diff --git a/.gitignore b/.gitignore index db8e29d903a..e1492c2cd73 100644 --- a/.gitignore +++ b/.gitignore @@ -26,6 +26,8 @@ rwc-report.html *.swp build.json *.actual +tests/webTestServer.js +tests/webTestServer.js.map tests/webhost/*.d.ts tests/webhost/webtsc.js tests/cases/**/*.js diff --git a/Jakefile.js b/Jakefile.js index a6570c3c710..1d017d5100f 100644 --- a/Jakefile.js +++ b/Jakefile.js @@ -165,18 +165,47 @@ var harnessSources = harnessCoreSources.concat([ return path.join(serverDirectory, f); })); -var librarySourceMap = [ - { target: "lib.core.d.ts", sources: ["header.d.ts", "core.d.ts"] }, - { target: "lib.dom.d.ts", sources: ["importcore.d.ts", "intl.d.ts", "dom.generated.d.ts"], }, - { target: "lib.webworker.d.ts", sources: ["importcore.d.ts", "intl.d.ts", "webworker.generated.d.ts"], }, - { target: "lib.scriptHost.d.ts", sources: ["importcore.d.ts", "scriptHost.d.ts"], }, - { target: "lib.d.ts", sources: ["header.d.ts", "core.d.ts", "intl.d.ts", "dom.generated.d.ts", "webworker.importscripts.d.ts", "scriptHost.d.ts"], }, - { target: "lib.core.es6.d.ts", sources: ["header.d.ts", "core.d.ts", "es6.d.ts"]}, - { target: "lib.es6.d.ts", sources: ["header.d.ts", "es6.d.ts", "core.d.ts", "intl.d.ts", "dom.generated.d.ts", "dom.es6.d.ts", "webworker.importscripts.d.ts", "scriptHost.d.ts"] }, - { target: "lib.core.es7.d.ts", sources: ["header.d.ts", "core.d.ts", "es6.d.ts", "es7.d.ts"]}, - { target: "lib.es7.d.ts", sources: ["header.d.ts", "es6.d.ts", "es7.d.ts", "core.d.ts", "intl.d.ts", "dom.generated.d.ts", "dom.es6.d.ts", "webworker.importscripts.d.ts", "scriptHost.d.ts"] } +var es2015LibrarySources = [ + "es2015.core.d.ts", + "es2015.collection.d.ts", + "es2015.generator.d.ts", + "es2015.iterable.d.ts", + "es2015.promise.d.ts", + "es2015.proxy.d.ts", + "es2015.reflect.d.ts", + "es2015.symbol.d.ts", + "es2015.symbol.wellknown.d.ts", ]; +var es2015LibrarySourceMap = es2015LibrarySources.map(function(source) { + return { target: "lib." + source, sources: ["header.d.ts", source] }; +}); + +var es2016LibrarySource = [ "es2016.array.include.d.ts" ]; + +var es2016LibrarySourceMap = es2016LibrarySource.map(function(source) { + return { target: "lib." + source, sources: ["header.d.ts", source] }; +}) + +var hostsLibrarySources = ["dom.generated.d.ts", "webworker.importscripts.d.ts", "scripthost.d.ts"] + +var librarySourceMap = [ + // Host library + { target: "lib.dom.d.ts", sources: ["header.d.ts", "dom.generated.d.ts"], }, + { target: "lib.dom.iterable.d.ts", sources: ["header.d.ts", "dom.iterable.d.ts"], }, + { target: "lib.webworker.d.ts", sources: ["header.d.ts", "webworker.generated.d.ts"], }, + { target: "lib.scripthost.d.ts", sources: ["header.d.ts", "scripthost.d.ts"], }, + + // JavaScript library + { target: "lib.es5.d.ts", sources: ["header.d.ts", "es5.d.ts"] }, + { target: "lib.es2015.d.ts", sources: ["header.d.ts", "es2015.d.ts"] }, + { target: "lib.es2016.d.ts", sources: ["header.d.ts", "es2016.d.ts"] }, + + // JavaScript + all host library + { target: "lib.d.ts", sources: ["header.d.ts", "es5.d.ts"].concat(hostsLibrarySources), }, + { target: "lib.es6.d.ts", sources: ["header.d.ts", "es5.d.ts"].concat(es2015LibrarySources, hostsLibrarySources), }, +].concat(es2015LibrarySourceMap, es2016LibrarySourceMap); + var libraryTargets = librarySourceMap.map(function (f) { return path.join(builtLocalDirectory, f.target); }); @@ -215,7 +244,7 @@ function concatenateFiles(destinationFile, sourceFiles) { } var useDebugMode = true; -var host = (process.env.host || process.env.TYPESCRIPT_HOST || "node"); +var host = (process.env.TYPESCRIPT_HOST || process.env.host || "node"); var compilerFilename = "tsc.js"; var LKGCompiler = path.join(LKGDirectory, compilerFilename); var builtLocalCompiler = path.join(builtLocalDirectory, compilerFilename); @@ -874,7 +903,6 @@ task("update-sublime", ["local", serverFile], function() { var tslintRuleDir = "scripts/tslint"; var tslintRules = ([ "nextLineRule", - "noNullRule", "preferConstRule", "booleanTriviaRule", "typeOperatorSpacingRule", diff --git a/lib/lib.core.es6.d.ts b/lib/lib.core.es6.d.ts deleted file mode 100644 index 4ccdd73c614..00000000000 --- a/lib/lib.core.es6.d.ts +++ /dev/null @@ -1,5255 +0,0 @@ -/*! ***************************************************************************** -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. -***************************************************************************** */ - -/// -///////////////////////////// -/// ECMAScript APIs -///////////////////////////// - -declare const NaN: number; -declare const Infinity: number; - -/** - * Evaluates JavaScript code and executes it. - * @param x A String value that contains valid JavaScript code. - */ -declare function eval(x: string): any; - -/** - * Converts A string to an integer. - * @param s A string to convert into a number. - * @param radix A value between 2 and 36 that specifies the base of the number in numString. - * If this argument is not supplied, strings with a prefix of '0x' are considered hexadecimal. - * All other strings are considered decimal. - */ -declare function parseInt(s: string, radix?: number): number; - -/** - * Converts a string to a floating-point number. - * @param string A string that contains a floating-point number. - */ -declare function parseFloat(string: string): number; - -/** - * Returns a Boolean value that indicates whether a value is the reserved value NaN (not a number). - * @param number A numeric value. - */ -declare function isNaN(number: number): boolean; - -/** - * Determines whether a supplied number is finite. - * @param number Any numeric value. - */ -declare function isFinite(number: number): boolean; - -/** - * Gets the unencoded version of an encoded Uniform Resource Identifier (URI). - * @param encodedURI A value representing an encoded URI. - */ -declare function decodeURI(encodedURI: string): string; - -/** - * Gets the unencoded version of an encoded component of a Uniform Resource Identifier (URI). - * @param encodedURIComponent A value representing an encoded URI component. - */ -declare function decodeURIComponent(encodedURIComponent: string): string; - -/** - * Encodes a text string as a valid Uniform Resource Identifier (URI) - * @param uri A value representing an encoded URI. - */ -declare function encodeURI(uri: string): string; - -/** - * Encodes a text string as a valid component of a Uniform Resource Identifier (URI). - * @param uriComponent A value representing an encoded URI component. - */ -declare function encodeURIComponent(uriComponent: string): string; - -interface PropertyDescriptor { - configurable?: boolean; - enumerable?: boolean; - value?: any; - writable?: boolean; - get? (): any; - set? (v: any): void; -} - -interface PropertyDescriptorMap { - [s: string]: PropertyDescriptor; -} - -interface Object { - /** The initial value of Object.prototype.constructor is the standard built-in Object constructor. */ - constructor: Function; - - /** Returns a string representation of an object. */ - toString(): string; - - /** Returns a date converted to a string using the current locale. */ - toLocaleString(): string; - - /** Returns the primitive value of the specified object. */ - valueOf(): Object; - - /** - * Determines whether an object has a property with the specified name. - * @param v A property name. - */ - hasOwnProperty(v: string): boolean; - - /** - * Determines whether an object exists in another object's prototype chain. - * @param v Another object whose prototype chain is to be checked. - */ - isPrototypeOf(v: Object): boolean; - - /** - * Determines whether a specified property is enumerable. - * @param v A property name. - */ - propertyIsEnumerable(v: string): boolean; -} - -interface ObjectConstructor { - new (value?: any): Object; - (): any; - (value: any): any; - - /** A reference to the prototype for a class of objects. */ - readonly prototype: Object; - - /** - * Returns the prototype of an object. - * @param o The object that references the prototype. - */ - getPrototypeOf(o: any): any; - - /** - * Gets the own property descriptor of the specified object. - * An own property descriptor is one that is defined directly on the object and is not inherited from the object's prototype. - * @param o Object that contains the property. - * @param p Name of the property. - */ - getOwnPropertyDescriptor(o: any, p: string): PropertyDescriptor; - - /** - * Returns the names of the own properties of an object. The own properties of an object are those that are defined directly - * on that object, and are not inherited from the object's prototype. The properties of an object include both fields (objects) and functions. - * @param o Object that contains the own properties. - */ - getOwnPropertyNames(o: any): string[]; - - /** - * Creates an object that has the specified prototype, and that optionally contains specified properties. - * @param o Object to use as a prototype. May be null - * @param properties JavaScript object that contains one or more property descriptors. - */ - create(o: any, properties?: PropertyDescriptorMap): any; - - /** - * Adds a property to an object, or modifies attributes of an existing property. - * @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. - * @param p The property name. - * @param attributes Descriptor for the property. It can be for a data property or an accessor property. - */ - defineProperty(o: any, p: string, attributes: PropertyDescriptor): any; - - /** - * Adds one or more properties to an object, and/or modifies attributes of existing properties. - * @param o Object on which to add or modify the properties. This can be a native JavaScript object or a DOM object. - * @param properties JavaScript object that contains one or more descriptor objects. Each descriptor object describes a data property or an accessor property. - */ - defineProperties(o: any, properties: PropertyDescriptorMap): any; - - /** - * Prevents the modification of attributes of existing properties, and prevents the addition of new properties. - * @param o Object on which to lock the attributes. - */ - seal(o: T): T; - - /** - * Prevents the modification of existing property attributes and values, and prevents the addition of new properties. - * @param o Object on which to lock the attributes. - */ - freeze(o: T): T; - - /** - * Prevents the addition of new properties to an object. - * @param o Object to make non-extensible. - */ - preventExtensions(o: T): T; - - /** - * Returns true if existing property attributes cannot be modified in an object and new properties cannot be added to the object. - * @param o Object to test. - */ - isSealed(o: any): boolean; - - /** - * Returns true if existing property attributes and values cannot be modified in an object, and new properties cannot be added to the object. - * @param o Object to test. - */ - isFrozen(o: any): boolean; - - /** - * Returns a value that indicates whether new properties can be added to an object. - * @param o Object to test. - */ - isExtensible(o: any): boolean; - - /** - * Returns the names of the enumerable properties and methods of an object. - * @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. - */ - keys(o: any): string[]; -} - -/** - * Provides functionality common to all JavaScript objects. - */ -declare const Object: ObjectConstructor; - -/** - * Creates a new function. - */ -interface Function { - /** - * Calls the function, substituting the specified object for the this value of the function, and the specified array for the arguments of the function. - * @param thisArg The object to be used as the this object. - * @param argArray A set of arguments to be passed to the function. - */ - apply(thisArg: any, argArray?: any): any; - - /** - * Calls a method of an object, substituting another object for the current object. - * @param thisArg The object to be used as the current object. - * @param argArray A list of arguments to be passed to the method. - */ - call(thisArg: any, ...argArray: any[]): any; - - /** - * For a given function, creates a bound function that has the same body as the original function. - * The this object of the bound function is associated with the specified object, and has the specified initial parameters. - * @param thisArg An object to which the this keyword can refer inside the new function. - * @param argArray A list of arguments to be passed to the new function. - */ - bind(thisArg: any, ...argArray: any[]): any; - - prototype: any; - readonly length: number; - - // Non-standard extensions - arguments: any; - caller: Function; -} - -interface FunctionConstructor { - /** - * Creates a new function. - * @param args A list of arguments the function accepts. - */ - new (...args: string[]): Function; - (...args: string[]): Function; - readonly prototype: Function; -} - -declare const Function: FunctionConstructor; - -interface IArguments { - [index: number]: any; - length: number; - callee: Function; -} - -interface String { - /** Returns a string representation of a string. */ - toString(): string; - - /** - * Returns the character at the specified index. - * @param pos The zero-based index of the desired character. - */ - charAt(pos: number): string; - - /** - * Returns the Unicode value of the character at the specified location. - * @param index The zero-based index of the desired character. If there is no character at the specified index, NaN is returned. - */ - charCodeAt(index: number): number; - - /** - * Returns a string that contains the concatenation of two or more strings. - * @param strings The strings to append to the end of the string. - */ - concat(...strings: string[]): string; - - /** - * Returns the position of the first occurrence of a substring. - * @param searchString The substring to search for in the string - * @param position The index at which to begin searching the String object. If omitted, search starts at the beginning of the string. - */ - indexOf(searchString: string, position?: number): number; - - /** - * Returns the last occurrence of a substring in the string. - * @param searchString The substring to search for. - * @param position The index at which to begin searching. If omitted, the search begins at the end of the string. - */ - lastIndexOf(searchString: string, position?: number): number; - - /** - * Determines whether two strings are equivalent in the current locale. - * @param that String to compare to target string - */ - localeCompare(that: string): number; - - /** - * Matches a string with a regular expression, and returns an array containing the results of that search. - * @param regexp A variable name or string literal containing the regular expression pattern and flags. - */ - match(regexp: string): RegExpMatchArray; - - /** - * Matches a string with a regular expression, and returns an array containing the results of that search. - * @param regexp A regular expression object that contains the regular expression pattern and applicable flags. - */ - match(regexp: RegExp): RegExpMatchArray; - - /** - * Replaces text in a string, using a regular expression or search string. - * @param searchValue A string that represents the regular expression. - * @param replaceValue A string containing the text to replace for every successful match of searchValue in this string. - */ - replace(searchValue: string, replaceValue: string): string; - - /** - * Replaces text in a string, using a regular expression or search string. - * @param searchValue A string that represents the regular expression. - * @param replacer A function that returns the replacement text. - */ - replace(searchValue: string, replacer: (substring: string, ...args: any[]) => string): string; - - /** - * Replaces text in a string, using a regular expression or search string. - * @param searchValue A Regular Expression object containing the regular expression pattern and applicable flags. - * @param replaceValue A string containing the text to replace for every successful match of searchValue in this string. - */ - replace(searchValue: RegExp, replaceValue: string): string; - - /** - * Replaces text in a string, using a regular expression or search string. - * @param searchValue A Regular Expression object containing the regular expression pattern and applicable flags - * @param replacer A function that returns the replacement text. - */ - replace(searchValue: RegExp, replacer: (substring: string, ...args: any[]) => string): string; - - /** - * Finds the first substring match in a regular expression search. - * @param regexp The regular expression pattern and applicable flags. - */ - search(regexp: string): number; - - /** - * Finds the first substring match in a regular expression search. - * @param regexp The regular expression pattern and applicable flags. - */ - search(regexp: RegExp): number; - - /** - * Returns a section of a string. - * @param start The index to the beginning of the specified portion of stringObj. - * @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. - * If this value is not specified, the substring continues to the end of stringObj. - */ - slice(start?: number, end?: number): string; - - /** - * Split a string into substrings using the specified separator and return them as an array. - * @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. - * @param limit A value used to limit the number of elements returned in the array. - */ - split(separator: string, limit?: number): string[]; - - /** - * Split a string into substrings using the specified separator and return them as an array. - * @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. - * @param limit A value used to limit the number of elements returned in the array. - */ - split(separator: RegExp, limit?: number): string[]; - - /** - * Returns the substring at the specified location within a String object. - * @param start The zero-based index number indicating the beginning of the substring. - * @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. - * If end is omitted, the characters from start through the end of the original string are returned. - */ - substring(start: number, end?: number): string; - - /** Converts all the alphabetic characters in a string to lowercase. */ - toLowerCase(): string; - - /** Converts all alphabetic characters to lowercase, taking into account the host environment's current locale. */ - toLocaleLowerCase(): string; - - /** Converts all the alphabetic characters in a string to uppercase. */ - toUpperCase(): string; - - /** Returns a string where all alphabetic characters have been converted to uppercase, taking into account the host environment's current locale. */ - toLocaleUpperCase(): string; - - /** Removes the leading and trailing white space and line terminator characters from a string. */ - trim(): string; - - /** Returns the length of a String object. */ - readonly length: number; - - // IE extensions - /** - * Gets a substring beginning at the specified location and having the specified length. - * @param from The starting position of the desired substring. The index of the first character in the string is zero. - * @param length The number of characters to include in the returned substring. - */ - substr(from: number, length?: number): string; - - /** Returns the primitive value of the specified object. */ - valueOf(): string; - - readonly [index: number]: string; -} - -interface StringConstructor { - new (value?: any): String; - (value?: any): string; - readonly prototype: String; - fromCharCode(...codes: number[]): string; -} - -/** - * Allows manipulation and formatting of text strings and determination and location of substrings within strings. - */ -declare const String: StringConstructor; - -interface Boolean { - /** Returns the primitive value of the specified object. */ - valueOf(): boolean; -} - -interface BooleanConstructor { - new (value?: any): Boolean; - (value?: any): boolean; - readonly prototype: Boolean; -} - -declare const Boolean: BooleanConstructor; - -interface Number { - /** - * Returns a string representation of an object. - * @param radix Specifies a radix for converting numeric values to strings. This value is only used for numbers. - */ - toString(radix?: number): string; - - /** - * Returns a string representing a number in fixed-point notation. - * @param fractionDigits Number of digits after the decimal point. Must be in the range 0 - 20, inclusive. - */ - toFixed(fractionDigits?: number): string; - - /** - * Returns a string containing a number represented in exponential notation. - * @param fractionDigits Number of digits after the decimal point. Must be in the range 0 - 20, inclusive. - */ - toExponential(fractionDigits?: number): string; - - /** - * Returns a string containing a number represented either in exponential or fixed-point notation with a specified number of digits. - * @param precision Number of significant digits. Must be in the range 1 - 21, inclusive. - */ - toPrecision(precision?: number): string; - - /** Returns the primitive value of the specified object. */ - valueOf(): number; -} - -interface NumberConstructor { - new (value?: any): Number; - (value?: any): number; - readonly prototype: Number; - - /** The largest number that can be represented in JavaScript. Equal to approximately 1.79E+308. */ - readonly MAX_VALUE: number; - - /** The closest number to zero that can be represented in JavaScript. Equal to approximately 5.00E-324. */ - readonly MIN_VALUE: number; - - /** - * A value that is not a number. - * In equality comparisons, NaN does not equal any value, including itself. To test whether a value is equivalent to NaN, use the isNaN function. - */ - readonly NaN: number; - - /** - * A value that is less than the largest negative number that can be represented in JavaScript. - * JavaScript displays NEGATIVE_INFINITY values as -infinity. - */ - readonly NEGATIVE_INFINITY: number; - - /** - * A value greater than the largest number that can be represented in JavaScript. - * JavaScript displays POSITIVE_INFINITY values as infinity. - */ - readonly POSITIVE_INFINITY: number; -} - -/** An object that represents a number of any kind. All JavaScript numbers are 64-bit floating-point numbers. */ -declare const Number: NumberConstructor; - -interface TemplateStringsArray extends Array { - readonly raw: string[]; -} - -interface Math { - /** The mathematical constant e. This is Euler's number, the base of natural logarithms. */ - readonly E: number; - /** The natural logarithm of 10. */ - readonly LN10: number; - /** The natural logarithm of 2. */ - readonly LN2: number; - /** The base-2 logarithm of e. */ - readonly LOG2E: number; - /** The base-10 logarithm of e. */ - readonly LOG10E: number; - /** Pi. This is the ratio of the circumference of a circle to its diameter. */ - readonly PI: number; - /** The square root of 0.5, or, equivalently, one divided by the square root of 2. */ - readonly SQRT1_2: number; - /** The square root of 2. */ - readonly SQRT2: number; - /** - * Returns the absolute value of a number (the value without regard to whether it is positive or negative). - * For example, the absolute value of -5 is the same as the absolute value of 5. - * @param x A numeric expression for which the absolute value is needed. - */ - abs(x: number): number; - /** - * Returns the arc cosine (or inverse cosine) of a number. - * @param x A numeric expression. - */ - acos(x: number): number; - /** - * Returns the arcsine of a number. - * @param x A numeric expression. - */ - asin(x: number): number; - /** - * Returns the arctangent of a number. - * @param x A numeric expression for which the arctangent is needed. - */ - atan(x: number): number; - /** - * Returns the angle (in radians) from the X axis to a point. - * @param y A numeric expression representing the cartesian y-coordinate. - * @param x A numeric expression representing the cartesian x-coordinate. - */ - atan2(y: number, x: number): number; - /** - * Returns the smallest number greater than or equal to its numeric argument. - * @param x A numeric expression. - */ - ceil(x: number): number; - /** - * Returns the cosine of a number. - * @param x A numeric expression that contains an angle measured in radians. - */ - cos(x: number): number; - /** - * Returns e (the base of natural logarithms) raised to a power. - * @param x A numeric expression representing the power of e. - */ - exp(x: number): number; - /** - * Returns the greatest number less than or equal to its numeric argument. - * @param x A numeric expression. - */ - floor(x: number): number; - /** - * Returns the natural logarithm (base e) of a number. - * @param x A numeric expression. - */ - log(x: number): number; - /** - * Returns the larger of a set of supplied numeric expressions. - * @param values Numeric expressions to be evaluated. - */ - max(...values: number[]): number; - /** - * Returns the smaller of a set of supplied numeric expressions. - * @param values Numeric expressions to be evaluated. - */ - min(...values: number[]): number; - /** - * Returns the value of a base expression taken to a specified power. - * @param x The base value of the expression. - * @param y The exponent value of the expression. - */ - pow(x: number, y: number): number; - /** Returns a pseudorandom number between 0 and 1. */ - random(): number; - /** - * Returns a supplied numeric expression rounded to the nearest number. - * @param x The value to be rounded to the nearest number. - */ - round(x: number): number; - /** - * Returns the sine of a number. - * @param x A numeric expression that contains an angle measured in radians. - */ - sin(x: number): number; - /** - * Returns the square root of a number. - * @param x A numeric expression. - */ - sqrt(x: number): number; - /** - * Returns the tangent of a number. - * @param x A numeric expression that contains an angle measured in radians. - */ - tan(x: number): number; -} -/** An intrinsic object that provides basic mathematics functionality and constants. */ -declare const Math: Math; - -/** Enables basic storage and retrieval of dates and times. */ -interface Date { - /** Returns a string representation of a date. The format of the string depends on the locale. */ - toString(): string; - /** Returns a date as a string value. */ - toDateString(): string; - /** Returns a time as a string value. */ - toTimeString(): string; - /** Returns a value as a string value appropriate to the host environment's current locale. */ - toLocaleString(): string; - /** Returns a date as a string value appropriate to the host environment's current locale. */ - toLocaleDateString(): string; - /** Returns a time as a string value appropriate to the host environment's current locale. */ - toLocaleTimeString(): string; - /** Returns the stored time value in milliseconds since midnight, January 1, 1970 UTC. */ - valueOf(): number; - /** Gets the time value in milliseconds. */ - getTime(): number; - /** Gets the year, using local time. */ - getFullYear(): number; - /** Gets the year using Universal Coordinated Time (UTC). */ - getUTCFullYear(): number; - /** Gets the month, using local time. */ - getMonth(): number; - /** Gets the month of a Date object using Universal Coordinated Time (UTC). */ - getUTCMonth(): number; - /** Gets the day-of-the-month, using local time. */ - getDate(): number; - /** Gets the day-of-the-month, using Universal Coordinated Time (UTC). */ - getUTCDate(): number; - /** Gets the day of the week, using local time. */ - getDay(): number; - /** Gets the day of the week using Universal Coordinated Time (UTC). */ - getUTCDay(): number; - /** Gets the hours in a date, using local time. */ - getHours(): number; - /** Gets the hours value in a Date object using Universal Coordinated Time (UTC). */ - getUTCHours(): number; - /** Gets the minutes of a Date object, using local time. */ - getMinutes(): number; - /** Gets the minutes of a Date object using Universal Coordinated Time (UTC). */ - getUTCMinutes(): number; - /** Gets the seconds of a Date object, using local time. */ - getSeconds(): number; - /** Gets the seconds of a Date object using Universal Coordinated Time (UTC). */ - getUTCSeconds(): number; - /** Gets the milliseconds of a Date, using local time. */ - getMilliseconds(): number; - /** Gets the milliseconds of a Date object using Universal Coordinated Time (UTC). */ - getUTCMilliseconds(): number; - /** Gets the difference in minutes between the time on the local computer and Universal Coordinated Time (UTC). */ - getTimezoneOffset(): number; - /** - * Sets the date and time value in the Date object. - * @param time A numeric value representing the number of elapsed milliseconds since midnight, January 1, 1970 GMT. - */ - setTime(time: number): number; - /** - * Sets the milliseconds value in the Date object using local time. - * @param ms A numeric value equal to the millisecond value. - */ - setMilliseconds(ms: number): number; - /** - * Sets the milliseconds value in the Date object using Universal Coordinated Time (UTC). - * @param ms A numeric value equal to the millisecond value. - */ - setUTCMilliseconds(ms: number): number; - - /** - * Sets the seconds value in the Date object using local time. - * @param sec A numeric value equal to the seconds value. - * @param ms A numeric value equal to the milliseconds value. - */ - setSeconds(sec: number, ms?: number): number; - /** - * Sets the seconds value in the Date object using Universal Coordinated Time (UTC). - * @param sec A numeric value equal to the seconds value. - * @param ms A numeric value equal to the milliseconds value. - */ - setUTCSeconds(sec: number, ms?: number): number; - /** - * Sets the minutes value in the Date object using local time. - * @param min A numeric value equal to the minutes value. - * @param sec A numeric value equal to the seconds value. - * @param ms A numeric value equal to the milliseconds value. - */ - setMinutes(min: number, sec?: number, ms?: number): number; - /** - * Sets the minutes value in the Date object using Universal Coordinated Time (UTC). - * @param min A numeric value equal to the minutes value. - * @param sec A numeric value equal to the seconds value. - * @param ms A numeric value equal to the milliseconds value. - */ - setUTCMinutes(min: number, sec?: number, ms?: number): number; - /** - * Sets the hour value in the Date object using local time. - * @param hours A numeric value equal to the hours value. - * @param min A numeric value equal to the minutes value. - * @param sec A numeric value equal to the seconds value. - * @param ms A numeric value equal to the milliseconds value. - */ - setHours(hours: number, min?: number, sec?: number, ms?: number): number; - /** - * Sets the hours value in the Date object using Universal Coordinated Time (UTC). - * @param hours A numeric value equal to the hours value. - * @param min A numeric value equal to the minutes value. - * @param sec A numeric value equal to the seconds value. - * @param ms A numeric value equal to the milliseconds value. - */ - setUTCHours(hours: number, min?: number, sec?: number, ms?: number): number; - /** - * Sets the numeric day-of-the-month value of the Date object using local time. - * @param date A numeric value equal to the day of the month. - */ - setDate(date: number): number; - /** - * Sets the numeric day of the month in the Date object using Universal Coordinated Time (UTC). - * @param date A numeric value equal to the day of the month. - */ - setUTCDate(date: number): number; - /** - * Sets the month value in the Date object using local time. - * @param month A numeric value equal to the month. The value for January is 0, and other month values follow consecutively. - * @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. - */ - setMonth(month: number, date?: number): number; - /** - * Sets the month value in the Date object using Universal Coordinated Time (UTC). - * @param month A numeric value equal to the month. The value for January is 0, and other month values follow consecutively. - * @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. - */ - setUTCMonth(month: number, date?: number): number; - /** - * Sets the year of the Date object using local time. - * @param year A numeric value for the year. - * @param month A zero-based numeric value for the month (0 for January, 11 for December). Must be specified if numDate is specified. - * @param date A numeric value equal for the day of the month. - */ - setFullYear(year: number, month?: number, date?: number): number; - /** - * Sets the year value in the Date object using Universal Coordinated Time (UTC). - * @param year A numeric value equal to the year. - * @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. - * @param date A numeric value equal to the day of the month. - */ - setUTCFullYear(year: number, month?: number, date?: number): number; - /** Returns a date converted to a string using Universal Coordinated Time (UTC). */ - toUTCString(): string; - /** Returns a date as a string value in ISO format. */ - toISOString(): string; - /** Used by the JSON.stringify method to enable the transformation of an object's data for JavaScript Object Notation (JSON) serialization. */ - toJSON(key?: any): string; -} - -interface DateConstructor { - new (): Date; - new (value: number): Date; - new (value: string): Date; - new (year: number, month: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): Date; - (): string; - readonly prototype: Date; - /** - * Parses a string containing a date, and returns the number of milliseconds between that date and midnight, January 1, 1970. - * @param s A date string - */ - parse(s: string): number; - /** - * Returns the number of milliseconds between midnight, January 1, 1970 Universal Coordinated Time (UTC) (or GMT) and the specified date. - * @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. - * @param month The month as an number between 0 and 11 (January to December). - * @param date The date as an number between 1 and 31. - * @param hours Must be supplied if minutes is supplied. An number from 0 to 23 (midnight to 11pm) that specifies the hour. - * @param minutes Must be supplied if seconds is supplied. An number from 0 to 59 that specifies the minutes. - * @param seconds Must be supplied if milliseconds is supplied. An number from 0 to 59 that specifies the seconds. - * @param ms An number from 0 to 999 that specifies the milliseconds. - */ - UTC(year: number, month: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): number; - now(): number; -} - -declare const Date: DateConstructor; - -interface RegExpMatchArray extends Array { - index?: number; - input?: string; -} - -interface RegExpExecArray extends Array { - index: number; - input: string; -} - -interface RegExp { - /** - * Executes a search on a string using a regular expression pattern, and returns an array containing the results of that search. - * @param string The String object or string literal on which to perform the search. - */ - exec(string: string): RegExpExecArray; - - /** - * Returns a Boolean value that indicates whether or not a pattern exists in a searched string. - * @param string String on which to perform the search. - */ - test(string: string): boolean; - - /** 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. */ - readonly source: string; - - /** Returns a Boolean value indicating the state of the global flag (g) used with a regular expression. Default is false. Read-only. */ - readonly global: boolean; - - /** Returns a Boolean value indicating the state of the ignoreCase flag (i) used with a regular expression. Default is false. Read-only. */ - readonly ignoreCase: boolean; - - /** Returns a Boolean value indicating the state of the multiline flag (m) used with a regular expression. Default is false. Read-only. */ - readonly multiline: boolean; - - lastIndex: number; - - // Non-standard extensions - compile(): RegExp; -} - -interface RegExpConstructor { - new (pattern: string, flags?: string): RegExp; - (pattern: string, flags?: string): RegExp; - readonly prototype: RegExp; - - // Non-standard extensions - $1: string; - $2: string; - $3: string; - $4: string; - $5: string; - $6: string; - $7: string; - $8: string; - $9: string; - lastMatch: string; -} - -declare const RegExp: RegExpConstructor; - -interface Error { - name: string; - message: string; -} - -interface ErrorConstructor { - new (message?: string): Error; - (message?: string): Error; - readonly prototype: Error; -} - -declare const Error: ErrorConstructor; - -interface EvalError extends Error { -} - -interface EvalErrorConstructor { - new (message?: string): EvalError; - (message?: string): EvalError; - readonly prototype: EvalError; -} - -declare const EvalError: EvalErrorConstructor; - -interface RangeError extends Error { -} - -interface RangeErrorConstructor { - new (message?: string): RangeError; - (message?: string): RangeError; - readonly prototype: RangeError; -} - -declare const RangeError: RangeErrorConstructor; - -interface ReferenceError extends Error { -} - -interface ReferenceErrorConstructor { - new (message?: string): ReferenceError; - (message?: string): ReferenceError; - readonly prototype: ReferenceError; -} - -declare const ReferenceError: ReferenceErrorConstructor; - -interface SyntaxError extends Error { -} - -interface SyntaxErrorConstructor { - new (message?: string): SyntaxError; - (message?: string): SyntaxError; - readonly prototype: SyntaxError; -} - -declare const SyntaxError: SyntaxErrorConstructor; - -interface TypeError extends Error { -} - -interface TypeErrorConstructor { - new (message?: string): TypeError; - (message?: string): TypeError; - readonly prototype: TypeError; -} - -declare const TypeError: TypeErrorConstructor; - -interface URIError extends Error { -} - -interface URIErrorConstructor { - new (message?: string): URIError; - (message?: string): URIError; - readonly prototype: URIError; -} - -declare const URIError: URIErrorConstructor; - -interface JSON { - /** - * Converts a JavaScript Object Notation (JSON) string into an object. - * @param text A valid JSON string. - * @param reviver A function that transforms the results. This function is called for each member of the object. - * If a member contains nested objects, the nested objects are transformed before the parent object is. - */ - parse(text: string, reviver?: (key: any, value: any) => any): any; - /** - * Converts a JavaScript value to a JavaScript Object Notation (JSON) string. - * @param value A JavaScript value, usually an object or array, to be converted. - */ - stringify(value: any): string; - /** - * Converts a JavaScript value to a JavaScript Object Notation (JSON) string. - * @param value A JavaScript value, usually an object or array, to be converted. - * @param replacer A function that transforms the results. - */ - stringify(value: any, replacer: (key: string, value: any) => any): string; - /** - * Converts a JavaScript value to a JavaScript Object Notation (JSON) string. - * @param value A JavaScript value, usually an object or array, to be converted. - * @param replacer Array that transforms the results. - */ - stringify(value: any, replacer: any[]): string; - /** - * Converts a JavaScript value to a JavaScript Object Notation (JSON) string. - * @param value A JavaScript value, usually an object or array, to be converted. - * @param replacer A function that transforms the results. - * @param space Adds indentation, white space, and line break characters to the return-value JSON text to make it easier to read. - */ - stringify(value: any, replacer: (key: string, value: any) => any, space: string | number): string; - /** - * Converts a JavaScript value to a JavaScript Object Notation (JSON) string. - * @param value A JavaScript value, usually an object or array, to be converted. - * @param replacer Array that transforms the results. - * @param space Adds indentation, white space, and line break characters to the return-value JSON text to make it easier to read. - */ - stringify(value: any, replacer: any[], space: string | number): string; -} -/** - * An intrinsic object that provides functions to convert JavaScript values to and from the JavaScript Object Notation (JSON) format. - */ -declare const JSON: JSON; - - -///////////////////////////// -/// ECMAScript Array API (specially handled by compiler) -///////////////////////////// - -interface ReadonlyArray { - /** - * Gets the length of the array. This is a number one higher than the highest element defined in an array. - */ - readonly length: number; - /** - * Returns a string representation of an array. - */ - toString(): string; - toLocaleString(): string; - /** - * Combines two or more arrays. - * @param items Additional items to add to the end of array1. - */ - concat>(...items: U[]): T[]; - /** - * Combines two or more arrays. - * @param items Additional items to add to the end of array1. - */ - concat(...items: T[]): T[]; - /** - * Adds all the elements of an array separated by the specified separator string. - * @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. - */ - join(separator?: string): string; - /** - * Returns a section of an array. - * @param start The beginning of the specified portion of the array. - * @param end The end of the specified portion of the array. - */ - slice(start?: number, end?: number): T[]; - /** - * Returns the index of the first occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the search starts at index 0. - */ - indexOf(searchElement: T, fromIndex?: number): number; - - /** - * Returns the index of the last occurrence of a specified value in an array. - * @param searchElement The value to locate in the array. - * @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. - */ - lastIndexOf(searchElement: T, fromIndex?: number): number; - /** - * Determines whether all the members of an array satisfy the specified test. - * @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. - * @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. - */ - every(callbackfn: (value: T, index: number, array: ReadonlyArray) => boolean, thisArg?: any): boolean; - /** - * Determines whether the specified callback function returns true for any element of an array. - * @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. - * @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. - */ - some(callbackfn: (value: T, index: number, array: ReadonlyArray) => boolean, thisArg?: any): boolean; - /** - * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the callbackfn function one time for each element in the array. - * @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. - */ - forEach(callbackfn: (value: T, index: number, array: ReadonlyArray) => void, thisArg?: any): void; - /** - * Calls a defined callback function on each element of an array, and returns an array that contains the results. - * @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. - * @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. - */ - map(callbackfn: (value: T, index: number, array: ReadonlyArray) => U, thisArg?: any): U[]; - /** - * Returns the elements of an array that meet the condition specified in a callback function. - * @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. - * @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. - */ - filter(callbackfn: (value: T, index: number, array: ReadonlyArray) => boolean, thisArg?: any): T[]; - /** - * 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. - * @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. - * @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. - */ - reduce(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: ReadonlyArray) => T, initialValue?: T): T; - /** - * 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. - * @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. - * @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. - */ - reduce(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: ReadonlyArray) => U, initialValue: U): U; - /** - * 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. - * @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. - * @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. - */ - reduceRight(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: ReadonlyArray) => T, initialValue?: T): T; - /** - * 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. - * @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. - * @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. - */ - reduceRight(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: ReadonlyArray) => U, initialValue: U): U; - - readonly [n: number]: T; -} - -interface Array { - /** - * Gets or sets the length of the array. This is a number one higher than the highest element defined in an array. - */ - length: number; - /** - * Returns a string representation of an array. - */ - toString(): string; - toLocaleString(): string; - /** - * Appends new elements to an array, and returns the new length of the array. - * @param items New elements of the Array. - */ - push(...items: T[]): number; - /** - * Removes the last element from an array and returns it. - */ - pop(): T; - /** - * Combines two or more arrays. - * @param items Additional items to add to the end of array1. - */ - concat(...items: (T | T[])[]): T[]; - /** - * Adds all the elements of an array separated by the specified separator string. - * @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. - */ - join(separator?: string): string; - /** - * Reverses the elements in an Array. - */ - reverse(): T[]; - /** - * Removes the first element from an array and returns it. - */ - shift(): T; - /** - * Returns a section of an array. - * @param start The beginning of the specified portion of the array. - * @param end The end of the specified portion of the array. - */ - slice(start?: number, end?: number): T[]; - /** - * Sorts an array. - * @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. - */ - sort(compareFn?: (a: T, b: T) => number): T[]; - /** - * Removes elements from an array and, if necessary, inserts new elements in their place, returning the deleted elements. - * @param start The zero-based location in the array from which to start removing elements. - */ - splice(start: number): T[]; - /** - * Removes elements from an array and, if necessary, inserts new elements in their place, returning the deleted elements. - * @param start The zero-based location in the array from which to start removing elements. - * @param deleteCount The number of elements to remove. - * @param items Elements to insert into the array in place of the deleted elements. - */ - splice(start: number, deleteCount: number, ...items: T[]): T[]; - /** - * Inserts new elements at the start of an array. - * @param items Elements to insert at the start of the Array. - */ - unshift(...items: T[]): number; - /** - * Returns the index of the first occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the search starts at index 0. - */ - indexOf(searchElement: T, fromIndex?: number): number; - /** - * Returns the index of the last occurrence of a specified value in an array. - * @param searchElement The value to locate in the array. - * @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. - */ - lastIndexOf(searchElement: T, fromIndex?: number): number; - /** - * Determines whether all the members of an array satisfy the specified test. - * @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. - * @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. - */ - every(callbackfn: (value: T, index: number, array: T[]) => boolean, thisArg?: any): boolean; - /** - * Determines whether the specified callback function returns true for any element of an array. - * @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. - * @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. - */ - some(callbackfn: (value: T, index: number, array: T[]) => boolean, thisArg?: any): boolean; - /** - * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the callbackfn function one time for each element in the array. - * @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. - */ - forEach(callbackfn: (value: T, index: number, array: T[]) => void, thisArg?: any): void; - /** - * Calls a defined callback function on each element of an array, and returns an array that contains the results. - * @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. - * @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. - */ - map(callbackfn: (value: T, index: number, array: T[]) => U, thisArg?: any): U[]; - /** - * Returns the elements of an array that meet the condition specified in a callback function. - * @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. - * @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. - */ - filter(callbackfn: (value: T, index: number, array: T[]) => boolean, thisArg?: any): T[]; - /** - * 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. - * @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. - * @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. - */ - reduce(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T, initialValue?: T): T; - /** - * 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. - * @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. - * @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. - */ - reduce(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: T[]) => U, initialValue: U): U; - /** - * 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. - * @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. - * @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. - */ - reduceRight(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T, initialValue?: T): T; - /** - * 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. - * @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. - * @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. - */ - reduceRight(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: T[]) => U, initialValue: U): U; - - [n: number]: T; -} - -interface ArrayConstructor { - new (arrayLength?: number): any[]; - new (arrayLength: number): T[]; - new (...items: T[]): T[]; - (arrayLength?: number): any[]; - (arrayLength: number): T[]; - (...items: T[]): T[]; - isArray(arg: any): arg is Array; - readonly prototype: Array; -} - -declare const Array: ArrayConstructor; - -interface TypedPropertyDescriptor { - enumerable?: boolean; - configurable?: boolean; - writable?: boolean; - value?: T; - get?: () => T; - set?: (value: T) => void; -} - -declare type ClassDecorator = (target: TFunction) => TFunction | void; -declare type PropertyDecorator = (target: Object, propertyKey: string | symbol) => void; -declare type MethodDecorator = (target: Object, propertyKey: string | symbol, descriptor: TypedPropertyDescriptor) => TypedPropertyDescriptor | void; -declare type ParameterDecorator = (target: Object, propertyKey: string | symbol, parameterIndex: number) => void; - -declare type PromiseConstructorLike = new (executor: (resolve: (value?: T | PromiseLike) => void, reject: (reason?: any) => void) => void) => PromiseLike; - -interface PromiseLike { - /** - * Attaches callbacks for the resolution and/or rejection of the Promise. - * @param onfulfilled The callback to execute when the Promise is resolved. - * @param onrejected The callback to execute when the Promise is rejected. - * @returns A Promise for the completion of which ever callback is executed. - */ - then(onfulfilled?: (value: T) => TResult | PromiseLike, onrejected?: (reason: any) => TResult | PromiseLike): PromiseLike; - then(onfulfilled?: (value: T) => TResult | PromiseLike, onrejected?: (reason: any) => void): PromiseLike; -} - -interface ArrayLike { - readonly length: number; - readonly [n: number]: T; -} - -/** - * Represents a raw buffer of binary data, which is used to store data for the - * different typed arrays. ArrayBuffers cannot be read from or written to directly, - * but can be passed to a typed array or DataView Object to interpret the raw - * buffer as needed. - */ -interface ArrayBuffer { - /** - * Read-only. The length of the ArrayBuffer (in bytes). - */ - readonly byteLength: number; - - /** - * Returns a section of an ArrayBuffer. - */ - slice(begin:number, end?:number): ArrayBuffer; -} - -interface ArrayBufferConstructor { - readonly prototype: ArrayBuffer; - new (byteLength: number): ArrayBuffer; - isView(arg: any): arg is ArrayBufferView; -} -declare const ArrayBuffer: ArrayBufferConstructor; - -interface ArrayBufferView { - /** - * The ArrayBuffer instance referenced by the array. - */ - buffer: ArrayBuffer; - - /** - * The length in bytes of the array. - */ - byteLength: number; - - /** - * The offset in bytes of the array. - */ - byteOffset: number; -} - -interface DataView { - readonly buffer: ArrayBuffer; - readonly byteLength: number; - readonly byteOffset: number; - /** - * Gets the Float32 value at the specified byte offset from the start of the view. There is - * no alignment constraint; multi-byte values may be fetched from any offset. - * @param byteOffset The place in the buffer at which the value should be retrieved. - */ - getFloat32(byteOffset: number, littleEndian?: boolean): number; - - /** - * Gets the Float64 value at the specified byte offset from the start of the view. There is - * no alignment constraint; multi-byte values may be fetched from any offset. - * @param byteOffset The place in the buffer at which the value should be retrieved. - */ - getFloat64(byteOffset: number, littleEndian?: boolean): number; - - /** - * Gets the Int8 value at the specified byte offset from the start of the view. There is - * no alignment constraint; multi-byte values may be fetched from any offset. - * @param byteOffset The place in the buffer at which the value should be retrieved. - */ - getInt8(byteOffset: number): number; - - /** - * Gets the Int16 value at the specified byte offset from the start of the view. There is - * no alignment constraint; multi-byte values may be fetched from any offset. - * @param byteOffset The place in the buffer at which the value should be retrieved. - */ - getInt16(byteOffset: number, littleEndian?: boolean): number; - /** - * Gets the Int32 value at the specified byte offset from the start of the view. There is - * no alignment constraint; multi-byte values may be fetched from any offset. - * @param byteOffset The place in the buffer at which the value should be retrieved. - */ - getInt32(byteOffset: number, littleEndian?: boolean): number; - - /** - * Gets the Uint8 value at the specified byte offset from the start of the view. There is - * no alignment constraint; multi-byte values may be fetched from any offset. - * @param byteOffset The place in the buffer at which the value should be retrieved. - */ - getUint8(byteOffset: number): number; - - /** - * Gets the Uint16 value at the specified byte offset from the start of the view. There is - * no alignment constraint; multi-byte values may be fetched from any offset. - * @param byteOffset The place in the buffer at which the value should be retrieved. - */ - getUint16(byteOffset: number, littleEndian?: boolean): number; - - /** - * Gets the Uint32 value at the specified byte offset from the start of the view. There is - * no alignment constraint; multi-byte values may be fetched from any offset. - * @param byteOffset The place in the buffer at which the value should be retrieved. - */ - getUint32(byteOffset: number, littleEndian?: boolean): number; - - /** - * Stores an Float32 value at the specified byte offset from the start of the view. - * @param byteOffset The place in the buffer at which the value should be set. - * @param value The value to set. - * @param littleEndian If false or undefined, a big-endian value should be written, - * otherwise a little-endian value should be written. - */ - setFloat32(byteOffset: number, value: number, littleEndian?: boolean): void; - - /** - * Stores an Float64 value at the specified byte offset from the start of the view. - * @param byteOffset The place in the buffer at which the value should be set. - * @param value The value to set. - * @param littleEndian If false or undefined, a big-endian value should be written, - * otherwise a little-endian value should be written. - */ - setFloat64(byteOffset: number, value: number, littleEndian?: boolean): void; - - /** - * Stores an Int8 value at the specified byte offset from the start of the view. - * @param byteOffset The place in the buffer at which the value should be set. - * @param value The value to set. - */ - setInt8(byteOffset: number, value: number): void; - - /** - * Stores an Int16 value at the specified byte offset from the start of the view. - * @param byteOffset The place in the buffer at which the value should be set. - * @param value The value to set. - * @param littleEndian If false or undefined, a big-endian value should be written, - * otherwise a little-endian value should be written. - */ - setInt16(byteOffset: number, value: number, littleEndian?: boolean): void; - - /** - * Stores an Int32 value at the specified byte offset from the start of the view. - * @param byteOffset The place in the buffer at which the value should be set. - * @param value The value to set. - * @param littleEndian If false or undefined, a big-endian value should be written, - * otherwise a little-endian value should be written. - */ - setInt32(byteOffset: number, value: number, littleEndian?: boolean): void; - - /** - * Stores an Uint8 value at the specified byte offset from the start of the view. - * @param byteOffset The place in the buffer at which the value should be set. - * @param value The value to set. - */ - setUint8(byteOffset: number, value: number): void; - - /** - * Stores an Uint16 value at the specified byte offset from the start of the view. - * @param byteOffset The place in the buffer at which the value should be set. - * @param value The value to set. - * @param littleEndian If false or undefined, a big-endian value should be written, - * otherwise a little-endian value should be written. - */ - setUint16(byteOffset: number, value: number, littleEndian?: boolean): void; - - /** - * Stores an Uint32 value at the specified byte offset from the start of the view. - * @param byteOffset The place in the buffer at which the value should be set. - * @param value The value to set. - * @param littleEndian If false or undefined, a big-endian value should be written, - * otherwise a little-endian value should be written. - */ - setUint32(byteOffset: number, value: number, littleEndian?: boolean): void; -} - -interface DataViewConstructor { - new (buffer: ArrayBuffer, byteOffset?: number, byteLength?: number): DataView; -} -declare const DataView: DataViewConstructor; - -/** - * A typed array of 8-bit integer values. The contents are initialized to 0. If the requested - * number of bytes could not be allocated an exception is raised. - */ -interface Int8Array { - /** - * The size in bytes of each element in the array. - */ - readonly BYTES_PER_ELEMENT: number; - - /** - * The ArrayBuffer instance referenced by the array. - */ - readonly buffer: ArrayBuffer; - - /** - * The length in bytes of the array. - */ - readonly byteLength: number; - - /** - * The offset in bytes of the array. - */ - readonly byteOffset: number; - - /** - * Returns the this object after copying a section of the array identified by start and end - * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it - * is treated as length+end. - * @param end If not specified, length of the this object is used as its default value. - */ - copyWithin(target: number, start: number, end?: number): Int8Array; - - /** - * Determines whether all the members of an array satisfy the specified test. - * @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. - * @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. - */ - every(callbackfn: (value: number, index: number, array: Int8Array) => boolean, thisArg?: any): boolean; - - /** - * Returns the this object after filling the section identified by start and end with value - * @param value value to fill array section with - * @param start index to start filling the array at. If start is negative, it is treated as - * length+start where length is the length of the array. - * @param end index to stop filling the array at. If end is negative, it is treated as - * length+end. - */ - fill(value: number, start?: number, end?: number): Int8Array; - - /** - * Returns the elements of an array that meet the condition specified in a callback function. - * @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. - * @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. - */ - filter(callbackfn: (value: number, index: number, array: Int8Array) => boolean, thisArg?: any): Int8Array; - - /** - * Returns the value of the first element in the array where predicate is true, and undefined - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; - - /** - * Returns the index of the first element in the array where predicate is true, and undefined - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - findIndex(predicate: (value: number) => boolean, thisArg?: any): number; - - /** - * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the - * callbackfn function one time for each element in the array. - * @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. - */ - forEach(callbackfn: (value: number, index: number, array: Int8Array) => void, thisArg?: any): void; - - /** - * Returns the index of the first occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - indexOf(searchElement: number, fromIndex?: number): number; - - /** - * Adds all the elements of an array separated by the specified separator string. - * @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. - */ - join(separator?: string): string; - - /** - * Returns the index of the last occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - lastIndexOf(searchElement: number, fromIndex?: number): number; - - /** - * The length of the array. - */ - readonly length: number; - - /** - * Calls a defined callback function on each element of an array, and returns an array that - * contains the results. - * @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. - * @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. - */ - map(callbackfn: (value: number, index: number, array: Int8Array) => number, thisArg?: any): Int8Array; - - /** - * 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. - * @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. - * @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. - */ - reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int8Array) => number, initialValue?: number): number; - - /** - * 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. - * @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. - * @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. - */ - reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int8Array) => U, initialValue: U): U; - - /** - * 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. - * @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. - * @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. - */ - reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int8Array) => number, initialValue?: number): number; - - /** - * 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. - * @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. - * @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. - */ - reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int8Array) => U, initialValue: U): U; - - /** - * Reverses the elements in an Array. - */ - reverse(): Int8Array; - - /** - * Sets a value or an array of values. - * @param index The index of the location to set. - * @param value The value to set. - */ - set(index: number, value: number): void; - - /** - * Sets a value or an array of values. - * @param array A typed or untyped array of values to set. - * @param offset The index in the current array at which the values are to be written. - */ - set(array: ArrayLike, offset?: number): void; - - /** - * Returns a section of an array. - * @param start The beginning of the specified portion of the array. - * @param end The end of the specified portion of the array. - */ - slice(start?: number, end?: number): Int8Array; - - /** - * Determines whether the specified callback function returns true for any element of an array. - * @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. - * @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. - */ - some(callbackfn: (value: number, index: number, array: Int8Array) => boolean, thisArg?: any): boolean; - - /** - * Sorts an array. - * @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. - */ - sort(compareFn?: (a: number, b: number) => number): Int8Array; - - /** - * Gets a new Int8Array view of the ArrayBuffer store for this array, referencing the elements - * at begin, inclusive, up to end, exclusive. - * @param begin The index of the beginning of the array. - * @param end The index of the end of the array. - */ - subarray(begin: number, end?: number): Int8Array; - - /** - * Converts a number to a string by using the current locale. - */ - toLocaleString(): string; - - /** - * Returns a string representation of an array. - */ - toString(): string; - - [index: number]: number; -} -interface Int8ArrayConstructor { - readonly prototype: Int8Array; - new (length: number): Int8Array; - new (array: ArrayLike): Int8Array; - new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Int8Array; - - /** - * The size in bytes of each element in the array. - */ - readonly BYTES_PER_ELEMENT: number; - - /** - * Returns a new array from a set of elements. - * @param items A set of elements to include in the new array object. - */ - of(...items: number[]): Int8Array; - - /** - * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Int8Array; - -} -declare const Int8Array: Int8ArrayConstructor; - -/** - * A typed array of 8-bit unsigned integer values. The contents are initialized to 0. If the - * requested number of bytes could not be allocated an exception is raised. - */ -interface Uint8Array { - /** - * The size in bytes of each element in the array. - */ - readonly BYTES_PER_ELEMENT: number; - - /** - * The ArrayBuffer instance referenced by the array. - */ - readonly buffer: ArrayBuffer; - - /** - * The length in bytes of the array. - */ - readonly byteLength: number; - - /** - * The offset in bytes of the array. - */ - readonly byteOffset: number; - - /** - * Returns the this object after copying a section of the array identified by start and end - * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it - * is treated as length+end. - * @param end If not specified, length of the this object is used as its default value. - */ - copyWithin(target: number, start: number, end?: number): Uint8Array; - - /** - * Determines whether all the members of an array satisfy the specified test. - * @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. - * @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. - */ - every(callbackfn: (value: number, index: number, array: Uint8Array) => boolean, thisArg?: any): boolean; - - /** - * Returns the this object after filling the section identified by start and end with value - * @param value value to fill array section with - * @param start index to start filling the array at. If start is negative, it is treated as - * length+start where length is the length of the array. - * @param end index to stop filling the array at. If end is negative, it is treated as - * length+end. - */ - fill(value: number, start?: number, end?: number): Uint8Array; - - /** - * Returns the elements of an array that meet the condition specified in a callback function. - * @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. - * @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. - */ - filter(callbackfn: (value: number, index: number, array: Uint8Array) => boolean, thisArg?: any): Uint8Array; - - /** - * Returns the value of the first element in the array where predicate is true, and undefined - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; - - /** - * Returns the index of the first element in the array where predicate is true, and undefined - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - findIndex(predicate: (value: number) => boolean, thisArg?: any): number; - - /** - * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the - * callbackfn function one time for each element in the array. - * @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. - */ - forEach(callbackfn: (value: number, index: number, array: Uint8Array) => void, thisArg?: any): void; - - /** - * Returns the index of the first occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - indexOf(searchElement: number, fromIndex?: number): number; - - /** - * Adds all the elements of an array separated by the specified separator string. - * @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. - */ - join(separator?: string): string; - - /** - * Returns the index of the last occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - lastIndexOf(searchElement: number, fromIndex?: number): number; - - /** - * The length of the array. - */ - readonly length: number; - - /** - * Calls a defined callback function on each element of an array, and returns an array that - * contains the results. - * @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. - * @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. - */ - map(callbackfn: (value: number, index: number, array: Uint8Array) => number, thisArg?: any): Uint8Array; - - /** - * 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. - * @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. - * @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. - */ - reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8Array) => number, initialValue?: number): number; - - /** - * 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. - * @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. - * @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. - */ - reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint8Array) => U, initialValue: U): U; - - /** - * 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. - * @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. - * @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. - */ - reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8Array) => number, initialValue?: number): number; - - /** - * 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. - * @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. - * @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. - */ - reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint8Array) => U, initialValue: U): U; - - /** - * Reverses the elements in an Array. - */ - reverse(): Uint8Array; - - /** - * Sets a value or an array of values. - * @param index The index of the location to set. - * @param value The value to set. - */ - set(index: number, value: number): void; - - /** - * Sets a value or an array of values. - * @param array A typed or untyped array of values to set. - * @param offset The index in the current array at which the values are to be written. - */ - set(array: ArrayLike, offset?: number): void; - - /** - * Returns a section of an array. - * @param start The beginning of the specified portion of the array. - * @param end The end of the specified portion of the array. - */ - slice(start?: number, end?: number): Uint8Array; - - /** - * Determines whether the specified callback function returns true for any element of an array. - * @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. - * @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. - */ - some(callbackfn: (value: number, index: number, array: Uint8Array) => boolean, thisArg?: any): boolean; - - /** - * Sorts an array. - * @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. - */ - sort(compareFn?: (a: number, b: number) => number): Uint8Array; - - /** - * Gets a new Uint8Array view of the ArrayBuffer store for this array, referencing the elements - * at begin, inclusive, up to end, exclusive. - * @param begin The index of the beginning of the array. - * @param end The index of the end of the array. - */ - subarray(begin: number, end?: number): Uint8Array; - - /** - * Converts a number to a string by using the current locale. - */ - toLocaleString(): string; - - /** - * Returns a string representation of an array. - */ - toString(): string; - - [index: number]: number; -} - -interface Uint8ArrayConstructor { - readonly prototype: Uint8Array; - new (length: number): Uint8Array; - new (array: ArrayLike): Uint8Array; - new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Uint8Array; - - /** - * The size in bytes of each element in the array. - */ - readonly BYTES_PER_ELEMENT: number; - - /** - * Returns a new array from a set of elements. - * @param items A set of elements to include in the new array object. - */ - of(...items: number[]): Uint8Array; - - /** - * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint8Array; - -} -declare const Uint8Array: Uint8ArrayConstructor; - -/** - * A typed array of 8-bit unsigned integer (clamped) values. The contents are initialized to 0. - * If the requested number of bytes could not be allocated an exception is raised. - */ -interface Uint8ClampedArray { - /** - * The size in bytes of each element in the array. - */ - readonly BYTES_PER_ELEMENT: number; - - /** - * The ArrayBuffer instance referenced by the array. - */ - readonly buffer: ArrayBuffer; - - /** - * The length in bytes of the array. - */ - readonly byteLength: number; - - /** - * The offset in bytes of the array. - */ - readonly byteOffset: number; - - /** - * Returns the this object after copying a section of the array identified by start and end - * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it - * is treated as length+end. - * @param end If not specified, length of the this object is used as its default value. - */ - copyWithin(target: number, start: number, end?: number): Uint8ClampedArray; - - /** - * Determines whether all the members of an array satisfy the specified test. - * @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. - * @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. - */ - every(callbackfn: (value: number, index: number, array: Uint8ClampedArray) => boolean, thisArg?: any): boolean; - - /** - * Returns the this object after filling the section identified by start and end with value - * @param value value to fill array section with - * @param start index to start filling the array at. If start is negative, it is treated as - * length+start where length is the length of the array. - * @param end index to stop filling the array at. If end is negative, it is treated as - * length+end. - */ - fill(value: number, start?: number, end?: number): Uint8ClampedArray; - - /** - * Returns the elements of an array that meet the condition specified in a callback function. - * @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. - * @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. - */ - filter(callbackfn: (value: number, index: number, array: Uint8ClampedArray) => boolean, thisArg?: any): Uint8ClampedArray; - - /** - * Returns the value of the first element in the array where predicate is true, and undefined - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; - - /** - * Returns the index of the first element in the array where predicate is true, and undefined - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - findIndex(predicate: (value: number) => boolean, thisArg?: any): number; - - /** - * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the - * callbackfn function one time for each element in the array. - * @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. - */ - forEach(callbackfn: (value: number, index: number, array: Uint8ClampedArray) => void, thisArg?: any): void; - - /** - * Returns the index of the first occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - indexOf(searchElement: number, fromIndex?: number): number; - - /** - * Adds all the elements of an array separated by the specified separator string. - * @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. - */ - join(separator?: string): string; - - /** - * Returns the index of the last occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - lastIndexOf(searchElement: number, fromIndex?: number): number; - - /** - * The length of the array. - */ - readonly length: number; - - /** - * Calls a defined callback function on each element of an array, and returns an array that - * contains the results. - * @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. - * @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. - */ - map(callbackfn: (value: number, index: number, array: Uint8ClampedArray) => number, thisArg?: any): Uint8ClampedArray; - - /** - * 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. - * @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. - * @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. - */ - reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8ClampedArray) => number, initialValue?: number): number; - - /** - * 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. - * @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. - * @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. - */ - reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint8ClampedArray) => U, initialValue: U): U; - - /** - * 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. - * @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. - * @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. - */ - reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8ClampedArray) => number, initialValue?: number): number; - - /** - * 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. - * @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. - * @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. - */ - reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint8ClampedArray) => U, initialValue: U): U; - - /** - * Reverses the elements in an Array. - */ - reverse(): Uint8ClampedArray; - - /** - * Sets a value or an array of values. - * @param index The index of the location to set. - * @param value The value to set. - */ - set(index: number, value: number): void; - - /** - * Sets a value or an array of values. - * @param array A typed or untyped array of values to set. - * @param offset The index in the current array at which the values are to be written. - */ - set(array: Uint8ClampedArray, offset?: number): void; - - /** - * Returns a section of an array. - * @param start The beginning of the specified portion of the array. - * @param end The end of the specified portion of the array. - */ - slice(start?: number, end?: number): Uint8ClampedArray; - - /** - * Determines whether the specified callback function returns true for any element of an array. - * @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. - * @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. - */ - some(callbackfn: (value: number, index: number, array: Uint8ClampedArray) => boolean, thisArg?: any): boolean; - - /** - * Sorts an array. - * @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. - */ - sort(compareFn?: (a: number, b: number) => number): Uint8ClampedArray; - - /** - * Gets a new Uint8ClampedArray view of the ArrayBuffer store for this array, referencing the elements - * at begin, inclusive, up to end, exclusive. - * @param begin The index of the beginning of the array. - * @param end The index of the end of the array. - */ - subarray(begin: number, end?: number): Uint8ClampedArray; - - /** - * Converts a number to a string by using the current locale. - */ - toLocaleString(): string; - - /** - * Returns a string representation of an array. - */ - toString(): string; - - [index: number]: number; -} - -interface Uint8ClampedArrayConstructor { - readonly prototype: Uint8ClampedArray; - new (length: number): Uint8ClampedArray; - new (array: ArrayLike): Uint8ClampedArray; - new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Uint8ClampedArray; - - /** - * The size in bytes of each element in the array. - */ - readonly BYTES_PER_ELEMENT: number; - - /** - * Returns a new array from a set of elements. - * @param items A set of elements to include in the new array object. - */ - of(...items: number[]): Uint8ClampedArray; - - /** - * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint8ClampedArray; -} -declare const Uint8ClampedArray: Uint8ClampedArrayConstructor; - -/** - * A typed array of 16-bit signed integer values. The contents are initialized to 0. If the - * requested number of bytes could not be allocated an exception is raised. - */ -interface Int16Array { - /** - * The size in bytes of each element in the array. - */ - readonly BYTES_PER_ELEMENT: number; - - /** - * The ArrayBuffer instance referenced by the array. - */ - readonly buffer: ArrayBuffer; - - /** - * The length in bytes of the array. - */ - readonly byteLength: number; - - /** - * The offset in bytes of the array. - */ - readonly byteOffset: number; - - /** - * Returns the this object after copying a section of the array identified by start and end - * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it - * is treated as length+end. - * @param end If not specified, length of the this object is used as its default value. - */ - copyWithin(target: number, start: number, end?: number): Int16Array; - - /** - * Determines whether all the members of an array satisfy the specified test. - * @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. - * @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. - */ - every(callbackfn: (value: number, index: number, array: Int16Array) => boolean, thisArg?: any): boolean; - - /** - * Returns the this object after filling the section identified by start and end with value - * @param value value to fill array section with - * @param start index to start filling the array at. If start is negative, it is treated as - * length+start where length is the length of the array. - * @param end index to stop filling the array at. If end is negative, it is treated as - * length+end. - */ - fill(value: number, start?: number, end?: number): Int16Array; - - /** - * Returns the elements of an array that meet the condition specified in a callback function. - * @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. - * @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. - */ - filter(callbackfn: (value: number, index: number, array: Int16Array) => boolean, thisArg?: any): Int16Array; - - /** - * Returns the value of the first element in the array where predicate is true, and undefined - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; - - /** - * Returns the index of the first element in the array where predicate is true, and undefined - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - findIndex(predicate: (value: number) => boolean, thisArg?: any): number; - - /** - * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the - * callbackfn function one time for each element in the array. - * @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. - */ - forEach(callbackfn: (value: number, index: number, array: Int16Array) => void, thisArg?: any): void; - - /** - * Returns the index of the first occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - indexOf(searchElement: number, fromIndex?: number): number; - - /** - * Adds all the elements of an array separated by the specified separator string. - * @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. - */ - join(separator?: string): string; - - /** - * Returns the index of the last occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - lastIndexOf(searchElement: number, fromIndex?: number): number; - - /** - * The length of the array. - */ - readonly length: number; - - /** - * Calls a defined callback function on each element of an array, and returns an array that - * contains the results. - * @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. - * @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. - */ - map(callbackfn: (value: number, index: number, array: Int16Array) => number, thisArg?: any): Int16Array; - - /** - * 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. - * @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. - * @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. - */ - reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int16Array) => number, initialValue?: number): number; - - /** - * 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. - * @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. - * @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. - */ - reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int16Array) => U, initialValue: U): U; - - /** - * 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. - * @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. - * @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. - */ - reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int16Array) => number, initialValue?: number): number; - - /** - * 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. - * @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. - * @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. - */ - reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int16Array) => U, initialValue: U): U; - - /** - * Reverses the elements in an Array. - */ - reverse(): Int16Array; - - /** - * Sets a value or an array of values. - * @param index The index of the location to set. - * @param value The value to set. - */ - set(index: number, value: number): void; - - /** - * Sets a value or an array of values. - * @param array A typed or untyped array of values to set. - * @param offset The index in the current array at which the values are to be written. - */ - set(array: ArrayLike, offset?: number): void; - - /** - * Returns a section of an array. - * @param start The beginning of the specified portion of the array. - * @param end The end of the specified portion of the array. - */ - slice(start?: number, end?: number): Int16Array; - - /** - * Determines whether the specified callback function returns true for any element of an array. - * @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. - * @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. - */ - some(callbackfn: (value: number, index: number, array: Int16Array) => boolean, thisArg?: any): boolean; - - /** - * Sorts an array. - * @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. - */ - sort(compareFn?: (a: number, b: number) => number): Int16Array; - - /** - * Gets a new Int16Array view of the ArrayBuffer store for this array, referencing the elements - * at begin, inclusive, up to end, exclusive. - * @param begin The index of the beginning of the array. - * @param end The index of the end of the array. - */ - subarray(begin: number, end?: number): Int16Array; - - /** - * Converts a number to a string by using the current locale. - */ - toLocaleString(): string; - - /** - * Returns a string representation of an array. - */ - toString(): string; - - [index: number]: number; -} - -interface Int16ArrayConstructor { - readonly prototype: Int16Array; - new (length: number): Int16Array; - new (array: ArrayLike): Int16Array; - new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Int16Array; - - /** - * The size in bytes of each element in the array. - */ - readonly BYTES_PER_ELEMENT: number; - - /** - * Returns a new array from a set of elements. - * @param items A set of elements to include in the new array object. - */ - of(...items: number[]): Int16Array; - - /** - * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Int16Array; - -} -declare const Int16Array: Int16ArrayConstructor; - -/** - * A typed array of 16-bit unsigned integer values. The contents are initialized to 0. If the - * requested number of bytes could not be allocated an exception is raised. - */ -interface Uint16Array { - /** - * The size in bytes of each element in the array. - */ - readonly BYTES_PER_ELEMENT: number; - - /** - * The ArrayBuffer instance referenced by the array. - */ - readonly buffer: ArrayBuffer; - - /** - * The length in bytes of the array. - */ - readonly byteLength: number; - - /** - * The offset in bytes of the array. - */ - readonly byteOffset: number; - - /** - * Returns the this object after copying a section of the array identified by start and end - * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it - * is treated as length+end. - * @param end If not specified, length of the this object is used as its default value. - */ - copyWithin(target: number, start: number, end?: number): Uint16Array; - - /** - * Determines whether all the members of an array satisfy the specified test. - * @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. - * @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. - */ - every(callbackfn: (value: number, index: number, array: Uint16Array) => boolean, thisArg?: any): boolean; - - /** - * Returns the this object after filling the section identified by start and end with value - * @param value value to fill array section with - * @param start index to start filling the array at. If start is negative, it is treated as - * length+start where length is the length of the array. - * @param end index to stop filling the array at. If end is negative, it is treated as - * length+end. - */ - fill(value: number, start?: number, end?: number): Uint16Array; - - /** - * Returns the elements of an array that meet the condition specified in a callback function. - * @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. - * @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. - */ - filter(callbackfn: (value: number, index: number, array: Uint16Array) => boolean, thisArg?: any): Uint16Array; - - /** - * Returns the value of the first element in the array where predicate is true, and undefined - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; - - /** - * Returns the index of the first element in the array where predicate is true, and undefined - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - findIndex(predicate: (value: number) => boolean, thisArg?: any): number; - - /** - * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the - * callbackfn function one time for each element in the array. - * @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. - */ - forEach(callbackfn: (value: number, index: number, array: Uint16Array) => void, thisArg?: any): void; - - /** - * Returns the index of the first occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - indexOf(searchElement: number, fromIndex?: number): number; - - /** - * Adds all the elements of an array separated by the specified separator string. - * @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. - */ - join(separator?: string): string; - - /** - * Returns the index of the last occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - lastIndexOf(searchElement: number, fromIndex?: number): number; - - /** - * The length of the array. - */ - readonly length: number; - - /** - * Calls a defined callback function on each element of an array, and returns an array that - * contains the results. - * @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. - * @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. - */ - map(callbackfn: (value: number, index: number, array: Uint16Array) => number, thisArg?: any): Uint16Array; - - /** - * 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. - * @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. - * @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. - */ - reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint16Array) => number, initialValue?: number): number; - - /** - * 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. - * @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. - * @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. - */ - reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint16Array) => U, initialValue: U): U; - - /** - * 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. - * @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. - * @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. - */ - reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint16Array) => number, initialValue?: number): number; - - /** - * 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. - * @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. - * @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. - */ - reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint16Array) => U, initialValue: U): U; - - /** - * Reverses the elements in an Array. - */ - reverse(): Uint16Array; - - /** - * Sets a value or an array of values. - * @param index The index of the location to set. - * @param value The value to set. - */ - set(index: number, value: number): void; - - /** - * Sets a value or an array of values. - * @param array A typed or untyped array of values to set. - * @param offset The index in the current array at which the values are to be written. - */ - set(array: ArrayLike, offset?: number): void; - - /** - * Returns a section of an array. - * @param start The beginning of the specified portion of the array. - * @param end The end of the specified portion of the array. - */ - slice(start?: number, end?: number): Uint16Array; - - /** - * Determines whether the specified callback function returns true for any element of an array. - * @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. - * @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. - */ - some(callbackfn: (value: number, index: number, array: Uint16Array) => boolean, thisArg?: any): boolean; - - /** - * Sorts an array. - * @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. - */ - sort(compareFn?: (a: number, b: number) => number): Uint16Array; - - /** - * Gets a new Uint16Array view of the ArrayBuffer store for this array, referencing the elements - * at begin, inclusive, up to end, exclusive. - * @param begin The index of the beginning of the array. - * @param end The index of the end of the array. - */ - subarray(begin: number, end?: number): Uint16Array; - - /** - * Converts a number to a string by using the current locale. - */ - toLocaleString(): string; - - /** - * Returns a string representation of an array. - */ - toString(): string; - - [index: number]: number; -} - -interface Uint16ArrayConstructor { - readonly prototype: Uint16Array; - new (length: number): Uint16Array; - new (array: ArrayLike): Uint16Array; - new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Uint16Array; - - /** - * The size in bytes of each element in the array. - */ - readonly BYTES_PER_ELEMENT: number; - - /** - * Returns a new array from a set of elements. - * @param items A set of elements to include in the new array object. - */ - of(...items: number[]): Uint16Array; - - /** - * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint16Array; - -} -declare const Uint16Array: Uint16ArrayConstructor; -/** - * A typed array of 32-bit signed integer values. The contents are initialized to 0. If the - * requested number of bytes could not be allocated an exception is raised. - */ -interface Int32Array { - /** - * The size in bytes of each element in the array. - */ - readonly BYTES_PER_ELEMENT: number; - - /** - * The ArrayBuffer instance referenced by the array. - */ - readonly buffer: ArrayBuffer; - - /** - * The length in bytes of the array. - */ - readonly byteLength: number; - - /** - * The offset in bytes of the array. - */ - readonly byteOffset: number; - - /** - * Returns the this object after copying a section of the array identified by start and end - * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it - * is treated as length+end. - * @param end If not specified, length of the this object is used as its default value. - */ - copyWithin(target: number, start: number, end?: number): Int32Array; - - /** - * Determines whether all the members of an array satisfy the specified test. - * @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. - * @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. - */ - every(callbackfn: (value: number, index: number, array: Int32Array) => boolean, thisArg?: any): boolean; - - /** - * Returns the this object after filling the section identified by start and end with value - * @param value value to fill array section with - * @param start index to start filling the array at. If start is negative, it is treated as - * length+start where length is the length of the array. - * @param end index to stop filling the array at. If end is negative, it is treated as - * length+end. - */ - fill(value: number, start?: number, end?: number): Int32Array; - - /** - * Returns the elements of an array that meet the condition specified in a callback function. - * @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. - * @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. - */ - filter(callbackfn: (value: number, index: number, array: Int32Array) => boolean, thisArg?: any): Int32Array; - - /** - * Returns the value of the first element in the array where predicate is true, and undefined - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; - - /** - * Returns the index of the first element in the array where predicate is true, and undefined - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - findIndex(predicate: (value: number) => boolean, thisArg?: any): number; - - /** - * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the - * callbackfn function one time for each element in the array. - * @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. - */ - forEach(callbackfn: (value: number, index: number, array: Int32Array) => void, thisArg?: any): void; - - /** - * Returns the index of the first occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - indexOf(searchElement: number, fromIndex?: number): number; - - /** - * Adds all the elements of an array separated by the specified separator string. - * @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. - */ - join(separator?: string): string; - - /** - * Returns the index of the last occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - lastIndexOf(searchElement: number, fromIndex?: number): number; - - /** - * The length of the array. - */ - readonly length: number; - - /** - * Calls a defined callback function on each element of an array, and returns an array that - * contains the results. - * @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. - * @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. - */ - map(callbackfn: (value: number, index: number, array: Int32Array) => number, thisArg?: any): Int32Array; - - /** - * 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. - * @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. - * @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. - */ - reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int32Array) => number, initialValue?: number): number; - - /** - * 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. - * @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. - * @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. - */ - reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int32Array) => U, initialValue: U): U; - - /** - * 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. - * @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. - * @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. - */ - reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int32Array) => number, initialValue?: number): number; - - /** - * 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. - * @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. - * @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. - */ - reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int32Array) => U, initialValue: U): U; - - /** - * Reverses the elements in an Array. - */ - reverse(): Int32Array; - - /** - * Sets a value or an array of values. - * @param index The index of the location to set. - * @param value The value to set. - */ - set(index: number, value: number): void; - - /** - * Sets a value or an array of values. - * @param array A typed or untyped array of values to set. - * @param offset The index in the current array at which the values are to be written. - */ - set(array: ArrayLike, offset?: number): void; - - /** - * Returns a section of an array. - * @param start The beginning of the specified portion of the array. - * @param end The end of the specified portion of the array. - */ - slice(start?: number, end?: number): Int32Array; - - /** - * Determines whether the specified callback function returns true for any element of an array. - * @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. - * @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. - */ - some(callbackfn: (value: number, index: number, array: Int32Array) => boolean, thisArg?: any): boolean; - - /** - * Sorts an array. - * @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. - */ - sort(compareFn?: (a: number, b: number) => number): Int32Array; - - /** - * Gets a new Int32Array view of the ArrayBuffer store for this array, referencing the elements - * at begin, inclusive, up to end, exclusive. - * @param begin The index of the beginning of the array. - * @param end The index of the end of the array. - */ - subarray(begin: number, end?: number): Int32Array; - - /** - * Converts a number to a string by using the current locale. - */ - toLocaleString(): string; - - /** - * Returns a string representation of an array. - */ - toString(): string; - - [index: number]: number; -} - -interface Int32ArrayConstructor { - readonly prototype: Int32Array; - new (length: number): Int32Array; - new (array: ArrayLike): Int32Array; - new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Int32Array; - - /** - * The size in bytes of each element in the array. - */ - readonly BYTES_PER_ELEMENT: number; - - /** - * Returns a new array from a set of elements. - * @param items A set of elements to include in the new array object. - */ - of(...items: number[]): Int32Array; - - /** - * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Int32Array; -} -declare const Int32Array: Int32ArrayConstructor; - -/** - * A typed array of 32-bit unsigned integer values. The contents are initialized to 0. If the - * requested number of bytes could not be allocated an exception is raised. - */ -interface Uint32Array { - /** - * The size in bytes of each element in the array. - */ - readonly BYTES_PER_ELEMENT: number; - - /** - * The ArrayBuffer instance referenced by the array. - */ - readonly buffer: ArrayBuffer; - - /** - * The length in bytes of the array. - */ - readonly byteLength: number; - - /** - * The offset in bytes of the array. - */ - readonly byteOffset: number; - - /** - * Returns the this object after copying a section of the array identified by start and end - * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it - * is treated as length+end. - * @param end If not specified, length of the this object is used as its default value. - */ - copyWithin(target: number, start: number, end?: number): Uint32Array; - - /** - * Determines whether all the members of an array satisfy the specified test. - * @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. - * @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. - */ - every(callbackfn: (value: number, index: number, array: Uint32Array) => boolean, thisArg?: any): boolean; - - /** - * Returns the this object after filling the section identified by start and end with value - * @param value value to fill array section with - * @param start index to start filling the array at. If start is negative, it is treated as - * length+start where length is the length of the array. - * @param end index to stop filling the array at. If end is negative, it is treated as - * length+end. - */ - fill(value: number, start?: number, end?: number): Uint32Array; - - /** - * Returns the elements of an array that meet the condition specified in a callback function. - * @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. - * @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. - */ - filter(callbackfn: (value: number, index: number, array: Uint32Array) => boolean, thisArg?: any): Uint32Array; - - /** - * Returns the value of the first element in the array where predicate is true, and undefined - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; - - /** - * Returns the index of the first element in the array where predicate is true, and undefined - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - findIndex(predicate: (value: number) => boolean, thisArg?: any): number; - - /** - * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the - * callbackfn function one time for each element in the array. - * @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. - */ - forEach(callbackfn: (value: number, index: number, array: Uint32Array) => void, thisArg?: any): void; - - /** - * Returns the index of the first occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - indexOf(searchElement: number, fromIndex?: number): number; - - /** - * Adds all the elements of an array separated by the specified separator string. - * @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. - */ - join(separator?: string): string; - - /** - * Returns the index of the last occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - lastIndexOf(searchElement: number, fromIndex?: number): number; - - /** - * The length of the array. - */ - readonly length: number; - - /** - * Calls a defined callback function on each element of an array, and returns an array that - * contains the results. - * @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. - * @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. - */ - map(callbackfn: (value: number, index: number, array: Uint32Array) => number, thisArg?: any): Uint32Array; - - /** - * 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. - * @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. - * @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. - */ - reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint32Array) => number, initialValue?: number): number; - - /** - * 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. - * @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. - * @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. - */ - reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint32Array) => U, initialValue: U): U; - - /** - * 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. - * @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. - * @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. - */ - reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint32Array) => number, initialValue?: number): number; - - /** - * 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. - * @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. - * @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. - */ - reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint32Array) => U, initialValue: U): U; - - /** - * Reverses the elements in an Array. - */ - reverse(): Uint32Array; - - /** - * Sets a value or an array of values. - * @param index The index of the location to set. - * @param value The value to set. - */ - set(index: number, value: number): void; - - /** - * Sets a value or an array of values. - * @param array A typed or untyped array of values to set. - * @param offset The index in the current array at which the values are to be written. - */ - set(array: ArrayLike, offset?: number): void; - - /** - * Returns a section of an array. - * @param start The beginning of the specified portion of the array. - * @param end The end of the specified portion of the array. - */ - slice(start?: number, end?: number): Uint32Array; - - /** - * Determines whether the specified callback function returns true for any element of an array. - * @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. - * @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. - */ - some(callbackfn: (value: number, index: number, array: Uint32Array) => boolean, thisArg?: any): boolean; - - /** - * Sorts an array. - * @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. - */ - sort(compareFn?: (a: number, b: number) => number): Uint32Array; - - /** - * Gets a new Uint32Array view of the ArrayBuffer store for this array, referencing the elements - * at begin, inclusive, up to end, exclusive. - * @param begin The index of the beginning of the array. - * @param end The index of the end of the array. - */ - subarray(begin: number, end?: number): Uint32Array; - - /** - * Converts a number to a string by using the current locale. - */ - toLocaleString(): string; - - /** - * Returns a string representation of an array. - */ - toString(): string; - - [index: number]: number; -} - -interface Uint32ArrayConstructor { - readonly prototype: Uint32Array; - new (length: number): Uint32Array; - new (array: ArrayLike): Uint32Array; - new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Uint32Array; - - /** - * The size in bytes of each element in the array. - */ - readonly BYTES_PER_ELEMENT: number; - - /** - * Returns a new array from a set of elements. - * @param items A set of elements to include in the new array object. - */ - of(...items: number[]): Uint32Array; - - /** - * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint32Array; -} -declare const Uint32Array: Uint32ArrayConstructor; - -/** - * A typed array of 32-bit float values. The contents are initialized to 0. If the requested number - * of bytes could not be allocated an exception is raised. - */ -interface Float32Array { - /** - * The size in bytes of each element in the array. - */ - readonly BYTES_PER_ELEMENT: number; - - /** - * The ArrayBuffer instance referenced by the array. - */ - readonly buffer: ArrayBuffer; - - /** - * The length in bytes of the array. - */ - readonly byteLength: number; - - /** - * The offset in bytes of the array. - */ - readonly byteOffset: number; - - /** - * Returns the this object after copying a section of the array identified by start and end - * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it - * is treated as length+end. - * @param end If not specified, length of the this object is used as its default value. - */ - copyWithin(target: number, start: number, end?: number): Float32Array; - - /** - * Determines whether all the members of an array satisfy the specified test. - * @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. - * @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. - */ - every(callbackfn: (value: number, index: number, array: Float32Array) => boolean, thisArg?: any): boolean; - - /** - * Returns the this object after filling the section identified by start and end with value - * @param value value to fill array section with - * @param start index to start filling the array at. If start is negative, it is treated as - * length+start where length is the length of the array. - * @param end index to stop filling the array at. If end is negative, it is treated as - * length+end. - */ - fill(value: number, start?: number, end?: number): Float32Array; - - /** - * Returns the elements of an array that meet the condition specified in a callback function. - * @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. - * @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. - */ - filter(callbackfn: (value: number, index: number, array: Float32Array) => boolean, thisArg?: any): Float32Array; - - /** - * Returns the value of the first element in the array where predicate is true, and undefined - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; - - /** - * Returns the index of the first element in the array where predicate is true, and undefined - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - findIndex(predicate: (value: number) => boolean, thisArg?: any): number; - - /** - * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the - * callbackfn function one time for each element in the array. - * @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. - */ - forEach(callbackfn: (value: number, index: number, array: Float32Array) => void, thisArg?: any): void; - - /** - * Returns the index of the first occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - indexOf(searchElement: number, fromIndex?: number): number; - - /** - * Adds all the elements of an array separated by the specified separator string. - * @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. - */ - join(separator?: string): string; - - /** - * Returns the index of the last occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - lastIndexOf(searchElement: number, fromIndex?: number): number; - - /** - * The length of the array. - */ - readonly length: number; - - /** - * Calls a defined callback function on each element of an array, and returns an array that - * contains the results. - * @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. - * @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. - */ - map(callbackfn: (value: number, index: number, array: Float32Array) => number, thisArg?: any): Float32Array; - - /** - * 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. - * @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. - * @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. - */ - reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float32Array) => number, initialValue?: number): number; - - /** - * 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. - * @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. - * @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. - */ - reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Float32Array) => U, initialValue: U): U; - - /** - * 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. - * @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. - * @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. - */ - reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float32Array) => number, initialValue?: number): number; - - /** - * 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. - * @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. - * @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. - */ - reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Float32Array) => U, initialValue: U): U; - - /** - * Reverses the elements in an Array. - */ - reverse(): Float32Array; - - /** - * Sets a value or an array of values. - * @param index The index of the location to set. - * @param value The value to set. - */ - set(index: number, value: number): void; - - /** - * Sets a value or an array of values. - * @param array A typed or untyped array of values to set. - * @param offset The index in the current array at which the values are to be written. - */ - set(array: ArrayLike, offset?: number): void; - - /** - * Returns a section of an array. - * @param start The beginning of the specified portion of the array. - * @param end The end of the specified portion of the array. - */ - slice(start?: number, end?: number): Float32Array; - - /** - * Determines whether the specified callback function returns true for any element of an array. - * @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. - * @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. - */ - some(callbackfn: (value: number, index: number, array: Float32Array) => boolean, thisArg?: any): boolean; - - /** - * Sorts an array. - * @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. - */ - sort(compareFn?: (a: number, b: number) => number): Float32Array; - - /** - * Gets a new Float32Array view of the ArrayBuffer store for this array, referencing the elements - * at begin, inclusive, up to end, exclusive. - * @param begin The index of the beginning of the array. - * @param end The index of the end of the array. - */ - subarray(begin: number, end?: number): Float32Array; - - /** - * Converts a number to a string by using the current locale. - */ - toLocaleString(): string; - - /** - * Returns a string representation of an array. - */ - toString(): string; - - [index: number]: number; -} - -interface Float32ArrayConstructor { - readonly prototype: Float32Array; - new (length: number): Float32Array; - new (array: ArrayLike): Float32Array; - new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Float32Array; - - /** - * The size in bytes of each element in the array. - */ - readonly BYTES_PER_ELEMENT: number; - - /** - * Returns a new array from a set of elements. - * @param items A set of elements to include in the new array object. - */ - of(...items: number[]): Float32Array; - - /** - * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Float32Array; - -} -declare const Float32Array: Float32ArrayConstructor; - -/** - * A typed array of 64-bit float values. The contents are initialized to 0. If the requested - * number of bytes could not be allocated an exception is raised. - */ -interface Float64Array { - /** - * The size in bytes of each element in the array. - */ - readonly BYTES_PER_ELEMENT: number; - - /** - * The ArrayBuffer instance referenced by the array. - */ - readonly buffer: ArrayBuffer; - - /** - * The length in bytes of the array. - */ - readonly byteLength: number; - - /** - * The offset in bytes of the array. - */ - readonly byteOffset: number; - - /** - * Returns the this object after copying a section of the array identified by start and end - * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it - * is treated as length+end. - * @param end If not specified, length of the this object is used as its default value. - */ - copyWithin(target: number, start: number, end?: number): Float64Array; - - /** - * Determines whether all the members of an array satisfy the specified test. - * @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. - * @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. - */ - every(callbackfn: (value: number, index: number, array: Float64Array) => boolean, thisArg?: any): boolean; - - /** - * Returns the this object after filling the section identified by start and end with value - * @param value value to fill array section with - * @param start index to start filling the array at. If start is negative, it is treated as - * length+start where length is the length of the array. - * @param end index to stop filling the array at. If end is negative, it is treated as - * length+end. - */ - fill(value: number, start?: number, end?: number): Float64Array; - - /** - * Returns the elements of an array that meet the condition specified in a callback function. - * @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. - * @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. - */ - filter(callbackfn: (value: number, index: number, array: Float64Array) => boolean, thisArg?: any): Float64Array; - - /** - * Returns the value of the first element in the array where predicate is true, and undefined - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; - - /** - * Returns the index of the first element in the array where predicate is true, and undefined - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - findIndex(predicate: (value: number) => boolean, thisArg?: any): number; - - /** - * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the - * callbackfn function one time for each element in the array. - * @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. - */ - forEach(callbackfn: (value: number, index: number, array: Float64Array) => void, thisArg?: any): void; - - /** - * Returns the index of the first occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - indexOf(searchElement: number, fromIndex?: number): number; - - /** - * Adds all the elements of an array separated by the specified separator string. - * @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. - */ - join(separator?: string): string; - - /** - * Returns the index of the last occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - lastIndexOf(searchElement: number, fromIndex?: number): number; - - /** - * The length of the array. - */ - readonly length: number; - - /** - * Calls a defined callback function on each element of an array, and returns an array that - * contains the results. - * @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. - * @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. - */ - map(callbackfn: (value: number, index: number, array: Float64Array) => number, thisArg?: any): Float64Array; - - /** - * 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. - * @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. - * @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. - */ - reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float64Array) => number, initialValue?: number): number; - - /** - * 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. - * @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. - * @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. - */ - reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Float64Array) => U, initialValue: U): U; - - /** - * 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. - * @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. - * @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. - */ - reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float64Array) => number, initialValue?: number): number; - - /** - * 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. - * @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. - * @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. - */ - reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Float64Array) => U, initialValue: U): U; - - /** - * Reverses the elements in an Array. - */ - reverse(): Float64Array; - - /** - * Sets a value or an array of values. - * @param index The index of the location to set. - * @param value The value to set. - */ - set(index: number, value: number): void; - - /** - * Sets a value or an array of values. - * @param array A typed or untyped array of values to set. - * @param offset The index in the current array at which the values are to be written. - */ - set(array: ArrayLike, offset?: number): void; - - /** - * Returns a section of an array. - * @param start The beginning of the specified portion of the array. - * @param end The end of the specified portion of the array. - */ - slice(start?: number, end?: number): Float64Array; - - /** - * Determines whether the specified callback function returns true for any element of an array. - * @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. - * @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. - */ - some(callbackfn: (value: number, index: number, array: Float64Array) => boolean, thisArg?: any): boolean; - - /** - * Sorts an array. - * @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. - */ - sort(compareFn?: (a: number, b: number) => number): Float64Array; - - /** - * Gets a new Float64Array view of the ArrayBuffer store for this array, referencing the elements - * at begin, inclusive, up to end, exclusive. - * @param begin The index of the beginning of the array. - * @param end The index of the end of the array. - */ - subarray(begin: number, end?: number): Float64Array; - - /** - * Converts a number to a string by using the current locale. - */ - toLocaleString(): string; - - /** - * Returns a string representation of an array. - */ - toString(): string; - - [index: number]: number; -} - -interface Float64ArrayConstructor { - readonly prototype: Float64Array; - new (length: number): Float64Array; - new (array: ArrayLike): Float64Array; - new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Float64Array; - - /** - * The size in bytes of each element in the array. - */ - readonly BYTES_PER_ELEMENT: number; - - /** - * Returns a new array from a set of elements. - * @param items A set of elements to include in the new array object. - */ - of(...items: number[]): Float64Array; - - /** - * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Float64Array; -} -declare const Float64Array: Float64ArrayConstructor; -declare type PropertyKey = string | number | symbol; - -interface Symbol { - /** Returns a string representation of an object. */ - toString(): string; - - /** Returns the primitive value of the specified object. */ - valueOf(): Object; - - readonly [Symbol.toStringTag]: "Symbol"; -} - -interface SymbolConstructor { - /** - * A reference to the prototype. - */ - readonly prototype: Symbol; - - /** - * Returns a new unique Symbol value. - * @param description Description of the new Symbol object. - */ - (description?: string|number): symbol; - - /** - * Returns a Symbol object from the global symbol registry matching the given key if found. - * Otherwise, returns a new symbol with this key. - * @param key key to search for. - */ - for(key: string): symbol; - - /** - * Returns a key from the global symbol registry matching the given Symbol if found. - * Otherwise, returns a undefined. - * @param sym Symbol to find the key for. - */ - keyFor(sym: symbol): string; - - // Well-known Symbols - - /** - * A method that determines if a constructor object recognizes an object as one of the - * constructor’s instances. Called by the semantics of the instanceof operator. - */ - readonly hasInstance: symbol; - - /** - * A Boolean value that if true indicates that an object should flatten to its array elements - * by Array.prototype.concat. - */ - readonly isConcatSpreadable: symbol; - - /** - * A method that returns the default iterator for an object. Called by the semantics of the - * for-of statement. - */ - readonly iterator: symbol; - - /** - * A regular expression method that matches the regular expression against a string. Called - * by the String.prototype.match method. - */ - readonly match: symbol; - - /** - * A regular expression method that replaces matched substrings of a string. Called by the - * String.prototype.replace method. - */ - readonly replace: symbol; - - /** - * A regular expression method that returns the index within a string that matches the - * regular expression. Called by the String.prototype.search method. - */ - readonly search: symbol; - - /** - * A function valued property that is the constructor function that is used to create - * derived objects. - */ - readonly species: symbol; - - /** - * A regular expression method that splits a string at the indices that match the regular - * expression. Called by the String.prototype.split method. - */ - readonly split: symbol; - - /** - * A method that converts an object to a corresponding primitive value. - * Called by the ToPrimitive abstract operation. - */ - readonly toPrimitive: symbol; - - /** - * A String value that is used in the creation of the default string description of an object. - * Called by the built-in method Object.prototype.toString. - */ - readonly toStringTag: symbol; - - /** - * An Object whose own property names are property names that are excluded from the 'with' - * environment bindings of the associated objects. - */ - readonly unscopables: symbol; -} -declare var Symbol: SymbolConstructor; - -interface Object { - /** - * Determines whether an object has a property with the specified name. - * @param v A property name. - */ - hasOwnProperty(v: PropertyKey): boolean; - - /** - * Determines whether a specified property is enumerable. - * @param v A property name. - */ - propertyIsEnumerable(v: PropertyKey): boolean; -} - -interface ObjectConstructor { - /** - * Copy the values of all of the enumerable own properties from one or more source objects to a - * target object. Returns the target object. - * @param target The target object to copy to. - * @param source The source object from which to copy properties. - */ - assign(target: T, source: U): T & U; - - /** - * Copy the values of all of the enumerable own properties from one or more source objects to a - * target object. Returns the target object. - * @param target The target object to copy to. - * @param source1 The first source object from which to copy properties. - * @param source2 The second source object from which to copy properties. - */ - assign(target: T, source1: U, source2: V): T & U & V; - - /** - * Copy the values of all of the enumerable own properties from one or more source objects to a - * target object. Returns the target object. - * @param target The target object to copy to. - * @param source1 The first source object from which to copy properties. - * @param source2 The second source object from which to copy properties. - * @param source3 The third source object from which to copy properties. - */ - assign(target: T, source1: U, source2: V, source3: W): T & U & V & W; - - /** - * Copy the values of all of the enumerable own properties from one or more source objects to a - * target object. Returns the target object. - * @param target The target object to copy to. - * @param sources One or more source objects from which to copy properties - */ - assign(target: any, ...sources: any[]): any; - - /** - * Returns an array of all symbol properties found directly on object o. - * @param o Object to retrieve the symbols from. - */ - getOwnPropertySymbols(o: any): symbol[]; - - /** - * Returns true if the values are the same value, false otherwise. - * @param value1 The first value. - * @param value2 The second value. - */ - is(value1: any, value2: any): boolean; - - /** - * Sets the prototype of a specified object o to object proto or null. Returns the object o. - * @param o The object to change its prototype. - * @param proto The value of the new prototype or null. - */ - setPrototypeOf(o: any, proto: any): any; - - /** - * Gets the own property descriptor of the specified object. - * An own property descriptor is one that is defined directly on the object and is not - * inherited from the object's prototype. - * @param o Object that contains the property. - * @param p Name of the property. - */ - getOwnPropertyDescriptor(o: any, propertyKey: PropertyKey): PropertyDescriptor; - - /** - * Adds a property to an object, or modifies attributes of an existing property. - * @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. - * @param p The property name. - * @param attributes Descriptor for the property. It can be for a data property or an accessor - * property. - */ - defineProperty(o: any, propertyKey: PropertyKey, attributes: PropertyDescriptor): any; -} - -interface Function { - /** - * Returns the name of the function. Function names are read-only and can not be changed. - */ - readonly name: string; - - /** - * Determines whether the given value inherits from this function if this function was used - * as a constructor function. - * - * A constructor function can control which objects are recognized as its instances by - * 'instanceof' by overriding this method. - */ - [Symbol.hasInstance](value: any): boolean; -} - -interface NumberConstructor { - /** - * The value of Number.EPSILON is the difference between 1 and the smallest value greater than 1 - * that is representable as a Number value, which is approximately: - * 2.2204460492503130808472633361816 x 10‍−‍16. - */ - readonly EPSILON: number; - - /** - * Returns true if passed value is finite. - * Unlike the global isFininte, Number.isFinite doesn't forcibly convert the parameter to a - * number. Only finite values of the type number, result in true. - * @param number A numeric value. - */ - isFinite(number: number): boolean; - - /** - * Returns true if the value passed is an integer, false otherwise. - * @param number A numeric value. - */ - isInteger(number: number): boolean; - - /** - * Returns a Boolean value that indicates whether a value is the reserved value NaN (not a - * number). Unlike the global isNaN(), Number.isNaN() doesn't forcefully convert the parameter - * to a number. Only values of the type number, that are also NaN, result in true. - * @param number A numeric value. - */ - isNaN(number: number): boolean; - - /** - * Returns true if the value passed is a safe integer. - * @param number A numeric value. - */ - isSafeInteger(number: number): boolean; - - /** - * The value of the largest integer n such that n and n + 1 are both exactly representable as - * a Number value. - * The value of Number.MIN_SAFE_INTEGER is 9007199254740991 2^53 − 1. - */ - readonly MAX_SAFE_INTEGER: number; - - /** - * The value of the smallest integer n such that n and n − 1 are both exactly representable as - * a Number value. - * The value of Number.MIN_SAFE_INTEGER is −9007199254740991 (−(2^53 − 1)). - */ - readonly MIN_SAFE_INTEGER: number; - - /** - * Converts a string to a floating-point number. - * @param string A string that contains a floating-point number. - */ - parseFloat(string: string): number; - - /** - * Converts A string to an integer. - * @param s A string to convert into a number. - * @param radix A value between 2 and 36 that specifies the base of the number in numString. - * If this argument is not supplied, strings with a prefix of '0x' are considered hexadecimal. - * All other strings are considered decimal. - */ - parseInt(string: string, radix?: number): number; -} - -interface Array { - /** Iterator */ - [Symbol.iterator](): IterableIterator; - - /** - * Returns an object whose properties have the value 'true' - * when they will be absent when used in a 'with' statement. - */ - [Symbol.unscopables](): { - copyWithin: boolean; - entries: boolean; - fill: boolean; - find: boolean; - findIndex: boolean; - keys: boolean; - values: boolean; - }; - - /** - * Returns an array of key, value pairs for every entry in the array - */ - entries(): IterableIterator<[number, T]>; - - /** - * Returns an list of keys in the array - */ - keys(): IterableIterator; - - /** - * Returns an list of values in the array - */ - values(): IterableIterator; - - /** - * Returns the value of the first element in the array where predicate is true, and undefined - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - find(predicate: (value: T, index: number, obj: Array) => boolean, thisArg?: any): T; - - /** - * Returns the index of the first element in the array where predicate is true, and undefined - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - findIndex(predicate: (value: T) => boolean, thisArg?: any): number; - - /** - * Returns the this object after filling the section identified by start and end with value - * @param value value to fill array section with - * @param start index to start filling the array at. If start is negative, it is treated as - * length+start where length is the length of the array. - * @param end index to stop filling the array at. If end is negative, it is treated as - * length+end. - */ - fill(value: T, start?: number, end?: number): T[]; - - /** - * Returns the this object after copying a section of the array identified by start and end - * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it - * is treated as length+end. - * @param end If not specified, length of the this object is used as its default value. - */ - copyWithin(target: number, start: number, end?: number): T[]; -} - -interface IArguments { - /** Iterator */ - [Symbol.iterator](): IterableIterator; -} - -interface ArrayConstructor { - /** - * Creates an array from an array-like object. - * @param arrayLike An array-like object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(arrayLike: ArrayLike, mapfn: (v: T, k: number) => U, thisArg?: any): Array; - - /** - * Creates an array from an iterable object. - * @param iterable An iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(iterable: Iterable, mapfn: (v: T, k: number) => U, thisArg?: any): Array; - - /** - * Creates an array from an array-like object. - * @param arrayLike An array-like object to convert to an array. - */ - from(arrayLike: ArrayLike): Array; - - /** - * Creates an array from an iterable object. - * @param iterable An iterable object to convert to an array. - */ - from(iterable: Iterable): Array; - - /** - * Returns a new array from a set of elements. - * @param items A set of elements to include in the new array object. - */ - of(...items: T[]): Array; -} - -interface String { - /** Iterator */ - [Symbol.iterator](): IterableIterator; - - /** - * Returns a nonnegative integer Number less than 1114112 (0x110000) that is the code point - * value of the UTF-16 encoded code point starting at the string element at position pos in - * the String resulting from converting this object to a String. - * If there is no element at that position, the result is undefined. - * If a valid UTF-16 surrogate pair does not begin at pos, the result is the code unit at pos. - */ - codePointAt(pos: number): number; - - /** - * Returns true if searchString appears as a substring of the result of converting this - * object to a String, at one or more positions that are - * greater than or equal to position; otherwise, returns false. - * @param searchString search string - * @param position If position is undefined, 0 is assumed, so as to search all of the String. - */ - includes(searchString: string, position?: number): boolean; - - /** - * Returns true if the sequence of elements of searchString converted to a String is the - * same as the corresponding elements of this object (converted to a String) starting at - * endPosition – length(this). Otherwise returns false. - */ - endsWith(searchString: string, endPosition?: number): boolean; - - /** - * Returns the String value result of normalizing the string into the normalization form - * named by form as specified in Unicode Standard Annex #15, Unicode Normalization Forms. - * @param form Applicable values: "NFC", "NFD", "NFKC", or "NFKD", If not specified default - * is "NFC" - */ - normalize(form?: string): string; - - /** - * Returns a String value that is made from count copies appended together. If count is 0, - * T is the empty String is returned. - * @param count number of copies to append - */ - repeat(count: number): string; - - /** - * Returns true if the sequence of elements of searchString converted to a String is the - * same as the corresponding elements of this object (converted to a String) starting at - * position. Otherwise returns false. - */ - startsWith(searchString: string, position?: number): boolean; - - // Overloads for objects with methods of well-known symbols. - - /** - * Matches a string an object that supports being matched against, and returns an array containing the results of that search. - * @param matcher An object that supports being matched against. - */ - match(matcher: { [Symbol.match](string: string): RegExpMatchArray; }): RegExpMatchArray; - - /** - * Replaces text in a string, using an object that supports replacement within a string. - * @param searchValue A object can search for and replace matches within a string. - * @param replaceValue A string containing the text to replace for every successful match of searchValue in this string. - */ - replace(searchValue: { [Symbol.replace](string: string, replaceValue: string): string; }, replaceValue: string): string; - - /** - * Replaces text in a string, using an object that supports replacement within a string. - * @param searchValue A object can search for and replace matches within a string. - * @param replacer A function that returns the replacement text. - */ - replace(searchValue: { [Symbol.replace](string: string, replacer: (substring: string, ...args: any[]) => string): string; }, replacer: (substring: string, ...args: any[]) => string): string; - - /** - * Finds the first substring match in a regular expression search. - * @param searcher An object which supports searching within a string. - */ - search(searcher: { [Symbol.search](string: string): number; }): number; - - /** - * Split a string into substrings using the specified separator and return them as an array. - * @param splitter An object that can split a string. - * @param limit A value used to limit the number of elements returned in the array. - */ - split(splitter: { [Symbol.split](string: string, limit?: number): string[]; }, limit?: number): string[]; - - /** - * Returns an HTML anchor element and sets the name attribute to the text value - * @param name - */ - anchor(name: string): string; - - /** Returns a HTML element */ - big(): string; - - /** Returns a HTML element */ - blink(): string; - - /** Returns a HTML element */ - bold(): string; - - /** Returns a HTML element */ - fixed(): string - - /** Returns a HTML element and sets the color attribute value */ - fontcolor(color: string): string - - /** Returns a HTML element and sets the size attribute value */ - fontsize(size: number): string; - - /** Returns a HTML element and sets the size attribute value */ - fontsize(size: string): string; - - /** Returns an HTML element */ - italics(): string; - - /** Returns an HTML element and sets the href attribute value */ - link(url: string): string; - - /** Returns a HTML element */ - small(): string; - - /** Returns a HTML element */ - strike(): string; - - /** Returns a HTML element */ - sub(): string; - - /** Returns a HTML element */ - sup(): string; -} - -interface StringConstructor { - /** - * Return the String value whose elements are, in order, the elements in the List elements. - * If length is 0, the empty string is returned. - */ - fromCodePoint(...codePoints: number[]): string; - - /** - * String.raw is intended for use as a tag function of a Tagged Template String. When called - * as such the first argument will be a well formed template call site object and the rest - * parameter will contain the substitution values. - * @param template A well-formed template string call site representation. - * @param substitutions A set of substitution values. - */ - raw(template: TemplateStringsArray, ...substitutions: any[]): string; -} - -interface IteratorResult { - done: boolean; - value?: T; -} - -interface Iterator { - next(value?: any): IteratorResult; - return?(value?: any): IteratorResult; - throw?(e?: any): IteratorResult; -} - -interface Iterable { - [Symbol.iterator](): Iterator; -} - -interface IterableIterator extends Iterator { - [Symbol.iterator](): IterableIterator; -} - -interface GeneratorFunction extends Function { - readonly [Symbol.toStringTag]: "GeneratorFunction"; -} - -interface GeneratorFunctionConstructor { - /** - * Creates a new Generator function. - * @param args A list of arguments the function accepts. - */ - new (...args: string[]): GeneratorFunction; - (...args: string[]): GeneratorFunction; - readonly prototype: GeneratorFunction; -} -declare var GeneratorFunction: GeneratorFunctionConstructor; - -interface Math { - /** - * Returns the number of leading zero bits in the 32-bit binary representation of a number. - * @param x A numeric expression. - */ - clz32(x: number): number; - - /** - * Returns the result of 32-bit multiplication of two numbers. - * @param x First number - * @param y Second number - */ - imul(x: number, y: number): number; - - /** - * Returns the sign of the x, indicating whether x is positive, negative or zero. - * @param x The numeric expression to test - */ - sign(x: number): number; - - /** - * Returns the base 10 logarithm of a number. - * @param x A numeric expression. - */ - log10(x: number): number; - - /** - * Returns the base 2 logarithm of a number. - * @param x A numeric expression. - */ - log2(x: number): number; - - /** - * Returns the natural logarithm of 1 + x. - * @param x A numeric expression. - */ - log1p(x: number): number; - - /** - * Returns the result of (e^x - 1) of x (e raised to the power of x, where e is the base of - * the natural logarithms). - * @param x A numeric expression. - */ - expm1(x: number): number; - - /** - * Returns the hyperbolic cosine of a number. - * @param x A numeric expression that contains an angle measured in radians. - */ - cosh(x: number): number; - - /** - * Returns the hyperbolic sine of a number. - * @param x A numeric expression that contains an angle measured in radians. - */ - sinh(x: number): number; - - /** - * Returns the hyperbolic tangent of a number. - * @param x A numeric expression that contains an angle measured in radians. - */ - tanh(x: number): number; - - /** - * Returns the inverse hyperbolic cosine of a number. - * @param x A numeric expression that contains an angle measured in radians. - */ - acosh(x: number): number; - - /** - * Returns the inverse hyperbolic sine of a number. - * @param x A numeric expression that contains an angle measured in radians. - */ - asinh(x: number): number; - - /** - * Returns the inverse hyperbolic tangent of a number. - * @param x A numeric expression that contains an angle measured in radians. - */ - atanh(x: number): number; - - /** - * Returns the square root of the sum of squares of its arguments. - * @param values Values to compute the square root for. - * If no arguments are passed, the result is +0. - * If there is only one argument, the result is the absolute value. - * If any argument is +Infinity or -Infinity, the result is +Infinity. - * If any argument is NaN, the result is NaN. - * If all arguments are either +0 or −0, the result is +0. - */ - hypot(...values: number[] ): number; - - /** - * Returns the integral part of the a numeric expression, x, removing any fractional digits. - * If x is already an integer, the result is x. - * @param x A numeric expression. - */ - trunc(x: number): number; - - /** - * Returns the nearest single precision float representation of a number. - * @param x A numeric expression. - */ - fround(x: number): number; - - /** - * Returns an implementation-dependent approximation to the cube root of number. - * @param x A numeric expression. - */ - cbrt(x: number): number; - - readonly [Symbol.toStringTag]: "Math"; -} - -interface Date { - /** - * Converts a Date object to a string. - */ - [Symbol.toPrimitive](hint: "default"): string; - /** - * Converts a Date object to a string. - */ - [Symbol.toPrimitive](hint: "string"): string; - /** - * Converts a Date object to a number. - */ - [Symbol.toPrimitive](hint: "number"): number; - /** - * Converts a Date object to a string or number. - * - * @param hint The strings "number", "string", or "default" to specify what primitive to return. - * - * @throws {TypeError} If 'hint' was given something other than "number", "string", or "default". - * @returns A number if 'hint' was "number", a string if 'hint' was "string" or "default". - */ - [Symbol.toPrimitive](hint: string): string | number; -} - -interface RegExp { - /** - * Matches a string with this regular expression, and returns an array containing the results of - * that search. - * @param string A string to search within. - */ - [Symbol.match](string: string): RegExpMatchArray; - - /** - * Replaces text in a string, using this regular expression. - * @param string A String object or string literal whose contents matching against - * this regular expression will be replaced - * @param replaceValue A String object or string literal containing the text to replace for every - * successful match of this regular expression. - */ - [Symbol.replace](string: string, replaceValue: string): string; - - /** - * Replaces text in a string, using this regular expression. - * @param string A String object or string literal whose contents matching against - * this regular expression will be replaced - * @param replacer A function that returns the replacement text. - */ - [Symbol.replace](string: string, replacer: (substring: string, ...args: any[]) => string): string; - - /** - * Finds the position beginning first substring match in a regular expression search - * using this regular expression. - * - * @param string The string to search within. - */ - [Symbol.search](string: string): number; - - /** - * Returns an array of substrings that were delimited by strings in the original input that - * match against this regular expression. - * - * If the regular expression contains capturing parentheses, then each time this - * regular expression matches, the results (including any undefined results) of the - * capturing parentheses are spliced. - * - * @param string string value to split - * @param limit if not undefined, the output array is truncated so that it contains no more - * than 'limit' elements. - */ - [Symbol.split](string: string, limit?: number): string[]; - - /** - * Returns a string indicating the flags of the regular expression in question. This field is read-only. - * The characters in this string are sequenced and concatenated in the following order: - * - * - "g" for global - * - "i" for ignoreCase - * - "m" for multiline - * - "u" for unicode - * - "y" for sticky - * - * If no flags are set, the value is the empty string. - */ - readonly flags: string; - - /** - * Returns a Boolean value indicating the state of the sticky flag (y) used with a regular - * expression. Default is false. Read-only. - */ - readonly sticky: boolean; - - /** - * Returns a Boolean value indicating the state of the Unicode flag (u) used with a regular - * expression. Default is false. Read-only. - */ - readonly unicode: boolean; -} - -interface RegExpConstructor { - [Symbol.species](): RegExpConstructor; -} - -interface Map { - clear(): void; - delete(key: K): boolean; - entries(): IterableIterator<[K, V]>; - forEach(callbackfn: (value: V, index: K, map: Map) => void, thisArg?: any): void; - get(key: K): V; - has(key: K): boolean; - keys(): IterableIterator; - set(key: K, value?: V): Map; - readonly size: number; - values(): IterableIterator; - [Symbol.iterator]():IterableIterator<[K,V]>; - readonly [Symbol.toStringTag]: "Map"; -} - -interface MapConstructor { - new (): Map; - new (): Map; - new (iterable: Iterable<[K, V]>): Map; - readonly prototype: Map; -} -declare var Map: MapConstructor; - -interface WeakMap { - clear(): void; - delete(key: K): boolean; - get(key: K): V; - has(key: K): boolean; - set(key: K, value?: V): WeakMap; - readonly [Symbol.toStringTag]: "WeakMap"; -} - -interface WeakMapConstructor { - new (): WeakMap; - new (): WeakMap; - new (iterable: Iterable<[K, V]>): WeakMap; - readonly prototype: WeakMap; -} -declare var WeakMap: WeakMapConstructor; - -interface Set { - add(value: T): Set; - clear(): void; - delete(value: T): boolean; - entries(): IterableIterator<[T, T]>; - forEach(callbackfn: (value: T, index: T, set: Set) => void, thisArg?: any): void; - has(value: T): boolean; - keys(): IterableIterator; - readonly size: number; - values(): IterableIterator; - [Symbol.iterator]():IterableIterator; - readonly [Symbol.toStringTag]: "Set"; -} - -interface SetConstructor { - new (): Set; - new (): Set; - new (iterable: Iterable): Set; - readonly prototype: Set; -} -declare var Set: SetConstructor; - -interface WeakSet { - add(value: T): WeakSet; - clear(): void; - delete(value: T): boolean; - has(value: T): boolean; - readonly [Symbol.toStringTag]: "WeakSet"; -} - -interface WeakSetConstructor { - new (): WeakSet; - new (): WeakSet; - new (iterable: Iterable): WeakSet; - readonly prototype: WeakSet; -} -declare var WeakSet: WeakSetConstructor; - -interface JSON { - readonly [Symbol.toStringTag]: "JSON"; -} - -/** - * Represents a raw buffer of binary data, which is used to store data for the - * different typed arrays. ArrayBuffers cannot be read from or written to directly, - * but can be passed to a typed array or DataView Object to interpret the raw - * buffer as needed. - */ -interface ArrayBuffer { - readonly [Symbol.toStringTag]: "ArrayBuffer"; -} - -interface DataView { - readonly [Symbol.toStringTag]: "DataView"; -} - -/** - * A typed array of 8-bit integer values. The contents are initialized to 0. If the requested - * number of bytes could not be allocated an exception is raised. - */ -interface Int8Array { - /** - * Returns an array of key, value pairs for every entry in the array - */ - entries(): IterableIterator<[number, number]>; - /** - * Returns an list of keys in the array - */ - keys(): IterableIterator; - /** - * Returns an list of values in the array - */ - values(): IterableIterator; - [Symbol.iterator](): IterableIterator; - readonly [Symbol.toStringTag]: "Int8Array"; -} - -interface Int8ArrayConstructor { - new (elements: Iterable): Int8Array; - - /** - * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Int8Array; -} - -/** - * A typed array of 8-bit unsigned integer values. The contents are initialized to 0. If the - * requested number of bytes could not be allocated an exception is raised. - */ -interface Uint8Array { - /** - * Returns an array of key, value pairs for every entry in the array - */ - entries(): IterableIterator<[number, number]>; - /** - * Returns an list of keys in the array - */ - keys(): IterableIterator; - /** - * Returns an list of values in the array - */ - values(): IterableIterator; - [Symbol.iterator](): IterableIterator; - readonly [Symbol.toStringTag]: "UInt8Array"; -} - -interface Uint8ArrayConstructor { - new (elements: Iterable): Uint8Array; - - /** - * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint8Array; -} - -/** - * A typed array of 8-bit unsigned integer (clamped) values. The contents are initialized to 0. - * If the requested number of bytes could not be allocated an exception is raised. - */ -interface Uint8ClampedArray { - /** - * Returns an array of key, value pairs for every entry in the array - */ - entries(): IterableIterator<[number, number]>; - - /** - * Returns an list of keys in the array - */ - keys(): IterableIterator; - - /** - * Returns an list of values in the array - */ - values(): IterableIterator; - - [Symbol.iterator](): IterableIterator; - readonly [Symbol.toStringTag]: "Uint8ClampedArray"; -} - -interface Uint8ClampedArrayConstructor { - new (elements: Iterable): Uint8ClampedArray; - - - /** - * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint8ClampedArray; -} - -/** - * A typed array of 16-bit signed integer values. The contents are initialized to 0. If the - * requested number of bytes could not be allocated an exception is raised. - */ -interface Int16Array { - /** - * Returns an array of key, value pairs for every entry in the array - */ - entries(): IterableIterator<[number, number]>; - - /** - * Returns an list of keys in the array - */ - keys(): IterableIterator; - - /** - * Returns an list of values in the array - */ - values(): IterableIterator; - - - [Symbol.iterator](): IterableIterator; - readonly [Symbol.toStringTag]: "Int16Array"; -} - -interface Int16ArrayConstructor { - new (elements: Iterable): Int16Array; - - /** - * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Int16Array; -} - -/** - * A typed array of 16-bit unsigned integer values. The contents are initialized to 0. If the - * requested number of bytes could not be allocated an exception is raised. - */ -interface Uint16Array { - /** - * Returns an array of key, value pairs for every entry in the array - */ - entries(): IterableIterator<[number, number]>; - /** - * Returns an list of keys in the array - */ - keys(): IterableIterator; - /** - * Returns an list of values in the array - */ - values(): IterableIterator; - [Symbol.iterator](): IterableIterator; - readonly [Symbol.toStringTag]: "Uint16Array"; -} - -interface Uint16ArrayConstructor { - new (elements: Iterable): Uint16Array; - - /** - * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint16Array; -} - -/** - * A typed array of 32-bit signed integer values. The contents are initialized to 0. If the - * requested number of bytes could not be allocated an exception is raised. - */ -interface Int32Array { - /** - * Returns an array of key, value pairs for every entry in the array - */ - entries(): IterableIterator<[number, number]>; - /** - * Returns an list of keys in the array - */ - keys(): IterableIterator; - /** - * Returns an list of values in the array - */ - values(): IterableIterator; - [Symbol.iterator](): IterableIterator; - readonly [Symbol.toStringTag]: "Int32Array"; -} - -interface Int32ArrayConstructor { - new (elements: Iterable): Int32Array; - - /** - * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Int32Array; -} - -/** - * A typed array of 32-bit unsigned integer values. The contents are initialized to 0. If the - * requested number of bytes could not be allocated an exception is raised. - */ -interface Uint32Array { - /** - * Returns an array of key, value pairs for every entry in the array - */ - entries(): IterableIterator<[number, number]>; - /** - * Returns an list of keys in the array - */ - keys(): IterableIterator; - /** - * Returns an list of values in the array - */ - values(): IterableIterator; - [Symbol.iterator](): IterableIterator; - readonly [Symbol.toStringTag]: "Uint32Array"; -} - -interface Uint32ArrayConstructor { - new (elements: Iterable): Uint32Array; - - /** - * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint32Array; -} - -/** - * A typed array of 32-bit float values. The contents are initialized to 0. If the requested number - * of bytes could not be allocated an exception is raised. - */ -interface Float32Array { - /** - * Returns an array of key, value pairs for every entry in the array - */ - entries(): IterableIterator<[number, number]>; - /** - * Returns an list of keys in the array - */ - keys(): IterableIterator; - /** - * Returns an list of values in the array - */ - values(): IterableIterator; - [Symbol.iterator](): IterableIterator; - readonly [Symbol.toStringTag]: "Float32Array"; -} - -interface Float32ArrayConstructor { - new (elements: Iterable): Float32Array; - - /** - * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Float32Array; -} - -/** - * A typed array of 64-bit float values. The contents are initialized to 0. If the requested - * number of bytes could not be allocated an exception is raised. - */ -interface Float64Array { - /** - * Returns an array of key, value pairs for every entry in the array - */ - entries(): IterableIterator<[number, number]>; - /** - * Returns an list of keys in the array - */ - keys(): IterableIterator; - /** - * Returns an list of values in the array - */ - values(): IterableIterator; - [Symbol.iterator](): IterableIterator; - readonly [Symbol.toStringTag]: "Float64Array"; -} - -interface Float64ArrayConstructor { - new (elements: Iterable): Float64Array; - - /** - * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Float64Array; -} - -interface ProxyHandler { - getPrototypeOf? (target: T): any; - setPrototypeOf? (target: T, v: any): boolean; - isExtensible? (target: T): boolean; - preventExtensions? (target: T): boolean; - getOwnPropertyDescriptor? (target: T, p: PropertyKey): PropertyDescriptor; - has? (target: T, p: PropertyKey): boolean; - get? (target: T, p: PropertyKey, receiver: any): any; - set? (target: T, p: PropertyKey, value: any, receiver: any): boolean; - deleteProperty? (target: T, p: PropertyKey): boolean; - defineProperty? (target: T, p: PropertyKey, attributes: PropertyDescriptor): boolean; - enumerate? (target: T): PropertyKey[]; - ownKeys? (target: T): PropertyKey[]; - apply? (target: T, thisArg: any, argArray?: any): any; - construct? (target: T, thisArg: any, argArray?: any): any; -} - -interface ProxyConstructor { - revocable(target: T, handler: ProxyHandler): { proxy: T; revoke: () => void; }; - new (target: T, handler: ProxyHandler): T -} -declare var Proxy: ProxyConstructor; - -declare namespace Reflect { - function apply(target: Function, thisArgument: any, argumentsList: ArrayLike): any; - function construct(target: Function, argumentsList: ArrayLike, newTarget?: any): any; - function defineProperty(target: any, propertyKey: PropertyKey, attributes: PropertyDescriptor): boolean; - function deleteProperty(target: any, propertyKey: PropertyKey): boolean; - function enumerate(target: any): IterableIterator; - function get(target: any, propertyKey: PropertyKey, receiver?: any): any; - function getOwnPropertyDescriptor(target: any, propertyKey: PropertyKey): PropertyDescriptor; - function getPrototypeOf(target: any): any; - function has(target: any, propertyKey: string): boolean; - function has(target: any, propertyKey: symbol): boolean; - function isExtensible(target: any): boolean; - function ownKeys(target: any): Array; - function preventExtensions(target: any): boolean; - function set(target: any, propertyKey: PropertyKey, value: any, receiver?: any): boolean; - function setPrototypeOf(target: any, proto: any): boolean; -} - -/** - * Represents the completion of an asynchronous operation - */ -interface Promise { - /** - * Attaches callbacks for the resolution and/or rejection of the Promise. - * @param onfulfilled The callback to execute when the Promise is resolved. - * @param onrejected The callback to execute when the Promise is rejected. - * @returns A Promise for the completion of which ever callback is executed. - */ - then(onfulfilled?: (value: T) => TResult | PromiseLike, onrejected?: (reason: any) => TResult | PromiseLike): Promise; - then(onfulfilled?: (value: T) => TResult | PromiseLike, onrejected?: (reason: any) => void): Promise; - - /** - * Attaches a callback for only the rejection of the Promise. - * @param onrejected The callback to execute when the Promise is rejected. - * @returns A Promise for the completion of the callback. - */ - catch(onrejected?: (reason: any) => T | PromiseLike): Promise; - catch(onrejected?: (reason: any) => void): Promise; - - readonly [Symbol.toStringTag]: "Promise"; -} - -interface PromiseConstructor { - /** - * A reference to the prototype. - */ - readonly prototype: Promise; - - /** - * Creates a new Promise. - * @param executor A callback used to initialize the promise. This callback is passed two arguments: - * a resolve callback used resolve the promise with a value or the result of another promise, - * and a reject callback used to reject the promise with a provided reason or error. - */ - new (executor: (resolve: (value?: T | PromiseLike) => void, reject: (reason?: any) => void) => void): Promise; - - /** - * Creates a Promise that is resolved with an array of results when all of the provided Promises - * resolve, or rejected when any Promise is rejected. - * @param values An array of Promises. - * @returns A new Promise. - */ - 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]>; - 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]>; - 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]>; - all(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike , T5 | PromiseLike, T6 | PromiseLike, T7 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6, T7]>; - all(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike , T5 | PromiseLike, T6 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6]>; - all(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike , T5 | PromiseLike]): Promise<[T1, T2, T3, T4, T5]>; - all(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike ]): Promise<[T1, T2, T3, T4]>; - all(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike]): Promise<[T1, T2, T3]>; - all(values: [T1 | PromiseLike, T2 | PromiseLike]): Promise<[T1, T2]>; - all(values: Iterable>): Promise; - - /** - * Creates a Promise that is resolved or rejected when any of the provided Promises are resolved - * or rejected. - * @param values An array of Promises. - * @returns A new Promise. - */ - race(values: Iterable>): Promise; - - /** - * Creates a new rejected promise for the provided reason. - * @param reason The reason the promise was rejected. - * @returns A new rejected Promise. - */ - reject(reason: any): Promise; - - /** - * Creates a new rejected promise for the provided reason. - * @param reason The reason the promise was rejected. - * @returns A new rejected Promise. - */ - reject(reason: any): Promise; - - /** - * Creates a new resolved promise for the provided value. - * @param value A promise. - * @returns A promise whose internal state matches the provided promise. - */ - resolve(value: T | PromiseLike): Promise; - - /** - * Creates a new resolved promise . - * @returns A resolved promise. - */ - resolve(): Promise; - - readonly [Symbol.species]: Function; -} - -declare var Promise: PromiseConstructor; diff --git a/lib/lib.core.es7.d.ts b/lib/lib.core.es7.d.ts deleted file mode 100644 index b5552f62929..00000000000 --- a/lib/lib.core.es7.d.ts +++ /dev/null @@ -1,5344 +0,0 @@ -/*! ***************************************************************************** -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. -***************************************************************************** */ - -/// -///////////////////////////// -/// ECMAScript APIs -///////////////////////////// - -declare const NaN: number; -declare const Infinity: number; - -/** - * Evaluates JavaScript code and executes it. - * @param x A String value that contains valid JavaScript code. - */ -declare function eval(x: string): any; - -/** - * Converts A string to an integer. - * @param s A string to convert into a number. - * @param radix A value between 2 and 36 that specifies the base of the number in numString. - * If this argument is not supplied, strings with a prefix of '0x' are considered hexadecimal. - * All other strings are considered decimal. - */ -declare function parseInt(s: string, radix?: number): number; - -/** - * Converts a string to a floating-point number. - * @param string A string that contains a floating-point number. - */ -declare function parseFloat(string: string): number; - -/** - * Returns a Boolean value that indicates whether a value is the reserved value NaN (not a number). - * @param number A numeric value. - */ -declare function isNaN(number: number): boolean; - -/** - * Determines whether a supplied number is finite. - * @param number Any numeric value. - */ -declare function isFinite(number: number): boolean; - -/** - * Gets the unencoded version of an encoded Uniform Resource Identifier (URI). - * @param encodedURI A value representing an encoded URI. - */ -declare function decodeURI(encodedURI: string): string; - -/** - * Gets the unencoded version of an encoded component of a Uniform Resource Identifier (URI). - * @param encodedURIComponent A value representing an encoded URI component. - */ -declare function decodeURIComponent(encodedURIComponent: string): string; - -/** - * Encodes a text string as a valid Uniform Resource Identifier (URI) - * @param uri A value representing an encoded URI. - */ -declare function encodeURI(uri: string): string; - -/** - * Encodes a text string as a valid component of a Uniform Resource Identifier (URI). - * @param uriComponent A value representing an encoded URI component. - */ -declare function encodeURIComponent(uriComponent: string): string; - -interface PropertyDescriptor { - configurable?: boolean; - enumerable?: boolean; - value?: any; - writable?: boolean; - get? (): any; - set? (v: any): void; -} - -interface PropertyDescriptorMap { - [s: string]: PropertyDescriptor; -} - -interface Object { - /** The initial value of Object.prototype.constructor is the standard built-in Object constructor. */ - constructor: Function; - - /** Returns a string representation of an object. */ - toString(): string; - - /** Returns a date converted to a string using the current locale. */ - toLocaleString(): string; - - /** Returns the primitive value of the specified object. */ - valueOf(): Object; - - /** - * Determines whether an object has a property with the specified name. - * @param v A property name. - */ - hasOwnProperty(v: string): boolean; - - /** - * Determines whether an object exists in another object's prototype chain. - * @param v Another object whose prototype chain is to be checked. - */ - isPrototypeOf(v: Object): boolean; - - /** - * Determines whether a specified property is enumerable. - * @param v A property name. - */ - propertyIsEnumerable(v: string): boolean; -} - -interface ObjectConstructor { - new (value?: any): Object; - (): any; - (value: any): any; - - /** A reference to the prototype for a class of objects. */ - readonly prototype: Object; - - /** - * Returns the prototype of an object. - * @param o The object that references the prototype. - */ - getPrototypeOf(o: any): any; - - /** - * Gets the own property descriptor of the specified object. - * An own property descriptor is one that is defined directly on the object and is not inherited from the object's prototype. - * @param o Object that contains the property. - * @param p Name of the property. - */ - getOwnPropertyDescriptor(o: any, p: string): PropertyDescriptor; - - /** - * Returns the names of the own properties of an object. The own properties of an object are those that are defined directly - * on that object, and are not inherited from the object's prototype. The properties of an object include both fields (objects) and functions. - * @param o Object that contains the own properties. - */ - getOwnPropertyNames(o: any): string[]; - - /** - * Creates an object that has the specified prototype, and that optionally contains specified properties. - * @param o Object to use as a prototype. May be null - * @param properties JavaScript object that contains one or more property descriptors. - */ - create(o: any, properties?: PropertyDescriptorMap): any; - - /** - * Adds a property to an object, or modifies attributes of an existing property. - * @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. - * @param p The property name. - * @param attributes Descriptor for the property. It can be for a data property or an accessor property. - */ - defineProperty(o: any, p: string, attributes: PropertyDescriptor): any; - - /** - * Adds one or more properties to an object, and/or modifies attributes of existing properties. - * @param o Object on which to add or modify the properties. This can be a native JavaScript object or a DOM object. - * @param properties JavaScript object that contains one or more descriptor objects. Each descriptor object describes a data property or an accessor property. - */ - defineProperties(o: any, properties: PropertyDescriptorMap): any; - - /** - * Prevents the modification of attributes of existing properties, and prevents the addition of new properties. - * @param o Object on which to lock the attributes. - */ - seal(o: T): T; - - /** - * Prevents the modification of existing property attributes and values, and prevents the addition of new properties. - * @param o Object on which to lock the attributes. - */ - freeze(o: T): T; - - /** - * Prevents the addition of new properties to an object. - * @param o Object to make non-extensible. - */ - preventExtensions(o: T): T; - - /** - * Returns true if existing property attributes cannot be modified in an object and new properties cannot be added to the object. - * @param o Object to test. - */ - isSealed(o: any): boolean; - - /** - * Returns true if existing property attributes and values cannot be modified in an object, and new properties cannot be added to the object. - * @param o Object to test. - */ - isFrozen(o: any): boolean; - - /** - * Returns a value that indicates whether new properties can be added to an object. - * @param o Object to test. - */ - isExtensible(o: any): boolean; - - /** - * Returns the names of the enumerable properties and methods of an object. - * @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. - */ - keys(o: any): string[]; -} - -/** - * Provides functionality common to all JavaScript objects. - */ -declare const Object: ObjectConstructor; - -/** - * Creates a new function. - */ -interface Function { - /** - * Calls the function, substituting the specified object for the this value of the function, and the specified array for the arguments of the function. - * @param thisArg The object to be used as the this object. - * @param argArray A set of arguments to be passed to the function. - */ - apply(thisArg: any, argArray?: any): any; - - /** - * Calls a method of an object, substituting another object for the current object. - * @param thisArg The object to be used as the current object. - * @param argArray A list of arguments to be passed to the method. - */ - call(thisArg: any, ...argArray: any[]): any; - - /** - * For a given function, creates a bound function that has the same body as the original function. - * The this object of the bound function is associated with the specified object, and has the specified initial parameters. - * @param thisArg An object to which the this keyword can refer inside the new function. - * @param argArray A list of arguments to be passed to the new function. - */ - bind(thisArg: any, ...argArray: any[]): any; - - prototype: any; - readonly length: number; - - // Non-standard extensions - arguments: any; - caller: Function; -} - -interface FunctionConstructor { - /** - * Creates a new function. - * @param args A list of arguments the function accepts. - */ - new (...args: string[]): Function; - (...args: string[]): Function; - readonly prototype: Function; -} - -declare const Function: FunctionConstructor; - -interface IArguments { - [index: number]: any; - length: number; - callee: Function; -} - -interface String { - /** Returns a string representation of a string. */ - toString(): string; - - /** - * Returns the character at the specified index. - * @param pos The zero-based index of the desired character. - */ - charAt(pos: number): string; - - /** - * Returns the Unicode value of the character at the specified location. - * @param index The zero-based index of the desired character. If there is no character at the specified index, NaN is returned. - */ - charCodeAt(index: number): number; - - /** - * Returns a string that contains the concatenation of two or more strings. - * @param strings The strings to append to the end of the string. - */ - concat(...strings: string[]): string; - - /** - * Returns the position of the first occurrence of a substring. - * @param searchString The substring to search for in the string - * @param position The index at which to begin searching the String object. If omitted, search starts at the beginning of the string. - */ - indexOf(searchString: string, position?: number): number; - - /** - * Returns the last occurrence of a substring in the string. - * @param searchString The substring to search for. - * @param position The index at which to begin searching. If omitted, the search begins at the end of the string. - */ - lastIndexOf(searchString: string, position?: number): number; - - /** - * Determines whether two strings are equivalent in the current locale. - * @param that String to compare to target string - */ - localeCompare(that: string): number; - - /** - * Matches a string with a regular expression, and returns an array containing the results of that search. - * @param regexp A variable name or string literal containing the regular expression pattern and flags. - */ - match(regexp: string): RegExpMatchArray; - - /** - * Matches a string with a regular expression, and returns an array containing the results of that search. - * @param regexp A regular expression object that contains the regular expression pattern and applicable flags. - */ - match(regexp: RegExp): RegExpMatchArray; - - /** - * Replaces text in a string, using a regular expression or search string. - * @param searchValue A string that represents the regular expression. - * @param replaceValue A string containing the text to replace for every successful match of searchValue in this string. - */ - replace(searchValue: string, replaceValue: string): string; - - /** - * Replaces text in a string, using a regular expression or search string. - * @param searchValue A string that represents the regular expression. - * @param replacer A function that returns the replacement text. - */ - replace(searchValue: string, replacer: (substring: string, ...args: any[]) => string): string; - - /** - * Replaces text in a string, using a regular expression or search string. - * @param searchValue A Regular Expression object containing the regular expression pattern and applicable flags. - * @param replaceValue A string containing the text to replace for every successful match of searchValue in this string. - */ - replace(searchValue: RegExp, replaceValue: string): string; - - /** - * Replaces text in a string, using a regular expression or search string. - * @param searchValue A Regular Expression object containing the regular expression pattern and applicable flags - * @param replacer A function that returns the replacement text. - */ - replace(searchValue: RegExp, replacer: (substring: string, ...args: any[]) => string): string; - - /** - * Finds the first substring match in a regular expression search. - * @param regexp The regular expression pattern and applicable flags. - */ - search(regexp: string): number; - - /** - * Finds the first substring match in a regular expression search. - * @param regexp The regular expression pattern and applicable flags. - */ - search(regexp: RegExp): number; - - /** - * Returns a section of a string. - * @param start The index to the beginning of the specified portion of stringObj. - * @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. - * If this value is not specified, the substring continues to the end of stringObj. - */ - slice(start?: number, end?: number): string; - - /** - * Split a string into substrings using the specified separator and return them as an array. - * @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. - * @param limit A value used to limit the number of elements returned in the array. - */ - split(separator: string, limit?: number): string[]; - - /** - * Split a string into substrings using the specified separator and return them as an array. - * @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. - * @param limit A value used to limit the number of elements returned in the array. - */ - split(separator: RegExp, limit?: number): string[]; - - /** - * Returns the substring at the specified location within a String object. - * @param start The zero-based index number indicating the beginning of the substring. - * @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. - * If end is omitted, the characters from start through the end of the original string are returned. - */ - substring(start: number, end?: number): string; - - /** Converts all the alphabetic characters in a string to lowercase. */ - toLowerCase(): string; - - /** Converts all alphabetic characters to lowercase, taking into account the host environment's current locale. */ - toLocaleLowerCase(): string; - - /** Converts all the alphabetic characters in a string to uppercase. */ - toUpperCase(): string; - - /** Returns a string where all alphabetic characters have been converted to uppercase, taking into account the host environment's current locale. */ - toLocaleUpperCase(): string; - - /** Removes the leading and trailing white space and line terminator characters from a string. */ - trim(): string; - - /** Returns the length of a String object. */ - readonly length: number; - - // IE extensions - /** - * Gets a substring beginning at the specified location and having the specified length. - * @param from The starting position of the desired substring. The index of the first character in the string is zero. - * @param length The number of characters to include in the returned substring. - */ - substr(from: number, length?: number): string; - - /** Returns the primitive value of the specified object. */ - valueOf(): string; - - readonly [index: number]: string; -} - -interface StringConstructor { - new (value?: any): String; - (value?: any): string; - readonly prototype: String; - fromCharCode(...codes: number[]): string; -} - -/** - * Allows manipulation and formatting of text strings and determination and location of substrings within strings. - */ -declare const String: StringConstructor; - -interface Boolean { - /** Returns the primitive value of the specified object. */ - valueOf(): boolean; -} - -interface BooleanConstructor { - new (value?: any): Boolean; - (value?: any): boolean; - readonly prototype: Boolean; -} - -declare const Boolean: BooleanConstructor; - -interface Number { - /** - * Returns a string representation of an object. - * @param radix Specifies a radix for converting numeric values to strings. This value is only used for numbers. - */ - toString(radix?: number): string; - - /** - * Returns a string representing a number in fixed-point notation. - * @param fractionDigits Number of digits after the decimal point. Must be in the range 0 - 20, inclusive. - */ - toFixed(fractionDigits?: number): string; - - /** - * Returns a string containing a number represented in exponential notation. - * @param fractionDigits Number of digits after the decimal point. Must be in the range 0 - 20, inclusive. - */ - toExponential(fractionDigits?: number): string; - - /** - * Returns a string containing a number represented either in exponential or fixed-point notation with a specified number of digits. - * @param precision Number of significant digits. Must be in the range 1 - 21, inclusive. - */ - toPrecision(precision?: number): string; - - /** Returns the primitive value of the specified object. */ - valueOf(): number; -} - -interface NumberConstructor { - new (value?: any): Number; - (value?: any): number; - readonly prototype: Number; - - /** The largest number that can be represented in JavaScript. Equal to approximately 1.79E+308. */ - readonly MAX_VALUE: number; - - /** The closest number to zero that can be represented in JavaScript. Equal to approximately 5.00E-324. */ - readonly MIN_VALUE: number; - - /** - * A value that is not a number. - * In equality comparisons, NaN does not equal any value, including itself. To test whether a value is equivalent to NaN, use the isNaN function. - */ - readonly NaN: number; - - /** - * A value that is less than the largest negative number that can be represented in JavaScript. - * JavaScript displays NEGATIVE_INFINITY values as -infinity. - */ - readonly NEGATIVE_INFINITY: number; - - /** - * A value greater than the largest number that can be represented in JavaScript. - * JavaScript displays POSITIVE_INFINITY values as infinity. - */ - readonly POSITIVE_INFINITY: number; -} - -/** An object that represents a number of any kind. All JavaScript numbers are 64-bit floating-point numbers. */ -declare const Number: NumberConstructor; - -interface TemplateStringsArray extends Array { - readonly raw: string[]; -} - -interface Math { - /** The mathematical constant e. This is Euler's number, the base of natural logarithms. */ - readonly E: number; - /** The natural logarithm of 10. */ - readonly LN10: number; - /** The natural logarithm of 2. */ - readonly LN2: number; - /** The base-2 logarithm of e. */ - readonly LOG2E: number; - /** The base-10 logarithm of e. */ - readonly LOG10E: number; - /** Pi. This is the ratio of the circumference of a circle to its diameter. */ - readonly PI: number; - /** The square root of 0.5, or, equivalently, one divided by the square root of 2. */ - readonly SQRT1_2: number; - /** The square root of 2. */ - readonly SQRT2: number; - /** - * Returns the absolute value of a number (the value without regard to whether it is positive or negative). - * For example, the absolute value of -5 is the same as the absolute value of 5. - * @param x A numeric expression for which the absolute value is needed. - */ - abs(x: number): number; - /** - * Returns the arc cosine (or inverse cosine) of a number. - * @param x A numeric expression. - */ - acos(x: number): number; - /** - * Returns the arcsine of a number. - * @param x A numeric expression. - */ - asin(x: number): number; - /** - * Returns the arctangent of a number. - * @param x A numeric expression for which the arctangent is needed. - */ - atan(x: number): number; - /** - * Returns the angle (in radians) from the X axis to a point. - * @param y A numeric expression representing the cartesian y-coordinate. - * @param x A numeric expression representing the cartesian x-coordinate. - */ - atan2(y: number, x: number): number; - /** - * Returns the smallest number greater than or equal to its numeric argument. - * @param x A numeric expression. - */ - ceil(x: number): number; - /** - * Returns the cosine of a number. - * @param x A numeric expression that contains an angle measured in radians. - */ - cos(x: number): number; - /** - * Returns e (the base of natural logarithms) raised to a power. - * @param x A numeric expression representing the power of e. - */ - exp(x: number): number; - /** - * Returns the greatest number less than or equal to its numeric argument. - * @param x A numeric expression. - */ - floor(x: number): number; - /** - * Returns the natural logarithm (base e) of a number. - * @param x A numeric expression. - */ - log(x: number): number; - /** - * Returns the larger of a set of supplied numeric expressions. - * @param values Numeric expressions to be evaluated. - */ - max(...values: number[]): number; - /** - * Returns the smaller of a set of supplied numeric expressions. - * @param values Numeric expressions to be evaluated. - */ - min(...values: number[]): number; - /** - * Returns the value of a base expression taken to a specified power. - * @param x The base value of the expression. - * @param y The exponent value of the expression. - */ - pow(x: number, y: number): number; - /** Returns a pseudorandom number between 0 and 1. */ - random(): number; - /** - * Returns a supplied numeric expression rounded to the nearest number. - * @param x The value to be rounded to the nearest number. - */ - round(x: number): number; - /** - * Returns the sine of a number. - * @param x A numeric expression that contains an angle measured in radians. - */ - sin(x: number): number; - /** - * Returns the square root of a number. - * @param x A numeric expression. - */ - sqrt(x: number): number; - /** - * Returns the tangent of a number. - * @param x A numeric expression that contains an angle measured in radians. - */ - tan(x: number): number; -} -/** An intrinsic object that provides basic mathematics functionality and constants. */ -declare const Math: Math; - -/** Enables basic storage and retrieval of dates and times. */ -interface Date { - /** Returns a string representation of a date. The format of the string depends on the locale. */ - toString(): string; - /** Returns a date as a string value. */ - toDateString(): string; - /** Returns a time as a string value. */ - toTimeString(): string; - /** Returns a value as a string value appropriate to the host environment's current locale. */ - toLocaleString(): string; - /** Returns a date as a string value appropriate to the host environment's current locale. */ - toLocaleDateString(): string; - /** Returns a time as a string value appropriate to the host environment's current locale. */ - toLocaleTimeString(): string; - /** Returns the stored time value in milliseconds since midnight, January 1, 1970 UTC. */ - valueOf(): number; - /** Gets the time value in milliseconds. */ - getTime(): number; - /** Gets the year, using local time. */ - getFullYear(): number; - /** Gets the year using Universal Coordinated Time (UTC). */ - getUTCFullYear(): number; - /** Gets the month, using local time. */ - getMonth(): number; - /** Gets the month of a Date object using Universal Coordinated Time (UTC). */ - getUTCMonth(): number; - /** Gets the day-of-the-month, using local time. */ - getDate(): number; - /** Gets the day-of-the-month, using Universal Coordinated Time (UTC). */ - getUTCDate(): number; - /** Gets the day of the week, using local time. */ - getDay(): number; - /** Gets the day of the week using Universal Coordinated Time (UTC). */ - getUTCDay(): number; - /** Gets the hours in a date, using local time. */ - getHours(): number; - /** Gets the hours value in a Date object using Universal Coordinated Time (UTC). */ - getUTCHours(): number; - /** Gets the minutes of a Date object, using local time. */ - getMinutes(): number; - /** Gets the minutes of a Date object using Universal Coordinated Time (UTC). */ - getUTCMinutes(): number; - /** Gets the seconds of a Date object, using local time. */ - getSeconds(): number; - /** Gets the seconds of a Date object using Universal Coordinated Time (UTC). */ - getUTCSeconds(): number; - /** Gets the milliseconds of a Date, using local time. */ - getMilliseconds(): number; - /** Gets the milliseconds of a Date object using Universal Coordinated Time (UTC). */ - getUTCMilliseconds(): number; - /** Gets the difference in minutes between the time on the local computer and Universal Coordinated Time (UTC). */ - getTimezoneOffset(): number; - /** - * Sets the date and time value in the Date object. - * @param time A numeric value representing the number of elapsed milliseconds since midnight, January 1, 1970 GMT. - */ - setTime(time: number): number; - /** - * Sets the milliseconds value in the Date object using local time. - * @param ms A numeric value equal to the millisecond value. - */ - setMilliseconds(ms: number): number; - /** - * Sets the milliseconds value in the Date object using Universal Coordinated Time (UTC). - * @param ms A numeric value equal to the millisecond value. - */ - setUTCMilliseconds(ms: number): number; - - /** - * Sets the seconds value in the Date object using local time. - * @param sec A numeric value equal to the seconds value. - * @param ms A numeric value equal to the milliseconds value. - */ - setSeconds(sec: number, ms?: number): number; - /** - * Sets the seconds value in the Date object using Universal Coordinated Time (UTC). - * @param sec A numeric value equal to the seconds value. - * @param ms A numeric value equal to the milliseconds value. - */ - setUTCSeconds(sec: number, ms?: number): number; - /** - * Sets the minutes value in the Date object using local time. - * @param min A numeric value equal to the minutes value. - * @param sec A numeric value equal to the seconds value. - * @param ms A numeric value equal to the milliseconds value. - */ - setMinutes(min: number, sec?: number, ms?: number): number; - /** - * Sets the minutes value in the Date object using Universal Coordinated Time (UTC). - * @param min A numeric value equal to the minutes value. - * @param sec A numeric value equal to the seconds value. - * @param ms A numeric value equal to the milliseconds value. - */ - setUTCMinutes(min: number, sec?: number, ms?: number): number; - /** - * Sets the hour value in the Date object using local time. - * @param hours A numeric value equal to the hours value. - * @param min A numeric value equal to the minutes value. - * @param sec A numeric value equal to the seconds value. - * @param ms A numeric value equal to the milliseconds value. - */ - setHours(hours: number, min?: number, sec?: number, ms?: number): number; - /** - * Sets the hours value in the Date object using Universal Coordinated Time (UTC). - * @param hours A numeric value equal to the hours value. - * @param min A numeric value equal to the minutes value. - * @param sec A numeric value equal to the seconds value. - * @param ms A numeric value equal to the milliseconds value. - */ - setUTCHours(hours: number, min?: number, sec?: number, ms?: number): number; - /** - * Sets the numeric day-of-the-month value of the Date object using local time. - * @param date A numeric value equal to the day of the month. - */ - setDate(date: number): number; - /** - * Sets the numeric day of the month in the Date object using Universal Coordinated Time (UTC). - * @param date A numeric value equal to the day of the month. - */ - setUTCDate(date: number): number; - /** - * Sets the month value in the Date object using local time. - * @param month A numeric value equal to the month. The value for January is 0, and other month values follow consecutively. - * @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. - */ - setMonth(month: number, date?: number): number; - /** - * Sets the month value in the Date object using Universal Coordinated Time (UTC). - * @param month A numeric value equal to the month. The value for January is 0, and other month values follow consecutively. - * @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. - */ - setUTCMonth(month: number, date?: number): number; - /** - * Sets the year of the Date object using local time. - * @param year A numeric value for the year. - * @param month A zero-based numeric value for the month (0 for January, 11 for December). Must be specified if numDate is specified. - * @param date A numeric value equal for the day of the month. - */ - setFullYear(year: number, month?: number, date?: number): number; - /** - * Sets the year value in the Date object using Universal Coordinated Time (UTC). - * @param year A numeric value equal to the year. - * @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. - * @param date A numeric value equal to the day of the month. - */ - setUTCFullYear(year: number, month?: number, date?: number): number; - /** Returns a date converted to a string using Universal Coordinated Time (UTC). */ - toUTCString(): string; - /** Returns a date as a string value in ISO format. */ - toISOString(): string; - /** Used by the JSON.stringify method to enable the transformation of an object's data for JavaScript Object Notation (JSON) serialization. */ - toJSON(key?: any): string; -} - -interface DateConstructor { - new (): Date; - new (value: number): Date; - new (value: string): Date; - new (year: number, month: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): Date; - (): string; - readonly prototype: Date; - /** - * Parses a string containing a date, and returns the number of milliseconds between that date and midnight, January 1, 1970. - * @param s A date string - */ - parse(s: string): number; - /** - * Returns the number of milliseconds between midnight, January 1, 1970 Universal Coordinated Time (UTC) (or GMT) and the specified date. - * @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. - * @param month The month as an number between 0 and 11 (January to December). - * @param date The date as an number between 1 and 31. - * @param hours Must be supplied if minutes is supplied. An number from 0 to 23 (midnight to 11pm) that specifies the hour. - * @param minutes Must be supplied if seconds is supplied. An number from 0 to 59 that specifies the minutes. - * @param seconds Must be supplied if milliseconds is supplied. An number from 0 to 59 that specifies the seconds. - * @param ms An number from 0 to 999 that specifies the milliseconds. - */ - UTC(year: number, month: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): number; - now(): number; -} - -declare const Date: DateConstructor; - -interface RegExpMatchArray extends Array { - index?: number; - input?: string; -} - -interface RegExpExecArray extends Array { - index: number; - input: string; -} - -interface RegExp { - /** - * Executes a search on a string using a regular expression pattern, and returns an array containing the results of that search. - * @param string The String object or string literal on which to perform the search. - */ - exec(string: string): RegExpExecArray; - - /** - * Returns a Boolean value that indicates whether or not a pattern exists in a searched string. - * @param string String on which to perform the search. - */ - test(string: string): boolean; - - /** 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. */ - readonly source: string; - - /** Returns a Boolean value indicating the state of the global flag (g) used with a regular expression. Default is false. Read-only. */ - readonly global: boolean; - - /** Returns a Boolean value indicating the state of the ignoreCase flag (i) used with a regular expression. Default is false. Read-only. */ - readonly ignoreCase: boolean; - - /** Returns a Boolean value indicating the state of the multiline flag (m) used with a regular expression. Default is false. Read-only. */ - readonly multiline: boolean; - - lastIndex: number; - - // Non-standard extensions - compile(): RegExp; -} - -interface RegExpConstructor { - new (pattern: string, flags?: string): RegExp; - (pattern: string, flags?: string): RegExp; - readonly prototype: RegExp; - - // Non-standard extensions - $1: string; - $2: string; - $3: string; - $4: string; - $5: string; - $6: string; - $7: string; - $8: string; - $9: string; - lastMatch: string; -} - -declare const RegExp: RegExpConstructor; - -interface Error { - name: string; - message: string; -} - -interface ErrorConstructor { - new (message?: string): Error; - (message?: string): Error; - readonly prototype: Error; -} - -declare const Error: ErrorConstructor; - -interface EvalError extends Error { -} - -interface EvalErrorConstructor { - new (message?: string): EvalError; - (message?: string): EvalError; - readonly prototype: EvalError; -} - -declare const EvalError: EvalErrorConstructor; - -interface RangeError extends Error { -} - -interface RangeErrorConstructor { - new (message?: string): RangeError; - (message?: string): RangeError; - readonly prototype: RangeError; -} - -declare const RangeError: RangeErrorConstructor; - -interface ReferenceError extends Error { -} - -interface ReferenceErrorConstructor { - new (message?: string): ReferenceError; - (message?: string): ReferenceError; - readonly prototype: ReferenceError; -} - -declare const ReferenceError: ReferenceErrorConstructor; - -interface SyntaxError extends Error { -} - -interface SyntaxErrorConstructor { - new (message?: string): SyntaxError; - (message?: string): SyntaxError; - readonly prototype: SyntaxError; -} - -declare const SyntaxError: SyntaxErrorConstructor; - -interface TypeError extends Error { -} - -interface TypeErrorConstructor { - new (message?: string): TypeError; - (message?: string): TypeError; - readonly prototype: TypeError; -} - -declare const TypeError: TypeErrorConstructor; - -interface URIError extends Error { -} - -interface URIErrorConstructor { - new (message?: string): URIError; - (message?: string): URIError; - readonly prototype: URIError; -} - -declare const URIError: URIErrorConstructor; - -interface JSON { - /** - * Converts a JavaScript Object Notation (JSON) string into an object. - * @param text A valid JSON string. - * @param reviver A function that transforms the results. This function is called for each member of the object. - * If a member contains nested objects, the nested objects are transformed before the parent object is. - */ - parse(text: string, reviver?: (key: any, value: any) => any): any; - /** - * Converts a JavaScript value to a JavaScript Object Notation (JSON) string. - * @param value A JavaScript value, usually an object or array, to be converted. - */ - stringify(value: any): string; - /** - * Converts a JavaScript value to a JavaScript Object Notation (JSON) string. - * @param value A JavaScript value, usually an object or array, to be converted. - * @param replacer A function that transforms the results. - */ - stringify(value: any, replacer: (key: string, value: any) => any): string; - /** - * Converts a JavaScript value to a JavaScript Object Notation (JSON) string. - * @param value A JavaScript value, usually an object or array, to be converted. - * @param replacer Array that transforms the results. - */ - stringify(value: any, replacer: any[]): string; - /** - * Converts a JavaScript value to a JavaScript Object Notation (JSON) string. - * @param value A JavaScript value, usually an object or array, to be converted. - * @param replacer A function that transforms the results. - * @param space Adds indentation, white space, and line break characters to the return-value JSON text to make it easier to read. - */ - stringify(value: any, replacer: (key: string, value: any) => any, space: string | number): string; - /** - * Converts a JavaScript value to a JavaScript Object Notation (JSON) string. - * @param value A JavaScript value, usually an object or array, to be converted. - * @param replacer Array that transforms the results. - * @param space Adds indentation, white space, and line break characters to the return-value JSON text to make it easier to read. - */ - stringify(value: any, replacer: any[], space: string | number): string; -} -/** - * An intrinsic object that provides functions to convert JavaScript values to and from the JavaScript Object Notation (JSON) format. - */ -declare const JSON: JSON; - - -///////////////////////////// -/// ECMAScript Array API (specially handled by compiler) -///////////////////////////// - -interface ReadonlyArray { - /** - * Gets the length of the array. This is a number one higher than the highest element defined in an array. - */ - readonly length: number; - /** - * Returns a string representation of an array. - */ - toString(): string; - toLocaleString(): string; - /** - * Combines two or more arrays. - * @param items Additional items to add to the end of array1. - */ - concat>(...items: U[]): T[]; - /** - * Combines two or more arrays. - * @param items Additional items to add to the end of array1. - */ - concat(...items: T[]): T[]; - /** - * Adds all the elements of an array separated by the specified separator string. - * @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. - */ - join(separator?: string): string; - /** - * Returns a section of an array. - * @param start The beginning of the specified portion of the array. - * @param end The end of the specified portion of the array. - */ - slice(start?: number, end?: number): T[]; - /** - * Returns the index of the first occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the search starts at index 0. - */ - indexOf(searchElement: T, fromIndex?: number): number; - - /** - * Returns the index of the last occurrence of a specified value in an array. - * @param searchElement The value to locate in the array. - * @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. - */ - lastIndexOf(searchElement: T, fromIndex?: number): number; - /** - * Determines whether all the members of an array satisfy the specified test. - * @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. - * @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. - */ - every(callbackfn: (value: T, index: number, array: ReadonlyArray) => boolean, thisArg?: any): boolean; - /** - * Determines whether the specified callback function returns true for any element of an array. - * @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. - * @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. - */ - some(callbackfn: (value: T, index: number, array: ReadonlyArray) => boolean, thisArg?: any): boolean; - /** - * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the callbackfn function one time for each element in the array. - * @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. - */ - forEach(callbackfn: (value: T, index: number, array: ReadonlyArray) => void, thisArg?: any): void; - /** - * Calls a defined callback function on each element of an array, and returns an array that contains the results. - * @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. - * @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. - */ - map(callbackfn: (value: T, index: number, array: ReadonlyArray) => U, thisArg?: any): U[]; - /** - * Returns the elements of an array that meet the condition specified in a callback function. - * @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. - * @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. - */ - filter(callbackfn: (value: T, index: number, array: ReadonlyArray) => boolean, thisArg?: any): T[]; - /** - * 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. - * @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. - * @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. - */ - reduce(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: ReadonlyArray) => T, initialValue?: T): T; - /** - * 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. - * @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. - * @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. - */ - reduce(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: ReadonlyArray) => U, initialValue: U): U; - /** - * 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. - * @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. - * @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. - */ - reduceRight(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: ReadonlyArray) => T, initialValue?: T): T; - /** - * 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. - * @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. - * @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. - */ - reduceRight(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: ReadonlyArray) => U, initialValue: U): U; - - readonly [n: number]: T; -} - -interface Array { - /** - * Gets or sets the length of the array. This is a number one higher than the highest element defined in an array. - */ - length: number; - /** - * Returns a string representation of an array. - */ - toString(): string; - toLocaleString(): string; - /** - * Appends new elements to an array, and returns the new length of the array. - * @param items New elements of the Array. - */ - push(...items: T[]): number; - /** - * Removes the last element from an array and returns it. - */ - pop(): T; - /** - * Combines two or more arrays. - * @param items Additional items to add to the end of array1. - */ - concat(...items: (T | T[])[]): T[]; - /** - * Adds all the elements of an array separated by the specified separator string. - * @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. - */ - join(separator?: string): string; - /** - * Reverses the elements in an Array. - */ - reverse(): T[]; - /** - * Removes the first element from an array and returns it. - */ - shift(): T; - /** - * Returns a section of an array. - * @param start The beginning of the specified portion of the array. - * @param end The end of the specified portion of the array. - */ - slice(start?: number, end?: number): T[]; - /** - * Sorts an array. - * @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. - */ - sort(compareFn?: (a: T, b: T) => number): T[]; - /** - * Removes elements from an array and, if necessary, inserts new elements in their place, returning the deleted elements. - * @param start The zero-based location in the array from which to start removing elements. - */ - splice(start: number): T[]; - /** - * Removes elements from an array and, if necessary, inserts new elements in their place, returning the deleted elements. - * @param start The zero-based location in the array from which to start removing elements. - * @param deleteCount The number of elements to remove. - * @param items Elements to insert into the array in place of the deleted elements. - */ - splice(start: number, deleteCount: number, ...items: T[]): T[]; - /** - * Inserts new elements at the start of an array. - * @param items Elements to insert at the start of the Array. - */ - unshift(...items: T[]): number; - /** - * Returns the index of the first occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the search starts at index 0. - */ - indexOf(searchElement: T, fromIndex?: number): number; - /** - * Returns the index of the last occurrence of a specified value in an array. - * @param searchElement The value to locate in the array. - * @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. - */ - lastIndexOf(searchElement: T, fromIndex?: number): number; - /** - * Determines whether all the members of an array satisfy the specified test. - * @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. - * @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. - */ - every(callbackfn: (value: T, index: number, array: T[]) => boolean, thisArg?: any): boolean; - /** - * Determines whether the specified callback function returns true for any element of an array. - * @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. - * @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. - */ - some(callbackfn: (value: T, index: number, array: T[]) => boolean, thisArg?: any): boolean; - /** - * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the callbackfn function one time for each element in the array. - * @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. - */ - forEach(callbackfn: (value: T, index: number, array: T[]) => void, thisArg?: any): void; - /** - * Calls a defined callback function on each element of an array, and returns an array that contains the results. - * @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. - * @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. - */ - map(callbackfn: (value: T, index: number, array: T[]) => U, thisArg?: any): U[]; - /** - * Returns the elements of an array that meet the condition specified in a callback function. - * @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. - * @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. - */ - filter(callbackfn: (value: T, index: number, array: T[]) => boolean, thisArg?: any): T[]; - /** - * 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. - * @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. - * @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. - */ - reduce(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T, initialValue?: T): T; - /** - * 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. - * @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. - * @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. - */ - reduce(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: T[]) => U, initialValue: U): U; - /** - * 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. - * @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. - * @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. - */ - reduceRight(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T, initialValue?: T): T; - /** - * 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. - * @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. - * @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. - */ - reduceRight(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: T[]) => U, initialValue: U): U; - - [n: number]: T; -} - -interface ArrayConstructor { - new (arrayLength?: number): any[]; - new (arrayLength: number): T[]; - new (...items: T[]): T[]; - (arrayLength?: number): any[]; - (arrayLength: number): T[]; - (...items: T[]): T[]; - isArray(arg: any): arg is Array; - readonly prototype: Array; -} - -declare const Array: ArrayConstructor; - -interface TypedPropertyDescriptor { - enumerable?: boolean; - configurable?: boolean; - writable?: boolean; - value?: T; - get?: () => T; - set?: (value: T) => void; -} - -declare type ClassDecorator = (target: TFunction) => TFunction | void; -declare type PropertyDecorator = (target: Object, propertyKey: string | symbol) => void; -declare type MethodDecorator = (target: Object, propertyKey: string | symbol, descriptor: TypedPropertyDescriptor) => TypedPropertyDescriptor | void; -declare type ParameterDecorator = (target: Object, propertyKey: string | symbol, parameterIndex: number) => void; - -declare type PromiseConstructorLike = new (executor: (resolve: (value?: T | PromiseLike) => void, reject: (reason?: any) => void) => void) => PromiseLike; - -interface PromiseLike { - /** - * Attaches callbacks for the resolution and/or rejection of the Promise. - * @param onfulfilled The callback to execute when the Promise is resolved. - * @param onrejected The callback to execute when the Promise is rejected. - * @returns A Promise for the completion of which ever callback is executed. - */ - then(onfulfilled?: (value: T) => TResult | PromiseLike, onrejected?: (reason: any) => TResult | PromiseLike): PromiseLike; - then(onfulfilled?: (value: T) => TResult | PromiseLike, onrejected?: (reason: any) => void): PromiseLike; -} - -interface ArrayLike { - readonly length: number; - readonly [n: number]: T; -} - -/** - * Represents a raw buffer of binary data, which is used to store data for the - * different typed arrays. ArrayBuffers cannot be read from or written to directly, - * but can be passed to a typed array or DataView Object to interpret the raw - * buffer as needed. - */ -interface ArrayBuffer { - /** - * Read-only. The length of the ArrayBuffer (in bytes). - */ - readonly byteLength: number; - - /** - * Returns a section of an ArrayBuffer. - */ - slice(begin:number, end?:number): ArrayBuffer; -} - -interface ArrayBufferConstructor { - readonly prototype: ArrayBuffer; - new (byteLength: number): ArrayBuffer; - isView(arg: any): arg is ArrayBufferView; -} -declare const ArrayBuffer: ArrayBufferConstructor; - -interface ArrayBufferView { - /** - * The ArrayBuffer instance referenced by the array. - */ - buffer: ArrayBuffer; - - /** - * The length in bytes of the array. - */ - byteLength: number; - - /** - * The offset in bytes of the array. - */ - byteOffset: number; -} - -interface DataView { - readonly buffer: ArrayBuffer; - readonly byteLength: number; - readonly byteOffset: number; - /** - * Gets the Float32 value at the specified byte offset from the start of the view. There is - * no alignment constraint; multi-byte values may be fetched from any offset. - * @param byteOffset The place in the buffer at which the value should be retrieved. - */ - getFloat32(byteOffset: number, littleEndian?: boolean): number; - - /** - * Gets the Float64 value at the specified byte offset from the start of the view. There is - * no alignment constraint; multi-byte values may be fetched from any offset. - * @param byteOffset The place in the buffer at which the value should be retrieved. - */ - getFloat64(byteOffset: number, littleEndian?: boolean): number; - - /** - * Gets the Int8 value at the specified byte offset from the start of the view. There is - * no alignment constraint; multi-byte values may be fetched from any offset. - * @param byteOffset The place in the buffer at which the value should be retrieved. - */ - getInt8(byteOffset: number): number; - - /** - * Gets the Int16 value at the specified byte offset from the start of the view. There is - * no alignment constraint; multi-byte values may be fetched from any offset. - * @param byteOffset The place in the buffer at which the value should be retrieved. - */ - getInt16(byteOffset: number, littleEndian?: boolean): number; - /** - * Gets the Int32 value at the specified byte offset from the start of the view. There is - * no alignment constraint; multi-byte values may be fetched from any offset. - * @param byteOffset The place in the buffer at which the value should be retrieved. - */ - getInt32(byteOffset: number, littleEndian?: boolean): number; - - /** - * Gets the Uint8 value at the specified byte offset from the start of the view. There is - * no alignment constraint; multi-byte values may be fetched from any offset. - * @param byteOffset The place in the buffer at which the value should be retrieved. - */ - getUint8(byteOffset: number): number; - - /** - * Gets the Uint16 value at the specified byte offset from the start of the view. There is - * no alignment constraint; multi-byte values may be fetched from any offset. - * @param byteOffset The place in the buffer at which the value should be retrieved. - */ - getUint16(byteOffset: number, littleEndian?: boolean): number; - - /** - * Gets the Uint32 value at the specified byte offset from the start of the view. There is - * no alignment constraint; multi-byte values may be fetched from any offset. - * @param byteOffset The place in the buffer at which the value should be retrieved. - */ - getUint32(byteOffset: number, littleEndian?: boolean): number; - - /** - * Stores an Float32 value at the specified byte offset from the start of the view. - * @param byteOffset The place in the buffer at which the value should be set. - * @param value The value to set. - * @param littleEndian If false or undefined, a big-endian value should be written, - * otherwise a little-endian value should be written. - */ - setFloat32(byteOffset: number, value: number, littleEndian?: boolean): void; - - /** - * Stores an Float64 value at the specified byte offset from the start of the view. - * @param byteOffset The place in the buffer at which the value should be set. - * @param value The value to set. - * @param littleEndian If false or undefined, a big-endian value should be written, - * otherwise a little-endian value should be written. - */ - setFloat64(byteOffset: number, value: number, littleEndian?: boolean): void; - - /** - * Stores an Int8 value at the specified byte offset from the start of the view. - * @param byteOffset The place in the buffer at which the value should be set. - * @param value The value to set. - */ - setInt8(byteOffset: number, value: number): void; - - /** - * Stores an Int16 value at the specified byte offset from the start of the view. - * @param byteOffset The place in the buffer at which the value should be set. - * @param value The value to set. - * @param littleEndian If false or undefined, a big-endian value should be written, - * otherwise a little-endian value should be written. - */ - setInt16(byteOffset: number, value: number, littleEndian?: boolean): void; - - /** - * Stores an Int32 value at the specified byte offset from the start of the view. - * @param byteOffset The place in the buffer at which the value should be set. - * @param value The value to set. - * @param littleEndian If false or undefined, a big-endian value should be written, - * otherwise a little-endian value should be written. - */ - setInt32(byteOffset: number, value: number, littleEndian?: boolean): void; - - /** - * Stores an Uint8 value at the specified byte offset from the start of the view. - * @param byteOffset The place in the buffer at which the value should be set. - * @param value The value to set. - */ - setUint8(byteOffset: number, value: number): void; - - /** - * Stores an Uint16 value at the specified byte offset from the start of the view. - * @param byteOffset The place in the buffer at which the value should be set. - * @param value The value to set. - * @param littleEndian If false or undefined, a big-endian value should be written, - * otherwise a little-endian value should be written. - */ - setUint16(byteOffset: number, value: number, littleEndian?: boolean): void; - - /** - * Stores an Uint32 value at the specified byte offset from the start of the view. - * @param byteOffset The place in the buffer at which the value should be set. - * @param value The value to set. - * @param littleEndian If false or undefined, a big-endian value should be written, - * otherwise a little-endian value should be written. - */ - setUint32(byteOffset: number, value: number, littleEndian?: boolean): void; -} - -interface DataViewConstructor { - new (buffer: ArrayBuffer, byteOffset?: number, byteLength?: number): DataView; -} -declare const DataView: DataViewConstructor; - -/** - * A typed array of 8-bit integer values. The contents are initialized to 0. If the requested - * number of bytes could not be allocated an exception is raised. - */ -interface Int8Array { - /** - * The size in bytes of each element in the array. - */ - readonly BYTES_PER_ELEMENT: number; - - /** - * The ArrayBuffer instance referenced by the array. - */ - readonly buffer: ArrayBuffer; - - /** - * The length in bytes of the array. - */ - readonly byteLength: number; - - /** - * The offset in bytes of the array. - */ - readonly byteOffset: number; - - /** - * Returns the this object after copying a section of the array identified by start and end - * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it - * is treated as length+end. - * @param end If not specified, length of the this object is used as its default value. - */ - copyWithin(target: number, start: number, end?: number): Int8Array; - - /** - * Determines whether all the members of an array satisfy the specified test. - * @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. - * @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. - */ - every(callbackfn: (value: number, index: number, array: Int8Array) => boolean, thisArg?: any): boolean; - - /** - * Returns the this object after filling the section identified by start and end with value - * @param value value to fill array section with - * @param start index to start filling the array at. If start is negative, it is treated as - * length+start where length is the length of the array. - * @param end index to stop filling the array at. If end is negative, it is treated as - * length+end. - */ - fill(value: number, start?: number, end?: number): Int8Array; - - /** - * Returns the elements of an array that meet the condition specified in a callback function. - * @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. - * @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. - */ - filter(callbackfn: (value: number, index: number, array: Int8Array) => boolean, thisArg?: any): Int8Array; - - /** - * Returns the value of the first element in the array where predicate is true, and undefined - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; - - /** - * Returns the index of the first element in the array where predicate is true, and undefined - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - findIndex(predicate: (value: number) => boolean, thisArg?: any): number; - - /** - * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the - * callbackfn function one time for each element in the array. - * @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. - */ - forEach(callbackfn: (value: number, index: number, array: Int8Array) => void, thisArg?: any): void; - - /** - * Returns the index of the first occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - indexOf(searchElement: number, fromIndex?: number): number; - - /** - * Adds all the elements of an array separated by the specified separator string. - * @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. - */ - join(separator?: string): string; - - /** - * Returns the index of the last occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - lastIndexOf(searchElement: number, fromIndex?: number): number; - - /** - * The length of the array. - */ - readonly length: number; - - /** - * Calls a defined callback function on each element of an array, and returns an array that - * contains the results. - * @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. - * @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. - */ - map(callbackfn: (value: number, index: number, array: Int8Array) => number, thisArg?: any): Int8Array; - - /** - * 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. - * @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. - * @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. - */ - reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int8Array) => number, initialValue?: number): number; - - /** - * 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. - * @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. - * @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. - */ - reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int8Array) => U, initialValue: U): U; - - /** - * 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. - * @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. - * @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. - */ - reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int8Array) => number, initialValue?: number): number; - - /** - * 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. - * @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. - * @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. - */ - reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int8Array) => U, initialValue: U): U; - - /** - * Reverses the elements in an Array. - */ - reverse(): Int8Array; - - /** - * Sets a value or an array of values. - * @param index The index of the location to set. - * @param value The value to set. - */ - set(index: number, value: number): void; - - /** - * Sets a value or an array of values. - * @param array A typed or untyped array of values to set. - * @param offset The index in the current array at which the values are to be written. - */ - set(array: ArrayLike, offset?: number): void; - - /** - * Returns a section of an array. - * @param start The beginning of the specified portion of the array. - * @param end The end of the specified portion of the array. - */ - slice(start?: number, end?: number): Int8Array; - - /** - * Determines whether the specified callback function returns true for any element of an array. - * @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. - * @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. - */ - some(callbackfn: (value: number, index: number, array: Int8Array) => boolean, thisArg?: any): boolean; - - /** - * Sorts an array. - * @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. - */ - sort(compareFn?: (a: number, b: number) => number): Int8Array; - - /** - * Gets a new Int8Array view of the ArrayBuffer store for this array, referencing the elements - * at begin, inclusive, up to end, exclusive. - * @param begin The index of the beginning of the array. - * @param end The index of the end of the array. - */ - subarray(begin: number, end?: number): Int8Array; - - /** - * Converts a number to a string by using the current locale. - */ - toLocaleString(): string; - - /** - * Returns a string representation of an array. - */ - toString(): string; - - [index: number]: number; -} -interface Int8ArrayConstructor { - readonly prototype: Int8Array; - new (length: number): Int8Array; - new (array: ArrayLike): Int8Array; - new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Int8Array; - - /** - * The size in bytes of each element in the array. - */ - readonly BYTES_PER_ELEMENT: number; - - /** - * Returns a new array from a set of elements. - * @param items A set of elements to include in the new array object. - */ - of(...items: number[]): Int8Array; - - /** - * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Int8Array; - -} -declare const Int8Array: Int8ArrayConstructor; - -/** - * A typed array of 8-bit unsigned integer values. The contents are initialized to 0. If the - * requested number of bytes could not be allocated an exception is raised. - */ -interface Uint8Array { - /** - * The size in bytes of each element in the array. - */ - readonly BYTES_PER_ELEMENT: number; - - /** - * The ArrayBuffer instance referenced by the array. - */ - readonly buffer: ArrayBuffer; - - /** - * The length in bytes of the array. - */ - readonly byteLength: number; - - /** - * The offset in bytes of the array. - */ - readonly byteOffset: number; - - /** - * Returns the this object after copying a section of the array identified by start and end - * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it - * is treated as length+end. - * @param end If not specified, length of the this object is used as its default value. - */ - copyWithin(target: number, start: number, end?: number): Uint8Array; - - /** - * Determines whether all the members of an array satisfy the specified test. - * @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. - * @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. - */ - every(callbackfn: (value: number, index: number, array: Uint8Array) => boolean, thisArg?: any): boolean; - - /** - * Returns the this object after filling the section identified by start and end with value - * @param value value to fill array section with - * @param start index to start filling the array at. If start is negative, it is treated as - * length+start where length is the length of the array. - * @param end index to stop filling the array at. If end is negative, it is treated as - * length+end. - */ - fill(value: number, start?: number, end?: number): Uint8Array; - - /** - * Returns the elements of an array that meet the condition specified in a callback function. - * @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. - * @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. - */ - filter(callbackfn: (value: number, index: number, array: Uint8Array) => boolean, thisArg?: any): Uint8Array; - - /** - * Returns the value of the first element in the array where predicate is true, and undefined - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; - - /** - * Returns the index of the first element in the array where predicate is true, and undefined - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - findIndex(predicate: (value: number) => boolean, thisArg?: any): number; - - /** - * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the - * callbackfn function one time for each element in the array. - * @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. - */ - forEach(callbackfn: (value: number, index: number, array: Uint8Array) => void, thisArg?: any): void; - - /** - * Returns the index of the first occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - indexOf(searchElement: number, fromIndex?: number): number; - - /** - * Adds all the elements of an array separated by the specified separator string. - * @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. - */ - join(separator?: string): string; - - /** - * Returns the index of the last occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - lastIndexOf(searchElement: number, fromIndex?: number): number; - - /** - * The length of the array. - */ - readonly length: number; - - /** - * Calls a defined callback function on each element of an array, and returns an array that - * contains the results. - * @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. - * @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. - */ - map(callbackfn: (value: number, index: number, array: Uint8Array) => number, thisArg?: any): Uint8Array; - - /** - * 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. - * @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. - * @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. - */ - reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8Array) => number, initialValue?: number): number; - - /** - * 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. - * @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. - * @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. - */ - reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint8Array) => U, initialValue: U): U; - - /** - * 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. - * @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. - * @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. - */ - reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8Array) => number, initialValue?: number): number; - - /** - * 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. - * @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. - * @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. - */ - reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint8Array) => U, initialValue: U): U; - - /** - * Reverses the elements in an Array. - */ - reverse(): Uint8Array; - - /** - * Sets a value or an array of values. - * @param index The index of the location to set. - * @param value The value to set. - */ - set(index: number, value: number): void; - - /** - * Sets a value or an array of values. - * @param array A typed or untyped array of values to set. - * @param offset The index in the current array at which the values are to be written. - */ - set(array: ArrayLike, offset?: number): void; - - /** - * Returns a section of an array. - * @param start The beginning of the specified portion of the array. - * @param end The end of the specified portion of the array. - */ - slice(start?: number, end?: number): Uint8Array; - - /** - * Determines whether the specified callback function returns true for any element of an array. - * @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. - * @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. - */ - some(callbackfn: (value: number, index: number, array: Uint8Array) => boolean, thisArg?: any): boolean; - - /** - * Sorts an array. - * @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. - */ - sort(compareFn?: (a: number, b: number) => number): Uint8Array; - - /** - * Gets a new Uint8Array view of the ArrayBuffer store for this array, referencing the elements - * at begin, inclusive, up to end, exclusive. - * @param begin The index of the beginning of the array. - * @param end The index of the end of the array. - */ - subarray(begin: number, end?: number): Uint8Array; - - /** - * Converts a number to a string by using the current locale. - */ - toLocaleString(): string; - - /** - * Returns a string representation of an array. - */ - toString(): string; - - [index: number]: number; -} - -interface Uint8ArrayConstructor { - readonly prototype: Uint8Array; - new (length: number): Uint8Array; - new (array: ArrayLike): Uint8Array; - new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Uint8Array; - - /** - * The size in bytes of each element in the array. - */ - readonly BYTES_PER_ELEMENT: number; - - /** - * Returns a new array from a set of elements. - * @param items A set of elements to include in the new array object. - */ - of(...items: number[]): Uint8Array; - - /** - * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint8Array; - -} -declare const Uint8Array: Uint8ArrayConstructor; - -/** - * A typed array of 8-bit unsigned integer (clamped) values. The contents are initialized to 0. - * If the requested number of bytes could not be allocated an exception is raised. - */ -interface Uint8ClampedArray { - /** - * The size in bytes of each element in the array. - */ - readonly BYTES_PER_ELEMENT: number; - - /** - * The ArrayBuffer instance referenced by the array. - */ - readonly buffer: ArrayBuffer; - - /** - * The length in bytes of the array. - */ - readonly byteLength: number; - - /** - * The offset in bytes of the array. - */ - readonly byteOffset: number; - - /** - * Returns the this object after copying a section of the array identified by start and end - * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it - * is treated as length+end. - * @param end If not specified, length of the this object is used as its default value. - */ - copyWithin(target: number, start: number, end?: number): Uint8ClampedArray; - - /** - * Determines whether all the members of an array satisfy the specified test. - * @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. - * @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. - */ - every(callbackfn: (value: number, index: number, array: Uint8ClampedArray) => boolean, thisArg?: any): boolean; - - /** - * Returns the this object after filling the section identified by start and end with value - * @param value value to fill array section with - * @param start index to start filling the array at. If start is negative, it is treated as - * length+start where length is the length of the array. - * @param end index to stop filling the array at. If end is negative, it is treated as - * length+end. - */ - fill(value: number, start?: number, end?: number): Uint8ClampedArray; - - /** - * Returns the elements of an array that meet the condition specified in a callback function. - * @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. - * @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. - */ - filter(callbackfn: (value: number, index: number, array: Uint8ClampedArray) => boolean, thisArg?: any): Uint8ClampedArray; - - /** - * Returns the value of the first element in the array where predicate is true, and undefined - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; - - /** - * Returns the index of the first element in the array where predicate is true, and undefined - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - findIndex(predicate: (value: number) => boolean, thisArg?: any): number; - - /** - * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the - * callbackfn function one time for each element in the array. - * @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. - */ - forEach(callbackfn: (value: number, index: number, array: Uint8ClampedArray) => void, thisArg?: any): void; - - /** - * Returns the index of the first occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - indexOf(searchElement: number, fromIndex?: number): number; - - /** - * Adds all the elements of an array separated by the specified separator string. - * @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. - */ - join(separator?: string): string; - - /** - * Returns the index of the last occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - lastIndexOf(searchElement: number, fromIndex?: number): number; - - /** - * The length of the array. - */ - readonly length: number; - - /** - * Calls a defined callback function on each element of an array, and returns an array that - * contains the results. - * @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. - * @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. - */ - map(callbackfn: (value: number, index: number, array: Uint8ClampedArray) => number, thisArg?: any): Uint8ClampedArray; - - /** - * 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. - * @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. - * @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. - */ - reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8ClampedArray) => number, initialValue?: number): number; - - /** - * 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. - * @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. - * @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. - */ - reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint8ClampedArray) => U, initialValue: U): U; - - /** - * 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. - * @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. - * @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. - */ - reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8ClampedArray) => number, initialValue?: number): number; - - /** - * 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. - * @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. - * @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. - */ - reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint8ClampedArray) => U, initialValue: U): U; - - /** - * Reverses the elements in an Array. - */ - reverse(): Uint8ClampedArray; - - /** - * Sets a value or an array of values. - * @param index The index of the location to set. - * @param value The value to set. - */ - set(index: number, value: number): void; - - /** - * Sets a value or an array of values. - * @param array A typed or untyped array of values to set. - * @param offset The index in the current array at which the values are to be written. - */ - set(array: Uint8ClampedArray, offset?: number): void; - - /** - * Returns a section of an array. - * @param start The beginning of the specified portion of the array. - * @param end The end of the specified portion of the array. - */ - slice(start?: number, end?: number): Uint8ClampedArray; - - /** - * Determines whether the specified callback function returns true for any element of an array. - * @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. - * @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. - */ - some(callbackfn: (value: number, index: number, array: Uint8ClampedArray) => boolean, thisArg?: any): boolean; - - /** - * Sorts an array. - * @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. - */ - sort(compareFn?: (a: number, b: number) => number): Uint8ClampedArray; - - /** - * Gets a new Uint8ClampedArray view of the ArrayBuffer store for this array, referencing the elements - * at begin, inclusive, up to end, exclusive. - * @param begin The index of the beginning of the array. - * @param end The index of the end of the array. - */ - subarray(begin: number, end?: number): Uint8ClampedArray; - - /** - * Converts a number to a string by using the current locale. - */ - toLocaleString(): string; - - /** - * Returns a string representation of an array. - */ - toString(): string; - - [index: number]: number; -} - -interface Uint8ClampedArrayConstructor { - readonly prototype: Uint8ClampedArray; - new (length: number): Uint8ClampedArray; - new (array: ArrayLike): Uint8ClampedArray; - new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Uint8ClampedArray; - - /** - * The size in bytes of each element in the array. - */ - readonly BYTES_PER_ELEMENT: number; - - /** - * Returns a new array from a set of elements. - * @param items A set of elements to include in the new array object. - */ - of(...items: number[]): Uint8ClampedArray; - - /** - * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint8ClampedArray; -} -declare const Uint8ClampedArray: Uint8ClampedArrayConstructor; - -/** - * A typed array of 16-bit signed integer values. The contents are initialized to 0. If the - * requested number of bytes could not be allocated an exception is raised. - */ -interface Int16Array { - /** - * The size in bytes of each element in the array. - */ - readonly BYTES_PER_ELEMENT: number; - - /** - * The ArrayBuffer instance referenced by the array. - */ - readonly buffer: ArrayBuffer; - - /** - * The length in bytes of the array. - */ - readonly byteLength: number; - - /** - * The offset in bytes of the array. - */ - readonly byteOffset: number; - - /** - * Returns the this object after copying a section of the array identified by start and end - * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it - * is treated as length+end. - * @param end If not specified, length of the this object is used as its default value. - */ - copyWithin(target: number, start: number, end?: number): Int16Array; - - /** - * Determines whether all the members of an array satisfy the specified test. - * @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. - * @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. - */ - every(callbackfn: (value: number, index: number, array: Int16Array) => boolean, thisArg?: any): boolean; - - /** - * Returns the this object after filling the section identified by start and end with value - * @param value value to fill array section with - * @param start index to start filling the array at. If start is negative, it is treated as - * length+start where length is the length of the array. - * @param end index to stop filling the array at. If end is negative, it is treated as - * length+end. - */ - fill(value: number, start?: number, end?: number): Int16Array; - - /** - * Returns the elements of an array that meet the condition specified in a callback function. - * @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. - * @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. - */ - filter(callbackfn: (value: number, index: number, array: Int16Array) => boolean, thisArg?: any): Int16Array; - - /** - * Returns the value of the first element in the array where predicate is true, and undefined - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; - - /** - * Returns the index of the first element in the array where predicate is true, and undefined - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - findIndex(predicate: (value: number) => boolean, thisArg?: any): number; - - /** - * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the - * callbackfn function one time for each element in the array. - * @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. - */ - forEach(callbackfn: (value: number, index: number, array: Int16Array) => void, thisArg?: any): void; - - /** - * Returns the index of the first occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - indexOf(searchElement: number, fromIndex?: number): number; - - /** - * Adds all the elements of an array separated by the specified separator string. - * @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. - */ - join(separator?: string): string; - - /** - * Returns the index of the last occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - lastIndexOf(searchElement: number, fromIndex?: number): number; - - /** - * The length of the array. - */ - readonly length: number; - - /** - * Calls a defined callback function on each element of an array, and returns an array that - * contains the results. - * @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. - * @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. - */ - map(callbackfn: (value: number, index: number, array: Int16Array) => number, thisArg?: any): Int16Array; - - /** - * 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. - * @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. - * @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. - */ - reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int16Array) => number, initialValue?: number): number; - - /** - * 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. - * @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. - * @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. - */ - reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int16Array) => U, initialValue: U): U; - - /** - * 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. - * @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. - * @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. - */ - reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int16Array) => number, initialValue?: number): number; - - /** - * 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. - * @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. - * @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. - */ - reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int16Array) => U, initialValue: U): U; - - /** - * Reverses the elements in an Array. - */ - reverse(): Int16Array; - - /** - * Sets a value or an array of values. - * @param index The index of the location to set. - * @param value The value to set. - */ - set(index: number, value: number): void; - - /** - * Sets a value or an array of values. - * @param array A typed or untyped array of values to set. - * @param offset The index in the current array at which the values are to be written. - */ - set(array: ArrayLike, offset?: number): void; - - /** - * Returns a section of an array. - * @param start The beginning of the specified portion of the array. - * @param end The end of the specified portion of the array. - */ - slice(start?: number, end?: number): Int16Array; - - /** - * Determines whether the specified callback function returns true for any element of an array. - * @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. - * @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. - */ - some(callbackfn: (value: number, index: number, array: Int16Array) => boolean, thisArg?: any): boolean; - - /** - * Sorts an array. - * @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. - */ - sort(compareFn?: (a: number, b: number) => number): Int16Array; - - /** - * Gets a new Int16Array view of the ArrayBuffer store for this array, referencing the elements - * at begin, inclusive, up to end, exclusive. - * @param begin The index of the beginning of the array. - * @param end The index of the end of the array. - */ - subarray(begin: number, end?: number): Int16Array; - - /** - * Converts a number to a string by using the current locale. - */ - toLocaleString(): string; - - /** - * Returns a string representation of an array. - */ - toString(): string; - - [index: number]: number; -} - -interface Int16ArrayConstructor { - readonly prototype: Int16Array; - new (length: number): Int16Array; - new (array: ArrayLike): Int16Array; - new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Int16Array; - - /** - * The size in bytes of each element in the array. - */ - readonly BYTES_PER_ELEMENT: number; - - /** - * Returns a new array from a set of elements. - * @param items A set of elements to include in the new array object. - */ - of(...items: number[]): Int16Array; - - /** - * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Int16Array; - -} -declare const Int16Array: Int16ArrayConstructor; - -/** - * A typed array of 16-bit unsigned integer values. The contents are initialized to 0. If the - * requested number of bytes could not be allocated an exception is raised. - */ -interface Uint16Array { - /** - * The size in bytes of each element in the array. - */ - readonly BYTES_PER_ELEMENT: number; - - /** - * The ArrayBuffer instance referenced by the array. - */ - readonly buffer: ArrayBuffer; - - /** - * The length in bytes of the array. - */ - readonly byteLength: number; - - /** - * The offset in bytes of the array. - */ - readonly byteOffset: number; - - /** - * Returns the this object after copying a section of the array identified by start and end - * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it - * is treated as length+end. - * @param end If not specified, length of the this object is used as its default value. - */ - copyWithin(target: number, start: number, end?: number): Uint16Array; - - /** - * Determines whether all the members of an array satisfy the specified test. - * @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. - * @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. - */ - every(callbackfn: (value: number, index: number, array: Uint16Array) => boolean, thisArg?: any): boolean; - - /** - * Returns the this object after filling the section identified by start and end with value - * @param value value to fill array section with - * @param start index to start filling the array at. If start is negative, it is treated as - * length+start where length is the length of the array. - * @param end index to stop filling the array at. If end is negative, it is treated as - * length+end. - */ - fill(value: number, start?: number, end?: number): Uint16Array; - - /** - * Returns the elements of an array that meet the condition specified in a callback function. - * @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. - * @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. - */ - filter(callbackfn: (value: number, index: number, array: Uint16Array) => boolean, thisArg?: any): Uint16Array; - - /** - * Returns the value of the first element in the array where predicate is true, and undefined - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; - - /** - * Returns the index of the first element in the array where predicate is true, and undefined - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - findIndex(predicate: (value: number) => boolean, thisArg?: any): number; - - /** - * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the - * callbackfn function one time for each element in the array. - * @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. - */ - forEach(callbackfn: (value: number, index: number, array: Uint16Array) => void, thisArg?: any): void; - - /** - * Returns the index of the first occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - indexOf(searchElement: number, fromIndex?: number): number; - - /** - * Adds all the elements of an array separated by the specified separator string. - * @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. - */ - join(separator?: string): string; - - /** - * Returns the index of the last occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - lastIndexOf(searchElement: number, fromIndex?: number): number; - - /** - * The length of the array. - */ - readonly length: number; - - /** - * Calls a defined callback function on each element of an array, and returns an array that - * contains the results. - * @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. - * @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. - */ - map(callbackfn: (value: number, index: number, array: Uint16Array) => number, thisArg?: any): Uint16Array; - - /** - * 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. - * @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. - * @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. - */ - reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint16Array) => number, initialValue?: number): number; - - /** - * 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. - * @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. - * @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. - */ - reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint16Array) => U, initialValue: U): U; - - /** - * 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. - * @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. - * @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. - */ - reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint16Array) => number, initialValue?: number): number; - - /** - * 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. - * @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. - * @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. - */ - reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint16Array) => U, initialValue: U): U; - - /** - * Reverses the elements in an Array. - */ - reverse(): Uint16Array; - - /** - * Sets a value or an array of values. - * @param index The index of the location to set. - * @param value The value to set. - */ - set(index: number, value: number): void; - - /** - * Sets a value or an array of values. - * @param array A typed or untyped array of values to set. - * @param offset The index in the current array at which the values are to be written. - */ - set(array: ArrayLike, offset?: number): void; - - /** - * Returns a section of an array. - * @param start The beginning of the specified portion of the array. - * @param end The end of the specified portion of the array. - */ - slice(start?: number, end?: number): Uint16Array; - - /** - * Determines whether the specified callback function returns true for any element of an array. - * @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. - * @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. - */ - some(callbackfn: (value: number, index: number, array: Uint16Array) => boolean, thisArg?: any): boolean; - - /** - * Sorts an array. - * @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. - */ - sort(compareFn?: (a: number, b: number) => number): Uint16Array; - - /** - * Gets a new Uint16Array view of the ArrayBuffer store for this array, referencing the elements - * at begin, inclusive, up to end, exclusive. - * @param begin The index of the beginning of the array. - * @param end The index of the end of the array. - */ - subarray(begin: number, end?: number): Uint16Array; - - /** - * Converts a number to a string by using the current locale. - */ - toLocaleString(): string; - - /** - * Returns a string representation of an array. - */ - toString(): string; - - [index: number]: number; -} - -interface Uint16ArrayConstructor { - readonly prototype: Uint16Array; - new (length: number): Uint16Array; - new (array: ArrayLike): Uint16Array; - new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Uint16Array; - - /** - * The size in bytes of each element in the array. - */ - readonly BYTES_PER_ELEMENT: number; - - /** - * Returns a new array from a set of elements. - * @param items A set of elements to include in the new array object. - */ - of(...items: number[]): Uint16Array; - - /** - * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint16Array; - -} -declare const Uint16Array: Uint16ArrayConstructor; -/** - * A typed array of 32-bit signed integer values. The contents are initialized to 0. If the - * requested number of bytes could not be allocated an exception is raised. - */ -interface Int32Array { - /** - * The size in bytes of each element in the array. - */ - readonly BYTES_PER_ELEMENT: number; - - /** - * The ArrayBuffer instance referenced by the array. - */ - readonly buffer: ArrayBuffer; - - /** - * The length in bytes of the array. - */ - readonly byteLength: number; - - /** - * The offset in bytes of the array. - */ - readonly byteOffset: number; - - /** - * Returns the this object after copying a section of the array identified by start and end - * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it - * is treated as length+end. - * @param end If not specified, length of the this object is used as its default value. - */ - copyWithin(target: number, start: number, end?: number): Int32Array; - - /** - * Determines whether all the members of an array satisfy the specified test. - * @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. - * @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. - */ - every(callbackfn: (value: number, index: number, array: Int32Array) => boolean, thisArg?: any): boolean; - - /** - * Returns the this object after filling the section identified by start and end with value - * @param value value to fill array section with - * @param start index to start filling the array at. If start is negative, it is treated as - * length+start where length is the length of the array. - * @param end index to stop filling the array at. If end is negative, it is treated as - * length+end. - */ - fill(value: number, start?: number, end?: number): Int32Array; - - /** - * Returns the elements of an array that meet the condition specified in a callback function. - * @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. - * @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. - */ - filter(callbackfn: (value: number, index: number, array: Int32Array) => boolean, thisArg?: any): Int32Array; - - /** - * Returns the value of the first element in the array where predicate is true, and undefined - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; - - /** - * Returns the index of the first element in the array where predicate is true, and undefined - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - findIndex(predicate: (value: number) => boolean, thisArg?: any): number; - - /** - * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the - * callbackfn function one time for each element in the array. - * @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. - */ - forEach(callbackfn: (value: number, index: number, array: Int32Array) => void, thisArg?: any): void; - - /** - * Returns the index of the first occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - indexOf(searchElement: number, fromIndex?: number): number; - - /** - * Adds all the elements of an array separated by the specified separator string. - * @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. - */ - join(separator?: string): string; - - /** - * Returns the index of the last occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - lastIndexOf(searchElement: number, fromIndex?: number): number; - - /** - * The length of the array. - */ - readonly length: number; - - /** - * Calls a defined callback function on each element of an array, and returns an array that - * contains the results. - * @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. - * @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. - */ - map(callbackfn: (value: number, index: number, array: Int32Array) => number, thisArg?: any): Int32Array; - - /** - * 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. - * @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. - * @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. - */ - reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int32Array) => number, initialValue?: number): number; - - /** - * 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. - * @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. - * @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. - */ - reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int32Array) => U, initialValue: U): U; - - /** - * 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. - * @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. - * @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. - */ - reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int32Array) => number, initialValue?: number): number; - - /** - * 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. - * @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. - * @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. - */ - reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int32Array) => U, initialValue: U): U; - - /** - * Reverses the elements in an Array. - */ - reverse(): Int32Array; - - /** - * Sets a value or an array of values. - * @param index The index of the location to set. - * @param value The value to set. - */ - set(index: number, value: number): void; - - /** - * Sets a value or an array of values. - * @param array A typed or untyped array of values to set. - * @param offset The index in the current array at which the values are to be written. - */ - set(array: ArrayLike, offset?: number): void; - - /** - * Returns a section of an array. - * @param start The beginning of the specified portion of the array. - * @param end The end of the specified portion of the array. - */ - slice(start?: number, end?: number): Int32Array; - - /** - * Determines whether the specified callback function returns true for any element of an array. - * @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. - * @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. - */ - some(callbackfn: (value: number, index: number, array: Int32Array) => boolean, thisArg?: any): boolean; - - /** - * Sorts an array. - * @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. - */ - sort(compareFn?: (a: number, b: number) => number): Int32Array; - - /** - * Gets a new Int32Array view of the ArrayBuffer store for this array, referencing the elements - * at begin, inclusive, up to end, exclusive. - * @param begin The index of the beginning of the array. - * @param end The index of the end of the array. - */ - subarray(begin: number, end?: number): Int32Array; - - /** - * Converts a number to a string by using the current locale. - */ - toLocaleString(): string; - - /** - * Returns a string representation of an array. - */ - toString(): string; - - [index: number]: number; -} - -interface Int32ArrayConstructor { - readonly prototype: Int32Array; - new (length: number): Int32Array; - new (array: ArrayLike): Int32Array; - new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Int32Array; - - /** - * The size in bytes of each element in the array. - */ - readonly BYTES_PER_ELEMENT: number; - - /** - * Returns a new array from a set of elements. - * @param items A set of elements to include in the new array object. - */ - of(...items: number[]): Int32Array; - - /** - * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Int32Array; -} -declare const Int32Array: Int32ArrayConstructor; - -/** - * A typed array of 32-bit unsigned integer values. The contents are initialized to 0. If the - * requested number of bytes could not be allocated an exception is raised. - */ -interface Uint32Array { - /** - * The size in bytes of each element in the array. - */ - readonly BYTES_PER_ELEMENT: number; - - /** - * The ArrayBuffer instance referenced by the array. - */ - readonly buffer: ArrayBuffer; - - /** - * The length in bytes of the array. - */ - readonly byteLength: number; - - /** - * The offset in bytes of the array. - */ - readonly byteOffset: number; - - /** - * Returns the this object after copying a section of the array identified by start and end - * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it - * is treated as length+end. - * @param end If not specified, length of the this object is used as its default value. - */ - copyWithin(target: number, start: number, end?: number): Uint32Array; - - /** - * Determines whether all the members of an array satisfy the specified test. - * @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. - * @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. - */ - every(callbackfn: (value: number, index: number, array: Uint32Array) => boolean, thisArg?: any): boolean; - - /** - * Returns the this object after filling the section identified by start and end with value - * @param value value to fill array section with - * @param start index to start filling the array at. If start is negative, it is treated as - * length+start where length is the length of the array. - * @param end index to stop filling the array at. If end is negative, it is treated as - * length+end. - */ - fill(value: number, start?: number, end?: number): Uint32Array; - - /** - * Returns the elements of an array that meet the condition specified in a callback function. - * @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. - * @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. - */ - filter(callbackfn: (value: number, index: number, array: Uint32Array) => boolean, thisArg?: any): Uint32Array; - - /** - * Returns the value of the first element in the array where predicate is true, and undefined - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; - - /** - * Returns the index of the first element in the array where predicate is true, and undefined - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - findIndex(predicate: (value: number) => boolean, thisArg?: any): number; - - /** - * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the - * callbackfn function one time for each element in the array. - * @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. - */ - forEach(callbackfn: (value: number, index: number, array: Uint32Array) => void, thisArg?: any): void; - - /** - * Returns the index of the first occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - indexOf(searchElement: number, fromIndex?: number): number; - - /** - * Adds all the elements of an array separated by the specified separator string. - * @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. - */ - join(separator?: string): string; - - /** - * Returns the index of the last occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - lastIndexOf(searchElement: number, fromIndex?: number): number; - - /** - * The length of the array. - */ - readonly length: number; - - /** - * Calls a defined callback function on each element of an array, and returns an array that - * contains the results. - * @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. - * @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. - */ - map(callbackfn: (value: number, index: number, array: Uint32Array) => number, thisArg?: any): Uint32Array; - - /** - * 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. - * @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. - * @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. - */ - reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint32Array) => number, initialValue?: number): number; - - /** - * 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. - * @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. - * @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. - */ - reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint32Array) => U, initialValue: U): U; - - /** - * 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. - * @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. - * @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. - */ - reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint32Array) => number, initialValue?: number): number; - - /** - * 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. - * @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. - * @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. - */ - reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint32Array) => U, initialValue: U): U; - - /** - * Reverses the elements in an Array. - */ - reverse(): Uint32Array; - - /** - * Sets a value or an array of values. - * @param index The index of the location to set. - * @param value The value to set. - */ - set(index: number, value: number): void; - - /** - * Sets a value or an array of values. - * @param array A typed or untyped array of values to set. - * @param offset The index in the current array at which the values are to be written. - */ - set(array: ArrayLike, offset?: number): void; - - /** - * Returns a section of an array. - * @param start The beginning of the specified portion of the array. - * @param end The end of the specified portion of the array. - */ - slice(start?: number, end?: number): Uint32Array; - - /** - * Determines whether the specified callback function returns true for any element of an array. - * @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. - * @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. - */ - some(callbackfn: (value: number, index: number, array: Uint32Array) => boolean, thisArg?: any): boolean; - - /** - * Sorts an array. - * @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. - */ - sort(compareFn?: (a: number, b: number) => number): Uint32Array; - - /** - * Gets a new Uint32Array view of the ArrayBuffer store for this array, referencing the elements - * at begin, inclusive, up to end, exclusive. - * @param begin The index of the beginning of the array. - * @param end The index of the end of the array. - */ - subarray(begin: number, end?: number): Uint32Array; - - /** - * Converts a number to a string by using the current locale. - */ - toLocaleString(): string; - - /** - * Returns a string representation of an array. - */ - toString(): string; - - [index: number]: number; -} - -interface Uint32ArrayConstructor { - readonly prototype: Uint32Array; - new (length: number): Uint32Array; - new (array: ArrayLike): Uint32Array; - new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Uint32Array; - - /** - * The size in bytes of each element in the array. - */ - readonly BYTES_PER_ELEMENT: number; - - /** - * Returns a new array from a set of elements. - * @param items A set of elements to include in the new array object. - */ - of(...items: number[]): Uint32Array; - - /** - * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint32Array; -} -declare const Uint32Array: Uint32ArrayConstructor; - -/** - * A typed array of 32-bit float values. The contents are initialized to 0. If the requested number - * of bytes could not be allocated an exception is raised. - */ -interface Float32Array { - /** - * The size in bytes of each element in the array. - */ - readonly BYTES_PER_ELEMENT: number; - - /** - * The ArrayBuffer instance referenced by the array. - */ - readonly buffer: ArrayBuffer; - - /** - * The length in bytes of the array. - */ - readonly byteLength: number; - - /** - * The offset in bytes of the array. - */ - readonly byteOffset: number; - - /** - * Returns the this object after copying a section of the array identified by start and end - * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it - * is treated as length+end. - * @param end If not specified, length of the this object is used as its default value. - */ - copyWithin(target: number, start: number, end?: number): Float32Array; - - /** - * Determines whether all the members of an array satisfy the specified test. - * @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. - * @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. - */ - every(callbackfn: (value: number, index: number, array: Float32Array) => boolean, thisArg?: any): boolean; - - /** - * Returns the this object after filling the section identified by start and end with value - * @param value value to fill array section with - * @param start index to start filling the array at. If start is negative, it is treated as - * length+start where length is the length of the array. - * @param end index to stop filling the array at. If end is negative, it is treated as - * length+end. - */ - fill(value: number, start?: number, end?: number): Float32Array; - - /** - * Returns the elements of an array that meet the condition specified in a callback function. - * @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. - * @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. - */ - filter(callbackfn: (value: number, index: number, array: Float32Array) => boolean, thisArg?: any): Float32Array; - - /** - * Returns the value of the first element in the array where predicate is true, and undefined - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; - - /** - * Returns the index of the first element in the array where predicate is true, and undefined - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - findIndex(predicate: (value: number) => boolean, thisArg?: any): number; - - /** - * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the - * callbackfn function one time for each element in the array. - * @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. - */ - forEach(callbackfn: (value: number, index: number, array: Float32Array) => void, thisArg?: any): void; - - /** - * Returns the index of the first occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - indexOf(searchElement: number, fromIndex?: number): number; - - /** - * Adds all the elements of an array separated by the specified separator string. - * @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. - */ - join(separator?: string): string; - - /** - * Returns the index of the last occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - lastIndexOf(searchElement: number, fromIndex?: number): number; - - /** - * The length of the array. - */ - readonly length: number; - - /** - * Calls a defined callback function on each element of an array, and returns an array that - * contains the results. - * @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. - * @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. - */ - map(callbackfn: (value: number, index: number, array: Float32Array) => number, thisArg?: any): Float32Array; - - /** - * 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. - * @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. - * @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. - */ - reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float32Array) => number, initialValue?: number): number; - - /** - * 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. - * @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. - * @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. - */ - reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Float32Array) => U, initialValue: U): U; - - /** - * 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. - * @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. - * @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. - */ - reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float32Array) => number, initialValue?: number): number; - - /** - * 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. - * @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. - * @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. - */ - reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Float32Array) => U, initialValue: U): U; - - /** - * Reverses the elements in an Array. - */ - reverse(): Float32Array; - - /** - * Sets a value or an array of values. - * @param index The index of the location to set. - * @param value The value to set. - */ - set(index: number, value: number): void; - - /** - * Sets a value or an array of values. - * @param array A typed or untyped array of values to set. - * @param offset The index in the current array at which the values are to be written. - */ - set(array: ArrayLike, offset?: number): void; - - /** - * Returns a section of an array. - * @param start The beginning of the specified portion of the array. - * @param end The end of the specified portion of the array. - */ - slice(start?: number, end?: number): Float32Array; - - /** - * Determines whether the specified callback function returns true for any element of an array. - * @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. - * @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. - */ - some(callbackfn: (value: number, index: number, array: Float32Array) => boolean, thisArg?: any): boolean; - - /** - * Sorts an array. - * @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. - */ - sort(compareFn?: (a: number, b: number) => number): Float32Array; - - /** - * Gets a new Float32Array view of the ArrayBuffer store for this array, referencing the elements - * at begin, inclusive, up to end, exclusive. - * @param begin The index of the beginning of the array. - * @param end The index of the end of the array. - */ - subarray(begin: number, end?: number): Float32Array; - - /** - * Converts a number to a string by using the current locale. - */ - toLocaleString(): string; - - /** - * Returns a string representation of an array. - */ - toString(): string; - - [index: number]: number; -} - -interface Float32ArrayConstructor { - readonly prototype: Float32Array; - new (length: number): Float32Array; - new (array: ArrayLike): Float32Array; - new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Float32Array; - - /** - * The size in bytes of each element in the array. - */ - readonly BYTES_PER_ELEMENT: number; - - /** - * Returns a new array from a set of elements. - * @param items A set of elements to include in the new array object. - */ - of(...items: number[]): Float32Array; - - /** - * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Float32Array; - -} -declare const Float32Array: Float32ArrayConstructor; - -/** - * A typed array of 64-bit float values. The contents are initialized to 0. If the requested - * number of bytes could not be allocated an exception is raised. - */ -interface Float64Array { - /** - * The size in bytes of each element in the array. - */ - readonly BYTES_PER_ELEMENT: number; - - /** - * The ArrayBuffer instance referenced by the array. - */ - readonly buffer: ArrayBuffer; - - /** - * The length in bytes of the array. - */ - readonly byteLength: number; - - /** - * The offset in bytes of the array. - */ - readonly byteOffset: number; - - /** - * Returns the this object after copying a section of the array identified by start and end - * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it - * is treated as length+end. - * @param end If not specified, length of the this object is used as its default value. - */ - copyWithin(target: number, start: number, end?: number): Float64Array; - - /** - * Determines whether all the members of an array satisfy the specified test. - * @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. - * @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. - */ - every(callbackfn: (value: number, index: number, array: Float64Array) => boolean, thisArg?: any): boolean; - - /** - * Returns the this object after filling the section identified by start and end with value - * @param value value to fill array section with - * @param start index to start filling the array at. If start is negative, it is treated as - * length+start where length is the length of the array. - * @param end index to stop filling the array at. If end is negative, it is treated as - * length+end. - */ - fill(value: number, start?: number, end?: number): Float64Array; - - /** - * Returns the elements of an array that meet the condition specified in a callback function. - * @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. - * @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. - */ - filter(callbackfn: (value: number, index: number, array: Float64Array) => boolean, thisArg?: any): Float64Array; - - /** - * Returns the value of the first element in the array where predicate is true, and undefined - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; - - /** - * Returns the index of the first element in the array where predicate is true, and undefined - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - findIndex(predicate: (value: number) => boolean, thisArg?: any): number; - - /** - * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the - * callbackfn function one time for each element in the array. - * @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. - */ - forEach(callbackfn: (value: number, index: number, array: Float64Array) => void, thisArg?: any): void; - - /** - * Returns the index of the first occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - indexOf(searchElement: number, fromIndex?: number): number; - - /** - * Adds all the elements of an array separated by the specified separator string. - * @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. - */ - join(separator?: string): string; - - /** - * Returns the index of the last occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - lastIndexOf(searchElement: number, fromIndex?: number): number; - - /** - * The length of the array. - */ - readonly length: number; - - /** - * Calls a defined callback function on each element of an array, and returns an array that - * contains the results. - * @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. - * @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. - */ - map(callbackfn: (value: number, index: number, array: Float64Array) => number, thisArg?: any): Float64Array; - - /** - * 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. - * @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. - * @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. - */ - reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float64Array) => number, initialValue?: number): number; - - /** - * 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. - * @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. - * @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. - */ - reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Float64Array) => U, initialValue: U): U; - - /** - * 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. - * @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. - * @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. - */ - reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float64Array) => number, initialValue?: number): number; - - /** - * 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. - * @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. - * @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. - */ - reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Float64Array) => U, initialValue: U): U; - - /** - * Reverses the elements in an Array. - */ - reverse(): Float64Array; - - /** - * Sets a value or an array of values. - * @param index The index of the location to set. - * @param value The value to set. - */ - set(index: number, value: number): void; - - /** - * Sets a value or an array of values. - * @param array A typed or untyped array of values to set. - * @param offset The index in the current array at which the values are to be written. - */ - set(array: ArrayLike, offset?: number): void; - - /** - * Returns a section of an array. - * @param start The beginning of the specified portion of the array. - * @param end The end of the specified portion of the array. - */ - slice(start?: number, end?: number): Float64Array; - - /** - * Determines whether the specified callback function returns true for any element of an array. - * @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. - * @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. - */ - some(callbackfn: (value: number, index: number, array: Float64Array) => boolean, thisArg?: any): boolean; - - /** - * Sorts an array. - * @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. - */ - sort(compareFn?: (a: number, b: number) => number): Float64Array; - - /** - * Gets a new Float64Array view of the ArrayBuffer store for this array, referencing the elements - * at begin, inclusive, up to end, exclusive. - * @param begin The index of the beginning of the array. - * @param end The index of the end of the array. - */ - subarray(begin: number, end?: number): Float64Array; - - /** - * Converts a number to a string by using the current locale. - */ - toLocaleString(): string; - - /** - * Returns a string representation of an array. - */ - toString(): string; - - [index: number]: number; -} - -interface Float64ArrayConstructor { - readonly prototype: Float64Array; - new (length: number): Float64Array; - new (array: ArrayLike): Float64Array; - new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Float64Array; - - /** - * The size in bytes of each element in the array. - */ - readonly BYTES_PER_ELEMENT: number; - - /** - * Returns a new array from a set of elements. - * @param items A set of elements to include in the new array object. - */ - of(...items: number[]): Float64Array; - - /** - * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Float64Array; -} -declare const Float64Array: Float64ArrayConstructor; -declare type PropertyKey = string | number | symbol; - -interface Symbol { - /** Returns a string representation of an object. */ - toString(): string; - - /** Returns the primitive value of the specified object. */ - valueOf(): Object; - - readonly [Symbol.toStringTag]: "Symbol"; -} - -interface SymbolConstructor { - /** - * A reference to the prototype. - */ - readonly prototype: Symbol; - - /** - * Returns a new unique Symbol value. - * @param description Description of the new Symbol object. - */ - (description?: string|number): symbol; - - /** - * Returns a Symbol object from the global symbol registry matching the given key if found. - * Otherwise, returns a new symbol with this key. - * @param key key to search for. - */ - for(key: string): symbol; - - /** - * Returns a key from the global symbol registry matching the given Symbol if found. - * Otherwise, returns a undefined. - * @param sym Symbol to find the key for. - */ - keyFor(sym: symbol): string; - - // Well-known Symbols - - /** - * A method that determines if a constructor object recognizes an object as one of the - * constructor’s instances. Called by the semantics of the instanceof operator. - */ - readonly hasInstance: symbol; - - /** - * A Boolean value that if true indicates that an object should flatten to its array elements - * by Array.prototype.concat. - */ - readonly isConcatSpreadable: symbol; - - /** - * A method that returns the default iterator for an object. Called by the semantics of the - * for-of statement. - */ - readonly iterator: symbol; - - /** - * A regular expression method that matches the regular expression against a string. Called - * by the String.prototype.match method. - */ - readonly match: symbol; - - /** - * A regular expression method that replaces matched substrings of a string. Called by the - * String.prototype.replace method. - */ - readonly replace: symbol; - - /** - * A regular expression method that returns the index within a string that matches the - * regular expression. Called by the String.prototype.search method. - */ - readonly search: symbol; - - /** - * A function valued property that is the constructor function that is used to create - * derived objects. - */ - readonly species: symbol; - - /** - * A regular expression method that splits a string at the indices that match the regular - * expression. Called by the String.prototype.split method. - */ - readonly split: symbol; - - /** - * A method that converts an object to a corresponding primitive value. - * Called by the ToPrimitive abstract operation. - */ - readonly toPrimitive: symbol; - - /** - * A String value that is used in the creation of the default string description of an object. - * Called by the built-in method Object.prototype.toString. - */ - readonly toStringTag: symbol; - - /** - * An Object whose own property names are property names that are excluded from the 'with' - * environment bindings of the associated objects. - */ - readonly unscopables: symbol; -} -declare var Symbol: SymbolConstructor; - -interface Object { - /** - * Determines whether an object has a property with the specified name. - * @param v A property name. - */ - hasOwnProperty(v: PropertyKey): boolean; - - /** - * Determines whether a specified property is enumerable. - * @param v A property name. - */ - propertyIsEnumerable(v: PropertyKey): boolean; -} - -interface ObjectConstructor { - /** - * Copy the values of all of the enumerable own properties from one or more source objects to a - * target object. Returns the target object. - * @param target The target object to copy to. - * @param source The source object from which to copy properties. - */ - assign(target: T, source: U): T & U; - - /** - * Copy the values of all of the enumerable own properties from one or more source objects to a - * target object. Returns the target object. - * @param target The target object to copy to. - * @param source1 The first source object from which to copy properties. - * @param source2 The second source object from which to copy properties. - */ - assign(target: T, source1: U, source2: V): T & U & V; - - /** - * Copy the values of all of the enumerable own properties from one or more source objects to a - * target object. Returns the target object. - * @param target The target object to copy to. - * @param source1 The first source object from which to copy properties. - * @param source2 The second source object from which to copy properties. - * @param source3 The third source object from which to copy properties. - */ - assign(target: T, source1: U, source2: V, source3: W): T & U & V & W; - - /** - * Copy the values of all of the enumerable own properties from one or more source objects to a - * target object. Returns the target object. - * @param target The target object to copy to. - * @param sources One or more source objects from which to copy properties - */ - assign(target: any, ...sources: any[]): any; - - /** - * Returns an array of all symbol properties found directly on object o. - * @param o Object to retrieve the symbols from. - */ - getOwnPropertySymbols(o: any): symbol[]; - - /** - * Returns true if the values are the same value, false otherwise. - * @param value1 The first value. - * @param value2 The second value. - */ - is(value1: any, value2: any): boolean; - - /** - * Sets the prototype of a specified object o to object proto or null. Returns the object o. - * @param o The object to change its prototype. - * @param proto The value of the new prototype or null. - */ - setPrototypeOf(o: any, proto: any): any; - - /** - * Gets the own property descriptor of the specified object. - * An own property descriptor is one that is defined directly on the object and is not - * inherited from the object's prototype. - * @param o Object that contains the property. - * @param p Name of the property. - */ - getOwnPropertyDescriptor(o: any, propertyKey: PropertyKey): PropertyDescriptor; - - /** - * Adds a property to an object, or modifies attributes of an existing property. - * @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. - * @param p The property name. - * @param attributes Descriptor for the property. It can be for a data property or an accessor - * property. - */ - defineProperty(o: any, propertyKey: PropertyKey, attributes: PropertyDescriptor): any; -} - -interface Function { - /** - * Returns the name of the function. Function names are read-only and can not be changed. - */ - readonly name: string; - - /** - * Determines whether the given value inherits from this function if this function was used - * as a constructor function. - * - * A constructor function can control which objects are recognized as its instances by - * 'instanceof' by overriding this method. - */ - [Symbol.hasInstance](value: any): boolean; -} - -interface NumberConstructor { - /** - * The value of Number.EPSILON is the difference between 1 and the smallest value greater than 1 - * that is representable as a Number value, which is approximately: - * 2.2204460492503130808472633361816 x 10‍−‍16. - */ - readonly EPSILON: number; - - /** - * Returns true if passed value is finite. - * Unlike the global isFininte, Number.isFinite doesn't forcibly convert the parameter to a - * number. Only finite values of the type number, result in true. - * @param number A numeric value. - */ - isFinite(number: number): boolean; - - /** - * Returns true if the value passed is an integer, false otherwise. - * @param number A numeric value. - */ - isInteger(number: number): boolean; - - /** - * Returns a Boolean value that indicates whether a value is the reserved value NaN (not a - * number). Unlike the global isNaN(), Number.isNaN() doesn't forcefully convert the parameter - * to a number. Only values of the type number, that are also NaN, result in true. - * @param number A numeric value. - */ - isNaN(number: number): boolean; - - /** - * Returns true if the value passed is a safe integer. - * @param number A numeric value. - */ - isSafeInteger(number: number): boolean; - - /** - * The value of the largest integer n such that n and n + 1 are both exactly representable as - * a Number value. - * The value of Number.MIN_SAFE_INTEGER is 9007199254740991 2^53 − 1. - */ - readonly MAX_SAFE_INTEGER: number; - - /** - * The value of the smallest integer n such that n and n − 1 are both exactly representable as - * a Number value. - * The value of Number.MIN_SAFE_INTEGER is −9007199254740991 (−(2^53 − 1)). - */ - readonly MIN_SAFE_INTEGER: number; - - /** - * Converts a string to a floating-point number. - * @param string A string that contains a floating-point number. - */ - parseFloat(string: string): number; - - /** - * Converts A string to an integer. - * @param s A string to convert into a number. - * @param radix A value between 2 and 36 that specifies the base of the number in numString. - * If this argument is not supplied, strings with a prefix of '0x' are considered hexadecimal. - * All other strings are considered decimal. - */ - parseInt(string: string, radix?: number): number; -} - -interface Array { - /** Iterator */ - [Symbol.iterator](): IterableIterator; - - /** - * Returns an object whose properties have the value 'true' - * when they will be absent when used in a 'with' statement. - */ - [Symbol.unscopables](): { - copyWithin: boolean; - entries: boolean; - fill: boolean; - find: boolean; - findIndex: boolean; - keys: boolean; - values: boolean; - }; - - /** - * Returns an array of key, value pairs for every entry in the array - */ - entries(): IterableIterator<[number, T]>; - - /** - * Returns an list of keys in the array - */ - keys(): IterableIterator; - - /** - * Returns an list of values in the array - */ - values(): IterableIterator; - - /** - * Returns the value of the first element in the array where predicate is true, and undefined - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - find(predicate: (value: T, index: number, obj: Array) => boolean, thisArg?: any): T; - - /** - * Returns the index of the first element in the array where predicate is true, and undefined - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - findIndex(predicate: (value: T) => boolean, thisArg?: any): number; - - /** - * Returns the this object after filling the section identified by start and end with value - * @param value value to fill array section with - * @param start index to start filling the array at. If start is negative, it is treated as - * length+start where length is the length of the array. - * @param end index to stop filling the array at. If end is negative, it is treated as - * length+end. - */ - fill(value: T, start?: number, end?: number): T[]; - - /** - * Returns the this object after copying a section of the array identified by start and end - * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it - * is treated as length+end. - * @param end If not specified, length of the this object is used as its default value. - */ - copyWithin(target: number, start: number, end?: number): T[]; -} - -interface IArguments { - /** Iterator */ - [Symbol.iterator](): IterableIterator; -} - -interface ArrayConstructor { - /** - * Creates an array from an array-like object. - * @param arrayLike An array-like object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(arrayLike: ArrayLike, mapfn: (v: T, k: number) => U, thisArg?: any): Array; - - /** - * Creates an array from an iterable object. - * @param iterable An iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(iterable: Iterable, mapfn: (v: T, k: number) => U, thisArg?: any): Array; - - /** - * Creates an array from an array-like object. - * @param arrayLike An array-like object to convert to an array. - */ - from(arrayLike: ArrayLike): Array; - - /** - * Creates an array from an iterable object. - * @param iterable An iterable object to convert to an array. - */ - from(iterable: Iterable): Array; - - /** - * Returns a new array from a set of elements. - * @param items A set of elements to include in the new array object. - */ - of(...items: T[]): Array; -} - -interface String { - /** Iterator */ - [Symbol.iterator](): IterableIterator; - - /** - * Returns a nonnegative integer Number less than 1114112 (0x110000) that is the code point - * value of the UTF-16 encoded code point starting at the string element at position pos in - * the String resulting from converting this object to a String. - * If there is no element at that position, the result is undefined. - * If a valid UTF-16 surrogate pair does not begin at pos, the result is the code unit at pos. - */ - codePointAt(pos: number): number; - - /** - * Returns true if searchString appears as a substring of the result of converting this - * object to a String, at one or more positions that are - * greater than or equal to position; otherwise, returns false. - * @param searchString search string - * @param position If position is undefined, 0 is assumed, so as to search all of the String. - */ - includes(searchString: string, position?: number): boolean; - - /** - * Returns true if the sequence of elements of searchString converted to a String is the - * same as the corresponding elements of this object (converted to a String) starting at - * endPosition – length(this). Otherwise returns false. - */ - endsWith(searchString: string, endPosition?: number): boolean; - - /** - * Returns the String value result of normalizing the string into the normalization form - * named by form as specified in Unicode Standard Annex #15, Unicode Normalization Forms. - * @param form Applicable values: "NFC", "NFD", "NFKC", or "NFKD", If not specified default - * is "NFC" - */ - normalize(form?: string): string; - - /** - * Returns a String value that is made from count copies appended together. If count is 0, - * T is the empty String is returned. - * @param count number of copies to append - */ - repeat(count: number): string; - - /** - * Returns true if the sequence of elements of searchString converted to a String is the - * same as the corresponding elements of this object (converted to a String) starting at - * position. Otherwise returns false. - */ - startsWith(searchString: string, position?: number): boolean; - - // Overloads for objects with methods of well-known symbols. - - /** - * Matches a string an object that supports being matched against, and returns an array containing the results of that search. - * @param matcher An object that supports being matched against. - */ - match(matcher: { [Symbol.match](string: string): RegExpMatchArray; }): RegExpMatchArray; - - /** - * Replaces text in a string, using an object that supports replacement within a string. - * @param searchValue A object can search for and replace matches within a string. - * @param replaceValue A string containing the text to replace for every successful match of searchValue in this string. - */ - replace(searchValue: { [Symbol.replace](string: string, replaceValue: string): string; }, replaceValue: string): string; - - /** - * Replaces text in a string, using an object that supports replacement within a string. - * @param searchValue A object can search for and replace matches within a string. - * @param replacer A function that returns the replacement text. - */ - replace(searchValue: { [Symbol.replace](string: string, replacer: (substring: string, ...args: any[]) => string): string; }, replacer: (substring: string, ...args: any[]) => string): string; - - /** - * Finds the first substring match in a regular expression search. - * @param searcher An object which supports searching within a string. - */ - search(searcher: { [Symbol.search](string: string): number; }): number; - - /** - * Split a string into substrings using the specified separator and return them as an array. - * @param splitter An object that can split a string. - * @param limit A value used to limit the number of elements returned in the array. - */ - split(splitter: { [Symbol.split](string: string, limit?: number): string[]; }, limit?: number): string[]; - - /** - * Returns an HTML anchor element and sets the name attribute to the text value - * @param name - */ - anchor(name: string): string; - - /** Returns a HTML element */ - big(): string; - - /** Returns a HTML element */ - blink(): string; - - /** Returns a HTML element */ - bold(): string; - - /** Returns a HTML element */ - fixed(): string - - /** Returns a HTML element and sets the color attribute value */ - fontcolor(color: string): string - - /** Returns a HTML element and sets the size attribute value */ - fontsize(size: number): string; - - /** Returns a HTML element and sets the size attribute value */ - fontsize(size: string): string; - - /** Returns an HTML element */ - italics(): string; - - /** Returns an HTML element and sets the href attribute value */ - link(url: string): string; - - /** Returns a HTML element */ - small(): string; - - /** Returns a HTML element */ - strike(): string; - - /** Returns a HTML element */ - sub(): string; - - /** Returns a HTML element */ - sup(): string; -} - -interface StringConstructor { - /** - * Return the String value whose elements are, in order, the elements in the List elements. - * If length is 0, the empty string is returned. - */ - fromCodePoint(...codePoints: number[]): string; - - /** - * String.raw is intended for use as a tag function of a Tagged Template String. When called - * as such the first argument will be a well formed template call site object and the rest - * parameter will contain the substitution values. - * @param template A well-formed template string call site representation. - * @param substitutions A set of substitution values. - */ - raw(template: TemplateStringsArray, ...substitutions: any[]): string; -} - -interface IteratorResult { - done: boolean; - value?: T; -} - -interface Iterator { - next(value?: any): IteratorResult; - return?(value?: any): IteratorResult; - throw?(e?: any): IteratorResult; -} - -interface Iterable { - [Symbol.iterator](): Iterator; -} - -interface IterableIterator extends Iterator { - [Symbol.iterator](): IterableIterator; -} - -interface GeneratorFunction extends Function { - readonly [Symbol.toStringTag]: "GeneratorFunction"; -} - -interface GeneratorFunctionConstructor { - /** - * Creates a new Generator function. - * @param args A list of arguments the function accepts. - */ - new (...args: string[]): GeneratorFunction; - (...args: string[]): GeneratorFunction; - readonly prototype: GeneratorFunction; -} -declare var GeneratorFunction: GeneratorFunctionConstructor; - -interface Math { - /** - * Returns the number of leading zero bits in the 32-bit binary representation of a number. - * @param x A numeric expression. - */ - clz32(x: number): number; - - /** - * Returns the result of 32-bit multiplication of two numbers. - * @param x First number - * @param y Second number - */ - imul(x: number, y: number): number; - - /** - * Returns the sign of the x, indicating whether x is positive, negative or zero. - * @param x The numeric expression to test - */ - sign(x: number): number; - - /** - * Returns the base 10 logarithm of a number. - * @param x A numeric expression. - */ - log10(x: number): number; - - /** - * Returns the base 2 logarithm of a number. - * @param x A numeric expression. - */ - log2(x: number): number; - - /** - * Returns the natural logarithm of 1 + x. - * @param x A numeric expression. - */ - log1p(x: number): number; - - /** - * Returns the result of (e^x - 1) of x (e raised to the power of x, where e is the base of - * the natural logarithms). - * @param x A numeric expression. - */ - expm1(x: number): number; - - /** - * Returns the hyperbolic cosine of a number. - * @param x A numeric expression that contains an angle measured in radians. - */ - cosh(x: number): number; - - /** - * Returns the hyperbolic sine of a number. - * @param x A numeric expression that contains an angle measured in radians. - */ - sinh(x: number): number; - - /** - * Returns the hyperbolic tangent of a number. - * @param x A numeric expression that contains an angle measured in radians. - */ - tanh(x: number): number; - - /** - * Returns the inverse hyperbolic cosine of a number. - * @param x A numeric expression that contains an angle measured in radians. - */ - acosh(x: number): number; - - /** - * Returns the inverse hyperbolic sine of a number. - * @param x A numeric expression that contains an angle measured in radians. - */ - asinh(x: number): number; - - /** - * Returns the inverse hyperbolic tangent of a number. - * @param x A numeric expression that contains an angle measured in radians. - */ - atanh(x: number): number; - - /** - * Returns the square root of the sum of squares of its arguments. - * @param values Values to compute the square root for. - * If no arguments are passed, the result is +0. - * If there is only one argument, the result is the absolute value. - * If any argument is +Infinity or -Infinity, the result is +Infinity. - * If any argument is NaN, the result is NaN. - * If all arguments are either +0 or −0, the result is +0. - */ - hypot(...values: number[] ): number; - - /** - * Returns the integral part of the a numeric expression, x, removing any fractional digits. - * If x is already an integer, the result is x. - * @param x A numeric expression. - */ - trunc(x: number): number; - - /** - * Returns the nearest single precision float representation of a number. - * @param x A numeric expression. - */ - fround(x: number): number; - - /** - * Returns an implementation-dependent approximation to the cube root of number. - * @param x A numeric expression. - */ - cbrt(x: number): number; - - readonly [Symbol.toStringTag]: "Math"; -} - -interface Date { - /** - * Converts a Date object to a string. - */ - [Symbol.toPrimitive](hint: "default"): string; - /** - * Converts a Date object to a string. - */ - [Symbol.toPrimitive](hint: "string"): string; - /** - * Converts a Date object to a number. - */ - [Symbol.toPrimitive](hint: "number"): number; - /** - * Converts a Date object to a string or number. - * - * @param hint The strings "number", "string", or "default" to specify what primitive to return. - * - * @throws {TypeError} If 'hint' was given something other than "number", "string", or "default". - * @returns A number if 'hint' was "number", a string if 'hint' was "string" or "default". - */ - [Symbol.toPrimitive](hint: string): string | number; -} - -interface RegExp { - /** - * Matches a string with this regular expression, and returns an array containing the results of - * that search. - * @param string A string to search within. - */ - [Symbol.match](string: string): RegExpMatchArray; - - /** - * Replaces text in a string, using this regular expression. - * @param string A String object or string literal whose contents matching against - * this regular expression will be replaced - * @param replaceValue A String object or string literal containing the text to replace for every - * successful match of this regular expression. - */ - [Symbol.replace](string: string, replaceValue: string): string; - - /** - * Replaces text in a string, using this regular expression. - * @param string A String object or string literal whose contents matching against - * this regular expression will be replaced - * @param replacer A function that returns the replacement text. - */ - [Symbol.replace](string: string, replacer: (substring: string, ...args: any[]) => string): string; - - /** - * Finds the position beginning first substring match in a regular expression search - * using this regular expression. - * - * @param string The string to search within. - */ - [Symbol.search](string: string): number; - - /** - * Returns an array of substrings that were delimited by strings in the original input that - * match against this regular expression. - * - * If the regular expression contains capturing parentheses, then each time this - * regular expression matches, the results (including any undefined results) of the - * capturing parentheses are spliced. - * - * @param string string value to split - * @param limit if not undefined, the output array is truncated so that it contains no more - * than 'limit' elements. - */ - [Symbol.split](string: string, limit?: number): string[]; - - /** - * Returns a string indicating the flags of the regular expression in question. This field is read-only. - * The characters in this string are sequenced and concatenated in the following order: - * - * - "g" for global - * - "i" for ignoreCase - * - "m" for multiline - * - "u" for unicode - * - "y" for sticky - * - * If no flags are set, the value is the empty string. - */ - readonly flags: string; - - /** - * Returns a Boolean value indicating the state of the sticky flag (y) used with a regular - * expression. Default is false. Read-only. - */ - readonly sticky: boolean; - - /** - * Returns a Boolean value indicating the state of the Unicode flag (u) used with a regular - * expression. Default is false. Read-only. - */ - readonly unicode: boolean; -} - -interface RegExpConstructor { - [Symbol.species](): RegExpConstructor; -} - -interface Map { - clear(): void; - delete(key: K): boolean; - entries(): IterableIterator<[K, V]>; - forEach(callbackfn: (value: V, index: K, map: Map) => void, thisArg?: any): void; - get(key: K): V; - has(key: K): boolean; - keys(): IterableIterator; - set(key: K, value?: V): Map; - readonly size: number; - values(): IterableIterator; - [Symbol.iterator]():IterableIterator<[K,V]>; - readonly [Symbol.toStringTag]: "Map"; -} - -interface MapConstructor { - new (): Map; - new (): Map; - new (iterable: Iterable<[K, V]>): Map; - readonly prototype: Map; -} -declare var Map: MapConstructor; - -interface WeakMap { - clear(): void; - delete(key: K): boolean; - get(key: K): V; - has(key: K): boolean; - set(key: K, value?: V): WeakMap; - readonly [Symbol.toStringTag]: "WeakMap"; -} - -interface WeakMapConstructor { - new (): WeakMap; - new (): WeakMap; - new (iterable: Iterable<[K, V]>): WeakMap; - readonly prototype: WeakMap; -} -declare var WeakMap: WeakMapConstructor; - -interface Set { - add(value: T): Set; - clear(): void; - delete(value: T): boolean; - entries(): IterableIterator<[T, T]>; - forEach(callbackfn: (value: T, index: T, set: Set) => void, thisArg?: any): void; - has(value: T): boolean; - keys(): IterableIterator; - readonly size: number; - values(): IterableIterator; - [Symbol.iterator]():IterableIterator; - readonly [Symbol.toStringTag]: "Set"; -} - -interface SetConstructor { - new (): Set; - new (): Set; - new (iterable: Iterable): Set; - readonly prototype: Set; -} -declare var Set: SetConstructor; - -interface WeakSet { - add(value: T): WeakSet; - clear(): void; - delete(value: T): boolean; - has(value: T): boolean; - readonly [Symbol.toStringTag]: "WeakSet"; -} - -interface WeakSetConstructor { - new (): WeakSet; - new (): WeakSet; - new (iterable: Iterable): WeakSet; - readonly prototype: WeakSet; -} -declare var WeakSet: WeakSetConstructor; - -interface JSON { - readonly [Symbol.toStringTag]: "JSON"; -} - -/** - * Represents a raw buffer of binary data, which is used to store data for the - * different typed arrays. ArrayBuffers cannot be read from or written to directly, - * but can be passed to a typed array or DataView Object to interpret the raw - * buffer as needed. - */ -interface ArrayBuffer { - readonly [Symbol.toStringTag]: "ArrayBuffer"; -} - -interface DataView { - readonly [Symbol.toStringTag]: "DataView"; -} - -/** - * A typed array of 8-bit integer values. The contents are initialized to 0. If the requested - * number of bytes could not be allocated an exception is raised. - */ -interface Int8Array { - /** - * Returns an array of key, value pairs for every entry in the array - */ - entries(): IterableIterator<[number, number]>; - /** - * Returns an list of keys in the array - */ - keys(): IterableIterator; - /** - * Returns an list of values in the array - */ - values(): IterableIterator; - [Symbol.iterator](): IterableIterator; - readonly [Symbol.toStringTag]: "Int8Array"; -} - -interface Int8ArrayConstructor { - new (elements: Iterable): Int8Array; - - /** - * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Int8Array; -} - -/** - * A typed array of 8-bit unsigned integer values. The contents are initialized to 0. If the - * requested number of bytes could not be allocated an exception is raised. - */ -interface Uint8Array { - /** - * Returns an array of key, value pairs for every entry in the array - */ - entries(): IterableIterator<[number, number]>; - /** - * Returns an list of keys in the array - */ - keys(): IterableIterator; - /** - * Returns an list of values in the array - */ - values(): IterableIterator; - [Symbol.iterator](): IterableIterator; - readonly [Symbol.toStringTag]: "UInt8Array"; -} - -interface Uint8ArrayConstructor { - new (elements: Iterable): Uint8Array; - - /** - * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint8Array; -} - -/** - * A typed array of 8-bit unsigned integer (clamped) values. The contents are initialized to 0. - * If the requested number of bytes could not be allocated an exception is raised. - */ -interface Uint8ClampedArray { - /** - * Returns an array of key, value pairs for every entry in the array - */ - entries(): IterableIterator<[number, number]>; - - /** - * Returns an list of keys in the array - */ - keys(): IterableIterator; - - /** - * Returns an list of values in the array - */ - values(): IterableIterator; - - [Symbol.iterator](): IterableIterator; - readonly [Symbol.toStringTag]: "Uint8ClampedArray"; -} - -interface Uint8ClampedArrayConstructor { - new (elements: Iterable): Uint8ClampedArray; - - - /** - * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint8ClampedArray; -} - -/** - * A typed array of 16-bit signed integer values. The contents are initialized to 0. If the - * requested number of bytes could not be allocated an exception is raised. - */ -interface Int16Array { - /** - * Returns an array of key, value pairs for every entry in the array - */ - entries(): IterableIterator<[number, number]>; - - /** - * Returns an list of keys in the array - */ - keys(): IterableIterator; - - /** - * Returns an list of values in the array - */ - values(): IterableIterator; - - - [Symbol.iterator](): IterableIterator; - readonly [Symbol.toStringTag]: "Int16Array"; -} - -interface Int16ArrayConstructor { - new (elements: Iterable): Int16Array; - - /** - * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Int16Array; -} - -/** - * A typed array of 16-bit unsigned integer values. The contents are initialized to 0. If the - * requested number of bytes could not be allocated an exception is raised. - */ -interface Uint16Array { - /** - * Returns an array of key, value pairs for every entry in the array - */ - entries(): IterableIterator<[number, number]>; - /** - * Returns an list of keys in the array - */ - keys(): IterableIterator; - /** - * Returns an list of values in the array - */ - values(): IterableIterator; - [Symbol.iterator](): IterableIterator; - readonly [Symbol.toStringTag]: "Uint16Array"; -} - -interface Uint16ArrayConstructor { - new (elements: Iterable): Uint16Array; - - /** - * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint16Array; -} - -/** - * A typed array of 32-bit signed integer values. The contents are initialized to 0. If the - * requested number of bytes could not be allocated an exception is raised. - */ -interface Int32Array { - /** - * Returns an array of key, value pairs for every entry in the array - */ - entries(): IterableIterator<[number, number]>; - /** - * Returns an list of keys in the array - */ - keys(): IterableIterator; - /** - * Returns an list of values in the array - */ - values(): IterableIterator; - [Symbol.iterator](): IterableIterator; - readonly [Symbol.toStringTag]: "Int32Array"; -} - -interface Int32ArrayConstructor { - new (elements: Iterable): Int32Array; - - /** - * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Int32Array; -} - -/** - * A typed array of 32-bit unsigned integer values. The contents are initialized to 0. If the - * requested number of bytes could not be allocated an exception is raised. - */ -interface Uint32Array { - /** - * Returns an array of key, value pairs for every entry in the array - */ - entries(): IterableIterator<[number, number]>; - /** - * Returns an list of keys in the array - */ - keys(): IterableIterator; - /** - * Returns an list of values in the array - */ - values(): IterableIterator; - [Symbol.iterator](): IterableIterator; - readonly [Symbol.toStringTag]: "Uint32Array"; -} - -interface Uint32ArrayConstructor { - new (elements: Iterable): Uint32Array; - - /** - * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint32Array; -} - -/** - * A typed array of 32-bit float values. The contents are initialized to 0. If the requested number - * of bytes could not be allocated an exception is raised. - */ -interface Float32Array { - /** - * Returns an array of key, value pairs for every entry in the array - */ - entries(): IterableIterator<[number, number]>; - /** - * Returns an list of keys in the array - */ - keys(): IterableIterator; - /** - * Returns an list of values in the array - */ - values(): IterableIterator; - [Symbol.iterator](): IterableIterator; - readonly [Symbol.toStringTag]: "Float32Array"; -} - -interface Float32ArrayConstructor { - new (elements: Iterable): Float32Array; - - /** - * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Float32Array; -} - -/** - * A typed array of 64-bit float values. The contents are initialized to 0. If the requested - * number of bytes could not be allocated an exception is raised. - */ -interface Float64Array { - /** - * Returns an array of key, value pairs for every entry in the array - */ - entries(): IterableIterator<[number, number]>; - /** - * Returns an list of keys in the array - */ - keys(): IterableIterator; - /** - * Returns an list of values in the array - */ - values(): IterableIterator; - [Symbol.iterator](): IterableIterator; - readonly [Symbol.toStringTag]: "Float64Array"; -} - -interface Float64ArrayConstructor { - new (elements: Iterable): Float64Array; - - /** - * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Float64Array; -} - -interface ProxyHandler { - getPrototypeOf? (target: T): any; - setPrototypeOf? (target: T, v: any): boolean; - isExtensible? (target: T): boolean; - preventExtensions? (target: T): boolean; - getOwnPropertyDescriptor? (target: T, p: PropertyKey): PropertyDescriptor; - has? (target: T, p: PropertyKey): boolean; - get? (target: T, p: PropertyKey, receiver: any): any; - set? (target: T, p: PropertyKey, value: any, receiver: any): boolean; - deleteProperty? (target: T, p: PropertyKey): boolean; - defineProperty? (target: T, p: PropertyKey, attributes: PropertyDescriptor): boolean; - enumerate? (target: T): PropertyKey[]; - ownKeys? (target: T): PropertyKey[]; - apply? (target: T, thisArg: any, argArray?: any): any; - construct? (target: T, thisArg: any, argArray?: any): any; -} - -interface ProxyConstructor { - revocable(target: T, handler: ProxyHandler): { proxy: T; revoke: () => void; }; - new (target: T, handler: ProxyHandler): T -} -declare var Proxy: ProxyConstructor; - -declare namespace Reflect { - function apply(target: Function, thisArgument: any, argumentsList: ArrayLike): any; - function construct(target: Function, argumentsList: ArrayLike, newTarget?: any): any; - function defineProperty(target: any, propertyKey: PropertyKey, attributes: PropertyDescriptor): boolean; - function deleteProperty(target: any, propertyKey: PropertyKey): boolean; - function enumerate(target: any): IterableIterator; - function get(target: any, propertyKey: PropertyKey, receiver?: any): any; - function getOwnPropertyDescriptor(target: any, propertyKey: PropertyKey): PropertyDescriptor; - function getPrototypeOf(target: any): any; - function has(target: any, propertyKey: string): boolean; - function has(target: any, propertyKey: symbol): boolean; - function isExtensible(target: any): boolean; - function ownKeys(target: any): Array; - function preventExtensions(target: any): boolean; - function set(target: any, propertyKey: PropertyKey, value: any, receiver?: any): boolean; - function setPrototypeOf(target: any, proto: any): boolean; -} - -/** - * Represents the completion of an asynchronous operation - */ -interface Promise { - /** - * Attaches callbacks for the resolution and/or rejection of the Promise. - * @param onfulfilled The callback to execute when the Promise is resolved. - * @param onrejected The callback to execute when the Promise is rejected. - * @returns A Promise for the completion of which ever callback is executed. - */ - then(onfulfilled?: (value: T) => TResult | PromiseLike, onrejected?: (reason: any) => TResult | PromiseLike): Promise; - then(onfulfilled?: (value: T) => TResult | PromiseLike, onrejected?: (reason: any) => void): Promise; - - /** - * Attaches a callback for only the rejection of the Promise. - * @param onrejected The callback to execute when the Promise is rejected. - * @returns A Promise for the completion of the callback. - */ - catch(onrejected?: (reason: any) => T | PromiseLike): Promise; - catch(onrejected?: (reason: any) => void): Promise; - - readonly [Symbol.toStringTag]: "Promise"; -} - -interface PromiseConstructor { - /** - * A reference to the prototype. - */ - readonly prototype: Promise; - - /** - * Creates a new Promise. - * @param executor A callback used to initialize the promise. This callback is passed two arguments: - * a resolve callback used resolve the promise with a value or the result of another promise, - * and a reject callback used to reject the promise with a provided reason or error. - */ - new (executor: (resolve: (value?: T | PromiseLike) => void, reject: (reason?: any) => void) => void): Promise; - - /** - * Creates a Promise that is resolved with an array of results when all of the provided Promises - * resolve, or rejected when any Promise is rejected. - * @param values An array of Promises. - * @returns A new Promise. - */ - 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]>; - 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]>; - 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]>; - all(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike , T5 | PromiseLike, T6 | PromiseLike, T7 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6, T7]>; - all(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike , T5 | PromiseLike, T6 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6]>; - all(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike , T5 | PromiseLike]): Promise<[T1, T2, T3, T4, T5]>; - all(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike ]): Promise<[T1, T2, T3, T4]>; - all(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike]): Promise<[T1, T2, T3]>; - all(values: [T1 | PromiseLike, T2 | PromiseLike]): Promise<[T1, T2]>; - all(values: Iterable>): Promise; - - /** - * Creates a Promise that is resolved or rejected when any of the provided Promises are resolved - * or rejected. - * @param values An array of Promises. - * @returns A new Promise. - */ - race(values: Iterable>): Promise; - - /** - * Creates a new rejected promise for the provided reason. - * @param reason The reason the promise was rejected. - * @returns A new rejected Promise. - */ - reject(reason: any): Promise; - - /** - * Creates a new rejected promise for the provided reason. - * @param reason The reason the promise was rejected. - * @returns A new rejected Promise. - */ - reject(reason: any): Promise; - - /** - * Creates a new resolved promise for the provided value. - * @param value A promise. - * @returns A promise whose internal state matches the provided promise. - */ - resolve(value: T | PromiseLike): Promise; - - /** - * Creates a new resolved promise . - * @returns A resolved promise. - */ - resolve(): Promise; - - readonly [Symbol.species]: Function; -} - -declare var Promise: PromiseConstructor; -interface Array { - /** - * Determines whether an array includes a certain element, returning true or false as appropriate. - * @param searchElement The element to search for. - * @param fromIndex The position in this array at which to begin searching for searchElement. - */ - includes(searchElement: T, fromIndex?: number): boolean; -} - -interface Int8Array { - /** - * Determines whether an array includes a certain element, returning true or false as appropriate. - * @param searchElement The element to search for. - * @param fromIndex The position in this array at which to begin searching for searchElement. - */ - includes(searchElement: number, fromIndex?: number): boolean; -} - -interface Uint8Array { - /** - * Determines whether an array includes a certain element, returning true or false as appropriate. - * @param searchElement The element to search for. - * @param fromIndex The position in this array at which to begin searching for searchElement. - */ - includes(searchElement: number, fromIndex?: number): boolean; -} - -interface Uint8ClampedArray { - /** - * Determines whether an array includes a certain element, returning true or false as appropriate. - * @param searchElement The element to search for. - * @param fromIndex The position in this array at which to begin searching for searchElement. - */ - includes(searchElement: number, fromIndex?: number): boolean; -} - -interface Int16Array { - /** - * Determines whether an array includes a certain element, returning true or false as appropriate. - * @param searchElement The element to search for. - * @param fromIndex The position in this array at which to begin searching for searchElement. - */ - includes(searchElement: number, fromIndex?: number): boolean; -} - -interface Uint16Array { - /** - * Determines whether an array includes a certain element, returning true or false as appropriate. - * @param searchElement The element to search for. - * @param fromIndex The position in this array at which to begin searching for searchElement. - */ - includes(searchElement: number, fromIndex?: number): boolean; -} - -interface Int32Array { - /** - * Determines whether an array includes a certain element, returning true or false as appropriate. - * @param searchElement The element to search for. - * @param fromIndex The position in this array at which to begin searching for searchElement. - */ - includes(searchElement: number, fromIndex?: number): boolean; -} - -interface Uint32Array { - /** - * Determines whether an array includes a certain element, returning true or false as appropriate. - * @param searchElement The element to search for. - * @param fromIndex The position in this array at which to begin searching for searchElement. - */ - includes(searchElement: number, fromIndex?: number): boolean; -} - -interface Float32Array { - /** - * Determines whether an array includes a certain element, returning true or false as appropriate. - * @param searchElement The element to search for. - * @param fromIndex The position in this array at which to begin searching for searchElement. - */ - includes(searchElement: number, fromIndex?: number): boolean; -} - -interface Float64Array { - /** - * Determines whether an array includes a certain element, returning true or false as appropriate. - * @param searchElement The element to search for. - * @param fromIndex The position in this array at which to begin searching for searchElement. - */ - includes(searchElement: number, fromIndex?: number): boolean; -} \ No newline at end of file diff --git a/lib/lib.d.ts b/lib/lib.d.ts index 68245cdefbf..da43acc116a 100644 --- a/lib/lib.d.ts +++ b/lib/lib.d.ts @@ -231,14 +231,16 @@ interface Function { * @param thisArg The object to be used as the this object. * @param argArray A set of arguments to be passed to the function. */ - apply(thisArg: any, argArray?: any): any; + apply(this: (this: T, ...argArray: any[]) => U, thisArg: T, argArray?: any): U; + apply(this: Function, thisArg: any, argArray?: any): any; /** * Calls a method of an object, substituting another object for the current object. * @param thisArg The object to be used as the current object. * @param argArray A list of arguments to be passed to the method. */ - call(thisArg: any, ...argArray: any[]): any; + call(this: (this: T, ...argArray: any[]) => U, thisArg: T, ...argArray: any[]): U; + call(this: Function, thisArg: any, ...argArray: any[]): any; /** * For a given function, creates a bound function that has the same body as the original function. @@ -246,7 +248,8 @@ interface Function { * @param thisArg An object to which the this keyword can refer inside the new function. * @param argArray A list of arguments to be passed to the new function. */ - bind(thisArg: any, ...argArray: any[]): any; + bind(this: (this: T, ...argArray: any[]) => U, thisArg: T, ...argArray: any[]): (this: void, ...argArray: any[]) => U; + bind(this: Function, thisArg: any, ...argArray: any[]): any; prototype: any; readonly length: number; @@ -320,13 +323,13 @@ interface String { * Matches a string with a regular expression, and returns an array containing the results of that search. * @param regexp A variable name or string literal containing the regular expression pattern and flags. */ - match(regexp: string): RegExpMatchArray; + match(regexp: string): RegExpMatchArray | null; /** * Matches a string with a regular expression, and returns an array containing the results of that search. * @param regexp A regular expression object that contains the regular expression pattern and applicable flags. */ - match(regexp: RegExp): RegExpMatchArray; + match(regexp: RegExp): RegExpMatchArray | null; /** * Replaces text in a string, using a regular expression or search string. @@ -829,7 +832,7 @@ interface RegExp { * Executes a search on a string using a regular expression pattern, and returns an array containing the results of that search. * @param string The String object or string literal on which to perform the search. */ - exec(string: string): RegExpExecArray; + exec(string: string): RegExpExecArray | null; /** * Returns a Boolean value that indicates whether or not a pattern exists in a searched string. @@ -852,7 +855,7 @@ interface RegExp { lastIndex: number; // Non-standard extensions - compile(): RegExp; + compile(): this; } interface RegExpConstructor { @@ -1124,7 +1127,7 @@ interface Array { /** * Removes the last element from an array and returns it. */ - pop(): T; + pop(): T | undefined; /** * Combines two or more arrays. * @param items Additional items to add to the end of array1. @@ -1142,7 +1145,7 @@ interface Array { /** * Removes the first element from an array and returns it. */ - shift(): T; + shift(): T | undefined; /** * Returns a section of an array. * @param start The beginning of the specified portion of the array. @@ -1535,7 +1538,7 @@ interface Int8Array { * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. */ - find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; + find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number | undefined; /** * Returns the index of the first element in the array where predicate is true, and undefined @@ -1546,7 +1549,7 @@ interface Int8Array { * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. */ - findIndex(predicate: (value: number) => boolean, thisArg?: any): number; + findIndex(predicate: (value: number) => boolean, thisArg?: any): number | undefined; /** * Performs the specified action for each element in an array. @@ -1808,7 +1811,7 @@ interface Uint8Array { * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. */ - find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; + find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number | undefined; /** * Returns the index of the first element in the array where predicate is true, and undefined @@ -1819,7 +1822,7 @@ interface Uint8Array { * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. */ - findIndex(predicate: (value: number) => boolean, thisArg?: any): number; + findIndex(predicate: (value: number) => boolean, thisArg?: any): number | undefined; /** * Performs the specified action for each element in an array. @@ -2082,7 +2085,7 @@ interface Uint8ClampedArray { * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. */ - find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; + find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number | undefined; /** * Returns the index of the first element in the array where predicate is true, and undefined @@ -2093,7 +2096,7 @@ interface Uint8ClampedArray { * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. */ - findIndex(predicate: (value: number) => boolean, thisArg?: any): number; + findIndex(predicate: (value: number) => boolean, thisArg?: any): number | undefined; /** * Performs the specified action for each element in an array. @@ -2355,7 +2358,7 @@ interface Int16Array { * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. */ - find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; + find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number | undefined; /** * Returns the index of the first element in the array where predicate is true, and undefined @@ -2366,7 +2369,7 @@ interface Int16Array { * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. */ - findIndex(predicate: (value: number) => boolean, thisArg?: any): number; + findIndex(predicate: (value: number) => boolean, thisArg?: any): number | undefined; /** * Performs the specified action for each element in an array. @@ -2629,7 +2632,7 @@ interface Uint16Array { * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. */ - find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; + find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number | undefined; /** * Returns the index of the first element in the array where predicate is true, and undefined @@ -2640,7 +2643,7 @@ interface Uint16Array { * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. */ - findIndex(predicate: (value: number) => boolean, thisArg?: any): number; + findIndex(predicate: (value: number) => boolean, thisArg?: any): number | undefined; /** * Performs the specified action for each element in an array. @@ -2902,7 +2905,7 @@ interface Int32Array { * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. */ - find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; + find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number | undefined; /** * Returns the index of the first element in the array where predicate is true, and undefined @@ -2913,7 +2916,7 @@ interface Int32Array { * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. */ - findIndex(predicate: (value: number) => boolean, thisArg?: any): number; + findIndex(predicate: (value: number) => boolean, thisArg?: any): number | undefined; /** * Performs the specified action for each element in an array. @@ -3175,7 +3178,7 @@ interface Uint32Array { * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. */ - find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; + find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number | undefined; /** * Returns the index of the first element in the array where predicate is true, and undefined @@ -3186,7 +3189,7 @@ interface Uint32Array { * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. */ - findIndex(predicate: (value: number) => boolean, thisArg?: any): number; + findIndex(predicate: (value: number) => boolean, thisArg?: any): number | undefined; /** * Performs the specified action for each element in an array. @@ -3448,7 +3451,7 @@ interface Float32Array { * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. */ - find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; + find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number | undefined; /** * Returns the index of the first element in the array where predicate is true, and undefined @@ -3459,7 +3462,7 @@ interface Float32Array { * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. */ - findIndex(predicate: (value: number) => boolean, thisArg?: any): number; + findIndex(predicate: (value: number) => boolean, thisArg?: any): number | undefined; /** * Performs the specified action for each element in an array. @@ -3722,7 +3725,7 @@ interface Float64Array { * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. */ - find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; + find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number | undefined; /** * Returns the index of the first element in the array where predicate is true, and undefined @@ -3733,7 +3736,7 @@ interface Float64Array { * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. */ - findIndex(predicate: (value: number) => boolean, thisArg?: any): number; + findIndex(predicate: (value: number) => boolean, thisArg?: any): number | undefined; /** * Performs the specified action for each element in an array. @@ -3920,6 +3923,7 @@ interface Float64ArrayConstructor { from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Float64Array; } declare const Float64Array: Float64ArrayConstructor; + ///////////////////////////// /// ECMAScript Internationalization API ///////////////////////////// @@ -4120,8 +4124,6 @@ interface Date { */ toLocaleTimeString(locale?: string, options?: Intl.DateTimeFormatOptions): string; } - - ///////////////////////////// /// IE DOM APIs ///////////////////////////// @@ -4135,11 +4137,6 @@ interface AriaRequestEventInit extends EventInit { attributeValue?: string; } -interface ClipboardEventInit extends EventInit { - data?: string; - dataType?: string; -} - interface CommandEventInit extends EventInit { commandName?: string; detail?: string; @@ -4153,6 +4150,31 @@ interface ConfirmSiteSpecificExceptionsInformation extends ExceptionInformation arrayOfDomainStrings?: string[]; } +interface ConstrainBooleanParameters { + exact?: boolean; + ideal?: boolean; +} + +interface ConstrainDOMStringParameters { + exact?: string | string[]; + ideal?: string | string[]; +} + +interface ConstrainDoubleRange extends DoubleRange { + exact?: number; + ideal?: number; +} + +interface ConstrainLongRange extends LongRange { + exact?: number; + ideal?: number; +} + +interface ConstrainVideoFacingModeParameters { + exact?: string | string[]; + ideal?: string | string[]; +} + interface CustomEventInit extends EventInit { detail?: any; } @@ -4163,17 +4185,44 @@ interface DeviceAccelerationDict { z?: number; } +interface DeviceLightEventInit extends EventInit { + value?: number; +} + interface DeviceRotationRateDict { alpha?: number; beta?: number; gamma?: number; } +interface DoubleRange { + max?: number; + min?: number; +} + interface EventInit { bubbles?: boolean; cancelable?: boolean; } +interface EventModifierInit extends UIEventInit { + ctrlKey?: boolean; + shiftKey?: boolean; + altKey?: boolean; + metaKey?: boolean; + modifierAltGraph?: boolean; + modifierCapsLock?: boolean; + modifierFn?: boolean; + modifierFnLock?: boolean; + modifierHyper?: boolean; + modifierNumLock?: boolean; + modifierOS?: boolean; + modifierScrollLock?: boolean; + modifierSuper?: boolean; + modifierSymbol?: boolean; + modifierSymbolLock?: boolean; +} + interface ExceptionInformation { domain?: string; } @@ -4187,17 +4236,415 @@ interface HashChangeEventInit extends EventInit { oldURL?: string; } +interface IDBIndexParameters { + multiEntry?: boolean; + unique?: boolean; +} + +interface IDBObjectStoreParameters { + autoIncrement?: boolean; + keyPath?: IDBKeyPath; +} + interface KeyAlgorithm { name?: string; } -interface KeyboardEventInit extends SharedKeyboardAndMouseEventInit { +interface KeyboardEventInit extends EventModifierInit { key?: string; location?: number; repeat?: boolean; } -interface MouseEventInit extends SharedKeyboardAndMouseEventInit { +interface LongRange { + max?: number; + min?: number; +} + +interface MSAccountInfo { + rpDisplayName?: string; + userDisplayName?: string; + accountName?: string; + userId?: string; + accountImageUri?: string; +} + +interface MSAudioLocalClientEvent extends MSLocalClientEventBase { + networkSendQualityEventRatio?: number; + networkDelayEventRatio?: number; + cpuInsufficientEventRatio?: number; + deviceHalfDuplexAECEventRatio?: number; + deviceRenderNotFunctioningEventRatio?: number; + deviceCaptureNotFunctioningEventRatio?: number; + deviceGlitchesEventRatio?: number; + deviceLowSNREventRatio?: number; + deviceLowSpeechLevelEventRatio?: number; + deviceClippingEventRatio?: number; + deviceEchoEventRatio?: number; + deviceNearEndToEchoRatioEventRatio?: number; + deviceRenderZeroVolumeEventRatio?: number; + deviceRenderMuteEventRatio?: number; + deviceMultipleEndpointsEventCount?: number; + deviceHowlingEventCount?: number; +} + +interface MSAudioRecvPayload extends MSPayloadBase { + samplingRate?: number; + signal?: MSAudioRecvSignal; + packetReorderRatio?: number; + packetReorderDepthAvg?: number; + packetReorderDepthMax?: number; + burstLossLength1?: number; + burstLossLength2?: number; + burstLossLength3?: number; + burstLossLength4?: number; + burstLossLength5?: number; + burstLossLength6?: number; + burstLossLength7?: number; + burstLossLength8OrHigher?: number; + fecRecvDistance1?: number; + fecRecvDistance2?: number; + fecRecvDistance3?: number; + ratioConcealedSamplesAvg?: number; + ratioStretchedSamplesAvg?: number; + ratioCompressedSamplesAvg?: number; +} + +interface MSAudioRecvSignal { + initialSignalLevelRMS?: number; + recvSignalLevelCh1?: number; + recvNoiseLevelCh1?: number; + renderSignalLevel?: number; + renderNoiseLevel?: number; + renderLoopbackSignalLevel?: number; +} + +interface MSAudioSendPayload extends MSPayloadBase { + samplingRate?: number; + signal?: MSAudioSendSignal; + audioFECUsed?: boolean; + sendMutePercent?: number; +} + +interface MSAudioSendSignal { + noiseLevel?: number; + sendSignalLevelCh1?: number; + sendNoiseLevelCh1?: number; +} + +interface MSConnectivity { + iceType?: string; + iceWarningFlags?: MSIceWarningFlags; + relayAddress?: MSRelayAddress; +} + +interface MSCredentialFilter { + accept?: MSCredentialSpec[]; +} + +interface MSCredentialParameters { + type?: string; +} + +interface MSCredentialSpec { + type?: string; + id?: string; +} + +interface MSDelay { + roundTrip?: number; + roundTripMax?: number; +} + +interface MSDescription extends RTCStats { + connectivity?: MSConnectivity; + transport?: string; + networkconnectivity?: MSNetworkConnectivityInfo; + localAddr?: MSIPAddressInfo; + remoteAddr?: MSIPAddressInfo; + deviceDevName?: string; + reflexiveLocalIPAddr?: MSIPAddressInfo; +} + +interface MSFIDOCredentialParameters extends MSCredentialParameters { + algorithm?: string | Algorithm; + authenticators?: AAGUID[]; +} + +interface MSIPAddressInfo { + ipAddr?: string; + port?: number; + manufacturerMacAddrMask?: string; +} + +interface MSIceWarningFlags { + turnTcpTimedOut?: boolean; + turnUdpAllocateFailed?: boolean; + turnUdpSendFailed?: boolean; + turnTcpAllocateFailed?: boolean; + turnTcpSendFailed?: boolean; + udpLocalConnectivityFailed?: boolean; + udpNatConnectivityFailed?: boolean; + udpRelayConnectivityFailed?: boolean; + tcpNatConnectivityFailed?: boolean; + tcpRelayConnectivityFailed?: boolean; + connCheckMessageIntegrityFailed?: boolean; + allocationMessageIntegrityFailed?: boolean; + connCheckOtherError?: boolean; + turnAuthUnknownUsernameError?: boolean; + noRelayServersConfigured?: boolean; + multipleRelayServersAttempted?: boolean; + portRangeExhausted?: boolean; + alternateServerReceived?: boolean; + pseudoTLSFailure?: boolean; + turnTurnTcpConnectivityFailed?: boolean; + useCandidateChecksFailed?: boolean; + fipsAllocationFailure?: boolean; +} + +interface MSJitter { + interArrival?: number; + interArrivalMax?: number; + interArrivalSD?: number; +} + +interface MSLocalClientEventBase extends RTCStats { + networkReceiveQualityEventRatio?: number; + networkBandwidthLowEventRatio?: number; +} + +interface MSNetwork extends RTCStats { + jitter?: MSJitter; + delay?: MSDelay; + packetLoss?: MSPacketLoss; + utilization?: MSUtilization; +} + +interface MSNetworkConnectivityInfo { + vpn?: boolean; + linkspeed?: number; + networkConnectionDetails?: string; +} + +interface MSNetworkInterfaceType { + interfaceTypeEthernet?: boolean; + interfaceTypeWireless?: boolean; + interfaceTypePPP?: boolean; + interfaceTypeTunnel?: boolean; + interfaceTypeWWAN?: boolean; +} + +interface MSOutboundNetwork extends MSNetwork { + appliedBandwidthLimit?: number; +} + +interface MSPacketLoss { + lossRate?: number; + lossRateMax?: number; +} + +interface MSPayloadBase extends RTCStats { + payloadDescription?: string; +} + +interface MSRelayAddress { + relayAddress?: string; + port?: number; +} + +interface MSSignatureParameters { + userPrompt?: string; +} + +interface MSTransportDiagnosticsStats extends RTCStats { + baseAddress?: string; + localAddress?: string; + localSite?: string; + networkName?: string; + remoteAddress?: string; + remoteSite?: string; + localMR?: string; + remoteMR?: string; + iceWarningFlags?: MSIceWarningFlags; + portRangeMin?: number; + portRangeMax?: number; + localMRTCPPort?: number; + remoteMRTCPPort?: number; + stunVer?: number; + numConsentReqSent?: number; + numConsentReqReceived?: number; + numConsentRespSent?: number; + numConsentRespReceived?: number; + interfaces?: MSNetworkInterfaceType; + baseInterface?: MSNetworkInterfaceType; + protocol?: string; + localInterface?: MSNetworkInterfaceType; + localAddrType?: string; + remoteAddrType?: string; + iceRole?: string; + rtpRtcpMux?: boolean; + allocationTimeInMs?: number; + msRtcEngineVersion?: string; +} + +interface MSUtilization { + packets?: number; + bandwidthEstimation?: number; + bandwidthEstimationMin?: number; + bandwidthEstimationMax?: number; + bandwidthEstimationStdDev?: number; + bandwidthEstimationAvg?: number; +} + +interface MSVideoPayload extends MSPayloadBase { + resoluton?: string; + videoBitRateAvg?: number; + videoBitRateMax?: number; + videoFrameRateAvg?: number; + videoPacketLossRate?: number; + durationSeconds?: number; +} + +interface MSVideoRecvPayload extends MSVideoPayload { + videoFrameLossRate?: number; + recvCodecType?: string; + recvResolutionWidth?: number; + recvResolutionHeight?: number; + videoResolutions?: MSVideoResolutionDistribution; + recvFrameRateAverage?: number; + recvBitRateMaximum?: number; + recvBitRateAverage?: number; + recvVideoStreamsMax?: number; + recvVideoStreamsMin?: number; + recvVideoStreamsMode?: number; + videoPostFECPLR?: number; + lowBitRateCallPercent?: number; + lowFrameRateCallPercent?: number; + reorderBufferTotalPackets?: number; + recvReorderBufferReorderedPackets?: number; + recvReorderBufferPacketsDroppedDueToBufferExhaustion?: number; + recvReorderBufferMaxSuccessfullyOrderedExtent?: number; + recvReorderBufferMaxSuccessfullyOrderedLateTime?: number; + recvReorderBufferPacketsDroppedDueToTimeout?: number; + recvFpsHarmonicAverage?: number; + recvNumResSwitches?: number; +} + +interface MSVideoResolutionDistribution { + cifQuality?: number; + vgaQuality?: number; + h720Quality?: number; + h1080Quality?: number; + h1440Quality?: number; + h2160Quality?: number; +} + +interface MSVideoSendPayload extends MSVideoPayload { + sendFrameRateAverage?: number; + sendBitRateMaximum?: number; + sendBitRateAverage?: number; + sendVideoStreamsMax?: number; + sendResolutionWidth?: number; + sendResolutionHeight?: number; +} + +interface MediaEncryptedEventInit extends EventInit { + initDataType?: string; + initData?: ArrayBuffer; +} + +interface MediaKeyMessageEventInit extends EventInit { + messageType?: string; + message?: ArrayBuffer; +} + +interface MediaKeySystemConfiguration { + initDataTypes?: string[]; + audioCapabilities?: MediaKeySystemMediaCapability[]; + videoCapabilities?: MediaKeySystemMediaCapability[]; + distinctiveIdentifier?: string; + persistentState?: string; +} + +interface MediaKeySystemMediaCapability { + contentType?: string; + robustness?: string; +} + +interface MediaStreamConstraints { + video?: boolean | MediaTrackConstraints; + audio?: boolean | MediaTrackConstraints; +} + +interface MediaStreamErrorEventInit extends EventInit { + error?: MediaStreamError; +} + +interface MediaStreamTrackEventInit extends EventInit { + track?: MediaStreamTrack; +} + +interface MediaTrackCapabilities { + width?: number | LongRange; + height?: number | LongRange; + aspectRatio?: number | DoubleRange; + frameRate?: number | DoubleRange; + facingMode?: string; + volume?: number | DoubleRange; + sampleRate?: number | LongRange; + sampleSize?: number | LongRange; + echoCancellation?: boolean[]; + deviceId?: string; + groupId?: string; +} + +interface MediaTrackConstraintSet { + width?: number | ConstrainLongRange; + height?: number | ConstrainLongRange; + aspectRatio?: number | ConstrainDoubleRange; + frameRate?: number | ConstrainDoubleRange; + facingMode?: string | string[] | ConstrainDOMStringParameters; + volume?: number | ConstrainDoubleRange; + sampleRate?: number | ConstrainLongRange; + sampleSize?: number | ConstrainLongRange; + echoCancelation?: boolean | ConstrainBooleanParameters; + deviceId?: string | string[] | ConstrainDOMStringParameters; + groupId?: string | string[] | ConstrainDOMStringParameters; +} + +interface MediaTrackConstraints extends MediaTrackConstraintSet { + advanced?: MediaTrackConstraintSet[]; +} + +interface MediaTrackSettings { + width?: number; + height?: number; + aspectRatio?: number; + frameRate?: number; + facingMode?: string; + volume?: number; + sampleRate?: number; + sampleSize?: number; + echoCancellation?: boolean; + deviceId?: string; + groupId?: string; +} + +interface MediaTrackSupportedConstraints { + width?: boolean; + height?: boolean; + aspectRatio?: boolean; + frameRate?: boolean; + facingMode?: boolean; + volume?: boolean; + sampleRate?: boolean; + sampleSize?: boolean; + echoCancellation?: boolean; + deviceId?: boolean; + groupId?: boolean; +} + +interface MouseEventInit extends EventModifierInit { screenX?: number; screenY?: number; clientX?: number; @@ -4230,6 +4677,10 @@ interface ObjectURLOptions { oneTimeOnly?: boolean; } +interface PeriodicWaveConstraints { + disableNormalization?: boolean; +} + interface PointerEventInit extends MouseEventInit { pointerId?: number; width?: number; @@ -4247,22 +4698,266 @@ interface PositionOptions { maximumAge?: number; } -interface SharedKeyboardAndMouseEventInit extends UIEventInit { - ctrlKey?: boolean; - shiftKey?: boolean; - altKey?: boolean; - metaKey?: boolean; - keyModifierStateAltGraph?: boolean; - keyModifierStateCapsLock?: boolean; - keyModifierStateFn?: boolean; - keyModifierStateFnLock?: boolean; - keyModifierStateHyper?: boolean; - keyModifierStateNumLock?: boolean; - keyModifierStateOS?: boolean; - keyModifierStateScrollLock?: boolean; - keyModifierStateSuper?: boolean; - keyModifierStateSymbol?: boolean; - keyModifierStateSymbolLock?: boolean; +interface RTCDTMFToneChangeEventInit extends EventInit { + tone?: string; +} + +interface RTCDtlsFingerprint { + algorithm?: string; + value?: string; +} + +interface RTCDtlsParameters { + role?: string; + fingerprints?: RTCDtlsFingerprint[]; +} + +interface RTCIceCandidate { + foundation?: string; + priority?: number; + ip?: string; + protocol?: string; + port?: number; + type?: string; + tcpType?: string; + relatedAddress?: string; + relatedPort?: number; +} + +interface RTCIceCandidateAttributes extends RTCStats { + ipAddress?: string; + portNumber?: number; + transport?: string; + candidateType?: string; + priority?: number; + addressSourceUrl?: string; +} + +interface RTCIceCandidateComplete { +} + +interface RTCIceCandidatePair { + local?: RTCIceCandidate; + remote?: RTCIceCandidate; +} + +interface RTCIceCandidatePairStats extends RTCStats { + transportId?: string; + localCandidateId?: string; + remoteCandidateId?: string; + state?: string; + priority?: number; + nominated?: boolean; + writable?: boolean; + readable?: boolean; + bytesSent?: number; + bytesReceived?: number; + roundTripTime?: number; + availableOutgoingBitrate?: number; + availableIncomingBitrate?: number; +} + +interface RTCIceGatherOptions { + gatherPolicy?: string; + iceservers?: RTCIceServer[]; +} + +interface RTCIceParameters { + usernameFragment?: string; + password?: string; +} + +interface RTCIceServer { + urls?: any; + username?: string; + credential?: string; +} + +interface RTCInboundRTPStreamStats extends RTCRTPStreamStats { + packetsReceived?: number; + bytesReceived?: number; + packetsLost?: number; + jitter?: number; + fractionLost?: number; +} + +interface RTCMediaStreamTrackStats extends RTCStats { + trackIdentifier?: string; + remoteSource?: boolean; + ssrcIds?: string[]; + frameWidth?: number; + frameHeight?: number; + framesPerSecond?: number; + framesSent?: number; + framesReceived?: number; + framesDecoded?: number; + framesDropped?: number; + framesCorrupted?: number; + audioLevel?: number; + echoReturnLoss?: number; + echoReturnLossEnhancement?: number; +} + +interface RTCOutboundRTPStreamStats extends RTCRTPStreamStats { + packetsSent?: number; + bytesSent?: number; + targetBitrate?: number; + roundTripTime?: number; +} + +interface RTCRTPStreamStats extends RTCStats { + ssrc?: string; + associateStatsId?: string; + isRemote?: boolean; + mediaTrackId?: string; + transportId?: string; + codecId?: string; + firCount?: number; + pliCount?: number; + nackCount?: number; + sliCount?: number; +} + +interface RTCRtcpFeedback { + type?: string; + parameter?: string; +} + +interface RTCRtcpParameters { + ssrc?: number; + cname?: string; + reducedSize?: boolean; + mux?: boolean; +} + +interface RTCRtpCapabilities { + codecs?: RTCRtpCodecCapability[]; + headerExtensions?: RTCRtpHeaderExtension[]; + fecMechanisms?: string[]; +} + +interface RTCRtpCodecCapability { + name?: string; + kind?: string; + clockRate?: number; + preferredPayloadType?: number; + maxptime?: number; + numChannels?: number; + rtcpFeedback?: RTCRtcpFeedback[]; + parameters?: any; + options?: any; + maxTemporalLayers?: number; + maxSpatialLayers?: number; + svcMultiStreamSupport?: boolean; +} + +interface RTCRtpCodecParameters { + name?: string; + payloadType?: any; + clockRate?: number; + maxptime?: number; + numChannels?: number; + rtcpFeedback?: RTCRtcpFeedback[]; + parameters?: any; +} + +interface RTCRtpContributingSource { + timestamp?: number; + csrc?: number; + audioLevel?: number; +} + +interface RTCRtpEncodingParameters { + ssrc?: number; + codecPayloadType?: number; + fec?: RTCRtpFecParameters; + rtx?: RTCRtpRtxParameters; + priority?: number; + maxBitrate?: number; + minQuality?: number; + framerateBias?: number; + resolutionScale?: number; + framerateScale?: number; + active?: boolean; + encodingId?: string; + dependencyEncodingIds?: string[]; + ssrcRange?: RTCSsrcRange; +} + +interface RTCRtpFecParameters { + ssrc?: number; + mechanism?: string; +} + +interface RTCRtpHeaderExtension { + kind?: string; + uri?: string; + preferredId?: number; + preferredEncrypt?: boolean; +} + +interface RTCRtpHeaderExtensionParameters { + uri?: string; + id?: number; + encrypt?: boolean; +} + +interface RTCRtpParameters { + muxId?: string; + codecs?: RTCRtpCodecParameters[]; + headerExtensions?: RTCRtpHeaderExtensionParameters[]; + encodings?: RTCRtpEncodingParameters[]; + rtcp?: RTCRtcpParameters; +} + +interface RTCRtpRtxParameters { + ssrc?: number; +} + +interface RTCRtpUnhandled { + ssrc?: number; + payloadType?: number; + muxId?: string; +} + +interface RTCSrtpKeyParam { + keyMethod?: string; + keySalt?: string; + lifetime?: string; + mkiValue?: number; + mkiLength?: number; +} + +interface RTCSrtpSdesParameters { + tag?: number; + cryptoSuite?: string; + keyParams?: RTCSrtpKeyParam[]; + sessionParams?: string[]; +} + +interface RTCSsrcRange { + min?: number; + max?: number; +} + +interface RTCStats { + timestamp?: number; + type?: string; + id?: string; + msType?: string; +} + +interface RTCStatsReport { +} + +interface RTCTransportStats extends RTCStats { + bytesSent?: number; + bytesReceived?: number; + rtcpTransportStatsId?: string; + activeConnection?: boolean; + selectedCandidatePairId?: string; + localCertificateId?: string; + remoteCertificateId?: string; } interface StoreExceptionsInformation extends ExceptionInformation { @@ -4308,18 +5003,18 @@ interface ANGLE_instanced_arrays { drawArraysInstancedANGLE(mode: number, first: number, count: number, primcount: number): void; drawElementsInstancedANGLE(mode: number, count: number, type: number, offset: number, primcount: number): void; vertexAttribDivisorANGLE(index: number, divisor: number): void; - VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE: number; + readonly VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE: number; } declare var ANGLE_instanced_arrays: { prototype: ANGLE_instanced_arrays; new(): ANGLE_instanced_arrays; - VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE: number; + readonly VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE: number; } interface AnalyserNode extends AudioNode { fftSize: number; - frequencyBinCount: number; + readonly frequencyBinCount: number; maxDecibels: number; minDecibels: number; smoothingTimeConstant: number; @@ -4335,8 +5030,8 @@ declare var AnalyserNode: { } interface AnimationEvent extends Event { - animationName: string; - elapsedTime: number; + readonly animationName: string; + readonly elapsedTime: number; initAnimationEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, animationNameArg: string, elapsedTimeArg: number): void; } @@ -4354,16 +5049,16 @@ interface ApplicationCache extends EventTarget { onobsolete: (ev: Event) => any; onprogress: (ev: ProgressEvent) => any; onupdateready: (ev: Event) => any; - status: number; + readonly status: number; abort(): void; swapCache(): void; update(): void; - CHECKING: number; - DOWNLOADING: number; - IDLE: number; - OBSOLETE: number; - UNCACHED: number; - UPDATEREADY: number; + readonly CHECKING: number; + readonly DOWNLOADING: number; + readonly IDLE: number; + readonly OBSOLETE: number; + readonly UNCACHED: number; + readonly UPDATEREADY: number; addEventListener(type: "cached", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "checking", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "downloading", listener: (ev: Event) => any, useCapture?: boolean): void; @@ -4378,16 +5073,16 @@ interface ApplicationCache extends EventTarget { declare var ApplicationCache: { prototype: ApplicationCache; new(): ApplicationCache; - CHECKING: number; - DOWNLOADING: number; - IDLE: number; - OBSOLETE: number; - UNCACHED: number; - UPDATEREADY: number; + readonly CHECKING: number; + readonly DOWNLOADING: number; + readonly IDLE: number; + readonly OBSOLETE: number; + readonly UNCACHED: number; + readonly UPDATEREADY: number; } interface AriaRequestEvent extends Event { - attributeName: string; + readonly attributeName: string; attributeValue: string; } @@ -4397,9 +5092,10 @@ declare var AriaRequestEvent: { } interface Attr extends Node { - name: string; - ownerElement: Element; - specified: boolean; + readonly name: string; + readonly ownerElement: Element; + readonly prefix: string; + readonly specified: boolean; value: string; } @@ -4409,10 +5105,12 @@ declare var Attr: { } interface AudioBuffer { - duration: number; - length: number; - numberOfChannels: number; - sampleRate: number; + readonly duration: number; + readonly length: number; + readonly numberOfChannels: number; + readonly sampleRate: number; + copyFromChannel(destination: Float32Array, channelNumber: number, startInChannel?: number): void; + copyToChannel(source: Float32Array, channelNumber: number, startInChannel?: number): void; getChannelData(channel: number): Float32Array; } @@ -4423,14 +5121,15 @@ declare var AudioBuffer: { interface AudioBufferSourceNode extends AudioNode { buffer: AudioBuffer; + readonly detune: AudioParam; loop: boolean; loopEnd: number; loopStart: number; - onended: (ev: Event) => any; - playbackRate: AudioParam; + onended: (ev: MediaStreamErrorEvent) => any; + readonly playbackRate: AudioParam; start(when?: number, offset?: number, duration?: number): void; stop(when?: number): void; - addEventListener(type: "ended", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "ended", listener: (ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -4440,10 +5139,10 @@ declare var AudioBufferSourceNode: { } interface AudioContext extends EventTarget { - currentTime: number; - destination: AudioDestinationNode; - listener: AudioListener; - sampleRate: number; + readonly currentTime: number; + readonly destination: AudioDestinationNode; + readonly listener: AudioListener; + readonly sampleRate: number; state: string; createAnalyser(): AnalyserNode; createBiquadFilter(): BiquadFilterNode; @@ -4456,13 +5155,14 @@ interface AudioContext extends EventTarget { createDynamicsCompressor(): DynamicsCompressorNode; createGain(): GainNode; createMediaElementSource(mediaElement: HTMLMediaElement): MediaElementAudioSourceNode; + createMediaStreamSource(mediaStream: MediaStream): MediaStreamAudioSourceNode; createOscillator(): OscillatorNode; createPanner(): PannerNode; - createPeriodicWave(real: Float32Array, imag: Float32Array): PeriodicWave; + createPeriodicWave(real: Float32Array, imag: Float32Array, constraints?: PeriodicWaveConstraints): PeriodicWave; createScriptProcessor(bufferSize?: number, numberOfInputChannels?: number, numberOfOutputChannels?: number): ScriptProcessorNode; createStereoPanner(): StereoPannerNode; createWaveShaper(): WaveShaperNode; - decodeAudioData(audioData: ArrayBuffer, successCallback: DecodeSuccessCallback, errorCallback?: DecodeErrorCallback): void; + decodeAudioData(audioData: ArrayBuffer, successCallback?: DecodeSuccessCallback, errorCallback?: DecodeErrorCallback): PromiseLike; } declare var AudioContext: { @@ -4471,7 +5171,7 @@ declare var AudioContext: { } interface AudioDestinationNode extends AudioNode { - maxChannelCount: number; + readonly maxChannelCount: number; } declare var AudioDestinationNode: { @@ -4496,9 +5196,9 @@ interface AudioNode extends EventTarget { channelCount: number; channelCountMode: string; channelInterpretation: string; - context: AudioContext; - numberOfInputs: number; - numberOfOutputs: number; + readonly context: AudioContext; + readonly numberOfInputs: number; + readonly numberOfOutputs: number; connect(destination: AudioNode, output?: number, input?: number): void; disconnect(output?: number): void; disconnect(destination: AudioNode, output?: number, input?: number): void; @@ -4511,7 +5211,7 @@ declare var AudioNode: { } interface AudioParam { - defaultValue: number; + readonly defaultValue: number; value: number; cancelScheduledValues(startTime: number): void; exponentialRampToValueAtTime(value: number, endTime: number): void; @@ -4527,9 +5227,9 @@ declare var AudioParam: { } interface AudioProcessingEvent extends Event { - inputBuffer: AudioBuffer; - outputBuffer: AudioBuffer; - playbackTime: number; + readonly inputBuffer: AudioBuffer; + readonly outputBuffer: AudioBuffer; + readonly playbackTime: number; } declare var AudioProcessingEvent: { @@ -4539,11 +5239,11 @@ declare var AudioProcessingEvent: { interface AudioTrack { enabled: boolean; - id: string; + readonly id: string; kind: string; - label: string; + readonly label: string; language: string; - sourceBuffer: SourceBuffer; + readonly sourceBuffer: SourceBuffer; } declare var AudioTrack: { @@ -4552,7 +5252,7 @@ declare var AudioTrack: { } interface AudioTrackList extends EventTarget { - length: number; + readonly length: number; onaddtrack: (ev: TrackEvent) => any; onchange: (ev: Event) => any; onremovetrack: (ev: TrackEvent) => any; @@ -4571,7 +5271,7 @@ declare var AudioTrackList: { } interface BarProp { - visible: boolean; + readonly visible: boolean; } declare var BarProp: { @@ -4589,10 +5289,10 @@ declare var BeforeUnloadEvent: { } interface BiquadFilterNode extends AudioNode { - Q: AudioParam; - detune: AudioParam; - frequency: AudioParam; - gain: AudioParam; + readonly Q: AudioParam; + readonly detune: AudioParam; + readonly frequency: AudioParam; + readonly gain: AudioParam; type: string; getFrequencyResponse(frequencyHz: Float32Array, magResponse: Float32Array, phaseResponse: Float32Array): void; } @@ -4603,8 +5303,8 @@ declare var BiquadFilterNode: { } interface Blob { - size: number; - type: string; + readonly size: number; + readonly type: string; msClose(): void; msDetachStream(): any; slice(start?: number, end?: number, contentType?: string): Blob; @@ -4638,7 +5338,7 @@ declare var CSSConditionRule: { } interface CSSFontFaceRule extends CSSRule { - style: CSSStyleDeclaration; + readonly style: CSSStyleDeclaration; } declare var CSSFontFaceRule: { @@ -4647,9 +5347,9 @@ declare var CSSFontFaceRule: { } interface CSSGroupingRule extends CSSRule { - cssRules: CSSRuleList; - deleteRule(index?: number): void; - insertRule(rule: string, index?: number): number; + readonly cssRules: CSSRuleList; + deleteRule(index: number): void; + insertRule(rule: string, index: number): number; } declare var CSSGroupingRule: { @@ -4658,9 +5358,9 @@ declare var CSSGroupingRule: { } interface CSSImportRule extends CSSRule { - href: string; - media: MediaList; - styleSheet: CSSStyleSheet; + readonly href: string; + readonly media: MediaList; + readonly styleSheet: CSSStyleSheet; } declare var CSSImportRule: { @@ -4670,7 +5370,7 @@ declare var CSSImportRule: { interface CSSKeyframeRule extends CSSRule { keyText: string; - style: CSSStyleDeclaration; + readonly style: CSSStyleDeclaration; } declare var CSSKeyframeRule: { @@ -4679,7 +5379,7 @@ declare var CSSKeyframeRule: { } interface CSSKeyframesRule extends CSSRule { - cssRules: CSSRuleList; + readonly cssRules: CSSRuleList; name: string; appendRule(rule: string): void; deleteRule(rule: string): void; @@ -4692,7 +5392,7 @@ declare var CSSKeyframesRule: { } interface CSSMediaRule extends CSSConditionRule { - media: MediaList; + readonly media: MediaList; } declare var CSSMediaRule: { @@ -4701,8 +5401,8 @@ declare var CSSMediaRule: { } interface CSSNamespaceRule extends CSSRule { - namespaceURI: string; - prefix: string; + readonly namespaceURI: string; + readonly prefix: string; } declare var CSSNamespaceRule: { @@ -4711,10 +5411,10 @@ declare var CSSNamespaceRule: { } interface CSSPageRule extends CSSRule { - pseudoClass: string; - selector: string; + readonly pseudoClass: string; + readonly selector: string; selectorText: string; - style: CSSStyleDeclaration; + readonly style: CSSStyleDeclaration; } declare var CSSPageRule: { @@ -4724,42 +5424,42 @@ declare var CSSPageRule: { interface CSSRule { cssText: string; - parentRule: CSSRule; - parentStyleSheet: CSSStyleSheet; - type: number; - CHARSET_RULE: number; - FONT_FACE_RULE: number; - IMPORT_RULE: number; - KEYFRAMES_RULE: number; - KEYFRAME_RULE: number; - MEDIA_RULE: number; - NAMESPACE_RULE: number; - PAGE_RULE: number; - STYLE_RULE: number; - SUPPORTS_RULE: number; - UNKNOWN_RULE: number; - VIEWPORT_RULE: number; + readonly parentRule: CSSRule; + readonly parentStyleSheet: CSSStyleSheet; + readonly type: number; + readonly CHARSET_RULE: number; + readonly FONT_FACE_RULE: number; + readonly IMPORT_RULE: number; + readonly KEYFRAMES_RULE: number; + readonly KEYFRAME_RULE: number; + readonly MEDIA_RULE: number; + readonly NAMESPACE_RULE: number; + readonly PAGE_RULE: number; + readonly STYLE_RULE: number; + readonly SUPPORTS_RULE: number; + readonly UNKNOWN_RULE: number; + readonly VIEWPORT_RULE: number; } declare var CSSRule: { prototype: CSSRule; new(): CSSRule; - CHARSET_RULE: number; - FONT_FACE_RULE: number; - IMPORT_RULE: number; - KEYFRAMES_RULE: number; - KEYFRAME_RULE: number; - MEDIA_RULE: number; - NAMESPACE_RULE: number; - PAGE_RULE: number; - STYLE_RULE: number; - SUPPORTS_RULE: number; - UNKNOWN_RULE: number; - VIEWPORT_RULE: number; + readonly CHARSET_RULE: number; + readonly FONT_FACE_RULE: number; + readonly IMPORT_RULE: number; + readonly KEYFRAMES_RULE: number; + readonly KEYFRAME_RULE: number; + readonly MEDIA_RULE: number; + readonly NAMESPACE_RULE: number; + readonly PAGE_RULE: number; + readonly STYLE_RULE: number; + readonly SUPPORTS_RULE: number; + readonly UNKNOWN_RULE: number; + readonly VIEWPORT_RULE: number; } interface CSSRuleList { - length: number; + readonly length: number; item(index: number): CSSRule; [index: number]: CSSRule; } @@ -4892,7 +5592,7 @@ interface CSSStyleDeclaration { justifyContent: string; kerning: string; left: string; - length: number; + readonly length: number; letterSpacing: string; lightingColor: string; lineHeight: string; @@ -4979,7 +5679,7 @@ interface CSSStyleDeclaration { pageBreakAfter: string; pageBreakBefore: string; pageBreakInside: string; - parentRule: CSSRule; + readonly parentRule: CSSRule; perspective: string; perspectiveOrigin: string; pointerEvents: string; @@ -5004,7 +5704,6 @@ interface CSSStyleDeclaration { textAlignLast: string; textAnchor: string; textDecoration: string; - textFillColor: string; textIndent: string; textJustify: string; textKashida: string; @@ -5040,25 +5739,12 @@ interface CSSStyleDeclaration { webkitAnimationTimingFunction: string; webkitAppearance: string; webkitBackfaceVisibility: string; - webkitBackground: string; - webkitBackgroundAttachment: string; webkitBackgroundClip: string; - webkitBackgroundColor: string; - webkitBackgroundImage: string; webkitBackgroundOrigin: string; - webkitBackgroundPosition: string; - webkitBackgroundPositionX: string; - webkitBackgroundPositionY: string; - webkitBackgroundRepeat: string; webkitBackgroundSize: string; webkitBorderBottomLeftRadius: string; webkitBorderBottomRightRadius: string; webkitBorderImage: string; - webkitBorderImageOutset: string; - webkitBorderImageRepeat: string; - webkitBorderImageSlice: string; - webkitBorderImageSource: string; - webkitBorderImageWidth: string; webkitBorderRadius: string; webkitBorderTopLeftRadius: string; webkitBorderTopRightRadius: string; @@ -5104,6 +5790,7 @@ interface CSSStyleDeclaration { webkitTransitionDuration: string; webkitTransitionProperty: string; webkitTransitionTimingFunction: string; + webkitUserModify: string; webkitUserSelect: string; webkitWritingMode: string; whiteSpace: string; @@ -5129,9 +5816,9 @@ declare var CSSStyleDeclaration: { } interface CSSStyleRule extends CSSRule { - readOnly: boolean; + readonly readOnly: boolean; selectorText: string; - style: CSSStyleDeclaration; + readonly style: CSSStyleDeclaration; } declare var CSSStyleRule: { @@ -5140,18 +5827,18 @@ declare var CSSStyleRule: { } interface CSSStyleSheet extends StyleSheet { - cssRules: CSSRuleList; + readonly cssRules: CSSRuleList; cssText: string; - href: string; - id: string; - imports: StyleSheetList; - isAlternate: boolean; - isPrefAlternate: boolean; - ownerRule: CSSRule; - owningElement: Element; - pages: StyleSheetPageList; - readOnly: boolean; - rules: CSSRuleList; + readonly href: string; + readonly id: string; + readonly imports: StyleSheetList; + readonly isAlternate: boolean; + readonly isPrefAlternate: boolean; + readonly ownerRule: CSSRule; + readonly owningElement: Element; + readonly pages: StyleSheetPageList; + readonly readOnly: boolean; + readonly rules: CSSRuleList; addImport(bstrURL: string, lIndex?: number): number; addPageRule(bstrSelector: string, bstrStyle: string, lIndex?: number): number; addRule(bstrSelector: string, bstrStyle?: string, lIndex?: number): number; @@ -5191,8 +5878,8 @@ declare var CanvasPattern: { new(): CanvasPattern; } -interface CanvasRenderingContext2D { - canvas: HTMLCanvasElement; +interface CanvasRenderingContext2D extends Object, CanvasPathMethods { + readonly canvas: HTMLCanvasElement; fillStyle: string | CanvasGradient | CanvasPattern; font: string; globalAlpha: number; @@ -5211,13 +5898,9 @@ interface CanvasRenderingContext2D { strokeStyle: string | CanvasGradient | CanvasPattern; textAlign: string; textBaseline: string; - arc(x: number, y: number, radius: number, startAngle: number, endAngle: number, anticlockwise?: boolean): void; - arcTo(x1: number, y1: number, x2: number, y2: number, radius: number): void; beginPath(): void; - bezierCurveTo(cp1x: number, cp1y: number, cp2x: number, cp2y: number, x: number, y: number): void; clearRect(x: number, y: number, w: number, h: number): void; clip(fillRule?: string): void; - closePath(): void; createImageData(imageDataOrSw: number | ImageData, sh?: number): ImageData; createLinearGradient(x0: number, y0: number, x1: number, y1: number): CanvasGradient; createPattern(image: HTMLImageElement | HTMLCanvasElement | HTMLVideoElement, repetition: string): CanvasPattern; @@ -5229,12 +5912,8 @@ interface CanvasRenderingContext2D { getImageData(sx: number, sy: number, sw: number, sh: number): ImageData; getLineDash(): number[]; isPointInPath(x: number, y: number, fillRule?: string): boolean; - lineTo(x: number, y: number): void; measureText(text: string): TextMetrics; - moveTo(x: number, y: number): void; putImageData(imagedata: ImageData, dx: number, dy: number, dirtyX?: number, dirtyY?: number, dirtyWidth?: number, dirtyHeight?: number): void; - quadraticCurveTo(cpx: number, cpy: number, x: number, y: number): void; - rect(x: number, y: number, w: number, h: number): void; restore(): void; rotate(angle: number): void; save(): void; @@ -5271,7 +5950,7 @@ declare var ChannelSplitterNode: { interface CharacterData extends Node, ChildNode { data: string; - length: number; + readonly length: number; appendData(arg: string): void; deleteData(offset: number, count: number): void; insertData(offset: number, arg: string): void; @@ -5287,11 +5966,11 @@ declare var CharacterData: { interface ClientRect { bottom: number; - height: number; + readonly height: number; left: number; right: number; top: number; - width: number; + readonly width: number; } declare var ClientRect: { @@ -5300,7 +5979,7 @@ declare var ClientRect: { } interface ClientRectList { - length: number; + readonly length: number; item(index: number): ClientRect; [index: number]: ClientRect; } @@ -5311,7 +5990,7 @@ declare var ClientRectList: { } interface ClipboardEvent extends Event { - clipboardData: DataTransfer; + readonly clipboardData: DataTransfer; } declare var ClipboardEvent: { @@ -5320,9 +5999,9 @@ declare var ClipboardEvent: { } interface CloseEvent extends Event { - code: number; - reason: string; - wasClean: boolean; + readonly code: number; + readonly reason: string; + readonly wasClean: boolean; initCloseEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, wasCleanArg: boolean, codeArg: number, reasonArg: string): void; } @@ -5332,8 +6011,8 @@ declare var CloseEvent: { } interface CommandEvent extends Event { - commandName: string; - detail: string; + readonly commandName: string; + readonly detail: string; } declare var CommandEvent: { @@ -5351,8 +6030,8 @@ declare var Comment: { } interface CompositionEvent extends UIEvent { - data: string; - locale: string; + readonly data: string; + readonly locale: string; initCompositionEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, dataArg: string, locale: string): void; } @@ -5369,6 +6048,7 @@ interface Console { dir(value?: any, ...optionalParams: any[]): void; dirxml(value: any): void; error(message?: any, ...optionalParams: any[]): void; + exception(message?: string, ...optionalParams: any[]): void; group(groupTitle?: string): void; groupCollapsed(groupTitle?: string): void; groupEnd(): void; @@ -5378,6 +6058,7 @@ interface Console { profile(reportName?: string): void; profileEnd(): void; select(element: Element): void; + table(...data: any[]): void; time(timerName?: string): void; timeEnd(timerName?: string): void; trace(message?: any, ...optionalParams: any[]): void; @@ -5400,13 +6081,13 @@ declare var ConvolverNode: { } interface Coordinates { - accuracy: number; - altitude: number; - altitudeAccuracy: number; - heading: number; - latitude: number; - longitude: number; - speed: number; + readonly accuracy: number; + readonly altitude: number; + readonly altitudeAccuracy: number; + readonly heading: number; + readonly latitude: number; + readonly longitude: number; + readonly speed: number; } declare var Coordinates: { @@ -5415,7 +6096,7 @@ declare var Coordinates: { } interface Crypto extends Object, RandomSource { - subtle: SubtleCrypto; + readonly subtle: SubtleCrypto; } declare var Crypto: { @@ -5424,10 +6105,10 @@ declare var Crypto: { } interface CryptoKey { - algorithm: KeyAlgorithm; - extractable: boolean; - type: string; - usages: string[]; + readonly algorithm: KeyAlgorithm; + readonly extractable: boolean; + readonly type: string; + readonly usages: string[]; } declare var CryptoKey: { @@ -5446,7 +6127,7 @@ declare var CryptoKeyPair: { } interface CustomEvent extends Event { - detail: any; + readonly detail: any; initCustomEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, detailArg: any): void; } @@ -5456,7 +6137,7 @@ declare var CustomEvent: { } interface DOMError { - name: string; + readonly name: string; toString(): string; } @@ -5466,69 +6147,69 @@ declare var DOMError: { } interface DOMException { - code: number; - message: string; - name: string; + readonly code: number; + readonly message: string; + readonly name: string; toString(): string; - ABORT_ERR: number; - DATA_CLONE_ERR: number; - DOMSTRING_SIZE_ERR: number; - HIERARCHY_REQUEST_ERR: number; - INDEX_SIZE_ERR: number; - INUSE_ATTRIBUTE_ERR: number; - INVALID_ACCESS_ERR: number; - INVALID_CHARACTER_ERR: number; - INVALID_MODIFICATION_ERR: number; - INVALID_NODE_TYPE_ERR: number; - INVALID_STATE_ERR: number; - NAMESPACE_ERR: number; - NETWORK_ERR: number; - NOT_FOUND_ERR: number; - NOT_SUPPORTED_ERR: number; - NO_DATA_ALLOWED_ERR: number; - NO_MODIFICATION_ALLOWED_ERR: number; - PARSE_ERR: number; - QUOTA_EXCEEDED_ERR: number; - SECURITY_ERR: number; - SERIALIZE_ERR: number; - SYNTAX_ERR: number; - TIMEOUT_ERR: number; - TYPE_MISMATCH_ERR: number; - URL_MISMATCH_ERR: number; - VALIDATION_ERR: number; - WRONG_DOCUMENT_ERR: number; + readonly ABORT_ERR: number; + readonly DATA_CLONE_ERR: number; + readonly DOMSTRING_SIZE_ERR: number; + readonly HIERARCHY_REQUEST_ERR: number; + readonly INDEX_SIZE_ERR: number; + readonly INUSE_ATTRIBUTE_ERR: number; + readonly INVALID_ACCESS_ERR: number; + readonly INVALID_CHARACTER_ERR: number; + readonly INVALID_MODIFICATION_ERR: number; + readonly INVALID_NODE_TYPE_ERR: number; + readonly INVALID_STATE_ERR: number; + readonly NAMESPACE_ERR: number; + readonly NETWORK_ERR: number; + readonly NOT_FOUND_ERR: number; + readonly NOT_SUPPORTED_ERR: number; + readonly NO_DATA_ALLOWED_ERR: number; + readonly NO_MODIFICATION_ALLOWED_ERR: number; + readonly PARSE_ERR: number; + readonly QUOTA_EXCEEDED_ERR: number; + readonly SECURITY_ERR: number; + readonly SERIALIZE_ERR: number; + readonly SYNTAX_ERR: number; + readonly TIMEOUT_ERR: number; + readonly TYPE_MISMATCH_ERR: number; + readonly URL_MISMATCH_ERR: number; + readonly VALIDATION_ERR: number; + readonly WRONG_DOCUMENT_ERR: number; } declare var DOMException: { prototype: DOMException; new(): DOMException; - ABORT_ERR: number; - DATA_CLONE_ERR: number; - DOMSTRING_SIZE_ERR: number; - HIERARCHY_REQUEST_ERR: number; - INDEX_SIZE_ERR: number; - INUSE_ATTRIBUTE_ERR: number; - INVALID_ACCESS_ERR: number; - INVALID_CHARACTER_ERR: number; - INVALID_MODIFICATION_ERR: number; - INVALID_NODE_TYPE_ERR: number; - INVALID_STATE_ERR: number; - NAMESPACE_ERR: number; - NETWORK_ERR: number; - NOT_FOUND_ERR: number; - NOT_SUPPORTED_ERR: number; - NO_DATA_ALLOWED_ERR: number; - NO_MODIFICATION_ALLOWED_ERR: number; - PARSE_ERR: number; - QUOTA_EXCEEDED_ERR: number; - SECURITY_ERR: number; - SERIALIZE_ERR: number; - SYNTAX_ERR: number; - TIMEOUT_ERR: number; - TYPE_MISMATCH_ERR: number; - URL_MISMATCH_ERR: number; - VALIDATION_ERR: number; - WRONG_DOCUMENT_ERR: number; + readonly ABORT_ERR: number; + readonly DATA_CLONE_ERR: number; + readonly DOMSTRING_SIZE_ERR: number; + readonly HIERARCHY_REQUEST_ERR: number; + readonly INDEX_SIZE_ERR: number; + readonly INUSE_ATTRIBUTE_ERR: number; + readonly INVALID_ACCESS_ERR: number; + readonly INVALID_CHARACTER_ERR: number; + readonly INVALID_MODIFICATION_ERR: number; + readonly INVALID_NODE_TYPE_ERR: number; + readonly INVALID_STATE_ERR: number; + readonly NAMESPACE_ERR: number; + readonly NETWORK_ERR: number; + readonly NOT_FOUND_ERR: number; + readonly NOT_SUPPORTED_ERR: number; + readonly NO_DATA_ALLOWED_ERR: number; + readonly NO_MODIFICATION_ALLOWED_ERR: number; + readonly PARSE_ERR: number; + readonly QUOTA_EXCEEDED_ERR: number; + readonly SECURITY_ERR: number; + readonly SERIALIZE_ERR: number; + readonly SYNTAX_ERR: number; + readonly TIMEOUT_ERR: number; + readonly TYPE_MISMATCH_ERR: number; + readonly URL_MISMATCH_ERR: number; + readonly VALIDATION_ERR: number; + readonly WRONG_DOCUMENT_ERR: number; } interface DOMImplementation { @@ -5562,7 +6243,7 @@ declare var DOMSettableTokenList: { } interface DOMStringList { - length: number; + readonly length: number; contains(str: string): boolean; item(index: number): string; [index: number]: string; @@ -5583,7 +6264,7 @@ declare var DOMStringMap: { } interface DOMTokenList { - length: number; + readonly length: number; add(...token: string[]): void; contains(token: string): boolean; item(index: number): string; @@ -5610,9 +6291,9 @@ declare var DataCue: { interface DataTransfer { dropEffect: string; effectAllowed: string; - files: FileList; - items: DataTransferItemList; - types: DOMStringList; + readonly files: FileList; + readonly items: DataTransferItemList; + readonly types: DOMStringList; clearData(format?: string): boolean; getData(format: string): string; setData(format: string, data: string): boolean; @@ -5624,8 +6305,8 @@ declare var DataTransfer: { } interface DataTransferItem { - kind: string; - type: string; + readonly kind: string; + readonly type: string; getAsFile(): File; getAsString(_callback: FunctionStringCallback): void; } @@ -5636,7 +6317,7 @@ declare var DataTransferItem: { } interface DataTransferItemList { - length: number; + readonly length: number; add(data: File): DataTransferItem; clear(): void; item(index: number): DataTransferItem; @@ -5650,9 +6331,9 @@ declare var DataTransferItemList: { } interface DeferredPermissionRequest { - id: number; - type: string; - uri: string; + readonly id: number; + readonly type: string; + readonly uri: string; allow(): void; deny(): void; } @@ -5663,7 +6344,7 @@ declare var DeferredPermissionRequest: { } interface DelayNode extends AudioNode { - delayTime: AudioParam; + readonly delayTime: AudioParam; } declare var DelayNode: { @@ -5672,9 +6353,9 @@ declare var DelayNode: { } interface DeviceAcceleration { - x: number; - y: number; - z: number; + readonly x: number; + readonly y: number; + readonly z: number; } declare var DeviceAcceleration: { @@ -5682,11 +6363,20 @@ declare var DeviceAcceleration: { new(): DeviceAcceleration; } +interface DeviceLightEvent extends Event { + readonly value: number; +} + +declare var DeviceLightEvent: { + prototype: DeviceLightEvent; + new(type: string, eventInitDict?: DeviceLightEventInit): DeviceLightEvent; +} + interface DeviceMotionEvent extends Event { - acceleration: DeviceAcceleration; - accelerationIncludingGravity: DeviceAcceleration; - interval: number; - rotationRate: DeviceRotationRate; + readonly acceleration: DeviceAcceleration; + readonly accelerationIncludingGravity: DeviceAcceleration; + readonly interval: number; + readonly rotationRate: DeviceRotationRate; initDeviceMotionEvent(type: string, bubbles: boolean, cancelable: boolean, acceleration: DeviceAccelerationDict, accelerationIncludingGravity: DeviceAccelerationDict, rotationRate: DeviceRotationRateDict, interval: number): void; } @@ -5696,10 +6386,10 @@ declare var DeviceMotionEvent: { } interface DeviceOrientationEvent extends Event { - absolute: boolean; - alpha: number; - beta: number; - gamma: number; + readonly absolute: boolean; + readonly alpha: number; + readonly beta: number; + readonly gamma: number; initDeviceOrientationEvent(type: string, bubbles: boolean, cancelable: boolean, alpha: number, beta: number, gamma: number, absolute: boolean): void; } @@ -5709,9 +6399,9 @@ declare var DeviceOrientationEvent: { } interface DeviceRotationRate { - alpha: number; - beta: number; - gamma: number; + readonly alpha: number; + readonly beta: number; + readonly gamma: number; } declare var DeviceRotationRate: { @@ -5723,15 +6413,15 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven /** * Sets or gets the URL for the current document. */ - URL: string; + readonly URL: string; /** * Gets the URL for the document, stripped of any character encoding. */ - URLUnencoded: string; + readonly URLUnencoded: string; /** * Gets the object that has the focus when the parent document has focus. */ - activeElement: Element; + readonly activeElement: Element; /** * Sets or gets the color of all active links in the document. */ @@ -5739,15 +6429,15 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven /** * Returns a reference to the collection of elements contained by the object. */ - all: HTMLCollection; + readonly all: HTMLAllCollection; /** * Retrieves a collection of all a objects that have a name and/or id property. Objects in this collection are in HTML source order. */ - anchors: HTMLCollection; + anchors: HTMLCollectionOf; /** * Retrieves a collection of all applet objects in the document. */ - applets: HTMLCollection; + applets: HTMLCollectionOf; /** * Deprecated. Sets or retrieves a value that indicates the background color behind the object. */ @@ -5756,7 +6446,7 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven * Specifies the beginning and end of the document body. */ body: HTMLElement; - characterSet: string; + readonly characterSet: string; /** * Gets or sets the character set used to encode the object. */ @@ -5764,13 +6454,14 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven /** * Gets a value that indicates whether standards-compliant mode is switched on for the object. */ - compatMode: string; + readonly compatMode: string; cookie: string; + readonly currentScript: HTMLScriptElement | SVGScriptElement; /** * Gets the default character set from the current regional language settings. */ - defaultCharset: string; - defaultView: Window; + readonly defaultCharset: string; + readonly defaultView: Window; /** * Sets or gets a value that indicates whether the document can be edited. */ @@ -5782,7 +6473,7 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven /** * Gets an object representing the document type declaration associated with the current document. */ - doctype: DocumentType; + readonly doctype: DocumentType; /** * Gets a reference to the root node of the document. */ @@ -5794,7 +6485,7 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven /** * Retrieves a collection of all embed objects in the document. */ - embeds: HTMLCollection; + embeds: HTMLCollectionOf; /** * Sets or gets the foreground (text) color of the document. */ @@ -5802,27 +6493,27 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven /** * Retrieves a collection, in source order, of all form objects in the document. */ - forms: HTMLCollection; - fullscreenElement: Element; - fullscreenEnabled: boolean; - head: HTMLHeadElement; - hidden: boolean; + forms: HTMLCollectionOf; + readonly fullscreenElement: Element; + readonly fullscreenEnabled: boolean; + readonly head: HTMLHeadElement; + readonly hidden: boolean; /** * Retrieves a collection, in source order, of img objects in the document. */ - images: HTMLCollection; + images: HTMLCollectionOf; /** * Gets the implementation object of the current document. */ - implementation: DOMImplementation; + readonly implementation: DOMImplementation; /** * Returns the character encoding used to create the webpage that is loaded into the document object. */ - inputEncoding: string; + readonly inputEncoding: string; /** * Gets the date that the page was last modified, if the page supplies one. */ - lastModified: string; + readonly lastModified: string; /** * Sets or gets the color of the document links. */ @@ -5830,16 +6521,13 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven /** * Retrieves a collection of all a objects that specify the href property and all area objects in the document. */ - links: HTMLCollection; + links: HTMLCollectionOf; /** * Contains information about the current URL. */ - location: Location; - media: string; + readonly location: Location; msCSSOMElementFloatMetrics: boolean; msCapsLockWarningOff: boolean; - msHidden: boolean; - msVisibilityState: string; /** * Fires when the user aborts the download. * @param ev The event. @@ -5941,7 +6629,7 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven * Occurs when the end of playback is reached. * @param ev The event */ - onended: (ev: Event) => any; + onended: (ev: MediaStreamErrorEvent) => any; /** * Fires when an error occurs during object loading. * @param ev The event. @@ -5955,6 +6643,7 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven onfullscreenchange: (ev: Event) => any; onfullscreenerror: (ev: Event) => any; oninput: (ev: Event) => any; + oninvalid: (ev: Event) => any; /** * Fires when the user presses a key. * @param ev The keyboard event @@ -6019,7 +6708,7 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven * Fires when the wheel button is rotated. * @param ev The mouse event */ - onmousewheel: (ev: MouseWheelEvent) => any; + onmousewheel: (ev: WheelEvent) => any; onmscontentzoom: (ev: UIEvent) => any; onmsgesturechange: (ev: MSGestureEvent) => any; onmsgesturedoubletap: (ev: MSGestureEvent) => any; @@ -6104,6 +6793,11 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven * @param ev The event. */ onselect: (ev: UIEvent) => any; + /** + * Fires when the selection state of a document changes. + * @param ev The event. + */ + onselectionchange: (ev: Event) => any; onselectstart: (ev: Event) => any; /** * Occurs when the download has stopped. @@ -6142,51 +6836,51 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven onwaiting: (ev: Event) => any; onwebkitfullscreenchange: (ev: Event) => any; onwebkitfullscreenerror: (ev: Event) => any; - plugins: HTMLCollection; - pointerLockElement: Element; + plugins: HTMLCollectionOf; + readonly pointerLockElement: Element; /** * Retrieves a value that indicates the current state of the object. */ - readyState: string; + readonly readyState: string; /** * Gets the URL of the location that referred the user to the current page. */ - referrer: string; + readonly referrer: string; /** * Gets the root svg element in the document hierarchy. */ - rootElement: SVGSVGElement; + readonly rootElement: SVGSVGElement; /** * Retrieves a collection of all script objects in the document. */ - scripts: HTMLCollection; - security: string; + scripts: HTMLCollectionOf; + readonly scrollingElement: Element; /** * Retrieves a collection of styleSheet objects representing the style sheets that correspond to each instance of a link or style object in the document. */ - styleSheets: StyleSheetList; + readonly styleSheets: StyleSheetList; /** * Contains the title of the document. */ title: string; - visibilityState: string; + readonly visibilityState: string; /** * Sets or gets the color of the links that the user has visited. */ vlinkColor: string; - webkitCurrentFullScreenElement: Element; - webkitFullscreenElement: Element; - webkitFullscreenEnabled: boolean; - webkitIsFullScreen: boolean; - xmlEncoding: string; + readonly webkitCurrentFullScreenElement: Element; + readonly webkitFullscreenElement: Element; + readonly webkitFullscreenEnabled: boolean; + readonly webkitIsFullScreen: boolean; + readonly xmlEncoding: string; xmlStandalone: boolean; /** * Gets or sets the version attribute specified in the declaration of an XML document. */ xmlVersion: string; - currentScript: HTMLScriptElement; adoptNode(source: Node): Node; captureEvents(): void; + caretRangeFromPoint(x: number, y: number): Range; clear(): void; /** * Closes an output stream and forces the sent data to display. @@ -6213,37 +6907,24 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven * @param tagName The name of an element. */ createElement(tagName: "a"): HTMLAnchorElement; - createElement(tagName: "abbr"): HTMLPhraseElement; - createElement(tagName: "acronym"): HTMLPhraseElement; - createElement(tagName: "address"): HTMLBlockElement; createElement(tagName: "applet"): HTMLAppletElement; createElement(tagName: "area"): HTMLAreaElement; createElement(tagName: "audio"): HTMLAudioElement; - createElement(tagName: "b"): HTMLPhraseElement; createElement(tagName: "base"): HTMLBaseElement; createElement(tagName: "basefont"): HTMLBaseFontElement; - createElement(tagName: "bdo"): HTMLPhraseElement; - createElement(tagName: "big"): HTMLPhraseElement; - createElement(tagName: "blockquote"): HTMLBlockElement; + createElement(tagName: "blockquote"): HTMLQuoteElement; createElement(tagName: "body"): HTMLBodyElement; createElement(tagName: "br"): HTMLBRElement; createElement(tagName: "button"): HTMLButtonElement; createElement(tagName: "canvas"): HTMLCanvasElement; createElement(tagName: "caption"): HTMLTableCaptionElement; - createElement(tagName: "center"): HTMLBlockElement; - createElement(tagName: "cite"): HTMLPhraseElement; - createElement(tagName: "code"): HTMLPhraseElement; createElement(tagName: "col"): HTMLTableColElement; createElement(tagName: "colgroup"): HTMLTableColElement; createElement(tagName: "datalist"): HTMLDataListElement; - createElement(tagName: "dd"): HTMLDDElement; createElement(tagName: "del"): HTMLModElement; - createElement(tagName: "dfn"): HTMLPhraseElement; createElement(tagName: "dir"): HTMLDirectoryElement; createElement(tagName: "div"): HTMLDivElement; createElement(tagName: "dl"): HTMLDListElement; - createElement(tagName: "dt"): HTMLDTElement; - createElement(tagName: "em"): HTMLPhraseElement; createElement(tagName: "embed"): HTMLEmbedElement; createElement(tagName: "fieldset"): HTMLFieldSetElement; createElement(tagName: "font"): HTMLFontElement; @@ -6259,52 +6940,41 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven createElement(tagName: "head"): HTMLHeadElement; createElement(tagName: "hr"): HTMLHRElement; createElement(tagName: "html"): HTMLHtmlElement; - createElement(tagName: "i"): HTMLPhraseElement; createElement(tagName: "iframe"): HTMLIFrameElement; createElement(tagName: "img"): HTMLImageElement; createElement(tagName: "input"): HTMLInputElement; createElement(tagName: "ins"): HTMLModElement; - createElement(tagName: "isindex"): HTMLIsIndexElement; - createElement(tagName: "kbd"): HTMLPhraseElement; - createElement(tagName: "keygen"): HTMLBlockElement; + createElement(tagName: "isindex"): HTMLUnknownElement; createElement(tagName: "label"): HTMLLabelElement; createElement(tagName: "legend"): HTMLLegendElement; createElement(tagName: "li"): HTMLLIElement; createElement(tagName: "link"): HTMLLinkElement; - createElement(tagName: "listing"): HTMLBlockElement; + createElement(tagName: "listing"): HTMLPreElement; createElement(tagName: "map"): HTMLMapElement; createElement(tagName: "marquee"): HTMLMarqueeElement; createElement(tagName: "menu"): HTMLMenuElement; createElement(tagName: "meta"): HTMLMetaElement; - createElement(tagName: "nextid"): HTMLNextIdElement; - createElement(tagName: "nobr"): HTMLPhraseElement; + createElement(tagName: "meter"): HTMLMeterElement; + createElement(tagName: "nextid"): HTMLUnknownElement; createElement(tagName: "object"): HTMLObjectElement; createElement(tagName: "ol"): HTMLOListElement; createElement(tagName: "optgroup"): HTMLOptGroupElement; createElement(tagName: "option"): HTMLOptionElement; createElement(tagName: "p"): HTMLParagraphElement; createElement(tagName: "param"): HTMLParamElement; - createElement(tagName: "plaintext"): HTMLBlockElement; + createElement(tagName: "picture"): HTMLPictureElement; createElement(tagName: "pre"): HTMLPreElement; createElement(tagName: "progress"): HTMLProgressElement; createElement(tagName: "q"): HTMLQuoteElement; - createElement(tagName: "rt"): HTMLPhraseElement; - createElement(tagName: "ruby"): HTMLPhraseElement; - createElement(tagName: "s"): HTMLPhraseElement; - createElement(tagName: "samp"): HTMLPhraseElement; createElement(tagName: "script"): HTMLScriptElement; createElement(tagName: "select"): HTMLSelectElement; - createElement(tagName: "small"): HTMLPhraseElement; createElement(tagName: "source"): HTMLSourceElement; createElement(tagName: "span"): HTMLSpanElement; - createElement(tagName: "strike"): HTMLPhraseElement; - createElement(tagName: "strong"): HTMLPhraseElement; createElement(tagName: "style"): HTMLStyleElement; - createElement(tagName: "sub"): HTMLPhraseElement; - createElement(tagName: "sup"): HTMLPhraseElement; createElement(tagName: "table"): HTMLTableElement; createElement(tagName: "tbody"): HTMLTableSectionElement; createElement(tagName: "td"): HTMLTableDataCellElement; + createElement(tagName: "template"): HTMLTemplateElement; createElement(tagName: "textarea"): HTMLTextAreaElement; createElement(tagName: "tfoot"): HTMLTableSectionElement; createElement(tagName: "th"): HTMLTableHeaderCellElement; @@ -6312,13 +6982,10 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven createElement(tagName: "title"): HTMLTitleElement; createElement(tagName: "tr"): HTMLTableRowElement; createElement(tagName: "track"): HTMLTrackElement; - createElement(tagName: "tt"): HTMLPhraseElement; - createElement(tagName: "u"): HTMLPhraseElement; createElement(tagName: "ul"): HTMLUListElement; - createElement(tagName: "var"): HTMLPhraseElement; createElement(tagName: "video"): HTMLVideoElement; createElement(tagName: "x-ms-webview"): MSHTMLWebViewElement; - createElement(tagName: "xmp"): HTMLBlockElement; + createElement(tagName: "xmp"): HTMLPreElement; createElement(tagName: string): HTMLElement; createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "a"): SVGAElement createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "circle"): SVGCircleElement @@ -6403,7 +7070,7 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven * @param data String that specifies the nodeValue property of the text node. */ createTextNode(data: string): Text; - createTouch(view: any, target: EventTarget, identifier: number, pageX: number, pageY: number, screenX: number, screenY: number): Touch; + createTouch(view: Window, target: EventTarget, identifier: number, pageX: number, pageY: number, screenX: number, screenY: number): Touch; createTouchList(...touches: Touch[]): TouchList; /** * Creates a TreeWalker object that you can use to traverse filtered lists of nodes or elements in a document. @@ -6454,44 +7121,44 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven * @param name Specifies the name of an element. */ getElementsByTagName(tagname: "a"): NodeListOf; - getElementsByTagName(tagname: "abbr"): NodeListOf; - getElementsByTagName(tagname: "acronym"): NodeListOf; - getElementsByTagName(tagname: "address"): NodeListOf; + getElementsByTagName(tagname: "abbr"): NodeListOf; + getElementsByTagName(tagname: "acronym"): NodeListOf; + getElementsByTagName(tagname: "address"): NodeListOf; getElementsByTagName(tagname: "applet"): NodeListOf; getElementsByTagName(tagname: "area"): NodeListOf; getElementsByTagName(tagname: "article"): NodeListOf; getElementsByTagName(tagname: "aside"): NodeListOf; getElementsByTagName(tagname: "audio"): NodeListOf; - getElementsByTagName(tagname: "b"): NodeListOf; + getElementsByTagName(tagname: "b"): NodeListOf; getElementsByTagName(tagname: "base"): NodeListOf; getElementsByTagName(tagname: "basefont"): NodeListOf; - getElementsByTagName(tagname: "bdo"): NodeListOf; - getElementsByTagName(tagname: "big"): NodeListOf; - getElementsByTagName(tagname: "blockquote"): NodeListOf; + getElementsByTagName(tagname: "bdo"): NodeListOf; + getElementsByTagName(tagname: "big"): NodeListOf; + getElementsByTagName(tagname: "blockquote"): NodeListOf; getElementsByTagName(tagname: "body"): NodeListOf; getElementsByTagName(tagname: "br"): NodeListOf; getElementsByTagName(tagname: "button"): NodeListOf; getElementsByTagName(tagname: "canvas"): NodeListOf; getElementsByTagName(tagname: "caption"): NodeListOf; - getElementsByTagName(tagname: "center"): NodeListOf; + getElementsByTagName(tagname: "center"): NodeListOf; getElementsByTagName(tagname: "circle"): NodeListOf; - getElementsByTagName(tagname: "cite"): NodeListOf; + getElementsByTagName(tagname: "cite"): NodeListOf; getElementsByTagName(tagname: "clippath"): NodeListOf; - getElementsByTagName(tagname: "code"): NodeListOf; + getElementsByTagName(tagname: "code"): NodeListOf; getElementsByTagName(tagname: "col"): NodeListOf; getElementsByTagName(tagname: "colgroup"): NodeListOf; getElementsByTagName(tagname: "datalist"): NodeListOf; - getElementsByTagName(tagname: "dd"): NodeListOf; + getElementsByTagName(tagname: "dd"): NodeListOf; getElementsByTagName(tagname: "defs"): NodeListOf; getElementsByTagName(tagname: "del"): NodeListOf; getElementsByTagName(tagname: "desc"): NodeListOf; - getElementsByTagName(tagname: "dfn"): NodeListOf; + getElementsByTagName(tagname: "dfn"): NodeListOf; getElementsByTagName(tagname: "dir"): NodeListOf; getElementsByTagName(tagname: "div"): NodeListOf; getElementsByTagName(tagname: "dl"): NodeListOf; - getElementsByTagName(tagname: "dt"): NodeListOf; + getElementsByTagName(tagname: "dt"): NodeListOf; getElementsByTagName(tagname: "ellipse"): NodeListOf; - getElementsByTagName(tagname: "em"): NodeListOf; + getElementsByTagName(tagname: "em"): NodeListOf; getElementsByTagName(tagname: "embed"): NodeListOf; getElementsByTagName(tagname: "feblend"): NodeListOf; getElementsByTagName(tagname: "fecolormatrix"): NodeListOf; @@ -6539,22 +7206,22 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven getElementsByTagName(tagname: "hgroup"): NodeListOf; getElementsByTagName(tagname: "hr"): NodeListOf; getElementsByTagName(tagname: "html"): NodeListOf; - getElementsByTagName(tagname: "i"): NodeListOf; + getElementsByTagName(tagname: "i"): NodeListOf; getElementsByTagName(tagname: "iframe"): NodeListOf; getElementsByTagName(tagname: "image"): NodeListOf; getElementsByTagName(tagname: "img"): NodeListOf; getElementsByTagName(tagname: "input"): NodeListOf; getElementsByTagName(tagname: "ins"): NodeListOf; - getElementsByTagName(tagname: "isindex"): NodeListOf; - getElementsByTagName(tagname: "kbd"): NodeListOf; - getElementsByTagName(tagname: "keygen"): NodeListOf; + getElementsByTagName(tagname: "isindex"): NodeListOf; + getElementsByTagName(tagname: "kbd"): NodeListOf; + getElementsByTagName(tagname: "keygen"): NodeListOf; getElementsByTagName(tagname: "label"): NodeListOf; getElementsByTagName(tagname: "legend"): NodeListOf; getElementsByTagName(tagname: "li"): NodeListOf; getElementsByTagName(tagname: "line"): NodeListOf; getElementsByTagName(tagname: "lineargradient"): NodeListOf; getElementsByTagName(tagname: "link"): NodeListOf; - getElementsByTagName(tagname: "listing"): NodeListOf; + getElementsByTagName(tagname: "listing"): NodeListOf; getElementsByTagName(tagname: "map"): NodeListOf; getElementsByTagName(tagname: "mark"): NodeListOf; getElementsByTagName(tagname: "marker"): NodeListOf; @@ -6563,9 +7230,10 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven getElementsByTagName(tagname: "menu"): NodeListOf; getElementsByTagName(tagname: "meta"): NodeListOf; getElementsByTagName(tagname: "metadata"): NodeListOf; + getElementsByTagName(tagname: "meter"): NodeListOf; getElementsByTagName(tagname: "nav"): NodeListOf; - getElementsByTagName(tagname: "nextid"): NodeListOf; - getElementsByTagName(tagname: "nobr"): NodeListOf; + getElementsByTagName(tagname: "nextid"): NodeListOf; + getElementsByTagName(tagname: "nobr"): NodeListOf; getElementsByTagName(tagname: "noframes"): NodeListOf; getElementsByTagName(tagname: "noscript"): NodeListOf; getElementsByTagName(tagname: "object"): NodeListOf; @@ -6576,7 +7244,8 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven getElementsByTagName(tagname: "param"): NodeListOf; getElementsByTagName(tagname: "path"): NodeListOf; getElementsByTagName(tagname: "pattern"): NodeListOf; - getElementsByTagName(tagname: "plaintext"): NodeListOf; + getElementsByTagName(tagname: "picture"): NodeListOf; + getElementsByTagName(tagname: "plaintext"): NodeListOf; getElementsByTagName(tagname: "polygon"): NodeListOf; getElementsByTagName(tagname: "polyline"): NodeListOf; getElementsByTagName(tagname: "pre"): NodeListOf; @@ -6584,28 +7253,29 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven getElementsByTagName(tagname: "q"): NodeListOf; getElementsByTagName(tagname: "radialgradient"): NodeListOf; getElementsByTagName(tagname: "rect"): NodeListOf; - getElementsByTagName(tagname: "rt"): NodeListOf; - getElementsByTagName(tagname: "ruby"): NodeListOf; - getElementsByTagName(tagname: "s"): NodeListOf; - getElementsByTagName(tagname: "samp"): NodeListOf; + getElementsByTagName(tagname: "rt"): NodeListOf; + getElementsByTagName(tagname: "ruby"): NodeListOf; + getElementsByTagName(tagname: "s"): NodeListOf; + getElementsByTagName(tagname: "samp"): NodeListOf; getElementsByTagName(tagname: "script"): NodeListOf; getElementsByTagName(tagname: "section"): NodeListOf; getElementsByTagName(tagname: "select"): NodeListOf; - getElementsByTagName(tagname: "small"): NodeListOf; + getElementsByTagName(tagname: "small"): NodeListOf; getElementsByTagName(tagname: "source"): NodeListOf; getElementsByTagName(tagname: "span"): NodeListOf; getElementsByTagName(tagname: "stop"): NodeListOf; - getElementsByTagName(tagname: "strike"): NodeListOf; - getElementsByTagName(tagname: "strong"): NodeListOf; + getElementsByTagName(tagname: "strike"): NodeListOf; + getElementsByTagName(tagname: "strong"): NodeListOf; getElementsByTagName(tagname: "style"): NodeListOf; - getElementsByTagName(tagname: "sub"): NodeListOf; - getElementsByTagName(tagname: "sup"): NodeListOf; + getElementsByTagName(tagname: "sub"): NodeListOf; + getElementsByTagName(tagname: "sup"): NodeListOf; getElementsByTagName(tagname: "svg"): NodeListOf; getElementsByTagName(tagname: "switch"): NodeListOf; getElementsByTagName(tagname: "symbol"): NodeListOf; getElementsByTagName(tagname: "table"): NodeListOf; getElementsByTagName(tagname: "tbody"): NodeListOf; getElementsByTagName(tagname: "td"): NodeListOf; + getElementsByTagName(tagname: "template"): NodeListOf; getElementsByTagName(tagname: "text"): NodeListOf; getElementsByTagName(tagname: "textpath"): NodeListOf; getElementsByTagName(tagname: "textarea"): NodeListOf; @@ -6616,16 +7286,16 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven getElementsByTagName(tagname: "tr"): NodeListOf; getElementsByTagName(tagname: "track"): NodeListOf; getElementsByTagName(tagname: "tspan"): NodeListOf; - getElementsByTagName(tagname: "tt"): NodeListOf; - getElementsByTagName(tagname: "u"): NodeListOf; + getElementsByTagName(tagname: "tt"): NodeListOf; + getElementsByTagName(tagname: "u"): NodeListOf; getElementsByTagName(tagname: "ul"): NodeListOf; getElementsByTagName(tagname: "use"): NodeListOf; - getElementsByTagName(tagname: "var"): NodeListOf; + getElementsByTagName(tagname: "var"): NodeListOf; getElementsByTagName(tagname: "video"): NodeListOf; getElementsByTagName(tagname: "view"): NodeListOf; getElementsByTagName(tagname: "wbr"): NodeListOf; getElementsByTagName(tagname: "x-ms-webview"): NodeListOf; - getElementsByTagName(tagname: "xmp"): NodeListOf; + getElementsByTagName(tagname: "xmp"): NodeListOf; getElementsByTagName(tagname: string): NodeListOf; getElementsByTagNameNS(namespaceURI: string, localName: string): NodeListOf; /** @@ -6637,8 +7307,8 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven */ hasFocus(): boolean; importNode(importedNode: Node, deep: boolean): Node; - msElementsFromPoint(x: number, y: number): NodeList; - msElementsFromRect(left: number, top: number, width: number, height: number): NodeList; + msElementsFromPoint(x: number, y: number): NodeListOf; + msElementsFromRect(left: number, top: number, width: number, height: number): NodeListOf; /** * 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. * @param url Specifies a MIME type for the document. @@ -6734,12 +7404,13 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven addEventListener(type: "drop", listener: (ev: DragEvent) => any, useCapture?: boolean): void; addEventListener(type: "durationchange", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "emptied", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "ended", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "ended", listener: (ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: "focus", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; addEventListener(type: "fullscreenchange", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "fullscreenerror", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "input", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "invalid", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "keydown", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "keypress", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "keyup", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; @@ -6752,7 +7423,7 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven addEventListener(type: "mouseout", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "mouseover", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "mouseup", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousewheel", listener: (ev: MouseWheelEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mousewheel", listener: (ev: WheelEvent) => any, useCapture?: boolean): void; addEventListener(type: "mssitemodejumplistitemremoved", listener: (ev: MSSiteModeEvent) => any, useCapture?: boolean): void; addEventListener(type: "msthumbnailclick", listener: (ev: MSSiteModeEvent) => any, useCapture?: boolean): void; addEventListener(type: "pause", listener: (ev: Event) => any, useCapture?: boolean): void; @@ -6776,6 +7447,7 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven addEventListener(type: "seeked", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "seeking", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "select", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "selectionchange", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "selectstart", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "stalled", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "stop", listener: (ev: Event) => any, useCapture?: boolean): void; @@ -6809,12 +7481,12 @@ declare var DocumentFragment: { } interface DocumentType extends Node, ChildNode { - entities: NamedNodeMap; - internalSubset: string; - name: string; - notations: NamedNodeMap; - publicId: string; - systemId: string; + readonly entities: NamedNodeMap; + readonly internalSubset: string; + readonly name: string; + readonly notations: NamedNodeMap; + readonly publicId: string; + readonly systemId: string; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -6824,7 +7496,7 @@ declare var DocumentType: { } interface DragEvent extends MouseEvent { - dataTransfer: DataTransfer; + readonly dataTransfer: DataTransfer; 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; msConvertURL(file: File, targetType: string, targetURL?: string): void; } @@ -6835,12 +7507,12 @@ declare var DragEvent: { } interface DynamicsCompressorNode extends AudioNode { - attack: AudioParam; - knee: AudioParam; - ratio: AudioParam; - reduction: AudioParam; - release: AudioParam; - threshold: AudioParam; + readonly attack: AudioParam; + readonly knee: AudioParam; + readonly ratio: AudioParam; + readonly reduction: AudioParam; + readonly release: AudioParam; + readonly threshold: AudioParam; } declare var DynamicsCompressorNode: { @@ -6848,26 +7520,36 @@ declare var DynamicsCompressorNode: { new(): DynamicsCompressorNode; } +interface EXT_frag_depth { +} + +declare var EXT_frag_depth: { + prototype: EXT_frag_depth; + new(): EXT_frag_depth; +} + interface EXT_texture_filter_anisotropic { - MAX_TEXTURE_MAX_ANISOTROPY_EXT: number; - TEXTURE_MAX_ANISOTROPY_EXT: number; + readonly MAX_TEXTURE_MAX_ANISOTROPY_EXT: number; + readonly TEXTURE_MAX_ANISOTROPY_EXT: number; } declare var EXT_texture_filter_anisotropic: { prototype: EXT_texture_filter_anisotropic; new(): EXT_texture_filter_anisotropic; - MAX_TEXTURE_MAX_ANISOTROPY_EXT: number; - TEXTURE_MAX_ANISOTROPY_EXT: number; + readonly MAX_TEXTURE_MAX_ANISOTROPY_EXT: number; + readonly TEXTURE_MAX_ANISOTROPY_EXT: number; } interface Element extends Node, GlobalEventHandlers, ElementTraversal, NodeSelector, ChildNode { - classList: DOMTokenList; - clientHeight: number; - clientLeft: number; - clientTop: number; - clientWidth: number; + readonly classList: DOMTokenList; + className: string; + readonly clientHeight: number; + readonly clientLeft: number; + readonly clientTop: number; + readonly clientWidth: number; + id: string; msContentZoomFactor: number; - msRegionOverflow: string; + readonly msRegionOverflow: string; onariarequest: (ev: AriaRequestEvent) => any; oncommand: (ev: CommandEvent) => any; ongotpointercapture: (ev: PointerEvent) => any; @@ -6895,13 +7577,12 @@ interface Element extends Node, GlobalEventHandlers, ElementTraversal, NodeSelec ontouchstart: (ev: TouchEvent) => any; onwebkitfullscreenchange: (ev: Event) => any; onwebkitfullscreenerror: (ev: Event) => any; - scrollHeight: number; + readonly prefix: string; + readonly scrollHeight: number; scrollLeft: number; scrollTop: number; - scrollWidth: number; - tagName: string; - id: string; - className: string; + readonly scrollWidth: number; + readonly tagName: string; innerHTML: string; getAttribute(name?: string): string; getAttributeNS(namespaceURI: string, localName: string): string; @@ -6910,44 +7591,44 @@ interface Element extends Node, GlobalEventHandlers, ElementTraversal, NodeSelec getBoundingClientRect(): ClientRect; getClientRects(): ClientRectList; getElementsByTagName(name: "a"): NodeListOf; - getElementsByTagName(name: "abbr"): NodeListOf; - getElementsByTagName(name: "acronym"): NodeListOf; - getElementsByTagName(name: "address"): NodeListOf; + getElementsByTagName(name: "abbr"): NodeListOf; + getElementsByTagName(name: "acronym"): NodeListOf; + getElementsByTagName(name: "address"): NodeListOf; getElementsByTagName(name: "applet"): NodeListOf; getElementsByTagName(name: "area"): NodeListOf; getElementsByTagName(name: "article"): NodeListOf; getElementsByTagName(name: "aside"): NodeListOf; getElementsByTagName(name: "audio"): NodeListOf; - getElementsByTagName(name: "b"): NodeListOf; + getElementsByTagName(name: "b"): NodeListOf; getElementsByTagName(name: "base"): NodeListOf; getElementsByTagName(name: "basefont"): NodeListOf; - getElementsByTagName(name: "bdo"): NodeListOf; - getElementsByTagName(name: "big"): NodeListOf; - getElementsByTagName(name: "blockquote"): NodeListOf; + getElementsByTagName(name: "bdo"): NodeListOf; + getElementsByTagName(name: "big"): NodeListOf; + getElementsByTagName(name: "blockquote"): NodeListOf; getElementsByTagName(name: "body"): NodeListOf; getElementsByTagName(name: "br"): NodeListOf; getElementsByTagName(name: "button"): NodeListOf; getElementsByTagName(name: "canvas"): NodeListOf; getElementsByTagName(name: "caption"): NodeListOf; - getElementsByTagName(name: "center"): NodeListOf; + getElementsByTagName(name: "center"): NodeListOf; getElementsByTagName(name: "circle"): NodeListOf; - getElementsByTagName(name: "cite"): NodeListOf; + getElementsByTagName(name: "cite"): NodeListOf; getElementsByTagName(name: "clippath"): NodeListOf; - getElementsByTagName(name: "code"): NodeListOf; + getElementsByTagName(name: "code"): NodeListOf; getElementsByTagName(name: "col"): NodeListOf; getElementsByTagName(name: "colgroup"): NodeListOf; getElementsByTagName(name: "datalist"): NodeListOf; - getElementsByTagName(name: "dd"): NodeListOf; + getElementsByTagName(name: "dd"): NodeListOf; getElementsByTagName(name: "defs"): NodeListOf; getElementsByTagName(name: "del"): NodeListOf; getElementsByTagName(name: "desc"): NodeListOf; - getElementsByTagName(name: "dfn"): NodeListOf; + getElementsByTagName(name: "dfn"): NodeListOf; getElementsByTagName(name: "dir"): NodeListOf; getElementsByTagName(name: "div"): NodeListOf; getElementsByTagName(name: "dl"): NodeListOf; - getElementsByTagName(name: "dt"): NodeListOf; + getElementsByTagName(name: "dt"): NodeListOf; getElementsByTagName(name: "ellipse"): NodeListOf; - getElementsByTagName(name: "em"): NodeListOf; + getElementsByTagName(name: "em"): NodeListOf; getElementsByTagName(name: "embed"): NodeListOf; getElementsByTagName(name: "feblend"): NodeListOf; getElementsByTagName(name: "fecolormatrix"): NodeListOf; @@ -6995,22 +7676,22 @@ interface Element extends Node, GlobalEventHandlers, ElementTraversal, NodeSelec getElementsByTagName(name: "hgroup"): NodeListOf; getElementsByTagName(name: "hr"): NodeListOf; getElementsByTagName(name: "html"): NodeListOf; - getElementsByTagName(name: "i"): NodeListOf; + getElementsByTagName(name: "i"): NodeListOf; getElementsByTagName(name: "iframe"): NodeListOf; getElementsByTagName(name: "image"): NodeListOf; getElementsByTagName(name: "img"): NodeListOf; getElementsByTagName(name: "input"): NodeListOf; getElementsByTagName(name: "ins"): NodeListOf; - getElementsByTagName(name: "isindex"): NodeListOf; - getElementsByTagName(name: "kbd"): NodeListOf; - getElementsByTagName(name: "keygen"): NodeListOf; + getElementsByTagName(name: "isindex"): NodeListOf; + getElementsByTagName(name: "kbd"): NodeListOf; + getElementsByTagName(name: "keygen"): NodeListOf; getElementsByTagName(name: "label"): NodeListOf; getElementsByTagName(name: "legend"): NodeListOf; getElementsByTagName(name: "li"): NodeListOf; getElementsByTagName(name: "line"): NodeListOf; getElementsByTagName(name: "lineargradient"): NodeListOf; getElementsByTagName(name: "link"): NodeListOf; - getElementsByTagName(name: "listing"): NodeListOf; + getElementsByTagName(name: "listing"): NodeListOf; getElementsByTagName(name: "map"): NodeListOf; getElementsByTagName(name: "mark"): NodeListOf; getElementsByTagName(name: "marker"): NodeListOf; @@ -7019,9 +7700,10 @@ interface Element extends Node, GlobalEventHandlers, ElementTraversal, NodeSelec getElementsByTagName(name: "menu"): NodeListOf; getElementsByTagName(name: "meta"): NodeListOf; getElementsByTagName(name: "metadata"): NodeListOf; + getElementsByTagName(name: "meter"): NodeListOf; getElementsByTagName(name: "nav"): NodeListOf; - getElementsByTagName(name: "nextid"): NodeListOf; - getElementsByTagName(name: "nobr"): NodeListOf; + getElementsByTagName(name: "nextid"): NodeListOf; + getElementsByTagName(name: "nobr"): NodeListOf; getElementsByTagName(name: "noframes"): NodeListOf; getElementsByTagName(name: "noscript"): NodeListOf; getElementsByTagName(name: "object"): NodeListOf; @@ -7032,7 +7714,8 @@ interface Element extends Node, GlobalEventHandlers, ElementTraversal, NodeSelec getElementsByTagName(name: "param"): NodeListOf; getElementsByTagName(name: "path"): NodeListOf; getElementsByTagName(name: "pattern"): NodeListOf; - getElementsByTagName(name: "plaintext"): NodeListOf; + getElementsByTagName(name: "picture"): NodeListOf; + getElementsByTagName(name: "plaintext"): NodeListOf; getElementsByTagName(name: "polygon"): NodeListOf; getElementsByTagName(name: "polyline"): NodeListOf; getElementsByTagName(name: "pre"): NodeListOf; @@ -7040,28 +7723,29 @@ interface Element extends Node, GlobalEventHandlers, ElementTraversal, NodeSelec getElementsByTagName(name: "q"): NodeListOf; getElementsByTagName(name: "radialgradient"): NodeListOf; getElementsByTagName(name: "rect"): NodeListOf; - getElementsByTagName(name: "rt"): NodeListOf; - getElementsByTagName(name: "ruby"): NodeListOf; - getElementsByTagName(name: "s"): NodeListOf; - getElementsByTagName(name: "samp"): NodeListOf; + getElementsByTagName(name: "rt"): NodeListOf; + getElementsByTagName(name: "ruby"): NodeListOf; + getElementsByTagName(name: "s"): NodeListOf; + getElementsByTagName(name: "samp"): NodeListOf; getElementsByTagName(name: "script"): NodeListOf; getElementsByTagName(name: "section"): NodeListOf; getElementsByTagName(name: "select"): NodeListOf; - getElementsByTagName(name: "small"): NodeListOf; + getElementsByTagName(name: "small"): NodeListOf; getElementsByTagName(name: "source"): NodeListOf; getElementsByTagName(name: "span"): NodeListOf; getElementsByTagName(name: "stop"): NodeListOf; - getElementsByTagName(name: "strike"): NodeListOf; - getElementsByTagName(name: "strong"): NodeListOf; + getElementsByTagName(name: "strike"): NodeListOf; + getElementsByTagName(name: "strong"): NodeListOf; getElementsByTagName(name: "style"): NodeListOf; - getElementsByTagName(name: "sub"): NodeListOf; - getElementsByTagName(name: "sup"): NodeListOf; + getElementsByTagName(name: "sub"): NodeListOf; + getElementsByTagName(name: "sup"): NodeListOf; getElementsByTagName(name: "svg"): NodeListOf; getElementsByTagName(name: "switch"): NodeListOf; getElementsByTagName(name: "symbol"): NodeListOf; getElementsByTagName(name: "table"): NodeListOf; getElementsByTagName(name: "tbody"): NodeListOf; getElementsByTagName(name: "td"): NodeListOf; + getElementsByTagName(name: "template"): NodeListOf; getElementsByTagName(name: "text"): NodeListOf; getElementsByTagName(name: "textpath"): NodeListOf; getElementsByTagName(name: "textarea"): NodeListOf; @@ -7072,16 +7756,16 @@ interface Element extends Node, GlobalEventHandlers, ElementTraversal, NodeSelec getElementsByTagName(name: "tr"): NodeListOf; getElementsByTagName(name: "track"): NodeListOf; getElementsByTagName(name: "tspan"): NodeListOf; - getElementsByTagName(name: "tt"): NodeListOf; - getElementsByTagName(name: "u"): NodeListOf; + getElementsByTagName(name: "tt"): NodeListOf; + getElementsByTagName(name: "u"): NodeListOf; getElementsByTagName(name: "ul"): NodeListOf; getElementsByTagName(name: "use"): NodeListOf; - getElementsByTagName(name: "var"): NodeListOf; + getElementsByTagName(name: "var"): NodeListOf; getElementsByTagName(name: "video"): NodeListOf; getElementsByTagName(name: "view"): NodeListOf; getElementsByTagName(name: "wbr"): NodeListOf; getElementsByTagName(name: "x-ms-webview"): NodeListOf; - getElementsByTagName(name: "xmp"): NodeListOf; + getElementsByTagName(name: "xmp"): NodeListOf; getElementsByTagName(name: string): NodeListOf; getElementsByTagNameNS(namespaceURI: string, localName: string): NodeListOf; hasAttribute(name: string): boolean; @@ -7154,11 +7838,11 @@ declare var Element: { } interface ErrorEvent extends Event { - colno: number; - error: any; - filename: string; - lineno: number; - message: string; + readonly colno: number; + readonly error: any; + readonly filename: string; + readonly lineno: number; + readonly message: string; initErrorEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, messageArg: string, filenameArg: string, linenoArg: number): void; } @@ -7168,39 +7852,39 @@ declare var ErrorEvent: { } interface Event { - bubbles: boolean; + readonly bubbles: boolean; cancelBubble: boolean; - cancelable: boolean; - currentTarget: EventTarget; - defaultPrevented: boolean; - eventPhase: number; - isTrusted: boolean; + readonly cancelable: boolean; + readonly currentTarget: EventTarget; + readonly defaultPrevented: boolean; + readonly eventPhase: number; + readonly isTrusted: boolean; returnValue: boolean; - srcElement: Element; - target: EventTarget; - timeStamp: number; - type: string; + readonly srcElement: Element; + readonly target: EventTarget; + readonly timeStamp: number; + readonly type: string; initEvent(eventTypeArg: string, canBubbleArg: boolean, cancelableArg: boolean): void; preventDefault(): void; stopImmediatePropagation(): void; stopPropagation(): void; - AT_TARGET: number; - BUBBLING_PHASE: number; - CAPTURING_PHASE: number; + readonly AT_TARGET: number; + readonly BUBBLING_PHASE: number; + readonly CAPTURING_PHASE: number; } declare var Event: { prototype: Event; new(type: string, eventInitDict?: EventInit): Event; - AT_TARGET: number; - BUBBLING_PHASE: number; - CAPTURING_PHASE: number; + readonly AT_TARGET: number; + readonly BUBBLING_PHASE: number; + readonly CAPTURING_PHASE: number; } interface EventTarget { - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; + addEventListener(type: string, listener?: EventListenerOrEventListenerObject, useCapture?: boolean): void; dispatchEvent(evt: Event): boolean; - removeEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; + removeEventListener(type: string, listener?: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var EventTarget: { @@ -7217,8 +7901,9 @@ declare var External: { } interface File extends Blob { - lastModifiedDate: any; - name: string; + readonly lastModifiedDate: any; + readonly name: string; + readonly webkitRelativePath: string; } declare var File: { @@ -7227,7 +7912,7 @@ declare var File: { } interface FileList { - length: number; + readonly length: number; item(index: number): File; [index: number]: File; } @@ -7238,7 +7923,7 @@ declare var FileList: { } interface FileReader extends EventTarget, MSBaseReader { - error: DOMError; + readonly error: DOMError; readAsArrayBuffer(blob: Blob): void; readAsBinaryString(blob: Blob): void; readAsDataURL(blob: Blob): void; @@ -7252,7 +7937,7 @@ declare var FileReader: { } interface FocusEvent extends UIEvent { - relatedTarget: EventTarget; + readonly relatedTarget: EventTarget; initFocusEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, relatedTargetArg: EventTarget): void; } @@ -7271,7 +7956,7 @@ declare var FormData: { } interface GainNode extends AudioNode { - gain: AudioParam; + readonly gain: AudioParam; } declare var GainNode: { @@ -7280,13 +7965,13 @@ declare var GainNode: { } interface Gamepad { - axes: number[]; - buttons: GamepadButton[]; - connected: boolean; - id: string; - index: number; - mapping: string; - timestamp: number; + readonly axes: number[]; + readonly buttons: GamepadButton[]; + readonly connected: boolean; + readonly id: string; + readonly index: number; + readonly mapping: string; + readonly timestamp: number; } declare var Gamepad: { @@ -7295,8 +7980,8 @@ declare var Gamepad: { } interface GamepadButton { - pressed: boolean; - value: number; + readonly pressed: boolean; + readonly value: number; } declare var GamepadButton: { @@ -7305,7 +7990,7 @@ declare var GamepadButton: { } interface GamepadEvent extends Event { - gamepad: Gamepad; + readonly gamepad: Gamepad; } declare var GamepadEvent: { @@ -7343,6 +8028,7 @@ interface HTMLAnchorElement extends HTMLElement { * Sets or retrieves the coordinates of the object. */ coords: string; + download: string; /** * Contains the anchor portion of the URL including the hash sign (#). */ @@ -7363,12 +8049,12 @@ interface HTMLAnchorElement extends HTMLElement { * Sets or retrieves the language code of the object. */ hreflang: string; - mimeType: string; + readonly mimeType: string; /** * Sets or retrieves the shape of the object. */ name: string; - nameProp: string; + readonly nameProp: string; /** * Contains the pathname of the URL. */ @@ -7381,7 +8067,7 @@ interface HTMLAnchorElement extends HTMLElement { * Contains the protocol of the URL. */ protocol: string; - protocolLong: string; + readonly protocolLong: string; /** * Sets or retrieves the relationship between the object and the destination of the link. */ @@ -7423,7 +8109,7 @@ interface HTMLAppletElement extends HTMLElement { /** * 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. */ - BaseHref: string; + readonly BaseHref: string; align: string; /** * Sets or retrieves a text alternative to the graphic. @@ -7450,7 +8136,7 @@ interface HTMLAppletElement extends HTMLElement { /** * Address of a pointer to the document this page or frame contains. If there is no document, then null will be returned. */ - contentDocument: Document; + readonly contentDocument: Document; /** * Sets or retrieves the URL that references the data of the object. */ @@ -7459,7 +8145,7 @@ interface HTMLAppletElement extends HTMLElement { * Sets or retrieves a character string that can be used to implement your own declare functionality for the object. */ declare: boolean; - form: HTMLFormElement; + readonly form: HTMLFormElement; /** * Sets or retrieves the height of the object. */ @@ -7500,6 +8186,7 @@ interface HTMLAreaElement extends HTMLElement { * Sets or retrieves the coordinates of the object. */ coords: string; + download: string; /** * Sets or retrieves the subsection of the href property that follows the number sign (#). */ @@ -7625,23 +8312,6 @@ declare var HTMLBaseFontElement: { new(): HTMLBaseFontElement; } -interface HTMLBlockElement extends HTMLElement { - /** - * Sets or retrieves reference information about the object. - */ - cite: string; - clear: string; - /** - * Sets or retrieves the width of the object. - */ - width: number; -} - -declare var HTMLBlockElement: { - prototype: HTMLBlockElement; - new(): HTMLBlockElement; -} - interface HTMLBodyElement extends HTMLElement { aLink: any; background: string; @@ -7669,7 +8339,6 @@ interface HTMLBodyElement extends HTMLElement { onunload: (ev: Event) => any; text: any; vLink: any; - createTextRange(): TextRange; addEventListener(type: "MSContentZoom", listener: (ev: UIEvent) => any, useCapture?: boolean): void; addEventListener(type: "MSGestureChange", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void; addEventListener(type: "MSGestureDoubleTap", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void; @@ -7694,10 +8363,10 @@ interface HTMLBodyElement extends HTMLElement { addEventListener(type: "afterprint", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "ariarequest", listener: (ev: AriaRequestEvent) => any, useCapture?: boolean): void; addEventListener(type: "beforeactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecopy", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecut", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforecopy", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforecut", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "beforedeactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforepaste", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforepaste", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "beforeprint", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "beforeunload", listener: (ev: BeforeUnloadEvent) => any, useCapture?: boolean): void; addEventListener(type: "blur", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; @@ -7708,9 +8377,9 @@ interface HTMLBodyElement extends HTMLElement { addEventListener(type: "click", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "command", listener: (ev: CommandEvent) => any, useCapture?: boolean): void; addEventListener(type: "contextmenu", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "copy", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "copy", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "cuechange", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "cut", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "cut", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "dblclick", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "deactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; addEventListener(type: "drag", listener: (ev: DragEvent) => any, useCapture?: boolean): void; @@ -7722,7 +8391,7 @@ interface HTMLBodyElement extends HTMLElement { addEventListener(type: "drop", listener: (ev: DragEvent) => any, useCapture?: boolean): void; addEventListener(type: "durationchange", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "emptied", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "ended", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "ended", listener: (ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: "focus", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; @@ -7730,6 +8399,7 @@ interface HTMLBodyElement extends HTMLElement { addEventListener(type: "gotpointercapture", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; addEventListener(type: "hashchange", listener: (ev: HashChangeEvent) => any, useCapture?: boolean): void; addEventListener(type: "input", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "invalid", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "keydown", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "keypress", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "keyup", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; @@ -7747,13 +8417,13 @@ interface HTMLBodyElement extends HTMLElement { addEventListener(type: "mouseout", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "mouseover", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "mouseup", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousewheel", listener: (ev: MouseWheelEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mousewheel", listener: (ev: WheelEvent) => any, useCapture?: boolean): void; addEventListener(type: "offline", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "online", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "orientationchange", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "pagehide", listener: (ev: PageTransitionEvent) => any, useCapture?: boolean): void; addEventListener(type: "pageshow", listener: (ev: PageTransitionEvent) => any, useCapture?: boolean): void; - addEventListener(type: "paste", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "paste", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "pause", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "play", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "playing", listener: (ev: Event) => any, useCapture?: boolean): void; @@ -7807,7 +8477,7 @@ interface HTMLButtonElement extends HTMLElement { /** * Retrieves a reference to the form that the object is embedded in. */ - form: HTMLFormElement; + readonly form: HTMLFormElement; /** * Overrides the action attribute (where the data on a form is sent) on the parent form element. */ @@ -7840,11 +8510,11 @@ interface HTMLButtonElement extends HTMLElement { /** * 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. */ - validationMessage: string; + readonly validationMessage: string; /** * Returns a ValidityState object that represents the validity states of an element. */ - validity: ValidityState; + readonly validity: ValidityState; /** * Sets or retrieves the default or selected value of the control. */ @@ -7852,15 +8522,11 @@ interface HTMLButtonElement extends HTMLElement { /** * Returns whether an element will successfully validate based on forms validation rules and constraints. */ - willValidate: boolean; + readonly willValidate: boolean; /** * Returns whether a form will validate when it is submitted, without having to submit it. */ checkValidity(): boolean; - /** - * Creates a TextRange object for the element. - */ - createTextRange(): TextRange; /** * Sets a custom error message that is displayed when a form is submitted. * @param error Sets a custom error message that is displayed when a form is submitted. @@ -7910,11 +8576,11 @@ interface HTMLCollection { /** * Sets or retrieves the number of objects in a collection. */ - length: number; + readonly length: number; /** * Retrieves an object from various collections. */ - item(nameOrIndex?: any, optionalIndex?: any): Element; + item(index: number): Element; /** * Retrieves a select object or an object from an options collection. */ @@ -7927,18 +8593,6 @@ declare var HTMLCollection: { new(): HTMLCollection; } -interface HTMLDDElement extends HTMLElement { - /** - * Sets or retrieves whether the browser automatically performs wordwrap. - */ - noWrap: boolean; -} - -declare var HTMLDDElement: { - prototype: HTMLDDElement; - new(): HTMLDDElement; -} - interface HTMLDListElement extends HTMLElement { compact: boolean; } @@ -7948,20 +8602,8 @@ declare var HTMLDListElement: { new(): HTMLDListElement; } -interface HTMLDTElement extends HTMLElement { - /** - * Sets or retrieves whether the browser automatically performs wordwrap. - */ - noWrap: boolean; -} - -declare var HTMLDTElement: { - prototype: HTMLDTElement; - new(): HTMLDTElement; -} - interface HTMLDataListElement extends HTMLElement { - options: HTMLCollection; + options: HTMLCollectionOf; } declare var HTMLDataListElement: { @@ -8004,38 +8646,38 @@ declare var HTMLDocument: { interface HTMLElement extends Element { accessKey: string; - children: HTMLCollection; + readonly children: HTMLCollection; contentEditable: string; - dataset: DOMStringMap; + readonly dataset: DOMStringMap; dir: string; draggable: boolean; hidden: boolean; hideFocus: boolean; innerHTML: string; innerText: string; - isContentEditable: boolean; + readonly isContentEditable: boolean; lang: string; - offsetHeight: number; - offsetLeft: number; - offsetParent: Element; - offsetTop: number; - offsetWidth: number; + readonly offsetHeight: number; + readonly offsetLeft: number; + readonly offsetParent: Element; + readonly offsetTop: number; + readonly offsetWidth: number; onabort: (ev: Event) => any; onactivate: (ev: UIEvent) => any; onbeforeactivate: (ev: UIEvent) => any; - onbeforecopy: (ev: DragEvent) => any; - onbeforecut: (ev: DragEvent) => any; + onbeforecopy: (ev: ClipboardEvent) => any; + onbeforecut: (ev: ClipboardEvent) => any; onbeforedeactivate: (ev: UIEvent) => any; - onbeforepaste: (ev: DragEvent) => any; + onbeforepaste: (ev: ClipboardEvent) => any; onblur: (ev: FocusEvent) => any; oncanplay: (ev: Event) => any; oncanplaythrough: (ev: Event) => any; onchange: (ev: Event) => any; onclick: (ev: MouseEvent) => any; oncontextmenu: (ev: PointerEvent) => any; - oncopy: (ev: DragEvent) => any; + oncopy: (ev: ClipboardEvent) => any; oncuechange: (ev: Event) => any; - oncut: (ev: DragEvent) => any; + oncut: (ev: ClipboardEvent) => any; ondblclick: (ev: MouseEvent) => any; ondeactivate: (ev: UIEvent) => any; ondrag: (ev: DragEvent) => any; @@ -8047,10 +8689,11 @@ interface HTMLElement extends Element { ondrop: (ev: DragEvent) => any; ondurationchange: (ev: Event) => any; onemptied: (ev: Event) => any; - onended: (ev: Event) => any; + onended: (ev: MediaStreamErrorEvent) => any; onerror: (ev: Event) => any; onfocus: (ev: FocusEvent) => any; oninput: (ev: Event) => any; + oninvalid: (ev: Event) => any; onkeydown: (ev: KeyboardEvent) => any; onkeypress: (ev: KeyboardEvent) => any; onkeyup: (ev: KeyboardEvent) => any; @@ -8065,10 +8708,10 @@ interface HTMLElement extends Element { onmouseout: (ev: MouseEvent) => any; onmouseover: (ev: MouseEvent) => any; onmouseup: (ev: MouseEvent) => any; - onmousewheel: (ev: MouseWheelEvent) => any; + onmousewheel: (ev: WheelEvent) => any; onmscontentzoom: (ev: UIEvent) => any; onmsmanipulationstatechanged: (ev: MSManipulationEvent) => any; - onpaste: (ev: DragEvent) => any; + onpaste: (ev: ClipboardEvent) => any; onpause: (ev: Event) => any; onplay: (ev: Event) => any; onplaying: (ev: Event) => any; @@ -8089,7 +8732,7 @@ interface HTMLElement extends Element { outerHTML: string; outerText: string; spellcheck: boolean; - style: CSSStyleDeclaration; + readonly style: CSSStyleDeclaration; tabIndex: number; title: string; blur(): void; @@ -8125,10 +8768,10 @@ interface HTMLElement extends Element { addEventListener(type: "activate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; addEventListener(type: "ariarequest", listener: (ev: AriaRequestEvent) => any, useCapture?: boolean): void; addEventListener(type: "beforeactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecopy", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecut", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforecopy", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforecut", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "beforedeactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforepaste", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforepaste", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "blur", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; addEventListener(type: "canplay", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "canplaythrough", listener: (ev: Event) => any, useCapture?: boolean): void; @@ -8136,9 +8779,9 @@ interface HTMLElement extends Element { addEventListener(type: "click", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "command", listener: (ev: CommandEvent) => any, useCapture?: boolean): void; addEventListener(type: "contextmenu", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "copy", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "copy", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "cuechange", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "cut", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "cut", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "dblclick", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "deactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; addEventListener(type: "drag", listener: (ev: DragEvent) => any, useCapture?: boolean): void; @@ -8150,11 +8793,12 @@ interface HTMLElement extends Element { addEventListener(type: "drop", listener: (ev: DragEvent) => any, useCapture?: boolean): void; addEventListener(type: "durationchange", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "emptied", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "ended", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "ended", listener: (ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: "focus", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; addEventListener(type: "gotpointercapture", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; addEventListener(type: "input", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "invalid", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "keydown", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "keypress", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "keyup", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; @@ -8170,8 +8814,8 @@ interface HTMLElement extends Element { addEventListener(type: "mouseout", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "mouseover", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "mouseup", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousewheel", listener: (ev: MouseWheelEvent) => any, useCapture?: boolean): void; - addEventListener(type: "paste", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mousewheel", listener: (ev: WheelEvent) => any, useCapture?: boolean): void; + addEventListener(type: "paste", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "pause", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "play", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "playing", listener: (ev: Event) => any, useCapture?: boolean): void; @@ -8233,7 +8877,7 @@ interface HTMLEmbedElement extends HTMLElement, GetSVGDocument { /** * Gets the source associated with the media element for use by the PlayToManager. */ - msPlayToSource: any; + readonly msPlayToSource: any; /** * Sets or retrieves the name of the object. */ @@ -8241,12 +8885,12 @@ interface HTMLEmbedElement extends HTMLElement, GetSVGDocument { /** * Retrieves the palette used for the embedded document. */ - palette: string; + readonly palette: string; /** * Retrieves the URL of the plug-in used to view an embedded document. */ - pluginspage: string; - readyState: string; + readonly pluginspage: string; + readonly readyState: string; /** * Sets or retrieves a URL to be loaded by the object. */ @@ -8276,19 +8920,19 @@ interface HTMLFieldSetElement extends HTMLElement { /** * Retrieves a reference to the form that the object is embedded in. */ - form: HTMLFormElement; + readonly form: HTMLFormElement; /** * 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. */ - validationMessage: string; + readonly validationMessage: string; /** * Returns a ValidityState object that represents the validity states of an element. */ - validity: ValidityState; + readonly validity: ValidityState; /** * Returns whether an element will successfully validate based on forms validation rules and constraints. */ - willValidate: boolean; + readonly willValidate: boolean; /** * Returns whether a form will validate when it is submitted, without having to submit it. */ @@ -8334,7 +8978,7 @@ interface HTMLFormElement extends HTMLElement { /** * Retrieves a collection, in source order, of all controls in a given form. */ - elements: HTMLCollection; + readonly elements: HTMLCollection; /** * Sets or retrieves the MIME encoding for the form. */ @@ -8346,7 +8990,7 @@ interface HTMLFormElement extends HTMLElement { /** * Sets or retrieves the number of objects in a collection. */ - length: number; + readonly length: number; /** * Sets or retrieves how to send the form data to the server. */ @@ -8405,11 +9049,11 @@ interface HTMLFrameElement extends HTMLElement, GetSVGDocument { /** * Retrieves the document object of the page or frame. */ - contentDocument: Document; + readonly contentDocument: Document; /** * Retrieves the object of the specified. */ - contentWindow: Window; + readonly contentWindow: Window; /** * Sets or retrieves whether to display a border for the frame. */ @@ -8450,10 +9094,6 @@ interface HTMLFrameElement extends HTMLElement, GetSVGDocument { * Sets or retrieves whether the frame can be scrolled. */ scrolling: string; - /** - * Sets the value indicating whether the source file of a frame or iframe has specific security restrictions applied. - */ - security: any; /** * Sets or retrieves a URL to be loaded by the object. */ @@ -8485,10 +9125,10 @@ interface HTMLFrameElement extends HTMLElement, GetSVGDocument { addEventListener(type: "activate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; addEventListener(type: "ariarequest", listener: (ev: AriaRequestEvent) => any, useCapture?: boolean): void; addEventListener(type: "beforeactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecopy", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecut", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforecopy", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforecut", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "beforedeactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforepaste", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforepaste", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "blur", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; addEventListener(type: "canplay", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "canplaythrough", listener: (ev: Event) => any, useCapture?: boolean): void; @@ -8496,9 +9136,9 @@ interface HTMLFrameElement extends HTMLElement, GetSVGDocument { addEventListener(type: "click", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "command", listener: (ev: CommandEvent) => any, useCapture?: boolean): void; addEventListener(type: "contextmenu", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "copy", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "copy", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "cuechange", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "cut", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "cut", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "dblclick", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "deactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; addEventListener(type: "drag", listener: (ev: DragEvent) => any, useCapture?: boolean): void; @@ -8510,11 +9150,12 @@ interface HTMLFrameElement extends HTMLElement, GetSVGDocument { addEventListener(type: "drop", listener: (ev: DragEvent) => any, useCapture?: boolean): void; addEventListener(type: "durationchange", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "emptied", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "ended", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "ended", listener: (ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: "focus", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; addEventListener(type: "gotpointercapture", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; addEventListener(type: "input", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "invalid", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "keydown", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "keypress", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "keyup", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; @@ -8531,8 +9172,8 @@ interface HTMLFrameElement extends HTMLElement, GetSVGDocument { addEventListener(type: "mouseout", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "mouseover", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "mouseup", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousewheel", listener: (ev: MouseWheelEvent) => any, useCapture?: boolean): void; - addEventListener(type: "paste", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mousewheel", listener: (ev: WheelEvent) => any, useCapture?: boolean): void; + addEventListener(type: "paste", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "pause", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "play", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "playing", listener: (ev: Event) => any, useCapture?: boolean): void; @@ -8642,10 +9283,10 @@ interface HTMLFrameSetElement extends HTMLElement { addEventListener(type: "activate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; addEventListener(type: "ariarequest", listener: (ev: AriaRequestEvent) => any, useCapture?: boolean): void; addEventListener(type: "beforeactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecopy", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecut", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforecopy", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforecut", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "beforedeactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforepaste", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforepaste", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "beforeprint", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "beforeunload", listener: (ev: BeforeUnloadEvent) => any, useCapture?: boolean): void; addEventListener(type: "blur", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; @@ -8656,9 +9297,9 @@ interface HTMLFrameSetElement extends HTMLElement { addEventListener(type: "click", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "command", listener: (ev: CommandEvent) => any, useCapture?: boolean): void; addEventListener(type: "contextmenu", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "copy", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "copy", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "cuechange", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "cut", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "cut", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "dblclick", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "deactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; addEventListener(type: "drag", listener: (ev: DragEvent) => any, useCapture?: boolean): void; @@ -8670,7 +9311,7 @@ interface HTMLFrameSetElement extends HTMLElement { addEventListener(type: "drop", listener: (ev: DragEvent) => any, useCapture?: boolean): void; addEventListener(type: "durationchange", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "emptied", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "ended", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "ended", listener: (ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: "focus", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; @@ -8678,6 +9319,7 @@ interface HTMLFrameSetElement extends HTMLElement { addEventListener(type: "gotpointercapture", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; addEventListener(type: "hashchange", listener: (ev: HashChangeEvent) => any, useCapture?: boolean): void; addEventListener(type: "input", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "invalid", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "keydown", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "keypress", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "keyup", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; @@ -8695,13 +9337,13 @@ interface HTMLFrameSetElement extends HTMLElement { addEventListener(type: "mouseout", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "mouseover", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "mouseup", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousewheel", listener: (ev: MouseWheelEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mousewheel", listener: (ev: WheelEvent) => any, useCapture?: boolean): void; addEventListener(type: "offline", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "online", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "orientationchange", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "pagehide", listener: (ev: PageTransitionEvent) => any, useCapture?: boolean): void; addEventListener(type: "pageshow", listener: (ev: PageTransitionEvent) => any, useCapture?: boolean): void; - addEventListener(type: "paste", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "paste", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "pause", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "play", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "playing", listener: (ev: Event) => any, useCapture?: boolean): void; @@ -8780,7 +9422,6 @@ interface HTMLHeadingElement extends HTMLElement { * Sets or retrieves a value that indicates the table alignment. */ align: string; - clear: string; } declare var HTMLHeadingElement: { @@ -8813,11 +9454,11 @@ interface HTMLIFrameElement extends HTMLElement, GetSVGDocument { /** * Retrieves the document object of the page or frame. */ - contentDocument: Document; + readonly contentDocument: Document; /** * Retrieves the object of the specified. */ - contentWindow: Window; + readonly contentWindow: Window; /** * Sets or retrieves whether to display a border for the frame. */ @@ -8858,15 +9499,11 @@ interface HTMLIFrameElement extends HTMLElement, GetSVGDocument { * Raised when the object has been completely received from the server. */ onload: (ev: Event) => any; - sandbox: DOMSettableTokenList; + readonly sandbox: DOMSettableTokenList; /** * Sets or retrieves whether the frame can be scrolled. */ scrolling: string; - /** - * Sets the value indicating whether the source file of a frame or iframe has specific security restrictions applied. - */ - security: any; /** * Sets or retrieves a URL to be loaded by the object. */ @@ -8902,10 +9539,10 @@ interface HTMLIFrameElement extends HTMLElement, GetSVGDocument { addEventListener(type: "activate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; addEventListener(type: "ariarequest", listener: (ev: AriaRequestEvent) => any, useCapture?: boolean): void; addEventListener(type: "beforeactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecopy", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecut", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforecopy", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforecut", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "beforedeactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforepaste", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforepaste", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "blur", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; addEventListener(type: "canplay", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "canplaythrough", listener: (ev: Event) => any, useCapture?: boolean): void; @@ -8913,9 +9550,9 @@ interface HTMLIFrameElement extends HTMLElement, GetSVGDocument { addEventListener(type: "click", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "command", listener: (ev: CommandEvent) => any, useCapture?: boolean): void; addEventListener(type: "contextmenu", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "copy", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "copy", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "cuechange", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "cut", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "cut", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "dblclick", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "deactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; addEventListener(type: "drag", listener: (ev: DragEvent) => any, useCapture?: boolean): void; @@ -8927,11 +9564,12 @@ interface HTMLIFrameElement extends HTMLElement, GetSVGDocument { addEventListener(type: "drop", listener: (ev: DragEvent) => any, useCapture?: boolean): void; addEventListener(type: "durationchange", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "emptied", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "ended", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "ended", listener: (ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: "focus", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; addEventListener(type: "gotpointercapture", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; addEventListener(type: "input", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "invalid", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "keydown", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "keypress", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "keyup", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; @@ -8948,8 +9586,8 @@ interface HTMLIFrameElement extends HTMLElement, GetSVGDocument { addEventListener(type: "mouseout", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "mouseover", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "mouseup", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousewheel", listener: (ev: MouseWheelEvent) => any, useCapture?: boolean): void; - addEventListener(type: "paste", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mousewheel", listener: (ev: WheelEvent) => any, useCapture?: boolean): void; + addEventListener(type: "paste", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "pause", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "play", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "playing", listener: (ev: Event) => any, useCapture?: boolean): void; @@ -9006,9 +9644,9 @@ interface HTMLImageElement extends HTMLElement { /** * Retrieves whether the object is fully loaded. */ - complete: boolean; + readonly complete: boolean; crossOrigin: string; - currentSrc: string; + readonly currentSrc: string; /** * Sets or retrieves the height of the object. */ @@ -9025,6 +9663,7 @@ interface HTMLImageElement extends HTMLElement { * Sets or retrieves a Uniform Resource Identifier (URI) to a long description of the object. */ longDesc: string; + lowsrc: string; /** * Gets or sets whether the DLNA PlayTo device is available. */ @@ -9037,7 +9676,7 @@ interface HTMLImageElement extends HTMLElement { /** * Gets the source associated with the media element for use by the PlayToManager. */ - msPlayToSource: any; + readonly msPlayToSource: any; /** * Sets or retrieves the name of the object. */ @@ -9045,11 +9684,12 @@ interface HTMLImageElement extends HTMLElement { /** * The original height of the image resource before sizing. */ - naturalHeight: number; + readonly naturalHeight: number; /** * The original width of the image resource before sizing. */ - naturalWidth: number; + readonly naturalWidth: number; + sizes: string; /** * The address or URL of the a media resource that is to be considered. */ @@ -9067,8 +9707,8 @@ interface HTMLImageElement extends HTMLElement { * Sets or retrieves the width of the object. */ width: number; - x: number; - y: number; + readonly x: number; + readonly y: number; msGetAsCastingSource(): any; } @@ -9110,7 +9750,7 @@ interface HTMLInputElement extends HTMLElement { /** * Retrieves whether the object is fully loaded. */ - complete: boolean; + readonly complete: boolean; /** * Sets or retrieves the state of the check box or radio button. */ @@ -9123,11 +9763,11 @@ interface HTMLInputElement extends HTMLElement { /** * Returns a FileList object on a file type input object. */ - files: FileList; + readonly files: FileList; /** * Retrieves a reference to the form that the object is embedded in. */ - form: HTMLFormElement; + readonly form: HTMLFormElement; /** * Overrides the action attribute (where the data on a form is sent) on the parent form element. */ @@ -9160,7 +9800,7 @@ interface HTMLInputElement extends HTMLElement { /** * Specifies the ID of a pre-defined datalist of options for an input element. */ - list: HTMLElement; + readonly list: HTMLElement; /** * 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. */ @@ -9194,6 +9834,7 @@ interface HTMLInputElement extends HTMLElement { * When present, marks an element that can't be submitted without a value. */ required: boolean; + selectionDirection: string; /** * Gets or sets the end position or offset of a text selection. */ @@ -9223,11 +9864,11 @@ interface HTMLInputElement extends HTMLElement { /** * 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. */ - validationMessage: string; + readonly validationMessage: string; /** * Returns a ValidityState object that represents the validity states of an element. */ - validity: ValidityState; + readonly validity: ValidityState; /** * Returns the value of the data at the cursor's current position. */ @@ -9241,6 +9882,7 @@ interface HTMLInputElement extends HTMLElement { * Sets or retrieves the vertical margin for the object. */ vspace: number; + webkitdirectory: boolean; /** * Sets or retrieves the width of the object. */ @@ -9248,15 +9890,12 @@ interface HTMLInputElement extends HTMLElement { /** * Returns whether an element will successfully validate based on forms validation rules and constraints. */ - willValidate: boolean; + readonly willValidate: boolean; + minLength: number; /** * Returns whether a form will validate when it is submitted, without having to submit it. */ checkValidity(): boolean; - /** - * Creates a TextRange object for the element. - */ - createTextRange(): TextRange; /** * Makes the selection equal to the current object. */ @@ -9271,7 +9910,7 @@ interface HTMLInputElement extends HTMLElement { * @param start The offset into the text field for the start of the selection. * @param end The offset into the text field for the end of the selection. */ - setSelectionRange(start: number, end: number): void; + setSelectionRange(start?: number, end?: number, direction?: string): void; /** * 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. * @param n Value to decrement the value by. @@ -9289,23 +9928,6 @@ declare var HTMLInputElement: { new(): HTMLInputElement; } -interface HTMLIsIndexElement extends HTMLElement { - /** - * Sets or retrieves the URL to which the form content is sent for processing. - */ - action: string; - /** - * Retrieves a reference to the form that the object is embedded in. - */ - form: HTMLFormElement; - prompt: string; -} - -declare var HTMLIsIndexElement: { - prototype: HTMLIsIndexElement; - new(): HTMLIsIndexElement; -} - interface HTMLLIElement extends HTMLElement { type: string; /** @@ -9323,7 +9945,7 @@ interface HTMLLabelElement extends HTMLElement { /** * Retrieves a reference to the form that the object is embedded in. */ - form: HTMLFormElement; + readonly form: HTMLFormElement; /** * Sets or retrieves the object to which the given label object is assigned. */ @@ -9343,7 +9965,7 @@ interface HTMLLegendElement extends HTMLElement { /** * Retrieves a reference to the form that the object is embedded in. */ - form: HTMLFormElement; + readonly form: HTMLFormElement; } declare var HTMLLegendElement: { @@ -9385,6 +10007,7 @@ interface HTMLLinkElement extends HTMLElement, LinkStyle { * Sets or retrieves the MIME type of the object. */ type: string; + import?: Document; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -9397,7 +10020,7 @@ interface HTMLMapElement extends HTMLElement { /** * Retrieves a collection of the area objects defined for the given map object. */ - areas: HTMLAreasCollection; + readonly areas: HTMLAreasCollection; /** * Sets or retrieves the name of the object. */ @@ -9449,10 +10072,10 @@ interface HTMLMarqueeElement extends HTMLElement { addEventListener(type: "activate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; addEventListener(type: "ariarequest", listener: (ev: AriaRequestEvent) => any, useCapture?: boolean): void; addEventListener(type: "beforeactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecopy", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecut", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforecopy", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforecut", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "beforedeactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforepaste", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforepaste", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "blur", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; addEventListener(type: "bounce", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "canplay", listener: (ev: Event) => any, useCapture?: boolean): void; @@ -9461,9 +10084,9 @@ interface HTMLMarqueeElement extends HTMLElement { addEventListener(type: "click", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "command", listener: (ev: CommandEvent) => any, useCapture?: boolean): void; addEventListener(type: "contextmenu", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "copy", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "copy", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "cuechange", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "cut", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "cut", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "dblclick", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "deactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; addEventListener(type: "drag", listener: (ev: DragEvent) => any, useCapture?: boolean): void; @@ -9475,12 +10098,13 @@ interface HTMLMarqueeElement extends HTMLElement { addEventListener(type: "drop", listener: (ev: DragEvent) => any, useCapture?: boolean): void; addEventListener(type: "durationchange", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "emptied", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "ended", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "ended", listener: (ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: "finish", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "focus", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; addEventListener(type: "gotpointercapture", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; addEventListener(type: "input", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "invalid", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "keydown", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "keypress", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "keyup", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; @@ -9496,8 +10120,8 @@ interface HTMLMarqueeElement extends HTMLElement { addEventListener(type: "mouseout", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "mouseover", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "mouseup", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousewheel", listener: (ev: MouseWheelEvent) => any, useCapture?: boolean): void; - addEventListener(type: "paste", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mousewheel", listener: (ev: WheelEvent) => any, useCapture?: boolean): void; + addEventListener(type: "paste", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "pause", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "play", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "playing", listener: (ev: Event) => any, useCapture?: boolean): void; @@ -9543,7 +10167,7 @@ interface HTMLMediaElement extends HTMLElement { /** * Returns an AudioTrackList object with the audio tracks for a given video element. */ - audioTracks: AudioTrackList; + readonly audioTracks: AudioTrackList; /** * Gets or sets a value that indicates whether to start playing the media automatically. */ @@ -9551,15 +10175,16 @@ interface HTMLMediaElement extends HTMLElement { /** * Gets a collection of buffered time ranges. */ - buffered: TimeRanges; + readonly buffered: TimeRanges; /** * 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). */ controls: boolean; + crossOrigin: string; /** * Gets the address or URL of the current media resource that is selected by IHTMLMediaElement. */ - currentSrc: string; + readonly currentSrc: string; /** * Gets or sets the current playback position, in seconds. */ @@ -9572,19 +10197,20 @@ interface HTMLMediaElement extends HTMLElement { /** * 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. */ - duration: number; + readonly duration: number; /** * Gets information about whether the playback has ended or not. */ - ended: boolean; + readonly ended: boolean; /** * Returns an object representing the current error state of the audio or video element. */ - error: MediaError; + readonly error: MediaError; /** * Gets or sets a flag to specify whether playback should restart after it completes. */ loop: boolean; + readonly mediaKeys: MediaKeys; /** * Specifies the purpose of the audio or video media, such as background audio or alerts. */ @@ -9593,11 +10219,11 @@ interface HTMLMediaElement extends HTMLElement { * Specifies the output device id that the audio will be sent to. */ msAudioDeviceType: string; - msGraphicsTrustStatus: MSGraphicsTrust; + readonly msGraphicsTrustStatus: MSGraphicsTrust; /** * Gets the MSMediaKeys object, which is used for decrypting media data, that is associated with this media element. */ - msKeys: MSMediaKeys; + readonly msKeys: MSMediaKeys; /** * Gets or sets whether the DLNA PlayTo device is available. */ @@ -9613,7 +10239,7 @@ interface HTMLMediaElement extends HTMLElement { /** * Gets the source associated with the media element for use by the PlayToManager. */ - msPlayToSource: any; + readonly msPlayToSource: any; /** * Specifies whether or not to enable low-latency playback on the media element. */ @@ -9625,12 +10251,13 @@ interface HTMLMediaElement extends HTMLElement { /** * Gets the current network activity for the element. */ - networkState: number; + readonly networkState: number; + onencrypted: (ev: MediaEncryptedEvent) => any; onmsneedkey: (ev: MSMediaKeyNeededEvent) => any; /** * Gets a flag that specifies whether playback is paused. */ - paused: boolean; + readonly paused: boolean; /** * 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. */ @@ -9638,7 +10265,7 @@ interface HTMLMediaElement extends HTMLElement { /** * Gets TimeRanges for the current media resource that has been played. */ - played: TimeRanges; + readonly played: TimeRanges; /** * Gets or sets the current playback position, in seconds. */ @@ -9647,17 +10274,18 @@ interface HTMLMediaElement extends HTMLElement { /** * Returns a TimeRanges object that represents the ranges of the current media resource that can be seeked. */ - seekable: TimeRanges; + readonly seekable: TimeRanges; /** * Gets a flag that indicates whether the the client is currently moving to a new playback position in the media resource. */ - seeking: boolean; + readonly seeking: boolean; /** * The address or URL of the a media resource that is to be considered. */ src: string; - textTracks: TextTrackList; - videoTracks: VideoTrackList; + srcObject: MediaStream; + readonly textTracks: TextTrackList; + readonly videoTracks: VideoTrackList; /** * Gets or sets the volume level for audio portions of the media element. */ @@ -9693,15 +10321,16 @@ interface HTMLMediaElement extends HTMLElement { * Loads and starts playback of a media resource. */ play(): void; - HAVE_CURRENT_DATA: number; - HAVE_ENOUGH_DATA: number; - HAVE_FUTURE_DATA: number; - HAVE_METADATA: number; - HAVE_NOTHING: number; - NETWORK_EMPTY: number; - NETWORK_IDLE: number; - NETWORK_LOADING: number; - NETWORK_NO_SOURCE: number; + setMediaKeys(mediaKeys: MediaKeys): PromiseLike; + readonly HAVE_CURRENT_DATA: number; + readonly HAVE_ENOUGH_DATA: number; + readonly HAVE_FUTURE_DATA: number; + readonly HAVE_METADATA: number; + readonly HAVE_NOTHING: number; + readonly NETWORK_EMPTY: number; + readonly NETWORK_IDLE: number; + readonly NETWORK_LOADING: number; + readonly NETWORK_NO_SOURCE: number; addEventListener(type: "MSContentZoom", listener: (ev: UIEvent) => any, useCapture?: boolean): void; addEventListener(type: "MSGestureChange", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void; addEventListener(type: "MSGestureDoubleTap", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void; @@ -9725,10 +10354,10 @@ interface HTMLMediaElement extends HTMLElement { addEventListener(type: "activate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; addEventListener(type: "ariarequest", listener: (ev: AriaRequestEvent) => any, useCapture?: boolean): void; addEventListener(type: "beforeactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecopy", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecut", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforecopy", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforecut", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "beforedeactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforepaste", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforepaste", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "blur", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; addEventListener(type: "canplay", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "canplaythrough", listener: (ev: Event) => any, useCapture?: boolean): void; @@ -9736,9 +10365,9 @@ interface HTMLMediaElement extends HTMLElement { addEventListener(type: "click", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "command", listener: (ev: CommandEvent) => any, useCapture?: boolean): void; addEventListener(type: "contextmenu", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "copy", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "copy", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "cuechange", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "cut", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "cut", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "dblclick", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "deactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; addEventListener(type: "drag", listener: (ev: DragEvent) => any, useCapture?: boolean): void; @@ -9750,11 +10379,13 @@ interface HTMLMediaElement extends HTMLElement { addEventListener(type: "drop", listener: (ev: DragEvent) => any, useCapture?: boolean): void; addEventListener(type: "durationchange", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "emptied", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "ended", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "encrypted", listener: (ev: MediaEncryptedEvent) => any, useCapture?: boolean): void; + addEventListener(type: "ended", listener: (ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: "focus", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; addEventListener(type: "gotpointercapture", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; addEventListener(type: "input", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "invalid", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "keydown", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "keypress", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "keyup", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; @@ -9770,9 +10401,9 @@ interface HTMLMediaElement extends HTMLElement { addEventListener(type: "mouseout", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "mouseover", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "mouseup", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousewheel", listener: (ev: MouseWheelEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mousewheel", listener: (ev: WheelEvent) => any, useCapture?: boolean): void; addEventListener(type: "msneedkey", listener: (ev: MSMediaKeyNeededEvent) => any, useCapture?: boolean): void; - addEventListener(type: "paste", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "paste", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "pause", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "play", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "playing", listener: (ev: Event) => any, useCapture?: boolean): void; @@ -9811,15 +10442,15 @@ interface HTMLMediaElement extends HTMLElement { declare var HTMLMediaElement: { prototype: HTMLMediaElement; new(): HTMLMediaElement; - HAVE_CURRENT_DATA: number; - HAVE_ENOUGH_DATA: number; - HAVE_FUTURE_DATA: number; - HAVE_METADATA: number; - HAVE_NOTHING: number; - NETWORK_EMPTY: number; - NETWORK_IDLE: number; - NETWORK_LOADING: number; - NETWORK_NO_SOURCE: number; + readonly HAVE_CURRENT_DATA: number; + readonly HAVE_ENOUGH_DATA: number; + readonly HAVE_FUTURE_DATA: number; + readonly HAVE_METADATA: number; + readonly HAVE_NOTHING: number; + readonly NETWORK_EMPTY: number; + readonly NETWORK_IDLE: number; + readonly NETWORK_LOADING: number; + readonly NETWORK_NO_SOURCE: number; } interface HTMLMenuElement extends HTMLElement { @@ -9864,6 +10495,20 @@ declare var HTMLMetaElement: { new(): HTMLMetaElement; } +interface HTMLMeterElement extends HTMLElement { + high: number; + low: number; + max: number; + min: number; + optimum: number; + value: number; +} + +declare var HTMLMeterElement: { + prototype: HTMLMeterElement; + new(): HTMLMeterElement; +} + interface HTMLModElement extends HTMLElement { /** * Sets or retrieves reference information about the object. @@ -9880,15 +10525,6 @@ declare var HTMLModElement: { new(): HTMLModElement; } -interface HTMLNextIdElement extends HTMLElement { - n: string; -} - -declare var HTMLNextIdElement: { - prototype: HTMLNextIdElement; - new(): HTMLNextIdElement; -} - interface HTMLOListElement extends HTMLElement { compact: boolean; /** @@ -9907,7 +10543,7 @@ interface HTMLObjectElement extends HTMLElement, GetSVGDocument { /** * 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. */ - BaseHref: string; + readonly BaseHref: string; align: string; /** * Sets or retrieves a text alternative to the graphic. @@ -9937,7 +10573,7 @@ interface HTMLObjectElement extends HTMLElement, GetSVGDocument { /** * Retrieves the document object of the page or frame. */ - contentDocument: Document; + readonly contentDocument: Document; /** * Sets or retrieves the URL that references the data of the object. */ @@ -9946,7 +10582,7 @@ interface HTMLObjectElement extends HTMLElement, GetSVGDocument { /** * Retrieves a reference to the form that the object is embedded in. */ - form: HTMLFormElement; + readonly form: HTMLFormElement; /** * Sets or retrieves the height of the object. */ @@ -9967,7 +10603,7 @@ interface HTMLObjectElement extends HTMLElement, GetSVGDocument { /** * Gets the source associated with the media element for use by the PlayToManager. */ - msPlayToSource: any; + readonly msPlayToSource: any; /** * Sets or retrieves the name of the object. */ @@ -9975,8 +10611,8 @@ interface HTMLObjectElement extends HTMLElement, GetSVGDocument { /** * Retrieves the contained object. */ - object: any; - readyState: number; + readonly object: any; + readonly readyState: number; /** * Sets or retrieves a message to be displayed while an object is loading. */ @@ -9992,11 +10628,11 @@ interface HTMLObjectElement extends HTMLElement, GetSVGDocument { /** * 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. */ - validationMessage: string; + readonly validationMessage: string; /** * Returns a ValidityState object that represents the validity states of an element. */ - validity: ValidityState; + readonly validity: ValidityState; vspace: number; /** * Sets or retrieves the width of the object. @@ -10005,7 +10641,7 @@ interface HTMLObjectElement extends HTMLElement, GetSVGDocument { /** * Returns whether an element will successfully validate based on forms validation rules and constraints. */ - willValidate: boolean; + readonly willValidate: boolean; /** * Returns whether a form will validate when it is submitted, without having to submit it. */ @@ -10032,11 +10668,11 @@ interface HTMLOptGroupElement extends HTMLElement { /** * Retrieves a reference to the form that the object is embedded in. */ - form: HTMLFormElement; + readonly form: HTMLFormElement; /** * Sets or retrieves the ordinal position of an option in a list box. */ - index: number; + readonly index: number; /** * Sets or retrieves a value that you can use to implement your own label functionality for the object. */ @@ -10048,7 +10684,7 @@ interface HTMLOptGroupElement extends HTMLElement { /** * Sets or retrieves the text string specified by the option tag. */ - text: string; + readonly text: string; /** * Sets or retrieves the value which is returned to the server when the form control is submitted. */ @@ -10069,11 +10705,11 @@ interface HTMLOptionElement extends HTMLElement { /** * Retrieves a reference to the form that the object is embedded in. */ - form: HTMLFormElement; + readonly form: HTMLFormElement; /** * Sets or retrieves the ordinal position of an option in a list box. */ - index: number; + readonly index: number; /** * Sets or retrieves a value that you can use to implement your own label functionality for the object. */ @@ -10098,6 +10734,18 @@ declare var HTMLOptionElement: { create(): HTMLOptionElement; } +interface HTMLOptionsCollection extends HTMLCollection { + length: number; + selectedIndex: number; + add(element: HTMLOptionElement | HTMLOptGroupElement, before?: HTMLElement | number): void; + remove(index: number): void; +} + +declare var HTMLOptionsCollection: { + prototype: HTMLOptionsCollection; + new(): HTMLOptionsCollection; +} + interface HTMLParagraphElement extends HTMLElement { /** * Sets or retrieves how the object is aligned with adjacent text. @@ -10135,28 +10783,15 @@ declare var HTMLParamElement: { new(): HTMLParamElement; } -interface HTMLPhraseElement extends HTMLElement { - /** - * Sets or retrieves reference information about the object. - */ - cite: string; - /** - * Sets or retrieves the date and time of a modification to the object. - */ - dateTime: string; +interface HTMLPictureElement extends HTMLElement { } -declare var HTMLPhraseElement: { - prototype: HTMLPhraseElement; - new(): HTMLPhraseElement; +declare var HTMLPictureElement: { + prototype: HTMLPictureElement; + new(): HTMLPictureElement; } interface HTMLPreElement extends HTMLElement { - /** - * Indicates a citation by rendering text in italic type. - */ - cite: string; - clear: string; /** * Sets or gets a value that you can use to implement your own width functionality for the object. */ @@ -10172,7 +10807,7 @@ interface HTMLProgressElement extends HTMLElement { /** * Retrieves a reference to the form that the object is embedded in. */ - form: HTMLFormElement; + readonly form: HTMLFormElement; /** * Defines the maximum, or "done" value for a progress element. */ @@ -10180,7 +10815,7 @@ interface HTMLProgressElement extends HTMLElement { /** * 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). */ - position: number; + readonly position: number; /** * Sets or gets the current value of a progress element. The value must be a non-negative number between 0 and the max value. */ @@ -10197,10 +10832,6 @@ interface HTMLQuoteElement extends HTMLElement { * Sets or retrieves reference information about the object. */ cite: string; - /** - * Sets or retrieves the date and time of a modification to the object. - */ - dateTime: string; } declare var HTMLQuoteElement: { @@ -10254,7 +10885,7 @@ interface HTMLSelectElement extends HTMLElement { /** * Retrieves a reference to the form that the object is embedded in. */ - form: HTMLFormElement; + readonly form: HTMLFormElement; /** * Sets or retrieves the number of objects in a collection. */ @@ -10267,7 +10898,7 @@ interface HTMLSelectElement extends HTMLElement { * Sets or retrieves the name of the object. */ name: string; - options: HTMLCollection; + options: HTMLCollectionOf; /** * When present, marks an element that can't be submitted without a value. */ @@ -10276,6 +10907,7 @@ interface HTMLSelectElement extends HTMLElement { * Sets or retrieves the index of the selected option in a select object. */ selectedIndex: number; + selectedOptions: HTMLCollectionOf; /** * Sets or retrieves the number of rows in the list box. */ @@ -10283,15 +10915,15 @@ interface HTMLSelectElement extends HTMLElement { /** * Retrieves the type of select control based on the value of the MULTIPLE attribute. */ - type: string; + readonly type: string; /** * 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. */ - validationMessage: string; + readonly validationMessage: string; /** * Returns a ValidityState object that represents the validity states of an element. */ - validity: ValidityState; + readonly validity: ValidityState; /** * Sets or retrieves the value which is returned to the server when the form control is submitted. */ @@ -10299,8 +10931,7 @@ interface HTMLSelectElement extends HTMLElement { /** * Returns whether an element will successfully validate based on forms validation rules and constraints. */ - willValidate: boolean; - selectedOptions: HTMLCollection; + readonly willValidate: boolean; /** * Adds an element to the areas, controlRange, or options collection. * @param element Variant of type Number that specifies the index position in the collection where the element is placed. If no value is given, the method places the element at the end of the collection. @@ -10346,10 +10977,12 @@ interface HTMLSourceElement extends HTMLElement { */ media: string; msKeySystem: string; + sizes: string; /** * The address or URL of the a media resource that is to be considered. */ src: string; + srcset: string; /** * Gets or sets the MIME type of a media resource. */ @@ -10370,6 +11003,7 @@ declare var HTMLSpanElement: { } interface HTMLStyleElement extends HTMLElement, LinkStyle { + disabled: boolean; /** * Sets or retrieves the media type. */ @@ -10419,7 +11053,7 @@ interface HTMLTableCellElement extends HTMLElement, HTMLTableAlignment { /** * Retrieves the position of the object in the cells collection of a row. */ - cellIndex: number; + readonly cellIndex: number; /** * Sets or retrieves the number columns in the table that the object should span. */ @@ -10526,7 +11160,7 @@ interface HTMLTableElement extends HTMLElement { /** * Sets or retrieves the number of horizontal rows contained in the object. */ - rows: HTMLCollection; + rows: HTMLCollectionOf; /** * Sets or retrieves which dividing lines (inner borders) are displayed. */ @@ -10538,7 +11172,7 @@ interface HTMLTableElement extends HTMLElement { /** * Retrieves a collection of all tBody objects in the table. Objects in this collection are in source order. */ - tBodies: HTMLCollection; + tBodies: HTMLCollectionOf; /** * Retrieves the tFoot object of the table. */ @@ -10617,7 +11251,7 @@ interface HTMLTableRowElement extends HTMLElement, HTMLTableAlignment { /** * Retrieves a collection of all cells in the table row. */ - cells: HTMLCollection; + cells: HTMLCollectionOf; /** * Sets or retrieves the height of the object. */ @@ -10625,11 +11259,11 @@ interface HTMLTableRowElement extends HTMLElement, HTMLTableAlignment { /** * Retrieves the position of the object in the rows collection for the table. */ - rowIndex: number; + readonly rowIndex: number; /** * Retrieves the position of the object in the collection. */ - sectionRowIndex: number; + readonly sectionRowIndex: number; /** * Removes the specified cell from the table row, as well as from the cells collection. * @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. @@ -10639,7 +11273,7 @@ interface HTMLTableRowElement extends HTMLElement, HTMLTableAlignment { * Creates a new cell in the table row, and adds the cell to the cells collection. * @param index Number that specifies where to insert the cell in the tr. The default value is -1, which appends the new cell to the end of the cells collection. */ - insertCell(index?: number): HTMLTableCellElement; + insertCell(index?: number): HTMLTableDataCellElement; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -10656,7 +11290,7 @@ interface HTMLTableSectionElement extends HTMLElement, HTMLTableAlignment { /** * Sets or retrieves the number of horizontal rows contained in the object. */ - rows: HTMLCollection; + rows: HTMLCollectionOf; /** * Removes the specified row (tr) from the element and from the rows collection. * @param index Number that specifies the zero-based position in the rows collection of the row to remove. @@ -10675,6 +11309,15 @@ declare var HTMLTableSectionElement: { new(): HTMLTableSectionElement; } +interface HTMLTemplateElement extends HTMLElement { + readonly content: DocumentFragment; +} + +declare var HTMLTemplateElement: { + prototype: HTMLTemplateElement; + new(): HTMLTemplateElement; +} + interface HTMLTextAreaElement extends HTMLElement { /** * 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. @@ -10692,7 +11335,7 @@ interface HTMLTextAreaElement extends HTMLElement { /** * Retrieves a reference to the form that the object is embedded in. */ - form: HTMLFormElement; + readonly form: HTMLFormElement; /** * Sets or retrieves the maximum number of characters that the user can enter in a text control. */ @@ -10732,15 +11375,15 @@ interface HTMLTextAreaElement extends HTMLElement { /** * Retrieves the type of control. */ - type: string; + readonly type: string; /** * 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. */ - validationMessage: string; + readonly validationMessage: string; /** * Returns a ValidityState object that represents the validity states of an element. */ - validity: ValidityState; + readonly validity: ValidityState; /** * Retrieves or sets the text in the entry field of the textArea element. */ @@ -10748,19 +11391,16 @@ interface HTMLTextAreaElement extends HTMLElement { /** * Returns whether an element will successfully validate based on forms validation rules and constraints. */ - willValidate: boolean; + readonly willValidate: boolean; /** * Sets or retrieves how to handle wordwrapping in the object. */ wrap: string; + minLength: number; /** * Returns whether a form will validate when it is submitted, without having to submit it. */ checkValidity(): boolean; - /** - * Creates a TextRange object for the element. - */ - createTextRange(): TextRange; /** * Highlights the input area of a form element. */ @@ -10799,23 +11439,23 @@ interface HTMLTrackElement extends HTMLElement { default: boolean; kind: string; label: string; - readyState: number; + readonly readyState: number; src: string; srclang: string; - track: TextTrack; - ERROR: number; - LOADED: number; - LOADING: number; - NONE: number; + readonly track: TextTrack; + readonly ERROR: number; + readonly LOADED: number; + readonly LOADING: number; + readonly NONE: number; } declare var HTMLTrackElement: { prototype: HTMLTrackElement; new(): HTMLTrackElement; - ERROR: number; - LOADED: number; - LOADING: number; - NONE: number; + readonly ERROR: number; + readonly LOADED: number; + readonly LOADING: number; + readonly NONE: number; } interface HTMLUListElement extends HTMLElement { @@ -10842,8 +11482,8 @@ interface HTMLVideoElement extends HTMLMediaElement { */ height: number; msHorizontalMirror: boolean; - msIsLayoutOptimalForPlayback: boolean; - msIsStereo3D: boolean; + readonly msIsLayoutOptimalForPlayback: boolean; + readonly msIsStereo3D: boolean; msStereo3DPackingMode: string; msStereo3DRenderMode: string; msZoom: boolean; @@ -10857,13 +11497,13 @@ interface HTMLVideoElement extends HTMLMediaElement { /** * Gets the intrinsic height of a video in CSS pixels, or zero if the dimensions are not known. */ - videoHeight: number; + readonly videoHeight: number; /** * Gets the intrinsic width of a video in CSS pixels, or zero if the dimensions are not known. */ - videoWidth: number; - webkitDisplayingFullscreen: boolean; - webkitSupportsFullscreen: boolean; + readonly videoWidth: number; + readonly webkitDisplayingFullscreen: boolean; + readonly webkitSupportsFullscreen: boolean; /** * Gets or sets the width of the video element. */ @@ -10902,10 +11542,10 @@ interface HTMLVideoElement extends HTMLMediaElement { addEventListener(type: "activate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; addEventListener(type: "ariarequest", listener: (ev: AriaRequestEvent) => any, useCapture?: boolean): void; addEventListener(type: "beforeactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecopy", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecut", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforecopy", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforecut", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "beforedeactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforepaste", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforepaste", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "blur", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; addEventListener(type: "canplay", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "canplaythrough", listener: (ev: Event) => any, useCapture?: boolean): void; @@ -10913,9 +11553,9 @@ interface HTMLVideoElement extends HTMLMediaElement { addEventListener(type: "click", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "command", listener: (ev: CommandEvent) => any, useCapture?: boolean): void; addEventListener(type: "contextmenu", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "copy", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "copy", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "cuechange", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "cut", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "cut", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "dblclick", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "deactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; addEventListener(type: "drag", listener: (ev: DragEvent) => any, useCapture?: boolean): void; @@ -10927,11 +11567,13 @@ interface HTMLVideoElement extends HTMLMediaElement { addEventListener(type: "drop", listener: (ev: DragEvent) => any, useCapture?: boolean): void; addEventListener(type: "durationchange", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "emptied", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "ended", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "encrypted", listener: (ev: MediaEncryptedEvent) => any, useCapture?: boolean): void; + addEventListener(type: "ended", listener: (ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: "focus", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; addEventListener(type: "gotpointercapture", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; addEventListener(type: "input", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "invalid", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "keydown", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "keypress", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "keyup", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; @@ -10947,9 +11589,9 @@ interface HTMLVideoElement extends HTMLMediaElement { addEventListener(type: "mouseout", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "mouseover", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "mouseup", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousewheel", listener: (ev: MouseWheelEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mousewheel", listener: (ev: WheelEvent) => any, useCapture?: boolean): void; addEventListener(type: "msneedkey", listener: (ev: MSMediaKeyNeededEvent) => any, useCapture?: boolean): void; - addEventListener(type: "paste", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "paste", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "pause", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "play", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "playing", listener: (ev: Event) => any, useCapture?: boolean): void; @@ -10991,8 +11633,8 @@ declare var HTMLVideoElement: { } interface HashChangeEvent extends Event { - newURL: string; - oldURL: string; + readonly newURL: string; + readonly oldURL: string; } declare var HashChangeEvent: { @@ -11001,8 +11643,8 @@ declare var HashChangeEvent: { } interface History { - length: number; - state: any; + readonly length: number; + readonly state: any; back(distance?: any): void; forward(distance?: any): void; go(delta?: any): void; @@ -11016,31 +11658,31 @@ declare var History: { } interface IDBCursor { - direction: string; - key: any; - primaryKey: any; + readonly direction: string; + key: IDBKeyRange | IDBValidKey; + readonly primaryKey: any; source: IDBObjectStore | IDBIndex; advance(count: number): void; - continue(key?: any): void; + continue(key?: IDBKeyRange | IDBValidKey): void; delete(): IDBRequest; update(value: any): IDBRequest; - NEXT: string; - NEXT_NO_DUPLICATE: string; - PREV: string; - PREV_NO_DUPLICATE: string; + readonly NEXT: string; + readonly NEXT_NO_DUPLICATE: string; + readonly PREV: string; + readonly PREV_NO_DUPLICATE: string; } declare var IDBCursor: { prototype: IDBCursor; new(): IDBCursor; - NEXT: string; - NEXT_NO_DUPLICATE: string; - PREV: string; - PREV_NO_DUPLICATE: string; + readonly NEXT: string; + readonly NEXT_NO_DUPLICATE: string; + readonly PREV: string; + readonly PREV_NO_DUPLICATE: string; } interface IDBCursorWithValue extends IDBCursor { - value: any; + readonly value: any; } declare var IDBCursorWithValue: { @@ -11049,15 +11691,17 @@ declare var IDBCursorWithValue: { } interface IDBDatabase extends EventTarget { - name: string; - objectStoreNames: DOMStringList; + readonly name: string; + readonly objectStoreNames: DOMStringList; onabort: (ev: Event) => any; onerror: (ev: Event) => any; version: number; + onversionchange: (ev: IDBVersionChangeEvent) => any; close(): void; createObjectStore(name: string, optionalParameters?: IDBObjectStoreParameters): IDBObjectStore; deleteObjectStore(name: string): void; transaction(storeNames: string | string[], mode?: string): IDBTransaction; + addEventListener(type: "versionchange", listener: (ev: IDBVersionChangeEvent) => any, useCapture?: boolean): void; addEventListener(type: "abort", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; @@ -11081,15 +11725,15 @@ declare var IDBFactory: { interface IDBIndex { keyPath: string | string[]; - name: string; - objectStore: IDBObjectStore; - unique: boolean; + readonly name: string; + readonly objectStore: IDBObjectStore; + readonly unique: boolean; multiEntry: boolean; - count(key?: any): IDBRequest; - get(key: any): IDBRequest; - getKey(key: any): IDBRequest; - openCursor(range?: IDBKeyRange, direction?: string): IDBRequest; - openKeyCursor(range?: IDBKeyRange, direction?: string): IDBRequest; + count(key?: IDBKeyRange | IDBValidKey): IDBRequest; + get(key: IDBKeyRange | IDBValidKey): IDBRequest; + getKey(key: IDBKeyRange | IDBValidKey): IDBRequest; + openCursor(range?: IDBKeyRange | IDBValidKey, direction?: string): IDBRequest; + openKeyCursor(range?: IDBKeyRange | IDBValidKey, direction?: string): IDBRequest; } declare var IDBIndex: { @@ -11098,37 +11742,37 @@ declare var IDBIndex: { } interface IDBKeyRange { - lower: any; - lowerOpen: boolean; - upper: any; - upperOpen: boolean; + readonly lower: any; + readonly lowerOpen: boolean; + readonly upper: any; + readonly upperOpen: boolean; } declare var IDBKeyRange: { prototype: IDBKeyRange; new(): IDBKeyRange; bound(lower: any, upper: any, lowerOpen?: boolean, upperOpen?: boolean): IDBKeyRange; - lowerBound(bound: any, open?: boolean): IDBKeyRange; + lowerBound(lower: any, open?: boolean): IDBKeyRange; only(value: any): IDBKeyRange; - upperBound(bound: any, open?: boolean): IDBKeyRange; + upperBound(upper: any, open?: boolean): IDBKeyRange; } interface IDBObjectStore { - indexNames: DOMStringList; + readonly indexNames: DOMStringList; keyPath: string | string[]; - name: string; - transaction: IDBTransaction; + readonly name: string; + readonly transaction: IDBTransaction; autoIncrement: boolean; - add(value: any, key?: any): IDBRequest; + add(value: any, key?: IDBKeyRange | IDBValidKey): IDBRequest; clear(): IDBRequest; - count(key?: any): IDBRequest; + count(key?: IDBKeyRange | IDBValidKey): IDBRequest; createIndex(name: string, keyPath: string | string[], optionalParameters?: IDBIndexParameters): IDBIndex; - delete(key: any): IDBRequest; + delete(key: IDBKeyRange | IDBValidKey): IDBRequest; deleteIndex(indexName: string): void; get(key: any): IDBRequest; index(name: string): IDBIndex; - openCursor(range?: any, direction?: string): IDBRequest; - put(value: any, key?: any): IDBRequest; + openCursor(range?: IDBKeyRange | IDBValidKey, direction?: string): IDBRequest; + put(value: any, key?: IDBKeyRange | IDBValidKey): IDBRequest; } declare var IDBObjectStore: { @@ -11152,13 +11796,13 @@ declare var IDBOpenDBRequest: { } interface IDBRequest extends EventTarget { - error: DOMError; + readonly error: DOMError; onerror: (ev: Event) => any; onsuccess: (ev: Event) => any; - readyState: string; - result: any; + readonly readyState: string; + readonly result: any; source: IDBObjectStore | IDBIndex | IDBCursor; - transaction: IDBTransaction; + readonly transaction: IDBTransaction; addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: "success", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; @@ -11170,17 +11814,17 @@ declare var IDBRequest: { } interface IDBTransaction extends EventTarget { - db: IDBDatabase; - error: DOMError; - mode: string; + readonly db: IDBDatabase; + readonly error: DOMError; + readonly mode: string; onabort: (ev: Event) => any; oncomplete: (ev: Event) => any; onerror: (ev: Event) => any; abort(): void; objectStore(name: string): IDBObjectStore; - READ_ONLY: string; - READ_WRITE: string; - VERSION_CHANGE: string; + readonly READ_ONLY: string; + readonly READ_WRITE: string; + readonly VERSION_CHANGE: string; addEventListener(type: "abort", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "complete", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; @@ -11190,14 +11834,14 @@ interface IDBTransaction extends EventTarget { declare var IDBTransaction: { prototype: IDBTransaction; new(): IDBTransaction; - READ_ONLY: string; - READ_WRITE: string; - VERSION_CHANGE: string; + readonly READ_ONLY: string; + readonly READ_WRITE: string; + readonly VERSION_CHANGE: string; } interface IDBVersionChangeEvent extends Event { - newVersion: number; - oldVersion: number; + readonly newVersion: number; + readonly oldVersion: number; } declare var IDBVersionChangeEvent: { @@ -11207,8 +11851,8 @@ declare var IDBVersionChangeEvent: { interface ImageData { data: Uint8ClampedArray; - height: number; - width: number; + readonly height: number; + readonly width: number; } declare var ImageData: { @@ -11218,37 +11862,47 @@ declare var ImageData: { } interface KeyboardEvent extends UIEvent { - altKey: boolean; - char: string; - charCode: number; - ctrlKey: boolean; - key: string; - keyCode: number; - locale: string; - location: number; - metaKey: boolean; - repeat: boolean; - shiftKey: boolean; - which: number; + readonly altKey: boolean; + readonly char: string; + readonly charCode: number; + readonly ctrlKey: boolean; + readonly key: string; + readonly keyCode: number; + readonly locale: string; + readonly location: number; + readonly metaKey: boolean; + readonly repeat: boolean; + readonly shiftKey: boolean; + readonly which: number; getModifierState(keyArg: string): boolean; initKeyboardEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, keyArg: string, locationArg: number, modifiersListArg: string, repeat: boolean, locale: string): void; - DOM_KEY_LOCATION_JOYSTICK: number; - DOM_KEY_LOCATION_LEFT: number; - DOM_KEY_LOCATION_MOBILE: number; - DOM_KEY_LOCATION_NUMPAD: number; - DOM_KEY_LOCATION_RIGHT: number; - DOM_KEY_LOCATION_STANDARD: number; + readonly DOM_KEY_LOCATION_JOYSTICK: number; + readonly DOM_KEY_LOCATION_LEFT: number; + readonly DOM_KEY_LOCATION_MOBILE: number; + readonly DOM_KEY_LOCATION_NUMPAD: number; + readonly DOM_KEY_LOCATION_RIGHT: number; + readonly DOM_KEY_LOCATION_STANDARD: number; } declare var KeyboardEvent: { prototype: KeyboardEvent; new(typeArg: string, eventInitDict?: KeyboardEventInit): KeyboardEvent; - DOM_KEY_LOCATION_JOYSTICK: number; - DOM_KEY_LOCATION_LEFT: number; - DOM_KEY_LOCATION_MOBILE: number; - DOM_KEY_LOCATION_NUMPAD: number; - DOM_KEY_LOCATION_RIGHT: number; - DOM_KEY_LOCATION_STANDARD: number; + readonly DOM_KEY_LOCATION_JOYSTICK: number; + readonly DOM_KEY_LOCATION_LEFT: number; + readonly DOM_KEY_LOCATION_MOBILE: number; + readonly DOM_KEY_LOCATION_NUMPAD: number; + readonly DOM_KEY_LOCATION_RIGHT: number; + readonly DOM_KEY_LOCATION_STANDARD: number; +} + +interface ListeningStateChangedEvent extends Event { + readonly label: string; + readonly state: string; +} + +declare var ListeningStateChangedEvent: { + prototype: ListeningStateChangedEvent; + new(): ListeningStateChangedEvent; } interface Location { @@ -11256,7 +11910,7 @@ interface Location { host: string; hostname: string; href: string; - origin: string; + readonly origin: string; pathname: string; port: string; protocol: string; @@ -11273,7 +11927,7 @@ declare var Location: { } interface LongRunningScriptDetectedEvent extends Event { - executionTime: number; + readonly executionTime: number; stopPageScriptExecution: boolean; } @@ -11292,29 +11946,29 @@ interface MSApp { execAsyncAtPriority(asynchronousCallback: MSExecAtPriorityFunctionCallback, priority: string, ...args: any[]): void; execAtPriority(synchronousCallback: MSExecAtPriorityFunctionCallback, priority: string, ...args: any[]): any; getCurrentPriority(): string; - getHtmlPrintDocumentSourceAsync(htmlDoc: any): any; + getHtmlPrintDocumentSourceAsync(htmlDoc: any): PromiseLike; getViewId(view: any): any; isTaskScheduledAtPriorityOrHigher(priority: string): boolean; pageHandlesAllApplicationActivations(enabled: boolean): void; suppressSubdownloadCredentialPrompts(suppress: boolean): void; terminateApp(exceptionObject: any): void; - CURRENT: string; - HIGH: string; - IDLE: string; - NORMAL: string; + readonly CURRENT: string; + readonly HIGH: string; + readonly IDLE: string; + readonly NORMAL: string; } declare var MSApp: MSApp; interface MSAppAsyncOperation extends EventTarget { - error: DOMError; + readonly error: DOMError; oncomplete: (ev: Event) => any; onerror: (ev: Event) => any; - readyState: number; - result: any; + readonly readyState: number; + readonly result: any; start(): void; - COMPLETED: number; - ERROR: number; - STARTED: number; + readonly COMPLETED: number; + readonly ERROR: number; + readonly STARTED: number; addEventListener(type: "complete", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; @@ -11323,9 +11977,19 @@ interface MSAppAsyncOperation extends EventTarget { declare var MSAppAsyncOperation: { prototype: MSAppAsyncOperation; new(): MSAppAsyncOperation; - COMPLETED: number; - ERROR: number; - STARTED: number; + readonly COMPLETED: number; + readonly ERROR: number; + readonly STARTED: number; +} + +interface MSAssertion { + readonly id: string; + readonly type: string; +} + +declare var MSAssertion: { + prototype: MSAssertion; + new(): MSAssertion; } interface MSBlobBuilder { @@ -11338,44 +12002,46 @@ declare var MSBlobBuilder: { new(): MSBlobBuilder; } -interface MSCSSMatrix { - a: number; - b: number; - c: number; - d: number; - e: number; - f: number; - m11: number; - m12: number; - m13: number; - m14: number; - m21: number; - m22: number; - m23: number; - m24: number; - m31: number; - m32: number; - m33: number; - m34: number; - m41: number; - m42: number; - m43: number; - m44: number; - inverse(): MSCSSMatrix; - multiply(secondMatrix: MSCSSMatrix): MSCSSMatrix; - rotate(angleX: number, angleY?: number, angleZ?: number): MSCSSMatrix; - rotateAxisAngle(x: number, y: number, z: number, angle: number): MSCSSMatrix; - scale(scaleX: number, scaleY?: number, scaleZ?: number): MSCSSMatrix; - setMatrixValue(value: string): void; - skewX(angle: number): MSCSSMatrix; - skewY(angle: number): MSCSSMatrix; - toString(): string; - translate(x: number, y: number, z?: number): MSCSSMatrix; +interface MSCredentials { + getAssertion(challenge: string, filter?: MSCredentialFilter, params?: MSSignatureParameters): PromiseLike; + makeCredential(accountInfo: MSAccountInfo, params: MSCredentialParameters[], challenge?: string): PromiseLike; } -declare var MSCSSMatrix: { - prototype: MSCSSMatrix; - new(text?: string): MSCSSMatrix; +declare var MSCredentials: { + prototype: MSCredentials; + new(): MSCredentials; +} + +interface MSFIDOCredentialAssertion extends MSAssertion { + readonly algorithm: string | Algorithm; + readonly attestation: any; + readonly publicKey: string; + readonly transportHints: string[]; +} + +declare var MSFIDOCredentialAssertion: { + prototype: MSFIDOCredentialAssertion; + new(): MSFIDOCredentialAssertion; +} + +interface MSFIDOSignature { + readonly authnrData: string; + readonly clientData: string; + readonly signature: string; +} + +declare var MSFIDOSignature: { + prototype: MSFIDOSignature; + new(): MSFIDOSignature; +} + +interface MSFIDOSignatureAssertion extends MSAssertion { + readonly signature: MSFIDOSignature; +} + +declare var MSFIDOSignatureAssertion: { + prototype: MSFIDOSignatureAssertion; + new(): MSFIDOSignatureAssertion; } interface MSGesture { @@ -11390,44 +12056,44 @@ declare var MSGesture: { } interface MSGestureEvent extends UIEvent { - clientX: number; - clientY: number; - expansion: number; - gestureObject: any; - hwTimestamp: number; - offsetX: number; - offsetY: number; - rotation: number; - scale: number; - screenX: number; - screenY: number; - translationX: number; - translationY: number; - velocityAngular: number; - velocityExpansion: number; - velocityX: number; - velocityY: number; + readonly clientX: number; + readonly clientY: number; + readonly expansion: number; + readonly gestureObject: any; + readonly hwTimestamp: number; + readonly offsetX: number; + readonly offsetY: number; + readonly rotation: number; + readonly scale: number; + readonly screenX: number; + readonly screenY: number; + readonly translationX: number; + readonly translationY: number; + readonly velocityAngular: number; + readonly velocityExpansion: number; + readonly velocityX: number; + readonly velocityY: number; 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; - MSGESTURE_FLAG_BEGIN: number; - MSGESTURE_FLAG_CANCEL: number; - MSGESTURE_FLAG_END: number; - MSGESTURE_FLAG_INERTIA: number; - MSGESTURE_FLAG_NONE: number; + readonly MSGESTURE_FLAG_BEGIN: number; + readonly MSGESTURE_FLAG_CANCEL: number; + readonly MSGESTURE_FLAG_END: number; + readonly MSGESTURE_FLAG_INERTIA: number; + readonly MSGESTURE_FLAG_NONE: number; } declare var MSGestureEvent: { prototype: MSGestureEvent; new(): MSGestureEvent; - MSGESTURE_FLAG_BEGIN: number; - MSGESTURE_FLAG_CANCEL: number; - MSGESTURE_FLAG_END: number; - MSGESTURE_FLAG_INERTIA: number; - MSGESTURE_FLAG_NONE: number; + readonly MSGESTURE_FLAG_BEGIN: number; + readonly MSGESTURE_FLAG_CANCEL: number; + readonly MSGESTURE_FLAG_END: number; + readonly MSGESTURE_FLAG_INERTIA: number; + readonly MSGESTURE_FLAG_NONE: number; } interface MSGraphicsTrust { - constrictionActive: boolean; - status: string; + readonly constrictionActive: boolean; + readonly status: string; } declare var MSGraphicsTrust: { @@ -11436,12 +12102,12 @@ declare var MSGraphicsTrust: { } interface MSHTMLWebViewElement extends HTMLElement { - canGoBack: boolean; - canGoForward: boolean; - containsFullScreenElement: boolean; - documentTitle: string; + readonly canGoBack: boolean; + readonly canGoForward: boolean; + readonly containsFullScreenElement: boolean; + readonly documentTitle: string; height: number; - settings: MSWebViewSettings; + readonly settings: MSWebViewSettings; src: string; width: number; addWebAllowedObject(name: string, applicationObject: any): void; @@ -11467,12 +12133,12 @@ declare var MSHTMLWebViewElement: { } interface MSInputMethodContext extends EventTarget { - compositionEndOffset: number; - compositionStartOffset: number; + readonly compositionEndOffset: number; + readonly compositionStartOffset: number; oncandidatewindowhide: (ev: Event) => any; oncandidatewindowshow: (ev: Event) => any; oncandidatewindowupdate: (ev: Event) => any; - target: HTMLElement; + readonly target: HTMLElement; getCandidateWindowClientRect(): ClientRect; getCompositionAlternatives(): string[]; hasComposition(): boolean; @@ -11489,59 +12155,59 @@ declare var MSInputMethodContext: { } interface MSManipulationEvent extends UIEvent { - currentState: number; - inertiaDestinationX: number; - inertiaDestinationY: number; - lastState: number; + readonly currentState: number; + readonly inertiaDestinationX: number; + readonly inertiaDestinationY: number; + readonly lastState: number; initMSManipulationEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, lastState: number, currentState: number): void; - MS_MANIPULATION_STATE_ACTIVE: number; - MS_MANIPULATION_STATE_CANCELLED: number; - MS_MANIPULATION_STATE_COMMITTED: number; - MS_MANIPULATION_STATE_DRAGGING: number; - MS_MANIPULATION_STATE_INERTIA: number; - MS_MANIPULATION_STATE_PRESELECT: number; - MS_MANIPULATION_STATE_SELECTING: number; - MS_MANIPULATION_STATE_STOPPED: number; + readonly MS_MANIPULATION_STATE_ACTIVE: number; + readonly MS_MANIPULATION_STATE_CANCELLED: number; + readonly MS_MANIPULATION_STATE_COMMITTED: number; + readonly MS_MANIPULATION_STATE_DRAGGING: number; + readonly MS_MANIPULATION_STATE_INERTIA: number; + readonly MS_MANIPULATION_STATE_PRESELECT: number; + readonly MS_MANIPULATION_STATE_SELECTING: number; + readonly MS_MANIPULATION_STATE_STOPPED: number; } declare var MSManipulationEvent: { prototype: MSManipulationEvent; new(): MSManipulationEvent; - MS_MANIPULATION_STATE_ACTIVE: number; - MS_MANIPULATION_STATE_CANCELLED: number; - MS_MANIPULATION_STATE_COMMITTED: number; - MS_MANIPULATION_STATE_DRAGGING: number; - MS_MANIPULATION_STATE_INERTIA: number; - MS_MANIPULATION_STATE_PRESELECT: number; - MS_MANIPULATION_STATE_SELECTING: number; - MS_MANIPULATION_STATE_STOPPED: number; + readonly MS_MANIPULATION_STATE_ACTIVE: number; + readonly MS_MANIPULATION_STATE_CANCELLED: number; + readonly MS_MANIPULATION_STATE_COMMITTED: number; + readonly MS_MANIPULATION_STATE_DRAGGING: number; + readonly MS_MANIPULATION_STATE_INERTIA: number; + readonly MS_MANIPULATION_STATE_PRESELECT: number; + readonly MS_MANIPULATION_STATE_SELECTING: number; + readonly MS_MANIPULATION_STATE_STOPPED: number; } interface MSMediaKeyError { - code: number; - systemCode: number; - MS_MEDIA_KEYERR_CLIENT: number; - MS_MEDIA_KEYERR_DOMAIN: number; - MS_MEDIA_KEYERR_HARDWARECHANGE: number; - MS_MEDIA_KEYERR_OUTPUT: number; - MS_MEDIA_KEYERR_SERVICE: number; - MS_MEDIA_KEYERR_UNKNOWN: number; + readonly code: number; + readonly systemCode: number; + readonly MS_MEDIA_KEYERR_CLIENT: number; + readonly MS_MEDIA_KEYERR_DOMAIN: number; + readonly MS_MEDIA_KEYERR_HARDWARECHANGE: number; + readonly MS_MEDIA_KEYERR_OUTPUT: number; + readonly MS_MEDIA_KEYERR_SERVICE: number; + readonly MS_MEDIA_KEYERR_UNKNOWN: number; } declare var MSMediaKeyError: { prototype: MSMediaKeyError; new(): MSMediaKeyError; - MS_MEDIA_KEYERR_CLIENT: number; - MS_MEDIA_KEYERR_DOMAIN: number; - MS_MEDIA_KEYERR_HARDWARECHANGE: number; - MS_MEDIA_KEYERR_OUTPUT: number; - MS_MEDIA_KEYERR_SERVICE: number; - MS_MEDIA_KEYERR_UNKNOWN: number; + readonly MS_MEDIA_KEYERR_CLIENT: number; + readonly MS_MEDIA_KEYERR_DOMAIN: number; + readonly MS_MEDIA_KEYERR_HARDWARECHANGE: number; + readonly MS_MEDIA_KEYERR_OUTPUT: number; + readonly MS_MEDIA_KEYERR_SERVICE: number; + readonly MS_MEDIA_KEYERR_UNKNOWN: number; } interface MSMediaKeyMessageEvent extends Event { - destinationURL: string; - message: Uint8Array; + readonly destinationURL: string; + readonly message: Uint8Array; } declare var MSMediaKeyMessageEvent: { @@ -11550,7 +12216,7 @@ declare var MSMediaKeyMessageEvent: { } interface MSMediaKeyNeededEvent extends Event { - initData: Uint8Array; + readonly initData: Uint8Array; } declare var MSMediaKeyNeededEvent: { @@ -11559,9 +12225,9 @@ declare var MSMediaKeyNeededEvent: { } interface MSMediaKeySession extends EventTarget { - error: MSMediaKeyError; - keySystem: string; - sessionId: string; + readonly error: MSMediaKeyError; + readonly keySystem: string; + readonly sessionId: string; close(): void; update(key: Uint8Array): void; } @@ -11572,7 +12238,7 @@ declare var MSMediaKeySession: { } interface MSMediaKeys { - keySystem: string; + readonly keySystem: string; createSession(type: string, initData: Uint8Array, cdmData?: Uint8Array): MSMediaKeySession; } @@ -11580,40 +12246,22 @@ declare var MSMediaKeys: { prototype: MSMediaKeys; new(keySystem: string): MSMediaKeys; isTypeSupported(keySystem: string, type?: string): boolean; -} - -interface MSMimeTypesCollection { - length: number; -} - -declare var MSMimeTypesCollection: { - prototype: MSMimeTypesCollection; - new(): MSMimeTypesCollection; -} - -interface MSPluginsCollection { - length: number; - refresh(reload?: boolean): void; -} - -declare var MSPluginsCollection: { - prototype: MSPluginsCollection; - new(): MSPluginsCollection; + isTypeSupportedWithFeatures(keySystem: string, type?: string): string; } interface MSPointerEvent extends MouseEvent { - currentPoint: any; - height: number; - hwTimestamp: number; - intermediatePoints: any; - isPrimary: boolean; - pointerId: number; - pointerType: any; - pressure: number; - rotation: number; - tiltX: number; - tiltY: number; - width: number; + readonly currentPoint: any; + readonly height: number; + readonly hwTimestamp: number; + readonly intermediatePoints: any; + readonly isPrimary: boolean; + readonly pointerId: number; + readonly pointerType: any; + readonly pressure: number; + readonly rotation: number; + readonly tiltX: number; + readonly tiltY: number; + readonly width: number; getCurrentPoint(element: Element): void; getIntermediatePoints(element: Element): void; 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; @@ -11625,7 +12273,7 @@ declare var MSPointerEvent: { } interface MSRangeCollection { - length: number; + readonly length: number; item(index: number): Range; [index: number]: Range; } @@ -11636,8 +12284,8 @@ declare var MSRangeCollection: { } interface MSSiteModeEvent extends Event { - actionURL: string; - buttonID: number; + readonly actionURL: string; + readonly buttonID: number; } declare var MSSiteModeEvent: { @@ -11646,7 +12294,7 @@ declare var MSSiteModeEvent: { } interface MSStream { - type: string; + readonly type: string; msClose(): void; msDetachStream(): any; } @@ -11657,7 +12305,7 @@ declare var MSStream: { } interface MSStreamReader extends EventTarget, MSBaseReader { - error: DOMError; + readonly error: DOMError; readAsArrayBuffer(stream: MSStream, size?: number): void; readAsBinaryString(stream: MSStream, size?: number): void; readAsBlob(stream: MSStream, size?: number): void; @@ -11672,20 +12320,20 @@ declare var MSStreamReader: { } interface MSWebViewAsyncOperation extends EventTarget { - error: DOMError; + readonly error: DOMError; oncomplete: (ev: Event) => any; onerror: (ev: Event) => any; - readyState: number; - result: any; - target: MSHTMLWebViewElement; - type: number; + readonly readyState: number; + readonly result: any; + readonly target: MSHTMLWebViewElement; + readonly type: number; start(): void; - COMPLETED: number; - ERROR: number; - STARTED: number; - TYPE_CAPTURE_PREVIEW_TO_RANDOM_ACCESS_STREAM: number; - TYPE_CREATE_DATA_PACKAGE_FROM_SELECTION: number; - TYPE_INVOKE_SCRIPT: number; + readonly COMPLETED: number; + readonly ERROR: number; + readonly STARTED: number; + readonly TYPE_CAPTURE_PREVIEW_TO_RANDOM_ACCESS_STREAM: number; + readonly TYPE_CREATE_DATA_PACKAGE_FROM_SELECTION: number; + readonly TYPE_INVOKE_SCRIPT: number; addEventListener(type: "complete", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; @@ -11694,12 +12342,12 @@ interface MSWebViewAsyncOperation extends EventTarget { declare var MSWebViewAsyncOperation: { prototype: MSWebViewAsyncOperation; new(): MSWebViewAsyncOperation; - COMPLETED: number; - ERROR: number; - STARTED: number; - TYPE_CAPTURE_PREVIEW_TO_RANDOM_ACCESS_STREAM: number; - TYPE_CREATE_DATA_PACKAGE_FROM_SELECTION: number; - TYPE_INVOKE_SCRIPT: number; + readonly COMPLETED: number; + readonly ERROR: number; + readonly STARTED: number; + readonly TYPE_CAPTURE_PREVIEW_TO_RANDOM_ACCESS_STREAM: number; + readonly TYPE_CREATE_DATA_PACKAGE_FROM_SELECTION: number; + readonly TYPE_INVOKE_SCRIPT: number; } interface MSWebViewSettings { @@ -11712,6 +12360,32 @@ declare var MSWebViewSettings: { new(): MSWebViewSettings; } +interface MediaDeviceInfo { + readonly deviceId: string; + readonly groupId: string; + readonly kind: string; + readonly label: string; +} + +declare var MediaDeviceInfo: { + prototype: MediaDeviceInfo; + new(): MediaDeviceInfo; +} + +interface MediaDevices extends EventTarget { + ondevicechange: (ev: Event) => any; + enumerateDevices(): any; + getSupportedConstraints(): MediaTrackSupportedConstraints; + getUserMedia(constraints: MediaStreamConstraints): PromiseLike; + addEventListener(type: "devicechange", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var MediaDevices: { + prototype: MediaDevices; + new(): MediaDevices; +} + interface MediaElementAudioSourceNode extends AudioNode { } @@ -11720,28 +12394,98 @@ declare var MediaElementAudioSourceNode: { new(): MediaElementAudioSourceNode; } +interface MediaEncryptedEvent extends Event { + readonly initData: ArrayBuffer; + readonly initDataType: string; +} + +declare var MediaEncryptedEvent: { + prototype: MediaEncryptedEvent; + new(type: string, eventInitDict?: MediaEncryptedEventInit): MediaEncryptedEvent; +} + interface MediaError { - code: number; - msExtendedCode: number; - MEDIA_ERR_ABORTED: number; - MEDIA_ERR_DECODE: number; - MEDIA_ERR_NETWORK: number; - MEDIA_ERR_SRC_NOT_SUPPORTED: number; - MS_MEDIA_ERR_ENCRYPTED: number; + readonly code: number; + readonly msExtendedCode: number; + readonly MEDIA_ERR_ABORTED: number; + readonly MEDIA_ERR_DECODE: number; + readonly MEDIA_ERR_NETWORK: number; + readonly MEDIA_ERR_SRC_NOT_SUPPORTED: number; + readonly MS_MEDIA_ERR_ENCRYPTED: number; } declare var MediaError: { prototype: MediaError; new(): MediaError; - MEDIA_ERR_ABORTED: number; - MEDIA_ERR_DECODE: number; - MEDIA_ERR_NETWORK: number; - MEDIA_ERR_SRC_NOT_SUPPORTED: number; - MS_MEDIA_ERR_ENCRYPTED: number; + readonly MEDIA_ERR_ABORTED: number; + readonly MEDIA_ERR_DECODE: number; + readonly MEDIA_ERR_NETWORK: number; + readonly MEDIA_ERR_SRC_NOT_SUPPORTED: number; + readonly MS_MEDIA_ERR_ENCRYPTED: number; +} + +interface MediaKeyMessageEvent extends Event { + readonly message: ArrayBuffer; + readonly messageType: string; +} + +declare var MediaKeyMessageEvent: { + prototype: MediaKeyMessageEvent; + new(type: string, eventInitDict?: MediaKeyMessageEventInit): MediaKeyMessageEvent; +} + +interface MediaKeySession extends EventTarget { + readonly closed: PromiseLike; + readonly expiration: number; + readonly keyStatuses: MediaKeyStatusMap; + readonly sessionId: string; + close(): PromiseLike; + generateRequest(initDataType: string, initData: any): PromiseLike; + load(sessionId: string): PromiseLike; + remove(): PromiseLike; + update(response: any): PromiseLike; +} + +declare var MediaKeySession: { + prototype: MediaKeySession; + new(): MediaKeySession; +} + +interface MediaKeyStatusMap { + readonly size: number; + forEach(callback: ForEachCallback): void; + get(keyId: any): string; + has(keyId: any): boolean; +} + +declare var MediaKeyStatusMap: { + prototype: MediaKeyStatusMap; + new(): MediaKeyStatusMap; +} + +interface MediaKeySystemAccess { + readonly keySystem: string; + createMediaKeys(): PromiseLike; + getConfiguration(): MediaKeySystemConfiguration; +} + +declare var MediaKeySystemAccess: { + prototype: MediaKeySystemAccess; + new(): MediaKeySystemAccess; +} + +interface MediaKeys { + createSession(sessionType?: string): MediaKeySession; + setServerCertificate(serverCertificate: any): PromiseLike; +} + +declare var MediaKeys: { + prototype: MediaKeys; + new(): MediaKeys; } interface MediaList { - length: number; + readonly length: number; mediaText: string; appendMedium(newMedium: string): void; deleteMedium(oldMedium: string): void; @@ -11756,8 +12500,8 @@ declare var MediaList: { } interface MediaQueryList { - matches: boolean; - media: string; + readonly matches: boolean; + readonly media: string; addListener(listener: MediaQueryListListener): void; removeListener(listener: MediaQueryListListener): void; } @@ -11768,10 +12512,10 @@ declare var MediaQueryList: { } interface MediaSource extends EventTarget { - activeSourceBuffers: SourceBufferList; + readonly activeSourceBuffers: SourceBufferList; duration: number; - readyState: string; - sourceBuffers: SourceBufferList; + readonly readyState: string; + readonly sourceBuffers: SourceBufferList; addSourceBuffer(type: string): SourceBuffer; endOfStream(error?: number): void; removeSourceBuffer(sourceBuffer: SourceBuffer): void; @@ -11783,9 +12527,104 @@ declare var MediaSource: { isTypeSupported(type: string): boolean; } +interface MediaStream extends EventTarget { + readonly active: boolean; + readonly id: string; + onactive: (ev: Event) => any; + onaddtrack: (ev: TrackEvent) => any; + oninactive: (ev: Event) => any; + onremovetrack: (ev: TrackEvent) => any; + addTrack(track: MediaStreamTrack): void; + clone(): MediaStream; + getAudioTracks(): MediaStreamTrack[]; + getTrackById(trackId: string): MediaStreamTrack; + getTracks(): MediaStreamTrack[]; + getVideoTracks(): MediaStreamTrack[]; + removeTrack(track: MediaStreamTrack): void; + stop(): void; + addEventListener(type: "active", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "addtrack", listener: (ev: TrackEvent) => any, useCapture?: boolean): void; + addEventListener(type: "inactive", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "removetrack", listener: (ev: TrackEvent) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var MediaStream: { + prototype: MediaStream; + new(streamOrTracks?: MediaStream | MediaStreamTrack[]): MediaStream; +} + +interface MediaStreamAudioSourceNode extends AudioNode { +} + +declare var MediaStreamAudioSourceNode: { + prototype: MediaStreamAudioSourceNode; + new(): MediaStreamAudioSourceNode; +} + +interface MediaStreamError { + readonly constraintName: string; + readonly message: string; + readonly name: string; +} + +declare var MediaStreamError: { + prototype: MediaStreamError; + new(): MediaStreamError; +} + +interface MediaStreamErrorEvent extends Event { + readonly error: MediaStreamError; +} + +declare var MediaStreamErrorEvent: { + prototype: MediaStreamErrorEvent; + new(type: string, eventInitDict?: MediaStreamErrorEventInit): MediaStreamErrorEvent; +} + +interface MediaStreamTrack extends EventTarget { + enabled: boolean; + readonly id: string; + readonly kind: string; + readonly label: string; + readonly muted: boolean; + onended: (ev: MediaStreamErrorEvent) => any; + onmute: (ev: Event) => any; + onoverconstrained: (ev: MediaStreamErrorEvent) => any; + onunmute: (ev: Event) => any; + readonly readonly: boolean; + readonly readyState: string; + readonly remote: boolean; + applyConstraints(constraints: MediaTrackConstraints): PromiseLike; + clone(): MediaStreamTrack; + getCapabilities(): MediaTrackCapabilities; + getConstraints(): MediaTrackConstraints; + getSettings(): MediaTrackSettings; + stop(): void; + addEventListener(type: "ended", listener: (ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mute", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "overconstrained", listener: (ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: "unmute", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var MediaStreamTrack: { + prototype: MediaStreamTrack; + new(): MediaStreamTrack; +} + +interface MediaStreamTrackEvent extends Event { + readonly track: MediaStreamTrack; +} + +declare var MediaStreamTrackEvent: { + prototype: MediaStreamTrackEvent; + new(type: string, eventInitDict?: MediaStreamTrackEventInit): MediaStreamTrackEvent; +} + interface MessageChannel { - port1: MessagePort; - port2: MessagePort; + readonly port1: MessagePort; + readonly port2: MessagePort; } declare var MessageChannel: { @@ -11794,10 +12633,10 @@ declare var MessageChannel: { } interface MessageEvent extends Event { - data: any; - origin: string; - ports: any; - source: Window; + readonly data: any; + readonly origin: string; + readonly ports: any; + readonly source: Window; initMessageEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, dataArg: any, originArg: string, lastEventIdArg: string, sourceArg: Window): void; } @@ -11821,10 +12660,10 @@ declare var MessagePort: { } interface MimeType { - description: string; - enabledPlugin: Plugin; - suffixes: string; - type: string; + readonly description: string; + readonly enabledPlugin: Plugin; + readonly suffixes: string; + readonly type: string; } declare var MimeType: { @@ -11833,7 +12672,7 @@ declare var MimeType: { } interface MimeTypeArray { - length: number; + readonly length: number; item(index: number): Plugin; namedItem(type: string): Plugin; [index: number]: Plugin; @@ -11845,30 +12684,30 @@ declare var MimeTypeArray: { } interface MouseEvent extends UIEvent { - altKey: boolean; - button: number; - buttons: number; - clientX: number; - clientY: number; - ctrlKey: boolean; - fromElement: Element; - layerX: number; - layerY: number; - metaKey: boolean; - movementX: number; - movementY: number; - offsetX: number; - offsetY: number; - pageX: number; - pageY: number; - relatedTarget: EventTarget; - screenX: number; - screenY: number; - shiftKey: boolean; - toElement: Element; - which: number; - x: number; - y: number; + readonly altKey: boolean; + readonly button: number; + readonly buttons: number; + readonly clientX: number; + readonly clientY: number; + readonly ctrlKey: boolean; + readonly fromElement: Element; + readonly layerX: number; + readonly layerY: number; + readonly metaKey: boolean; + readonly movementX: number; + readonly movementY: number; + readonly offsetX: number; + readonly offsetY: number; + readonly pageX: number; + readonly pageY: number; + readonly relatedTarget: EventTarget; + readonly screenX: number; + readonly screenY: number; + readonly shiftKey: boolean; + readonly toElement: Element; + readonly which: number; + readonly x: number; + readonly y: number; getModifierState(keyArg: string): boolean; 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; } @@ -11878,36 +12717,24 @@ declare var MouseEvent: { new(typeArg: string, eventInitDict?: MouseEventInit): MouseEvent; } -interface MouseWheelEvent extends MouseEvent { - wheelDelta: number; - wheelDeltaX: number; - wheelDeltaY: number; - initMouseWheelEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, screenXArg: number, screenYArg: number, clientXArg: number, clientYArg: number, buttonArg: number, relatedTargetArg: EventTarget, modifiersListArg: string, wheelDeltaArg: number): void; -} - -declare var MouseWheelEvent: { - prototype: MouseWheelEvent; - new(): MouseWheelEvent; -} - interface MutationEvent extends Event { - attrChange: number; - attrName: string; - newValue: string; - prevValue: string; - relatedNode: Node; + readonly attrChange: number; + readonly attrName: string; + readonly newValue: string; + readonly prevValue: string; + readonly relatedNode: Node; initMutationEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, relatedNodeArg: Node, prevValueArg: string, newValueArg: string, attrNameArg: string, attrChangeArg: number): void; - ADDITION: number; - MODIFICATION: number; - REMOVAL: number; + readonly ADDITION: number; + readonly MODIFICATION: number; + readonly REMOVAL: number; } declare var MutationEvent: { prototype: MutationEvent; new(): MutationEvent; - ADDITION: number; - MODIFICATION: number; - REMOVAL: number; + readonly ADDITION: number; + readonly MODIFICATION: number; + readonly REMOVAL: number; } interface MutationObserver { @@ -11922,15 +12749,15 @@ declare var MutationObserver: { } interface MutationRecord { - addedNodes: NodeList; - attributeName: string; - attributeNamespace: string; - nextSibling: Node; - oldValue: string; - previousSibling: Node; - removedNodes: NodeList; - target: Node; - type: string; + readonly addedNodes: NodeList; + readonly attributeName: string; + readonly attributeNamespace: string; + readonly nextSibling: Node; + readonly oldValue: string; + readonly previousSibling: Node; + readonly removedNodes: NodeList; + readonly target: Node; + readonly type: string; } declare var MutationRecord: { @@ -11939,7 +12766,7 @@ declare var MutationRecord: { } interface NamedNodeMap { - length: number; + readonly length: number; getNamedItem(name: string): Attr; getNamedItemNS(namespaceURI: string, localName: string): Attr; item(index: number): Attr; @@ -11956,8 +12783,8 @@ declare var NamedNodeMap: { } interface NavigationCompletedEvent extends NavigationEvent { - isSuccess: boolean; - webErrorStatus: number; + readonly isSuccess: boolean; + readonly webErrorStatus: number; } declare var NavigationCompletedEvent: { @@ -11966,7 +12793,7 @@ declare var NavigationCompletedEvent: { } interface NavigationEvent extends Event { - uri: string; + readonly uri: string; } declare var NavigationEvent: { @@ -11975,7 +12802,7 @@ declare var NavigationEvent: { } interface NavigationEventWithReferrer extends NavigationEvent { - referer: string; + readonly referer: string; } declare var NavigationEventWithReferrer: { @@ -11983,27 +12810,22 @@ declare var NavigationEventWithReferrer: { new(): NavigationEventWithReferrer; } -interface Navigator extends Object, NavigatorID, NavigatorOnLine, NavigatorContentUtils, NavigatorStorageUtils, NavigatorGeolocation, MSNavigatorDoNotTrack, MSFileSaver { - appCodeName: string; - appMinorVersion: string; - browserLanguage: string; - connectionSpeed: number; - cookieEnabled: boolean; - cpuClass: string; - language: string; - maxTouchPoints: number; - mimeTypes: MSMimeTypesCollection; - msManipulationViewsEnabled: boolean; - msMaxTouchPoints: number; - msPointerEnabled: boolean; - plugins: MSPluginsCollection; - pointerEnabled: boolean; - systemLanguage: string; - userLanguage: string; - webdriver: boolean; +interface Navigator extends Object, NavigatorID, NavigatorOnLine, NavigatorContentUtils, NavigatorStorageUtils, NavigatorGeolocation, MSNavigatorDoNotTrack, MSFileSaver, NavigatorUserMedia { + readonly appCodeName: string; + readonly cookieEnabled: boolean; + readonly language: string; + readonly maxTouchPoints: number; + readonly mimeTypes: MimeTypeArray; + readonly msManipulationViewsEnabled: boolean; + readonly msMaxTouchPoints: number; + readonly msPointerEnabled: boolean; + readonly plugins: PluginArray; + readonly pointerEnabled: boolean; + readonly webdriver: boolean; getGamepads(): Gamepad[]; javaEnabled(): boolean; msLaunchUri(uri: string, successCallback?: MSLaunchUriCallback, noHandlerCallback?: MSLaunchUriCallback): void; + requestMediaKeySystemAccess(keySystem: string, supportedConfigurations: MediaKeySystemConfiguration[]): PromiseLike; vibrate(pattern: number | number[]): boolean; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -12014,26 +12836,26 @@ declare var Navigator: { } interface Node extends EventTarget { - attributes: NamedNodeMap; - baseURI: string; - childNodes: NodeList; - firstChild: Node; - lastChild: Node; - localName: string; - namespaceURI: string; - nextSibling: Node; - nodeName: string; - nodeType: number; + readonly attributes: NamedNodeMap; + readonly baseURI: string; + readonly childNodes: NodeList; + readonly firstChild: Node; + readonly lastChild: Node; + readonly localName: string; + readonly namespaceURI: string; + readonly nextSibling: Node; + readonly nodeName: string; + readonly nodeType: number; nodeValue: string; - ownerDocument: Document; - parentElement: HTMLElement; - parentNode: Node; - prefix: string; - previousSibling: Node; + readonly ownerDocument: Document; + readonly parentElement: HTMLElement; + readonly parentNode: Node; + readonly previousSibling: Node; textContent: string; appendChild(newChild: Node): Node; cloneNode(deep?: boolean): Node; compareDocumentPosition(other: Node): number; + contains(child: Node): boolean; hasAttributes(): boolean; hasChildNodes(): boolean; insertBefore(newChild: Node, refChild?: Node): Node; @@ -12046,47 +12868,47 @@ interface Node extends EventTarget { removeChild(oldChild: Node): Node; replaceChild(newChild: Node, oldChild: Node): Node; contains(node: Node): boolean; - ATTRIBUTE_NODE: number; - CDATA_SECTION_NODE: number; - COMMENT_NODE: number; - DOCUMENT_FRAGMENT_NODE: number; - DOCUMENT_NODE: number; - DOCUMENT_POSITION_CONTAINED_BY: number; - DOCUMENT_POSITION_CONTAINS: number; - DOCUMENT_POSITION_DISCONNECTED: number; - DOCUMENT_POSITION_FOLLOWING: number; - DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC: number; - DOCUMENT_POSITION_PRECEDING: number; - DOCUMENT_TYPE_NODE: number; - ELEMENT_NODE: number; - ENTITY_NODE: number; - ENTITY_REFERENCE_NODE: number; - NOTATION_NODE: number; - PROCESSING_INSTRUCTION_NODE: number; - TEXT_NODE: number; + readonly ATTRIBUTE_NODE: number; + readonly CDATA_SECTION_NODE: number; + readonly COMMENT_NODE: number; + readonly DOCUMENT_FRAGMENT_NODE: number; + readonly DOCUMENT_NODE: number; + readonly DOCUMENT_POSITION_CONTAINED_BY: number; + readonly DOCUMENT_POSITION_CONTAINS: number; + readonly DOCUMENT_POSITION_DISCONNECTED: number; + readonly DOCUMENT_POSITION_FOLLOWING: number; + readonly DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC: number; + readonly DOCUMENT_POSITION_PRECEDING: number; + readonly DOCUMENT_TYPE_NODE: number; + readonly ELEMENT_NODE: number; + readonly ENTITY_NODE: number; + readonly ENTITY_REFERENCE_NODE: number; + readonly NOTATION_NODE: number; + readonly PROCESSING_INSTRUCTION_NODE: number; + readonly TEXT_NODE: number; } declare var Node: { prototype: Node; new(): Node; - ATTRIBUTE_NODE: number; - CDATA_SECTION_NODE: number; - COMMENT_NODE: number; - DOCUMENT_FRAGMENT_NODE: number; - DOCUMENT_NODE: number; - DOCUMENT_POSITION_CONTAINED_BY: number; - DOCUMENT_POSITION_CONTAINS: number; - DOCUMENT_POSITION_DISCONNECTED: number; - DOCUMENT_POSITION_FOLLOWING: number; - DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC: number; - DOCUMENT_POSITION_PRECEDING: number; - DOCUMENT_TYPE_NODE: number; - ELEMENT_NODE: number; - ENTITY_NODE: number; - ENTITY_REFERENCE_NODE: number; - NOTATION_NODE: number; - PROCESSING_INSTRUCTION_NODE: number; - TEXT_NODE: number; + readonly ATTRIBUTE_NODE: number; + readonly CDATA_SECTION_NODE: number; + readonly COMMENT_NODE: number; + readonly DOCUMENT_FRAGMENT_NODE: number; + readonly DOCUMENT_NODE: number; + readonly DOCUMENT_POSITION_CONTAINED_BY: number; + readonly DOCUMENT_POSITION_CONTAINS: number; + readonly DOCUMENT_POSITION_DISCONNECTED: number; + readonly DOCUMENT_POSITION_FOLLOWING: number; + readonly DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC: number; + readonly DOCUMENT_POSITION_PRECEDING: number; + readonly DOCUMENT_TYPE_NODE: number; + readonly ELEMENT_NODE: number; + readonly ENTITY_NODE: number; + readonly ENTITY_REFERENCE_NODE: number; + readonly NOTATION_NODE: number; + readonly PROCESSING_INSTRUCTION_NODE: number; + readonly TEXT_NODE: number; } interface NodeFilter { @@ -12094,29 +12916,29 @@ interface NodeFilter { } declare var NodeFilter: { - FILTER_ACCEPT: number; - FILTER_REJECT: number; - FILTER_SKIP: number; - SHOW_ALL: number; - SHOW_ATTRIBUTE: number; - SHOW_CDATA_SECTION: number; - SHOW_COMMENT: number; - SHOW_DOCUMENT: number; - SHOW_DOCUMENT_FRAGMENT: number; - SHOW_DOCUMENT_TYPE: number; - SHOW_ELEMENT: number; - SHOW_ENTITY: number; - SHOW_ENTITY_REFERENCE: number; - SHOW_NOTATION: number; - SHOW_PROCESSING_INSTRUCTION: number; - SHOW_TEXT: number; + readonly FILTER_ACCEPT: number; + readonly FILTER_REJECT: number; + readonly FILTER_SKIP: number; + readonly SHOW_ALL: number; + readonly SHOW_ATTRIBUTE: number; + readonly SHOW_CDATA_SECTION: number; + readonly SHOW_COMMENT: number; + readonly SHOW_DOCUMENT: number; + readonly SHOW_DOCUMENT_FRAGMENT: number; + readonly SHOW_DOCUMENT_TYPE: number; + readonly SHOW_ELEMENT: number; + readonly SHOW_ENTITY: number; + readonly SHOW_ENTITY_REFERENCE: number; + readonly SHOW_NOTATION: number; + readonly SHOW_PROCESSING_INSTRUCTION: number; + readonly SHOW_TEXT: number; } interface NodeIterator { - expandEntityReferences: boolean; - filter: NodeFilter; - root: Node; - whatToShow: number; + readonly expandEntityReferences: boolean; + readonly filter: NodeFilter; + readonly root: Node; + readonly whatToShow: number; detach(): void; nextNode(): Node; previousNode(): Node; @@ -12128,7 +12950,7 @@ declare var NodeIterator: { } interface NodeList { - length: number; + readonly length: number; item(index: number): Node; [index: number]: Node; } @@ -12147,13 +12969,13 @@ declare var OES_element_index_uint: { } interface OES_standard_derivatives { - FRAGMENT_SHADER_DERIVATIVE_HINT_OES: number; + readonly FRAGMENT_SHADER_DERIVATIVE_HINT_OES: number; } declare var OES_standard_derivatives: { prototype: OES_standard_derivatives; new(): OES_standard_derivatives; - FRAGMENT_SHADER_DERIVATIVE_HINT_OES: number; + readonly FRAGMENT_SHADER_DERIVATIVE_HINT_OES: number; } interface OES_texture_float { @@ -12173,7 +12995,7 @@ declare var OES_texture_float_linear: { } interface OfflineAudioCompletionEvent extends Event { - renderedBuffer: AudioBuffer; + readonly renderedBuffer: AudioBuffer; } declare var OfflineAudioCompletionEvent: { @@ -12183,7 +13005,7 @@ declare var OfflineAudioCompletionEvent: { interface OfflineAudioContext extends AudioContext { oncomplete: (ev: Event) => any; - startRendering(): void; + startRendering(): PromiseLike; addEventListener(type: "complete", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -12194,14 +13016,14 @@ declare var OfflineAudioContext: { } interface OscillatorNode extends AudioNode { - detune: AudioParam; - frequency: AudioParam; - onended: (ev: Event) => any; + readonly detune: AudioParam; + readonly frequency: AudioParam; + onended: (ev: MediaStreamErrorEvent) => any; type: string; setPeriodicWave(periodicWave: PeriodicWave): void; start(when?: number): void; stop(when?: number): void; - addEventListener(type: "ended", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "ended", listener: (ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -12210,8 +13032,25 @@ declare var OscillatorNode: { new(): OscillatorNode; } +interface OverflowEvent extends UIEvent { + readonly horizontalOverflow: boolean; + readonly orient: number; + readonly verticalOverflow: boolean; + readonly BOTH: number; + readonly HORIZONTAL: number; + readonly VERTICAL: number; +} + +declare var OverflowEvent: { + prototype: OverflowEvent; + new(): OverflowEvent; + readonly BOTH: number; + readonly HORIZONTAL: number; + readonly VERTICAL: number; +} + interface PageTransitionEvent extends Event { - persisted: boolean; + readonly persisted: boolean; } declare var PageTransitionEvent: { @@ -12239,17 +13078,17 @@ declare var PannerNode: { } interface PerfWidgetExternal { - activeNetworkRequestCount: number; - averageFrameTime: number; - averagePaintTime: number; - extraInformationEnabled: boolean; - independentRenderingEnabled: boolean; - irDisablingContentString: string; - irStatusAvailable: boolean; - maxCpuSpeed: number; - paintRequestsPerSecond: number; - performanceCounter: number; - performanceCounterFrequency: number; + readonly activeNetworkRequestCount: number; + readonly averageFrameTime: number; + readonly averagePaintTime: number; + readonly extraInformationEnabled: boolean; + readonly independentRenderingEnabled: boolean; + readonly irDisablingContentString: string; + readonly irStatusAvailable: boolean; + readonly maxCpuSpeed: number; + readonly paintRequestsPerSecond: number; + readonly performanceCounter: number; + readonly performanceCounterFrequency: number; addEventListener(eventType: string, callback: Function): void; getMemoryUsage(): number; getProcessCpuUsage(): number; @@ -12268,8 +13107,8 @@ declare var PerfWidgetExternal: { } interface Performance { - navigation: PerformanceNavigation; - timing: PerformanceTiming; + readonly navigation: PerformanceNavigation; + readonly timing: PerformanceTiming; clearMarks(markName?: string): void; clearMeasures(measureName?: string): void; clearResourceTimings(): void; @@ -12291,10 +13130,10 @@ declare var Performance: { } interface PerformanceEntry { - duration: number; - entryType: string; - name: string; - startTime: number; + readonly duration: number; + readonly entryType: string; + readonly name: string; + readonly startTime: number; } declare var PerformanceEntry: { @@ -12319,47 +13158,47 @@ declare var PerformanceMeasure: { } interface PerformanceNavigation { - redirectCount: number; - type: number; + readonly redirectCount: number; + readonly type: number; toJSON(): any; - TYPE_BACK_FORWARD: number; - TYPE_NAVIGATE: number; - TYPE_RELOAD: number; - TYPE_RESERVED: number; + readonly TYPE_BACK_FORWARD: number; + readonly TYPE_NAVIGATE: number; + readonly TYPE_RELOAD: number; + readonly TYPE_RESERVED: number; } declare var PerformanceNavigation: { prototype: PerformanceNavigation; new(): PerformanceNavigation; - TYPE_BACK_FORWARD: number; - TYPE_NAVIGATE: number; - TYPE_RELOAD: number; - TYPE_RESERVED: number; + readonly TYPE_BACK_FORWARD: number; + readonly TYPE_NAVIGATE: number; + readonly TYPE_RELOAD: number; + readonly TYPE_RESERVED: number; } interface PerformanceNavigationTiming extends PerformanceEntry { - connectEnd: number; - connectStart: number; - domComplete: number; - domContentLoadedEventEnd: number; - domContentLoadedEventStart: number; - domInteractive: number; - domLoading: number; - domainLookupEnd: number; - domainLookupStart: number; - fetchStart: number; - loadEventEnd: number; - loadEventStart: number; - navigationStart: number; - redirectCount: number; - redirectEnd: number; - redirectStart: number; - requestStart: number; - responseEnd: number; - responseStart: number; - type: string; - unloadEventEnd: number; - unloadEventStart: number; + readonly connectEnd: number; + readonly connectStart: number; + readonly domComplete: number; + readonly domContentLoadedEventEnd: number; + readonly domContentLoadedEventStart: number; + readonly domInteractive: number; + readonly domLoading: number; + readonly domainLookupEnd: number; + readonly domainLookupStart: number; + readonly fetchStart: number; + readonly loadEventEnd: number; + readonly loadEventStart: number; + readonly navigationStart: number; + readonly redirectCount: number; + readonly redirectEnd: number; + readonly redirectStart: number; + readonly requestStart: number; + readonly responseEnd: number; + readonly responseStart: number; + readonly type: string; + readonly unloadEventEnd: number; + readonly unloadEventStart: number; } declare var PerformanceNavigationTiming: { @@ -12368,17 +13207,17 @@ declare var PerformanceNavigationTiming: { } interface PerformanceResourceTiming extends PerformanceEntry { - connectEnd: number; - connectStart: number; - domainLookupEnd: number; - domainLookupStart: number; - fetchStart: number; - initiatorType: string; - redirectEnd: number; - redirectStart: number; - requestStart: number; - responseEnd: number; - responseStart: number; + readonly connectEnd: number; + readonly connectStart: number; + readonly domainLookupEnd: number; + readonly domainLookupStart: number; + readonly fetchStart: number; + readonly initiatorType: string; + readonly redirectEnd: number; + readonly redirectStart: number; + readonly requestStart: number; + readonly responseEnd: number; + readonly responseStart: number; } declare var PerformanceResourceTiming: { @@ -12387,27 +13226,27 @@ declare var PerformanceResourceTiming: { } interface PerformanceTiming { - connectEnd: number; - connectStart: number; - domComplete: number; - domContentLoadedEventEnd: number; - domContentLoadedEventStart: number; - domInteractive: number; - domLoading: number; - domainLookupEnd: number; - domainLookupStart: number; - fetchStart: number; - loadEventEnd: number; - loadEventStart: number; - msFirstPaint: number; - navigationStart: number; - redirectEnd: number; - redirectStart: number; - requestStart: number; - responseEnd: number; - responseStart: number; - unloadEventEnd: number; - unloadEventStart: number; + readonly connectEnd: number; + readonly connectStart: number; + readonly domComplete: number; + readonly domContentLoadedEventEnd: number; + readonly domContentLoadedEventStart: number; + readonly domInteractive: number; + readonly domLoading: number; + readonly domainLookupEnd: number; + readonly domainLookupStart: number; + readonly fetchStart: number; + readonly loadEventEnd: number; + readonly loadEventStart: number; + readonly msFirstPaint: number; + readonly navigationStart: number; + readonly redirectEnd: number; + readonly redirectStart: number; + readonly requestStart: number; + readonly responseEnd: number; + readonly responseStart: number; + readonly unloadEventEnd: number; + readonly unloadEventStart: number; toJSON(): any; } @@ -12425,7 +13264,7 @@ declare var PeriodicWave: { } interface PermissionRequest extends DeferredPermissionRequest { - state: string; + readonly state: string; defer(): void; } @@ -12435,7 +13274,7 @@ declare var PermissionRequest: { } interface PermissionRequestedEvent extends Event { - permissionRequest: PermissionRequest; + readonly permissionRequest: PermissionRequest; } declare var PermissionRequestedEvent: { @@ -12444,11 +13283,11 @@ declare var PermissionRequestedEvent: { } interface Plugin { - description: string; - filename: string; - length: number; - name: string; - version: string; + readonly description: string; + readonly filename: string; + readonly length: number; + readonly name: string; + readonly version: string; item(index: number): MimeType; namedItem(type: string): MimeType; [index: number]: MimeType; @@ -12460,7 +13299,7 @@ declare var Plugin: { } interface PluginArray { - length: number; + readonly length: number; item(index: number): Plugin; namedItem(name: string): Plugin; refresh(reload?: boolean): void; @@ -12473,18 +13312,18 @@ declare var PluginArray: { } interface PointerEvent extends MouseEvent { - currentPoint: any; - height: number; - hwTimestamp: number; - intermediatePoints: any; - isPrimary: boolean; - pointerId: number; - pointerType: any; - pressure: number; - rotation: number; - tiltX: number; - tiltY: number; - width: number; + readonly currentPoint: any; + readonly height: number; + readonly hwTimestamp: number; + readonly intermediatePoints: any; + readonly isPrimary: boolean; + readonly pointerId: number; + readonly pointerType: any; + readonly pressure: number; + readonly rotation: number; + readonly tiltX: number; + readonly tiltY: number; + readonly width: number; getCurrentPoint(element: Element): void; getIntermediatePoints(element: Element): void; 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; @@ -12496,7 +13335,7 @@ declare var PointerEvent: { } interface PopStateEvent extends Event { - state: any; + readonly state: any; initPopStateEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, stateArg: any): void; } @@ -12506,8 +13345,8 @@ declare var PopStateEvent: { } interface Position { - coords: Coordinates; - timestamp: number; + readonly coords: Coordinates; + readonly timestamp: number; } declare var Position: { @@ -12516,24 +13355,24 @@ declare var Position: { } interface PositionError { - code: number; - message: string; + readonly code: number; + readonly message: string; toString(): string; - PERMISSION_DENIED: number; - POSITION_UNAVAILABLE: number; - TIMEOUT: number; + readonly PERMISSION_DENIED: number; + readonly POSITION_UNAVAILABLE: number; + readonly TIMEOUT: number; } declare var PositionError: { prototype: PositionError; new(): PositionError; - PERMISSION_DENIED: number; - POSITION_UNAVAILABLE: number; - TIMEOUT: number; + readonly PERMISSION_DENIED: number; + readonly POSITION_UNAVAILABLE: number; + readonly TIMEOUT: number; } interface ProcessingInstruction extends CharacterData { - target: string; + readonly target: string; } declare var ProcessingInstruction: { @@ -12542,9 +13381,9 @@ declare var ProcessingInstruction: { } interface ProgressEvent extends Event { - lengthComputable: boolean; - loaded: number; - total: number; + readonly lengthComputable: boolean; + readonly loaded: number; + readonly total: number; initProgressEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, lengthComputableArg: boolean, loadedArg: number, totalArg: number): void; } @@ -12553,13 +13392,210 @@ declare var ProgressEvent: { new(type: string, eventInitDict?: ProgressEventInit): ProgressEvent; } +interface RTCDTMFToneChangeEvent extends Event { + readonly tone: string; +} + +declare var RTCDTMFToneChangeEvent: { + prototype: RTCDTMFToneChangeEvent; + new(type: string, eventInitDict: RTCDTMFToneChangeEventInit): RTCDTMFToneChangeEvent; +} + +interface RTCDtlsTransport extends RTCStatsProvider { + ondtlsstatechange: (ev: RTCDtlsTransportStateChangedEvent) => any; + onerror: (ev: Event) => any; + readonly state: string; + readonly transport: RTCIceTransport; + getLocalParameters(): RTCDtlsParameters; + getRemoteCertificates(): ArrayBuffer[]; + getRemoteParameters(): RTCDtlsParameters; + start(remoteParameters: RTCDtlsParameters): void; + stop(): void; + addEventListener(type: "dtlsstatechange", listener: (ev: RTCDtlsTransportStateChangedEvent) => any, useCapture?: boolean): void; + addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var RTCDtlsTransport: { + prototype: RTCDtlsTransport; + new(transport: RTCIceTransport): RTCDtlsTransport; +} + +interface RTCDtlsTransportStateChangedEvent extends Event { + readonly state: string; +} + +declare var RTCDtlsTransportStateChangedEvent: { + prototype: RTCDtlsTransportStateChangedEvent; + new(): RTCDtlsTransportStateChangedEvent; +} + +interface RTCDtmfSender extends EventTarget { + readonly canInsertDTMF: boolean; + readonly duration: number; + readonly interToneGap: number; + ontonechange: (ev: RTCDTMFToneChangeEvent) => any; + readonly sender: RTCRtpSender; + readonly toneBuffer: string; + insertDTMF(tones: string, duration?: number, interToneGap?: number): void; + addEventListener(type: "tonechange", listener: (ev: RTCDTMFToneChangeEvent) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var RTCDtmfSender: { + prototype: RTCDtmfSender; + new(sender: RTCRtpSender): RTCDtmfSender; +} + +interface RTCIceCandidatePairChangedEvent extends Event { + readonly pair: RTCIceCandidatePair; +} + +declare var RTCIceCandidatePairChangedEvent: { + prototype: RTCIceCandidatePairChangedEvent; + new(): RTCIceCandidatePairChangedEvent; +} + +interface RTCIceGatherer extends RTCStatsProvider { + readonly component: string; + onerror: (ev: Event) => any; + onlocalcandidate: (ev: RTCIceGathererEvent) => any; + createAssociatedGatherer(): RTCIceGatherer; + getLocalCandidates(): RTCIceCandidate[]; + getLocalParameters(): RTCIceParameters; + addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: "localcandidate", listener: (ev: RTCIceGathererEvent) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var RTCIceGatherer: { + prototype: RTCIceGatherer; + new(options: RTCIceGatherOptions): RTCIceGatherer; +} + +interface RTCIceGathererEvent extends Event { + readonly candidate: RTCIceCandidate | RTCIceCandidateComplete; +} + +declare var RTCIceGathererEvent: { + prototype: RTCIceGathererEvent; + new(): RTCIceGathererEvent; +} + +interface RTCIceTransport extends RTCStatsProvider { + readonly component: string; + readonly iceGatherer: RTCIceGatherer; + oncandidatepairchange: (ev: RTCIceCandidatePairChangedEvent) => any; + onicestatechange: (ev: RTCIceTransportStateChangedEvent) => any; + readonly role: string; + readonly state: string; + addRemoteCandidate(remoteCandidate: RTCIceCandidate | RTCIceCandidateComplete): void; + createAssociatedTransport(): RTCIceTransport; + getNominatedCandidatePair(): RTCIceCandidatePair; + getRemoteCandidates(): RTCIceCandidate[]; + getRemoteParameters(): RTCIceParameters; + setRemoteCandidates(remoteCandidates: RTCIceCandidate[]): void; + start(gatherer: RTCIceGatherer, remoteParameters: RTCIceParameters, role?: string): void; + stop(): void; + addEventListener(type: "candidatepairchange", listener: (ev: RTCIceCandidatePairChangedEvent) => any, useCapture?: boolean): void; + addEventListener(type: "icestatechange", listener: (ev: RTCIceTransportStateChangedEvent) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var RTCIceTransport: { + prototype: RTCIceTransport; + new(): RTCIceTransport; +} + +interface RTCIceTransportStateChangedEvent extends Event { + readonly state: string; +} + +declare var RTCIceTransportStateChangedEvent: { + prototype: RTCIceTransportStateChangedEvent; + new(): RTCIceTransportStateChangedEvent; +} + +interface RTCRtpReceiver extends RTCStatsProvider { + onerror: (ev: Event) => any; + readonly rtcpTransport: RTCDtlsTransport; + readonly track: MediaStreamTrack; + readonly transport: RTCDtlsTransport | RTCSrtpSdesTransport; + getContributingSources(): RTCRtpContributingSource[]; + receive(parameters: RTCRtpParameters): void; + requestSendCSRC(csrc: number): void; + setTransport(transport: RTCDtlsTransport | RTCSrtpSdesTransport, rtcpTransport?: RTCDtlsTransport): void; + stop(): void; + addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var RTCRtpReceiver: { + prototype: RTCRtpReceiver; + new(transport: RTCDtlsTransport | RTCSrtpSdesTransport, kind: string, rtcpTransport?: RTCDtlsTransport): RTCRtpReceiver; + getCapabilities(kind?: string): RTCRtpCapabilities; +} + +interface RTCRtpSender extends RTCStatsProvider { + onerror: (ev: Event) => any; + onssrcconflict: (ev: RTCSsrcConflictEvent) => any; + readonly rtcpTransport: RTCDtlsTransport; + readonly track: MediaStreamTrack; + readonly transport: RTCDtlsTransport | RTCSrtpSdesTransport; + send(parameters: RTCRtpParameters): void; + setTrack(track: MediaStreamTrack): void; + setTransport(transport: RTCDtlsTransport | RTCSrtpSdesTransport, rtcpTransport?: RTCDtlsTransport): void; + stop(): void; + addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: "ssrcconflict", listener: (ev: RTCSsrcConflictEvent) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var RTCRtpSender: { + prototype: RTCRtpSender; + new(track: MediaStreamTrack, transport: RTCDtlsTransport | RTCSrtpSdesTransport, rtcpTransport?: RTCDtlsTransport): RTCRtpSender; + getCapabilities(kind?: string): RTCRtpCapabilities; +} + +interface RTCSrtpSdesTransport extends EventTarget { + onerror: (ev: Event) => any; + readonly transport: RTCIceTransport; + addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var RTCSrtpSdesTransport: { + prototype: RTCSrtpSdesTransport; + new(transport: RTCIceTransport, encryptParameters: RTCSrtpSdesParameters, decryptParameters: RTCSrtpSdesParameters): RTCSrtpSdesTransport; + getLocalParameters(): RTCSrtpSdesParameters[]; +} + +interface RTCSsrcConflictEvent extends Event { + readonly ssrc: number; +} + +declare var RTCSsrcConflictEvent: { + prototype: RTCSsrcConflictEvent; + new(): RTCSsrcConflictEvent; +} + +interface RTCStatsProvider extends EventTarget { + getStats(): PromiseLike; + msGetStats(): PromiseLike; +} + +declare var RTCStatsProvider: { + prototype: RTCStatsProvider; + new(): RTCStatsProvider; +} + interface Range { - collapsed: boolean; - commonAncestorContainer: Node; - endContainer: Node; - endOffset: number; - startContainer: Node; - startOffset: number; + readonly collapsed: boolean; + readonly commonAncestorContainer: Node; + readonly endContainer: Node; + readonly endOffset: number; + readonly startContainer: Node; + readonly startOffset: number; cloneContents(): DocumentFragment; cloneRange(): Range; collapse(toStart: boolean): void; @@ -12582,23 +13618,23 @@ interface Range { setStartBefore(refNode: Node): void; surroundContents(newParent: Node): void; toString(): string; - END_TO_END: number; - END_TO_START: number; - START_TO_END: number; - START_TO_START: number; + readonly END_TO_END: number; + readonly END_TO_START: number; + readonly START_TO_END: number; + readonly START_TO_START: number; } declare var Range: { prototype: Range; new(): Range; - END_TO_END: number; - END_TO_START: number; - START_TO_END: number; - START_TO_START: number; + readonly END_TO_END: number; + readonly END_TO_START: number; + readonly START_TO_END: number; + readonly START_TO_START: number; } interface SVGAElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired, SVGURIReference { - target: SVGAnimatedString; + readonly target: SVGAnimatedString; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -12608,32 +13644,32 @@ declare var SVGAElement: { } interface SVGAngle { - unitType: number; + readonly unitType: number; value: number; valueAsString: string; valueInSpecifiedUnits: number; convertToSpecifiedUnits(unitType: number): void; newValueSpecifiedUnits(unitType: number, valueInSpecifiedUnits: number): void; - SVG_ANGLETYPE_DEG: number; - SVG_ANGLETYPE_GRAD: number; - SVG_ANGLETYPE_RAD: number; - SVG_ANGLETYPE_UNKNOWN: number; - SVG_ANGLETYPE_UNSPECIFIED: number; + readonly SVG_ANGLETYPE_DEG: number; + readonly SVG_ANGLETYPE_GRAD: number; + readonly SVG_ANGLETYPE_RAD: number; + readonly SVG_ANGLETYPE_UNKNOWN: number; + readonly SVG_ANGLETYPE_UNSPECIFIED: number; } declare var SVGAngle: { prototype: SVGAngle; new(): SVGAngle; - SVG_ANGLETYPE_DEG: number; - SVG_ANGLETYPE_GRAD: number; - SVG_ANGLETYPE_RAD: number; - SVG_ANGLETYPE_UNKNOWN: number; - SVG_ANGLETYPE_UNSPECIFIED: number; + readonly SVG_ANGLETYPE_DEG: number; + readonly SVG_ANGLETYPE_GRAD: number; + readonly SVG_ANGLETYPE_RAD: number; + readonly SVG_ANGLETYPE_UNKNOWN: number; + readonly SVG_ANGLETYPE_UNSPECIFIED: number; } interface SVGAnimatedAngle { - animVal: SVGAngle; - baseVal: SVGAngle; + readonly animVal: SVGAngle; + readonly baseVal: SVGAngle; } declare var SVGAnimatedAngle: { @@ -12642,7 +13678,7 @@ declare var SVGAnimatedAngle: { } interface SVGAnimatedBoolean { - animVal: boolean; + readonly animVal: boolean; baseVal: boolean; } @@ -12652,7 +13688,7 @@ declare var SVGAnimatedBoolean: { } interface SVGAnimatedEnumeration { - animVal: number; + readonly animVal: number; baseVal: number; } @@ -12662,7 +13698,7 @@ declare var SVGAnimatedEnumeration: { } interface SVGAnimatedInteger { - animVal: number; + readonly animVal: number; baseVal: number; } @@ -12672,8 +13708,8 @@ declare var SVGAnimatedInteger: { } interface SVGAnimatedLength { - animVal: SVGLength; - baseVal: SVGLength; + readonly animVal: SVGLength; + readonly baseVal: SVGLength; } declare var SVGAnimatedLength: { @@ -12682,8 +13718,8 @@ declare var SVGAnimatedLength: { } interface SVGAnimatedLengthList { - animVal: SVGLengthList; - baseVal: SVGLengthList; + readonly animVal: SVGLengthList; + readonly baseVal: SVGLengthList; } declare var SVGAnimatedLengthList: { @@ -12692,7 +13728,7 @@ declare var SVGAnimatedLengthList: { } interface SVGAnimatedNumber { - animVal: number; + readonly animVal: number; baseVal: number; } @@ -12702,8 +13738,8 @@ declare var SVGAnimatedNumber: { } interface SVGAnimatedNumberList { - animVal: SVGNumberList; - baseVal: SVGNumberList; + readonly animVal: SVGNumberList; + readonly baseVal: SVGNumberList; } declare var SVGAnimatedNumberList: { @@ -12712,8 +13748,8 @@ declare var SVGAnimatedNumberList: { } interface SVGAnimatedPreserveAspectRatio { - animVal: SVGPreserveAspectRatio; - baseVal: SVGPreserveAspectRatio; + readonly animVal: SVGPreserveAspectRatio; + readonly baseVal: SVGPreserveAspectRatio; } declare var SVGAnimatedPreserveAspectRatio: { @@ -12722,8 +13758,8 @@ declare var SVGAnimatedPreserveAspectRatio: { } interface SVGAnimatedRect { - animVal: SVGRect; - baseVal: SVGRect; + readonly animVal: SVGRect; + readonly baseVal: SVGRect; } declare var SVGAnimatedRect: { @@ -12732,7 +13768,7 @@ declare var SVGAnimatedRect: { } interface SVGAnimatedString { - animVal: string; + readonly animVal: string; baseVal: string; } @@ -12742,8 +13778,8 @@ declare var SVGAnimatedString: { } interface SVGAnimatedTransformList { - animVal: SVGTransformList; - baseVal: SVGTransformList; + readonly animVal: SVGTransformList; + readonly baseVal: SVGTransformList; } declare var SVGAnimatedTransformList: { @@ -12752,9 +13788,9 @@ declare var SVGAnimatedTransformList: { } interface SVGCircleElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired { - cx: SVGAnimatedLength; - cy: SVGAnimatedLength; - r: SVGAnimatedLength; + readonly cx: SVGAnimatedLength; + readonly cy: SVGAnimatedLength; + readonly r: SVGAnimatedLength; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -12764,7 +13800,7 @@ declare var SVGCircleElement: { } interface SVGClipPathElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired, SVGUnitTypes { - clipPathUnits: SVGAnimatedEnumeration; + readonly clipPathUnits: SVGAnimatedEnumeration; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -12774,30 +13810,30 @@ declare var SVGClipPathElement: { } interface SVGComponentTransferFunctionElement extends SVGElement { - amplitude: SVGAnimatedNumber; - exponent: SVGAnimatedNumber; - intercept: SVGAnimatedNumber; - offset: SVGAnimatedNumber; - slope: SVGAnimatedNumber; - tableValues: SVGAnimatedNumberList; - type: SVGAnimatedEnumeration; - SVG_FECOMPONENTTRANSFER_TYPE_DISCRETE: number; - SVG_FECOMPONENTTRANSFER_TYPE_GAMMA: number; - SVG_FECOMPONENTTRANSFER_TYPE_IDENTITY: number; - SVG_FECOMPONENTTRANSFER_TYPE_LINEAR: number; - SVG_FECOMPONENTTRANSFER_TYPE_TABLE: number; - SVG_FECOMPONENTTRANSFER_TYPE_UNKNOWN: number; + readonly amplitude: SVGAnimatedNumber; + readonly exponent: SVGAnimatedNumber; + readonly intercept: SVGAnimatedNumber; + readonly offset: SVGAnimatedNumber; + readonly slope: SVGAnimatedNumber; + readonly tableValues: SVGAnimatedNumberList; + readonly type: SVGAnimatedEnumeration; + readonly SVG_FECOMPONENTTRANSFER_TYPE_DISCRETE: number; + readonly SVG_FECOMPONENTTRANSFER_TYPE_GAMMA: number; + readonly SVG_FECOMPONENTTRANSFER_TYPE_IDENTITY: number; + readonly SVG_FECOMPONENTTRANSFER_TYPE_LINEAR: number; + readonly SVG_FECOMPONENTTRANSFER_TYPE_TABLE: number; + readonly SVG_FECOMPONENTTRANSFER_TYPE_UNKNOWN: number; } declare var SVGComponentTransferFunctionElement: { prototype: SVGComponentTransferFunctionElement; new(): SVGComponentTransferFunctionElement; - SVG_FECOMPONENTTRANSFER_TYPE_DISCRETE: number; - SVG_FECOMPONENTTRANSFER_TYPE_GAMMA: number; - SVG_FECOMPONENTTRANSFER_TYPE_IDENTITY: number; - SVG_FECOMPONENTTRANSFER_TYPE_LINEAR: number; - SVG_FECOMPONENTTRANSFER_TYPE_TABLE: number; - SVG_FECOMPONENTTRANSFER_TYPE_UNKNOWN: number; + readonly SVG_FECOMPONENTTRANSFER_TYPE_DISCRETE: number; + readonly SVG_FECOMPONENTTRANSFER_TYPE_GAMMA: number; + readonly SVG_FECOMPONENTTRANSFER_TYPE_IDENTITY: number; + readonly SVG_FECOMPONENTTRANSFER_TYPE_LINEAR: number; + readonly SVG_FECOMPONENTTRANSFER_TYPE_TABLE: number; + readonly SVG_FECOMPONENTTRANSFER_TYPE_UNKNOWN: number; } interface SVGDefsElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired { @@ -12819,7 +13855,6 @@ declare var SVGDescElement: { } interface SVGElement extends Element { - id: string; onclick: (ev: MouseEvent) => any; ondblclick: (ev: MouseEvent) => any; onfocusin: (ev: FocusEvent) => any; @@ -12830,8 +13865,8 @@ interface SVGElement extends Element { onmouseout: (ev: MouseEvent) => any; onmouseover: (ev: MouseEvent) => any; onmouseup: (ev: MouseEvent) => any; - ownerSVGElement: SVGSVGElement; - viewportElement: SVGElement; + readonly ownerSVGElement: SVGSVGElement; + readonly viewportElement: SVGElement; xmlbase: string; className: any; addEventListener(type: "MSGestureChange", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void; @@ -12889,14 +13924,14 @@ declare var SVGElement: { } interface SVGElementInstance extends EventTarget { - childNodes: SVGElementInstanceList; - correspondingElement: SVGElement; - correspondingUseElement: SVGUseElement; - firstChild: SVGElementInstance; - lastChild: SVGElementInstance; - nextSibling: SVGElementInstance; - parentNode: SVGElementInstance; - previousSibling: SVGElementInstance; + readonly childNodes: SVGElementInstanceList; + readonly correspondingElement: SVGElement; + readonly correspondingUseElement: SVGUseElement; + readonly firstChild: SVGElementInstance; + readonly lastChild: SVGElementInstance; + readonly nextSibling: SVGElementInstance; + readonly parentNode: SVGElementInstance; + readonly previousSibling: SVGElementInstance; } declare var SVGElementInstance: { @@ -12905,7 +13940,7 @@ declare var SVGElementInstance: { } interface SVGElementInstanceList { - length: number; + readonly length: number; item(index: number): SVGElementInstance; } @@ -12915,10 +13950,10 @@ declare var SVGElementInstanceList: { } interface SVGEllipseElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired { - cx: SVGAnimatedLength; - cy: SVGAnimatedLength; - rx: SVGAnimatedLength; - ry: SVGAnimatedLength; + readonly cx: SVGAnimatedLength; + readonly cy: SVGAnimatedLength; + readonly rx: SVGAnimatedLength; + readonly ry: SVGAnimatedLength; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -12928,75 +13963,75 @@ declare var SVGEllipseElement: { } interface SVGFEBlendElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { - in1: SVGAnimatedString; - in2: SVGAnimatedString; - mode: SVGAnimatedEnumeration; - SVG_FEBLEND_MODE_COLOR: number; - SVG_FEBLEND_MODE_COLOR_BURN: number; - SVG_FEBLEND_MODE_COLOR_DODGE: number; - SVG_FEBLEND_MODE_DARKEN: number; - SVG_FEBLEND_MODE_DIFFERENCE: number; - SVG_FEBLEND_MODE_EXCLUSION: number; - SVG_FEBLEND_MODE_HARD_LIGHT: number; - SVG_FEBLEND_MODE_HUE: number; - SVG_FEBLEND_MODE_LIGHTEN: number; - SVG_FEBLEND_MODE_LUMINOSITY: number; - SVG_FEBLEND_MODE_MULTIPLY: number; - SVG_FEBLEND_MODE_NORMAL: number; - SVG_FEBLEND_MODE_OVERLAY: number; - SVG_FEBLEND_MODE_SATURATION: number; - SVG_FEBLEND_MODE_SCREEN: number; - SVG_FEBLEND_MODE_SOFT_LIGHT: number; - SVG_FEBLEND_MODE_UNKNOWN: number; + readonly in1: SVGAnimatedString; + readonly in2: SVGAnimatedString; + readonly mode: SVGAnimatedEnumeration; + readonly SVG_FEBLEND_MODE_COLOR: number; + readonly SVG_FEBLEND_MODE_COLOR_BURN: number; + readonly SVG_FEBLEND_MODE_COLOR_DODGE: number; + readonly SVG_FEBLEND_MODE_DARKEN: number; + readonly SVG_FEBLEND_MODE_DIFFERENCE: number; + readonly SVG_FEBLEND_MODE_EXCLUSION: number; + readonly SVG_FEBLEND_MODE_HARD_LIGHT: number; + readonly SVG_FEBLEND_MODE_HUE: number; + readonly SVG_FEBLEND_MODE_LIGHTEN: number; + readonly SVG_FEBLEND_MODE_LUMINOSITY: number; + readonly SVG_FEBLEND_MODE_MULTIPLY: number; + readonly SVG_FEBLEND_MODE_NORMAL: number; + readonly SVG_FEBLEND_MODE_OVERLAY: number; + readonly SVG_FEBLEND_MODE_SATURATION: number; + readonly SVG_FEBLEND_MODE_SCREEN: number; + readonly SVG_FEBLEND_MODE_SOFT_LIGHT: number; + readonly SVG_FEBLEND_MODE_UNKNOWN: number; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var SVGFEBlendElement: { prototype: SVGFEBlendElement; new(): SVGFEBlendElement; - SVG_FEBLEND_MODE_COLOR: number; - SVG_FEBLEND_MODE_COLOR_BURN: number; - SVG_FEBLEND_MODE_COLOR_DODGE: number; - SVG_FEBLEND_MODE_DARKEN: number; - SVG_FEBLEND_MODE_DIFFERENCE: number; - SVG_FEBLEND_MODE_EXCLUSION: number; - SVG_FEBLEND_MODE_HARD_LIGHT: number; - SVG_FEBLEND_MODE_HUE: number; - SVG_FEBLEND_MODE_LIGHTEN: number; - SVG_FEBLEND_MODE_LUMINOSITY: number; - SVG_FEBLEND_MODE_MULTIPLY: number; - SVG_FEBLEND_MODE_NORMAL: number; - SVG_FEBLEND_MODE_OVERLAY: number; - SVG_FEBLEND_MODE_SATURATION: number; - SVG_FEBLEND_MODE_SCREEN: number; - SVG_FEBLEND_MODE_SOFT_LIGHT: number; - SVG_FEBLEND_MODE_UNKNOWN: number; + readonly SVG_FEBLEND_MODE_COLOR: number; + readonly SVG_FEBLEND_MODE_COLOR_BURN: number; + readonly SVG_FEBLEND_MODE_COLOR_DODGE: number; + readonly SVG_FEBLEND_MODE_DARKEN: number; + readonly SVG_FEBLEND_MODE_DIFFERENCE: number; + readonly SVG_FEBLEND_MODE_EXCLUSION: number; + readonly SVG_FEBLEND_MODE_HARD_LIGHT: number; + readonly SVG_FEBLEND_MODE_HUE: number; + readonly SVG_FEBLEND_MODE_LIGHTEN: number; + readonly SVG_FEBLEND_MODE_LUMINOSITY: number; + readonly SVG_FEBLEND_MODE_MULTIPLY: number; + readonly SVG_FEBLEND_MODE_NORMAL: number; + readonly SVG_FEBLEND_MODE_OVERLAY: number; + readonly SVG_FEBLEND_MODE_SATURATION: number; + readonly SVG_FEBLEND_MODE_SCREEN: number; + readonly SVG_FEBLEND_MODE_SOFT_LIGHT: number; + readonly SVG_FEBLEND_MODE_UNKNOWN: number; } interface SVGFEColorMatrixElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { - in1: SVGAnimatedString; - type: SVGAnimatedEnumeration; - values: SVGAnimatedNumberList; - SVG_FECOLORMATRIX_TYPE_HUEROTATE: number; - SVG_FECOLORMATRIX_TYPE_LUMINANCETOALPHA: number; - SVG_FECOLORMATRIX_TYPE_MATRIX: number; - SVG_FECOLORMATRIX_TYPE_SATURATE: number; - SVG_FECOLORMATRIX_TYPE_UNKNOWN: number; + readonly in1: SVGAnimatedString; + readonly type: SVGAnimatedEnumeration; + readonly values: SVGAnimatedNumberList; + readonly SVG_FECOLORMATRIX_TYPE_HUEROTATE: number; + readonly SVG_FECOLORMATRIX_TYPE_LUMINANCETOALPHA: number; + readonly SVG_FECOLORMATRIX_TYPE_MATRIX: number; + readonly SVG_FECOLORMATRIX_TYPE_SATURATE: number; + readonly SVG_FECOLORMATRIX_TYPE_UNKNOWN: number; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var SVGFEColorMatrixElement: { prototype: SVGFEColorMatrixElement; new(): SVGFEColorMatrixElement; - SVG_FECOLORMATRIX_TYPE_HUEROTATE: number; - SVG_FECOLORMATRIX_TYPE_LUMINANCETOALPHA: number; - SVG_FECOLORMATRIX_TYPE_MATRIX: number; - SVG_FECOLORMATRIX_TYPE_SATURATE: number; - SVG_FECOLORMATRIX_TYPE_UNKNOWN: number; + readonly SVG_FECOLORMATRIX_TYPE_HUEROTATE: number; + readonly SVG_FECOLORMATRIX_TYPE_LUMINANCETOALPHA: number; + readonly SVG_FECOLORMATRIX_TYPE_MATRIX: number; + readonly SVG_FECOLORMATRIX_TYPE_SATURATE: number; + readonly SVG_FECOLORMATRIX_TYPE_UNKNOWN: number; } interface SVGFEComponentTransferElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { - in1: SVGAnimatedString; + readonly in1: SVGAnimatedString; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -13006,70 +14041,70 @@ declare var SVGFEComponentTransferElement: { } interface SVGFECompositeElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { - in1: SVGAnimatedString; - in2: SVGAnimatedString; - k1: SVGAnimatedNumber; - k2: SVGAnimatedNumber; - k3: SVGAnimatedNumber; - k4: SVGAnimatedNumber; - operator: SVGAnimatedEnumeration; - SVG_FECOMPOSITE_OPERATOR_ARITHMETIC: number; - SVG_FECOMPOSITE_OPERATOR_ATOP: number; - SVG_FECOMPOSITE_OPERATOR_IN: number; - SVG_FECOMPOSITE_OPERATOR_OUT: number; - SVG_FECOMPOSITE_OPERATOR_OVER: number; - SVG_FECOMPOSITE_OPERATOR_UNKNOWN: number; - SVG_FECOMPOSITE_OPERATOR_XOR: number; + readonly in1: SVGAnimatedString; + readonly in2: SVGAnimatedString; + readonly k1: SVGAnimatedNumber; + readonly k2: SVGAnimatedNumber; + readonly k3: SVGAnimatedNumber; + readonly k4: SVGAnimatedNumber; + readonly operator: SVGAnimatedEnumeration; + readonly SVG_FECOMPOSITE_OPERATOR_ARITHMETIC: number; + readonly SVG_FECOMPOSITE_OPERATOR_ATOP: number; + readonly SVG_FECOMPOSITE_OPERATOR_IN: number; + readonly SVG_FECOMPOSITE_OPERATOR_OUT: number; + readonly SVG_FECOMPOSITE_OPERATOR_OVER: number; + readonly SVG_FECOMPOSITE_OPERATOR_UNKNOWN: number; + readonly SVG_FECOMPOSITE_OPERATOR_XOR: number; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var SVGFECompositeElement: { prototype: SVGFECompositeElement; new(): SVGFECompositeElement; - SVG_FECOMPOSITE_OPERATOR_ARITHMETIC: number; - SVG_FECOMPOSITE_OPERATOR_ATOP: number; - SVG_FECOMPOSITE_OPERATOR_IN: number; - SVG_FECOMPOSITE_OPERATOR_OUT: number; - SVG_FECOMPOSITE_OPERATOR_OVER: number; - SVG_FECOMPOSITE_OPERATOR_UNKNOWN: number; - SVG_FECOMPOSITE_OPERATOR_XOR: number; + readonly SVG_FECOMPOSITE_OPERATOR_ARITHMETIC: number; + readonly SVG_FECOMPOSITE_OPERATOR_ATOP: number; + readonly SVG_FECOMPOSITE_OPERATOR_IN: number; + readonly SVG_FECOMPOSITE_OPERATOR_OUT: number; + readonly SVG_FECOMPOSITE_OPERATOR_OVER: number; + readonly SVG_FECOMPOSITE_OPERATOR_UNKNOWN: number; + readonly SVG_FECOMPOSITE_OPERATOR_XOR: number; } interface SVGFEConvolveMatrixElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { - bias: SVGAnimatedNumber; - divisor: SVGAnimatedNumber; - edgeMode: SVGAnimatedEnumeration; - in1: SVGAnimatedString; - kernelMatrix: SVGAnimatedNumberList; - kernelUnitLengthX: SVGAnimatedNumber; - kernelUnitLengthY: SVGAnimatedNumber; - orderX: SVGAnimatedInteger; - orderY: SVGAnimatedInteger; - preserveAlpha: SVGAnimatedBoolean; - targetX: SVGAnimatedInteger; - targetY: SVGAnimatedInteger; - SVG_EDGEMODE_DUPLICATE: number; - SVG_EDGEMODE_NONE: number; - SVG_EDGEMODE_UNKNOWN: number; - SVG_EDGEMODE_WRAP: number; + readonly bias: SVGAnimatedNumber; + readonly divisor: SVGAnimatedNumber; + readonly edgeMode: SVGAnimatedEnumeration; + readonly in1: SVGAnimatedString; + readonly kernelMatrix: SVGAnimatedNumberList; + readonly kernelUnitLengthX: SVGAnimatedNumber; + readonly kernelUnitLengthY: SVGAnimatedNumber; + readonly orderX: SVGAnimatedInteger; + readonly orderY: SVGAnimatedInteger; + readonly preserveAlpha: SVGAnimatedBoolean; + readonly targetX: SVGAnimatedInteger; + readonly targetY: SVGAnimatedInteger; + readonly SVG_EDGEMODE_DUPLICATE: number; + readonly SVG_EDGEMODE_NONE: number; + readonly SVG_EDGEMODE_UNKNOWN: number; + readonly SVG_EDGEMODE_WRAP: number; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var SVGFEConvolveMatrixElement: { prototype: SVGFEConvolveMatrixElement; new(): SVGFEConvolveMatrixElement; - SVG_EDGEMODE_DUPLICATE: number; - SVG_EDGEMODE_NONE: number; - SVG_EDGEMODE_UNKNOWN: number; - SVG_EDGEMODE_WRAP: number; + readonly SVG_EDGEMODE_DUPLICATE: number; + readonly SVG_EDGEMODE_NONE: number; + readonly SVG_EDGEMODE_UNKNOWN: number; + readonly SVG_EDGEMODE_WRAP: number; } interface SVGFEDiffuseLightingElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { - diffuseConstant: SVGAnimatedNumber; - in1: SVGAnimatedString; - kernelUnitLengthX: SVGAnimatedNumber; - kernelUnitLengthY: SVGAnimatedNumber; - surfaceScale: SVGAnimatedNumber; + readonly diffuseConstant: SVGAnimatedNumber; + readonly in1: SVGAnimatedString; + readonly kernelUnitLengthX: SVGAnimatedNumber; + readonly kernelUnitLengthY: SVGAnimatedNumber; + readonly surfaceScale: SVGAnimatedNumber; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -13079,32 +14114,32 @@ declare var SVGFEDiffuseLightingElement: { } interface SVGFEDisplacementMapElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { - in1: SVGAnimatedString; - in2: SVGAnimatedString; - scale: SVGAnimatedNumber; - xChannelSelector: SVGAnimatedEnumeration; - yChannelSelector: SVGAnimatedEnumeration; - SVG_CHANNEL_A: number; - SVG_CHANNEL_B: number; - SVG_CHANNEL_G: number; - SVG_CHANNEL_R: number; - SVG_CHANNEL_UNKNOWN: number; + readonly in1: SVGAnimatedString; + readonly in2: SVGAnimatedString; + readonly scale: SVGAnimatedNumber; + readonly xChannelSelector: SVGAnimatedEnumeration; + readonly yChannelSelector: SVGAnimatedEnumeration; + readonly SVG_CHANNEL_A: number; + readonly SVG_CHANNEL_B: number; + readonly SVG_CHANNEL_G: number; + readonly SVG_CHANNEL_R: number; + readonly SVG_CHANNEL_UNKNOWN: number; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var SVGFEDisplacementMapElement: { prototype: SVGFEDisplacementMapElement; new(): SVGFEDisplacementMapElement; - SVG_CHANNEL_A: number; - SVG_CHANNEL_B: number; - SVG_CHANNEL_G: number; - SVG_CHANNEL_R: number; - SVG_CHANNEL_UNKNOWN: number; + readonly SVG_CHANNEL_A: number; + readonly SVG_CHANNEL_B: number; + readonly SVG_CHANNEL_G: number; + readonly SVG_CHANNEL_R: number; + readonly SVG_CHANNEL_UNKNOWN: number; } interface SVGFEDistantLightElement extends SVGElement { - azimuth: SVGAnimatedNumber; - elevation: SVGAnimatedNumber; + readonly azimuth: SVGAnimatedNumber; + readonly elevation: SVGAnimatedNumber; } declare var SVGFEDistantLightElement: { @@ -13154,9 +14189,9 @@ declare var SVGFEFuncRElement: { } interface SVGFEGaussianBlurElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { - in1: SVGAnimatedString; - stdDeviationX: SVGAnimatedNumber; - stdDeviationY: SVGAnimatedNumber; + readonly in1: SVGAnimatedString; + readonly stdDeviationX: SVGAnimatedNumber; + readonly stdDeviationY: SVGAnimatedNumber; setStdDeviation(stdDeviationX: number, stdDeviationY: number): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -13167,7 +14202,7 @@ declare var SVGFEGaussianBlurElement: { } interface SVGFEImageElement extends SVGElement, SVGFilterPrimitiveStandardAttributes, SVGLangSpace, SVGURIReference, SVGExternalResourcesRequired { - preserveAspectRatio: SVGAnimatedPreserveAspectRatio; + readonly preserveAspectRatio: SVGAnimatedPreserveAspectRatio; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -13186,7 +14221,7 @@ declare var SVGFEMergeElement: { } interface SVGFEMergeNodeElement extends SVGElement { - in1: SVGAnimatedString; + readonly in1: SVGAnimatedString; } declare var SVGFEMergeNodeElement: { @@ -13195,28 +14230,28 @@ declare var SVGFEMergeNodeElement: { } interface SVGFEMorphologyElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { - in1: SVGAnimatedString; - operator: SVGAnimatedEnumeration; - radiusX: SVGAnimatedNumber; - radiusY: SVGAnimatedNumber; - SVG_MORPHOLOGY_OPERATOR_DILATE: number; - SVG_MORPHOLOGY_OPERATOR_ERODE: number; - SVG_MORPHOLOGY_OPERATOR_UNKNOWN: number; + readonly in1: SVGAnimatedString; + readonly operator: SVGAnimatedEnumeration; + readonly radiusX: SVGAnimatedNumber; + readonly radiusY: SVGAnimatedNumber; + readonly SVG_MORPHOLOGY_OPERATOR_DILATE: number; + readonly SVG_MORPHOLOGY_OPERATOR_ERODE: number; + readonly SVG_MORPHOLOGY_OPERATOR_UNKNOWN: number; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var SVGFEMorphologyElement: { prototype: SVGFEMorphologyElement; new(): SVGFEMorphologyElement; - SVG_MORPHOLOGY_OPERATOR_DILATE: number; - SVG_MORPHOLOGY_OPERATOR_ERODE: number; - SVG_MORPHOLOGY_OPERATOR_UNKNOWN: number; + readonly SVG_MORPHOLOGY_OPERATOR_DILATE: number; + readonly SVG_MORPHOLOGY_OPERATOR_ERODE: number; + readonly SVG_MORPHOLOGY_OPERATOR_UNKNOWN: number; } interface SVGFEOffsetElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { - dx: SVGAnimatedNumber; - dy: SVGAnimatedNumber; - in1: SVGAnimatedString; + readonly dx: SVGAnimatedNumber; + readonly dy: SVGAnimatedNumber; + readonly in1: SVGAnimatedString; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -13226,9 +14261,9 @@ declare var SVGFEOffsetElement: { } interface SVGFEPointLightElement extends SVGElement { - x: SVGAnimatedNumber; - y: SVGAnimatedNumber; - z: SVGAnimatedNumber; + readonly x: SVGAnimatedNumber; + readonly y: SVGAnimatedNumber; + readonly z: SVGAnimatedNumber; } declare var SVGFEPointLightElement: { @@ -13237,12 +14272,12 @@ declare var SVGFEPointLightElement: { } interface SVGFESpecularLightingElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { - in1: SVGAnimatedString; - kernelUnitLengthX: SVGAnimatedNumber; - kernelUnitLengthY: SVGAnimatedNumber; - specularConstant: SVGAnimatedNumber; - specularExponent: SVGAnimatedNumber; - surfaceScale: SVGAnimatedNumber; + readonly in1: SVGAnimatedString; + readonly kernelUnitLengthX: SVGAnimatedNumber; + readonly kernelUnitLengthY: SVGAnimatedNumber; + readonly specularConstant: SVGAnimatedNumber; + readonly specularExponent: SVGAnimatedNumber; + readonly surfaceScale: SVGAnimatedNumber; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -13252,14 +14287,14 @@ declare var SVGFESpecularLightingElement: { } interface SVGFESpotLightElement extends SVGElement { - limitingConeAngle: SVGAnimatedNumber; - pointsAtX: SVGAnimatedNumber; - pointsAtY: SVGAnimatedNumber; - pointsAtZ: SVGAnimatedNumber; - specularExponent: SVGAnimatedNumber; - x: SVGAnimatedNumber; - y: SVGAnimatedNumber; - z: SVGAnimatedNumber; + readonly limitingConeAngle: SVGAnimatedNumber; + readonly pointsAtX: SVGAnimatedNumber; + readonly pointsAtY: SVGAnimatedNumber; + readonly pointsAtZ: SVGAnimatedNumber; + readonly specularExponent: SVGAnimatedNumber; + readonly x: SVGAnimatedNumber; + readonly y: SVGAnimatedNumber; + readonly z: SVGAnimatedNumber; } declare var SVGFESpotLightElement: { @@ -13268,7 +14303,7 @@ declare var SVGFESpotLightElement: { } interface SVGFETileElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { - in1: SVGAnimatedString; + readonly in1: SVGAnimatedString; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -13278,41 +14313,41 @@ declare var SVGFETileElement: { } interface SVGFETurbulenceElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { - baseFrequencyX: SVGAnimatedNumber; - baseFrequencyY: SVGAnimatedNumber; - numOctaves: SVGAnimatedInteger; - seed: SVGAnimatedNumber; - stitchTiles: SVGAnimatedEnumeration; - type: SVGAnimatedEnumeration; - SVG_STITCHTYPE_NOSTITCH: number; - SVG_STITCHTYPE_STITCH: number; - SVG_STITCHTYPE_UNKNOWN: number; - SVG_TURBULENCE_TYPE_FRACTALNOISE: number; - SVG_TURBULENCE_TYPE_TURBULENCE: number; - SVG_TURBULENCE_TYPE_UNKNOWN: number; + readonly baseFrequencyX: SVGAnimatedNumber; + readonly baseFrequencyY: SVGAnimatedNumber; + readonly numOctaves: SVGAnimatedInteger; + readonly seed: SVGAnimatedNumber; + readonly stitchTiles: SVGAnimatedEnumeration; + readonly type: SVGAnimatedEnumeration; + readonly SVG_STITCHTYPE_NOSTITCH: number; + readonly SVG_STITCHTYPE_STITCH: number; + readonly SVG_STITCHTYPE_UNKNOWN: number; + readonly SVG_TURBULENCE_TYPE_FRACTALNOISE: number; + readonly SVG_TURBULENCE_TYPE_TURBULENCE: number; + readonly SVG_TURBULENCE_TYPE_UNKNOWN: number; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var SVGFETurbulenceElement: { prototype: SVGFETurbulenceElement; new(): SVGFETurbulenceElement; - SVG_STITCHTYPE_NOSTITCH: number; - SVG_STITCHTYPE_STITCH: number; - SVG_STITCHTYPE_UNKNOWN: number; - SVG_TURBULENCE_TYPE_FRACTALNOISE: number; - SVG_TURBULENCE_TYPE_TURBULENCE: number; - SVG_TURBULENCE_TYPE_UNKNOWN: number; + readonly SVG_STITCHTYPE_NOSTITCH: number; + readonly SVG_STITCHTYPE_STITCH: number; + readonly SVG_STITCHTYPE_UNKNOWN: number; + readonly SVG_TURBULENCE_TYPE_FRACTALNOISE: number; + readonly SVG_TURBULENCE_TYPE_TURBULENCE: number; + readonly SVG_TURBULENCE_TYPE_UNKNOWN: number; } interface SVGFilterElement extends SVGElement, SVGUnitTypes, SVGStylable, SVGLangSpace, SVGURIReference, SVGExternalResourcesRequired { - filterResX: SVGAnimatedInteger; - filterResY: SVGAnimatedInteger; - filterUnits: SVGAnimatedEnumeration; - height: SVGAnimatedLength; - primitiveUnits: SVGAnimatedEnumeration; - width: SVGAnimatedLength; - x: SVGAnimatedLength; - y: SVGAnimatedLength; + readonly filterResX: SVGAnimatedInteger; + readonly filterResY: SVGAnimatedInteger; + readonly filterUnits: SVGAnimatedEnumeration; + readonly height: SVGAnimatedLength; + readonly primitiveUnits: SVGAnimatedEnumeration; + readonly width: SVGAnimatedLength; + readonly x: SVGAnimatedLength; + readonly y: SVGAnimatedLength; setFilterRes(filterResX: number, filterResY: number): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -13323,10 +14358,10 @@ declare var SVGFilterElement: { } interface SVGForeignObjectElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired { - height: SVGAnimatedLength; - width: SVGAnimatedLength; - x: SVGAnimatedLength; - y: SVGAnimatedLength; + readonly height: SVGAnimatedLength; + readonly width: SVGAnimatedLength; + readonly x: SVGAnimatedLength; + readonly y: SVGAnimatedLength; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -13345,31 +14380,31 @@ declare var SVGGElement: { } interface SVGGradientElement extends SVGElement, SVGStylable, SVGExternalResourcesRequired, SVGURIReference, SVGUnitTypes { - gradientTransform: SVGAnimatedTransformList; - gradientUnits: SVGAnimatedEnumeration; - spreadMethod: SVGAnimatedEnumeration; - SVG_SPREADMETHOD_PAD: number; - SVG_SPREADMETHOD_REFLECT: number; - SVG_SPREADMETHOD_REPEAT: number; - SVG_SPREADMETHOD_UNKNOWN: number; + readonly gradientTransform: SVGAnimatedTransformList; + readonly gradientUnits: SVGAnimatedEnumeration; + readonly spreadMethod: SVGAnimatedEnumeration; + readonly SVG_SPREADMETHOD_PAD: number; + readonly SVG_SPREADMETHOD_REFLECT: number; + readonly SVG_SPREADMETHOD_REPEAT: number; + readonly SVG_SPREADMETHOD_UNKNOWN: number; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var SVGGradientElement: { prototype: SVGGradientElement; new(): SVGGradientElement; - SVG_SPREADMETHOD_PAD: number; - SVG_SPREADMETHOD_REFLECT: number; - SVG_SPREADMETHOD_REPEAT: number; - SVG_SPREADMETHOD_UNKNOWN: number; + readonly SVG_SPREADMETHOD_PAD: number; + readonly SVG_SPREADMETHOD_REFLECT: number; + readonly SVG_SPREADMETHOD_REPEAT: number; + readonly SVG_SPREADMETHOD_UNKNOWN: number; } interface SVGImageElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired, SVGURIReference { - height: SVGAnimatedLength; - preserveAspectRatio: SVGAnimatedPreserveAspectRatio; - width: SVGAnimatedLength; - x: SVGAnimatedLength; - y: SVGAnimatedLength; + readonly height: SVGAnimatedLength; + readonly preserveAspectRatio: SVGAnimatedPreserveAspectRatio; + readonly width: SVGAnimatedLength; + readonly x: SVGAnimatedLength; + readonly y: SVGAnimatedLength; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -13379,43 +14414,43 @@ declare var SVGImageElement: { } interface SVGLength { - unitType: number; + readonly unitType: number; value: number; valueAsString: string; valueInSpecifiedUnits: number; convertToSpecifiedUnits(unitType: number): void; newValueSpecifiedUnits(unitType: number, valueInSpecifiedUnits: number): void; - SVG_LENGTHTYPE_CM: number; - SVG_LENGTHTYPE_EMS: number; - SVG_LENGTHTYPE_EXS: number; - SVG_LENGTHTYPE_IN: number; - SVG_LENGTHTYPE_MM: number; - SVG_LENGTHTYPE_NUMBER: number; - SVG_LENGTHTYPE_PC: number; - SVG_LENGTHTYPE_PERCENTAGE: number; - SVG_LENGTHTYPE_PT: number; - SVG_LENGTHTYPE_PX: number; - SVG_LENGTHTYPE_UNKNOWN: number; + readonly SVG_LENGTHTYPE_CM: number; + readonly SVG_LENGTHTYPE_EMS: number; + readonly SVG_LENGTHTYPE_EXS: number; + readonly SVG_LENGTHTYPE_IN: number; + readonly SVG_LENGTHTYPE_MM: number; + readonly SVG_LENGTHTYPE_NUMBER: number; + readonly SVG_LENGTHTYPE_PC: number; + readonly SVG_LENGTHTYPE_PERCENTAGE: number; + readonly SVG_LENGTHTYPE_PT: number; + readonly SVG_LENGTHTYPE_PX: number; + readonly SVG_LENGTHTYPE_UNKNOWN: number; } declare var SVGLength: { prototype: SVGLength; new(): SVGLength; - SVG_LENGTHTYPE_CM: number; - SVG_LENGTHTYPE_EMS: number; - SVG_LENGTHTYPE_EXS: number; - SVG_LENGTHTYPE_IN: number; - SVG_LENGTHTYPE_MM: number; - SVG_LENGTHTYPE_NUMBER: number; - SVG_LENGTHTYPE_PC: number; - SVG_LENGTHTYPE_PERCENTAGE: number; - SVG_LENGTHTYPE_PT: number; - SVG_LENGTHTYPE_PX: number; - SVG_LENGTHTYPE_UNKNOWN: number; + readonly SVG_LENGTHTYPE_CM: number; + readonly SVG_LENGTHTYPE_EMS: number; + readonly SVG_LENGTHTYPE_EXS: number; + readonly SVG_LENGTHTYPE_IN: number; + readonly SVG_LENGTHTYPE_MM: number; + readonly SVG_LENGTHTYPE_NUMBER: number; + readonly SVG_LENGTHTYPE_PC: number; + readonly SVG_LENGTHTYPE_PERCENTAGE: number; + readonly SVG_LENGTHTYPE_PT: number; + readonly SVG_LENGTHTYPE_PX: number; + readonly SVG_LENGTHTYPE_UNKNOWN: number; } interface SVGLengthList { - numberOfItems: number; + readonly numberOfItems: number; appendItem(newItem: SVGLength): SVGLength; clear(): void; getItem(index: number): SVGLength; @@ -13431,10 +14466,10 @@ declare var SVGLengthList: { } interface SVGLineElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired { - x1: SVGAnimatedLength; - x2: SVGAnimatedLength; - y1: SVGAnimatedLength; - y2: SVGAnimatedLength; + readonly x1: SVGAnimatedLength; + readonly x2: SVGAnimatedLength; + readonly y1: SVGAnimatedLength; + readonly y2: SVGAnimatedLength; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -13444,10 +14479,10 @@ declare var SVGLineElement: { } interface SVGLinearGradientElement extends SVGGradientElement { - x1: SVGAnimatedLength; - x2: SVGAnimatedLength; - y1: SVGAnimatedLength; - y2: SVGAnimatedLength; + readonly x1: SVGAnimatedLength; + readonly x2: SVGAnimatedLength; + readonly y1: SVGAnimatedLength; + readonly y2: SVGAnimatedLength; } declare var SVGLinearGradientElement: { @@ -13456,42 +14491,42 @@ declare var SVGLinearGradientElement: { } interface SVGMarkerElement extends SVGElement, SVGStylable, SVGLangSpace, SVGExternalResourcesRequired, SVGFitToViewBox { - markerHeight: SVGAnimatedLength; - markerUnits: SVGAnimatedEnumeration; - markerWidth: SVGAnimatedLength; - orientAngle: SVGAnimatedAngle; - orientType: SVGAnimatedEnumeration; - refX: SVGAnimatedLength; - refY: SVGAnimatedLength; + readonly markerHeight: SVGAnimatedLength; + readonly markerUnits: SVGAnimatedEnumeration; + readonly markerWidth: SVGAnimatedLength; + readonly orientAngle: SVGAnimatedAngle; + readonly orientType: SVGAnimatedEnumeration; + readonly refX: SVGAnimatedLength; + readonly refY: SVGAnimatedLength; setOrientToAngle(angle: SVGAngle): void; setOrientToAuto(): void; - SVG_MARKERUNITS_STROKEWIDTH: number; - SVG_MARKERUNITS_UNKNOWN: number; - SVG_MARKERUNITS_USERSPACEONUSE: number; - SVG_MARKER_ORIENT_ANGLE: number; - SVG_MARKER_ORIENT_AUTO: number; - SVG_MARKER_ORIENT_UNKNOWN: number; + readonly SVG_MARKERUNITS_STROKEWIDTH: number; + readonly SVG_MARKERUNITS_UNKNOWN: number; + readonly SVG_MARKERUNITS_USERSPACEONUSE: number; + readonly SVG_MARKER_ORIENT_ANGLE: number; + readonly SVG_MARKER_ORIENT_AUTO: number; + readonly SVG_MARKER_ORIENT_UNKNOWN: number; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var SVGMarkerElement: { prototype: SVGMarkerElement; new(): SVGMarkerElement; - SVG_MARKERUNITS_STROKEWIDTH: number; - SVG_MARKERUNITS_UNKNOWN: number; - SVG_MARKERUNITS_USERSPACEONUSE: number; - SVG_MARKER_ORIENT_ANGLE: number; - SVG_MARKER_ORIENT_AUTO: number; - SVG_MARKER_ORIENT_UNKNOWN: number; + readonly SVG_MARKERUNITS_STROKEWIDTH: number; + readonly SVG_MARKERUNITS_UNKNOWN: number; + readonly SVG_MARKERUNITS_USERSPACEONUSE: number; + readonly SVG_MARKER_ORIENT_ANGLE: number; + readonly SVG_MARKER_ORIENT_AUTO: number; + readonly SVG_MARKER_ORIENT_UNKNOWN: number; } interface SVGMaskElement extends SVGElement, SVGStylable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired, SVGUnitTypes { - height: SVGAnimatedLength; - maskContentUnits: SVGAnimatedEnumeration; - maskUnits: SVGAnimatedEnumeration; - width: SVGAnimatedLength; - x: SVGAnimatedLength; - y: SVGAnimatedLength; + readonly height: SVGAnimatedLength; + readonly maskContentUnits: SVGAnimatedEnumeration; + readonly maskUnits: SVGAnimatedEnumeration; + readonly width: SVGAnimatedLength; + readonly x: SVGAnimatedLength; + readonly y: SVGAnimatedLength; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -13543,7 +14578,7 @@ declare var SVGNumber: { } interface SVGNumberList { - numberOfItems: number; + readonly numberOfItems: number; appendItem(newItem: SVGNumber): SVGNumber; clear(): void; getItem(index: number): SVGNumber; @@ -13590,53 +14625,53 @@ declare var SVGPathElement: { } interface SVGPathSeg { - pathSegType: number; - pathSegTypeAsLetter: string; - PATHSEG_ARC_ABS: number; - PATHSEG_ARC_REL: number; - PATHSEG_CLOSEPATH: number; - PATHSEG_CURVETO_CUBIC_ABS: number; - PATHSEG_CURVETO_CUBIC_REL: number; - PATHSEG_CURVETO_CUBIC_SMOOTH_ABS: number; - PATHSEG_CURVETO_CUBIC_SMOOTH_REL: number; - PATHSEG_CURVETO_QUADRATIC_ABS: number; - PATHSEG_CURVETO_QUADRATIC_REL: number; - PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS: number; - PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL: number; - PATHSEG_LINETO_ABS: number; - PATHSEG_LINETO_HORIZONTAL_ABS: number; - PATHSEG_LINETO_HORIZONTAL_REL: number; - PATHSEG_LINETO_REL: number; - PATHSEG_LINETO_VERTICAL_ABS: number; - PATHSEG_LINETO_VERTICAL_REL: number; - PATHSEG_MOVETO_ABS: number; - PATHSEG_MOVETO_REL: number; - PATHSEG_UNKNOWN: number; + readonly pathSegType: number; + readonly pathSegTypeAsLetter: string; + readonly PATHSEG_ARC_ABS: number; + readonly PATHSEG_ARC_REL: number; + readonly PATHSEG_CLOSEPATH: number; + readonly PATHSEG_CURVETO_CUBIC_ABS: number; + readonly PATHSEG_CURVETO_CUBIC_REL: number; + readonly PATHSEG_CURVETO_CUBIC_SMOOTH_ABS: number; + readonly PATHSEG_CURVETO_CUBIC_SMOOTH_REL: number; + readonly PATHSEG_CURVETO_QUADRATIC_ABS: number; + readonly PATHSEG_CURVETO_QUADRATIC_REL: number; + readonly PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS: number; + readonly PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL: number; + readonly PATHSEG_LINETO_ABS: number; + readonly PATHSEG_LINETO_HORIZONTAL_ABS: number; + readonly PATHSEG_LINETO_HORIZONTAL_REL: number; + readonly PATHSEG_LINETO_REL: number; + readonly PATHSEG_LINETO_VERTICAL_ABS: number; + readonly PATHSEG_LINETO_VERTICAL_REL: number; + readonly PATHSEG_MOVETO_ABS: number; + readonly PATHSEG_MOVETO_REL: number; + readonly PATHSEG_UNKNOWN: number; } declare var SVGPathSeg: { prototype: SVGPathSeg; new(): SVGPathSeg; - PATHSEG_ARC_ABS: number; - PATHSEG_ARC_REL: number; - PATHSEG_CLOSEPATH: number; - PATHSEG_CURVETO_CUBIC_ABS: number; - PATHSEG_CURVETO_CUBIC_REL: number; - PATHSEG_CURVETO_CUBIC_SMOOTH_ABS: number; - PATHSEG_CURVETO_CUBIC_SMOOTH_REL: number; - PATHSEG_CURVETO_QUADRATIC_ABS: number; - PATHSEG_CURVETO_QUADRATIC_REL: number; - PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS: number; - PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL: number; - PATHSEG_LINETO_ABS: number; - PATHSEG_LINETO_HORIZONTAL_ABS: number; - PATHSEG_LINETO_HORIZONTAL_REL: number; - PATHSEG_LINETO_REL: number; - PATHSEG_LINETO_VERTICAL_ABS: number; - PATHSEG_LINETO_VERTICAL_REL: number; - PATHSEG_MOVETO_ABS: number; - PATHSEG_MOVETO_REL: number; - PATHSEG_UNKNOWN: number; + readonly PATHSEG_ARC_ABS: number; + readonly PATHSEG_ARC_REL: number; + readonly PATHSEG_CLOSEPATH: number; + readonly PATHSEG_CURVETO_CUBIC_ABS: number; + readonly PATHSEG_CURVETO_CUBIC_REL: number; + readonly PATHSEG_CURVETO_CUBIC_SMOOTH_ABS: number; + readonly PATHSEG_CURVETO_CUBIC_SMOOTH_REL: number; + readonly PATHSEG_CURVETO_QUADRATIC_ABS: number; + readonly PATHSEG_CURVETO_QUADRATIC_REL: number; + readonly PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS: number; + readonly PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL: number; + readonly PATHSEG_LINETO_ABS: number; + readonly PATHSEG_LINETO_HORIZONTAL_ABS: number; + readonly PATHSEG_LINETO_HORIZONTAL_REL: number; + readonly PATHSEG_LINETO_REL: number; + readonly PATHSEG_LINETO_VERTICAL_ABS: number; + readonly PATHSEG_LINETO_VERTICAL_REL: number; + readonly PATHSEG_MOVETO_ABS: number; + readonly PATHSEG_MOVETO_REL: number; + readonly PATHSEG_UNKNOWN: number; } interface SVGPathSegArcAbs extends SVGPathSeg { @@ -13830,7 +14865,7 @@ declare var SVGPathSegLinetoVerticalRel: { } interface SVGPathSegList { - numberOfItems: number; + readonly numberOfItems: number; appendItem(newItem: SVGPathSeg): SVGPathSeg; clear(): void; getItem(index: number): SVGPathSeg; @@ -13866,13 +14901,13 @@ declare var SVGPathSegMovetoRel: { } interface SVGPatternElement extends SVGElement, SVGStylable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired, SVGFitToViewBox, SVGURIReference, SVGUnitTypes { - height: SVGAnimatedLength; - patternContentUnits: SVGAnimatedEnumeration; - patternTransform: SVGAnimatedTransformList; - patternUnits: SVGAnimatedEnumeration; - width: SVGAnimatedLength; - x: SVGAnimatedLength; - y: SVGAnimatedLength; + readonly height: SVGAnimatedLength; + readonly patternContentUnits: SVGAnimatedEnumeration; + readonly patternTransform: SVGAnimatedTransformList; + readonly patternUnits: SVGAnimatedEnumeration; + readonly width: SVGAnimatedLength; + readonly x: SVGAnimatedLength; + readonly y: SVGAnimatedLength; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -13893,7 +14928,7 @@ declare var SVGPoint: { } interface SVGPointList { - numberOfItems: number; + readonly numberOfItems: number; appendItem(newItem: SVGPoint): SVGPoint; clear(): void; getItem(index: number): SVGPoint; @@ -13929,47 +14964,47 @@ declare var SVGPolylineElement: { interface SVGPreserveAspectRatio { align: number; meetOrSlice: number; - SVG_MEETORSLICE_MEET: number; - SVG_MEETORSLICE_SLICE: number; - SVG_MEETORSLICE_UNKNOWN: number; - SVG_PRESERVEASPECTRATIO_NONE: number; - SVG_PRESERVEASPECTRATIO_UNKNOWN: number; - SVG_PRESERVEASPECTRATIO_XMAXYMAX: number; - SVG_PRESERVEASPECTRATIO_XMAXYMID: number; - SVG_PRESERVEASPECTRATIO_XMAXYMIN: number; - SVG_PRESERVEASPECTRATIO_XMIDYMAX: number; - SVG_PRESERVEASPECTRATIO_XMIDYMID: number; - SVG_PRESERVEASPECTRATIO_XMIDYMIN: number; - SVG_PRESERVEASPECTRATIO_XMINYMAX: number; - SVG_PRESERVEASPECTRATIO_XMINYMID: number; - SVG_PRESERVEASPECTRATIO_XMINYMIN: number; + readonly SVG_MEETORSLICE_MEET: number; + readonly SVG_MEETORSLICE_SLICE: number; + readonly SVG_MEETORSLICE_UNKNOWN: number; + readonly SVG_PRESERVEASPECTRATIO_NONE: number; + readonly SVG_PRESERVEASPECTRATIO_UNKNOWN: number; + readonly SVG_PRESERVEASPECTRATIO_XMAXYMAX: number; + readonly SVG_PRESERVEASPECTRATIO_XMAXYMID: number; + readonly SVG_PRESERVEASPECTRATIO_XMAXYMIN: number; + readonly SVG_PRESERVEASPECTRATIO_XMIDYMAX: number; + readonly SVG_PRESERVEASPECTRATIO_XMIDYMID: number; + readonly SVG_PRESERVEASPECTRATIO_XMIDYMIN: number; + readonly SVG_PRESERVEASPECTRATIO_XMINYMAX: number; + readonly SVG_PRESERVEASPECTRATIO_XMINYMID: number; + readonly SVG_PRESERVEASPECTRATIO_XMINYMIN: number; } declare var SVGPreserveAspectRatio: { prototype: SVGPreserveAspectRatio; new(): SVGPreserveAspectRatio; - SVG_MEETORSLICE_MEET: number; - SVG_MEETORSLICE_SLICE: number; - SVG_MEETORSLICE_UNKNOWN: number; - SVG_PRESERVEASPECTRATIO_NONE: number; - SVG_PRESERVEASPECTRATIO_UNKNOWN: number; - SVG_PRESERVEASPECTRATIO_XMAXYMAX: number; - SVG_PRESERVEASPECTRATIO_XMAXYMID: number; - SVG_PRESERVEASPECTRATIO_XMAXYMIN: number; - SVG_PRESERVEASPECTRATIO_XMIDYMAX: number; - SVG_PRESERVEASPECTRATIO_XMIDYMID: number; - SVG_PRESERVEASPECTRATIO_XMIDYMIN: number; - SVG_PRESERVEASPECTRATIO_XMINYMAX: number; - SVG_PRESERVEASPECTRATIO_XMINYMID: number; - SVG_PRESERVEASPECTRATIO_XMINYMIN: number; + readonly SVG_MEETORSLICE_MEET: number; + readonly SVG_MEETORSLICE_SLICE: number; + readonly SVG_MEETORSLICE_UNKNOWN: number; + readonly SVG_PRESERVEASPECTRATIO_NONE: number; + readonly SVG_PRESERVEASPECTRATIO_UNKNOWN: number; + readonly SVG_PRESERVEASPECTRATIO_XMAXYMAX: number; + readonly SVG_PRESERVEASPECTRATIO_XMAXYMID: number; + readonly SVG_PRESERVEASPECTRATIO_XMAXYMIN: number; + readonly SVG_PRESERVEASPECTRATIO_XMIDYMAX: number; + readonly SVG_PRESERVEASPECTRATIO_XMIDYMID: number; + readonly SVG_PRESERVEASPECTRATIO_XMIDYMIN: number; + readonly SVG_PRESERVEASPECTRATIO_XMINYMAX: number; + readonly SVG_PRESERVEASPECTRATIO_XMINYMID: number; + readonly SVG_PRESERVEASPECTRATIO_XMINYMIN: number; } interface SVGRadialGradientElement extends SVGGradientElement { - cx: SVGAnimatedLength; - cy: SVGAnimatedLength; - fx: SVGAnimatedLength; - fy: SVGAnimatedLength; - r: SVGAnimatedLength; + readonly cx: SVGAnimatedLength; + readonly cy: SVGAnimatedLength; + readonly fx: SVGAnimatedLength; + readonly fy: SVGAnimatedLength; + readonly r: SVGAnimatedLength; } declare var SVGRadialGradientElement: { @@ -13990,12 +15025,12 @@ declare var SVGRect: { } interface SVGRectElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired { - height: SVGAnimatedLength; - rx: SVGAnimatedLength; - ry: SVGAnimatedLength; - width: SVGAnimatedLength; - x: SVGAnimatedLength; - y: SVGAnimatedLength; + readonly height: SVGAnimatedLength; + readonly rx: SVGAnimatedLength; + readonly ry: SVGAnimatedLength; + readonly width: SVGAnimatedLength; + readonly x: SVGAnimatedLength; + readonly y: SVGAnimatedLength; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -14008,22 +15043,22 @@ interface SVGSVGElement extends SVGElement, DocumentEvent, SVGLocatable, SVGTest contentScriptType: string; contentStyleType: string; currentScale: number; - currentTranslate: SVGPoint; - height: SVGAnimatedLength; + readonly currentTranslate: SVGPoint; + readonly height: SVGAnimatedLength; onabort: (ev: Event) => any; onerror: (ev: Event) => any; onresize: (ev: UIEvent) => any; onscroll: (ev: UIEvent) => any; onunload: (ev: Event) => any; onzoom: (ev: SVGZoomEvent) => any; - pixelUnitToMillimeterX: number; - pixelUnitToMillimeterY: number; - screenPixelToMillimeterX: number; - screenPixelToMillimeterY: number; - viewport: SVGRect; - width: SVGAnimatedLength; - x: SVGAnimatedLength; - y: SVGAnimatedLength; + readonly pixelUnitToMillimeterX: number; + readonly pixelUnitToMillimeterY: number; + readonly screenPixelToMillimeterX: number; + readonly screenPixelToMillimeterY: number; + readonly viewport: SVGRect; + readonly width: SVGAnimatedLength; + readonly x: SVGAnimatedLength; + readonly y: SVGAnimatedLength; checkEnclosure(element: SVGElement, rect: SVGRect): boolean; checkIntersection(element: SVGElement, rect: SVGRect): boolean; createSVGAngle(): SVGAngle; @@ -14039,8 +15074,8 @@ interface SVGSVGElement extends SVGElement, DocumentEvent, SVGLocatable, SVGTest getComputedStyle(elt: Element, pseudoElt?: string): CSSStyleDeclaration; getCurrentTime(): number; getElementById(elementId: string): Element; - getEnclosureList(rect: SVGRect, referenceElement: SVGElement): NodeList; - getIntersectionList(rect: SVGRect, referenceElement: SVGElement): NodeList; + getEnclosureList(rect: SVGRect, referenceElement: SVGElement): NodeListOf; + getIntersectionList(rect: SVGRect, referenceElement: SVGElement): NodeListOf; pauseAnimations(): void; setCurrentTime(seconds: number): void; suspendRedraw(maxWaitMilliseconds: number): number; @@ -14118,7 +15153,7 @@ declare var SVGScriptElement: { } interface SVGStopElement extends SVGElement, SVGStylable { - offset: SVGAnimatedNumber; + readonly offset: SVGAnimatedNumber; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -14128,7 +15163,7 @@ declare var SVGStopElement: { } interface SVGStringList { - numberOfItems: number; + readonly numberOfItems: number; appendItem(newItem: string): string; clear(): void; getItem(index: number): string; @@ -14144,6 +15179,7 @@ declare var SVGStringList: { } interface SVGStyleElement extends SVGElement, SVGLangSpace { + disabled: boolean; media: string; title: string; type: string; @@ -14182,8 +15218,8 @@ declare var SVGTSpanElement: { } interface SVGTextContentElement extends SVGElement, SVGStylable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired { - lengthAdjust: SVGAnimatedEnumeration; - textLength: SVGAnimatedLength; + readonly lengthAdjust: SVGAnimatedEnumeration; + readonly textLength: SVGAnimatedLength; getCharNumAtPosition(point: SVGPoint): number; getComputedTextLength(): number; getEndPositionOfChar(charnum: number): SVGPoint; @@ -14193,18 +15229,18 @@ interface SVGTextContentElement extends SVGElement, SVGStylable, SVGTests, SVGLa getStartPositionOfChar(charnum: number): SVGPoint; getSubStringLength(charnum: number, nchars: number): number; selectSubString(charnum: number, nchars: number): void; - LENGTHADJUST_SPACING: number; - LENGTHADJUST_SPACINGANDGLYPHS: number; - LENGTHADJUST_UNKNOWN: number; + readonly LENGTHADJUST_SPACING: number; + readonly LENGTHADJUST_SPACINGANDGLYPHS: number; + readonly LENGTHADJUST_UNKNOWN: number; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var SVGTextContentElement: { prototype: SVGTextContentElement; new(): SVGTextContentElement; - LENGTHADJUST_SPACING: number; - LENGTHADJUST_SPACINGANDGLYPHS: number; - LENGTHADJUST_UNKNOWN: number; + readonly LENGTHADJUST_SPACING: number; + readonly LENGTHADJUST_SPACINGANDGLYPHS: number; + readonly LENGTHADJUST_UNKNOWN: number; } interface SVGTextElement extends SVGTextPositioningElement, SVGTransformable { @@ -14217,35 +15253,35 @@ declare var SVGTextElement: { } interface SVGTextPathElement extends SVGTextContentElement, SVGURIReference { - method: SVGAnimatedEnumeration; - spacing: SVGAnimatedEnumeration; - startOffset: SVGAnimatedLength; - TEXTPATH_METHODTYPE_ALIGN: number; - TEXTPATH_METHODTYPE_STRETCH: number; - TEXTPATH_METHODTYPE_UNKNOWN: number; - TEXTPATH_SPACINGTYPE_AUTO: number; - TEXTPATH_SPACINGTYPE_EXACT: number; - TEXTPATH_SPACINGTYPE_UNKNOWN: number; + readonly method: SVGAnimatedEnumeration; + readonly spacing: SVGAnimatedEnumeration; + readonly startOffset: SVGAnimatedLength; + readonly TEXTPATH_METHODTYPE_ALIGN: number; + readonly TEXTPATH_METHODTYPE_STRETCH: number; + readonly TEXTPATH_METHODTYPE_UNKNOWN: number; + readonly TEXTPATH_SPACINGTYPE_AUTO: number; + readonly TEXTPATH_SPACINGTYPE_EXACT: number; + readonly TEXTPATH_SPACINGTYPE_UNKNOWN: number; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var SVGTextPathElement: { prototype: SVGTextPathElement; new(): SVGTextPathElement; - TEXTPATH_METHODTYPE_ALIGN: number; - TEXTPATH_METHODTYPE_STRETCH: number; - TEXTPATH_METHODTYPE_UNKNOWN: number; - TEXTPATH_SPACINGTYPE_AUTO: number; - TEXTPATH_SPACINGTYPE_EXACT: number; - TEXTPATH_SPACINGTYPE_UNKNOWN: number; + readonly TEXTPATH_METHODTYPE_ALIGN: number; + readonly TEXTPATH_METHODTYPE_STRETCH: number; + readonly TEXTPATH_METHODTYPE_UNKNOWN: number; + readonly TEXTPATH_SPACINGTYPE_AUTO: number; + readonly TEXTPATH_SPACINGTYPE_EXACT: number; + readonly TEXTPATH_SPACINGTYPE_UNKNOWN: number; } interface SVGTextPositioningElement extends SVGTextContentElement { - dx: SVGAnimatedLengthList; - dy: SVGAnimatedLengthList; - rotate: SVGAnimatedNumberList; - x: SVGAnimatedLengthList; - y: SVGAnimatedLengthList; + readonly dx: SVGAnimatedLengthList; + readonly dy: SVGAnimatedLengthList; + readonly rotate: SVGAnimatedNumberList; + readonly x: SVGAnimatedLengthList; + readonly y: SVGAnimatedLengthList; } declare var SVGTextPositioningElement: { @@ -14263,38 +15299,38 @@ declare var SVGTitleElement: { } interface SVGTransform { - angle: number; - matrix: SVGMatrix; - type: number; + readonly angle: number; + readonly matrix: SVGMatrix; + readonly type: number; setMatrix(matrix: SVGMatrix): void; setRotate(angle: number, cx: number, cy: number): void; setScale(sx: number, sy: number): void; setSkewX(angle: number): void; setSkewY(angle: number): void; setTranslate(tx: number, ty: number): void; - SVG_TRANSFORM_MATRIX: number; - SVG_TRANSFORM_ROTATE: number; - SVG_TRANSFORM_SCALE: number; - SVG_TRANSFORM_SKEWX: number; - SVG_TRANSFORM_SKEWY: number; - SVG_TRANSFORM_TRANSLATE: number; - SVG_TRANSFORM_UNKNOWN: number; + readonly SVG_TRANSFORM_MATRIX: number; + readonly SVG_TRANSFORM_ROTATE: number; + readonly SVG_TRANSFORM_SCALE: number; + readonly SVG_TRANSFORM_SKEWX: number; + readonly SVG_TRANSFORM_SKEWY: number; + readonly SVG_TRANSFORM_TRANSLATE: number; + readonly SVG_TRANSFORM_UNKNOWN: number; } declare var SVGTransform: { prototype: SVGTransform; new(): SVGTransform; - SVG_TRANSFORM_MATRIX: number; - SVG_TRANSFORM_ROTATE: number; - SVG_TRANSFORM_SCALE: number; - SVG_TRANSFORM_SKEWX: number; - SVG_TRANSFORM_SKEWY: number; - SVG_TRANSFORM_TRANSLATE: number; - SVG_TRANSFORM_UNKNOWN: number; + readonly SVG_TRANSFORM_MATRIX: number; + readonly SVG_TRANSFORM_ROTATE: number; + readonly SVG_TRANSFORM_SCALE: number; + readonly SVG_TRANSFORM_SKEWX: number; + readonly SVG_TRANSFORM_SKEWY: number; + readonly SVG_TRANSFORM_TRANSLATE: number; + readonly SVG_TRANSFORM_UNKNOWN: number; } interface SVGTransformList { - numberOfItems: number; + readonly numberOfItems: number; appendItem(newItem: SVGTransform): SVGTransform; clear(): void; consolidate(): SVGTransform; @@ -14312,19 +15348,19 @@ declare var SVGTransformList: { } interface SVGUnitTypes { - SVG_UNIT_TYPE_OBJECTBOUNDINGBOX: number; - SVG_UNIT_TYPE_UNKNOWN: number; - SVG_UNIT_TYPE_USERSPACEONUSE: number; + readonly SVG_UNIT_TYPE_OBJECTBOUNDINGBOX: number; + readonly SVG_UNIT_TYPE_UNKNOWN: number; + readonly SVG_UNIT_TYPE_USERSPACEONUSE: number; } declare var SVGUnitTypes: SVGUnitTypes; interface SVGUseElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired, SVGURIReference { - animatedInstanceRoot: SVGElementInstance; - height: SVGAnimatedLength; - instanceRoot: SVGElementInstance; - width: SVGAnimatedLength; - x: SVGAnimatedLength; - y: SVGAnimatedLength; + readonly animatedInstanceRoot: SVGElementInstance; + readonly height: SVGAnimatedLength; + readonly instanceRoot: SVGElementInstance; + readonly width: SVGAnimatedLength; + readonly x: SVGAnimatedLength; + readonly y: SVGAnimatedLength; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -14334,7 +15370,7 @@ declare var SVGUseElement: { } interface SVGViewElement extends SVGElement, SVGExternalResourcesRequired, SVGFitToViewBox, SVGZoomAndPan { - viewTarget: SVGStringList; + readonly viewTarget: SVGStringList; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -14344,21 +15380,21 @@ declare var SVGViewElement: { } interface SVGZoomAndPan { - zoomAndPan: number; + readonly zoomAndPan: number; } declare var SVGZoomAndPan: { - SVG_ZOOMANDPAN_DISABLE: number; - SVG_ZOOMANDPAN_MAGNIFY: number; - SVG_ZOOMANDPAN_UNKNOWN: number; + readonly SVG_ZOOMANDPAN_DISABLE: number; + readonly SVG_ZOOMANDPAN_MAGNIFY: number; + readonly SVG_ZOOMANDPAN_UNKNOWN: number; } interface SVGZoomEvent extends UIEvent { - newScale: number; - newTranslate: SVGPoint; - previousScale: number; - previousTranslate: SVGPoint; - zoomRectScreen: SVGRect; + readonly newScale: number; + readonly newTranslate: SVGPoint; + readonly previousScale: number; + readonly previousTranslate: SVGPoint; + readonly zoomRectScreen: SVGRect; } declare var SVGZoomEvent: { @@ -14367,22 +15403,22 @@ declare var SVGZoomEvent: { } interface Screen extends EventTarget { - availHeight: number; - availWidth: number; + readonly availHeight: number; + readonly availWidth: number; bufferDepth: number; - colorDepth: number; - deviceXDPI: number; - deviceYDPI: number; - fontSmoothingEnabled: boolean; - height: number; - logicalXDPI: number; - logicalYDPI: number; - msOrientation: string; + readonly colorDepth: number; + readonly deviceXDPI: number; + readonly deviceYDPI: number; + readonly fontSmoothingEnabled: boolean; + readonly height: number; + readonly logicalXDPI: number; + readonly logicalYDPI: number; + readonly msOrientation: string; onmsorientationchange: (ev: Event) => any; - pixelDepth: number; - systemXDPI: number; - systemYDPI: number; - width: number; + readonly pixelDepth: number; + readonly systemXDPI: number; + readonly systemYDPI: number; + readonly width: number; msLockOrientation(orientations: string | string[]): boolean; msUnlockOrientation(): void; addEventListener(type: "MSOrientationChange", listener: (ev: Event) => any, useCapture?: boolean): void; @@ -14395,8 +15431,8 @@ declare var Screen: { } interface ScriptNotifyEvent extends Event { - callingUri: string; - value: string; + readonly callingUri: string; + readonly value: string; } declare var ScriptNotifyEvent: { @@ -14405,7 +15441,7 @@ declare var ScriptNotifyEvent: { } interface ScriptProcessorNode extends AudioNode { - bufferSize: number; + readonly bufferSize: number; onaudioprocess: (ev: AudioProcessingEvent) => any; addEventListener(type: "audioprocess", listener: (ev: AudioProcessingEvent) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; @@ -14417,13 +15453,13 @@ declare var ScriptProcessorNode: { } interface Selection { - anchorNode: Node; - anchorOffset: number; - focusNode: Node; - focusOffset: number; - isCollapsed: boolean; - rangeCount: number; - type: string; + readonly anchorNode: Node; + readonly anchorOffset: number; + readonly focusNode: Node; + readonly focusOffset: number; + readonly isCollapsed: boolean; + readonly rangeCount: number; + readonly type: string; addRange(range: Range): void; collapse(parentNode: Node, offset: number): void; collapseToEnd(): void; @@ -14448,12 +15484,12 @@ declare var Selection: { interface SourceBuffer extends EventTarget { appendWindowEnd: number; appendWindowStart: number; - audioTracks: AudioTrackList; - buffered: TimeRanges; + readonly audioTracks: AudioTrackList; + readonly buffered: TimeRanges; mode: string; timestampOffset: number; - updating: boolean; - videoTracks: VideoTrackList; + readonly updating: boolean; + readonly videoTracks: VideoTrackList; abort(): void; appendBuffer(data: ArrayBuffer | ArrayBufferView): void; appendStream(stream: MSStream, maxSize?: number): void; @@ -14466,7 +15502,7 @@ declare var SourceBuffer: { } interface SourceBufferList extends EventTarget { - length: number; + readonly length: number; item(index: number): SourceBuffer; [index: number]: SourceBuffer; } @@ -14477,7 +15513,7 @@ declare var SourceBufferList: { } interface StereoPannerNode extends AudioNode { - pan: AudioParam; + readonly pan: AudioParam; } declare var StereoPannerNode: { @@ -14486,9 +15522,9 @@ declare var StereoPannerNode: { } interface Storage { - length: number; + readonly length: number; clear(): void; - getItem(key: string): any; + getItem(key: string): string; key(index: number): string; removeItem(key: string): void; setItem(key: string, data: string): void; @@ -14502,7 +15538,7 @@ declare var Storage: { } interface StorageEvent extends Event { - url: string; + readonly url: string; key?: string; oldValue?: string; newValue?: string; @@ -14515,7 +15551,7 @@ declare var StorageEvent: { } interface StyleMedia { - type: string; + readonly type: string; matchMedium(mediaquery: string): boolean; } @@ -14526,12 +15562,12 @@ declare var StyleMedia: { interface StyleSheet { disabled: boolean; - href: string; - media: MediaList; - ownerNode: Node; - parentStyleSheet: StyleSheet; - title: string; - type: string; + readonly href: string; + readonly media: MediaList; + readonly ownerNode: Node; + readonly parentStyleSheet: StyleSheet; + readonly title: string; + readonly type: string; } declare var StyleSheet: { @@ -14540,7 +15576,7 @@ declare var StyleSheet: { } interface StyleSheetList { - length: number; + readonly length: number; item(index?: number): StyleSheet; [index: number]: StyleSheet; } @@ -14551,7 +15587,7 @@ declare var StyleSheetList: { } interface StyleSheetPageList { - length: number; + readonly length: number; item(index: number): CSSPageRule; [index: number]: CSSPageRule; } @@ -14562,18 +15598,18 @@ declare var StyleSheetPageList: { } interface SubtleCrypto { - decrypt(algorithm: string | Algorithm, key: CryptoKey, data: ArrayBufferView): any; - deriveBits(algorithm: string | Algorithm, baseKey: CryptoKey, length: number): any; - deriveKey(algorithm: string | Algorithm, baseKey: CryptoKey, derivedKeyType: string | Algorithm, extractable: boolean, keyUsages: string[]): any; - digest(algorithm: string | Algorithm, data: ArrayBufferView): any; - encrypt(algorithm: string | Algorithm, key: CryptoKey, data: ArrayBufferView): any; - exportKey(format: string, key: CryptoKey): any; - generateKey(algorithm: string | Algorithm, extractable: boolean, keyUsages: string[]): any; - importKey(format: string, keyData: ArrayBufferView, algorithm: string | Algorithm, extractable: boolean, keyUsages: string[]): any; - sign(algorithm: string | Algorithm, key: CryptoKey, data: ArrayBufferView): any; - unwrapKey(format: string, wrappedKey: ArrayBufferView, unwrappingKey: CryptoKey, unwrapAlgorithm: string | Algorithm, unwrappedKeyAlgorithm: string | Algorithm, extractable: boolean, keyUsages: string[]): any; - verify(algorithm: string | Algorithm, key: CryptoKey, signature: ArrayBufferView, data: ArrayBufferView): any; - wrapKey(format: string, key: CryptoKey, wrappingKey: CryptoKey, wrapAlgorithm: string | Algorithm): any; + decrypt(algorithm: string | Algorithm, key: CryptoKey, data: ArrayBufferView): PromiseLike; + deriveBits(algorithm: string | Algorithm, baseKey: CryptoKey, length: number): PromiseLike; + deriveKey(algorithm: string | Algorithm, baseKey: CryptoKey, derivedKeyType: string | Algorithm, extractable: boolean, keyUsages: string[]): PromiseLike; + digest(algorithm: string | Algorithm, data: ArrayBufferView): PromiseLike; + encrypt(algorithm: string | Algorithm, key: CryptoKey, data: ArrayBufferView): PromiseLike; + exportKey(format: string, key: CryptoKey): PromiseLike; + generateKey(algorithm: string | Algorithm, extractable: boolean, keyUsages: string[]): PromiseLike; + importKey(format: string, keyData: ArrayBufferView, algorithm: string | Algorithm, extractable: boolean, keyUsages: string[]): PromiseLike; + sign(algorithm: string | Algorithm, key: CryptoKey, data: ArrayBufferView): PromiseLike; + unwrapKey(format: string, wrappedKey: ArrayBufferView, unwrappingKey: CryptoKey, unwrapAlgorithm: string | Algorithm, unwrappedKeyAlgorithm: string | Algorithm, extractable: boolean, keyUsages: string[]): PromiseLike; + verify(algorithm: string | Algorithm, key: CryptoKey, signature: ArrayBufferView, data: ArrayBufferView): PromiseLike; + wrapKey(format: string, key: CryptoKey, wrappingKey: CryptoKey, wrapAlgorithm: string | Algorithm): PromiseLike; } declare var SubtleCrypto: { @@ -14582,8 +15618,7 @@ declare var SubtleCrypto: { } interface Text extends CharacterData { - wholeText: string; - replaceWholeText(content: string): Text; + readonly wholeText: string; splitText(offset: number): Text; } @@ -14593,39 +15628,39 @@ declare var Text: { } interface TextEvent extends UIEvent { - data: string; - inputMethod: number; - locale: string; + readonly data: string; + readonly inputMethod: number; + readonly locale: string; initTextEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, dataArg: string, inputMethod: number, locale: string): void; - DOM_INPUT_METHOD_DROP: number; - DOM_INPUT_METHOD_HANDWRITING: number; - DOM_INPUT_METHOD_IME: number; - DOM_INPUT_METHOD_KEYBOARD: number; - DOM_INPUT_METHOD_MULTIMODAL: number; - DOM_INPUT_METHOD_OPTION: number; - DOM_INPUT_METHOD_PASTE: number; - DOM_INPUT_METHOD_SCRIPT: number; - DOM_INPUT_METHOD_UNKNOWN: number; - DOM_INPUT_METHOD_VOICE: number; + readonly DOM_INPUT_METHOD_DROP: number; + readonly DOM_INPUT_METHOD_HANDWRITING: number; + readonly DOM_INPUT_METHOD_IME: number; + readonly DOM_INPUT_METHOD_KEYBOARD: number; + readonly DOM_INPUT_METHOD_MULTIMODAL: number; + readonly DOM_INPUT_METHOD_OPTION: number; + readonly DOM_INPUT_METHOD_PASTE: number; + readonly DOM_INPUT_METHOD_SCRIPT: number; + readonly DOM_INPUT_METHOD_UNKNOWN: number; + readonly DOM_INPUT_METHOD_VOICE: number; } declare var TextEvent: { prototype: TextEvent; new(): TextEvent; - DOM_INPUT_METHOD_DROP: number; - DOM_INPUT_METHOD_HANDWRITING: number; - DOM_INPUT_METHOD_IME: number; - DOM_INPUT_METHOD_KEYBOARD: number; - DOM_INPUT_METHOD_MULTIMODAL: number; - DOM_INPUT_METHOD_OPTION: number; - DOM_INPUT_METHOD_PASTE: number; - DOM_INPUT_METHOD_SCRIPT: number; - DOM_INPUT_METHOD_UNKNOWN: number; - DOM_INPUT_METHOD_VOICE: number; + readonly DOM_INPUT_METHOD_DROP: number; + readonly DOM_INPUT_METHOD_HANDWRITING: number; + readonly DOM_INPUT_METHOD_IME: number; + readonly DOM_INPUT_METHOD_KEYBOARD: number; + readonly DOM_INPUT_METHOD_MULTIMODAL: number; + readonly DOM_INPUT_METHOD_OPTION: number; + readonly DOM_INPUT_METHOD_PASTE: number; + readonly DOM_INPUT_METHOD_SCRIPT: number; + readonly DOM_INPUT_METHOD_UNKNOWN: number; + readonly DOM_INPUT_METHOD_VOICE: number; } interface TextMetrics { - width: number; + readonly width: number; } declare var TextMetrics: { @@ -14633,83 +15668,27 @@ declare var TextMetrics: { new(): TextMetrics; } -interface TextRange { - boundingHeight: number; - boundingLeft: number; - boundingTop: number; - boundingWidth: number; - htmlText: string; - offsetLeft: number; - offsetTop: number; - text: string; - collapse(start?: boolean): void; - compareEndPoints(how: string, sourceRange: TextRange): number; - duplicate(): TextRange; - execCommand(cmdID: string, showUI?: boolean, value?: any): boolean; - execCommandShowHelp(cmdID: string): boolean; - expand(Unit: string): boolean; - findText(string: string, count?: number, flags?: number): boolean; - getBookmark(): string; - getBoundingClientRect(): ClientRect; - getClientRects(): ClientRectList; - inRange(range: TextRange): boolean; - isEqual(range: TextRange): boolean; - move(unit: string, count?: number): number; - moveEnd(unit: string, count?: number): number; - moveStart(unit: string, count?: number): number; - moveToBookmark(bookmark: string): boolean; - moveToElementText(element: Element): void; - moveToPoint(x: number, y: number): void; - parentElement(): Element; - pasteHTML(html: string): void; - queryCommandEnabled(cmdID: string): boolean; - queryCommandIndeterm(cmdID: string): boolean; - queryCommandState(cmdID: string): boolean; - queryCommandSupported(cmdID: string): boolean; - queryCommandText(cmdID: string): string; - queryCommandValue(cmdID: string): any; - scrollIntoView(fStart?: boolean): void; - select(): void; - setEndPoint(how: string, SourceRange: TextRange): void; -} - -declare var TextRange: { - prototype: TextRange; - new(): TextRange; -} - -interface TextRangeCollection { - length: number; - item(index: number): TextRange; - [index: number]: TextRange; -} - -declare var TextRangeCollection: { - prototype: TextRangeCollection; - new(): TextRangeCollection; -} - interface TextTrack extends EventTarget { - activeCues: TextTrackCueList; - cues: TextTrackCueList; - inBandMetadataTrackDispatchType: string; - kind: string; - label: string; - language: string; + readonly activeCues: TextTrackCueList; + readonly cues: TextTrackCueList; + readonly inBandMetadataTrackDispatchType: string; + readonly kind: string; + readonly label: string; + readonly language: string; mode: any; oncuechange: (ev: Event) => any; onerror: (ev: Event) => any; onload: (ev: Event) => any; - readyState: number; + readonly readyState: number; addCue(cue: TextTrackCue): void; removeCue(cue: TextTrackCue): void; - DISABLED: number; - ERROR: number; - HIDDEN: number; - LOADED: number; - LOADING: number; - NONE: number; - SHOWING: number; + readonly DISABLED: number; + readonly ERROR: number; + readonly HIDDEN: number; + readonly LOADED: number; + readonly LOADING: number; + readonly NONE: number; + readonly SHOWING: number; addEventListener(type: "cuechange", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: "load", listener: (ev: Event) => any, useCapture?: boolean): void; @@ -14719,13 +15698,13 @@ interface TextTrack extends EventTarget { declare var TextTrack: { prototype: TextTrack; new(): TextTrack; - DISABLED: number; - ERROR: number; - HIDDEN: number; - LOADED: number; - LOADING: number; - NONE: number; - SHOWING: number; + readonly DISABLED: number; + readonly ERROR: number; + readonly HIDDEN: number; + readonly LOADED: number; + readonly LOADING: number; + readonly NONE: number; + readonly SHOWING: number; } interface TextTrackCue extends EventTarget { @@ -14736,7 +15715,7 @@ interface TextTrackCue extends EventTarget { pauseOnExit: boolean; startTime: number; text: string; - track: TextTrack; + readonly track: TextTrack; getCueAsHTML(): DocumentFragment; addEventListener(type: "enter", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "exit", listener: (ev: Event) => any, useCapture?: boolean): void; @@ -14749,7 +15728,7 @@ declare var TextTrackCue: { } interface TextTrackCueList { - length: number; + readonly length: number; getCueById(id: string): TextTrackCue; item(index: number): TextTrackCue; [index: number]: TextTrackCue; @@ -14761,7 +15740,7 @@ declare var TextTrackCueList: { } interface TextTrackList extends EventTarget { - length: number; + readonly length: number; onaddtrack: (ev: TrackEvent) => any; item(index: number): TextTrack; addEventListener(type: "addtrack", listener: (ev: TrackEvent) => any, useCapture?: boolean): void; @@ -14775,7 +15754,7 @@ declare var TextTrackList: { } interface TimeRanges { - length: number; + readonly length: number; end(index: number): number; start(index: number): number; } @@ -14786,14 +15765,14 @@ declare var TimeRanges: { } interface Touch { - clientX: number; - clientY: number; - identifier: number; - pageX: number; - pageY: number; - screenX: number; - screenY: number; - target: EventTarget; + readonly clientX: number; + readonly clientY: number; + readonly identifier: number; + readonly pageX: number; + readonly pageY: number; + readonly screenX: number; + readonly screenY: number; + readonly target: EventTarget; } declare var Touch: { @@ -14802,13 +15781,13 @@ declare var Touch: { } interface TouchEvent extends UIEvent { - altKey: boolean; - changedTouches: TouchList; - ctrlKey: boolean; - metaKey: boolean; - shiftKey: boolean; - targetTouches: TouchList; - touches: TouchList; + readonly altKey: boolean; + readonly changedTouches: TouchList; + readonly ctrlKey: boolean; + readonly metaKey: boolean; + readonly shiftKey: boolean; + readonly targetTouches: TouchList; + readonly touches: TouchList; } declare var TouchEvent: { @@ -14817,7 +15796,7 @@ declare var TouchEvent: { } interface TouchList { - length: number; + readonly length: number; item(index: number): Touch; [index: number]: Touch; } @@ -14828,7 +15807,7 @@ declare var TouchList: { } interface TrackEvent extends Event { - track: any; + readonly track: any; } declare var TrackEvent: { @@ -14837,8 +15816,8 @@ declare var TrackEvent: { } interface TransitionEvent extends Event { - elapsedTime: number; - propertyName: string; + readonly elapsedTime: number; + readonly propertyName: string; initTransitionEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, propertyNameArg: string, elapsedTimeArg: number): void; } @@ -14849,10 +15828,10 @@ declare var TransitionEvent: { interface TreeWalker { currentNode: Node; - expandEntityReferences: boolean; - filter: NodeFilter; - root: Node; - whatToShow: number; + readonly expandEntityReferences: boolean; + readonly filter: NodeFilter; + readonly root: Node; + readonly whatToShow: number; firstChild(): Node; lastChild(): Node; nextNode(): Node; @@ -14868,8 +15847,8 @@ declare var TreeWalker: { } interface UIEvent extends Event { - detail: number; - view: Window; + readonly detail: number; + readonly view: Window; initUIEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number): void; } @@ -14879,13 +15858,29 @@ declare var UIEvent: { } interface URL { + hash: string; + host: string; + hostname: string; + href: string; + readonly origin: string; + password: string; + pathname: string; + port: string; + protocol: string; + search: string; + username: string; + toString(): string; +} + +declare var URL: { + prototype: URL; + new(url: string, base?: string): URL; createObjectURL(object: any, options?: ObjectURLOptions): string; revokeObjectURL(url: string): void; } -declare var URL: URL; interface UnviewableContentIdentifiedEvent extends NavigationEventWithReferrer { - mediaType: string; + readonly mediaType: string; } declare var UnviewableContentIdentifiedEvent: { @@ -14894,16 +15889,16 @@ declare var UnviewableContentIdentifiedEvent: { } interface ValidityState { - badInput: boolean; - customError: boolean; - patternMismatch: boolean; - rangeOverflow: boolean; - rangeUnderflow: boolean; - stepMismatch: boolean; - tooLong: boolean; - typeMismatch: boolean; - valid: boolean; - valueMissing: boolean; + readonly badInput: boolean; + readonly customError: boolean; + readonly patternMismatch: boolean; + readonly rangeOverflow: boolean; + readonly rangeUnderflow: boolean; + readonly stepMismatch: boolean; + readonly tooLong: boolean; + readonly typeMismatch: boolean; + readonly valid: boolean; + readonly valueMissing: boolean; } declare var ValidityState: { @@ -14912,11 +15907,11 @@ declare var ValidityState: { } interface VideoPlaybackQuality { - corruptedVideoFrames: number; - creationTime: number; - droppedVideoFrames: number; - totalFrameDelay: number; - totalVideoFrames: number; + readonly corruptedVideoFrames: number; + readonly creationTime: number; + readonly droppedVideoFrames: number; + readonly totalFrameDelay: number; + readonly totalVideoFrames: number; } declare var VideoPlaybackQuality: { @@ -14925,12 +15920,12 @@ declare var VideoPlaybackQuality: { } interface VideoTrack { - id: string; + readonly id: string; kind: string; - label: string; + readonly label: string; language: string; selected: boolean; - sourceBuffer: SourceBuffer; + readonly sourceBuffer: SourceBuffer; } declare var VideoTrack: { @@ -14939,11 +15934,11 @@ declare var VideoTrack: { } interface VideoTrackList extends EventTarget { - length: number; + readonly length: number; onaddtrack: (ev: TrackEvent) => any; onchange: (ev: Event) => any; onremovetrack: (ev: TrackEvent) => any; - selectedIndex: number; + readonly selectedIndex: number; getTrackById(id: string): VideoTrack; item(index: number): VideoTrack; addEventListener(type: "addtrack", listener: (ev: TrackEvent) => any, useCapture?: boolean): void; @@ -14959,41 +15954,41 @@ declare var VideoTrackList: { } interface WEBGL_compressed_texture_s3tc { - COMPRESSED_RGBA_S3TC_DXT1_EXT: number; - COMPRESSED_RGBA_S3TC_DXT3_EXT: number; - COMPRESSED_RGBA_S3TC_DXT5_EXT: number; - COMPRESSED_RGB_S3TC_DXT1_EXT: number; + readonly COMPRESSED_RGBA_S3TC_DXT1_EXT: number; + readonly COMPRESSED_RGBA_S3TC_DXT3_EXT: number; + readonly COMPRESSED_RGBA_S3TC_DXT5_EXT: number; + readonly COMPRESSED_RGB_S3TC_DXT1_EXT: number; } declare var WEBGL_compressed_texture_s3tc: { prototype: WEBGL_compressed_texture_s3tc; new(): WEBGL_compressed_texture_s3tc; - COMPRESSED_RGBA_S3TC_DXT1_EXT: number; - COMPRESSED_RGBA_S3TC_DXT3_EXT: number; - COMPRESSED_RGBA_S3TC_DXT5_EXT: number; - COMPRESSED_RGB_S3TC_DXT1_EXT: number; + readonly COMPRESSED_RGBA_S3TC_DXT1_EXT: number; + readonly COMPRESSED_RGBA_S3TC_DXT3_EXT: number; + readonly COMPRESSED_RGBA_S3TC_DXT5_EXT: number; + readonly COMPRESSED_RGB_S3TC_DXT1_EXT: number; } interface WEBGL_debug_renderer_info { - UNMASKED_RENDERER_WEBGL: number; - UNMASKED_VENDOR_WEBGL: number; + readonly UNMASKED_RENDERER_WEBGL: number; + readonly UNMASKED_VENDOR_WEBGL: number; } declare var WEBGL_debug_renderer_info: { prototype: WEBGL_debug_renderer_info; new(): WEBGL_debug_renderer_info; - UNMASKED_RENDERER_WEBGL: number; - UNMASKED_VENDOR_WEBGL: number; + readonly UNMASKED_RENDERER_WEBGL: number; + readonly UNMASKED_VENDOR_WEBGL: number; } interface WEBGL_depth_texture { - UNSIGNED_INT_24_8_WEBGL: number; + readonly UNSIGNED_INT_24_8_WEBGL: number; } declare var WEBGL_depth_texture: { prototype: WEBGL_depth_texture; new(): WEBGL_depth_texture; - UNSIGNED_INT_24_8_WEBGL: number; + readonly UNSIGNED_INT_24_8_WEBGL: number; } interface WaveShaperNode extends AudioNode { @@ -15007,9 +16002,9 @@ declare var WaveShaperNode: { } interface WebGLActiveInfo { - name: string; - size: number; - type: number; + readonly name: string; + readonly size: number; + readonly type: number; } declare var WebGLActiveInfo: { @@ -15026,12 +16021,12 @@ declare var WebGLBuffer: { } interface WebGLContextEvent extends Event { - statusMessage: string; + readonly statusMessage: string; } declare var WebGLContextEvent: { prototype: WebGLContextEvent; - new(): WebGLContextEvent; + new(type: string, eventInitDict?: WebGLContextEventInit): WebGLContextEvent; } interface WebGLFramebuffer extends WebGLObject { @@ -15067,9 +16062,9 @@ declare var WebGLRenderbuffer: { } interface WebGLRenderingContext { - canvas: HTMLCanvasElement; - drawingBufferHeight: number; - drawingBufferWidth: number; + readonly canvas: HTMLCanvasElement; + readonly drawingBufferHeight: number; + readonly drawingBufferWidth: number; activeTexture(texture: number): void; attachShader(program: WebGLProgram, shader: WebGLShader): void; bindAttribLocation(program: WebGLProgram, index: number, name: string): void; @@ -15184,635 +16179,635 @@ interface WebGLRenderingContext { texSubImage2D(target: number, level: number, xoffset: number, yoffset: number, format: number, type: number, video: HTMLVideoElement): void; texSubImage2D(target: number, level: number, xoffset: number, yoffset: number, format: number, type: number, pixels: ImageData): void; uniform1f(location: WebGLUniformLocation, x: number): void; - uniform1fv(location: WebGLUniformLocation, v: Float32Array): void; + uniform1fv(location: WebGLUniformLocation, v: Float32Array | number[]): void; uniform1i(location: WebGLUniformLocation, x: number): void; - uniform1iv(location: WebGLUniformLocation, v: Int32Array): void; + uniform1iv(location: WebGLUniformLocation, v: Int32Array | number[]): void; uniform2f(location: WebGLUniformLocation, x: number, y: number): void; - uniform2fv(location: WebGLUniformLocation, v: Float32Array): void; + uniform2fv(location: WebGLUniformLocation, v: Float32Array | number[]): void; uniform2i(location: WebGLUniformLocation, x: number, y: number): void; - uniform2iv(location: WebGLUniformLocation, v: Int32Array): void; + uniform2iv(location: WebGLUniformLocation, v: Int32Array | number[]): void; uniform3f(location: WebGLUniformLocation, x: number, y: number, z: number): void; - uniform3fv(location: WebGLUniformLocation, v: Float32Array): void; + uniform3fv(location: WebGLUniformLocation, v: Float32Array | number[]): void; uniform3i(location: WebGLUniformLocation, x: number, y: number, z: number): void; - uniform3iv(location: WebGLUniformLocation, v: Int32Array): void; + uniform3iv(location: WebGLUniformLocation, v: Int32Array | number[]): void; uniform4f(location: WebGLUniformLocation, x: number, y: number, z: number, w: number): void; - uniform4fv(location: WebGLUniformLocation, v: Float32Array): void; + uniform4fv(location: WebGLUniformLocation, v: Float32Array | number[]): void; uniform4i(location: WebGLUniformLocation, x: number, y: number, z: number, w: number): void; - uniform4iv(location: WebGLUniformLocation, v: Int32Array): void; - uniformMatrix2fv(location: WebGLUniformLocation, transpose: boolean, value: Float32Array): void; - uniformMatrix3fv(location: WebGLUniformLocation, transpose: boolean, value: Float32Array): void; - uniformMatrix4fv(location: WebGLUniformLocation, transpose: boolean, value: Float32Array): void; + uniform4iv(location: WebGLUniformLocation, v: Int32Array | number[]): void; + uniformMatrix2fv(location: WebGLUniformLocation, transpose: boolean, value: Float32Array | number[]): void; + uniformMatrix3fv(location: WebGLUniformLocation, transpose: boolean, value: Float32Array | number[]): void; + uniformMatrix4fv(location: WebGLUniformLocation, transpose: boolean, value: Float32Array | number[]): void; useProgram(program: WebGLProgram): void; validateProgram(program: WebGLProgram): void; vertexAttrib1f(indx: number, x: number): void; - vertexAttrib1fv(indx: number, values: Float32Array): void; + vertexAttrib1fv(indx: number, values: Float32Array | number[]): void; vertexAttrib2f(indx: number, x: number, y: number): void; - vertexAttrib2fv(indx: number, values: Float32Array): void; + vertexAttrib2fv(indx: number, values: Float32Array | number[]): void; vertexAttrib3f(indx: number, x: number, y: number, z: number): void; - vertexAttrib3fv(indx: number, values: Float32Array): void; + vertexAttrib3fv(indx: number, values: Float32Array | number[]): void; vertexAttrib4f(indx: number, x: number, y: number, z: number, w: number): void; - vertexAttrib4fv(indx: number, values: Float32Array): void; + vertexAttrib4fv(indx: number, values: Float32Array | number[]): void; vertexAttribPointer(indx: number, size: number, type: number, normalized: boolean, stride: number, offset: number): void; viewport(x: number, y: number, width: number, height: number): void; - ACTIVE_ATTRIBUTES: number; - ACTIVE_TEXTURE: number; - ACTIVE_UNIFORMS: number; - ALIASED_LINE_WIDTH_RANGE: number; - ALIASED_POINT_SIZE_RANGE: number; - ALPHA: number; - ALPHA_BITS: number; - ALWAYS: number; - ARRAY_BUFFER: number; - ARRAY_BUFFER_BINDING: number; - ATTACHED_SHADERS: number; - BACK: number; - BLEND: number; - BLEND_COLOR: number; - BLEND_DST_ALPHA: number; - BLEND_DST_RGB: number; - BLEND_EQUATION: number; - BLEND_EQUATION_ALPHA: number; - BLEND_EQUATION_RGB: number; - BLEND_SRC_ALPHA: number; - BLEND_SRC_RGB: number; - BLUE_BITS: number; - BOOL: number; - BOOL_VEC2: number; - BOOL_VEC3: number; - BOOL_VEC4: number; - BROWSER_DEFAULT_WEBGL: number; - BUFFER_SIZE: number; - BUFFER_USAGE: number; - BYTE: number; - CCW: number; - CLAMP_TO_EDGE: number; - COLOR_ATTACHMENT0: number; - COLOR_BUFFER_BIT: number; - COLOR_CLEAR_VALUE: number; - COLOR_WRITEMASK: number; - COMPILE_STATUS: number; - COMPRESSED_TEXTURE_FORMATS: number; - CONSTANT_ALPHA: number; - CONSTANT_COLOR: number; - CONTEXT_LOST_WEBGL: number; - CULL_FACE: number; - CULL_FACE_MODE: number; - CURRENT_PROGRAM: number; - CURRENT_VERTEX_ATTRIB: number; - CW: number; - DECR: number; - DECR_WRAP: number; - DELETE_STATUS: number; - DEPTH_ATTACHMENT: number; - DEPTH_BITS: number; - DEPTH_BUFFER_BIT: number; - DEPTH_CLEAR_VALUE: number; - DEPTH_COMPONENT: number; - DEPTH_COMPONENT16: number; - DEPTH_FUNC: number; - DEPTH_RANGE: number; - DEPTH_STENCIL: number; - DEPTH_STENCIL_ATTACHMENT: number; - DEPTH_TEST: number; - DEPTH_WRITEMASK: number; - DITHER: number; - DONT_CARE: number; - DST_ALPHA: number; - DST_COLOR: number; - DYNAMIC_DRAW: number; - ELEMENT_ARRAY_BUFFER: number; - ELEMENT_ARRAY_BUFFER_BINDING: number; - EQUAL: number; - FASTEST: number; - FLOAT: number; - FLOAT_MAT2: number; - FLOAT_MAT3: number; - FLOAT_MAT4: number; - FLOAT_VEC2: number; - FLOAT_VEC3: number; - FLOAT_VEC4: number; - FRAGMENT_SHADER: number; - FRAMEBUFFER: number; - FRAMEBUFFER_ATTACHMENT_OBJECT_NAME: number; - FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE: number; - FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE: number; - FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL: number; - FRAMEBUFFER_BINDING: number; - FRAMEBUFFER_COMPLETE: number; - FRAMEBUFFER_INCOMPLETE_ATTACHMENT: number; - FRAMEBUFFER_INCOMPLETE_DIMENSIONS: number; - FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT: number; - FRAMEBUFFER_UNSUPPORTED: number; - FRONT: number; - FRONT_AND_BACK: number; - FRONT_FACE: number; - FUNC_ADD: number; - FUNC_REVERSE_SUBTRACT: number; - FUNC_SUBTRACT: number; - GENERATE_MIPMAP_HINT: number; - GEQUAL: number; - GREATER: number; - GREEN_BITS: number; - HIGH_FLOAT: number; - HIGH_INT: number; - IMPLEMENTATION_COLOR_READ_FORMAT: number; - IMPLEMENTATION_COLOR_READ_TYPE: number; - INCR: number; - INCR_WRAP: number; - INT: number; - INT_VEC2: number; - INT_VEC3: number; - INT_VEC4: number; - INVALID_ENUM: number; - INVALID_FRAMEBUFFER_OPERATION: number; - INVALID_OPERATION: number; - INVALID_VALUE: number; - INVERT: number; - KEEP: number; - LEQUAL: number; - LESS: number; - LINEAR: number; - LINEAR_MIPMAP_LINEAR: number; - LINEAR_MIPMAP_NEAREST: number; - LINES: number; - LINE_LOOP: number; - LINE_STRIP: number; - LINE_WIDTH: number; - LINK_STATUS: number; - LOW_FLOAT: number; - LOW_INT: number; - LUMINANCE: number; - LUMINANCE_ALPHA: number; - MAX_COMBINED_TEXTURE_IMAGE_UNITS: number; - MAX_CUBE_MAP_TEXTURE_SIZE: number; - MAX_FRAGMENT_UNIFORM_VECTORS: number; - MAX_RENDERBUFFER_SIZE: number; - MAX_TEXTURE_IMAGE_UNITS: number; - MAX_TEXTURE_SIZE: number; - MAX_VARYING_VECTORS: number; - MAX_VERTEX_ATTRIBS: number; - MAX_VERTEX_TEXTURE_IMAGE_UNITS: number; - MAX_VERTEX_UNIFORM_VECTORS: number; - MAX_VIEWPORT_DIMS: number; - MEDIUM_FLOAT: number; - MEDIUM_INT: number; - MIRRORED_REPEAT: number; - NEAREST: number; - NEAREST_MIPMAP_LINEAR: number; - NEAREST_MIPMAP_NEAREST: number; - NEVER: number; - NICEST: number; - NONE: number; - NOTEQUAL: number; - NO_ERROR: number; - ONE: number; - ONE_MINUS_CONSTANT_ALPHA: number; - ONE_MINUS_CONSTANT_COLOR: number; - ONE_MINUS_DST_ALPHA: number; - ONE_MINUS_DST_COLOR: number; - ONE_MINUS_SRC_ALPHA: number; - ONE_MINUS_SRC_COLOR: number; - OUT_OF_MEMORY: number; - PACK_ALIGNMENT: number; - POINTS: number; - POLYGON_OFFSET_FACTOR: number; - POLYGON_OFFSET_FILL: number; - POLYGON_OFFSET_UNITS: number; - RED_BITS: number; - RENDERBUFFER: number; - RENDERBUFFER_ALPHA_SIZE: number; - RENDERBUFFER_BINDING: number; - RENDERBUFFER_BLUE_SIZE: number; - RENDERBUFFER_DEPTH_SIZE: number; - RENDERBUFFER_GREEN_SIZE: number; - RENDERBUFFER_HEIGHT: number; - RENDERBUFFER_INTERNAL_FORMAT: number; - RENDERBUFFER_RED_SIZE: number; - RENDERBUFFER_STENCIL_SIZE: number; - RENDERBUFFER_WIDTH: number; - RENDERER: number; - REPEAT: number; - REPLACE: number; - RGB: number; - RGB565: number; - RGB5_A1: number; - RGBA: number; - RGBA4: number; - SAMPLER_2D: number; - SAMPLER_CUBE: number; - SAMPLES: number; - SAMPLE_ALPHA_TO_COVERAGE: number; - SAMPLE_BUFFERS: number; - SAMPLE_COVERAGE: number; - SAMPLE_COVERAGE_INVERT: number; - SAMPLE_COVERAGE_VALUE: number; - SCISSOR_BOX: number; - SCISSOR_TEST: number; - SHADER_TYPE: number; - SHADING_LANGUAGE_VERSION: number; - SHORT: number; - SRC_ALPHA: number; - SRC_ALPHA_SATURATE: number; - SRC_COLOR: number; - STATIC_DRAW: number; - STENCIL_ATTACHMENT: number; - STENCIL_BACK_FAIL: number; - STENCIL_BACK_FUNC: number; - STENCIL_BACK_PASS_DEPTH_FAIL: number; - STENCIL_BACK_PASS_DEPTH_PASS: number; - STENCIL_BACK_REF: number; - STENCIL_BACK_VALUE_MASK: number; - STENCIL_BACK_WRITEMASK: number; - STENCIL_BITS: number; - STENCIL_BUFFER_BIT: number; - STENCIL_CLEAR_VALUE: number; - STENCIL_FAIL: number; - STENCIL_FUNC: number; - STENCIL_INDEX: number; - STENCIL_INDEX8: number; - STENCIL_PASS_DEPTH_FAIL: number; - STENCIL_PASS_DEPTH_PASS: number; - STENCIL_REF: number; - STENCIL_TEST: number; - STENCIL_VALUE_MASK: number; - STENCIL_WRITEMASK: number; - STREAM_DRAW: number; - SUBPIXEL_BITS: number; - TEXTURE: number; - TEXTURE0: number; - TEXTURE1: number; - TEXTURE10: number; - TEXTURE11: number; - TEXTURE12: number; - TEXTURE13: number; - TEXTURE14: number; - TEXTURE15: number; - TEXTURE16: number; - TEXTURE17: number; - TEXTURE18: number; - TEXTURE19: number; - TEXTURE2: number; - TEXTURE20: number; - TEXTURE21: number; - TEXTURE22: number; - TEXTURE23: number; - TEXTURE24: number; - TEXTURE25: number; - TEXTURE26: number; - TEXTURE27: number; - TEXTURE28: number; - TEXTURE29: number; - TEXTURE3: number; - TEXTURE30: number; - TEXTURE31: number; - TEXTURE4: number; - TEXTURE5: number; - TEXTURE6: number; - TEXTURE7: number; - TEXTURE8: number; - TEXTURE9: number; - TEXTURE_2D: number; - TEXTURE_BINDING_2D: number; - TEXTURE_BINDING_CUBE_MAP: number; - TEXTURE_CUBE_MAP: number; - TEXTURE_CUBE_MAP_NEGATIVE_X: number; - TEXTURE_CUBE_MAP_NEGATIVE_Y: number; - TEXTURE_CUBE_MAP_NEGATIVE_Z: number; - TEXTURE_CUBE_MAP_POSITIVE_X: number; - TEXTURE_CUBE_MAP_POSITIVE_Y: number; - TEXTURE_CUBE_MAP_POSITIVE_Z: number; - TEXTURE_MAG_FILTER: number; - TEXTURE_MIN_FILTER: number; - TEXTURE_WRAP_S: number; - TEXTURE_WRAP_T: number; - TRIANGLES: number; - TRIANGLE_FAN: number; - TRIANGLE_STRIP: number; - UNPACK_ALIGNMENT: number; - UNPACK_COLORSPACE_CONVERSION_WEBGL: number; - UNPACK_FLIP_Y_WEBGL: number; - UNPACK_PREMULTIPLY_ALPHA_WEBGL: number; - UNSIGNED_BYTE: number; - UNSIGNED_INT: number; - UNSIGNED_SHORT: number; - UNSIGNED_SHORT_4_4_4_4: number; - UNSIGNED_SHORT_5_5_5_1: number; - UNSIGNED_SHORT_5_6_5: number; - VALIDATE_STATUS: number; - VENDOR: number; - VERSION: number; - VERTEX_ATTRIB_ARRAY_BUFFER_BINDING: number; - VERTEX_ATTRIB_ARRAY_ENABLED: number; - VERTEX_ATTRIB_ARRAY_NORMALIZED: number; - VERTEX_ATTRIB_ARRAY_POINTER: number; - VERTEX_ATTRIB_ARRAY_SIZE: number; - VERTEX_ATTRIB_ARRAY_STRIDE: number; - VERTEX_ATTRIB_ARRAY_TYPE: number; - VERTEX_SHADER: number; - VIEWPORT: number; - ZERO: number; + readonly ACTIVE_ATTRIBUTES: number; + readonly ACTIVE_TEXTURE: number; + readonly ACTIVE_UNIFORMS: number; + readonly ALIASED_LINE_WIDTH_RANGE: number; + readonly ALIASED_POINT_SIZE_RANGE: number; + readonly ALPHA: number; + readonly ALPHA_BITS: number; + readonly ALWAYS: number; + readonly ARRAY_BUFFER: number; + readonly ARRAY_BUFFER_BINDING: number; + readonly ATTACHED_SHADERS: number; + readonly BACK: number; + readonly BLEND: number; + readonly BLEND_COLOR: number; + readonly BLEND_DST_ALPHA: number; + readonly BLEND_DST_RGB: number; + readonly BLEND_EQUATION: number; + readonly BLEND_EQUATION_ALPHA: number; + readonly BLEND_EQUATION_RGB: number; + readonly BLEND_SRC_ALPHA: number; + readonly BLEND_SRC_RGB: number; + readonly BLUE_BITS: number; + readonly BOOL: number; + readonly BOOL_VEC2: number; + readonly BOOL_VEC3: number; + readonly BOOL_VEC4: number; + readonly BROWSER_DEFAULT_WEBGL: number; + readonly BUFFER_SIZE: number; + readonly BUFFER_USAGE: number; + readonly BYTE: number; + readonly CCW: number; + readonly CLAMP_TO_EDGE: number; + readonly COLOR_ATTACHMENT0: number; + readonly COLOR_BUFFER_BIT: number; + readonly COLOR_CLEAR_VALUE: number; + readonly COLOR_WRITEMASK: number; + readonly COMPILE_STATUS: number; + readonly COMPRESSED_TEXTURE_FORMATS: number; + readonly CONSTANT_ALPHA: number; + readonly CONSTANT_COLOR: number; + readonly CONTEXT_LOST_WEBGL: number; + readonly CULL_FACE: number; + readonly CULL_FACE_MODE: number; + readonly CURRENT_PROGRAM: number; + readonly CURRENT_VERTEX_ATTRIB: number; + readonly CW: number; + readonly DECR: number; + readonly DECR_WRAP: number; + readonly DELETE_STATUS: number; + readonly DEPTH_ATTACHMENT: number; + readonly DEPTH_BITS: number; + readonly DEPTH_BUFFER_BIT: number; + readonly DEPTH_CLEAR_VALUE: number; + readonly DEPTH_COMPONENT: number; + readonly DEPTH_COMPONENT16: number; + readonly DEPTH_FUNC: number; + readonly DEPTH_RANGE: number; + readonly DEPTH_STENCIL: number; + readonly DEPTH_STENCIL_ATTACHMENT: number; + readonly DEPTH_TEST: number; + readonly DEPTH_WRITEMASK: number; + readonly DITHER: number; + readonly DONT_CARE: number; + readonly DST_ALPHA: number; + readonly DST_COLOR: number; + readonly DYNAMIC_DRAW: number; + readonly ELEMENT_ARRAY_BUFFER: number; + readonly ELEMENT_ARRAY_BUFFER_BINDING: number; + readonly EQUAL: number; + readonly FASTEST: number; + readonly FLOAT: number; + readonly FLOAT_MAT2: number; + readonly FLOAT_MAT3: number; + readonly FLOAT_MAT4: number; + readonly FLOAT_VEC2: number; + readonly FLOAT_VEC3: number; + readonly FLOAT_VEC4: number; + readonly FRAGMENT_SHADER: number; + readonly FRAMEBUFFER: number; + readonly FRAMEBUFFER_ATTACHMENT_OBJECT_NAME: number; + readonly FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE: number; + readonly FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE: number; + readonly FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL: number; + readonly FRAMEBUFFER_BINDING: number; + readonly FRAMEBUFFER_COMPLETE: number; + readonly FRAMEBUFFER_INCOMPLETE_ATTACHMENT: number; + readonly FRAMEBUFFER_INCOMPLETE_DIMENSIONS: number; + readonly FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT: number; + readonly FRAMEBUFFER_UNSUPPORTED: number; + readonly FRONT: number; + readonly FRONT_AND_BACK: number; + readonly FRONT_FACE: number; + readonly FUNC_ADD: number; + readonly FUNC_REVERSE_SUBTRACT: number; + readonly FUNC_SUBTRACT: number; + readonly GENERATE_MIPMAP_HINT: number; + readonly GEQUAL: number; + readonly GREATER: number; + readonly GREEN_BITS: number; + readonly HIGH_FLOAT: number; + readonly HIGH_INT: number; + readonly IMPLEMENTATION_COLOR_READ_FORMAT: number; + readonly IMPLEMENTATION_COLOR_READ_TYPE: number; + readonly INCR: number; + readonly INCR_WRAP: number; + readonly INT: number; + readonly INT_VEC2: number; + readonly INT_VEC3: number; + readonly INT_VEC4: number; + readonly INVALID_ENUM: number; + readonly INVALID_FRAMEBUFFER_OPERATION: number; + readonly INVALID_OPERATION: number; + readonly INVALID_VALUE: number; + readonly INVERT: number; + readonly KEEP: number; + readonly LEQUAL: number; + readonly LESS: number; + readonly LINEAR: number; + readonly LINEAR_MIPMAP_LINEAR: number; + readonly LINEAR_MIPMAP_NEAREST: number; + readonly LINES: number; + readonly LINE_LOOP: number; + readonly LINE_STRIP: number; + readonly LINE_WIDTH: number; + readonly LINK_STATUS: number; + readonly LOW_FLOAT: number; + readonly LOW_INT: number; + readonly LUMINANCE: number; + readonly LUMINANCE_ALPHA: number; + readonly MAX_COMBINED_TEXTURE_IMAGE_UNITS: number; + readonly MAX_CUBE_MAP_TEXTURE_SIZE: number; + readonly MAX_FRAGMENT_UNIFORM_VECTORS: number; + readonly MAX_RENDERBUFFER_SIZE: number; + readonly MAX_TEXTURE_IMAGE_UNITS: number; + readonly MAX_TEXTURE_SIZE: number; + readonly MAX_VARYING_VECTORS: number; + readonly MAX_VERTEX_ATTRIBS: number; + readonly MAX_VERTEX_TEXTURE_IMAGE_UNITS: number; + readonly MAX_VERTEX_UNIFORM_VECTORS: number; + readonly MAX_VIEWPORT_DIMS: number; + readonly MEDIUM_FLOAT: number; + readonly MEDIUM_INT: number; + readonly MIRRORED_REPEAT: number; + readonly NEAREST: number; + readonly NEAREST_MIPMAP_LINEAR: number; + readonly NEAREST_MIPMAP_NEAREST: number; + readonly NEVER: number; + readonly NICEST: number; + readonly NONE: number; + readonly NOTEQUAL: number; + readonly NO_ERROR: number; + readonly ONE: number; + readonly ONE_MINUS_CONSTANT_ALPHA: number; + readonly ONE_MINUS_CONSTANT_COLOR: number; + readonly ONE_MINUS_DST_ALPHA: number; + readonly ONE_MINUS_DST_COLOR: number; + readonly ONE_MINUS_SRC_ALPHA: number; + readonly ONE_MINUS_SRC_COLOR: number; + readonly OUT_OF_MEMORY: number; + readonly PACK_ALIGNMENT: number; + readonly POINTS: number; + readonly POLYGON_OFFSET_FACTOR: number; + readonly POLYGON_OFFSET_FILL: number; + readonly POLYGON_OFFSET_UNITS: number; + readonly RED_BITS: number; + readonly RENDERBUFFER: number; + readonly RENDERBUFFER_ALPHA_SIZE: number; + readonly RENDERBUFFER_BINDING: number; + readonly RENDERBUFFER_BLUE_SIZE: number; + readonly RENDERBUFFER_DEPTH_SIZE: number; + readonly RENDERBUFFER_GREEN_SIZE: number; + readonly RENDERBUFFER_HEIGHT: number; + readonly RENDERBUFFER_INTERNAL_FORMAT: number; + readonly RENDERBUFFER_RED_SIZE: number; + readonly RENDERBUFFER_STENCIL_SIZE: number; + readonly RENDERBUFFER_WIDTH: number; + readonly RENDERER: number; + readonly REPEAT: number; + readonly REPLACE: number; + readonly RGB: number; + readonly RGB565: number; + readonly RGB5_A1: number; + readonly RGBA: number; + readonly RGBA4: number; + readonly SAMPLER_2D: number; + readonly SAMPLER_CUBE: number; + readonly SAMPLES: number; + readonly SAMPLE_ALPHA_TO_COVERAGE: number; + readonly SAMPLE_BUFFERS: number; + readonly SAMPLE_COVERAGE: number; + readonly SAMPLE_COVERAGE_INVERT: number; + readonly SAMPLE_COVERAGE_VALUE: number; + readonly SCISSOR_BOX: number; + readonly SCISSOR_TEST: number; + readonly SHADER_TYPE: number; + readonly SHADING_LANGUAGE_VERSION: number; + readonly SHORT: number; + readonly SRC_ALPHA: number; + readonly SRC_ALPHA_SATURATE: number; + readonly SRC_COLOR: number; + readonly STATIC_DRAW: number; + readonly STENCIL_ATTACHMENT: number; + readonly STENCIL_BACK_FAIL: number; + readonly STENCIL_BACK_FUNC: number; + readonly STENCIL_BACK_PASS_DEPTH_FAIL: number; + readonly STENCIL_BACK_PASS_DEPTH_PASS: number; + readonly STENCIL_BACK_REF: number; + readonly STENCIL_BACK_VALUE_MASK: number; + readonly STENCIL_BACK_WRITEMASK: number; + readonly STENCIL_BITS: number; + readonly STENCIL_BUFFER_BIT: number; + readonly STENCIL_CLEAR_VALUE: number; + readonly STENCIL_FAIL: number; + readonly STENCIL_FUNC: number; + readonly STENCIL_INDEX: number; + readonly STENCIL_INDEX8: number; + readonly STENCIL_PASS_DEPTH_FAIL: number; + readonly STENCIL_PASS_DEPTH_PASS: number; + readonly STENCIL_REF: number; + readonly STENCIL_TEST: number; + readonly STENCIL_VALUE_MASK: number; + readonly STENCIL_WRITEMASK: number; + readonly STREAM_DRAW: number; + readonly SUBPIXEL_BITS: number; + readonly TEXTURE: number; + readonly TEXTURE0: number; + readonly TEXTURE1: number; + readonly TEXTURE10: number; + readonly TEXTURE11: number; + readonly TEXTURE12: number; + readonly TEXTURE13: number; + readonly TEXTURE14: number; + readonly TEXTURE15: number; + readonly TEXTURE16: number; + readonly TEXTURE17: number; + readonly TEXTURE18: number; + readonly TEXTURE19: number; + readonly TEXTURE2: number; + readonly TEXTURE20: number; + readonly TEXTURE21: number; + readonly TEXTURE22: number; + readonly TEXTURE23: number; + readonly TEXTURE24: number; + readonly TEXTURE25: number; + readonly TEXTURE26: number; + readonly TEXTURE27: number; + readonly TEXTURE28: number; + readonly TEXTURE29: number; + readonly TEXTURE3: number; + readonly TEXTURE30: number; + readonly TEXTURE31: number; + readonly TEXTURE4: number; + readonly TEXTURE5: number; + readonly TEXTURE6: number; + readonly TEXTURE7: number; + readonly TEXTURE8: number; + readonly TEXTURE9: number; + readonly TEXTURE_2D: number; + readonly TEXTURE_BINDING_2D: number; + readonly TEXTURE_BINDING_CUBE_MAP: number; + readonly TEXTURE_CUBE_MAP: number; + readonly TEXTURE_CUBE_MAP_NEGATIVE_X: number; + readonly TEXTURE_CUBE_MAP_NEGATIVE_Y: number; + readonly TEXTURE_CUBE_MAP_NEGATIVE_Z: number; + readonly TEXTURE_CUBE_MAP_POSITIVE_X: number; + readonly TEXTURE_CUBE_MAP_POSITIVE_Y: number; + readonly TEXTURE_CUBE_MAP_POSITIVE_Z: number; + readonly TEXTURE_MAG_FILTER: number; + readonly TEXTURE_MIN_FILTER: number; + readonly TEXTURE_WRAP_S: number; + readonly TEXTURE_WRAP_T: number; + readonly TRIANGLES: number; + readonly TRIANGLE_FAN: number; + readonly TRIANGLE_STRIP: number; + readonly UNPACK_ALIGNMENT: number; + readonly UNPACK_COLORSPACE_CONVERSION_WEBGL: number; + readonly UNPACK_FLIP_Y_WEBGL: number; + readonly UNPACK_PREMULTIPLY_ALPHA_WEBGL: number; + readonly UNSIGNED_BYTE: number; + readonly UNSIGNED_INT: number; + readonly UNSIGNED_SHORT: number; + readonly UNSIGNED_SHORT_4_4_4_4: number; + readonly UNSIGNED_SHORT_5_5_5_1: number; + readonly UNSIGNED_SHORT_5_6_5: number; + readonly VALIDATE_STATUS: number; + readonly VENDOR: number; + readonly VERSION: number; + readonly VERTEX_ATTRIB_ARRAY_BUFFER_BINDING: number; + readonly VERTEX_ATTRIB_ARRAY_ENABLED: number; + readonly VERTEX_ATTRIB_ARRAY_NORMALIZED: number; + readonly VERTEX_ATTRIB_ARRAY_POINTER: number; + readonly VERTEX_ATTRIB_ARRAY_SIZE: number; + readonly VERTEX_ATTRIB_ARRAY_STRIDE: number; + readonly VERTEX_ATTRIB_ARRAY_TYPE: number; + readonly VERTEX_SHADER: number; + readonly VIEWPORT: number; + readonly ZERO: number; } declare var WebGLRenderingContext: { prototype: WebGLRenderingContext; new(): WebGLRenderingContext; - ACTIVE_ATTRIBUTES: number; - ACTIVE_TEXTURE: number; - ACTIVE_UNIFORMS: number; - ALIASED_LINE_WIDTH_RANGE: number; - ALIASED_POINT_SIZE_RANGE: number; - ALPHA: number; - ALPHA_BITS: number; - ALWAYS: number; - ARRAY_BUFFER: number; - ARRAY_BUFFER_BINDING: number; - ATTACHED_SHADERS: number; - BACK: number; - BLEND: number; - BLEND_COLOR: number; - BLEND_DST_ALPHA: number; - BLEND_DST_RGB: number; - BLEND_EQUATION: number; - BLEND_EQUATION_ALPHA: number; - BLEND_EQUATION_RGB: number; - BLEND_SRC_ALPHA: number; - BLEND_SRC_RGB: number; - BLUE_BITS: number; - BOOL: number; - BOOL_VEC2: number; - BOOL_VEC3: number; - BOOL_VEC4: number; - BROWSER_DEFAULT_WEBGL: number; - BUFFER_SIZE: number; - BUFFER_USAGE: number; - BYTE: number; - CCW: number; - CLAMP_TO_EDGE: number; - COLOR_ATTACHMENT0: number; - COLOR_BUFFER_BIT: number; - COLOR_CLEAR_VALUE: number; - COLOR_WRITEMASK: number; - COMPILE_STATUS: number; - COMPRESSED_TEXTURE_FORMATS: number; - CONSTANT_ALPHA: number; - CONSTANT_COLOR: number; - CONTEXT_LOST_WEBGL: number; - CULL_FACE: number; - CULL_FACE_MODE: number; - CURRENT_PROGRAM: number; - CURRENT_VERTEX_ATTRIB: number; - CW: number; - DECR: number; - DECR_WRAP: number; - DELETE_STATUS: number; - DEPTH_ATTACHMENT: number; - DEPTH_BITS: number; - DEPTH_BUFFER_BIT: number; - DEPTH_CLEAR_VALUE: number; - DEPTH_COMPONENT: number; - DEPTH_COMPONENT16: number; - DEPTH_FUNC: number; - DEPTH_RANGE: number; - DEPTH_STENCIL: number; - DEPTH_STENCIL_ATTACHMENT: number; - DEPTH_TEST: number; - DEPTH_WRITEMASK: number; - DITHER: number; - DONT_CARE: number; - DST_ALPHA: number; - DST_COLOR: number; - DYNAMIC_DRAW: number; - ELEMENT_ARRAY_BUFFER: number; - ELEMENT_ARRAY_BUFFER_BINDING: number; - EQUAL: number; - FASTEST: number; - FLOAT: number; - FLOAT_MAT2: number; - FLOAT_MAT3: number; - FLOAT_MAT4: number; - FLOAT_VEC2: number; - FLOAT_VEC3: number; - FLOAT_VEC4: number; - FRAGMENT_SHADER: number; - FRAMEBUFFER: number; - FRAMEBUFFER_ATTACHMENT_OBJECT_NAME: number; - FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE: number; - FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE: number; - FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL: number; - FRAMEBUFFER_BINDING: number; - FRAMEBUFFER_COMPLETE: number; - FRAMEBUFFER_INCOMPLETE_ATTACHMENT: number; - FRAMEBUFFER_INCOMPLETE_DIMENSIONS: number; - FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT: number; - FRAMEBUFFER_UNSUPPORTED: number; - FRONT: number; - FRONT_AND_BACK: number; - FRONT_FACE: number; - FUNC_ADD: number; - FUNC_REVERSE_SUBTRACT: number; - FUNC_SUBTRACT: number; - GENERATE_MIPMAP_HINT: number; - GEQUAL: number; - GREATER: number; - GREEN_BITS: number; - HIGH_FLOAT: number; - HIGH_INT: number; - IMPLEMENTATION_COLOR_READ_FORMAT: number; - IMPLEMENTATION_COLOR_READ_TYPE: number; - INCR: number; - INCR_WRAP: number; - INT: number; - INT_VEC2: number; - INT_VEC3: number; - INT_VEC4: number; - INVALID_ENUM: number; - INVALID_FRAMEBUFFER_OPERATION: number; - INVALID_OPERATION: number; - INVALID_VALUE: number; - INVERT: number; - KEEP: number; - LEQUAL: number; - LESS: number; - LINEAR: number; - LINEAR_MIPMAP_LINEAR: number; - LINEAR_MIPMAP_NEAREST: number; - LINES: number; - LINE_LOOP: number; - LINE_STRIP: number; - LINE_WIDTH: number; - LINK_STATUS: number; - LOW_FLOAT: number; - LOW_INT: number; - LUMINANCE: number; - LUMINANCE_ALPHA: number; - MAX_COMBINED_TEXTURE_IMAGE_UNITS: number; - MAX_CUBE_MAP_TEXTURE_SIZE: number; - MAX_FRAGMENT_UNIFORM_VECTORS: number; - MAX_RENDERBUFFER_SIZE: number; - MAX_TEXTURE_IMAGE_UNITS: number; - MAX_TEXTURE_SIZE: number; - MAX_VARYING_VECTORS: number; - MAX_VERTEX_ATTRIBS: number; - MAX_VERTEX_TEXTURE_IMAGE_UNITS: number; - MAX_VERTEX_UNIFORM_VECTORS: number; - MAX_VIEWPORT_DIMS: number; - MEDIUM_FLOAT: number; - MEDIUM_INT: number; - MIRRORED_REPEAT: number; - NEAREST: number; - NEAREST_MIPMAP_LINEAR: number; - NEAREST_MIPMAP_NEAREST: number; - NEVER: number; - NICEST: number; - NONE: number; - NOTEQUAL: number; - NO_ERROR: number; - ONE: number; - ONE_MINUS_CONSTANT_ALPHA: number; - ONE_MINUS_CONSTANT_COLOR: number; - ONE_MINUS_DST_ALPHA: number; - ONE_MINUS_DST_COLOR: number; - ONE_MINUS_SRC_ALPHA: number; - ONE_MINUS_SRC_COLOR: number; - OUT_OF_MEMORY: number; - PACK_ALIGNMENT: number; - POINTS: number; - POLYGON_OFFSET_FACTOR: number; - POLYGON_OFFSET_FILL: number; - POLYGON_OFFSET_UNITS: number; - RED_BITS: number; - RENDERBUFFER: number; - RENDERBUFFER_ALPHA_SIZE: number; - RENDERBUFFER_BINDING: number; - RENDERBUFFER_BLUE_SIZE: number; - RENDERBUFFER_DEPTH_SIZE: number; - RENDERBUFFER_GREEN_SIZE: number; - RENDERBUFFER_HEIGHT: number; - RENDERBUFFER_INTERNAL_FORMAT: number; - RENDERBUFFER_RED_SIZE: number; - RENDERBUFFER_STENCIL_SIZE: number; - RENDERBUFFER_WIDTH: number; - RENDERER: number; - REPEAT: number; - REPLACE: number; - RGB: number; - RGB565: number; - RGB5_A1: number; - RGBA: number; - RGBA4: number; - SAMPLER_2D: number; - SAMPLER_CUBE: number; - SAMPLES: number; - SAMPLE_ALPHA_TO_COVERAGE: number; - SAMPLE_BUFFERS: number; - SAMPLE_COVERAGE: number; - SAMPLE_COVERAGE_INVERT: number; - SAMPLE_COVERAGE_VALUE: number; - SCISSOR_BOX: number; - SCISSOR_TEST: number; - SHADER_TYPE: number; - SHADING_LANGUAGE_VERSION: number; - SHORT: number; - SRC_ALPHA: number; - SRC_ALPHA_SATURATE: number; - SRC_COLOR: number; - STATIC_DRAW: number; - STENCIL_ATTACHMENT: number; - STENCIL_BACK_FAIL: number; - STENCIL_BACK_FUNC: number; - STENCIL_BACK_PASS_DEPTH_FAIL: number; - STENCIL_BACK_PASS_DEPTH_PASS: number; - STENCIL_BACK_REF: number; - STENCIL_BACK_VALUE_MASK: number; - STENCIL_BACK_WRITEMASK: number; - STENCIL_BITS: number; - STENCIL_BUFFER_BIT: number; - STENCIL_CLEAR_VALUE: number; - STENCIL_FAIL: number; - STENCIL_FUNC: number; - STENCIL_INDEX: number; - STENCIL_INDEX8: number; - STENCIL_PASS_DEPTH_FAIL: number; - STENCIL_PASS_DEPTH_PASS: number; - STENCIL_REF: number; - STENCIL_TEST: number; - STENCIL_VALUE_MASK: number; - STENCIL_WRITEMASK: number; - STREAM_DRAW: number; - SUBPIXEL_BITS: number; - TEXTURE: number; - TEXTURE0: number; - TEXTURE1: number; - TEXTURE10: number; - TEXTURE11: number; - TEXTURE12: number; - TEXTURE13: number; - TEXTURE14: number; - TEXTURE15: number; - TEXTURE16: number; - TEXTURE17: number; - TEXTURE18: number; - TEXTURE19: number; - TEXTURE2: number; - TEXTURE20: number; - TEXTURE21: number; - TEXTURE22: number; - TEXTURE23: number; - TEXTURE24: number; - TEXTURE25: number; - TEXTURE26: number; - TEXTURE27: number; - TEXTURE28: number; - TEXTURE29: number; - TEXTURE3: number; - TEXTURE30: number; - TEXTURE31: number; - TEXTURE4: number; - TEXTURE5: number; - TEXTURE6: number; - TEXTURE7: number; - TEXTURE8: number; - TEXTURE9: number; - TEXTURE_2D: number; - TEXTURE_BINDING_2D: number; - TEXTURE_BINDING_CUBE_MAP: number; - TEXTURE_CUBE_MAP: number; - TEXTURE_CUBE_MAP_NEGATIVE_X: number; - TEXTURE_CUBE_MAP_NEGATIVE_Y: number; - TEXTURE_CUBE_MAP_NEGATIVE_Z: number; - TEXTURE_CUBE_MAP_POSITIVE_X: number; - TEXTURE_CUBE_MAP_POSITIVE_Y: number; - TEXTURE_CUBE_MAP_POSITIVE_Z: number; - TEXTURE_MAG_FILTER: number; - TEXTURE_MIN_FILTER: number; - TEXTURE_WRAP_S: number; - TEXTURE_WRAP_T: number; - TRIANGLES: number; - TRIANGLE_FAN: number; - TRIANGLE_STRIP: number; - UNPACK_ALIGNMENT: number; - UNPACK_COLORSPACE_CONVERSION_WEBGL: number; - UNPACK_FLIP_Y_WEBGL: number; - UNPACK_PREMULTIPLY_ALPHA_WEBGL: number; - UNSIGNED_BYTE: number; - UNSIGNED_INT: number; - UNSIGNED_SHORT: number; - UNSIGNED_SHORT_4_4_4_4: number; - UNSIGNED_SHORT_5_5_5_1: number; - UNSIGNED_SHORT_5_6_5: number; - VALIDATE_STATUS: number; - VENDOR: number; - VERSION: number; - VERTEX_ATTRIB_ARRAY_BUFFER_BINDING: number; - VERTEX_ATTRIB_ARRAY_ENABLED: number; - VERTEX_ATTRIB_ARRAY_NORMALIZED: number; - VERTEX_ATTRIB_ARRAY_POINTER: number; - VERTEX_ATTRIB_ARRAY_SIZE: number; - VERTEX_ATTRIB_ARRAY_STRIDE: number; - VERTEX_ATTRIB_ARRAY_TYPE: number; - VERTEX_SHADER: number; - VIEWPORT: number; - ZERO: number; + readonly ACTIVE_ATTRIBUTES: number; + readonly ACTIVE_TEXTURE: number; + readonly ACTIVE_UNIFORMS: number; + readonly ALIASED_LINE_WIDTH_RANGE: number; + readonly ALIASED_POINT_SIZE_RANGE: number; + readonly ALPHA: number; + readonly ALPHA_BITS: number; + readonly ALWAYS: number; + readonly ARRAY_BUFFER: number; + readonly ARRAY_BUFFER_BINDING: number; + readonly ATTACHED_SHADERS: number; + readonly BACK: number; + readonly BLEND: number; + readonly BLEND_COLOR: number; + readonly BLEND_DST_ALPHA: number; + readonly BLEND_DST_RGB: number; + readonly BLEND_EQUATION: number; + readonly BLEND_EQUATION_ALPHA: number; + readonly BLEND_EQUATION_RGB: number; + readonly BLEND_SRC_ALPHA: number; + readonly BLEND_SRC_RGB: number; + readonly BLUE_BITS: number; + readonly BOOL: number; + readonly BOOL_VEC2: number; + readonly BOOL_VEC3: number; + readonly BOOL_VEC4: number; + readonly BROWSER_DEFAULT_WEBGL: number; + readonly BUFFER_SIZE: number; + readonly BUFFER_USAGE: number; + readonly BYTE: number; + readonly CCW: number; + readonly CLAMP_TO_EDGE: number; + readonly COLOR_ATTACHMENT0: number; + readonly COLOR_BUFFER_BIT: number; + readonly COLOR_CLEAR_VALUE: number; + readonly COLOR_WRITEMASK: number; + readonly COMPILE_STATUS: number; + readonly COMPRESSED_TEXTURE_FORMATS: number; + readonly CONSTANT_ALPHA: number; + readonly CONSTANT_COLOR: number; + readonly CONTEXT_LOST_WEBGL: number; + readonly CULL_FACE: number; + readonly CULL_FACE_MODE: number; + readonly CURRENT_PROGRAM: number; + readonly CURRENT_VERTEX_ATTRIB: number; + readonly CW: number; + readonly DECR: number; + readonly DECR_WRAP: number; + readonly DELETE_STATUS: number; + readonly DEPTH_ATTACHMENT: number; + readonly DEPTH_BITS: number; + readonly DEPTH_BUFFER_BIT: number; + readonly DEPTH_CLEAR_VALUE: number; + readonly DEPTH_COMPONENT: number; + readonly DEPTH_COMPONENT16: number; + readonly DEPTH_FUNC: number; + readonly DEPTH_RANGE: number; + readonly DEPTH_STENCIL: number; + readonly DEPTH_STENCIL_ATTACHMENT: number; + readonly DEPTH_TEST: number; + readonly DEPTH_WRITEMASK: number; + readonly DITHER: number; + readonly DONT_CARE: number; + readonly DST_ALPHA: number; + readonly DST_COLOR: number; + readonly DYNAMIC_DRAW: number; + readonly ELEMENT_ARRAY_BUFFER: number; + readonly ELEMENT_ARRAY_BUFFER_BINDING: number; + readonly EQUAL: number; + readonly FASTEST: number; + readonly FLOAT: number; + readonly FLOAT_MAT2: number; + readonly FLOAT_MAT3: number; + readonly FLOAT_MAT4: number; + readonly FLOAT_VEC2: number; + readonly FLOAT_VEC3: number; + readonly FLOAT_VEC4: number; + readonly FRAGMENT_SHADER: number; + readonly FRAMEBUFFER: number; + readonly FRAMEBUFFER_ATTACHMENT_OBJECT_NAME: number; + readonly FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE: number; + readonly FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE: number; + readonly FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL: number; + readonly FRAMEBUFFER_BINDING: number; + readonly FRAMEBUFFER_COMPLETE: number; + readonly FRAMEBUFFER_INCOMPLETE_ATTACHMENT: number; + readonly FRAMEBUFFER_INCOMPLETE_DIMENSIONS: number; + readonly FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT: number; + readonly FRAMEBUFFER_UNSUPPORTED: number; + readonly FRONT: number; + readonly FRONT_AND_BACK: number; + readonly FRONT_FACE: number; + readonly FUNC_ADD: number; + readonly FUNC_REVERSE_SUBTRACT: number; + readonly FUNC_SUBTRACT: number; + readonly GENERATE_MIPMAP_HINT: number; + readonly GEQUAL: number; + readonly GREATER: number; + readonly GREEN_BITS: number; + readonly HIGH_FLOAT: number; + readonly HIGH_INT: number; + readonly IMPLEMENTATION_COLOR_READ_FORMAT: number; + readonly IMPLEMENTATION_COLOR_READ_TYPE: number; + readonly INCR: number; + readonly INCR_WRAP: number; + readonly INT: number; + readonly INT_VEC2: number; + readonly INT_VEC3: number; + readonly INT_VEC4: number; + readonly INVALID_ENUM: number; + readonly INVALID_FRAMEBUFFER_OPERATION: number; + readonly INVALID_OPERATION: number; + readonly INVALID_VALUE: number; + readonly INVERT: number; + readonly KEEP: number; + readonly LEQUAL: number; + readonly LESS: number; + readonly LINEAR: number; + readonly LINEAR_MIPMAP_LINEAR: number; + readonly LINEAR_MIPMAP_NEAREST: number; + readonly LINES: number; + readonly LINE_LOOP: number; + readonly LINE_STRIP: number; + readonly LINE_WIDTH: number; + readonly LINK_STATUS: number; + readonly LOW_FLOAT: number; + readonly LOW_INT: number; + readonly LUMINANCE: number; + readonly LUMINANCE_ALPHA: number; + readonly MAX_COMBINED_TEXTURE_IMAGE_UNITS: number; + readonly MAX_CUBE_MAP_TEXTURE_SIZE: number; + readonly MAX_FRAGMENT_UNIFORM_VECTORS: number; + readonly MAX_RENDERBUFFER_SIZE: number; + readonly MAX_TEXTURE_IMAGE_UNITS: number; + readonly MAX_TEXTURE_SIZE: number; + readonly MAX_VARYING_VECTORS: number; + readonly MAX_VERTEX_ATTRIBS: number; + readonly MAX_VERTEX_TEXTURE_IMAGE_UNITS: number; + readonly MAX_VERTEX_UNIFORM_VECTORS: number; + readonly MAX_VIEWPORT_DIMS: number; + readonly MEDIUM_FLOAT: number; + readonly MEDIUM_INT: number; + readonly MIRRORED_REPEAT: number; + readonly NEAREST: number; + readonly NEAREST_MIPMAP_LINEAR: number; + readonly NEAREST_MIPMAP_NEAREST: number; + readonly NEVER: number; + readonly NICEST: number; + readonly NONE: number; + readonly NOTEQUAL: number; + readonly NO_ERROR: number; + readonly ONE: number; + readonly ONE_MINUS_CONSTANT_ALPHA: number; + readonly ONE_MINUS_CONSTANT_COLOR: number; + readonly ONE_MINUS_DST_ALPHA: number; + readonly ONE_MINUS_DST_COLOR: number; + readonly ONE_MINUS_SRC_ALPHA: number; + readonly ONE_MINUS_SRC_COLOR: number; + readonly OUT_OF_MEMORY: number; + readonly PACK_ALIGNMENT: number; + readonly POINTS: number; + readonly POLYGON_OFFSET_FACTOR: number; + readonly POLYGON_OFFSET_FILL: number; + readonly POLYGON_OFFSET_UNITS: number; + readonly RED_BITS: number; + readonly RENDERBUFFER: number; + readonly RENDERBUFFER_ALPHA_SIZE: number; + readonly RENDERBUFFER_BINDING: number; + readonly RENDERBUFFER_BLUE_SIZE: number; + readonly RENDERBUFFER_DEPTH_SIZE: number; + readonly RENDERBUFFER_GREEN_SIZE: number; + readonly RENDERBUFFER_HEIGHT: number; + readonly RENDERBUFFER_INTERNAL_FORMAT: number; + readonly RENDERBUFFER_RED_SIZE: number; + readonly RENDERBUFFER_STENCIL_SIZE: number; + readonly RENDERBUFFER_WIDTH: number; + readonly RENDERER: number; + readonly REPEAT: number; + readonly REPLACE: number; + readonly RGB: number; + readonly RGB565: number; + readonly RGB5_A1: number; + readonly RGBA: number; + readonly RGBA4: number; + readonly SAMPLER_2D: number; + readonly SAMPLER_CUBE: number; + readonly SAMPLES: number; + readonly SAMPLE_ALPHA_TO_COVERAGE: number; + readonly SAMPLE_BUFFERS: number; + readonly SAMPLE_COVERAGE: number; + readonly SAMPLE_COVERAGE_INVERT: number; + readonly SAMPLE_COVERAGE_VALUE: number; + readonly SCISSOR_BOX: number; + readonly SCISSOR_TEST: number; + readonly SHADER_TYPE: number; + readonly SHADING_LANGUAGE_VERSION: number; + readonly SHORT: number; + readonly SRC_ALPHA: number; + readonly SRC_ALPHA_SATURATE: number; + readonly SRC_COLOR: number; + readonly STATIC_DRAW: number; + readonly STENCIL_ATTACHMENT: number; + readonly STENCIL_BACK_FAIL: number; + readonly STENCIL_BACK_FUNC: number; + readonly STENCIL_BACK_PASS_DEPTH_FAIL: number; + readonly STENCIL_BACK_PASS_DEPTH_PASS: number; + readonly STENCIL_BACK_REF: number; + readonly STENCIL_BACK_VALUE_MASK: number; + readonly STENCIL_BACK_WRITEMASK: number; + readonly STENCIL_BITS: number; + readonly STENCIL_BUFFER_BIT: number; + readonly STENCIL_CLEAR_VALUE: number; + readonly STENCIL_FAIL: number; + readonly STENCIL_FUNC: number; + readonly STENCIL_INDEX: number; + readonly STENCIL_INDEX8: number; + readonly STENCIL_PASS_DEPTH_FAIL: number; + readonly STENCIL_PASS_DEPTH_PASS: number; + readonly STENCIL_REF: number; + readonly STENCIL_TEST: number; + readonly STENCIL_VALUE_MASK: number; + readonly STENCIL_WRITEMASK: number; + readonly STREAM_DRAW: number; + readonly SUBPIXEL_BITS: number; + readonly TEXTURE: number; + readonly TEXTURE0: number; + readonly TEXTURE1: number; + readonly TEXTURE10: number; + readonly TEXTURE11: number; + readonly TEXTURE12: number; + readonly TEXTURE13: number; + readonly TEXTURE14: number; + readonly TEXTURE15: number; + readonly TEXTURE16: number; + readonly TEXTURE17: number; + readonly TEXTURE18: number; + readonly TEXTURE19: number; + readonly TEXTURE2: number; + readonly TEXTURE20: number; + readonly TEXTURE21: number; + readonly TEXTURE22: number; + readonly TEXTURE23: number; + readonly TEXTURE24: number; + readonly TEXTURE25: number; + readonly TEXTURE26: number; + readonly TEXTURE27: number; + readonly TEXTURE28: number; + readonly TEXTURE29: number; + readonly TEXTURE3: number; + readonly TEXTURE30: number; + readonly TEXTURE31: number; + readonly TEXTURE4: number; + readonly TEXTURE5: number; + readonly TEXTURE6: number; + readonly TEXTURE7: number; + readonly TEXTURE8: number; + readonly TEXTURE9: number; + readonly TEXTURE_2D: number; + readonly TEXTURE_BINDING_2D: number; + readonly TEXTURE_BINDING_CUBE_MAP: number; + readonly TEXTURE_CUBE_MAP: number; + readonly TEXTURE_CUBE_MAP_NEGATIVE_X: number; + readonly TEXTURE_CUBE_MAP_NEGATIVE_Y: number; + readonly TEXTURE_CUBE_MAP_NEGATIVE_Z: number; + readonly TEXTURE_CUBE_MAP_POSITIVE_X: number; + readonly TEXTURE_CUBE_MAP_POSITIVE_Y: number; + readonly TEXTURE_CUBE_MAP_POSITIVE_Z: number; + readonly TEXTURE_MAG_FILTER: number; + readonly TEXTURE_MIN_FILTER: number; + readonly TEXTURE_WRAP_S: number; + readonly TEXTURE_WRAP_T: number; + readonly TRIANGLES: number; + readonly TRIANGLE_FAN: number; + readonly TRIANGLE_STRIP: number; + readonly UNPACK_ALIGNMENT: number; + readonly UNPACK_COLORSPACE_CONVERSION_WEBGL: number; + readonly UNPACK_FLIP_Y_WEBGL: number; + readonly UNPACK_PREMULTIPLY_ALPHA_WEBGL: number; + readonly UNSIGNED_BYTE: number; + readonly UNSIGNED_INT: number; + readonly UNSIGNED_SHORT: number; + readonly UNSIGNED_SHORT_4_4_4_4: number; + readonly UNSIGNED_SHORT_5_5_5_1: number; + readonly UNSIGNED_SHORT_5_6_5: number; + readonly VALIDATE_STATUS: number; + readonly VENDOR: number; + readonly VERSION: number; + readonly VERTEX_ATTRIB_ARRAY_BUFFER_BINDING: number; + readonly VERTEX_ATTRIB_ARRAY_ENABLED: number; + readonly VERTEX_ATTRIB_ARRAY_NORMALIZED: number; + readonly VERTEX_ATTRIB_ARRAY_POINTER: number; + readonly VERTEX_ATTRIB_ARRAY_SIZE: number; + readonly VERTEX_ATTRIB_ARRAY_STRIDE: number; + readonly VERTEX_ATTRIB_ARRAY_TYPE: number; + readonly VERTEX_SHADER: number; + readonly VIEWPORT: number; + readonly ZERO: number; } interface WebGLShader extends WebGLObject { @@ -15824,9 +16819,9 @@ declare var WebGLShader: { } interface WebGLShaderPrecisionFormat { - precision: number; - rangeMax: number; - rangeMin: number; + readonly precision: number; + readonly rangeMax: number; + readonly rangeMin: number; } declare var WebGLShaderPrecisionFormat: { @@ -15902,21 +16897,21 @@ declare var WebKitPoint: { interface WebSocket extends EventTarget { binaryType: string; - bufferedAmount: number; - extensions: string; + readonly bufferedAmount: number; + readonly extensions: string; onclose: (ev: CloseEvent) => any; onerror: (ev: Event) => any; onmessage: (ev: MessageEvent) => any; onopen: (ev: Event) => any; - protocol: string; - readyState: number; - url: string; + readonly protocol: string; + readonly readyState: number; + readonly url: string; close(code?: number, reason?: string): void; send(data: any): void; - CLOSED: number; - CLOSING: number; - CONNECTING: number; - OPEN: number; + readonly CLOSED: number; + readonly CLOSING: number; + readonly CONNECTING: number; + readonly OPEN: number; addEventListener(type: "close", listener: (ev: CloseEvent) => any, useCapture?: boolean): void; addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: "message", listener: (ev: MessageEvent) => any, useCapture?: boolean): void; @@ -15927,56 +16922,58 @@ interface WebSocket extends EventTarget { declare var WebSocket: { prototype: WebSocket; new(url: string, protocols?: string | string[]): WebSocket; - CLOSED: number; - CLOSING: number; - CONNECTING: number; - OPEN: number; + readonly CLOSED: number; + readonly CLOSING: number; + readonly CONNECTING: number; + readonly OPEN: number; } interface WheelEvent extends MouseEvent { - deltaMode: number; - deltaX: number; - deltaY: number; - deltaZ: number; + readonly deltaMode: number; + readonly deltaX: number; + readonly deltaY: number; + readonly deltaZ: number; + readonly wheelDelta: number; + readonly wheelDeltaX: number; + readonly wheelDeltaY: number; getCurrentPoint(element: Element): void; 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; - DOM_DELTA_LINE: number; - DOM_DELTA_PAGE: number; - DOM_DELTA_PIXEL: number; + readonly DOM_DELTA_LINE: number; + readonly DOM_DELTA_PAGE: number; + readonly DOM_DELTA_PIXEL: number; } declare var WheelEvent: { prototype: WheelEvent; new(typeArg: string, eventInitDict?: WheelEventInit): WheelEvent; - DOM_DELTA_LINE: number; - DOM_DELTA_PAGE: number; - DOM_DELTA_PIXEL: number; + readonly DOM_DELTA_LINE: number; + readonly DOM_DELTA_PAGE: number; + readonly DOM_DELTA_PIXEL: number; } interface Window extends EventTarget, WindowTimers, WindowSessionStorage, WindowLocalStorage, WindowConsole, GlobalEventHandlers, IDBEnvironment, WindowBase64 { - animationStartTime: number; - applicationCache: ApplicationCache; - clientInformation: Navigator; - closed: boolean; - crypto: Crypto; + readonly applicationCache: ApplicationCache; + readonly clientInformation: Navigator; + readonly closed: boolean; + readonly crypto: Crypto; defaultStatus: string; - devicePixelRatio: number; - doNotTrack: string; - document: Document; + readonly devicePixelRatio: number; + readonly doNotTrack: string; + readonly document: Document; event: Event; - external: External; - frameElement: Element; - frames: Window; - history: History; - innerHeight: number; - innerWidth: number; - length: number; - location: Location; - locationbar: BarProp; - menubar: BarProp; - msAnimationStartTime: number; + readonly external: External; + readonly frameElement: Element; + readonly frames: Window; + readonly history: History; + readonly innerHeight: number; + readonly innerWidth: number; + readonly length: number; + readonly location: Location; + readonly locationbar: BarProp; + readonly menubar: BarProp; + readonly msCredentials: MSCredentials; name: string; - navigator: Navigator; + readonly navigator: Navigator; offscreenBuffering: string | boolean; onabort: (ev: Event) => any; onafterprint: (ev: Event) => any; @@ -15990,6 +16987,7 @@ interface Window extends EventTarget, WindowTimers, WindowSessionStorage, Window oncompassneedscalibration: (ev: Event) => any; oncontextmenu: (ev: PointerEvent) => any; ondblclick: (ev: MouseEvent) => any; + ondevicelight: (ev: DeviceLightEvent) => any; ondevicemotion: (ev: DeviceMotionEvent) => any; ondeviceorientation: (ev: DeviceOrientationEvent) => any; ondrag: (ev: DragEvent) => any; @@ -16001,11 +16999,12 @@ interface Window extends EventTarget, WindowTimers, WindowSessionStorage, Window ondrop: (ev: DragEvent) => any; ondurationchange: (ev: Event) => any; onemptied: (ev: Event) => any; - onended: (ev: Event) => any; + onended: (ev: MediaStreamErrorEvent) => any; onerror: ErrorEventHandler; onfocus: (ev: FocusEvent) => any; onhashchange: (ev: HashChangeEvent) => any; oninput: (ev: Event) => any; + oninvalid: (ev: Event) => any; onkeydown: (ev: KeyboardEvent) => any; onkeypress: (ev: KeyboardEvent) => any; onkeyup: (ev: KeyboardEvent) => any; @@ -16021,7 +17020,7 @@ interface Window extends EventTarget, WindowTimers, WindowSessionStorage, Window onmouseout: (ev: MouseEvent) => any; onmouseover: (ev: MouseEvent) => any; onmouseup: (ev: MouseEvent) => any; - onmousewheel: (ev: MouseWheelEvent) => any; + onmousewheel: (ev: WheelEvent) => any; onmsgesturechange: (ev: MSGestureEvent) => any; onmsgesturedoubletap: (ev: MSGestureEvent) => any; onmsgestureend: (ev: MSGestureEvent) => any; @@ -16060,38 +17059,38 @@ interface Window extends EventTarget, WindowTimers, WindowSessionStorage, Window onsubmit: (ev: Event) => any; onsuspend: (ev: Event) => any; ontimeupdate: (ev: Event) => any; - ontouchcancel: any; - ontouchend: any; - ontouchmove: any; - ontouchstart: any; + ontouchcancel: (ev: TouchEvent) => any; + ontouchend: (ev: TouchEvent) => any; + ontouchmove: (ev: TouchEvent) => any; + ontouchstart: (ev: TouchEvent) => any; onunload: (ev: Event) => any; onvolumechange: (ev: Event) => any; onwaiting: (ev: Event) => any; - opener: Window; + readonly opener: Window; orientation: string | number; - outerHeight: number; - outerWidth: number; - pageXOffset: number; - pageYOffset: number; - parent: Window; - performance: Performance; - personalbar: BarProp; - screen: Screen; - screenLeft: number; - screenTop: number; - screenX: number; - screenY: number; - scrollX: number; - scrollY: number; - scrollbars: BarProp; - self: Window; + readonly outerHeight: number; + readonly outerWidth: number; + readonly pageXOffset: number; + readonly pageYOffset: number; + readonly parent: Window; + readonly performance: Performance; + readonly personalbar: BarProp; + readonly screen: Screen; + readonly screenLeft: number; + readonly screenTop: number; + readonly screenX: number; + readonly screenY: number; + readonly scrollX: number; + readonly scrollY: number; + readonly scrollbars: BarProp; + readonly self: Window; status: string; - statusbar: BarProp; - styleMedia: StyleMedia; - toolbar: BarProp; - top: Window; - window: Window; - URL: URL; + readonly statusbar: BarProp; + readonly styleMedia: StyleMedia; + readonly toolbar: BarProp; + readonly top: Window; + readonly window: Window; + URL: typeof URL; alert(message?: any): void; blur(): void; cancelAnimationFrame(handle: number): void; @@ -16105,12 +17104,9 @@ interface Window extends EventTarget, WindowTimers, WindowSessionStorage, Window matchMedia(mediaQuery: string): MediaQueryList; moveBy(x?: number, y?: number): void; moveTo(x?: number, y?: number): void; - msCancelRequestAnimationFrame(handle: number): void; - msMatchMedia(mediaQuery: string): MediaQueryList; - msRequestAnimationFrame(callback: FrameRequestCallback): number; msWriteProfilerMark(profilerMarkName: string): void; open(url?: string, target?: string, features?: string, replace?: boolean): Window; - postMessage(message: any, targetOrigin: string, ports?: any): void; + postMessage(message: any, targetOrigin: string, transfer?: any[]): void; print(): void; prompt(message?: string, _default?: string): string; releaseEvents(): void; @@ -16120,8 +17116,10 @@ interface Window extends EventTarget, WindowTimers, WindowSessionStorage, Window scroll(x?: number, y?: number): void; scrollBy(x?: number, y?: number): void; scrollTo(x?: number, y?: number): void; + webkitCancelAnimationFrame(handle: number): void; webkitConvertPointFromNodeToPage(node: Node, pt: WebKitPoint): WebKitPoint; webkitConvertPointFromPageToNode(node: Node, pt: WebKitPoint): WebKitPoint; + webkitRequestAnimationFrame(callback: FrameRequestCallback): number; addEventListener(type: "MSGestureChange", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void; addEventListener(type: "MSGestureDoubleTap", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void; addEventListener(type: "MSGestureEnd", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void; @@ -16149,6 +17147,7 @@ interface Window extends EventTarget, WindowTimers, WindowSessionStorage, Window addEventListener(type: "compassneedscalibration", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "contextmenu", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; addEventListener(type: "dblclick", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "devicelight", listener: (ev: DeviceLightEvent) => any, useCapture?: boolean): void; addEventListener(type: "devicemotion", listener: (ev: DeviceMotionEvent) => any, useCapture?: boolean): void; addEventListener(type: "deviceorientation", listener: (ev: DeviceOrientationEvent) => any, useCapture?: boolean): void; addEventListener(type: "drag", listener: (ev: DragEvent) => any, useCapture?: boolean): void; @@ -16160,10 +17159,11 @@ interface Window extends EventTarget, WindowTimers, WindowSessionStorage, Window addEventListener(type: "drop", listener: (ev: DragEvent) => any, useCapture?: boolean): void; addEventListener(type: "durationchange", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "emptied", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "ended", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "ended", listener: (ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: "focus", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; addEventListener(type: "hashchange", listener: (ev: HashChangeEvent) => any, useCapture?: boolean): void; addEventListener(type: "input", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "invalid", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "keydown", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "keypress", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "keyup", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; @@ -16179,7 +17179,7 @@ interface Window extends EventTarget, WindowTimers, WindowSessionStorage, Window addEventListener(type: "mouseout", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "mouseover", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "mouseup", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousewheel", listener: (ev: MouseWheelEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mousewheel", listener: (ev: WheelEvent) => any, useCapture?: boolean): void; addEventListener(type: "offline", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "online", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "orientationchange", listener: (ev: Event) => any, useCapture?: boolean): void; @@ -16249,16 +17249,15 @@ declare var XMLDocument: { interface XMLHttpRequest extends EventTarget, XMLHttpRequestEventTarget { msCaching: string; onreadystatechange: (ev: ProgressEvent) => any; - readyState: number; - response: any; - responseBody: any; - responseText: string; + readonly readyState: number; + readonly response: any; + readonly responseText: string; responseType: string; - responseXML: any; - status: number; - statusText: string; + readonly responseXML: any; + readonly status: number; + readonly statusText: string; timeout: number; - upload: XMLHttpRequestUpload; + readonly upload: XMLHttpRequestUpload; withCredentials: boolean; abort(): void; getAllResponseHeaders(): string; @@ -16270,11 +17269,11 @@ interface XMLHttpRequest extends EventTarget, XMLHttpRequestEventTarget { send(data?: string): void; send(data?: any): void; setRequestHeader(header: string, value: string): void; - DONE: number; - HEADERS_RECEIVED: number; - LOADING: number; - OPENED: number; - UNSENT: number; + readonly DONE: number; + readonly HEADERS_RECEIVED: number; + readonly LOADING: number; + readonly OPENED: number; + readonly UNSENT: number; addEventListener(type: "abort", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: "load", listener: (ev: Event) => any, useCapture?: boolean): void; @@ -16289,11 +17288,11 @@ interface XMLHttpRequest extends EventTarget, XMLHttpRequestEventTarget { declare var XMLHttpRequest: { prototype: XMLHttpRequest; new(): XMLHttpRequest; - DONE: number; - HEADERS_RECEIVED: number; - LOADING: number; - OPENED: number; - UNSENT: number; + readonly DONE: number; + readonly HEADERS_RECEIVED: number; + readonly LOADING: number; + readonly OPENED: number; + readonly UNSENT: number; create(): XMLHttpRequest; } @@ -16345,40 +17344,40 @@ declare var XPathNSResolver: { } interface XPathResult { - booleanValue: boolean; - invalidIteratorState: boolean; - numberValue: number; - resultType: number; - singleNodeValue: Node; - snapshotLength: number; - stringValue: string; + readonly booleanValue: boolean; + readonly invalidIteratorState: boolean; + readonly numberValue: number; + readonly resultType: number; + readonly singleNodeValue: Node; + readonly snapshotLength: number; + readonly stringValue: string; iterateNext(): Node; snapshotItem(index: number): Node; - ANY_TYPE: number; - ANY_UNORDERED_NODE_TYPE: number; - BOOLEAN_TYPE: number; - FIRST_ORDERED_NODE_TYPE: number; - NUMBER_TYPE: number; - ORDERED_NODE_ITERATOR_TYPE: number; - ORDERED_NODE_SNAPSHOT_TYPE: number; - STRING_TYPE: number; - UNORDERED_NODE_ITERATOR_TYPE: number; - UNORDERED_NODE_SNAPSHOT_TYPE: number; + readonly ANY_TYPE: number; + readonly ANY_UNORDERED_NODE_TYPE: number; + readonly BOOLEAN_TYPE: number; + readonly FIRST_ORDERED_NODE_TYPE: number; + readonly NUMBER_TYPE: number; + readonly ORDERED_NODE_ITERATOR_TYPE: number; + readonly ORDERED_NODE_SNAPSHOT_TYPE: number; + readonly STRING_TYPE: number; + readonly UNORDERED_NODE_ITERATOR_TYPE: number; + readonly UNORDERED_NODE_SNAPSHOT_TYPE: number; } declare var XPathResult: { prototype: XPathResult; new(): XPathResult; - ANY_TYPE: number; - ANY_UNORDERED_NODE_TYPE: number; - BOOLEAN_TYPE: number; - FIRST_ORDERED_NODE_TYPE: number; - NUMBER_TYPE: number; - ORDERED_NODE_ITERATOR_TYPE: number; - ORDERED_NODE_SNAPSHOT_TYPE: number; - STRING_TYPE: number; - UNORDERED_NODE_ITERATOR_TYPE: number; - UNORDERED_NODE_SNAPSHOT_TYPE: number; + readonly ANY_TYPE: number; + readonly ANY_UNORDERED_NODE_TYPE: number; + readonly BOOLEAN_TYPE: number; + readonly FIRST_ORDERED_NODE_TYPE: number; + readonly NUMBER_TYPE: number; + readonly ORDERED_NODE_ITERATOR_TYPE: number; + readonly ORDERED_NODE_SNAPSHOT_TYPE: number; + readonly STRING_TYPE: number; + readonly UNORDERED_NODE_ITERATOR_TYPE: number; + readonly UNORDERED_NODE_SNAPSHOT_TYPE: number; } interface XSLTProcessor { @@ -16403,6 +17402,18 @@ interface AbstractWorker { addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } +interface CanvasPathMethods { + arc(x: number, y: number, radius: number, startAngle: number, endAngle: number, anticlockwise?: boolean): void; + arcTo(x1: number, y1: number, x2: number, y2: number, radius: number): void; + bezierCurveTo(cp1x: number, cp1y: number, cp2x: number, cp2y: number, x: number, y: number): void; + closePath(): void; + ellipse(x: number, y: number, radiusX: number, radiusY: number, rotation: number, startAngle: number, endAngle: number, anticlockwise?: boolean): void; + lineTo(x: number, y: number): void; + moveTo(x: number, y: number): void; + quadraticCurveTo(cpx: number, cpy: number, x: number, y: number): void; + rect(x: number, y: number, w: number, h: number): void; +} + interface ChildNode { remove(): void; } @@ -16425,6 +17436,7 @@ interface DocumentEvent { createEvent(eventInterface:"CommandEvent"): CommandEvent; createEvent(eventInterface:"CompositionEvent"): CompositionEvent; createEvent(eventInterface:"CustomEvent"): CustomEvent; + createEvent(eventInterface:"DeviceLightEvent"): DeviceLightEvent; createEvent(eventInterface:"DeviceMotionEvent"): DeviceMotionEvent; createEvent(eventInterface:"DeviceOrientationEvent"): DeviceOrientationEvent; createEvent(eventInterface:"DragEvent"): DragEvent; @@ -16436,6 +17448,7 @@ interface DocumentEvent { createEvent(eventInterface:"HashChangeEvent"): HashChangeEvent; createEvent(eventInterface:"IDBVersionChangeEvent"): IDBVersionChangeEvent; createEvent(eventInterface:"KeyboardEvent"): KeyboardEvent; + createEvent(eventInterface:"ListeningStateChangedEvent"): ListeningStateChangedEvent; createEvent(eventInterface:"LongRunningScriptDetectedEvent"): LongRunningScriptDetectedEvent; createEvent(eventInterface:"MSGestureEvent"): MSGestureEvent; createEvent(eventInterface:"MSManipulationEvent"): MSManipulationEvent; @@ -16443,21 +17456,31 @@ interface DocumentEvent { createEvent(eventInterface:"MSMediaKeyNeededEvent"): MSMediaKeyNeededEvent; createEvent(eventInterface:"MSPointerEvent"): MSPointerEvent; createEvent(eventInterface:"MSSiteModeEvent"): MSSiteModeEvent; + createEvent(eventInterface:"MediaEncryptedEvent"): MediaEncryptedEvent; + createEvent(eventInterface:"MediaKeyMessageEvent"): MediaKeyMessageEvent; + createEvent(eventInterface:"MediaStreamErrorEvent"): MediaStreamErrorEvent; + createEvent(eventInterface:"MediaStreamTrackEvent"): MediaStreamTrackEvent; createEvent(eventInterface:"MessageEvent"): MessageEvent; createEvent(eventInterface:"MouseEvent"): MouseEvent; createEvent(eventInterface:"MouseEvents"): MouseEvent; - createEvent(eventInterface:"MouseWheelEvent"): MouseWheelEvent; createEvent(eventInterface:"MutationEvent"): MutationEvent; createEvent(eventInterface:"MutationEvents"): MutationEvent; createEvent(eventInterface:"NavigationCompletedEvent"): NavigationCompletedEvent; createEvent(eventInterface:"NavigationEvent"): NavigationEvent; createEvent(eventInterface:"NavigationEventWithReferrer"): NavigationEventWithReferrer; createEvent(eventInterface:"OfflineAudioCompletionEvent"): OfflineAudioCompletionEvent; + createEvent(eventInterface:"OverflowEvent"): OverflowEvent; createEvent(eventInterface:"PageTransitionEvent"): PageTransitionEvent; createEvent(eventInterface:"PermissionRequestedEvent"): PermissionRequestedEvent; createEvent(eventInterface:"PointerEvent"): PointerEvent; createEvent(eventInterface:"PopStateEvent"): PopStateEvent; createEvent(eventInterface:"ProgressEvent"): ProgressEvent; + createEvent(eventInterface:"RTCDTMFToneChangeEvent"): RTCDTMFToneChangeEvent; + createEvent(eventInterface:"RTCDtlsTransportStateChangedEvent"): RTCDtlsTransportStateChangedEvent; + createEvent(eventInterface:"RTCIceCandidatePairChangedEvent"): RTCIceCandidatePairChangedEvent; + createEvent(eventInterface:"RTCIceGathererEvent"): RTCIceGathererEvent; + createEvent(eventInterface:"RTCIceTransportStateChangedEvent"): RTCIceTransportStateChangedEvent; + createEvent(eventInterface:"RTCSsrcConflictEvent"): RTCSsrcConflictEvent; createEvent(eventInterface:"SVGZoomEvent"): SVGZoomEvent; createEvent(eventInterface:"SVGZoomEvents"): SVGZoomEvent; createEvent(eventInterface:"ScriptNotifyEvent"): ScriptNotifyEvent; @@ -16475,11 +17498,11 @@ interface DocumentEvent { } interface ElementTraversal { - childElementCount: number; - firstElementChild: Element; - lastElementChild: Element; - nextElementSibling: Element; - previousElementSibling: Element; + readonly childElementCount: number; + readonly firstElementChild: Element; + readonly lastElementChild: Element; + readonly nextElementSibling: Element; + readonly previousElementSibling: Element; } interface GetSVGDocument { @@ -16524,12 +17547,11 @@ interface HTMLTableAlignment { } interface IDBEnvironment { - indexedDB: IDBFactory; - msIndexedDB: IDBFactory; + readonly indexedDB: IDBFactory; } interface LinkStyle { - sheet: StyleSheet; + readonly sheet: StyleSheet; } interface MSBaseReader { @@ -16539,12 +17561,12 @@ interface MSBaseReader { onloadend: (ev: ProgressEvent) => any; onloadstart: (ev: Event) => any; onprogress: (ev: ProgressEvent) => any; - readyState: number; - result: any; + readonly readyState: number; + readonly result: any; abort(): void; - DONE: number; - EMPTY: number; - LOADING: number; + readonly DONE: number; + readonly EMPTY: number; + readonly LOADING: number; addEventListener(type: "abort", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: "load", listener: (ev: Event) => any, useCapture?: boolean): void; @@ -16572,27 +17594,32 @@ interface NavigatorContentUtils { } interface NavigatorGeolocation { - geolocation: Geolocation; + readonly geolocation: Geolocation; } interface NavigatorID { - appName: string; - appVersion: string; - platform: string; - product: string; - productSub: string; - userAgent: string; - vendor: string; - vendorSub: string; + readonly appName: string; + readonly appVersion: string; + readonly platform: string; + readonly product: string; + readonly productSub: string; + readonly userAgent: string; + readonly vendor: string; + readonly vendorSub: string; } interface NavigatorOnLine { - onLine: boolean; + readonly onLine: boolean; } interface NavigatorStorageUtils { } +interface NavigatorUserMedia { + readonly mediaDevices: MediaDevices; + getUserMedia(constraints: MediaStreamConstraints, successCallback: NavigatorUserMediaSuccessCallback, errorCallback: NavigatorUserMediaErrorCallback): void; +} + interface NodeSelector { querySelector(selectors: string): Element; querySelectorAll(selectors: string): NodeListOf; @@ -16603,29 +17630,29 @@ interface RandomSource { } interface SVGAnimatedPathData { - pathSegList: SVGPathSegList; + readonly pathSegList: SVGPathSegList; } interface SVGAnimatedPoints { - animatedPoints: SVGPointList; - points: SVGPointList; + readonly animatedPoints: SVGPointList; + readonly points: SVGPointList; } interface SVGExternalResourcesRequired { - externalResourcesRequired: SVGAnimatedBoolean; + readonly externalResourcesRequired: SVGAnimatedBoolean; } interface SVGFilterPrimitiveStandardAttributes extends SVGStylable { - height: SVGAnimatedLength; - result: SVGAnimatedString; - width: SVGAnimatedLength; - x: SVGAnimatedLength; - y: SVGAnimatedLength; + readonly height: SVGAnimatedLength; + readonly result: SVGAnimatedString; + readonly width: SVGAnimatedLength; + readonly x: SVGAnimatedLength; + readonly y: SVGAnimatedLength; } interface SVGFitToViewBox { - preserveAspectRatio: SVGAnimatedPreserveAspectRatio; - viewBox: SVGAnimatedRect; + readonly preserveAspectRatio: SVGAnimatedPreserveAspectRatio; + readonly viewBox: SVGAnimatedRect; } interface SVGLangSpace { @@ -16634,8 +17661,8 @@ interface SVGLangSpace { } interface SVGLocatable { - farthestViewportElement: SVGElement; - nearestViewportElement: SVGElement; + readonly farthestViewportElement: SVGElement; + readonly nearestViewportElement: SVGElement; getBBox(): SVGRect; getCTM(): SVGMatrix; getScreenCTM(): SVGMatrix; @@ -16644,22 +17671,22 @@ interface SVGLocatable { interface SVGStylable { className: any; - style: CSSStyleDeclaration; + readonly style: CSSStyleDeclaration; } interface SVGTests { - requiredExtensions: SVGStringList; - requiredFeatures: SVGStringList; - systemLanguage: SVGStringList; + readonly requiredExtensions: SVGStringList; + readonly requiredFeatures: SVGStringList; + readonly systemLanguage: SVGStringList; hasExtension(extension: string): boolean; } interface SVGTransformable extends SVGLocatable { - transform: SVGAnimatedTransformList; + readonly transform: SVGAnimatedTransformList; } interface SVGURIReference { - href: SVGAnimatedString; + readonly href: SVGAnimatedString; } interface WindowBase64 { @@ -16668,15 +17695,15 @@ interface WindowBase64 { } interface WindowConsole { - console: Console; + readonly console: Console; } interface WindowLocalStorage { - localStorage: Storage; + readonly localStorage: Storage; } interface WindowSessionStorage { - sessionStorage: Storage; + readonly sessionStorage: Storage; } interface WindowTimers extends Object, WindowTimersExtension { @@ -16688,8 +17715,6 @@ interface WindowTimers extends Object, WindowTimersExtension { interface WindowTimersExtension { clearImmediate(handle: number): void; - msClearImmediate(handle: number): void; - msSetImmediate(expression: any, ...args: any[]): number; setImmediate(expression: any, ...args: any[]): number; } @@ -16719,22 +17744,18 @@ interface StorageEventInit extends EventInit { storageArea?: Storage; } -interface IDBObjectStoreParameters { - keyPath?: string | string[]; - autoIncrement?: boolean; -} - -interface IDBIndexParameters { - unique?: boolean; - multiEntry?: boolean; -} - interface NodeListOf extends NodeList { length: number; item(index: number): TNode; [index: number]: TNode; } +interface HTMLCollectionOf extends HTMLCollection { + item(index: number): T; + namedItem(name: string): T; + [index: number]: T; +} + interface BlobPropertyBag { type?: string; endings?: string; @@ -16764,15 +17785,6 @@ interface ProgressEventInit extends EventInit { total?: number; } -interface HTMLTemplateElement extends HTMLElement { - content: DocumentFragment; -} - -declare var HTMLTemplateElement: { - prototype: HTMLTemplateElement; - new(): HTMLTemplateElement; -} - interface HTMLPictureElement extends HTMLElement { } @@ -16781,6 +17793,14 @@ declare var HTMLPictureElement: { new(): HTMLPictureElement; } +interface ClipboardEventInit extends EventInit { + data?: string; + dataType?: string; +} + +interface IDBArrayKey extends Array { +} + declare type EventListenerOrEventListenerObject = EventListener | EventListenerObject; interface ErrorEventHandler { @@ -16819,10 +17839,18 @@ interface DecodeErrorCallback { interface FunctionStringCallback { (data: string): void; } +interface NavigatorUserMediaSuccessCallback { + (stream: MediaStream): void; +} +interface NavigatorUserMediaErrorCallback { + (error: MediaStreamError): void; +} +interface ForEachCallback { + (keyId: any, status: string): void; +} declare var Audio: {new(src?: string): HTMLAudioElement; }; declare var Image: {new(width?: number, height?: number): HTMLImageElement; }; declare var Option: {new(text?: string, value?: string, defaultSelected?: boolean, selected?: boolean): HTMLOptionElement; }; -declare var animationStartTime: number; declare var applicationCache: ApplicationCache; declare var clientInformation: Navigator; declare var closed: boolean; @@ -16842,7 +17870,7 @@ declare var length: number; declare var location: Location; declare var locationbar: BarProp; declare var menubar: BarProp; -declare var msAnimationStartTime: number; +declare var msCredentials: MSCredentials; declare var name: string; declare var navigator: Navigator; declare var offscreenBuffering: string | boolean; @@ -16858,6 +17886,7 @@ declare var onclick: (ev: MouseEvent) => any; declare var oncompassneedscalibration: (ev: Event) => any; declare var oncontextmenu: (ev: PointerEvent) => any; declare var ondblclick: (ev: MouseEvent) => any; +declare var ondevicelight: (ev: DeviceLightEvent) => any; declare var ondevicemotion: (ev: DeviceMotionEvent) => any; declare var ondeviceorientation: (ev: DeviceOrientationEvent) => any; declare var ondrag: (ev: DragEvent) => any; @@ -16869,11 +17898,12 @@ declare var ondragstart: (ev: DragEvent) => any; declare var ondrop: (ev: DragEvent) => any; declare var ondurationchange: (ev: Event) => any; declare var onemptied: (ev: Event) => any; -declare var onended: (ev: Event) => any; +declare var onended: (ev: MediaStreamErrorEvent) => any; declare var onerror: ErrorEventHandler; declare var onfocus: (ev: FocusEvent) => any; declare var onhashchange: (ev: HashChangeEvent) => any; declare var oninput: (ev: Event) => any; +declare var oninvalid: (ev: Event) => any; declare var onkeydown: (ev: KeyboardEvent) => any; declare var onkeypress: (ev: KeyboardEvent) => any; declare var onkeyup: (ev: KeyboardEvent) => any; @@ -16889,7 +17919,7 @@ declare var onmousemove: (ev: MouseEvent) => any; declare var onmouseout: (ev: MouseEvent) => any; declare var onmouseover: (ev: MouseEvent) => any; declare var onmouseup: (ev: MouseEvent) => any; -declare var onmousewheel: (ev: MouseWheelEvent) => any; +declare var onmousewheel: (ev: WheelEvent) => any; declare var onmsgesturechange: (ev: MSGestureEvent) => any; declare var onmsgesturedoubletap: (ev: MSGestureEvent) => any; declare var onmsgestureend: (ev: MSGestureEvent) => any; @@ -16928,10 +17958,10 @@ declare var onstorage: (ev: StorageEvent) => any; declare var onsubmit: (ev: Event) => any; declare var onsuspend: (ev: Event) => any; declare var ontimeupdate: (ev: Event) => any; -declare var ontouchcancel: any; -declare var ontouchend: any; -declare var ontouchmove: any; -declare var ontouchstart: any; +declare var ontouchcancel: (ev: TouchEvent) => any; +declare var ontouchend: (ev: TouchEvent) => any; +declare var ontouchmove: (ev: TouchEvent) => any; +declare var ontouchstart: (ev: TouchEvent) => any; declare var onunload: (ev: Event) => any; declare var onvolumechange: (ev: Event) => any; declare var onwaiting: (ev: Event) => any; @@ -16959,7 +17989,6 @@ declare var styleMedia: StyleMedia; declare var toolbar: BarProp; declare var top: Window; declare var window: Window; -declare var URL: URL; declare function alert(message?: any): void; declare function blur(): void; declare function cancelAnimationFrame(handle: number): void; @@ -16973,12 +18002,9 @@ declare function getSelection(): Selection; declare function matchMedia(mediaQuery: string): MediaQueryList; declare function moveBy(x?: number, y?: number): void; declare function moveTo(x?: number, y?: number): void; -declare function msCancelRequestAnimationFrame(handle: number): void; -declare function msMatchMedia(mediaQuery: string): MediaQueryList; -declare function msRequestAnimationFrame(callback: FrameRequestCallback): number; declare function msWriteProfilerMark(profilerMarkName: string): void; declare function open(url?: string, target?: string, features?: string, replace?: boolean): Window; -declare function postMessage(message: any, targetOrigin: string, ports?: any): void; +declare function postMessage(message: any, targetOrigin: string, transfer?: any[]): void; declare function print(): void; declare function prompt(message?: string, _default?: string): string; declare function releaseEvents(): void; @@ -16988,19 +18014,19 @@ declare function resizeTo(x?: number, y?: number): void; declare function scroll(x?: number, y?: number): void; declare function scrollBy(x?: number, y?: number): void; declare function scrollTo(x?: number, y?: number): void; +declare function webkitCancelAnimationFrame(handle: number): void; declare function webkitConvertPointFromNodeToPage(node: Node, pt: WebKitPoint): WebKitPoint; declare function webkitConvertPointFromPageToNode(node: Node, pt: WebKitPoint): WebKitPoint; +declare function webkitRequestAnimationFrame(callback: FrameRequestCallback): number; declare function toString(): string; -declare function addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +declare function addEventListener(type: string, listener?: EventListenerOrEventListenerObject, useCapture?: boolean): void; declare function dispatchEvent(evt: Event): boolean; -declare function removeEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +declare function removeEventListener(type: string, listener?: EventListenerOrEventListenerObject, useCapture?: boolean): void; declare function clearInterval(handle: number): void; declare function clearTimeout(handle: number): void; declare function setInterval(handler: any, timeout?: any, ...args: any[]): number; declare function setTimeout(handler: any, timeout?: any, ...args: any[]): number; declare function clearImmediate(handle: number): void; -declare function msClearImmediate(handle: number): void; -declare function msSetImmediate(expression: any, ...args: any[]): number; declare function setImmediate(expression: any, ...args: any[]): number; declare var sessionStorage: Storage; declare var localStorage: Storage; @@ -17015,7 +18041,6 @@ declare var onpointerover: (ev: PointerEvent) => any; declare var onpointerup: (ev: PointerEvent) => any; declare var onwheel: (ev: WheelEvent) => any; declare var indexedDB: IDBFactory; -declare var msIndexedDB: IDBFactory; declare function atob(encodedString: string): string; declare function btoa(rawString: string): string; declare function addEventListener(type: "MSGestureChange", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void; @@ -17045,6 +18070,7 @@ declare function addEventListener(type: "click", listener: (ev: MouseEvent) => a declare function addEventListener(type: "compassneedscalibration", listener: (ev: Event) => any, useCapture?: boolean): void; declare function addEventListener(type: "contextmenu", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; declare function addEventListener(type: "dblclick", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "devicelight", listener: (ev: DeviceLightEvent) => any, useCapture?: boolean): void; declare function addEventListener(type: "devicemotion", listener: (ev: DeviceMotionEvent) => any, useCapture?: boolean): void; declare function addEventListener(type: "deviceorientation", listener: (ev: DeviceOrientationEvent) => any, useCapture?: boolean): void; declare function addEventListener(type: "drag", listener: (ev: DragEvent) => any, useCapture?: boolean): void; @@ -17056,10 +18082,11 @@ declare function addEventListener(type: "dragstart", listener: (ev: DragEvent) = declare function addEventListener(type: "drop", listener: (ev: DragEvent) => any, useCapture?: boolean): void; declare function addEventListener(type: "durationchange", listener: (ev: Event) => any, useCapture?: boolean): void; declare function addEventListener(type: "emptied", listener: (ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "ended", listener: (ev: Event) => any, useCapture?: boolean): void; +declare function addEventListener(type: "ended", listener: (ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; declare function addEventListener(type: "focus", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; declare function addEventListener(type: "hashchange", listener: (ev: HashChangeEvent) => any, useCapture?: boolean): void; declare function addEventListener(type: "input", listener: (ev: Event) => any, useCapture?: boolean): void; +declare function addEventListener(type: "invalid", listener: (ev: Event) => any, useCapture?: boolean): void; declare function addEventListener(type: "keydown", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; declare function addEventListener(type: "keypress", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; declare function addEventListener(type: "keyup", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; @@ -17075,7 +18102,7 @@ declare function addEventListener(type: "mousemove", listener: (ev: MouseEvent) declare function addEventListener(type: "mouseout", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; declare function addEventListener(type: "mouseover", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; declare function addEventListener(type: "mouseup", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "mousewheel", listener: (ev: MouseWheelEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "mousewheel", listener: (ev: WheelEvent) => any, useCapture?: boolean): void; declare function addEventListener(type: "offline", listener: (ev: Event) => any, useCapture?: boolean): void; declare function addEventListener(type: "online", listener: (ev: Event) => any, useCapture?: boolean): void; declare function addEventListener(type: "orientationchange", listener: (ev: Event) => any, useCapture?: boolean): void; @@ -17112,6 +18139,38 @@ declare function addEventListener(type: "volumechange", listener: (ev: Event) => declare function addEventListener(type: "waiting", listener: (ev: Event) => any, useCapture?: boolean): void; declare function addEventListener(type: "wheel", listener: (ev: WheelEvent) => any, useCapture?: boolean): void; declare function addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +type AAGUID = string; +type AlgorithmIdentifier = string | Algorithm; +type ConstrainBoolean = boolean | ConstrainBooleanParameters; +type ConstrainDOMString = string | string[] | ConstrainDOMStringParameters; +type ConstrainDouble = number | ConstrainDoubleRange; +type ConstrainLong = number | ConstrainLongRange; +type CryptoOperationData = ArrayBufferView; +type GLbitfield = number; +type GLboolean = boolean; +type GLbyte = number; +type GLclampf = number; +type GLenum = number; +type GLfloat = number; +type GLint = number; +type GLintptr = number; +type GLshort = number; +type GLsizei = number; +type GLsizeiptr = number; +type GLubyte = number; +type GLuint = number; +type GLushort = number; +type IDBKeyPath = string; +type KeyFormat = string; +type KeyType = string; +type KeyUsage = string; +type MSInboundPayload = MSVideoRecvPayload | MSAudioRecvPayload; +type MSLocalClientEvent = MSLocalClientEventBase | MSAudioLocalClientEvent; +type MSOutboundPayload = MSVideoSendPayload | MSAudioSendPayload; +type RTCIceGatherCandidate = RTCIceCandidate | RTCIceCandidateComplete; +type RTCTransport = RTCDtlsTransport | RTCSrtpSdesTransport; +type payloadtype = number; +type IDBValidKey = number | string | Date | IDBArrayKey; ///////////////////////////// /// WorkerGlobalScope APIs ///////////////////////////// diff --git a/lib/lib.dom.d.ts b/lib/lib.dom.d.ts index 7bb2e8d4158..27a38590913 100644 --- a/lib/lib.dom.d.ts +++ b/lib/lib.dom.d.ts @@ -13,209 +13,7 @@ See the Apache Version 2.0 License for specific language governing permissions and limitations under the License. ***************************************************************************** */ -/// -///////////////////////////// -/// ECMAScript Internationalization API -///////////////////////////// - -declare module Intl { - interface CollatorOptions { - usage?: string; - localeMatcher?: string; - numeric?: boolean; - caseFirst?: string; - sensitivity?: string; - ignorePunctuation?: boolean; - } - - interface ResolvedCollatorOptions { - locale: string; - usage: string; - sensitivity: string; - ignorePunctuation: boolean; - collation: string; - caseFirst: string; - numeric: boolean; - } - - interface Collator { - compare(x: string, y: string): number; - resolvedOptions(): ResolvedCollatorOptions; - } - var Collator: { - new (locales?: string[], options?: CollatorOptions): Collator; - new (locale?: string, options?: CollatorOptions): Collator; - (locales?: string[], options?: CollatorOptions): Collator; - (locale?: string, options?: CollatorOptions): Collator; - supportedLocalesOf(locales: string[], options?: CollatorOptions): string[]; - supportedLocalesOf(locale: string, options?: CollatorOptions): string[]; - } - - interface NumberFormatOptions { - localeMatcher?: string; - style?: string; - currency?: string; - currencyDisplay?: string; - useGrouping?: boolean; - minimumIntegerDigits?: number; - minimumFractionDigits?: number; - maximumFractionDigits?: number; - minimumSignificantDigits?: number; - maximumSignificantDigits?: number; - } - - interface ResolvedNumberFormatOptions { - locale: string; - numberingSystem: string; - style: string; - currency?: string; - currencyDisplay?: string; - minimumIntegerDigits: number; - minimumFractionDigits: number; - maximumFractionDigits: number; - minimumSignificantDigits?: number; - maximumSignificantDigits?: number; - useGrouping: boolean; - } - - interface NumberFormat { - format(value: number): string; - resolvedOptions(): ResolvedNumberFormatOptions; - } - var NumberFormat: { - new (locales?: string[], options?: NumberFormatOptions): NumberFormat; - new (locale?: string, options?: NumberFormatOptions): NumberFormat; - (locales?: string[], options?: NumberFormatOptions): NumberFormat; - (locale?: string, options?: NumberFormatOptions): NumberFormat; - supportedLocalesOf(locales: string[], options?: NumberFormatOptions): string[]; - supportedLocalesOf(locale: string, options?: NumberFormatOptions): string[]; - } - - interface DateTimeFormatOptions { - localeMatcher?: string; - weekday?: string; - era?: string; - year?: string; - month?: string; - day?: string; - hour?: string; - minute?: string; - second?: string; - timeZoneName?: string; - formatMatcher?: string; - hour12?: boolean; - timeZone?: string; - } - - interface ResolvedDateTimeFormatOptions { - locale: string; - calendar: string; - numberingSystem: string; - timeZone: string; - hour12?: boolean; - weekday?: string; - era?: string; - year?: string; - month?: string; - day?: string; - hour?: string; - minute?: string; - second?: string; - timeZoneName?: string; - } - - interface DateTimeFormat { - format(date?: Date | number): string; - resolvedOptions(): ResolvedDateTimeFormatOptions; - } - var DateTimeFormat: { - new (locales?: string[], options?: DateTimeFormatOptions): DateTimeFormat; - new (locale?: string, options?: DateTimeFormatOptions): DateTimeFormat; - (locales?: string[], options?: DateTimeFormatOptions): DateTimeFormat; - (locale?: string, options?: DateTimeFormatOptions): DateTimeFormat; - supportedLocalesOf(locales: string[], options?: DateTimeFormatOptions): string[]; - supportedLocalesOf(locale: string, options?: DateTimeFormatOptions): string[]; - } -} - -interface String { - /** - * Determines whether two strings are equivalent in the current locale. - * @param that String to compare to target string - * @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. - * @param options An object that contains one or more properties that specify comparison options. see the Intl.Collator object for details. - */ - localeCompare(that: string, locales: string[], options?: Intl.CollatorOptions): number; - - /** - * Determines whether two strings are equivalent in the current locale. - * @param that String to compare to target string - * @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. - * @param options An object that contains one or more properties that specify comparison options. see the Intl.Collator object for details. - */ - localeCompare(that: string, locale: string, options?: Intl.CollatorOptions): number; -} - -interface Number { - /** - * Converts a number to a string by using the current or specified locale. - * @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. - * @param options An object that contains one or more properties that specify comparison options. - */ - toLocaleString(locales?: string[], options?: Intl.NumberFormatOptions): string; - - /** - * Converts a number to a string by using the current or specified locale. - * @param locale Locale tag. If you omit this parameter, the default locale of the JavaScript runtime is used. - * @param options An object that contains one or more properties that specify comparison options. - */ - toLocaleString(locale?: string, options?: Intl.NumberFormatOptions): string; -} - -interface Date { - /** - * Converts a date and time to a string by using the current or specified locale. - * @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. - * @param options An object that contains one or more properties that specify comparison options. - */ - toLocaleString(locales?: string[], options?: Intl.DateTimeFormatOptions): string; - /** - * Converts a date to a string by using the current or specified locale. - * @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. - * @param options An object that contains one or more properties that specify comparison options. - */ - toLocaleDateString(locales?: string[], options?: Intl.DateTimeFormatOptions): string; - - /** - * Converts a time to a string by using the current or specified locale. - * @param locale Locale tag. If you omit this parameter, the default locale of the JavaScript runtime is used. - * @param options An object that contains one or more properties that specify comparison options. - */ - toLocaleTimeString(locale?: string[], options?: Intl.DateTimeFormatOptions): string; - - /** - * Converts a date and time to a string by using the current or specified locale. - * @param locale Locale tag. If you omit this parameter, the default locale of the JavaScript runtime is used. - * @param options An object that contains one or more properties that specify comparison options. - */ - toLocaleString(locale?: string, options?: Intl.DateTimeFormatOptions): string; - - /** - * Converts a date to a string by using the current or specified locale. - * @param locale Locale tag. If you omit this parameter, the default locale of the JavaScript runtime is used. - * @param options An object that contains one or more properties that specify comparison options. - */ - toLocaleDateString(locale?: string, options?: Intl.DateTimeFormatOptions): string; - - /** - * Converts a time to a string by using the current or specified locale. - * @param locale Locale tag. If you omit this parameter, the default locale of the JavaScript runtime is used. - * @param options An object that contains one or more properties that specify comparison options. - */ - toLocaleTimeString(locale?: string, options?: Intl.DateTimeFormatOptions): string; -} - - +/// ///////////////////////////// /// IE DOM APIs ///////////////////////////// @@ -229,11 +27,6 @@ interface AriaRequestEventInit extends EventInit { attributeValue?: string; } -interface ClipboardEventInit extends EventInit { - data?: string; - dataType?: string; -} - interface CommandEventInit extends EventInit { commandName?: string; detail?: string; @@ -247,6 +40,31 @@ interface ConfirmSiteSpecificExceptionsInformation extends ExceptionInformation arrayOfDomainStrings?: string[]; } +interface ConstrainBooleanParameters { + exact?: boolean; + ideal?: boolean; +} + +interface ConstrainDOMStringParameters { + exact?: string | string[]; + ideal?: string | string[]; +} + +interface ConstrainDoubleRange extends DoubleRange { + exact?: number; + ideal?: number; +} + +interface ConstrainLongRange extends LongRange { + exact?: number; + ideal?: number; +} + +interface ConstrainVideoFacingModeParameters { + exact?: string | string[]; + ideal?: string | string[]; +} + interface CustomEventInit extends EventInit { detail?: any; } @@ -257,17 +75,44 @@ interface DeviceAccelerationDict { z?: number; } +interface DeviceLightEventInit extends EventInit { + value?: number; +} + interface DeviceRotationRateDict { alpha?: number; beta?: number; gamma?: number; } +interface DoubleRange { + max?: number; + min?: number; +} + interface EventInit { bubbles?: boolean; cancelable?: boolean; } +interface EventModifierInit extends UIEventInit { + ctrlKey?: boolean; + shiftKey?: boolean; + altKey?: boolean; + metaKey?: boolean; + modifierAltGraph?: boolean; + modifierCapsLock?: boolean; + modifierFn?: boolean; + modifierFnLock?: boolean; + modifierHyper?: boolean; + modifierNumLock?: boolean; + modifierOS?: boolean; + modifierScrollLock?: boolean; + modifierSuper?: boolean; + modifierSymbol?: boolean; + modifierSymbolLock?: boolean; +} + interface ExceptionInformation { domain?: string; } @@ -281,17 +126,415 @@ interface HashChangeEventInit extends EventInit { oldURL?: string; } +interface IDBIndexParameters { + multiEntry?: boolean; + unique?: boolean; +} + +interface IDBObjectStoreParameters { + autoIncrement?: boolean; + keyPath?: IDBKeyPath; +} + interface KeyAlgorithm { name?: string; } -interface KeyboardEventInit extends SharedKeyboardAndMouseEventInit { +interface KeyboardEventInit extends EventModifierInit { key?: string; location?: number; repeat?: boolean; } -interface MouseEventInit extends SharedKeyboardAndMouseEventInit { +interface LongRange { + max?: number; + min?: number; +} + +interface MSAccountInfo { + rpDisplayName?: string; + userDisplayName?: string; + accountName?: string; + userId?: string; + accountImageUri?: string; +} + +interface MSAudioLocalClientEvent extends MSLocalClientEventBase { + networkSendQualityEventRatio?: number; + networkDelayEventRatio?: number; + cpuInsufficientEventRatio?: number; + deviceHalfDuplexAECEventRatio?: number; + deviceRenderNotFunctioningEventRatio?: number; + deviceCaptureNotFunctioningEventRatio?: number; + deviceGlitchesEventRatio?: number; + deviceLowSNREventRatio?: number; + deviceLowSpeechLevelEventRatio?: number; + deviceClippingEventRatio?: number; + deviceEchoEventRatio?: number; + deviceNearEndToEchoRatioEventRatio?: number; + deviceRenderZeroVolumeEventRatio?: number; + deviceRenderMuteEventRatio?: number; + deviceMultipleEndpointsEventCount?: number; + deviceHowlingEventCount?: number; +} + +interface MSAudioRecvPayload extends MSPayloadBase { + samplingRate?: number; + signal?: MSAudioRecvSignal; + packetReorderRatio?: number; + packetReorderDepthAvg?: number; + packetReorderDepthMax?: number; + burstLossLength1?: number; + burstLossLength2?: number; + burstLossLength3?: number; + burstLossLength4?: number; + burstLossLength5?: number; + burstLossLength6?: number; + burstLossLength7?: number; + burstLossLength8OrHigher?: number; + fecRecvDistance1?: number; + fecRecvDistance2?: number; + fecRecvDistance3?: number; + ratioConcealedSamplesAvg?: number; + ratioStretchedSamplesAvg?: number; + ratioCompressedSamplesAvg?: number; +} + +interface MSAudioRecvSignal { + initialSignalLevelRMS?: number; + recvSignalLevelCh1?: number; + recvNoiseLevelCh1?: number; + renderSignalLevel?: number; + renderNoiseLevel?: number; + renderLoopbackSignalLevel?: number; +} + +interface MSAudioSendPayload extends MSPayloadBase { + samplingRate?: number; + signal?: MSAudioSendSignal; + audioFECUsed?: boolean; + sendMutePercent?: number; +} + +interface MSAudioSendSignal { + noiseLevel?: number; + sendSignalLevelCh1?: number; + sendNoiseLevelCh1?: number; +} + +interface MSConnectivity { + iceType?: string; + iceWarningFlags?: MSIceWarningFlags; + relayAddress?: MSRelayAddress; +} + +interface MSCredentialFilter { + accept?: MSCredentialSpec[]; +} + +interface MSCredentialParameters { + type?: string; +} + +interface MSCredentialSpec { + type?: string; + id?: string; +} + +interface MSDelay { + roundTrip?: number; + roundTripMax?: number; +} + +interface MSDescription extends RTCStats { + connectivity?: MSConnectivity; + transport?: string; + networkconnectivity?: MSNetworkConnectivityInfo; + localAddr?: MSIPAddressInfo; + remoteAddr?: MSIPAddressInfo; + deviceDevName?: string; + reflexiveLocalIPAddr?: MSIPAddressInfo; +} + +interface MSFIDOCredentialParameters extends MSCredentialParameters { + algorithm?: string | Algorithm; + authenticators?: AAGUID[]; +} + +interface MSIPAddressInfo { + ipAddr?: string; + port?: number; + manufacturerMacAddrMask?: string; +} + +interface MSIceWarningFlags { + turnTcpTimedOut?: boolean; + turnUdpAllocateFailed?: boolean; + turnUdpSendFailed?: boolean; + turnTcpAllocateFailed?: boolean; + turnTcpSendFailed?: boolean; + udpLocalConnectivityFailed?: boolean; + udpNatConnectivityFailed?: boolean; + udpRelayConnectivityFailed?: boolean; + tcpNatConnectivityFailed?: boolean; + tcpRelayConnectivityFailed?: boolean; + connCheckMessageIntegrityFailed?: boolean; + allocationMessageIntegrityFailed?: boolean; + connCheckOtherError?: boolean; + turnAuthUnknownUsernameError?: boolean; + noRelayServersConfigured?: boolean; + multipleRelayServersAttempted?: boolean; + portRangeExhausted?: boolean; + alternateServerReceived?: boolean; + pseudoTLSFailure?: boolean; + turnTurnTcpConnectivityFailed?: boolean; + useCandidateChecksFailed?: boolean; + fipsAllocationFailure?: boolean; +} + +interface MSJitter { + interArrival?: number; + interArrivalMax?: number; + interArrivalSD?: number; +} + +interface MSLocalClientEventBase extends RTCStats { + networkReceiveQualityEventRatio?: number; + networkBandwidthLowEventRatio?: number; +} + +interface MSNetwork extends RTCStats { + jitter?: MSJitter; + delay?: MSDelay; + packetLoss?: MSPacketLoss; + utilization?: MSUtilization; +} + +interface MSNetworkConnectivityInfo { + vpn?: boolean; + linkspeed?: number; + networkConnectionDetails?: string; +} + +interface MSNetworkInterfaceType { + interfaceTypeEthernet?: boolean; + interfaceTypeWireless?: boolean; + interfaceTypePPP?: boolean; + interfaceTypeTunnel?: boolean; + interfaceTypeWWAN?: boolean; +} + +interface MSOutboundNetwork extends MSNetwork { + appliedBandwidthLimit?: number; +} + +interface MSPacketLoss { + lossRate?: number; + lossRateMax?: number; +} + +interface MSPayloadBase extends RTCStats { + payloadDescription?: string; +} + +interface MSRelayAddress { + relayAddress?: string; + port?: number; +} + +interface MSSignatureParameters { + userPrompt?: string; +} + +interface MSTransportDiagnosticsStats extends RTCStats { + baseAddress?: string; + localAddress?: string; + localSite?: string; + networkName?: string; + remoteAddress?: string; + remoteSite?: string; + localMR?: string; + remoteMR?: string; + iceWarningFlags?: MSIceWarningFlags; + portRangeMin?: number; + portRangeMax?: number; + localMRTCPPort?: number; + remoteMRTCPPort?: number; + stunVer?: number; + numConsentReqSent?: number; + numConsentReqReceived?: number; + numConsentRespSent?: number; + numConsentRespReceived?: number; + interfaces?: MSNetworkInterfaceType; + baseInterface?: MSNetworkInterfaceType; + protocol?: string; + localInterface?: MSNetworkInterfaceType; + localAddrType?: string; + remoteAddrType?: string; + iceRole?: string; + rtpRtcpMux?: boolean; + allocationTimeInMs?: number; + msRtcEngineVersion?: string; +} + +interface MSUtilization { + packets?: number; + bandwidthEstimation?: number; + bandwidthEstimationMin?: number; + bandwidthEstimationMax?: number; + bandwidthEstimationStdDev?: number; + bandwidthEstimationAvg?: number; +} + +interface MSVideoPayload extends MSPayloadBase { + resoluton?: string; + videoBitRateAvg?: number; + videoBitRateMax?: number; + videoFrameRateAvg?: number; + videoPacketLossRate?: number; + durationSeconds?: number; +} + +interface MSVideoRecvPayload extends MSVideoPayload { + videoFrameLossRate?: number; + recvCodecType?: string; + recvResolutionWidth?: number; + recvResolutionHeight?: number; + videoResolutions?: MSVideoResolutionDistribution; + recvFrameRateAverage?: number; + recvBitRateMaximum?: number; + recvBitRateAverage?: number; + recvVideoStreamsMax?: number; + recvVideoStreamsMin?: number; + recvVideoStreamsMode?: number; + videoPostFECPLR?: number; + lowBitRateCallPercent?: number; + lowFrameRateCallPercent?: number; + reorderBufferTotalPackets?: number; + recvReorderBufferReorderedPackets?: number; + recvReorderBufferPacketsDroppedDueToBufferExhaustion?: number; + recvReorderBufferMaxSuccessfullyOrderedExtent?: number; + recvReorderBufferMaxSuccessfullyOrderedLateTime?: number; + recvReorderBufferPacketsDroppedDueToTimeout?: number; + recvFpsHarmonicAverage?: number; + recvNumResSwitches?: number; +} + +interface MSVideoResolutionDistribution { + cifQuality?: number; + vgaQuality?: number; + h720Quality?: number; + h1080Quality?: number; + h1440Quality?: number; + h2160Quality?: number; +} + +interface MSVideoSendPayload extends MSVideoPayload { + sendFrameRateAverage?: number; + sendBitRateMaximum?: number; + sendBitRateAverage?: number; + sendVideoStreamsMax?: number; + sendResolutionWidth?: number; + sendResolutionHeight?: number; +} + +interface MediaEncryptedEventInit extends EventInit { + initDataType?: string; + initData?: ArrayBuffer; +} + +interface MediaKeyMessageEventInit extends EventInit { + messageType?: string; + message?: ArrayBuffer; +} + +interface MediaKeySystemConfiguration { + initDataTypes?: string[]; + audioCapabilities?: MediaKeySystemMediaCapability[]; + videoCapabilities?: MediaKeySystemMediaCapability[]; + distinctiveIdentifier?: string; + persistentState?: string; +} + +interface MediaKeySystemMediaCapability { + contentType?: string; + robustness?: string; +} + +interface MediaStreamConstraints { + video?: boolean | MediaTrackConstraints; + audio?: boolean | MediaTrackConstraints; +} + +interface MediaStreamErrorEventInit extends EventInit { + error?: MediaStreamError; +} + +interface MediaStreamTrackEventInit extends EventInit { + track?: MediaStreamTrack; +} + +interface MediaTrackCapabilities { + width?: number | LongRange; + height?: number | LongRange; + aspectRatio?: number | DoubleRange; + frameRate?: number | DoubleRange; + facingMode?: string; + volume?: number | DoubleRange; + sampleRate?: number | LongRange; + sampleSize?: number | LongRange; + echoCancellation?: boolean[]; + deviceId?: string; + groupId?: string; +} + +interface MediaTrackConstraintSet { + width?: number | ConstrainLongRange; + height?: number | ConstrainLongRange; + aspectRatio?: number | ConstrainDoubleRange; + frameRate?: number | ConstrainDoubleRange; + facingMode?: string | string[] | ConstrainDOMStringParameters; + volume?: number | ConstrainDoubleRange; + sampleRate?: number | ConstrainLongRange; + sampleSize?: number | ConstrainLongRange; + echoCancelation?: boolean | ConstrainBooleanParameters; + deviceId?: string | string[] | ConstrainDOMStringParameters; + groupId?: string | string[] | ConstrainDOMStringParameters; +} + +interface MediaTrackConstraints extends MediaTrackConstraintSet { + advanced?: MediaTrackConstraintSet[]; +} + +interface MediaTrackSettings { + width?: number; + height?: number; + aspectRatio?: number; + frameRate?: number; + facingMode?: string; + volume?: number; + sampleRate?: number; + sampleSize?: number; + echoCancellation?: boolean; + deviceId?: string; + groupId?: string; +} + +interface MediaTrackSupportedConstraints { + width?: boolean; + height?: boolean; + aspectRatio?: boolean; + frameRate?: boolean; + facingMode?: boolean; + volume?: boolean; + sampleRate?: boolean; + sampleSize?: boolean; + echoCancellation?: boolean; + deviceId?: boolean; + groupId?: boolean; +} + +interface MouseEventInit extends EventModifierInit { screenX?: number; screenY?: number; clientX?: number; @@ -324,6 +567,10 @@ interface ObjectURLOptions { oneTimeOnly?: boolean; } +interface PeriodicWaveConstraints { + disableNormalization?: boolean; +} + interface PointerEventInit extends MouseEventInit { pointerId?: number; width?: number; @@ -341,22 +588,266 @@ interface PositionOptions { maximumAge?: number; } -interface SharedKeyboardAndMouseEventInit extends UIEventInit { - ctrlKey?: boolean; - shiftKey?: boolean; - altKey?: boolean; - metaKey?: boolean; - keyModifierStateAltGraph?: boolean; - keyModifierStateCapsLock?: boolean; - keyModifierStateFn?: boolean; - keyModifierStateFnLock?: boolean; - keyModifierStateHyper?: boolean; - keyModifierStateNumLock?: boolean; - keyModifierStateOS?: boolean; - keyModifierStateScrollLock?: boolean; - keyModifierStateSuper?: boolean; - keyModifierStateSymbol?: boolean; - keyModifierStateSymbolLock?: boolean; +interface RTCDTMFToneChangeEventInit extends EventInit { + tone?: string; +} + +interface RTCDtlsFingerprint { + algorithm?: string; + value?: string; +} + +interface RTCDtlsParameters { + role?: string; + fingerprints?: RTCDtlsFingerprint[]; +} + +interface RTCIceCandidate { + foundation?: string; + priority?: number; + ip?: string; + protocol?: string; + port?: number; + type?: string; + tcpType?: string; + relatedAddress?: string; + relatedPort?: number; +} + +interface RTCIceCandidateAttributes extends RTCStats { + ipAddress?: string; + portNumber?: number; + transport?: string; + candidateType?: string; + priority?: number; + addressSourceUrl?: string; +} + +interface RTCIceCandidateComplete { +} + +interface RTCIceCandidatePair { + local?: RTCIceCandidate; + remote?: RTCIceCandidate; +} + +interface RTCIceCandidatePairStats extends RTCStats { + transportId?: string; + localCandidateId?: string; + remoteCandidateId?: string; + state?: string; + priority?: number; + nominated?: boolean; + writable?: boolean; + readable?: boolean; + bytesSent?: number; + bytesReceived?: number; + roundTripTime?: number; + availableOutgoingBitrate?: number; + availableIncomingBitrate?: number; +} + +interface RTCIceGatherOptions { + gatherPolicy?: string; + iceservers?: RTCIceServer[]; +} + +interface RTCIceParameters { + usernameFragment?: string; + password?: string; +} + +interface RTCIceServer { + urls?: any; + username?: string; + credential?: string; +} + +interface RTCInboundRTPStreamStats extends RTCRTPStreamStats { + packetsReceived?: number; + bytesReceived?: number; + packetsLost?: number; + jitter?: number; + fractionLost?: number; +} + +interface RTCMediaStreamTrackStats extends RTCStats { + trackIdentifier?: string; + remoteSource?: boolean; + ssrcIds?: string[]; + frameWidth?: number; + frameHeight?: number; + framesPerSecond?: number; + framesSent?: number; + framesReceived?: number; + framesDecoded?: number; + framesDropped?: number; + framesCorrupted?: number; + audioLevel?: number; + echoReturnLoss?: number; + echoReturnLossEnhancement?: number; +} + +interface RTCOutboundRTPStreamStats extends RTCRTPStreamStats { + packetsSent?: number; + bytesSent?: number; + targetBitrate?: number; + roundTripTime?: number; +} + +interface RTCRTPStreamStats extends RTCStats { + ssrc?: string; + associateStatsId?: string; + isRemote?: boolean; + mediaTrackId?: string; + transportId?: string; + codecId?: string; + firCount?: number; + pliCount?: number; + nackCount?: number; + sliCount?: number; +} + +interface RTCRtcpFeedback { + type?: string; + parameter?: string; +} + +interface RTCRtcpParameters { + ssrc?: number; + cname?: string; + reducedSize?: boolean; + mux?: boolean; +} + +interface RTCRtpCapabilities { + codecs?: RTCRtpCodecCapability[]; + headerExtensions?: RTCRtpHeaderExtension[]; + fecMechanisms?: string[]; +} + +interface RTCRtpCodecCapability { + name?: string; + kind?: string; + clockRate?: number; + preferredPayloadType?: number; + maxptime?: number; + numChannels?: number; + rtcpFeedback?: RTCRtcpFeedback[]; + parameters?: any; + options?: any; + maxTemporalLayers?: number; + maxSpatialLayers?: number; + svcMultiStreamSupport?: boolean; +} + +interface RTCRtpCodecParameters { + name?: string; + payloadType?: any; + clockRate?: number; + maxptime?: number; + numChannels?: number; + rtcpFeedback?: RTCRtcpFeedback[]; + parameters?: any; +} + +interface RTCRtpContributingSource { + timestamp?: number; + csrc?: number; + audioLevel?: number; +} + +interface RTCRtpEncodingParameters { + ssrc?: number; + codecPayloadType?: number; + fec?: RTCRtpFecParameters; + rtx?: RTCRtpRtxParameters; + priority?: number; + maxBitrate?: number; + minQuality?: number; + framerateBias?: number; + resolutionScale?: number; + framerateScale?: number; + active?: boolean; + encodingId?: string; + dependencyEncodingIds?: string[]; + ssrcRange?: RTCSsrcRange; +} + +interface RTCRtpFecParameters { + ssrc?: number; + mechanism?: string; +} + +interface RTCRtpHeaderExtension { + kind?: string; + uri?: string; + preferredId?: number; + preferredEncrypt?: boolean; +} + +interface RTCRtpHeaderExtensionParameters { + uri?: string; + id?: number; + encrypt?: boolean; +} + +interface RTCRtpParameters { + muxId?: string; + codecs?: RTCRtpCodecParameters[]; + headerExtensions?: RTCRtpHeaderExtensionParameters[]; + encodings?: RTCRtpEncodingParameters[]; + rtcp?: RTCRtcpParameters; +} + +interface RTCRtpRtxParameters { + ssrc?: number; +} + +interface RTCRtpUnhandled { + ssrc?: number; + payloadType?: number; + muxId?: string; +} + +interface RTCSrtpKeyParam { + keyMethod?: string; + keySalt?: string; + lifetime?: string; + mkiValue?: number; + mkiLength?: number; +} + +interface RTCSrtpSdesParameters { + tag?: number; + cryptoSuite?: string; + keyParams?: RTCSrtpKeyParam[]; + sessionParams?: string[]; +} + +interface RTCSsrcRange { + min?: number; + max?: number; +} + +interface RTCStats { + timestamp?: number; + type?: string; + id?: string; + msType?: string; +} + +interface RTCStatsReport { +} + +interface RTCTransportStats extends RTCStats { + bytesSent?: number; + bytesReceived?: number; + rtcpTransportStatsId?: string; + activeConnection?: boolean; + selectedCandidatePairId?: string; + localCertificateId?: string; + remoteCertificateId?: string; } interface StoreExceptionsInformation extends ExceptionInformation { @@ -402,18 +893,18 @@ interface ANGLE_instanced_arrays { drawArraysInstancedANGLE(mode: number, first: number, count: number, primcount: number): void; drawElementsInstancedANGLE(mode: number, count: number, type: number, offset: number, primcount: number): void; vertexAttribDivisorANGLE(index: number, divisor: number): void; - VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE: number; + readonly VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE: number; } declare var ANGLE_instanced_arrays: { prototype: ANGLE_instanced_arrays; new(): ANGLE_instanced_arrays; - VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE: number; + readonly VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE: number; } interface AnalyserNode extends AudioNode { fftSize: number; - frequencyBinCount: number; + readonly frequencyBinCount: number; maxDecibels: number; minDecibels: number; smoothingTimeConstant: number; @@ -429,8 +920,8 @@ declare var AnalyserNode: { } interface AnimationEvent extends Event { - animationName: string; - elapsedTime: number; + readonly animationName: string; + readonly elapsedTime: number; initAnimationEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, animationNameArg: string, elapsedTimeArg: number): void; } @@ -448,16 +939,16 @@ interface ApplicationCache extends EventTarget { onobsolete: (ev: Event) => any; onprogress: (ev: ProgressEvent) => any; onupdateready: (ev: Event) => any; - status: number; + readonly status: number; abort(): void; swapCache(): void; update(): void; - CHECKING: number; - DOWNLOADING: number; - IDLE: number; - OBSOLETE: number; - UNCACHED: number; - UPDATEREADY: number; + readonly CHECKING: number; + readonly DOWNLOADING: number; + readonly IDLE: number; + readonly OBSOLETE: number; + readonly UNCACHED: number; + readonly UPDATEREADY: number; addEventListener(type: "cached", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "checking", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "downloading", listener: (ev: Event) => any, useCapture?: boolean): void; @@ -472,16 +963,16 @@ interface ApplicationCache extends EventTarget { declare var ApplicationCache: { prototype: ApplicationCache; new(): ApplicationCache; - CHECKING: number; - DOWNLOADING: number; - IDLE: number; - OBSOLETE: number; - UNCACHED: number; - UPDATEREADY: number; + readonly CHECKING: number; + readonly DOWNLOADING: number; + readonly IDLE: number; + readonly OBSOLETE: number; + readonly UNCACHED: number; + readonly UPDATEREADY: number; } interface AriaRequestEvent extends Event { - attributeName: string; + readonly attributeName: string; attributeValue: string; } @@ -491,9 +982,10 @@ declare var AriaRequestEvent: { } interface Attr extends Node { - name: string; - ownerElement: Element; - specified: boolean; + readonly name: string; + readonly ownerElement: Element; + readonly prefix: string; + readonly specified: boolean; value: string; } @@ -503,10 +995,12 @@ declare var Attr: { } interface AudioBuffer { - duration: number; - length: number; - numberOfChannels: number; - sampleRate: number; + readonly duration: number; + readonly length: number; + readonly numberOfChannels: number; + readonly sampleRate: number; + copyFromChannel(destination: Float32Array, channelNumber: number, startInChannel?: number): void; + copyToChannel(source: Float32Array, channelNumber: number, startInChannel?: number): void; getChannelData(channel: number): Float32Array; } @@ -517,14 +1011,15 @@ declare var AudioBuffer: { interface AudioBufferSourceNode extends AudioNode { buffer: AudioBuffer; + readonly detune: AudioParam; loop: boolean; loopEnd: number; loopStart: number; - onended: (ev: Event) => any; - playbackRate: AudioParam; + onended: (ev: MediaStreamErrorEvent) => any; + readonly playbackRate: AudioParam; start(when?: number, offset?: number, duration?: number): void; stop(when?: number): void; - addEventListener(type: "ended", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "ended", listener: (ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -534,10 +1029,10 @@ declare var AudioBufferSourceNode: { } interface AudioContext extends EventTarget { - currentTime: number; - destination: AudioDestinationNode; - listener: AudioListener; - sampleRate: number; + readonly currentTime: number; + readonly destination: AudioDestinationNode; + readonly listener: AudioListener; + readonly sampleRate: number; state: string; createAnalyser(): AnalyserNode; createBiquadFilter(): BiquadFilterNode; @@ -550,13 +1045,14 @@ interface AudioContext extends EventTarget { createDynamicsCompressor(): DynamicsCompressorNode; createGain(): GainNode; createMediaElementSource(mediaElement: HTMLMediaElement): MediaElementAudioSourceNode; + createMediaStreamSource(mediaStream: MediaStream): MediaStreamAudioSourceNode; createOscillator(): OscillatorNode; createPanner(): PannerNode; - createPeriodicWave(real: Float32Array, imag: Float32Array): PeriodicWave; + createPeriodicWave(real: Float32Array, imag: Float32Array, constraints?: PeriodicWaveConstraints): PeriodicWave; createScriptProcessor(bufferSize?: number, numberOfInputChannels?: number, numberOfOutputChannels?: number): ScriptProcessorNode; createStereoPanner(): StereoPannerNode; createWaveShaper(): WaveShaperNode; - decodeAudioData(audioData: ArrayBuffer, successCallback: DecodeSuccessCallback, errorCallback?: DecodeErrorCallback): void; + decodeAudioData(audioData: ArrayBuffer, successCallback?: DecodeSuccessCallback, errorCallback?: DecodeErrorCallback): PromiseLike; } declare var AudioContext: { @@ -565,7 +1061,7 @@ declare var AudioContext: { } interface AudioDestinationNode extends AudioNode { - maxChannelCount: number; + readonly maxChannelCount: number; } declare var AudioDestinationNode: { @@ -590,9 +1086,9 @@ interface AudioNode extends EventTarget { channelCount: number; channelCountMode: string; channelInterpretation: string; - context: AudioContext; - numberOfInputs: number; - numberOfOutputs: number; + readonly context: AudioContext; + readonly numberOfInputs: number; + readonly numberOfOutputs: number; connect(destination: AudioNode, output?: number, input?: number): void; disconnect(output?: number): void; disconnect(destination: AudioNode, output?: number, input?: number): void; @@ -605,7 +1101,7 @@ declare var AudioNode: { } interface AudioParam { - defaultValue: number; + readonly defaultValue: number; value: number; cancelScheduledValues(startTime: number): void; exponentialRampToValueAtTime(value: number, endTime: number): void; @@ -621,9 +1117,9 @@ declare var AudioParam: { } interface AudioProcessingEvent extends Event { - inputBuffer: AudioBuffer; - outputBuffer: AudioBuffer; - playbackTime: number; + readonly inputBuffer: AudioBuffer; + readonly outputBuffer: AudioBuffer; + readonly playbackTime: number; } declare var AudioProcessingEvent: { @@ -633,11 +1129,11 @@ declare var AudioProcessingEvent: { interface AudioTrack { enabled: boolean; - id: string; + readonly id: string; kind: string; - label: string; + readonly label: string; language: string; - sourceBuffer: SourceBuffer; + readonly sourceBuffer: SourceBuffer; } declare var AudioTrack: { @@ -646,7 +1142,7 @@ declare var AudioTrack: { } interface AudioTrackList extends EventTarget { - length: number; + readonly length: number; onaddtrack: (ev: TrackEvent) => any; onchange: (ev: Event) => any; onremovetrack: (ev: TrackEvent) => any; @@ -665,7 +1161,7 @@ declare var AudioTrackList: { } interface BarProp { - visible: boolean; + readonly visible: boolean; } declare var BarProp: { @@ -683,10 +1179,10 @@ declare var BeforeUnloadEvent: { } interface BiquadFilterNode extends AudioNode { - Q: AudioParam; - detune: AudioParam; - frequency: AudioParam; - gain: AudioParam; + readonly Q: AudioParam; + readonly detune: AudioParam; + readonly frequency: AudioParam; + readonly gain: AudioParam; type: string; getFrequencyResponse(frequencyHz: Float32Array, magResponse: Float32Array, phaseResponse: Float32Array): void; } @@ -697,8 +1193,8 @@ declare var BiquadFilterNode: { } interface Blob { - size: number; - type: string; + readonly size: number; + readonly type: string; msClose(): void; msDetachStream(): any; slice(start?: number, end?: number, contentType?: string): Blob; @@ -732,7 +1228,7 @@ declare var CSSConditionRule: { } interface CSSFontFaceRule extends CSSRule { - style: CSSStyleDeclaration; + readonly style: CSSStyleDeclaration; } declare var CSSFontFaceRule: { @@ -741,9 +1237,9 @@ declare var CSSFontFaceRule: { } interface CSSGroupingRule extends CSSRule { - cssRules: CSSRuleList; - deleteRule(index?: number): void; - insertRule(rule: string, index?: number): number; + readonly cssRules: CSSRuleList; + deleteRule(index: number): void; + insertRule(rule: string, index: number): number; } declare var CSSGroupingRule: { @@ -752,9 +1248,9 @@ declare var CSSGroupingRule: { } interface CSSImportRule extends CSSRule { - href: string; - media: MediaList; - styleSheet: CSSStyleSheet; + readonly href: string; + readonly media: MediaList; + readonly styleSheet: CSSStyleSheet; } declare var CSSImportRule: { @@ -764,7 +1260,7 @@ declare var CSSImportRule: { interface CSSKeyframeRule extends CSSRule { keyText: string; - style: CSSStyleDeclaration; + readonly style: CSSStyleDeclaration; } declare var CSSKeyframeRule: { @@ -773,7 +1269,7 @@ declare var CSSKeyframeRule: { } interface CSSKeyframesRule extends CSSRule { - cssRules: CSSRuleList; + readonly cssRules: CSSRuleList; name: string; appendRule(rule: string): void; deleteRule(rule: string): void; @@ -786,7 +1282,7 @@ declare var CSSKeyframesRule: { } interface CSSMediaRule extends CSSConditionRule { - media: MediaList; + readonly media: MediaList; } declare var CSSMediaRule: { @@ -795,8 +1291,8 @@ declare var CSSMediaRule: { } interface CSSNamespaceRule extends CSSRule { - namespaceURI: string; - prefix: string; + readonly namespaceURI: string; + readonly prefix: string; } declare var CSSNamespaceRule: { @@ -805,10 +1301,10 @@ declare var CSSNamespaceRule: { } interface CSSPageRule extends CSSRule { - pseudoClass: string; - selector: string; + readonly pseudoClass: string; + readonly selector: string; selectorText: string; - style: CSSStyleDeclaration; + readonly style: CSSStyleDeclaration; } declare var CSSPageRule: { @@ -818,42 +1314,42 @@ declare var CSSPageRule: { interface CSSRule { cssText: string; - parentRule: CSSRule; - parentStyleSheet: CSSStyleSheet; - type: number; - CHARSET_RULE: number; - FONT_FACE_RULE: number; - IMPORT_RULE: number; - KEYFRAMES_RULE: number; - KEYFRAME_RULE: number; - MEDIA_RULE: number; - NAMESPACE_RULE: number; - PAGE_RULE: number; - STYLE_RULE: number; - SUPPORTS_RULE: number; - UNKNOWN_RULE: number; - VIEWPORT_RULE: number; + readonly parentRule: CSSRule; + readonly parentStyleSheet: CSSStyleSheet; + readonly type: number; + readonly CHARSET_RULE: number; + readonly FONT_FACE_RULE: number; + readonly IMPORT_RULE: number; + readonly KEYFRAMES_RULE: number; + readonly KEYFRAME_RULE: number; + readonly MEDIA_RULE: number; + readonly NAMESPACE_RULE: number; + readonly PAGE_RULE: number; + readonly STYLE_RULE: number; + readonly SUPPORTS_RULE: number; + readonly UNKNOWN_RULE: number; + readonly VIEWPORT_RULE: number; } declare var CSSRule: { prototype: CSSRule; new(): CSSRule; - CHARSET_RULE: number; - FONT_FACE_RULE: number; - IMPORT_RULE: number; - KEYFRAMES_RULE: number; - KEYFRAME_RULE: number; - MEDIA_RULE: number; - NAMESPACE_RULE: number; - PAGE_RULE: number; - STYLE_RULE: number; - SUPPORTS_RULE: number; - UNKNOWN_RULE: number; - VIEWPORT_RULE: number; + readonly CHARSET_RULE: number; + readonly FONT_FACE_RULE: number; + readonly IMPORT_RULE: number; + readonly KEYFRAMES_RULE: number; + readonly KEYFRAME_RULE: number; + readonly MEDIA_RULE: number; + readonly NAMESPACE_RULE: number; + readonly PAGE_RULE: number; + readonly STYLE_RULE: number; + readonly SUPPORTS_RULE: number; + readonly UNKNOWN_RULE: number; + readonly VIEWPORT_RULE: number; } interface CSSRuleList { - length: number; + readonly length: number; item(index: number): CSSRule; [index: number]: CSSRule; } @@ -986,7 +1482,7 @@ interface CSSStyleDeclaration { justifyContent: string; kerning: string; left: string; - length: number; + readonly length: number; letterSpacing: string; lightingColor: string; lineHeight: string; @@ -1073,7 +1569,7 @@ interface CSSStyleDeclaration { pageBreakAfter: string; pageBreakBefore: string; pageBreakInside: string; - parentRule: CSSRule; + readonly parentRule: CSSRule; perspective: string; perspectiveOrigin: string; pointerEvents: string; @@ -1098,7 +1594,6 @@ interface CSSStyleDeclaration { textAlignLast: string; textAnchor: string; textDecoration: string; - textFillColor: string; textIndent: string; textJustify: string; textKashida: string; @@ -1134,25 +1629,12 @@ interface CSSStyleDeclaration { webkitAnimationTimingFunction: string; webkitAppearance: string; webkitBackfaceVisibility: string; - webkitBackground: string; - webkitBackgroundAttachment: string; webkitBackgroundClip: string; - webkitBackgroundColor: string; - webkitBackgroundImage: string; webkitBackgroundOrigin: string; - webkitBackgroundPosition: string; - webkitBackgroundPositionX: string; - webkitBackgroundPositionY: string; - webkitBackgroundRepeat: string; webkitBackgroundSize: string; webkitBorderBottomLeftRadius: string; webkitBorderBottomRightRadius: string; webkitBorderImage: string; - webkitBorderImageOutset: string; - webkitBorderImageRepeat: string; - webkitBorderImageSlice: string; - webkitBorderImageSource: string; - webkitBorderImageWidth: string; webkitBorderRadius: string; webkitBorderTopLeftRadius: string; webkitBorderTopRightRadius: string; @@ -1198,6 +1680,7 @@ interface CSSStyleDeclaration { webkitTransitionDuration: string; webkitTransitionProperty: string; webkitTransitionTimingFunction: string; + webkitUserModify: string; webkitUserSelect: string; webkitWritingMode: string; whiteSpace: string; @@ -1223,9 +1706,9 @@ declare var CSSStyleDeclaration: { } interface CSSStyleRule extends CSSRule { - readOnly: boolean; + readonly readOnly: boolean; selectorText: string; - style: CSSStyleDeclaration; + readonly style: CSSStyleDeclaration; } declare var CSSStyleRule: { @@ -1234,18 +1717,18 @@ declare var CSSStyleRule: { } interface CSSStyleSheet extends StyleSheet { - cssRules: CSSRuleList; + readonly cssRules: CSSRuleList; cssText: string; - href: string; - id: string; - imports: StyleSheetList; - isAlternate: boolean; - isPrefAlternate: boolean; - ownerRule: CSSRule; - owningElement: Element; - pages: StyleSheetPageList; - readOnly: boolean; - rules: CSSRuleList; + readonly href: string; + readonly id: string; + readonly imports: StyleSheetList; + readonly isAlternate: boolean; + readonly isPrefAlternate: boolean; + readonly ownerRule: CSSRule; + readonly owningElement: Element; + readonly pages: StyleSheetPageList; + readonly readOnly: boolean; + readonly rules: CSSRuleList; addImport(bstrURL: string, lIndex?: number): number; addPageRule(bstrSelector: string, bstrStyle: string, lIndex?: number): number; addRule(bstrSelector: string, bstrStyle?: string, lIndex?: number): number; @@ -1285,8 +1768,8 @@ declare var CanvasPattern: { new(): CanvasPattern; } -interface CanvasRenderingContext2D { - canvas: HTMLCanvasElement; +interface CanvasRenderingContext2D extends Object, CanvasPathMethods { + readonly canvas: HTMLCanvasElement; fillStyle: string | CanvasGradient | CanvasPattern; font: string; globalAlpha: number; @@ -1305,13 +1788,9 @@ interface CanvasRenderingContext2D { strokeStyle: string | CanvasGradient | CanvasPattern; textAlign: string; textBaseline: string; - arc(x: number, y: number, radius: number, startAngle: number, endAngle: number, anticlockwise?: boolean): void; - arcTo(x1: number, y1: number, x2: number, y2: number, radius: number): void; beginPath(): void; - bezierCurveTo(cp1x: number, cp1y: number, cp2x: number, cp2y: number, x: number, y: number): void; clearRect(x: number, y: number, w: number, h: number): void; clip(fillRule?: string): void; - closePath(): void; createImageData(imageDataOrSw: number | ImageData, sh?: number): ImageData; createLinearGradient(x0: number, y0: number, x1: number, y1: number): CanvasGradient; createPattern(image: HTMLImageElement | HTMLCanvasElement | HTMLVideoElement, repetition: string): CanvasPattern; @@ -1323,12 +1802,8 @@ interface CanvasRenderingContext2D { getImageData(sx: number, sy: number, sw: number, sh: number): ImageData; getLineDash(): number[]; isPointInPath(x: number, y: number, fillRule?: string): boolean; - lineTo(x: number, y: number): void; measureText(text: string): TextMetrics; - moveTo(x: number, y: number): void; putImageData(imagedata: ImageData, dx: number, dy: number, dirtyX?: number, dirtyY?: number, dirtyWidth?: number, dirtyHeight?: number): void; - quadraticCurveTo(cpx: number, cpy: number, x: number, y: number): void; - rect(x: number, y: number, w: number, h: number): void; restore(): void; rotate(angle: number): void; save(): void; @@ -1365,7 +1840,7 @@ declare var ChannelSplitterNode: { interface CharacterData extends Node, ChildNode { data: string; - length: number; + readonly length: number; appendData(arg: string): void; deleteData(offset: number, count: number): void; insertData(offset: number, arg: string): void; @@ -1381,11 +1856,11 @@ declare var CharacterData: { interface ClientRect { bottom: number; - height: number; + readonly height: number; left: number; right: number; top: number; - width: number; + readonly width: number; } declare var ClientRect: { @@ -1394,7 +1869,7 @@ declare var ClientRect: { } interface ClientRectList { - length: number; + readonly length: number; item(index: number): ClientRect; [index: number]: ClientRect; } @@ -1405,7 +1880,7 @@ declare var ClientRectList: { } interface ClipboardEvent extends Event { - clipboardData: DataTransfer; + readonly clipboardData: DataTransfer; } declare var ClipboardEvent: { @@ -1414,9 +1889,9 @@ declare var ClipboardEvent: { } interface CloseEvent extends Event { - code: number; - reason: string; - wasClean: boolean; + readonly code: number; + readonly reason: string; + readonly wasClean: boolean; initCloseEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, wasCleanArg: boolean, codeArg: number, reasonArg: string): void; } @@ -1426,8 +1901,8 @@ declare var CloseEvent: { } interface CommandEvent extends Event { - commandName: string; - detail: string; + readonly commandName: string; + readonly detail: string; } declare var CommandEvent: { @@ -1445,8 +1920,8 @@ declare var Comment: { } interface CompositionEvent extends UIEvent { - data: string; - locale: string; + readonly data: string; + readonly locale: string; initCompositionEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, dataArg: string, locale: string): void; } @@ -1463,6 +1938,7 @@ interface Console { dir(value?: any, ...optionalParams: any[]): void; dirxml(value: any): void; error(message?: any, ...optionalParams: any[]): void; + exception(message?: string, ...optionalParams: any[]): void; group(groupTitle?: string): void; groupCollapsed(groupTitle?: string): void; groupEnd(): void; @@ -1472,6 +1948,7 @@ interface Console { profile(reportName?: string): void; profileEnd(): void; select(element: Element): void; + table(...data: any[]): void; time(timerName?: string): void; timeEnd(timerName?: string): void; trace(message?: any, ...optionalParams: any[]): void; @@ -1494,13 +1971,13 @@ declare var ConvolverNode: { } interface Coordinates { - accuracy: number; - altitude: number; - altitudeAccuracy: number; - heading: number; - latitude: number; - longitude: number; - speed: number; + readonly accuracy: number; + readonly altitude: number; + readonly altitudeAccuracy: number; + readonly heading: number; + readonly latitude: number; + readonly longitude: number; + readonly speed: number; } declare var Coordinates: { @@ -1509,7 +1986,7 @@ declare var Coordinates: { } interface Crypto extends Object, RandomSource { - subtle: SubtleCrypto; + readonly subtle: SubtleCrypto; } declare var Crypto: { @@ -1518,10 +1995,10 @@ declare var Crypto: { } interface CryptoKey { - algorithm: KeyAlgorithm; - extractable: boolean; - type: string; - usages: string[]; + readonly algorithm: KeyAlgorithm; + readonly extractable: boolean; + readonly type: string; + readonly usages: string[]; } declare var CryptoKey: { @@ -1540,7 +2017,7 @@ declare var CryptoKeyPair: { } interface CustomEvent extends Event { - detail: any; + readonly detail: any; initCustomEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, detailArg: any): void; } @@ -1550,7 +2027,7 @@ declare var CustomEvent: { } interface DOMError { - name: string; + readonly name: string; toString(): string; } @@ -1560,69 +2037,69 @@ declare var DOMError: { } interface DOMException { - code: number; - message: string; - name: string; + readonly code: number; + readonly message: string; + readonly name: string; toString(): string; - ABORT_ERR: number; - DATA_CLONE_ERR: number; - DOMSTRING_SIZE_ERR: number; - HIERARCHY_REQUEST_ERR: number; - INDEX_SIZE_ERR: number; - INUSE_ATTRIBUTE_ERR: number; - INVALID_ACCESS_ERR: number; - INVALID_CHARACTER_ERR: number; - INVALID_MODIFICATION_ERR: number; - INVALID_NODE_TYPE_ERR: number; - INVALID_STATE_ERR: number; - NAMESPACE_ERR: number; - NETWORK_ERR: number; - NOT_FOUND_ERR: number; - NOT_SUPPORTED_ERR: number; - NO_DATA_ALLOWED_ERR: number; - NO_MODIFICATION_ALLOWED_ERR: number; - PARSE_ERR: number; - QUOTA_EXCEEDED_ERR: number; - SECURITY_ERR: number; - SERIALIZE_ERR: number; - SYNTAX_ERR: number; - TIMEOUT_ERR: number; - TYPE_MISMATCH_ERR: number; - URL_MISMATCH_ERR: number; - VALIDATION_ERR: number; - WRONG_DOCUMENT_ERR: number; + readonly ABORT_ERR: number; + readonly DATA_CLONE_ERR: number; + readonly DOMSTRING_SIZE_ERR: number; + readonly HIERARCHY_REQUEST_ERR: number; + readonly INDEX_SIZE_ERR: number; + readonly INUSE_ATTRIBUTE_ERR: number; + readonly INVALID_ACCESS_ERR: number; + readonly INVALID_CHARACTER_ERR: number; + readonly INVALID_MODIFICATION_ERR: number; + readonly INVALID_NODE_TYPE_ERR: number; + readonly INVALID_STATE_ERR: number; + readonly NAMESPACE_ERR: number; + readonly NETWORK_ERR: number; + readonly NOT_FOUND_ERR: number; + readonly NOT_SUPPORTED_ERR: number; + readonly NO_DATA_ALLOWED_ERR: number; + readonly NO_MODIFICATION_ALLOWED_ERR: number; + readonly PARSE_ERR: number; + readonly QUOTA_EXCEEDED_ERR: number; + readonly SECURITY_ERR: number; + readonly SERIALIZE_ERR: number; + readonly SYNTAX_ERR: number; + readonly TIMEOUT_ERR: number; + readonly TYPE_MISMATCH_ERR: number; + readonly URL_MISMATCH_ERR: number; + readonly VALIDATION_ERR: number; + readonly WRONG_DOCUMENT_ERR: number; } declare var DOMException: { prototype: DOMException; new(): DOMException; - ABORT_ERR: number; - DATA_CLONE_ERR: number; - DOMSTRING_SIZE_ERR: number; - HIERARCHY_REQUEST_ERR: number; - INDEX_SIZE_ERR: number; - INUSE_ATTRIBUTE_ERR: number; - INVALID_ACCESS_ERR: number; - INVALID_CHARACTER_ERR: number; - INVALID_MODIFICATION_ERR: number; - INVALID_NODE_TYPE_ERR: number; - INVALID_STATE_ERR: number; - NAMESPACE_ERR: number; - NETWORK_ERR: number; - NOT_FOUND_ERR: number; - NOT_SUPPORTED_ERR: number; - NO_DATA_ALLOWED_ERR: number; - NO_MODIFICATION_ALLOWED_ERR: number; - PARSE_ERR: number; - QUOTA_EXCEEDED_ERR: number; - SECURITY_ERR: number; - SERIALIZE_ERR: number; - SYNTAX_ERR: number; - TIMEOUT_ERR: number; - TYPE_MISMATCH_ERR: number; - URL_MISMATCH_ERR: number; - VALIDATION_ERR: number; - WRONG_DOCUMENT_ERR: number; + readonly ABORT_ERR: number; + readonly DATA_CLONE_ERR: number; + readonly DOMSTRING_SIZE_ERR: number; + readonly HIERARCHY_REQUEST_ERR: number; + readonly INDEX_SIZE_ERR: number; + readonly INUSE_ATTRIBUTE_ERR: number; + readonly INVALID_ACCESS_ERR: number; + readonly INVALID_CHARACTER_ERR: number; + readonly INVALID_MODIFICATION_ERR: number; + readonly INVALID_NODE_TYPE_ERR: number; + readonly INVALID_STATE_ERR: number; + readonly NAMESPACE_ERR: number; + readonly NETWORK_ERR: number; + readonly NOT_FOUND_ERR: number; + readonly NOT_SUPPORTED_ERR: number; + readonly NO_DATA_ALLOWED_ERR: number; + readonly NO_MODIFICATION_ALLOWED_ERR: number; + readonly PARSE_ERR: number; + readonly QUOTA_EXCEEDED_ERR: number; + readonly SECURITY_ERR: number; + readonly SERIALIZE_ERR: number; + readonly SYNTAX_ERR: number; + readonly TIMEOUT_ERR: number; + readonly TYPE_MISMATCH_ERR: number; + readonly URL_MISMATCH_ERR: number; + readonly VALIDATION_ERR: number; + readonly WRONG_DOCUMENT_ERR: number; } interface DOMImplementation { @@ -1656,7 +2133,7 @@ declare var DOMSettableTokenList: { } interface DOMStringList { - length: number; + readonly length: number; contains(str: string): boolean; item(index: number): string; [index: number]: string; @@ -1677,7 +2154,7 @@ declare var DOMStringMap: { } interface DOMTokenList { - length: number; + readonly length: number; add(...token: string[]): void; contains(token: string): boolean; item(index: number): string; @@ -1704,9 +2181,9 @@ declare var DataCue: { interface DataTransfer { dropEffect: string; effectAllowed: string; - files: FileList; - items: DataTransferItemList; - types: DOMStringList; + readonly files: FileList; + readonly items: DataTransferItemList; + readonly types: DOMStringList; clearData(format?: string): boolean; getData(format: string): string; setData(format: string, data: string): boolean; @@ -1718,8 +2195,8 @@ declare var DataTransfer: { } interface DataTransferItem { - kind: string; - type: string; + readonly kind: string; + readonly type: string; getAsFile(): File; getAsString(_callback: FunctionStringCallback): void; } @@ -1730,7 +2207,7 @@ declare var DataTransferItem: { } interface DataTransferItemList { - length: number; + readonly length: number; add(data: File): DataTransferItem; clear(): void; item(index: number): DataTransferItem; @@ -1744,9 +2221,9 @@ declare var DataTransferItemList: { } interface DeferredPermissionRequest { - id: number; - type: string; - uri: string; + readonly id: number; + readonly type: string; + readonly uri: string; allow(): void; deny(): void; } @@ -1757,7 +2234,7 @@ declare var DeferredPermissionRequest: { } interface DelayNode extends AudioNode { - delayTime: AudioParam; + readonly delayTime: AudioParam; } declare var DelayNode: { @@ -1766,9 +2243,9 @@ declare var DelayNode: { } interface DeviceAcceleration { - x: number; - y: number; - z: number; + readonly x: number; + readonly y: number; + readonly z: number; } declare var DeviceAcceleration: { @@ -1776,11 +2253,20 @@ declare var DeviceAcceleration: { new(): DeviceAcceleration; } +interface DeviceLightEvent extends Event { + readonly value: number; +} + +declare var DeviceLightEvent: { + prototype: DeviceLightEvent; + new(type: string, eventInitDict?: DeviceLightEventInit): DeviceLightEvent; +} + interface DeviceMotionEvent extends Event { - acceleration: DeviceAcceleration; - accelerationIncludingGravity: DeviceAcceleration; - interval: number; - rotationRate: DeviceRotationRate; + readonly acceleration: DeviceAcceleration; + readonly accelerationIncludingGravity: DeviceAcceleration; + readonly interval: number; + readonly rotationRate: DeviceRotationRate; initDeviceMotionEvent(type: string, bubbles: boolean, cancelable: boolean, acceleration: DeviceAccelerationDict, accelerationIncludingGravity: DeviceAccelerationDict, rotationRate: DeviceRotationRateDict, interval: number): void; } @@ -1790,10 +2276,10 @@ declare var DeviceMotionEvent: { } interface DeviceOrientationEvent extends Event { - absolute: boolean; - alpha: number; - beta: number; - gamma: number; + readonly absolute: boolean; + readonly alpha: number; + readonly beta: number; + readonly gamma: number; initDeviceOrientationEvent(type: string, bubbles: boolean, cancelable: boolean, alpha: number, beta: number, gamma: number, absolute: boolean): void; } @@ -1803,9 +2289,9 @@ declare var DeviceOrientationEvent: { } interface DeviceRotationRate { - alpha: number; - beta: number; - gamma: number; + readonly alpha: number; + readonly beta: number; + readonly gamma: number; } declare var DeviceRotationRate: { @@ -1817,15 +2303,15 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven /** * Sets or gets the URL for the current document. */ - URL: string; + readonly URL: string; /** * Gets the URL for the document, stripped of any character encoding. */ - URLUnencoded: string; + readonly URLUnencoded: string; /** * Gets the object that has the focus when the parent document has focus. */ - activeElement: Element; + readonly activeElement: Element; /** * Sets or gets the color of all active links in the document. */ @@ -1833,15 +2319,15 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven /** * Returns a reference to the collection of elements contained by the object. */ - all: HTMLCollection; + readonly all: HTMLAllCollection; /** * Retrieves a collection of all a objects that have a name and/or id property. Objects in this collection are in HTML source order. */ - anchors: HTMLCollection; + anchors: HTMLCollectionOf; /** * Retrieves a collection of all applet objects in the document. */ - applets: HTMLCollection; + applets: HTMLCollectionOf; /** * Deprecated. Sets or retrieves a value that indicates the background color behind the object. */ @@ -1850,7 +2336,7 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven * Specifies the beginning and end of the document body. */ body: HTMLElement; - characterSet: string; + readonly characterSet: string; /** * Gets or sets the character set used to encode the object. */ @@ -1858,13 +2344,14 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven /** * Gets a value that indicates whether standards-compliant mode is switched on for the object. */ - compatMode: string; + readonly compatMode: string; cookie: string; + readonly currentScript: HTMLScriptElement | SVGScriptElement; /** * Gets the default character set from the current regional language settings. */ - defaultCharset: string; - defaultView: Window; + readonly defaultCharset: string; + readonly defaultView: Window; /** * Sets or gets a value that indicates whether the document can be edited. */ @@ -1876,7 +2363,7 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven /** * Gets an object representing the document type declaration associated with the current document. */ - doctype: DocumentType; + readonly doctype: DocumentType; /** * Gets a reference to the root node of the document. */ @@ -1888,7 +2375,7 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven /** * Retrieves a collection of all embed objects in the document. */ - embeds: HTMLCollection; + embeds: HTMLCollectionOf; /** * Sets or gets the foreground (text) color of the document. */ @@ -1896,27 +2383,27 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven /** * Retrieves a collection, in source order, of all form objects in the document. */ - forms: HTMLCollection; - fullscreenElement: Element; - fullscreenEnabled: boolean; - head: HTMLHeadElement; - hidden: boolean; + forms: HTMLCollectionOf; + readonly fullscreenElement: Element; + readonly fullscreenEnabled: boolean; + readonly head: HTMLHeadElement; + readonly hidden: boolean; /** * Retrieves a collection, in source order, of img objects in the document. */ - images: HTMLCollection; + images: HTMLCollectionOf; /** * Gets the implementation object of the current document. */ - implementation: DOMImplementation; + readonly implementation: DOMImplementation; /** * Returns the character encoding used to create the webpage that is loaded into the document object. */ - inputEncoding: string; + readonly inputEncoding: string; /** * Gets the date that the page was last modified, if the page supplies one. */ - lastModified: string; + readonly lastModified: string; /** * Sets or gets the color of the document links. */ @@ -1924,16 +2411,13 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven /** * Retrieves a collection of all a objects that specify the href property and all area objects in the document. */ - links: HTMLCollection; + links: HTMLCollectionOf; /** * Contains information about the current URL. */ - location: Location; - media: string; + readonly location: Location; msCSSOMElementFloatMetrics: boolean; msCapsLockWarningOff: boolean; - msHidden: boolean; - msVisibilityState: string; /** * Fires when the user aborts the download. * @param ev The event. @@ -2035,7 +2519,7 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven * Occurs when the end of playback is reached. * @param ev The event */ - onended: (ev: Event) => any; + onended: (ev: MediaStreamErrorEvent) => any; /** * Fires when an error occurs during object loading. * @param ev The event. @@ -2049,6 +2533,7 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven onfullscreenchange: (ev: Event) => any; onfullscreenerror: (ev: Event) => any; oninput: (ev: Event) => any; + oninvalid: (ev: Event) => any; /** * Fires when the user presses a key. * @param ev The keyboard event @@ -2113,7 +2598,7 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven * Fires when the wheel button is rotated. * @param ev The mouse event */ - onmousewheel: (ev: MouseWheelEvent) => any; + onmousewheel: (ev: WheelEvent) => any; onmscontentzoom: (ev: UIEvent) => any; onmsgesturechange: (ev: MSGestureEvent) => any; onmsgesturedoubletap: (ev: MSGestureEvent) => any; @@ -2198,6 +2683,11 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven * @param ev The event. */ onselect: (ev: UIEvent) => any; + /** + * Fires when the selection state of a document changes. + * @param ev The event. + */ + onselectionchange: (ev: Event) => any; onselectstart: (ev: Event) => any; /** * Occurs when the download has stopped. @@ -2236,51 +2726,51 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven onwaiting: (ev: Event) => any; onwebkitfullscreenchange: (ev: Event) => any; onwebkitfullscreenerror: (ev: Event) => any; - plugins: HTMLCollection; - pointerLockElement: Element; + plugins: HTMLCollectionOf; + readonly pointerLockElement: Element; /** * Retrieves a value that indicates the current state of the object. */ - readyState: string; + readonly readyState: string; /** * Gets the URL of the location that referred the user to the current page. */ - referrer: string; + readonly referrer: string; /** * Gets the root svg element in the document hierarchy. */ - rootElement: SVGSVGElement; + readonly rootElement: SVGSVGElement; /** * Retrieves a collection of all script objects in the document. */ - scripts: HTMLCollection; - security: string; + scripts: HTMLCollectionOf; + readonly scrollingElement: Element; /** * Retrieves a collection of styleSheet objects representing the style sheets that correspond to each instance of a link or style object in the document. */ - styleSheets: StyleSheetList; + readonly styleSheets: StyleSheetList; /** * Contains the title of the document. */ title: string; - visibilityState: string; + readonly visibilityState: string; /** * Sets or gets the color of the links that the user has visited. */ vlinkColor: string; - webkitCurrentFullScreenElement: Element; - webkitFullscreenElement: Element; - webkitFullscreenEnabled: boolean; - webkitIsFullScreen: boolean; - xmlEncoding: string; + readonly webkitCurrentFullScreenElement: Element; + readonly webkitFullscreenElement: Element; + readonly webkitFullscreenEnabled: boolean; + readonly webkitIsFullScreen: boolean; + readonly xmlEncoding: string; xmlStandalone: boolean; /** * Gets or sets the version attribute specified in the declaration of an XML document. */ xmlVersion: string; - currentScript: HTMLScriptElement; adoptNode(source: Node): Node; captureEvents(): void; + caretRangeFromPoint(x: number, y: number): Range; clear(): void; /** * Closes an output stream and forces the sent data to display. @@ -2307,37 +2797,24 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven * @param tagName The name of an element. */ createElement(tagName: "a"): HTMLAnchorElement; - createElement(tagName: "abbr"): HTMLPhraseElement; - createElement(tagName: "acronym"): HTMLPhraseElement; - createElement(tagName: "address"): HTMLBlockElement; createElement(tagName: "applet"): HTMLAppletElement; createElement(tagName: "area"): HTMLAreaElement; createElement(tagName: "audio"): HTMLAudioElement; - createElement(tagName: "b"): HTMLPhraseElement; createElement(tagName: "base"): HTMLBaseElement; createElement(tagName: "basefont"): HTMLBaseFontElement; - createElement(tagName: "bdo"): HTMLPhraseElement; - createElement(tagName: "big"): HTMLPhraseElement; - createElement(tagName: "blockquote"): HTMLBlockElement; + createElement(tagName: "blockquote"): HTMLQuoteElement; createElement(tagName: "body"): HTMLBodyElement; createElement(tagName: "br"): HTMLBRElement; createElement(tagName: "button"): HTMLButtonElement; createElement(tagName: "canvas"): HTMLCanvasElement; createElement(tagName: "caption"): HTMLTableCaptionElement; - createElement(tagName: "center"): HTMLBlockElement; - createElement(tagName: "cite"): HTMLPhraseElement; - createElement(tagName: "code"): HTMLPhraseElement; createElement(tagName: "col"): HTMLTableColElement; createElement(tagName: "colgroup"): HTMLTableColElement; createElement(tagName: "datalist"): HTMLDataListElement; - createElement(tagName: "dd"): HTMLDDElement; createElement(tagName: "del"): HTMLModElement; - createElement(tagName: "dfn"): HTMLPhraseElement; createElement(tagName: "dir"): HTMLDirectoryElement; createElement(tagName: "div"): HTMLDivElement; createElement(tagName: "dl"): HTMLDListElement; - createElement(tagName: "dt"): HTMLDTElement; - createElement(tagName: "em"): HTMLPhraseElement; createElement(tagName: "embed"): HTMLEmbedElement; createElement(tagName: "fieldset"): HTMLFieldSetElement; createElement(tagName: "font"): HTMLFontElement; @@ -2353,52 +2830,41 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven createElement(tagName: "head"): HTMLHeadElement; createElement(tagName: "hr"): HTMLHRElement; createElement(tagName: "html"): HTMLHtmlElement; - createElement(tagName: "i"): HTMLPhraseElement; createElement(tagName: "iframe"): HTMLIFrameElement; createElement(tagName: "img"): HTMLImageElement; createElement(tagName: "input"): HTMLInputElement; createElement(tagName: "ins"): HTMLModElement; - createElement(tagName: "isindex"): HTMLIsIndexElement; - createElement(tagName: "kbd"): HTMLPhraseElement; - createElement(tagName: "keygen"): HTMLBlockElement; + createElement(tagName: "isindex"): HTMLUnknownElement; createElement(tagName: "label"): HTMLLabelElement; createElement(tagName: "legend"): HTMLLegendElement; createElement(tagName: "li"): HTMLLIElement; createElement(tagName: "link"): HTMLLinkElement; - createElement(tagName: "listing"): HTMLBlockElement; + createElement(tagName: "listing"): HTMLPreElement; createElement(tagName: "map"): HTMLMapElement; createElement(tagName: "marquee"): HTMLMarqueeElement; createElement(tagName: "menu"): HTMLMenuElement; createElement(tagName: "meta"): HTMLMetaElement; - createElement(tagName: "nextid"): HTMLNextIdElement; - createElement(tagName: "nobr"): HTMLPhraseElement; + createElement(tagName: "meter"): HTMLMeterElement; + createElement(tagName: "nextid"): HTMLUnknownElement; createElement(tagName: "object"): HTMLObjectElement; createElement(tagName: "ol"): HTMLOListElement; createElement(tagName: "optgroup"): HTMLOptGroupElement; createElement(tagName: "option"): HTMLOptionElement; createElement(tagName: "p"): HTMLParagraphElement; createElement(tagName: "param"): HTMLParamElement; - createElement(tagName: "plaintext"): HTMLBlockElement; + createElement(tagName: "picture"): HTMLPictureElement; createElement(tagName: "pre"): HTMLPreElement; createElement(tagName: "progress"): HTMLProgressElement; createElement(tagName: "q"): HTMLQuoteElement; - createElement(tagName: "rt"): HTMLPhraseElement; - createElement(tagName: "ruby"): HTMLPhraseElement; - createElement(tagName: "s"): HTMLPhraseElement; - createElement(tagName: "samp"): HTMLPhraseElement; createElement(tagName: "script"): HTMLScriptElement; createElement(tagName: "select"): HTMLSelectElement; - createElement(tagName: "small"): HTMLPhraseElement; createElement(tagName: "source"): HTMLSourceElement; createElement(tagName: "span"): HTMLSpanElement; - createElement(tagName: "strike"): HTMLPhraseElement; - createElement(tagName: "strong"): HTMLPhraseElement; createElement(tagName: "style"): HTMLStyleElement; - createElement(tagName: "sub"): HTMLPhraseElement; - createElement(tagName: "sup"): HTMLPhraseElement; createElement(tagName: "table"): HTMLTableElement; createElement(tagName: "tbody"): HTMLTableSectionElement; createElement(tagName: "td"): HTMLTableDataCellElement; + createElement(tagName: "template"): HTMLTemplateElement; createElement(tagName: "textarea"): HTMLTextAreaElement; createElement(tagName: "tfoot"): HTMLTableSectionElement; createElement(tagName: "th"): HTMLTableHeaderCellElement; @@ -2406,13 +2872,10 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven createElement(tagName: "title"): HTMLTitleElement; createElement(tagName: "tr"): HTMLTableRowElement; createElement(tagName: "track"): HTMLTrackElement; - createElement(tagName: "tt"): HTMLPhraseElement; - createElement(tagName: "u"): HTMLPhraseElement; createElement(tagName: "ul"): HTMLUListElement; - createElement(tagName: "var"): HTMLPhraseElement; createElement(tagName: "video"): HTMLVideoElement; createElement(tagName: "x-ms-webview"): MSHTMLWebViewElement; - createElement(tagName: "xmp"): HTMLBlockElement; + createElement(tagName: "xmp"): HTMLPreElement; createElement(tagName: string): HTMLElement; createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "a"): SVGAElement createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "circle"): SVGCircleElement @@ -2497,7 +2960,7 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven * @param data String that specifies the nodeValue property of the text node. */ createTextNode(data: string): Text; - createTouch(view: any, target: EventTarget, identifier: number, pageX: number, pageY: number, screenX: number, screenY: number): Touch; + createTouch(view: Window, target: EventTarget, identifier: number, pageX: number, pageY: number, screenX: number, screenY: number): Touch; createTouchList(...touches: Touch[]): TouchList; /** * Creates a TreeWalker object that you can use to traverse filtered lists of nodes or elements in a document. @@ -2548,44 +3011,44 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven * @param name Specifies the name of an element. */ getElementsByTagName(tagname: "a"): NodeListOf; - getElementsByTagName(tagname: "abbr"): NodeListOf; - getElementsByTagName(tagname: "acronym"): NodeListOf; - getElementsByTagName(tagname: "address"): NodeListOf; + getElementsByTagName(tagname: "abbr"): NodeListOf; + getElementsByTagName(tagname: "acronym"): NodeListOf; + getElementsByTagName(tagname: "address"): NodeListOf; getElementsByTagName(tagname: "applet"): NodeListOf; getElementsByTagName(tagname: "area"): NodeListOf; getElementsByTagName(tagname: "article"): NodeListOf; getElementsByTagName(tagname: "aside"): NodeListOf; getElementsByTagName(tagname: "audio"): NodeListOf; - getElementsByTagName(tagname: "b"): NodeListOf; + getElementsByTagName(tagname: "b"): NodeListOf; getElementsByTagName(tagname: "base"): NodeListOf; getElementsByTagName(tagname: "basefont"): NodeListOf; - getElementsByTagName(tagname: "bdo"): NodeListOf; - getElementsByTagName(tagname: "big"): NodeListOf; - getElementsByTagName(tagname: "blockquote"): NodeListOf; + getElementsByTagName(tagname: "bdo"): NodeListOf; + getElementsByTagName(tagname: "big"): NodeListOf; + getElementsByTagName(tagname: "blockquote"): NodeListOf; getElementsByTagName(tagname: "body"): NodeListOf; getElementsByTagName(tagname: "br"): NodeListOf; getElementsByTagName(tagname: "button"): NodeListOf; getElementsByTagName(tagname: "canvas"): NodeListOf; getElementsByTagName(tagname: "caption"): NodeListOf; - getElementsByTagName(tagname: "center"): NodeListOf; + getElementsByTagName(tagname: "center"): NodeListOf; getElementsByTagName(tagname: "circle"): NodeListOf; - getElementsByTagName(tagname: "cite"): NodeListOf; + getElementsByTagName(tagname: "cite"): NodeListOf; getElementsByTagName(tagname: "clippath"): NodeListOf; - getElementsByTagName(tagname: "code"): NodeListOf; + getElementsByTagName(tagname: "code"): NodeListOf; getElementsByTagName(tagname: "col"): NodeListOf; getElementsByTagName(tagname: "colgroup"): NodeListOf; getElementsByTagName(tagname: "datalist"): NodeListOf; - getElementsByTagName(tagname: "dd"): NodeListOf; + getElementsByTagName(tagname: "dd"): NodeListOf; getElementsByTagName(tagname: "defs"): NodeListOf; getElementsByTagName(tagname: "del"): NodeListOf; getElementsByTagName(tagname: "desc"): NodeListOf; - getElementsByTagName(tagname: "dfn"): NodeListOf; + getElementsByTagName(tagname: "dfn"): NodeListOf; getElementsByTagName(tagname: "dir"): NodeListOf; getElementsByTagName(tagname: "div"): NodeListOf; getElementsByTagName(tagname: "dl"): NodeListOf; - getElementsByTagName(tagname: "dt"): NodeListOf; + getElementsByTagName(tagname: "dt"): NodeListOf; getElementsByTagName(tagname: "ellipse"): NodeListOf; - getElementsByTagName(tagname: "em"): NodeListOf; + getElementsByTagName(tagname: "em"): NodeListOf; getElementsByTagName(tagname: "embed"): NodeListOf; getElementsByTagName(tagname: "feblend"): NodeListOf; getElementsByTagName(tagname: "fecolormatrix"): NodeListOf; @@ -2633,22 +3096,22 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven getElementsByTagName(tagname: "hgroup"): NodeListOf; getElementsByTagName(tagname: "hr"): NodeListOf; getElementsByTagName(tagname: "html"): NodeListOf; - getElementsByTagName(tagname: "i"): NodeListOf; + getElementsByTagName(tagname: "i"): NodeListOf; getElementsByTagName(tagname: "iframe"): NodeListOf; getElementsByTagName(tagname: "image"): NodeListOf; getElementsByTagName(tagname: "img"): NodeListOf; getElementsByTagName(tagname: "input"): NodeListOf; getElementsByTagName(tagname: "ins"): NodeListOf; - getElementsByTagName(tagname: "isindex"): NodeListOf; - getElementsByTagName(tagname: "kbd"): NodeListOf; - getElementsByTagName(tagname: "keygen"): NodeListOf; + getElementsByTagName(tagname: "isindex"): NodeListOf; + getElementsByTagName(tagname: "kbd"): NodeListOf; + getElementsByTagName(tagname: "keygen"): NodeListOf; getElementsByTagName(tagname: "label"): NodeListOf; getElementsByTagName(tagname: "legend"): NodeListOf; getElementsByTagName(tagname: "li"): NodeListOf; getElementsByTagName(tagname: "line"): NodeListOf; getElementsByTagName(tagname: "lineargradient"): NodeListOf; getElementsByTagName(tagname: "link"): NodeListOf; - getElementsByTagName(tagname: "listing"): NodeListOf; + getElementsByTagName(tagname: "listing"): NodeListOf; getElementsByTagName(tagname: "map"): NodeListOf; getElementsByTagName(tagname: "mark"): NodeListOf; getElementsByTagName(tagname: "marker"): NodeListOf; @@ -2657,9 +3120,10 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven getElementsByTagName(tagname: "menu"): NodeListOf; getElementsByTagName(tagname: "meta"): NodeListOf; getElementsByTagName(tagname: "metadata"): NodeListOf; + getElementsByTagName(tagname: "meter"): NodeListOf; getElementsByTagName(tagname: "nav"): NodeListOf; - getElementsByTagName(tagname: "nextid"): NodeListOf; - getElementsByTagName(tagname: "nobr"): NodeListOf; + getElementsByTagName(tagname: "nextid"): NodeListOf; + getElementsByTagName(tagname: "nobr"): NodeListOf; getElementsByTagName(tagname: "noframes"): NodeListOf; getElementsByTagName(tagname: "noscript"): NodeListOf; getElementsByTagName(tagname: "object"): NodeListOf; @@ -2670,7 +3134,8 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven getElementsByTagName(tagname: "param"): NodeListOf; getElementsByTagName(tagname: "path"): NodeListOf; getElementsByTagName(tagname: "pattern"): NodeListOf; - getElementsByTagName(tagname: "plaintext"): NodeListOf; + getElementsByTagName(tagname: "picture"): NodeListOf; + getElementsByTagName(tagname: "plaintext"): NodeListOf; getElementsByTagName(tagname: "polygon"): NodeListOf; getElementsByTagName(tagname: "polyline"): NodeListOf; getElementsByTagName(tagname: "pre"): NodeListOf; @@ -2678,28 +3143,29 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven getElementsByTagName(tagname: "q"): NodeListOf; getElementsByTagName(tagname: "radialgradient"): NodeListOf; getElementsByTagName(tagname: "rect"): NodeListOf; - getElementsByTagName(tagname: "rt"): NodeListOf; - getElementsByTagName(tagname: "ruby"): NodeListOf; - getElementsByTagName(tagname: "s"): NodeListOf; - getElementsByTagName(tagname: "samp"): NodeListOf; + getElementsByTagName(tagname: "rt"): NodeListOf; + getElementsByTagName(tagname: "ruby"): NodeListOf; + getElementsByTagName(tagname: "s"): NodeListOf; + getElementsByTagName(tagname: "samp"): NodeListOf; getElementsByTagName(tagname: "script"): NodeListOf; getElementsByTagName(tagname: "section"): NodeListOf; getElementsByTagName(tagname: "select"): NodeListOf; - getElementsByTagName(tagname: "small"): NodeListOf; + getElementsByTagName(tagname: "small"): NodeListOf; getElementsByTagName(tagname: "source"): NodeListOf; getElementsByTagName(tagname: "span"): NodeListOf; getElementsByTagName(tagname: "stop"): NodeListOf; - getElementsByTagName(tagname: "strike"): NodeListOf; - getElementsByTagName(tagname: "strong"): NodeListOf; + getElementsByTagName(tagname: "strike"): NodeListOf; + getElementsByTagName(tagname: "strong"): NodeListOf; getElementsByTagName(tagname: "style"): NodeListOf; - getElementsByTagName(tagname: "sub"): NodeListOf; - getElementsByTagName(tagname: "sup"): NodeListOf; + getElementsByTagName(tagname: "sub"): NodeListOf; + getElementsByTagName(tagname: "sup"): NodeListOf; getElementsByTagName(tagname: "svg"): NodeListOf; getElementsByTagName(tagname: "switch"): NodeListOf; getElementsByTagName(tagname: "symbol"): NodeListOf; getElementsByTagName(tagname: "table"): NodeListOf; getElementsByTagName(tagname: "tbody"): NodeListOf; getElementsByTagName(tagname: "td"): NodeListOf; + getElementsByTagName(tagname: "template"): NodeListOf; getElementsByTagName(tagname: "text"): NodeListOf; getElementsByTagName(tagname: "textpath"): NodeListOf; getElementsByTagName(tagname: "textarea"): NodeListOf; @@ -2710,16 +3176,16 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven getElementsByTagName(tagname: "tr"): NodeListOf; getElementsByTagName(tagname: "track"): NodeListOf; getElementsByTagName(tagname: "tspan"): NodeListOf; - getElementsByTagName(tagname: "tt"): NodeListOf; - getElementsByTagName(tagname: "u"): NodeListOf; + getElementsByTagName(tagname: "tt"): NodeListOf; + getElementsByTagName(tagname: "u"): NodeListOf; getElementsByTagName(tagname: "ul"): NodeListOf; getElementsByTagName(tagname: "use"): NodeListOf; - getElementsByTagName(tagname: "var"): NodeListOf; + getElementsByTagName(tagname: "var"): NodeListOf; getElementsByTagName(tagname: "video"): NodeListOf; getElementsByTagName(tagname: "view"): NodeListOf; getElementsByTagName(tagname: "wbr"): NodeListOf; getElementsByTagName(tagname: "x-ms-webview"): NodeListOf; - getElementsByTagName(tagname: "xmp"): NodeListOf; + getElementsByTagName(tagname: "xmp"): NodeListOf; getElementsByTagName(tagname: string): NodeListOf; getElementsByTagNameNS(namespaceURI: string, localName: string): NodeListOf; /** @@ -2731,8 +3197,8 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven */ hasFocus(): boolean; importNode(importedNode: Node, deep: boolean): Node; - msElementsFromPoint(x: number, y: number): NodeList; - msElementsFromRect(left: number, top: number, width: number, height: number): NodeList; + msElementsFromPoint(x: number, y: number): NodeListOf; + msElementsFromRect(left: number, top: number, width: number, height: number): NodeListOf; /** * 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. * @param url Specifies a MIME type for the document. @@ -2828,12 +3294,13 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven addEventListener(type: "drop", listener: (ev: DragEvent) => any, useCapture?: boolean): void; addEventListener(type: "durationchange", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "emptied", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "ended", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "ended", listener: (ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: "focus", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; addEventListener(type: "fullscreenchange", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "fullscreenerror", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "input", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "invalid", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "keydown", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "keypress", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "keyup", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; @@ -2846,7 +3313,7 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven addEventListener(type: "mouseout", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "mouseover", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "mouseup", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousewheel", listener: (ev: MouseWheelEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mousewheel", listener: (ev: WheelEvent) => any, useCapture?: boolean): void; addEventListener(type: "mssitemodejumplistitemremoved", listener: (ev: MSSiteModeEvent) => any, useCapture?: boolean): void; addEventListener(type: "msthumbnailclick", listener: (ev: MSSiteModeEvent) => any, useCapture?: boolean): void; addEventListener(type: "pause", listener: (ev: Event) => any, useCapture?: boolean): void; @@ -2870,6 +3337,7 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven addEventListener(type: "seeked", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "seeking", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "select", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "selectionchange", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "selectstart", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "stalled", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "stop", listener: (ev: Event) => any, useCapture?: boolean): void; @@ -2903,12 +3371,12 @@ declare var DocumentFragment: { } interface DocumentType extends Node, ChildNode { - entities: NamedNodeMap; - internalSubset: string; - name: string; - notations: NamedNodeMap; - publicId: string; - systemId: string; + readonly entities: NamedNodeMap; + readonly internalSubset: string; + readonly name: string; + readonly notations: NamedNodeMap; + readonly publicId: string; + readonly systemId: string; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -2918,7 +3386,7 @@ declare var DocumentType: { } interface DragEvent extends MouseEvent { - dataTransfer: DataTransfer; + readonly dataTransfer: DataTransfer; 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; msConvertURL(file: File, targetType: string, targetURL?: string): void; } @@ -2929,12 +3397,12 @@ declare var DragEvent: { } interface DynamicsCompressorNode extends AudioNode { - attack: AudioParam; - knee: AudioParam; - ratio: AudioParam; - reduction: AudioParam; - release: AudioParam; - threshold: AudioParam; + readonly attack: AudioParam; + readonly knee: AudioParam; + readonly ratio: AudioParam; + readonly reduction: AudioParam; + readonly release: AudioParam; + readonly threshold: AudioParam; } declare var DynamicsCompressorNode: { @@ -2942,26 +3410,36 @@ declare var DynamicsCompressorNode: { new(): DynamicsCompressorNode; } +interface EXT_frag_depth { +} + +declare var EXT_frag_depth: { + prototype: EXT_frag_depth; + new(): EXT_frag_depth; +} + interface EXT_texture_filter_anisotropic { - MAX_TEXTURE_MAX_ANISOTROPY_EXT: number; - TEXTURE_MAX_ANISOTROPY_EXT: number; + readonly MAX_TEXTURE_MAX_ANISOTROPY_EXT: number; + readonly TEXTURE_MAX_ANISOTROPY_EXT: number; } declare var EXT_texture_filter_anisotropic: { prototype: EXT_texture_filter_anisotropic; new(): EXT_texture_filter_anisotropic; - MAX_TEXTURE_MAX_ANISOTROPY_EXT: number; - TEXTURE_MAX_ANISOTROPY_EXT: number; + readonly MAX_TEXTURE_MAX_ANISOTROPY_EXT: number; + readonly TEXTURE_MAX_ANISOTROPY_EXT: number; } interface Element extends Node, GlobalEventHandlers, ElementTraversal, NodeSelector, ChildNode { - classList: DOMTokenList; - clientHeight: number; - clientLeft: number; - clientTop: number; - clientWidth: number; + readonly classList: DOMTokenList; + className: string; + readonly clientHeight: number; + readonly clientLeft: number; + readonly clientTop: number; + readonly clientWidth: number; + id: string; msContentZoomFactor: number; - msRegionOverflow: string; + readonly msRegionOverflow: string; onariarequest: (ev: AriaRequestEvent) => any; oncommand: (ev: CommandEvent) => any; ongotpointercapture: (ev: PointerEvent) => any; @@ -2989,13 +3467,12 @@ interface Element extends Node, GlobalEventHandlers, ElementTraversal, NodeSelec ontouchstart: (ev: TouchEvent) => any; onwebkitfullscreenchange: (ev: Event) => any; onwebkitfullscreenerror: (ev: Event) => any; - scrollHeight: number; + readonly prefix: string; + readonly scrollHeight: number; scrollLeft: number; scrollTop: number; - scrollWidth: number; - tagName: string; - id: string; - className: string; + readonly scrollWidth: number; + readonly tagName: string; innerHTML: string; getAttribute(name?: string): string; getAttributeNS(namespaceURI: string, localName: string): string; @@ -3004,44 +3481,44 @@ interface Element extends Node, GlobalEventHandlers, ElementTraversal, NodeSelec getBoundingClientRect(): ClientRect; getClientRects(): ClientRectList; getElementsByTagName(name: "a"): NodeListOf; - getElementsByTagName(name: "abbr"): NodeListOf; - getElementsByTagName(name: "acronym"): NodeListOf; - getElementsByTagName(name: "address"): NodeListOf; + getElementsByTagName(name: "abbr"): NodeListOf; + getElementsByTagName(name: "acronym"): NodeListOf; + getElementsByTagName(name: "address"): NodeListOf; getElementsByTagName(name: "applet"): NodeListOf; getElementsByTagName(name: "area"): NodeListOf; getElementsByTagName(name: "article"): NodeListOf; getElementsByTagName(name: "aside"): NodeListOf; getElementsByTagName(name: "audio"): NodeListOf; - getElementsByTagName(name: "b"): NodeListOf; + getElementsByTagName(name: "b"): NodeListOf; getElementsByTagName(name: "base"): NodeListOf; getElementsByTagName(name: "basefont"): NodeListOf; - getElementsByTagName(name: "bdo"): NodeListOf; - getElementsByTagName(name: "big"): NodeListOf; - getElementsByTagName(name: "blockquote"): NodeListOf; + getElementsByTagName(name: "bdo"): NodeListOf; + getElementsByTagName(name: "big"): NodeListOf; + getElementsByTagName(name: "blockquote"): NodeListOf; getElementsByTagName(name: "body"): NodeListOf; getElementsByTagName(name: "br"): NodeListOf; getElementsByTagName(name: "button"): NodeListOf; getElementsByTagName(name: "canvas"): NodeListOf; getElementsByTagName(name: "caption"): NodeListOf; - getElementsByTagName(name: "center"): NodeListOf; + getElementsByTagName(name: "center"): NodeListOf; getElementsByTagName(name: "circle"): NodeListOf; - getElementsByTagName(name: "cite"): NodeListOf; + getElementsByTagName(name: "cite"): NodeListOf; getElementsByTagName(name: "clippath"): NodeListOf; - getElementsByTagName(name: "code"): NodeListOf; + getElementsByTagName(name: "code"): NodeListOf; getElementsByTagName(name: "col"): NodeListOf; getElementsByTagName(name: "colgroup"): NodeListOf; getElementsByTagName(name: "datalist"): NodeListOf; - getElementsByTagName(name: "dd"): NodeListOf; + getElementsByTagName(name: "dd"): NodeListOf; getElementsByTagName(name: "defs"): NodeListOf; getElementsByTagName(name: "del"): NodeListOf; getElementsByTagName(name: "desc"): NodeListOf; - getElementsByTagName(name: "dfn"): NodeListOf; + getElementsByTagName(name: "dfn"): NodeListOf; getElementsByTagName(name: "dir"): NodeListOf; getElementsByTagName(name: "div"): NodeListOf; getElementsByTagName(name: "dl"): NodeListOf; - getElementsByTagName(name: "dt"): NodeListOf; + getElementsByTagName(name: "dt"): NodeListOf; getElementsByTagName(name: "ellipse"): NodeListOf; - getElementsByTagName(name: "em"): NodeListOf; + getElementsByTagName(name: "em"): NodeListOf; getElementsByTagName(name: "embed"): NodeListOf; getElementsByTagName(name: "feblend"): NodeListOf; getElementsByTagName(name: "fecolormatrix"): NodeListOf; @@ -3089,22 +3566,22 @@ interface Element extends Node, GlobalEventHandlers, ElementTraversal, NodeSelec getElementsByTagName(name: "hgroup"): NodeListOf; getElementsByTagName(name: "hr"): NodeListOf; getElementsByTagName(name: "html"): NodeListOf; - getElementsByTagName(name: "i"): NodeListOf; + getElementsByTagName(name: "i"): NodeListOf; getElementsByTagName(name: "iframe"): NodeListOf; getElementsByTagName(name: "image"): NodeListOf; getElementsByTagName(name: "img"): NodeListOf; getElementsByTagName(name: "input"): NodeListOf; getElementsByTagName(name: "ins"): NodeListOf; - getElementsByTagName(name: "isindex"): NodeListOf; - getElementsByTagName(name: "kbd"): NodeListOf; - getElementsByTagName(name: "keygen"): NodeListOf; + getElementsByTagName(name: "isindex"): NodeListOf; + getElementsByTagName(name: "kbd"): NodeListOf; + getElementsByTagName(name: "keygen"): NodeListOf; getElementsByTagName(name: "label"): NodeListOf; getElementsByTagName(name: "legend"): NodeListOf; getElementsByTagName(name: "li"): NodeListOf; getElementsByTagName(name: "line"): NodeListOf; getElementsByTagName(name: "lineargradient"): NodeListOf; getElementsByTagName(name: "link"): NodeListOf; - getElementsByTagName(name: "listing"): NodeListOf; + getElementsByTagName(name: "listing"): NodeListOf; getElementsByTagName(name: "map"): NodeListOf; getElementsByTagName(name: "mark"): NodeListOf; getElementsByTagName(name: "marker"): NodeListOf; @@ -3113,9 +3590,10 @@ interface Element extends Node, GlobalEventHandlers, ElementTraversal, NodeSelec getElementsByTagName(name: "menu"): NodeListOf; getElementsByTagName(name: "meta"): NodeListOf; getElementsByTagName(name: "metadata"): NodeListOf; + getElementsByTagName(name: "meter"): NodeListOf; getElementsByTagName(name: "nav"): NodeListOf; - getElementsByTagName(name: "nextid"): NodeListOf; - getElementsByTagName(name: "nobr"): NodeListOf; + getElementsByTagName(name: "nextid"): NodeListOf; + getElementsByTagName(name: "nobr"): NodeListOf; getElementsByTagName(name: "noframes"): NodeListOf; getElementsByTagName(name: "noscript"): NodeListOf; getElementsByTagName(name: "object"): NodeListOf; @@ -3126,7 +3604,8 @@ interface Element extends Node, GlobalEventHandlers, ElementTraversal, NodeSelec getElementsByTagName(name: "param"): NodeListOf; getElementsByTagName(name: "path"): NodeListOf; getElementsByTagName(name: "pattern"): NodeListOf; - getElementsByTagName(name: "plaintext"): NodeListOf; + getElementsByTagName(name: "picture"): NodeListOf; + getElementsByTagName(name: "plaintext"): NodeListOf; getElementsByTagName(name: "polygon"): NodeListOf; getElementsByTagName(name: "polyline"): NodeListOf; getElementsByTagName(name: "pre"): NodeListOf; @@ -3134,28 +3613,29 @@ interface Element extends Node, GlobalEventHandlers, ElementTraversal, NodeSelec getElementsByTagName(name: "q"): NodeListOf; getElementsByTagName(name: "radialgradient"): NodeListOf; getElementsByTagName(name: "rect"): NodeListOf; - getElementsByTagName(name: "rt"): NodeListOf; - getElementsByTagName(name: "ruby"): NodeListOf; - getElementsByTagName(name: "s"): NodeListOf; - getElementsByTagName(name: "samp"): NodeListOf; + getElementsByTagName(name: "rt"): NodeListOf; + getElementsByTagName(name: "ruby"): NodeListOf; + getElementsByTagName(name: "s"): NodeListOf; + getElementsByTagName(name: "samp"): NodeListOf; getElementsByTagName(name: "script"): NodeListOf; getElementsByTagName(name: "section"): NodeListOf; getElementsByTagName(name: "select"): NodeListOf; - getElementsByTagName(name: "small"): NodeListOf; + getElementsByTagName(name: "small"): NodeListOf; getElementsByTagName(name: "source"): NodeListOf; getElementsByTagName(name: "span"): NodeListOf; getElementsByTagName(name: "stop"): NodeListOf; - getElementsByTagName(name: "strike"): NodeListOf; - getElementsByTagName(name: "strong"): NodeListOf; + getElementsByTagName(name: "strike"): NodeListOf; + getElementsByTagName(name: "strong"): NodeListOf; getElementsByTagName(name: "style"): NodeListOf; - getElementsByTagName(name: "sub"): NodeListOf; - getElementsByTagName(name: "sup"): NodeListOf; + getElementsByTagName(name: "sub"): NodeListOf; + getElementsByTagName(name: "sup"): NodeListOf; getElementsByTagName(name: "svg"): NodeListOf; getElementsByTagName(name: "switch"): NodeListOf; getElementsByTagName(name: "symbol"): NodeListOf; getElementsByTagName(name: "table"): NodeListOf; getElementsByTagName(name: "tbody"): NodeListOf; getElementsByTagName(name: "td"): NodeListOf; + getElementsByTagName(name: "template"): NodeListOf; getElementsByTagName(name: "text"): NodeListOf; getElementsByTagName(name: "textpath"): NodeListOf; getElementsByTagName(name: "textarea"): NodeListOf; @@ -3166,16 +3646,16 @@ interface Element extends Node, GlobalEventHandlers, ElementTraversal, NodeSelec getElementsByTagName(name: "tr"): NodeListOf; getElementsByTagName(name: "track"): NodeListOf; getElementsByTagName(name: "tspan"): NodeListOf; - getElementsByTagName(name: "tt"): NodeListOf; - getElementsByTagName(name: "u"): NodeListOf; + getElementsByTagName(name: "tt"): NodeListOf; + getElementsByTagName(name: "u"): NodeListOf; getElementsByTagName(name: "ul"): NodeListOf; getElementsByTagName(name: "use"): NodeListOf; - getElementsByTagName(name: "var"): NodeListOf; + getElementsByTagName(name: "var"): NodeListOf; getElementsByTagName(name: "video"): NodeListOf; getElementsByTagName(name: "view"): NodeListOf; getElementsByTagName(name: "wbr"): NodeListOf; getElementsByTagName(name: "x-ms-webview"): NodeListOf; - getElementsByTagName(name: "xmp"): NodeListOf; + getElementsByTagName(name: "xmp"): NodeListOf; getElementsByTagName(name: string): NodeListOf; getElementsByTagNameNS(namespaceURI: string, localName: string): NodeListOf; hasAttribute(name: string): boolean; @@ -3248,11 +3728,11 @@ declare var Element: { } interface ErrorEvent extends Event { - colno: number; - error: any; - filename: string; - lineno: number; - message: string; + readonly colno: number; + readonly error: any; + readonly filename: string; + readonly lineno: number; + readonly message: string; initErrorEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, messageArg: string, filenameArg: string, linenoArg: number): void; } @@ -3262,39 +3742,39 @@ declare var ErrorEvent: { } interface Event { - bubbles: boolean; + readonly bubbles: boolean; cancelBubble: boolean; - cancelable: boolean; - currentTarget: EventTarget; - defaultPrevented: boolean; - eventPhase: number; - isTrusted: boolean; + readonly cancelable: boolean; + readonly currentTarget: EventTarget; + readonly defaultPrevented: boolean; + readonly eventPhase: number; + readonly isTrusted: boolean; returnValue: boolean; - srcElement: Element; - target: EventTarget; - timeStamp: number; - type: string; + readonly srcElement: Element; + readonly target: EventTarget; + readonly timeStamp: number; + readonly type: string; initEvent(eventTypeArg: string, canBubbleArg: boolean, cancelableArg: boolean): void; preventDefault(): void; stopImmediatePropagation(): void; stopPropagation(): void; - AT_TARGET: number; - BUBBLING_PHASE: number; - CAPTURING_PHASE: number; + readonly AT_TARGET: number; + readonly BUBBLING_PHASE: number; + readonly CAPTURING_PHASE: number; } declare var Event: { prototype: Event; new(type: string, eventInitDict?: EventInit): Event; - AT_TARGET: number; - BUBBLING_PHASE: number; - CAPTURING_PHASE: number; + readonly AT_TARGET: number; + readonly BUBBLING_PHASE: number; + readonly CAPTURING_PHASE: number; } interface EventTarget { - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; + addEventListener(type: string, listener?: EventListenerOrEventListenerObject, useCapture?: boolean): void; dispatchEvent(evt: Event): boolean; - removeEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; + removeEventListener(type: string, listener?: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var EventTarget: { @@ -3311,8 +3791,9 @@ declare var External: { } interface File extends Blob { - lastModifiedDate: any; - name: string; + readonly lastModifiedDate: any; + readonly name: string; + readonly webkitRelativePath: string; } declare var File: { @@ -3321,7 +3802,7 @@ declare var File: { } interface FileList { - length: number; + readonly length: number; item(index: number): File; [index: number]: File; } @@ -3332,7 +3813,7 @@ declare var FileList: { } interface FileReader extends EventTarget, MSBaseReader { - error: DOMError; + readonly error: DOMError; readAsArrayBuffer(blob: Blob): void; readAsBinaryString(blob: Blob): void; readAsDataURL(blob: Blob): void; @@ -3346,7 +3827,7 @@ declare var FileReader: { } interface FocusEvent extends UIEvent { - relatedTarget: EventTarget; + readonly relatedTarget: EventTarget; initFocusEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, relatedTargetArg: EventTarget): void; } @@ -3365,7 +3846,7 @@ declare var FormData: { } interface GainNode extends AudioNode { - gain: AudioParam; + readonly gain: AudioParam; } declare var GainNode: { @@ -3374,13 +3855,13 @@ declare var GainNode: { } interface Gamepad { - axes: number[]; - buttons: GamepadButton[]; - connected: boolean; - id: string; - index: number; - mapping: string; - timestamp: number; + readonly axes: number[]; + readonly buttons: GamepadButton[]; + readonly connected: boolean; + readonly id: string; + readonly index: number; + readonly mapping: string; + readonly timestamp: number; } declare var Gamepad: { @@ -3389,8 +3870,8 @@ declare var Gamepad: { } interface GamepadButton { - pressed: boolean; - value: number; + readonly pressed: boolean; + readonly value: number; } declare var GamepadButton: { @@ -3399,7 +3880,7 @@ declare var GamepadButton: { } interface GamepadEvent extends Event { - gamepad: Gamepad; + readonly gamepad: Gamepad; } declare var GamepadEvent: { @@ -3437,6 +3918,7 @@ interface HTMLAnchorElement extends HTMLElement { * Sets or retrieves the coordinates of the object. */ coords: string; + download: string; /** * Contains the anchor portion of the URL including the hash sign (#). */ @@ -3457,12 +3939,12 @@ interface HTMLAnchorElement extends HTMLElement { * Sets or retrieves the language code of the object. */ hreflang: string; - mimeType: string; + readonly mimeType: string; /** * Sets or retrieves the shape of the object. */ name: string; - nameProp: string; + readonly nameProp: string; /** * Contains the pathname of the URL. */ @@ -3475,7 +3957,7 @@ interface HTMLAnchorElement extends HTMLElement { * Contains the protocol of the URL. */ protocol: string; - protocolLong: string; + readonly protocolLong: string; /** * Sets or retrieves the relationship between the object and the destination of the link. */ @@ -3517,7 +3999,7 @@ interface HTMLAppletElement extends HTMLElement { /** * 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. */ - BaseHref: string; + readonly BaseHref: string; align: string; /** * Sets or retrieves a text alternative to the graphic. @@ -3544,7 +4026,7 @@ interface HTMLAppletElement extends HTMLElement { /** * Address of a pointer to the document this page or frame contains. If there is no document, then null will be returned. */ - contentDocument: Document; + readonly contentDocument: Document; /** * Sets or retrieves the URL that references the data of the object. */ @@ -3553,7 +4035,7 @@ interface HTMLAppletElement extends HTMLElement { * Sets or retrieves a character string that can be used to implement your own declare functionality for the object. */ declare: boolean; - form: HTMLFormElement; + readonly form: HTMLFormElement; /** * Sets or retrieves the height of the object. */ @@ -3594,6 +4076,7 @@ interface HTMLAreaElement extends HTMLElement { * Sets or retrieves the coordinates of the object. */ coords: string; + download: string; /** * Sets or retrieves the subsection of the href property that follows the number sign (#). */ @@ -3719,23 +4202,6 @@ declare var HTMLBaseFontElement: { new(): HTMLBaseFontElement; } -interface HTMLBlockElement extends HTMLElement { - /** - * Sets or retrieves reference information about the object. - */ - cite: string; - clear: string; - /** - * Sets or retrieves the width of the object. - */ - width: number; -} - -declare var HTMLBlockElement: { - prototype: HTMLBlockElement; - new(): HTMLBlockElement; -} - interface HTMLBodyElement extends HTMLElement { aLink: any; background: string; @@ -3763,7 +4229,6 @@ interface HTMLBodyElement extends HTMLElement { onunload: (ev: Event) => any; text: any; vLink: any; - createTextRange(): TextRange; addEventListener(type: "MSContentZoom", listener: (ev: UIEvent) => any, useCapture?: boolean): void; addEventListener(type: "MSGestureChange", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void; addEventListener(type: "MSGestureDoubleTap", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void; @@ -3788,10 +4253,10 @@ interface HTMLBodyElement extends HTMLElement { addEventListener(type: "afterprint", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "ariarequest", listener: (ev: AriaRequestEvent) => any, useCapture?: boolean): void; addEventListener(type: "beforeactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecopy", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecut", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforecopy", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforecut", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "beforedeactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforepaste", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforepaste", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "beforeprint", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "beforeunload", listener: (ev: BeforeUnloadEvent) => any, useCapture?: boolean): void; addEventListener(type: "blur", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; @@ -3802,9 +4267,9 @@ interface HTMLBodyElement extends HTMLElement { addEventListener(type: "click", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "command", listener: (ev: CommandEvent) => any, useCapture?: boolean): void; addEventListener(type: "contextmenu", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "copy", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "copy", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "cuechange", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "cut", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "cut", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "dblclick", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "deactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; addEventListener(type: "drag", listener: (ev: DragEvent) => any, useCapture?: boolean): void; @@ -3816,7 +4281,7 @@ interface HTMLBodyElement extends HTMLElement { addEventListener(type: "drop", listener: (ev: DragEvent) => any, useCapture?: boolean): void; addEventListener(type: "durationchange", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "emptied", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "ended", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "ended", listener: (ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: "focus", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; @@ -3824,6 +4289,7 @@ interface HTMLBodyElement extends HTMLElement { addEventListener(type: "gotpointercapture", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; addEventListener(type: "hashchange", listener: (ev: HashChangeEvent) => any, useCapture?: boolean): void; addEventListener(type: "input", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "invalid", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "keydown", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "keypress", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "keyup", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; @@ -3841,13 +4307,13 @@ interface HTMLBodyElement extends HTMLElement { addEventListener(type: "mouseout", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "mouseover", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "mouseup", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousewheel", listener: (ev: MouseWheelEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mousewheel", listener: (ev: WheelEvent) => any, useCapture?: boolean): void; addEventListener(type: "offline", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "online", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "orientationchange", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "pagehide", listener: (ev: PageTransitionEvent) => any, useCapture?: boolean): void; addEventListener(type: "pageshow", listener: (ev: PageTransitionEvent) => any, useCapture?: boolean): void; - addEventListener(type: "paste", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "paste", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "pause", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "play", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "playing", listener: (ev: Event) => any, useCapture?: boolean): void; @@ -3901,7 +4367,7 @@ interface HTMLButtonElement extends HTMLElement { /** * Retrieves a reference to the form that the object is embedded in. */ - form: HTMLFormElement; + readonly form: HTMLFormElement; /** * Overrides the action attribute (where the data on a form is sent) on the parent form element. */ @@ -3934,11 +4400,11 @@ interface HTMLButtonElement extends HTMLElement { /** * 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. */ - validationMessage: string; + readonly validationMessage: string; /** * Returns a ValidityState object that represents the validity states of an element. */ - validity: ValidityState; + readonly validity: ValidityState; /** * Sets or retrieves the default or selected value of the control. */ @@ -3946,15 +4412,11 @@ interface HTMLButtonElement extends HTMLElement { /** * Returns whether an element will successfully validate based on forms validation rules and constraints. */ - willValidate: boolean; + readonly willValidate: boolean; /** * Returns whether a form will validate when it is submitted, without having to submit it. */ checkValidity(): boolean; - /** - * Creates a TextRange object for the element. - */ - createTextRange(): TextRange; /** * Sets a custom error message that is displayed when a form is submitted. * @param error Sets a custom error message that is displayed when a form is submitted. @@ -4004,11 +4466,11 @@ interface HTMLCollection { /** * Sets or retrieves the number of objects in a collection. */ - length: number; + readonly length: number; /** * Retrieves an object from various collections. */ - item(nameOrIndex?: any, optionalIndex?: any): Element; + item(index: number): Element; /** * Retrieves a select object or an object from an options collection. */ @@ -4021,18 +4483,6 @@ declare var HTMLCollection: { new(): HTMLCollection; } -interface HTMLDDElement extends HTMLElement { - /** - * Sets or retrieves whether the browser automatically performs wordwrap. - */ - noWrap: boolean; -} - -declare var HTMLDDElement: { - prototype: HTMLDDElement; - new(): HTMLDDElement; -} - interface HTMLDListElement extends HTMLElement { compact: boolean; } @@ -4042,20 +4492,8 @@ declare var HTMLDListElement: { new(): HTMLDListElement; } -interface HTMLDTElement extends HTMLElement { - /** - * Sets or retrieves whether the browser automatically performs wordwrap. - */ - noWrap: boolean; -} - -declare var HTMLDTElement: { - prototype: HTMLDTElement; - new(): HTMLDTElement; -} - interface HTMLDataListElement extends HTMLElement { - options: HTMLCollection; + options: HTMLCollectionOf; } declare var HTMLDataListElement: { @@ -4098,38 +4536,38 @@ declare var HTMLDocument: { interface HTMLElement extends Element { accessKey: string; - children: HTMLCollection; + readonly children: HTMLCollection; contentEditable: string; - dataset: DOMStringMap; + readonly dataset: DOMStringMap; dir: string; draggable: boolean; hidden: boolean; hideFocus: boolean; innerHTML: string; innerText: string; - isContentEditable: boolean; + readonly isContentEditable: boolean; lang: string; - offsetHeight: number; - offsetLeft: number; - offsetParent: Element; - offsetTop: number; - offsetWidth: number; + readonly offsetHeight: number; + readonly offsetLeft: number; + readonly offsetParent: Element; + readonly offsetTop: number; + readonly offsetWidth: number; onabort: (ev: Event) => any; onactivate: (ev: UIEvent) => any; onbeforeactivate: (ev: UIEvent) => any; - onbeforecopy: (ev: DragEvent) => any; - onbeforecut: (ev: DragEvent) => any; + onbeforecopy: (ev: ClipboardEvent) => any; + onbeforecut: (ev: ClipboardEvent) => any; onbeforedeactivate: (ev: UIEvent) => any; - onbeforepaste: (ev: DragEvent) => any; + onbeforepaste: (ev: ClipboardEvent) => any; onblur: (ev: FocusEvent) => any; oncanplay: (ev: Event) => any; oncanplaythrough: (ev: Event) => any; onchange: (ev: Event) => any; onclick: (ev: MouseEvent) => any; oncontextmenu: (ev: PointerEvent) => any; - oncopy: (ev: DragEvent) => any; + oncopy: (ev: ClipboardEvent) => any; oncuechange: (ev: Event) => any; - oncut: (ev: DragEvent) => any; + oncut: (ev: ClipboardEvent) => any; ondblclick: (ev: MouseEvent) => any; ondeactivate: (ev: UIEvent) => any; ondrag: (ev: DragEvent) => any; @@ -4141,10 +4579,11 @@ interface HTMLElement extends Element { ondrop: (ev: DragEvent) => any; ondurationchange: (ev: Event) => any; onemptied: (ev: Event) => any; - onended: (ev: Event) => any; + onended: (ev: MediaStreamErrorEvent) => any; onerror: (ev: Event) => any; onfocus: (ev: FocusEvent) => any; oninput: (ev: Event) => any; + oninvalid: (ev: Event) => any; onkeydown: (ev: KeyboardEvent) => any; onkeypress: (ev: KeyboardEvent) => any; onkeyup: (ev: KeyboardEvent) => any; @@ -4159,10 +4598,10 @@ interface HTMLElement extends Element { onmouseout: (ev: MouseEvent) => any; onmouseover: (ev: MouseEvent) => any; onmouseup: (ev: MouseEvent) => any; - onmousewheel: (ev: MouseWheelEvent) => any; + onmousewheel: (ev: WheelEvent) => any; onmscontentzoom: (ev: UIEvent) => any; onmsmanipulationstatechanged: (ev: MSManipulationEvent) => any; - onpaste: (ev: DragEvent) => any; + onpaste: (ev: ClipboardEvent) => any; onpause: (ev: Event) => any; onplay: (ev: Event) => any; onplaying: (ev: Event) => any; @@ -4183,7 +4622,7 @@ interface HTMLElement extends Element { outerHTML: string; outerText: string; spellcheck: boolean; - style: CSSStyleDeclaration; + readonly style: CSSStyleDeclaration; tabIndex: number; title: string; blur(): void; @@ -4219,10 +4658,10 @@ interface HTMLElement extends Element { addEventListener(type: "activate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; addEventListener(type: "ariarequest", listener: (ev: AriaRequestEvent) => any, useCapture?: boolean): void; addEventListener(type: "beforeactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecopy", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecut", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforecopy", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforecut", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "beforedeactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforepaste", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforepaste", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "blur", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; addEventListener(type: "canplay", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "canplaythrough", listener: (ev: Event) => any, useCapture?: boolean): void; @@ -4230,9 +4669,9 @@ interface HTMLElement extends Element { addEventListener(type: "click", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "command", listener: (ev: CommandEvent) => any, useCapture?: boolean): void; addEventListener(type: "contextmenu", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "copy", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "copy", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "cuechange", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "cut", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "cut", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "dblclick", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "deactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; addEventListener(type: "drag", listener: (ev: DragEvent) => any, useCapture?: boolean): void; @@ -4244,11 +4683,12 @@ interface HTMLElement extends Element { addEventListener(type: "drop", listener: (ev: DragEvent) => any, useCapture?: boolean): void; addEventListener(type: "durationchange", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "emptied", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "ended", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "ended", listener: (ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: "focus", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; addEventListener(type: "gotpointercapture", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; addEventListener(type: "input", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "invalid", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "keydown", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "keypress", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "keyup", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; @@ -4264,8 +4704,8 @@ interface HTMLElement extends Element { addEventListener(type: "mouseout", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "mouseover", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "mouseup", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousewheel", listener: (ev: MouseWheelEvent) => any, useCapture?: boolean): void; - addEventListener(type: "paste", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mousewheel", listener: (ev: WheelEvent) => any, useCapture?: boolean): void; + addEventListener(type: "paste", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "pause", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "play", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "playing", listener: (ev: Event) => any, useCapture?: boolean): void; @@ -4327,7 +4767,7 @@ interface HTMLEmbedElement extends HTMLElement, GetSVGDocument { /** * Gets the source associated with the media element for use by the PlayToManager. */ - msPlayToSource: any; + readonly msPlayToSource: any; /** * Sets or retrieves the name of the object. */ @@ -4335,12 +4775,12 @@ interface HTMLEmbedElement extends HTMLElement, GetSVGDocument { /** * Retrieves the palette used for the embedded document. */ - palette: string; + readonly palette: string; /** * Retrieves the URL of the plug-in used to view an embedded document. */ - pluginspage: string; - readyState: string; + readonly pluginspage: string; + readonly readyState: string; /** * Sets or retrieves a URL to be loaded by the object. */ @@ -4370,19 +4810,19 @@ interface HTMLFieldSetElement extends HTMLElement { /** * Retrieves a reference to the form that the object is embedded in. */ - form: HTMLFormElement; + readonly form: HTMLFormElement; /** * 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. */ - validationMessage: string; + readonly validationMessage: string; /** * Returns a ValidityState object that represents the validity states of an element. */ - validity: ValidityState; + readonly validity: ValidityState; /** * Returns whether an element will successfully validate based on forms validation rules and constraints. */ - willValidate: boolean; + readonly willValidate: boolean; /** * Returns whether a form will validate when it is submitted, without having to submit it. */ @@ -4428,7 +4868,7 @@ interface HTMLFormElement extends HTMLElement { /** * Retrieves a collection, in source order, of all controls in a given form. */ - elements: HTMLCollection; + readonly elements: HTMLCollection; /** * Sets or retrieves the MIME encoding for the form. */ @@ -4440,7 +4880,7 @@ interface HTMLFormElement extends HTMLElement { /** * Sets or retrieves the number of objects in a collection. */ - length: number; + readonly length: number; /** * Sets or retrieves how to send the form data to the server. */ @@ -4499,11 +4939,11 @@ interface HTMLFrameElement extends HTMLElement, GetSVGDocument { /** * Retrieves the document object of the page or frame. */ - contentDocument: Document; + readonly contentDocument: Document; /** * Retrieves the object of the specified. */ - contentWindow: Window; + readonly contentWindow: Window; /** * Sets or retrieves whether to display a border for the frame. */ @@ -4544,10 +4984,6 @@ interface HTMLFrameElement extends HTMLElement, GetSVGDocument { * Sets or retrieves whether the frame can be scrolled. */ scrolling: string; - /** - * Sets the value indicating whether the source file of a frame or iframe has specific security restrictions applied. - */ - security: any; /** * Sets or retrieves a URL to be loaded by the object. */ @@ -4579,10 +5015,10 @@ interface HTMLFrameElement extends HTMLElement, GetSVGDocument { addEventListener(type: "activate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; addEventListener(type: "ariarequest", listener: (ev: AriaRequestEvent) => any, useCapture?: boolean): void; addEventListener(type: "beforeactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecopy", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecut", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforecopy", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforecut", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "beforedeactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforepaste", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforepaste", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "blur", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; addEventListener(type: "canplay", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "canplaythrough", listener: (ev: Event) => any, useCapture?: boolean): void; @@ -4590,9 +5026,9 @@ interface HTMLFrameElement extends HTMLElement, GetSVGDocument { addEventListener(type: "click", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "command", listener: (ev: CommandEvent) => any, useCapture?: boolean): void; addEventListener(type: "contextmenu", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "copy", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "copy", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "cuechange", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "cut", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "cut", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "dblclick", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "deactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; addEventListener(type: "drag", listener: (ev: DragEvent) => any, useCapture?: boolean): void; @@ -4604,11 +5040,12 @@ interface HTMLFrameElement extends HTMLElement, GetSVGDocument { addEventListener(type: "drop", listener: (ev: DragEvent) => any, useCapture?: boolean): void; addEventListener(type: "durationchange", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "emptied", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "ended", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "ended", listener: (ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: "focus", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; addEventListener(type: "gotpointercapture", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; addEventListener(type: "input", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "invalid", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "keydown", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "keypress", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "keyup", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; @@ -4625,8 +5062,8 @@ interface HTMLFrameElement extends HTMLElement, GetSVGDocument { addEventListener(type: "mouseout", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "mouseover", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "mouseup", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousewheel", listener: (ev: MouseWheelEvent) => any, useCapture?: boolean): void; - addEventListener(type: "paste", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mousewheel", listener: (ev: WheelEvent) => any, useCapture?: boolean): void; + addEventListener(type: "paste", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "pause", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "play", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "playing", listener: (ev: Event) => any, useCapture?: boolean): void; @@ -4736,10 +5173,10 @@ interface HTMLFrameSetElement extends HTMLElement { addEventListener(type: "activate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; addEventListener(type: "ariarequest", listener: (ev: AriaRequestEvent) => any, useCapture?: boolean): void; addEventListener(type: "beforeactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecopy", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecut", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforecopy", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforecut", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "beforedeactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforepaste", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforepaste", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "beforeprint", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "beforeunload", listener: (ev: BeforeUnloadEvent) => any, useCapture?: boolean): void; addEventListener(type: "blur", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; @@ -4750,9 +5187,9 @@ interface HTMLFrameSetElement extends HTMLElement { addEventListener(type: "click", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "command", listener: (ev: CommandEvent) => any, useCapture?: boolean): void; addEventListener(type: "contextmenu", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "copy", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "copy", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "cuechange", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "cut", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "cut", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "dblclick", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "deactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; addEventListener(type: "drag", listener: (ev: DragEvent) => any, useCapture?: boolean): void; @@ -4764,7 +5201,7 @@ interface HTMLFrameSetElement extends HTMLElement { addEventListener(type: "drop", listener: (ev: DragEvent) => any, useCapture?: boolean): void; addEventListener(type: "durationchange", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "emptied", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "ended", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "ended", listener: (ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: "focus", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; @@ -4772,6 +5209,7 @@ interface HTMLFrameSetElement extends HTMLElement { addEventListener(type: "gotpointercapture", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; addEventListener(type: "hashchange", listener: (ev: HashChangeEvent) => any, useCapture?: boolean): void; addEventListener(type: "input", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "invalid", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "keydown", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "keypress", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "keyup", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; @@ -4789,13 +5227,13 @@ interface HTMLFrameSetElement extends HTMLElement { addEventListener(type: "mouseout", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "mouseover", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "mouseup", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousewheel", listener: (ev: MouseWheelEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mousewheel", listener: (ev: WheelEvent) => any, useCapture?: boolean): void; addEventListener(type: "offline", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "online", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "orientationchange", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "pagehide", listener: (ev: PageTransitionEvent) => any, useCapture?: boolean): void; addEventListener(type: "pageshow", listener: (ev: PageTransitionEvent) => any, useCapture?: boolean): void; - addEventListener(type: "paste", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "paste", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "pause", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "play", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "playing", listener: (ev: Event) => any, useCapture?: boolean): void; @@ -4874,7 +5312,6 @@ interface HTMLHeadingElement extends HTMLElement { * Sets or retrieves a value that indicates the table alignment. */ align: string; - clear: string; } declare var HTMLHeadingElement: { @@ -4907,11 +5344,11 @@ interface HTMLIFrameElement extends HTMLElement, GetSVGDocument { /** * Retrieves the document object of the page or frame. */ - contentDocument: Document; + readonly contentDocument: Document; /** * Retrieves the object of the specified. */ - contentWindow: Window; + readonly contentWindow: Window; /** * Sets or retrieves whether to display a border for the frame. */ @@ -4952,15 +5389,11 @@ interface HTMLIFrameElement extends HTMLElement, GetSVGDocument { * Raised when the object has been completely received from the server. */ onload: (ev: Event) => any; - sandbox: DOMSettableTokenList; + readonly sandbox: DOMSettableTokenList; /** * Sets or retrieves whether the frame can be scrolled. */ scrolling: string; - /** - * Sets the value indicating whether the source file of a frame or iframe has specific security restrictions applied. - */ - security: any; /** * Sets or retrieves a URL to be loaded by the object. */ @@ -4996,10 +5429,10 @@ interface HTMLIFrameElement extends HTMLElement, GetSVGDocument { addEventListener(type: "activate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; addEventListener(type: "ariarequest", listener: (ev: AriaRequestEvent) => any, useCapture?: boolean): void; addEventListener(type: "beforeactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecopy", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecut", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforecopy", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforecut", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "beforedeactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforepaste", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforepaste", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "blur", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; addEventListener(type: "canplay", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "canplaythrough", listener: (ev: Event) => any, useCapture?: boolean): void; @@ -5007,9 +5440,9 @@ interface HTMLIFrameElement extends HTMLElement, GetSVGDocument { addEventListener(type: "click", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "command", listener: (ev: CommandEvent) => any, useCapture?: boolean): void; addEventListener(type: "contextmenu", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "copy", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "copy", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "cuechange", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "cut", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "cut", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "dblclick", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "deactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; addEventListener(type: "drag", listener: (ev: DragEvent) => any, useCapture?: boolean): void; @@ -5021,11 +5454,12 @@ interface HTMLIFrameElement extends HTMLElement, GetSVGDocument { addEventListener(type: "drop", listener: (ev: DragEvent) => any, useCapture?: boolean): void; addEventListener(type: "durationchange", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "emptied", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "ended", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "ended", listener: (ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: "focus", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; addEventListener(type: "gotpointercapture", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; addEventListener(type: "input", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "invalid", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "keydown", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "keypress", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "keyup", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; @@ -5042,8 +5476,8 @@ interface HTMLIFrameElement extends HTMLElement, GetSVGDocument { addEventListener(type: "mouseout", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "mouseover", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "mouseup", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousewheel", listener: (ev: MouseWheelEvent) => any, useCapture?: boolean): void; - addEventListener(type: "paste", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mousewheel", listener: (ev: WheelEvent) => any, useCapture?: boolean): void; + addEventListener(type: "paste", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "pause", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "play", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "playing", listener: (ev: Event) => any, useCapture?: boolean): void; @@ -5100,9 +5534,9 @@ interface HTMLImageElement extends HTMLElement { /** * Retrieves whether the object is fully loaded. */ - complete: boolean; + readonly complete: boolean; crossOrigin: string; - currentSrc: string; + readonly currentSrc: string; /** * Sets or retrieves the height of the object. */ @@ -5119,6 +5553,7 @@ interface HTMLImageElement extends HTMLElement { * Sets or retrieves a Uniform Resource Identifier (URI) to a long description of the object. */ longDesc: string; + lowsrc: string; /** * Gets or sets whether the DLNA PlayTo device is available. */ @@ -5131,7 +5566,7 @@ interface HTMLImageElement extends HTMLElement { /** * Gets the source associated with the media element for use by the PlayToManager. */ - msPlayToSource: any; + readonly msPlayToSource: any; /** * Sets or retrieves the name of the object. */ @@ -5139,11 +5574,12 @@ interface HTMLImageElement extends HTMLElement { /** * The original height of the image resource before sizing. */ - naturalHeight: number; + readonly naturalHeight: number; /** * The original width of the image resource before sizing. */ - naturalWidth: number; + readonly naturalWidth: number; + sizes: string; /** * The address or URL of the a media resource that is to be considered. */ @@ -5161,8 +5597,8 @@ interface HTMLImageElement extends HTMLElement { * Sets or retrieves the width of the object. */ width: number; - x: number; - y: number; + readonly x: number; + readonly y: number; msGetAsCastingSource(): any; } @@ -5204,7 +5640,7 @@ interface HTMLInputElement extends HTMLElement { /** * Retrieves whether the object is fully loaded. */ - complete: boolean; + readonly complete: boolean; /** * Sets or retrieves the state of the check box or radio button. */ @@ -5217,11 +5653,11 @@ interface HTMLInputElement extends HTMLElement { /** * Returns a FileList object on a file type input object. */ - files: FileList; + readonly files: FileList; /** * Retrieves a reference to the form that the object is embedded in. */ - form: HTMLFormElement; + readonly form: HTMLFormElement; /** * Overrides the action attribute (where the data on a form is sent) on the parent form element. */ @@ -5254,7 +5690,7 @@ interface HTMLInputElement extends HTMLElement { /** * Specifies the ID of a pre-defined datalist of options for an input element. */ - list: HTMLElement; + readonly list: HTMLElement; /** * 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. */ @@ -5288,6 +5724,7 @@ interface HTMLInputElement extends HTMLElement { * When present, marks an element that can't be submitted without a value. */ required: boolean; + selectionDirection: string; /** * Gets or sets the end position or offset of a text selection. */ @@ -5317,11 +5754,11 @@ interface HTMLInputElement extends HTMLElement { /** * 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. */ - validationMessage: string; + readonly validationMessage: string; /** * Returns a ValidityState object that represents the validity states of an element. */ - validity: ValidityState; + readonly validity: ValidityState; /** * Returns the value of the data at the cursor's current position. */ @@ -5335,6 +5772,7 @@ interface HTMLInputElement extends HTMLElement { * Sets or retrieves the vertical margin for the object. */ vspace: number; + webkitdirectory: boolean; /** * Sets or retrieves the width of the object. */ @@ -5342,15 +5780,12 @@ interface HTMLInputElement extends HTMLElement { /** * Returns whether an element will successfully validate based on forms validation rules and constraints. */ - willValidate: boolean; + readonly willValidate: boolean; + minLength: number; /** * Returns whether a form will validate when it is submitted, without having to submit it. */ checkValidity(): boolean; - /** - * Creates a TextRange object for the element. - */ - createTextRange(): TextRange; /** * Makes the selection equal to the current object. */ @@ -5365,7 +5800,7 @@ interface HTMLInputElement extends HTMLElement { * @param start The offset into the text field for the start of the selection. * @param end The offset into the text field for the end of the selection. */ - setSelectionRange(start: number, end: number): void; + setSelectionRange(start?: number, end?: number, direction?: string): void; /** * 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. * @param n Value to decrement the value by. @@ -5383,23 +5818,6 @@ declare var HTMLInputElement: { new(): HTMLInputElement; } -interface HTMLIsIndexElement extends HTMLElement { - /** - * Sets or retrieves the URL to which the form content is sent for processing. - */ - action: string; - /** - * Retrieves a reference to the form that the object is embedded in. - */ - form: HTMLFormElement; - prompt: string; -} - -declare var HTMLIsIndexElement: { - prototype: HTMLIsIndexElement; - new(): HTMLIsIndexElement; -} - interface HTMLLIElement extends HTMLElement { type: string; /** @@ -5417,7 +5835,7 @@ interface HTMLLabelElement extends HTMLElement { /** * Retrieves a reference to the form that the object is embedded in. */ - form: HTMLFormElement; + readonly form: HTMLFormElement; /** * Sets or retrieves the object to which the given label object is assigned. */ @@ -5437,7 +5855,7 @@ interface HTMLLegendElement extends HTMLElement { /** * Retrieves a reference to the form that the object is embedded in. */ - form: HTMLFormElement; + readonly form: HTMLFormElement; } declare var HTMLLegendElement: { @@ -5479,6 +5897,7 @@ interface HTMLLinkElement extends HTMLElement, LinkStyle { * Sets or retrieves the MIME type of the object. */ type: string; + import?: Document; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -5491,7 +5910,7 @@ interface HTMLMapElement extends HTMLElement { /** * Retrieves a collection of the area objects defined for the given map object. */ - areas: HTMLAreasCollection; + readonly areas: HTMLAreasCollection; /** * Sets or retrieves the name of the object. */ @@ -5543,10 +5962,10 @@ interface HTMLMarqueeElement extends HTMLElement { addEventListener(type: "activate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; addEventListener(type: "ariarequest", listener: (ev: AriaRequestEvent) => any, useCapture?: boolean): void; addEventListener(type: "beforeactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecopy", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecut", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforecopy", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforecut", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "beforedeactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforepaste", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforepaste", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "blur", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; addEventListener(type: "bounce", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "canplay", listener: (ev: Event) => any, useCapture?: boolean): void; @@ -5555,9 +5974,9 @@ interface HTMLMarqueeElement extends HTMLElement { addEventListener(type: "click", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "command", listener: (ev: CommandEvent) => any, useCapture?: boolean): void; addEventListener(type: "contextmenu", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "copy", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "copy", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "cuechange", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "cut", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "cut", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "dblclick", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "deactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; addEventListener(type: "drag", listener: (ev: DragEvent) => any, useCapture?: boolean): void; @@ -5569,12 +5988,13 @@ interface HTMLMarqueeElement extends HTMLElement { addEventListener(type: "drop", listener: (ev: DragEvent) => any, useCapture?: boolean): void; addEventListener(type: "durationchange", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "emptied", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "ended", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "ended", listener: (ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: "finish", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "focus", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; addEventListener(type: "gotpointercapture", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; addEventListener(type: "input", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "invalid", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "keydown", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "keypress", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "keyup", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; @@ -5590,8 +6010,8 @@ interface HTMLMarqueeElement extends HTMLElement { addEventListener(type: "mouseout", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "mouseover", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "mouseup", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousewheel", listener: (ev: MouseWheelEvent) => any, useCapture?: boolean): void; - addEventListener(type: "paste", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mousewheel", listener: (ev: WheelEvent) => any, useCapture?: boolean): void; + addEventListener(type: "paste", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "pause", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "play", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "playing", listener: (ev: Event) => any, useCapture?: boolean): void; @@ -5637,7 +6057,7 @@ interface HTMLMediaElement extends HTMLElement { /** * Returns an AudioTrackList object with the audio tracks for a given video element. */ - audioTracks: AudioTrackList; + readonly audioTracks: AudioTrackList; /** * Gets or sets a value that indicates whether to start playing the media automatically. */ @@ -5645,15 +6065,16 @@ interface HTMLMediaElement extends HTMLElement { /** * Gets a collection of buffered time ranges. */ - buffered: TimeRanges; + readonly buffered: TimeRanges; /** * 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). */ controls: boolean; + crossOrigin: string; /** * Gets the address or URL of the current media resource that is selected by IHTMLMediaElement. */ - currentSrc: string; + readonly currentSrc: string; /** * Gets or sets the current playback position, in seconds. */ @@ -5666,19 +6087,20 @@ interface HTMLMediaElement extends HTMLElement { /** * 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. */ - duration: number; + readonly duration: number; /** * Gets information about whether the playback has ended or not. */ - ended: boolean; + readonly ended: boolean; /** * Returns an object representing the current error state of the audio or video element. */ - error: MediaError; + readonly error: MediaError; /** * Gets or sets a flag to specify whether playback should restart after it completes. */ loop: boolean; + readonly mediaKeys: MediaKeys; /** * Specifies the purpose of the audio or video media, such as background audio or alerts. */ @@ -5687,11 +6109,11 @@ interface HTMLMediaElement extends HTMLElement { * Specifies the output device id that the audio will be sent to. */ msAudioDeviceType: string; - msGraphicsTrustStatus: MSGraphicsTrust; + readonly msGraphicsTrustStatus: MSGraphicsTrust; /** * Gets the MSMediaKeys object, which is used for decrypting media data, that is associated with this media element. */ - msKeys: MSMediaKeys; + readonly msKeys: MSMediaKeys; /** * Gets or sets whether the DLNA PlayTo device is available. */ @@ -5707,7 +6129,7 @@ interface HTMLMediaElement extends HTMLElement { /** * Gets the source associated with the media element for use by the PlayToManager. */ - msPlayToSource: any; + readonly msPlayToSource: any; /** * Specifies whether or not to enable low-latency playback on the media element. */ @@ -5719,12 +6141,13 @@ interface HTMLMediaElement extends HTMLElement { /** * Gets the current network activity for the element. */ - networkState: number; + readonly networkState: number; + onencrypted: (ev: MediaEncryptedEvent) => any; onmsneedkey: (ev: MSMediaKeyNeededEvent) => any; /** * Gets a flag that specifies whether playback is paused. */ - paused: boolean; + readonly paused: boolean; /** * 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. */ @@ -5732,7 +6155,7 @@ interface HTMLMediaElement extends HTMLElement { /** * Gets TimeRanges for the current media resource that has been played. */ - played: TimeRanges; + readonly played: TimeRanges; /** * Gets or sets the current playback position, in seconds. */ @@ -5741,17 +6164,18 @@ interface HTMLMediaElement extends HTMLElement { /** * Returns a TimeRanges object that represents the ranges of the current media resource that can be seeked. */ - seekable: TimeRanges; + readonly seekable: TimeRanges; /** * Gets a flag that indicates whether the the client is currently moving to a new playback position in the media resource. */ - seeking: boolean; + readonly seeking: boolean; /** * The address or URL of the a media resource that is to be considered. */ src: string; - textTracks: TextTrackList; - videoTracks: VideoTrackList; + srcObject: MediaStream; + readonly textTracks: TextTrackList; + readonly videoTracks: VideoTrackList; /** * Gets or sets the volume level for audio portions of the media element. */ @@ -5787,15 +6211,16 @@ interface HTMLMediaElement extends HTMLElement { * Loads and starts playback of a media resource. */ play(): void; - HAVE_CURRENT_DATA: number; - HAVE_ENOUGH_DATA: number; - HAVE_FUTURE_DATA: number; - HAVE_METADATA: number; - HAVE_NOTHING: number; - NETWORK_EMPTY: number; - NETWORK_IDLE: number; - NETWORK_LOADING: number; - NETWORK_NO_SOURCE: number; + setMediaKeys(mediaKeys: MediaKeys): PromiseLike; + readonly HAVE_CURRENT_DATA: number; + readonly HAVE_ENOUGH_DATA: number; + readonly HAVE_FUTURE_DATA: number; + readonly HAVE_METADATA: number; + readonly HAVE_NOTHING: number; + readonly NETWORK_EMPTY: number; + readonly NETWORK_IDLE: number; + readonly NETWORK_LOADING: number; + readonly NETWORK_NO_SOURCE: number; addEventListener(type: "MSContentZoom", listener: (ev: UIEvent) => any, useCapture?: boolean): void; addEventListener(type: "MSGestureChange", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void; addEventListener(type: "MSGestureDoubleTap", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void; @@ -5819,10 +6244,10 @@ interface HTMLMediaElement extends HTMLElement { addEventListener(type: "activate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; addEventListener(type: "ariarequest", listener: (ev: AriaRequestEvent) => any, useCapture?: boolean): void; addEventListener(type: "beforeactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecopy", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecut", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforecopy", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforecut", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "beforedeactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforepaste", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforepaste", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "blur", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; addEventListener(type: "canplay", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "canplaythrough", listener: (ev: Event) => any, useCapture?: boolean): void; @@ -5830,9 +6255,9 @@ interface HTMLMediaElement extends HTMLElement { addEventListener(type: "click", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "command", listener: (ev: CommandEvent) => any, useCapture?: boolean): void; addEventListener(type: "contextmenu", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "copy", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "copy", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "cuechange", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "cut", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "cut", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "dblclick", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "deactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; addEventListener(type: "drag", listener: (ev: DragEvent) => any, useCapture?: boolean): void; @@ -5844,11 +6269,13 @@ interface HTMLMediaElement extends HTMLElement { addEventListener(type: "drop", listener: (ev: DragEvent) => any, useCapture?: boolean): void; addEventListener(type: "durationchange", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "emptied", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "ended", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "encrypted", listener: (ev: MediaEncryptedEvent) => any, useCapture?: boolean): void; + addEventListener(type: "ended", listener: (ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: "focus", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; addEventListener(type: "gotpointercapture", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; addEventListener(type: "input", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "invalid", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "keydown", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "keypress", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "keyup", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; @@ -5864,9 +6291,9 @@ interface HTMLMediaElement extends HTMLElement { addEventListener(type: "mouseout", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "mouseover", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "mouseup", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousewheel", listener: (ev: MouseWheelEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mousewheel", listener: (ev: WheelEvent) => any, useCapture?: boolean): void; addEventListener(type: "msneedkey", listener: (ev: MSMediaKeyNeededEvent) => any, useCapture?: boolean): void; - addEventListener(type: "paste", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "paste", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "pause", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "play", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "playing", listener: (ev: Event) => any, useCapture?: boolean): void; @@ -5905,15 +6332,15 @@ interface HTMLMediaElement extends HTMLElement { declare var HTMLMediaElement: { prototype: HTMLMediaElement; new(): HTMLMediaElement; - HAVE_CURRENT_DATA: number; - HAVE_ENOUGH_DATA: number; - HAVE_FUTURE_DATA: number; - HAVE_METADATA: number; - HAVE_NOTHING: number; - NETWORK_EMPTY: number; - NETWORK_IDLE: number; - NETWORK_LOADING: number; - NETWORK_NO_SOURCE: number; + readonly HAVE_CURRENT_DATA: number; + readonly HAVE_ENOUGH_DATA: number; + readonly HAVE_FUTURE_DATA: number; + readonly HAVE_METADATA: number; + readonly HAVE_NOTHING: number; + readonly NETWORK_EMPTY: number; + readonly NETWORK_IDLE: number; + readonly NETWORK_LOADING: number; + readonly NETWORK_NO_SOURCE: number; } interface HTMLMenuElement extends HTMLElement { @@ -5958,6 +6385,20 @@ declare var HTMLMetaElement: { new(): HTMLMetaElement; } +interface HTMLMeterElement extends HTMLElement { + high: number; + low: number; + max: number; + min: number; + optimum: number; + value: number; +} + +declare var HTMLMeterElement: { + prototype: HTMLMeterElement; + new(): HTMLMeterElement; +} + interface HTMLModElement extends HTMLElement { /** * Sets or retrieves reference information about the object. @@ -5974,15 +6415,6 @@ declare var HTMLModElement: { new(): HTMLModElement; } -interface HTMLNextIdElement extends HTMLElement { - n: string; -} - -declare var HTMLNextIdElement: { - prototype: HTMLNextIdElement; - new(): HTMLNextIdElement; -} - interface HTMLOListElement extends HTMLElement { compact: boolean; /** @@ -6001,7 +6433,7 @@ interface HTMLObjectElement extends HTMLElement, GetSVGDocument { /** * 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. */ - BaseHref: string; + readonly BaseHref: string; align: string; /** * Sets or retrieves a text alternative to the graphic. @@ -6031,7 +6463,7 @@ interface HTMLObjectElement extends HTMLElement, GetSVGDocument { /** * Retrieves the document object of the page or frame. */ - contentDocument: Document; + readonly contentDocument: Document; /** * Sets or retrieves the URL that references the data of the object. */ @@ -6040,7 +6472,7 @@ interface HTMLObjectElement extends HTMLElement, GetSVGDocument { /** * Retrieves a reference to the form that the object is embedded in. */ - form: HTMLFormElement; + readonly form: HTMLFormElement; /** * Sets or retrieves the height of the object. */ @@ -6061,7 +6493,7 @@ interface HTMLObjectElement extends HTMLElement, GetSVGDocument { /** * Gets the source associated with the media element for use by the PlayToManager. */ - msPlayToSource: any; + readonly msPlayToSource: any; /** * Sets or retrieves the name of the object. */ @@ -6069,8 +6501,8 @@ interface HTMLObjectElement extends HTMLElement, GetSVGDocument { /** * Retrieves the contained object. */ - object: any; - readyState: number; + readonly object: any; + readonly readyState: number; /** * Sets or retrieves a message to be displayed while an object is loading. */ @@ -6086,11 +6518,11 @@ interface HTMLObjectElement extends HTMLElement, GetSVGDocument { /** * 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. */ - validationMessage: string; + readonly validationMessage: string; /** * Returns a ValidityState object that represents the validity states of an element. */ - validity: ValidityState; + readonly validity: ValidityState; vspace: number; /** * Sets or retrieves the width of the object. @@ -6099,7 +6531,7 @@ interface HTMLObjectElement extends HTMLElement, GetSVGDocument { /** * Returns whether an element will successfully validate based on forms validation rules and constraints. */ - willValidate: boolean; + readonly willValidate: boolean; /** * Returns whether a form will validate when it is submitted, without having to submit it. */ @@ -6126,11 +6558,11 @@ interface HTMLOptGroupElement extends HTMLElement { /** * Retrieves a reference to the form that the object is embedded in. */ - form: HTMLFormElement; + readonly form: HTMLFormElement; /** * Sets or retrieves the ordinal position of an option in a list box. */ - index: number; + readonly index: number; /** * Sets or retrieves a value that you can use to implement your own label functionality for the object. */ @@ -6142,7 +6574,7 @@ interface HTMLOptGroupElement extends HTMLElement { /** * Sets or retrieves the text string specified by the option tag. */ - text: string; + readonly text: string; /** * Sets or retrieves the value which is returned to the server when the form control is submitted. */ @@ -6163,11 +6595,11 @@ interface HTMLOptionElement extends HTMLElement { /** * Retrieves a reference to the form that the object is embedded in. */ - form: HTMLFormElement; + readonly form: HTMLFormElement; /** * Sets or retrieves the ordinal position of an option in a list box. */ - index: number; + readonly index: number; /** * Sets or retrieves a value that you can use to implement your own label functionality for the object. */ @@ -6192,6 +6624,18 @@ declare var HTMLOptionElement: { create(): HTMLOptionElement; } +interface HTMLOptionsCollection extends HTMLCollection { + length: number; + selectedIndex: number; + add(element: HTMLOptionElement | HTMLOptGroupElement, before?: HTMLElement | number): void; + remove(index: number): void; +} + +declare var HTMLOptionsCollection: { + prototype: HTMLOptionsCollection; + new(): HTMLOptionsCollection; +} + interface HTMLParagraphElement extends HTMLElement { /** * Sets or retrieves how the object is aligned with adjacent text. @@ -6229,28 +6673,15 @@ declare var HTMLParamElement: { new(): HTMLParamElement; } -interface HTMLPhraseElement extends HTMLElement { - /** - * Sets or retrieves reference information about the object. - */ - cite: string; - /** - * Sets or retrieves the date and time of a modification to the object. - */ - dateTime: string; +interface HTMLPictureElement extends HTMLElement { } -declare var HTMLPhraseElement: { - prototype: HTMLPhraseElement; - new(): HTMLPhraseElement; +declare var HTMLPictureElement: { + prototype: HTMLPictureElement; + new(): HTMLPictureElement; } interface HTMLPreElement extends HTMLElement { - /** - * Indicates a citation by rendering text in italic type. - */ - cite: string; - clear: string; /** * Sets or gets a value that you can use to implement your own width functionality for the object. */ @@ -6266,7 +6697,7 @@ interface HTMLProgressElement extends HTMLElement { /** * Retrieves a reference to the form that the object is embedded in. */ - form: HTMLFormElement; + readonly form: HTMLFormElement; /** * Defines the maximum, or "done" value for a progress element. */ @@ -6274,7 +6705,7 @@ interface HTMLProgressElement extends HTMLElement { /** * 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). */ - position: number; + readonly position: number; /** * Sets or gets the current value of a progress element. The value must be a non-negative number between 0 and the max value. */ @@ -6291,10 +6722,6 @@ interface HTMLQuoteElement extends HTMLElement { * Sets or retrieves reference information about the object. */ cite: string; - /** - * Sets or retrieves the date and time of a modification to the object. - */ - dateTime: string; } declare var HTMLQuoteElement: { @@ -6348,7 +6775,7 @@ interface HTMLSelectElement extends HTMLElement { /** * Retrieves a reference to the form that the object is embedded in. */ - form: HTMLFormElement; + readonly form: HTMLFormElement; /** * Sets or retrieves the number of objects in a collection. */ @@ -6361,7 +6788,7 @@ interface HTMLSelectElement extends HTMLElement { * Sets or retrieves the name of the object. */ name: string; - options: HTMLCollection; + options: HTMLCollectionOf; /** * When present, marks an element that can't be submitted without a value. */ @@ -6370,6 +6797,7 @@ interface HTMLSelectElement extends HTMLElement { * Sets or retrieves the index of the selected option in a select object. */ selectedIndex: number; + selectedOptions: HTMLCollectionOf; /** * Sets or retrieves the number of rows in the list box. */ @@ -6377,15 +6805,15 @@ interface HTMLSelectElement extends HTMLElement { /** * Retrieves the type of select control based on the value of the MULTIPLE attribute. */ - type: string; + readonly type: string; /** * 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. */ - validationMessage: string; + readonly validationMessage: string; /** * Returns a ValidityState object that represents the validity states of an element. */ - validity: ValidityState; + readonly validity: ValidityState; /** * Sets or retrieves the value which is returned to the server when the form control is submitted. */ @@ -6393,8 +6821,7 @@ interface HTMLSelectElement extends HTMLElement { /** * Returns whether an element will successfully validate based on forms validation rules and constraints. */ - willValidate: boolean; - selectedOptions: HTMLCollection; + readonly willValidate: boolean; /** * Adds an element to the areas, controlRange, or options collection. * @param element Variant of type Number that specifies the index position in the collection where the element is placed. If no value is given, the method places the element at the end of the collection. @@ -6440,10 +6867,12 @@ interface HTMLSourceElement extends HTMLElement { */ media: string; msKeySystem: string; + sizes: string; /** * The address or URL of the a media resource that is to be considered. */ src: string; + srcset: string; /** * Gets or sets the MIME type of a media resource. */ @@ -6464,6 +6893,7 @@ declare var HTMLSpanElement: { } interface HTMLStyleElement extends HTMLElement, LinkStyle { + disabled: boolean; /** * Sets or retrieves the media type. */ @@ -6513,7 +6943,7 @@ interface HTMLTableCellElement extends HTMLElement, HTMLTableAlignment { /** * Retrieves the position of the object in the cells collection of a row. */ - cellIndex: number; + readonly cellIndex: number; /** * Sets or retrieves the number columns in the table that the object should span. */ @@ -6620,7 +7050,7 @@ interface HTMLTableElement extends HTMLElement { /** * Sets or retrieves the number of horizontal rows contained in the object. */ - rows: HTMLCollection; + rows: HTMLCollectionOf; /** * Sets or retrieves which dividing lines (inner borders) are displayed. */ @@ -6632,7 +7062,7 @@ interface HTMLTableElement extends HTMLElement { /** * Retrieves a collection of all tBody objects in the table. Objects in this collection are in source order. */ - tBodies: HTMLCollection; + tBodies: HTMLCollectionOf; /** * Retrieves the tFoot object of the table. */ @@ -6711,7 +7141,7 @@ interface HTMLTableRowElement extends HTMLElement, HTMLTableAlignment { /** * Retrieves a collection of all cells in the table row. */ - cells: HTMLCollection; + cells: HTMLCollectionOf; /** * Sets or retrieves the height of the object. */ @@ -6719,11 +7149,11 @@ interface HTMLTableRowElement extends HTMLElement, HTMLTableAlignment { /** * Retrieves the position of the object in the rows collection for the table. */ - rowIndex: number; + readonly rowIndex: number; /** * Retrieves the position of the object in the collection. */ - sectionRowIndex: number; + readonly sectionRowIndex: number; /** * Removes the specified cell from the table row, as well as from the cells collection. * @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. @@ -6733,7 +7163,7 @@ interface HTMLTableRowElement extends HTMLElement, HTMLTableAlignment { * Creates a new cell in the table row, and adds the cell to the cells collection. * @param index Number that specifies where to insert the cell in the tr. The default value is -1, which appends the new cell to the end of the cells collection. */ - insertCell(index?: number): HTMLTableCellElement; + insertCell(index?: number): HTMLTableDataCellElement; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -6750,7 +7180,7 @@ interface HTMLTableSectionElement extends HTMLElement, HTMLTableAlignment { /** * Sets or retrieves the number of horizontal rows contained in the object. */ - rows: HTMLCollection; + rows: HTMLCollectionOf; /** * Removes the specified row (tr) from the element and from the rows collection. * @param index Number that specifies the zero-based position in the rows collection of the row to remove. @@ -6769,6 +7199,15 @@ declare var HTMLTableSectionElement: { new(): HTMLTableSectionElement; } +interface HTMLTemplateElement extends HTMLElement { + readonly content: DocumentFragment; +} + +declare var HTMLTemplateElement: { + prototype: HTMLTemplateElement; + new(): HTMLTemplateElement; +} + interface HTMLTextAreaElement extends HTMLElement { /** * 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. @@ -6786,7 +7225,7 @@ interface HTMLTextAreaElement extends HTMLElement { /** * Retrieves a reference to the form that the object is embedded in. */ - form: HTMLFormElement; + readonly form: HTMLFormElement; /** * Sets or retrieves the maximum number of characters that the user can enter in a text control. */ @@ -6826,15 +7265,15 @@ interface HTMLTextAreaElement extends HTMLElement { /** * Retrieves the type of control. */ - type: string; + readonly type: string; /** * 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. */ - validationMessage: string; + readonly validationMessage: string; /** * Returns a ValidityState object that represents the validity states of an element. */ - validity: ValidityState; + readonly validity: ValidityState; /** * Retrieves or sets the text in the entry field of the textArea element. */ @@ -6842,19 +7281,16 @@ interface HTMLTextAreaElement extends HTMLElement { /** * Returns whether an element will successfully validate based on forms validation rules and constraints. */ - willValidate: boolean; + readonly willValidate: boolean; /** * Sets or retrieves how to handle wordwrapping in the object. */ wrap: string; + minLength: number; /** * Returns whether a form will validate when it is submitted, without having to submit it. */ checkValidity(): boolean; - /** - * Creates a TextRange object for the element. - */ - createTextRange(): TextRange; /** * Highlights the input area of a form element. */ @@ -6893,23 +7329,23 @@ interface HTMLTrackElement extends HTMLElement { default: boolean; kind: string; label: string; - readyState: number; + readonly readyState: number; src: string; srclang: string; - track: TextTrack; - ERROR: number; - LOADED: number; - LOADING: number; - NONE: number; + readonly track: TextTrack; + readonly ERROR: number; + readonly LOADED: number; + readonly LOADING: number; + readonly NONE: number; } declare var HTMLTrackElement: { prototype: HTMLTrackElement; new(): HTMLTrackElement; - ERROR: number; - LOADED: number; - LOADING: number; - NONE: number; + readonly ERROR: number; + readonly LOADED: number; + readonly LOADING: number; + readonly NONE: number; } interface HTMLUListElement extends HTMLElement { @@ -6936,8 +7372,8 @@ interface HTMLVideoElement extends HTMLMediaElement { */ height: number; msHorizontalMirror: boolean; - msIsLayoutOptimalForPlayback: boolean; - msIsStereo3D: boolean; + readonly msIsLayoutOptimalForPlayback: boolean; + readonly msIsStereo3D: boolean; msStereo3DPackingMode: string; msStereo3DRenderMode: string; msZoom: boolean; @@ -6951,13 +7387,13 @@ interface HTMLVideoElement extends HTMLMediaElement { /** * Gets the intrinsic height of a video in CSS pixels, or zero if the dimensions are not known. */ - videoHeight: number; + readonly videoHeight: number; /** * Gets the intrinsic width of a video in CSS pixels, or zero if the dimensions are not known. */ - videoWidth: number; - webkitDisplayingFullscreen: boolean; - webkitSupportsFullscreen: boolean; + readonly videoWidth: number; + readonly webkitDisplayingFullscreen: boolean; + readonly webkitSupportsFullscreen: boolean; /** * Gets or sets the width of the video element. */ @@ -6996,10 +7432,10 @@ interface HTMLVideoElement extends HTMLMediaElement { addEventListener(type: "activate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; addEventListener(type: "ariarequest", listener: (ev: AriaRequestEvent) => any, useCapture?: boolean): void; addEventListener(type: "beforeactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecopy", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecut", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforecopy", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforecut", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "beforedeactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforepaste", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforepaste", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "blur", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; addEventListener(type: "canplay", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "canplaythrough", listener: (ev: Event) => any, useCapture?: boolean): void; @@ -7007,9 +7443,9 @@ interface HTMLVideoElement extends HTMLMediaElement { addEventListener(type: "click", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "command", listener: (ev: CommandEvent) => any, useCapture?: boolean): void; addEventListener(type: "contextmenu", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "copy", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "copy", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "cuechange", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "cut", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "cut", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "dblclick", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "deactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; addEventListener(type: "drag", listener: (ev: DragEvent) => any, useCapture?: boolean): void; @@ -7021,11 +7457,13 @@ interface HTMLVideoElement extends HTMLMediaElement { addEventListener(type: "drop", listener: (ev: DragEvent) => any, useCapture?: boolean): void; addEventListener(type: "durationchange", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "emptied", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "ended", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "encrypted", listener: (ev: MediaEncryptedEvent) => any, useCapture?: boolean): void; + addEventListener(type: "ended", listener: (ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: "focus", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; addEventListener(type: "gotpointercapture", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; addEventListener(type: "input", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "invalid", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "keydown", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "keypress", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "keyup", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; @@ -7041,9 +7479,9 @@ interface HTMLVideoElement extends HTMLMediaElement { addEventListener(type: "mouseout", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "mouseover", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "mouseup", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousewheel", listener: (ev: MouseWheelEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mousewheel", listener: (ev: WheelEvent) => any, useCapture?: boolean): void; addEventListener(type: "msneedkey", listener: (ev: MSMediaKeyNeededEvent) => any, useCapture?: boolean): void; - addEventListener(type: "paste", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "paste", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "pause", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "play", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "playing", listener: (ev: Event) => any, useCapture?: boolean): void; @@ -7085,8 +7523,8 @@ declare var HTMLVideoElement: { } interface HashChangeEvent extends Event { - newURL: string; - oldURL: string; + readonly newURL: string; + readonly oldURL: string; } declare var HashChangeEvent: { @@ -7095,8 +7533,8 @@ declare var HashChangeEvent: { } interface History { - length: number; - state: any; + readonly length: number; + readonly state: any; back(distance?: any): void; forward(distance?: any): void; go(delta?: any): void; @@ -7110,31 +7548,31 @@ declare var History: { } interface IDBCursor { - direction: string; - key: any; - primaryKey: any; + readonly direction: string; + key: IDBKeyRange | IDBValidKey; + readonly primaryKey: any; source: IDBObjectStore | IDBIndex; advance(count: number): void; - continue(key?: any): void; + continue(key?: IDBKeyRange | IDBValidKey): void; delete(): IDBRequest; update(value: any): IDBRequest; - NEXT: string; - NEXT_NO_DUPLICATE: string; - PREV: string; - PREV_NO_DUPLICATE: string; + readonly NEXT: string; + readonly NEXT_NO_DUPLICATE: string; + readonly PREV: string; + readonly PREV_NO_DUPLICATE: string; } declare var IDBCursor: { prototype: IDBCursor; new(): IDBCursor; - NEXT: string; - NEXT_NO_DUPLICATE: string; - PREV: string; - PREV_NO_DUPLICATE: string; + readonly NEXT: string; + readonly NEXT_NO_DUPLICATE: string; + readonly PREV: string; + readonly PREV_NO_DUPLICATE: string; } interface IDBCursorWithValue extends IDBCursor { - value: any; + readonly value: any; } declare var IDBCursorWithValue: { @@ -7143,15 +7581,17 @@ declare var IDBCursorWithValue: { } interface IDBDatabase extends EventTarget { - name: string; - objectStoreNames: DOMStringList; + readonly name: string; + readonly objectStoreNames: DOMStringList; onabort: (ev: Event) => any; onerror: (ev: Event) => any; version: number; + onversionchange: (ev: IDBVersionChangeEvent) => any; close(): void; createObjectStore(name: string, optionalParameters?: IDBObjectStoreParameters): IDBObjectStore; deleteObjectStore(name: string): void; transaction(storeNames: string | string[], mode?: string): IDBTransaction; + addEventListener(type: "versionchange", listener: (ev: IDBVersionChangeEvent) => any, useCapture?: boolean): void; addEventListener(type: "abort", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; @@ -7175,15 +7615,15 @@ declare var IDBFactory: { interface IDBIndex { keyPath: string | string[]; - name: string; - objectStore: IDBObjectStore; - unique: boolean; + readonly name: string; + readonly objectStore: IDBObjectStore; + readonly unique: boolean; multiEntry: boolean; - count(key?: any): IDBRequest; - get(key: any): IDBRequest; - getKey(key: any): IDBRequest; - openCursor(range?: IDBKeyRange, direction?: string): IDBRequest; - openKeyCursor(range?: IDBKeyRange, direction?: string): IDBRequest; + count(key?: IDBKeyRange | IDBValidKey): IDBRequest; + get(key: IDBKeyRange | IDBValidKey): IDBRequest; + getKey(key: IDBKeyRange | IDBValidKey): IDBRequest; + openCursor(range?: IDBKeyRange | IDBValidKey, direction?: string): IDBRequest; + openKeyCursor(range?: IDBKeyRange | IDBValidKey, direction?: string): IDBRequest; } declare var IDBIndex: { @@ -7192,37 +7632,37 @@ declare var IDBIndex: { } interface IDBKeyRange { - lower: any; - lowerOpen: boolean; - upper: any; - upperOpen: boolean; + readonly lower: any; + readonly lowerOpen: boolean; + readonly upper: any; + readonly upperOpen: boolean; } declare var IDBKeyRange: { prototype: IDBKeyRange; new(): IDBKeyRange; bound(lower: any, upper: any, lowerOpen?: boolean, upperOpen?: boolean): IDBKeyRange; - lowerBound(bound: any, open?: boolean): IDBKeyRange; + lowerBound(lower: any, open?: boolean): IDBKeyRange; only(value: any): IDBKeyRange; - upperBound(bound: any, open?: boolean): IDBKeyRange; + upperBound(upper: any, open?: boolean): IDBKeyRange; } interface IDBObjectStore { - indexNames: DOMStringList; + readonly indexNames: DOMStringList; keyPath: string | string[]; - name: string; - transaction: IDBTransaction; + readonly name: string; + readonly transaction: IDBTransaction; autoIncrement: boolean; - add(value: any, key?: any): IDBRequest; + add(value: any, key?: IDBKeyRange | IDBValidKey): IDBRequest; clear(): IDBRequest; - count(key?: any): IDBRequest; + count(key?: IDBKeyRange | IDBValidKey): IDBRequest; createIndex(name: string, keyPath: string | string[], optionalParameters?: IDBIndexParameters): IDBIndex; - delete(key: any): IDBRequest; + delete(key: IDBKeyRange | IDBValidKey): IDBRequest; deleteIndex(indexName: string): void; get(key: any): IDBRequest; index(name: string): IDBIndex; - openCursor(range?: any, direction?: string): IDBRequest; - put(value: any, key?: any): IDBRequest; + openCursor(range?: IDBKeyRange | IDBValidKey, direction?: string): IDBRequest; + put(value: any, key?: IDBKeyRange | IDBValidKey): IDBRequest; } declare var IDBObjectStore: { @@ -7246,13 +7686,13 @@ declare var IDBOpenDBRequest: { } interface IDBRequest extends EventTarget { - error: DOMError; + readonly error: DOMError; onerror: (ev: Event) => any; onsuccess: (ev: Event) => any; - readyState: string; - result: any; + readonly readyState: string; + readonly result: any; source: IDBObjectStore | IDBIndex | IDBCursor; - transaction: IDBTransaction; + readonly transaction: IDBTransaction; addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: "success", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; @@ -7264,17 +7704,17 @@ declare var IDBRequest: { } interface IDBTransaction extends EventTarget { - db: IDBDatabase; - error: DOMError; - mode: string; + readonly db: IDBDatabase; + readonly error: DOMError; + readonly mode: string; onabort: (ev: Event) => any; oncomplete: (ev: Event) => any; onerror: (ev: Event) => any; abort(): void; objectStore(name: string): IDBObjectStore; - READ_ONLY: string; - READ_WRITE: string; - VERSION_CHANGE: string; + readonly READ_ONLY: string; + readonly READ_WRITE: string; + readonly VERSION_CHANGE: string; addEventListener(type: "abort", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "complete", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; @@ -7284,14 +7724,14 @@ interface IDBTransaction extends EventTarget { declare var IDBTransaction: { prototype: IDBTransaction; new(): IDBTransaction; - READ_ONLY: string; - READ_WRITE: string; - VERSION_CHANGE: string; + readonly READ_ONLY: string; + readonly READ_WRITE: string; + readonly VERSION_CHANGE: string; } interface IDBVersionChangeEvent extends Event { - newVersion: number; - oldVersion: number; + readonly newVersion: number; + readonly oldVersion: number; } declare var IDBVersionChangeEvent: { @@ -7301,8 +7741,8 @@ declare var IDBVersionChangeEvent: { interface ImageData { data: Uint8ClampedArray; - height: number; - width: number; + readonly height: number; + readonly width: number; } declare var ImageData: { @@ -7312,37 +7752,47 @@ declare var ImageData: { } interface KeyboardEvent extends UIEvent { - altKey: boolean; - char: string; - charCode: number; - ctrlKey: boolean; - key: string; - keyCode: number; - locale: string; - location: number; - metaKey: boolean; - repeat: boolean; - shiftKey: boolean; - which: number; + readonly altKey: boolean; + readonly char: string; + readonly charCode: number; + readonly ctrlKey: boolean; + readonly key: string; + readonly keyCode: number; + readonly locale: string; + readonly location: number; + readonly metaKey: boolean; + readonly repeat: boolean; + readonly shiftKey: boolean; + readonly which: number; getModifierState(keyArg: string): boolean; initKeyboardEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, keyArg: string, locationArg: number, modifiersListArg: string, repeat: boolean, locale: string): void; - DOM_KEY_LOCATION_JOYSTICK: number; - DOM_KEY_LOCATION_LEFT: number; - DOM_KEY_LOCATION_MOBILE: number; - DOM_KEY_LOCATION_NUMPAD: number; - DOM_KEY_LOCATION_RIGHT: number; - DOM_KEY_LOCATION_STANDARD: number; + readonly DOM_KEY_LOCATION_JOYSTICK: number; + readonly DOM_KEY_LOCATION_LEFT: number; + readonly DOM_KEY_LOCATION_MOBILE: number; + readonly DOM_KEY_LOCATION_NUMPAD: number; + readonly DOM_KEY_LOCATION_RIGHT: number; + readonly DOM_KEY_LOCATION_STANDARD: number; } declare var KeyboardEvent: { prototype: KeyboardEvent; new(typeArg: string, eventInitDict?: KeyboardEventInit): KeyboardEvent; - DOM_KEY_LOCATION_JOYSTICK: number; - DOM_KEY_LOCATION_LEFT: number; - DOM_KEY_LOCATION_MOBILE: number; - DOM_KEY_LOCATION_NUMPAD: number; - DOM_KEY_LOCATION_RIGHT: number; - DOM_KEY_LOCATION_STANDARD: number; + readonly DOM_KEY_LOCATION_JOYSTICK: number; + readonly DOM_KEY_LOCATION_LEFT: number; + readonly DOM_KEY_LOCATION_MOBILE: number; + readonly DOM_KEY_LOCATION_NUMPAD: number; + readonly DOM_KEY_LOCATION_RIGHT: number; + readonly DOM_KEY_LOCATION_STANDARD: number; +} + +interface ListeningStateChangedEvent extends Event { + readonly label: string; + readonly state: string; +} + +declare var ListeningStateChangedEvent: { + prototype: ListeningStateChangedEvent; + new(): ListeningStateChangedEvent; } interface Location { @@ -7350,7 +7800,7 @@ interface Location { host: string; hostname: string; href: string; - origin: string; + readonly origin: string; pathname: string; port: string; protocol: string; @@ -7367,7 +7817,7 @@ declare var Location: { } interface LongRunningScriptDetectedEvent extends Event { - executionTime: number; + readonly executionTime: number; stopPageScriptExecution: boolean; } @@ -7386,29 +7836,29 @@ interface MSApp { execAsyncAtPriority(asynchronousCallback: MSExecAtPriorityFunctionCallback, priority: string, ...args: any[]): void; execAtPriority(synchronousCallback: MSExecAtPriorityFunctionCallback, priority: string, ...args: any[]): any; getCurrentPriority(): string; - getHtmlPrintDocumentSourceAsync(htmlDoc: any): any; + getHtmlPrintDocumentSourceAsync(htmlDoc: any): PromiseLike; getViewId(view: any): any; isTaskScheduledAtPriorityOrHigher(priority: string): boolean; pageHandlesAllApplicationActivations(enabled: boolean): void; suppressSubdownloadCredentialPrompts(suppress: boolean): void; terminateApp(exceptionObject: any): void; - CURRENT: string; - HIGH: string; - IDLE: string; - NORMAL: string; + readonly CURRENT: string; + readonly HIGH: string; + readonly IDLE: string; + readonly NORMAL: string; } declare var MSApp: MSApp; interface MSAppAsyncOperation extends EventTarget { - error: DOMError; + readonly error: DOMError; oncomplete: (ev: Event) => any; onerror: (ev: Event) => any; - readyState: number; - result: any; + readonly readyState: number; + readonly result: any; start(): void; - COMPLETED: number; - ERROR: number; - STARTED: number; + readonly COMPLETED: number; + readonly ERROR: number; + readonly STARTED: number; addEventListener(type: "complete", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; @@ -7417,9 +7867,19 @@ interface MSAppAsyncOperation extends EventTarget { declare var MSAppAsyncOperation: { prototype: MSAppAsyncOperation; new(): MSAppAsyncOperation; - COMPLETED: number; - ERROR: number; - STARTED: number; + readonly COMPLETED: number; + readonly ERROR: number; + readonly STARTED: number; +} + +interface MSAssertion { + readonly id: string; + readonly type: string; +} + +declare var MSAssertion: { + prototype: MSAssertion; + new(): MSAssertion; } interface MSBlobBuilder { @@ -7432,44 +7892,46 @@ declare var MSBlobBuilder: { new(): MSBlobBuilder; } -interface MSCSSMatrix { - a: number; - b: number; - c: number; - d: number; - e: number; - f: number; - m11: number; - m12: number; - m13: number; - m14: number; - m21: number; - m22: number; - m23: number; - m24: number; - m31: number; - m32: number; - m33: number; - m34: number; - m41: number; - m42: number; - m43: number; - m44: number; - inverse(): MSCSSMatrix; - multiply(secondMatrix: MSCSSMatrix): MSCSSMatrix; - rotate(angleX: number, angleY?: number, angleZ?: number): MSCSSMatrix; - rotateAxisAngle(x: number, y: number, z: number, angle: number): MSCSSMatrix; - scale(scaleX: number, scaleY?: number, scaleZ?: number): MSCSSMatrix; - setMatrixValue(value: string): void; - skewX(angle: number): MSCSSMatrix; - skewY(angle: number): MSCSSMatrix; - toString(): string; - translate(x: number, y: number, z?: number): MSCSSMatrix; +interface MSCredentials { + getAssertion(challenge: string, filter?: MSCredentialFilter, params?: MSSignatureParameters): PromiseLike; + makeCredential(accountInfo: MSAccountInfo, params: MSCredentialParameters[], challenge?: string): PromiseLike; } -declare var MSCSSMatrix: { - prototype: MSCSSMatrix; - new(text?: string): MSCSSMatrix; +declare var MSCredentials: { + prototype: MSCredentials; + new(): MSCredentials; +} + +interface MSFIDOCredentialAssertion extends MSAssertion { + readonly algorithm: string | Algorithm; + readonly attestation: any; + readonly publicKey: string; + readonly transportHints: string[]; +} + +declare var MSFIDOCredentialAssertion: { + prototype: MSFIDOCredentialAssertion; + new(): MSFIDOCredentialAssertion; +} + +interface MSFIDOSignature { + readonly authnrData: string; + readonly clientData: string; + readonly signature: string; +} + +declare var MSFIDOSignature: { + prototype: MSFIDOSignature; + new(): MSFIDOSignature; +} + +interface MSFIDOSignatureAssertion extends MSAssertion { + readonly signature: MSFIDOSignature; +} + +declare var MSFIDOSignatureAssertion: { + prototype: MSFIDOSignatureAssertion; + new(): MSFIDOSignatureAssertion; } interface MSGesture { @@ -7484,44 +7946,44 @@ declare var MSGesture: { } interface MSGestureEvent extends UIEvent { - clientX: number; - clientY: number; - expansion: number; - gestureObject: any; - hwTimestamp: number; - offsetX: number; - offsetY: number; - rotation: number; - scale: number; - screenX: number; - screenY: number; - translationX: number; - translationY: number; - velocityAngular: number; - velocityExpansion: number; - velocityX: number; - velocityY: number; + readonly clientX: number; + readonly clientY: number; + readonly expansion: number; + readonly gestureObject: any; + readonly hwTimestamp: number; + readonly offsetX: number; + readonly offsetY: number; + readonly rotation: number; + readonly scale: number; + readonly screenX: number; + readonly screenY: number; + readonly translationX: number; + readonly translationY: number; + readonly velocityAngular: number; + readonly velocityExpansion: number; + readonly velocityX: number; + readonly velocityY: number; 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; - MSGESTURE_FLAG_BEGIN: number; - MSGESTURE_FLAG_CANCEL: number; - MSGESTURE_FLAG_END: number; - MSGESTURE_FLAG_INERTIA: number; - MSGESTURE_FLAG_NONE: number; + readonly MSGESTURE_FLAG_BEGIN: number; + readonly MSGESTURE_FLAG_CANCEL: number; + readonly MSGESTURE_FLAG_END: number; + readonly MSGESTURE_FLAG_INERTIA: number; + readonly MSGESTURE_FLAG_NONE: number; } declare var MSGestureEvent: { prototype: MSGestureEvent; new(): MSGestureEvent; - MSGESTURE_FLAG_BEGIN: number; - MSGESTURE_FLAG_CANCEL: number; - MSGESTURE_FLAG_END: number; - MSGESTURE_FLAG_INERTIA: number; - MSGESTURE_FLAG_NONE: number; + readonly MSGESTURE_FLAG_BEGIN: number; + readonly MSGESTURE_FLAG_CANCEL: number; + readonly MSGESTURE_FLAG_END: number; + readonly MSGESTURE_FLAG_INERTIA: number; + readonly MSGESTURE_FLAG_NONE: number; } interface MSGraphicsTrust { - constrictionActive: boolean; - status: string; + readonly constrictionActive: boolean; + readonly status: string; } declare var MSGraphicsTrust: { @@ -7530,12 +7992,12 @@ declare var MSGraphicsTrust: { } interface MSHTMLWebViewElement extends HTMLElement { - canGoBack: boolean; - canGoForward: boolean; - containsFullScreenElement: boolean; - documentTitle: string; + readonly canGoBack: boolean; + readonly canGoForward: boolean; + readonly containsFullScreenElement: boolean; + readonly documentTitle: string; height: number; - settings: MSWebViewSettings; + readonly settings: MSWebViewSettings; src: string; width: number; addWebAllowedObject(name: string, applicationObject: any): void; @@ -7561,12 +8023,12 @@ declare var MSHTMLWebViewElement: { } interface MSInputMethodContext extends EventTarget { - compositionEndOffset: number; - compositionStartOffset: number; + readonly compositionEndOffset: number; + readonly compositionStartOffset: number; oncandidatewindowhide: (ev: Event) => any; oncandidatewindowshow: (ev: Event) => any; oncandidatewindowupdate: (ev: Event) => any; - target: HTMLElement; + readonly target: HTMLElement; getCandidateWindowClientRect(): ClientRect; getCompositionAlternatives(): string[]; hasComposition(): boolean; @@ -7583,59 +8045,59 @@ declare var MSInputMethodContext: { } interface MSManipulationEvent extends UIEvent { - currentState: number; - inertiaDestinationX: number; - inertiaDestinationY: number; - lastState: number; + readonly currentState: number; + readonly inertiaDestinationX: number; + readonly inertiaDestinationY: number; + readonly lastState: number; initMSManipulationEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, lastState: number, currentState: number): void; - MS_MANIPULATION_STATE_ACTIVE: number; - MS_MANIPULATION_STATE_CANCELLED: number; - MS_MANIPULATION_STATE_COMMITTED: number; - MS_MANIPULATION_STATE_DRAGGING: number; - MS_MANIPULATION_STATE_INERTIA: number; - MS_MANIPULATION_STATE_PRESELECT: number; - MS_MANIPULATION_STATE_SELECTING: number; - MS_MANIPULATION_STATE_STOPPED: number; + readonly MS_MANIPULATION_STATE_ACTIVE: number; + readonly MS_MANIPULATION_STATE_CANCELLED: number; + readonly MS_MANIPULATION_STATE_COMMITTED: number; + readonly MS_MANIPULATION_STATE_DRAGGING: number; + readonly MS_MANIPULATION_STATE_INERTIA: number; + readonly MS_MANIPULATION_STATE_PRESELECT: number; + readonly MS_MANIPULATION_STATE_SELECTING: number; + readonly MS_MANIPULATION_STATE_STOPPED: number; } declare var MSManipulationEvent: { prototype: MSManipulationEvent; new(): MSManipulationEvent; - MS_MANIPULATION_STATE_ACTIVE: number; - MS_MANIPULATION_STATE_CANCELLED: number; - MS_MANIPULATION_STATE_COMMITTED: number; - MS_MANIPULATION_STATE_DRAGGING: number; - MS_MANIPULATION_STATE_INERTIA: number; - MS_MANIPULATION_STATE_PRESELECT: number; - MS_MANIPULATION_STATE_SELECTING: number; - MS_MANIPULATION_STATE_STOPPED: number; + readonly MS_MANIPULATION_STATE_ACTIVE: number; + readonly MS_MANIPULATION_STATE_CANCELLED: number; + readonly MS_MANIPULATION_STATE_COMMITTED: number; + readonly MS_MANIPULATION_STATE_DRAGGING: number; + readonly MS_MANIPULATION_STATE_INERTIA: number; + readonly MS_MANIPULATION_STATE_PRESELECT: number; + readonly MS_MANIPULATION_STATE_SELECTING: number; + readonly MS_MANIPULATION_STATE_STOPPED: number; } interface MSMediaKeyError { - code: number; - systemCode: number; - MS_MEDIA_KEYERR_CLIENT: number; - MS_MEDIA_KEYERR_DOMAIN: number; - MS_MEDIA_KEYERR_HARDWARECHANGE: number; - MS_MEDIA_KEYERR_OUTPUT: number; - MS_MEDIA_KEYERR_SERVICE: number; - MS_MEDIA_KEYERR_UNKNOWN: number; + readonly code: number; + readonly systemCode: number; + readonly MS_MEDIA_KEYERR_CLIENT: number; + readonly MS_MEDIA_KEYERR_DOMAIN: number; + readonly MS_MEDIA_KEYERR_HARDWARECHANGE: number; + readonly MS_MEDIA_KEYERR_OUTPUT: number; + readonly MS_MEDIA_KEYERR_SERVICE: number; + readonly MS_MEDIA_KEYERR_UNKNOWN: number; } declare var MSMediaKeyError: { prototype: MSMediaKeyError; new(): MSMediaKeyError; - MS_MEDIA_KEYERR_CLIENT: number; - MS_MEDIA_KEYERR_DOMAIN: number; - MS_MEDIA_KEYERR_HARDWARECHANGE: number; - MS_MEDIA_KEYERR_OUTPUT: number; - MS_MEDIA_KEYERR_SERVICE: number; - MS_MEDIA_KEYERR_UNKNOWN: number; + readonly MS_MEDIA_KEYERR_CLIENT: number; + readonly MS_MEDIA_KEYERR_DOMAIN: number; + readonly MS_MEDIA_KEYERR_HARDWARECHANGE: number; + readonly MS_MEDIA_KEYERR_OUTPUT: number; + readonly MS_MEDIA_KEYERR_SERVICE: number; + readonly MS_MEDIA_KEYERR_UNKNOWN: number; } interface MSMediaKeyMessageEvent extends Event { - destinationURL: string; - message: Uint8Array; + readonly destinationURL: string; + readonly message: Uint8Array; } declare var MSMediaKeyMessageEvent: { @@ -7644,7 +8106,7 @@ declare var MSMediaKeyMessageEvent: { } interface MSMediaKeyNeededEvent extends Event { - initData: Uint8Array; + readonly initData: Uint8Array; } declare var MSMediaKeyNeededEvent: { @@ -7653,9 +8115,9 @@ declare var MSMediaKeyNeededEvent: { } interface MSMediaKeySession extends EventTarget { - error: MSMediaKeyError; - keySystem: string; - sessionId: string; + readonly error: MSMediaKeyError; + readonly keySystem: string; + readonly sessionId: string; close(): void; update(key: Uint8Array): void; } @@ -7666,7 +8128,7 @@ declare var MSMediaKeySession: { } interface MSMediaKeys { - keySystem: string; + readonly keySystem: string; createSession(type: string, initData: Uint8Array, cdmData?: Uint8Array): MSMediaKeySession; } @@ -7674,40 +8136,22 @@ declare var MSMediaKeys: { prototype: MSMediaKeys; new(keySystem: string): MSMediaKeys; isTypeSupported(keySystem: string, type?: string): boolean; -} - -interface MSMimeTypesCollection { - length: number; -} - -declare var MSMimeTypesCollection: { - prototype: MSMimeTypesCollection; - new(): MSMimeTypesCollection; -} - -interface MSPluginsCollection { - length: number; - refresh(reload?: boolean): void; -} - -declare var MSPluginsCollection: { - prototype: MSPluginsCollection; - new(): MSPluginsCollection; + isTypeSupportedWithFeatures(keySystem: string, type?: string): string; } interface MSPointerEvent extends MouseEvent { - currentPoint: any; - height: number; - hwTimestamp: number; - intermediatePoints: any; - isPrimary: boolean; - pointerId: number; - pointerType: any; - pressure: number; - rotation: number; - tiltX: number; - tiltY: number; - width: number; + readonly currentPoint: any; + readonly height: number; + readonly hwTimestamp: number; + readonly intermediatePoints: any; + readonly isPrimary: boolean; + readonly pointerId: number; + readonly pointerType: any; + readonly pressure: number; + readonly rotation: number; + readonly tiltX: number; + readonly tiltY: number; + readonly width: number; getCurrentPoint(element: Element): void; getIntermediatePoints(element: Element): void; 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; @@ -7719,7 +8163,7 @@ declare var MSPointerEvent: { } interface MSRangeCollection { - length: number; + readonly length: number; item(index: number): Range; [index: number]: Range; } @@ -7730,8 +8174,8 @@ declare var MSRangeCollection: { } interface MSSiteModeEvent extends Event { - actionURL: string; - buttonID: number; + readonly actionURL: string; + readonly buttonID: number; } declare var MSSiteModeEvent: { @@ -7740,7 +8184,7 @@ declare var MSSiteModeEvent: { } interface MSStream { - type: string; + readonly type: string; msClose(): void; msDetachStream(): any; } @@ -7751,7 +8195,7 @@ declare var MSStream: { } interface MSStreamReader extends EventTarget, MSBaseReader { - error: DOMError; + readonly error: DOMError; readAsArrayBuffer(stream: MSStream, size?: number): void; readAsBinaryString(stream: MSStream, size?: number): void; readAsBlob(stream: MSStream, size?: number): void; @@ -7766,20 +8210,20 @@ declare var MSStreamReader: { } interface MSWebViewAsyncOperation extends EventTarget { - error: DOMError; + readonly error: DOMError; oncomplete: (ev: Event) => any; onerror: (ev: Event) => any; - readyState: number; - result: any; - target: MSHTMLWebViewElement; - type: number; + readonly readyState: number; + readonly result: any; + readonly target: MSHTMLWebViewElement; + readonly type: number; start(): void; - COMPLETED: number; - ERROR: number; - STARTED: number; - TYPE_CAPTURE_PREVIEW_TO_RANDOM_ACCESS_STREAM: number; - TYPE_CREATE_DATA_PACKAGE_FROM_SELECTION: number; - TYPE_INVOKE_SCRIPT: number; + readonly COMPLETED: number; + readonly ERROR: number; + readonly STARTED: number; + readonly TYPE_CAPTURE_PREVIEW_TO_RANDOM_ACCESS_STREAM: number; + readonly TYPE_CREATE_DATA_PACKAGE_FROM_SELECTION: number; + readonly TYPE_INVOKE_SCRIPT: number; addEventListener(type: "complete", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; @@ -7788,12 +8232,12 @@ interface MSWebViewAsyncOperation extends EventTarget { declare var MSWebViewAsyncOperation: { prototype: MSWebViewAsyncOperation; new(): MSWebViewAsyncOperation; - COMPLETED: number; - ERROR: number; - STARTED: number; - TYPE_CAPTURE_PREVIEW_TO_RANDOM_ACCESS_STREAM: number; - TYPE_CREATE_DATA_PACKAGE_FROM_SELECTION: number; - TYPE_INVOKE_SCRIPT: number; + readonly COMPLETED: number; + readonly ERROR: number; + readonly STARTED: number; + readonly TYPE_CAPTURE_PREVIEW_TO_RANDOM_ACCESS_STREAM: number; + readonly TYPE_CREATE_DATA_PACKAGE_FROM_SELECTION: number; + readonly TYPE_INVOKE_SCRIPT: number; } interface MSWebViewSettings { @@ -7806,6 +8250,32 @@ declare var MSWebViewSettings: { new(): MSWebViewSettings; } +interface MediaDeviceInfo { + readonly deviceId: string; + readonly groupId: string; + readonly kind: string; + readonly label: string; +} + +declare var MediaDeviceInfo: { + prototype: MediaDeviceInfo; + new(): MediaDeviceInfo; +} + +interface MediaDevices extends EventTarget { + ondevicechange: (ev: Event) => any; + enumerateDevices(): any; + getSupportedConstraints(): MediaTrackSupportedConstraints; + getUserMedia(constraints: MediaStreamConstraints): PromiseLike; + addEventListener(type: "devicechange", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var MediaDevices: { + prototype: MediaDevices; + new(): MediaDevices; +} + interface MediaElementAudioSourceNode extends AudioNode { } @@ -7814,28 +8284,98 @@ declare var MediaElementAudioSourceNode: { new(): MediaElementAudioSourceNode; } +interface MediaEncryptedEvent extends Event { + readonly initData: ArrayBuffer; + readonly initDataType: string; +} + +declare var MediaEncryptedEvent: { + prototype: MediaEncryptedEvent; + new(type: string, eventInitDict?: MediaEncryptedEventInit): MediaEncryptedEvent; +} + interface MediaError { - code: number; - msExtendedCode: number; - MEDIA_ERR_ABORTED: number; - MEDIA_ERR_DECODE: number; - MEDIA_ERR_NETWORK: number; - MEDIA_ERR_SRC_NOT_SUPPORTED: number; - MS_MEDIA_ERR_ENCRYPTED: number; + readonly code: number; + readonly msExtendedCode: number; + readonly MEDIA_ERR_ABORTED: number; + readonly MEDIA_ERR_DECODE: number; + readonly MEDIA_ERR_NETWORK: number; + readonly MEDIA_ERR_SRC_NOT_SUPPORTED: number; + readonly MS_MEDIA_ERR_ENCRYPTED: number; } declare var MediaError: { prototype: MediaError; new(): MediaError; - MEDIA_ERR_ABORTED: number; - MEDIA_ERR_DECODE: number; - MEDIA_ERR_NETWORK: number; - MEDIA_ERR_SRC_NOT_SUPPORTED: number; - MS_MEDIA_ERR_ENCRYPTED: number; + readonly MEDIA_ERR_ABORTED: number; + readonly MEDIA_ERR_DECODE: number; + readonly MEDIA_ERR_NETWORK: number; + readonly MEDIA_ERR_SRC_NOT_SUPPORTED: number; + readonly MS_MEDIA_ERR_ENCRYPTED: number; +} + +interface MediaKeyMessageEvent extends Event { + readonly message: ArrayBuffer; + readonly messageType: string; +} + +declare var MediaKeyMessageEvent: { + prototype: MediaKeyMessageEvent; + new(type: string, eventInitDict?: MediaKeyMessageEventInit): MediaKeyMessageEvent; +} + +interface MediaKeySession extends EventTarget { + readonly closed: PromiseLike; + readonly expiration: number; + readonly keyStatuses: MediaKeyStatusMap; + readonly sessionId: string; + close(): PromiseLike; + generateRequest(initDataType: string, initData: any): PromiseLike; + load(sessionId: string): PromiseLike; + remove(): PromiseLike; + update(response: any): PromiseLike; +} + +declare var MediaKeySession: { + prototype: MediaKeySession; + new(): MediaKeySession; +} + +interface MediaKeyStatusMap { + readonly size: number; + forEach(callback: ForEachCallback): void; + get(keyId: any): string; + has(keyId: any): boolean; +} + +declare var MediaKeyStatusMap: { + prototype: MediaKeyStatusMap; + new(): MediaKeyStatusMap; +} + +interface MediaKeySystemAccess { + readonly keySystem: string; + createMediaKeys(): PromiseLike; + getConfiguration(): MediaKeySystemConfiguration; +} + +declare var MediaKeySystemAccess: { + prototype: MediaKeySystemAccess; + new(): MediaKeySystemAccess; +} + +interface MediaKeys { + createSession(sessionType?: string): MediaKeySession; + setServerCertificate(serverCertificate: any): PromiseLike; +} + +declare var MediaKeys: { + prototype: MediaKeys; + new(): MediaKeys; } interface MediaList { - length: number; + readonly length: number; mediaText: string; appendMedium(newMedium: string): void; deleteMedium(oldMedium: string): void; @@ -7850,8 +8390,8 @@ declare var MediaList: { } interface MediaQueryList { - matches: boolean; - media: string; + readonly matches: boolean; + readonly media: string; addListener(listener: MediaQueryListListener): void; removeListener(listener: MediaQueryListListener): void; } @@ -7862,10 +8402,10 @@ declare var MediaQueryList: { } interface MediaSource extends EventTarget { - activeSourceBuffers: SourceBufferList; + readonly activeSourceBuffers: SourceBufferList; duration: number; - readyState: string; - sourceBuffers: SourceBufferList; + readonly readyState: string; + readonly sourceBuffers: SourceBufferList; addSourceBuffer(type: string): SourceBuffer; endOfStream(error?: number): void; removeSourceBuffer(sourceBuffer: SourceBuffer): void; @@ -7877,9 +8417,104 @@ declare var MediaSource: { isTypeSupported(type: string): boolean; } +interface MediaStream extends EventTarget { + readonly active: boolean; + readonly id: string; + onactive: (ev: Event) => any; + onaddtrack: (ev: TrackEvent) => any; + oninactive: (ev: Event) => any; + onremovetrack: (ev: TrackEvent) => any; + addTrack(track: MediaStreamTrack): void; + clone(): MediaStream; + getAudioTracks(): MediaStreamTrack[]; + getTrackById(trackId: string): MediaStreamTrack; + getTracks(): MediaStreamTrack[]; + getVideoTracks(): MediaStreamTrack[]; + removeTrack(track: MediaStreamTrack): void; + stop(): void; + addEventListener(type: "active", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "addtrack", listener: (ev: TrackEvent) => any, useCapture?: boolean): void; + addEventListener(type: "inactive", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "removetrack", listener: (ev: TrackEvent) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var MediaStream: { + prototype: MediaStream; + new(streamOrTracks?: MediaStream | MediaStreamTrack[]): MediaStream; +} + +interface MediaStreamAudioSourceNode extends AudioNode { +} + +declare var MediaStreamAudioSourceNode: { + prototype: MediaStreamAudioSourceNode; + new(): MediaStreamAudioSourceNode; +} + +interface MediaStreamError { + readonly constraintName: string; + readonly message: string; + readonly name: string; +} + +declare var MediaStreamError: { + prototype: MediaStreamError; + new(): MediaStreamError; +} + +interface MediaStreamErrorEvent extends Event { + readonly error: MediaStreamError; +} + +declare var MediaStreamErrorEvent: { + prototype: MediaStreamErrorEvent; + new(type: string, eventInitDict?: MediaStreamErrorEventInit): MediaStreamErrorEvent; +} + +interface MediaStreamTrack extends EventTarget { + enabled: boolean; + readonly id: string; + readonly kind: string; + readonly label: string; + readonly muted: boolean; + onended: (ev: MediaStreamErrorEvent) => any; + onmute: (ev: Event) => any; + onoverconstrained: (ev: MediaStreamErrorEvent) => any; + onunmute: (ev: Event) => any; + readonly readonly: boolean; + readonly readyState: string; + readonly remote: boolean; + applyConstraints(constraints: MediaTrackConstraints): PromiseLike; + clone(): MediaStreamTrack; + getCapabilities(): MediaTrackCapabilities; + getConstraints(): MediaTrackConstraints; + getSettings(): MediaTrackSettings; + stop(): void; + addEventListener(type: "ended", listener: (ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mute", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "overconstrained", listener: (ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: "unmute", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var MediaStreamTrack: { + prototype: MediaStreamTrack; + new(): MediaStreamTrack; +} + +interface MediaStreamTrackEvent extends Event { + readonly track: MediaStreamTrack; +} + +declare var MediaStreamTrackEvent: { + prototype: MediaStreamTrackEvent; + new(type: string, eventInitDict?: MediaStreamTrackEventInit): MediaStreamTrackEvent; +} + interface MessageChannel { - port1: MessagePort; - port2: MessagePort; + readonly port1: MessagePort; + readonly port2: MessagePort; } declare var MessageChannel: { @@ -7888,10 +8523,10 @@ declare var MessageChannel: { } interface MessageEvent extends Event { - data: any; - origin: string; - ports: any; - source: Window; + readonly data: any; + readonly origin: string; + readonly ports: any; + readonly source: Window; initMessageEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, dataArg: any, originArg: string, lastEventIdArg: string, sourceArg: Window): void; } @@ -7915,10 +8550,10 @@ declare var MessagePort: { } interface MimeType { - description: string; - enabledPlugin: Plugin; - suffixes: string; - type: string; + readonly description: string; + readonly enabledPlugin: Plugin; + readonly suffixes: string; + readonly type: string; } declare var MimeType: { @@ -7927,7 +8562,7 @@ declare var MimeType: { } interface MimeTypeArray { - length: number; + readonly length: number; item(index: number): Plugin; namedItem(type: string): Plugin; [index: number]: Plugin; @@ -7939,30 +8574,30 @@ declare var MimeTypeArray: { } interface MouseEvent extends UIEvent { - altKey: boolean; - button: number; - buttons: number; - clientX: number; - clientY: number; - ctrlKey: boolean; - fromElement: Element; - layerX: number; - layerY: number; - metaKey: boolean; - movementX: number; - movementY: number; - offsetX: number; - offsetY: number; - pageX: number; - pageY: number; - relatedTarget: EventTarget; - screenX: number; - screenY: number; - shiftKey: boolean; - toElement: Element; - which: number; - x: number; - y: number; + readonly altKey: boolean; + readonly button: number; + readonly buttons: number; + readonly clientX: number; + readonly clientY: number; + readonly ctrlKey: boolean; + readonly fromElement: Element; + readonly layerX: number; + readonly layerY: number; + readonly metaKey: boolean; + readonly movementX: number; + readonly movementY: number; + readonly offsetX: number; + readonly offsetY: number; + readonly pageX: number; + readonly pageY: number; + readonly relatedTarget: EventTarget; + readonly screenX: number; + readonly screenY: number; + readonly shiftKey: boolean; + readonly toElement: Element; + readonly which: number; + readonly x: number; + readonly y: number; getModifierState(keyArg: string): boolean; 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; } @@ -7972,36 +8607,24 @@ declare var MouseEvent: { new(typeArg: string, eventInitDict?: MouseEventInit): MouseEvent; } -interface MouseWheelEvent extends MouseEvent { - wheelDelta: number; - wheelDeltaX: number; - wheelDeltaY: number; - initMouseWheelEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, screenXArg: number, screenYArg: number, clientXArg: number, clientYArg: number, buttonArg: number, relatedTargetArg: EventTarget, modifiersListArg: string, wheelDeltaArg: number): void; -} - -declare var MouseWheelEvent: { - prototype: MouseWheelEvent; - new(): MouseWheelEvent; -} - interface MutationEvent extends Event { - attrChange: number; - attrName: string; - newValue: string; - prevValue: string; - relatedNode: Node; + readonly attrChange: number; + readonly attrName: string; + readonly newValue: string; + readonly prevValue: string; + readonly relatedNode: Node; initMutationEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, relatedNodeArg: Node, prevValueArg: string, newValueArg: string, attrNameArg: string, attrChangeArg: number): void; - ADDITION: number; - MODIFICATION: number; - REMOVAL: number; + readonly ADDITION: number; + readonly MODIFICATION: number; + readonly REMOVAL: number; } declare var MutationEvent: { prototype: MutationEvent; new(): MutationEvent; - ADDITION: number; - MODIFICATION: number; - REMOVAL: number; + readonly ADDITION: number; + readonly MODIFICATION: number; + readonly REMOVAL: number; } interface MutationObserver { @@ -8016,15 +8639,15 @@ declare var MutationObserver: { } interface MutationRecord { - addedNodes: NodeList; - attributeName: string; - attributeNamespace: string; - nextSibling: Node; - oldValue: string; - previousSibling: Node; - removedNodes: NodeList; - target: Node; - type: string; + readonly addedNodes: NodeList; + readonly attributeName: string; + readonly attributeNamespace: string; + readonly nextSibling: Node; + readonly oldValue: string; + readonly previousSibling: Node; + readonly removedNodes: NodeList; + readonly target: Node; + readonly type: string; } declare var MutationRecord: { @@ -8033,7 +8656,7 @@ declare var MutationRecord: { } interface NamedNodeMap { - length: number; + readonly length: number; getNamedItem(name: string): Attr; getNamedItemNS(namespaceURI: string, localName: string): Attr; item(index: number): Attr; @@ -8050,8 +8673,8 @@ declare var NamedNodeMap: { } interface NavigationCompletedEvent extends NavigationEvent { - isSuccess: boolean; - webErrorStatus: number; + readonly isSuccess: boolean; + readonly webErrorStatus: number; } declare var NavigationCompletedEvent: { @@ -8060,7 +8683,7 @@ declare var NavigationCompletedEvent: { } interface NavigationEvent extends Event { - uri: string; + readonly uri: string; } declare var NavigationEvent: { @@ -8069,7 +8692,7 @@ declare var NavigationEvent: { } interface NavigationEventWithReferrer extends NavigationEvent { - referer: string; + readonly referer: string; } declare var NavigationEventWithReferrer: { @@ -8077,27 +8700,22 @@ declare var NavigationEventWithReferrer: { new(): NavigationEventWithReferrer; } -interface Navigator extends Object, NavigatorID, NavigatorOnLine, NavigatorContentUtils, NavigatorStorageUtils, NavigatorGeolocation, MSNavigatorDoNotTrack, MSFileSaver { - appCodeName: string; - appMinorVersion: string; - browserLanguage: string; - connectionSpeed: number; - cookieEnabled: boolean; - cpuClass: string; - language: string; - maxTouchPoints: number; - mimeTypes: MSMimeTypesCollection; - msManipulationViewsEnabled: boolean; - msMaxTouchPoints: number; - msPointerEnabled: boolean; - plugins: MSPluginsCollection; - pointerEnabled: boolean; - systemLanguage: string; - userLanguage: string; - webdriver: boolean; +interface Navigator extends Object, NavigatorID, NavigatorOnLine, NavigatorContentUtils, NavigatorStorageUtils, NavigatorGeolocation, MSNavigatorDoNotTrack, MSFileSaver, NavigatorUserMedia { + readonly appCodeName: string; + readonly cookieEnabled: boolean; + readonly language: string; + readonly maxTouchPoints: number; + readonly mimeTypes: MimeTypeArray; + readonly msManipulationViewsEnabled: boolean; + readonly msMaxTouchPoints: number; + readonly msPointerEnabled: boolean; + readonly plugins: PluginArray; + readonly pointerEnabled: boolean; + readonly webdriver: boolean; getGamepads(): Gamepad[]; javaEnabled(): boolean; msLaunchUri(uri: string, successCallback?: MSLaunchUriCallback, noHandlerCallback?: MSLaunchUriCallback): void; + requestMediaKeySystemAccess(keySystem: string, supportedConfigurations: MediaKeySystemConfiguration[]): PromiseLike; vibrate(pattern: number | number[]): boolean; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -8108,26 +8726,26 @@ declare var Navigator: { } interface Node extends EventTarget { - attributes: NamedNodeMap; - baseURI: string; - childNodes: NodeList; - firstChild: Node; - lastChild: Node; - localName: string; - namespaceURI: string; - nextSibling: Node; - nodeName: string; - nodeType: number; + readonly attributes: NamedNodeMap; + readonly baseURI: string; + readonly childNodes: NodeList; + readonly firstChild: Node; + readonly lastChild: Node; + readonly localName: string; + readonly namespaceURI: string; + readonly nextSibling: Node; + readonly nodeName: string; + readonly nodeType: number; nodeValue: string; - ownerDocument: Document; - parentElement: HTMLElement; - parentNode: Node; - prefix: string; - previousSibling: Node; + readonly ownerDocument: Document; + readonly parentElement: HTMLElement; + readonly parentNode: Node; + readonly previousSibling: Node; textContent: string; appendChild(newChild: Node): Node; cloneNode(deep?: boolean): Node; compareDocumentPosition(other: Node): number; + contains(child: Node): boolean; hasAttributes(): boolean; hasChildNodes(): boolean; insertBefore(newChild: Node, refChild?: Node): Node; @@ -8140,47 +8758,47 @@ interface Node extends EventTarget { removeChild(oldChild: Node): Node; replaceChild(newChild: Node, oldChild: Node): Node; contains(node: Node): boolean; - ATTRIBUTE_NODE: number; - CDATA_SECTION_NODE: number; - COMMENT_NODE: number; - DOCUMENT_FRAGMENT_NODE: number; - DOCUMENT_NODE: number; - DOCUMENT_POSITION_CONTAINED_BY: number; - DOCUMENT_POSITION_CONTAINS: number; - DOCUMENT_POSITION_DISCONNECTED: number; - DOCUMENT_POSITION_FOLLOWING: number; - DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC: number; - DOCUMENT_POSITION_PRECEDING: number; - DOCUMENT_TYPE_NODE: number; - ELEMENT_NODE: number; - ENTITY_NODE: number; - ENTITY_REFERENCE_NODE: number; - NOTATION_NODE: number; - PROCESSING_INSTRUCTION_NODE: number; - TEXT_NODE: number; + readonly ATTRIBUTE_NODE: number; + readonly CDATA_SECTION_NODE: number; + readonly COMMENT_NODE: number; + readonly DOCUMENT_FRAGMENT_NODE: number; + readonly DOCUMENT_NODE: number; + readonly DOCUMENT_POSITION_CONTAINED_BY: number; + readonly DOCUMENT_POSITION_CONTAINS: number; + readonly DOCUMENT_POSITION_DISCONNECTED: number; + readonly DOCUMENT_POSITION_FOLLOWING: number; + readonly DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC: number; + readonly DOCUMENT_POSITION_PRECEDING: number; + readonly DOCUMENT_TYPE_NODE: number; + readonly ELEMENT_NODE: number; + readonly ENTITY_NODE: number; + readonly ENTITY_REFERENCE_NODE: number; + readonly NOTATION_NODE: number; + readonly PROCESSING_INSTRUCTION_NODE: number; + readonly TEXT_NODE: number; } declare var Node: { prototype: Node; new(): Node; - ATTRIBUTE_NODE: number; - CDATA_SECTION_NODE: number; - COMMENT_NODE: number; - DOCUMENT_FRAGMENT_NODE: number; - DOCUMENT_NODE: number; - DOCUMENT_POSITION_CONTAINED_BY: number; - DOCUMENT_POSITION_CONTAINS: number; - DOCUMENT_POSITION_DISCONNECTED: number; - DOCUMENT_POSITION_FOLLOWING: number; - DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC: number; - DOCUMENT_POSITION_PRECEDING: number; - DOCUMENT_TYPE_NODE: number; - ELEMENT_NODE: number; - ENTITY_NODE: number; - ENTITY_REFERENCE_NODE: number; - NOTATION_NODE: number; - PROCESSING_INSTRUCTION_NODE: number; - TEXT_NODE: number; + readonly ATTRIBUTE_NODE: number; + readonly CDATA_SECTION_NODE: number; + readonly COMMENT_NODE: number; + readonly DOCUMENT_FRAGMENT_NODE: number; + readonly DOCUMENT_NODE: number; + readonly DOCUMENT_POSITION_CONTAINED_BY: number; + readonly DOCUMENT_POSITION_CONTAINS: number; + readonly DOCUMENT_POSITION_DISCONNECTED: number; + readonly DOCUMENT_POSITION_FOLLOWING: number; + readonly DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC: number; + readonly DOCUMENT_POSITION_PRECEDING: number; + readonly DOCUMENT_TYPE_NODE: number; + readonly ELEMENT_NODE: number; + readonly ENTITY_NODE: number; + readonly ENTITY_REFERENCE_NODE: number; + readonly NOTATION_NODE: number; + readonly PROCESSING_INSTRUCTION_NODE: number; + readonly TEXT_NODE: number; } interface NodeFilter { @@ -8188,29 +8806,29 @@ interface NodeFilter { } declare var NodeFilter: { - FILTER_ACCEPT: number; - FILTER_REJECT: number; - FILTER_SKIP: number; - SHOW_ALL: number; - SHOW_ATTRIBUTE: number; - SHOW_CDATA_SECTION: number; - SHOW_COMMENT: number; - SHOW_DOCUMENT: number; - SHOW_DOCUMENT_FRAGMENT: number; - SHOW_DOCUMENT_TYPE: number; - SHOW_ELEMENT: number; - SHOW_ENTITY: number; - SHOW_ENTITY_REFERENCE: number; - SHOW_NOTATION: number; - SHOW_PROCESSING_INSTRUCTION: number; - SHOW_TEXT: number; + readonly FILTER_ACCEPT: number; + readonly FILTER_REJECT: number; + readonly FILTER_SKIP: number; + readonly SHOW_ALL: number; + readonly SHOW_ATTRIBUTE: number; + readonly SHOW_CDATA_SECTION: number; + readonly SHOW_COMMENT: number; + readonly SHOW_DOCUMENT: number; + readonly SHOW_DOCUMENT_FRAGMENT: number; + readonly SHOW_DOCUMENT_TYPE: number; + readonly SHOW_ELEMENT: number; + readonly SHOW_ENTITY: number; + readonly SHOW_ENTITY_REFERENCE: number; + readonly SHOW_NOTATION: number; + readonly SHOW_PROCESSING_INSTRUCTION: number; + readonly SHOW_TEXT: number; } interface NodeIterator { - expandEntityReferences: boolean; - filter: NodeFilter; - root: Node; - whatToShow: number; + readonly expandEntityReferences: boolean; + readonly filter: NodeFilter; + readonly root: Node; + readonly whatToShow: number; detach(): void; nextNode(): Node; previousNode(): Node; @@ -8222,7 +8840,7 @@ declare var NodeIterator: { } interface NodeList { - length: number; + readonly length: number; item(index: number): Node; [index: number]: Node; } @@ -8241,13 +8859,13 @@ declare var OES_element_index_uint: { } interface OES_standard_derivatives { - FRAGMENT_SHADER_DERIVATIVE_HINT_OES: number; + readonly FRAGMENT_SHADER_DERIVATIVE_HINT_OES: number; } declare var OES_standard_derivatives: { prototype: OES_standard_derivatives; new(): OES_standard_derivatives; - FRAGMENT_SHADER_DERIVATIVE_HINT_OES: number; + readonly FRAGMENT_SHADER_DERIVATIVE_HINT_OES: number; } interface OES_texture_float { @@ -8267,7 +8885,7 @@ declare var OES_texture_float_linear: { } interface OfflineAudioCompletionEvent extends Event { - renderedBuffer: AudioBuffer; + readonly renderedBuffer: AudioBuffer; } declare var OfflineAudioCompletionEvent: { @@ -8277,7 +8895,7 @@ declare var OfflineAudioCompletionEvent: { interface OfflineAudioContext extends AudioContext { oncomplete: (ev: Event) => any; - startRendering(): void; + startRendering(): PromiseLike; addEventListener(type: "complete", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -8288,14 +8906,14 @@ declare var OfflineAudioContext: { } interface OscillatorNode extends AudioNode { - detune: AudioParam; - frequency: AudioParam; - onended: (ev: Event) => any; + readonly detune: AudioParam; + readonly frequency: AudioParam; + onended: (ev: MediaStreamErrorEvent) => any; type: string; setPeriodicWave(periodicWave: PeriodicWave): void; start(when?: number): void; stop(when?: number): void; - addEventListener(type: "ended", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "ended", listener: (ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -8304,8 +8922,25 @@ declare var OscillatorNode: { new(): OscillatorNode; } +interface OverflowEvent extends UIEvent { + readonly horizontalOverflow: boolean; + readonly orient: number; + readonly verticalOverflow: boolean; + readonly BOTH: number; + readonly HORIZONTAL: number; + readonly VERTICAL: number; +} + +declare var OverflowEvent: { + prototype: OverflowEvent; + new(): OverflowEvent; + readonly BOTH: number; + readonly HORIZONTAL: number; + readonly VERTICAL: number; +} + interface PageTransitionEvent extends Event { - persisted: boolean; + readonly persisted: boolean; } declare var PageTransitionEvent: { @@ -8333,17 +8968,17 @@ declare var PannerNode: { } interface PerfWidgetExternal { - activeNetworkRequestCount: number; - averageFrameTime: number; - averagePaintTime: number; - extraInformationEnabled: boolean; - independentRenderingEnabled: boolean; - irDisablingContentString: string; - irStatusAvailable: boolean; - maxCpuSpeed: number; - paintRequestsPerSecond: number; - performanceCounter: number; - performanceCounterFrequency: number; + readonly activeNetworkRequestCount: number; + readonly averageFrameTime: number; + readonly averagePaintTime: number; + readonly extraInformationEnabled: boolean; + readonly independentRenderingEnabled: boolean; + readonly irDisablingContentString: string; + readonly irStatusAvailable: boolean; + readonly maxCpuSpeed: number; + readonly paintRequestsPerSecond: number; + readonly performanceCounter: number; + readonly performanceCounterFrequency: number; addEventListener(eventType: string, callback: Function): void; getMemoryUsage(): number; getProcessCpuUsage(): number; @@ -8362,8 +8997,8 @@ declare var PerfWidgetExternal: { } interface Performance { - navigation: PerformanceNavigation; - timing: PerformanceTiming; + readonly navigation: PerformanceNavigation; + readonly timing: PerformanceTiming; clearMarks(markName?: string): void; clearMeasures(measureName?: string): void; clearResourceTimings(): void; @@ -8385,10 +9020,10 @@ declare var Performance: { } interface PerformanceEntry { - duration: number; - entryType: string; - name: string; - startTime: number; + readonly duration: number; + readonly entryType: string; + readonly name: string; + readonly startTime: number; } declare var PerformanceEntry: { @@ -8413,47 +9048,47 @@ declare var PerformanceMeasure: { } interface PerformanceNavigation { - redirectCount: number; - type: number; + readonly redirectCount: number; + readonly type: number; toJSON(): any; - TYPE_BACK_FORWARD: number; - TYPE_NAVIGATE: number; - TYPE_RELOAD: number; - TYPE_RESERVED: number; + readonly TYPE_BACK_FORWARD: number; + readonly TYPE_NAVIGATE: number; + readonly TYPE_RELOAD: number; + readonly TYPE_RESERVED: number; } declare var PerformanceNavigation: { prototype: PerformanceNavigation; new(): PerformanceNavigation; - TYPE_BACK_FORWARD: number; - TYPE_NAVIGATE: number; - TYPE_RELOAD: number; - TYPE_RESERVED: number; + readonly TYPE_BACK_FORWARD: number; + readonly TYPE_NAVIGATE: number; + readonly TYPE_RELOAD: number; + readonly TYPE_RESERVED: number; } interface PerformanceNavigationTiming extends PerformanceEntry { - connectEnd: number; - connectStart: number; - domComplete: number; - domContentLoadedEventEnd: number; - domContentLoadedEventStart: number; - domInteractive: number; - domLoading: number; - domainLookupEnd: number; - domainLookupStart: number; - fetchStart: number; - loadEventEnd: number; - loadEventStart: number; - navigationStart: number; - redirectCount: number; - redirectEnd: number; - redirectStart: number; - requestStart: number; - responseEnd: number; - responseStart: number; - type: string; - unloadEventEnd: number; - unloadEventStart: number; + readonly connectEnd: number; + readonly connectStart: number; + readonly domComplete: number; + readonly domContentLoadedEventEnd: number; + readonly domContentLoadedEventStart: number; + readonly domInteractive: number; + readonly domLoading: number; + readonly domainLookupEnd: number; + readonly domainLookupStart: number; + readonly fetchStart: number; + readonly loadEventEnd: number; + readonly loadEventStart: number; + readonly navigationStart: number; + readonly redirectCount: number; + readonly redirectEnd: number; + readonly redirectStart: number; + readonly requestStart: number; + readonly responseEnd: number; + readonly responseStart: number; + readonly type: string; + readonly unloadEventEnd: number; + readonly unloadEventStart: number; } declare var PerformanceNavigationTiming: { @@ -8462,17 +9097,17 @@ declare var PerformanceNavigationTiming: { } interface PerformanceResourceTiming extends PerformanceEntry { - connectEnd: number; - connectStart: number; - domainLookupEnd: number; - domainLookupStart: number; - fetchStart: number; - initiatorType: string; - redirectEnd: number; - redirectStart: number; - requestStart: number; - responseEnd: number; - responseStart: number; + readonly connectEnd: number; + readonly connectStart: number; + readonly domainLookupEnd: number; + readonly domainLookupStart: number; + readonly fetchStart: number; + readonly initiatorType: string; + readonly redirectEnd: number; + readonly redirectStart: number; + readonly requestStart: number; + readonly responseEnd: number; + readonly responseStart: number; } declare var PerformanceResourceTiming: { @@ -8481,27 +9116,27 @@ declare var PerformanceResourceTiming: { } interface PerformanceTiming { - connectEnd: number; - connectStart: number; - domComplete: number; - domContentLoadedEventEnd: number; - domContentLoadedEventStart: number; - domInteractive: number; - domLoading: number; - domainLookupEnd: number; - domainLookupStart: number; - fetchStart: number; - loadEventEnd: number; - loadEventStart: number; - msFirstPaint: number; - navigationStart: number; - redirectEnd: number; - redirectStart: number; - requestStart: number; - responseEnd: number; - responseStart: number; - unloadEventEnd: number; - unloadEventStart: number; + readonly connectEnd: number; + readonly connectStart: number; + readonly domComplete: number; + readonly domContentLoadedEventEnd: number; + readonly domContentLoadedEventStart: number; + readonly domInteractive: number; + readonly domLoading: number; + readonly domainLookupEnd: number; + readonly domainLookupStart: number; + readonly fetchStart: number; + readonly loadEventEnd: number; + readonly loadEventStart: number; + readonly msFirstPaint: number; + readonly navigationStart: number; + readonly redirectEnd: number; + readonly redirectStart: number; + readonly requestStart: number; + readonly responseEnd: number; + readonly responseStart: number; + readonly unloadEventEnd: number; + readonly unloadEventStart: number; toJSON(): any; } @@ -8519,7 +9154,7 @@ declare var PeriodicWave: { } interface PermissionRequest extends DeferredPermissionRequest { - state: string; + readonly state: string; defer(): void; } @@ -8529,7 +9164,7 @@ declare var PermissionRequest: { } interface PermissionRequestedEvent extends Event { - permissionRequest: PermissionRequest; + readonly permissionRequest: PermissionRequest; } declare var PermissionRequestedEvent: { @@ -8538,11 +9173,11 @@ declare var PermissionRequestedEvent: { } interface Plugin { - description: string; - filename: string; - length: number; - name: string; - version: string; + readonly description: string; + readonly filename: string; + readonly length: number; + readonly name: string; + readonly version: string; item(index: number): MimeType; namedItem(type: string): MimeType; [index: number]: MimeType; @@ -8554,7 +9189,7 @@ declare var Plugin: { } interface PluginArray { - length: number; + readonly length: number; item(index: number): Plugin; namedItem(name: string): Plugin; refresh(reload?: boolean): void; @@ -8567,18 +9202,18 @@ declare var PluginArray: { } interface PointerEvent extends MouseEvent { - currentPoint: any; - height: number; - hwTimestamp: number; - intermediatePoints: any; - isPrimary: boolean; - pointerId: number; - pointerType: any; - pressure: number; - rotation: number; - tiltX: number; - tiltY: number; - width: number; + readonly currentPoint: any; + readonly height: number; + readonly hwTimestamp: number; + readonly intermediatePoints: any; + readonly isPrimary: boolean; + readonly pointerId: number; + readonly pointerType: any; + readonly pressure: number; + readonly rotation: number; + readonly tiltX: number; + readonly tiltY: number; + readonly width: number; getCurrentPoint(element: Element): void; getIntermediatePoints(element: Element): void; 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; @@ -8590,7 +9225,7 @@ declare var PointerEvent: { } interface PopStateEvent extends Event { - state: any; + readonly state: any; initPopStateEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, stateArg: any): void; } @@ -8600,8 +9235,8 @@ declare var PopStateEvent: { } interface Position { - coords: Coordinates; - timestamp: number; + readonly coords: Coordinates; + readonly timestamp: number; } declare var Position: { @@ -8610,24 +9245,24 @@ declare var Position: { } interface PositionError { - code: number; - message: string; + readonly code: number; + readonly message: string; toString(): string; - PERMISSION_DENIED: number; - POSITION_UNAVAILABLE: number; - TIMEOUT: number; + readonly PERMISSION_DENIED: number; + readonly POSITION_UNAVAILABLE: number; + readonly TIMEOUT: number; } declare var PositionError: { prototype: PositionError; new(): PositionError; - PERMISSION_DENIED: number; - POSITION_UNAVAILABLE: number; - TIMEOUT: number; + readonly PERMISSION_DENIED: number; + readonly POSITION_UNAVAILABLE: number; + readonly TIMEOUT: number; } interface ProcessingInstruction extends CharacterData { - target: string; + readonly target: string; } declare var ProcessingInstruction: { @@ -8636,9 +9271,9 @@ declare var ProcessingInstruction: { } interface ProgressEvent extends Event { - lengthComputable: boolean; - loaded: number; - total: number; + readonly lengthComputable: boolean; + readonly loaded: number; + readonly total: number; initProgressEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, lengthComputableArg: boolean, loadedArg: number, totalArg: number): void; } @@ -8647,13 +9282,210 @@ declare var ProgressEvent: { new(type: string, eventInitDict?: ProgressEventInit): ProgressEvent; } +interface RTCDTMFToneChangeEvent extends Event { + readonly tone: string; +} + +declare var RTCDTMFToneChangeEvent: { + prototype: RTCDTMFToneChangeEvent; + new(type: string, eventInitDict: RTCDTMFToneChangeEventInit): RTCDTMFToneChangeEvent; +} + +interface RTCDtlsTransport extends RTCStatsProvider { + ondtlsstatechange: (ev: RTCDtlsTransportStateChangedEvent) => any; + onerror: (ev: Event) => any; + readonly state: string; + readonly transport: RTCIceTransport; + getLocalParameters(): RTCDtlsParameters; + getRemoteCertificates(): ArrayBuffer[]; + getRemoteParameters(): RTCDtlsParameters; + start(remoteParameters: RTCDtlsParameters): void; + stop(): void; + addEventListener(type: "dtlsstatechange", listener: (ev: RTCDtlsTransportStateChangedEvent) => any, useCapture?: boolean): void; + addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var RTCDtlsTransport: { + prototype: RTCDtlsTransport; + new(transport: RTCIceTransport): RTCDtlsTransport; +} + +interface RTCDtlsTransportStateChangedEvent extends Event { + readonly state: string; +} + +declare var RTCDtlsTransportStateChangedEvent: { + prototype: RTCDtlsTransportStateChangedEvent; + new(): RTCDtlsTransportStateChangedEvent; +} + +interface RTCDtmfSender extends EventTarget { + readonly canInsertDTMF: boolean; + readonly duration: number; + readonly interToneGap: number; + ontonechange: (ev: RTCDTMFToneChangeEvent) => any; + readonly sender: RTCRtpSender; + readonly toneBuffer: string; + insertDTMF(tones: string, duration?: number, interToneGap?: number): void; + addEventListener(type: "tonechange", listener: (ev: RTCDTMFToneChangeEvent) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var RTCDtmfSender: { + prototype: RTCDtmfSender; + new(sender: RTCRtpSender): RTCDtmfSender; +} + +interface RTCIceCandidatePairChangedEvent extends Event { + readonly pair: RTCIceCandidatePair; +} + +declare var RTCIceCandidatePairChangedEvent: { + prototype: RTCIceCandidatePairChangedEvent; + new(): RTCIceCandidatePairChangedEvent; +} + +interface RTCIceGatherer extends RTCStatsProvider { + readonly component: string; + onerror: (ev: Event) => any; + onlocalcandidate: (ev: RTCIceGathererEvent) => any; + createAssociatedGatherer(): RTCIceGatherer; + getLocalCandidates(): RTCIceCandidate[]; + getLocalParameters(): RTCIceParameters; + addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: "localcandidate", listener: (ev: RTCIceGathererEvent) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var RTCIceGatherer: { + prototype: RTCIceGatherer; + new(options: RTCIceGatherOptions): RTCIceGatherer; +} + +interface RTCIceGathererEvent extends Event { + readonly candidate: RTCIceCandidate | RTCIceCandidateComplete; +} + +declare var RTCIceGathererEvent: { + prototype: RTCIceGathererEvent; + new(): RTCIceGathererEvent; +} + +interface RTCIceTransport extends RTCStatsProvider { + readonly component: string; + readonly iceGatherer: RTCIceGatherer; + oncandidatepairchange: (ev: RTCIceCandidatePairChangedEvent) => any; + onicestatechange: (ev: RTCIceTransportStateChangedEvent) => any; + readonly role: string; + readonly state: string; + addRemoteCandidate(remoteCandidate: RTCIceCandidate | RTCIceCandidateComplete): void; + createAssociatedTransport(): RTCIceTransport; + getNominatedCandidatePair(): RTCIceCandidatePair; + getRemoteCandidates(): RTCIceCandidate[]; + getRemoteParameters(): RTCIceParameters; + setRemoteCandidates(remoteCandidates: RTCIceCandidate[]): void; + start(gatherer: RTCIceGatherer, remoteParameters: RTCIceParameters, role?: string): void; + stop(): void; + addEventListener(type: "candidatepairchange", listener: (ev: RTCIceCandidatePairChangedEvent) => any, useCapture?: boolean): void; + addEventListener(type: "icestatechange", listener: (ev: RTCIceTransportStateChangedEvent) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var RTCIceTransport: { + prototype: RTCIceTransport; + new(): RTCIceTransport; +} + +interface RTCIceTransportStateChangedEvent extends Event { + readonly state: string; +} + +declare var RTCIceTransportStateChangedEvent: { + prototype: RTCIceTransportStateChangedEvent; + new(): RTCIceTransportStateChangedEvent; +} + +interface RTCRtpReceiver extends RTCStatsProvider { + onerror: (ev: Event) => any; + readonly rtcpTransport: RTCDtlsTransport; + readonly track: MediaStreamTrack; + readonly transport: RTCDtlsTransport | RTCSrtpSdesTransport; + getContributingSources(): RTCRtpContributingSource[]; + receive(parameters: RTCRtpParameters): void; + requestSendCSRC(csrc: number): void; + setTransport(transport: RTCDtlsTransport | RTCSrtpSdesTransport, rtcpTransport?: RTCDtlsTransport): void; + stop(): void; + addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var RTCRtpReceiver: { + prototype: RTCRtpReceiver; + new(transport: RTCDtlsTransport | RTCSrtpSdesTransport, kind: string, rtcpTransport?: RTCDtlsTransport): RTCRtpReceiver; + getCapabilities(kind?: string): RTCRtpCapabilities; +} + +interface RTCRtpSender extends RTCStatsProvider { + onerror: (ev: Event) => any; + onssrcconflict: (ev: RTCSsrcConflictEvent) => any; + readonly rtcpTransport: RTCDtlsTransport; + readonly track: MediaStreamTrack; + readonly transport: RTCDtlsTransport | RTCSrtpSdesTransport; + send(parameters: RTCRtpParameters): void; + setTrack(track: MediaStreamTrack): void; + setTransport(transport: RTCDtlsTransport | RTCSrtpSdesTransport, rtcpTransport?: RTCDtlsTransport): void; + stop(): void; + addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: "ssrcconflict", listener: (ev: RTCSsrcConflictEvent) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var RTCRtpSender: { + prototype: RTCRtpSender; + new(track: MediaStreamTrack, transport: RTCDtlsTransport | RTCSrtpSdesTransport, rtcpTransport?: RTCDtlsTransport): RTCRtpSender; + getCapabilities(kind?: string): RTCRtpCapabilities; +} + +interface RTCSrtpSdesTransport extends EventTarget { + onerror: (ev: Event) => any; + readonly transport: RTCIceTransport; + addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var RTCSrtpSdesTransport: { + prototype: RTCSrtpSdesTransport; + new(transport: RTCIceTransport, encryptParameters: RTCSrtpSdesParameters, decryptParameters: RTCSrtpSdesParameters): RTCSrtpSdesTransport; + getLocalParameters(): RTCSrtpSdesParameters[]; +} + +interface RTCSsrcConflictEvent extends Event { + readonly ssrc: number; +} + +declare var RTCSsrcConflictEvent: { + prototype: RTCSsrcConflictEvent; + new(): RTCSsrcConflictEvent; +} + +interface RTCStatsProvider extends EventTarget { + getStats(): PromiseLike; + msGetStats(): PromiseLike; +} + +declare var RTCStatsProvider: { + prototype: RTCStatsProvider; + new(): RTCStatsProvider; +} + interface Range { - collapsed: boolean; - commonAncestorContainer: Node; - endContainer: Node; - endOffset: number; - startContainer: Node; - startOffset: number; + readonly collapsed: boolean; + readonly commonAncestorContainer: Node; + readonly endContainer: Node; + readonly endOffset: number; + readonly startContainer: Node; + readonly startOffset: number; cloneContents(): DocumentFragment; cloneRange(): Range; collapse(toStart: boolean): void; @@ -8676,23 +9508,23 @@ interface Range { setStartBefore(refNode: Node): void; surroundContents(newParent: Node): void; toString(): string; - END_TO_END: number; - END_TO_START: number; - START_TO_END: number; - START_TO_START: number; + readonly END_TO_END: number; + readonly END_TO_START: number; + readonly START_TO_END: number; + readonly START_TO_START: number; } declare var Range: { prototype: Range; new(): Range; - END_TO_END: number; - END_TO_START: number; - START_TO_END: number; - START_TO_START: number; + readonly END_TO_END: number; + readonly END_TO_START: number; + readonly START_TO_END: number; + readonly START_TO_START: number; } interface SVGAElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired, SVGURIReference { - target: SVGAnimatedString; + readonly target: SVGAnimatedString; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -8702,32 +9534,32 @@ declare var SVGAElement: { } interface SVGAngle { - unitType: number; + readonly unitType: number; value: number; valueAsString: string; valueInSpecifiedUnits: number; convertToSpecifiedUnits(unitType: number): void; newValueSpecifiedUnits(unitType: number, valueInSpecifiedUnits: number): void; - SVG_ANGLETYPE_DEG: number; - SVG_ANGLETYPE_GRAD: number; - SVG_ANGLETYPE_RAD: number; - SVG_ANGLETYPE_UNKNOWN: number; - SVG_ANGLETYPE_UNSPECIFIED: number; + readonly SVG_ANGLETYPE_DEG: number; + readonly SVG_ANGLETYPE_GRAD: number; + readonly SVG_ANGLETYPE_RAD: number; + readonly SVG_ANGLETYPE_UNKNOWN: number; + readonly SVG_ANGLETYPE_UNSPECIFIED: number; } declare var SVGAngle: { prototype: SVGAngle; new(): SVGAngle; - SVG_ANGLETYPE_DEG: number; - SVG_ANGLETYPE_GRAD: number; - SVG_ANGLETYPE_RAD: number; - SVG_ANGLETYPE_UNKNOWN: number; - SVG_ANGLETYPE_UNSPECIFIED: number; + readonly SVG_ANGLETYPE_DEG: number; + readonly SVG_ANGLETYPE_GRAD: number; + readonly SVG_ANGLETYPE_RAD: number; + readonly SVG_ANGLETYPE_UNKNOWN: number; + readonly SVG_ANGLETYPE_UNSPECIFIED: number; } interface SVGAnimatedAngle { - animVal: SVGAngle; - baseVal: SVGAngle; + readonly animVal: SVGAngle; + readonly baseVal: SVGAngle; } declare var SVGAnimatedAngle: { @@ -8736,7 +9568,7 @@ declare var SVGAnimatedAngle: { } interface SVGAnimatedBoolean { - animVal: boolean; + readonly animVal: boolean; baseVal: boolean; } @@ -8746,7 +9578,7 @@ declare var SVGAnimatedBoolean: { } interface SVGAnimatedEnumeration { - animVal: number; + readonly animVal: number; baseVal: number; } @@ -8756,7 +9588,7 @@ declare var SVGAnimatedEnumeration: { } interface SVGAnimatedInteger { - animVal: number; + readonly animVal: number; baseVal: number; } @@ -8766,8 +9598,8 @@ declare var SVGAnimatedInteger: { } interface SVGAnimatedLength { - animVal: SVGLength; - baseVal: SVGLength; + readonly animVal: SVGLength; + readonly baseVal: SVGLength; } declare var SVGAnimatedLength: { @@ -8776,8 +9608,8 @@ declare var SVGAnimatedLength: { } interface SVGAnimatedLengthList { - animVal: SVGLengthList; - baseVal: SVGLengthList; + readonly animVal: SVGLengthList; + readonly baseVal: SVGLengthList; } declare var SVGAnimatedLengthList: { @@ -8786,7 +9618,7 @@ declare var SVGAnimatedLengthList: { } interface SVGAnimatedNumber { - animVal: number; + readonly animVal: number; baseVal: number; } @@ -8796,8 +9628,8 @@ declare var SVGAnimatedNumber: { } interface SVGAnimatedNumberList { - animVal: SVGNumberList; - baseVal: SVGNumberList; + readonly animVal: SVGNumberList; + readonly baseVal: SVGNumberList; } declare var SVGAnimatedNumberList: { @@ -8806,8 +9638,8 @@ declare var SVGAnimatedNumberList: { } interface SVGAnimatedPreserveAspectRatio { - animVal: SVGPreserveAspectRatio; - baseVal: SVGPreserveAspectRatio; + readonly animVal: SVGPreserveAspectRatio; + readonly baseVal: SVGPreserveAspectRatio; } declare var SVGAnimatedPreserveAspectRatio: { @@ -8816,8 +9648,8 @@ declare var SVGAnimatedPreserveAspectRatio: { } interface SVGAnimatedRect { - animVal: SVGRect; - baseVal: SVGRect; + readonly animVal: SVGRect; + readonly baseVal: SVGRect; } declare var SVGAnimatedRect: { @@ -8826,7 +9658,7 @@ declare var SVGAnimatedRect: { } interface SVGAnimatedString { - animVal: string; + readonly animVal: string; baseVal: string; } @@ -8836,8 +9668,8 @@ declare var SVGAnimatedString: { } interface SVGAnimatedTransformList { - animVal: SVGTransformList; - baseVal: SVGTransformList; + readonly animVal: SVGTransformList; + readonly baseVal: SVGTransformList; } declare var SVGAnimatedTransformList: { @@ -8846,9 +9678,9 @@ declare var SVGAnimatedTransformList: { } interface SVGCircleElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired { - cx: SVGAnimatedLength; - cy: SVGAnimatedLength; - r: SVGAnimatedLength; + readonly cx: SVGAnimatedLength; + readonly cy: SVGAnimatedLength; + readonly r: SVGAnimatedLength; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -8858,7 +9690,7 @@ declare var SVGCircleElement: { } interface SVGClipPathElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired, SVGUnitTypes { - clipPathUnits: SVGAnimatedEnumeration; + readonly clipPathUnits: SVGAnimatedEnumeration; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -8868,30 +9700,30 @@ declare var SVGClipPathElement: { } interface SVGComponentTransferFunctionElement extends SVGElement { - amplitude: SVGAnimatedNumber; - exponent: SVGAnimatedNumber; - intercept: SVGAnimatedNumber; - offset: SVGAnimatedNumber; - slope: SVGAnimatedNumber; - tableValues: SVGAnimatedNumberList; - type: SVGAnimatedEnumeration; - SVG_FECOMPONENTTRANSFER_TYPE_DISCRETE: number; - SVG_FECOMPONENTTRANSFER_TYPE_GAMMA: number; - SVG_FECOMPONENTTRANSFER_TYPE_IDENTITY: number; - SVG_FECOMPONENTTRANSFER_TYPE_LINEAR: number; - SVG_FECOMPONENTTRANSFER_TYPE_TABLE: number; - SVG_FECOMPONENTTRANSFER_TYPE_UNKNOWN: number; + readonly amplitude: SVGAnimatedNumber; + readonly exponent: SVGAnimatedNumber; + readonly intercept: SVGAnimatedNumber; + readonly offset: SVGAnimatedNumber; + readonly slope: SVGAnimatedNumber; + readonly tableValues: SVGAnimatedNumberList; + readonly type: SVGAnimatedEnumeration; + readonly SVG_FECOMPONENTTRANSFER_TYPE_DISCRETE: number; + readonly SVG_FECOMPONENTTRANSFER_TYPE_GAMMA: number; + readonly SVG_FECOMPONENTTRANSFER_TYPE_IDENTITY: number; + readonly SVG_FECOMPONENTTRANSFER_TYPE_LINEAR: number; + readonly SVG_FECOMPONENTTRANSFER_TYPE_TABLE: number; + readonly SVG_FECOMPONENTTRANSFER_TYPE_UNKNOWN: number; } declare var SVGComponentTransferFunctionElement: { prototype: SVGComponentTransferFunctionElement; new(): SVGComponentTransferFunctionElement; - SVG_FECOMPONENTTRANSFER_TYPE_DISCRETE: number; - SVG_FECOMPONENTTRANSFER_TYPE_GAMMA: number; - SVG_FECOMPONENTTRANSFER_TYPE_IDENTITY: number; - SVG_FECOMPONENTTRANSFER_TYPE_LINEAR: number; - SVG_FECOMPONENTTRANSFER_TYPE_TABLE: number; - SVG_FECOMPONENTTRANSFER_TYPE_UNKNOWN: number; + readonly SVG_FECOMPONENTTRANSFER_TYPE_DISCRETE: number; + readonly SVG_FECOMPONENTTRANSFER_TYPE_GAMMA: number; + readonly SVG_FECOMPONENTTRANSFER_TYPE_IDENTITY: number; + readonly SVG_FECOMPONENTTRANSFER_TYPE_LINEAR: number; + readonly SVG_FECOMPONENTTRANSFER_TYPE_TABLE: number; + readonly SVG_FECOMPONENTTRANSFER_TYPE_UNKNOWN: number; } interface SVGDefsElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired { @@ -8913,7 +9745,6 @@ declare var SVGDescElement: { } interface SVGElement extends Element { - id: string; onclick: (ev: MouseEvent) => any; ondblclick: (ev: MouseEvent) => any; onfocusin: (ev: FocusEvent) => any; @@ -8924,8 +9755,8 @@ interface SVGElement extends Element { onmouseout: (ev: MouseEvent) => any; onmouseover: (ev: MouseEvent) => any; onmouseup: (ev: MouseEvent) => any; - ownerSVGElement: SVGSVGElement; - viewportElement: SVGElement; + readonly ownerSVGElement: SVGSVGElement; + readonly viewportElement: SVGElement; xmlbase: string; className: any; addEventListener(type: "MSGestureChange", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void; @@ -8983,14 +9814,14 @@ declare var SVGElement: { } interface SVGElementInstance extends EventTarget { - childNodes: SVGElementInstanceList; - correspondingElement: SVGElement; - correspondingUseElement: SVGUseElement; - firstChild: SVGElementInstance; - lastChild: SVGElementInstance; - nextSibling: SVGElementInstance; - parentNode: SVGElementInstance; - previousSibling: SVGElementInstance; + readonly childNodes: SVGElementInstanceList; + readonly correspondingElement: SVGElement; + readonly correspondingUseElement: SVGUseElement; + readonly firstChild: SVGElementInstance; + readonly lastChild: SVGElementInstance; + readonly nextSibling: SVGElementInstance; + readonly parentNode: SVGElementInstance; + readonly previousSibling: SVGElementInstance; } declare var SVGElementInstance: { @@ -8999,7 +9830,7 @@ declare var SVGElementInstance: { } interface SVGElementInstanceList { - length: number; + readonly length: number; item(index: number): SVGElementInstance; } @@ -9009,10 +9840,10 @@ declare var SVGElementInstanceList: { } interface SVGEllipseElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired { - cx: SVGAnimatedLength; - cy: SVGAnimatedLength; - rx: SVGAnimatedLength; - ry: SVGAnimatedLength; + readonly cx: SVGAnimatedLength; + readonly cy: SVGAnimatedLength; + readonly rx: SVGAnimatedLength; + readonly ry: SVGAnimatedLength; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -9022,75 +9853,75 @@ declare var SVGEllipseElement: { } interface SVGFEBlendElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { - in1: SVGAnimatedString; - in2: SVGAnimatedString; - mode: SVGAnimatedEnumeration; - SVG_FEBLEND_MODE_COLOR: number; - SVG_FEBLEND_MODE_COLOR_BURN: number; - SVG_FEBLEND_MODE_COLOR_DODGE: number; - SVG_FEBLEND_MODE_DARKEN: number; - SVG_FEBLEND_MODE_DIFFERENCE: number; - SVG_FEBLEND_MODE_EXCLUSION: number; - SVG_FEBLEND_MODE_HARD_LIGHT: number; - SVG_FEBLEND_MODE_HUE: number; - SVG_FEBLEND_MODE_LIGHTEN: number; - SVG_FEBLEND_MODE_LUMINOSITY: number; - SVG_FEBLEND_MODE_MULTIPLY: number; - SVG_FEBLEND_MODE_NORMAL: number; - SVG_FEBLEND_MODE_OVERLAY: number; - SVG_FEBLEND_MODE_SATURATION: number; - SVG_FEBLEND_MODE_SCREEN: number; - SVG_FEBLEND_MODE_SOFT_LIGHT: number; - SVG_FEBLEND_MODE_UNKNOWN: number; + readonly in1: SVGAnimatedString; + readonly in2: SVGAnimatedString; + readonly mode: SVGAnimatedEnumeration; + readonly SVG_FEBLEND_MODE_COLOR: number; + readonly SVG_FEBLEND_MODE_COLOR_BURN: number; + readonly SVG_FEBLEND_MODE_COLOR_DODGE: number; + readonly SVG_FEBLEND_MODE_DARKEN: number; + readonly SVG_FEBLEND_MODE_DIFFERENCE: number; + readonly SVG_FEBLEND_MODE_EXCLUSION: number; + readonly SVG_FEBLEND_MODE_HARD_LIGHT: number; + readonly SVG_FEBLEND_MODE_HUE: number; + readonly SVG_FEBLEND_MODE_LIGHTEN: number; + readonly SVG_FEBLEND_MODE_LUMINOSITY: number; + readonly SVG_FEBLEND_MODE_MULTIPLY: number; + readonly SVG_FEBLEND_MODE_NORMAL: number; + readonly SVG_FEBLEND_MODE_OVERLAY: number; + readonly SVG_FEBLEND_MODE_SATURATION: number; + readonly SVG_FEBLEND_MODE_SCREEN: number; + readonly SVG_FEBLEND_MODE_SOFT_LIGHT: number; + readonly SVG_FEBLEND_MODE_UNKNOWN: number; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var SVGFEBlendElement: { prototype: SVGFEBlendElement; new(): SVGFEBlendElement; - SVG_FEBLEND_MODE_COLOR: number; - SVG_FEBLEND_MODE_COLOR_BURN: number; - SVG_FEBLEND_MODE_COLOR_DODGE: number; - SVG_FEBLEND_MODE_DARKEN: number; - SVG_FEBLEND_MODE_DIFFERENCE: number; - SVG_FEBLEND_MODE_EXCLUSION: number; - SVG_FEBLEND_MODE_HARD_LIGHT: number; - SVG_FEBLEND_MODE_HUE: number; - SVG_FEBLEND_MODE_LIGHTEN: number; - SVG_FEBLEND_MODE_LUMINOSITY: number; - SVG_FEBLEND_MODE_MULTIPLY: number; - SVG_FEBLEND_MODE_NORMAL: number; - SVG_FEBLEND_MODE_OVERLAY: number; - SVG_FEBLEND_MODE_SATURATION: number; - SVG_FEBLEND_MODE_SCREEN: number; - SVG_FEBLEND_MODE_SOFT_LIGHT: number; - SVG_FEBLEND_MODE_UNKNOWN: number; + readonly SVG_FEBLEND_MODE_COLOR: number; + readonly SVG_FEBLEND_MODE_COLOR_BURN: number; + readonly SVG_FEBLEND_MODE_COLOR_DODGE: number; + readonly SVG_FEBLEND_MODE_DARKEN: number; + readonly SVG_FEBLEND_MODE_DIFFERENCE: number; + readonly SVG_FEBLEND_MODE_EXCLUSION: number; + readonly SVG_FEBLEND_MODE_HARD_LIGHT: number; + readonly SVG_FEBLEND_MODE_HUE: number; + readonly SVG_FEBLEND_MODE_LIGHTEN: number; + readonly SVG_FEBLEND_MODE_LUMINOSITY: number; + readonly SVG_FEBLEND_MODE_MULTIPLY: number; + readonly SVG_FEBLEND_MODE_NORMAL: number; + readonly SVG_FEBLEND_MODE_OVERLAY: number; + readonly SVG_FEBLEND_MODE_SATURATION: number; + readonly SVG_FEBLEND_MODE_SCREEN: number; + readonly SVG_FEBLEND_MODE_SOFT_LIGHT: number; + readonly SVG_FEBLEND_MODE_UNKNOWN: number; } interface SVGFEColorMatrixElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { - in1: SVGAnimatedString; - type: SVGAnimatedEnumeration; - values: SVGAnimatedNumberList; - SVG_FECOLORMATRIX_TYPE_HUEROTATE: number; - SVG_FECOLORMATRIX_TYPE_LUMINANCETOALPHA: number; - SVG_FECOLORMATRIX_TYPE_MATRIX: number; - SVG_FECOLORMATRIX_TYPE_SATURATE: number; - SVG_FECOLORMATRIX_TYPE_UNKNOWN: number; + readonly in1: SVGAnimatedString; + readonly type: SVGAnimatedEnumeration; + readonly values: SVGAnimatedNumberList; + readonly SVG_FECOLORMATRIX_TYPE_HUEROTATE: number; + readonly SVG_FECOLORMATRIX_TYPE_LUMINANCETOALPHA: number; + readonly SVG_FECOLORMATRIX_TYPE_MATRIX: number; + readonly SVG_FECOLORMATRIX_TYPE_SATURATE: number; + readonly SVG_FECOLORMATRIX_TYPE_UNKNOWN: number; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var SVGFEColorMatrixElement: { prototype: SVGFEColorMatrixElement; new(): SVGFEColorMatrixElement; - SVG_FECOLORMATRIX_TYPE_HUEROTATE: number; - SVG_FECOLORMATRIX_TYPE_LUMINANCETOALPHA: number; - SVG_FECOLORMATRIX_TYPE_MATRIX: number; - SVG_FECOLORMATRIX_TYPE_SATURATE: number; - SVG_FECOLORMATRIX_TYPE_UNKNOWN: number; + readonly SVG_FECOLORMATRIX_TYPE_HUEROTATE: number; + readonly SVG_FECOLORMATRIX_TYPE_LUMINANCETOALPHA: number; + readonly SVG_FECOLORMATRIX_TYPE_MATRIX: number; + readonly SVG_FECOLORMATRIX_TYPE_SATURATE: number; + readonly SVG_FECOLORMATRIX_TYPE_UNKNOWN: number; } interface SVGFEComponentTransferElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { - in1: SVGAnimatedString; + readonly in1: SVGAnimatedString; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -9100,70 +9931,70 @@ declare var SVGFEComponentTransferElement: { } interface SVGFECompositeElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { - in1: SVGAnimatedString; - in2: SVGAnimatedString; - k1: SVGAnimatedNumber; - k2: SVGAnimatedNumber; - k3: SVGAnimatedNumber; - k4: SVGAnimatedNumber; - operator: SVGAnimatedEnumeration; - SVG_FECOMPOSITE_OPERATOR_ARITHMETIC: number; - SVG_FECOMPOSITE_OPERATOR_ATOP: number; - SVG_FECOMPOSITE_OPERATOR_IN: number; - SVG_FECOMPOSITE_OPERATOR_OUT: number; - SVG_FECOMPOSITE_OPERATOR_OVER: number; - SVG_FECOMPOSITE_OPERATOR_UNKNOWN: number; - SVG_FECOMPOSITE_OPERATOR_XOR: number; + readonly in1: SVGAnimatedString; + readonly in2: SVGAnimatedString; + readonly k1: SVGAnimatedNumber; + readonly k2: SVGAnimatedNumber; + readonly k3: SVGAnimatedNumber; + readonly k4: SVGAnimatedNumber; + readonly operator: SVGAnimatedEnumeration; + readonly SVG_FECOMPOSITE_OPERATOR_ARITHMETIC: number; + readonly SVG_FECOMPOSITE_OPERATOR_ATOP: number; + readonly SVG_FECOMPOSITE_OPERATOR_IN: number; + readonly SVG_FECOMPOSITE_OPERATOR_OUT: number; + readonly SVG_FECOMPOSITE_OPERATOR_OVER: number; + readonly SVG_FECOMPOSITE_OPERATOR_UNKNOWN: number; + readonly SVG_FECOMPOSITE_OPERATOR_XOR: number; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var SVGFECompositeElement: { prototype: SVGFECompositeElement; new(): SVGFECompositeElement; - SVG_FECOMPOSITE_OPERATOR_ARITHMETIC: number; - SVG_FECOMPOSITE_OPERATOR_ATOP: number; - SVG_FECOMPOSITE_OPERATOR_IN: number; - SVG_FECOMPOSITE_OPERATOR_OUT: number; - SVG_FECOMPOSITE_OPERATOR_OVER: number; - SVG_FECOMPOSITE_OPERATOR_UNKNOWN: number; - SVG_FECOMPOSITE_OPERATOR_XOR: number; + readonly SVG_FECOMPOSITE_OPERATOR_ARITHMETIC: number; + readonly SVG_FECOMPOSITE_OPERATOR_ATOP: number; + readonly SVG_FECOMPOSITE_OPERATOR_IN: number; + readonly SVG_FECOMPOSITE_OPERATOR_OUT: number; + readonly SVG_FECOMPOSITE_OPERATOR_OVER: number; + readonly SVG_FECOMPOSITE_OPERATOR_UNKNOWN: number; + readonly SVG_FECOMPOSITE_OPERATOR_XOR: number; } interface SVGFEConvolveMatrixElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { - bias: SVGAnimatedNumber; - divisor: SVGAnimatedNumber; - edgeMode: SVGAnimatedEnumeration; - in1: SVGAnimatedString; - kernelMatrix: SVGAnimatedNumberList; - kernelUnitLengthX: SVGAnimatedNumber; - kernelUnitLengthY: SVGAnimatedNumber; - orderX: SVGAnimatedInteger; - orderY: SVGAnimatedInteger; - preserveAlpha: SVGAnimatedBoolean; - targetX: SVGAnimatedInteger; - targetY: SVGAnimatedInteger; - SVG_EDGEMODE_DUPLICATE: number; - SVG_EDGEMODE_NONE: number; - SVG_EDGEMODE_UNKNOWN: number; - SVG_EDGEMODE_WRAP: number; + readonly bias: SVGAnimatedNumber; + readonly divisor: SVGAnimatedNumber; + readonly edgeMode: SVGAnimatedEnumeration; + readonly in1: SVGAnimatedString; + readonly kernelMatrix: SVGAnimatedNumberList; + readonly kernelUnitLengthX: SVGAnimatedNumber; + readonly kernelUnitLengthY: SVGAnimatedNumber; + readonly orderX: SVGAnimatedInteger; + readonly orderY: SVGAnimatedInteger; + readonly preserveAlpha: SVGAnimatedBoolean; + readonly targetX: SVGAnimatedInteger; + readonly targetY: SVGAnimatedInteger; + readonly SVG_EDGEMODE_DUPLICATE: number; + readonly SVG_EDGEMODE_NONE: number; + readonly SVG_EDGEMODE_UNKNOWN: number; + readonly SVG_EDGEMODE_WRAP: number; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var SVGFEConvolveMatrixElement: { prototype: SVGFEConvolveMatrixElement; new(): SVGFEConvolveMatrixElement; - SVG_EDGEMODE_DUPLICATE: number; - SVG_EDGEMODE_NONE: number; - SVG_EDGEMODE_UNKNOWN: number; - SVG_EDGEMODE_WRAP: number; + readonly SVG_EDGEMODE_DUPLICATE: number; + readonly SVG_EDGEMODE_NONE: number; + readonly SVG_EDGEMODE_UNKNOWN: number; + readonly SVG_EDGEMODE_WRAP: number; } interface SVGFEDiffuseLightingElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { - diffuseConstant: SVGAnimatedNumber; - in1: SVGAnimatedString; - kernelUnitLengthX: SVGAnimatedNumber; - kernelUnitLengthY: SVGAnimatedNumber; - surfaceScale: SVGAnimatedNumber; + readonly diffuseConstant: SVGAnimatedNumber; + readonly in1: SVGAnimatedString; + readonly kernelUnitLengthX: SVGAnimatedNumber; + readonly kernelUnitLengthY: SVGAnimatedNumber; + readonly surfaceScale: SVGAnimatedNumber; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -9173,32 +10004,32 @@ declare var SVGFEDiffuseLightingElement: { } interface SVGFEDisplacementMapElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { - in1: SVGAnimatedString; - in2: SVGAnimatedString; - scale: SVGAnimatedNumber; - xChannelSelector: SVGAnimatedEnumeration; - yChannelSelector: SVGAnimatedEnumeration; - SVG_CHANNEL_A: number; - SVG_CHANNEL_B: number; - SVG_CHANNEL_G: number; - SVG_CHANNEL_R: number; - SVG_CHANNEL_UNKNOWN: number; + readonly in1: SVGAnimatedString; + readonly in2: SVGAnimatedString; + readonly scale: SVGAnimatedNumber; + readonly xChannelSelector: SVGAnimatedEnumeration; + readonly yChannelSelector: SVGAnimatedEnumeration; + readonly SVG_CHANNEL_A: number; + readonly SVG_CHANNEL_B: number; + readonly SVG_CHANNEL_G: number; + readonly SVG_CHANNEL_R: number; + readonly SVG_CHANNEL_UNKNOWN: number; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var SVGFEDisplacementMapElement: { prototype: SVGFEDisplacementMapElement; new(): SVGFEDisplacementMapElement; - SVG_CHANNEL_A: number; - SVG_CHANNEL_B: number; - SVG_CHANNEL_G: number; - SVG_CHANNEL_R: number; - SVG_CHANNEL_UNKNOWN: number; + readonly SVG_CHANNEL_A: number; + readonly SVG_CHANNEL_B: number; + readonly SVG_CHANNEL_G: number; + readonly SVG_CHANNEL_R: number; + readonly SVG_CHANNEL_UNKNOWN: number; } interface SVGFEDistantLightElement extends SVGElement { - azimuth: SVGAnimatedNumber; - elevation: SVGAnimatedNumber; + readonly azimuth: SVGAnimatedNumber; + readonly elevation: SVGAnimatedNumber; } declare var SVGFEDistantLightElement: { @@ -9248,9 +10079,9 @@ declare var SVGFEFuncRElement: { } interface SVGFEGaussianBlurElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { - in1: SVGAnimatedString; - stdDeviationX: SVGAnimatedNumber; - stdDeviationY: SVGAnimatedNumber; + readonly in1: SVGAnimatedString; + readonly stdDeviationX: SVGAnimatedNumber; + readonly stdDeviationY: SVGAnimatedNumber; setStdDeviation(stdDeviationX: number, stdDeviationY: number): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -9261,7 +10092,7 @@ declare var SVGFEGaussianBlurElement: { } interface SVGFEImageElement extends SVGElement, SVGFilterPrimitiveStandardAttributes, SVGLangSpace, SVGURIReference, SVGExternalResourcesRequired { - preserveAspectRatio: SVGAnimatedPreserveAspectRatio; + readonly preserveAspectRatio: SVGAnimatedPreserveAspectRatio; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -9280,7 +10111,7 @@ declare var SVGFEMergeElement: { } interface SVGFEMergeNodeElement extends SVGElement { - in1: SVGAnimatedString; + readonly in1: SVGAnimatedString; } declare var SVGFEMergeNodeElement: { @@ -9289,28 +10120,28 @@ declare var SVGFEMergeNodeElement: { } interface SVGFEMorphologyElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { - in1: SVGAnimatedString; - operator: SVGAnimatedEnumeration; - radiusX: SVGAnimatedNumber; - radiusY: SVGAnimatedNumber; - SVG_MORPHOLOGY_OPERATOR_DILATE: number; - SVG_MORPHOLOGY_OPERATOR_ERODE: number; - SVG_MORPHOLOGY_OPERATOR_UNKNOWN: number; + readonly in1: SVGAnimatedString; + readonly operator: SVGAnimatedEnumeration; + readonly radiusX: SVGAnimatedNumber; + readonly radiusY: SVGAnimatedNumber; + readonly SVG_MORPHOLOGY_OPERATOR_DILATE: number; + readonly SVG_MORPHOLOGY_OPERATOR_ERODE: number; + readonly SVG_MORPHOLOGY_OPERATOR_UNKNOWN: number; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var SVGFEMorphologyElement: { prototype: SVGFEMorphologyElement; new(): SVGFEMorphologyElement; - SVG_MORPHOLOGY_OPERATOR_DILATE: number; - SVG_MORPHOLOGY_OPERATOR_ERODE: number; - SVG_MORPHOLOGY_OPERATOR_UNKNOWN: number; + readonly SVG_MORPHOLOGY_OPERATOR_DILATE: number; + readonly SVG_MORPHOLOGY_OPERATOR_ERODE: number; + readonly SVG_MORPHOLOGY_OPERATOR_UNKNOWN: number; } interface SVGFEOffsetElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { - dx: SVGAnimatedNumber; - dy: SVGAnimatedNumber; - in1: SVGAnimatedString; + readonly dx: SVGAnimatedNumber; + readonly dy: SVGAnimatedNumber; + readonly in1: SVGAnimatedString; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -9320,9 +10151,9 @@ declare var SVGFEOffsetElement: { } interface SVGFEPointLightElement extends SVGElement { - x: SVGAnimatedNumber; - y: SVGAnimatedNumber; - z: SVGAnimatedNumber; + readonly x: SVGAnimatedNumber; + readonly y: SVGAnimatedNumber; + readonly z: SVGAnimatedNumber; } declare var SVGFEPointLightElement: { @@ -9331,12 +10162,12 @@ declare var SVGFEPointLightElement: { } interface SVGFESpecularLightingElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { - in1: SVGAnimatedString; - kernelUnitLengthX: SVGAnimatedNumber; - kernelUnitLengthY: SVGAnimatedNumber; - specularConstant: SVGAnimatedNumber; - specularExponent: SVGAnimatedNumber; - surfaceScale: SVGAnimatedNumber; + readonly in1: SVGAnimatedString; + readonly kernelUnitLengthX: SVGAnimatedNumber; + readonly kernelUnitLengthY: SVGAnimatedNumber; + readonly specularConstant: SVGAnimatedNumber; + readonly specularExponent: SVGAnimatedNumber; + readonly surfaceScale: SVGAnimatedNumber; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -9346,14 +10177,14 @@ declare var SVGFESpecularLightingElement: { } interface SVGFESpotLightElement extends SVGElement { - limitingConeAngle: SVGAnimatedNumber; - pointsAtX: SVGAnimatedNumber; - pointsAtY: SVGAnimatedNumber; - pointsAtZ: SVGAnimatedNumber; - specularExponent: SVGAnimatedNumber; - x: SVGAnimatedNumber; - y: SVGAnimatedNumber; - z: SVGAnimatedNumber; + readonly limitingConeAngle: SVGAnimatedNumber; + readonly pointsAtX: SVGAnimatedNumber; + readonly pointsAtY: SVGAnimatedNumber; + readonly pointsAtZ: SVGAnimatedNumber; + readonly specularExponent: SVGAnimatedNumber; + readonly x: SVGAnimatedNumber; + readonly y: SVGAnimatedNumber; + readonly z: SVGAnimatedNumber; } declare var SVGFESpotLightElement: { @@ -9362,7 +10193,7 @@ declare var SVGFESpotLightElement: { } interface SVGFETileElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { - in1: SVGAnimatedString; + readonly in1: SVGAnimatedString; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -9372,41 +10203,41 @@ declare var SVGFETileElement: { } interface SVGFETurbulenceElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { - baseFrequencyX: SVGAnimatedNumber; - baseFrequencyY: SVGAnimatedNumber; - numOctaves: SVGAnimatedInteger; - seed: SVGAnimatedNumber; - stitchTiles: SVGAnimatedEnumeration; - type: SVGAnimatedEnumeration; - SVG_STITCHTYPE_NOSTITCH: number; - SVG_STITCHTYPE_STITCH: number; - SVG_STITCHTYPE_UNKNOWN: number; - SVG_TURBULENCE_TYPE_FRACTALNOISE: number; - SVG_TURBULENCE_TYPE_TURBULENCE: number; - SVG_TURBULENCE_TYPE_UNKNOWN: number; + readonly baseFrequencyX: SVGAnimatedNumber; + readonly baseFrequencyY: SVGAnimatedNumber; + readonly numOctaves: SVGAnimatedInteger; + readonly seed: SVGAnimatedNumber; + readonly stitchTiles: SVGAnimatedEnumeration; + readonly type: SVGAnimatedEnumeration; + readonly SVG_STITCHTYPE_NOSTITCH: number; + readonly SVG_STITCHTYPE_STITCH: number; + readonly SVG_STITCHTYPE_UNKNOWN: number; + readonly SVG_TURBULENCE_TYPE_FRACTALNOISE: number; + readonly SVG_TURBULENCE_TYPE_TURBULENCE: number; + readonly SVG_TURBULENCE_TYPE_UNKNOWN: number; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var SVGFETurbulenceElement: { prototype: SVGFETurbulenceElement; new(): SVGFETurbulenceElement; - SVG_STITCHTYPE_NOSTITCH: number; - SVG_STITCHTYPE_STITCH: number; - SVG_STITCHTYPE_UNKNOWN: number; - SVG_TURBULENCE_TYPE_FRACTALNOISE: number; - SVG_TURBULENCE_TYPE_TURBULENCE: number; - SVG_TURBULENCE_TYPE_UNKNOWN: number; + readonly SVG_STITCHTYPE_NOSTITCH: number; + readonly SVG_STITCHTYPE_STITCH: number; + readonly SVG_STITCHTYPE_UNKNOWN: number; + readonly SVG_TURBULENCE_TYPE_FRACTALNOISE: number; + readonly SVG_TURBULENCE_TYPE_TURBULENCE: number; + readonly SVG_TURBULENCE_TYPE_UNKNOWN: number; } interface SVGFilterElement extends SVGElement, SVGUnitTypes, SVGStylable, SVGLangSpace, SVGURIReference, SVGExternalResourcesRequired { - filterResX: SVGAnimatedInteger; - filterResY: SVGAnimatedInteger; - filterUnits: SVGAnimatedEnumeration; - height: SVGAnimatedLength; - primitiveUnits: SVGAnimatedEnumeration; - width: SVGAnimatedLength; - x: SVGAnimatedLength; - y: SVGAnimatedLength; + readonly filterResX: SVGAnimatedInteger; + readonly filterResY: SVGAnimatedInteger; + readonly filterUnits: SVGAnimatedEnumeration; + readonly height: SVGAnimatedLength; + readonly primitiveUnits: SVGAnimatedEnumeration; + readonly width: SVGAnimatedLength; + readonly x: SVGAnimatedLength; + readonly y: SVGAnimatedLength; setFilterRes(filterResX: number, filterResY: number): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -9417,10 +10248,10 @@ declare var SVGFilterElement: { } interface SVGForeignObjectElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired { - height: SVGAnimatedLength; - width: SVGAnimatedLength; - x: SVGAnimatedLength; - y: SVGAnimatedLength; + readonly height: SVGAnimatedLength; + readonly width: SVGAnimatedLength; + readonly x: SVGAnimatedLength; + readonly y: SVGAnimatedLength; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -9439,31 +10270,31 @@ declare var SVGGElement: { } interface SVGGradientElement extends SVGElement, SVGStylable, SVGExternalResourcesRequired, SVGURIReference, SVGUnitTypes { - gradientTransform: SVGAnimatedTransformList; - gradientUnits: SVGAnimatedEnumeration; - spreadMethod: SVGAnimatedEnumeration; - SVG_SPREADMETHOD_PAD: number; - SVG_SPREADMETHOD_REFLECT: number; - SVG_SPREADMETHOD_REPEAT: number; - SVG_SPREADMETHOD_UNKNOWN: number; + readonly gradientTransform: SVGAnimatedTransformList; + readonly gradientUnits: SVGAnimatedEnumeration; + readonly spreadMethod: SVGAnimatedEnumeration; + readonly SVG_SPREADMETHOD_PAD: number; + readonly SVG_SPREADMETHOD_REFLECT: number; + readonly SVG_SPREADMETHOD_REPEAT: number; + readonly SVG_SPREADMETHOD_UNKNOWN: number; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var SVGGradientElement: { prototype: SVGGradientElement; new(): SVGGradientElement; - SVG_SPREADMETHOD_PAD: number; - SVG_SPREADMETHOD_REFLECT: number; - SVG_SPREADMETHOD_REPEAT: number; - SVG_SPREADMETHOD_UNKNOWN: number; + readonly SVG_SPREADMETHOD_PAD: number; + readonly SVG_SPREADMETHOD_REFLECT: number; + readonly SVG_SPREADMETHOD_REPEAT: number; + readonly SVG_SPREADMETHOD_UNKNOWN: number; } interface SVGImageElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired, SVGURIReference { - height: SVGAnimatedLength; - preserveAspectRatio: SVGAnimatedPreserveAspectRatio; - width: SVGAnimatedLength; - x: SVGAnimatedLength; - y: SVGAnimatedLength; + readonly height: SVGAnimatedLength; + readonly preserveAspectRatio: SVGAnimatedPreserveAspectRatio; + readonly width: SVGAnimatedLength; + readonly x: SVGAnimatedLength; + readonly y: SVGAnimatedLength; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -9473,43 +10304,43 @@ declare var SVGImageElement: { } interface SVGLength { - unitType: number; + readonly unitType: number; value: number; valueAsString: string; valueInSpecifiedUnits: number; convertToSpecifiedUnits(unitType: number): void; newValueSpecifiedUnits(unitType: number, valueInSpecifiedUnits: number): void; - SVG_LENGTHTYPE_CM: number; - SVG_LENGTHTYPE_EMS: number; - SVG_LENGTHTYPE_EXS: number; - SVG_LENGTHTYPE_IN: number; - SVG_LENGTHTYPE_MM: number; - SVG_LENGTHTYPE_NUMBER: number; - SVG_LENGTHTYPE_PC: number; - SVG_LENGTHTYPE_PERCENTAGE: number; - SVG_LENGTHTYPE_PT: number; - SVG_LENGTHTYPE_PX: number; - SVG_LENGTHTYPE_UNKNOWN: number; + readonly SVG_LENGTHTYPE_CM: number; + readonly SVG_LENGTHTYPE_EMS: number; + readonly SVG_LENGTHTYPE_EXS: number; + readonly SVG_LENGTHTYPE_IN: number; + readonly SVG_LENGTHTYPE_MM: number; + readonly SVG_LENGTHTYPE_NUMBER: number; + readonly SVG_LENGTHTYPE_PC: number; + readonly SVG_LENGTHTYPE_PERCENTAGE: number; + readonly SVG_LENGTHTYPE_PT: number; + readonly SVG_LENGTHTYPE_PX: number; + readonly SVG_LENGTHTYPE_UNKNOWN: number; } declare var SVGLength: { prototype: SVGLength; new(): SVGLength; - SVG_LENGTHTYPE_CM: number; - SVG_LENGTHTYPE_EMS: number; - SVG_LENGTHTYPE_EXS: number; - SVG_LENGTHTYPE_IN: number; - SVG_LENGTHTYPE_MM: number; - SVG_LENGTHTYPE_NUMBER: number; - SVG_LENGTHTYPE_PC: number; - SVG_LENGTHTYPE_PERCENTAGE: number; - SVG_LENGTHTYPE_PT: number; - SVG_LENGTHTYPE_PX: number; - SVG_LENGTHTYPE_UNKNOWN: number; + readonly SVG_LENGTHTYPE_CM: number; + readonly SVG_LENGTHTYPE_EMS: number; + readonly SVG_LENGTHTYPE_EXS: number; + readonly SVG_LENGTHTYPE_IN: number; + readonly SVG_LENGTHTYPE_MM: number; + readonly SVG_LENGTHTYPE_NUMBER: number; + readonly SVG_LENGTHTYPE_PC: number; + readonly SVG_LENGTHTYPE_PERCENTAGE: number; + readonly SVG_LENGTHTYPE_PT: number; + readonly SVG_LENGTHTYPE_PX: number; + readonly SVG_LENGTHTYPE_UNKNOWN: number; } interface SVGLengthList { - numberOfItems: number; + readonly numberOfItems: number; appendItem(newItem: SVGLength): SVGLength; clear(): void; getItem(index: number): SVGLength; @@ -9525,10 +10356,10 @@ declare var SVGLengthList: { } interface SVGLineElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired { - x1: SVGAnimatedLength; - x2: SVGAnimatedLength; - y1: SVGAnimatedLength; - y2: SVGAnimatedLength; + readonly x1: SVGAnimatedLength; + readonly x2: SVGAnimatedLength; + readonly y1: SVGAnimatedLength; + readonly y2: SVGAnimatedLength; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -9538,10 +10369,10 @@ declare var SVGLineElement: { } interface SVGLinearGradientElement extends SVGGradientElement { - x1: SVGAnimatedLength; - x2: SVGAnimatedLength; - y1: SVGAnimatedLength; - y2: SVGAnimatedLength; + readonly x1: SVGAnimatedLength; + readonly x2: SVGAnimatedLength; + readonly y1: SVGAnimatedLength; + readonly y2: SVGAnimatedLength; } declare var SVGLinearGradientElement: { @@ -9550,42 +10381,42 @@ declare var SVGLinearGradientElement: { } interface SVGMarkerElement extends SVGElement, SVGStylable, SVGLangSpace, SVGExternalResourcesRequired, SVGFitToViewBox { - markerHeight: SVGAnimatedLength; - markerUnits: SVGAnimatedEnumeration; - markerWidth: SVGAnimatedLength; - orientAngle: SVGAnimatedAngle; - orientType: SVGAnimatedEnumeration; - refX: SVGAnimatedLength; - refY: SVGAnimatedLength; + readonly markerHeight: SVGAnimatedLength; + readonly markerUnits: SVGAnimatedEnumeration; + readonly markerWidth: SVGAnimatedLength; + readonly orientAngle: SVGAnimatedAngle; + readonly orientType: SVGAnimatedEnumeration; + readonly refX: SVGAnimatedLength; + readonly refY: SVGAnimatedLength; setOrientToAngle(angle: SVGAngle): void; setOrientToAuto(): void; - SVG_MARKERUNITS_STROKEWIDTH: number; - SVG_MARKERUNITS_UNKNOWN: number; - SVG_MARKERUNITS_USERSPACEONUSE: number; - SVG_MARKER_ORIENT_ANGLE: number; - SVG_MARKER_ORIENT_AUTO: number; - SVG_MARKER_ORIENT_UNKNOWN: number; + readonly SVG_MARKERUNITS_STROKEWIDTH: number; + readonly SVG_MARKERUNITS_UNKNOWN: number; + readonly SVG_MARKERUNITS_USERSPACEONUSE: number; + readonly SVG_MARKER_ORIENT_ANGLE: number; + readonly SVG_MARKER_ORIENT_AUTO: number; + readonly SVG_MARKER_ORIENT_UNKNOWN: number; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var SVGMarkerElement: { prototype: SVGMarkerElement; new(): SVGMarkerElement; - SVG_MARKERUNITS_STROKEWIDTH: number; - SVG_MARKERUNITS_UNKNOWN: number; - SVG_MARKERUNITS_USERSPACEONUSE: number; - SVG_MARKER_ORIENT_ANGLE: number; - SVG_MARKER_ORIENT_AUTO: number; - SVG_MARKER_ORIENT_UNKNOWN: number; + readonly SVG_MARKERUNITS_STROKEWIDTH: number; + readonly SVG_MARKERUNITS_UNKNOWN: number; + readonly SVG_MARKERUNITS_USERSPACEONUSE: number; + readonly SVG_MARKER_ORIENT_ANGLE: number; + readonly SVG_MARKER_ORIENT_AUTO: number; + readonly SVG_MARKER_ORIENT_UNKNOWN: number; } interface SVGMaskElement extends SVGElement, SVGStylable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired, SVGUnitTypes { - height: SVGAnimatedLength; - maskContentUnits: SVGAnimatedEnumeration; - maskUnits: SVGAnimatedEnumeration; - width: SVGAnimatedLength; - x: SVGAnimatedLength; - y: SVGAnimatedLength; + readonly height: SVGAnimatedLength; + readonly maskContentUnits: SVGAnimatedEnumeration; + readonly maskUnits: SVGAnimatedEnumeration; + readonly width: SVGAnimatedLength; + readonly x: SVGAnimatedLength; + readonly y: SVGAnimatedLength; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -9637,7 +10468,7 @@ declare var SVGNumber: { } interface SVGNumberList { - numberOfItems: number; + readonly numberOfItems: number; appendItem(newItem: SVGNumber): SVGNumber; clear(): void; getItem(index: number): SVGNumber; @@ -9684,53 +10515,53 @@ declare var SVGPathElement: { } interface SVGPathSeg { - pathSegType: number; - pathSegTypeAsLetter: string; - PATHSEG_ARC_ABS: number; - PATHSEG_ARC_REL: number; - PATHSEG_CLOSEPATH: number; - PATHSEG_CURVETO_CUBIC_ABS: number; - PATHSEG_CURVETO_CUBIC_REL: number; - PATHSEG_CURVETO_CUBIC_SMOOTH_ABS: number; - PATHSEG_CURVETO_CUBIC_SMOOTH_REL: number; - PATHSEG_CURVETO_QUADRATIC_ABS: number; - PATHSEG_CURVETO_QUADRATIC_REL: number; - PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS: number; - PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL: number; - PATHSEG_LINETO_ABS: number; - PATHSEG_LINETO_HORIZONTAL_ABS: number; - PATHSEG_LINETO_HORIZONTAL_REL: number; - PATHSEG_LINETO_REL: number; - PATHSEG_LINETO_VERTICAL_ABS: number; - PATHSEG_LINETO_VERTICAL_REL: number; - PATHSEG_MOVETO_ABS: number; - PATHSEG_MOVETO_REL: number; - PATHSEG_UNKNOWN: number; + readonly pathSegType: number; + readonly pathSegTypeAsLetter: string; + readonly PATHSEG_ARC_ABS: number; + readonly PATHSEG_ARC_REL: number; + readonly PATHSEG_CLOSEPATH: number; + readonly PATHSEG_CURVETO_CUBIC_ABS: number; + readonly PATHSEG_CURVETO_CUBIC_REL: number; + readonly PATHSEG_CURVETO_CUBIC_SMOOTH_ABS: number; + readonly PATHSEG_CURVETO_CUBIC_SMOOTH_REL: number; + readonly PATHSEG_CURVETO_QUADRATIC_ABS: number; + readonly PATHSEG_CURVETO_QUADRATIC_REL: number; + readonly PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS: number; + readonly PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL: number; + readonly PATHSEG_LINETO_ABS: number; + readonly PATHSEG_LINETO_HORIZONTAL_ABS: number; + readonly PATHSEG_LINETO_HORIZONTAL_REL: number; + readonly PATHSEG_LINETO_REL: number; + readonly PATHSEG_LINETO_VERTICAL_ABS: number; + readonly PATHSEG_LINETO_VERTICAL_REL: number; + readonly PATHSEG_MOVETO_ABS: number; + readonly PATHSEG_MOVETO_REL: number; + readonly PATHSEG_UNKNOWN: number; } declare var SVGPathSeg: { prototype: SVGPathSeg; new(): SVGPathSeg; - PATHSEG_ARC_ABS: number; - PATHSEG_ARC_REL: number; - PATHSEG_CLOSEPATH: number; - PATHSEG_CURVETO_CUBIC_ABS: number; - PATHSEG_CURVETO_CUBIC_REL: number; - PATHSEG_CURVETO_CUBIC_SMOOTH_ABS: number; - PATHSEG_CURVETO_CUBIC_SMOOTH_REL: number; - PATHSEG_CURVETO_QUADRATIC_ABS: number; - PATHSEG_CURVETO_QUADRATIC_REL: number; - PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS: number; - PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL: number; - PATHSEG_LINETO_ABS: number; - PATHSEG_LINETO_HORIZONTAL_ABS: number; - PATHSEG_LINETO_HORIZONTAL_REL: number; - PATHSEG_LINETO_REL: number; - PATHSEG_LINETO_VERTICAL_ABS: number; - PATHSEG_LINETO_VERTICAL_REL: number; - PATHSEG_MOVETO_ABS: number; - PATHSEG_MOVETO_REL: number; - PATHSEG_UNKNOWN: number; + readonly PATHSEG_ARC_ABS: number; + readonly PATHSEG_ARC_REL: number; + readonly PATHSEG_CLOSEPATH: number; + readonly PATHSEG_CURVETO_CUBIC_ABS: number; + readonly PATHSEG_CURVETO_CUBIC_REL: number; + readonly PATHSEG_CURVETO_CUBIC_SMOOTH_ABS: number; + readonly PATHSEG_CURVETO_CUBIC_SMOOTH_REL: number; + readonly PATHSEG_CURVETO_QUADRATIC_ABS: number; + readonly PATHSEG_CURVETO_QUADRATIC_REL: number; + readonly PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS: number; + readonly PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL: number; + readonly PATHSEG_LINETO_ABS: number; + readonly PATHSEG_LINETO_HORIZONTAL_ABS: number; + readonly PATHSEG_LINETO_HORIZONTAL_REL: number; + readonly PATHSEG_LINETO_REL: number; + readonly PATHSEG_LINETO_VERTICAL_ABS: number; + readonly PATHSEG_LINETO_VERTICAL_REL: number; + readonly PATHSEG_MOVETO_ABS: number; + readonly PATHSEG_MOVETO_REL: number; + readonly PATHSEG_UNKNOWN: number; } interface SVGPathSegArcAbs extends SVGPathSeg { @@ -9924,7 +10755,7 @@ declare var SVGPathSegLinetoVerticalRel: { } interface SVGPathSegList { - numberOfItems: number; + readonly numberOfItems: number; appendItem(newItem: SVGPathSeg): SVGPathSeg; clear(): void; getItem(index: number): SVGPathSeg; @@ -9960,13 +10791,13 @@ declare var SVGPathSegMovetoRel: { } interface SVGPatternElement extends SVGElement, SVGStylable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired, SVGFitToViewBox, SVGURIReference, SVGUnitTypes { - height: SVGAnimatedLength; - patternContentUnits: SVGAnimatedEnumeration; - patternTransform: SVGAnimatedTransformList; - patternUnits: SVGAnimatedEnumeration; - width: SVGAnimatedLength; - x: SVGAnimatedLength; - y: SVGAnimatedLength; + readonly height: SVGAnimatedLength; + readonly patternContentUnits: SVGAnimatedEnumeration; + readonly patternTransform: SVGAnimatedTransformList; + readonly patternUnits: SVGAnimatedEnumeration; + readonly width: SVGAnimatedLength; + readonly x: SVGAnimatedLength; + readonly y: SVGAnimatedLength; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -9987,7 +10818,7 @@ declare var SVGPoint: { } interface SVGPointList { - numberOfItems: number; + readonly numberOfItems: number; appendItem(newItem: SVGPoint): SVGPoint; clear(): void; getItem(index: number): SVGPoint; @@ -10023,47 +10854,47 @@ declare var SVGPolylineElement: { interface SVGPreserveAspectRatio { align: number; meetOrSlice: number; - SVG_MEETORSLICE_MEET: number; - SVG_MEETORSLICE_SLICE: number; - SVG_MEETORSLICE_UNKNOWN: number; - SVG_PRESERVEASPECTRATIO_NONE: number; - SVG_PRESERVEASPECTRATIO_UNKNOWN: number; - SVG_PRESERVEASPECTRATIO_XMAXYMAX: number; - SVG_PRESERVEASPECTRATIO_XMAXYMID: number; - SVG_PRESERVEASPECTRATIO_XMAXYMIN: number; - SVG_PRESERVEASPECTRATIO_XMIDYMAX: number; - SVG_PRESERVEASPECTRATIO_XMIDYMID: number; - SVG_PRESERVEASPECTRATIO_XMIDYMIN: number; - SVG_PRESERVEASPECTRATIO_XMINYMAX: number; - SVG_PRESERVEASPECTRATIO_XMINYMID: number; - SVG_PRESERVEASPECTRATIO_XMINYMIN: number; + readonly SVG_MEETORSLICE_MEET: number; + readonly SVG_MEETORSLICE_SLICE: number; + readonly SVG_MEETORSLICE_UNKNOWN: number; + readonly SVG_PRESERVEASPECTRATIO_NONE: number; + readonly SVG_PRESERVEASPECTRATIO_UNKNOWN: number; + readonly SVG_PRESERVEASPECTRATIO_XMAXYMAX: number; + readonly SVG_PRESERVEASPECTRATIO_XMAXYMID: number; + readonly SVG_PRESERVEASPECTRATIO_XMAXYMIN: number; + readonly SVG_PRESERVEASPECTRATIO_XMIDYMAX: number; + readonly SVG_PRESERVEASPECTRATIO_XMIDYMID: number; + readonly SVG_PRESERVEASPECTRATIO_XMIDYMIN: number; + readonly SVG_PRESERVEASPECTRATIO_XMINYMAX: number; + readonly SVG_PRESERVEASPECTRATIO_XMINYMID: number; + readonly SVG_PRESERVEASPECTRATIO_XMINYMIN: number; } declare var SVGPreserveAspectRatio: { prototype: SVGPreserveAspectRatio; new(): SVGPreserveAspectRatio; - SVG_MEETORSLICE_MEET: number; - SVG_MEETORSLICE_SLICE: number; - SVG_MEETORSLICE_UNKNOWN: number; - SVG_PRESERVEASPECTRATIO_NONE: number; - SVG_PRESERVEASPECTRATIO_UNKNOWN: number; - SVG_PRESERVEASPECTRATIO_XMAXYMAX: number; - SVG_PRESERVEASPECTRATIO_XMAXYMID: number; - SVG_PRESERVEASPECTRATIO_XMAXYMIN: number; - SVG_PRESERVEASPECTRATIO_XMIDYMAX: number; - SVG_PRESERVEASPECTRATIO_XMIDYMID: number; - SVG_PRESERVEASPECTRATIO_XMIDYMIN: number; - SVG_PRESERVEASPECTRATIO_XMINYMAX: number; - SVG_PRESERVEASPECTRATIO_XMINYMID: number; - SVG_PRESERVEASPECTRATIO_XMINYMIN: number; + readonly SVG_MEETORSLICE_MEET: number; + readonly SVG_MEETORSLICE_SLICE: number; + readonly SVG_MEETORSLICE_UNKNOWN: number; + readonly SVG_PRESERVEASPECTRATIO_NONE: number; + readonly SVG_PRESERVEASPECTRATIO_UNKNOWN: number; + readonly SVG_PRESERVEASPECTRATIO_XMAXYMAX: number; + readonly SVG_PRESERVEASPECTRATIO_XMAXYMID: number; + readonly SVG_PRESERVEASPECTRATIO_XMAXYMIN: number; + readonly SVG_PRESERVEASPECTRATIO_XMIDYMAX: number; + readonly SVG_PRESERVEASPECTRATIO_XMIDYMID: number; + readonly SVG_PRESERVEASPECTRATIO_XMIDYMIN: number; + readonly SVG_PRESERVEASPECTRATIO_XMINYMAX: number; + readonly SVG_PRESERVEASPECTRATIO_XMINYMID: number; + readonly SVG_PRESERVEASPECTRATIO_XMINYMIN: number; } interface SVGRadialGradientElement extends SVGGradientElement { - cx: SVGAnimatedLength; - cy: SVGAnimatedLength; - fx: SVGAnimatedLength; - fy: SVGAnimatedLength; - r: SVGAnimatedLength; + readonly cx: SVGAnimatedLength; + readonly cy: SVGAnimatedLength; + readonly fx: SVGAnimatedLength; + readonly fy: SVGAnimatedLength; + readonly r: SVGAnimatedLength; } declare var SVGRadialGradientElement: { @@ -10084,12 +10915,12 @@ declare var SVGRect: { } interface SVGRectElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired { - height: SVGAnimatedLength; - rx: SVGAnimatedLength; - ry: SVGAnimatedLength; - width: SVGAnimatedLength; - x: SVGAnimatedLength; - y: SVGAnimatedLength; + readonly height: SVGAnimatedLength; + readonly rx: SVGAnimatedLength; + readonly ry: SVGAnimatedLength; + readonly width: SVGAnimatedLength; + readonly x: SVGAnimatedLength; + readonly y: SVGAnimatedLength; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -10102,22 +10933,22 @@ interface SVGSVGElement extends SVGElement, DocumentEvent, SVGLocatable, SVGTest contentScriptType: string; contentStyleType: string; currentScale: number; - currentTranslate: SVGPoint; - height: SVGAnimatedLength; + readonly currentTranslate: SVGPoint; + readonly height: SVGAnimatedLength; onabort: (ev: Event) => any; onerror: (ev: Event) => any; onresize: (ev: UIEvent) => any; onscroll: (ev: UIEvent) => any; onunload: (ev: Event) => any; onzoom: (ev: SVGZoomEvent) => any; - pixelUnitToMillimeterX: number; - pixelUnitToMillimeterY: number; - screenPixelToMillimeterX: number; - screenPixelToMillimeterY: number; - viewport: SVGRect; - width: SVGAnimatedLength; - x: SVGAnimatedLength; - y: SVGAnimatedLength; + readonly pixelUnitToMillimeterX: number; + readonly pixelUnitToMillimeterY: number; + readonly screenPixelToMillimeterX: number; + readonly screenPixelToMillimeterY: number; + readonly viewport: SVGRect; + readonly width: SVGAnimatedLength; + readonly x: SVGAnimatedLength; + readonly y: SVGAnimatedLength; checkEnclosure(element: SVGElement, rect: SVGRect): boolean; checkIntersection(element: SVGElement, rect: SVGRect): boolean; createSVGAngle(): SVGAngle; @@ -10133,8 +10964,8 @@ interface SVGSVGElement extends SVGElement, DocumentEvent, SVGLocatable, SVGTest getComputedStyle(elt: Element, pseudoElt?: string): CSSStyleDeclaration; getCurrentTime(): number; getElementById(elementId: string): Element; - getEnclosureList(rect: SVGRect, referenceElement: SVGElement): NodeList; - getIntersectionList(rect: SVGRect, referenceElement: SVGElement): NodeList; + getEnclosureList(rect: SVGRect, referenceElement: SVGElement): NodeListOf; + getIntersectionList(rect: SVGRect, referenceElement: SVGElement): NodeListOf; pauseAnimations(): void; setCurrentTime(seconds: number): void; suspendRedraw(maxWaitMilliseconds: number): number; @@ -10212,7 +11043,7 @@ declare var SVGScriptElement: { } interface SVGStopElement extends SVGElement, SVGStylable { - offset: SVGAnimatedNumber; + readonly offset: SVGAnimatedNumber; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -10222,7 +11053,7 @@ declare var SVGStopElement: { } interface SVGStringList { - numberOfItems: number; + readonly numberOfItems: number; appendItem(newItem: string): string; clear(): void; getItem(index: number): string; @@ -10238,6 +11069,7 @@ declare var SVGStringList: { } interface SVGStyleElement extends SVGElement, SVGLangSpace { + disabled: boolean; media: string; title: string; type: string; @@ -10276,8 +11108,8 @@ declare var SVGTSpanElement: { } interface SVGTextContentElement extends SVGElement, SVGStylable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired { - lengthAdjust: SVGAnimatedEnumeration; - textLength: SVGAnimatedLength; + readonly lengthAdjust: SVGAnimatedEnumeration; + readonly textLength: SVGAnimatedLength; getCharNumAtPosition(point: SVGPoint): number; getComputedTextLength(): number; getEndPositionOfChar(charnum: number): SVGPoint; @@ -10287,18 +11119,18 @@ interface SVGTextContentElement extends SVGElement, SVGStylable, SVGTests, SVGLa getStartPositionOfChar(charnum: number): SVGPoint; getSubStringLength(charnum: number, nchars: number): number; selectSubString(charnum: number, nchars: number): void; - LENGTHADJUST_SPACING: number; - LENGTHADJUST_SPACINGANDGLYPHS: number; - LENGTHADJUST_UNKNOWN: number; + readonly LENGTHADJUST_SPACING: number; + readonly LENGTHADJUST_SPACINGANDGLYPHS: number; + readonly LENGTHADJUST_UNKNOWN: number; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var SVGTextContentElement: { prototype: SVGTextContentElement; new(): SVGTextContentElement; - LENGTHADJUST_SPACING: number; - LENGTHADJUST_SPACINGANDGLYPHS: number; - LENGTHADJUST_UNKNOWN: number; + readonly LENGTHADJUST_SPACING: number; + readonly LENGTHADJUST_SPACINGANDGLYPHS: number; + readonly LENGTHADJUST_UNKNOWN: number; } interface SVGTextElement extends SVGTextPositioningElement, SVGTransformable { @@ -10311,35 +11143,35 @@ declare var SVGTextElement: { } interface SVGTextPathElement extends SVGTextContentElement, SVGURIReference { - method: SVGAnimatedEnumeration; - spacing: SVGAnimatedEnumeration; - startOffset: SVGAnimatedLength; - TEXTPATH_METHODTYPE_ALIGN: number; - TEXTPATH_METHODTYPE_STRETCH: number; - TEXTPATH_METHODTYPE_UNKNOWN: number; - TEXTPATH_SPACINGTYPE_AUTO: number; - TEXTPATH_SPACINGTYPE_EXACT: number; - TEXTPATH_SPACINGTYPE_UNKNOWN: number; + readonly method: SVGAnimatedEnumeration; + readonly spacing: SVGAnimatedEnumeration; + readonly startOffset: SVGAnimatedLength; + readonly TEXTPATH_METHODTYPE_ALIGN: number; + readonly TEXTPATH_METHODTYPE_STRETCH: number; + readonly TEXTPATH_METHODTYPE_UNKNOWN: number; + readonly TEXTPATH_SPACINGTYPE_AUTO: number; + readonly TEXTPATH_SPACINGTYPE_EXACT: number; + readonly TEXTPATH_SPACINGTYPE_UNKNOWN: number; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var SVGTextPathElement: { prototype: SVGTextPathElement; new(): SVGTextPathElement; - TEXTPATH_METHODTYPE_ALIGN: number; - TEXTPATH_METHODTYPE_STRETCH: number; - TEXTPATH_METHODTYPE_UNKNOWN: number; - TEXTPATH_SPACINGTYPE_AUTO: number; - TEXTPATH_SPACINGTYPE_EXACT: number; - TEXTPATH_SPACINGTYPE_UNKNOWN: number; + readonly TEXTPATH_METHODTYPE_ALIGN: number; + readonly TEXTPATH_METHODTYPE_STRETCH: number; + readonly TEXTPATH_METHODTYPE_UNKNOWN: number; + readonly TEXTPATH_SPACINGTYPE_AUTO: number; + readonly TEXTPATH_SPACINGTYPE_EXACT: number; + readonly TEXTPATH_SPACINGTYPE_UNKNOWN: number; } interface SVGTextPositioningElement extends SVGTextContentElement { - dx: SVGAnimatedLengthList; - dy: SVGAnimatedLengthList; - rotate: SVGAnimatedNumberList; - x: SVGAnimatedLengthList; - y: SVGAnimatedLengthList; + readonly dx: SVGAnimatedLengthList; + readonly dy: SVGAnimatedLengthList; + readonly rotate: SVGAnimatedNumberList; + readonly x: SVGAnimatedLengthList; + readonly y: SVGAnimatedLengthList; } declare var SVGTextPositioningElement: { @@ -10357,38 +11189,38 @@ declare var SVGTitleElement: { } interface SVGTransform { - angle: number; - matrix: SVGMatrix; - type: number; + readonly angle: number; + readonly matrix: SVGMatrix; + readonly type: number; setMatrix(matrix: SVGMatrix): void; setRotate(angle: number, cx: number, cy: number): void; setScale(sx: number, sy: number): void; setSkewX(angle: number): void; setSkewY(angle: number): void; setTranslate(tx: number, ty: number): void; - SVG_TRANSFORM_MATRIX: number; - SVG_TRANSFORM_ROTATE: number; - SVG_TRANSFORM_SCALE: number; - SVG_TRANSFORM_SKEWX: number; - SVG_TRANSFORM_SKEWY: number; - SVG_TRANSFORM_TRANSLATE: number; - SVG_TRANSFORM_UNKNOWN: number; + readonly SVG_TRANSFORM_MATRIX: number; + readonly SVG_TRANSFORM_ROTATE: number; + readonly SVG_TRANSFORM_SCALE: number; + readonly SVG_TRANSFORM_SKEWX: number; + readonly SVG_TRANSFORM_SKEWY: number; + readonly SVG_TRANSFORM_TRANSLATE: number; + readonly SVG_TRANSFORM_UNKNOWN: number; } declare var SVGTransform: { prototype: SVGTransform; new(): SVGTransform; - SVG_TRANSFORM_MATRIX: number; - SVG_TRANSFORM_ROTATE: number; - SVG_TRANSFORM_SCALE: number; - SVG_TRANSFORM_SKEWX: number; - SVG_TRANSFORM_SKEWY: number; - SVG_TRANSFORM_TRANSLATE: number; - SVG_TRANSFORM_UNKNOWN: number; + readonly SVG_TRANSFORM_MATRIX: number; + readonly SVG_TRANSFORM_ROTATE: number; + readonly SVG_TRANSFORM_SCALE: number; + readonly SVG_TRANSFORM_SKEWX: number; + readonly SVG_TRANSFORM_SKEWY: number; + readonly SVG_TRANSFORM_TRANSLATE: number; + readonly SVG_TRANSFORM_UNKNOWN: number; } interface SVGTransformList { - numberOfItems: number; + readonly numberOfItems: number; appendItem(newItem: SVGTransform): SVGTransform; clear(): void; consolidate(): SVGTransform; @@ -10406,19 +11238,19 @@ declare var SVGTransformList: { } interface SVGUnitTypes { - SVG_UNIT_TYPE_OBJECTBOUNDINGBOX: number; - SVG_UNIT_TYPE_UNKNOWN: number; - SVG_UNIT_TYPE_USERSPACEONUSE: number; + readonly SVG_UNIT_TYPE_OBJECTBOUNDINGBOX: number; + readonly SVG_UNIT_TYPE_UNKNOWN: number; + readonly SVG_UNIT_TYPE_USERSPACEONUSE: number; } declare var SVGUnitTypes: SVGUnitTypes; interface SVGUseElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired, SVGURIReference { - animatedInstanceRoot: SVGElementInstance; - height: SVGAnimatedLength; - instanceRoot: SVGElementInstance; - width: SVGAnimatedLength; - x: SVGAnimatedLength; - y: SVGAnimatedLength; + readonly animatedInstanceRoot: SVGElementInstance; + readonly height: SVGAnimatedLength; + readonly instanceRoot: SVGElementInstance; + readonly width: SVGAnimatedLength; + readonly x: SVGAnimatedLength; + readonly y: SVGAnimatedLength; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -10428,7 +11260,7 @@ declare var SVGUseElement: { } interface SVGViewElement extends SVGElement, SVGExternalResourcesRequired, SVGFitToViewBox, SVGZoomAndPan { - viewTarget: SVGStringList; + readonly viewTarget: SVGStringList; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -10438,21 +11270,21 @@ declare var SVGViewElement: { } interface SVGZoomAndPan { - zoomAndPan: number; + readonly zoomAndPan: number; } declare var SVGZoomAndPan: { - SVG_ZOOMANDPAN_DISABLE: number; - SVG_ZOOMANDPAN_MAGNIFY: number; - SVG_ZOOMANDPAN_UNKNOWN: number; + readonly SVG_ZOOMANDPAN_DISABLE: number; + readonly SVG_ZOOMANDPAN_MAGNIFY: number; + readonly SVG_ZOOMANDPAN_UNKNOWN: number; } interface SVGZoomEvent extends UIEvent { - newScale: number; - newTranslate: SVGPoint; - previousScale: number; - previousTranslate: SVGPoint; - zoomRectScreen: SVGRect; + readonly newScale: number; + readonly newTranslate: SVGPoint; + readonly previousScale: number; + readonly previousTranslate: SVGPoint; + readonly zoomRectScreen: SVGRect; } declare var SVGZoomEvent: { @@ -10461,22 +11293,22 @@ declare var SVGZoomEvent: { } interface Screen extends EventTarget { - availHeight: number; - availWidth: number; + readonly availHeight: number; + readonly availWidth: number; bufferDepth: number; - colorDepth: number; - deviceXDPI: number; - deviceYDPI: number; - fontSmoothingEnabled: boolean; - height: number; - logicalXDPI: number; - logicalYDPI: number; - msOrientation: string; + readonly colorDepth: number; + readonly deviceXDPI: number; + readonly deviceYDPI: number; + readonly fontSmoothingEnabled: boolean; + readonly height: number; + readonly logicalXDPI: number; + readonly logicalYDPI: number; + readonly msOrientation: string; onmsorientationchange: (ev: Event) => any; - pixelDepth: number; - systemXDPI: number; - systemYDPI: number; - width: number; + readonly pixelDepth: number; + readonly systemXDPI: number; + readonly systemYDPI: number; + readonly width: number; msLockOrientation(orientations: string | string[]): boolean; msUnlockOrientation(): void; addEventListener(type: "MSOrientationChange", listener: (ev: Event) => any, useCapture?: boolean): void; @@ -10489,8 +11321,8 @@ declare var Screen: { } interface ScriptNotifyEvent extends Event { - callingUri: string; - value: string; + readonly callingUri: string; + readonly value: string; } declare var ScriptNotifyEvent: { @@ -10499,7 +11331,7 @@ declare var ScriptNotifyEvent: { } interface ScriptProcessorNode extends AudioNode { - bufferSize: number; + readonly bufferSize: number; onaudioprocess: (ev: AudioProcessingEvent) => any; addEventListener(type: "audioprocess", listener: (ev: AudioProcessingEvent) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; @@ -10511,13 +11343,13 @@ declare var ScriptProcessorNode: { } interface Selection { - anchorNode: Node; - anchorOffset: number; - focusNode: Node; - focusOffset: number; - isCollapsed: boolean; - rangeCount: number; - type: string; + readonly anchorNode: Node; + readonly anchorOffset: number; + readonly focusNode: Node; + readonly focusOffset: number; + readonly isCollapsed: boolean; + readonly rangeCount: number; + readonly type: string; addRange(range: Range): void; collapse(parentNode: Node, offset: number): void; collapseToEnd(): void; @@ -10542,12 +11374,12 @@ declare var Selection: { interface SourceBuffer extends EventTarget { appendWindowEnd: number; appendWindowStart: number; - audioTracks: AudioTrackList; - buffered: TimeRanges; + readonly audioTracks: AudioTrackList; + readonly buffered: TimeRanges; mode: string; timestampOffset: number; - updating: boolean; - videoTracks: VideoTrackList; + readonly updating: boolean; + readonly videoTracks: VideoTrackList; abort(): void; appendBuffer(data: ArrayBuffer | ArrayBufferView): void; appendStream(stream: MSStream, maxSize?: number): void; @@ -10560,7 +11392,7 @@ declare var SourceBuffer: { } interface SourceBufferList extends EventTarget { - length: number; + readonly length: number; item(index: number): SourceBuffer; [index: number]: SourceBuffer; } @@ -10571,7 +11403,7 @@ declare var SourceBufferList: { } interface StereoPannerNode extends AudioNode { - pan: AudioParam; + readonly pan: AudioParam; } declare var StereoPannerNode: { @@ -10580,9 +11412,9 @@ declare var StereoPannerNode: { } interface Storage { - length: number; + readonly length: number; clear(): void; - getItem(key: string): any; + getItem(key: string): string; key(index: number): string; removeItem(key: string): void; setItem(key: string, data: string): void; @@ -10596,7 +11428,7 @@ declare var Storage: { } interface StorageEvent extends Event { - url: string; + readonly url: string; key?: string; oldValue?: string; newValue?: string; @@ -10609,7 +11441,7 @@ declare var StorageEvent: { } interface StyleMedia { - type: string; + readonly type: string; matchMedium(mediaquery: string): boolean; } @@ -10620,12 +11452,12 @@ declare var StyleMedia: { interface StyleSheet { disabled: boolean; - href: string; - media: MediaList; - ownerNode: Node; - parentStyleSheet: StyleSheet; - title: string; - type: string; + readonly href: string; + readonly media: MediaList; + readonly ownerNode: Node; + readonly parentStyleSheet: StyleSheet; + readonly title: string; + readonly type: string; } declare var StyleSheet: { @@ -10634,7 +11466,7 @@ declare var StyleSheet: { } interface StyleSheetList { - length: number; + readonly length: number; item(index?: number): StyleSheet; [index: number]: StyleSheet; } @@ -10645,7 +11477,7 @@ declare var StyleSheetList: { } interface StyleSheetPageList { - length: number; + readonly length: number; item(index: number): CSSPageRule; [index: number]: CSSPageRule; } @@ -10656,18 +11488,18 @@ declare var StyleSheetPageList: { } interface SubtleCrypto { - decrypt(algorithm: string | Algorithm, key: CryptoKey, data: ArrayBufferView): any; - deriveBits(algorithm: string | Algorithm, baseKey: CryptoKey, length: number): any; - deriveKey(algorithm: string | Algorithm, baseKey: CryptoKey, derivedKeyType: string | Algorithm, extractable: boolean, keyUsages: string[]): any; - digest(algorithm: string | Algorithm, data: ArrayBufferView): any; - encrypt(algorithm: string | Algorithm, key: CryptoKey, data: ArrayBufferView): any; - exportKey(format: string, key: CryptoKey): any; - generateKey(algorithm: string | Algorithm, extractable: boolean, keyUsages: string[]): any; - importKey(format: string, keyData: ArrayBufferView, algorithm: string | Algorithm, extractable: boolean, keyUsages: string[]): any; - sign(algorithm: string | Algorithm, key: CryptoKey, data: ArrayBufferView): any; - unwrapKey(format: string, wrappedKey: ArrayBufferView, unwrappingKey: CryptoKey, unwrapAlgorithm: string | Algorithm, unwrappedKeyAlgorithm: string | Algorithm, extractable: boolean, keyUsages: string[]): any; - verify(algorithm: string | Algorithm, key: CryptoKey, signature: ArrayBufferView, data: ArrayBufferView): any; - wrapKey(format: string, key: CryptoKey, wrappingKey: CryptoKey, wrapAlgorithm: string | Algorithm): any; + decrypt(algorithm: string | Algorithm, key: CryptoKey, data: ArrayBufferView): PromiseLike; + deriveBits(algorithm: string | Algorithm, baseKey: CryptoKey, length: number): PromiseLike; + deriveKey(algorithm: string | Algorithm, baseKey: CryptoKey, derivedKeyType: string | Algorithm, extractable: boolean, keyUsages: string[]): PromiseLike; + digest(algorithm: string | Algorithm, data: ArrayBufferView): PromiseLike; + encrypt(algorithm: string | Algorithm, key: CryptoKey, data: ArrayBufferView): PromiseLike; + exportKey(format: string, key: CryptoKey): PromiseLike; + generateKey(algorithm: string | Algorithm, extractable: boolean, keyUsages: string[]): PromiseLike; + importKey(format: string, keyData: ArrayBufferView, algorithm: string | Algorithm, extractable: boolean, keyUsages: string[]): PromiseLike; + sign(algorithm: string | Algorithm, key: CryptoKey, data: ArrayBufferView): PromiseLike; + unwrapKey(format: string, wrappedKey: ArrayBufferView, unwrappingKey: CryptoKey, unwrapAlgorithm: string | Algorithm, unwrappedKeyAlgorithm: string | Algorithm, extractable: boolean, keyUsages: string[]): PromiseLike; + verify(algorithm: string | Algorithm, key: CryptoKey, signature: ArrayBufferView, data: ArrayBufferView): PromiseLike; + wrapKey(format: string, key: CryptoKey, wrappingKey: CryptoKey, wrapAlgorithm: string | Algorithm): PromiseLike; } declare var SubtleCrypto: { @@ -10676,8 +11508,7 @@ declare var SubtleCrypto: { } interface Text extends CharacterData { - wholeText: string; - replaceWholeText(content: string): Text; + readonly wholeText: string; splitText(offset: number): Text; } @@ -10687,39 +11518,39 @@ declare var Text: { } interface TextEvent extends UIEvent { - data: string; - inputMethod: number; - locale: string; + readonly data: string; + readonly inputMethod: number; + readonly locale: string; initTextEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, dataArg: string, inputMethod: number, locale: string): void; - DOM_INPUT_METHOD_DROP: number; - DOM_INPUT_METHOD_HANDWRITING: number; - DOM_INPUT_METHOD_IME: number; - DOM_INPUT_METHOD_KEYBOARD: number; - DOM_INPUT_METHOD_MULTIMODAL: number; - DOM_INPUT_METHOD_OPTION: number; - DOM_INPUT_METHOD_PASTE: number; - DOM_INPUT_METHOD_SCRIPT: number; - DOM_INPUT_METHOD_UNKNOWN: number; - DOM_INPUT_METHOD_VOICE: number; + readonly DOM_INPUT_METHOD_DROP: number; + readonly DOM_INPUT_METHOD_HANDWRITING: number; + readonly DOM_INPUT_METHOD_IME: number; + readonly DOM_INPUT_METHOD_KEYBOARD: number; + readonly DOM_INPUT_METHOD_MULTIMODAL: number; + readonly DOM_INPUT_METHOD_OPTION: number; + readonly DOM_INPUT_METHOD_PASTE: number; + readonly DOM_INPUT_METHOD_SCRIPT: number; + readonly DOM_INPUT_METHOD_UNKNOWN: number; + readonly DOM_INPUT_METHOD_VOICE: number; } declare var TextEvent: { prototype: TextEvent; new(): TextEvent; - DOM_INPUT_METHOD_DROP: number; - DOM_INPUT_METHOD_HANDWRITING: number; - DOM_INPUT_METHOD_IME: number; - DOM_INPUT_METHOD_KEYBOARD: number; - DOM_INPUT_METHOD_MULTIMODAL: number; - DOM_INPUT_METHOD_OPTION: number; - DOM_INPUT_METHOD_PASTE: number; - DOM_INPUT_METHOD_SCRIPT: number; - DOM_INPUT_METHOD_UNKNOWN: number; - DOM_INPUT_METHOD_VOICE: number; + readonly DOM_INPUT_METHOD_DROP: number; + readonly DOM_INPUT_METHOD_HANDWRITING: number; + readonly DOM_INPUT_METHOD_IME: number; + readonly DOM_INPUT_METHOD_KEYBOARD: number; + readonly DOM_INPUT_METHOD_MULTIMODAL: number; + readonly DOM_INPUT_METHOD_OPTION: number; + readonly DOM_INPUT_METHOD_PASTE: number; + readonly DOM_INPUT_METHOD_SCRIPT: number; + readonly DOM_INPUT_METHOD_UNKNOWN: number; + readonly DOM_INPUT_METHOD_VOICE: number; } interface TextMetrics { - width: number; + readonly width: number; } declare var TextMetrics: { @@ -10727,83 +11558,27 @@ declare var TextMetrics: { new(): TextMetrics; } -interface TextRange { - boundingHeight: number; - boundingLeft: number; - boundingTop: number; - boundingWidth: number; - htmlText: string; - offsetLeft: number; - offsetTop: number; - text: string; - collapse(start?: boolean): void; - compareEndPoints(how: string, sourceRange: TextRange): number; - duplicate(): TextRange; - execCommand(cmdID: string, showUI?: boolean, value?: any): boolean; - execCommandShowHelp(cmdID: string): boolean; - expand(Unit: string): boolean; - findText(string: string, count?: number, flags?: number): boolean; - getBookmark(): string; - getBoundingClientRect(): ClientRect; - getClientRects(): ClientRectList; - inRange(range: TextRange): boolean; - isEqual(range: TextRange): boolean; - move(unit: string, count?: number): number; - moveEnd(unit: string, count?: number): number; - moveStart(unit: string, count?: number): number; - moveToBookmark(bookmark: string): boolean; - moveToElementText(element: Element): void; - moveToPoint(x: number, y: number): void; - parentElement(): Element; - pasteHTML(html: string): void; - queryCommandEnabled(cmdID: string): boolean; - queryCommandIndeterm(cmdID: string): boolean; - queryCommandState(cmdID: string): boolean; - queryCommandSupported(cmdID: string): boolean; - queryCommandText(cmdID: string): string; - queryCommandValue(cmdID: string): any; - scrollIntoView(fStart?: boolean): void; - select(): void; - setEndPoint(how: string, SourceRange: TextRange): void; -} - -declare var TextRange: { - prototype: TextRange; - new(): TextRange; -} - -interface TextRangeCollection { - length: number; - item(index: number): TextRange; - [index: number]: TextRange; -} - -declare var TextRangeCollection: { - prototype: TextRangeCollection; - new(): TextRangeCollection; -} - interface TextTrack extends EventTarget { - activeCues: TextTrackCueList; - cues: TextTrackCueList; - inBandMetadataTrackDispatchType: string; - kind: string; - label: string; - language: string; + readonly activeCues: TextTrackCueList; + readonly cues: TextTrackCueList; + readonly inBandMetadataTrackDispatchType: string; + readonly kind: string; + readonly label: string; + readonly language: string; mode: any; oncuechange: (ev: Event) => any; onerror: (ev: Event) => any; onload: (ev: Event) => any; - readyState: number; + readonly readyState: number; addCue(cue: TextTrackCue): void; removeCue(cue: TextTrackCue): void; - DISABLED: number; - ERROR: number; - HIDDEN: number; - LOADED: number; - LOADING: number; - NONE: number; - SHOWING: number; + readonly DISABLED: number; + readonly ERROR: number; + readonly HIDDEN: number; + readonly LOADED: number; + readonly LOADING: number; + readonly NONE: number; + readonly SHOWING: number; addEventListener(type: "cuechange", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: "load", listener: (ev: Event) => any, useCapture?: boolean): void; @@ -10813,13 +11588,13 @@ interface TextTrack extends EventTarget { declare var TextTrack: { prototype: TextTrack; new(): TextTrack; - DISABLED: number; - ERROR: number; - HIDDEN: number; - LOADED: number; - LOADING: number; - NONE: number; - SHOWING: number; + readonly DISABLED: number; + readonly ERROR: number; + readonly HIDDEN: number; + readonly LOADED: number; + readonly LOADING: number; + readonly NONE: number; + readonly SHOWING: number; } interface TextTrackCue extends EventTarget { @@ -10830,7 +11605,7 @@ interface TextTrackCue extends EventTarget { pauseOnExit: boolean; startTime: number; text: string; - track: TextTrack; + readonly track: TextTrack; getCueAsHTML(): DocumentFragment; addEventListener(type: "enter", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "exit", listener: (ev: Event) => any, useCapture?: boolean): void; @@ -10843,7 +11618,7 @@ declare var TextTrackCue: { } interface TextTrackCueList { - length: number; + readonly length: number; getCueById(id: string): TextTrackCue; item(index: number): TextTrackCue; [index: number]: TextTrackCue; @@ -10855,7 +11630,7 @@ declare var TextTrackCueList: { } interface TextTrackList extends EventTarget { - length: number; + readonly length: number; onaddtrack: (ev: TrackEvent) => any; item(index: number): TextTrack; addEventListener(type: "addtrack", listener: (ev: TrackEvent) => any, useCapture?: boolean): void; @@ -10869,7 +11644,7 @@ declare var TextTrackList: { } interface TimeRanges { - length: number; + readonly length: number; end(index: number): number; start(index: number): number; } @@ -10880,14 +11655,14 @@ declare var TimeRanges: { } interface Touch { - clientX: number; - clientY: number; - identifier: number; - pageX: number; - pageY: number; - screenX: number; - screenY: number; - target: EventTarget; + readonly clientX: number; + readonly clientY: number; + readonly identifier: number; + readonly pageX: number; + readonly pageY: number; + readonly screenX: number; + readonly screenY: number; + readonly target: EventTarget; } declare var Touch: { @@ -10896,13 +11671,13 @@ declare var Touch: { } interface TouchEvent extends UIEvent { - altKey: boolean; - changedTouches: TouchList; - ctrlKey: boolean; - metaKey: boolean; - shiftKey: boolean; - targetTouches: TouchList; - touches: TouchList; + readonly altKey: boolean; + readonly changedTouches: TouchList; + readonly ctrlKey: boolean; + readonly metaKey: boolean; + readonly shiftKey: boolean; + readonly targetTouches: TouchList; + readonly touches: TouchList; } declare var TouchEvent: { @@ -10911,7 +11686,7 @@ declare var TouchEvent: { } interface TouchList { - length: number; + readonly length: number; item(index: number): Touch; [index: number]: Touch; } @@ -10922,7 +11697,7 @@ declare var TouchList: { } interface TrackEvent extends Event { - track: any; + readonly track: any; } declare var TrackEvent: { @@ -10931,8 +11706,8 @@ declare var TrackEvent: { } interface TransitionEvent extends Event { - elapsedTime: number; - propertyName: string; + readonly elapsedTime: number; + readonly propertyName: string; initTransitionEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, propertyNameArg: string, elapsedTimeArg: number): void; } @@ -10943,10 +11718,10 @@ declare var TransitionEvent: { interface TreeWalker { currentNode: Node; - expandEntityReferences: boolean; - filter: NodeFilter; - root: Node; - whatToShow: number; + readonly expandEntityReferences: boolean; + readonly filter: NodeFilter; + readonly root: Node; + readonly whatToShow: number; firstChild(): Node; lastChild(): Node; nextNode(): Node; @@ -10962,8 +11737,8 @@ declare var TreeWalker: { } interface UIEvent extends Event { - detail: number; - view: Window; + readonly detail: number; + readonly view: Window; initUIEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number): void; } @@ -10973,13 +11748,29 @@ declare var UIEvent: { } interface URL { + hash: string; + host: string; + hostname: string; + href: string; + readonly origin: string; + password: string; + pathname: string; + port: string; + protocol: string; + search: string; + username: string; + toString(): string; +} + +declare var URL: { + prototype: URL; + new(url: string, base?: string): URL; createObjectURL(object: any, options?: ObjectURLOptions): string; revokeObjectURL(url: string): void; } -declare var URL: URL; interface UnviewableContentIdentifiedEvent extends NavigationEventWithReferrer { - mediaType: string; + readonly mediaType: string; } declare var UnviewableContentIdentifiedEvent: { @@ -10988,16 +11779,16 @@ declare var UnviewableContentIdentifiedEvent: { } interface ValidityState { - badInput: boolean; - customError: boolean; - patternMismatch: boolean; - rangeOverflow: boolean; - rangeUnderflow: boolean; - stepMismatch: boolean; - tooLong: boolean; - typeMismatch: boolean; - valid: boolean; - valueMissing: boolean; + readonly badInput: boolean; + readonly customError: boolean; + readonly patternMismatch: boolean; + readonly rangeOverflow: boolean; + readonly rangeUnderflow: boolean; + readonly stepMismatch: boolean; + readonly tooLong: boolean; + readonly typeMismatch: boolean; + readonly valid: boolean; + readonly valueMissing: boolean; } declare var ValidityState: { @@ -11006,11 +11797,11 @@ declare var ValidityState: { } interface VideoPlaybackQuality { - corruptedVideoFrames: number; - creationTime: number; - droppedVideoFrames: number; - totalFrameDelay: number; - totalVideoFrames: number; + readonly corruptedVideoFrames: number; + readonly creationTime: number; + readonly droppedVideoFrames: number; + readonly totalFrameDelay: number; + readonly totalVideoFrames: number; } declare var VideoPlaybackQuality: { @@ -11019,12 +11810,12 @@ declare var VideoPlaybackQuality: { } interface VideoTrack { - id: string; + readonly id: string; kind: string; - label: string; + readonly label: string; language: string; selected: boolean; - sourceBuffer: SourceBuffer; + readonly sourceBuffer: SourceBuffer; } declare var VideoTrack: { @@ -11033,11 +11824,11 @@ declare var VideoTrack: { } interface VideoTrackList extends EventTarget { - length: number; + readonly length: number; onaddtrack: (ev: TrackEvent) => any; onchange: (ev: Event) => any; onremovetrack: (ev: TrackEvent) => any; - selectedIndex: number; + readonly selectedIndex: number; getTrackById(id: string): VideoTrack; item(index: number): VideoTrack; addEventListener(type: "addtrack", listener: (ev: TrackEvent) => any, useCapture?: boolean): void; @@ -11053,41 +11844,41 @@ declare var VideoTrackList: { } interface WEBGL_compressed_texture_s3tc { - COMPRESSED_RGBA_S3TC_DXT1_EXT: number; - COMPRESSED_RGBA_S3TC_DXT3_EXT: number; - COMPRESSED_RGBA_S3TC_DXT5_EXT: number; - COMPRESSED_RGB_S3TC_DXT1_EXT: number; + readonly COMPRESSED_RGBA_S3TC_DXT1_EXT: number; + readonly COMPRESSED_RGBA_S3TC_DXT3_EXT: number; + readonly COMPRESSED_RGBA_S3TC_DXT5_EXT: number; + readonly COMPRESSED_RGB_S3TC_DXT1_EXT: number; } declare var WEBGL_compressed_texture_s3tc: { prototype: WEBGL_compressed_texture_s3tc; new(): WEBGL_compressed_texture_s3tc; - COMPRESSED_RGBA_S3TC_DXT1_EXT: number; - COMPRESSED_RGBA_S3TC_DXT3_EXT: number; - COMPRESSED_RGBA_S3TC_DXT5_EXT: number; - COMPRESSED_RGB_S3TC_DXT1_EXT: number; + readonly COMPRESSED_RGBA_S3TC_DXT1_EXT: number; + readonly COMPRESSED_RGBA_S3TC_DXT3_EXT: number; + readonly COMPRESSED_RGBA_S3TC_DXT5_EXT: number; + readonly COMPRESSED_RGB_S3TC_DXT1_EXT: number; } interface WEBGL_debug_renderer_info { - UNMASKED_RENDERER_WEBGL: number; - UNMASKED_VENDOR_WEBGL: number; + readonly UNMASKED_RENDERER_WEBGL: number; + readonly UNMASKED_VENDOR_WEBGL: number; } declare var WEBGL_debug_renderer_info: { prototype: WEBGL_debug_renderer_info; new(): WEBGL_debug_renderer_info; - UNMASKED_RENDERER_WEBGL: number; - UNMASKED_VENDOR_WEBGL: number; + readonly UNMASKED_RENDERER_WEBGL: number; + readonly UNMASKED_VENDOR_WEBGL: number; } interface WEBGL_depth_texture { - UNSIGNED_INT_24_8_WEBGL: number; + readonly UNSIGNED_INT_24_8_WEBGL: number; } declare var WEBGL_depth_texture: { prototype: WEBGL_depth_texture; new(): WEBGL_depth_texture; - UNSIGNED_INT_24_8_WEBGL: number; + readonly UNSIGNED_INT_24_8_WEBGL: number; } interface WaveShaperNode extends AudioNode { @@ -11101,9 +11892,9 @@ declare var WaveShaperNode: { } interface WebGLActiveInfo { - name: string; - size: number; - type: number; + readonly name: string; + readonly size: number; + readonly type: number; } declare var WebGLActiveInfo: { @@ -11120,12 +11911,12 @@ declare var WebGLBuffer: { } interface WebGLContextEvent extends Event { - statusMessage: string; + readonly statusMessage: string; } declare var WebGLContextEvent: { prototype: WebGLContextEvent; - new(): WebGLContextEvent; + new(type: string, eventInitDict?: WebGLContextEventInit): WebGLContextEvent; } interface WebGLFramebuffer extends WebGLObject { @@ -11161,9 +11952,9 @@ declare var WebGLRenderbuffer: { } interface WebGLRenderingContext { - canvas: HTMLCanvasElement; - drawingBufferHeight: number; - drawingBufferWidth: number; + readonly canvas: HTMLCanvasElement; + readonly drawingBufferHeight: number; + readonly drawingBufferWidth: number; activeTexture(texture: number): void; attachShader(program: WebGLProgram, shader: WebGLShader): void; bindAttribLocation(program: WebGLProgram, index: number, name: string): void; @@ -11278,635 +12069,635 @@ interface WebGLRenderingContext { texSubImage2D(target: number, level: number, xoffset: number, yoffset: number, format: number, type: number, video: HTMLVideoElement): void; texSubImage2D(target: number, level: number, xoffset: number, yoffset: number, format: number, type: number, pixels: ImageData): void; uniform1f(location: WebGLUniformLocation, x: number): void; - uniform1fv(location: WebGLUniformLocation, v: Float32Array): void; + uniform1fv(location: WebGLUniformLocation, v: Float32Array | number[]): void; uniform1i(location: WebGLUniformLocation, x: number): void; - uniform1iv(location: WebGLUniformLocation, v: Int32Array): void; + uniform1iv(location: WebGLUniformLocation, v: Int32Array | number[]): void; uniform2f(location: WebGLUniformLocation, x: number, y: number): void; - uniform2fv(location: WebGLUniformLocation, v: Float32Array): void; + uniform2fv(location: WebGLUniformLocation, v: Float32Array | number[]): void; uniform2i(location: WebGLUniformLocation, x: number, y: number): void; - uniform2iv(location: WebGLUniformLocation, v: Int32Array): void; + uniform2iv(location: WebGLUniformLocation, v: Int32Array | number[]): void; uniform3f(location: WebGLUniformLocation, x: number, y: number, z: number): void; - uniform3fv(location: WebGLUniformLocation, v: Float32Array): void; + uniform3fv(location: WebGLUniformLocation, v: Float32Array | number[]): void; uniform3i(location: WebGLUniformLocation, x: number, y: number, z: number): void; - uniform3iv(location: WebGLUniformLocation, v: Int32Array): void; + uniform3iv(location: WebGLUniformLocation, v: Int32Array | number[]): void; uniform4f(location: WebGLUniformLocation, x: number, y: number, z: number, w: number): void; - uniform4fv(location: WebGLUniformLocation, v: Float32Array): void; + uniform4fv(location: WebGLUniformLocation, v: Float32Array | number[]): void; uniform4i(location: WebGLUniformLocation, x: number, y: number, z: number, w: number): void; - uniform4iv(location: WebGLUniformLocation, v: Int32Array): void; - uniformMatrix2fv(location: WebGLUniformLocation, transpose: boolean, value: Float32Array): void; - uniformMatrix3fv(location: WebGLUniformLocation, transpose: boolean, value: Float32Array): void; - uniformMatrix4fv(location: WebGLUniformLocation, transpose: boolean, value: Float32Array): void; + uniform4iv(location: WebGLUniformLocation, v: Int32Array | number[]): void; + uniformMatrix2fv(location: WebGLUniformLocation, transpose: boolean, value: Float32Array | number[]): void; + uniformMatrix3fv(location: WebGLUniformLocation, transpose: boolean, value: Float32Array | number[]): void; + uniformMatrix4fv(location: WebGLUniformLocation, transpose: boolean, value: Float32Array | number[]): void; useProgram(program: WebGLProgram): void; validateProgram(program: WebGLProgram): void; vertexAttrib1f(indx: number, x: number): void; - vertexAttrib1fv(indx: number, values: Float32Array): void; + vertexAttrib1fv(indx: number, values: Float32Array | number[]): void; vertexAttrib2f(indx: number, x: number, y: number): void; - vertexAttrib2fv(indx: number, values: Float32Array): void; + vertexAttrib2fv(indx: number, values: Float32Array | number[]): void; vertexAttrib3f(indx: number, x: number, y: number, z: number): void; - vertexAttrib3fv(indx: number, values: Float32Array): void; + vertexAttrib3fv(indx: number, values: Float32Array | number[]): void; vertexAttrib4f(indx: number, x: number, y: number, z: number, w: number): void; - vertexAttrib4fv(indx: number, values: Float32Array): void; + vertexAttrib4fv(indx: number, values: Float32Array | number[]): void; vertexAttribPointer(indx: number, size: number, type: number, normalized: boolean, stride: number, offset: number): void; viewport(x: number, y: number, width: number, height: number): void; - ACTIVE_ATTRIBUTES: number; - ACTIVE_TEXTURE: number; - ACTIVE_UNIFORMS: number; - ALIASED_LINE_WIDTH_RANGE: number; - ALIASED_POINT_SIZE_RANGE: number; - ALPHA: number; - ALPHA_BITS: number; - ALWAYS: number; - ARRAY_BUFFER: number; - ARRAY_BUFFER_BINDING: number; - ATTACHED_SHADERS: number; - BACK: number; - BLEND: number; - BLEND_COLOR: number; - BLEND_DST_ALPHA: number; - BLEND_DST_RGB: number; - BLEND_EQUATION: number; - BLEND_EQUATION_ALPHA: number; - BLEND_EQUATION_RGB: number; - BLEND_SRC_ALPHA: number; - BLEND_SRC_RGB: number; - BLUE_BITS: number; - BOOL: number; - BOOL_VEC2: number; - BOOL_VEC3: number; - BOOL_VEC4: number; - BROWSER_DEFAULT_WEBGL: number; - BUFFER_SIZE: number; - BUFFER_USAGE: number; - BYTE: number; - CCW: number; - CLAMP_TO_EDGE: number; - COLOR_ATTACHMENT0: number; - COLOR_BUFFER_BIT: number; - COLOR_CLEAR_VALUE: number; - COLOR_WRITEMASK: number; - COMPILE_STATUS: number; - COMPRESSED_TEXTURE_FORMATS: number; - CONSTANT_ALPHA: number; - CONSTANT_COLOR: number; - CONTEXT_LOST_WEBGL: number; - CULL_FACE: number; - CULL_FACE_MODE: number; - CURRENT_PROGRAM: number; - CURRENT_VERTEX_ATTRIB: number; - CW: number; - DECR: number; - DECR_WRAP: number; - DELETE_STATUS: number; - DEPTH_ATTACHMENT: number; - DEPTH_BITS: number; - DEPTH_BUFFER_BIT: number; - DEPTH_CLEAR_VALUE: number; - DEPTH_COMPONENT: number; - DEPTH_COMPONENT16: number; - DEPTH_FUNC: number; - DEPTH_RANGE: number; - DEPTH_STENCIL: number; - DEPTH_STENCIL_ATTACHMENT: number; - DEPTH_TEST: number; - DEPTH_WRITEMASK: number; - DITHER: number; - DONT_CARE: number; - DST_ALPHA: number; - DST_COLOR: number; - DYNAMIC_DRAW: number; - ELEMENT_ARRAY_BUFFER: number; - ELEMENT_ARRAY_BUFFER_BINDING: number; - EQUAL: number; - FASTEST: number; - FLOAT: number; - FLOAT_MAT2: number; - FLOAT_MAT3: number; - FLOAT_MAT4: number; - FLOAT_VEC2: number; - FLOAT_VEC3: number; - FLOAT_VEC4: number; - FRAGMENT_SHADER: number; - FRAMEBUFFER: number; - FRAMEBUFFER_ATTACHMENT_OBJECT_NAME: number; - FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE: number; - FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE: number; - FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL: number; - FRAMEBUFFER_BINDING: number; - FRAMEBUFFER_COMPLETE: number; - FRAMEBUFFER_INCOMPLETE_ATTACHMENT: number; - FRAMEBUFFER_INCOMPLETE_DIMENSIONS: number; - FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT: number; - FRAMEBUFFER_UNSUPPORTED: number; - FRONT: number; - FRONT_AND_BACK: number; - FRONT_FACE: number; - FUNC_ADD: number; - FUNC_REVERSE_SUBTRACT: number; - FUNC_SUBTRACT: number; - GENERATE_MIPMAP_HINT: number; - GEQUAL: number; - GREATER: number; - GREEN_BITS: number; - HIGH_FLOAT: number; - HIGH_INT: number; - IMPLEMENTATION_COLOR_READ_FORMAT: number; - IMPLEMENTATION_COLOR_READ_TYPE: number; - INCR: number; - INCR_WRAP: number; - INT: number; - INT_VEC2: number; - INT_VEC3: number; - INT_VEC4: number; - INVALID_ENUM: number; - INVALID_FRAMEBUFFER_OPERATION: number; - INVALID_OPERATION: number; - INVALID_VALUE: number; - INVERT: number; - KEEP: number; - LEQUAL: number; - LESS: number; - LINEAR: number; - LINEAR_MIPMAP_LINEAR: number; - LINEAR_MIPMAP_NEAREST: number; - LINES: number; - LINE_LOOP: number; - LINE_STRIP: number; - LINE_WIDTH: number; - LINK_STATUS: number; - LOW_FLOAT: number; - LOW_INT: number; - LUMINANCE: number; - LUMINANCE_ALPHA: number; - MAX_COMBINED_TEXTURE_IMAGE_UNITS: number; - MAX_CUBE_MAP_TEXTURE_SIZE: number; - MAX_FRAGMENT_UNIFORM_VECTORS: number; - MAX_RENDERBUFFER_SIZE: number; - MAX_TEXTURE_IMAGE_UNITS: number; - MAX_TEXTURE_SIZE: number; - MAX_VARYING_VECTORS: number; - MAX_VERTEX_ATTRIBS: number; - MAX_VERTEX_TEXTURE_IMAGE_UNITS: number; - MAX_VERTEX_UNIFORM_VECTORS: number; - MAX_VIEWPORT_DIMS: number; - MEDIUM_FLOAT: number; - MEDIUM_INT: number; - MIRRORED_REPEAT: number; - NEAREST: number; - NEAREST_MIPMAP_LINEAR: number; - NEAREST_MIPMAP_NEAREST: number; - NEVER: number; - NICEST: number; - NONE: number; - NOTEQUAL: number; - NO_ERROR: number; - ONE: number; - ONE_MINUS_CONSTANT_ALPHA: number; - ONE_MINUS_CONSTANT_COLOR: number; - ONE_MINUS_DST_ALPHA: number; - ONE_MINUS_DST_COLOR: number; - ONE_MINUS_SRC_ALPHA: number; - ONE_MINUS_SRC_COLOR: number; - OUT_OF_MEMORY: number; - PACK_ALIGNMENT: number; - POINTS: number; - POLYGON_OFFSET_FACTOR: number; - POLYGON_OFFSET_FILL: number; - POLYGON_OFFSET_UNITS: number; - RED_BITS: number; - RENDERBUFFER: number; - RENDERBUFFER_ALPHA_SIZE: number; - RENDERBUFFER_BINDING: number; - RENDERBUFFER_BLUE_SIZE: number; - RENDERBUFFER_DEPTH_SIZE: number; - RENDERBUFFER_GREEN_SIZE: number; - RENDERBUFFER_HEIGHT: number; - RENDERBUFFER_INTERNAL_FORMAT: number; - RENDERBUFFER_RED_SIZE: number; - RENDERBUFFER_STENCIL_SIZE: number; - RENDERBUFFER_WIDTH: number; - RENDERER: number; - REPEAT: number; - REPLACE: number; - RGB: number; - RGB565: number; - RGB5_A1: number; - RGBA: number; - RGBA4: number; - SAMPLER_2D: number; - SAMPLER_CUBE: number; - SAMPLES: number; - SAMPLE_ALPHA_TO_COVERAGE: number; - SAMPLE_BUFFERS: number; - SAMPLE_COVERAGE: number; - SAMPLE_COVERAGE_INVERT: number; - SAMPLE_COVERAGE_VALUE: number; - SCISSOR_BOX: number; - SCISSOR_TEST: number; - SHADER_TYPE: number; - SHADING_LANGUAGE_VERSION: number; - SHORT: number; - SRC_ALPHA: number; - SRC_ALPHA_SATURATE: number; - SRC_COLOR: number; - STATIC_DRAW: number; - STENCIL_ATTACHMENT: number; - STENCIL_BACK_FAIL: number; - STENCIL_BACK_FUNC: number; - STENCIL_BACK_PASS_DEPTH_FAIL: number; - STENCIL_BACK_PASS_DEPTH_PASS: number; - STENCIL_BACK_REF: number; - STENCIL_BACK_VALUE_MASK: number; - STENCIL_BACK_WRITEMASK: number; - STENCIL_BITS: number; - STENCIL_BUFFER_BIT: number; - STENCIL_CLEAR_VALUE: number; - STENCIL_FAIL: number; - STENCIL_FUNC: number; - STENCIL_INDEX: number; - STENCIL_INDEX8: number; - STENCIL_PASS_DEPTH_FAIL: number; - STENCIL_PASS_DEPTH_PASS: number; - STENCIL_REF: number; - STENCIL_TEST: number; - STENCIL_VALUE_MASK: number; - STENCIL_WRITEMASK: number; - STREAM_DRAW: number; - SUBPIXEL_BITS: number; - TEXTURE: number; - TEXTURE0: number; - TEXTURE1: number; - TEXTURE10: number; - TEXTURE11: number; - TEXTURE12: number; - TEXTURE13: number; - TEXTURE14: number; - TEXTURE15: number; - TEXTURE16: number; - TEXTURE17: number; - TEXTURE18: number; - TEXTURE19: number; - TEXTURE2: number; - TEXTURE20: number; - TEXTURE21: number; - TEXTURE22: number; - TEXTURE23: number; - TEXTURE24: number; - TEXTURE25: number; - TEXTURE26: number; - TEXTURE27: number; - TEXTURE28: number; - TEXTURE29: number; - TEXTURE3: number; - TEXTURE30: number; - TEXTURE31: number; - TEXTURE4: number; - TEXTURE5: number; - TEXTURE6: number; - TEXTURE7: number; - TEXTURE8: number; - TEXTURE9: number; - TEXTURE_2D: number; - TEXTURE_BINDING_2D: number; - TEXTURE_BINDING_CUBE_MAP: number; - TEXTURE_CUBE_MAP: number; - TEXTURE_CUBE_MAP_NEGATIVE_X: number; - TEXTURE_CUBE_MAP_NEGATIVE_Y: number; - TEXTURE_CUBE_MAP_NEGATIVE_Z: number; - TEXTURE_CUBE_MAP_POSITIVE_X: number; - TEXTURE_CUBE_MAP_POSITIVE_Y: number; - TEXTURE_CUBE_MAP_POSITIVE_Z: number; - TEXTURE_MAG_FILTER: number; - TEXTURE_MIN_FILTER: number; - TEXTURE_WRAP_S: number; - TEXTURE_WRAP_T: number; - TRIANGLES: number; - TRIANGLE_FAN: number; - TRIANGLE_STRIP: number; - UNPACK_ALIGNMENT: number; - UNPACK_COLORSPACE_CONVERSION_WEBGL: number; - UNPACK_FLIP_Y_WEBGL: number; - UNPACK_PREMULTIPLY_ALPHA_WEBGL: number; - UNSIGNED_BYTE: number; - UNSIGNED_INT: number; - UNSIGNED_SHORT: number; - UNSIGNED_SHORT_4_4_4_4: number; - UNSIGNED_SHORT_5_5_5_1: number; - UNSIGNED_SHORT_5_6_5: number; - VALIDATE_STATUS: number; - VENDOR: number; - VERSION: number; - VERTEX_ATTRIB_ARRAY_BUFFER_BINDING: number; - VERTEX_ATTRIB_ARRAY_ENABLED: number; - VERTEX_ATTRIB_ARRAY_NORMALIZED: number; - VERTEX_ATTRIB_ARRAY_POINTER: number; - VERTEX_ATTRIB_ARRAY_SIZE: number; - VERTEX_ATTRIB_ARRAY_STRIDE: number; - VERTEX_ATTRIB_ARRAY_TYPE: number; - VERTEX_SHADER: number; - VIEWPORT: number; - ZERO: number; + readonly ACTIVE_ATTRIBUTES: number; + readonly ACTIVE_TEXTURE: number; + readonly ACTIVE_UNIFORMS: number; + readonly ALIASED_LINE_WIDTH_RANGE: number; + readonly ALIASED_POINT_SIZE_RANGE: number; + readonly ALPHA: number; + readonly ALPHA_BITS: number; + readonly ALWAYS: number; + readonly ARRAY_BUFFER: number; + readonly ARRAY_BUFFER_BINDING: number; + readonly ATTACHED_SHADERS: number; + readonly BACK: number; + readonly BLEND: number; + readonly BLEND_COLOR: number; + readonly BLEND_DST_ALPHA: number; + readonly BLEND_DST_RGB: number; + readonly BLEND_EQUATION: number; + readonly BLEND_EQUATION_ALPHA: number; + readonly BLEND_EQUATION_RGB: number; + readonly BLEND_SRC_ALPHA: number; + readonly BLEND_SRC_RGB: number; + readonly BLUE_BITS: number; + readonly BOOL: number; + readonly BOOL_VEC2: number; + readonly BOOL_VEC3: number; + readonly BOOL_VEC4: number; + readonly BROWSER_DEFAULT_WEBGL: number; + readonly BUFFER_SIZE: number; + readonly BUFFER_USAGE: number; + readonly BYTE: number; + readonly CCW: number; + readonly CLAMP_TO_EDGE: number; + readonly COLOR_ATTACHMENT0: number; + readonly COLOR_BUFFER_BIT: number; + readonly COLOR_CLEAR_VALUE: number; + readonly COLOR_WRITEMASK: number; + readonly COMPILE_STATUS: number; + readonly COMPRESSED_TEXTURE_FORMATS: number; + readonly CONSTANT_ALPHA: number; + readonly CONSTANT_COLOR: number; + readonly CONTEXT_LOST_WEBGL: number; + readonly CULL_FACE: number; + readonly CULL_FACE_MODE: number; + readonly CURRENT_PROGRAM: number; + readonly CURRENT_VERTEX_ATTRIB: number; + readonly CW: number; + readonly DECR: number; + readonly DECR_WRAP: number; + readonly DELETE_STATUS: number; + readonly DEPTH_ATTACHMENT: number; + readonly DEPTH_BITS: number; + readonly DEPTH_BUFFER_BIT: number; + readonly DEPTH_CLEAR_VALUE: number; + readonly DEPTH_COMPONENT: number; + readonly DEPTH_COMPONENT16: number; + readonly DEPTH_FUNC: number; + readonly DEPTH_RANGE: number; + readonly DEPTH_STENCIL: number; + readonly DEPTH_STENCIL_ATTACHMENT: number; + readonly DEPTH_TEST: number; + readonly DEPTH_WRITEMASK: number; + readonly DITHER: number; + readonly DONT_CARE: number; + readonly DST_ALPHA: number; + readonly DST_COLOR: number; + readonly DYNAMIC_DRAW: number; + readonly ELEMENT_ARRAY_BUFFER: number; + readonly ELEMENT_ARRAY_BUFFER_BINDING: number; + readonly EQUAL: number; + readonly FASTEST: number; + readonly FLOAT: number; + readonly FLOAT_MAT2: number; + readonly FLOAT_MAT3: number; + readonly FLOAT_MAT4: number; + readonly FLOAT_VEC2: number; + readonly FLOAT_VEC3: number; + readonly FLOAT_VEC4: number; + readonly FRAGMENT_SHADER: number; + readonly FRAMEBUFFER: number; + readonly FRAMEBUFFER_ATTACHMENT_OBJECT_NAME: number; + readonly FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE: number; + readonly FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE: number; + readonly FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL: number; + readonly FRAMEBUFFER_BINDING: number; + readonly FRAMEBUFFER_COMPLETE: number; + readonly FRAMEBUFFER_INCOMPLETE_ATTACHMENT: number; + readonly FRAMEBUFFER_INCOMPLETE_DIMENSIONS: number; + readonly FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT: number; + readonly FRAMEBUFFER_UNSUPPORTED: number; + readonly FRONT: number; + readonly FRONT_AND_BACK: number; + readonly FRONT_FACE: number; + readonly FUNC_ADD: number; + readonly FUNC_REVERSE_SUBTRACT: number; + readonly FUNC_SUBTRACT: number; + readonly GENERATE_MIPMAP_HINT: number; + readonly GEQUAL: number; + readonly GREATER: number; + readonly GREEN_BITS: number; + readonly HIGH_FLOAT: number; + readonly HIGH_INT: number; + readonly IMPLEMENTATION_COLOR_READ_FORMAT: number; + readonly IMPLEMENTATION_COLOR_READ_TYPE: number; + readonly INCR: number; + readonly INCR_WRAP: number; + readonly INT: number; + readonly INT_VEC2: number; + readonly INT_VEC3: number; + readonly INT_VEC4: number; + readonly INVALID_ENUM: number; + readonly INVALID_FRAMEBUFFER_OPERATION: number; + readonly INVALID_OPERATION: number; + readonly INVALID_VALUE: number; + readonly INVERT: number; + readonly KEEP: number; + readonly LEQUAL: number; + readonly LESS: number; + readonly LINEAR: number; + readonly LINEAR_MIPMAP_LINEAR: number; + readonly LINEAR_MIPMAP_NEAREST: number; + readonly LINES: number; + readonly LINE_LOOP: number; + readonly LINE_STRIP: number; + readonly LINE_WIDTH: number; + readonly LINK_STATUS: number; + readonly LOW_FLOAT: number; + readonly LOW_INT: number; + readonly LUMINANCE: number; + readonly LUMINANCE_ALPHA: number; + readonly MAX_COMBINED_TEXTURE_IMAGE_UNITS: number; + readonly MAX_CUBE_MAP_TEXTURE_SIZE: number; + readonly MAX_FRAGMENT_UNIFORM_VECTORS: number; + readonly MAX_RENDERBUFFER_SIZE: number; + readonly MAX_TEXTURE_IMAGE_UNITS: number; + readonly MAX_TEXTURE_SIZE: number; + readonly MAX_VARYING_VECTORS: number; + readonly MAX_VERTEX_ATTRIBS: number; + readonly MAX_VERTEX_TEXTURE_IMAGE_UNITS: number; + readonly MAX_VERTEX_UNIFORM_VECTORS: number; + readonly MAX_VIEWPORT_DIMS: number; + readonly MEDIUM_FLOAT: number; + readonly MEDIUM_INT: number; + readonly MIRRORED_REPEAT: number; + readonly NEAREST: number; + readonly NEAREST_MIPMAP_LINEAR: number; + readonly NEAREST_MIPMAP_NEAREST: number; + readonly NEVER: number; + readonly NICEST: number; + readonly NONE: number; + readonly NOTEQUAL: number; + readonly NO_ERROR: number; + readonly ONE: number; + readonly ONE_MINUS_CONSTANT_ALPHA: number; + readonly ONE_MINUS_CONSTANT_COLOR: number; + readonly ONE_MINUS_DST_ALPHA: number; + readonly ONE_MINUS_DST_COLOR: number; + readonly ONE_MINUS_SRC_ALPHA: number; + readonly ONE_MINUS_SRC_COLOR: number; + readonly OUT_OF_MEMORY: number; + readonly PACK_ALIGNMENT: number; + readonly POINTS: number; + readonly POLYGON_OFFSET_FACTOR: number; + readonly POLYGON_OFFSET_FILL: number; + readonly POLYGON_OFFSET_UNITS: number; + readonly RED_BITS: number; + readonly RENDERBUFFER: number; + readonly RENDERBUFFER_ALPHA_SIZE: number; + readonly RENDERBUFFER_BINDING: number; + readonly RENDERBUFFER_BLUE_SIZE: number; + readonly RENDERBUFFER_DEPTH_SIZE: number; + readonly RENDERBUFFER_GREEN_SIZE: number; + readonly RENDERBUFFER_HEIGHT: number; + readonly RENDERBUFFER_INTERNAL_FORMAT: number; + readonly RENDERBUFFER_RED_SIZE: number; + readonly RENDERBUFFER_STENCIL_SIZE: number; + readonly RENDERBUFFER_WIDTH: number; + readonly RENDERER: number; + readonly REPEAT: number; + readonly REPLACE: number; + readonly RGB: number; + readonly RGB565: number; + readonly RGB5_A1: number; + readonly RGBA: number; + readonly RGBA4: number; + readonly SAMPLER_2D: number; + readonly SAMPLER_CUBE: number; + readonly SAMPLES: number; + readonly SAMPLE_ALPHA_TO_COVERAGE: number; + readonly SAMPLE_BUFFERS: number; + readonly SAMPLE_COVERAGE: number; + readonly SAMPLE_COVERAGE_INVERT: number; + readonly SAMPLE_COVERAGE_VALUE: number; + readonly SCISSOR_BOX: number; + readonly SCISSOR_TEST: number; + readonly SHADER_TYPE: number; + readonly SHADING_LANGUAGE_VERSION: number; + readonly SHORT: number; + readonly SRC_ALPHA: number; + readonly SRC_ALPHA_SATURATE: number; + readonly SRC_COLOR: number; + readonly STATIC_DRAW: number; + readonly STENCIL_ATTACHMENT: number; + readonly STENCIL_BACK_FAIL: number; + readonly STENCIL_BACK_FUNC: number; + readonly STENCIL_BACK_PASS_DEPTH_FAIL: number; + readonly STENCIL_BACK_PASS_DEPTH_PASS: number; + readonly STENCIL_BACK_REF: number; + readonly STENCIL_BACK_VALUE_MASK: number; + readonly STENCIL_BACK_WRITEMASK: number; + readonly STENCIL_BITS: number; + readonly STENCIL_BUFFER_BIT: number; + readonly STENCIL_CLEAR_VALUE: number; + readonly STENCIL_FAIL: number; + readonly STENCIL_FUNC: number; + readonly STENCIL_INDEX: number; + readonly STENCIL_INDEX8: number; + readonly STENCIL_PASS_DEPTH_FAIL: number; + readonly STENCIL_PASS_DEPTH_PASS: number; + readonly STENCIL_REF: number; + readonly STENCIL_TEST: number; + readonly STENCIL_VALUE_MASK: number; + readonly STENCIL_WRITEMASK: number; + readonly STREAM_DRAW: number; + readonly SUBPIXEL_BITS: number; + readonly TEXTURE: number; + readonly TEXTURE0: number; + readonly TEXTURE1: number; + readonly TEXTURE10: number; + readonly TEXTURE11: number; + readonly TEXTURE12: number; + readonly TEXTURE13: number; + readonly TEXTURE14: number; + readonly TEXTURE15: number; + readonly TEXTURE16: number; + readonly TEXTURE17: number; + readonly TEXTURE18: number; + readonly TEXTURE19: number; + readonly TEXTURE2: number; + readonly TEXTURE20: number; + readonly TEXTURE21: number; + readonly TEXTURE22: number; + readonly TEXTURE23: number; + readonly TEXTURE24: number; + readonly TEXTURE25: number; + readonly TEXTURE26: number; + readonly TEXTURE27: number; + readonly TEXTURE28: number; + readonly TEXTURE29: number; + readonly TEXTURE3: number; + readonly TEXTURE30: number; + readonly TEXTURE31: number; + readonly TEXTURE4: number; + readonly TEXTURE5: number; + readonly TEXTURE6: number; + readonly TEXTURE7: number; + readonly TEXTURE8: number; + readonly TEXTURE9: number; + readonly TEXTURE_2D: number; + readonly TEXTURE_BINDING_2D: number; + readonly TEXTURE_BINDING_CUBE_MAP: number; + readonly TEXTURE_CUBE_MAP: number; + readonly TEXTURE_CUBE_MAP_NEGATIVE_X: number; + readonly TEXTURE_CUBE_MAP_NEGATIVE_Y: number; + readonly TEXTURE_CUBE_MAP_NEGATIVE_Z: number; + readonly TEXTURE_CUBE_MAP_POSITIVE_X: number; + readonly TEXTURE_CUBE_MAP_POSITIVE_Y: number; + readonly TEXTURE_CUBE_MAP_POSITIVE_Z: number; + readonly TEXTURE_MAG_FILTER: number; + readonly TEXTURE_MIN_FILTER: number; + readonly TEXTURE_WRAP_S: number; + readonly TEXTURE_WRAP_T: number; + readonly TRIANGLES: number; + readonly TRIANGLE_FAN: number; + readonly TRIANGLE_STRIP: number; + readonly UNPACK_ALIGNMENT: number; + readonly UNPACK_COLORSPACE_CONVERSION_WEBGL: number; + readonly UNPACK_FLIP_Y_WEBGL: number; + readonly UNPACK_PREMULTIPLY_ALPHA_WEBGL: number; + readonly UNSIGNED_BYTE: number; + readonly UNSIGNED_INT: number; + readonly UNSIGNED_SHORT: number; + readonly UNSIGNED_SHORT_4_4_4_4: number; + readonly UNSIGNED_SHORT_5_5_5_1: number; + readonly UNSIGNED_SHORT_5_6_5: number; + readonly VALIDATE_STATUS: number; + readonly VENDOR: number; + readonly VERSION: number; + readonly VERTEX_ATTRIB_ARRAY_BUFFER_BINDING: number; + readonly VERTEX_ATTRIB_ARRAY_ENABLED: number; + readonly VERTEX_ATTRIB_ARRAY_NORMALIZED: number; + readonly VERTEX_ATTRIB_ARRAY_POINTER: number; + readonly VERTEX_ATTRIB_ARRAY_SIZE: number; + readonly VERTEX_ATTRIB_ARRAY_STRIDE: number; + readonly VERTEX_ATTRIB_ARRAY_TYPE: number; + readonly VERTEX_SHADER: number; + readonly VIEWPORT: number; + readonly ZERO: number; } declare var WebGLRenderingContext: { prototype: WebGLRenderingContext; new(): WebGLRenderingContext; - ACTIVE_ATTRIBUTES: number; - ACTIVE_TEXTURE: number; - ACTIVE_UNIFORMS: number; - ALIASED_LINE_WIDTH_RANGE: number; - ALIASED_POINT_SIZE_RANGE: number; - ALPHA: number; - ALPHA_BITS: number; - ALWAYS: number; - ARRAY_BUFFER: number; - ARRAY_BUFFER_BINDING: number; - ATTACHED_SHADERS: number; - BACK: number; - BLEND: number; - BLEND_COLOR: number; - BLEND_DST_ALPHA: number; - BLEND_DST_RGB: number; - BLEND_EQUATION: number; - BLEND_EQUATION_ALPHA: number; - BLEND_EQUATION_RGB: number; - BLEND_SRC_ALPHA: number; - BLEND_SRC_RGB: number; - BLUE_BITS: number; - BOOL: number; - BOOL_VEC2: number; - BOOL_VEC3: number; - BOOL_VEC4: number; - BROWSER_DEFAULT_WEBGL: number; - BUFFER_SIZE: number; - BUFFER_USAGE: number; - BYTE: number; - CCW: number; - CLAMP_TO_EDGE: number; - COLOR_ATTACHMENT0: number; - COLOR_BUFFER_BIT: number; - COLOR_CLEAR_VALUE: number; - COLOR_WRITEMASK: number; - COMPILE_STATUS: number; - COMPRESSED_TEXTURE_FORMATS: number; - CONSTANT_ALPHA: number; - CONSTANT_COLOR: number; - CONTEXT_LOST_WEBGL: number; - CULL_FACE: number; - CULL_FACE_MODE: number; - CURRENT_PROGRAM: number; - CURRENT_VERTEX_ATTRIB: number; - CW: number; - DECR: number; - DECR_WRAP: number; - DELETE_STATUS: number; - DEPTH_ATTACHMENT: number; - DEPTH_BITS: number; - DEPTH_BUFFER_BIT: number; - DEPTH_CLEAR_VALUE: number; - DEPTH_COMPONENT: number; - DEPTH_COMPONENT16: number; - DEPTH_FUNC: number; - DEPTH_RANGE: number; - DEPTH_STENCIL: number; - DEPTH_STENCIL_ATTACHMENT: number; - DEPTH_TEST: number; - DEPTH_WRITEMASK: number; - DITHER: number; - DONT_CARE: number; - DST_ALPHA: number; - DST_COLOR: number; - DYNAMIC_DRAW: number; - ELEMENT_ARRAY_BUFFER: number; - ELEMENT_ARRAY_BUFFER_BINDING: number; - EQUAL: number; - FASTEST: number; - FLOAT: number; - FLOAT_MAT2: number; - FLOAT_MAT3: number; - FLOAT_MAT4: number; - FLOAT_VEC2: number; - FLOAT_VEC3: number; - FLOAT_VEC4: number; - FRAGMENT_SHADER: number; - FRAMEBUFFER: number; - FRAMEBUFFER_ATTACHMENT_OBJECT_NAME: number; - FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE: number; - FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE: number; - FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL: number; - FRAMEBUFFER_BINDING: number; - FRAMEBUFFER_COMPLETE: number; - FRAMEBUFFER_INCOMPLETE_ATTACHMENT: number; - FRAMEBUFFER_INCOMPLETE_DIMENSIONS: number; - FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT: number; - FRAMEBUFFER_UNSUPPORTED: number; - FRONT: number; - FRONT_AND_BACK: number; - FRONT_FACE: number; - FUNC_ADD: number; - FUNC_REVERSE_SUBTRACT: number; - FUNC_SUBTRACT: number; - GENERATE_MIPMAP_HINT: number; - GEQUAL: number; - GREATER: number; - GREEN_BITS: number; - HIGH_FLOAT: number; - HIGH_INT: number; - IMPLEMENTATION_COLOR_READ_FORMAT: number; - IMPLEMENTATION_COLOR_READ_TYPE: number; - INCR: number; - INCR_WRAP: number; - INT: number; - INT_VEC2: number; - INT_VEC3: number; - INT_VEC4: number; - INVALID_ENUM: number; - INVALID_FRAMEBUFFER_OPERATION: number; - INVALID_OPERATION: number; - INVALID_VALUE: number; - INVERT: number; - KEEP: number; - LEQUAL: number; - LESS: number; - LINEAR: number; - LINEAR_MIPMAP_LINEAR: number; - LINEAR_MIPMAP_NEAREST: number; - LINES: number; - LINE_LOOP: number; - LINE_STRIP: number; - LINE_WIDTH: number; - LINK_STATUS: number; - LOW_FLOAT: number; - LOW_INT: number; - LUMINANCE: number; - LUMINANCE_ALPHA: number; - MAX_COMBINED_TEXTURE_IMAGE_UNITS: number; - MAX_CUBE_MAP_TEXTURE_SIZE: number; - MAX_FRAGMENT_UNIFORM_VECTORS: number; - MAX_RENDERBUFFER_SIZE: number; - MAX_TEXTURE_IMAGE_UNITS: number; - MAX_TEXTURE_SIZE: number; - MAX_VARYING_VECTORS: number; - MAX_VERTEX_ATTRIBS: number; - MAX_VERTEX_TEXTURE_IMAGE_UNITS: number; - MAX_VERTEX_UNIFORM_VECTORS: number; - MAX_VIEWPORT_DIMS: number; - MEDIUM_FLOAT: number; - MEDIUM_INT: number; - MIRRORED_REPEAT: number; - NEAREST: number; - NEAREST_MIPMAP_LINEAR: number; - NEAREST_MIPMAP_NEAREST: number; - NEVER: number; - NICEST: number; - NONE: number; - NOTEQUAL: number; - NO_ERROR: number; - ONE: number; - ONE_MINUS_CONSTANT_ALPHA: number; - ONE_MINUS_CONSTANT_COLOR: number; - ONE_MINUS_DST_ALPHA: number; - ONE_MINUS_DST_COLOR: number; - ONE_MINUS_SRC_ALPHA: number; - ONE_MINUS_SRC_COLOR: number; - OUT_OF_MEMORY: number; - PACK_ALIGNMENT: number; - POINTS: number; - POLYGON_OFFSET_FACTOR: number; - POLYGON_OFFSET_FILL: number; - POLYGON_OFFSET_UNITS: number; - RED_BITS: number; - RENDERBUFFER: number; - RENDERBUFFER_ALPHA_SIZE: number; - RENDERBUFFER_BINDING: number; - RENDERBUFFER_BLUE_SIZE: number; - RENDERBUFFER_DEPTH_SIZE: number; - RENDERBUFFER_GREEN_SIZE: number; - RENDERBUFFER_HEIGHT: number; - RENDERBUFFER_INTERNAL_FORMAT: number; - RENDERBUFFER_RED_SIZE: number; - RENDERBUFFER_STENCIL_SIZE: number; - RENDERBUFFER_WIDTH: number; - RENDERER: number; - REPEAT: number; - REPLACE: number; - RGB: number; - RGB565: number; - RGB5_A1: number; - RGBA: number; - RGBA4: number; - SAMPLER_2D: number; - SAMPLER_CUBE: number; - SAMPLES: number; - SAMPLE_ALPHA_TO_COVERAGE: number; - SAMPLE_BUFFERS: number; - SAMPLE_COVERAGE: number; - SAMPLE_COVERAGE_INVERT: number; - SAMPLE_COVERAGE_VALUE: number; - SCISSOR_BOX: number; - SCISSOR_TEST: number; - SHADER_TYPE: number; - SHADING_LANGUAGE_VERSION: number; - SHORT: number; - SRC_ALPHA: number; - SRC_ALPHA_SATURATE: number; - SRC_COLOR: number; - STATIC_DRAW: number; - STENCIL_ATTACHMENT: number; - STENCIL_BACK_FAIL: number; - STENCIL_BACK_FUNC: number; - STENCIL_BACK_PASS_DEPTH_FAIL: number; - STENCIL_BACK_PASS_DEPTH_PASS: number; - STENCIL_BACK_REF: number; - STENCIL_BACK_VALUE_MASK: number; - STENCIL_BACK_WRITEMASK: number; - STENCIL_BITS: number; - STENCIL_BUFFER_BIT: number; - STENCIL_CLEAR_VALUE: number; - STENCIL_FAIL: number; - STENCIL_FUNC: number; - STENCIL_INDEX: number; - STENCIL_INDEX8: number; - STENCIL_PASS_DEPTH_FAIL: number; - STENCIL_PASS_DEPTH_PASS: number; - STENCIL_REF: number; - STENCIL_TEST: number; - STENCIL_VALUE_MASK: number; - STENCIL_WRITEMASK: number; - STREAM_DRAW: number; - SUBPIXEL_BITS: number; - TEXTURE: number; - TEXTURE0: number; - TEXTURE1: number; - TEXTURE10: number; - TEXTURE11: number; - TEXTURE12: number; - TEXTURE13: number; - TEXTURE14: number; - TEXTURE15: number; - TEXTURE16: number; - TEXTURE17: number; - TEXTURE18: number; - TEXTURE19: number; - TEXTURE2: number; - TEXTURE20: number; - TEXTURE21: number; - TEXTURE22: number; - TEXTURE23: number; - TEXTURE24: number; - TEXTURE25: number; - TEXTURE26: number; - TEXTURE27: number; - TEXTURE28: number; - TEXTURE29: number; - TEXTURE3: number; - TEXTURE30: number; - TEXTURE31: number; - TEXTURE4: number; - TEXTURE5: number; - TEXTURE6: number; - TEXTURE7: number; - TEXTURE8: number; - TEXTURE9: number; - TEXTURE_2D: number; - TEXTURE_BINDING_2D: number; - TEXTURE_BINDING_CUBE_MAP: number; - TEXTURE_CUBE_MAP: number; - TEXTURE_CUBE_MAP_NEGATIVE_X: number; - TEXTURE_CUBE_MAP_NEGATIVE_Y: number; - TEXTURE_CUBE_MAP_NEGATIVE_Z: number; - TEXTURE_CUBE_MAP_POSITIVE_X: number; - TEXTURE_CUBE_MAP_POSITIVE_Y: number; - TEXTURE_CUBE_MAP_POSITIVE_Z: number; - TEXTURE_MAG_FILTER: number; - TEXTURE_MIN_FILTER: number; - TEXTURE_WRAP_S: number; - TEXTURE_WRAP_T: number; - TRIANGLES: number; - TRIANGLE_FAN: number; - TRIANGLE_STRIP: number; - UNPACK_ALIGNMENT: number; - UNPACK_COLORSPACE_CONVERSION_WEBGL: number; - UNPACK_FLIP_Y_WEBGL: number; - UNPACK_PREMULTIPLY_ALPHA_WEBGL: number; - UNSIGNED_BYTE: number; - UNSIGNED_INT: number; - UNSIGNED_SHORT: number; - UNSIGNED_SHORT_4_4_4_4: number; - UNSIGNED_SHORT_5_5_5_1: number; - UNSIGNED_SHORT_5_6_5: number; - VALIDATE_STATUS: number; - VENDOR: number; - VERSION: number; - VERTEX_ATTRIB_ARRAY_BUFFER_BINDING: number; - VERTEX_ATTRIB_ARRAY_ENABLED: number; - VERTEX_ATTRIB_ARRAY_NORMALIZED: number; - VERTEX_ATTRIB_ARRAY_POINTER: number; - VERTEX_ATTRIB_ARRAY_SIZE: number; - VERTEX_ATTRIB_ARRAY_STRIDE: number; - VERTEX_ATTRIB_ARRAY_TYPE: number; - VERTEX_SHADER: number; - VIEWPORT: number; - ZERO: number; + readonly ACTIVE_ATTRIBUTES: number; + readonly ACTIVE_TEXTURE: number; + readonly ACTIVE_UNIFORMS: number; + readonly ALIASED_LINE_WIDTH_RANGE: number; + readonly ALIASED_POINT_SIZE_RANGE: number; + readonly ALPHA: number; + readonly ALPHA_BITS: number; + readonly ALWAYS: number; + readonly ARRAY_BUFFER: number; + readonly ARRAY_BUFFER_BINDING: number; + readonly ATTACHED_SHADERS: number; + readonly BACK: number; + readonly BLEND: number; + readonly BLEND_COLOR: number; + readonly BLEND_DST_ALPHA: number; + readonly BLEND_DST_RGB: number; + readonly BLEND_EQUATION: number; + readonly BLEND_EQUATION_ALPHA: number; + readonly BLEND_EQUATION_RGB: number; + readonly BLEND_SRC_ALPHA: number; + readonly BLEND_SRC_RGB: number; + readonly BLUE_BITS: number; + readonly BOOL: number; + readonly BOOL_VEC2: number; + readonly BOOL_VEC3: number; + readonly BOOL_VEC4: number; + readonly BROWSER_DEFAULT_WEBGL: number; + readonly BUFFER_SIZE: number; + readonly BUFFER_USAGE: number; + readonly BYTE: number; + readonly CCW: number; + readonly CLAMP_TO_EDGE: number; + readonly COLOR_ATTACHMENT0: number; + readonly COLOR_BUFFER_BIT: number; + readonly COLOR_CLEAR_VALUE: number; + readonly COLOR_WRITEMASK: number; + readonly COMPILE_STATUS: number; + readonly COMPRESSED_TEXTURE_FORMATS: number; + readonly CONSTANT_ALPHA: number; + readonly CONSTANT_COLOR: number; + readonly CONTEXT_LOST_WEBGL: number; + readonly CULL_FACE: number; + readonly CULL_FACE_MODE: number; + readonly CURRENT_PROGRAM: number; + readonly CURRENT_VERTEX_ATTRIB: number; + readonly CW: number; + readonly DECR: number; + readonly DECR_WRAP: number; + readonly DELETE_STATUS: number; + readonly DEPTH_ATTACHMENT: number; + readonly DEPTH_BITS: number; + readonly DEPTH_BUFFER_BIT: number; + readonly DEPTH_CLEAR_VALUE: number; + readonly DEPTH_COMPONENT: number; + readonly DEPTH_COMPONENT16: number; + readonly DEPTH_FUNC: number; + readonly DEPTH_RANGE: number; + readonly DEPTH_STENCIL: number; + readonly DEPTH_STENCIL_ATTACHMENT: number; + readonly DEPTH_TEST: number; + readonly DEPTH_WRITEMASK: number; + readonly DITHER: number; + readonly DONT_CARE: number; + readonly DST_ALPHA: number; + readonly DST_COLOR: number; + readonly DYNAMIC_DRAW: number; + readonly ELEMENT_ARRAY_BUFFER: number; + readonly ELEMENT_ARRAY_BUFFER_BINDING: number; + readonly EQUAL: number; + readonly FASTEST: number; + readonly FLOAT: number; + readonly FLOAT_MAT2: number; + readonly FLOAT_MAT3: number; + readonly FLOAT_MAT4: number; + readonly FLOAT_VEC2: number; + readonly FLOAT_VEC3: number; + readonly FLOAT_VEC4: number; + readonly FRAGMENT_SHADER: number; + readonly FRAMEBUFFER: number; + readonly FRAMEBUFFER_ATTACHMENT_OBJECT_NAME: number; + readonly FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE: number; + readonly FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE: number; + readonly FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL: number; + readonly FRAMEBUFFER_BINDING: number; + readonly FRAMEBUFFER_COMPLETE: number; + readonly FRAMEBUFFER_INCOMPLETE_ATTACHMENT: number; + readonly FRAMEBUFFER_INCOMPLETE_DIMENSIONS: number; + readonly FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT: number; + readonly FRAMEBUFFER_UNSUPPORTED: number; + readonly FRONT: number; + readonly FRONT_AND_BACK: number; + readonly FRONT_FACE: number; + readonly FUNC_ADD: number; + readonly FUNC_REVERSE_SUBTRACT: number; + readonly FUNC_SUBTRACT: number; + readonly GENERATE_MIPMAP_HINT: number; + readonly GEQUAL: number; + readonly GREATER: number; + readonly GREEN_BITS: number; + readonly HIGH_FLOAT: number; + readonly HIGH_INT: number; + readonly IMPLEMENTATION_COLOR_READ_FORMAT: number; + readonly IMPLEMENTATION_COLOR_READ_TYPE: number; + readonly INCR: number; + readonly INCR_WRAP: number; + readonly INT: number; + readonly INT_VEC2: number; + readonly INT_VEC3: number; + readonly INT_VEC4: number; + readonly INVALID_ENUM: number; + readonly INVALID_FRAMEBUFFER_OPERATION: number; + readonly INVALID_OPERATION: number; + readonly INVALID_VALUE: number; + readonly INVERT: number; + readonly KEEP: number; + readonly LEQUAL: number; + readonly LESS: number; + readonly LINEAR: number; + readonly LINEAR_MIPMAP_LINEAR: number; + readonly LINEAR_MIPMAP_NEAREST: number; + readonly LINES: number; + readonly LINE_LOOP: number; + readonly LINE_STRIP: number; + readonly LINE_WIDTH: number; + readonly LINK_STATUS: number; + readonly LOW_FLOAT: number; + readonly LOW_INT: number; + readonly LUMINANCE: number; + readonly LUMINANCE_ALPHA: number; + readonly MAX_COMBINED_TEXTURE_IMAGE_UNITS: number; + readonly MAX_CUBE_MAP_TEXTURE_SIZE: number; + readonly MAX_FRAGMENT_UNIFORM_VECTORS: number; + readonly MAX_RENDERBUFFER_SIZE: number; + readonly MAX_TEXTURE_IMAGE_UNITS: number; + readonly MAX_TEXTURE_SIZE: number; + readonly MAX_VARYING_VECTORS: number; + readonly MAX_VERTEX_ATTRIBS: number; + readonly MAX_VERTEX_TEXTURE_IMAGE_UNITS: number; + readonly MAX_VERTEX_UNIFORM_VECTORS: number; + readonly MAX_VIEWPORT_DIMS: number; + readonly MEDIUM_FLOAT: number; + readonly MEDIUM_INT: number; + readonly MIRRORED_REPEAT: number; + readonly NEAREST: number; + readonly NEAREST_MIPMAP_LINEAR: number; + readonly NEAREST_MIPMAP_NEAREST: number; + readonly NEVER: number; + readonly NICEST: number; + readonly NONE: number; + readonly NOTEQUAL: number; + readonly NO_ERROR: number; + readonly ONE: number; + readonly ONE_MINUS_CONSTANT_ALPHA: number; + readonly ONE_MINUS_CONSTANT_COLOR: number; + readonly ONE_MINUS_DST_ALPHA: number; + readonly ONE_MINUS_DST_COLOR: number; + readonly ONE_MINUS_SRC_ALPHA: number; + readonly ONE_MINUS_SRC_COLOR: number; + readonly OUT_OF_MEMORY: number; + readonly PACK_ALIGNMENT: number; + readonly POINTS: number; + readonly POLYGON_OFFSET_FACTOR: number; + readonly POLYGON_OFFSET_FILL: number; + readonly POLYGON_OFFSET_UNITS: number; + readonly RED_BITS: number; + readonly RENDERBUFFER: number; + readonly RENDERBUFFER_ALPHA_SIZE: number; + readonly RENDERBUFFER_BINDING: number; + readonly RENDERBUFFER_BLUE_SIZE: number; + readonly RENDERBUFFER_DEPTH_SIZE: number; + readonly RENDERBUFFER_GREEN_SIZE: number; + readonly RENDERBUFFER_HEIGHT: number; + readonly RENDERBUFFER_INTERNAL_FORMAT: number; + readonly RENDERBUFFER_RED_SIZE: number; + readonly RENDERBUFFER_STENCIL_SIZE: number; + readonly RENDERBUFFER_WIDTH: number; + readonly RENDERER: number; + readonly REPEAT: number; + readonly REPLACE: number; + readonly RGB: number; + readonly RGB565: number; + readonly RGB5_A1: number; + readonly RGBA: number; + readonly RGBA4: number; + readonly SAMPLER_2D: number; + readonly SAMPLER_CUBE: number; + readonly SAMPLES: number; + readonly SAMPLE_ALPHA_TO_COVERAGE: number; + readonly SAMPLE_BUFFERS: number; + readonly SAMPLE_COVERAGE: number; + readonly SAMPLE_COVERAGE_INVERT: number; + readonly SAMPLE_COVERAGE_VALUE: number; + readonly SCISSOR_BOX: number; + readonly SCISSOR_TEST: number; + readonly SHADER_TYPE: number; + readonly SHADING_LANGUAGE_VERSION: number; + readonly SHORT: number; + readonly SRC_ALPHA: number; + readonly SRC_ALPHA_SATURATE: number; + readonly SRC_COLOR: number; + readonly STATIC_DRAW: number; + readonly STENCIL_ATTACHMENT: number; + readonly STENCIL_BACK_FAIL: number; + readonly STENCIL_BACK_FUNC: number; + readonly STENCIL_BACK_PASS_DEPTH_FAIL: number; + readonly STENCIL_BACK_PASS_DEPTH_PASS: number; + readonly STENCIL_BACK_REF: number; + readonly STENCIL_BACK_VALUE_MASK: number; + readonly STENCIL_BACK_WRITEMASK: number; + readonly STENCIL_BITS: number; + readonly STENCIL_BUFFER_BIT: number; + readonly STENCIL_CLEAR_VALUE: number; + readonly STENCIL_FAIL: number; + readonly STENCIL_FUNC: number; + readonly STENCIL_INDEX: number; + readonly STENCIL_INDEX8: number; + readonly STENCIL_PASS_DEPTH_FAIL: number; + readonly STENCIL_PASS_DEPTH_PASS: number; + readonly STENCIL_REF: number; + readonly STENCIL_TEST: number; + readonly STENCIL_VALUE_MASK: number; + readonly STENCIL_WRITEMASK: number; + readonly STREAM_DRAW: number; + readonly SUBPIXEL_BITS: number; + readonly TEXTURE: number; + readonly TEXTURE0: number; + readonly TEXTURE1: number; + readonly TEXTURE10: number; + readonly TEXTURE11: number; + readonly TEXTURE12: number; + readonly TEXTURE13: number; + readonly TEXTURE14: number; + readonly TEXTURE15: number; + readonly TEXTURE16: number; + readonly TEXTURE17: number; + readonly TEXTURE18: number; + readonly TEXTURE19: number; + readonly TEXTURE2: number; + readonly TEXTURE20: number; + readonly TEXTURE21: number; + readonly TEXTURE22: number; + readonly TEXTURE23: number; + readonly TEXTURE24: number; + readonly TEXTURE25: number; + readonly TEXTURE26: number; + readonly TEXTURE27: number; + readonly TEXTURE28: number; + readonly TEXTURE29: number; + readonly TEXTURE3: number; + readonly TEXTURE30: number; + readonly TEXTURE31: number; + readonly TEXTURE4: number; + readonly TEXTURE5: number; + readonly TEXTURE6: number; + readonly TEXTURE7: number; + readonly TEXTURE8: number; + readonly TEXTURE9: number; + readonly TEXTURE_2D: number; + readonly TEXTURE_BINDING_2D: number; + readonly TEXTURE_BINDING_CUBE_MAP: number; + readonly TEXTURE_CUBE_MAP: number; + readonly TEXTURE_CUBE_MAP_NEGATIVE_X: number; + readonly TEXTURE_CUBE_MAP_NEGATIVE_Y: number; + readonly TEXTURE_CUBE_MAP_NEGATIVE_Z: number; + readonly TEXTURE_CUBE_MAP_POSITIVE_X: number; + readonly TEXTURE_CUBE_MAP_POSITIVE_Y: number; + readonly TEXTURE_CUBE_MAP_POSITIVE_Z: number; + readonly TEXTURE_MAG_FILTER: number; + readonly TEXTURE_MIN_FILTER: number; + readonly TEXTURE_WRAP_S: number; + readonly TEXTURE_WRAP_T: number; + readonly TRIANGLES: number; + readonly TRIANGLE_FAN: number; + readonly TRIANGLE_STRIP: number; + readonly UNPACK_ALIGNMENT: number; + readonly UNPACK_COLORSPACE_CONVERSION_WEBGL: number; + readonly UNPACK_FLIP_Y_WEBGL: number; + readonly UNPACK_PREMULTIPLY_ALPHA_WEBGL: number; + readonly UNSIGNED_BYTE: number; + readonly UNSIGNED_INT: number; + readonly UNSIGNED_SHORT: number; + readonly UNSIGNED_SHORT_4_4_4_4: number; + readonly UNSIGNED_SHORT_5_5_5_1: number; + readonly UNSIGNED_SHORT_5_6_5: number; + readonly VALIDATE_STATUS: number; + readonly VENDOR: number; + readonly VERSION: number; + readonly VERTEX_ATTRIB_ARRAY_BUFFER_BINDING: number; + readonly VERTEX_ATTRIB_ARRAY_ENABLED: number; + readonly VERTEX_ATTRIB_ARRAY_NORMALIZED: number; + readonly VERTEX_ATTRIB_ARRAY_POINTER: number; + readonly VERTEX_ATTRIB_ARRAY_SIZE: number; + readonly VERTEX_ATTRIB_ARRAY_STRIDE: number; + readonly VERTEX_ATTRIB_ARRAY_TYPE: number; + readonly VERTEX_SHADER: number; + readonly VIEWPORT: number; + readonly ZERO: number; } interface WebGLShader extends WebGLObject { @@ -11918,9 +12709,9 @@ declare var WebGLShader: { } interface WebGLShaderPrecisionFormat { - precision: number; - rangeMax: number; - rangeMin: number; + readonly precision: number; + readonly rangeMax: number; + readonly rangeMin: number; } declare var WebGLShaderPrecisionFormat: { @@ -11996,21 +12787,21 @@ declare var WebKitPoint: { interface WebSocket extends EventTarget { binaryType: string; - bufferedAmount: number; - extensions: string; + readonly bufferedAmount: number; + readonly extensions: string; onclose: (ev: CloseEvent) => any; onerror: (ev: Event) => any; onmessage: (ev: MessageEvent) => any; onopen: (ev: Event) => any; - protocol: string; - readyState: number; - url: string; + readonly protocol: string; + readonly readyState: number; + readonly url: string; close(code?: number, reason?: string): void; send(data: any): void; - CLOSED: number; - CLOSING: number; - CONNECTING: number; - OPEN: number; + readonly CLOSED: number; + readonly CLOSING: number; + readonly CONNECTING: number; + readonly OPEN: number; addEventListener(type: "close", listener: (ev: CloseEvent) => any, useCapture?: boolean): void; addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: "message", listener: (ev: MessageEvent) => any, useCapture?: boolean): void; @@ -12021,56 +12812,58 @@ interface WebSocket extends EventTarget { declare var WebSocket: { prototype: WebSocket; new(url: string, protocols?: string | string[]): WebSocket; - CLOSED: number; - CLOSING: number; - CONNECTING: number; - OPEN: number; + readonly CLOSED: number; + readonly CLOSING: number; + readonly CONNECTING: number; + readonly OPEN: number; } interface WheelEvent extends MouseEvent { - deltaMode: number; - deltaX: number; - deltaY: number; - deltaZ: number; + readonly deltaMode: number; + readonly deltaX: number; + readonly deltaY: number; + readonly deltaZ: number; + readonly wheelDelta: number; + readonly wheelDeltaX: number; + readonly wheelDeltaY: number; getCurrentPoint(element: Element): void; 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; - DOM_DELTA_LINE: number; - DOM_DELTA_PAGE: number; - DOM_DELTA_PIXEL: number; + readonly DOM_DELTA_LINE: number; + readonly DOM_DELTA_PAGE: number; + readonly DOM_DELTA_PIXEL: number; } declare var WheelEvent: { prototype: WheelEvent; new(typeArg: string, eventInitDict?: WheelEventInit): WheelEvent; - DOM_DELTA_LINE: number; - DOM_DELTA_PAGE: number; - DOM_DELTA_PIXEL: number; + readonly DOM_DELTA_LINE: number; + readonly DOM_DELTA_PAGE: number; + readonly DOM_DELTA_PIXEL: number; } interface Window extends EventTarget, WindowTimers, WindowSessionStorage, WindowLocalStorage, WindowConsole, GlobalEventHandlers, IDBEnvironment, WindowBase64 { - animationStartTime: number; - applicationCache: ApplicationCache; - clientInformation: Navigator; - closed: boolean; - crypto: Crypto; + readonly applicationCache: ApplicationCache; + readonly clientInformation: Navigator; + readonly closed: boolean; + readonly crypto: Crypto; defaultStatus: string; - devicePixelRatio: number; - doNotTrack: string; - document: Document; + readonly devicePixelRatio: number; + readonly doNotTrack: string; + readonly document: Document; event: Event; - external: External; - frameElement: Element; - frames: Window; - history: History; - innerHeight: number; - innerWidth: number; - length: number; - location: Location; - locationbar: BarProp; - menubar: BarProp; - msAnimationStartTime: number; + readonly external: External; + readonly frameElement: Element; + readonly frames: Window; + readonly history: History; + readonly innerHeight: number; + readonly innerWidth: number; + readonly length: number; + readonly location: Location; + readonly locationbar: BarProp; + readonly menubar: BarProp; + readonly msCredentials: MSCredentials; name: string; - navigator: Navigator; + readonly navigator: Navigator; offscreenBuffering: string | boolean; onabort: (ev: Event) => any; onafterprint: (ev: Event) => any; @@ -12084,6 +12877,7 @@ interface Window extends EventTarget, WindowTimers, WindowSessionStorage, Window oncompassneedscalibration: (ev: Event) => any; oncontextmenu: (ev: PointerEvent) => any; ondblclick: (ev: MouseEvent) => any; + ondevicelight: (ev: DeviceLightEvent) => any; ondevicemotion: (ev: DeviceMotionEvent) => any; ondeviceorientation: (ev: DeviceOrientationEvent) => any; ondrag: (ev: DragEvent) => any; @@ -12095,11 +12889,12 @@ interface Window extends EventTarget, WindowTimers, WindowSessionStorage, Window ondrop: (ev: DragEvent) => any; ondurationchange: (ev: Event) => any; onemptied: (ev: Event) => any; - onended: (ev: Event) => any; + onended: (ev: MediaStreamErrorEvent) => any; onerror: ErrorEventHandler; onfocus: (ev: FocusEvent) => any; onhashchange: (ev: HashChangeEvent) => any; oninput: (ev: Event) => any; + oninvalid: (ev: Event) => any; onkeydown: (ev: KeyboardEvent) => any; onkeypress: (ev: KeyboardEvent) => any; onkeyup: (ev: KeyboardEvent) => any; @@ -12115,7 +12910,7 @@ interface Window extends EventTarget, WindowTimers, WindowSessionStorage, Window onmouseout: (ev: MouseEvent) => any; onmouseover: (ev: MouseEvent) => any; onmouseup: (ev: MouseEvent) => any; - onmousewheel: (ev: MouseWheelEvent) => any; + onmousewheel: (ev: WheelEvent) => any; onmsgesturechange: (ev: MSGestureEvent) => any; onmsgesturedoubletap: (ev: MSGestureEvent) => any; onmsgestureend: (ev: MSGestureEvent) => any; @@ -12154,38 +12949,38 @@ interface Window extends EventTarget, WindowTimers, WindowSessionStorage, Window onsubmit: (ev: Event) => any; onsuspend: (ev: Event) => any; ontimeupdate: (ev: Event) => any; - ontouchcancel: any; - ontouchend: any; - ontouchmove: any; - ontouchstart: any; + ontouchcancel: (ev: TouchEvent) => any; + ontouchend: (ev: TouchEvent) => any; + ontouchmove: (ev: TouchEvent) => any; + ontouchstart: (ev: TouchEvent) => any; onunload: (ev: Event) => any; onvolumechange: (ev: Event) => any; onwaiting: (ev: Event) => any; - opener: Window; + readonly opener: Window; orientation: string | number; - outerHeight: number; - outerWidth: number; - pageXOffset: number; - pageYOffset: number; - parent: Window; - performance: Performance; - personalbar: BarProp; - screen: Screen; - screenLeft: number; - screenTop: number; - screenX: number; - screenY: number; - scrollX: number; - scrollY: number; - scrollbars: BarProp; - self: Window; + readonly outerHeight: number; + readonly outerWidth: number; + readonly pageXOffset: number; + readonly pageYOffset: number; + readonly parent: Window; + readonly performance: Performance; + readonly personalbar: BarProp; + readonly screen: Screen; + readonly screenLeft: number; + readonly screenTop: number; + readonly screenX: number; + readonly screenY: number; + readonly scrollX: number; + readonly scrollY: number; + readonly scrollbars: BarProp; + readonly self: Window; status: string; - statusbar: BarProp; - styleMedia: StyleMedia; - toolbar: BarProp; - top: Window; - window: Window; - URL: URL; + readonly statusbar: BarProp; + readonly styleMedia: StyleMedia; + readonly toolbar: BarProp; + readonly top: Window; + readonly window: Window; + URL: typeof URL; alert(message?: any): void; blur(): void; cancelAnimationFrame(handle: number): void; @@ -12199,12 +12994,9 @@ interface Window extends EventTarget, WindowTimers, WindowSessionStorage, Window matchMedia(mediaQuery: string): MediaQueryList; moveBy(x?: number, y?: number): void; moveTo(x?: number, y?: number): void; - msCancelRequestAnimationFrame(handle: number): void; - msMatchMedia(mediaQuery: string): MediaQueryList; - msRequestAnimationFrame(callback: FrameRequestCallback): number; msWriteProfilerMark(profilerMarkName: string): void; open(url?: string, target?: string, features?: string, replace?: boolean): Window; - postMessage(message: any, targetOrigin: string, ports?: any): void; + postMessage(message: any, targetOrigin: string, transfer?: any[]): void; print(): void; prompt(message?: string, _default?: string): string; releaseEvents(): void; @@ -12214,8 +13006,10 @@ interface Window extends EventTarget, WindowTimers, WindowSessionStorage, Window scroll(x?: number, y?: number): void; scrollBy(x?: number, y?: number): void; scrollTo(x?: number, y?: number): void; + webkitCancelAnimationFrame(handle: number): void; webkitConvertPointFromNodeToPage(node: Node, pt: WebKitPoint): WebKitPoint; webkitConvertPointFromPageToNode(node: Node, pt: WebKitPoint): WebKitPoint; + webkitRequestAnimationFrame(callback: FrameRequestCallback): number; addEventListener(type: "MSGestureChange", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void; addEventListener(type: "MSGestureDoubleTap", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void; addEventListener(type: "MSGestureEnd", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void; @@ -12243,6 +13037,7 @@ interface Window extends EventTarget, WindowTimers, WindowSessionStorage, Window addEventListener(type: "compassneedscalibration", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "contextmenu", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; addEventListener(type: "dblclick", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "devicelight", listener: (ev: DeviceLightEvent) => any, useCapture?: boolean): void; addEventListener(type: "devicemotion", listener: (ev: DeviceMotionEvent) => any, useCapture?: boolean): void; addEventListener(type: "deviceorientation", listener: (ev: DeviceOrientationEvent) => any, useCapture?: boolean): void; addEventListener(type: "drag", listener: (ev: DragEvent) => any, useCapture?: boolean): void; @@ -12254,10 +13049,11 @@ interface Window extends EventTarget, WindowTimers, WindowSessionStorage, Window addEventListener(type: "drop", listener: (ev: DragEvent) => any, useCapture?: boolean): void; addEventListener(type: "durationchange", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "emptied", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "ended", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "ended", listener: (ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: "focus", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; addEventListener(type: "hashchange", listener: (ev: HashChangeEvent) => any, useCapture?: boolean): void; addEventListener(type: "input", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "invalid", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "keydown", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "keypress", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "keyup", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; @@ -12273,7 +13069,7 @@ interface Window extends EventTarget, WindowTimers, WindowSessionStorage, Window addEventListener(type: "mouseout", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "mouseover", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "mouseup", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousewheel", listener: (ev: MouseWheelEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mousewheel", listener: (ev: WheelEvent) => any, useCapture?: boolean): void; addEventListener(type: "offline", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "online", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "orientationchange", listener: (ev: Event) => any, useCapture?: boolean): void; @@ -12343,16 +13139,15 @@ declare var XMLDocument: { interface XMLHttpRequest extends EventTarget, XMLHttpRequestEventTarget { msCaching: string; onreadystatechange: (ev: ProgressEvent) => any; - readyState: number; - response: any; - responseBody: any; - responseText: string; + readonly readyState: number; + readonly response: any; + readonly responseText: string; responseType: string; - responseXML: any; - status: number; - statusText: string; + readonly responseXML: any; + readonly status: number; + readonly statusText: string; timeout: number; - upload: XMLHttpRequestUpload; + readonly upload: XMLHttpRequestUpload; withCredentials: boolean; abort(): void; getAllResponseHeaders(): string; @@ -12364,11 +13159,11 @@ interface XMLHttpRequest extends EventTarget, XMLHttpRequestEventTarget { send(data?: string): void; send(data?: any): void; setRequestHeader(header: string, value: string): void; - DONE: number; - HEADERS_RECEIVED: number; - LOADING: number; - OPENED: number; - UNSENT: number; + readonly DONE: number; + readonly HEADERS_RECEIVED: number; + readonly LOADING: number; + readonly OPENED: number; + readonly UNSENT: number; addEventListener(type: "abort", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: "load", listener: (ev: Event) => any, useCapture?: boolean): void; @@ -12383,11 +13178,11 @@ interface XMLHttpRequest extends EventTarget, XMLHttpRequestEventTarget { declare var XMLHttpRequest: { prototype: XMLHttpRequest; new(): XMLHttpRequest; - DONE: number; - HEADERS_RECEIVED: number; - LOADING: number; - OPENED: number; - UNSENT: number; + readonly DONE: number; + readonly HEADERS_RECEIVED: number; + readonly LOADING: number; + readonly OPENED: number; + readonly UNSENT: number; create(): XMLHttpRequest; } @@ -12439,40 +13234,40 @@ declare var XPathNSResolver: { } interface XPathResult { - booleanValue: boolean; - invalidIteratorState: boolean; - numberValue: number; - resultType: number; - singleNodeValue: Node; - snapshotLength: number; - stringValue: string; + readonly booleanValue: boolean; + readonly invalidIteratorState: boolean; + readonly numberValue: number; + readonly resultType: number; + readonly singleNodeValue: Node; + readonly snapshotLength: number; + readonly stringValue: string; iterateNext(): Node; snapshotItem(index: number): Node; - ANY_TYPE: number; - ANY_UNORDERED_NODE_TYPE: number; - BOOLEAN_TYPE: number; - FIRST_ORDERED_NODE_TYPE: number; - NUMBER_TYPE: number; - ORDERED_NODE_ITERATOR_TYPE: number; - ORDERED_NODE_SNAPSHOT_TYPE: number; - STRING_TYPE: number; - UNORDERED_NODE_ITERATOR_TYPE: number; - UNORDERED_NODE_SNAPSHOT_TYPE: number; + readonly ANY_TYPE: number; + readonly ANY_UNORDERED_NODE_TYPE: number; + readonly BOOLEAN_TYPE: number; + readonly FIRST_ORDERED_NODE_TYPE: number; + readonly NUMBER_TYPE: number; + readonly ORDERED_NODE_ITERATOR_TYPE: number; + readonly ORDERED_NODE_SNAPSHOT_TYPE: number; + readonly STRING_TYPE: number; + readonly UNORDERED_NODE_ITERATOR_TYPE: number; + readonly UNORDERED_NODE_SNAPSHOT_TYPE: number; } declare var XPathResult: { prototype: XPathResult; new(): XPathResult; - ANY_TYPE: number; - ANY_UNORDERED_NODE_TYPE: number; - BOOLEAN_TYPE: number; - FIRST_ORDERED_NODE_TYPE: number; - NUMBER_TYPE: number; - ORDERED_NODE_ITERATOR_TYPE: number; - ORDERED_NODE_SNAPSHOT_TYPE: number; - STRING_TYPE: number; - UNORDERED_NODE_ITERATOR_TYPE: number; - UNORDERED_NODE_SNAPSHOT_TYPE: number; + readonly ANY_TYPE: number; + readonly ANY_UNORDERED_NODE_TYPE: number; + readonly BOOLEAN_TYPE: number; + readonly FIRST_ORDERED_NODE_TYPE: number; + readonly NUMBER_TYPE: number; + readonly ORDERED_NODE_ITERATOR_TYPE: number; + readonly ORDERED_NODE_SNAPSHOT_TYPE: number; + readonly STRING_TYPE: number; + readonly UNORDERED_NODE_ITERATOR_TYPE: number; + readonly UNORDERED_NODE_SNAPSHOT_TYPE: number; } interface XSLTProcessor { @@ -12497,6 +13292,18 @@ interface AbstractWorker { addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } +interface CanvasPathMethods { + arc(x: number, y: number, radius: number, startAngle: number, endAngle: number, anticlockwise?: boolean): void; + arcTo(x1: number, y1: number, x2: number, y2: number, radius: number): void; + bezierCurveTo(cp1x: number, cp1y: number, cp2x: number, cp2y: number, x: number, y: number): void; + closePath(): void; + ellipse(x: number, y: number, radiusX: number, radiusY: number, rotation: number, startAngle: number, endAngle: number, anticlockwise?: boolean): void; + lineTo(x: number, y: number): void; + moveTo(x: number, y: number): void; + quadraticCurveTo(cpx: number, cpy: number, x: number, y: number): void; + rect(x: number, y: number, w: number, h: number): void; +} + interface ChildNode { remove(): void; } @@ -12519,6 +13326,7 @@ interface DocumentEvent { createEvent(eventInterface:"CommandEvent"): CommandEvent; createEvent(eventInterface:"CompositionEvent"): CompositionEvent; createEvent(eventInterface:"CustomEvent"): CustomEvent; + createEvent(eventInterface:"DeviceLightEvent"): DeviceLightEvent; createEvent(eventInterface:"DeviceMotionEvent"): DeviceMotionEvent; createEvent(eventInterface:"DeviceOrientationEvent"): DeviceOrientationEvent; createEvent(eventInterface:"DragEvent"): DragEvent; @@ -12530,6 +13338,7 @@ interface DocumentEvent { createEvent(eventInterface:"HashChangeEvent"): HashChangeEvent; createEvent(eventInterface:"IDBVersionChangeEvent"): IDBVersionChangeEvent; createEvent(eventInterface:"KeyboardEvent"): KeyboardEvent; + createEvent(eventInterface:"ListeningStateChangedEvent"): ListeningStateChangedEvent; createEvent(eventInterface:"LongRunningScriptDetectedEvent"): LongRunningScriptDetectedEvent; createEvent(eventInterface:"MSGestureEvent"): MSGestureEvent; createEvent(eventInterface:"MSManipulationEvent"): MSManipulationEvent; @@ -12537,21 +13346,31 @@ interface DocumentEvent { createEvent(eventInterface:"MSMediaKeyNeededEvent"): MSMediaKeyNeededEvent; createEvent(eventInterface:"MSPointerEvent"): MSPointerEvent; createEvent(eventInterface:"MSSiteModeEvent"): MSSiteModeEvent; + createEvent(eventInterface:"MediaEncryptedEvent"): MediaEncryptedEvent; + createEvent(eventInterface:"MediaKeyMessageEvent"): MediaKeyMessageEvent; + createEvent(eventInterface:"MediaStreamErrorEvent"): MediaStreamErrorEvent; + createEvent(eventInterface:"MediaStreamTrackEvent"): MediaStreamTrackEvent; createEvent(eventInterface:"MessageEvent"): MessageEvent; createEvent(eventInterface:"MouseEvent"): MouseEvent; createEvent(eventInterface:"MouseEvents"): MouseEvent; - createEvent(eventInterface:"MouseWheelEvent"): MouseWheelEvent; createEvent(eventInterface:"MutationEvent"): MutationEvent; createEvent(eventInterface:"MutationEvents"): MutationEvent; createEvent(eventInterface:"NavigationCompletedEvent"): NavigationCompletedEvent; createEvent(eventInterface:"NavigationEvent"): NavigationEvent; createEvent(eventInterface:"NavigationEventWithReferrer"): NavigationEventWithReferrer; createEvent(eventInterface:"OfflineAudioCompletionEvent"): OfflineAudioCompletionEvent; + createEvent(eventInterface:"OverflowEvent"): OverflowEvent; createEvent(eventInterface:"PageTransitionEvent"): PageTransitionEvent; createEvent(eventInterface:"PermissionRequestedEvent"): PermissionRequestedEvent; createEvent(eventInterface:"PointerEvent"): PointerEvent; createEvent(eventInterface:"PopStateEvent"): PopStateEvent; createEvent(eventInterface:"ProgressEvent"): ProgressEvent; + createEvent(eventInterface:"RTCDTMFToneChangeEvent"): RTCDTMFToneChangeEvent; + createEvent(eventInterface:"RTCDtlsTransportStateChangedEvent"): RTCDtlsTransportStateChangedEvent; + createEvent(eventInterface:"RTCIceCandidatePairChangedEvent"): RTCIceCandidatePairChangedEvent; + createEvent(eventInterface:"RTCIceGathererEvent"): RTCIceGathererEvent; + createEvent(eventInterface:"RTCIceTransportStateChangedEvent"): RTCIceTransportStateChangedEvent; + createEvent(eventInterface:"RTCSsrcConflictEvent"): RTCSsrcConflictEvent; createEvent(eventInterface:"SVGZoomEvent"): SVGZoomEvent; createEvent(eventInterface:"SVGZoomEvents"): SVGZoomEvent; createEvent(eventInterface:"ScriptNotifyEvent"): ScriptNotifyEvent; @@ -12569,11 +13388,11 @@ interface DocumentEvent { } interface ElementTraversal { - childElementCount: number; - firstElementChild: Element; - lastElementChild: Element; - nextElementSibling: Element; - previousElementSibling: Element; + readonly childElementCount: number; + readonly firstElementChild: Element; + readonly lastElementChild: Element; + readonly nextElementSibling: Element; + readonly previousElementSibling: Element; } interface GetSVGDocument { @@ -12618,12 +13437,11 @@ interface HTMLTableAlignment { } interface IDBEnvironment { - indexedDB: IDBFactory; - msIndexedDB: IDBFactory; + readonly indexedDB: IDBFactory; } interface LinkStyle { - sheet: StyleSheet; + readonly sheet: StyleSheet; } interface MSBaseReader { @@ -12633,12 +13451,12 @@ interface MSBaseReader { onloadend: (ev: ProgressEvent) => any; onloadstart: (ev: Event) => any; onprogress: (ev: ProgressEvent) => any; - readyState: number; - result: any; + readonly readyState: number; + readonly result: any; abort(): void; - DONE: number; - EMPTY: number; - LOADING: number; + readonly DONE: number; + readonly EMPTY: number; + readonly LOADING: number; addEventListener(type: "abort", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: "load", listener: (ev: Event) => any, useCapture?: boolean): void; @@ -12666,27 +13484,32 @@ interface NavigatorContentUtils { } interface NavigatorGeolocation { - geolocation: Geolocation; + readonly geolocation: Geolocation; } interface NavigatorID { - appName: string; - appVersion: string; - platform: string; - product: string; - productSub: string; - userAgent: string; - vendor: string; - vendorSub: string; + readonly appName: string; + readonly appVersion: string; + readonly platform: string; + readonly product: string; + readonly productSub: string; + readonly userAgent: string; + readonly vendor: string; + readonly vendorSub: string; } interface NavigatorOnLine { - onLine: boolean; + readonly onLine: boolean; } interface NavigatorStorageUtils { } +interface NavigatorUserMedia { + readonly mediaDevices: MediaDevices; + getUserMedia(constraints: MediaStreamConstraints, successCallback: NavigatorUserMediaSuccessCallback, errorCallback: NavigatorUserMediaErrorCallback): void; +} + interface NodeSelector { querySelector(selectors: string): Element; querySelectorAll(selectors: string): NodeListOf; @@ -12697,29 +13520,29 @@ interface RandomSource { } interface SVGAnimatedPathData { - pathSegList: SVGPathSegList; + readonly pathSegList: SVGPathSegList; } interface SVGAnimatedPoints { - animatedPoints: SVGPointList; - points: SVGPointList; + readonly animatedPoints: SVGPointList; + readonly points: SVGPointList; } interface SVGExternalResourcesRequired { - externalResourcesRequired: SVGAnimatedBoolean; + readonly externalResourcesRequired: SVGAnimatedBoolean; } interface SVGFilterPrimitiveStandardAttributes extends SVGStylable { - height: SVGAnimatedLength; - result: SVGAnimatedString; - width: SVGAnimatedLength; - x: SVGAnimatedLength; - y: SVGAnimatedLength; + readonly height: SVGAnimatedLength; + readonly result: SVGAnimatedString; + readonly width: SVGAnimatedLength; + readonly x: SVGAnimatedLength; + readonly y: SVGAnimatedLength; } interface SVGFitToViewBox { - preserveAspectRatio: SVGAnimatedPreserveAspectRatio; - viewBox: SVGAnimatedRect; + readonly preserveAspectRatio: SVGAnimatedPreserveAspectRatio; + readonly viewBox: SVGAnimatedRect; } interface SVGLangSpace { @@ -12728,8 +13551,8 @@ interface SVGLangSpace { } interface SVGLocatable { - farthestViewportElement: SVGElement; - nearestViewportElement: SVGElement; + readonly farthestViewportElement: SVGElement; + readonly nearestViewportElement: SVGElement; getBBox(): SVGRect; getCTM(): SVGMatrix; getScreenCTM(): SVGMatrix; @@ -12738,22 +13561,22 @@ interface SVGLocatable { interface SVGStylable { className: any; - style: CSSStyleDeclaration; + readonly style: CSSStyleDeclaration; } interface SVGTests { - requiredExtensions: SVGStringList; - requiredFeatures: SVGStringList; - systemLanguage: SVGStringList; + readonly requiredExtensions: SVGStringList; + readonly requiredFeatures: SVGStringList; + readonly systemLanguage: SVGStringList; hasExtension(extension: string): boolean; } interface SVGTransformable extends SVGLocatable { - transform: SVGAnimatedTransformList; + readonly transform: SVGAnimatedTransformList; } interface SVGURIReference { - href: SVGAnimatedString; + readonly href: SVGAnimatedString; } interface WindowBase64 { @@ -12762,15 +13585,15 @@ interface WindowBase64 { } interface WindowConsole { - console: Console; + readonly console: Console; } interface WindowLocalStorage { - localStorage: Storage; + readonly localStorage: Storage; } interface WindowSessionStorage { - sessionStorage: Storage; + readonly sessionStorage: Storage; } interface WindowTimers extends Object, WindowTimersExtension { @@ -12782,8 +13605,6 @@ interface WindowTimers extends Object, WindowTimersExtension { interface WindowTimersExtension { clearImmediate(handle: number): void; - msClearImmediate(handle: number): void; - msSetImmediate(expression: any, ...args: any[]): number; setImmediate(expression: any, ...args: any[]): number; } @@ -12813,22 +13634,18 @@ interface StorageEventInit extends EventInit { storageArea?: Storage; } -interface IDBObjectStoreParameters { - keyPath?: string | string[]; - autoIncrement?: boolean; -} - -interface IDBIndexParameters { - unique?: boolean; - multiEntry?: boolean; -} - interface NodeListOf extends NodeList { length: number; item(index: number): TNode; [index: number]: TNode; } +interface HTMLCollectionOf extends HTMLCollection { + item(index: number): T; + namedItem(name: string): T; + [index: number]: T; +} + interface BlobPropertyBag { type?: string; endings?: string; @@ -12858,15 +13675,6 @@ interface ProgressEventInit extends EventInit { total?: number; } -interface HTMLTemplateElement extends HTMLElement { - content: DocumentFragment; -} - -declare var HTMLTemplateElement: { - prototype: HTMLTemplateElement; - new(): HTMLTemplateElement; -} - interface HTMLPictureElement extends HTMLElement { } @@ -12875,6 +13683,14 @@ declare var HTMLPictureElement: { new(): HTMLPictureElement; } +interface ClipboardEventInit extends EventInit { + data?: string; + dataType?: string; +} + +interface IDBArrayKey extends Array { +} + declare type EventListenerOrEventListenerObject = EventListener | EventListenerObject; interface ErrorEventHandler { @@ -12913,10 +13729,18 @@ interface DecodeErrorCallback { interface FunctionStringCallback { (data: string): void; } +interface NavigatorUserMediaSuccessCallback { + (stream: MediaStream): void; +} +interface NavigatorUserMediaErrorCallback { + (error: MediaStreamError): void; +} +interface ForEachCallback { + (keyId: any, status: string): void; +} declare var Audio: {new(src?: string): HTMLAudioElement; }; declare var Image: {new(width?: number, height?: number): HTMLImageElement; }; declare var Option: {new(text?: string, value?: string, defaultSelected?: boolean, selected?: boolean): HTMLOptionElement; }; -declare var animationStartTime: number; declare var applicationCache: ApplicationCache; declare var clientInformation: Navigator; declare var closed: boolean; @@ -12936,7 +13760,7 @@ declare var length: number; declare var location: Location; declare var locationbar: BarProp; declare var menubar: BarProp; -declare var msAnimationStartTime: number; +declare var msCredentials: MSCredentials; declare var name: string; declare var navigator: Navigator; declare var offscreenBuffering: string | boolean; @@ -12952,6 +13776,7 @@ declare var onclick: (ev: MouseEvent) => any; declare var oncompassneedscalibration: (ev: Event) => any; declare var oncontextmenu: (ev: PointerEvent) => any; declare var ondblclick: (ev: MouseEvent) => any; +declare var ondevicelight: (ev: DeviceLightEvent) => any; declare var ondevicemotion: (ev: DeviceMotionEvent) => any; declare var ondeviceorientation: (ev: DeviceOrientationEvent) => any; declare var ondrag: (ev: DragEvent) => any; @@ -12963,11 +13788,12 @@ declare var ondragstart: (ev: DragEvent) => any; declare var ondrop: (ev: DragEvent) => any; declare var ondurationchange: (ev: Event) => any; declare var onemptied: (ev: Event) => any; -declare var onended: (ev: Event) => any; +declare var onended: (ev: MediaStreamErrorEvent) => any; declare var onerror: ErrorEventHandler; declare var onfocus: (ev: FocusEvent) => any; declare var onhashchange: (ev: HashChangeEvent) => any; declare var oninput: (ev: Event) => any; +declare var oninvalid: (ev: Event) => any; declare var onkeydown: (ev: KeyboardEvent) => any; declare var onkeypress: (ev: KeyboardEvent) => any; declare var onkeyup: (ev: KeyboardEvent) => any; @@ -12983,7 +13809,7 @@ declare var onmousemove: (ev: MouseEvent) => any; declare var onmouseout: (ev: MouseEvent) => any; declare var onmouseover: (ev: MouseEvent) => any; declare var onmouseup: (ev: MouseEvent) => any; -declare var onmousewheel: (ev: MouseWheelEvent) => any; +declare var onmousewheel: (ev: WheelEvent) => any; declare var onmsgesturechange: (ev: MSGestureEvent) => any; declare var onmsgesturedoubletap: (ev: MSGestureEvent) => any; declare var onmsgestureend: (ev: MSGestureEvent) => any; @@ -13022,10 +13848,10 @@ declare var onstorage: (ev: StorageEvent) => any; declare var onsubmit: (ev: Event) => any; declare var onsuspend: (ev: Event) => any; declare var ontimeupdate: (ev: Event) => any; -declare var ontouchcancel: any; -declare var ontouchend: any; -declare var ontouchmove: any; -declare var ontouchstart: any; +declare var ontouchcancel: (ev: TouchEvent) => any; +declare var ontouchend: (ev: TouchEvent) => any; +declare var ontouchmove: (ev: TouchEvent) => any; +declare var ontouchstart: (ev: TouchEvent) => any; declare var onunload: (ev: Event) => any; declare var onvolumechange: (ev: Event) => any; declare var onwaiting: (ev: Event) => any; @@ -13053,7 +13879,6 @@ declare var styleMedia: StyleMedia; declare var toolbar: BarProp; declare var top: Window; declare var window: Window; -declare var URL: URL; declare function alert(message?: any): void; declare function blur(): void; declare function cancelAnimationFrame(handle: number): void; @@ -13067,12 +13892,9 @@ declare function getSelection(): Selection; declare function matchMedia(mediaQuery: string): MediaQueryList; declare function moveBy(x?: number, y?: number): void; declare function moveTo(x?: number, y?: number): void; -declare function msCancelRequestAnimationFrame(handle: number): void; -declare function msMatchMedia(mediaQuery: string): MediaQueryList; -declare function msRequestAnimationFrame(callback: FrameRequestCallback): number; declare function msWriteProfilerMark(profilerMarkName: string): void; declare function open(url?: string, target?: string, features?: string, replace?: boolean): Window; -declare function postMessage(message: any, targetOrigin: string, ports?: any): void; +declare function postMessage(message: any, targetOrigin: string, transfer?: any[]): void; declare function print(): void; declare function prompt(message?: string, _default?: string): string; declare function releaseEvents(): void; @@ -13082,19 +13904,19 @@ declare function resizeTo(x?: number, y?: number): void; declare function scroll(x?: number, y?: number): void; declare function scrollBy(x?: number, y?: number): void; declare function scrollTo(x?: number, y?: number): void; +declare function webkitCancelAnimationFrame(handle: number): void; declare function webkitConvertPointFromNodeToPage(node: Node, pt: WebKitPoint): WebKitPoint; declare function webkitConvertPointFromPageToNode(node: Node, pt: WebKitPoint): WebKitPoint; +declare function webkitRequestAnimationFrame(callback: FrameRequestCallback): number; declare function toString(): string; -declare function addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +declare function addEventListener(type: string, listener?: EventListenerOrEventListenerObject, useCapture?: boolean): void; declare function dispatchEvent(evt: Event): boolean; -declare function removeEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +declare function removeEventListener(type: string, listener?: EventListenerOrEventListenerObject, useCapture?: boolean): void; declare function clearInterval(handle: number): void; declare function clearTimeout(handle: number): void; declare function setInterval(handler: any, timeout?: any, ...args: any[]): number; declare function setTimeout(handler: any, timeout?: any, ...args: any[]): number; declare function clearImmediate(handle: number): void; -declare function msClearImmediate(handle: number): void; -declare function msSetImmediate(expression: any, ...args: any[]): number; declare function setImmediate(expression: any, ...args: any[]): number; declare var sessionStorage: Storage; declare var localStorage: Storage; @@ -13109,7 +13931,6 @@ declare var onpointerover: (ev: PointerEvent) => any; declare var onpointerup: (ev: PointerEvent) => any; declare var onwheel: (ev: WheelEvent) => any; declare var indexedDB: IDBFactory; -declare var msIndexedDB: IDBFactory; declare function atob(encodedString: string): string; declare function btoa(rawString: string): string; declare function addEventListener(type: "MSGestureChange", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void; @@ -13139,6 +13960,7 @@ declare function addEventListener(type: "click", listener: (ev: MouseEvent) => a declare function addEventListener(type: "compassneedscalibration", listener: (ev: Event) => any, useCapture?: boolean): void; declare function addEventListener(type: "contextmenu", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; declare function addEventListener(type: "dblclick", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "devicelight", listener: (ev: DeviceLightEvent) => any, useCapture?: boolean): void; declare function addEventListener(type: "devicemotion", listener: (ev: DeviceMotionEvent) => any, useCapture?: boolean): void; declare function addEventListener(type: "deviceorientation", listener: (ev: DeviceOrientationEvent) => any, useCapture?: boolean): void; declare function addEventListener(type: "drag", listener: (ev: DragEvent) => any, useCapture?: boolean): void; @@ -13150,10 +13972,11 @@ declare function addEventListener(type: "dragstart", listener: (ev: DragEvent) = declare function addEventListener(type: "drop", listener: (ev: DragEvent) => any, useCapture?: boolean): void; declare function addEventListener(type: "durationchange", listener: (ev: Event) => any, useCapture?: boolean): void; declare function addEventListener(type: "emptied", listener: (ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "ended", listener: (ev: Event) => any, useCapture?: boolean): void; +declare function addEventListener(type: "ended", listener: (ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; declare function addEventListener(type: "focus", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; declare function addEventListener(type: "hashchange", listener: (ev: HashChangeEvent) => any, useCapture?: boolean): void; declare function addEventListener(type: "input", listener: (ev: Event) => any, useCapture?: boolean): void; +declare function addEventListener(type: "invalid", listener: (ev: Event) => any, useCapture?: boolean): void; declare function addEventListener(type: "keydown", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; declare function addEventListener(type: "keypress", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; declare function addEventListener(type: "keyup", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; @@ -13169,7 +13992,7 @@ declare function addEventListener(type: "mousemove", listener: (ev: MouseEvent) declare function addEventListener(type: "mouseout", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; declare function addEventListener(type: "mouseover", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; declare function addEventListener(type: "mouseup", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "mousewheel", listener: (ev: MouseWheelEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "mousewheel", listener: (ev: WheelEvent) => any, useCapture?: boolean): void; declare function addEventListener(type: "offline", listener: (ev: Event) => any, useCapture?: boolean): void; declare function addEventListener(type: "online", listener: (ev: Event) => any, useCapture?: boolean): void; declare function addEventListener(type: "orientationchange", listener: (ev: Event) => any, useCapture?: boolean): void; @@ -13205,4 +14028,36 @@ declare function addEventListener(type: "unload", listener: (ev: Event) => any, declare function addEventListener(type: "volumechange", listener: (ev: Event) => any, useCapture?: boolean): void; declare function addEventListener(type: "waiting", listener: (ev: Event) => any, useCapture?: boolean): void; declare function addEventListener(type: "wheel", listener: (ev: WheelEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; \ No newline at end of file +declare function addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +type AAGUID = string; +type AlgorithmIdentifier = string | Algorithm; +type ConstrainBoolean = boolean | ConstrainBooleanParameters; +type ConstrainDOMString = string | string[] | ConstrainDOMStringParameters; +type ConstrainDouble = number | ConstrainDoubleRange; +type ConstrainLong = number | ConstrainLongRange; +type CryptoOperationData = ArrayBufferView; +type GLbitfield = number; +type GLboolean = boolean; +type GLbyte = number; +type GLclampf = number; +type GLenum = number; +type GLfloat = number; +type GLint = number; +type GLintptr = number; +type GLshort = number; +type GLsizei = number; +type GLsizeiptr = number; +type GLubyte = number; +type GLuint = number; +type GLushort = number; +type IDBKeyPath = string; +type KeyFormat = string; +type KeyType = string; +type KeyUsage = string; +type MSInboundPayload = MSVideoRecvPayload | MSAudioRecvPayload; +type MSLocalClientEvent = MSLocalClientEventBase | MSAudioLocalClientEvent; +type MSOutboundPayload = MSVideoSendPayload | MSAudioSendPayload; +type RTCIceGatherCandidate = RTCIceCandidate | RTCIceCandidateComplete; +type RTCTransport = RTCDtlsTransport | RTCSrtpSdesTransport; +type payloadtype = number; +type IDBValidKey = number | string | Date | IDBArrayKey; \ No newline at end of file diff --git a/lib/lib.dom.iterable.d.ts b/lib/lib.dom.iterable.d.ts new file mode 100644 index 00000000000..e9cf451bf49 --- /dev/null +++ b/lib/lib.dom.iterable.d.ts @@ -0,0 +1,29 @@ +/*! ***************************************************************************** +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. +***************************************************************************** */ + +/// +/// + +interface DOMTokenList { + [Symbol.iterator](): IterableIterator; +} + +interface NodeList { + [Symbol.iterator](): IterableIterator +} + +interface NodeListOf { + [Symbol.iterator](): IterableIterator +} diff --git a/lib/lib.es2015.collection.d.ts b/lib/lib.es2015.collection.d.ts new file mode 100644 index 00000000000..b1dbcac592d --- /dev/null +++ b/lib/lib.es2015.collection.d.ts @@ -0,0 +1,86 @@ +/*! ***************************************************************************** +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. +***************************************************************************** */ + +/// +interface Map { + clear(): void; + delete(key: K): boolean; + forEach(callbackfn: (value: V, index: K, map: Map) => void, thisArg?: any): void; + get(key: K): V | undefined; + has(key: K): boolean; + set(key: K, value?: V): Map; + readonly size: number; +} + +interface MapConstructor { + new (): Map; + new (): Map; + readonly prototype: Map; +} +declare var Map: MapConstructor; + +interface WeakMap { + clear(): void; + delete(key: K): boolean; + get(key: K): V | undefined; + has(key: K): boolean; + set(key: K, value?: V): WeakMap; + +} + +interface WeakMapConstructor { + new (): WeakMap; + new (): WeakMap; + readonly prototype: WeakMap; +} +declare var WeakMap: WeakMapConstructor; + +interface Set { + add(value: T): Set; + clear(): void; + delete(value: T): boolean; + entries(): IterableIterator<[T, T]>; + forEach(callbackfn: (value: T, index: T, set: Set) => void, thisArg?: any): void; + has(value: T): boolean; + keys(): IterableIterator; + readonly size: number; + values(): IterableIterator; + [Symbol.iterator]():IterableIterator; + readonly [Symbol.toStringTag]: "Set"; +} + +interface SetConstructor { + new (): Set; + new (): Set; + new (iterable: Iterable): Set; + readonly prototype: Set; +} +declare var Set: SetConstructor; + +interface WeakSet { + add(value: T): WeakSet; + clear(): void; + delete(value: T): boolean; + has(value: T): boolean; + readonly [Symbol.toStringTag]: "WeakSet"; +} + +interface WeakSetConstructor { + new (): WeakSet; + new (): WeakSet; + new (iterable: Iterable): WeakSet; + readonly prototype: WeakSet; +} +declare var WeakSet: WeakSetConstructor; diff --git a/lib/lib.es2015.core.d.ts b/lib/lib.es2015.core.d.ts new file mode 100644 index 00000000000..fb6b7b96df5 --- /dev/null +++ b/lib/lib.es2015.core.d.ts @@ -0,0 +1,499 @@ +/*! ***************************************************************************** +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 type PropertyKey = string | number | symbol; + +interface Array { + /** + * Returns the value of the first element in the array where predicate is true, and undefined + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find + * immediately returns that element value. Otherwise, find returns undefined. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + find(predicate: (value: T, index: number, obj: Array) => boolean, thisArg?: any): T | undefined; + + /** + * Returns the index of the first element in the array where predicate is true, and undefined + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find + * immediately returns that element value. Otherwise, find returns undefined. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + findIndex(predicate: (value: T) => boolean, thisArg?: any): number | undefined; + + /** + * Returns the this object after filling the section identified by start and end with value + * @param value value to fill array section with + * @param start index to start filling the array at. If start is negative, it is treated as + * length+start where length is the length of the array. + * @param end index to stop filling the array at. If end is negative, it is treated as + * length+end. + */ + fill(value: T, start?: number, end?: number): T[]; + + /** + * Returns the this object after copying a section of the array identified by start and end + * to the same array starting at position target + * @param target If target is negative, it is treated as length+target where length is the + * length of the array. + * @param start If start is negative, it is treated as length+start. If end is negative, it + * is treated as length+end. + * @param end If not specified, length of the this object is used as its default value. + */ + copyWithin(target: number, start: number, end?: number): T[]; +} + +interface ArrayConstructor { + /** + * Creates an array from an array-like object. + * @param arrayLike An array-like object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: ArrayLike, mapfn: (v: T, k: number) => U, thisArg?: any): Array; + + + /** + * Creates an array from an array-like object. + * @param arrayLike An array-like object to convert to an array. + */ + from(arrayLike: ArrayLike): Array; + + /** + * Returns a new array from a set of elements. + * @param items A set of elements to include in the new array object. + */ + of(...items: T[]): Array; +} + +interface Function { + /** + * Returns the name of the function. Function names are read-only and can not be changed. + */ + readonly name: string; +} + +interface Math { + /** + * Returns the number of leading zero bits in the 32-bit binary representation of a number. + * @param x A numeric expression. + */ + clz32(x: number): number; + + /** + * Returns the result of 32-bit multiplication of two numbers. + * @param x First number + * @param y Second number + */ + imul(x: number, y: number): number; + + /** + * Returns the sign of the x, indicating whether x is positive, negative or zero. + * @param x The numeric expression to test + */ + sign(x: number): number; + + /** + * Returns the base 10 logarithm of a number. + * @param x A numeric expression. + */ + log10(x: number): number; + + /** + * Returns the base 2 logarithm of a number. + * @param x A numeric expression. + */ + log2(x: number): number; + + /** + * Returns the natural logarithm of 1 + x. + * @param x A numeric expression. + */ + log1p(x: number): number; + + /** + * Returns the result of (e^x - 1) of x (e raised to the power of x, where e is the base of + * the natural logarithms). + * @param x A numeric expression. + */ + expm1(x: number): number; + + /** + * Returns the hyperbolic cosine of a number. + * @param x A numeric expression that contains an angle measured in radians. + */ + cosh(x: number): number; + + /** + * Returns the hyperbolic sine of a number. + * @param x A numeric expression that contains an angle measured in radians. + */ + sinh(x: number): number; + + /** + * Returns the hyperbolic tangent of a number. + * @param x A numeric expression that contains an angle measured in radians. + */ + tanh(x: number): number; + + /** + * Returns the inverse hyperbolic cosine of a number. + * @param x A numeric expression that contains an angle measured in radians. + */ + acosh(x: number): number; + + /** + * Returns the inverse hyperbolic sine of a number. + * @param x A numeric expression that contains an angle measured in radians. + */ + asinh(x: number): number; + + /** + * Returns the inverse hyperbolic tangent of a number. + * @param x A numeric expression that contains an angle measured in radians. + */ + atanh(x: number): number; + + /** + * Returns the square root of the sum of squares of its arguments. + * @param values Values to compute the square root for. + * If no arguments are passed, the result is +0. + * If there is only one argument, the result is the absolute value. + * If any argument is +Infinity or -Infinity, the result is +Infinity. + * If any argument is NaN, the result is NaN. + * If all arguments are either +0 or −0, the result is +0. + */ + hypot(...values: number[] ): number; + + /** + * Returns the integral part of the a numeric expression, x, removing any fractional digits. + * If x is already an integer, the result is x. + * @param x A numeric expression. + */ + trunc(x: number): number; + + /** + * Returns the nearest single precision float representation of a number. + * @param x A numeric expression. + */ + fround(x: number): number; + + /** + * Returns an implementation-dependent approximation to the cube root of number. + * @param x A numeric expression. + */ + cbrt(x: number): number; +} + +interface NumberConstructor { + /** + * The value of Number.EPSILON is the difference between 1 and the smallest value greater than 1 + * that is representable as a Number value, which is approximately: + * 2.2204460492503130808472633361816 x 10‍−‍16. + */ + readonly EPSILON: number; + + /** + * Returns true if passed value is finite. + * Unlike the global isFininte, Number.isFinite doesn't forcibly convert the parameter to a + * number. Only finite values of the type number, result in true. + * @param number A numeric value. + */ + isFinite(number: number): boolean; + + /** + * Returns true if the value passed is an integer, false otherwise. + * @param number A numeric value. + */ + isInteger(number: number): boolean; + + /** + * Returns a Boolean value that indicates whether a value is the reserved value NaN (not a + * number). Unlike the global isNaN(), Number.isNaN() doesn't forcefully convert the parameter + * to a number. Only values of the type number, that are also NaN, result in true. + * @param number A numeric value. + */ + isNaN(number: number): boolean; + + /** + * Returns true if the value passed is a safe integer. + * @param number A numeric value. + */ + isSafeInteger(number: number): boolean; + + /** + * The value of the largest integer n such that n and n + 1 are both exactly representable as + * a Number value. + * The value of Number.MIN_SAFE_INTEGER is 9007199254740991 2^53 − 1. + */ + readonly MAX_SAFE_INTEGER: number; + + /** + * The value of the smallest integer n such that n and n − 1 are both exactly representable as + * a Number value. + * The value of Number.MIN_SAFE_INTEGER is −9007199254740991 (−(2^53 − 1)). + */ + readonly MIN_SAFE_INTEGER: number; + + /** + * Converts a string to a floating-point number. + * @param string A string that contains a floating-point number. + */ + parseFloat(string: string): number; + + /** + * Converts A string to an integer. + * @param s A string to convert into a number. + * @param radix A value between 2 and 36 that specifies the base of the number in numString. + * If this argument is not supplied, strings with a prefix of '0x' are considered hexadecimal. + * All other strings are considered decimal. + */ + parseInt(string: string, radix?: number): number; +} + +interface Object { + /** + * Determines whether an object has a property with the specified name. + * @param v A property name. + */ + hasOwnProperty(v: PropertyKey): boolean + + /** + * Determines whether a specified property is enumerable. + * @param v A property name. + */ + propertyIsEnumerable(v: PropertyKey): boolean; +} + +interface ObjectConstructor { + /** + * Copy the values of all of the enumerable own properties from one or more source objects to a + * target object. Returns the target object. + * @param target The target object to copy to. + * @param source The source object from which to copy properties. + */ + assign(target: T, source: U): T & U; + + /** + * Copy the values of all of the enumerable own properties from one or more source objects to a + * target object. Returns the target object. + * @param target The target object to copy to. + * @param source1 The first source object from which to copy properties. + * @param source2 The second source object from which to copy properties. + */ + assign(target: T, source1: U, source2: V): T & U & V; + + /** + * Copy the values of all of the enumerable own properties from one or more source objects to a + * target object. Returns the target object. + * @param target The target object to copy to. + * @param source1 The first source object from which to copy properties. + * @param source2 The second source object from which to copy properties. + * @param source3 The third source object from which to copy properties. + */ + assign(target: T, source1: U, source2: V, source3: W): T & U & V & W; + + /** + * Copy the values of all of the enumerable own properties from one or more source objects to a + * target object. Returns the target object. + * @param target The target object to copy to. + * @param sources One or more source objects from which to copy properties + */ + assign(target: any, ...sources: any[]): any; + + /** + * Returns an array of all symbol properties found directly on object o. + * @param o Object to retrieve the symbols from. + */ + getOwnPropertySymbols(o: any): symbol[]; + + /** + * Returns true if the values are the same value, false otherwise. + * @param value1 The first value. + * @param value2 The second value. + */ + is(value1: any, value2: any): boolean; + + /** + * Sets the prototype of a specified object o to object proto or null. Returns the object o. + * @param o The object to change its prototype. + * @param proto The value of the new prototype or null. + */ + setPrototypeOf(o: any, proto: any): any; + + /** + * Gets the own property descriptor of the specified object. + * An own property descriptor is one that is defined directly on the object and is not + * inherited from the object's prototype. + * @param o Object that contains the property. + * @param p Name of the property. + */ + getOwnPropertyDescriptor(o: any, propertyKey: PropertyKey): PropertyDescriptor; + + /** + * Adds a property to an object, or modifies attributes of an existing property. + * @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. + * @param p The property name. + * @param attributes Descriptor for the property. It can be for a data property or an accessor + * property. + */ + defineProperty(o: any, propertyKey: PropertyKey, attributes: PropertyDescriptor): any; +} + +interface RegExp { + /** + * Returns a string indicating the flags of the regular expression in question. This field is read-only. + * The characters in this string are sequenced and concatenated in the following order: + * + * - "g" for global + * - "i" for ignoreCase + * - "m" for multiline + * - "u" for unicode + * - "y" for sticky + * + * If no flags are set, the value is the empty string. + */ + readonly flags: string; + + /** + * Returns a Boolean value indicating the state of the sticky flag (y) used with a regular + * expression. Default is false. Read-only. + */ + readonly sticky: boolean; + + /** + * Returns a Boolean value indicating the state of the Unicode flag (u) used with a regular + * expression. Default is false. Read-only. + */ + readonly unicode: boolean; +} + +interface String { + /** + * Returns a nonnegative integer Number less than 1114112 (0x110000) that is the code point + * value of the UTF-16 encoded code point starting at the string element at position pos in + * the String resulting from converting this object to a String. + * If there is no element at that position, the result is undefined. + * If a valid UTF-16 surrogate pair does not begin at pos, the result is the code unit at pos. + */ + codePointAt(pos: number): number | undefined; + + /** + * Returns true if searchString appears as a substring of the result of converting this + * object to a String, at one or more positions that are + * greater than or equal to position; otherwise, returns false. + * @param searchString search string + * @param position If position is undefined, 0 is assumed, so as to search all of the String. + */ + includes(searchString: string, position?: number): boolean; + + /** + * Returns true if the sequence of elements of searchString converted to a String is the + * same as the corresponding elements of this object (converted to a String) starting at + * endPosition – length(this). Otherwise returns false. + */ + endsWith(searchString: string, endPosition?: number): boolean; + + /** + * Returns the String value result of normalizing the string into the normalization form + * named by form as specified in Unicode Standard Annex #15, Unicode Normalization Forms. + * @param form Applicable values: "NFC", "NFD", "NFKC", or "NFKD", If not specified default + * is "NFC" + */ + normalize(form?: string): string; + + /** + * Returns a String value that is made from count copies appended together. If count is 0, + * T is the empty String is returned. + * @param count number of copies to append + */ + repeat(count: number): string; + + /** + * Returns true if the sequence of elements of searchString converted to a String is the + * same as the corresponding elements of this object (converted to a String) starting at + * position. Otherwise returns false. + */ + startsWith(searchString: string, position?: number): boolean; + + /** + * Returns an HTML anchor element and sets the name attribute to the text value + * @param name + */ + anchor(name: string): string; + + /** Returns a HTML element */ + big(): string; + + /** Returns a HTML element */ + blink(): string; + + /** Returns a HTML element */ + bold(): string; + + /** Returns a HTML element */ + fixed(): string + + /** Returns a HTML element and sets the color attribute value */ + fontcolor(color: string): string + + /** Returns a HTML element and sets the size attribute value */ + fontsize(size: number): string; + + /** Returns a HTML element and sets the size attribute value */ + fontsize(size: string): string; + + /** Returns an HTML element */ + italics(): string; + + /** Returns an HTML element and sets the href attribute value */ + link(url: string): string; + + /** Returns a HTML element */ + small(): string; + + /** Returns a HTML element */ + strike(): string; + + /** Returns a HTML element */ + sub(): string; + + /** Returns a HTML element */ + sup(): string; +} + +interface StringConstructor { + /** + * Return the String value whose elements are, in order, the elements in the List elements. + * If length is 0, the empty string is returned. + */ + fromCodePoint(...codePoints: number[]): string; + + /** + * String.raw is intended for use as a tag function of a Tagged Template String. When called + * as such the first argument will be a well formed template call site object and the rest + * parameter will contain the substitution values. + * @param template A well-formed template string call site representation. + * @param substitutions A set of substitution values. + */ + raw(template: TemplateStringsArray, ...substitutions: any[]): string; +} \ No newline at end of file diff --git a/lib/lib.es2015.d.ts b/lib/lib.es2015.d.ts new file mode 100644 index 00000000000..973d5180989 --- /dev/null +++ b/lib/lib.es2015.d.ts @@ -0,0 +1,26 @@ +/*! ***************************************************************************** +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. +***************************************************************************** */ + +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// \ No newline at end of file diff --git a/lib/lib.es2015.generator.d.ts b/lib/lib.es2015.generator.d.ts new file mode 100644 index 00000000000..003f325e4e0 --- /dev/null +++ b/lib/lib.es2015.generator.d.ts @@ -0,0 +1,28 @@ +/*! ***************************************************************************** +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. +***************************************************************************** */ + +/// +interface GeneratorFunction extends Function { } + +interface GeneratorFunctionConstructor { + /** + * Creates a new Generator function. + * @param args A list of arguments the function accepts. + */ + new (...args: string[]): GeneratorFunction; + (...args: string[]): GeneratorFunction; + readonly prototype: GeneratorFunction; +} +declare var GeneratorFunction: GeneratorFunctionConstructor; diff --git a/lib/lib.es2015.iterable.d.ts b/lib/lib.es2015.iterable.d.ts new file mode 100644 index 00000000000..ef8b99309af --- /dev/null +++ b/lib/lib.es2015.iterable.d.ts @@ -0,0 +1,389 @@ +/*! ***************************************************************************** +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. +***************************************************************************** */ + +/// +/// + +interface IteratorResult { + done: boolean; + value?: T; +} + +interface Iterator { + next(value?: any): IteratorResult; + return?(value?: any): IteratorResult; + throw?(e?: any): IteratorResult; +} + +interface Iterable { } + +interface IterableIterator extends Iterator { } + +interface Array { + /** + * Returns an array of key, value pairs for every entry in the array + */ + entries(): IterableIterator<[number, T]>; + + /** + * Returns an list of keys in the array + */ + keys(): IterableIterator; + + /** + * Returns an list of values in the array + */ + values(): IterableIterator; +} + +interface ArrayConstructor { + /** + * Creates an array from an iterable object. + * @param iterable An iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(iterable: Iterable, mapfn: (v: T, k: number) => U, thisArg?: any): Array; + + /** + * Creates an array from an iterable object. + * @param iterable An iterable object to convert to an array. + */ + from(iterable: Iterable): Array; +} + +interface Map { + entries(): IterableIterator<[K, V]>; + keys(): IterableIterator; + values(): IterableIterator; +} + +interface MapConstructor { + new (iterable: Iterable<[K, V]>): Map; +} + +interface WeakMap { } + +interface WeakMapConstructor { + new (iterable: Iterable<[K, V]>): WeakMap; +} + +interface Promise { } + +interface PromiseConstructor { + /** + * Creates a Promise that is resolved with an array of results when all of the provided Promises + * resolve, or rejected when any Promise is rejected. + * @param values An array of Promises. + * @returns A new Promise. + */ + all(values: Iterable>): Promise; + + /** + * Creates a Promise that is resolved or rejected when any of the provided Promises are resolved + * or rejected. + * @param values An array of Promises. + * @returns A new Promise. + */ + race(values: Iterable>): Promise; +} + +declare namespace Reflect { + function enumerate(target: any): IterableIterator; +} + +/** + * A typed array of 8-bit integer values. The contents are initialized to 0. If the requested + * number of bytes could not be allocated an exception is raised. + */ +interface Int8Array { + /** + * Returns an array of key, value pairs for every entry in the array + */ + entries(): IterableIterator<[number, number]>; + /** + * Returns an list of keys in the array + */ + keys(): IterableIterator; + /** + * Returns an list of values in the array + */ + values(): IterableIterator; +} + +interface Int8ArrayConstructor { + new (elements: Iterable): Int8Array; + + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Int8Array; +} + +/** + * A typed array of 8-bit unsigned integer values. The contents are initialized to 0. If the + * requested number of bytes could not be allocated an exception is raised. + */ +interface Uint8Array { + /** + * Returns an array of key, value pairs for every entry in the array + */ + entries(): IterableIterator<[number, number]>; + /** + * Returns an list of keys in the array + */ + keys(): IterableIterator; + /** + * Returns an list of values in the array + */ + values(): IterableIterator; +} + +interface Uint8ArrayConstructor { + new (elements: Iterable): Uint8Array; + + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint8Array; +} + +/** + * A typed array of 8-bit unsigned integer (clamped) values. The contents are initialized to 0. + * If the requested number of bytes could not be allocated an exception is raised. + */ +interface Uint8ClampedArray { + /** + * Returns an array of key, value pairs for every entry in the array + */ + entries(): IterableIterator<[number, number]>; + + /** + * Returns an list of keys in the array + */ + keys(): IterableIterator; + + /** + * Returns an list of values in the array + */ + values(): IterableIterator; +} + +interface Uint8ClampedArrayConstructor { + new (elements: Iterable): Uint8ClampedArray; + + + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint8ClampedArray; +} + +/** + * A typed array of 16-bit signed integer values. The contents are initialized to 0. If the + * requested number of bytes could not be allocated an exception is raised. + */ +interface Int16Array { + /** + * Returns an array of key, value pairs for every entry in the array + */ + entries(): IterableIterator<[number, number]>; + + /** + * Returns an list of keys in the array + */ + keys(): IterableIterator; + + /** + * Returns an list of values in the array + */ + values(): IterableIterator; +} + +interface Int16ArrayConstructor { + new (elements: Iterable): Int16Array; + + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Int16Array; +} + +/** + * A typed array of 16-bit unsigned integer values. The contents are initialized to 0. If the + * requested number of bytes could not be allocated an exception is raised. + */ +interface Uint16Array { + /** + * Returns an array of key, value pairs for every entry in the array + */ + entries(): IterableIterator<[number, number]>; + /** + * Returns an list of keys in the array + */ + keys(): IterableIterator; + /** + * Returns an list of values in the array + */ + values(): IterableIterator; +} + +interface Uint16ArrayConstructor { + new (elements: Iterable): Uint16Array; + + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint16Array; +} + +/** + * A typed array of 32-bit signed integer values. The contents are initialized to 0. If the + * requested number of bytes could not be allocated an exception is raised. + */ +interface Int32Array { + /** + * Returns an array of key, value pairs for every entry in the array + */ + entries(): IterableIterator<[number, number]>; + /** + * Returns an list of keys in the array + */ + keys(): IterableIterator; + /** + * Returns an list of values in the array + */ + values(): IterableIterator; +} + +interface Int32ArrayConstructor { + new (elements: Iterable): Int32Array; + + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Int32Array; +} + +/** + * A typed array of 32-bit unsigned integer values. The contents are initialized to 0. If the + * requested number of bytes could not be allocated an exception is raised. + */ +interface Uint32Array { + /** + * Returns an array of key, value pairs for every entry in the array + */ + entries(): IterableIterator<[number, number]>; + /** + * Returns an list of keys in the array + */ + keys(): IterableIterator; + /** + * Returns an list of values in the array + */ + values(): IterableIterator; +} + +interface Uint32ArrayConstructor { + new (elements: Iterable): Uint32Array; + + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint32Array; +} + +/** + * A typed array of 32-bit float values. The contents are initialized to 0. If the requested number + * of bytes could not be allocated an exception is raised. + */ +interface Float32Array { + /** + * Returns an array of key, value pairs for every entry in the array + */ + entries(): IterableIterator<[number, number]>; + /** + * Returns an list of keys in the array + */ + keys(): IterableIterator; + /** + * Returns an list of values in the array + */ + values(): IterableIterator; +} + +interface Float32ArrayConstructor { + new (elements: Iterable): Float32Array; + + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Float32Array; +} + +/** + * A typed array of 64-bit float values. The contents are initialized to 0. If the requested + * number of bytes could not be allocated an exception is raised. + */ +interface Float64Array { + /** + * Returns an array of key, value pairs for every entry in the array + */ + entries(): IterableIterator<[number, number]>; + /** + * Returns an list of keys in the array + */ + keys(): IterableIterator; + /** + * Returns an list of values in the array + */ + values(): IterableIterator; +} + +interface Float64ArrayConstructor { + new (elements: Iterable): Float64Array; + + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Float64Array; +} \ No newline at end of file diff --git a/lib/lib.es2015.promise.d.ts b/lib/lib.es2015.promise.d.ts new file mode 100644 index 00000000000..4817121154f --- /dev/null +++ b/lib/lib.es2015.promise.d.ts @@ -0,0 +1,97 @@ +/*! ***************************************************************************** +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. +***************************************************************************** */ + +/// +/** + * Represents the completion of an asynchronous operation + */ +interface Promise { + /** + * Attaches callbacks for the resolution and/or rejection of the Promise. + * @param onfulfilled The callback to execute when the Promise is resolved. + * @param onrejected The callback to execute when the Promise is rejected. + * @returns A Promise for the completion of which ever callback is executed. + */ + then(onfulfilled?: (value: T) => TResult | PromiseLike, onrejected?: (reason: any) => TResult | PromiseLike): Promise; + then(onfulfilled?: (value: T) => TResult | PromiseLike, onrejected?: (reason: any) => void): Promise; + + /** + * Attaches a callback for only the rejection of the Promise. + * @param onrejected The callback to execute when the Promise is rejected. + * @returns A Promise for the completion of the callback. + */ + catch(onrejected?: (reason: any) => T | PromiseLike): Promise; + catch(onrejected?: (reason: any) => void): Promise; +} + +interface PromiseConstructor { + /** + * A reference to the prototype. + */ + readonly prototype: Promise; + + /** + * Creates a new Promise. + * @param executor A callback used to initialize the promise. This callback is passed two arguments: + * a resolve callback used resolve the promise with a value or the result of another promise, + * and a reject callback used to reject the promise with a provided reason or error. + */ + new (executor: (resolve: (value?: T | PromiseLike) => void, reject: (reason?: any) => void) => void): Promise; + + /** + * Creates a Promise that is resolved with an array of results when all of the provided Promises + * resolve, or rejected when any Promise is rejected. + * @param values An array of Promises. + * @returns A new Promise. + */ + 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]>; + 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]>; + 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]>; + all(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike , T5 | PromiseLike, T6 | PromiseLike, T7 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6, T7]>; + all(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike , T5 | PromiseLike, T6 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6]>; + all(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike , T5 | PromiseLike]): Promise<[T1, T2, T3, T4, T5]>; + all(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike ]): Promise<[T1, T2, T3, T4]>; + all(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike]): Promise<[T1, T2, T3]>; + all(values: [T1 | PromiseLike, T2 | PromiseLike]): Promise<[T1, T2]>; + + /** + * Creates a new rejected promise for the provided reason. + * @param reason The reason the promise was rejected. + * @returns A new rejected Promise. + */ + reject(reason: any): Promise; + + /** + * Creates a new rejected promise for the provided reason. + * @param reason The reason the promise was rejected. + * @returns A new rejected Promise. + */ + reject(reason: any): Promise; + + /** + * Creates a new resolved promise for the provided value. + * @param value A promise. + * @returns A promise whose internal state matches the provided promise. + */ + resolve(value: T | PromiseLike): Promise; + + /** + * Creates a new resolved promise . + * @returns A resolved promise. + */ + resolve(): Promise; +} + +declare var Promise: PromiseConstructor; \ No newline at end of file diff --git a/lib/lib.es2015.proxy.d.ts b/lib/lib.es2015.proxy.d.ts new file mode 100644 index 00000000000..3908e97c17c --- /dev/null +++ b/lib/lib.es2015.proxy.d.ts @@ -0,0 +1,38 @@ +/*! ***************************************************************************** +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. +***************************************************************************** */ + +/// +interface ProxyHandler { + getPrototypeOf? (target: T): any; + setPrototypeOf? (target: T, v: any): boolean; + isExtensible? (target: T): boolean; + preventExtensions? (target: T): boolean; + getOwnPropertyDescriptor? (target: T, p: PropertyKey): PropertyDescriptor; + has? (target: T, p: PropertyKey): boolean; + get? (target: T, p: PropertyKey, receiver: any): any; + set? (target: T, p: PropertyKey, value: any, receiver: any): boolean; + deleteProperty? (target: T, p: PropertyKey): boolean; + defineProperty? (target: T, p: PropertyKey, attributes: PropertyDescriptor): boolean; + enumerate? (target: T): PropertyKey[]; + ownKeys? (target: T): PropertyKey[]; + apply? (target: T, thisArg: any, argArray?: any): any; + construct? (target: T, thisArg: any, argArray?: any): any; +} + +interface ProxyConstructor { + revocable(target: T, handler: ProxyHandler): { proxy: T; revoke: () => void; }; + new (target: T, handler: ProxyHandler): T +} +declare var Proxy: ProxyConstructor; \ No newline at end of file diff --git a/lib/lib.es2015.reflect.d.ts b/lib/lib.es2015.reflect.d.ts new file mode 100644 index 00000000000..c53cdaf88ac --- /dev/null +++ b/lib/lib.es2015.reflect.d.ts @@ -0,0 +1,32 @@ +/*! ***************************************************************************** +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 Reflect { + function apply(target: Function, thisArgument: any, argumentsList: ArrayLike): any; + function construct(target: Function, argumentsList: ArrayLike, newTarget?: any): any; + function defineProperty(target: any, propertyKey: PropertyKey, attributes: PropertyDescriptor): boolean; + function deleteProperty(target: any, propertyKey: PropertyKey): boolean; + function get(target: any, propertyKey: PropertyKey, receiver?: any): any; + function getOwnPropertyDescriptor(target: any, propertyKey: PropertyKey): PropertyDescriptor; + function getPrototypeOf(target: any): any; + function has(target: any, propertyKey: string): boolean; + function has(target: any, propertyKey: symbol): boolean; + function isExtensible(target: any): boolean; + function ownKeys(target: any): Array; + function preventExtensions(target: any): boolean; + function set(target: any, propertyKey: PropertyKey, value: any, receiver?: any): boolean; + function setPrototypeOf(target: any, proto: any): boolean; +} \ No newline at end of file diff --git a/lib/lib.es2015.symbol.d.ts b/lib/lib.es2015.symbol.d.ts new file mode 100644 index 00000000000..4ab7b4374f1 --- /dev/null +++ b/lib/lib.es2015.symbol.d.ts @@ -0,0 +1,52 @@ +/*! ***************************************************************************** +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. +***************************************************************************** */ + +/// +interface Symbol { + /** Returns a string representation of an object. */ + toString(): string; + + /** Returns the primitive value of the specified object. */ + valueOf(): Object; +} + +interface SymbolConstructor { + /** + * A reference to the prototype. + */ + readonly prototype: Symbol; + + /** + * Returns a new unique Symbol value. + * @param description Description of the new Symbol object. + */ + (description?: string|number): symbol; + + /** + * Returns a Symbol object from the global symbol registry matching the given key if found. + * Otherwise, returns a new symbol with this key. + * @param key key to search for. + */ + for(key: string): symbol; + + /** + * Returns a key from the global symbol registry matching the given Symbol if found. + * Otherwise, returns a undefined. + * @param sym Symbol to find the key for. + */ + keyFor(sym: symbol): string | undefined; +} + +declare var Symbol: SymbolConstructor; \ No newline at end of file diff --git a/lib/lib.es2015.symbol.wellknown.d.ts b/lib/lib.es2015.symbol.wellknown.d.ts new file mode 100644 index 00000000000..f266301dc23 --- /dev/null +++ b/lib/lib.es2015.symbol.wellknown.d.ts @@ -0,0 +1,372 @@ +/*! ***************************************************************************** +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. +***************************************************************************** */ + +/// +/// + +interface SymbolConstructor { + /** + * A method that determines if a constructor object recognizes an object as one of the + * constructor’s instances. Called by the semantics of the instanceof operator. + */ + readonly hasInstance: symbol; + + /** + * A Boolean value that if true indicates that an object should flatten to its array elements + * by Array.prototype.concat. + */ + readonly isConcatSpreadable: symbol; + + /** + * A method that returns the default iterator for an object. Called by the semantics of the + * for-of statement. + */ + readonly iterator: symbol; + + /** + * A regular expression method that matches the regular expression against a string. Called + * by the String.prototype.match method. + */ + readonly match: symbol; + + /** + * A regular expression method that replaces matched substrings of a string. Called by the + * String.prototype.replace method. + */ + readonly replace: symbol; + + /** + * A regular expression method that returns the index within a string that matches the + * regular expression. Called by the String.prototype.search method. + */ + readonly search: symbol; + + /** + * A function valued property that is the constructor function that is used to create + * derived objects. + */ + readonly species: symbol; + + /** + * A regular expression method that splits a string at the indices that match the regular + * expression. Called by the String.prototype.split method. + */ + readonly split: symbol; + + /** + * A method that converts an object to a corresponding primitive value. + * Called by the ToPrimitive abstract operation. + */ + readonly toPrimitive: symbol; + + /** + * A String value that is used in the creation of the default string description of an object. + * Called by the built-in method Object.prototype.toString. + */ + readonly toStringTag: symbol; + + /** + * An Object whose own property names are property names that are excluded from the 'with' + * environment bindings of the associated objects. + */ + readonly unscopables: symbol; +} + +interface Symbol { + readonly [Symbol.toStringTag]: "Symbol"; +} + +interface Array { + /** Iterator */ + [Symbol.iterator](): IterableIterator; + + /** + * Returns an object whose properties have the value 'true' + * when they will be absent when used in a 'with' statement. + */ + [Symbol.unscopables](): { + copyWithin: boolean; + entries: boolean; + fill: boolean; + find: boolean; + findIndex: boolean; + keys: boolean; + values: boolean; + }; +} + +interface Date { + /** + * Converts a Date object to a string. + */ + [Symbol.toPrimitive](hint: "default"): string; + /** + * Converts a Date object to a string. + */ + [Symbol.toPrimitive](hint: "string"): string; + /** + * Converts a Date object to a number. + */ + [Symbol.toPrimitive](hint: "number"): number; + /** + * Converts a Date object to a string or number. + * + * @param hint The strings "number", "string", or "default" to specify what primitive to return. + * + * @throws {TypeError} If 'hint' was given something other than "number", "string", or "default". + * @returns A number if 'hint' was "number", a string if 'hint' was "string" or "default". + */ + [Symbol.toPrimitive](hint: string): string | number; +} + +interface Map { + [Symbol.iterator]():IterableIterator<[K,V]>; + readonly [Symbol.toStringTag]: "Map"; +} + +interface WeakMap{ + readonly [Symbol.toStringTag]: "WeakMap"; +} + +interface JSON { + readonly [Symbol.toStringTag]: "JSON"; +} + +interface Function { + /** + * Determines whether the given value inherits from this function if this function was used + * as a constructor function. + * + * A constructor function can control which objects are recognized as its instances by + * 'instanceof' by overriding this method. + */ + [Symbol.hasInstance](value: any): boolean; +} + +interface GeneratorFunction extends Function { + readonly [Symbol.toStringTag]: "GeneratorFunction"; +} + +interface IArguments { + /** Iterator */ + [Symbol.iterator](): IterableIterator; +} + +interface Iterator { } + +interface Iterable { + [Symbol.iterator](): Iterator; +} + +interface IterableIterator extends Iterator { + [Symbol.iterator](): IterableIterator; +} + +interface Math { + readonly [Symbol.toStringTag]: "Math"; +} + +interface Promise { + readonly [Symbol.toStringTag]: "Promise"; +} + +interface PromiseConstructor { + readonly [Symbol.species]: Function; +} + +interface RegExp { + /** + * Matches a string with this regular expression, and returns an array containing the results of + * that search. + * @param string A string to search within. + */ + [Symbol.match](string: string): RegExpMatchArray | null; + + /** + * Replaces text in a string, using this regular expression. + * @param string A String object or string literal whose contents matching against + * this regular expression will be replaced + * @param replaceValue A String object or string literal containing the text to replace for every + * successful match of this regular expression. + */ + [Symbol.replace](string: string, replaceValue: string): string; + + /** + * Replaces text in a string, using this regular expression. + * @param string A String object or string literal whose contents matching against + * this regular expression will be replaced + * @param replacer A function that returns the replacement text. + */ + [Symbol.replace](string: string, replacer: (substring: string, ...args: any[]) => string): string; + + /** + * Finds the position beginning first substring match in a regular expression search + * using this regular expression. + * + * @param string The string to search within. + */ + [Symbol.search](string: string): number; + + /** + * Returns an array of substrings that were delimited by strings in the original input that + * match against this regular expression. + * + * If the regular expression contains capturing parentheses, then each time this + * regular expression matches, the results (including any undefined results) of the + * capturing parentheses are spliced. + * + * @param string string value to split + * @param limit if not undefined, the output array is truncated so that it contains no more + * than 'limit' elements. + */ + [Symbol.split](string: string, limit?: number): string[]; +} + +interface RegExpConstructor { + [Symbol.species](): RegExpConstructor; +} + +interface String { + /** Iterator */ + [Symbol.iterator](): IterableIterator; + + /** + * Matches a string an object that supports being matched against, and returns an array containing the results of that search. + * @param matcher An object that supports being matched against. + */ + match(matcher: { [Symbol.match](string: string): RegExpMatchArray | null; }): RegExpMatchArray | null; + + /** + * Replaces text in a string, using an object that supports replacement within a string. + * @param searchValue A object can search for and replace matches within a string. + * @param replaceValue A string containing the text to replace for every successful match of searchValue in this string. + */ + replace(searchValue: { [Symbol.replace](string: string, replaceValue: string): string; }, replaceValue: string): string; + + /** + * Replaces text in a string, using an object that supports replacement within a string. + * @param searchValue A object can search for and replace matches within a string. + * @param replacer A function that returns the replacement text. + */ + replace(searchValue: { [Symbol.replace](string: string, replacer: (substring: string, ...args: any[]) => string): string; }, replacer: (substring: string, ...args: any[]) => string): string; + + /** + * Finds the first substring match in a regular expression search. + * @param searcher An object which supports searching within a string. + */ + search(searcher: { [Symbol.search](string: string): number; }): number; + + /** + * Split a string into substrings using the specified separator and return them as an array. + * @param splitter An object that can split a string. + * @param limit A value used to limit the number of elements returned in the array. + */ + split(splitter: { [Symbol.split](string: string, limit?: number): string[]; }, limit?: number): string[]; +} + +/** + * Represents a raw buffer of binary data, which is used to store data for the + * different typed arrays. ArrayBuffers cannot be read from or written to directly, + * but can be passed to a typed array or DataView Object to interpret the raw + * buffer as needed. + */ +interface ArrayBuffer { + readonly [Symbol.toStringTag]: "ArrayBuffer"; +} + +interface DataView { + readonly [Symbol.toStringTag]: "DataView"; +} + +/** + * A typed array of 8-bit integer values. The contents are initialized to 0. If the requested + * number of bytes could not be allocated an exception is raised. + */ +interface Int8Array { + [Symbol.iterator](): IterableIterator; + readonly [Symbol.toStringTag]: "Int8Array"; +} + +/** + * A typed array of 8-bit unsigned integer values. The contents are initialized to 0. If the + * requested number of bytes could not be allocated an exception is raised. + */ +interface Uint8Array { + [Symbol.iterator](): IterableIterator; + readonly [Symbol.toStringTag]: "UInt8Array"; +} + +/** + * A typed array of 8-bit unsigned integer (clamped) values. The contents are initialized to 0. + * If the requested number of bytes could not be allocated an exception is raised. + */ +interface Uint8ClampedArray { + [Symbol.iterator](): IterableIterator; + readonly [Symbol.toStringTag]: "Uint8ClampedArray"; +} + +/** + * A typed array of 16-bit signed integer values. The contents are initialized to 0. If the + * requested number of bytes could not be allocated an exception is raised. + */ +interface Int16Array { + [Symbol.iterator](): IterableIterator; + readonly [Symbol.toStringTag]: "Int16Array"; +} + +/** + * A typed array of 16-bit unsigned integer values. The contents are initialized to 0. If the + * requested number of bytes could not be allocated an exception is raised. + */ +interface Uint16Array { + [Symbol.iterator](): IterableIterator; + readonly [Symbol.toStringTag]: "Uint16Array"; +} + +/** + * A typed array of 32-bit signed integer values. The contents are initialized to 0. If the + * requested number of bytes could not be allocated an exception is raised. + */ +interface Int32Array { + [Symbol.iterator](): IterableIterator; + readonly [Symbol.toStringTag]: "Int32Array"; +} + +/** + * A typed array of 32-bit unsigned integer values. The contents are initialized to 0. If the + * requested number of bytes could not be allocated an exception is raised. + */ +interface Uint32Array { + [Symbol.iterator](): IterableIterator; + readonly [Symbol.toStringTag]: "Uint32Array"; +} + +/** + * A typed array of 32-bit float values. The contents are initialized to 0. If the requested number + * of bytes could not be allocated an exception is raised. + */ +interface Float32Array { + [Symbol.iterator](): IterableIterator; + readonly [Symbol.toStringTag]: "Float32Array"; +} + +/** + * A typed array of 64-bit float values. The contents are initialized to 0. If the requested + * number of bytes could not be allocated an exception is raised. + */ +interface Float64Array { + [Symbol.iterator](): IterableIterator; + readonly [Symbol.toStringTag]: "Float64Array"; +} \ No newline at end of file diff --git a/lib/lib.es2016.array.include.d.ts b/lib/lib.es2016.array.include.d.ts new file mode 100644 index 00000000000..a4677e7cf1e --- /dev/null +++ b/lib/lib.es2016.array.include.d.ts @@ -0,0 +1,105 @@ +/*! ***************************************************************************** +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. +***************************************************************************** */ + +/// +interface Array { + /** + * Determines whether an array includes a certain element, returning true or false as appropriate. + * @param searchElement The element to search for. + * @param fromIndex The position in this array at which to begin searching for searchElement. + */ + includes(searchElement: T, fromIndex?: number): boolean; +} + +interface Int8Array { + /** + * Determines whether an array includes a certain element, returning true or false as appropriate. + * @param searchElement The element to search for. + * @param fromIndex The position in this array at which to begin searching for searchElement. + */ + includes(searchElement: number, fromIndex?: number): boolean; +} + +interface Uint8Array { + /** + * Determines whether an array includes a certain element, returning true or false as appropriate. + * @param searchElement The element to search for. + * @param fromIndex The position in this array at which to begin searching for searchElement. + */ + includes(searchElement: number, fromIndex?: number): boolean; +} + +interface Uint8ClampedArray { + /** + * Determines whether an array includes a certain element, returning true or false as appropriate. + * @param searchElement The element to search for. + * @param fromIndex The position in this array at which to begin searching for searchElement. + */ + includes(searchElement: number, fromIndex?: number): boolean; +} + +interface Int16Array { + /** + * Determines whether an array includes a certain element, returning true or false as appropriate. + * @param searchElement The element to search for. + * @param fromIndex The position in this array at which to begin searching for searchElement. + */ + includes(searchElement: number, fromIndex?: number): boolean; +} + +interface Uint16Array { + /** + * Determines whether an array includes a certain element, returning true or false as appropriate. + * @param searchElement The element to search for. + * @param fromIndex The position in this array at which to begin searching for searchElement. + */ + includes(searchElement: number, fromIndex?: number): boolean; +} + +interface Int32Array { + /** + * Determines whether an array includes a certain element, returning true or false as appropriate. + * @param searchElement The element to search for. + * @param fromIndex The position in this array at which to begin searching for searchElement. + */ + includes(searchElement: number, fromIndex?: number): boolean; +} + +interface Uint32Array { + /** + * Determines whether an array includes a certain element, returning true or false as appropriate. + * @param searchElement The element to search for. + * @param fromIndex The position in this array at which to begin searching for searchElement. + */ + includes(searchElement: number, fromIndex?: number): boolean; +} + +interface Float32Array { + /** + * Determines whether an array includes a certain element, returning true or false as appropriate. + * @param searchElement The element to search for. + * @param fromIndex The position in this array at which to begin searching for searchElement. + */ + includes(searchElement: number, fromIndex?: number): boolean; +} + +interface Float64Array { + /** + * Determines whether an array includes a certain element, returning true or false as appropriate. + * @param searchElement The element to search for. + * @param fromIndex The position in this array at which to begin searching for searchElement. + */ + includes(searchElement: number, fromIndex?: number): boolean; +} \ No newline at end of file diff --git a/lib/lib.es2016.d.ts b/lib/lib.es2016.d.ts new file mode 100644 index 00000000000..04a23379676 --- /dev/null +++ b/lib/lib.es2016.d.ts @@ -0,0 +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. +***************************************************************************** */ + +/// +/// +/// \ No newline at end of file diff --git a/lib/lib.core.d.ts b/lib/lib.es5.d.ts similarity index 92% rename from lib/lib.core.d.ts rename to lib/lib.es5.d.ts index c1843f5207e..8ea19d2b9ea 100644 --- a/lib/lib.core.d.ts +++ b/lib/lib.es5.d.ts @@ -231,14 +231,16 @@ interface Function { * @param thisArg The object to be used as the this object. * @param argArray A set of arguments to be passed to the function. */ - apply(thisArg: any, argArray?: any): any; + apply(this: (this: T, ...argArray: any[]) => U, thisArg: T, argArray?: any): U; + apply(this: Function, thisArg: any, argArray?: any): any; /** * Calls a method of an object, substituting another object for the current object. * @param thisArg The object to be used as the current object. * @param argArray A list of arguments to be passed to the method. */ - call(thisArg: any, ...argArray: any[]): any; + call(this: (this: T, ...argArray: any[]) => U, thisArg: T, ...argArray: any[]): U; + call(this: Function, thisArg: any, ...argArray: any[]): any; /** * For a given function, creates a bound function that has the same body as the original function. @@ -246,7 +248,8 @@ interface Function { * @param thisArg An object to which the this keyword can refer inside the new function. * @param argArray A list of arguments to be passed to the new function. */ - bind(thisArg: any, ...argArray: any[]): any; + bind(this: (this: T, ...argArray: any[]) => U, thisArg: T, ...argArray: any[]): (this: void, ...argArray: any[]) => U; + bind(this: Function, thisArg: any, ...argArray: any[]): any; prototype: any; readonly length: number; @@ -320,13 +323,13 @@ interface String { * Matches a string with a regular expression, and returns an array containing the results of that search. * @param regexp A variable name or string literal containing the regular expression pattern and flags. */ - match(regexp: string): RegExpMatchArray; + match(regexp: string): RegExpMatchArray | null; /** * Matches a string with a regular expression, and returns an array containing the results of that search. * @param regexp A regular expression object that contains the regular expression pattern and applicable flags. */ - match(regexp: RegExp): RegExpMatchArray; + match(regexp: RegExp): RegExpMatchArray | null; /** * Replaces text in a string, using a regular expression or search string. @@ -829,7 +832,7 @@ interface RegExp { * Executes a search on a string using a regular expression pattern, and returns an array containing the results of that search. * @param string The String object or string literal on which to perform the search. */ - exec(string: string): RegExpExecArray; + exec(string: string): RegExpExecArray | null; /** * Returns a Boolean value that indicates whether or not a pattern exists in a searched string. @@ -852,7 +855,7 @@ interface RegExp { lastIndex: number; // Non-standard extensions - compile(): RegExp; + compile(): this; } interface RegExpConstructor { @@ -1124,7 +1127,7 @@ interface Array { /** * Removes the last element from an array and returns it. */ - pop(): T; + pop(): T | undefined; /** * Combines two or more arrays. * @param items Additional items to add to the end of array1. @@ -1142,7 +1145,7 @@ interface Array { /** * Removes the first element from an array and returns it. */ - shift(): T; + shift(): T | undefined; /** * Returns a section of an array. * @param start The beginning of the specified portion of the array. @@ -1535,7 +1538,7 @@ interface Int8Array { * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. */ - find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; + find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number | undefined; /** * Returns the index of the first element in the array where predicate is true, and undefined @@ -1546,7 +1549,7 @@ interface Int8Array { * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. */ - findIndex(predicate: (value: number) => boolean, thisArg?: any): number; + findIndex(predicate: (value: number) => boolean, thisArg?: any): number | undefined; /** * Performs the specified action for each element in an array. @@ -1808,7 +1811,7 @@ interface Uint8Array { * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. */ - find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; + find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number | undefined; /** * Returns the index of the first element in the array where predicate is true, and undefined @@ -1819,7 +1822,7 @@ interface Uint8Array { * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. */ - findIndex(predicate: (value: number) => boolean, thisArg?: any): number; + findIndex(predicate: (value: number) => boolean, thisArg?: any): number | undefined; /** * Performs the specified action for each element in an array. @@ -2082,7 +2085,7 @@ interface Uint8ClampedArray { * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. */ - find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; + find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number | undefined; /** * Returns the index of the first element in the array where predicate is true, and undefined @@ -2093,7 +2096,7 @@ interface Uint8ClampedArray { * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. */ - findIndex(predicate: (value: number) => boolean, thisArg?: any): number; + findIndex(predicate: (value: number) => boolean, thisArg?: any): number | undefined; /** * Performs the specified action for each element in an array. @@ -2355,7 +2358,7 @@ interface Int16Array { * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. */ - find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; + find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number | undefined; /** * Returns the index of the first element in the array where predicate is true, and undefined @@ -2366,7 +2369,7 @@ interface Int16Array { * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. */ - findIndex(predicate: (value: number) => boolean, thisArg?: any): number; + findIndex(predicate: (value: number) => boolean, thisArg?: any): number | undefined; /** * Performs the specified action for each element in an array. @@ -2629,7 +2632,7 @@ interface Uint16Array { * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. */ - find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; + find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number | undefined; /** * Returns the index of the first element in the array where predicate is true, and undefined @@ -2640,7 +2643,7 @@ interface Uint16Array { * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. */ - findIndex(predicate: (value: number) => boolean, thisArg?: any): number; + findIndex(predicate: (value: number) => boolean, thisArg?: any): number | undefined; /** * Performs the specified action for each element in an array. @@ -2902,7 +2905,7 @@ interface Int32Array { * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. */ - find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; + find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number | undefined; /** * Returns the index of the first element in the array where predicate is true, and undefined @@ -2913,7 +2916,7 @@ interface Int32Array { * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. */ - findIndex(predicate: (value: number) => boolean, thisArg?: any): number; + findIndex(predicate: (value: number) => boolean, thisArg?: any): number | undefined; /** * Performs the specified action for each element in an array. @@ -3175,7 +3178,7 @@ interface Uint32Array { * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. */ - find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; + find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number | undefined; /** * Returns the index of the first element in the array where predicate is true, and undefined @@ -3186,7 +3189,7 @@ interface Uint32Array { * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. */ - findIndex(predicate: (value: number) => boolean, thisArg?: any): number; + findIndex(predicate: (value: number) => boolean, thisArg?: any): number | undefined; /** * Performs the specified action for each element in an array. @@ -3448,7 +3451,7 @@ interface Float32Array { * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. */ - find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; + find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number | undefined; /** * Returns the index of the first element in the array where predicate is true, and undefined @@ -3459,7 +3462,7 @@ interface Float32Array { * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. */ - findIndex(predicate: (value: number) => boolean, thisArg?: any): number; + findIndex(predicate: (value: number) => boolean, thisArg?: any): number | undefined; /** * Performs the specified action for each element in an array. @@ -3722,7 +3725,7 @@ interface Float64Array { * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. */ - find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; + find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number | undefined; /** * Returns the index of the first element in the array where predicate is true, and undefined @@ -3733,7 +3736,7 @@ interface Float64Array { * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. */ - findIndex(predicate: (value: number) => boolean, thisArg?: any): number; + findIndex(predicate: (value: number) => boolean, thisArg?: any): number | undefined; /** * Performs the specified action for each element in an array. @@ -3920,3 +3923,204 @@ interface Float64ArrayConstructor { from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Float64Array; } declare const Float64Array: Float64ArrayConstructor; + +///////////////////////////// +/// ECMAScript Internationalization API +///////////////////////////// + +declare module Intl { + interface CollatorOptions { + usage?: string; + localeMatcher?: string; + numeric?: boolean; + caseFirst?: string; + sensitivity?: string; + ignorePunctuation?: boolean; + } + + interface ResolvedCollatorOptions { + locale: string; + usage: string; + sensitivity: string; + ignorePunctuation: boolean; + collation: string; + caseFirst: string; + numeric: boolean; + } + + interface Collator { + compare(x: string, y: string): number; + resolvedOptions(): ResolvedCollatorOptions; + } + var Collator: { + new (locales?: string[], options?: CollatorOptions): Collator; + new (locale?: string, options?: CollatorOptions): Collator; + (locales?: string[], options?: CollatorOptions): Collator; + (locale?: string, options?: CollatorOptions): Collator; + supportedLocalesOf(locales: string[], options?: CollatorOptions): string[]; + supportedLocalesOf(locale: string, options?: CollatorOptions): string[]; + } + + interface NumberFormatOptions { + localeMatcher?: string; + style?: string; + currency?: string; + currencyDisplay?: string; + useGrouping?: boolean; + minimumIntegerDigits?: number; + minimumFractionDigits?: number; + maximumFractionDigits?: number; + minimumSignificantDigits?: number; + maximumSignificantDigits?: number; + } + + interface ResolvedNumberFormatOptions { + locale: string; + numberingSystem: string; + style: string; + currency?: string; + currencyDisplay?: string; + minimumIntegerDigits: number; + minimumFractionDigits: number; + maximumFractionDigits: number; + minimumSignificantDigits?: number; + maximumSignificantDigits?: number; + useGrouping: boolean; + } + + interface NumberFormat { + format(value: number): string; + resolvedOptions(): ResolvedNumberFormatOptions; + } + var NumberFormat: { + new (locales?: string[], options?: NumberFormatOptions): NumberFormat; + new (locale?: string, options?: NumberFormatOptions): NumberFormat; + (locales?: string[], options?: NumberFormatOptions): NumberFormat; + (locale?: string, options?: NumberFormatOptions): NumberFormat; + supportedLocalesOf(locales: string[], options?: NumberFormatOptions): string[]; + supportedLocalesOf(locale: string, options?: NumberFormatOptions): string[]; + } + + interface DateTimeFormatOptions { + localeMatcher?: string; + weekday?: string; + era?: string; + year?: string; + month?: string; + day?: string; + hour?: string; + minute?: string; + second?: string; + timeZoneName?: string; + formatMatcher?: string; + hour12?: boolean; + timeZone?: string; + } + + interface ResolvedDateTimeFormatOptions { + locale: string; + calendar: string; + numberingSystem: string; + timeZone: string; + hour12?: boolean; + weekday?: string; + era?: string; + year?: string; + month?: string; + day?: string; + hour?: string; + minute?: string; + second?: string; + timeZoneName?: string; + } + + interface DateTimeFormat { + format(date?: Date | number): string; + resolvedOptions(): ResolvedDateTimeFormatOptions; + } + var DateTimeFormat: { + new (locales?: string[], options?: DateTimeFormatOptions): DateTimeFormat; + new (locale?: string, options?: DateTimeFormatOptions): DateTimeFormat; + (locales?: string[], options?: DateTimeFormatOptions): DateTimeFormat; + (locale?: string, options?: DateTimeFormatOptions): DateTimeFormat; + supportedLocalesOf(locales: string[], options?: DateTimeFormatOptions): string[]; + supportedLocalesOf(locale: string, options?: DateTimeFormatOptions): string[]; + } +} + +interface String { + /** + * Determines whether two strings are equivalent in the current locale. + * @param that String to compare to target string + * @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. + * @param options An object that contains one or more properties that specify comparison options. see the Intl.Collator object for details. + */ + localeCompare(that: string, locales: string[], options?: Intl.CollatorOptions): number; + + /** + * Determines whether two strings are equivalent in the current locale. + * @param that String to compare to target string + * @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. + * @param options An object that contains one or more properties that specify comparison options. see the Intl.Collator object for details. + */ + localeCompare(that: string, locale: string, options?: Intl.CollatorOptions): number; +} + +interface Number { + /** + * Converts a number to a string by using the current or specified locale. + * @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. + * @param options An object that contains one or more properties that specify comparison options. + */ + toLocaleString(locales?: string[], options?: Intl.NumberFormatOptions): string; + + /** + * Converts a number to a string by using the current or specified locale. + * @param locale Locale tag. If you omit this parameter, the default locale of the JavaScript runtime is used. + * @param options An object that contains one or more properties that specify comparison options. + */ + toLocaleString(locale?: string, options?: Intl.NumberFormatOptions): string; +} + +interface Date { + /** + * Converts a date and time to a string by using the current or specified locale. + * @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. + * @param options An object that contains one or more properties that specify comparison options. + */ + toLocaleString(locales?: string[], options?: Intl.DateTimeFormatOptions): string; + /** + * Converts a date to a string by using the current or specified locale. + * @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. + * @param options An object that contains one or more properties that specify comparison options. + */ + toLocaleDateString(locales?: string[], options?: Intl.DateTimeFormatOptions): string; + + /** + * Converts a time to a string by using the current or specified locale. + * @param locale Locale tag. If you omit this parameter, the default locale of the JavaScript runtime is used. + * @param options An object that contains one or more properties that specify comparison options. + */ + toLocaleTimeString(locale?: string[], options?: Intl.DateTimeFormatOptions): string; + + /** + * Converts a date and time to a string by using the current or specified locale. + * @param locale Locale tag. If you omit this parameter, the default locale of the JavaScript runtime is used. + * @param options An object that contains one or more properties that specify comparison options. + */ + toLocaleString(locale?: string, options?: Intl.DateTimeFormatOptions): string; + + /** + * Converts a date to a string by using the current or specified locale. + * @param locale Locale tag. If you omit this parameter, the default locale of the JavaScript runtime is used. + * @param options An object that contains one or more properties that specify comparison options. + */ + toLocaleDateString(locale?: string, options?: Intl.DateTimeFormatOptions): string; + + /** + * Converts a time to a string by using the current or specified locale. + * @param locale Locale tag. If you omit this parameter, the default locale of the JavaScript runtime is used. + * @param options An object that contains one or more properties that specify comparison options. + */ + toLocaleTimeString(locale?: string, options?: Intl.DateTimeFormatOptions): string; +} diff --git a/lib/lib.es6.d.ts b/lib/lib.es6.d.ts index 7e973a82820..202d3d53d82 100644 --- a/lib/lib.es6.d.ts +++ b/lib/lib.es6.d.ts @@ -14,1339 +14,6 @@ and limitations under the License. ***************************************************************************** */ /// -declare type PropertyKey = string | number | symbol; - -interface Symbol { - /** Returns a string representation of an object. */ - toString(): string; - - /** Returns the primitive value of the specified object. */ - valueOf(): Object; - - readonly [Symbol.toStringTag]: "Symbol"; -} - -interface SymbolConstructor { - /** - * A reference to the prototype. - */ - readonly prototype: Symbol; - - /** - * Returns a new unique Symbol value. - * @param description Description of the new Symbol object. - */ - (description?: string|number): symbol; - - /** - * Returns a Symbol object from the global symbol registry matching the given key if found. - * Otherwise, returns a new symbol with this key. - * @param key key to search for. - */ - for(key: string): symbol; - - /** - * Returns a key from the global symbol registry matching the given Symbol if found. - * Otherwise, returns a undefined. - * @param sym Symbol to find the key for. - */ - keyFor(sym: symbol): string; - - // Well-known Symbols - - /** - * A method that determines if a constructor object recognizes an object as one of the - * constructor’s instances. Called by the semantics of the instanceof operator. - */ - readonly hasInstance: symbol; - - /** - * A Boolean value that if true indicates that an object should flatten to its array elements - * by Array.prototype.concat. - */ - readonly isConcatSpreadable: symbol; - - /** - * A method that returns the default iterator for an object. Called by the semantics of the - * for-of statement. - */ - readonly iterator: symbol; - - /** - * A regular expression method that matches the regular expression against a string. Called - * by the String.prototype.match method. - */ - readonly match: symbol; - - /** - * A regular expression method that replaces matched substrings of a string. Called by the - * String.prototype.replace method. - */ - readonly replace: symbol; - - /** - * A regular expression method that returns the index within a string that matches the - * regular expression. Called by the String.prototype.search method. - */ - readonly search: symbol; - - /** - * A function valued property that is the constructor function that is used to create - * derived objects. - */ - readonly species: symbol; - - /** - * A regular expression method that splits a string at the indices that match the regular - * expression. Called by the String.prototype.split method. - */ - readonly split: symbol; - - /** - * A method that converts an object to a corresponding primitive value. - * Called by the ToPrimitive abstract operation. - */ - readonly toPrimitive: symbol; - - /** - * A String value that is used in the creation of the default string description of an object. - * Called by the built-in method Object.prototype.toString. - */ - readonly toStringTag: symbol; - - /** - * An Object whose own property names are property names that are excluded from the 'with' - * environment bindings of the associated objects. - */ - readonly unscopables: symbol; -} -declare var Symbol: SymbolConstructor; - -interface Object { - /** - * Determines whether an object has a property with the specified name. - * @param v A property name. - */ - hasOwnProperty(v: PropertyKey): boolean; - - /** - * Determines whether a specified property is enumerable. - * @param v A property name. - */ - propertyIsEnumerable(v: PropertyKey): boolean; -} - -interface ObjectConstructor { - /** - * Copy the values of all of the enumerable own properties from one or more source objects to a - * target object. Returns the target object. - * @param target The target object to copy to. - * @param source The source object from which to copy properties. - */ - assign(target: T, source: U): T & U; - - /** - * Copy the values of all of the enumerable own properties from one or more source objects to a - * target object. Returns the target object. - * @param target The target object to copy to. - * @param source1 The first source object from which to copy properties. - * @param source2 The second source object from which to copy properties. - */ - assign(target: T, source1: U, source2: V): T & U & V; - - /** - * Copy the values of all of the enumerable own properties from one or more source objects to a - * target object. Returns the target object. - * @param target The target object to copy to. - * @param source1 The first source object from which to copy properties. - * @param source2 The second source object from which to copy properties. - * @param source3 The third source object from which to copy properties. - */ - assign(target: T, source1: U, source2: V, source3: W): T & U & V & W; - - /** - * Copy the values of all of the enumerable own properties from one or more source objects to a - * target object. Returns the target object. - * @param target The target object to copy to. - * @param sources One or more source objects from which to copy properties - */ - assign(target: any, ...sources: any[]): any; - - /** - * Returns an array of all symbol properties found directly on object o. - * @param o Object to retrieve the symbols from. - */ - getOwnPropertySymbols(o: any): symbol[]; - - /** - * Returns true if the values are the same value, false otherwise. - * @param value1 The first value. - * @param value2 The second value. - */ - is(value1: any, value2: any): boolean; - - /** - * Sets the prototype of a specified object o to object proto or null. Returns the object o. - * @param o The object to change its prototype. - * @param proto The value of the new prototype or null. - */ - setPrototypeOf(o: any, proto: any): any; - - /** - * Gets the own property descriptor of the specified object. - * An own property descriptor is one that is defined directly on the object and is not - * inherited from the object's prototype. - * @param o Object that contains the property. - * @param p Name of the property. - */ - getOwnPropertyDescriptor(o: any, propertyKey: PropertyKey): PropertyDescriptor; - - /** - * Adds a property to an object, or modifies attributes of an existing property. - * @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. - * @param p The property name. - * @param attributes Descriptor for the property. It can be for a data property or an accessor - * property. - */ - defineProperty(o: any, propertyKey: PropertyKey, attributes: PropertyDescriptor): any; -} - -interface Function { - /** - * Returns the name of the function. Function names are read-only and can not be changed. - */ - readonly name: string; - - /** - * Determines whether the given value inherits from this function if this function was used - * as a constructor function. - * - * A constructor function can control which objects are recognized as its instances by - * 'instanceof' by overriding this method. - */ - [Symbol.hasInstance](value: any): boolean; -} - -interface NumberConstructor { - /** - * The value of Number.EPSILON is the difference between 1 and the smallest value greater than 1 - * that is representable as a Number value, which is approximately: - * 2.2204460492503130808472633361816 x 10‍−‍16. - */ - readonly EPSILON: number; - - /** - * Returns true if passed value is finite. - * Unlike the global isFininte, Number.isFinite doesn't forcibly convert the parameter to a - * number. Only finite values of the type number, result in true. - * @param number A numeric value. - */ - isFinite(number: number): boolean; - - /** - * Returns true if the value passed is an integer, false otherwise. - * @param number A numeric value. - */ - isInteger(number: number): boolean; - - /** - * Returns a Boolean value that indicates whether a value is the reserved value NaN (not a - * number). Unlike the global isNaN(), Number.isNaN() doesn't forcefully convert the parameter - * to a number. Only values of the type number, that are also NaN, result in true. - * @param number A numeric value. - */ - isNaN(number: number): boolean; - - /** - * Returns true if the value passed is a safe integer. - * @param number A numeric value. - */ - isSafeInteger(number: number): boolean; - - /** - * The value of the largest integer n such that n and n + 1 are both exactly representable as - * a Number value. - * The value of Number.MIN_SAFE_INTEGER is 9007199254740991 2^53 − 1. - */ - readonly MAX_SAFE_INTEGER: number; - - /** - * The value of the smallest integer n such that n and n − 1 are both exactly representable as - * a Number value. - * The value of Number.MIN_SAFE_INTEGER is −9007199254740991 (−(2^53 − 1)). - */ - readonly MIN_SAFE_INTEGER: number; - - /** - * Converts a string to a floating-point number. - * @param string A string that contains a floating-point number. - */ - parseFloat(string: string): number; - - /** - * Converts A string to an integer. - * @param s A string to convert into a number. - * @param radix A value between 2 and 36 that specifies the base of the number in numString. - * If this argument is not supplied, strings with a prefix of '0x' are considered hexadecimal. - * All other strings are considered decimal. - */ - parseInt(string: string, radix?: number): number; -} - -interface Array { - /** Iterator */ - [Symbol.iterator](): IterableIterator; - - /** - * Returns an object whose properties have the value 'true' - * when they will be absent when used in a 'with' statement. - */ - [Symbol.unscopables](): { - copyWithin: boolean; - entries: boolean; - fill: boolean; - find: boolean; - findIndex: boolean; - keys: boolean; - values: boolean; - }; - - /** - * Returns an array of key, value pairs for every entry in the array - */ - entries(): IterableIterator<[number, T]>; - - /** - * Returns an list of keys in the array - */ - keys(): IterableIterator; - - /** - * Returns an list of values in the array - */ - values(): IterableIterator; - - /** - * Returns the value of the first element in the array where predicate is true, and undefined - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - find(predicate: (value: T, index: number, obj: Array) => boolean, thisArg?: any): T; - - /** - * Returns the index of the first element in the array where predicate is true, and undefined - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - findIndex(predicate: (value: T) => boolean, thisArg?: any): number; - - /** - * Returns the this object after filling the section identified by start and end with value - * @param value value to fill array section with - * @param start index to start filling the array at. If start is negative, it is treated as - * length+start where length is the length of the array. - * @param end index to stop filling the array at. If end is negative, it is treated as - * length+end. - */ - fill(value: T, start?: number, end?: number): T[]; - - /** - * Returns the this object after copying a section of the array identified by start and end - * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it - * is treated as length+end. - * @param end If not specified, length of the this object is used as its default value. - */ - copyWithin(target: number, start: number, end?: number): T[]; -} - -interface IArguments { - /** Iterator */ - [Symbol.iterator](): IterableIterator; -} - -interface ArrayConstructor { - /** - * Creates an array from an array-like object. - * @param arrayLike An array-like object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(arrayLike: ArrayLike, mapfn: (v: T, k: number) => U, thisArg?: any): Array; - - /** - * Creates an array from an iterable object. - * @param iterable An iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(iterable: Iterable, mapfn: (v: T, k: number) => U, thisArg?: any): Array; - - /** - * Creates an array from an array-like object. - * @param arrayLike An array-like object to convert to an array. - */ - from(arrayLike: ArrayLike): Array; - - /** - * Creates an array from an iterable object. - * @param iterable An iterable object to convert to an array. - */ - from(iterable: Iterable): Array; - - /** - * Returns a new array from a set of elements. - * @param items A set of elements to include in the new array object. - */ - of(...items: T[]): Array; -} - -interface String { - /** Iterator */ - [Symbol.iterator](): IterableIterator; - - /** - * Returns a nonnegative integer Number less than 1114112 (0x110000) that is the code point - * value of the UTF-16 encoded code point starting at the string element at position pos in - * the String resulting from converting this object to a String. - * If there is no element at that position, the result is undefined. - * If a valid UTF-16 surrogate pair does not begin at pos, the result is the code unit at pos. - */ - codePointAt(pos: number): number; - - /** - * Returns true if searchString appears as a substring of the result of converting this - * object to a String, at one or more positions that are - * greater than or equal to position; otherwise, returns false. - * @param searchString search string - * @param position If position is undefined, 0 is assumed, so as to search all of the String. - */ - includes(searchString: string, position?: number): boolean; - - /** - * Returns true if the sequence of elements of searchString converted to a String is the - * same as the corresponding elements of this object (converted to a String) starting at - * endPosition – length(this). Otherwise returns false. - */ - endsWith(searchString: string, endPosition?: number): boolean; - - /** - * Returns the String value result of normalizing the string into the normalization form - * named by form as specified in Unicode Standard Annex #15, Unicode Normalization Forms. - * @param form Applicable values: "NFC", "NFD", "NFKC", or "NFKD", If not specified default - * is "NFC" - */ - normalize(form?: string): string; - - /** - * Returns a String value that is made from count copies appended together. If count is 0, - * T is the empty String is returned. - * @param count number of copies to append - */ - repeat(count: number): string; - - /** - * Returns true if the sequence of elements of searchString converted to a String is the - * same as the corresponding elements of this object (converted to a String) starting at - * position. Otherwise returns false. - */ - startsWith(searchString: string, position?: number): boolean; - - // Overloads for objects with methods of well-known symbols. - - /** - * Matches a string an object that supports being matched against, and returns an array containing the results of that search. - * @param matcher An object that supports being matched against. - */ - match(matcher: { [Symbol.match](string: string): RegExpMatchArray; }): RegExpMatchArray; - - /** - * Replaces text in a string, using an object that supports replacement within a string. - * @param searchValue A object can search for and replace matches within a string. - * @param replaceValue A string containing the text to replace for every successful match of searchValue in this string. - */ - replace(searchValue: { [Symbol.replace](string: string, replaceValue: string): string; }, replaceValue: string): string; - - /** - * Replaces text in a string, using an object that supports replacement within a string. - * @param searchValue A object can search for and replace matches within a string. - * @param replacer A function that returns the replacement text. - */ - replace(searchValue: { [Symbol.replace](string: string, replacer: (substring: string, ...args: any[]) => string): string; }, replacer: (substring: string, ...args: any[]) => string): string; - - /** - * Finds the first substring match in a regular expression search. - * @param searcher An object which supports searching within a string. - */ - search(searcher: { [Symbol.search](string: string): number; }): number; - - /** - * Split a string into substrings using the specified separator and return them as an array. - * @param splitter An object that can split a string. - * @param limit A value used to limit the number of elements returned in the array. - */ - split(splitter: { [Symbol.split](string: string, limit?: number): string[]; }, limit?: number): string[]; - - /** - * Returns an HTML anchor element and sets the name attribute to the text value - * @param name - */ - anchor(name: string): string; - - /** Returns a HTML element */ - big(): string; - - /** Returns a HTML element */ - blink(): string; - - /** Returns a HTML element */ - bold(): string; - - /** Returns a HTML element */ - fixed(): string - - /** Returns a HTML element and sets the color attribute value */ - fontcolor(color: string): string - - /** Returns a HTML element and sets the size attribute value */ - fontsize(size: number): string; - - /** Returns a HTML element and sets the size attribute value */ - fontsize(size: string): string; - - /** Returns an HTML element */ - italics(): string; - - /** Returns an HTML element and sets the href attribute value */ - link(url: string): string; - - /** Returns a HTML element */ - small(): string; - - /** Returns a HTML element */ - strike(): string; - - /** Returns a HTML element */ - sub(): string; - - /** Returns a HTML element */ - sup(): string; -} - -interface StringConstructor { - /** - * Return the String value whose elements are, in order, the elements in the List elements. - * If length is 0, the empty string is returned. - */ - fromCodePoint(...codePoints: number[]): string; - - /** - * String.raw is intended for use as a tag function of a Tagged Template String. When called - * as such the first argument will be a well formed template call site object and the rest - * parameter will contain the substitution values. - * @param template A well-formed template string call site representation. - * @param substitutions A set of substitution values. - */ - raw(template: TemplateStringsArray, ...substitutions: any[]): string; -} - -interface IteratorResult { - done: boolean; - value?: T; -} - -interface Iterator { - next(value?: any): IteratorResult; - return?(value?: any): IteratorResult; - throw?(e?: any): IteratorResult; -} - -interface Iterable { - [Symbol.iterator](): Iterator; -} - -interface IterableIterator extends Iterator { - [Symbol.iterator](): IterableIterator; -} - -interface GeneratorFunction extends Function { - readonly [Symbol.toStringTag]: "GeneratorFunction"; -} - -interface GeneratorFunctionConstructor { - /** - * Creates a new Generator function. - * @param args A list of arguments the function accepts. - */ - new (...args: string[]): GeneratorFunction; - (...args: string[]): GeneratorFunction; - readonly prototype: GeneratorFunction; -} -declare var GeneratorFunction: GeneratorFunctionConstructor; - -interface Math { - /** - * Returns the number of leading zero bits in the 32-bit binary representation of a number. - * @param x A numeric expression. - */ - clz32(x: number): number; - - /** - * Returns the result of 32-bit multiplication of two numbers. - * @param x First number - * @param y Second number - */ - imul(x: number, y: number): number; - - /** - * Returns the sign of the x, indicating whether x is positive, negative or zero. - * @param x The numeric expression to test - */ - sign(x: number): number; - - /** - * Returns the base 10 logarithm of a number. - * @param x A numeric expression. - */ - log10(x: number): number; - - /** - * Returns the base 2 logarithm of a number. - * @param x A numeric expression. - */ - log2(x: number): number; - - /** - * Returns the natural logarithm of 1 + x. - * @param x A numeric expression. - */ - log1p(x: number): number; - - /** - * Returns the result of (e^x - 1) of x (e raised to the power of x, where e is the base of - * the natural logarithms). - * @param x A numeric expression. - */ - expm1(x: number): number; - - /** - * Returns the hyperbolic cosine of a number. - * @param x A numeric expression that contains an angle measured in radians. - */ - cosh(x: number): number; - - /** - * Returns the hyperbolic sine of a number. - * @param x A numeric expression that contains an angle measured in radians. - */ - sinh(x: number): number; - - /** - * Returns the hyperbolic tangent of a number. - * @param x A numeric expression that contains an angle measured in radians. - */ - tanh(x: number): number; - - /** - * Returns the inverse hyperbolic cosine of a number. - * @param x A numeric expression that contains an angle measured in radians. - */ - acosh(x: number): number; - - /** - * Returns the inverse hyperbolic sine of a number. - * @param x A numeric expression that contains an angle measured in radians. - */ - asinh(x: number): number; - - /** - * Returns the inverse hyperbolic tangent of a number. - * @param x A numeric expression that contains an angle measured in radians. - */ - atanh(x: number): number; - - /** - * Returns the square root of the sum of squares of its arguments. - * @param values Values to compute the square root for. - * If no arguments are passed, the result is +0. - * If there is only one argument, the result is the absolute value. - * If any argument is +Infinity or -Infinity, the result is +Infinity. - * If any argument is NaN, the result is NaN. - * If all arguments are either +0 or −0, the result is +0. - */ - hypot(...values: number[] ): number; - - /** - * Returns the integral part of the a numeric expression, x, removing any fractional digits. - * If x is already an integer, the result is x. - * @param x A numeric expression. - */ - trunc(x: number): number; - - /** - * Returns the nearest single precision float representation of a number. - * @param x A numeric expression. - */ - fround(x: number): number; - - /** - * Returns an implementation-dependent approximation to the cube root of number. - * @param x A numeric expression. - */ - cbrt(x: number): number; - - readonly [Symbol.toStringTag]: "Math"; -} - -interface Date { - /** - * Converts a Date object to a string. - */ - [Symbol.toPrimitive](hint: "default"): string; - /** - * Converts a Date object to a string. - */ - [Symbol.toPrimitive](hint: "string"): string; - /** - * Converts a Date object to a number. - */ - [Symbol.toPrimitive](hint: "number"): number; - /** - * Converts a Date object to a string or number. - * - * @param hint The strings "number", "string", or "default" to specify what primitive to return. - * - * @throws {TypeError} If 'hint' was given something other than "number", "string", or "default". - * @returns A number if 'hint' was "number", a string if 'hint' was "string" or "default". - */ - [Symbol.toPrimitive](hint: string): string | number; -} - -interface RegExp { - /** - * Matches a string with this regular expression, and returns an array containing the results of - * that search. - * @param string A string to search within. - */ - [Symbol.match](string: string): RegExpMatchArray; - - /** - * Replaces text in a string, using this regular expression. - * @param string A String object or string literal whose contents matching against - * this regular expression will be replaced - * @param replaceValue A String object or string literal containing the text to replace for every - * successful match of this regular expression. - */ - [Symbol.replace](string: string, replaceValue: string): string; - - /** - * Replaces text in a string, using this regular expression. - * @param string A String object or string literal whose contents matching against - * this regular expression will be replaced - * @param replacer A function that returns the replacement text. - */ - [Symbol.replace](string: string, replacer: (substring: string, ...args: any[]) => string): string; - - /** - * Finds the position beginning first substring match in a regular expression search - * using this regular expression. - * - * @param string The string to search within. - */ - [Symbol.search](string: string): number; - - /** - * Returns an array of substrings that were delimited by strings in the original input that - * match against this regular expression. - * - * If the regular expression contains capturing parentheses, then each time this - * regular expression matches, the results (including any undefined results) of the - * capturing parentheses are spliced. - * - * @param string string value to split - * @param limit if not undefined, the output array is truncated so that it contains no more - * than 'limit' elements. - */ - [Symbol.split](string: string, limit?: number): string[]; - - /** - * Returns a string indicating the flags of the regular expression in question. This field is read-only. - * The characters in this string are sequenced and concatenated in the following order: - * - * - "g" for global - * - "i" for ignoreCase - * - "m" for multiline - * - "u" for unicode - * - "y" for sticky - * - * If no flags are set, the value is the empty string. - */ - readonly flags: string; - - /** - * Returns a Boolean value indicating the state of the sticky flag (y) used with a regular - * expression. Default is false. Read-only. - */ - readonly sticky: boolean; - - /** - * Returns a Boolean value indicating the state of the Unicode flag (u) used with a regular - * expression. Default is false. Read-only. - */ - readonly unicode: boolean; -} - -interface RegExpConstructor { - [Symbol.species](): RegExpConstructor; -} - -interface Map { - clear(): void; - delete(key: K): boolean; - entries(): IterableIterator<[K, V]>; - forEach(callbackfn: (value: V, index: K, map: Map) => void, thisArg?: any): void; - get(key: K): V; - has(key: K): boolean; - keys(): IterableIterator; - set(key: K, value?: V): Map; - readonly size: number; - values(): IterableIterator; - [Symbol.iterator]():IterableIterator<[K,V]>; - readonly [Symbol.toStringTag]: "Map"; -} - -interface MapConstructor { - new (): Map; - new (): Map; - new (iterable: Iterable<[K, V]>): Map; - readonly prototype: Map; -} -declare var Map: MapConstructor; - -interface WeakMap { - clear(): void; - delete(key: K): boolean; - get(key: K): V; - has(key: K): boolean; - set(key: K, value?: V): WeakMap; - readonly [Symbol.toStringTag]: "WeakMap"; -} - -interface WeakMapConstructor { - new (): WeakMap; - new (): WeakMap; - new (iterable: Iterable<[K, V]>): WeakMap; - readonly prototype: WeakMap; -} -declare var WeakMap: WeakMapConstructor; - -interface Set { - add(value: T): Set; - clear(): void; - delete(value: T): boolean; - entries(): IterableIterator<[T, T]>; - forEach(callbackfn: (value: T, index: T, set: Set) => void, thisArg?: any): void; - has(value: T): boolean; - keys(): IterableIterator; - readonly size: number; - values(): IterableIterator; - [Symbol.iterator]():IterableIterator; - readonly [Symbol.toStringTag]: "Set"; -} - -interface SetConstructor { - new (): Set; - new (): Set; - new (iterable: Iterable): Set; - readonly prototype: Set; -} -declare var Set: SetConstructor; - -interface WeakSet { - add(value: T): WeakSet; - clear(): void; - delete(value: T): boolean; - has(value: T): boolean; - readonly [Symbol.toStringTag]: "WeakSet"; -} - -interface WeakSetConstructor { - new (): WeakSet; - new (): WeakSet; - new (iterable: Iterable): WeakSet; - readonly prototype: WeakSet; -} -declare var WeakSet: WeakSetConstructor; - -interface JSON { - readonly [Symbol.toStringTag]: "JSON"; -} - -/** - * Represents a raw buffer of binary data, which is used to store data for the - * different typed arrays. ArrayBuffers cannot be read from or written to directly, - * but can be passed to a typed array or DataView Object to interpret the raw - * buffer as needed. - */ -interface ArrayBuffer { - readonly [Symbol.toStringTag]: "ArrayBuffer"; -} - -interface DataView { - readonly [Symbol.toStringTag]: "DataView"; -} - -/** - * A typed array of 8-bit integer values. The contents are initialized to 0. If the requested - * number of bytes could not be allocated an exception is raised. - */ -interface Int8Array { - /** - * Returns an array of key, value pairs for every entry in the array - */ - entries(): IterableIterator<[number, number]>; - /** - * Returns an list of keys in the array - */ - keys(): IterableIterator; - /** - * Returns an list of values in the array - */ - values(): IterableIterator; - [Symbol.iterator](): IterableIterator; - readonly [Symbol.toStringTag]: "Int8Array"; -} - -interface Int8ArrayConstructor { - new (elements: Iterable): Int8Array; - - /** - * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Int8Array; -} - -/** - * A typed array of 8-bit unsigned integer values. The contents are initialized to 0. If the - * requested number of bytes could not be allocated an exception is raised. - */ -interface Uint8Array { - /** - * Returns an array of key, value pairs for every entry in the array - */ - entries(): IterableIterator<[number, number]>; - /** - * Returns an list of keys in the array - */ - keys(): IterableIterator; - /** - * Returns an list of values in the array - */ - values(): IterableIterator; - [Symbol.iterator](): IterableIterator; - readonly [Symbol.toStringTag]: "UInt8Array"; -} - -interface Uint8ArrayConstructor { - new (elements: Iterable): Uint8Array; - - /** - * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint8Array; -} - -/** - * A typed array of 8-bit unsigned integer (clamped) values. The contents are initialized to 0. - * If the requested number of bytes could not be allocated an exception is raised. - */ -interface Uint8ClampedArray { - /** - * Returns an array of key, value pairs for every entry in the array - */ - entries(): IterableIterator<[number, number]>; - - /** - * Returns an list of keys in the array - */ - keys(): IterableIterator; - - /** - * Returns an list of values in the array - */ - values(): IterableIterator; - - [Symbol.iterator](): IterableIterator; - readonly [Symbol.toStringTag]: "Uint8ClampedArray"; -} - -interface Uint8ClampedArrayConstructor { - new (elements: Iterable): Uint8ClampedArray; - - - /** - * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint8ClampedArray; -} - -/** - * A typed array of 16-bit signed integer values. The contents are initialized to 0. If the - * requested number of bytes could not be allocated an exception is raised. - */ -interface Int16Array { - /** - * Returns an array of key, value pairs for every entry in the array - */ - entries(): IterableIterator<[number, number]>; - - /** - * Returns an list of keys in the array - */ - keys(): IterableIterator; - - /** - * Returns an list of values in the array - */ - values(): IterableIterator; - - - [Symbol.iterator](): IterableIterator; - readonly [Symbol.toStringTag]: "Int16Array"; -} - -interface Int16ArrayConstructor { - new (elements: Iterable): Int16Array; - - /** - * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Int16Array; -} - -/** - * A typed array of 16-bit unsigned integer values. The contents are initialized to 0. If the - * requested number of bytes could not be allocated an exception is raised. - */ -interface Uint16Array { - /** - * Returns an array of key, value pairs for every entry in the array - */ - entries(): IterableIterator<[number, number]>; - /** - * Returns an list of keys in the array - */ - keys(): IterableIterator; - /** - * Returns an list of values in the array - */ - values(): IterableIterator; - [Symbol.iterator](): IterableIterator; - readonly [Symbol.toStringTag]: "Uint16Array"; -} - -interface Uint16ArrayConstructor { - new (elements: Iterable): Uint16Array; - - /** - * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint16Array; -} - -/** - * A typed array of 32-bit signed integer values. The contents are initialized to 0. If the - * requested number of bytes could not be allocated an exception is raised. - */ -interface Int32Array { - /** - * Returns an array of key, value pairs for every entry in the array - */ - entries(): IterableIterator<[number, number]>; - /** - * Returns an list of keys in the array - */ - keys(): IterableIterator; - /** - * Returns an list of values in the array - */ - values(): IterableIterator; - [Symbol.iterator](): IterableIterator; - readonly [Symbol.toStringTag]: "Int32Array"; -} - -interface Int32ArrayConstructor { - new (elements: Iterable): Int32Array; - - /** - * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Int32Array; -} - -/** - * A typed array of 32-bit unsigned integer values. The contents are initialized to 0. If the - * requested number of bytes could not be allocated an exception is raised. - */ -interface Uint32Array { - /** - * Returns an array of key, value pairs for every entry in the array - */ - entries(): IterableIterator<[number, number]>; - /** - * Returns an list of keys in the array - */ - keys(): IterableIterator; - /** - * Returns an list of values in the array - */ - values(): IterableIterator; - [Symbol.iterator](): IterableIterator; - readonly [Symbol.toStringTag]: "Uint32Array"; -} - -interface Uint32ArrayConstructor { - new (elements: Iterable): Uint32Array; - - /** - * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint32Array; -} - -/** - * A typed array of 32-bit float values. The contents are initialized to 0. If the requested number - * of bytes could not be allocated an exception is raised. - */ -interface Float32Array { - /** - * Returns an array of key, value pairs for every entry in the array - */ - entries(): IterableIterator<[number, number]>; - /** - * Returns an list of keys in the array - */ - keys(): IterableIterator; - /** - * Returns an list of values in the array - */ - values(): IterableIterator; - [Symbol.iterator](): IterableIterator; - readonly [Symbol.toStringTag]: "Float32Array"; -} - -interface Float32ArrayConstructor { - new (elements: Iterable): Float32Array; - - /** - * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Float32Array; -} - -/** - * A typed array of 64-bit float values. The contents are initialized to 0. If the requested - * number of bytes could not be allocated an exception is raised. - */ -interface Float64Array { - /** - * Returns an array of key, value pairs for every entry in the array - */ - entries(): IterableIterator<[number, number]>; - /** - * Returns an list of keys in the array - */ - keys(): IterableIterator; - /** - * Returns an list of values in the array - */ - values(): IterableIterator; - [Symbol.iterator](): IterableIterator; - readonly [Symbol.toStringTag]: "Float64Array"; -} - -interface Float64ArrayConstructor { - new (elements: Iterable): Float64Array; - - /** - * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Float64Array; -} - -interface ProxyHandler { - getPrototypeOf? (target: T): any; - setPrototypeOf? (target: T, v: any): boolean; - isExtensible? (target: T): boolean; - preventExtensions? (target: T): boolean; - getOwnPropertyDescriptor? (target: T, p: PropertyKey): PropertyDescriptor; - has? (target: T, p: PropertyKey): boolean; - get? (target: T, p: PropertyKey, receiver: any): any; - set? (target: T, p: PropertyKey, value: any, receiver: any): boolean; - deleteProperty? (target: T, p: PropertyKey): boolean; - defineProperty? (target: T, p: PropertyKey, attributes: PropertyDescriptor): boolean; - enumerate? (target: T): PropertyKey[]; - ownKeys? (target: T): PropertyKey[]; - apply? (target: T, thisArg: any, argArray?: any): any; - construct? (target: T, thisArg: any, argArray?: any): any; -} - -interface ProxyConstructor { - revocable(target: T, handler: ProxyHandler): { proxy: T; revoke: () => void; }; - new (target: T, handler: ProxyHandler): T -} -declare var Proxy: ProxyConstructor; - -declare namespace Reflect { - function apply(target: Function, thisArgument: any, argumentsList: ArrayLike): any; - function construct(target: Function, argumentsList: ArrayLike, newTarget?: any): any; - function defineProperty(target: any, propertyKey: PropertyKey, attributes: PropertyDescriptor): boolean; - function deleteProperty(target: any, propertyKey: PropertyKey): boolean; - function enumerate(target: any): IterableIterator; - function get(target: any, propertyKey: PropertyKey, receiver?: any): any; - function getOwnPropertyDescriptor(target: any, propertyKey: PropertyKey): PropertyDescriptor; - function getPrototypeOf(target: any): any; - function has(target: any, propertyKey: string): boolean; - function has(target: any, propertyKey: symbol): boolean; - function isExtensible(target: any): boolean; - function ownKeys(target: any): Array; - function preventExtensions(target: any): boolean; - function set(target: any, propertyKey: PropertyKey, value: any, receiver?: any): boolean; - function setPrototypeOf(target: any, proto: any): boolean; -} - -/** - * Represents the completion of an asynchronous operation - */ -interface Promise { - /** - * Attaches callbacks for the resolution and/or rejection of the Promise. - * @param onfulfilled The callback to execute when the Promise is resolved. - * @param onrejected The callback to execute when the Promise is rejected. - * @returns A Promise for the completion of which ever callback is executed. - */ - then(onfulfilled?: (value: T) => TResult | PromiseLike, onrejected?: (reason: any) => TResult | PromiseLike): Promise; - then(onfulfilled?: (value: T) => TResult | PromiseLike, onrejected?: (reason: any) => void): Promise; - - /** - * Attaches a callback for only the rejection of the Promise. - * @param onrejected The callback to execute when the Promise is rejected. - * @returns A Promise for the completion of the callback. - */ - catch(onrejected?: (reason: any) => T | PromiseLike): Promise; - catch(onrejected?: (reason: any) => void): Promise; - - readonly [Symbol.toStringTag]: "Promise"; -} - -interface PromiseConstructor { - /** - * A reference to the prototype. - */ - readonly prototype: Promise; - - /** - * Creates a new Promise. - * @param executor A callback used to initialize the promise. This callback is passed two arguments: - * a resolve callback used resolve the promise with a value or the result of another promise, - * and a reject callback used to reject the promise with a provided reason or error. - */ - new (executor: (resolve: (value?: T | PromiseLike) => void, reject: (reason?: any) => void) => void): Promise; - - /** - * Creates a Promise that is resolved with an array of results when all of the provided Promises - * resolve, or rejected when any Promise is rejected. - * @param values An array of Promises. - * @returns A new Promise. - */ - 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]>; - 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]>; - 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]>; - all(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike , T5 | PromiseLike, T6 | PromiseLike, T7 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6, T7]>; - all(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike , T5 | PromiseLike, T6 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6]>; - all(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike , T5 | PromiseLike]): Promise<[T1, T2, T3, T4, T5]>; - all(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike ]): Promise<[T1, T2, T3, T4]>; - all(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike]): Promise<[T1, T2, T3]>; - all(values: [T1 | PromiseLike, T2 | PromiseLike]): Promise<[T1, T2]>; - all(values: Iterable>): Promise; - - /** - * Creates a Promise that is resolved or rejected when any of the provided Promises are resolved - * or rejected. - * @param values An array of Promises. - * @returns A new Promise. - */ - race(values: Iterable>): Promise; - - /** - * Creates a new rejected promise for the provided reason. - * @param reason The reason the promise was rejected. - * @returns A new rejected Promise. - */ - reject(reason: any): Promise; - - /** - * Creates a new rejected promise for the provided reason. - * @param reason The reason the promise was rejected. - * @returns A new rejected Promise. - */ - reject(reason: any): Promise; - - /** - * Creates a new resolved promise for the provided value. - * @param value A promise. - * @returns A promise whose internal state matches the provided promise. - */ - resolve(value: T | PromiseLike): Promise; - - /** - * Creates a new resolved promise . - * @returns A resolved promise. - */ - resolve(): Promise; - - readonly [Symbol.species]: Function; -} - -declare var Promise: PromiseConstructor; ///////////////////////////// /// ECMAScript APIs ///////////////////////////// @@ -1564,14 +231,16 @@ interface Function { * @param thisArg The object to be used as the this object. * @param argArray A set of arguments to be passed to the function. */ - apply(thisArg: any, argArray?: any): any; + apply(this: (this: T, ...argArray: any[]) => U, thisArg: T, argArray?: any): U; + apply(this: Function, thisArg: any, argArray?: any): any; /** * Calls a method of an object, substituting another object for the current object. * @param thisArg The object to be used as the current object. * @param argArray A list of arguments to be passed to the method. */ - call(thisArg: any, ...argArray: any[]): any; + call(this: (this: T, ...argArray: any[]) => U, thisArg: T, ...argArray: any[]): U; + call(this: Function, thisArg: any, ...argArray: any[]): any; /** * For a given function, creates a bound function that has the same body as the original function. @@ -1579,7 +248,8 @@ interface Function { * @param thisArg An object to which the this keyword can refer inside the new function. * @param argArray A list of arguments to be passed to the new function. */ - bind(thisArg: any, ...argArray: any[]): any; + bind(this: (this: T, ...argArray: any[]) => U, thisArg: T, ...argArray: any[]): (this: void, ...argArray: any[]) => U; + bind(this: Function, thisArg: any, ...argArray: any[]): any; prototype: any; readonly length: number; @@ -1653,13 +323,13 @@ interface String { * Matches a string with a regular expression, and returns an array containing the results of that search. * @param regexp A variable name or string literal containing the regular expression pattern and flags. */ - match(regexp: string): RegExpMatchArray; + match(regexp: string): RegExpMatchArray | null; /** * Matches a string with a regular expression, and returns an array containing the results of that search. * @param regexp A regular expression object that contains the regular expression pattern and applicable flags. */ - match(regexp: RegExp): RegExpMatchArray; + match(regexp: RegExp): RegExpMatchArray | null; /** * Replaces text in a string, using a regular expression or search string. @@ -2162,7 +832,7 @@ interface RegExp { * Executes a search on a string using a regular expression pattern, and returns an array containing the results of that search. * @param string The String object or string literal on which to perform the search. */ - exec(string: string): RegExpExecArray; + exec(string: string): RegExpExecArray | null; /** * Returns a Boolean value that indicates whether or not a pattern exists in a searched string. @@ -2185,7 +855,7 @@ interface RegExp { lastIndex: number; // Non-standard extensions - compile(): RegExp; + compile(): this; } interface RegExpConstructor { @@ -2457,7 +1127,7 @@ interface Array { /** * Removes the last element from an array and returns it. */ - pop(): T; + pop(): T | undefined; /** * Combines two or more arrays. * @param items Additional items to add to the end of array1. @@ -2475,7 +1145,7 @@ interface Array { /** * Removes the first element from an array and returns it. */ - shift(): T; + shift(): T | undefined; /** * Returns a section of an array. * @param start The beginning of the specified portion of the array. @@ -2868,7 +1538,7 @@ interface Int8Array { * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. */ - find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; + find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number | undefined; /** * Returns the index of the first element in the array where predicate is true, and undefined @@ -2879,7 +1549,7 @@ interface Int8Array { * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. */ - findIndex(predicate: (value: number) => boolean, thisArg?: any): number; + findIndex(predicate: (value: number) => boolean, thisArg?: any): number | undefined; /** * Performs the specified action for each element in an array. @@ -3141,7 +1811,7 @@ interface Uint8Array { * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. */ - find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; + find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number | undefined; /** * Returns the index of the first element in the array where predicate is true, and undefined @@ -3152,7 +1822,7 @@ interface Uint8Array { * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. */ - findIndex(predicate: (value: number) => boolean, thisArg?: any): number; + findIndex(predicate: (value: number) => boolean, thisArg?: any): number | undefined; /** * Performs the specified action for each element in an array. @@ -3415,7 +2085,7 @@ interface Uint8ClampedArray { * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. */ - find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; + find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number | undefined; /** * Returns the index of the first element in the array where predicate is true, and undefined @@ -3426,7 +2096,7 @@ interface Uint8ClampedArray { * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. */ - findIndex(predicate: (value: number) => boolean, thisArg?: any): number; + findIndex(predicate: (value: number) => boolean, thisArg?: any): number | undefined; /** * Performs the specified action for each element in an array. @@ -3688,7 +2358,7 @@ interface Int16Array { * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. */ - find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; + find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number | undefined; /** * Returns the index of the first element in the array where predicate is true, and undefined @@ -3699,7 +2369,7 @@ interface Int16Array { * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. */ - findIndex(predicate: (value: number) => boolean, thisArg?: any): number; + findIndex(predicate: (value: number) => boolean, thisArg?: any): number | undefined; /** * Performs the specified action for each element in an array. @@ -3962,7 +2632,7 @@ interface Uint16Array { * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. */ - find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; + find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number | undefined; /** * Returns the index of the first element in the array where predicate is true, and undefined @@ -3973,7 +2643,7 @@ interface Uint16Array { * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. */ - findIndex(predicate: (value: number) => boolean, thisArg?: any): number; + findIndex(predicate: (value: number) => boolean, thisArg?: any): number | undefined; /** * Performs the specified action for each element in an array. @@ -4235,7 +2905,7 @@ interface Int32Array { * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. */ - find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; + find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number | undefined; /** * Returns the index of the first element in the array where predicate is true, and undefined @@ -4246,7 +2916,7 @@ interface Int32Array { * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. */ - findIndex(predicate: (value: number) => boolean, thisArg?: any): number; + findIndex(predicate: (value: number) => boolean, thisArg?: any): number | undefined; /** * Performs the specified action for each element in an array. @@ -4508,7 +3178,7 @@ interface Uint32Array { * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. */ - find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; + find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number | undefined; /** * Returns the index of the first element in the array where predicate is true, and undefined @@ -4519,7 +3189,7 @@ interface Uint32Array { * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. */ - findIndex(predicate: (value: number) => boolean, thisArg?: any): number; + findIndex(predicate: (value: number) => boolean, thisArg?: any): number | undefined; /** * Performs the specified action for each element in an array. @@ -4781,7 +3451,7 @@ interface Float32Array { * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. */ - find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; + find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number | undefined; /** * Returns the index of the first element in the array where predicate is true, and undefined @@ -4792,7 +3462,7 @@ interface Float32Array { * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. */ - findIndex(predicate: (value: number) => boolean, thisArg?: any): number; + findIndex(predicate: (value: number) => boolean, thisArg?: any): number | undefined; /** * Performs the specified action for each element in an array. @@ -5055,7 +3725,7 @@ interface Float64Array { * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. */ - find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; + find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number | undefined; /** * Returns the index of the first element in the array where predicate is true, and undefined @@ -5066,7 +3736,7 @@ interface Float64Array { * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. */ - findIndex(predicate: (value: number) => boolean, thisArg?: any): number; + findIndex(predicate: (value: number) => boolean, thisArg?: any): number | undefined; /** * Performs the specified action for each element in an array. @@ -5253,6 +3923,7 @@ interface Float64ArrayConstructor { from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Float64Array; } declare const Float64Array: Float64ArrayConstructor; + ///////////////////////////// /// ECMAScript Internationalization API ///////////////////////////// @@ -5453,9 +4124,1449 @@ interface Date { */ toLocaleTimeString(locale?: string, options?: Intl.DateTimeFormatOptions): string; } +declare type PropertyKey = string | number | symbol; + +interface Array { + /** + * Returns the value of the first element in the array where predicate is true, and undefined + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find + * immediately returns that element value. Otherwise, find returns undefined. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + find(predicate: (value: T, index: number, obj: Array) => boolean, thisArg?: any): T | undefined; + + /** + * Returns the index of the first element in the array where predicate is true, and undefined + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find + * immediately returns that element value. Otherwise, find returns undefined. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + findIndex(predicate: (value: T) => boolean, thisArg?: any): number | undefined; + + /** + * Returns the this object after filling the section identified by start and end with value + * @param value value to fill array section with + * @param start index to start filling the array at. If start is negative, it is treated as + * length+start where length is the length of the array. + * @param end index to stop filling the array at. If end is negative, it is treated as + * length+end. + */ + fill(value: T, start?: number, end?: number): T[]; + + /** + * Returns the this object after copying a section of the array identified by start and end + * to the same array starting at position target + * @param target If target is negative, it is treated as length+target where length is the + * length of the array. + * @param start If start is negative, it is treated as length+start. If end is negative, it + * is treated as length+end. + * @param end If not specified, length of the this object is used as its default value. + */ + copyWithin(target: number, start: number, end?: number): T[]; +} + +interface ArrayConstructor { + /** + * Creates an array from an array-like object. + * @param arrayLike An array-like object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: ArrayLike, mapfn: (v: T, k: number) => U, thisArg?: any): Array; -///////////////////////////// + /** + * Creates an array from an array-like object. + * @param arrayLike An array-like object to convert to an array. + */ + from(arrayLike: ArrayLike): Array; + + /** + * Returns a new array from a set of elements. + * @param items A set of elements to include in the new array object. + */ + of(...items: T[]): Array; +} + +interface Function { + /** + * Returns the name of the function. Function names are read-only and can not be changed. + */ + readonly name: string; +} + +interface Math { + /** + * Returns the number of leading zero bits in the 32-bit binary representation of a number. + * @param x A numeric expression. + */ + clz32(x: number): number; + + /** + * Returns the result of 32-bit multiplication of two numbers. + * @param x First number + * @param y Second number + */ + imul(x: number, y: number): number; + + /** + * Returns the sign of the x, indicating whether x is positive, negative or zero. + * @param x The numeric expression to test + */ + sign(x: number): number; + + /** + * Returns the base 10 logarithm of a number. + * @param x A numeric expression. + */ + log10(x: number): number; + + /** + * Returns the base 2 logarithm of a number. + * @param x A numeric expression. + */ + log2(x: number): number; + + /** + * Returns the natural logarithm of 1 + x. + * @param x A numeric expression. + */ + log1p(x: number): number; + + /** + * Returns the result of (e^x - 1) of x (e raised to the power of x, where e is the base of + * the natural logarithms). + * @param x A numeric expression. + */ + expm1(x: number): number; + + /** + * Returns the hyperbolic cosine of a number. + * @param x A numeric expression that contains an angle measured in radians. + */ + cosh(x: number): number; + + /** + * Returns the hyperbolic sine of a number. + * @param x A numeric expression that contains an angle measured in radians. + */ + sinh(x: number): number; + + /** + * Returns the hyperbolic tangent of a number. + * @param x A numeric expression that contains an angle measured in radians. + */ + tanh(x: number): number; + + /** + * Returns the inverse hyperbolic cosine of a number. + * @param x A numeric expression that contains an angle measured in radians. + */ + acosh(x: number): number; + + /** + * Returns the inverse hyperbolic sine of a number. + * @param x A numeric expression that contains an angle measured in radians. + */ + asinh(x: number): number; + + /** + * Returns the inverse hyperbolic tangent of a number. + * @param x A numeric expression that contains an angle measured in radians. + */ + atanh(x: number): number; + + /** + * Returns the square root of the sum of squares of its arguments. + * @param values Values to compute the square root for. + * If no arguments are passed, the result is +0. + * If there is only one argument, the result is the absolute value. + * If any argument is +Infinity or -Infinity, the result is +Infinity. + * If any argument is NaN, the result is NaN. + * If all arguments are either +0 or −0, the result is +0. + */ + hypot(...values: number[] ): number; + + /** + * Returns the integral part of the a numeric expression, x, removing any fractional digits. + * If x is already an integer, the result is x. + * @param x A numeric expression. + */ + trunc(x: number): number; + + /** + * Returns the nearest single precision float representation of a number. + * @param x A numeric expression. + */ + fround(x: number): number; + + /** + * Returns an implementation-dependent approximation to the cube root of number. + * @param x A numeric expression. + */ + cbrt(x: number): number; +} + +interface NumberConstructor { + /** + * The value of Number.EPSILON is the difference between 1 and the smallest value greater than 1 + * that is representable as a Number value, which is approximately: + * 2.2204460492503130808472633361816 x 10‍−‍16. + */ + readonly EPSILON: number; + + /** + * Returns true if passed value is finite. + * Unlike the global isFininte, Number.isFinite doesn't forcibly convert the parameter to a + * number. Only finite values of the type number, result in true. + * @param number A numeric value. + */ + isFinite(number: number): boolean; + + /** + * Returns true if the value passed is an integer, false otherwise. + * @param number A numeric value. + */ + isInteger(number: number): boolean; + + /** + * Returns a Boolean value that indicates whether a value is the reserved value NaN (not a + * number). Unlike the global isNaN(), Number.isNaN() doesn't forcefully convert the parameter + * to a number. Only values of the type number, that are also NaN, result in true. + * @param number A numeric value. + */ + isNaN(number: number): boolean; + + /** + * Returns true if the value passed is a safe integer. + * @param number A numeric value. + */ + isSafeInteger(number: number): boolean; + + /** + * The value of the largest integer n such that n and n + 1 are both exactly representable as + * a Number value. + * The value of Number.MIN_SAFE_INTEGER is 9007199254740991 2^53 − 1. + */ + readonly MAX_SAFE_INTEGER: number; + + /** + * The value of the smallest integer n such that n and n − 1 are both exactly representable as + * a Number value. + * The value of Number.MIN_SAFE_INTEGER is −9007199254740991 (−(2^53 − 1)). + */ + readonly MIN_SAFE_INTEGER: number; + + /** + * Converts a string to a floating-point number. + * @param string A string that contains a floating-point number. + */ + parseFloat(string: string): number; + + /** + * Converts A string to an integer. + * @param s A string to convert into a number. + * @param radix A value between 2 and 36 that specifies the base of the number in numString. + * If this argument is not supplied, strings with a prefix of '0x' are considered hexadecimal. + * All other strings are considered decimal. + */ + parseInt(string: string, radix?: number): number; +} + +interface Object { + /** + * Determines whether an object has a property with the specified name. + * @param v A property name. + */ + hasOwnProperty(v: PropertyKey): boolean + + /** + * Determines whether a specified property is enumerable. + * @param v A property name. + */ + propertyIsEnumerable(v: PropertyKey): boolean; +} + +interface ObjectConstructor { + /** + * Copy the values of all of the enumerable own properties from one or more source objects to a + * target object. Returns the target object. + * @param target The target object to copy to. + * @param source The source object from which to copy properties. + */ + assign(target: T, source: U): T & U; + + /** + * Copy the values of all of the enumerable own properties from one or more source objects to a + * target object. Returns the target object. + * @param target The target object to copy to. + * @param source1 The first source object from which to copy properties. + * @param source2 The second source object from which to copy properties. + */ + assign(target: T, source1: U, source2: V): T & U & V; + + /** + * Copy the values of all of the enumerable own properties from one or more source objects to a + * target object. Returns the target object. + * @param target The target object to copy to. + * @param source1 The first source object from which to copy properties. + * @param source2 The second source object from which to copy properties. + * @param source3 The third source object from which to copy properties. + */ + assign(target: T, source1: U, source2: V, source3: W): T & U & V & W; + + /** + * Copy the values of all of the enumerable own properties from one or more source objects to a + * target object. Returns the target object. + * @param target The target object to copy to. + * @param sources One or more source objects from which to copy properties + */ + assign(target: any, ...sources: any[]): any; + + /** + * Returns an array of all symbol properties found directly on object o. + * @param o Object to retrieve the symbols from. + */ + getOwnPropertySymbols(o: any): symbol[]; + + /** + * Returns true if the values are the same value, false otherwise. + * @param value1 The first value. + * @param value2 The second value. + */ + is(value1: any, value2: any): boolean; + + /** + * Sets the prototype of a specified object o to object proto or null. Returns the object o. + * @param o The object to change its prototype. + * @param proto The value of the new prototype or null. + */ + setPrototypeOf(o: any, proto: any): any; + + /** + * Gets the own property descriptor of the specified object. + * An own property descriptor is one that is defined directly on the object and is not + * inherited from the object's prototype. + * @param o Object that contains the property. + * @param p Name of the property. + */ + getOwnPropertyDescriptor(o: any, propertyKey: PropertyKey): PropertyDescriptor; + + /** + * Adds a property to an object, or modifies attributes of an existing property. + * @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. + * @param p The property name. + * @param attributes Descriptor for the property. It can be for a data property or an accessor + * property. + */ + defineProperty(o: any, propertyKey: PropertyKey, attributes: PropertyDescriptor): any; +} + +interface RegExp { + /** + * Returns a string indicating the flags of the regular expression in question. This field is read-only. + * The characters in this string are sequenced and concatenated in the following order: + * + * - "g" for global + * - "i" for ignoreCase + * - "m" for multiline + * - "u" for unicode + * - "y" for sticky + * + * If no flags are set, the value is the empty string. + */ + readonly flags: string; + + /** + * Returns a Boolean value indicating the state of the sticky flag (y) used with a regular + * expression. Default is false. Read-only. + */ + readonly sticky: boolean; + + /** + * Returns a Boolean value indicating the state of the Unicode flag (u) used with a regular + * expression. Default is false. Read-only. + */ + readonly unicode: boolean; +} + +interface String { + /** + * Returns a nonnegative integer Number less than 1114112 (0x110000) that is the code point + * value of the UTF-16 encoded code point starting at the string element at position pos in + * the String resulting from converting this object to a String. + * If there is no element at that position, the result is undefined. + * If a valid UTF-16 surrogate pair does not begin at pos, the result is the code unit at pos. + */ + codePointAt(pos: number): number | undefined; + + /** + * Returns true if searchString appears as a substring of the result of converting this + * object to a String, at one or more positions that are + * greater than or equal to position; otherwise, returns false. + * @param searchString search string + * @param position If position is undefined, 0 is assumed, so as to search all of the String. + */ + includes(searchString: string, position?: number): boolean; + + /** + * Returns true if the sequence of elements of searchString converted to a String is the + * same as the corresponding elements of this object (converted to a String) starting at + * endPosition – length(this). Otherwise returns false. + */ + endsWith(searchString: string, endPosition?: number): boolean; + + /** + * Returns the String value result of normalizing the string into the normalization form + * named by form as specified in Unicode Standard Annex #15, Unicode Normalization Forms. + * @param form Applicable values: "NFC", "NFD", "NFKC", or "NFKD", If not specified default + * is "NFC" + */ + normalize(form?: string): string; + + /** + * Returns a String value that is made from count copies appended together. If count is 0, + * T is the empty String is returned. + * @param count number of copies to append + */ + repeat(count: number): string; + + /** + * Returns true if the sequence of elements of searchString converted to a String is the + * same as the corresponding elements of this object (converted to a String) starting at + * position. Otherwise returns false. + */ + startsWith(searchString: string, position?: number): boolean; + + /** + * Returns an HTML anchor element and sets the name attribute to the text value + * @param name + */ + anchor(name: string): string; + + /** Returns a HTML element */ + big(): string; + + /** Returns a HTML element */ + blink(): string; + + /** Returns a HTML element */ + bold(): string; + + /** Returns a HTML element */ + fixed(): string + + /** Returns a HTML element and sets the color attribute value */ + fontcolor(color: string): string + + /** Returns a HTML element and sets the size attribute value */ + fontsize(size: number): string; + + /** Returns a HTML element and sets the size attribute value */ + fontsize(size: string): string; + + /** Returns an HTML element */ + italics(): string; + + /** Returns an HTML element and sets the href attribute value */ + link(url: string): string; + + /** Returns a HTML element */ + small(): string; + + /** Returns a HTML element */ + strike(): string; + + /** Returns a HTML element */ + sub(): string; + + /** Returns a HTML element */ + sup(): string; +} + +interface StringConstructor { + /** + * Return the String value whose elements are, in order, the elements in the List elements. + * If length is 0, the empty string is returned. + */ + fromCodePoint(...codePoints: number[]): string; + + /** + * String.raw is intended for use as a tag function of a Tagged Template String. When called + * as such the first argument will be a well formed template call site object and the rest + * parameter will contain the substitution values. + * @param template A well-formed template string call site representation. + * @param substitutions A set of substitution values. + */ + raw(template: TemplateStringsArray, ...substitutions: any[]): string; +}interface Map { + clear(): void; + delete(key: K): boolean; + forEach(callbackfn: (value: V, index: K, map: Map) => void, thisArg?: any): void; + get(key: K): V | undefined; + has(key: K): boolean; + set(key: K, value?: V): Map; + readonly size: number; +} + +interface MapConstructor { + new (): Map; + new (): Map; + readonly prototype: Map; +} +declare var Map: MapConstructor; + +interface WeakMap { + clear(): void; + delete(key: K): boolean; + get(key: K): V | undefined; + has(key: K): boolean; + set(key: K, value?: V): WeakMap; + +} + +interface WeakMapConstructor { + new (): WeakMap; + new (): WeakMap; + readonly prototype: WeakMap; +} +declare var WeakMap: WeakMapConstructor; + +interface Set { + add(value: T): Set; + clear(): void; + delete(value: T): boolean; + entries(): IterableIterator<[T, T]>; + forEach(callbackfn: (value: T, index: T, set: Set) => void, thisArg?: any): void; + has(value: T): boolean; + keys(): IterableIterator; + readonly size: number; + values(): IterableIterator; + [Symbol.iterator]():IterableIterator; + readonly [Symbol.toStringTag]: "Set"; +} + +interface SetConstructor { + new (): Set; + new (): Set; + new (iterable: Iterable): Set; + readonly prototype: Set; +} +declare var Set: SetConstructor; + +interface WeakSet { + add(value: T): WeakSet; + clear(): void; + delete(value: T): boolean; + has(value: T): boolean; + readonly [Symbol.toStringTag]: "WeakSet"; +} + +interface WeakSetConstructor { + new (): WeakSet; + new (): WeakSet; + new (iterable: Iterable): WeakSet; + readonly prototype: WeakSet; +} +declare var WeakSet: WeakSetConstructor; +interface GeneratorFunction extends Function { } + +interface GeneratorFunctionConstructor { + /** + * Creates a new Generator function. + * @param args A list of arguments the function accepts. + */ + new (...args: string[]): GeneratorFunction; + (...args: string[]): GeneratorFunction; + readonly prototype: GeneratorFunction; +} +declare var GeneratorFunction: GeneratorFunctionConstructor; +/// + +interface IteratorResult { + done: boolean; + value?: T; +} + +interface Iterator { + next(value?: any): IteratorResult; + return?(value?: any): IteratorResult; + throw?(e?: any): IteratorResult; +} + +interface Iterable { } + +interface IterableIterator extends Iterator { } + +interface Array { + /** + * Returns an array of key, value pairs for every entry in the array + */ + entries(): IterableIterator<[number, T]>; + + /** + * Returns an list of keys in the array + */ + keys(): IterableIterator; + + /** + * Returns an list of values in the array + */ + values(): IterableIterator; +} + +interface ArrayConstructor { + /** + * Creates an array from an iterable object. + * @param iterable An iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(iterable: Iterable, mapfn: (v: T, k: number) => U, thisArg?: any): Array; + + /** + * Creates an array from an iterable object. + * @param iterable An iterable object to convert to an array. + */ + from(iterable: Iterable): Array; +} + +interface Map { + entries(): IterableIterator<[K, V]>; + keys(): IterableIterator; + values(): IterableIterator; +} + +interface MapConstructor { + new (iterable: Iterable<[K, V]>): Map; +} + +interface WeakMap { } + +interface WeakMapConstructor { + new (iterable: Iterable<[K, V]>): WeakMap; +} + +interface Promise { } + +interface PromiseConstructor { + /** + * Creates a Promise that is resolved with an array of results when all of the provided Promises + * resolve, or rejected when any Promise is rejected. + * @param values An array of Promises. + * @returns A new Promise. + */ + all(values: Iterable>): Promise; + + /** + * Creates a Promise that is resolved or rejected when any of the provided Promises are resolved + * or rejected. + * @param values An array of Promises. + * @returns A new Promise. + */ + race(values: Iterable>): Promise; +} + +declare namespace Reflect { + function enumerate(target: any): IterableIterator; +} + +/** + * A typed array of 8-bit integer values. The contents are initialized to 0. If the requested + * number of bytes could not be allocated an exception is raised. + */ +interface Int8Array { + /** + * Returns an array of key, value pairs for every entry in the array + */ + entries(): IterableIterator<[number, number]>; + /** + * Returns an list of keys in the array + */ + keys(): IterableIterator; + /** + * Returns an list of values in the array + */ + values(): IterableIterator; +} + +interface Int8ArrayConstructor { + new (elements: Iterable): Int8Array; + + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Int8Array; +} + +/** + * A typed array of 8-bit unsigned integer values. The contents are initialized to 0. If the + * requested number of bytes could not be allocated an exception is raised. + */ +interface Uint8Array { + /** + * Returns an array of key, value pairs for every entry in the array + */ + entries(): IterableIterator<[number, number]>; + /** + * Returns an list of keys in the array + */ + keys(): IterableIterator; + /** + * Returns an list of values in the array + */ + values(): IterableIterator; +} + +interface Uint8ArrayConstructor { + new (elements: Iterable): Uint8Array; + + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint8Array; +} + +/** + * A typed array of 8-bit unsigned integer (clamped) values. The contents are initialized to 0. + * If the requested number of bytes could not be allocated an exception is raised. + */ +interface Uint8ClampedArray { + /** + * Returns an array of key, value pairs for every entry in the array + */ + entries(): IterableIterator<[number, number]>; + + /** + * Returns an list of keys in the array + */ + keys(): IterableIterator; + + /** + * Returns an list of values in the array + */ + values(): IterableIterator; +} + +interface Uint8ClampedArrayConstructor { + new (elements: Iterable): Uint8ClampedArray; + + + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint8ClampedArray; +} + +/** + * A typed array of 16-bit signed integer values. The contents are initialized to 0. If the + * requested number of bytes could not be allocated an exception is raised. + */ +interface Int16Array { + /** + * Returns an array of key, value pairs for every entry in the array + */ + entries(): IterableIterator<[number, number]>; + + /** + * Returns an list of keys in the array + */ + keys(): IterableIterator; + + /** + * Returns an list of values in the array + */ + values(): IterableIterator; +} + +interface Int16ArrayConstructor { + new (elements: Iterable): Int16Array; + + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Int16Array; +} + +/** + * A typed array of 16-bit unsigned integer values. The contents are initialized to 0. If the + * requested number of bytes could not be allocated an exception is raised. + */ +interface Uint16Array { + /** + * Returns an array of key, value pairs for every entry in the array + */ + entries(): IterableIterator<[number, number]>; + /** + * Returns an list of keys in the array + */ + keys(): IterableIterator; + /** + * Returns an list of values in the array + */ + values(): IterableIterator; +} + +interface Uint16ArrayConstructor { + new (elements: Iterable): Uint16Array; + + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint16Array; +} + +/** + * A typed array of 32-bit signed integer values. The contents are initialized to 0. If the + * requested number of bytes could not be allocated an exception is raised. + */ +interface Int32Array { + /** + * Returns an array of key, value pairs for every entry in the array + */ + entries(): IterableIterator<[number, number]>; + /** + * Returns an list of keys in the array + */ + keys(): IterableIterator; + /** + * Returns an list of values in the array + */ + values(): IterableIterator; +} + +interface Int32ArrayConstructor { + new (elements: Iterable): Int32Array; + + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Int32Array; +} + +/** + * A typed array of 32-bit unsigned integer values. The contents are initialized to 0. If the + * requested number of bytes could not be allocated an exception is raised. + */ +interface Uint32Array { + /** + * Returns an array of key, value pairs for every entry in the array + */ + entries(): IterableIterator<[number, number]>; + /** + * Returns an list of keys in the array + */ + keys(): IterableIterator; + /** + * Returns an list of values in the array + */ + values(): IterableIterator; +} + +interface Uint32ArrayConstructor { + new (elements: Iterable): Uint32Array; + + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint32Array; +} + +/** + * A typed array of 32-bit float values. The contents are initialized to 0. If the requested number + * of bytes could not be allocated an exception is raised. + */ +interface Float32Array { + /** + * Returns an array of key, value pairs for every entry in the array + */ + entries(): IterableIterator<[number, number]>; + /** + * Returns an list of keys in the array + */ + keys(): IterableIterator; + /** + * Returns an list of values in the array + */ + values(): IterableIterator; +} + +interface Float32ArrayConstructor { + new (elements: Iterable): Float32Array; + + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Float32Array; +} + +/** + * A typed array of 64-bit float values. The contents are initialized to 0. If the requested + * number of bytes could not be allocated an exception is raised. + */ +interface Float64Array { + /** + * Returns an array of key, value pairs for every entry in the array + */ + entries(): IterableIterator<[number, number]>; + /** + * Returns an list of keys in the array + */ + keys(): IterableIterator; + /** + * Returns an list of values in the array + */ + values(): IterableIterator; +} + +interface Float64ArrayConstructor { + new (elements: Iterable): Float64Array; + + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Float64Array; +}/** + * Represents the completion of an asynchronous operation + */ +interface Promise { + /** + * Attaches callbacks for the resolution and/or rejection of the Promise. + * @param onfulfilled The callback to execute when the Promise is resolved. + * @param onrejected The callback to execute when the Promise is rejected. + * @returns A Promise for the completion of which ever callback is executed. + */ + then(onfulfilled?: (value: T) => TResult | PromiseLike, onrejected?: (reason: any) => TResult | PromiseLike): Promise; + then(onfulfilled?: (value: T) => TResult | PromiseLike, onrejected?: (reason: any) => void): Promise; + + /** + * Attaches a callback for only the rejection of the Promise. + * @param onrejected The callback to execute when the Promise is rejected. + * @returns A Promise for the completion of the callback. + */ + catch(onrejected?: (reason: any) => T | PromiseLike): Promise; + catch(onrejected?: (reason: any) => void): Promise; +} + +interface PromiseConstructor { + /** + * A reference to the prototype. + */ + readonly prototype: Promise; + + /** + * Creates a new Promise. + * @param executor A callback used to initialize the promise. This callback is passed two arguments: + * a resolve callback used resolve the promise with a value or the result of another promise, + * and a reject callback used to reject the promise with a provided reason or error. + */ + new (executor: (resolve: (value?: T | PromiseLike) => void, reject: (reason?: any) => void) => void): Promise; + + /** + * Creates a Promise that is resolved with an array of results when all of the provided Promises + * resolve, or rejected when any Promise is rejected. + * @param values An array of Promises. + * @returns A new Promise. + */ + 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]>; + 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]>; + 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]>; + all(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike , T5 | PromiseLike, T6 | PromiseLike, T7 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6, T7]>; + all(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike , T5 | PromiseLike, T6 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6]>; + all(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike , T5 | PromiseLike]): Promise<[T1, T2, T3, T4, T5]>; + all(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike ]): Promise<[T1, T2, T3, T4]>; + all(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike]): Promise<[T1, T2, T3]>; + all(values: [T1 | PromiseLike, T2 | PromiseLike]): Promise<[T1, T2]>; + + /** + * Creates a new rejected promise for the provided reason. + * @param reason The reason the promise was rejected. + * @returns A new rejected Promise. + */ + reject(reason: any): Promise; + + /** + * Creates a new rejected promise for the provided reason. + * @param reason The reason the promise was rejected. + * @returns A new rejected Promise. + */ + reject(reason: any): Promise; + + /** + * Creates a new resolved promise for the provided value. + * @param value A promise. + * @returns A promise whose internal state matches the provided promise. + */ + resolve(value: T | PromiseLike): Promise; + + /** + * Creates a new resolved promise . + * @returns A resolved promise. + */ + resolve(): Promise; +} + +declare var Promise: PromiseConstructor;interface ProxyHandler { + getPrototypeOf? (target: T): any; + setPrototypeOf? (target: T, v: any): boolean; + isExtensible? (target: T): boolean; + preventExtensions? (target: T): boolean; + getOwnPropertyDescriptor? (target: T, p: PropertyKey): PropertyDescriptor; + has? (target: T, p: PropertyKey): boolean; + get? (target: T, p: PropertyKey, receiver: any): any; + set? (target: T, p: PropertyKey, value: any, receiver: any): boolean; + deleteProperty? (target: T, p: PropertyKey): boolean; + defineProperty? (target: T, p: PropertyKey, attributes: PropertyDescriptor): boolean; + enumerate? (target: T): PropertyKey[]; + ownKeys? (target: T): PropertyKey[]; + apply? (target: T, thisArg: any, argArray?: any): any; + construct? (target: T, thisArg: any, argArray?: any): any; +} + +interface ProxyConstructor { + revocable(target: T, handler: ProxyHandler): { proxy: T; revoke: () => void; }; + new (target: T, handler: ProxyHandler): T +} +declare var Proxy: ProxyConstructor;declare namespace Reflect { + function apply(target: Function, thisArgument: any, argumentsList: ArrayLike): any; + function construct(target: Function, argumentsList: ArrayLike, newTarget?: any): any; + function defineProperty(target: any, propertyKey: PropertyKey, attributes: PropertyDescriptor): boolean; + function deleteProperty(target: any, propertyKey: PropertyKey): boolean; + function get(target: any, propertyKey: PropertyKey, receiver?: any): any; + function getOwnPropertyDescriptor(target: any, propertyKey: PropertyKey): PropertyDescriptor; + function getPrototypeOf(target: any): any; + function has(target: any, propertyKey: string): boolean; + function has(target: any, propertyKey: symbol): boolean; + function isExtensible(target: any): boolean; + function ownKeys(target: any): Array; + function preventExtensions(target: any): boolean; + function set(target: any, propertyKey: PropertyKey, value: any, receiver?: any): boolean; + function setPrototypeOf(target: any, proto: any): boolean; +}interface Symbol { + /** Returns a string representation of an object. */ + toString(): string; + + /** Returns the primitive value of the specified object. */ + valueOf(): Object; +} + +interface SymbolConstructor { + /** + * A reference to the prototype. + */ + readonly prototype: Symbol; + + /** + * Returns a new unique Symbol value. + * @param description Description of the new Symbol object. + */ + (description?: string|number): symbol; + + /** + * Returns a Symbol object from the global symbol registry matching the given key if found. + * Otherwise, returns a new symbol with this key. + * @param key key to search for. + */ + for(key: string): symbol; + + /** + * Returns a key from the global symbol registry matching the given Symbol if found. + * Otherwise, returns a undefined. + * @param sym Symbol to find the key for. + */ + keyFor(sym: symbol): string | undefined; +} + +declare var Symbol: SymbolConstructor;/// + +interface SymbolConstructor { + /** + * A method that determines if a constructor object recognizes an object as one of the + * constructor’s instances. Called by the semantics of the instanceof operator. + */ + readonly hasInstance: symbol; + + /** + * A Boolean value that if true indicates that an object should flatten to its array elements + * by Array.prototype.concat. + */ + readonly isConcatSpreadable: symbol; + + /** + * A method that returns the default iterator for an object. Called by the semantics of the + * for-of statement. + */ + readonly iterator: symbol; + + /** + * A regular expression method that matches the regular expression against a string. Called + * by the String.prototype.match method. + */ + readonly match: symbol; + + /** + * A regular expression method that replaces matched substrings of a string. Called by the + * String.prototype.replace method. + */ + readonly replace: symbol; + + /** + * A regular expression method that returns the index within a string that matches the + * regular expression. Called by the String.prototype.search method. + */ + readonly search: symbol; + + /** + * A function valued property that is the constructor function that is used to create + * derived objects. + */ + readonly species: symbol; + + /** + * A regular expression method that splits a string at the indices that match the regular + * expression. Called by the String.prototype.split method. + */ + readonly split: symbol; + + /** + * A method that converts an object to a corresponding primitive value. + * Called by the ToPrimitive abstract operation. + */ + readonly toPrimitive: symbol; + + /** + * A String value that is used in the creation of the default string description of an object. + * Called by the built-in method Object.prototype.toString. + */ + readonly toStringTag: symbol; + + /** + * An Object whose own property names are property names that are excluded from the 'with' + * environment bindings of the associated objects. + */ + readonly unscopables: symbol; +} + +interface Symbol { + readonly [Symbol.toStringTag]: "Symbol"; +} + +interface Array { + /** Iterator */ + [Symbol.iterator](): IterableIterator; + + /** + * Returns an object whose properties have the value 'true' + * when they will be absent when used in a 'with' statement. + */ + [Symbol.unscopables](): { + copyWithin: boolean; + entries: boolean; + fill: boolean; + find: boolean; + findIndex: boolean; + keys: boolean; + values: boolean; + }; +} + +interface Date { + /** + * Converts a Date object to a string. + */ + [Symbol.toPrimitive](hint: "default"): string; + /** + * Converts a Date object to a string. + */ + [Symbol.toPrimitive](hint: "string"): string; + /** + * Converts a Date object to a number. + */ + [Symbol.toPrimitive](hint: "number"): number; + /** + * Converts a Date object to a string or number. + * + * @param hint The strings "number", "string", or "default" to specify what primitive to return. + * + * @throws {TypeError} If 'hint' was given something other than "number", "string", or "default". + * @returns A number if 'hint' was "number", a string if 'hint' was "string" or "default". + */ + [Symbol.toPrimitive](hint: string): string | number; +} + +interface Map { + [Symbol.iterator]():IterableIterator<[K,V]>; + readonly [Symbol.toStringTag]: "Map"; +} + +interface WeakMap{ + readonly [Symbol.toStringTag]: "WeakMap"; +} + +interface JSON { + readonly [Symbol.toStringTag]: "JSON"; +} + +interface Function { + /** + * Determines whether the given value inherits from this function if this function was used + * as a constructor function. + * + * A constructor function can control which objects are recognized as its instances by + * 'instanceof' by overriding this method. + */ + [Symbol.hasInstance](value: any): boolean; +} + +interface GeneratorFunction extends Function { + readonly [Symbol.toStringTag]: "GeneratorFunction"; +} + +interface IArguments { + /** Iterator */ + [Symbol.iterator](): IterableIterator; +} + +interface Iterator { } + +interface Iterable { + [Symbol.iterator](): Iterator; +} + +interface IterableIterator extends Iterator { + [Symbol.iterator](): IterableIterator; +} + +interface Math { + readonly [Symbol.toStringTag]: "Math"; +} + +interface Promise { + readonly [Symbol.toStringTag]: "Promise"; +} + +interface PromiseConstructor { + readonly [Symbol.species]: Function; +} + +interface RegExp { + /** + * Matches a string with this regular expression, and returns an array containing the results of + * that search. + * @param string A string to search within. + */ + [Symbol.match](string: string): RegExpMatchArray | null; + + /** + * Replaces text in a string, using this regular expression. + * @param string A String object or string literal whose contents matching against + * this regular expression will be replaced + * @param replaceValue A String object or string literal containing the text to replace for every + * successful match of this regular expression. + */ + [Symbol.replace](string: string, replaceValue: string): string; + + /** + * Replaces text in a string, using this regular expression. + * @param string A String object or string literal whose contents matching against + * this regular expression will be replaced + * @param replacer A function that returns the replacement text. + */ + [Symbol.replace](string: string, replacer: (substring: string, ...args: any[]) => string): string; + + /** + * Finds the position beginning first substring match in a regular expression search + * using this regular expression. + * + * @param string The string to search within. + */ + [Symbol.search](string: string): number; + + /** + * Returns an array of substrings that were delimited by strings in the original input that + * match against this regular expression. + * + * If the regular expression contains capturing parentheses, then each time this + * regular expression matches, the results (including any undefined results) of the + * capturing parentheses are spliced. + * + * @param string string value to split + * @param limit if not undefined, the output array is truncated so that it contains no more + * than 'limit' elements. + */ + [Symbol.split](string: string, limit?: number): string[]; +} + +interface RegExpConstructor { + [Symbol.species](): RegExpConstructor; +} + +interface String { + /** Iterator */ + [Symbol.iterator](): IterableIterator; + + /** + * Matches a string an object that supports being matched against, and returns an array containing the results of that search. + * @param matcher An object that supports being matched against. + */ + match(matcher: { [Symbol.match](string: string): RegExpMatchArray | null; }): RegExpMatchArray | null; + + /** + * Replaces text in a string, using an object that supports replacement within a string. + * @param searchValue A object can search for and replace matches within a string. + * @param replaceValue A string containing the text to replace for every successful match of searchValue in this string. + */ + replace(searchValue: { [Symbol.replace](string: string, replaceValue: string): string; }, replaceValue: string): string; + + /** + * Replaces text in a string, using an object that supports replacement within a string. + * @param searchValue A object can search for and replace matches within a string. + * @param replacer A function that returns the replacement text. + */ + replace(searchValue: { [Symbol.replace](string: string, replacer: (substring: string, ...args: any[]) => string): string; }, replacer: (substring: string, ...args: any[]) => string): string; + + /** + * Finds the first substring match in a regular expression search. + * @param searcher An object which supports searching within a string. + */ + search(searcher: { [Symbol.search](string: string): number; }): number; + + /** + * Split a string into substrings using the specified separator and return them as an array. + * @param splitter An object that can split a string. + * @param limit A value used to limit the number of elements returned in the array. + */ + split(splitter: { [Symbol.split](string: string, limit?: number): string[]; }, limit?: number): string[]; +} + +/** + * Represents a raw buffer of binary data, which is used to store data for the + * different typed arrays. ArrayBuffers cannot be read from or written to directly, + * but can be passed to a typed array or DataView Object to interpret the raw + * buffer as needed. + */ +interface ArrayBuffer { + readonly [Symbol.toStringTag]: "ArrayBuffer"; +} + +interface DataView { + readonly [Symbol.toStringTag]: "DataView"; +} + +/** + * A typed array of 8-bit integer values. The contents are initialized to 0. If the requested + * number of bytes could not be allocated an exception is raised. + */ +interface Int8Array { + [Symbol.iterator](): IterableIterator; + readonly [Symbol.toStringTag]: "Int8Array"; +} + +/** + * A typed array of 8-bit unsigned integer values. The contents are initialized to 0. If the + * requested number of bytes could not be allocated an exception is raised. + */ +interface Uint8Array { + [Symbol.iterator](): IterableIterator; + readonly [Symbol.toStringTag]: "UInt8Array"; +} + +/** + * A typed array of 8-bit unsigned integer (clamped) values. The contents are initialized to 0. + * If the requested number of bytes could not be allocated an exception is raised. + */ +interface Uint8ClampedArray { + [Symbol.iterator](): IterableIterator; + readonly [Symbol.toStringTag]: "Uint8ClampedArray"; +} + +/** + * A typed array of 16-bit signed integer values. The contents are initialized to 0. If the + * requested number of bytes could not be allocated an exception is raised. + */ +interface Int16Array { + [Symbol.iterator](): IterableIterator; + readonly [Symbol.toStringTag]: "Int16Array"; +} + +/** + * A typed array of 16-bit unsigned integer values. The contents are initialized to 0. If the + * requested number of bytes could not be allocated an exception is raised. + */ +interface Uint16Array { + [Symbol.iterator](): IterableIterator; + readonly [Symbol.toStringTag]: "Uint16Array"; +} + +/** + * A typed array of 32-bit signed integer values. The contents are initialized to 0. If the + * requested number of bytes could not be allocated an exception is raised. + */ +interface Int32Array { + [Symbol.iterator](): IterableIterator; + readonly [Symbol.toStringTag]: "Int32Array"; +} + +/** + * A typed array of 32-bit unsigned integer values. The contents are initialized to 0. If the + * requested number of bytes could not be allocated an exception is raised. + */ +interface Uint32Array { + [Symbol.iterator](): IterableIterator; + readonly [Symbol.toStringTag]: "Uint32Array"; +} + +/** + * A typed array of 32-bit float values. The contents are initialized to 0. If the requested number + * of bytes could not be allocated an exception is raised. + */ +interface Float32Array { + [Symbol.iterator](): IterableIterator; + readonly [Symbol.toStringTag]: "Float32Array"; +} + +/** + * A typed array of 64-bit float values. The contents are initialized to 0. If the requested + * number of bytes could not be allocated an exception is raised. + */ +interface Float64Array { + [Symbol.iterator](): IterableIterator; + readonly [Symbol.toStringTag]: "Float64Array"; +}///////////////////////////// /// IE DOM APIs ///////////////////////////// @@ -5468,11 +5579,6 @@ interface AriaRequestEventInit extends EventInit { attributeValue?: string; } -interface ClipboardEventInit extends EventInit { - data?: string; - dataType?: string; -} - interface CommandEventInit extends EventInit { commandName?: string; detail?: string; @@ -5486,6 +5592,31 @@ interface ConfirmSiteSpecificExceptionsInformation extends ExceptionInformation arrayOfDomainStrings?: string[]; } +interface ConstrainBooleanParameters { + exact?: boolean; + ideal?: boolean; +} + +interface ConstrainDOMStringParameters { + exact?: string | string[]; + ideal?: string | string[]; +} + +interface ConstrainDoubleRange extends DoubleRange { + exact?: number; + ideal?: number; +} + +interface ConstrainLongRange extends LongRange { + exact?: number; + ideal?: number; +} + +interface ConstrainVideoFacingModeParameters { + exact?: string | string[]; + ideal?: string | string[]; +} + interface CustomEventInit extends EventInit { detail?: any; } @@ -5496,17 +5627,44 @@ interface DeviceAccelerationDict { z?: number; } +interface DeviceLightEventInit extends EventInit { + value?: number; +} + interface DeviceRotationRateDict { alpha?: number; beta?: number; gamma?: number; } +interface DoubleRange { + max?: number; + min?: number; +} + interface EventInit { bubbles?: boolean; cancelable?: boolean; } +interface EventModifierInit extends UIEventInit { + ctrlKey?: boolean; + shiftKey?: boolean; + altKey?: boolean; + metaKey?: boolean; + modifierAltGraph?: boolean; + modifierCapsLock?: boolean; + modifierFn?: boolean; + modifierFnLock?: boolean; + modifierHyper?: boolean; + modifierNumLock?: boolean; + modifierOS?: boolean; + modifierScrollLock?: boolean; + modifierSuper?: boolean; + modifierSymbol?: boolean; + modifierSymbolLock?: boolean; +} + interface ExceptionInformation { domain?: string; } @@ -5520,17 +5678,415 @@ interface HashChangeEventInit extends EventInit { oldURL?: string; } +interface IDBIndexParameters { + multiEntry?: boolean; + unique?: boolean; +} + +interface IDBObjectStoreParameters { + autoIncrement?: boolean; + keyPath?: IDBKeyPath; +} + interface KeyAlgorithm { name?: string; } -interface KeyboardEventInit extends SharedKeyboardAndMouseEventInit { +interface KeyboardEventInit extends EventModifierInit { key?: string; location?: number; repeat?: boolean; } -interface MouseEventInit extends SharedKeyboardAndMouseEventInit { +interface LongRange { + max?: number; + min?: number; +} + +interface MSAccountInfo { + rpDisplayName?: string; + userDisplayName?: string; + accountName?: string; + userId?: string; + accountImageUri?: string; +} + +interface MSAudioLocalClientEvent extends MSLocalClientEventBase { + networkSendQualityEventRatio?: number; + networkDelayEventRatio?: number; + cpuInsufficientEventRatio?: number; + deviceHalfDuplexAECEventRatio?: number; + deviceRenderNotFunctioningEventRatio?: number; + deviceCaptureNotFunctioningEventRatio?: number; + deviceGlitchesEventRatio?: number; + deviceLowSNREventRatio?: number; + deviceLowSpeechLevelEventRatio?: number; + deviceClippingEventRatio?: number; + deviceEchoEventRatio?: number; + deviceNearEndToEchoRatioEventRatio?: number; + deviceRenderZeroVolumeEventRatio?: number; + deviceRenderMuteEventRatio?: number; + deviceMultipleEndpointsEventCount?: number; + deviceHowlingEventCount?: number; +} + +interface MSAudioRecvPayload extends MSPayloadBase { + samplingRate?: number; + signal?: MSAudioRecvSignal; + packetReorderRatio?: number; + packetReorderDepthAvg?: number; + packetReorderDepthMax?: number; + burstLossLength1?: number; + burstLossLength2?: number; + burstLossLength3?: number; + burstLossLength4?: number; + burstLossLength5?: number; + burstLossLength6?: number; + burstLossLength7?: number; + burstLossLength8OrHigher?: number; + fecRecvDistance1?: number; + fecRecvDistance2?: number; + fecRecvDistance3?: number; + ratioConcealedSamplesAvg?: number; + ratioStretchedSamplesAvg?: number; + ratioCompressedSamplesAvg?: number; +} + +interface MSAudioRecvSignal { + initialSignalLevelRMS?: number; + recvSignalLevelCh1?: number; + recvNoiseLevelCh1?: number; + renderSignalLevel?: number; + renderNoiseLevel?: number; + renderLoopbackSignalLevel?: number; +} + +interface MSAudioSendPayload extends MSPayloadBase { + samplingRate?: number; + signal?: MSAudioSendSignal; + audioFECUsed?: boolean; + sendMutePercent?: number; +} + +interface MSAudioSendSignal { + noiseLevel?: number; + sendSignalLevelCh1?: number; + sendNoiseLevelCh1?: number; +} + +interface MSConnectivity { + iceType?: string; + iceWarningFlags?: MSIceWarningFlags; + relayAddress?: MSRelayAddress; +} + +interface MSCredentialFilter { + accept?: MSCredentialSpec[]; +} + +interface MSCredentialParameters { + type?: string; +} + +interface MSCredentialSpec { + type?: string; + id?: string; +} + +interface MSDelay { + roundTrip?: number; + roundTripMax?: number; +} + +interface MSDescription extends RTCStats { + connectivity?: MSConnectivity; + transport?: string; + networkconnectivity?: MSNetworkConnectivityInfo; + localAddr?: MSIPAddressInfo; + remoteAddr?: MSIPAddressInfo; + deviceDevName?: string; + reflexiveLocalIPAddr?: MSIPAddressInfo; +} + +interface MSFIDOCredentialParameters extends MSCredentialParameters { + algorithm?: string | Algorithm; + authenticators?: AAGUID[]; +} + +interface MSIPAddressInfo { + ipAddr?: string; + port?: number; + manufacturerMacAddrMask?: string; +} + +interface MSIceWarningFlags { + turnTcpTimedOut?: boolean; + turnUdpAllocateFailed?: boolean; + turnUdpSendFailed?: boolean; + turnTcpAllocateFailed?: boolean; + turnTcpSendFailed?: boolean; + udpLocalConnectivityFailed?: boolean; + udpNatConnectivityFailed?: boolean; + udpRelayConnectivityFailed?: boolean; + tcpNatConnectivityFailed?: boolean; + tcpRelayConnectivityFailed?: boolean; + connCheckMessageIntegrityFailed?: boolean; + allocationMessageIntegrityFailed?: boolean; + connCheckOtherError?: boolean; + turnAuthUnknownUsernameError?: boolean; + noRelayServersConfigured?: boolean; + multipleRelayServersAttempted?: boolean; + portRangeExhausted?: boolean; + alternateServerReceived?: boolean; + pseudoTLSFailure?: boolean; + turnTurnTcpConnectivityFailed?: boolean; + useCandidateChecksFailed?: boolean; + fipsAllocationFailure?: boolean; +} + +interface MSJitter { + interArrival?: number; + interArrivalMax?: number; + interArrivalSD?: number; +} + +interface MSLocalClientEventBase extends RTCStats { + networkReceiveQualityEventRatio?: number; + networkBandwidthLowEventRatio?: number; +} + +interface MSNetwork extends RTCStats { + jitter?: MSJitter; + delay?: MSDelay; + packetLoss?: MSPacketLoss; + utilization?: MSUtilization; +} + +interface MSNetworkConnectivityInfo { + vpn?: boolean; + linkspeed?: number; + networkConnectionDetails?: string; +} + +interface MSNetworkInterfaceType { + interfaceTypeEthernet?: boolean; + interfaceTypeWireless?: boolean; + interfaceTypePPP?: boolean; + interfaceTypeTunnel?: boolean; + interfaceTypeWWAN?: boolean; +} + +interface MSOutboundNetwork extends MSNetwork { + appliedBandwidthLimit?: number; +} + +interface MSPacketLoss { + lossRate?: number; + lossRateMax?: number; +} + +interface MSPayloadBase extends RTCStats { + payloadDescription?: string; +} + +interface MSRelayAddress { + relayAddress?: string; + port?: number; +} + +interface MSSignatureParameters { + userPrompt?: string; +} + +interface MSTransportDiagnosticsStats extends RTCStats { + baseAddress?: string; + localAddress?: string; + localSite?: string; + networkName?: string; + remoteAddress?: string; + remoteSite?: string; + localMR?: string; + remoteMR?: string; + iceWarningFlags?: MSIceWarningFlags; + portRangeMin?: number; + portRangeMax?: number; + localMRTCPPort?: number; + remoteMRTCPPort?: number; + stunVer?: number; + numConsentReqSent?: number; + numConsentReqReceived?: number; + numConsentRespSent?: number; + numConsentRespReceived?: number; + interfaces?: MSNetworkInterfaceType; + baseInterface?: MSNetworkInterfaceType; + protocol?: string; + localInterface?: MSNetworkInterfaceType; + localAddrType?: string; + remoteAddrType?: string; + iceRole?: string; + rtpRtcpMux?: boolean; + allocationTimeInMs?: number; + msRtcEngineVersion?: string; +} + +interface MSUtilization { + packets?: number; + bandwidthEstimation?: number; + bandwidthEstimationMin?: number; + bandwidthEstimationMax?: number; + bandwidthEstimationStdDev?: number; + bandwidthEstimationAvg?: number; +} + +interface MSVideoPayload extends MSPayloadBase { + resoluton?: string; + videoBitRateAvg?: number; + videoBitRateMax?: number; + videoFrameRateAvg?: number; + videoPacketLossRate?: number; + durationSeconds?: number; +} + +interface MSVideoRecvPayload extends MSVideoPayload { + videoFrameLossRate?: number; + recvCodecType?: string; + recvResolutionWidth?: number; + recvResolutionHeight?: number; + videoResolutions?: MSVideoResolutionDistribution; + recvFrameRateAverage?: number; + recvBitRateMaximum?: number; + recvBitRateAverage?: number; + recvVideoStreamsMax?: number; + recvVideoStreamsMin?: number; + recvVideoStreamsMode?: number; + videoPostFECPLR?: number; + lowBitRateCallPercent?: number; + lowFrameRateCallPercent?: number; + reorderBufferTotalPackets?: number; + recvReorderBufferReorderedPackets?: number; + recvReorderBufferPacketsDroppedDueToBufferExhaustion?: number; + recvReorderBufferMaxSuccessfullyOrderedExtent?: number; + recvReorderBufferMaxSuccessfullyOrderedLateTime?: number; + recvReorderBufferPacketsDroppedDueToTimeout?: number; + recvFpsHarmonicAverage?: number; + recvNumResSwitches?: number; +} + +interface MSVideoResolutionDistribution { + cifQuality?: number; + vgaQuality?: number; + h720Quality?: number; + h1080Quality?: number; + h1440Quality?: number; + h2160Quality?: number; +} + +interface MSVideoSendPayload extends MSVideoPayload { + sendFrameRateAverage?: number; + sendBitRateMaximum?: number; + sendBitRateAverage?: number; + sendVideoStreamsMax?: number; + sendResolutionWidth?: number; + sendResolutionHeight?: number; +} + +interface MediaEncryptedEventInit extends EventInit { + initDataType?: string; + initData?: ArrayBuffer; +} + +interface MediaKeyMessageEventInit extends EventInit { + messageType?: string; + message?: ArrayBuffer; +} + +interface MediaKeySystemConfiguration { + initDataTypes?: string[]; + audioCapabilities?: MediaKeySystemMediaCapability[]; + videoCapabilities?: MediaKeySystemMediaCapability[]; + distinctiveIdentifier?: string; + persistentState?: string; +} + +interface MediaKeySystemMediaCapability { + contentType?: string; + robustness?: string; +} + +interface MediaStreamConstraints { + video?: boolean | MediaTrackConstraints; + audio?: boolean | MediaTrackConstraints; +} + +interface MediaStreamErrorEventInit extends EventInit { + error?: MediaStreamError; +} + +interface MediaStreamTrackEventInit extends EventInit { + track?: MediaStreamTrack; +} + +interface MediaTrackCapabilities { + width?: number | LongRange; + height?: number | LongRange; + aspectRatio?: number | DoubleRange; + frameRate?: number | DoubleRange; + facingMode?: string; + volume?: number | DoubleRange; + sampleRate?: number | LongRange; + sampleSize?: number | LongRange; + echoCancellation?: boolean[]; + deviceId?: string; + groupId?: string; +} + +interface MediaTrackConstraintSet { + width?: number | ConstrainLongRange; + height?: number | ConstrainLongRange; + aspectRatio?: number | ConstrainDoubleRange; + frameRate?: number | ConstrainDoubleRange; + facingMode?: string | string[] | ConstrainDOMStringParameters; + volume?: number | ConstrainDoubleRange; + sampleRate?: number | ConstrainLongRange; + sampleSize?: number | ConstrainLongRange; + echoCancelation?: boolean | ConstrainBooleanParameters; + deviceId?: string | string[] | ConstrainDOMStringParameters; + groupId?: string | string[] | ConstrainDOMStringParameters; +} + +interface MediaTrackConstraints extends MediaTrackConstraintSet { + advanced?: MediaTrackConstraintSet[]; +} + +interface MediaTrackSettings { + width?: number; + height?: number; + aspectRatio?: number; + frameRate?: number; + facingMode?: string; + volume?: number; + sampleRate?: number; + sampleSize?: number; + echoCancellation?: boolean; + deviceId?: string; + groupId?: string; +} + +interface MediaTrackSupportedConstraints { + width?: boolean; + height?: boolean; + aspectRatio?: boolean; + frameRate?: boolean; + facingMode?: boolean; + volume?: boolean; + sampleRate?: boolean; + sampleSize?: boolean; + echoCancellation?: boolean; + deviceId?: boolean; + groupId?: boolean; +} + +interface MouseEventInit extends EventModifierInit { screenX?: number; screenY?: number; clientX?: number; @@ -5563,6 +6119,10 @@ interface ObjectURLOptions { oneTimeOnly?: boolean; } +interface PeriodicWaveConstraints { + disableNormalization?: boolean; +} + interface PointerEventInit extends MouseEventInit { pointerId?: number; width?: number; @@ -5580,22 +6140,266 @@ interface PositionOptions { maximumAge?: number; } -interface SharedKeyboardAndMouseEventInit extends UIEventInit { - ctrlKey?: boolean; - shiftKey?: boolean; - altKey?: boolean; - metaKey?: boolean; - keyModifierStateAltGraph?: boolean; - keyModifierStateCapsLock?: boolean; - keyModifierStateFn?: boolean; - keyModifierStateFnLock?: boolean; - keyModifierStateHyper?: boolean; - keyModifierStateNumLock?: boolean; - keyModifierStateOS?: boolean; - keyModifierStateScrollLock?: boolean; - keyModifierStateSuper?: boolean; - keyModifierStateSymbol?: boolean; - keyModifierStateSymbolLock?: boolean; +interface RTCDTMFToneChangeEventInit extends EventInit { + tone?: string; +} + +interface RTCDtlsFingerprint { + algorithm?: string; + value?: string; +} + +interface RTCDtlsParameters { + role?: string; + fingerprints?: RTCDtlsFingerprint[]; +} + +interface RTCIceCandidate { + foundation?: string; + priority?: number; + ip?: string; + protocol?: string; + port?: number; + type?: string; + tcpType?: string; + relatedAddress?: string; + relatedPort?: number; +} + +interface RTCIceCandidateAttributes extends RTCStats { + ipAddress?: string; + portNumber?: number; + transport?: string; + candidateType?: string; + priority?: number; + addressSourceUrl?: string; +} + +interface RTCIceCandidateComplete { +} + +interface RTCIceCandidatePair { + local?: RTCIceCandidate; + remote?: RTCIceCandidate; +} + +interface RTCIceCandidatePairStats extends RTCStats { + transportId?: string; + localCandidateId?: string; + remoteCandidateId?: string; + state?: string; + priority?: number; + nominated?: boolean; + writable?: boolean; + readable?: boolean; + bytesSent?: number; + bytesReceived?: number; + roundTripTime?: number; + availableOutgoingBitrate?: number; + availableIncomingBitrate?: number; +} + +interface RTCIceGatherOptions { + gatherPolicy?: string; + iceservers?: RTCIceServer[]; +} + +interface RTCIceParameters { + usernameFragment?: string; + password?: string; +} + +interface RTCIceServer { + urls?: any; + username?: string; + credential?: string; +} + +interface RTCInboundRTPStreamStats extends RTCRTPStreamStats { + packetsReceived?: number; + bytesReceived?: number; + packetsLost?: number; + jitter?: number; + fractionLost?: number; +} + +interface RTCMediaStreamTrackStats extends RTCStats { + trackIdentifier?: string; + remoteSource?: boolean; + ssrcIds?: string[]; + frameWidth?: number; + frameHeight?: number; + framesPerSecond?: number; + framesSent?: number; + framesReceived?: number; + framesDecoded?: number; + framesDropped?: number; + framesCorrupted?: number; + audioLevel?: number; + echoReturnLoss?: number; + echoReturnLossEnhancement?: number; +} + +interface RTCOutboundRTPStreamStats extends RTCRTPStreamStats { + packetsSent?: number; + bytesSent?: number; + targetBitrate?: number; + roundTripTime?: number; +} + +interface RTCRTPStreamStats extends RTCStats { + ssrc?: string; + associateStatsId?: string; + isRemote?: boolean; + mediaTrackId?: string; + transportId?: string; + codecId?: string; + firCount?: number; + pliCount?: number; + nackCount?: number; + sliCount?: number; +} + +interface RTCRtcpFeedback { + type?: string; + parameter?: string; +} + +interface RTCRtcpParameters { + ssrc?: number; + cname?: string; + reducedSize?: boolean; + mux?: boolean; +} + +interface RTCRtpCapabilities { + codecs?: RTCRtpCodecCapability[]; + headerExtensions?: RTCRtpHeaderExtension[]; + fecMechanisms?: string[]; +} + +interface RTCRtpCodecCapability { + name?: string; + kind?: string; + clockRate?: number; + preferredPayloadType?: number; + maxptime?: number; + numChannels?: number; + rtcpFeedback?: RTCRtcpFeedback[]; + parameters?: any; + options?: any; + maxTemporalLayers?: number; + maxSpatialLayers?: number; + svcMultiStreamSupport?: boolean; +} + +interface RTCRtpCodecParameters { + name?: string; + payloadType?: any; + clockRate?: number; + maxptime?: number; + numChannels?: number; + rtcpFeedback?: RTCRtcpFeedback[]; + parameters?: any; +} + +interface RTCRtpContributingSource { + timestamp?: number; + csrc?: number; + audioLevel?: number; +} + +interface RTCRtpEncodingParameters { + ssrc?: number; + codecPayloadType?: number; + fec?: RTCRtpFecParameters; + rtx?: RTCRtpRtxParameters; + priority?: number; + maxBitrate?: number; + minQuality?: number; + framerateBias?: number; + resolutionScale?: number; + framerateScale?: number; + active?: boolean; + encodingId?: string; + dependencyEncodingIds?: string[]; + ssrcRange?: RTCSsrcRange; +} + +interface RTCRtpFecParameters { + ssrc?: number; + mechanism?: string; +} + +interface RTCRtpHeaderExtension { + kind?: string; + uri?: string; + preferredId?: number; + preferredEncrypt?: boolean; +} + +interface RTCRtpHeaderExtensionParameters { + uri?: string; + id?: number; + encrypt?: boolean; +} + +interface RTCRtpParameters { + muxId?: string; + codecs?: RTCRtpCodecParameters[]; + headerExtensions?: RTCRtpHeaderExtensionParameters[]; + encodings?: RTCRtpEncodingParameters[]; + rtcp?: RTCRtcpParameters; +} + +interface RTCRtpRtxParameters { + ssrc?: number; +} + +interface RTCRtpUnhandled { + ssrc?: number; + payloadType?: number; + muxId?: string; +} + +interface RTCSrtpKeyParam { + keyMethod?: string; + keySalt?: string; + lifetime?: string; + mkiValue?: number; + mkiLength?: number; +} + +interface RTCSrtpSdesParameters { + tag?: number; + cryptoSuite?: string; + keyParams?: RTCSrtpKeyParam[]; + sessionParams?: string[]; +} + +interface RTCSsrcRange { + min?: number; + max?: number; +} + +interface RTCStats { + timestamp?: number; + type?: string; + id?: string; + msType?: string; +} + +interface RTCStatsReport { +} + +interface RTCTransportStats extends RTCStats { + bytesSent?: number; + bytesReceived?: number; + rtcpTransportStatsId?: string; + activeConnection?: boolean; + selectedCandidatePairId?: string; + localCertificateId?: string; + remoteCertificateId?: string; } interface StoreExceptionsInformation extends ExceptionInformation { @@ -5641,18 +6445,18 @@ interface ANGLE_instanced_arrays { drawArraysInstancedANGLE(mode: number, first: number, count: number, primcount: number): void; drawElementsInstancedANGLE(mode: number, count: number, type: number, offset: number, primcount: number): void; vertexAttribDivisorANGLE(index: number, divisor: number): void; - VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE: number; + readonly VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE: number; } declare var ANGLE_instanced_arrays: { prototype: ANGLE_instanced_arrays; new(): ANGLE_instanced_arrays; - VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE: number; + readonly VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE: number; } interface AnalyserNode extends AudioNode { fftSize: number; - frequencyBinCount: number; + readonly frequencyBinCount: number; maxDecibels: number; minDecibels: number; smoothingTimeConstant: number; @@ -5668,8 +6472,8 @@ declare var AnalyserNode: { } interface AnimationEvent extends Event { - animationName: string; - elapsedTime: number; + readonly animationName: string; + readonly elapsedTime: number; initAnimationEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, animationNameArg: string, elapsedTimeArg: number): void; } @@ -5687,16 +6491,16 @@ interface ApplicationCache extends EventTarget { onobsolete: (ev: Event) => any; onprogress: (ev: ProgressEvent) => any; onupdateready: (ev: Event) => any; - status: number; + readonly status: number; abort(): void; swapCache(): void; update(): void; - CHECKING: number; - DOWNLOADING: number; - IDLE: number; - OBSOLETE: number; - UNCACHED: number; - UPDATEREADY: number; + readonly CHECKING: number; + readonly DOWNLOADING: number; + readonly IDLE: number; + readonly OBSOLETE: number; + readonly UNCACHED: number; + readonly UPDATEREADY: number; addEventListener(type: "cached", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "checking", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "downloading", listener: (ev: Event) => any, useCapture?: boolean): void; @@ -5711,16 +6515,16 @@ interface ApplicationCache extends EventTarget { declare var ApplicationCache: { prototype: ApplicationCache; new(): ApplicationCache; - CHECKING: number; - DOWNLOADING: number; - IDLE: number; - OBSOLETE: number; - UNCACHED: number; - UPDATEREADY: number; + readonly CHECKING: number; + readonly DOWNLOADING: number; + readonly IDLE: number; + readonly OBSOLETE: number; + readonly UNCACHED: number; + readonly UPDATEREADY: number; } interface AriaRequestEvent extends Event { - attributeName: string; + readonly attributeName: string; attributeValue: string; } @@ -5730,9 +6534,10 @@ declare var AriaRequestEvent: { } interface Attr extends Node { - name: string; - ownerElement: Element; - specified: boolean; + readonly name: string; + readonly ownerElement: Element; + readonly prefix: string; + readonly specified: boolean; value: string; } @@ -5742,10 +6547,12 @@ declare var Attr: { } interface AudioBuffer { - duration: number; - length: number; - numberOfChannels: number; - sampleRate: number; + readonly duration: number; + readonly length: number; + readonly numberOfChannels: number; + readonly sampleRate: number; + copyFromChannel(destination: Float32Array, channelNumber: number, startInChannel?: number): void; + copyToChannel(source: Float32Array, channelNumber: number, startInChannel?: number): void; getChannelData(channel: number): Float32Array; } @@ -5756,14 +6563,15 @@ declare var AudioBuffer: { interface AudioBufferSourceNode extends AudioNode { buffer: AudioBuffer; + readonly detune: AudioParam; loop: boolean; loopEnd: number; loopStart: number; - onended: (ev: Event) => any; - playbackRate: AudioParam; + onended: (ev: MediaStreamErrorEvent) => any; + readonly playbackRate: AudioParam; start(when?: number, offset?: number, duration?: number): void; stop(when?: number): void; - addEventListener(type: "ended", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "ended", listener: (ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -5773,10 +6581,10 @@ declare var AudioBufferSourceNode: { } interface AudioContext extends EventTarget { - currentTime: number; - destination: AudioDestinationNode; - listener: AudioListener; - sampleRate: number; + readonly currentTime: number; + readonly destination: AudioDestinationNode; + readonly listener: AudioListener; + readonly sampleRate: number; state: string; createAnalyser(): AnalyserNode; createBiquadFilter(): BiquadFilterNode; @@ -5789,13 +6597,14 @@ interface AudioContext extends EventTarget { createDynamicsCompressor(): DynamicsCompressorNode; createGain(): GainNode; createMediaElementSource(mediaElement: HTMLMediaElement): MediaElementAudioSourceNode; + createMediaStreamSource(mediaStream: MediaStream): MediaStreamAudioSourceNode; createOscillator(): OscillatorNode; createPanner(): PannerNode; - createPeriodicWave(real: Float32Array, imag: Float32Array): PeriodicWave; + createPeriodicWave(real: Float32Array, imag: Float32Array, constraints?: PeriodicWaveConstraints): PeriodicWave; createScriptProcessor(bufferSize?: number, numberOfInputChannels?: number, numberOfOutputChannels?: number): ScriptProcessorNode; createStereoPanner(): StereoPannerNode; createWaveShaper(): WaveShaperNode; - decodeAudioData(audioData: ArrayBuffer, successCallback: DecodeSuccessCallback, errorCallback?: DecodeErrorCallback): void; + decodeAudioData(audioData: ArrayBuffer, successCallback?: DecodeSuccessCallback, errorCallback?: DecodeErrorCallback): PromiseLike; } declare var AudioContext: { @@ -5804,7 +6613,7 @@ declare var AudioContext: { } interface AudioDestinationNode extends AudioNode { - maxChannelCount: number; + readonly maxChannelCount: number; } declare var AudioDestinationNode: { @@ -5829,9 +6638,9 @@ interface AudioNode extends EventTarget { channelCount: number; channelCountMode: string; channelInterpretation: string; - context: AudioContext; - numberOfInputs: number; - numberOfOutputs: number; + readonly context: AudioContext; + readonly numberOfInputs: number; + readonly numberOfOutputs: number; connect(destination: AudioNode, output?: number, input?: number): void; disconnect(output?: number): void; disconnect(destination: AudioNode, output?: number, input?: number): void; @@ -5844,7 +6653,7 @@ declare var AudioNode: { } interface AudioParam { - defaultValue: number; + readonly defaultValue: number; value: number; cancelScheduledValues(startTime: number): void; exponentialRampToValueAtTime(value: number, endTime: number): void; @@ -5860,9 +6669,9 @@ declare var AudioParam: { } interface AudioProcessingEvent extends Event { - inputBuffer: AudioBuffer; - outputBuffer: AudioBuffer; - playbackTime: number; + readonly inputBuffer: AudioBuffer; + readonly outputBuffer: AudioBuffer; + readonly playbackTime: number; } declare var AudioProcessingEvent: { @@ -5872,11 +6681,11 @@ declare var AudioProcessingEvent: { interface AudioTrack { enabled: boolean; - id: string; + readonly id: string; kind: string; - label: string; + readonly label: string; language: string; - sourceBuffer: SourceBuffer; + readonly sourceBuffer: SourceBuffer; } declare var AudioTrack: { @@ -5885,7 +6694,7 @@ declare var AudioTrack: { } interface AudioTrackList extends EventTarget { - length: number; + readonly length: number; onaddtrack: (ev: TrackEvent) => any; onchange: (ev: Event) => any; onremovetrack: (ev: TrackEvent) => any; @@ -5904,7 +6713,7 @@ declare var AudioTrackList: { } interface BarProp { - visible: boolean; + readonly visible: boolean; } declare var BarProp: { @@ -5922,10 +6731,10 @@ declare var BeforeUnloadEvent: { } interface BiquadFilterNode extends AudioNode { - Q: AudioParam; - detune: AudioParam; - frequency: AudioParam; - gain: AudioParam; + readonly Q: AudioParam; + readonly detune: AudioParam; + readonly frequency: AudioParam; + readonly gain: AudioParam; type: string; getFrequencyResponse(frequencyHz: Float32Array, magResponse: Float32Array, phaseResponse: Float32Array): void; } @@ -5936,8 +6745,8 @@ declare var BiquadFilterNode: { } interface Blob { - size: number; - type: string; + readonly size: number; + readonly type: string; msClose(): void; msDetachStream(): any; slice(start?: number, end?: number, contentType?: string): Blob; @@ -5971,7 +6780,7 @@ declare var CSSConditionRule: { } interface CSSFontFaceRule extends CSSRule { - style: CSSStyleDeclaration; + readonly style: CSSStyleDeclaration; } declare var CSSFontFaceRule: { @@ -5980,9 +6789,9 @@ declare var CSSFontFaceRule: { } interface CSSGroupingRule extends CSSRule { - cssRules: CSSRuleList; - deleteRule(index?: number): void; - insertRule(rule: string, index?: number): number; + readonly cssRules: CSSRuleList; + deleteRule(index: number): void; + insertRule(rule: string, index: number): number; } declare var CSSGroupingRule: { @@ -5991,9 +6800,9 @@ declare var CSSGroupingRule: { } interface CSSImportRule extends CSSRule { - href: string; - media: MediaList; - styleSheet: CSSStyleSheet; + readonly href: string; + readonly media: MediaList; + readonly styleSheet: CSSStyleSheet; } declare var CSSImportRule: { @@ -6003,7 +6812,7 @@ declare var CSSImportRule: { interface CSSKeyframeRule extends CSSRule { keyText: string; - style: CSSStyleDeclaration; + readonly style: CSSStyleDeclaration; } declare var CSSKeyframeRule: { @@ -6012,7 +6821,7 @@ declare var CSSKeyframeRule: { } interface CSSKeyframesRule extends CSSRule { - cssRules: CSSRuleList; + readonly cssRules: CSSRuleList; name: string; appendRule(rule: string): void; deleteRule(rule: string): void; @@ -6025,7 +6834,7 @@ declare var CSSKeyframesRule: { } interface CSSMediaRule extends CSSConditionRule { - media: MediaList; + readonly media: MediaList; } declare var CSSMediaRule: { @@ -6034,8 +6843,8 @@ declare var CSSMediaRule: { } interface CSSNamespaceRule extends CSSRule { - namespaceURI: string; - prefix: string; + readonly namespaceURI: string; + readonly prefix: string; } declare var CSSNamespaceRule: { @@ -6044,10 +6853,10 @@ declare var CSSNamespaceRule: { } interface CSSPageRule extends CSSRule { - pseudoClass: string; - selector: string; + readonly pseudoClass: string; + readonly selector: string; selectorText: string; - style: CSSStyleDeclaration; + readonly style: CSSStyleDeclaration; } declare var CSSPageRule: { @@ -6057,42 +6866,42 @@ declare var CSSPageRule: { interface CSSRule { cssText: string; - parentRule: CSSRule; - parentStyleSheet: CSSStyleSheet; - type: number; - CHARSET_RULE: number; - FONT_FACE_RULE: number; - IMPORT_RULE: number; - KEYFRAMES_RULE: number; - KEYFRAME_RULE: number; - MEDIA_RULE: number; - NAMESPACE_RULE: number; - PAGE_RULE: number; - STYLE_RULE: number; - SUPPORTS_RULE: number; - UNKNOWN_RULE: number; - VIEWPORT_RULE: number; + readonly parentRule: CSSRule; + readonly parentStyleSheet: CSSStyleSheet; + readonly type: number; + readonly CHARSET_RULE: number; + readonly FONT_FACE_RULE: number; + readonly IMPORT_RULE: number; + readonly KEYFRAMES_RULE: number; + readonly KEYFRAME_RULE: number; + readonly MEDIA_RULE: number; + readonly NAMESPACE_RULE: number; + readonly PAGE_RULE: number; + readonly STYLE_RULE: number; + readonly SUPPORTS_RULE: number; + readonly UNKNOWN_RULE: number; + readonly VIEWPORT_RULE: number; } declare var CSSRule: { prototype: CSSRule; new(): CSSRule; - CHARSET_RULE: number; - FONT_FACE_RULE: number; - IMPORT_RULE: number; - KEYFRAMES_RULE: number; - KEYFRAME_RULE: number; - MEDIA_RULE: number; - NAMESPACE_RULE: number; - PAGE_RULE: number; - STYLE_RULE: number; - SUPPORTS_RULE: number; - UNKNOWN_RULE: number; - VIEWPORT_RULE: number; + readonly CHARSET_RULE: number; + readonly FONT_FACE_RULE: number; + readonly IMPORT_RULE: number; + readonly KEYFRAMES_RULE: number; + readonly KEYFRAME_RULE: number; + readonly MEDIA_RULE: number; + readonly NAMESPACE_RULE: number; + readonly PAGE_RULE: number; + readonly STYLE_RULE: number; + readonly SUPPORTS_RULE: number; + readonly UNKNOWN_RULE: number; + readonly VIEWPORT_RULE: number; } interface CSSRuleList { - length: number; + readonly length: number; item(index: number): CSSRule; [index: number]: CSSRule; } @@ -6225,7 +7034,7 @@ interface CSSStyleDeclaration { justifyContent: string; kerning: string; left: string; - length: number; + readonly length: number; letterSpacing: string; lightingColor: string; lineHeight: string; @@ -6312,7 +7121,7 @@ interface CSSStyleDeclaration { pageBreakAfter: string; pageBreakBefore: string; pageBreakInside: string; - parentRule: CSSRule; + readonly parentRule: CSSRule; perspective: string; perspectiveOrigin: string; pointerEvents: string; @@ -6337,7 +7146,6 @@ interface CSSStyleDeclaration { textAlignLast: string; textAnchor: string; textDecoration: string; - textFillColor: string; textIndent: string; textJustify: string; textKashida: string; @@ -6373,25 +7181,12 @@ interface CSSStyleDeclaration { webkitAnimationTimingFunction: string; webkitAppearance: string; webkitBackfaceVisibility: string; - webkitBackground: string; - webkitBackgroundAttachment: string; webkitBackgroundClip: string; - webkitBackgroundColor: string; - webkitBackgroundImage: string; webkitBackgroundOrigin: string; - webkitBackgroundPosition: string; - webkitBackgroundPositionX: string; - webkitBackgroundPositionY: string; - webkitBackgroundRepeat: string; webkitBackgroundSize: string; webkitBorderBottomLeftRadius: string; webkitBorderBottomRightRadius: string; webkitBorderImage: string; - webkitBorderImageOutset: string; - webkitBorderImageRepeat: string; - webkitBorderImageSlice: string; - webkitBorderImageSource: string; - webkitBorderImageWidth: string; webkitBorderRadius: string; webkitBorderTopLeftRadius: string; webkitBorderTopRightRadius: string; @@ -6437,6 +7232,7 @@ interface CSSStyleDeclaration { webkitTransitionDuration: string; webkitTransitionProperty: string; webkitTransitionTimingFunction: string; + webkitUserModify: string; webkitUserSelect: string; webkitWritingMode: string; whiteSpace: string; @@ -6462,9 +7258,9 @@ declare var CSSStyleDeclaration: { } interface CSSStyleRule extends CSSRule { - readOnly: boolean; + readonly readOnly: boolean; selectorText: string; - style: CSSStyleDeclaration; + readonly style: CSSStyleDeclaration; } declare var CSSStyleRule: { @@ -6473,18 +7269,18 @@ declare var CSSStyleRule: { } interface CSSStyleSheet extends StyleSheet { - cssRules: CSSRuleList; + readonly cssRules: CSSRuleList; cssText: string; - href: string; - id: string; - imports: StyleSheetList; - isAlternate: boolean; - isPrefAlternate: boolean; - ownerRule: CSSRule; - owningElement: Element; - pages: StyleSheetPageList; - readOnly: boolean; - rules: CSSRuleList; + readonly href: string; + readonly id: string; + readonly imports: StyleSheetList; + readonly isAlternate: boolean; + readonly isPrefAlternate: boolean; + readonly ownerRule: CSSRule; + readonly owningElement: Element; + readonly pages: StyleSheetPageList; + readonly readOnly: boolean; + readonly rules: CSSRuleList; addImport(bstrURL: string, lIndex?: number): number; addPageRule(bstrSelector: string, bstrStyle: string, lIndex?: number): number; addRule(bstrSelector: string, bstrStyle?: string, lIndex?: number): number; @@ -6524,8 +7320,8 @@ declare var CanvasPattern: { new(): CanvasPattern; } -interface CanvasRenderingContext2D { - canvas: HTMLCanvasElement; +interface CanvasRenderingContext2D extends Object, CanvasPathMethods { + readonly canvas: HTMLCanvasElement; fillStyle: string | CanvasGradient | CanvasPattern; font: string; globalAlpha: number; @@ -6544,13 +7340,9 @@ interface CanvasRenderingContext2D { strokeStyle: string | CanvasGradient | CanvasPattern; textAlign: string; textBaseline: string; - arc(x: number, y: number, radius: number, startAngle: number, endAngle: number, anticlockwise?: boolean): void; - arcTo(x1: number, y1: number, x2: number, y2: number, radius: number): void; beginPath(): void; - bezierCurveTo(cp1x: number, cp1y: number, cp2x: number, cp2y: number, x: number, y: number): void; clearRect(x: number, y: number, w: number, h: number): void; clip(fillRule?: string): void; - closePath(): void; createImageData(imageDataOrSw: number | ImageData, sh?: number): ImageData; createLinearGradient(x0: number, y0: number, x1: number, y1: number): CanvasGradient; createPattern(image: HTMLImageElement | HTMLCanvasElement | HTMLVideoElement, repetition: string): CanvasPattern; @@ -6562,12 +7354,8 @@ interface CanvasRenderingContext2D { getImageData(sx: number, sy: number, sw: number, sh: number): ImageData; getLineDash(): number[]; isPointInPath(x: number, y: number, fillRule?: string): boolean; - lineTo(x: number, y: number): void; measureText(text: string): TextMetrics; - moveTo(x: number, y: number): void; putImageData(imagedata: ImageData, dx: number, dy: number, dirtyX?: number, dirtyY?: number, dirtyWidth?: number, dirtyHeight?: number): void; - quadraticCurveTo(cpx: number, cpy: number, x: number, y: number): void; - rect(x: number, y: number, w: number, h: number): void; restore(): void; rotate(angle: number): void; save(): void; @@ -6604,7 +7392,7 @@ declare var ChannelSplitterNode: { interface CharacterData extends Node, ChildNode { data: string; - length: number; + readonly length: number; appendData(arg: string): void; deleteData(offset: number, count: number): void; insertData(offset: number, arg: string): void; @@ -6620,11 +7408,11 @@ declare var CharacterData: { interface ClientRect { bottom: number; - height: number; + readonly height: number; left: number; right: number; top: number; - width: number; + readonly width: number; } declare var ClientRect: { @@ -6633,7 +7421,7 @@ declare var ClientRect: { } interface ClientRectList { - length: number; + readonly length: number; item(index: number): ClientRect; [index: number]: ClientRect; } @@ -6644,7 +7432,7 @@ declare var ClientRectList: { } interface ClipboardEvent extends Event { - clipboardData: DataTransfer; + readonly clipboardData: DataTransfer; } declare var ClipboardEvent: { @@ -6653,9 +7441,9 @@ declare var ClipboardEvent: { } interface CloseEvent extends Event { - code: number; - reason: string; - wasClean: boolean; + readonly code: number; + readonly reason: string; + readonly wasClean: boolean; initCloseEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, wasCleanArg: boolean, codeArg: number, reasonArg: string): void; } @@ -6665,8 +7453,8 @@ declare var CloseEvent: { } interface CommandEvent extends Event { - commandName: string; - detail: string; + readonly commandName: string; + readonly detail: string; } declare var CommandEvent: { @@ -6684,8 +7472,8 @@ declare var Comment: { } interface CompositionEvent extends UIEvent { - data: string; - locale: string; + readonly data: string; + readonly locale: string; initCompositionEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, dataArg: string, locale: string): void; } @@ -6702,6 +7490,7 @@ interface Console { dir(value?: any, ...optionalParams: any[]): void; dirxml(value: any): void; error(message?: any, ...optionalParams: any[]): void; + exception(message?: string, ...optionalParams: any[]): void; group(groupTitle?: string): void; groupCollapsed(groupTitle?: string): void; groupEnd(): void; @@ -6711,6 +7500,7 @@ interface Console { profile(reportName?: string): void; profileEnd(): void; select(element: Element): void; + table(...data: any[]): void; time(timerName?: string): void; timeEnd(timerName?: string): void; trace(message?: any, ...optionalParams: any[]): void; @@ -6733,13 +7523,13 @@ declare var ConvolverNode: { } interface Coordinates { - accuracy: number; - altitude: number; - altitudeAccuracy: number; - heading: number; - latitude: number; - longitude: number; - speed: number; + readonly accuracy: number; + readonly altitude: number; + readonly altitudeAccuracy: number; + readonly heading: number; + readonly latitude: number; + readonly longitude: number; + readonly speed: number; } declare var Coordinates: { @@ -6748,7 +7538,7 @@ declare var Coordinates: { } interface Crypto extends Object, RandomSource { - subtle: SubtleCrypto; + readonly subtle: SubtleCrypto; } declare var Crypto: { @@ -6757,10 +7547,10 @@ declare var Crypto: { } interface CryptoKey { - algorithm: KeyAlgorithm; - extractable: boolean; - type: string; - usages: string[]; + readonly algorithm: KeyAlgorithm; + readonly extractable: boolean; + readonly type: string; + readonly usages: string[]; } declare var CryptoKey: { @@ -6779,7 +7569,7 @@ declare var CryptoKeyPair: { } interface CustomEvent extends Event { - detail: any; + readonly detail: any; initCustomEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, detailArg: any): void; } @@ -6789,7 +7579,7 @@ declare var CustomEvent: { } interface DOMError { - name: string; + readonly name: string; toString(): string; } @@ -6799,69 +7589,69 @@ declare var DOMError: { } interface DOMException { - code: number; - message: string; - name: string; + readonly code: number; + readonly message: string; + readonly name: string; toString(): string; - ABORT_ERR: number; - DATA_CLONE_ERR: number; - DOMSTRING_SIZE_ERR: number; - HIERARCHY_REQUEST_ERR: number; - INDEX_SIZE_ERR: number; - INUSE_ATTRIBUTE_ERR: number; - INVALID_ACCESS_ERR: number; - INVALID_CHARACTER_ERR: number; - INVALID_MODIFICATION_ERR: number; - INVALID_NODE_TYPE_ERR: number; - INVALID_STATE_ERR: number; - NAMESPACE_ERR: number; - NETWORK_ERR: number; - NOT_FOUND_ERR: number; - NOT_SUPPORTED_ERR: number; - NO_DATA_ALLOWED_ERR: number; - NO_MODIFICATION_ALLOWED_ERR: number; - PARSE_ERR: number; - QUOTA_EXCEEDED_ERR: number; - SECURITY_ERR: number; - SERIALIZE_ERR: number; - SYNTAX_ERR: number; - TIMEOUT_ERR: number; - TYPE_MISMATCH_ERR: number; - URL_MISMATCH_ERR: number; - VALIDATION_ERR: number; - WRONG_DOCUMENT_ERR: number; + readonly ABORT_ERR: number; + readonly DATA_CLONE_ERR: number; + readonly DOMSTRING_SIZE_ERR: number; + readonly HIERARCHY_REQUEST_ERR: number; + readonly INDEX_SIZE_ERR: number; + readonly INUSE_ATTRIBUTE_ERR: number; + readonly INVALID_ACCESS_ERR: number; + readonly INVALID_CHARACTER_ERR: number; + readonly INVALID_MODIFICATION_ERR: number; + readonly INVALID_NODE_TYPE_ERR: number; + readonly INVALID_STATE_ERR: number; + readonly NAMESPACE_ERR: number; + readonly NETWORK_ERR: number; + readonly NOT_FOUND_ERR: number; + readonly NOT_SUPPORTED_ERR: number; + readonly NO_DATA_ALLOWED_ERR: number; + readonly NO_MODIFICATION_ALLOWED_ERR: number; + readonly PARSE_ERR: number; + readonly QUOTA_EXCEEDED_ERR: number; + readonly SECURITY_ERR: number; + readonly SERIALIZE_ERR: number; + readonly SYNTAX_ERR: number; + readonly TIMEOUT_ERR: number; + readonly TYPE_MISMATCH_ERR: number; + readonly URL_MISMATCH_ERR: number; + readonly VALIDATION_ERR: number; + readonly WRONG_DOCUMENT_ERR: number; } declare var DOMException: { prototype: DOMException; new(): DOMException; - ABORT_ERR: number; - DATA_CLONE_ERR: number; - DOMSTRING_SIZE_ERR: number; - HIERARCHY_REQUEST_ERR: number; - INDEX_SIZE_ERR: number; - INUSE_ATTRIBUTE_ERR: number; - INVALID_ACCESS_ERR: number; - INVALID_CHARACTER_ERR: number; - INVALID_MODIFICATION_ERR: number; - INVALID_NODE_TYPE_ERR: number; - INVALID_STATE_ERR: number; - NAMESPACE_ERR: number; - NETWORK_ERR: number; - NOT_FOUND_ERR: number; - NOT_SUPPORTED_ERR: number; - NO_DATA_ALLOWED_ERR: number; - NO_MODIFICATION_ALLOWED_ERR: number; - PARSE_ERR: number; - QUOTA_EXCEEDED_ERR: number; - SECURITY_ERR: number; - SERIALIZE_ERR: number; - SYNTAX_ERR: number; - TIMEOUT_ERR: number; - TYPE_MISMATCH_ERR: number; - URL_MISMATCH_ERR: number; - VALIDATION_ERR: number; - WRONG_DOCUMENT_ERR: number; + readonly ABORT_ERR: number; + readonly DATA_CLONE_ERR: number; + readonly DOMSTRING_SIZE_ERR: number; + readonly HIERARCHY_REQUEST_ERR: number; + readonly INDEX_SIZE_ERR: number; + readonly INUSE_ATTRIBUTE_ERR: number; + readonly INVALID_ACCESS_ERR: number; + readonly INVALID_CHARACTER_ERR: number; + readonly INVALID_MODIFICATION_ERR: number; + readonly INVALID_NODE_TYPE_ERR: number; + readonly INVALID_STATE_ERR: number; + readonly NAMESPACE_ERR: number; + readonly NETWORK_ERR: number; + readonly NOT_FOUND_ERR: number; + readonly NOT_SUPPORTED_ERR: number; + readonly NO_DATA_ALLOWED_ERR: number; + readonly NO_MODIFICATION_ALLOWED_ERR: number; + readonly PARSE_ERR: number; + readonly QUOTA_EXCEEDED_ERR: number; + readonly SECURITY_ERR: number; + readonly SERIALIZE_ERR: number; + readonly SYNTAX_ERR: number; + readonly TIMEOUT_ERR: number; + readonly TYPE_MISMATCH_ERR: number; + readonly URL_MISMATCH_ERR: number; + readonly VALIDATION_ERR: number; + readonly WRONG_DOCUMENT_ERR: number; } interface DOMImplementation { @@ -6895,7 +7685,7 @@ declare var DOMSettableTokenList: { } interface DOMStringList { - length: number; + readonly length: number; contains(str: string): boolean; item(index: number): string; [index: number]: string; @@ -6916,7 +7706,7 @@ declare var DOMStringMap: { } interface DOMTokenList { - length: number; + readonly length: number; add(...token: string[]): void; contains(token: string): boolean; item(index: number): string; @@ -6943,9 +7733,9 @@ declare var DataCue: { interface DataTransfer { dropEffect: string; effectAllowed: string; - files: FileList; - items: DataTransferItemList; - types: DOMStringList; + readonly files: FileList; + readonly items: DataTransferItemList; + readonly types: DOMStringList; clearData(format?: string): boolean; getData(format: string): string; setData(format: string, data: string): boolean; @@ -6957,8 +7747,8 @@ declare var DataTransfer: { } interface DataTransferItem { - kind: string; - type: string; + readonly kind: string; + readonly type: string; getAsFile(): File; getAsString(_callback: FunctionStringCallback): void; } @@ -6969,7 +7759,7 @@ declare var DataTransferItem: { } interface DataTransferItemList { - length: number; + readonly length: number; add(data: File): DataTransferItem; clear(): void; item(index: number): DataTransferItem; @@ -6983,9 +7773,9 @@ declare var DataTransferItemList: { } interface DeferredPermissionRequest { - id: number; - type: string; - uri: string; + readonly id: number; + readonly type: string; + readonly uri: string; allow(): void; deny(): void; } @@ -6996,7 +7786,7 @@ declare var DeferredPermissionRequest: { } interface DelayNode extends AudioNode { - delayTime: AudioParam; + readonly delayTime: AudioParam; } declare var DelayNode: { @@ -7005,9 +7795,9 @@ declare var DelayNode: { } interface DeviceAcceleration { - x: number; - y: number; - z: number; + readonly x: number; + readonly y: number; + readonly z: number; } declare var DeviceAcceleration: { @@ -7015,11 +7805,20 @@ declare var DeviceAcceleration: { new(): DeviceAcceleration; } +interface DeviceLightEvent extends Event { + readonly value: number; +} + +declare var DeviceLightEvent: { + prototype: DeviceLightEvent; + new(type: string, eventInitDict?: DeviceLightEventInit): DeviceLightEvent; +} + interface DeviceMotionEvent extends Event { - acceleration: DeviceAcceleration; - accelerationIncludingGravity: DeviceAcceleration; - interval: number; - rotationRate: DeviceRotationRate; + readonly acceleration: DeviceAcceleration; + readonly accelerationIncludingGravity: DeviceAcceleration; + readonly interval: number; + readonly rotationRate: DeviceRotationRate; initDeviceMotionEvent(type: string, bubbles: boolean, cancelable: boolean, acceleration: DeviceAccelerationDict, accelerationIncludingGravity: DeviceAccelerationDict, rotationRate: DeviceRotationRateDict, interval: number): void; } @@ -7029,10 +7828,10 @@ declare var DeviceMotionEvent: { } interface DeviceOrientationEvent extends Event { - absolute: boolean; - alpha: number; - beta: number; - gamma: number; + readonly absolute: boolean; + readonly alpha: number; + readonly beta: number; + readonly gamma: number; initDeviceOrientationEvent(type: string, bubbles: boolean, cancelable: boolean, alpha: number, beta: number, gamma: number, absolute: boolean): void; } @@ -7042,9 +7841,9 @@ declare var DeviceOrientationEvent: { } interface DeviceRotationRate { - alpha: number; - beta: number; - gamma: number; + readonly alpha: number; + readonly beta: number; + readonly gamma: number; } declare var DeviceRotationRate: { @@ -7056,15 +7855,15 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven /** * Sets or gets the URL for the current document. */ - URL: string; + readonly URL: string; /** * Gets the URL for the document, stripped of any character encoding. */ - URLUnencoded: string; + readonly URLUnencoded: string; /** * Gets the object that has the focus when the parent document has focus. */ - activeElement: Element; + readonly activeElement: Element; /** * Sets or gets the color of all active links in the document. */ @@ -7072,15 +7871,15 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven /** * Returns a reference to the collection of elements contained by the object. */ - all: HTMLCollection; + readonly all: HTMLAllCollection; /** * Retrieves a collection of all a objects that have a name and/or id property. Objects in this collection are in HTML source order. */ - anchors: HTMLCollection; + anchors: HTMLCollectionOf; /** * Retrieves a collection of all applet objects in the document. */ - applets: HTMLCollection; + applets: HTMLCollectionOf; /** * Deprecated. Sets or retrieves a value that indicates the background color behind the object. */ @@ -7089,7 +7888,7 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven * Specifies the beginning and end of the document body. */ body: HTMLElement; - characterSet: string; + readonly characterSet: string; /** * Gets or sets the character set used to encode the object. */ @@ -7097,13 +7896,14 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven /** * Gets a value that indicates whether standards-compliant mode is switched on for the object. */ - compatMode: string; + readonly compatMode: string; cookie: string; + readonly currentScript: HTMLScriptElement | SVGScriptElement; /** * Gets the default character set from the current regional language settings. */ - defaultCharset: string; - defaultView: Window; + readonly defaultCharset: string; + readonly defaultView: Window; /** * Sets or gets a value that indicates whether the document can be edited. */ @@ -7115,7 +7915,7 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven /** * Gets an object representing the document type declaration associated with the current document. */ - doctype: DocumentType; + readonly doctype: DocumentType; /** * Gets a reference to the root node of the document. */ @@ -7127,7 +7927,7 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven /** * Retrieves a collection of all embed objects in the document. */ - embeds: HTMLCollection; + embeds: HTMLCollectionOf; /** * Sets or gets the foreground (text) color of the document. */ @@ -7135,27 +7935,27 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven /** * Retrieves a collection, in source order, of all form objects in the document. */ - forms: HTMLCollection; - fullscreenElement: Element; - fullscreenEnabled: boolean; - head: HTMLHeadElement; - hidden: boolean; + forms: HTMLCollectionOf; + readonly fullscreenElement: Element; + readonly fullscreenEnabled: boolean; + readonly head: HTMLHeadElement; + readonly hidden: boolean; /** * Retrieves a collection, in source order, of img objects in the document. */ - images: HTMLCollection; + images: HTMLCollectionOf; /** * Gets the implementation object of the current document. */ - implementation: DOMImplementation; + readonly implementation: DOMImplementation; /** * Returns the character encoding used to create the webpage that is loaded into the document object. */ - inputEncoding: string; + readonly inputEncoding: string; /** * Gets the date that the page was last modified, if the page supplies one. */ - lastModified: string; + readonly lastModified: string; /** * Sets or gets the color of the document links. */ @@ -7163,16 +7963,13 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven /** * Retrieves a collection of all a objects that specify the href property and all area objects in the document. */ - links: HTMLCollection; + links: HTMLCollectionOf; /** * Contains information about the current URL. */ - location: Location; - media: string; + readonly location: Location; msCSSOMElementFloatMetrics: boolean; msCapsLockWarningOff: boolean; - msHidden: boolean; - msVisibilityState: string; /** * Fires when the user aborts the download. * @param ev The event. @@ -7274,7 +8071,7 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven * Occurs when the end of playback is reached. * @param ev The event */ - onended: (ev: Event) => any; + onended: (ev: MediaStreamErrorEvent) => any; /** * Fires when an error occurs during object loading. * @param ev The event. @@ -7288,6 +8085,7 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven onfullscreenchange: (ev: Event) => any; onfullscreenerror: (ev: Event) => any; oninput: (ev: Event) => any; + oninvalid: (ev: Event) => any; /** * Fires when the user presses a key. * @param ev The keyboard event @@ -7352,7 +8150,7 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven * Fires when the wheel button is rotated. * @param ev The mouse event */ - onmousewheel: (ev: MouseWheelEvent) => any; + onmousewheel: (ev: WheelEvent) => any; onmscontentzoom: (ev: UIEvent) => any; onmsgesturechange: (ev: MSGestureEvent) => any; onmsgesturedoubletap: (ev: MSGestureEvent) => any; @@ -7437,6 +8235,11 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven * @param ev The event. */ onselect: (ev: UIEvent) => any; + /** + * Fires when the selection state of a document changes. + * @param ev The event. + */ + onselectionchange: (ev: Event) => any; onselectstart: (ev: Event) => any; /** * Occurs when the download has stopped. @@ -7475,51 +8278,51 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven onwaiting: (ev: Event) => any; onwebkitfullscreenchange: (ev: Event) => any; onwebkitfullscreenerror: (ev: Event) => any; - plugins: HTMLCollection; - pointerLockElement: Element; + plugins: HTMLCollectionOf; + readonly pointerLockElement: Element; /** * Retrieves a value that indicates the current state of the object. */ - readyState: string; + readonly readyState: string; /** * Gets the URL of the location that referred the user to the current page. */ - referrer: string; + readonly referrer: string; /** * Gets the root svg element in the document hierarchy. */ - rootElement: SVGSVGElement; + readonly rootElement: SVGSVGElement; /** * Retrieves a collection of all script objects in the document. */ - scripts: HTMLCollection; - security: string; + scripts: HTMLCollectionOf; + readonly scrollingElement: Element; /** * Retrieves a collection of styleSheet objects representing the style sheets that correspond to each instance of a link or style object in the document. */ - styleSheets: StyleSheetList; + readonly styleSheets: StyleSheetList; /** * Contains the title of the document. */ title: string; - visibilityState: string; + readonly visibilityState: string; /** * Sets or gets the color of the links that the user has visited. */ vlinkColor: string; - webkitCurrentFullScreenElement: Element; - webkitFullscreenElement: Element; - webkitFullscreenEnabled: boolean; - webkitIsFullScreen: boolean; - xmlEncoding: string; + readonly webkitCurrentFullScreenElement: Element; + readonly webkitFullscreenElement: Element; + readonly webkitFullscreenEnabled: boolean; + readonly webkitIsFullScreen: boolean; + readonly xmlEncoding: string; xmlStandalone: boolean; /** * Gets or sets the version attribute specified in the declaration of an XML document. */ xmlVersion: string; - currentScript: HTMLScriptElement; adoptNode(source: Node): Node; captureEvents(): void; + caretRangeFromPoint(x: number, y: number): Range; clear(): void; /** * Closes an output stream and forces the sent data to display. @@ -7546,37 +8349,24 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven * @param tagName The name of an element. */ createElement(tagName: "a"): HTMLAnchorElement; - createElement(tagName: "abbr"): HTMLPhraseElement; - createElement(tagName: "acronym"): HTMLPhraseElement; - createElement(tagName: "address"): HTMLBlockElement; createElement(tagName: "applet"): HTMLAppletElement; createElement(tagName: "area"): HTMLAreaElement; createElement(tagName: "audio"): HTMLAudioElement; - createElement(tagName: "b"): HTMLPhraseElement; createElement(tagName: "base"): HTMLBaseElement; createElement(tagName: "basefont"): HTMLBaseFontElement; - createElement(tagName: "bdo"): HTMLPhraseElement; - createElement(tagName: "big"): HTMLPhraseElement; - createElement(tagName: "blockquote"): HTMLBlockElement; + createElement(tagName: "blockquote"): HTMLQuoteElement; createElement(tagName: "body"): HTMLBodyElement; createElement(tagName: "br"): HTMLBRElement; createElement(tagName: "button"): HTMLButtonElement; createElement(tagName: "canvas"): HTMLCanvasElement; createElement(tagName: "caption"): HTMLTableCaptionElement; - createElement(tagName: "center"): HTMLBlockElement; - createElement(tagName: "cite"): HTMLPhraseElement; - createElement(tagName: "code"): HTMLPhraseElement; createElement(tagName: "col"): HTMLTableColElement; createElement(tagName: "colgroup"): HTMLTableColElement; createElement(tagName: "datalist"): HTMLDataListElement; - createElement(tagName: "dd"): HTMLDDElement; createElement(tagName: "del"): HTMLModElement; - createElement(tagName: "dfn"): HTMLPhraseElement; createElement(tagName: "dir"): HTMLDirectoryElement; createElement(tagName: "div"): HTMLDivElement; createElement(tagName: "dl"): HTMLDListElement; - createElement(tagName: "dt"): HTMLDTElement; - createElement(tagName: "em"): HTMLPhraseElement; createElement(tagName: "embed"): HTMLEmbedElement; createElement(tagName: "fieldset"): HTMLFieldSetElement; createElement(tagName: "font"): HTMLFontElement; @@ -7592,52 +8382,41 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven createElement(tagName: "head"): HTMLHeadElement; createElement(tagName: "hr"): HTMLHRElement; createElement(tagName: "html"): HTMLHtmlElement; - createElement(tagName: "i"): HTMLPhraseElement; createElement(tagName: "iframe"): HTMLIFrameElement; createElement(tagName: "img"): HTMLImageElement; createElement(tagName: "input"): HTMLInputElement; createElement(tagName: "ins"): HTMLModElement; - createElement(tagName: "isindex"): HTMLIsIndexElement; - createElement(tagName: "kbd"): HTMLPhraseElement; - createElement(tagName: "keygen"): HTMLBlockElement; + createElement(tagName: "isindex"): HTMLUnknownElement; createElement(tagName: "label"): HTMLLabelElement; createElement(tagName: "legend"): HTMLLegendElement; createElement(tagName: "li"): HTMLLIElement; createElement(tagName: "link"): HTMLLinkElement; - createElement(tagName: "listing"): HTMLBlockElement; + createElement(tagName: "listing"): HTMLPreElement; createElement(tagName: "map"): HTMLMapElement; createElement(tagName: "marquee"): HTMLMarqueeElement; createElement(tagName: "menu"): HTMLMenuElement; createElement(tagName: "meta"): HTMLMetaElement; - createElement(tagName: "nextid"): HTMLNextIdElement; - createElement(tagName: "nobr"): HTMLPhraseElement; + createElement(tagName: "meter"): HTMLMeterElement; + createElement(tagName: "nextid"): HTMLUnknownElement; createElement(tagName: "object"): HTMLObjectElement; createElement(tagName: "ol"): HTMLOListElement; createElement(tagName: "optgroup"): HTMLOptGroupElement; createElement(tagName: "option"): HTMLOptionElement; createElement(tagName: "p"): HTMLParagraphElement; createElement(tagName: "param"): HTMLParamElement; - createElement(tagName: "plaintext"): HTMLBlockElement; + createElement(tagName: "picture"): HTMLPictureElement; createElement(tagName: "pre"): HTMLPreElement; createElement(tagName: "progress"): HTMLProgressElement; createElement(tagName: "q"): HTMLQuoteElement; - createElement(tagName: "rt"): HTMLPhraseElement; - createElement(tagName: "ruby"): HTMLPhraseElement; - createElement(tagName: "s"): HTMLPhraseElement; - createElement(tagName: "samp"): HTMLPhraseElement; createElement(tagName: "script"): HTMLScriptElement; createElement(tagName: "select"): HTMLSelectElement; - createElement(tagName: "small"): HTMLPhraseElement; createElement(tagName: "source"): HTMLSourceElement; createElement(tagName: "span"): HTMLSpanElement; - createElement(tagName: "strike"): HTMLPhraseElement; - createElement(tagName: "strong"): HTMLPhraseElement; createElement(tagName: "style"): HTMLStyleElement; - createElement(tagName: "sub"): HTMLPhraseElement; - createElement(tagName: "sup"): HTMLPhraseElement; createElement(tagName: "table"): HTMLTableElement; createElement(tagName: "tbody"): HTMLTableSectionElement; createElement(tagName: "td"): HTMLTableDataCellElement; + createElement(tagName: "template"): HTMLTemplateElement; createElement(tagName: "textarea"): HTMLTextAreaElement; createElement(tagName: "tfoot"): HTMLTableSectionElement; createElement(tagName: "th"): HTMLTableHeaderCellElement; @@ -7645,13 +8424,10 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven createElement(tagName: "title"): HTMLTitleElement; createElement(tagName: "tr"): HTMLTableRowElement; createElement(tagName: "track"): HTMLTrackElement; - createElement(tagName: "tt"): HTMLPhraseElement; - createElement(tagName: "u"): HTMLPhraseElement; createElement(tagName: "ul"): HTMLUListElement; - createElement(tagName: "var"): HTMLPhraseElement; createElement(tagName: "video"): HTMLVideoElement; createElement(tagName: "x-ms-webview"): MSHTMLWebViewElement; - createElement(tagName: "xmp"): HTMLBlockElement; + createElement(tagName: "xmp"): HTMLPreElement; createElement(tagName: string): HTMLElement; createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "a"): SVGAElement createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "circle"): SVGCircleElement @@ -7736,7 +8512,7 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven * @param data String that specifies the nodeValue property of the text node. */ createTextNode(data: string): Text; - createTouch(view: any, target: EventTarget, identifier: number, pageX: number, pageY: number, screenX: number, screenY: number): Touch; + createTouch(view: Window, target: EventTarget, identifier: number, pageX: number, pageY: number, screenX: number, screenY: number): Touch; createTouchList(...touches: Touch[]): TouchList; /** * Creates a TreeWalker object that you can use to traverse filtered lists of nodes or elements in a document. @@ -7787,44 +8563,44 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven * @param name Specifies the name of an element. */ getElementsByTagName(tagname: "a"): NodeListOf; - getElementsByTagName(tagname: "abbr"): NodeListOf; - getElementsByTagName(tagname: "acronym"): NodeListOf; - getElementsByTagName(tagname: "address"): NodeListOf; + getElementsByTagName(tagname: "abbr"): NodeListOf; + getElementsByTagName(tagname: "acronym"): NodeListOf; + getElementsByTagName(tagname: "address"): NodeListOf; getElementsByTagName(tagname: "applet"): NodeListOf; getElementsByTagName(tagname: "area"): NodeListOf; getElementsByTagName(tagname: "article"): NodeListOf; getElementsByTagName(tagname: "aside"): NodeListOf; getElementsByTagName(tagname: "audio"): NodeListOf; - getElementsByTagName(tagname: "b"): NodeListOf; + getElementsByTagName(tagname: "b"): NodeListOf; getElementsByTagName(tagname: "base"): NodeListOf; getElementsByTagName(tagname: "basefont"): NodeListOf; - getElementsByTagName(tagname: "bdo"): NodeListOf; - getElementsByTagName(tagname: "big"): NodeListOf; - getElementsByTagName(tagname: "blockquote"): NodeListOf; + getElementsByTagName(tagname: "bdo"): NodeListOf; + getElementsByTagName(tagname: "big"): NodeListOf; + getElementsByTagName(tagname: "blockquote"): NodeListOf; getElementsByTagName(tagname: "body"): NodeListOf; getElementsByTagName(tagname: "br"): NodeListOf; getElementsByTagName(tagname: "button"): NodeListOf; getElementsByTagName(tagname: "canvas"): NodeListOf; getElementsByTagName(tagname: "caption"): NodeListOf; - getElementsByTagName(tagname: "center"): NodeListOf; + getElementsByTagName(tagname: "center"): NodeListOf; getElementsByTagName(tagname: "circle"): NodeListOf; - getElementsByTagName(tagname: "cite"): NodeListOf; + getElementsByTagName(tagname: "cite"): NodeListOf; getElementsByTagName(tagname: "clippath"): NodeListOf; - getElementsByTagName(tagname: "code"): NodeListOf; + getElementsByTagName(tagname: "code"): NodeListOf; getElementsByTagName(tagname: "col"): NodeListOf; getElementsByTagName(tagname: "colgroup"): NodeListOf; getElementsByTagName(tagname: "datalist"): NodeListOf; - getElementsByTagName(tagname: "dd"): NodeListOf; + getElementsByTagName(tagname: "dd"): NodeListOf; getElementsByTagName(tagname: "defs"): NodeListOf; getElementsByTagName(tagname: "del"): NodeListOf; getElementsByTagName(tagname: "desc"): NodeListOf; - getElementsByTagName(tagname: "dfn"): NodeListOf; + getElementsByTagName(tagname: "dfn"): NodeListOf; getElementsByTagName(tagname: "dir"): NodeListOf; getElementsByTagName(tagname: "div"): NodeListOf; getElementsByTagName(tagname: "dl"): NodeListOf; - getElementsByTagName(tagname: "dt"): NodeListOf; + getElementsByTagName(tagname: "dt"): NodeListOf; getElementsByTagName(tagname: "ellipse"): NodeListOf; - getElementsByTagName(tagname: "em"): NodeListOf; + getElementsByTagName(tagname: "em"): NodeListOf; getElementsByTagName(tagname: "embed"): NodeListOf; getElementsByTagName(tagname: "feblend"): NodeListOf; getElementsByTagName(tagname: "fecolormatrix"): NodeListOf; @@ -7872,22 +8648,22 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven getElementsByTagName(tagname: "hgroup"): NodeListOf; getElementsByTagName(tagname: "hr"): NodeListOf; getElementsByTagName(tagname: "html"): NodeListOf; - getElementsByTagName(tagname: "i"): NodeListOf; + getElementsByTagName(tagname: "i"): NodeListOf; getElementsByTagName(tagname: "iframe"): NodeListOf; getElementsByTagName(tagname: "image"): NodeListOf; getElementsByTagName(tagname: "img"): NodeListOf; getElementsByTagName(tagname: "input"): NodeListOf; getElementsByTagName(tagname: "ins"): NodeListOf; - getElementsByTagName(tagname: "isindex"): NodeListOf; - getElementsByTagName(tagname: "kbd"): NodeListOf; - getElementsByTagName(tagname: "keygen"): NodeListOf; + getElementsByTagName(tagname: "isindex"): NodeListOf; + getElementsByTagName(tagname: "kbd"): NodeListOf; + getElementsByTagName(tagname: "keygen"): NodeListOf; getElementsByTagName(tagname: "label"): NodeListOf; getElementsByTagName(tagname: "legend"): NodeListOf; getElementsByTagName(tagname: "li"): NodeListOf; getElementsByTagName(tagname: "line"): NodeListOf; getElementsByTagName(tagname: "lineargradient"): NodeListOf; getElementsByTagName(tagname: "link"): NodeListOf; - getElementsByTagName(tagname: "listing"): NodeListOf; + getElementsByTagName(tagname: "listing"): NodeListOf; getElementsByTagName(tagname: "map"): NodeListOf; getElementsByTagName(tagname: "mark"): NodeListOf; getElementsByTagName(tagname: "marker"): NodeListOf; @@ -7896,9 +8672,10 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven getElementsByTagName(tagname: "menu"): NodeListOf; getElementsByTagName(tagname: "meta"): NodeListOf; getElementsByTagName(tagname: "metadata"): NodeListOf; + getElementsByTagName(tagname: "meter"): NodeListOf; getElementsByTagName(tagname: "nav"): NodeListOf; - getElementsByTagName(tagname: "nextid"): NodeListOf; - getElementsByTagName(tagname: "nobr"): NodeListOf; + getElementsByTagName(tagname: "nextid"): NodeListOf; + getElementsByTagName(tagname: "nobr"): NodeListOf; getElementsByTagName(tagname: "noframes"): NodeListOf; getElementsByTagName(tagname: "noscript"): NodeListOf; getElementsByTagName(tagname: "object"): NodeListOf; @@ -7909,7 +8686,8 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven getElementsByTagName(tagname: "param"): NodeListOf; getElementsByTagName(tagname: "path"): NodeListOf; getElementsByTagName(tagname: "pattern"): NodeListOf; - getElementsByTagName(tagname: "plaintext"): NodeListOf; + getElementsByTagName(tagname: "picture"): NodeListOf; + getElementsByTagName(tagname: "plaintext"): NodeListOf; getElementsByTagName(tagname: "polygon"): NodeListOf; getElementsByTagName(tagname: "polyline"): NodeListOf; getElementsByTagName(tagname: "pre"): NodeListOf; @@ -7917,28 +8695,29 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven getElementsByTagName(tagname: "q"): NodeListOf; getElementsByTagName(tagname: "radialgradient"): NodeListOf; getElementsByTagName(tagname: "rect"): NodeListOf; - getElementsByTagName(tagname: "rt"): NodeListOf; - getElementsByTagName(tagname: "ruby"): NodeListOf; - getElementsByTagName(tagname: "s"): NodeListOf; - getElementsByTagName(tagname: "samp"): NodeListOf; + getElementsByTagName(tagname: "rt"): NodeListOf; + getElementsByTagName(tagname: "ruby"): NodeListOf; + getElementsByTagName(tagname: "s"): NodeListOf; + getElementsByTagName(tagname: "samp"): NodeListOf; getElementsByTagName(tagname: "script"): NodeListOf; getElementsByTagName(tagname: "section"): NodeListOf; getElementsByTagName(tagname: "select"): NodeListOf; - getElementsByTagName(tagname: "small"): NodeListOf; + getElementsByTagName(tagname: "small"): NodeListOf; getElementsByTagName(tagname: "source"): NodeListOf; getElementsByTagName(tagname: "span"): NodeListOf; getElementsByTagName(tagname: "stop"): NodeListOf; - getElementsByTagName(tagname: "strike"): NodeListOf; - getElementsByTagName(tagname: "strong"): NodeListOf; + getElementsByTagName(tagname: "strike"): NodeListOf; + getElementsByTagName(tagname: "strong"): NodeListOf; getElementsByTagName(tagname: "style"): NodeListOf; - getElementsByTagName(tagname: "sub"): NodeListOf; - getElementsByTagName(tagname: "sup"): NodeListOf; + getElementsByTagName(tagname: "sub"): NodeListOf; + getElementsByTagName(tagname: "sup"): NodeListOf; getElementsByTagName(tagname: "svg"): NodeListOf; getElementsByTagName(tagname: "switch"): NodeListOf; getElementsByTagName(tagname: "symbol"): NodeListOf; getElementsByTagName(tagname: "table"): NodeListOf; getElementsByTagName(tagname: "tbody"): NodeListOf; getElementsByTagName(tagname: "td"): NodeListOf; + getElementsByTagName(tagname: "template"): NodeListOf; getElementsByTagName(tagname: "text"): NodeListOf; getElementsByTagName(tagname: "textpath"): NodeListOf; getElementsByTagName(tagname: "textarea"): NodeListOf; @@ -7949,16 +8728,16 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven getElementsByTagName(tagname: "tr"): NodeListOf; getElementsByTagName(tagname: "track"): NodeListOf; getElementsByTagName(tagname: "tspan"): NodeListOf; - getElementsByTagName(tagname: "tt"): NodeListOf; - getElementsByTagName(tagname: "u"): NodeListOf; + getElementsByTagName(tagname: "tt"): NodeListOf; + getElementsByTagName(tagname: "u"): NodeListOf; getElementsByTagName(tagname: "ul"): NodeListOf; getElementsByTagName(tagname: "use"): NodeListOf; - getElementsByTagName(tagname: "var"): NodeListOf; + getElementsByTagName(tagname: "var"): NodeListOf; getElementsByTagName(tagname: "video"): NodeListOf; getElementsByTagName(tagname: "view"): NodeListOf; getElementsByTagName(tagname: "wbr"): NodeListOf; getElementsByTagName(tagname: "x-ms-webview"): NodeListOf; - getElementsByTagName(tagname: "xmp"): NodeListOf; + getElementsByTagName(tagname: "xmp"): NodeListOf; getElementsByTagName(tagname: string): NodeListOf; getElementsByTagNameNS(namespaceURI: string, localName: string): NodeListOf; /** @@ -7970,8 +8749,8 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven */ hasFocus(): boolean; importNode(importedNode: Node, deep: boolean): Node; - msElementsFromPoint(x: number, y: number): NodeList; - msElementsFromRect(left: number, top: number, width: number, height: number): NodeList; + msElementsFromPoint(x: number, y: number): NodeListOf; + msElementsFromRect(left: number, top: number, width: number, height: number): NodeListOf; /** * 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. * @param url Specifies a MIME type for the document. @@ -8067,12 +8846,13 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven addEventListener(type: "drop", listener: (ev: DragEvent) => any, useCapture?: boolean): void; addEventListener(type: "durationchange", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "emptied", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "ended", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "ended", listener: (ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: "focus", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; addEventListener(type: "fullscreenchange", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "fullscreenerror", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "input", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "invalid", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "keydown", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "keypress", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "keyup", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; @@ -8085,7 +8865,7 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven addEventListener(type: "mouseout", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "mouseover", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "mouseup", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousewheel", listener: (ev: MouseWheelEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mousewheel", listener: (ev: WheelEvent) => any, useCapture?: boolean): void; addEventListener(type: "mssitemodejumplistitemremoved", listener: (ev: MSSiteModeEvent) => any, useCapture?: boolean): void; addEventListener(type: "msthumbnailclick", listener: (ev: MSSiteModeEvent) => any, useCapture?: boolean): void; addEventListener(type: "pause", listener: (ev: Event) => any, useCapture?: boolean): void; @@ -8109,6 +8889,7 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven addEventListener(type: "seeked", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "seeking", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "select", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "selectionchange", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "selectstart", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "stalled", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "stop", listener: (ev: Event) => any, useCapture?: boolean): void; @@ -8142,12 +8923,12 @@ declare var DocumentFragment: { } interface DocumentType extends Node, ChildNode { - entities: NamedNodeMap; - internalSubset: string; - name: string; - notations: NamedNodeMap; - publicId: string; - systemId: string; + readonly entities: NamedNodeMap; + readonly internalSubset: string; + readonly name: string; + readonly notations: NamedNodeMap; + readonly publicId: string; + readonly systemId: string; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -8157,7 +8938,7 @@ declare var DocumentType: { } interface DragEvent extends MouseEvent { - dataTransfer: DataTransfer; + readonly dataTransfer: DataTransfer; 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; msConvertURL(file: File, targetType: string, targetURL?: string): void; } @@ -8168,12 +8949,12 @@ declare var DragEvent: { } interface DynamicsCompressorNode extends AudioNode { - attack: AudioParam; - knee: AudioParam; - ratio: AudioParam; - reduction: AudioParam; - release: AudioParam; - threshold: AudioParam; + readonly attack: AudioParam; + readonly knee: AudioParam; + readonly ratio: AudioParam; + readonly reduction: AudioParam; + readonly release: AudioParam; + readonly threshold: AudioParam; } declare var DynamicsCompressorNode: { @@ -8181,26 +8962,36 @@ declare var DynamicsCompressorNode: { new(): DynamicsCompressorNode; } +interface EXT_frag_depth { +} + +declare var EXT_frag_depth: { + prototype: EXT_frag_depth; + new(): EXT_frag_depth; +} + interface EXT_texture_filter_anisotropic { - MAX_TEXTURE_MAX_ANISOTROPY_EXT: number; - TEXTURE_MAX_ANISOTROPY_EXT: number; + readonly MAX_TEXTURE_MAX_ANISOTROPY_EXT: number; + readonly TEXTURE_MAX_ANISOTROPY_EXT: number; } declare var EXT_texture_filter_anisotropic: { prototype: EXT_texture_filter_anisotropic; new(): EXT_texture_filter_anisotropic; - MAX_TEXTURE_MAX_ANISOTROPY_EXT: number; - TEXTURE_MAX_ANISOTROPY_EXT: number; + readonly MAX_TEXTURE_MAX_ANISOTROPY_EXT: number; + readonly TEXTURE_MAX_ANISOTROPY_EXT: number; } interface Element extends Node, GlobalEventHandlers, ElementTraversal, NodeSelector, ChildNode { - classList: DOMTokenList; - clientHeight: number; - clientLeft: number; - clientTop: number; - clientWidth: number; + readonly classList: DOMTokenList; + className: string; + readonly clientHeight: number; + readonly clientLeft: number; + readonly clientTop: number; + readonly clientWidth: number; + id: string; msContentZoomFactor: number; - msRegionOverflow: string; + readonly msRegionOverflow: string; onariarequest: (ev: AriaRequestEvent) => any; oncommand: (ev: CommandEvent) => any; ongotpointercapture: (ev: PointerEvent) => any; @@ -8228,13 +9019,12 @@ interface Element extends Node, GlobalEventHandlers, ElementTraversal, NodeSelec ontouchstart: (ev: TouchEvent) => any; onwebkitfullscreenchange: (ev: Event) => any; onwebkitfullscreenerror: (ev: Event) => any; - scrollHeight: number; + readonly prefix: string; + readonly scrollHeight: number; scrollLeft: number; scrollTop: number; - scrollWidth: number; - tagName: string; - id: string; - className: string; + readonly scrollWidth: number; + readonly tagName: string; innerHTML: string; getAttribute(name?: string): string; getAttributeNS(namespaceURI: string, localName: string): string; @@ -8243,44 +9033,44 @@ interface Element extends Node, GlobalEventHandlers, ElementTraversal, NodeSelec getBoundingClientRect(): ClientRect; getClientRects(): ClientRectList; getElementsByTagName(name: "a"): NodeListOf; - getElementsByTagName(name: "abbr"): NodeListOf; - getElementsByTagName(name: "acronym"): NodeListOf; - getElementsByTagName(name: "address"): NodeListOf; + getElementsByTagName(name: "abbr"): NodeListOf; + getElementsByTagName(name: "acronym"): NodeListOf; + getElementsByTagName(name: "address"): NodeListOf; getElementsByTagName(name: "applet"): NodeListOf; getElementsByTagName(name: "area"): NodeListOf; getElementsByTagName(name: "article"): NodeListOf; getElementsByTagName(name: "aside"): NodeListOf; getElementsByTagName(name: "audio"): NodeListOf; - getElementsByTagName(name: "b"): NodeListOf; + getElementsByTagName(name: "b"): NodeListOf; getElementsByTagName(name: "base"): NodeListOf; getElementsByTagName(name: "basefont"): NodeListOf; - getElementsByTagName(name: "bdo"): NodeListOf; - getElementsByTagName(name: "big"): NodeListOf; - getElementsByTagName(name: "blockquote"): NodeListOf; + getElementsByTagName(name: "bdo"): NodeListOf; + getElementsByTagName(name: "big"): NodeListOf; + getElementsByTagName(name: "blockquote"): NodeListOf; getElementsByTagName(name: "body"): NodeListOf; getElementsByTagName(name: "br"): NodeListOf; getElementsByTagName(name: "button"): NodeListOf; getElementsByTagName(name: "canvas"): NodeListOf; getElementsByTagName(name: "caption"): NodeListOf; - getElementsByTagName(name: "center"): NodeListOf; + getElementsByTagName(name: "center"): NodeListOf; getElementsByTagName(name: "circle"): NodeListOf; - getElementsByTagName(name: "cite"): NodeListOf; + getElementsByTagName(name: "cite"): NodeListOf; getElementsByTagName(name: "clippath"): NodeListOf; - getElementsByTagName(name: "code"): NodeListOf; + getElementsByTagName(name: "code"): NodeListOf; getElementsByTagName(name: "col"): NodeListOf; getElementsByTagName(name: "colgroup"): NodeListOf; getElementsByTagName(name: "datalist"): NodeListOf; - getElementsByTagName(name: "dd"): NodeListOf; + getElementsByTagName(name: "dd"): NodeListOf; getElementsByTagName(name: "defs"): NodeListOf; getElementsByTagName(name: "del"): NodeListOf; getElementsByTagName(name: "desc"): NodeListOf; - getElementsByTagName(name: "dfn"): NodeListOf; + getElementsByTagName(name: "dfn"): NodeListOf; getElementsByTagName(name: "dir"): NodeListOf; getElementsByTagName(name: "div"): NodeListOf; getElementsByTagName(name: "dl"): NodeListOf; - getElementsByTagName(name: "dt"): NodeListOf; + getElementsByTagName(name: "dt"): NodeListOf; getElementsByTagName(name: "ellipse"): NodeListOf; - getElementsByTagName(name: "em"): NodeListOf; + getElementsByTagName(name: "em"): NodeListOf; getElementsByTagName(name: "embed"): NodeListOf; getElementsByTagName(name: "feblend"): NodeListOf; getElementsByTagName(name: "fecolormatrix"): NodeListOf; @@ -8328,22 +9118,22 @@ interface Element extends Node, GlobalEventHandlers, ElementTraversal, NodeSelec getElementsByTagName(name: "hgroup"): NodeListOf; getElementsByTagName(name: "hr"): NodeListOf; getElementsByTagName(name: "html"): NodeListOf; - getElementsByTagName(name: "i"): NodeListOf; + getElementsByTagName(name: "i"): NodeListOf; getElementsByTagName(name: "iframe"): NodeListOf; getElementsByTagName(name: "image"): NodeListOf; getElementsByTagName(name: "img"): NodeListOf; getElementsByTagName(name: "input"): NodeListOf; getElementsByTagName(name: "ins"): NodeListOf; - getElementsByTagName(name: "isindex"): NodeListOf; - getElementsByTagName(name: "kbd"): NodeListOf; - getElementsByTagName(name: "keygen"): NodeListOf; + getElementsByTagName(name: "isindex"): NodeListOf; + getElementsByTagName(name: "kbd"): NodeListOf; + getElementsByTagName(name: "keygen"): NodeListOf; getElementsByTagName(name: "label"): NodeListOf; getElementsByTagName(name: "legend"): NodeListOf; getElementsByTagName(name: "li"): NodeListOf; getElementsByTagName(name: "line"): NodeListOf; getElementsByTagName(name: "lineargradient"): NodeListOf; getElementsByTagName(name: "link"): NodeListOf; - getElementsByTagName(name: "listing"): NodeListOf; + getElementsByTagName(name: "listing"): NodeListOf; getElementsByTagName(name: "map"): NodeListOf; getElementsByTagName(name: "mark"): NodeListOf; getElementsByTagName(name: "marker"): NodeListOf; @@ -8352,9 +9142,10 @@ interface Element extends Node, GlobalEventHandlers, ElementTraversal, NodeSelec getElementsByTagName(name: "menu"): NodeListOf; getElementsByTagName(name: "meta"): NodeListOf; getElementsByTagName(name: "metadata"): NodeListOf; + getElementsByTagName(name: "meter"): NodeListOf; getElementsByTagName(name: "nav"): NodeListOf; - getElementsByTagName(name: "nextid"): NodeListOf; - getElementsByTagName(name: "nobr"): NodeListOf; + getElementsByTagName(name: "nextid"): NodeListOf; + getElementsByTagName(name: "nobr"): NodeListOf; getElementsByTagName(name: "noframes"): NodeListOf; getElementsByTagName(name: "noscript"): NodeListOf; getElementsByTagName(name: "object"): NodeListOf; @@ -8365,7 +9156,8 @@ interface Element extends Node, GlobalEventHandlers, ElementTraversal, NodeSelec getElementsByTagName(name: "param"): NodeListOf; getElementsByTagName(name: "path"): NodeListOf; getElementsByTagName(name: "pattern"): NodeListOf; - getElementsByTagName(name: "plaintext"): NodeListOf; + getElementsByTagName(name: "picture"): NodeListOf; + getElementsByTagName(name: "plaintext"): NodeListOf; getElementsByTagName(name: "polygon"): NodeListOf; getElementsByTagName(name: "polyline"): NodeListOf; getElementsByTagName(name: "pre"): NodeListOf; @@ -8373,28 +9165,29 @@ interface Element extends Node, GlobalEventHandlers, ElementTraversal, NodeSelec getElementsByTagName(name: "q"): NodeListOf; getElementsByTagName(name: "radialgradient"): NodeListOf; getElementsByTagName(name: "rect"): NodeListOf; - getElementsByTagName(name: "rt"): NodeListOf; - getElementsByTagName(name: "ruby"): NodeListOf; - getElementsByTagName(name: "s"): NodeListOf; - getElementsByTagName(name: "samp"): NodeListOf; + getElementsByTagName(name: "rt"): NodeListOf; + getElementsByTagName(name: "ruby"): NodeListOf; + getElementsByTagName(name: "s"): NodeListOf; + getElementsByTagName(name: "samp"): NodeListOf; getElementsByTagName(name: "script"): NodeListOf; getElementsByTagName(name: "section"): NodeListOf; getElementsByTagName(name: "select"): NodeListOf; - getElementsByTagName(name: "small"): NodeListOf; + getElementsByTagName(name: "small"): NodeListOf; getElementsByTagName(name: "source"): NodeListOf; getElementsByTagName(name: "span"): NodeListOf; getElementsByTagName(name: "stop"): NodeListOf; - getElementsByTagName(name: "strike"): NodeListOf; - getElementsByTagName(name: "strong"): NodeListOf; + getElementsByTagName(name: "strike"): NodeListOf; + getElementsByTagName(name: "strong"): NodeListOf; getElementsByTagName(name: "style"): NodeListOf; - getElementsByTagName(name: "sub"): NodeListOf; - getElementsByTagName(name: "sup"): NodeListOf; + getElementsByTagName(name: "sub"): NodeListOf; + getElementsByTagName(name: "sup"): NodeListOf; getElementsByTagName(name: "svg"): NodeListOf; getElementsByTagName(name: "switch"): NodeListOf; getElementsByTagName(name: "symbol"): NodeListOf; getElementsByTagName(name: "table"): NodeListOf; getElementsByTagName(name: "tbody"): NodeListOf; getElementsByTagName(name: "td"): NodeListOf; + getElementsByTagName(name: "template"): NodeListOf; getElementsByTagName(name: "text"): NodeListOf; getElementsByTagName(name: "textpath"): NodeListOf; getElementsByTagName(name: "textarea"): NodeListOf; @@ -8405,16 +9198,16 @@ interface Element extends Node, GlobalEventHandlers, ElementTraversal, NodeSelec getElementsByTagName(name: "tr"): NodeListOf; getElementsByTagName(name: "track"): NodeListOf; getElementsByTagName(name: "tspan"): NodeListOf; - getElementsByTagName(name: "tt"): NodeListOf; - getElementsByTagName(name: "u"): NodeListOf; + getElementsByTagName(name: "tt"): NodeListOf; + getElementsByTagName(name: "u"): NodeListOf; getElementsByTagName(name: "ul"): NodeListOf; getElementsByTagName(name: "use"): NodeListOf; - getElementsByTagName(name: "var"): NodeListOf; + getElementsByTagName(name: "var"): NodeListOf; getElementsByTagName(name: "video"): NodeListOf; getElementsByTagName(name: "view"): NodeListOf; getElementsByTagName(name: "wbr"): NodeListOf; getElementsByTagName(name: "x-ms-webview"): NodeListOf; - getElementsByTagName(name: "xmp"): NodeListOf; + getElementsByTagName(name: "xmp"): NodeListOf; getElementsByTagName(name: string): NodeListOf; getElementsByTagNameNS(namespaceURI: string, localName: string): NodeListOf; hasAttribute(name: string): boolean; @@ -8487,11 +9280,11 @@ declare var Element: { } interface ErrorEvent extends Event { - colno: number; - error: any; - filename: string; - lineno: number; - message: string; + readonly colno: number; + readonly error: any; + readonly filename: string; + readonly lineno: number; + readonly message: string; initErrorEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, messageArg: string, filenameArg: string, linenoArg: number): void; } @@ -8501,39 +9294,39 @@ declare var ErrorEvent: { } interface Event { - bubbles: boolean; + readonly bubbles: boolean; cancelBubble: boolean; - cancelable: boolean; - currentTarget: EventTarget; - defaultPrevented: boolean; - eventPhase: number; - isTrusted: boolean; + readonly cancelable: boolean; + readonly currentTarget: EventTarget; + readonly defaultPrevented: boolean; + readonly eventPhase: number; + readonly isTrusted: boolean; returnValue: boolean; - srcElement: Element; - target: EventTarget; - timeStamp: number; - type: string; + readonly srcElement: Element; + readonly target: EventTarget; + readonly timeStamp: number; + readonly type: string; initEvent(eventTypeArg: string, canBubbleArg: boolean, cancelableArg: boolean): void; preventDefault(): void; stopImmediatePropagation(): void; stopPropagation(): void; - AT_TARGET: number; - BUBBLING_PHASE: number; - CAPTURING_PHASE: number; + readonly AT_TARGET: number; + readonly BUBBLING_PHASE: number; + readonly CAPTURING_PHASE: number; } declare var Event: { prototype: Event; new(type: string, eventInitDict?: EventInit): Event; - AT_TARGET: number; - BUBBLING_PHASE: number; - CAPTURING_PHASE: number; + readonly AT_TARGET: number; + readonly BUBBLING_PHASE: number; + readonly CAPTURING_PHASE: number; } interface EventTarget { - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; + addEventListener(type: string, listener?: EventListenerOrEventListenerObject, useCapture?: boolean): void; dispatchEvent(evt: Event): boolean; - removeEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; + removeEventListener(type: string, listener?: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var EventTarget: { @@ -8550,8 +9343,9 @@ declare var External: { } interface File extends Blob { - lastModifiedDate: any; - name: string; + readonly lastModifiedDate: any; + readonly name: string; + readonly webkitRelativePath: string; } declare var File: { @@ -8560,7 +9354,7 @@ declare var File: { } interface FileList { - length: number; + readonly length: number; item(index: number): File; [index: number]: File; } @@ -8571,7 +9365,7 @@ declare var FileList: { } interface FileReader extends EventTarget, MSBaseReader { - error: DOMError; + readonly error: DOMError; readAsArrayBuffer(blob: Blob): void; readAsBinaryString(blob: Blob): void; readAsDataURL(blob: Blob): void; @@ -8585,7 +9379,7 @@ declare var FileReader: { } interface FocusEvent extends UIEvent { - relatedTarget: EventTarget; + readonly relatedTarget: EventTarget; initFocusEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, relatedTargetArg: EventTarget): void; } @@ -8604,7 +9398,7 @@ declare var FormData: { } interface GainNode extends AudioNode { - gain: AudioParam; + readonly gain: AudioParam; } declare var GainNode: { @@ -8613,13 +9407,13 @@ declare var GainNode: { } interface Gamepad { - axes: number[]; - buttons: GamepadButton[]; - connected: boolean; - id: string; - index: number; - mapping: string; - timestamp: number; + readonly axes: number[]; + readonly buttons: GamepadButton[]; + readonly connected: boolean; + readonly id: string; + readonly index: number; + readonly mapping: string; + readonly timestamp: number; } declare var Gamepad: { @@ -8628,8 +9422,8 @@ declare var Gamepad: { } interface GamepadButton { - pressed: boolean; - value: number; + readonly pressed: boolean; + readonly value: number; } declare var GamepadButton: { @@ -8638,7 +9432,7 @@ declare var GamepadButton: { } interface GamepadEvent extends Event { - gamepad: Gamepad; + readonly gamepad: Gamepad; } declare var GamepadEvent: { @@ -8676,6 +9470,7 @@ interface HTMLAnchorElement extends HTMLElement { * Sets or retrieves the coordinates of the object. */ coords: string; + download: string; /** * Contains the anchor portion of the URL including the hash sign (#). */ @@ -8696,12 +9491,12 @@ interface HTMLAnchorElement extends HTMLElement { * Sets or retrieves the language code of the object. */ hreflang: string; - mimeType: string; + readonly mimeType: string; /** * Sets or retrieves the shape of the object. */ name: string; - nameProp: string; + readonly nameProp: string; /** * Contains the pathname of the URL. */ @@ -8714,7 +9509,7 @@ interface HTMLAnchorElement extends HTMLElement { * Contains the protocol of the URL. */ protocol: string; - protocolLong: string; + readonly protocolLong: string; /** * Sets or retrieves the relationship between the object and the destination of the link. */ @@ -8756,7 +9551,7 @@ interface HTMLAppletElement extends HTMLElement { /** * 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. */ - BaseHref: string; + readonly BaseHref: string; align: string; /** * Sets or retrieves a text alternative to the graphic. @@ -8783,7 +9578,7 @@ interface HTMLAppletElement extends HTMLElement { /** * Address of a pointer to the document this page or frame contains. If there is no document, then null will be returned. */ - contentDocument: Document; + readonly contentDocument: Document; /** * Sets or retrieves the URL that references the data of the object. */ @@ -8792,7 +9587,7 @@ interface HTMLAppletElement extends HTMLElement { * Sets or retrieves a character string that can be used to implement your own declare functionality for the object. */ declare: boolean; - form: HTMLFormElement; + readonly form: HTMLFormElement; /** * Sets or retrieves the height of the object. */ @@ -8833,6 +9628,7 @@ interface HTMLAreaElement extends HTMLElement { * Sets or retrieves the coordinates of the object. */ coords: string; + download: string; /** * Sets or retrieves the subsection of the href property that follows the number sign (#). */ @@ -8958,23 +9754,6 @@ declare var HTMLBaseFontElement: { new(): HTMLBaseFontElement; } -interface HTMLBlockElement extends HTMLElement { - /** - * Sets or retrieves reference information about the object. - */ - cite: string; - clear: string; - /** - * Sets or retrieves the width of the object. - */ - width: number; -} - -declare var HTMLBlockElement: { - prototype: HTMLBlockElement; - new(): HTMLBlockElement; -} - interface HTMLBodyElement extends HTMLElement { aLink: any; background: string; @@ -9002,7 +9781,6 @@ interface HTMLBodyElement extends HTMLElement { onunload: (ev: Event) => any; text: any; vLink: any; - createTextRange(): TextRange; addEventListener(type: "MSContentZoom", listener: (ev: UIEvent) => any, useCapture?: boolean): void; addEventListener(type: "MSGestureChange", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void; addEventListener(type: "MSGestureDoubleTap", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void; @@ -9027,10 +9805,10 @@ interface HTMLBodyElement extends HTMLElement { addEventListener(type: "afterprint", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "ariarequest", listener: (ev: AriaRequestEvent) => any, useCapture?: boolean): void; addEventListener(type: "beforeactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecopy", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecut", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforecopy", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforecut", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "beforedeactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforepaste", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforepaste", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "beforeprint", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "beforeunload", listener: (ev: BeforeUnloadEvent) => any, useCapture?: boolean): void; addEventListener(type: "blur", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; @@ -9041,9 +9819,9 @@ interface HTMLBodyElement extends HTMLElement { addEventListener(type: "click", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "command", listener: (ev: CommandEvent) => any, useCapture?: boolean): void; addEventListener(type: "contextmenu", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "copy", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "copy", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "cuechange", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "cut", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "cut", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "dblclick", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "deactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; addEventListener(type: "drag", listener: (ev: DragEvent) => any, useCapture?: boolean): void; @@ -9055,7 +9833,7 @@ interface HTMLBodyElement extends HTMLElement { addEventListener(type: "drop", listener: (ev: DragEvent) => any, useCapture?: boolean): void; addEventListener(type: "durationchange", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "emptied", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "ended", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "ended", listener: (ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: "focus", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; @@ -9063,6 +9841,7 @@ interface HTMLBodyElement extends HTMLElement { addEventListener(type: "gotpointercapture", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; addEventListener(type: "hashchange", listener: (ev: HashChangeEvent) => any, useCapture?: boolean): void; addEventListener(type: "input", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "invalid", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "keydown", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "keypress", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "keyup", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; @@ -9080,13 +9859,13 @@ interface HTMLBodyElement extends HTMLElement { addEventListener(type: "mouseout", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "mouseover", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "mouseup", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousewheel", listener: (ev: MouseWheelEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mousewheel", listener: (ev: WheelEvent) => any, useCapture?: boolean): void; addEventListener(type: "offline", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "online", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "orientationchange", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "pagehide", listener: (ev: PageTransitionEvent) => any, useCapture?: boolean): void; addEventListener(type: "pageshow", listener: (ev: PageTransitionEvent) => any, useCapture?: boolean): void; - addEventListener(type: "paste", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "paste", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "pause", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "play", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "playing", listener: (ev: Event) => any, useCapture?: boolean): void; @@ -9140,7 +9919,7 @@ interface HTMLButtonElement extends HTMLElement { /** * Retrieves a reference to the form that the object is embedded in. */ - form: HTMLFormElement; + readonly form: HTMLFormElement; /** * Overrides the action attribute (where the data on a form is sent) on the parent form element. */ @@ -9173,11 +9952,11 @@ interface HTMLButtonElement extends HTMLElement { /** * 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. */ - validationMessage: string; + readonly validationMessage: string; /** * Returns a ValidityState object that represents the validity states of an element. */ - validity: ValidityState; + readonly validity: ValidityState; /** * Sets or retrieves the default or selected value of the control. */ @@ -9185,15 +9964,11 @@ interface HTMLButtonElement extends HTMLElement { /** * Returns whether an element will successfully validate based on forms validation rules and constraints. */ - willValidate: boolean; + readonly willValidate: boolean; /** * Returns whether a form will validate when it is submitted, without having to submit it. */ checkValidity(): boolean; - /** - * Creates a TextRange object for the element. - */ - createTextRange(): TextRange; /** * Sets a custom error message that is displayed when a form is submitted. * @param error Sets a custom error message that is displayed when a form is submitted. @@ -9243,11 +10018,11 @@ interface HTMLCollection { /** * Sets or retrieves the number of objects in a collection. */ - length: number; + readonly length: number; /** * Retrieves an object from various collections. */ - item(nameOrIndex?: any, optionalIndex?: any): Element; + item(index: number): Element; /** * Retrieves a select object or an object from an options collection. */ @@ -9260,18 +10035,6 @@ declare var HTMLCollection: { new(): HTMLCollection; } -interface HTMLDDElement extends HTMLElement { - /** - * Sets or retrieves whether the browser automatically performs wordwrap. - */ - noWrap: boolean; -} - -declare var HTMLDDElement: { - prototype: HTMLDDElement; - new(): HTMLDDElement; -} - interface HTMLDListElement extends HTMLElement { compact: boolean; } @@ -9281,20 +10044,8 @@ declare var HTMLDListElement: { new(): HTMLDListElement; } -interface HTMLDTElement extends HTMLElement { - /** - * Sets or retrieves whether the browser automatically performs wordwrap. - */ - noWrap: boolean; -} - -declare var HTMLDTElement: { - prototype: HTMLDTElement; - new(): HTMLDTElement; -} - interface HTMLDataListElement extends HTMLElement { - options: HTMLCollection; + options: HTMLCollectionOf; } declare var HTMLDataListElement: { @@ -9337,38 +10088,38 @@ declare var HTMLDocument: { interface HTMLElement extends Element { accessKey: string; - children: HTMLCollection; + readonly children: HTMLCollection; contentEditable: string; - dataset: DOMStringMap; + readonly dataset: DOMStringMap; dir: string; draggable: boolean; hidden: boolean; hideFocus: boolean; innerHTML: string; innerText: string; - isContentEditable: boolean; + readonly isContentEditable: boolean; lang: string; - offsetHeight: number; - offsetLeft: number; - offsetParent: Element; - offsetTop: number; - offsetWidth: number; + readonly offsetHeight: number; + readonly offsetLeft: number; + readonly offsetParent: Element; + readonly offsetTop: number; + readonly offsetWidth: number; onabort: (ev: Event) => any; onactivate: (ev: UIEvent) => any; onbeforeactivate: (ev: UIEvent) => any; - onbeforecopy: (ev: DragEvent) => any; - onbeforecut: (ev: DragEvent) => any; + onbeforecopy: (ev: ClipboardEvent) => any; + onbeforecut: (ev: ClipboardEvent) => any; onbeforedeactivate: (ev: UIEvent) => any; - onbeforepaste: (ev: DragEvent) => any; + onbeforepaste: (ev: ClipboardEvent) => any; onblur: (ev: FocusEvent) => any; oncanplay: (ev: Event) => any; oncanplaythrough: (ev: Event) => any; onchange: (ev: Event) => any; onclick: (ev: MouseEvent) => any; oncontextmenu: (ev: PointerEvent) => any; - oncopy: (ev: DragEvent) => any; + oncopy: (ev: ClipboardEvent) => any; oncuechange: (ev: Event) => any; - oncut: (ev: DragEvent) => any; + oncut: (ev: ClipboardEvent) => any; ondblclick: (ev: MouseEvent) => any; ondeactivate: (ev: UIEvent) => any; ondrag: (ev: DragEvent) => any; @@ -9380,10 +10131,11 @@ interface HTMLElement extends Element { ondrop: (ev: DragEvent) => any; ondurationchange: (ev: Event) => any; onemptied: (ev: Event) => any; - onended: (ev: Event) => any; + onended: (ev: MediaStreamErrorEvent) => any; onerror: (ev: Event) => any; onfocus: (ev: FocusEvent) => any; oninput: (ev: Event) => any; + oninvalid: (ev: Event) => any; onkeydown: (ev: KeyboardEvent) => any; onkeypress: (ev: KeyboardEvent) => any; onkeyup: (ev: KeyboardEvent) => any; @@ -9398,10 +10150,10 @@ interface HTMLElement extends Element { onmouseout: (ev: MouseEvent) => any; onmouseover: (ev: MouseEvent) => any; onmouseup: (ev: MouseEvent) => any; - onmousewheel: (ev: MouseWheelEvent) => any; + onmousewheel: (ev: WheelEvent) => any; onmscontentzoom: (ev: UIEvent) => any; onmsmanipulationstatechanged: (ev: MSManipulationEvent) => any; - onpaste: (ev: DragEvent) => any; + onpaste: (ev: ClipboardEvent) => any; onpause: (ev: Event) => any; onplay: (ev: Event) => any; onplaying: (ev: Event) => any; @@ -9422,7 +10174,7 @@ interface HTMLElement extends Element { outerHTML: string; outerText: string; spellcheck: boolean; - style: CSSStyleDeclaration; + readonly style: CSSStyleDeclaration; tabIndex: number; title: string; blur(): void; @@ -9458,10 +10210,10 @@ interface HTMLElement extends Element { addEventListener(type: "activate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; addEventListener(type: "ariarequest", listener: (ev: AriaRequestEvent) => any, useCapture?: boolean): void; addEventListener(type: "beforeactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecopy", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecut", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforecopy", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforecut", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "beforedeactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforepaste", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforepaste", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "blur", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; addEventListener(type: "canplay", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "canplaythrough", listener: (ev: Event) => any, useCapture?: boolean): void; @@ -9469,9 +10221,9 @@ interface HTMLElement extends Element { addEventListener(type: "click", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "command", listener: (ev: CommandEvent) => any, useCapture?: boolean): void; addEventListener(type: "contextmenu", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "copy", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "copy", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "cuechange", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "cut", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "cut", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "dblclick", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "deactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; addEventListener(type: "drag", listener: (ev: DragEvent) => any, useCapture?: boolean): void; @@ -9483,11 +10235,12 @@ interface HTMLElement extends Element { addEventListener(type: "drop", listener: (ev: DragEvent) => any, useCapture?: boolean): void; addEventListener(type: "durationchange", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "emptied", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "ended", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "ended", listener: (ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: "focus", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; addEventListener(type: "gotpointercapture", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; addEventListener(type: "input", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "invalid", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "keydown", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "keypress", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "keyup", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; @@ -9503,8 +10256,8 @@ interface HTMLElement extends Element { addEventListener(type: "mouseout", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "mouseover", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "mouseup", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousewheel", listener: (ev: MouseWheelEvent) => any, useCapture?: boolean): void; - addEventListener(type: "paste", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mousewheel", listener: (ev: WheelEvent) => any, useCapture?: boolean): void; + addEventListener(type: "paste", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "pause", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "play", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "playing", listener: (ev: Event) => any, useCapture?: boolean): void; @@ -9566,7 +10319,7 @@ interface HTMLEmbedElement extends HTMLElement, GetSVGDocument { /** * Gets the source associated with the media element for use by the PlayToManager. */ - msPlayToSource: any; + readonly msPlayToSource: any; /** * Sets or retrieves the name of the object. */ @@ -9574,12 +10327,12 @@ interface HTMLEmbedElement extends HTMLElement, GetSVGDocument { /** * Retrieves the palette used for the embedded document. */ - palette: string; + readonly palette: string; /** * Retrieves the URL of the plug-in used to view an embedded document. */ - pluginspage: string; - readyState: string; + readonly pluginspage: string; + readonly readyState: string; /** * Sets or retrieves a URL to be loaded by the object. */ @@ -9609,19 +10362,19 @@ interface HTMLFieldSetElement extends HTMLElement { /** * Retrieves a reference to the form that the object is embedded in. */ - form: HTMLFormElement; + readonly form: HTMLFormElement; /** * 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. */ - validationMessage: string; + readonly validationMessage: string; /** * Returns a ValidityState object that represents the validity states of an element. */ - validity: ValidityState; + readonly validity: ValidityState; /** * Returns whether an element will successfully validate based on forms validation rules and constraints. */ - willValidate: boolean; + readonly willValidate: boolean; /** * Returns whether a form will validate when it is submitted, without having to submit it. */ @@ -9667,7 +10420,7 @@ interface HTMLFormElement extends HTMLElement { /** * Retrieves a collection, in source order, of all controls in a given form. */ - elements: HTMLCollection; + readonly elements: HTMLCollection; /** * Sets or retrieves the MIME encoding for the form. */ @@ -9679,7 +10432,7 @@ interface HTMLFormElement extends HTMLElement { /** * Sets or retrieves the number of objects in a collection. */ - length: number; + readonly length: number; /** * Sets or retrieves how to send the form data to the server. */ @@ -9738,11 +10491,11 @@ interface HTMLFrameElement extends HTMLElement, GetSVGDocument { /** * Retrieves the document object of the page or frame. */ - contentDocument: Document; + readonly contentDocument: Document; /** * Retrieves the object of the specified. */ - contentWindow: Window; + readonly contentWindow: Window; /** * Sets or retrieves whether to display a border for the frame. */ @@ -9783,10 +10536,6 @@ interface HTMLFrameElement extends HTMLElement, GetSVGDocument { * Sets or retrieves whether the frame can be scrolled. */ scrolling: string; - /** - * Sets the value indicating whether the source file of a frame or iframe has specific security restrictions applied. - */ - security: any; /** * Sets or retrieves a URL to be loaded by the object. */ @@ -9818,10 +10567,10 @@ interface HTMLFrameElement extends HTMLElement, GetSVGDocument { addEventListener(type: "activate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; addEventListener(type: "ariarequest", listener: (ev: AriaRequestEvent) => any, useCapture?: boolean): void; addEventListener(type: "beforeactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecopy", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecut", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforecopy", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforecut", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "beforedeactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforepaste", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforepaste", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "blur", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; addEventListener(type: "canplay", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "canplaythrough", listener: (ev: Event) => any, useCapture?: boolean): void; @@ -9829,9 +10578,9 @@ interface HTMLFrameElement extends HTMLElement, GetSVGDocument { addEventListener(type: "click", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "command", listener: (ev: CommandEvent) => any, useCapture?: boolean): void; addEventListener(type: "contextmenu", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "copy", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "copy", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "cuechange", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "cut", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "cut", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "dblclick", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "deactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; addEventListener(type: "drag", listener: (ev: DragEvent) => any, useCapture?: boolean): void; @@ -9843,11 +10592,12 @@ interface HTMLFrameElement extends HTMLElement, GetSVGDocument { addEventListener(type: "drop", listener: (ev: DragEvent) => any, useCapture?: boolean): void; addEventListener(type: "durationchange", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "emptied", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "ended", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "ended", listener: (ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: "focus", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; addEventListener(type: "gotpointercapture", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; addEventListener(type: "input", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "invalid", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "keydown", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "keypress", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "keyup", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; @@ -9864,8 +10614,8 @@ interface HTMLFrameElement extends HTMLElement, GetSVGDocument { addEventListener(type: "mouseout", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "mouseover", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "mouseup", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousewheel", listener: (ev: MouseWheelEvent) => any, useCapture?: boolean): void; - addEventListener(type: "paste", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mousewheel", listener: (ev: WheelEvent) => any, useCapture?: boolean): void; + addEventListener(type: "paste", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "pause", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "play", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "playing", listener: (ev: Event) => any, useCapture?: boolean): void; @@ -9975,10 +10725,10 @@ interface HTMLFrameSetElement extends HTMLElement { addEventListener(type: "activate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; addEventListener(type: "ariarequest", listener: (ev: AriaRequestEvent) => any, useCapture?: boolean): void; addEventListener(type: "beforeactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecopy", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecut", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforecopy", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforecut", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "beforedeactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforepaste", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforepaste", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "beforeprint", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "beforeunload", listener: (ev: BeforeUnloadEvent) => any, useCapture?: boolean): void; addEventListener(type: "blur", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; @@ -9989,9 +10739,9 @@ interface HTMLFrameSetElement extends HTMLElement { addEventListener(type: "click", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "command", listener: (ev: CommandEvent) => any, useCapture?: boolean): void; addEventListener(type: "contextmenu", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "copy", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "copy", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "cuechange", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "cut", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "cut", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "dblclick", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "deactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; addEventListener(type: "drag", listener: (ev: DragEvent) => any, useCapture?: boolean): void; @@ -10003,7 +10753,7 @@ interface HTMLFrameSetElement extends HTMLElement { addEventListener(type: "drop", listener: (ev: DragEvent) => any, useCapture?: boolean): void; addEventListener(type: "durationchange", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "emptied", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "ended", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "ended", listener: (ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: "focus", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; @@ -10011,6 +10761,7 @@ interface HTMLFrameSetElement extends HTMLElement { addEventListener(type: "gotpointercapture", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; addEventListener(type: "hashchange", listener: (ev: HashChangeEvent) => any, useCapture?: boolean): void; addEventListener(type: "input", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "invalid", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "keydown", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "keypress", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "keyup", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; @@ -10028,13 +10779,13 @@ interface HTMLFrameSetElement extends HTMLElement { addEventListener(type: "mouseout", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "mouseover", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "mouseup", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousewheel", listener: (ev: MouseWheelEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mousewheel", listener: (ev: WheelEvent) => any, useCapture?: boolean): void; addEventListener(type: "offline", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "online", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "orientationchange", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "pagehide", listener: (ev: PageTransitionEvent) => any, useCapture?: boolean): void; addEventListener(type: "pageshow", listener: (ev: PageTransitionEvent) => any, useCapture?: boolean): void; - addEventListener(type: "paste", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "paste", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "pause", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "play", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "playing", listener: (ev: Event) => any, useCapture?: boolean): void; @@ -10113,7 +10864,6 @@ interface HTMLHeadingElement extends HTMLElement { * Sets or retrieves a value that indicates the table alignment. */ align: string; - clear: string; } declare var HTMLHeadingElement: { @@ -10146,11 +10896,11 @@ interface HTMLIFrameElement extends HTMLElement, GetSVGDocument { /** * Retrieves the document object of the page or frame. */ - contentDocument: Document; + readonly contentDocument: Document; /** * Retrieves the object of the specified. */ - contentWindow: Window; + readonly contentWindow: Window; /** * Sets or retrieves whether to display a border for the frame. */ @@ -10191,15 +10941,11 @@ interface HTMLIFrameElement extends HTMLElement, GetSVGDocument { * Raised when the object has been completely received from the server. */ onload: (ev: Event) => any; - sandbox: DOMSettableTokenList; + readonly sandbox: DOMSettableTokenList; /** * Sets or retrieves whether the frame can be scrolled. */ scrolling: string; - /** - * Sets the value indicating whether the source file of a frame or iframe has specific security restrictions applied. - */ - security: any; /** * Sets or retrieves a URL to be loaded by the object. */ @@ -10235,10 +10981,10 @@ interface HTMLIFrameElement extends HTMLElement, GetSVGDocument { addEventListener(type: "activate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; addEventListener(type: "ariarequest", listener: (ev: AriaRequestEvent) => any, useCapture?: boolean): void; addEventListener(type: "beforeactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecopy", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecut", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforecopy", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforecut", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "beforedeactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforepaste", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforepaste", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "blur", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; addEventListener(type: "canplay", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "canplaythrough", listener: (ev: Event) => any, useCapture?: boolean): void; @@ -10246,9 +10992,9 @@ interface HTMLIFrameElement extends HTMLElement, GetSVGDocument { addEventListener(type: "click", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "command", listener: (ev: CommandEvent) => any, useCapture?: boolean): void; addEventListener(type: "contextmenu", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "copy", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "copy", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "cuechange", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "cut", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "cut", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "dblclick", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "deactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; addEventListener(type: "drag", listener: (ev: DragEvent) => any, useCapture?: boolean): void; @@ -10260,11 +11006,12 @@ interface HTMLIFrameElement extends HTMLElement, GetSVGDocument { addEventListener(type: "drop", listener: (ev: DragEvent) => any, useCapture?: boolean): void; addEventListener(type: "durationchange", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "emptied", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "ended", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "ended", listener: (ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: "focus", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; addEventListener(type: "gotpointercapture", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; addEventListener(type: "input", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "invalid", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "keydown", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "keypress", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "keyup", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; @@ -10281,8 +11028,8 @@ interface HTMLIFrameElement extends HTMLElement, GetSVGDocument { addEventListener(type: "mouseout", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "mouseover", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "mouseup", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousewheel", listener: (ev: MouseWheelEvent) => any, useCapture?: boolean): void; - addEventListener(type: "paste", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mousewheel", listener: (ev: WheelEvent) => any, useCapture?: boolean): void; + addEventListener(type: "paste", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "pause", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "play", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "playing", listener: (ev: Event) => any, useCapture?: boolean): void; @@ -10339,9 +11086,9 @@ interface HTMLImageElement extends HTMLElement { /** * Retrieves whether the object is fully loaded. */ - complete: boolean; + readonly complete: boolean; crossOrigin: string; - currentSrc: string; + readonly currentSrc: string; /** * Sets or retrieves the height of the object. */ @@ -10358,6 +11105,7 @@ interface HTMLImageElement extends HTMLElement { * Sets or retrieves a Uniform Resource Identifier (URI) to a long description of the object. */ longDesc: string; + lowsrc: string; /** * Gets or sets whether the DLNA PlayTo device is available. */ @@ -10370,7 +11118,7 @@ interface HTMLImageElement extends HTMLElement { /** * Gets the source associated with the media element for use by the PlayToManager. */ - msPlayToSource: any; + readonly msPlayToSource: any; /** * Sets or retrieves the name of the object. */ @@ -10378,11 +11126,12 @@ interface HTMLImageElement extends HTMLElement { /** * The original height of the image resource before sizing. */ - naturalHeight: number; + readonly naturalHeight: number; /** * The original width of the image resource before sizing. */ - naturalWidth: number; + readonly naturalWidth: number; + sizes: string; /** * The address or URL of the a media resource that is to be considered. */ @@ -10400,8 +11149,8 @@ interface HTMLImageElement extends HTMLElement { * Sets or retrieves the width of the object. */ width: number; - x: number; - y: number; + readonly x: number; + readonly y: number; msGetAsCastingSource(): any; } @@ -10443,7 +11192,7 @@ interface HTMLInputElement extends HTMLElement { /** * Retrieves whether the object is fully loaded. */ - complete: boolean; + readonly complete: boolean; /** * Sets or retrieves the state of the check box or radio button. */ @@ -10456,11 +11205,11 @@ interface HTMLInputElement extends HTMLElement { /** * Returns a FileList object on a file type input object. */ - files: FileList; + readonly files: FileList; /** * Retrieves a reference to the form that the object is embedded in. */ - form: HTMLFormElement; + readonly form: HTMLFormElement; /** * Overrides the action attribute (where the data on a form is sent) on the parent form element. */ @@ -10493,7 +11242,7 @@ interface HTMLInputElement extends HTMLElement { /** * Specifies the ID of a pre-defined datalist of options for an input element. */ - list: HTMLElement; + readonly list: HTMLElement; /** * 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. */ @@ -10527,6 +11276,7 @@ interface HTMLInputElement extends HTMLElement { * When present, marks an element that can't be submitted without a value. */ required: boolean; + selectionDirection: string; /** * Gets or sets the end position or offset of a text selection. */ @@ -10556,11 +11306,11 @@ interface HTMLInputElement extends HTMLElement { /** * 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. */ - validationMessage: string; + readonly validationMessage: string; /** * Returns a ValidityState object that represents the validity states of an element. */ - validity: ValidityState; + readonly validity: ValidityState; /** * Returns the value of the data at the cursor's current position. */ @@ -10574,6 +11324,7 @@ interface HTMLInputElement extends HTMLElement { * Sets or retrieves the vertical margin for the object. */ vspace: number; + webkitdirectory: boolean; /** * Sets or retrieves the width of the object. */ @@ -10581,15 +11332,12 @@ interface HTMLInputElement extends HTMLElement { /** * Returns whether an element will successfully validate based on forms validation rules and constraints. */ - willValidate: boolean; + readonly willValidate: boolean; + minLength: number; /** * Returns whether a form will validate when it is submitted, without having to submit it. */ checkValidity(): boolean; - /** - * Creates a TextRange object for the element. - */ - createTextRange(): TextRange; /** * Makes the selection equal to the current object. */ @@ -10604,7 +11352,7 @@ interface HTMLInputElement extends HTMLElement { * @param start The offset into the text field for the start of the selection. * @param end The offset into the text field for the end of the selection. */ - setSelectionRange(start: number, end: number): void; + setSelectionRange(start?: number, end?: number, direction?: string): void; /** * 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. * @param n Value to decrement the value by. @@ -10622,23 +11370,6 @@ declare var HTMLInputElement: { new(): HTMLInputElement; } -interface HTMLIsIndexElement extends HTMLElement { - /** - * Sets or retrieves the URL to which the form content is sent for processing. - */ - action: string; - /** - * Retrieves a reference to the form that the object is embedded in. - */ - form: HTMLFormElement; - prompt: string; -} - -declare var HTMLIsIndexElement: { - prototype: HTMLIsIndexElement; - new(): HTMLIsIndexElement; -} - interface HTMLLIElement extends HTMLElement { type: string; /** @@ -10656,7 +11387,7 @@ interface HTMLLabelElement extends HTMLElement { /** * Retrieves a reference to the form that the object is embedded in. */ - form: HTMLFormElement; + readonly form: HTMLFormElement; /** * Sets or retrieves the object to which the given label object is assigned. */ @@ -10676,7 +11407,7 @@ interface HTMLLegendElement extends HTMLElement { /** * Retrieves a reference to the form that the object is embedded in. */ - form: HTMLFormElement; + readonly form: HTMLFormElement; } declare var HTMLLegendElement: { @@ -10718,6 +11449,7 @@ interface HTMLLinkElement extends HTMLElement, LinkStyle { * Sets or retrieves the MIME type of the object. */ type: string; + import?: Document; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -10730,7 +11462,7 @@ interface HTMLMapElement extends HTMLElement { /** * Retrieves a collection of the area objects defined for the given map object. */ - areas: HTMLAreasCollection; + readonly areas: HTMLAreasCollection; /** * Sets or retrieves the name of the object. */ @@ -10782,10 +11514,10 @@ interface HTMLMarqueeElement extends HTMLElement { addEventListener(type: "activate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; addEventListener(type: "ariarequest", listener: (ev: AriaRequestEvent) => any, useCapture?: boolean): void; addEventListener(type: "beforeactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecopy", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecut", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforecopy", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforecut", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "beforedeactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforepaste", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforepaste", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "blur", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; addEventListener(type: "bounce", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "canplay", listener: (ev: Event) => any, useCapture?: boolean): void; @@ -10794,9 +11526,9 @@ interface HTMLMarqueeElement extends HTMLElement { addEventListener(type: "click", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "command", listener: (ev: CommandEvent) => any, useCapture?: boolean): void; addEventListener(type: "contextmenu", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "copy", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "copy", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "cuechange", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "cut", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "cut", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "dblclick", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "deactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; addEventListener(type: "drag", listener: (ev: DragEvent) => any, useCapture?: boolean): void; @@ -10808,12 +11540,13 @@ interface HTMLMarqueeElement extends HTMLElement { addEventListener(type: "drop", listener: (ev: DragEvent) => any, useCapture?: boolean): void; addEventListener(type: "durationchange", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "emptied", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "ended", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "ended", listener: (ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: "finish", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "focus", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; addEventListener(type: "gotpointercapture", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; addEventListener(type: "input", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "invalid", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "keydown", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "keypress", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "keyup", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; @@ -10829,8 +11562,8 @@ interface HTMLMarqueeElement extends HTMLElement { addEventListener(type: "mouseout", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "mouseover", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "mouseup", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousewheel", listener: (ev: MouseWheelEvent) => any, useCapture?: boolean): void; - addEventListener(type: "paste", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mousewheel", listener: (ev: WheelEvent) => any, useCapture?: boolean): void; + addEventListener(type: "paste", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "pause", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "play", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "playing", listener: (ev: Event) => any, useCapture?: boolean): void; @@ -10876,7 +11609,7 @@ interface HTMLMediaElement extends HTMLElement { /** * Returns an AudioTrackList object with the audio tracks for a given video element. */ - audioTracks: AudioTrackList; + readonly audioTracks: AudioTrackList; /** * Gets or sets a value that indicates whether to start playing the media automatically. */ @@ -10884,15 +11617,16 @@ interface HTMLMediaElement extends HTMLElement { /** * Gets a collection of buffered time ranges. */ - buffered: TimeRanges; + readonly buffered: TimeRanges; /** * 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). */ controls: boolean; + crossOrigin: string; /** * Gets the address or URL of the current media resource that is selected by IHTMLMediaElement. */ - currentSrc: string; + readonly currentSrc: string; /** * Gets or sets the current playback position, in seconds. */ @@ -10905,19 +11639,20 @@ interface HTMLMediaElement extends HTMLElement { /** * 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. */ - duration: number; + readonly duration: number; /** * Gets information about whether the playback has ended or not. */ - ended: boolean; + readonly ended: boolean; /** * Returns an object representing the current error state of the audio or video element. */ - error: MediaError; + readonly error: MediaError; /** * Gets or sets a flag to specify whether playback should restart after it completes. */ loop: boolean; + readonly mediaKeys: MediaKeys; /** * Specifies the purpose of the audio or video media, such as background audio or alerts. */ @@ -10926,11 +11661,11 @@ interface HTMLMediaElement extends HTMLElement { * Specifies the output device id that the audio will be sent to. */ msAudioDeviceType: string; - msGraphicsTrustStatus: MSGraphicsTrust; + readonly msGraphicsTrustStatus: MSGraphicsTrust; /** * Gets the MSMediaKeys object, which is used for decrypting media data, that is associated with this media element. */ - msKeys: MSMediaKeys; + readonly msKeys: MSMediaKeys; /** * Gets or sets whether the DLNA PlayTo device is available. */ @@ -10946,7 +11681,7 @@ interface HTMLMediaElement extends HTMLElement { /** * Gets the source associated with the media element for use by the PlayToManager. */ - msPlayToSource: any; + readonly msPlayToSource: any; /** * Specifies whether or not to enable low-latency playback on the media element. */ @@ -10958,12 +11693,13 @@ interface HTMLMediaElement extends HTMLElement { /** * Gets the current network activity for the element. */ - networkState: number; + readonly networkState: number; + onencrypted: (ev: MediaEncryptedEvent) => any; onmsneedkey: (ev: MSMediaKeyNeededEvent) => any; /** * Gets a flag that specifies whether playback is paused. */ - paused: boolean; + readonly paused: boolean; /** * 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. */ @@ -10971,7 +11707,7 @@ interface HTMLMediaElement extends HTMLElement { /** * Gets TimeRanges for the current media resource that has been played. */ - played: TimeRanges; + readonly played: TimeRanges; /** * Gets or sets the current playback position, in seconds. */ @@ -10980,17 +11716,18 @@ interface HTMLMediaElement extends HTMLElement { /** * Returns a TimeRanges object that represents the ranges of the current media resource that can be seeked. */ - seekable: TimeRanges; + readonly seekable: TimeRanges; /** * Gets a flag that indicates whether the the client is currently moving to a new playback position in the media resource. */ - seeking: boolean; + readonly seeking: boolean; /** * The address or URL of the a media resource that is to be considered. */ src: string; - textTracks: TextTrackList; - videoTracks: VideoTrackList; + srcObject: MediaStream; + readonly textTracks: TextTrackList; + readonly videoTracks: VideoTrackList; /** * Gets or sets the volume level for audio portions of the media element. */ @@ -11026,15 +11763,16 @@ interface HTMLMediaElement extends HTMLElement { * Loads and starts playback of a media resource. */ play(): void; - HAVE_CURRENT_DATA: number; - HAVE_ENOUGH_DATA: number; - HAVE_FUTURE_DATA: number; - HAVE_METADATA: number; - HAVE_NOTHING: number; - NETWORK_EMPTY: number; - NETWORK_IDLE: number; - NETWORK_LOADING: number; - NETWORK_NO_SOURCE: number; + setMediaKeys(mediaKeys: MediaKeys): PromiseLike; + readonly HAVE_CURRENT_DATA: number; + readonly HAVE_ENOUGH_DATA: number; + readonly HAVE_FUTURE_DATA: number; + readonly HAVE_METADATA: number; + readonly HAVE_NOTHING: number; + readonly NETWORK_EMPTY: number; + readonly NETWORK_IDLE: number; + readonly NETWORK_LOADING: number; + readonly NETWORK_NO_SOURCE: number; addEventListener(type: "MSContentZoom", listener: (ev: UIEvent) => any, useCapture?: boolean): void; addEventListener(type: "MSGestureChange", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void; addEventListener(type: "MSGestureDoubleTap", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void; @@ -11058,10 +11796,10 @@ interface HTMLMediaElement extends HTMLElement { addEventListener(type: "activate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; addEventListener(type: "ariarequest", listener: (ev: AriaRequestEvent) => any, useCapture?: boolean): void; addEventListener(type: "beforeactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecopy", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecut", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforecopy", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforecut", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "beforedeactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforepaste", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforepaste", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "blur", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; addEventListener(type: "canplay", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "canplaythrough", listener: (ev: Event) => any, useCapture?: boolean): void; @@ -11069,9 +11807,9 @@ interface HTMLMediaElement extends HTMLElement { addEventListener(type: "click", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "command", listener: (ev: CommandEvent) => any, useCapture?: boolean): void; addEventListener(type: "contextmenu", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "copy", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "copy", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "cuechange", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "cut", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "cut", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "dblclick", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "deactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; addEventListener(type: "drag", listener: (ev: DragEvent) => any, useCapture?: boolean): void; @@ -11083,11 +11821,13 @@ interface HTMLMediaElement extends HTMLElement { addEventListener(type: "drop", listener: (ev: DragEvent) => any, useCapture?: boolean): void; addEventListener(type: "durationchange", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "emptied", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "ended", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "encrypted", listener: (ev: MediaEncryptedEvent) => any, useCapture?: boolean): void; + addEventListener(type: "ended", listener: (ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: "focus", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; addEventListener(type: "gotpointercapture", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; addEventListener(type: "input", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "invalid", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "keydown", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "keypress", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "keyup", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; @@ -11103,9 +11843,9 @@ interface HTMLMediaElement extends HTMLElement { addEventListener(type: "mouseout", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "mouseover", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "mouseup", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousewheel", listener: (ev: MouseWheelEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mousewheel", listener: (ev: WheelEvent) => any, useCapture?: boolean): void; addEventListener(type: "msneedkey", listener: (ev: MSMediaKeyNeededEvent) => any, useCapture?: boolean): void; - addEventListener(type: "paste", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "paste", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "pause", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "play", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "playing", listener: (ev: Event) => any, useCapture?: boolean): void; @@ -11144,15 +11884,15 @@ interface HTMLMediaElement extends HTMLElement { declare var HTMLMediaElement: { prototype: HTMLMediaElement; new(): HTMLMediaElement; - HAVE_CURRENT_DATA: number; - HAVE_ENOUGH_DATA: number; - HAVE_FUTURE_DATA: number; - HAVE_METADATA: number; - HAVE_NOTHING: number; - NETWORK_EMPTY: number; - NETWORK_IDLE: number; - NETWORK_LOADING: number; - NETWORK_NO_SOURCE: number; + readonly HAVE_CURRENT_DATA: number; + readonly HAVE_ENOUGH_DATA: number; + readonly HAVE_FUTURE_DATA: number; + readonly HAVE_METADATA: number; + readonly HAVE_NOTHING: number; + readonly NETWORK_EMPTY: number; + readonly NETWORK_IDLE: number; + readonly NETWORK_LOADING: number; + readonly NETWORK_NO_SOURCE: number; } interface HTMLMenuElement extends HTMLElement { @@ -11197,6 +11937,20 @@ declare var HTMLMetaElement: { new(): HTMLMetaElement; } +interface HTMLMeterElement extends HTMLElement { + high: number; + low: number; + max: number; + min: number; + optimum: number; + value: number; +} + +declare var HTMLMeterElement: { + prototype: HTMLMeterElement; + new(): HTMLMeterElement; +} + interface HTMLModElement extends HTMLElement { /** * Sets or retrieves reference information about the object. @@ -11213,15 +11967,6 @@ declare var HTMLModElement: { new(): HTMLModElement; } -interface HTMLNextIdElement extends HTMLElement { - n: string; -} - -declare var HTMLNextIdElement: { - prototype: HTMLNextIdElement; - new(): HTMLNextIdElement; -} - interface HTMLOListElement extends HTMLElement { compact: boolean; /** @@ -11240,7 +11985,7 @@ interface HTMLObjectElement extends HTMLElement, GetSVGDocument { /** * 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. */ - BaseHref: string; + readonly BaseHref: string; align: string; /** * Sets or retrieves a text alternative to the graphic. @@ -11270,7 +12015,7 @@ interface HTMLObjectElement extends HTMLElement, GetSVGDocument { /** * Retrieves the document object of the page or frame. */ - contentDocument: Document; + readonly contentDocument: Document; /** * Sets or retrieves the URL that references the data of the object. */ @@ -11279,7 +12024,7 @@ interface HTMLObjectElement extends HTMLElement, GetSVGDocument { /** * Retrieves a reference to the form that the object is embedded in. */ - form: HTMLFormElement; + readonly form: HTMLFormElement; /** * Sets or retrieves the height of the object. */ @@ -11300,7 +12045,7 @@ interface HTMLObjectElement extends HTMLElement, GetSVGDocument { /** * Gets the source associated with the media element for use by the PlayToManager. */ - msPlayToSource: any; + readonly msPlayToSource: any; /** * Sets or retrieves the name of the object. */ @@ -11308,8 +12053,8 @@ interface HTMLObjectElement extends HTMLElement, GetSVGDocument { /** * Retrieves the contained object. */ - object: any; - readyState: number; + readonly object: any; + readonly readyState: number; /** * Sets or retrieves a message to be displayed while an object is loading. */ @@ -11325,11 +12070,11 @@ interface HTMLObjectElement extends HTMLElement, GetSVGDocument { /** * 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. */ - validationMessage: string; + readonly validationMessage: string; /** * Returns a ValidityState object that represents the validity states of an element. */ - validity: ValidityState; + readonly validity: ValidityState; vspace: number; /** * Sets or retrieves the width of the object. @@ -11338,7 +12083,7 @@ interface HTMLObjectElement extends HTMLElement, GetSVGDocument { /** * Returns whether an element will successfully validate based on forms validation rules and constraints. */ - willValidate: boolean; + readonly willValidate: boolean; /** * Returns whether a form will validate when it is submitted, without having to submit it. */ @@ -11365,11 +12110,11 @@ interface HTMLOptGroupElement extends HTMLElement { /** * Retrieves a reference to the form that the object is embedded in. */ - form: HTMLFormElement; + readonly form: HTMLFormElement; /** * Sets or retrieves the ordinal position of an option in a list box. */ - index: number; + readonly index: number; /** * Sets or retrieves a value that you can use to implement your own label functionality for the object. */ @@ -11381,7 +12126,7 @@ interface HTMLOptGroupElement extends HTMLElement { /** * Sets or retrieves the text string specified by the option tag. */ - text: string; + readonly text: string; /** * Sets or retrieves the value which is returned to the server when the form control is submitted. */ @@ -11402,11 +12147,11 @@ interface HTMLOptionElement extends HTMLElement { /** * Retrieves a reference to the form that the object is embedded in. */ - form: HTMLFormElement; + readonly form: HTMLFormElement; /** * Sets or retrieves the ordinal position of an option in a list box. */ - index: number; + readonly index: number; /** * Sets or retrieves a value that you can use to implement your own label functionality for the object. */ @@ -11431,6 +12176,18 @@ declare var HTMLOptionElement: { create(): HTMLOptionElement; } +interface HTMLOptionsCollection extends HTMLCollection { + length: number; + selectedIndex: number; + add(element: HTMLOptionElement | HTMLOptGroupElement, before?: HTMLElement | number): void; + remove(index: number): void; +} + +declare var HTMLOptionsCollection: { + prototype: HTMLOptionsCollection; + new(): HTMLOptionsCollection; +} + interface HTMLParagraphElement extends HTMLElement { /** * Sets or retrieves how the object is aligned with adjacent text. @@ -11468,28 +12225,15 @@ declare var HTMLParamElement: { new(): HTMLParamElement; } -interface HTMLPhraseElement extends HTMLElement { - /** - * Sets or retrieves reference information about the object. - */ - cite: string; - /** - * Sets or retrieves the date and time of a modification to the object. - */ - dateTime: string; +interface HTMLPictureElement extends HTMLElement { } -declare var HTMLPhraseElement: { - prototype: HTMLPhraseElement; - new(): HTMLPhraseElement; +declare var HTMLPictureElement: { + prototype: HTMLPictureElement; + new(): HTMLPictureElement; } interface HTMLPreElement extends HTMLElement { - /** - * Indicates a citation by rendering text in italic type. - */ - cite: string; - clear: string; /** * Sets or gets a value that you can use to implement your own width functionality for the object. */ @@ -11505,7 +12249,7 @@ interface HTMLProgressElement extends HTMLElement { /** * Retrieves a reference to the form that the object is embedded in. */ - form: HTMLFormElement; + readonly form: HTMLFormElement; /** * Defines the maximum, or "done" value for a progress element. */ @@ -11513,7 +12257,7 @@ interface HTMLProgressElement extends HTMLElement { /** * 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). */ - position: number; + readonly position: number; /** * Sets or gets the current value of a progress element. The value must be a non-negative number between 0 and the max value. */ @@ -11530,10 +12274,6 @@ interface HTMLQuoteElement extends HTMLElement { * Sets or retrieves reference information about the object. */ cite: string; - /** - * Sets or retrieves the date and time of a modification to the object. - */ - dateTime: string; } declare var HTMLQuoteElement: { @@ -11587,7 +12327,7 @@ interface HTMLSelectElement extends HTMLElement { /** * Retrieves a reference to the form that the object is embedded in. */ - form: HTMLFormElement; + readonly form: HTMLFormElement; /** * Sets or retrieves the number of objects in a collection. */ @@ -11600,7 +12340,7 @@ interface HTMLSelectElement extends HTMLElement { * Sets or retrieves the name of the object. */ name: string; - options: HTMLCollection; + options: HTMLCollectionOf; /** * When present, marks an element that can't be submitted without a value. */ @@ -11609,6 +12349,7 @@ interface HTMLSelectElement extends HTMLElement { * Sets or retrieves the index of the selected option in a select object. */ selectedIndex: number; + selectedOptions: HTMLCollectionOf; /** * Sets or retrieves the number of rows in the list box. */ @@ -11616,15 +12357,15 @@ interface HTMLSelectElement extends HTMLElement { /** * Retrieves the type of select control based on the value of the MULTIPLE attribute. */ - type: string; + readonly type: string; /** * 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. */ - validationMessage: string; + readonly validationMessage: string; /** * Returns a ValidityState object that represents the validity states of an element. */ - validity: ValidityState; + readonly validity: ValidityState; /** * Sets or retrieves the value which is returned to the server when the form control is submitted. */ @@ -11632,8 +12373,7 @@ interface HTMLSelectElement extends HTMLElement { /** * Returns whether an element will successfully validate based on forms validation rules and constraints. */ - willValidate: boolean; - selectedOptions: HTMLCollection; + readonly willValidate: boolean; /** * Adds an element to the areas, controlRange, or options collection. * @param element Variant of type Number that specifies the index position in the collection where the element is placed. If no value is given, the method places the element at the end of the collection. @@ -11679,10 +12419,12 @@ interface HTMLSourceElement extends HTMLElement { */ media: string; msKeySystem: string; + sizes: string; /** * The address or URL of the a media resource that is to be considered. */ src: string; + srcset: string; /** * Gets or sets the MIME type of a media resource. */ @@ -11703,6 +12445,7 @@ declare var HTMLSpanElement: { } interface HTMLStyleElement extends HTMLElement, LinkStyle { + disabled: boolean; /** * Sets or retrieves the media type. */ @@ -11752,7 +12495,7 @@ interface HTMLTableCellElement extends HTMLElement, HTMLTableAlignment { /** * Retrieves the position of the object in the cells collection of a row. */ - cellIndex: number; + readonly cellIndex: number; /** * Sets or retrieves the number columns in the table that the object should span. */ @@ -11859,7 +12602,7 @@ interface HTMLTableElement extends HTMLElement { /** * Sets or retrieves the number of horizontal rows contained in the object. */ - rows: HTMLCollection; + rows: HTMLCollectionOf; /** * Sets or retrieves which dividing lines (inner borders) are displayed. */ @@ -11871,7 +12614,7 @@ interface HTMLTableElement extends HTMLElement { /** * Retrieves a collection of all tBody objects in the table. Objects in this collection are in source order. */ - tBodies: HTMLCollection; + tBodies: HTMLCollectionOf; /** * Retrieves the tFoot object of the table. */ @@ -11950,7 +12693,7 @@ interface HTMLTableRowElement extends HTMLElement, HTMLTableAlignment { /** * Retrieves a collection of all cells in the table row. */ - cells: HTMLCollection; + cells: HTMLCollectionOf; /** * Sets or retrieves the height of the object. */ @@ -11958,11 +12701,11 @@ interface HTMLTableRowElement extends HTMLElement, HTMLTableAlignment { /** * Retrieves the position of the object in the rows collection for the table. */ - rowIndex: number; + readonly rowIndex: number; /** * Retrieves the position of the object in the collection. */ - sectionRowIndex: number; + readonly sectionRowIndex: number; /** * Removes the specified cell from the table row, as well as from the cells collection. * @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. @@ -11972,7 +12715,7 @@ interface HTMLTableRowElement extends HTMLElement, HTMLTableAlignment { * Creates a new cell in the table row, and adds the cell to the cells collection. * @param index Number that specifies where to insert the cell in the tr. The default value is -1, which appends the new cell to the end of the cells collection. */ - insertCell(index?: number): HTMLTableCellElement; + insertCell(index?: number): HTMLTableDataCellElement; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -11989,7 +12732,7 @@ interface HTMLTableSectionElement extends HTMLElement, HTMLTableAlignment { /** * Sets or retrieves the number of horizontal rows contained in the object. */ - rows: HTMLCollection; + rows: HTMLCollectionOf; /** * Removes the specified row (tr) from the element and from the rows collection. * @param index Number that specifies the zero-based position in the rows collection of the row to remove. @@ -12008,6 +12751,15 @@ declare var HTMLTableSectionElement: { new(): HTMLTableSectionElement; } +interface HTMLTemplateElement extends HTMLElement { + readonly content: DocumentFragment; +} + +declare var HTMLTemplateElement: { + prototype: HTMLTemplateElement; + new(): HTMLTemplateElement; +} + interface HTMLTextAreaElement extends HTMLElement { /** * 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. @@ -12025,7 +12777,7 @@ interface HTMLTextAreaElement extends HTMLElement { /** * Retrieves a reference to the form that the object is embedded in. */ - form: HTMLFormElement; + readonly form: HTMLFormElement; /** * Sets or retrieves the maximum number of characters that the user can enter in a text control. */ @@ -12065,15 +12817,15 @@ interface HTMLTextAreaElement extends HTMLElement { /** * Retrieves the type of control. */ - type: string; + readonly type: string; /** * 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. */ - validationMessage: string; + readonly validationMessage: string; /** * Returns a ValidityState object that represents the validity states of an element. */ - validity: ValidityState; + readonly validity: ValidityState; /** * Retrieves or sets the text in the entry field of the textArea element. */ @@ -12081,19 +12833,16 @@ interface HTMLTextAreaElement extends HTMLElement { /** * Returns whether an element will successfully validate based on forms validation rules and constraints. */ - willValidate: boolean; + readonly willValidate: boolean; /** * Sets or retrieves how to handle wordwrapping in the object. */ wrap: string; + minLength: number; /** * Returns whether a form will validate when it is submitted, without having to submit it. */ checkValidity(): boolean; - /** - * Creates a TextRange object for the element. - */ - createTextRange(): TextRange; /** * Highlights the input area of a form element. */ @@ -12132,23 +12881,23 @@ interface HTMLTrackElement extends HTMLElement { default: boolean; kind: string; label: string; - readyState: number; + readonly readyState: number; src: string; srclang: string; - track: TextTrack; - ERROR: number; - LOADED: number; - LOADING: number; - NONE: number; + readonly track: TextTrack; + readonly ERROR: number; + readonly LOADED: number; + readonly LOADING: number; + readonly NONE: number; } declare var HTMLTrackElement: { prototype: HTMLTrackElement; new(): HTMLTrackElement; - ERROR: number; - LOADED: number; - LOADING: number; - NONE: number; + readonly ERROR: number; + readonly LOADED: number; + readonly LOADING: number; + readonly NONE: number; } interface HTMLUListElement extends HTMLElement { @@ -12175,8 +12924,8 @@ interface HTMLVideoElement extends HTMLMediaElement { */ height: number; msHorizontalMirror: boolean; - msIsLayoutOptimalForPlayback: boolean; - msIsStereo3D: boolean; + readonly msIsLayoutOptimalForPlayback: boolean; + readonly msIsStereo3D: boolean; msStereo3DPackingMode: string; msStereo3DRenderMode: string; msZoom: boolean; @@ -12190,13 +12939,13 @@ interface HTMLVideoElement extends HTMLMediaElement { /** * Gets the intrinsic height of a video in CSS pixels, or zero if the dimensions are not known. */ - videoHeight: number; + readonly videoHeight: number; /** * Gets the intrinsic width of a video in CSS pixels, or zero if the dimensions are not known. */ - videoWidth: number; - webkitDisplayingFullscreen: boolean; - webkitSupportsFullscreen: boolean; + readonly videoWidth: number; + readonly webkitDisplayingFullscreen: boolean; + readonly webkitSupportsFullscreen: boolean; /** * Gets or sets the width of the video element. */ @@ -12235,10 +12984,10 @@ interface HTMLVideoElement extends HTMLMediaElement { addEventListener(type: "activate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; addEventListener(type: "ariarequest", listener: (ev: AriaRequestEvent) => any, useCapture?: boolean): void; addEventListener(type: "beforeactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecopy", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecut", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforecopy", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforecut", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "beforedeactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforepaste", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforepaste", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "blur", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; addEventListener(type: "canplay", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "canplaythrough", listener: (ev: Event) => any, useCapture?: boolean): void; @@ -12246,9 +12995,9 @@ interface HTMLVideoElement extends HTMLMediaElement { addEventListener(type: "click", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "command", listener: (ev: CommandEvent) => any, useCapture?: boolean): void; addEventListener(type: "contextmenu", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "copy", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "copy", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "cuechange", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "cut", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "cut", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "dblclick", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "deactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; addEventListener(type: "drag", listener: (ev: DragEvent) => any, useCapture?: boolean): void; @@ -12260,11 +13009,13 @@ interface HTMLVideoElement extends HTMLMediaElement { addEventListener(type: "drop", listener: (ev: DragEvent) => any, useCapture?: boolean): void; addEventListener(type: "durationchange", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "emptied", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "ended", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "encrypted", listener: (ev: MediaEncryptedEvent) => any, useCapture?: boolean): void; + addEventListener(type: "ended", listener: (ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: "focus", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; addEventListener(type: "gotpointercapture", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; addEventListener(type: "input", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "invalid", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "keydown", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "keypress", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "keyup", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; @@ -12280,9 +13031,9 @@ interface HTMLVideoElement extends HTMLMediaElement { addEventListener(type: "mouseout", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "mouseover", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "mouseup", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousewheel", listener: (ev: MouseWheelEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mousewheel", listener: (ev: WheelEvent) => any, useCapture?: boolean): void; addEventListener(type: "msneedkey", listener: (ev: MSMediaKeyNeededEvent) => any, useCapture?: boolean): void; - addEventListener(type: "paste", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "paste", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "pause", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "play", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "playing", listener: (ev: Event) => any, useCapture?: boolean): void; @@ -12324,8 +13075,8 @@ declare var HTMLVideoElement: { } interface HashChangeEvent extends Event { - newURL: string; - oldURL: string; + readonly newURL: string; + readonly oldURL: string; } declare var HashChangeEvent: { @@ -12334,8 +13085,8 @@ declare var HashChangeEvent: { } interface History { - length: number; - state: any; + readonly length: number; + readonly state: any; back(distance?: any): void; forward(distance?: any): void; go(delta?: any): void; @@ -12349,31 +13100,31 @@ declare var History: { } interface IDBCursor { - direction: string; - key: any; - primaryKey: any; + readonly direction: string; + key: IDBKeyRange | IDBValidKey; + readonly primaryKey: any; source: IDBObjectStore | IDBIndex; advance(count: number): void; - continue(key?: any): void; + continue(key?: IDBKeyRange | IDBValidKey): void; delete(): IDBRequest; update(value: any): IDBRequest; - NEXT: string; - NEXT_NO_DUPLICATE: string; - PREV: string; - PREV_NO_DUPLICATE: string; + readonly NEXT: string; + readonly NEXT_NO_DUPLICATE: string; + readonly PREV: string; + readonly PREV_NO_DUPLICATE: string; } declare var IDBCursor: { prototype: IDBCursor; new(): IDBCursor; - NEXT: string; - NEXT_NO_DUPLICATE: string; - PREV: string; - PREV_NO_DUPLICATE: string; + readonly NEXT: string; + readonly NEXT_NO_DUPLICATE: string; + readonly PREV: string; + readonly PREV_NO_DUPLICATE: string; } interface IDBCursorWithValue extends IDBCursor { - value: any; + readonly value: any; } declare var IDBCursorWithValue: { @@ -12382,15 +13133,17 @@ declare var IDBCursorWithValue: { } interface IDBDatabase extends EventTarget { - name: string; - objectStoreNames: DOMStringList; + readonly name: string; + readonly objectStoreNames: DOMStringList; onabort: (ev: Event) => any; onerror: (ev: Event) => any; version: number; + onversionchange: (ev: IDBVersionChangeEvent) => any; close(): void; createObjectStore(name: string, optionalParameters?: IDBObjectStoreParameters): IDBObjectStore; deleteObjectStore(name: string): void; transaction(storeNames: string | string[], mode?: string): IDBTransaction; + addEventListener(type: "versionchange", listener: (ev: IDBVersionChangeEvent) => any, useCapture?: boolean): void; addEventListener(type: "abort", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; @@ -12414,15 +13167,15 @@ declare var IDBFactory: { interface IDBIndex { keyPath: string | string[]; - name: string; - objectStore: IDBObjectStore; - unique: boolean; + readonly name: string; + readonly objectStore: IDBObjectStore; + readonly unique: boolean; multiEntry: boolean; - count(key?: any): IDBRequest; - get(key: any): IDBRequest; - getKey(key: any): IDBRequest; - openCursor(range?: IDBKeyRange, direction?: string): IDBRequest; - openKeyCursor(range?: IDBKeyRange, direction?: string): IDBRequest; + count(key?: IDBKeyRange | IDBValidKey): IDBRequest; + get(key: IDBKeyRange | IDBValidKey): IDBRequest; + getKey(key: IDBKeyRange | IDBValidKey): IDBRequest; + openCursor(range?: IDBKeyRange | IDBValidKey, direction?: string): IDBRequest; + openKeyCursor(range?: IDBKeyRange | IDBValidKey, direction?: string): IDBRequest; } declare var IDBIndex: { @@ -12431,37 +13184,37 @@ declare var IDBIndex: { } interface IDBKeyRange { - lower: any; - lowerOpen: boolean; - upper: any; - upperOpen: boolean; + readonly lower: any; + readonly lowerOpen: boolean; + readonly upper: any; + readonly upperOpen: boolean; } declare var IDBKeyRange: { prototype: IDBKeyRange; new(): IDBKeyRange; bound(lower: any, upper: any, lowerOpen?: boolean, upperOpen?: boolean): IDBKeyRange; - lowerBound(bound: any, open?: boolean): IDBKeyRange; + lowerBound(lower: any, open?: boolean): IDBKeyRange; only(value: any): IDBKeyRange; - upperBound(bound: any, open?: boolean): IDBKeyRange; + upperBound(upper: any, open?: boolean): IDBKeyRange; } interface IDBObjectStore { - indexNames: DOMStringList; + readonly indexNames: DOMStringList; keyPath: string | string[]; - name: string; - transaction: IDBTransaction; + readonly name: string; + readonly transaction: IDBTransaction; autoIncrement: boolean; - add(value: any, key?: any): IDBRequest; + add(value: any, key?: IDBKeyRange | IDBValidKey): IDBRequest; clear(): IDBRequest; - count(key?: any): IDBRequest; + count(key?: IDBKeyRange | IDBValidKey): IDBRequest; createIndex(name: string, keyPath: string | string[], optionalParameters?: IDBIndexParameters): IDBIndex; - delete(key: any): IDBRequest; + delete(key: IDBKeyRange | IDBValidKey): IDBRequest; deleteIndex(indexName: string): void; get(key: any): IDBRequest; index(name: string): IDBIndex; - openCursor(range?: any, direction?: string): IDBRequest; - put(value: any, key?: any): IDBRequest; + openCursor(range?: IDBKeyRange | IDBValidKey, direction?: string): IDBRequest; + put(value: any, key?: IDBKeyRange | IDBValidKey): IDBRequest; } declare var IDBObjectStore: { @@ -12485,13 +13238,13 @@ declare var IDBOpenDBRequest: { } interface IDBRequest extends EventTarget { - error: DOMError; + readonly error: DOMError; onerror: (ev: Event) => any; onsuccess: (ev: Event) => any; - readyState: string; - result: any; + readonly readyState: string; + readonly result: any; source: IDBObjectStore | IDBIndex | IDBCursor; - transaction: IDBTransaction; + readonly transaction: IDBTransaction; addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: "success", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; @@ -12503,17 +13256,17 @@ declare var IDBRequest: { } interface IDBTransaction extends EventTarget { - db: IDBDatabase; - error: DOMError; - mode: string; + readonly db: IDBDatabase; + readonly error: DOMError; + readonly mode: string; onabort: (ev: Event) => any; oncomplete: (ev: Event) => any; onerror: (ev: Event) => any; abort(): void; objectStore(name: string): IDBObjectStore; - READ_ONLY: string; - READ_WRITE: string; - VERSION_CHANGE: string; + readonly READ_ONLY: string; + readonly READ_WRITE: string; + readonly VERSION_CHANGE: string; addEventListener(type: "abort", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "complete", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; @@ -12523,14 +13276,14 @@ interface IDBTransaction extends EventTarget { declare var IDBTransaction: { prototype: IDBTransaction; new(): IDBTransaction; - READ_ONLY: string; - READ_WRITE: string; - VERSION_CHANGE: string; + readonly READ_ONLY: string; + readonly READ_WRITE: string; + readonly VERSION_CHANGE: string; } interface IDBVersionChangeEvent extends Event { - newVersion: number; - oldVersion: number; + readonly newVersion: number; + readonly oldVersion: number; } declare var IDBVersionChangeEvent: { @@ -12540,8 +13293,8 @@ declare var IDBVersionChangeEvent: { interface ImageData { data: Uint8ClampedArray; - height: number; - width: number; + readonly height: number; + readonly width: number; } declare var ImageData: { @@ -12551,37 +13304,47 @@ declare var ImageData: { } interface KeyboardEvent extends UIEvent { - altKey: boolean; - char: string; - charCode: number; - ctrlKey: boolean; - key: string; - keyCode: number; - locale: string; - location: number; - metaKey: boolean; - repeat: boolean; - shiftKey: boolean; - which: number; + readonly altKey: boolean; + readonly char: string; + readonly charCode: number; + readonly ctrlKey: boolean; + readonly key: string; + readonly keyCode: number; + readonly locale: string; + readonly location: number; + readonly metaKey: boolean; + readonly repeat: boolean; + readonly shiftKey: boolean; + readonly which: number; getModifierState(keyArg: string): boolean; initKeyboardEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, keyArg: string, locationArg: number, modifiersListArg: string, repeat: boolean, locale: string): void; - DOM_KEY_LOCATION_JOYSTICK: number; - DOM_KEY_LOCATION_LEFT: number; - DOM_KEY_LOCATION_MOBILE: number; - DOM_KEY_LOCATION_NUMPAD: number; - DOM_KEY_LOCATION_RIGHT: number; - DOM_KEY_LOCATION_STANDARD: number; + readonly DOM_KEY_LOCATION_JOYSTICK: number; + readonly DOM_KEY_LOCATION_LEFT: number; + readonly DOM_KEY_LOCATION_MOBILE: number; + readonly DOM_KEY_LOCATION_NUMPAD: number; + readonly DOM_KEY_LOCATION_RIGHT: number; + readonly DOM_KEY_LOCATION_STANDARD: number; } declare var KeyboardEvent: { prototype: KeyboardEvent; new(typeArg: string, eventInitDict?: KeyboardEventInit): KeyboardEvent; - DOM_KEY_LOCATION_JOYSTICK: number; - DOM_KEY_LOCATION_LEFT: number; - DOM_KEY_LOCATION_MOBILE: number; - DOM_KEY_LOCATION_NUMPAD: number; - DOM_KEY_LOCATION_RIGHT: number; - DOM_KEY_LOCATION_STANDARD: number; + readonly DOM_KEY_LOCATION_JOYSTICK: number; + readonly DOM_KEY_LOCATION_LEFT: number; + readonly DOM_KEY_LOCATION_MOBILE: number; + readonly DOM_KEY_LOCATION_NUMPAD: number; + readonly DOM_KEY_LOCATION_RIGHT: number; + readonly DOM_KEY_LOCATION_STANDARD: number; +} + +interface ListeningStateChangedEvent extends Event { + readonly label: string; + readonly state: string; +} + +declare var ListeningStateChangedEvent: { + prototype: ListeningStateChangedEvent; + new(): ListeningStateChangedEvent; } interface Location { @@ -12589,7 +13352,7 @@ interface Location { host: string; hostname: string; href: string; - origin: string; + readonly origin: string; pathname: string; port: string; protocol: string; @@ -12606,7 +13369,7 @@ declare var Location: { } interface LongRunningScriptDetectedEvent extends Event { - executionTime: number; + readonly executionTime: number; stopPageScriptExecution: boolean; } @@ -12625,29 +13388,29 @@ interface MSApp { execAsyncAtPriority(asynchronousCallback: MSExecAtPriorityFunctionCallback, priority: string, ...args: any[]): void; execAtPriority(synchronousCallback: MSExecAtPriorityFunctionCallback, priority: string, ...args: any[]): any; getCurrentPriority(): string; - getHtmlPrintDocumentSourceAsync(htmlDoc: any): any; + getHtmlPrintDocumentSourceAsync(htmlDoc: any): PromiseLike; getViewId(view: any): any; isTaskScheduledAtPriorityOrHigher(priority: string): boolean; pageHandlesAllApplicationActivations(enabled: boolean): void; suppressSubdownloadCredentialPrompts(suppress: boolean): void; terminateApp(exceptionObject: any): void; - CURRENT: string; - HIGH: string; - IDLE: string; - NORMAL: string; + readonly CURRENT: string; + readonly HIGH: string; + readonly IDLE: string; + readonly NORMAL: string; } declare var MSApp: MSApp; interface MSAppAsyncOperation extends EventTarget { - error: DOMError; + readonly error: DOMError; oncomplete: (ev: Event) => any; onerror: (ev: Event) => any; - readyState: number; - result: any; + readonly readyState: number; + readonly result: any; start(): void; - COMPLETED: number; - ERROR: number; - STARTED: number; + readonly COMPLETED: number; + readonly ERROR: number; + readonly STARTED: number; addEventListener(type: "complete", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; @@ -12656,9 +13419,19 @@ interface MSAppAsyncOperation extends EventTarget { declare var MSAppAsyncOperation: { prototype: MSAppAsyncOperation; new(): MSAppAsyncOperation; - COMPLETED: number; - ERROR: number; - STARTED: number; + readonly COMPLETED: number; + readonly ERROR: number; + readonly STARTED: number; +} + +interface MSAssertion { + readonly id: string; + readonly type: string; +} + +declare var MSAssertion: { + prototype: MSAssertion; + new(): MSAssertion; } interface MSBlobBuilder { @@ -12671,44 +13444,46 @@ declare var MSBlobBuilder: { new(): MSBlobBuilder; } -interface MSCSSMatrix { - a: number; - b: number; - c: number; - d: number; - e: number; - f: number; - m11: number; - m12: number; - m13: number; - m14: number; - m21: number; - m22: number; - m23: number; - m24: number; - m31: number; - m32: number; - m33: number; - m34: number; - m41: number; - m42: number; - m43: number; - m44: number; - inverse(): MSCSSMatrix; - multiply(secondMatrix: MSCSSMatrix): MSCSSMatrix; - rotate(angleX: number, angleY?: number, angleZ?: number): MSCSSMatrix; - rotateAxisAngle(x: number, y: number, z: number, angle: number): MSCSSMatrix; - scale(scaleX: number, scaleY?: number, scaleZ?: number): MSCSSMatrix; - setMatrixValue(value: string): void; - skewX(angle: number): MSCSSMatrix; - skewY(angle: number): MSCSSMatrix; - toString(): string; - translate(x: number, y: number, z?: number): MSCSSMatrix; +interface MSCredentials { + getAssertion(challenge: string, filter?: MSCredentialFilter, params?: MSSignatureParameters): PromiseLike; + makeCredential(accountInfo: MSAccountInfo, params: MSCredentialParameters[], challenge?: string): PromiseLike; } -declare var MSCSSMatrix: { - prototype: MSCSSMatrix; - new(text?: string): MSCSSMatrix; +declare var MSCredentials: { + prototype: MSCredentials; + new(): MSCredentials; +} + +interface MSFIDOCredentialAssertion extends MSAssertion { + readonly algorithm: string | Algorithm; + readonly attestation: any; + readonly publicKey: string; + readonly transportHints: string[]; +} + +declare var MSFIDOCredentialAssertion: { + prototype: MSFIDOCredentialAssertion; + new(): MSFIDOCredentialAssertion; +} + +interface MSFIDOSignature { + readonly authnrData: string; + readonly clientData: string; + readonly signature: string; +} + +declare var MSFIDOSignature: { + prototype: MSFIDOSignature; + new(): MSFIDOSignature; +} + +interface MSFIDOSignatureAssertion extends MSAssertion { + readonly signature: MSFIDOSignature; +} + +declare var MSFIDOSignatureAssertion: { + prototype: MSFIDOSignatureAssertion; + new(): MSFIDOSignatureAssertion; } interface MSGesture { @@ -12723,44 +13498,44 @@ declare var MSGesture: { } interface MSGestureEvent extends UIEvent { - clientX: number; - clientY: number; - expansion: number; - gestureObject: any; - hwTimestamp: number; - offsetX: number; - offsetY: number; - rotation: number; - scale: number; - screenX: number; - screenY: number; - translationX: number; - translationY: number; - velocityAngular: number; - velocityExpansion: number; - velocityX: number; - velocityY: number; + readonly clientX: number; + readonly clientY: number; + readonly expansion: number; + readonly gestureObject: any; + readonly hwTimestamp: number; + readonly offsetX: number; + readonly offsetY: number; + readonly rotation: number; + readonly scale: number; + readonly screenX: number; + readonly screenY: number; + readonly translationX: number; + readonly translationY: number; + readonly velocityAngular: number; + readonly velocityExpansion: number; + readonly velocityX: number; + readonly velocityY: number; 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; - MSGESTURE_FLAG_BEGIN: number; - MSGESTURE_FLAG_CANCEL: number; - MSGESTURE_FLAG_END: number; - MSGESTURE_FLAG_INERTIA: number; - MSGESTURE_FLAG_NONE: number; + readonly MSGESTURE_FLAG_BEGIN: number; + readonly MSGESTURE_FLAG_CANCEL: number; + readonly MSGESTURE_FLAG_END: number; + readonly MSGESTURE_FLAG_INERTIA: number; + readonly MSGESTURE_FLAG_NONE: number; } declare var MSGestureEvent: { prototype: MSGestureEvent; new(): MSGestureEvent; - MSGESTURE_FLAG_BEGIN: number; - MSGESTURE_FLAG_CANCEL: number; - MSGESTURE_FLAG_END: number; - MSGESTURE_FLAG_INERTIA: number; - MSGESTURE_FLAG_NONE: number; + readonly MSGESTURE_FLAG_BEGIN: number; + readonly MSGESTURE_FLAG_CANCEL: number; + readonly MSGESTURE_FLAG_END: number; + readonly MSGESTURE_FLAG_INERTIA: number; + readonly MSGESTURE_FLAG_NONE: number; } interface MSGraphicsTrust { - constrictionActive: boolean; - status: string; + readonly constrictionActive: boolean; + readonly status: string; } declare var MSGraphicsTrust: { @@ -12769,12 +13544,12 @@ declare var MSGraphicsTrust: { } interface MSHTMLWebViewElement extends HTMLElement { - canGoBack: boolean; - canGoForward: boolean; - containsFullScreenElement: boolean; - documentTitle: string; + readonly canGoBack: boolean; + readonly canGoForward: boolean; + readonly containsFullScreenElement: boolean; + readonly documentTitle: string; height: number; - settings: MSWebViewSettings; + readonly settings: MSWebViewSettings; src: string; width: number; addWebAllowedObject(name: string, applicationObject: any): void; @@ -12800,12 +13575,12 @@ declare var MSHTMLWebViewElement: { } interface MSInputMethodContext extends EventTarget { - compositionEndOffset: number; - compositionStartOffset: number; + readonly compositionEndOffset: number; + readonly compositionStartOffset: number; oncandidatewindowhide: (ev: Event) => any; oncandidatewindowshow: (ev: Event) => any; oncandidatewindowupdate: (ev: Event) => any; - target: HTMLElement; + readonly target: HTMLElement; getCandidateWindowClientRect(): ClientRect; getCompositionAlternatives(): string[]; hasComposition(): boolean; @@ -12822,59 +13597,59 @@ declare var MSInputMethodContext: { } interface MSManipulationEvent extends UIEvent { - currentState: number; - inertiaDestinationX: number; - inertiaDestinationY: number; - lastState: number; + readonly currentState: number; + readonly inertiaDestinationX: number; + readonly inertiaDestinationY: number; + readonly lastState: number; initMSManipulationEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, lastState: number, currentState: number): void; - MS_MANIPULATION_STATE_ACTIVE: number; - MS_MANIPULATION_STATE_CANCELLED: number; - MS_MANIPULATION_STATE_COMMITTED: number; - MS_MANIPULATION_STATE_DRAGGING: number; - MS_MANIPULATION_STATE_INERTIA: number; - MS_MANIPULATION_STATE_PRESELECT: number; - MS_MANIPULATION_STATE_SELECTING: number; - MS_MANIPULATION_STATE_STOPPED: number; + readonly MS_MANIPULATION_STATE_ACTIVE: number; + readonly MS_MANIPULATION_STATE_CANCELLED: number; + readonly MS_MANIPULATION_STATE_COMMITTED: number; + readonly MS_MANIPULATION_STATE_DRAGGING: number; + readonly MS_MANIPULATION_STATE_INERTIA: number; + readonly MS_MANIPULATION_STATE_PRESELECT: number; + readonly MS_MANIPULATION_STATE_SELECTING: number; + readonly MS_MANIPULATION_STATE_STOPPED: number; } declare var MSManipulationEvent: { prototype: MSManipulationEvent; new(): MSManipulationEvent; - MS_MANIPULATION_STATE_ACTIVE: number; - MS_MANIPULATION_STATE_CANCELLED: number; - MS_MANIPULATION_STATE_COMMITTED: number; - MS_MANIPULATION_STATE_DRAGGING: number; - MS_MANIPULATION_STATE_INERTIA: number; - MS_MANIPULATION_STATE_PRESELECT: number; - MS_MANIPULATION_STATE_SELECTING: number; - MS_MANIPULATION_STATE_STOPPED: number; + readonly MS_MANIPULATION_STATE_ACTIVE: number; + readonly MS_MANIPULATION_STATE_CANCELLED: number; + readonly MS_MANIPULATION_STATE_COMMITTED: number; + readonly MS_MANIPULATION_STATE_DRAGGING: number; + readonly MS_MANIPULATION_STATE_INERTIA: number; + readonly MS_MANIPULATION_STATE_PRESELECT: number; + readonly MS_MANIPULATION_STATE_SELECTING: number; + readonly MS_MANIPULATION_STATE_STOPPED: number; } interface MSMediaKeyError { - code: number; - systemCode: number; - MS_MEDIA_KEYERR_CLIENT: number; - MS_MEDIA_KEYERR_DOMAIN: number; - MS_MEDIA_KEYERR_HARDWARECHANGE: number; - MS_MEDIA_KEYERR_OUTPUT: number; - MS_MEDIA_KEYERR_SERVICE: number; - MS_MEDIA_KEYERR_UNKNOWN: number; + readonly code: number; + readonly systemCode: number; + readonly MS_MEDIA_KEYERR_CLIENT: number; + readonly MS_MEDIA_KEYERR_DOMAIN: number; + readonly MS_MEDIA_KEYERR_HARDWARECHANGE: number; + readonly MS_MEDIA_KEYERR_OUTPUT: number; + readonly MS_MEDIA_KEYERR_SERVICE: number; + readonly MS_MEDIA_KEYERR_UNKNOWN: number; } declare var MSMediaKeyError: { prototype: MSMediaKeyError; new(): MSMediaKeyError; - MS_MEDIA_KEYERR_CLIENT: number; - MS_MEDIA_KEYERR_DOMAIN: number; - MS_MEDIA_KEYERR_HARDWARECHANGE: number; - MS_MEDIA_KEYERR_OUTPUT: number; - MS_MEDIA_KEYERR_SERVICE: number; - MS_MEDIA_KEYERR_UNKNOWN: number; + readonly MS_MEDIA_KEYERR_CLIENT: number; + readonly MS_MEDIA_KEYERR_DOMAIN: number; + readonly MS_MEDIA_KEYERR_HARDWARECHANGE: number; + readonly MS_MEDIA_KEYERR_OUTPUT: number; + readonly MS_MEDIA_KEYERR_SERVICE: number; + readonly MS_MEDIA_KEYERR_UNKNOWN: number; } interface MSMediaKeyMessageEvent extends Event { - destinationURL: string; - message: Uint8Array; + readonly destinationURL: string; + readonly message: Uint8Array; } declare var MSMediaKeyMessageEvent: { @@ -12883,7 +13658,7 @@ declare var MSMediaKeyMessageEvent: { } interface MSMediaKeyNeededEvent extends Event { - initData: Uint8Array; + readonly initData: Uint8Array; } declare var MSMediaKeyNeededEvent: { @@ -12892,9 +13667,9 @@ declare var MSMediaKeyNeededEvent: { } interface MSMediaKeySession extends EventTarget { - error: MSMediaKeyError; - keySystem: string; - sessionId: string; + readonly error: MSMediaKeyError; + readonly keySystem: string; + readonly sessionId: string; close(): void; update(key: Uint8Array): void; } @@ -12905,7 +13680,7 @@ declare var MSMediaKeySession: { } interface MSMediaKeys { - keySystem: string; + readonly keySystem: string; createSession(type: string, initData: Uint8Array, cdmData?: Uint8Array): MSMediaKeySession; } @@ -12913,40 +13688,22 @@ declare var MSMediaKeys: { prototype: MSMediaKeys; new(keySystem: string): MSMediaKeys; isTypeSupported(keySystem: string, type?: string): boolean; -} - -interface MSMimeTypesCollection { - length: number; -} - -declare var MSMimeTypesCollection: { - prototype: MSMimeTypesCollection; - new(): MSMimeTypesCollection; -} - -interface MSPluginsCollection { - length: number; - refresh(reload?: boolean): void; -} - -declare var MSPluginsCollection: { - prototype: MSPluginsCollection; - new(): MSPluginsCollection; + isTypeSupportedWithFeatures(keySystem: string, type?: string): string; } interface MSPointerEvent extends MouseEvent { - currentPoint: any; - height: number; - hwTimestamp: number; - intermediatePoints: any; - isPrimary: boolean; - pointerId: number; - pointerType: any; - pressure: number; - rotation: number; - tiltX: number; - tiltY: number; - width: number; + readonly currentPoint: any; + readonly height: number; + readonly hwTimestamp: number; + readonly intermediatePoints: any; + readonly isPrimary: boolean; + readonly pointerId: number; + readonly pointerType: any; + readonly pressure: number; + readonly rotation: number; + readonly tiltX: number; + readonly tiltY: number; + readonly width: number; getCurrentPoint(element: Element): void; getIntermediatePoints(element: Element): void; 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; @@ -12958,7 +13715,7 @@ declare var MSPointerEvent: { } interface MSRangeCollection { - length: number; + readonly length: number; item(index: number): Range; [index: number]: Range; } @@ -12969,8 +13726,8 @@ declare var MSRangeCollection: { } interface MSSiteModeEvent extends Event { - actionURL: string; - buttonID: number; + readonly actionURL: string; + readonly buttonID: number; } declare var MSSiteModeEvent: { @@ -12979,7 +13736,7 @@ declare var MSSiteModeEvent: { } interface MSStream { - type: string; + readonly type: string; msClose(): void; msDetachStream(): any; } @@ -12990,7 +13747,7 @@ declare var MSStream: { } interface MSStreamReader extends EventTarget, MSBaseReader { - error: DOMError; + readonly error: DOMError; readAsArrayBuffer(stream: MSStream, size?: number): void; readAsBinaryString(stream: MSStream, size?: number): void; readAsBlob(stream: MSStream, size?: number): void; @@ -13005,20 +13762,20 @@ declare var MSStreamReader: { } interface MSWebViewAsyncOperation extends EventTarget { - error: DOMError; + readonly error: DOMError; oncomplete: (ev: Event) => any; onerror: (ev: Event) => any; - readyState: number; - result: any; - target: MSHTMLWebViewElement; - type: number; + readonly readyState: number; + readonly result: any; + readonly target: MSHTMLWebViewElement; + readonly type: number; start(): void; - COMPLETED: number; - ERROR: number; - STARTED: number; - TYPE_CAPTURE_PREVIEW_TO_RANDOM_ACCESS_STREAM: number; - TYPE_CREATE_DATA_PACKAGE_FROM_SELECTION: number; - TYPE_INVOKE_SCRIPT: number; + readonly COMPLETED: number; + readonly ERROR: number; + readonly STARTED: number; + readonly TYPE_CAPTURE_PREVIEW_TO_RANDOM_ACCESS_STREAM: number; + readonly TYPE_CREATE_DATA_PACKAGE_FROM_SELECTION: number; + readonly TYPE_INVOKE_SCRIPT: number; addEventListener(type: "complete", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; @@ -13027,12 +13784,12 @@ interface MSWebViewAsyncOperation extends EventTarget { declare var MSWebViewAsyncOperation: { prototype: MSWebViewAsyncOperation; new(): MSWebViewAsyncOperation; - COMPLETED: number; - ERROR: number; - STARTED: number; - TYPE_CAPTURE_PREVIEW_TO_RANDOM_ACCESS_STREAM: number; - TYPE_CREATE_DATA_PACKAGE_FROM_SELECTION: number; - TYPE_INVOKE_SCRIPT: number; + readonly COMPLETED: number; + readonly ERROR: number; + readonly STARTED: number; + readonly TYPE_CAPTURE_PREVIEW_TO_RANDOM_ACCESS_STREAM: number; + readonly TYPE_CREATE_DATA_PACKAGE_FROM_SELECTION: number; + readonly TYPE_INVOKE_SCRIPT: number; } interface MSWebViewSettings { @@ -13045,6 +13802,32 @@ declare var MSWebViewSettings: { new(): MSWebViewSettings; } +interface MediaDeviceInfo { + readonly deviceId: string; + readonly groupId: string; + readonly kind: string; + readonly label: string; +} + +declare var MediaDeviceInfo: { + prototype: MediaDeviceInfo; + new(): MediaDeviceInfo; +} + +interface MediaDevices extends EventTarget { + ondevicechange: (ev: Event) => any; + enumerateDevices(): any; + getSupportedConstraints(): MediaTrackSupportedConstraints; + getUserMedia(constraints: MediaStreamConstraints): PromiseLike; + addEventListener(type: "devicechange", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var MediaDevices: { + prototype: MediaDevices; + new(): MediaDevices; +} + interface MediaElementAudioSourceNode extends AudioNode { } @@ -13053,28 +13836,98 @@ declare var MediaElementAudioSourceNode: { new(): MediaElementAudioSourceNode; } +interface MediaEncryptedEvent extends Event { + readonly initData: ArrayBuffer; + readonly initDataType: string; +} + +declare var MediaEncryptedEvent: { + prototype: MediaEncryptedEvent; + new(type: string, eventInitDict?: MediaEncryptedEventInit): MediaEncryptedEvent; +} + interface MediaError { - code: number; - msExtendedCode: number; - MEDIA_ERR_ABORTED: number; - MEDIA_ERR_DECODE: number; - MEDIA_ERR_NETWORK: number; - MEDIA_ERR_SRC_NOT_SUPPORTED: number; - MS_MEDIA_ERR_ENCRYPTED: number; + readonly code: number; + readonly msExtendedCode: number; + readonly MEDIA_ERR_ABORTED: number; + readonly MEDIA_ERR_DECODE: number; + readonly MEDIA_ERR_NETWORK: number; + readonly MEDIA_ERR_SRC_NOT_SUPPORTED: number; + readonly MS_MEDIA_ERR_ENCRYPTED: number; } declare var MediaError: { prototype: MediaError; new(): MediaError; - MEDIA_ERR_ABORTED: number; - MEDIA_ERR_DECODE: number; - MEDIA_ERR_NETWORK: number; - MEDIA_ERR_SRC_NOT_SUPPORTED: number; - MS_MEDIA_ERR_ENCRYPTED: number; + readonly MEDIA_ERR_ABORTED: number; + readonly MEDIA_ERR_DECODE: number; + readonly MEDIA_ERR_NETWORK: number; + readonly MEDIA_ERR_SRC_NOT_SUPPORTED: number; + readonly MS_MEDIA_ERR_ENCRYPTED: number; +} + +interface MediaKeyMessageEvent extends Event { + readonly message: ArrayBuffer; + readonly messageType: string; +} + +declare var MediaKeyMessageEvent: { + prototype: MediaKeyMessageEvent; + new(type: string, eventInitDict?: MediaKeyMessageEventInit): MediaKeyMessageEvent; +} + +interface MediaKeySession extends EventTarget { + readonly closed: PromiseLike; + readonly expiration: number; + readonly keyStatuses: MediaKeyStatusMap; + readonly sessionId: string; + close(): PromiseLike; + generateRequest(initDataType: string, initData: any): PromiseLike; + load(sessionId: string): PromiseLike; + remove(): PromiseLike; + update(response: any): PromiseLike; +} + +declare var MediaKeySession: { + prototype: MediaKeySession; + new(): MediaKeySession; +} + +interface MediaKeyStatusMap { + readonly size: number; + forEach(callback: ForEachCallback): void; + get(keyId: any): string; + has(keyId: any): boolean; +} + +declare var MediaKeyStatusMap: { + prototype: MediaKeyStatusMap; + new(): MediaKeyStatusMap; +} + +interface MediaKeySystemAccess { + readonly keySystem: string; + createMediaKeys(): PromiseLike; + getConfiguration(): MediaKeySystemConfiguration; +} + +declare var MediaKeySystemAccess: { + prototype: MediaKeySystemAccess; + new(): MediaKeySystemAccess; +} + +interface MediaKeys { + createSession(sessionType?: string): MediaKeySession; + setServerCertificate(serverCertificate: any): PromiseLike; +} + +declare var MediaKeys: { + prototype: MediaKeys; + new(): MediaKeys; } interface MediaList { - length: number; + readonly length: number; mediaText: string; appendMedium(newMedium: string): void; deleteMedium(oldMedium: string): void; @@ -13089,8 +13942,8 @@ declare var MediaList: { } interface MediaQueryList { - matches: boolean; - media: string; + readonly matches: boolean; + readonly media: string; addListener(listener: MediaQueryListListener): void; removeListener(listener: MediaQueryListListener): void; } @@ -13101,10 +13954,10 @@ declare var MediaQueryList: { } interface MediaSource extends EventTarget { - activeSourceBuffers: SourceBufferList; + readonly activeSourceBuffers: SourceBufferList; duration: number; - readyState: string; - sourceBuffers: SourceBufferList; + readonly readyState: string; + readonly sourceBuffers: SourceBufferList; addSourceBuffer(type: string): SourceBuffer; endOfStream(error?: number): void; removeSourceBuffer(sourceBuffer: SourceBuffer): void; @@ -13116,9 +13969,104 @@ declare var MediaSource: { isTypeSupported(type: string): boolean; } +interface MediaStream extends EventTarget { + readonly active: boolean; + readonly id: string; + onactive: (ev: Event) => any; + onaddtrack: (ev: TrackEvent) => any; + oninactive: (ev: Event) => any; + onremovetrack: (ev: TrackEvent) => any; + addTrack(track: MediaStreamTrack): void; + clone(): MediaStream; + getAudioTracks(): MediaStreamTrack[]; + getTrackById(trackId: string): MediaStreamTrack; + getTracks(): MediaStreamTrack[]; + getVideoTracks(): MediaStreamTrack[]; + removeTrack(track: MediaStreamTrack): void; + stop(): void; + addEventListener(type: "active", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "addtrack", listener: (ev: TrackEvent) => any, useCapture?: boolean): void; + addEventListener(type: "inactive", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "removetrack", listener: (ev: TrackEvent) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var MediaStream: { + prototype: MediaStream; + new(streamOrTracks?: MediaStream | MediaStreamTrack[]): MediaStream; +} + +interface MediaStreamAudioSourceNode extends AudioNode { +} + +declare var MediaStreamAudioSourceNode: { + prototype: MediaStreamAudioSourceNode; + new(): MediaStreamAudioSourceNode; +} + +interface MediaStreamError { + readonly constraintName: string; + readonly message: string; + readonly name: string; +} + +declare var MediaStreamError: { + prototype: MediaStreamError; + new(): MediaStreamError; +} + +interface MediaStreamErrorEvent extends Event { + readonly error: MediaStreamError; +} + +declare var MediaStreamErrorEvent: { + prototype: MediaStreamErrorEvent; + new(type: string, eventInitDict?: MediaStreamErrorEventInit): MediaStreamErrorEvent; +} + +interface MediaStreamTrack extends EventTarget { + enabled: boolean; + readonly id: string; + readonly kind: string; + readonly label: string; + readonly muted: boolean; + onended: (ev: MediaStreamErrorEvent) => any; + onmute: (ev: Event) => any; + onoverconstrained: (ev: MediaStreamErrorEvent) => any; + onunmute: (ev: Event) => any; + readonly readonly: boolean; + readonly readyState: string; + readonly remote: boolean; + applyConstraints(constraints: MediaTrackConstraints): PromiseLike; + clone(): MediaStreamTrack; + getCapabilities(): MediaTrackCapabilities; + getConstraints(): MediaTrackConstraints; + getSettings(): MediaTrackSettings; + stop(): void; + addEventListener(type: "ended", listener: (ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mute", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "overconstrained", listener: (ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: "unmute", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var MediaStreamTrack: { + prototype: MediaStreamTrack; + new(): MediaStreamTrack; +} + +interface MediaStreamTrackEvent extends Event { + readonly track: MediaStreamTrack; +} + +declare var MediaStreamTrackEvent: { + prototype: MediaStreamTrackEvent; + new(type: string, eventInitDict?: MediaStreamTrackEventInit): MediaStreamTrackEvent; +} + interface MessageChannel { - port1: MessagePort; - port2: MessagePort; + readonly port1: MessagePort; + readonly port2: MessagePort; } declare var MessageChannel: { @@ -13127,10 +14075,10 @@ declare var MessageChannel: { } interface MessageEvent extends Event { - data: any; - origin: string; - ports: any; - source: Window; + readonly data: any; + readonly origin: string; + readonly ports: any; + readonly source: Window; initMessageEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, dataArg: any, originArg: string, lastEventIdArg: string, sourceArg: Window): void; } @@ -13154,10 +14102,10 @@ declare var MessagePort: { } interface MimeType { - description: string; - enabledPlugin: Plugin; - suffixes: string; - type: string; + readonly description: string; + readonly enabledPlugin: Plugin; + readonly suffixes: string; + readonly type: string; } declare var MimeType: { @@ -13166,7 +14114,7 @@ declare var MimeType: { } interface MimeTypeArray { - length: number; + readonly length: number; item(index: number): Plugin; namedItem(type: string): Plugin; [index: number]: Plugin; @@ -13178,30 +14126,30 @@ declare var MimeTypeArray: { } interface MouseEvent extends UIEvent { - altKey: boolean; - button: number; - buttons: number; - clientX: number; - clientY: number; - ctrlKey: boolean; - fromElement: Element; - layerX: number; - layerY: number; - metaKey: boolean; - movementX: number; - movementY: number; - offsetX: number; - offsetY: number; - pageX: number; - pageY: number; - relatedTarget: EventTarget; - screenX: number; - screenY: number; - shiftKey: boolean; - toElement: Element; - which: number; - x: number; - y: number; + readonly altKey: boolean; + readonly button: number; + readonly buttons: number; + readonly clientX: number; + readonly clientY: number; + readonly ctrlKey: boolean; + readonly fromElement: Element; + readonly layerX: number; + readonly layerY: number; + readonly metaKey: boolean; + readonly movementX: number; + readonly movementY: number; + readonly offsetX: number; + readonly offsetY: number; + readonly pageX: number; + readonly pageY: number; + readonly relatedTarget: EventTarget; + readonly screenX: number; + readonly screenY: number; + readonly shiftKey: boolean; + readonly toElement: Element; + readonly which: number; + readonly x: number; + readonly y: number; getModifierState(keyArg: string): boolean; 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; } @@ -13211,36 +14159,24 @@ declare var MouseEvent: { new(typeArg: string, eventInitDict?: MouseEventInit): MouseEvent; } -interface MouseWheelEvent extends MouseEvent { - wheelDelta: number; - wheelDeltaX: number; - wheelDeltaY: number; - initMouseWheelEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, screenXArg: number, screenYArg: number, clientXArg: number, clientYArg: number, buttonArg: number, relatedTargetArg: EventTarget, modifiersListArg: string, wheelDeltaArg: number): void; -} - -declare var MouseWheelEvent: { - prototype: MouseWheelEvent; - new(): MouseWheelEvent; -} - interface MutationEvent extends Event { - attrChange: number; - attrName: string; - newValue: string; - prevValue: string; - relatedNode: Node; + readonly attrChange: number; + readonly attrName: string; + readonly newValue: string; + readonly prevValue: string; + readonly relatedNode: Node; initMutationEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, relatedNodeArg: Node, prevValueArg: string, newValueArg: string, attrNameArg: string, attrChangeArg: number): void; - ADDITION: number; - MODIFICATION: number; - REMOVAL: number; + readonly ADDITION: number; + readonly MODIFICATION: number; + readonly REMOVAL: number; } declare var MutationEvent: { prototype: MutationEvent; new(): MutationEvent; - ADDITION: number; - MODIFICATION: number; - REMOVAL: number; + readonly ADDITION: number; + readonly MODIFICATION: number; + readonly REMOVAL: number; } interface MutationObserver { @@ -13255,15 +14191,15 @@ declare var MutationObserver: { } interface MutationRecord { - addedNodes: NodeList; - attributeName: string; - attributeNamespace: string; - nextSibling: Node; - oldValue: string; - previousSibling: Node; - removedNodes: NodeList; - target: Node; - type: string; + readonly addedNodes: NodeList; + readonly attributeName: string; + readonly attributeNamespace: string; + readonly nextSibling: Node; + readonly oldValue: string; + readonly previousSibling: Node; + readonly removedNodes: NodeList; + readonly target: Node; + readonly type: string; } declare var MutationRecord: { @@ -13272,7 +14208,7 @@ declare var MutationRecord: { } interface NamedNodeMap { - length: number; + readonly length: number; getNamedItem(name: string): Attr; getNamedItemNS(namespaceURI: string, localName: string): Attr; item(index: number): Attr; @@ -13289,8 +14225,8 @@ declare var NamedNodeMap: { } interface NavigationCompletedEvent extends NavigationEvent { - isSuccess: boolean; - webErrorStatus: number; + readonly isSuccess: boolean; + readonly webErrorStatus: number; } declare var NavigationCompletedEvent: { @@ -13299,7 +14235,7 @@ declare var NavigationCompletedEvent: { } interface NavigationEvent extends Event { - uri: string; + readonly uri: string; } declare var NavigationEvent: { @@ -13308,7 +14244,7 @@ declare var NavigationEvent: { } interface NavigationEventWithReferrer extends NavigationEvent { - referer: string; + readonly referer: string; } declare var NavigationEventWithReferrer: { @@ -13316,27 +14252,22 @@ declare var NavigationEventWithReferrer: { new(): NavigationEventWithReferrer; } -interface Navigator extends Object, NavigatorID, NavigatorOnLine, NavigatorContentUtils, NavigatorStorageUtils, NavigatorGeolocation, MSNavigatorDoNotTrack, MSFileSaver { - appCodeName: string; - appMinorVersion: string; - browserLanguage: string; - connectionSpeed: number; - cookieEnabled: boolean; - cpuClass: string; - language: string; - maxTouchPoints: number; - mimeTypes: MSMimeTypesCollection; - msManipulationViewsEnabled: boolean; - msMaxTouchPoints: number; - msPointerEnabled: boolean; - plugins: MSPluginsCollection; - pointerEnabled: boolean; - systemLanguage: string; - userLanguage: string; - webdriver: boolean; +interface Navigator extends Object, NavigatorID, NavigatorOnLine, NavigatorContentUtils, NavigatorStorageUtils, NavigatorGeolocation, MSNavigatorDoNotTrack, MSFileSaver, NavigatorUserMedia { + readonly appCodeName: string; + readonly cookieEnabled: boolean; + readonly language: string; + readonly maxTouchPoints: number; + readonly mimeTypes: MimeTypeArray; + readonly msManipulationViewsEnabled: boolean; + readonly msMaxTouchPoints: number; + readonly msPointerEnabled: boolean; + readonly plugins: PluginArray; + readonly pointerEnabled: boolean; + readonly webdriver: boolean; getGamepads(): Gamepad[]; javaEnabled(): boolean; msLaunchUri(uri: string, successCallback?: MSLaunchUriCallback, noHandlerCallback?: MSLaunchUriCallback): void; + requestMediaKeySystemAccess(keySystem: string, supportedConfigurations: MediaKeySystemConfiguration[]): PromiseLike; vibrate(pattern: number | number[]): boolean; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -13347,26 +14278,26 @@ declare var Navigator: { } interface Node extends EventTarget { - attributes: NamedNodeMap; - baseURI: string; - childNodes: NodeList; - firstChild: Node; - lastChild: Node; - localName: string; - namespaceURI: string; - nextSibling: Node; - nodeName: string; - nodeType: number; + readonly attributes: NamedNodeMap; + readonly baseURI: string; + readonly childNodes: NodeList; + readonly firstChild: Node; + readonly lastChild: Node; + readonly localName: string; + readonly namespaceURI: string; + readonly nextSibling: Node; + readonly nodeName: string; + readonly nodeType: number; nodeValue: string; - ownerDocument: Document; - parentElement: HTMLElement; - parentNode: Node; - prefix: string; - previousSibling: Node; + readonly ownerDocument: Document; + readonly parentElement: HTMLElement; + readonly parentNode: Node; + readonly previousSibling: Node; textContent: string; appendChild(newChild: Node): Node; cloneNode(deep?: boolean): Node; compareDocumentPosition(other: Node): number; + contains(child: Node): boolean; hasAttributes(): boolean; hasChildNodes(): boolean; insertBefore(newChild: Node, refChild?: Node): Node; @@ -13379,47 +14310,47 @@ interface Node extends EventTarget { removeChild(oldChild: Node): Node; replaceChild(newChild: Node, oldChild: Node): Node; contains(node: Node): boolean; - ATTRIBUTE_NODE: number; - CDATA_SECTION_NODE: number; - COMMENT_NODE: number; - DOCUMENT_FRAGMENT_NODE: number; - DOCUMENT_NODE: number; - DOCUMENT_POSITION_CONTAINED_BY: number; - DOCUMENT_POSITION_CONTAINS: number; - DOCUMENT_POSITION_DISCONNECTED: number; - DOCUMENT_POSITION_FOLLOWING: number; - DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC: number; - DOCUMENT_POSITION_PRECEDING: number; - DOCUMENT_TYPE_NODE: number; - ELEMENT_NODE: number; - ENTITY_NODE: number; - ENTITY_REFERENCE_NODE: number; - NOTATION_NODE: number; - PROCESSING_INSTRUCTION_NODE: number; - TEXT_NODE: number; + readonly ATTRIBUTE_NODE: number; + readonly CDATA_SECTION_NODE: number; + readonly COMMENT_NODE: number; + readonly DOCUMENT_FRAGMENT_NODE: number; + readonly DOCUMENT_NODE: number; + readonly DOCUMENT_POSITION_CONTAINED_BY: number; + readonly DOCUMENT_POSITION_CONTAINS: number; + readonly DOCUMENT_POSITION_DISCONNECTED: number; + readonly DOCUMENT_POSITION_FOLLOWING: number; + readonly DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC: number; + readonly DOCUMENT_POSITION_PRECEDING: number; + readonly DOCUMENT_TYPE_NODE: number; + readonly ELEMENT_NODE: number; + readonly ENTITY_NODE: number; + readonly ENTITY_REFERENCE_NODE: number; + readonly NOTATION_NODE: number; + readonly PROCESSING_INSTRUCTION_NODE: number; + readonly TEXT_NODE: number; } declare var Node: { prototype: Node; new(): Node; - ATTRIBUTE_NODE: number; - CDATA_SECTION_NODE: number; - COMMENT_NODE: number; - DOCUMENT_FRAGMENT_NODE: number; - DOCUMENT_NODE: number; - DOCUMENT_POSITION_CONTAINED_BY: number; - DOCUMENT_POSITION_CONTAINS: number; - DOCUMENT_POSITION_DISCONNECTED: number; - DOCUMENT_POSITION_FOLLOWING: number; - DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC: number; - DOCUMENT_POSITION_PRECEDING: number; - DOCUMENT_TYPE_NODE: number; - ELEMENT_NODE: number; - ENTITY_NODE: number; - ENTITY_REFERENCE_NODE: number; - NOTATION_NODE: number; - PROCESSING_INSTRUCTION_NODE: number; - TEXT_NODE: number; + readonly ATTRIBUTE_NODE: number; + readonly CDATA_SECTION_NODE: number; + readonly COMMENT_NODE: number; + readonly DOCUMENT_FRAGMENT_NODE: number; + readonly DOCUMENT_NODE: number; + readonly DOCUMENT_POSITION_CONTAINED_BY: number; + readonly DOCUMENT_POSITION_CONTAINS: number; + readonly DOCUMENT_POSITION_DISCONNECTED: number; + readonly DOCUMENT_POSITION_FOLLOWING: number; + readonly DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC: number; + readonly DOCUMENT_POSITION_PRECEDING: number; + readonly DOCUMENT_TYPE_NODE: number; + readonly ELEMENT_NODE: number; + readonly ENTITY_NODE: number; + readonly ENTITY_REFERENCE_NODE: number; + readonly NOTATION_NODE: number; + readonly PROCESSING_INSTRUCTION_NODE: number; + readonly TEXT_NODE: number; } interface NodeFilter { @@ -13427,29 +14358,29 @@ interface NodeFilter { } declare var NodeFilter: { - FILTER_ACCEPT: number; - FILTER_REJECT: number; - FILTER_SKIP: number; - SHOW_ALL: number; - SHOW_ATTRIBUTE: number; - SHOW_CDATA_SECTION: number; - SHOW_COMMENT: number; - SHOW_DOCUMENT: number; - SHOW_DOCUMENT_FRAGMENT: number; - SHOW_DOCUMENT_TYPE: number; - SHOW_ELEMENT: number; - SHOW_ENTITY: number; - SHOW_ENTITY_REFERENCE: number; - SHOW_NOTATION: number; - SHOW_PROCESSING_INSTRUCTION: number; - SHOW_TEXT: number; + readonly FILTER_ACCEPT: number; + readonly FILTER_REJECT: number; + readonly FILTER_SKIP: number; + readonly SHOW_ALL: number; + readonly SHOW_ATTRIBUTE: number; + readonly SHOW_CDATA_SECTION: number; + readonly SHOW_COMMENT: number; + readonly SHOW_DOCUMENT: number; + readonly SHOW_DOCUMENT_FRAGMENT: number; + readonly SHOW_DOCUMENT_TYPE: number; + readonly SHOW_ELEMENT: number; + readonly SHOW_ENTITY: number; + readonly SHOW_ENTITY_REFERENCE: number; + readonly SHOW_NOTATION: number; + readonly SHOW_PROCESSING_INSTRUCTION: number; + readonly SHOW_TEXT: number; } interface NodeIterator { - expandEntityReferences: boolean; - filter: NodeFilter; - root: Node; - whatToShow: number; + readonly expandEntityReferences: boolean; + readonly filter: NodeFilter; + readonly root: Node; + readonly whatToShow: number; detach(): void; nextNode(): Node; previousNode(): Node; @@ -13461,7 +14392,7 @@ declare var NodeIterator: { } interface NodeList { - length: number; + readonly length: number; item(index: number): Node; [index: number]: Node; } @@ -13480,13 +14411,13 @@ declare var OES_element_index_uint: { } interface OES_standard_derivatives { - FRAGMENT_SHADER_DERIVATIVE_HINT_OES: number; + readonly FRAGMENT_SHADER_DERIVATIVE_HINT_OES: number; } declare var OES_standard_derivatives: { prototype: OES_standard_derivatives; new(): OES_standard_derivatives; - FRAGMENT_SHADER_DERIVATIVE_HINT_OES: number; + readonly FRAGMENT_SHADER_DERIVATIVE_HINT_OES: number; } interface OES_texture_float { @@ -13506,7 +14437,7 @@ declare var OES_texture_float_linear: { } interface OfflineAudioCompletionEvent extends Event { - renderedBuffer: AudioBuffer; + readonly renderedBuffer: AudioBuffer; } declare var OfflineAudioCompletionEvent: { @@ -13516,7 +14447,7 @@ declare var OfflineAudioCompletionEvent: { interface OfflineAudioContext extends AudioContext { oncomplete: (ev: Event) => any; - startRendering(): void; + startRendering(): PromiseLike; addEventListener(type: "complete", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -13527,14 +14458,14 @@ declare var OfflineAudioContext: { } interface OscillatorNode extends AudioNode { - detune: AudioParam; - frequency: AudioParam; - onended: (ev: Event) => any; + readonly detune: AudioParam; + readonly frequency: AudioParam; + onended: (ev: MediaStreamErrorEvent) => any; type: string; setPeriodicWave(periodicWave: PeriodicWave): void; start(when?: number): void; stop(when?: number): void; - addEventListener(type: "ended", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "ended", listener: (ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -13543,8 +14474,25 @@ declare var OscillatorNode: { new(): OscillatorNode; } +interface OverflowEvent extends UIEvent { + readonly horizontalOverflow: boolean; + readonly orient: number; + readonly verticalOverflow: boolean; + readonly BOTH: number; + readonly HORIZONTAL: number; + readonly VERTICAL: number; +} + +declare var OverflowEvent: { + prototype: OverflowEvent; + new(): OverflowEvent; + readonly BOTH: number; + readonly HORIZONTAL: number; + readonly VERTICAL: number; +} + interface PageTransitionEvent extends Event { - persisted: boolean; + readonly persisted: boolean; } declare var PageTransitionEvent: { @@ -13572,17 +14520,17 @@ declare var PannerNode: { } interface PerfWidgetExternal { - activeNetworkRequestCount: number; - averageFrameTime: number; - averagePaintTime: number; - extraInformationEnabled: boolean; - independentRenderingEnabled: boolean; - irDisablingContentString: string; - irStatusAvailable: boolean; - maxCpuSpeed: number; - paintRequestsPerSecond: number; - performanceCounter: number; - performanceCounterFrequency: number; + readonly activeNetworkRequestCount: number; + readonly averageFrameTime: number; + readonly averagePaintTime: number; + readonly extraInformationEnabled: boolean; + readonly independentRenderingEnabled: boolean; + readonly irDisablingContentString: string; + readonly irStatusAvailable: boolean; + readonly maxCpuSpeed: number; + readonly paintRequestsPerSecond: number; + readonly performanceCounter: number; + readonly performanceCounterFrequency: number; addEventListener(eventType: string, callback: Function): void; getMemoryUsage(): number; getProcessCpuUsage(): number; @@ -13601,8 +14549,8 @@ declare var PerfWidgetExternal: { } interface Performance { - navigation: PerformanceNavigation; - timing: PerformanceTiming; + readonly navigation: PerformanceNavigation; + readonly timing: PerformanceTiming; clearMarks(markName?: string): void; clearMeasures(measureName?: string): void; clearResourceTimings(): void; @@ -13624,10 +14572,10 @@ declare var Performance: { } interface PerformanceEntry { - duration: number; - entryType: string; - name: string; - startTime: number; + readonly duration: number; + readonly entryType: string; + readonly name: string; + readonly startTime: number; } declare var PerformanceEntry: { @@ -13652,47 +14600,47 @@ declare var PerformanceMeasure: { } interface PerformanceNavigation { - redirectCount: number; - type: number; + readonly redirectCount: number; + readonly type: number; toJSON(): any; - TYPE_BACK_FORWARD: number; - TYPE_NAVIGATE: number; - TYPE_RELOAD: number; - TYPE_RESERVED: number; + readonly TYPE_BACK_FORWARD: number; + readonly TYPE_NAVIGATE: number; + readonly TYPE_RELOAD: number; + readonly TYPE_RESERVED: number; } declare var PerformanceNavigation: { prototype: PerformanceNavigation; new(): PerformanceNavigation; - TYPE_BACK_FORWARD: number; - TYPE_NAVIGATE: number; - TYPE_RELOAD: number; - TYPE_RESERVED: number; + readonly TYPE_BACK_FORWARD: number; + readonly TYPE_NAVIGATE: number; + readonly TYPE_RELOAD: number; + readonly TYPE_RESERVED: number; } interface PerformanceNavigationTiming extends PerformanceEntry { - connectEnd: number; - connectStart: number; - domComplete: number; - domContentLoadedEventEnd: number; - domContentLoadedEventStart: number; - domInteractive: number; - domLoading: number; - domainLookupEnd: number; - domainLookupStart: number; - fetchStart: number; - loadEventEnd: number; - loadEventStart: number; - navigationStart: number; - redirectCount: number; - redirectEnd: number; - redirectStart: number; - requestStart: number; - responseEnd: number; - responseStart: number; - type: string; - unloadEventEnd: number; - unloadEventStart: number; + readonly connectEnd: number; + readonly connectStart: number; + readonly domComplete: number; + readonly domContentLoadedEventEnd: number; + readonly domContentLoadedEventStart: number; + readonly domInteractive: number; + readonly domLoading: number; + readonly domainLookupEnd: number; + readonly domainLookupStart: number; + readonly fetchStart: number; + readonly loadEventEnd: number; + readonly loadEventStart: number; + readonly navigationStart: number; + readonly redirectCount: number; + readonly redirectEnd: number; + readonly redirectStart: number; + readonly requestStart: number; + readonly responseEnd: number; + readonly responseStart: number; + readonly type: string; + readonly unloadEventEnd: number; + readonly unloadEventStart: number; } declare var PerformanceNavigationTiming: { @@ -13701,17 +14649,17 @@ declare var PerformanceNavigationTiming: { } interface PerformanceResourceTiming extends PerformanceEntry { - connectEnd: number; - connectStart: number; - domainLookupEnd: number; - domainLookupStart: number; - fetchStart: number; - initiatorType: string; - redirectEnd: number; - redirectStart: number; - requestStart: number; - responseEnd: number; - responseStart: number; + readonly connectEnd: number; + readonly connectStart: number; + readonly domainLookupEnd: number; + readonly domainLookupStart: number; + readonly fetchStart: number; + readonly initiatorType: string; + readonly redirectEnd: number; + readonly redirectStart: number; + readonly requestStart: number; + readonly responseEnd: number; + readonly responseStart: number; } declare var PerformanceResourceTiming: { @@ -13720,27 +14668,27 @@ declare var PerformanceResourceTiming: { } interface PerformanceTiming { - connectEnd: number; - connectStart: number; - domComplete: number; - domContentLoadedEventEnd: number; - domContentLoadedEventStart: number; - domInteractive: number; - domLoading: number; - domainLookupEnd: number; - domainLookupStart: number; - fetchStart: number; - loadEventEnd: number; - loadEventStart: number; - msFirstPaint: number; - navigationStart: number; - redirectEnd: number; - redirectStart: number; - requestStart: number; - responseEnd: number; - responseStart: number; - unloadEventEnd: number; - unloadEventStart: number; + readonly connectEnd: number; + readonly connectStart: number; + readonly domComplete: number; + readonly domContentLoadedEventEnd: number; + readonly domContentLoadedEventStart: number; + readonly domInteractive: number; + readonly domLoading: number; + readonly domainLookupEnd: number; + readonly domainLookupStart: number; + readonly fetchStart: number; + readonly loadEventEnd: number; + readonly loadEventStart: number; + readonly msFirstPaint: number; + readonly navigationStart: number; + readonly redirectEnd: number; + readonly redirectStart: number; + readonly requestStart: number; + readonly responseEnd: number; + readonly responseStart: number; + readonly unloadEventEnd: number; + readonly unloadEventStart: number; toJSON(): any; } @@ -13758,7 +14706,7 @@ declare var PeriodicWave: { } interface PermissionRequest extends DeferredPermissionRequest { - state: string; + readonly state: string; defer(): void; } @@ -13768,7 +14716,7 @@ declare var PermissionRequest: { } interface PermissionRequestedEvent extends Event { - permissionRequest: PermissionRequest; + readonly permissionRequest: PermissionRequest; } declare var PermissionRequestedEvent: { @@ -13777,11 +14725,11 @@ declare var PermissionRequestedEvent: { } interface Plugin { - description: string; - filename: string; - length: number; - name: string; - version: string; + readonly description: string; + readonly filename: string; + readonly length: number; + readonly name: string; + readonly version: string; item(index: number): MimeType; namedItem(type: string): MimeType; [index: number]: MimeType; @@ -13793,7 +14741,7 @@ declare var Plugin: { } interface PluginArray { - length: number; + readonly length: number; item(index: number): Plugin; namedItem(name: string): Plugin; refresh(reload?: boolean): void; @@ -13806,18 +14754,18 @@ declare var PluginArray: { } interface PointerEvent extends MouseEvent { - currentPoint: any; - height: number; - hwTimestamp: number; - intermediatePoints: any; - isPrimary: boolean; - pointerId: number; - pointerType: any; - pressure: number; - rotation: number; - tiltX: number; - tiltY: number; - width: number; + readonly currentPoint: any; + readonly height: number; + readonly hwTimestamp: number; + readonly intermediatePoints: any; + readonly isPrimary: boolean; + readonly pointerId: number; + readonly pointerType: any; + readonly pressure: number; + readonly rotation: number; + readonly tiltX: number; + readonly tiltY: number; + readonly width: number; getCurrentPoint(element: Element): void; getIntermediatePoints(element: Element): void; 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; @@ -13829,7 +14777,7 @@ declare var PointerEvent: { } interface PopStateEvent extends Event { - state: any; + readonly state: any; initPopStateEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, stateArg: any): void; } @@ -13839,8 +14787,8 @@ declare var PopStateEvent: { } interface Position { - coords: Coordinates; - timestamp: number; + readonly coords: Coordinates; + readonly timestamp: number; } declare var Position: { @@ -13849,24 +14797,24 @@ declare var Position: { } interface PositionError { - code: number; - message: string; + readonly code: number; + readonly message: string; toString(): string; - PERMISSION_DENIED: number; - POSITION_UNAVAILABLE: number; - TIMEOUT: number; + readonly PERMISSION_DENIED: number; + readonly POSITION_UNAVAILABLE: number; + readonly TIMEOUT: number; } declare var PositionError: { prototype: PositionError; new(): PositionError; - PERMISSION_DENIED: number; - POSITION_UNAVAILABLE: number; - TIMEOUT: number; + readonly PERMISSION_DENIED: number; + readonly POSITION_UNAVAILABLE: number; + readonly TIMEOUT: number; } interface ProcessingInstruction extends CharacterData { - target: string; + readonly target: string; } declare var ProcessingInstruction: { @@ -13875,9 +14823,9 @@ declare var ProcessingInstruction: { } interface ProgressEvent extends Event { - lengthComputable: boolean; - loaded: number; - total: number; + readonly lengthComputable: boolean; + readonly loaded: number; + readonly total: number; initProgressEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, lengthComputableArg: boolean, loadedArg: number, totalArg: number): void; } @@ -13886,13 +14834,210 @@ declare var ProgressEvent: { new(type: string, eventInitDict?: ProgressEventInit): ProgressEvent; } +interface RTCDTMFToneChangeEvent extends Event { + readonly tone: string; +} + +declare var RTCDTMFToneChangeEvent: { + prototype: RTCDTMFToneChangeEvent; + new(type: string, eventInitDict: RTCDTMFToneChangeEventInit): RTCDTMFToneChangeEvent; +} + +interface RTCDtlsTransport extends RTCStatsProvider { + ondtlsstatechange: (ev: RTCDtlsTransportStateChangedEvent) => any; + onerror: (ev: Event) => any; + readonly state: string; + readonly transport: RTCIceTransport; + getLocalParameters(): RTCDtlsParameters; + getRemoteCertificates(): ArrayBuffer[]; + getRemoteParameters(): RTCDtlsParameters; + start(remoteParameters: RTCDtlsParameters): void; + stop(): void; + addEventListener(type: "dtlsstatechange", listener: (ev: RTCDtlsTransportStateChangedEvent) => any, useCapture?: boolean): void; + addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var RTCDtlsTransport: { + prototype: RTCDtlsTransport; + new(transport: RTCIceTransport): RTCDtlsTransport; +} + +interface RTCDtlsTransportStateChangedEvent extends Event { + readonly state: string; +} + +declare var RTCDtlsTransportStateChangedEvent: { + prototype: RTCDtlsTransportStateChangedEvent; + new(): RTCDtlsTransportStateChangedEvent; +} + +interface RTCDtmfSender extends EventTarget { + readonly canInsertDTMF: boolean; + readonly duration: number; + readonly interToneGap: number; + ontonechange: (ev: RTCDTMFToneChangeEvent) => any; + readonly sender: RTCRtpSender; + readonly toneBuffer: string; + insertDTMF(tones: string, duration?: number, interToneGap?: number): void; + addEventListener(type: "tonechange", listener: (ev: RTCDTMFToneChangeEvent) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var RTCDtmfSender: { + prototype: RTCDtmfSender; + new(sender: RTCRtpSender): RTCDtmfSender; +} + +interface RTCIceCandidatePairChangedEvent extends Event { + readonly pair: RTCIceCandidatePair; +} + +declare var RTCIceCandidatePairChangedEvent: { + prototype: RTCIceCandidatePairChangedEvent; + new(): RTCIceCandidatePairChangedEvent; +} + +interface RTCIceGatherer extends RTCStatsProvider { + readonly component: string; + onerror: (ev: Event) => any; + onlocalcandidate: (ev: RTCIceGathererEvent) => any; + createAssociatedGatherer(): RTCIceGatherer; + getLocalCandidates(): RTCIceCandidate[]; + getLocalParameters(): RTCIceParameters; + addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: "localcandidate", listener: (ev: RTCIceGathererEvent) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var RTCIceGatherer: { + prototype: RTCIceGatherer; + new(options: RTCIceGatherOptions): RTCIceGatherer; +} + +interface RTCIceGathererEvent extends Event { + readonly candidate: RTCIceCandidate | RTCIceCandidateComplete; +} + +declare var RTCIceGathererEvent: { + prototype: RTCIceGathererEvent; + new(): RTCIceGathererEvent; +} + +interface RTCIceTransport extends RTCStatsProvider { + readonly component: string; + readonly iceGatherer: RTCIceGatherer; + oncandidatepairchange: (ev: RTCIceCandidatePairChangedEvent) => any; + onicestatechange: (ev: RTCIceTransportStateChangedEvent) => any; + readonly role: string; + readonly state: string; + addRemoteCandidate(remoteCandidate: RTCIceCandidate | RTCIceCandidateComplete): void; + createAssociatedTransport(): RTCIceTransport; + getNominatedCandidatePair(): RTCIceCandidatePair; + getRemoteCandidates(): RTCIceCandidate[]; + getRemoteParameters(): RTCIceParameters; + setRemoteCandidates(remoteCandidates: RTCIceCandidate[]): void; + start(gatherer: RTCIceGatherer, remoteParameters: RTCIceParameters, role?: string): void; + stop(): void; + addEventListener(type: "candidatepairchange", listener: (ev: RTCIceCandidatePairChangedEvent) => any, useCapture?: boolean): void; + addEventListener(type: "icestatechange", listener: (ev: RTCIceTransportStateChangedEvent) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var RTCIceTransport: { + prototype: RTCIceTransport; + new(): RTCIceTransport; +} + +interface RTCIceTransportStateChangedEvent extends Event { + readonly state: string; +} + +declare var RTCIceTransportStateChangedEvent: { + prototype: RTCIceTransportStateChangedEvent; + new(): RTCIceTransportStateChangedEvent; +} + +interface RTCRtpReceiver extends RTCStatsProvider { + onerror: (ev: Event) => any; + readonly rtcpTransport: RTCDtlsTransport; + readonly track: MediaStreamTrack; + readonly transport: RTCDtlsTransport | RTCSrtpSdesTransport; + getContributingSources(): RTCRtpContributingSource[]; + receive(parameters: RTCRtpParameters): void; + requestSendCSRC(csrc: number): void; + setTransport(transport: RTCDtlsTransport | RTCSrtpSdesTransport, rtcpTransport?: RTCDtlsTransport): void; + stop(): void; + addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var RTCRtpReceiver: { + prototype: RTCRtpReceiver; + new(transport: RTCDtlsTransport | RTCSrtpSdesTransport, kind: string, rtcpTransport?: RTCDtlsTransport): RTCRtpReceiver; + getCapabilities(kind?: string): RTCRtpCapabilities; +} + +interface RTCRtpSender extends RTCStatsProvider { + onerror: (ev: Event) => any; + onssrcconflict: (ev: RTCSsrcConflictEvent) => any; + readonly rtcpTransport: RTCDtlsTransport; + readonly track: MediaStreamTrack; + readonly transport: RTCDtlsTransport | RTCSrtpSdesTransport; + send(parameters: RTCRtpParameters): void; + setTrack(track: MediaStreamTrack): void; + setTransport(transport: RTCDtlsTransport | RTCSrtpSdesTransport, rtcpTransport?: RTCDtlsTransport): void; + stop(): void; + addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: "ssrcconflict", listener: (ev: RTCSsrcConflictEvent) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var RTCRtpSender: { + prototype: RTCRtpSender; + new(track: MediaStreamTrack, transport: RTCDtlsTransport | RTCSrtpSdesTransport, rtcpTransport?: RTCDtlsTransport): RTCRtpSender; + getCapabilities(kind?: string): RTCRtpCapabilities; +} + +interface RTCSrtpSdesTransport extends EventTarget { + onerror: (ev: Event) => any; + readonly transport: RTCIceTransport; + addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var RTCSrtpSdesTransport: { + prototype: RTCSrtpSdesTransport; + new(transport: RTCIceTransport, encryptParameters: RTCSrtpSdesParameters, decryptParameters: RTCSrtpSdesParameters): RTCSrtpSdesTransport; + getLocalParameters(): RTCSrtpSdesParameters[]; +} + +interface RTCSsrcConflictEvent extends Event { + readonly ssrc: number; +} + +declare var RTCSsrcConflictEvent: { + prototype: RTCSsrcConflictEvent; + new(): RTCSsrcConflictEvent; +} + +interface RTCStatsProvider extends EventTarget { + getStats(): PromiseLike; + msGetStats(): PromiseLike; +} + +declare var RTCStatsProvider: { + prototype: RTCStatsProvider; + new(): RTCStatsProvider; +} + interface Range { - collapsed: boolean; - commonAncestorContainer: Node; - endContainer: Node; - endOffset: number; - startContainer: Node; - startOffset: number; + readonly collapsed: boolean; + readonly commonAncestorContainer: Node; + readonly endContainer: Node; + readonly endOffset: number; + readonly startContainer: Node; + readonly startOffset: number; cloneContents(): DocumentFragment; cloneRange(): Range; collapse(toStart: boolean): void; @@ -13915,23 +15060,23 @@ interface Range { setStartBefore(refNode: Node): void; surroundContents(newParent: Node): void; toString(): string; - END_TO_END: number; - END_TO_START: number; - START_TO_END: number; - START_TO_START: number; + readonly END_TO_END: number; + readonly END_TO_START: number; + readonly START_TO_END: number; + readonly START_TO_START: number; } declare var Range: { prototype: Range; new(): Range; - END_TO_END: number; - END_TO_START: number; - START_TO_END: number; - START_TO_START: number; + readonly END_TO_END: number; + readonly END_TO_START: number; + readonly START_TO_END: number; + readonly START_TO_START: number; } interface SVGAElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired, SVGURIReference { - target: SVGAnimatedString; + readonly target: SVGAnimatedString; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -13941,32 +15086,32 @@ declare var SVGAElement: { } interface SVGAngle { - unitType: number; + readonly unitType: number; value: number; valueAsString: string; valueInSpecifiedUnits: number; convertToSpecifiedUnits(unitType: number): void; newValueSpecifiedUnits(unitType: number, valueInSpecifiedUnits: number): void; - SVG_ANGLETYPE_DEG: number; - SVG_ANGLETYPE_GRAD: number; - SVG_ANGLETYPE_RAD: number; - SVG_ANGLETYPE_UNKNOWN: number; - SVG_ANGLETYPE_UNSPECIFIED: number; + readonly SVG_ANGLETYPE_DEG: number; + readonly SVG_ANGLETYPE_GRAD: number; + readonly SVG_ANGLETYPE_RAD: number; + readonly SVG_ANGLETYPE_UNKNOWN: number; + readonly SVG_ANGLETYPE_UNSPECIFIED: number; } declare var SVGAngle: { prototype: SVGAngle; new(): SVGAngle; - SVG_ANGLETYPE_DEG: number; - SVG_ANGLETYPE_GRAD: number; - SVG_ANGLETYPE_RAD: number; - SVG_ANGLETYPE_UNKNOWN: number; - SVG_ANGLETYPE_UNSPECIFIED: number; + readonly SVG_ANGLETYPE_DEG: number; + readonly SVG_ANGLETYPE_GRAD: number; + readonly SVG_ANGLETYPE_RAD: number; + readonly SVG_ANGLETYPE_UNKNOWN: number; + readonly SVG_ANGLETYPE_UNSPECIFIED: number; } interface SVGAnimatedAngle { - animVal: SVGAngle; - baseVal: SVGAngle; + readonly animVal: SVGAngle; + readonly baseVal: SVGAngle; } declare var SVGAnimatedAngle: { @@ -13975,7 +15120,7 @@ declare var SVGAnimatedAngle: { } interface SVGAnimatedBoolean { - animVal: boolean; + readonly animVal: boolean; baseVal: boolean; } @@ -13985,7 +15130,7 @@ declare var SVGAnimatedBoolean: { } interface SVGAnimatedEnumeration { - animVal: number; + readonly animVal: number; baseVal: number; } @@ -13995,7 +15140,7 @@ declare var SVGAnimatedEnumeration: { } interface SVGAnimatedInteger { - animVal: number; + readonly animVal: number; baseVal: number; } @@ -14005,8 +15150,8 @@ declare var SVGAnimatedInteger: { } interface SVGAnimatedLength { - animVal: SVGLength; - baseVal: SVGLength; + readonly animVal: SVGLength; + readonly baseVal: SVGLength; } declare var SVGAnimatedLength: { @@ -14015,8 +15160,8 @@ declare var SVGAnimatedLength: { } interface SVGAnimatedLengthList { - animVal: SVGLengthList; - baseVal: SVGLengthList; + readonly animVal: SVGLengthList; + readonly baseVal: SVGLengthList; } declare var SVGAnimatedLengthList: { @@ -14025,7 +15170,7 @@ declare var SVGAnimatedLengthList: { } interface SVGAnimatedNumber { - animVal: number; + readonly animVal: number; baseVal: number; } @@ -14035,8 +15180,8 @@ declare var SVGAnimatedNumber: { } interface SVGAnimatedNumberList { - animVal: SVGNumberList; - baseVal: SVGNumberList; + readonly animVal: SVGNumberList; + readonly baseVal: SVGNumberList; } declare var SVGAnimatedNumberList: { @@ -14045,8 +15190,8 @@ declare var SVGAnimatedNumberList: { } interface SVGAnimatedPreserveAspectRatio { - animVal: SVGPreserveAspectRatio; - baseVal: SVGPreserveAspectRatio; + readonly animVal: SVGPreserveAspectRatio; + readonly baseVal: SVGPreserveAspectRatio; } declare var SVGAnimatedPreserveAspectRatio: { @@ -14055,8 +15200,8 @@ declare var SVGAnimatedPreserveAspectRatio: { } interface SVGAnimatedRect { - animVal: SVGRect; - baseVal: SVGRect; + readonly animVal: SVGRect; + readonly baseVal: SVGRect; } declare var SVGAnimatedRect: { @@ -14065,7 +15210,7 @@ declare var SVGAnimatedRect: { } interface SVGAnimatedString { - animVal: string; + readonly animVal: string; baseVal: string; } @@ -14075,8 +15220,8 @@ declare var SVGAnimatedString: { } interface SVGAnimatedTransformList { - animVal: SVGTransformList; - baseVal: SVGTransformList; + readonly animVal: SVGTransformList; + readonly baseVal: SVGTransformList; } declare var SVGAnimatedTransformList: { @@ -14085,9 +15230,9 @@ declare var SVGAnimatedTransformList: { } interface SVGCircleElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired { - cx: SVGAnimatedLength; - cy: SVGAnimatedLength; - r: SVGAnimatedLength; + readonly cx: SVGAnimatedLength; + readonly cy: SVGAnimatedLength; + readonly r: SVGAnimatedLength; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -14097,7 +15242,7 @@ declare var SVGCircleElement: { } interface SVGClipPathElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired, SVGUnitTypes { - clipPathUnits: SVGAnimatedEnumeration; + readonly clipPathUnits: SVGAnimatedEnumeration; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -14107,30 +15252,30 @@ declare var SVGClipPathElement: { } interface SVGComponentTransferFunctionElement extends SVGElement { - amplitude: SVGAnimatedNumber; - exponent: SVGAnimatedNumber; - intercept: SVGAnimatedNumber; - offset: SVGAnimatedNumber; - slope: SVGAnimatedNumber; - tableValues: SVGAnimatedNumberList; - type: SVGAnimatedEnumeration; - SVG_FECOMPONENTTRANSFER_TYPE_DISCRETE: number; - SVG_FECOMPONENTTRANSFER_TYPE_GAMMA: number; - SVG_FECOMPONENTTRANSFER_TYPE_IDENTITY: number; - SVG_FECOMPONENTTRANSFER_TYPE_LINEAR: number; - SVG_FECOMPONENTTRANSFER_TYPE_TABLE: number; - SVG_FECOMPONENTTRANSFER_TYPE_UNKNOWN: number; + readonly amplitude: SVGAnimatedNumber; + readonly exponent: SVGAnimatedNumber; + readonly intercept: SVGAnimatedNumber; + readonly offset: SVGAnimatedNumber; + readonly slope: SVGAnimatedNumber; + readonly tableValues: SVGAnimatedNumberList; + readonly type: SVGAnimatedEnumeration; + readonly SVG_FECOMPONENTTRANSFER_TYPE_DISCRETE: number; + readonly SVG_FECOMPONENTTRANSFER_TYPE_GAMMA: number; + readonly SVG_FECOMPONENTTRANSFER_TYPE_IDENTITY: number; + readonly SVG_FECOMPONENTTRANSFER_TYPE_LINEAR: number; + readonly SVG_FECOMPONENTTRANSFER_TYPE_TABLE: number; + readonly SVG_FECOMPONENTTRANSFER_TYPE_UNKNOWN: number; } declare var SVGComponentTransferFunctionElement: { prototype: SVGComponentTransferFunctionElement; new(): SVGComponentTransferFunctionElement; - SVG_FECOMPONENTTRANSFER_TYPE_DISCRETE: number; - SVG_FECOMPONENTTRANSFER_TYPE_GAMMA: number; - SVG_FECOMPONENTTRANSFER_TYPE_IDENTITY: number; - SVG_FECOMPONENTTRANSFER_TYPE_LINEAR: number; - SVG_FECOMPONENTTRANSFER_TYPE_TABLE: number; - SVG_FECOMPONENTTRANSFER_TYPE_UNKNOWN: number; + readonly SVG_FECOMPONENTTRANSFER_TYPE_DISCRETE: number; + readonly SVG_FECOMPONENTTRANSFER_TYPE_GAMMA: number; + readonly SVG_FECOMPONENTTRANSFER_TYPE_IDENTITY: number; + readonly SVG_FECOMPONENTTRANSFER_TYPE_LINEAR: number; + readonly SVG_FECOMPONENTTRANSFER_TYPE_TABLE: number; + readonly SVG_FECOMPONENTTRANSFER_TYPE_UNKNOWN: number; } interface SVGDefsElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired { @@ -14152,7 +15297,6 @@ declare var SVGDescElement: { } interface SVGElement extends Element { - id: string; onclick: (ev: MouseEvent) => any; ondblclick: (ev: MouseEvent) => any; onfocusin: (ev: FocusEvent) => any; @@ -14163,8 +15307,8 @@ interface SVGElement extends Element { onmouseout: (ev: MouseEvent) => any; onmouseover: (ev: MouseEvent) => any; onmouseup: (ev: MouseEvent) => any; - ownerSVGElement: SVGSVGElement; - viewportElement: SVGElement; + readonly ownerSVGElement: SVGSVGElement; + readonly viewportElement: SVGElement; xmlbase: string; className: any; addEventListener(type: "MSGestureChange", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void; @@ -14222,14 +15366,14 @@ declare var SVGElement: { } interface SVGElementInstance extends EventTarget { - childNodes: SVGElementInstanceList; - correspondingElement: SVGElement; - correspondingUseElement: SVGUseElement; - firstChild: SVGElementInstance; - lastChild: SVGElementInstance; - nextSibling: SVGElementInstance; - parentNode: SVGElementInstance; - previousSibling: SVGElementInstance; + readonly childNodes: SVGElementInstanceList; + readonly correspondingElement: SVGElement; + readonly correspondingUseElement: SVGUseElement; + readonly firstChild: SVGElementInstance; + readonly lastChild: SVGElementInstance; + readonly nextSibling: SVGElementInstance; + readonly parentNode: SVGElementInstance; + readonly previousSibling: SVGElementInstance; } declare var SVGElementInstance: { @@ -14238,7 +15382,7 @@ declare var SVGElementInstance: { } interface SVGElementInstanceList { - length: number; + readonly length: number; item(index: number): SVGElementInstance; } @@ -14248,10 +15392,10 @@ declare var SVGElementInstanceList: { } interface SVGEllipseElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired { - cx: SVGAnimatedLength; - cy: SVGAnimatedLength; - rx: SVGAnimatedLength; - ry: SVGAnimatedLength; + readonly cx: SVGAnimatedLength; + readonly cy: SVGAnimatedLength; + readonly rx: SVGAnimatedLength; + readonly ry: SVGAnimatedLength; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -14261,75 +15405,75 @@ declare var SVGEllipseElement: { } interface SVGFEBlendElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { - in1: SVGAnimatedString; - in2: SVGAnimatedString; - mode: SVGAnimatedEnumeration; - SVG_FEBLEND_MODE_COLOR: number; - SVG_FEBLEND_MODE_COLOR_BURN: number; - SVG_FEBLEND_MODE_COLOR_DODGE: number; - SVG_FEBLEND_MODE_DARKEN: number; - SVG_FEBLEND_MODE_DIFFERENCE: number; - SVG_FEBLEND_MODE_EXCLUSION: number; - SVG_FEBLEND_MODE_HARD_LIGHT: number; - SVG_FEBLEND_MODE_HUE: number; - SVG_FEBLEND_MODE_LIGHTEN: number; - SVG_FEBLEND_MODE_LUMINOSITY: number; - SVG_FEBLEND_MODE_MULTIPLY: number; - SVG_FEBLEND_MODE_NORMAL: number; - SVG_FEBLEND_MODE_OVERLAY: number; - SVG_FEBLEND_MODE_SATURATION: number; - SVG_FEBLEND_MODE_SCREEN: number; - SVG_FEBLEND_MODE_SOFT_LIGHT: number; - SVG_FEBLEND_MODE_UNKNOWN: number; + readonly in1: SVGAnimatedString; + readonly in2: SVGAnimatedString; + readonly mode: SVGAnimatedEnumeration; + readonly SVG_FEBLEND_MODE_COLOR: number; + readonly SVG_FEBLEND_MODE_COLOR_BURN: number; + readonly SVG_FEBLEND_MODE_COLOR_DODGE: number; + readonly SVG_FEBLEND_MODE_DARKEN: number; + readonly SVG_FEBLEND_MODE_DIFFERENCE: number; + readonly SVG_FEBLEND_MODE_EXCLUSION: number; + readonly SVG_FEBLEND_MODE_HARD_LIGHT: number; + readonly SVG_FEBLEND_MODE_HUE: number; + readonly SVG_FEBLEND_MODE_LIGHTEN: number; + readonly SVG_FEBLEND_MODE_LUMINOSITY: number; + readonly SVG_FEBLEND_MODE_MULTIPLY: number; + readonly SVG_FEBLEND_MODE_NORMAL: number; + readonly SVG_FEBLEND_MODE_OVERLAY: number; + readonly SVG_FEBLEND_MODE_SATURATION: number; + readonly SVG_FEBLEND_MODE_SCREEN: number; + readonly SVG_FEBLEND_MODE_SOFT_LIGHT: number; + readonly SVG_FEBLEND_MODE_UNKNOWN: number; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var SVGFEBlendElement: { prototype: SVGFEBlendElement; new(): SVGFEBlendElement; - SVG_FEBLEND_MODE_COLOR: number; - SVG_FEBLEND_MODE_COLOR_BURN: number; - SVG_FEBLEND_MODE_COLOR_DODGE: number; - SVG_FEBLEND_MODE_DARKEN: number; - SVG_FEBLEND_MODE_DIFFERENCE: number; - SVG_FEBLEND_MODE_EXCLUSION: number; - SVG_FEBLEND_MODE_HARD_LIGHT: number; - SVG_FEBLEND_MODE_HUE: number; - SVG_FEBLEND_MODE_LIGHTEN: number; - SVG_FEBLEND_MODE_LUMINOSITY: number; - SVG_FEBLEND_MODE_MULTIPLY: number; - SVG_FEBLEND_MODE_NORMAL: number; - SVG_FEBLEND_MODE_OVERLAY: number; - SVG_FEBLEND_MODE_SATURATION: number; - SVG_FEBLEND_MODE_SCREEN: number; - SVG_FEBLEND_MODE_SOFT_LIGHT: number; - SVG_FEBLEND_MODE_UNKNOWN: number; + readonly SVG_FEBLEND_MODE_COLOR: number; + readonly SVG_FEBLEND_MODE_COLOR_BURN: number; + readonly SVG_FEBLEND_MODE_COLOR_DODGE: number; + readonly SVG_FEBLEND_MODE_DARKEN: number; + readonly SVG_FEBLEND_MODE_DIFFERENCE: number; + readonly SVG_FEBLEND_MODE_EXCLUSION: number; + readonly SVG_FEBLEND_MODE_HARD_LIGHT: number; + readonly SVG_FEBLEND_MODE_HUE: number; + readonly SVG_FEBLEND_MODE_LIGHTEN: number; + readonly SVG_FEBLEND_MODE_LUMINOSITY: number; + readonly SVG_FEBLEND_MODE_MULTIPLY: number; + readonly SVG_FEBLEND_MODE_NORMAL: number; + readonly SVG_FEBLEND_MODE_OVERLAY: number; + readonly SVG_FEBLEND_MODE_SATURATION: number; + readonly SVG_FEBLEND_MODE_SCREEN: number; + readonly SVG_FEBLEND_MODE_SOFT_LIGHT: number; + readonly SVG_FEBLEND_MODE_UNKNOWN: number; } interface SVGFEColorMatrixElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { - in1: SVGAnimatedString; - type: SVGAnimatedEnumeration; - values: SVGAnimatedNumberList; - SVG_FECOLORMATRIX_TYPE_HUEROTATE: number; - SVG_FECOLORMATRIX_TYPE_LUMINANCETOALPHA: number; - SVG_FECOLORMATRIX_TYPE_MATRIX: number; - SVG_FECOLORMATRIX_TYPE_SATURATE: number; - SVG_FECOLORMATRIX_TYPE_UNKNOWN: number; + readonly in1: SVGAnimatedString; + readonly type: SVGAnimatedEnumeration; + readonly values: SVGAnimatedNumberList; + readonly SVG_FECOLORMATRIX_TYPE_HUEROTATE: number; + readonly SVG_FECOLORMATRIX_TYPE_LUMINANCETOALPHA: number; + readonly SVG_FECOLORMATRIX_TYPE_MATRIX: number; + readonly SVG_FECOLORMATRIX_TYPE_SATURATE: number; + readonly SVG_FECOLORMATRIX_TYPE_UNKNOWN: number; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var SVGFEColorMatrixElement: { prototype: SVGFEColorMatrixElement; new(): SVGFEColorMatrixElement; - SVG_FECOLORMATRIX_TYPE_HUEROTATE: number; - SVG_FECOLORMATRIX_TYPE_LUMINANCETOALPHA: number; - SVG_FECOLORMATRIX_TYPE_MATRIX: number; - SVG_FECOLORMATRIX_TYPE_SATURATE: number; - SVG_FECOLORMATRIX_TYPE_UNKNOWN: number; + readonly SVG_FECOLORMATRIX_TYPE_HUEROTATE: number; + readonly SVG_FECOLORMATRIX_TYPE_LUMINANCETOALPHA: number; + readonly SVG_FECOLORMATRIX_TYPE_MATRIX: number; + readonly SVG_FECOLORMATRIX_TYPE_SATURATE: number; + readonly SVG_FECOLORMATRIX_TYPE_UNKNOWN: number; } interface SVGFEComponentTransferElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { - in1: SVGAnimatedString; + readonly in1: SVGAnimatedString; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -14339,70 +15483,70 @@ declare var SVGFEComponentTransferElement: { } interface SVGFECompositeElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { - in1: SVGAnimatedString; - in2: SVGAnimatedString; - k1: SVGAnimatedNumber; - k2: SVGAnimatedNumber; - k3: SVGAnimatedNumber; - k4: SVGAnimatedNumber; - operator: SVGAnimatedEnumeration; - SVG_FECOMPOSITE_OPERATOR_ARITHMETIC: number; - SVG_FECOMPOSITE_OPERATOR_ATOP: number; - SVG_FECOMPOSITE_OPERATOR_IN: number; - SVG_FECOMPOSITE_OPERATOR_OUT: number; - SVG_FECOMPOSITE_OPERATOR_OVER: number; - SVG_FECOMPOSITE_OPERATOR_UNKNOWN: number; - SVG_FECOMPOSITE_OPERATOR_XOR: number; + readonly in1: SVGAnimatedString; + readonly in2: SVGAnimatedString; + readonly k1: SVGAnimatedNumber; + readonly k2: SVGAnimatedNumber; + readonly k3: SVGAnimatedNumber; + readonly k4: SVGAnimatedNumber; + readonly operator: SVGAnimatedEnumeration; + readonly SVG_FECOMPOSITE_OPERATOR_ARITHMETIC: number; + readonly SVG_FECOMPOSITE_OPERATOR_ATOP: number; + readonly SVG_FECOMPOSITE_OPERATOR_IN: number; + readonly SVG_FECOMPOSITE_OPERATOR_OUT: number; + readonly SVG_FECOMPOSITE_OPERATOR_OVER: number; + readonly SVG_FECOMPOSITE_OPERATOR_UNKNOWN: number; + readonly SVG_FECOMPOSITE_OPERATOR_XOR: number; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var SVGFECompositeElement: { prototype: SVGFECompositeElement; new(): SVGFECompositeElement; - SVG_FECOMPOSITE_OPERATOR_ARITHMETIC: number; - SVG_FECOMPOSITE_OPERATOR_ATOP: number; - SVG_FECOMPOSITE_OPERATOR_IN: number; - SVG_FECOMPOSITE_OPERATOR_OUT: number; - SVG_FECOMPOSITE_OPERATOR_OVER: number; - SVG_FECOMPOSITE_OPERATOR_UNKNOWN: number; - SVG_FECOMPOSITE_OPERATOR_XOR: number; + readonly SVG_FECOMPOSITE_OPERATOR_ARITHMETIC: number; + readonly SVG_FECOMPOSITE_OPERATOR_ATOP: number; + readonly SVG_FECOMPOSITE_OPERATOR_IN: number; + readonly SVG_FECOMPOSITE_OPERATOR_OUT: number; + readonly SVG_FECOMPOSITE_OPERATOR_OVER: number; + readonly SVG_FECOMPOSITE_OPERATOR_UNKNOWN: number; + readonly SVG_FECOMPOSITE_OPERATOR_XOR: number; } interface SVGFEConvolveMatrixElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { - bias: SVGAnimatedNumber; - divisor: SVGAnimatedNumber; - edgeMode: SVGAnimatedEnumeration; - in1: SVGAnimatedString; - kernelMatrix: SVGAnimatedNumberList; - kernelUnitLengthX: SVGAnimatedNumber; - kernelUnitLengthY: SVGAnimatedNumber; - orderX: SVGAnimatedInteger; - orderY: SVGAnimatedInteger; - preserveAlpha: SVGAnimatedBoolean; - targetX: SVGAnimatedInteger; - targetY: SVGAnimatedInteger; - SVG_EDGEMODE_DUPLICATE: number; - SVG_EDGEMODE_NONE: number; - SVG_EDGEMODE_UNKNOWN: number; - SVG_EDGEMODE_WRAP: number; + readonly bias: SVGAnimatedNumber; + readonly divisor: SVGAnimatedNumber; + readonly edgeMode: SVGAnimatedEnumeration; + readonly in1: SVGAnimatedString; + readonly kernelMatrix: SVGAnimatedNumberList; + readonly kernelUnitLengthX: SVGAnimatedNumber; + readonly kernelUnitLengthY: SVGAnimatedNumber; + readonly orderX: SVGAnimatedInteger; + readonly orderY: SVGAnimatedInteger; + readonly preserveAlpha: SVGAnimatedBoolean; + readonly targetX: SVGAnimatedInteger; + readonly targetY: SVGAnimatedInteger; + readonly SVG_EDGEMODE_DUPLICATE: number; + readonly SVG_EDGEMODE_NONE: number; + readonly SVG_EDGEMODE_UNKNOWN: number; + readonly SVG_EDGEMODE_WRAP: number; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var SVGFEConvolveMatrixElement: { prototype: SVGFEConvolveMatrixElement; new(): SVGFEConvolveMatrixElement; - SVG_EDGEMODE_DUPLICATE: number; - SVG_EDGEMODE_NONE: number; - SVG_EDGEMODE_UNKNOWN: number; - SVG_EDGEMODE_WRAP: number; + readonly SVG_EDGEMODE_DUPLICATE: number; + readonly SVG_EDGEMODE_NONE: number; + readonly SVG_EDGEMODE_UNKNOWN: number; + readonly SVG_EDGEMODE_WRAP: number; } interface SVGFEDiffuseLightingElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { - diffuseConstant: SVGAnimatedNumber; - in1: SVGAnimatedString; - kernelUnitLengthX: SVGAnimatedNumber; - kernelUnitLengthY: SVGAnimatedNumber; - surfaceScale: SVGAnimatedNumber; + readonly diffuseConstant: SVGAnimatedNumber; + readonly in1: SVGAnimatedString; + readonly kernelUnitLengthX: SVGAnimatedNumber; + readonly kernelUnitLengthY: SVGAnimatedNumber; + readonly surfaceScale: SVGAnimatedNumber; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -14412,32 +15556,32 @@ declare var SVGFEDiffuseLightingElement: { } interface SVGFEDisplacementMapElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { - in1: SVGAnimatedString; - in2: SVGAnimatedString; - scale: SVGAnimatedNumber; - xChannelSelector: SVGAnimatedEnumeration; - yChannelSelector: SVGAnimatedEnumeration; - SVG_CHANNEL_A: number; - SVG_CHANNEL_B: number; - SVG_CHANNEL_G: number; - SVG_CHANNEL_R: number; - SVG_CHANNEL_UNKNOWN: number; + readonly in1: SVGAnimatedString; + readonly in2: SVGAnimatedString; + readonly scale: SVGAnimatedNumber; + readonly xChannelSelector: SVGAnimatedEnumeration; + readonly yChannelSelector: SVGAnimatedEnumeration; + readonly SVG_CHANNEL_A: number; + readonly SVG_CHANNEL_B: number; + readonly SVG_CHANNEL_G: number; + readonly SVG_CHANNEL_R: number; + readonly SVG_CHANNEL_UNKNOWN: number; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var SVGFEDisplacementMapElement: { prototype: SVGFEDisplacementMapElement; new(): SVGFEDisplacementMapElement; - SVG_CHANNEL_A: number; - SVG_CHANNEL_B: number; - SVG_CHANNEL_G: number; - SVG_CHANNEL_R: number; - SVG_CHANNEL_UNKNOWN: number; + readonly SVG_CHANNEL_A: number; + readonly SVG_CHANNEL_B: number; + readonly SVG_CHANNEL_G: number; + readonly SVG_CHANNEL_R: number; + readonly SVG_CHANNEL_UNKNOWN: number; } interface SVGFEDistantLightElement extends SVGElement { - azimuth: SVGAnimatedNumber; - elevation: SVGAnimatedNumber; + readonly azimuth: SVGAnimatedNumber; + readonly elevation: SVGAnimatedNumber; } declare var SVGFEDistantLightElement: { @@ -14487,9 +15631,9 @@ declare var SVGFEFuncRElement: { } interface SVGFEGaussianBlurElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { - in1: SVGAnimatedString; - stdDeviationX: SVGAnimatedNumber; - stdDeviationY: SVGAnimatedNumber; + readonly in1: SVGAnimatedString; + readonly stdDeviationX: SVGAnimatedNumber; + readonly stdDeviationY: SVGAnimatedNumber; setStdDeviation(stdDeviationX: number, stdDeviationY: number): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -14500,7 +15644,7 @@ declare var SVGFEGaussianBlurElement: { } interface SVGFEImageElement extends SVGElement, SVGFilterPrimitiveStandardAttributes, SVGLangSpace, SVGURIReference, SVGExternalResourcesRequired { - preserveAspectRatio: SVGAnimatedPreserveAspectRatio; + readonly preserveAspectRatio: SVGAnimatedPreserveAspectRatio; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -14519,7 +15663,7 @@ declare var SVGFEMergeElement: { } interface SVGFEMergeNodeElement extends SVGElement { - in1: SVGAnimatedString; + readonly in1: SVGAnimatedString; } declare var SVGFEMergeNodeElement: { @@ -14528,28 +15672,28 @@ declare var SVGFEMergeNodeElement: { } interface SVGFEMorphologyElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { - in1: SVGAnimatedString; - operator: SVGAnimatedEnumeration; - radiusX: SVGAnimatedNumber; - radiusY: SVGAnimatedNumber; - SVG_MORPHOLOGY_OPERATOR_DILATE: number; - SVG_MORPHOLOGY_OPERATOR_ERODE: number; - SVG_MORPHOLOGY_OPERATOR_UNKNOWN: number; + readonly in1: SVGAnimatedString; + readonly operator: SVGAnimatedEnumeration; + readonly radiusX: SVGAnimatedNumber; + readonly radiusY: SVGAnimatedNumber; + readonly SVG_MORPHOLOGY_OPERATOR_DILATE: number; + readonly SVG_MORPHOLOGY_OPERATOR_ERODE: number; + readonly SVG_MORPHOLOGY_OPERATOR_UNKNOWN: number; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var SVGFEMorphologyElement: { prototype: SVGFEMorphologyElement; new(): SVGFEMorphologyElement; - SVG_MORPHOLOGY_OPERATOR_DILATE: number; - SVG_MORPHOLOGY_OPERATOR_ERODE: number; - SVG_MORPHOLOGY_OPERATOR_UNKNOWN: number; + readonly SVG_MORPHOLOGY_OPERATOR_DILATE: number; + readonly SVG_MORPHOLOGY_OPERATOR_ERODE: number; + readonly SVG_MORPHOLOGY_OPERATOR_UNKNOWN: number; } interface SVGFEOffsetElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { - dx: SVGAnimatedNumber; - dy: SVGAnimatedNumber; - in1: SVGAnimatedString; + readonly dx: SVGAnimatedNumber; + readonly dy: SVGAnimatedNumber; + readonly in1: SVGAnimatedString; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -14559,9 +15703,9 @@ declare var SVGFEOffsetElement: { } interface SVGFEPointLightElement extends SVGElement { - x: SVGAnimatedNumber; - y: SVGAnimatedNumber; - z: SVGAnimatedNumber; + readonly x: SVGAnimatedNumber; + readonly y: SVGAnimatedNumber; + readonly z: SVGAnimatedNumber; } declare var SVGFEPointLightElement: { @@ -14570,12 +15714,12 @@ declare var SVGFEPointLightElement: { } interface SVGFESpecularLightingElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { - in1: SVGAnimatedString; - kernelUnitLengthX: SVGAnimatedNumber; - kernelUnitLengthY: SVGAnimatedNumber; - specularConstant: SVGAnimatedNumber; - specularExponent: SVGAnimatedNumber; - surfaceScale: SVGAnimatedNumber; + readonly in1: SVGAnimatedString; + readonly kernelUnitLengthX: SVGAnimatedNumber; + readonly kernelUnitLengthY: SVGAnimatedNumber; + readonly specularConstant: SVGAnimatedNumber; + readonly specularExponent: SVGAnimatedNumber; + readonly surfaceScale: SVGAnimatedNumber; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -14585,14 +15729,14 @@ declare var SVGFESpecularLightingElement: { } interface SVGFESpotLightElement extends SVGElement { - limitingConeAngle: SVGAnimatedNumber; - pointsAtX: SVGAnimatedNumber; - pointsAtY: SVGAnimatedNumber; - pointsAtZ: SVGAnimatedNumber; - specularExponent: SVGAnimatedNumber; - x: SVGAnimatedNumber; - y: SVGAnimatedNumber; - z: SVGAnimatedNumber; + readonly limitingConeAngle: SVGAnimatedNumber; + readonly pointsAtX: SVGAnimatedNumber; + readonly pointsAtY: SVGAnimatedNumber; + readonly pointsAtZ: SVGAnimatedNumber; + readonly specularExponent: SVGAnimatedNumber; + readonly x: SVGAnimatedNumber; + readonly y: SVGAnimatedNumber; + readonly z: SVGAnimatedNumber; } declare var SVGFESpotLightElement: { @@ -14601,7 +15745,7 @@ declare var SVGFESpotLightElement: { } interface SVGFETileElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { - in1: SVGAnimatedString; + readonly in1: SVGAnimatedString; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -14611,41 +15755,41 @@ declare var SVGFETileElement: { } interface SVGFETurbulenceElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { - baseFrequencyX: SVGAnimatedNumber; - baseFrequencyY: SVGAnimatedNumber; - numOctaves: SVGAnimatedInteger; - seed: SVGAnimatedNumber; - stitchTiles: SVGAnimatedEnumeration; - type: SVGAnimatedEnumeration; - SVG_STITCHTYPE_NOSTITCH: number; - SVG_STITCHTYPE_STITCH: number; - SVG_STITCHTYPE_UNKNOWN: number; - SVG_TURBULENCE_TYPE_FRACTALNOISE: number; - SVG_TURBULENCE_TYPE_TURBULENCE: number; - SVG_TURBULENCE_TYPE_UNKNOWN: number; + readonly baseFrequencyX: SVGAnimatedNumber; + readonly baseFrequencyY: SVGAnimatedNumber; + readonly numOctaves: SVGAnimatedInteger; + readonly seed: SVGAnimatedNumber; + readonly stitchTiles: SVGAnimatedEnumeration; + readonly type: SVGAnimatedEnumeration; + readonly SVG_STITCHTYPE_NOSTITCH: number; + readonly SVG_STITCHTYPE_STITCH: number; + readonly SVG_STITCHTYPE_UNKNOWN: number; + readonly SVG_TURBULENCE_TYPE_FRACTALNOISE: number; + readonly SVG_TURBULENCE_TYPE_TURBULENCE: number; + readonly SVG_TURBULENCE_TYPE_UNKNOWN: number; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var SVGFETurbulenceElement: { prototype: SVGFETurbulenceElement; new(): SVGFETurbulenceElement; - SVG_STITCHTYPE_NOSTITCH: number; - SVG_STITCHTYPE_STITCH: number; - SVG_STITCHTYPE_UNKNOWN: number; - SVG_TURBULENCE_TYPE_FRACTALNOISE: number; - SVG_TURBULENCE_TYPE_TURBULENCE: number; - SVG_TURBULENCE_TYPE_UNKNOWN: number; + readonly SVG_STITCHTYPE_NOSTITCH: number; + readonly SVG_STITCHTYPE_STITCH: number; + readonly SVG_STITCHTYPE_UNKNOWN: number; + readonly SVG_TURBULENCE_TYPE_FRACTALNOISE: number; + readonly SVG_TURBULENCE_TYPE_TURBULENCE: number; + readonly SVG_TURBULENCE_TYPE_UNKNOWN: number; } interface SVGFilterElement extends SVGElement, SVGUnitTypes, SVGStylable, SVGLangSpace, SVGURIReference, SVGExternalResourcesRequired { - filterResX: SVGAnimatedInteger; - filterResY: SVGAnimatedInteger; - filterUnits: SVGAnimatedEnumeration; - height: SVGAnimatedLength; - primitiveUnits: SVGAnimatedEnumeration; - width: SVGAnimatedLength; - x: SVGAnimatedLength; - y: SVGAnimatedLength; + readonly filterResX: SVGAnimatedInteger; + readonly filterResY: SVGAnimatedInteger; + readonly filterUnits: SVGAnimatedEnumeration; + readonly height: SVGAnimatedLength; + readonly primitiveUnits: SVGAnimatedEnumeration; + readonly width: SVGAnimatedLength; + readonly x: SVGAnimatedLength; + readonly y: SVGAnimatedLength; setFilterRes(filterResX: number, filterResY: number): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -14656,10 +15800,10 @@ declare var SVGFilterElement: { } interface SVGForeignObjectElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired { - height: SVGAnimatedLength; - width: SVGAnimatedLength; - x: SVGAnimatedLength; - y: SVGAnimatedLength; + readonly height: SVGAnimatedLength; + readonly width: SVGAnimatedLength; + readonly x: SVGAnimatedLength; + readonly y: SVGAnimatedLength; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -14678,31 +15822,31 @@ declare var SVGGElement: { } interface SVGGradientElement extends SVGElement, SVGStylable, SVGExternalResourcesRequired, SVGURIReference, SVGUnitTypes { - gradientTransform: SVGAnimatedTransformList; - gradientUnits: SVGAnimatedEnumeration; - spreadMethod: SVGAnimatedEnumeration; - SVG_SPREADMETHOD_PAD: number; - SVG_SPREADMETHOD_REFLECT: number; - SVG_SPREADMETHOD_REPEAT: number; - SVG_SPREADMETHOD_UNKNOWN: number; + readonly gradientTransform: SVGAnimatedTransformList; + readonly gradientUnits: SVGAnimatedEnumeration; + readonly spreadMethod: SVGAnimatedEnumeration; + readonly SVG_SPREADMETHOD_PAD: number; + readonly SVG_SPREADMETHOD_REFLECT: number; + readonly SVG_SPREADMETHOD_REPEAT: number; + readonly SVG_SPREADMETHOD_UNKNOWN: number; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var SVGGradientElement: { prototype: SVGGradientElement; new(): SVGGradientElement; - SVG_SPREADMETHOD_PAD: number; - SVG_SPREADMETHOD_REFLECT: number; - SVG_SPREADMETHOD_REPEAT: number; - SVG_SPREADMETHOD_UNKNOWN: number; + readonly SVG_SPREADMETHOD_PAD: number; + readonly SVG_SPREADMETHOD_REFLECT: number; + readonly SVG_SPREADMETHOD_REPEAT: number; + readonly SVG_SPREADMETHOD_UNKNOWN: number; } interface SVGImageElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired, SVGURIReference { - height: SVGAnimatedLength; - preserveAspectRatio: SVGAnimatedPreserveAspectRatio; - width: SVGAnimatedLength; - x: SVGAnimatedLength; - y: SVGAnimatedLength; + readonly height: SVGAnimatedLength; + readonly preserveAspectRatio: SVGAnimatedPreserveAspectRatio; + readonly width: SVGAnimatedLength; + readonly x: SVGAnimatedLength; + readonly y: SVGAnimatedLength; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -14712,43 +15856,43 @@ declare var SVGImageElement: { } interface SVGLength { - unitType: number; + readonly unitType: number; value: number; valueAsString: string; valueInSpecifiedUnits: number; convertToSpecifiedUnits(unitType: number): void; newValueSpecifiedUnits(unitType: number, valueInSpecifiedUnits: number): void; - SVG_LENGTHTYPE_CM: number; - SVG_LENGTHTYPE_EMS: number; - SVG_LENGTHTYPE_EXS: number; - SVG_LENGTHTYPE_IN: number; - SVG_LENGTHTYPE_MM: number; - SVG_LENGTHTYPE_NUMBER: number; - SVG_LENGTHTYPE_PC: number; - SVG_LENGTHTYPE_PERCENTAGE: number; - SVG_LENGTHTYPE_PT: number; - SVG_LENGTHTYPE_PX: number; - SVG_LENGTHTYPE_UNKNOWN: number; + readonly SVG_LENGTHTYPE_CM: number; + readonly SVG_LENGTHTYPE_EMS: number; + readonly SVG_LENGTHTYPE_EXS: number; + readonly SVG_LENGTHTYPE_IN: number; + readonly SVG_LENGTHTYPE_MM: number; + readonly SVG_LENGTHTYPE_NUMBER: number; + readonly SVG_LENGTHTYPE_PC: number; + readonly SVG_LENGTHTYPE_PERCENTAGE: number; + readonly SVG_LENGTHTYPE_PT: number; + readonly SVG_LENGTHTYPE_PX: number; + readonly SVG_LENGTHTYPE_UNKNOWN: number; } declare var SVGLength: { prototype: SVGLength; new(): SVGLength; - SVG_LENGTHTYPE_CM: number; - SVG_LENGTHTYPE_EMS: number; - SVG_LENGTHTYPE_EXS: number; - SVG_LENGTHTYPE_IN: number; - SVG_LENGTHTYPE_MM: number; - SVG_LENGTHTYPE_NUMBER: number; - SVG_LENGTHTYPE_PC: number; - SVG_LENGTHTYPE_PERCENTAGE: number; - SVG_LENGTHTYPE_PT: number; - SVG_LENGTHTYPE_PX: number; - SVG_LENGTHTYPE_UNKNOWN: number; + readonly SVG_LENGTHTYPE_CM: number; + readonly SVG_LENGTHTYPE_EMS: number; + readonly SVG_LENGTHTYPE_EXS: number; + readonly SVG_LENGTHTYPE_IN: number; + readonly SVG_LENGTHTYPE_MM: number; + readonly SVG_LENGTHTYPE_NUMBER: number; + readonly SVG_LENGTHTYPE_PC: number; + readonly SVG_LENGTHTYPE_PERCENTAGE: number; + readonly SVG_LENGTHTYPE_PT: number; + readonly SVG_LENGTHTYPE_PX: number; + readonly SVG_LENGTHTYPE_UNKNOWN: number; } interface SVGLengthList { - numberOfItems: number; + readonly numberOfItems: number; appendItem(newItem: SVGLength): SVGLength; clear(): void; getItem(index: number): SVGLength; @@ -14764,10 +15908,10 @@ declare var SVGLengthList: { } interface SVGLineElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired { - x1: SVGAnimatedLength; - x2: SVGAnimatedLength; - y1: SVGAnimatedLength; - y2: SVGAnimatedLength; + readonly x1: SVGAnimatedLength; + readonly x2: SVGAnimatedLength; + readonly y1: SVGAnimatedLength; + readonly y2: SVGAnimatedLength; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -14777,10 +15921,10 @@ declare var SVGLineElement: { } interface SVGLinearGradientElement extends SVGGradientElement { - x1: SVGAnimatedLength; - x2: SVGAnimatedLength; - y1: SVGAnimatedLength; - y2: SVGAnimatedLength; + readonly x1: SVGAnimatedLength; + readonly x2: SVGAnimatedLength; + readonly y1: SVGAnimatedLength; + readonly y2: SVGAnimatedLength; } declare var SVGLinearGradientElement: { @@ -14789,42 +15933,42 @@ declare var SVGLinearGradientElement: { } interface SVGMarkerElement extends SVGElement, SVGStylable, SVGLangSpace, SVGExternalResourcesRequired, SVGFitToViewBox { - markerHeight: SVGAnimatedLength; - markerUnits: SVGAnimatedEnumeration; - markerWidth: SVGAnimatedLength; - orientAngle: SVGAnimatedAngle; - orientType: SVGAnimatedEnumeration; - refX: SVGAnimatedLength; - refY: SVGAnimatedLength; + readonly markerHeight: SVGAnimatedLength; + readonly markerUnits: SVGAnimatedEnumeration; + readonly markerWidth: SVGAnimatedLength; + readonly orientAngle: SVGAnimatedAngle; + readonly orientType: SVGAnimatedEnumeration; + readonly refX: SVGAnimatedLength; + readonly refY: SVGAnimatedLength; setOrientToAngle(angle: SVGAngle): void; setOrientToAuto(): void; - SVG_MARKERUNITS_STROKEWIDTH: number; - SVG_MARKERUNITS_UNKNOWN: number; - SVG_MARKERUNITS_USERSPACEONUSE: number; - SVG_MARKER_ORIENT_ANGLE: number; - SVG_MARKER_ORIENT_AUTO: number; - SVG_MARKER_ORIENT_UNKNOWN: number; + readonly SVG_MARKERUNITS_STROKEWIDTH: number; + readonly SVG_MARKERUNITS_UNKNOWN: number; + readonly SVG_MARKERUNITS_USERSPACEONUSE: number; + readonly SVG_MARKER_ORIENT_ANGLE: number; + readonly SVG_MARKER_ORIENT_AUTO: number; + readonly SVG_MARKER_ORIENT_UNKNOWN: number; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var SVGMarkerElement: { prototype: SVGMarkerElement; new(): SVGMarkerElement; - SVG_MARKERUNITS_STROKEWIDTH: number; - SVG_MARKERUNITS_UNKNOWN: number; - SVG_MARKERUNITS_USERSPACEONUSE: number; - SVG_MARKER_ORIENT_ANGLE: number; - SVG_MARKER_ORIENT_AUTO: number; - SVG_MARKER_ORIENT_UNKNOWN: number; + readonly SVG_MARKERUNITS_STROKEWIDTH: number; + readonly SVG_MARKERUNITS_UNKNOWN: number; + readonly SVG_MARKERUNITS_USERSPACEONUSE: number; + readonly SVG_MARKER_ORIENT_ANGLE: number; + readonly SVG_MARKER_ORIENT_AUTO: number; + readonly SVG_MARKER_ORIENT_UNKNOWN: number; } interface SVGMaskElement extends SVGElement, SVGStylable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired, SVGUnitTypes { - height: SVGAnimatedLength; - maskContentUnits: SVGAnimatedEnumeration; - maskUnits: SVGAnimatedEnumeration; - width: SVGAnimatedLength; - x: SVGAnimatedLength; - y: SVGAnimatedLength; + readonly height: SVGAnimatedLength; + readonly maskContentUnits: SVGAnimatedEnumeration; + readonly maskUnits: SVGAnimatedEnumeration; + readonly width: SVGAnimatedLength; + readonly x: SVGAnimatedLength; + readonly y: SVGAnimatedLength; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -14876,7 +16020,7 @@ declare var SVGNumber: { } interface SVGNumberList { - numberOfItems: number; + readonly numberOfItems: number; appendItem(newItem: SVGNumber): SVGNumber; clear(): void; getItem(index: number): SVGNumber; @@ -14923,53 +16067,53 @@ declare var SVGPathElement: { } interface SVGPathSeg { - pathSegType: number; - pathSegTypeAsLetter: string; - PATHSEG_ARC_ABS: number; - PATHSEG_ARC_REL: number; - PATHSEG_CLOSEPATH: number; - PATHSEG_CURVETO_CUBIC_ABS: number; - PATHSEG_CURVETO_CUBIC_REL: number; - PATHSEG_CURVETO_CUBIC_SMOOTH_ABS: number; - PATHSEG_CURVETO_CUBIC_SMOOTH_REL: number; - PATHSEG_CURVETO_QUADRATIC_ABS: number; - PATHSEG_CURVETO_QUADRATIC_REL: number; - PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS: number; - PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL: number; - PATHSEG_LINETO_ABS: number; - PATHSEG_LINETO_HORIZONTAL_ABS: number; - PATHSEG_LINETO_HORIZONTAL_REL: number; - PATHSEG_LINETO_REL: number; - PATHSEG_LINETO_VERTICAL_ABS: number; - PATHSEG_LINETO_VERTICAL_REL: number; - PATHSEG_MOVETO_ABS: number; - PATHSEG_MOVETO_REL: number; - PATHSEG_UNKNOWN: number; + readonly pathSegType: number; + readonly pathSegTypeAsLetter: string; + readonly PATHSEG_ARC_ABS: number; + readonly PATHSEG_ARC_REL: number; + readonly PATHSEG_CLOSEPATH: number; + readonly PATHSEG_CURVETO_CUBIC_ABS: number; + readonly PATHSEG_CURVETO_CUBIC_REL: number; + readonly PATHSEG_CURVETO_CUBIC_SMOOTH_ABS: number; + readonly PATHSEG_CURVETO_CUBIC_SMOOTH_REL: number; + readonly PATHSEG_CURVETO_QUADRATIC_ABS: number; + readonly PATHSEG_CURVETO_QUADRATIC_REL: number; + readonly PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS: number; + readonly PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL: number; + readonly PATHSEG_LINETO_ABS: number; + readonly PATHSEG_LINETO_HORIZONTAL_ABS: number; + readonly PATHSEG_LINETO_HORIZONTAL_REL: number; + readonly PATHSEG_LINETO_REL: number; + readonly PATHSEG_LINETO_VERTICAL_ABS: number; + readonly PATHSEG_LINETO_VERTICAL_REL: number; + readonly PATHSEG_MOVETO_ABS: number; + readonly PATHSEG_MOVETO_REL: number; + readonly PATHSEG_UNKNOWN: number; } declare var SVGPathSeg: { prototype: SVGPathSeg; new(): SVGPathSeg; - PATHSEG_ARC_ABS: number; - PATHSEG_ARC_REL: number; - PATHSEG_CLOSEPATH: number; - PATHSEG_CURVETO_CUBIC_ABS: number; - PATHSEG_CURVETO_CUBIC_REL: number; - PATHSEG_CURVETO_CUBIC_SMOOTH_ABS: number; - PATHSEG_CURVETO_CUBIC_SMOOTH_REL: number; - PATHSEG_CURVETO_QUADRATIC_ABS: number; - PATHSEG_CURVETO_QUADRATIC_REL: number; - PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS: number; - PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL: number; - PATHSEG_LINETO_ABS: number; - PATHSEG_LINETO_HORIZONTAL_ABS: number; - PATHSEG_LINETO_HORIZONTAL_REL: number; - PATHSEG_LINETO_REL: number; - PATHSEG_LINETO_VERTICAL_ABS: number; - PATHSEG_LINETO_VERTICAL_REL: number; - PATHSEG_MOVETO_ABS: number; - PATHSEG_MOVETO_REL: number; - PATHSEG_UNKNOWN: number; + readonly PATHSEG_ARC_ABS: number; + readonly PATHSEG_ARC_REL: number; + readonly PATHSEG_CLOSEPATH: number; + readonly PATHSEG_CURVETO_CUBIC_ABS: number; + readonly PATHSEG_CURVETO_CUBIC_REL: number; + readonly PATHSEG_CURVETO_CUBIC_SMOOTH_ABS: number; + readonly PATHSEG_CURVETO_CUBIC_SMOOTH_REL: number; + readonly PATHSEG_CURVETO_QUADRATIC_ABS: number; + readonly PATHSEG_CURVETO_QUADRATIC_REL: number; + readonly PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS: number; + readonly PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL: number; + readonly PATHSEG_LINETO_ABS: number; + readonly PATHSEG_LINETO_HORIZONTAL_ABS: number; + readonly PATHSEG_LINETO_HORIZONTAL_REL: number; + readonly PATHSEG_LINETO_REL: number; + readonly PATHSEG_LINETO_VERTICAL_ABS: number; + readonly PATHSEG_LINETO_VERTICAL_REL: number; + readonly PATHSEG_MOVETO_ABS: number; + readonly PATHSEG_MOVETO_REL: number; + readonly PATHSEG_UNKNOWN: number; } interface SVGPathSegArcAbs extends SVGPathSeg { @@ -15163,7 +16307,7 @@ declare var SVGPathSegLinetoVerticalRel: { } interface SVGPathSegList { - numberOfItems: number; + readonly numberOfItems: number; appendItem(newItem: SVGPathSeg): SVGPathSeg; clear(): void; getItem(index: number): SVGPathSeg; @@ -15199,13 +16343,13 @@ declare var SVGPathSegMovetoRel: { } interface SVGPatternElement extends SVGElement, SVGStylable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired, SVGFitToViewBox, SVGURIReference, SVGUnitTypes { - height: SVGAnimatedLength; - patternContentUnits: SVGAnimatedEnumeration; - patternTransform: SVGAnimatedTransformList; - patternUnits: SVGAnimatedEnumeration; - width: SVGAnimatedLength; - x: SVGAnimatedLength; - y: SVGAnimatedLength; + readonly height: SVGAnimatedLength; + readonly patternContentUnits: SVGAnimatedEnumeration; + readonly patternTransform: SVGAnimatedTransformList; + readonly patternUnits: SVGAnimatedEnumeration; + readonly width: SVGAnimatedLength; + readonly x: SVGAnimatedLength; + readonly y: SVGAnimatedLength; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -15226,7 +16370,7 @@ declare var SVGPoint: { } interface SVGPointList { - numberOfItems: number; + readonly numberOfItems: number; appendItem(newItem: SVGPoint): SVGPoint; clear(): void; getItem(index: number): SVGPoint; @@ -15262,47 +16406,47 @@ declare var SVGPolylineElement: { interface SVGPreserveAspectRatio { align: number; meetOrSlice: number; - SVG_MEETORSLICE_MEET: number; - SVG_MEETORSLICE_SLICE: number; - SVG_MEETORSLICE_UNKNOWN: number; - SVG_PRESERVEASPECTRATIO_NONE: number; - SVG_PRESERVEASPECTRATIO_UNKNOWN: number; - SVG_PRESERVEASPECTRATIO_XMAXYMAX: number; - SVG_PRESERVEASPECTRATIO_XMAXYMID: number; - SVG_PRESERVEASPECTRATIO_XMAXYMIN: number; - SVG_PRESERVEASPECTRATIO_XMIDYMAX: number; - SVG_PRESERVEASPECTRATIO_XMIDYMID: number; - SVG_PRESERVEASPECTRATIO_XMIDYMIN: number; - SVG_PRESERVEASPECTRATIO_XMINYMAX: number; - SVG_PRESERVEASPECTRATIO_XMINYMID: number; - SVG_PRESERVEASPECTRATIO_XMINYMIN: number; + readonly SVG_MEETORSLICE_MEET: number; + readonly SVG_MEETORSLICE_SLICE: number; + readonly SVG_MEETORSLICE_UNKNOWN: number; + readonly SVG_PRESERVEASPECTRATIO_NONE: number; + readonly SVG_PRESERVEASPECTRATIO_UNKNOWN: number; + readonly SVG_PRESERVEASPECTRATIO_XMAXYMAX: number; + readonly SVG_PRESERVEASPECTRATIO_XMAXYMID: number; + readonly SVG_PRESERVEASPECTRATIO_XMAXYMIN: number; + readonly SVG_PRESERVEASPECTRATIO_XMIDYMAX: number; + readonly SVG_PRESERVEASPECTRATIO_XMIDYMID: number; + readonly SVG_PRESERVEASPECTRATIO_XMIDYMIN: number; + readonly SVG_PRESERVEASPECTRATIO_XMINYMAX: number; + readonly SVG_PRESERVEASPECTRATIO_XMINYMID: number; + readonly SVG_PRESERVEASPECTRATIO_XMINYMIN: number; } declare var SVGPreserveAspectRatio: { prototype: SVGPreserveAspectRatio; new(): SVGPreserveAspectRatio; - SVG_MEETORSLICE_MEET: number; - SVG_MEETORSLICE_SLICE: number; - SVG_MEETORSLICE_UNKNOWN: number; - SVG_PRESERVEASPECTRATIO_NONE: number; - SVG_PRESERVEASPECTRATIO_UNKNOWN: number; - SVG_PRESERVEASPECTRATIO_XMAXYMAX: number; - SVG_PRESERVEASPECTRATIO_XMAXYMID: number; - SVG_PRESERVEASPECTRATIO_XMAXYMIN: number; - SVG_PRESERVEASPECTRATIO_XMIDYMAX: number; - SVG_PRESERVEASPECTRATIO_XMIDYMID: number; - SVG_PRESERVEASPECTRATIO_XMIDYMIN: number; - SVG_PRESERVEASPECTRATIO_XMINYMAX: number; - SVG_PRESERVEASPECTRATIO_XMINYMID: number; - SVG_PRESERVEASPECTRATIO_XMINYMIN: number; + readonly SVG_MEETORSLICE_MEET: number; + readonly SVG_MEETORSLICE_SLICE: number; + readonly SVG_MEETORSLICE_UNKNOWN: number; + readonly SVG_PRESERVEASPECTRATIO_NONE: number; + readonly SVG_PRESERVEASPECTRATIO_UNKNOWN: number; + readonly SVG_PRESERVEASPECTRATIO_XMAXYMAX: number; + readonly SVG_PRESERVEASPECTRATIO_XMAXYMID: number; + readonly SVG_PRESERVEASPECTRATIO_XMAXYMIN: number; + readonly SVG_PRESERVEASPECTRATIO_XMIDYMAX: number; + readonly SVG_PRESERVEASPECTRATIO_XMIDYMID: number; + readonly SVG_PRESERVEASPECTRATIO_XMIDYMIN: number; + readonly SVG_PRESERVEASPECTRATIO_XMINYMAX: number; + readonly SVG_PRESERVEASPECTRATIO_XMINYMID: number; + readonly SVG_PRESERVEASPECTRATIO_XMINYMIN: number; } interface SVGRadialGradientElement extends SVGGradientElement { - cx: SVGAnimatedLength; - cy: SVGAnimatedLength; - fx: SVGAnimatedLength; - fy: SVGAnimatedLength; - r: SVGAnimatedLength; + readonly cx: SVGAnimatedLength; + readonly cy: SVGAnimatedLength; + readonly fx: SVGAnimatedLength; + readonly fy: SVGAnimatedLength; + readonly r: SVGAnimatedLength; } declare var SVGRadialGradientElement: { @@ -15323,12 +16467,12 @@ declare var SVGRect: { } interface SVGRectElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired { - height: SVGAnimatedLength; - rx: SVGAnimatedLength; - ry: SVGAnimatedLength; - width: SVGAnimatedLength; - x: SVGAnimatedLength; - y: SVGAnimatedLength; + readonly height: SVGAnimatedLength; + readonly rx: SVGAnimatedLength; + readonly ry: SVGAnimatedLength; + readonly width: SVGAnimatedLength; + readonly x: SVGAnimatedLength; + readonly y: SVGAnimatedLength; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -15341,22 +16485,22 @@ interface SVGSVGElement extends SVGElement, DocumentEvent, SVGLocatable, SVGTest contentScriptType: string; contentStyleType: string; currentScale: number; - currentTranslate: SVGPoint; - height: SVGAnimatedLength; + readonly currentTranslate: SVGPoint; + readonly height: SVGAnimatedLength; onabort: (ev: Event) => any; onerror: (ev: Event) => any; onresize: (ev: UIEvent) => any; onscroll: (ev: UIEvent) => any; onunload: (ev: Event) => any; onzoom: (ev: SVGZoomEvent) => any; - pixelUnitToMillimeterX: number; - pixelUnitToMillimeterY: number; - screenPixelToMillimeterX: number; - screenPixelToMillimeterY: number; - viewport: SVGRect; - width: SVGAnimatedLength; - x: SVGAnimatedLength; - y: SVGAnimatedLength; + readonly pixelUnitToMillimeterX: number; + readonly pixelUnitToMillimeterY: number; + readonly screenPixelToMillimeterX: number; + readonly screenPixelToMillimeterY: number; + readonly viewport: SVGRect; + readonly width: SVGAnimatedLength; + readonly x: SVGAnimatedLength; + readonly y: SVGAnimatedLength; checkEnclosure(element: SVGElement, rect: SVGRect): boolean; checkIntersection(element: SVGElement, rect: SVGRect): boolean; createSVGAngle(): SVGAngle; @@ -15372,8 +16516,8 @@ interface SVGSVGElement extends SVGElement, DocumentEvent, SVGLocatable, SVGTest getComputedStyle(elt: Element, pseudoElt?: string): CSSStyleDeclaration; getCurrentTime(): number; getElementById(elementId: string): Element; - getEnclosureList(rect: SVGRect, referenceElement: SVGElement): NodeList; - getIntersectionList(rect: SVGRect, referenceElement: SVGElement): NodeList; + getEnclosureList(rect: SVGRect, referenceElement: SVGElement): NodeListOf; + getIntersectionList(rect: SVGRect, referenceElement: SVGElement): NodeListOf; pauseAnimations(): void; setCurrentTime(seconds: number): void; suspendRedraw(maxWaitMilliseconds: number): number; @@ -15451,7 +16595,7 @@ declare var SVGScriptElement: { } interface SVGStopElement extends SVGElement, SVGStylable { - offset: SVGAnimatedNumber; + readonly offset: SVGAnimatedNumber; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -15461,7 +16605,7 @@ declare var SVGStopElement: { } interface SVGStringList { - numberOfItems: number; + readonly numberOfItems: number; appendItem(newItem: string): string; clear(): void; getItem(index: number): string; @@ -15477,6 +16621,7 @@ declare var SVGStringList: { } interface SVGStyleElement extends SVGElement, SVGLangSpace { + disabled: boolean; media: string; title: string; type: string; @@ -15515,8 +16660,8 @@ declare var SVGTSpanElement: { } interface SVGTextContentElement extends SVGElement, SVGStylable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired { - lengthAdjust: SVGAnimatedEnumeration; - textLength: SVGAnimatedLength; + readonly lengthAdjust: SVGAnimatedEnumeration; + readonly textLength: SVGAnimatedLength; getCharNumAtPosition(point: SVGPoint): number; getComputedTextLength(): number; getEndPositionOfChar(charnum: number): SVGPoint; @@ -15526,18 +16671,18 @@ interface SVGTextContentElement extends SVGElement, SVGStylable, SVGTests, SVGLa getStartPositionOfChar(charnum: number): SVGPoint; getSubStringLength(charnum: number, nchars: number): number; selectSubString(charnum: number, nchars: number): void; - LENGTHADJUST_SPACING: number; - LENGTHADJUST_SPACINGANDGLYPHS: number; - LENGTHADJUST_UNKNOWN: number; + readonly LENGTHADJUST_SPACING: number; + readonly LENGTHADJUST_SPACINGANDGLYPHS: number; + readonly LENGTHADJUST_UNKNOWN: number; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var SVGTextContentElement: { prototype: SVGTextContentElement; new(): SVGTextContentElement; - LENGTHADJUST_SPACING: number; - LENGTHADJUST_SPACINGANDGLYPHS: number; - LENGTHADJUST_UNKNOWN: number; + readonly LENGTHADJUST_SPACING: number; + readonly LENGTHADJUST_SPACINGANDGLYPHS: number; + readonly LENGTHADJUST_UNKNOWN: number; } interface SVGTextElement extends SVGTextPositioningElement, SVGTransformable { @@ -15550,35 +16695,35 @@ declare var SVGTextElement: { } interface SVGTextPathElement extends SVGTextContentElement, SVGURIReference { - method: SVGAnimatedEnumeration; - spacing: SVGAnimatedEnumeration; - startOffset: SVGAnimatedLength; - TEXTPATH_METHODTYPE_ALIGN: number; - TEXTPATH_METHODTYPE_STRETCH: number; - TEXTPATH_METHODTYPE_UNKNOWN: number; - TEXTPATH_SPACINGTYPE_AUTO: number; - TEXTPATH_SPACINGTYPE_EXACT: number; - TEXTPATH_SPACINGTYPE_UNKNOWN: number; + readonly method: SVGAnimatedEnumeration; + readonly spacing: SVGAnimatedEnumeration; + readonly startOffset: SVGAnimatedLength; + readonly TEXTPATH_METHODTYPE_ALIGN: number; + readonly TEXTPATH_METHODTYPE_STRETCH: number; + readonly TEXTPATH_METHODTYPE_UNKNOWN: number; + readonly TEXTPATH_SPACINGTYPE_AUTO: number; + readonly TEXTPATH_SPACINGTYPE_EXACT: number; + readonly TEXTPATH_SPACINGTYPE_UNKNOWN: number; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var SVGTextPathElement: { prototype: SVGTextPathElement; new(): SVGTextPathElement; - TEXTPATH_METHODTYPE_ALIGN: number; - TEXTPATH_METHODTYPE_STRETCH: number; - TEXTPATH_METHODTYPE_UNKNOWN: number; - TEXTPATH_SPACINGTYPE_AUTO: number; - TEXTPATH_SPACINGTYPE_EXACT: number; - TEXTPATH_SPACINGTYPE_UNKNOWN: number; + readonly TEXTPATH_METHODTYPE_ALIGN: number; + readonly TEXTPATH_METHODTYPE_STRETCH: number; + readonly TEXTPATH_METHODTYPE_UNKNOWN: number; + readonly TEXTPATH_SPACINGTYPE_AUTO: number; + readonly TEXTPATH_SPACINGTYPE_EXACT: number; + readonly TEXTPATH_SPACINGTYPE_UNKNOWN: number; } interface SVGTextPositioningElement extends SVGTextContentElement { - dx: SVGAnimatedLengthList; - dy: SVGAnimatedLengthList; - rotate: SVGAnimatedNumberList; - x: SVGAnimatedLengthList; - y: SVGAnimatedLengthList; + readonly dx: SVGAnimatedLengthList; + readonly dy: SVGAnimatedLengthList; + readonly rotate: SVGAnimatedNumberList; + readonly x: SVGAnimatedLengthList; + readonly y: SVGAnimatedLengthList; } declare var SVGTextPositioningElement: { @@ -15596,38 +16741,38 @@ declare var SVGTitleElement: { } interface SVGTransform { - angle: number; - matrix: SVGMatrix; - type: number; + readonly angle: number; + readonly matrix: SVGMatrix; + readonly type: number; setMatrix(matrix: SVGMatrix): void; setRotate(angle: number, cx: number, cy: number): void; setScale(sx: number, sy: number): void; setSkewX(angle: number): void; setSkewY(angle: number): void; setTranslate(tx: number, ty: number): void; - SVG_TRANSFORM_MATRIX: number; - SVG_TRANSFORM_ROTATE: number; - SVG_TRANSFORM_SCALE: number; - SVG_TRANSFORM_SKEWX: number; - SVG_TRANSFORM_SKEWY: number; - SVG_TRANSFORM_TRANSLATE: number; - SVG_TRANSFORM_UNKNOWN: number; + readonly SVG_TRANSFORM_MATRIX: number; + readonly SVG_TRANSFORM_ROTATE: number; + readonly SVG_TRANSFORM_SCALE: number; + readonly SVG_TRANSFORM_SKEWX: number; + readonly SVG_TRANSFORM_SKEWY: number; + readonly SVG_TRANSFORM_TRANSLATE: number; + readonly SVG_TRANSFORM_UNKNOWN: number; } declare var SVGTransform: { prototype: SVGTransform; new(): SVGTransform; - SVG_TRANSFORM_MATRIX: number; - SVG_TRANSFORM_ROTATE: number; - SVG_TRANSFORM_SCALE: number; - SVG_TRANSFORM_SKEWX: number; - SVG_TRANSFORM_SKEWY: number; - SVG_TRANSFORM_TRANSLATE: number; - SVG_TRANSFORM_UNKNOWN: number; + readonly SVG_TRANSFORM_MATRIX: number; + readonly SVG_TRANSFORM_ROTATE: number; + readonly SVG_TRANSFORM_SCALE: number; + readonly SVG_TRANSFORM_SKEWX: number; + readonly SVG_TRANSFORM_SKEWY: number; + readonly SVG_TRANSFORM_TRANSLATE: number; + readonly SVG_TRANSFORM_UNKNOWN: number; } interface SVGTransformList { - numberOfItems: number; + readonly numberOfItems: number; appendItem(newItem: SVGTransform): SVGTransform; clear(): void; consolidate(): SVGTransform; @@ -15645,19 +16790,19 @@ declare var SVGTransformList: { } interface SVGUnitTypes { - SVG_UNIT_TYPE_OBJECTBOUNDINGBOX: number; - SVG_UNIT_TYPE_UNKNOWN: number; - SVG_UNIT_TYPE_USERSPACEONUSE: number; + readonly SVG_UNIT_TYPE_OBJECTBOUNDINGBOX: number; + readonly SVG_UNIT_TYPE_UNKNOWN: number; + readonly SVG_UNIT_TYPE_USERSPACEONUSE: number; } declare var SVGUnitTypes: SVGUnitTypes; interface SVGUseElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired, SVGURIReference { - animatedInstanceRoot: SVGElementInstance; - height: SVGAnimatedLength; - instanceRoot: SVGElementInstance; - width: SVGAnimatedLength; - x: SVGAnimatedLength; - y: SVGAnimatedLength; + readonly animatedInstanceRoot: SVGElementInstance; + readonly height: SVGAnimatedLength; + readonly instanceRoot: SVGElementInstance; + readonly width: SVGAnimatedLength; + readonly x: SVGAnimatedLength; + readonly y: SVGAnimatedLength; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -15667,7 +16812,7 @@ declare var SVGUseElement: { } interface SVGViewElement extends SVGElement, SVGExternalResourcesRequired, SVGFitToViewBox, SVGZoomAndPan { - viewTarget: SVGStringList; + readonly viewTarget: SVGStringList; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -15677,21 +16822,21 @@ declare var SVGViewElement: { } interface SVGZoomAndPan { - zoomAndPan: number; + readonly zoomAndPan: number; } declare var SVGZoomAndPan: { - SVG_ZOOMANDPAN_DISABLE: number; - SVG_ZOOMANDPAN_MAGNIFY: number; - SVG_ZOOMANDPAN_UNKNOWN: number; + readonly SVG_ZOOMANDPAN_DISABLE: number; + readonly SVG_ZOOMANDPAN_MAGNIFY: number; + readonly SVG_ZOOMANDPAN_UNKNOWN: number; } interface SVGZoomEvent extends UIEvent { - newScale: number; - newTranslate: SVGPoint; - previousScale: number; - previousTranslate: SVGPoint; - zoomRectScreen: SVGRect; + readonly newScale: number; + readonly newTranslate: SVGPoint; + readonly previousScale: number; + readonly previousTranslate: SVGPoint; + readonly zoomRectScreen: SVGRect; } declare var SVGZoomEvent: { @@ -15700,22 +16845,22 @@ declare var SVGZoomEvent: { } interface Screen extends EventTarget { - availHeight: number; - availWidth: number; + readonly availHeight: number; + readonly availWidth: number; bufferDepth: number; - colorDepth: number; - deviceXDPI: number; - deviceYDPI: number; - fontSmoothingEnabled: boolean; - height: number; - logicalXDPI: number; - logicalYDPI: number; - msOrientation: string; + readonly colorDepth: number; + readonly deviceXDPI: number; + readonly deviceYDPI: number; + readonly fontSmoothingEnabled: boolean; + readonly height: number; + readonly logicalXDPI: number; + readonly logicalYDPI: number; + readonly msOrientation: string; onmsorientationchange: (ev: Event) => any; - pixelDepth: number; - systemXDPI: number; - systemYDPI: number; - width: number; + readonly pixelDepth: number; + readonly systemXDPI: number; + readonly systemYDPI: number; + readonly width: number; msLockOrientation(orientations: string | string[]): boolean; msUnlockOrientation(): void; addEventListener(type: "MSOrientationChange", listener: (ev: Event) => any, useCapture?: boolean): void; @@ -15728,8 +16873,8 @@ declare var Screen: { } interface ScriptNotifyEvent extends Event { - callingUri: string; - value: string; + readonly callingUri: string; + readonly value: string; } declare var ScriptNotifyEvent: { @@ -15738,7 +16883,7 @@ declare var ScriptNotifyEvent: { } interface ScriptProcessorNode extends AudioNode { - bufferSize: number; + readonly bufferSize: number; onaudioprocess: (ev: AudioProcessingEvent) => any; addEventListener(type: "audioprocess", listener: (ev: AudioProcessingEvent) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; @@ -15750,13 +16895,13 @@ declare var ScriptProcessorNode: { } interface Selection { - anchorNode: Node; - anchorOffset: number; - focusNode: Node; - focusOffset: number; - isCollapsed: boolean; - rangeCount: number; - type: string; + readonly anchorNode: Node; + readonly anchorOffset: number; + readonly focusNode: Node; + readonly focusOffset: number; + readonly isCollapsed: boolean; + readonly rangeCount: number; + readonly type: string; addRange(range: Range): void; collapse(parentNode: Node, offset: number): void; collapseToEnd(): void; @@ -15781,12 +16926,12 @@ declare var Selection: { interface SourceBuffer extends EventTarget { appendWindowEnd: number; appendWindowStart: number; - audioTracks: AudioTrackList; - buffered: TimeRanges; + readonly audioTracks: AudioTrackList; + readonly buffered: TimeRanges; mode: string; timestampOffset: number; - updating: boolean; - videoTracks: VideoTrackList; + readonly updating: boolean; + readonly videoTracks: VideoTrackList; abort(): void; appendBuffer(data: ArrayBuffer | ArrayBufferView): void; appendStream(stream: MSStream, maxSize?: number): void; @@ -15799,7 +16944,7 @@ declare var SourceBuffer: { } interface SourceBufferList extends EventTarget { - length: number; + readonly length: number; item(index: number): SourceBuffer; [index: number]: SourceBuffer; } @@ -15810,7 +16955,7 @@ declare var SourceBufferList: { } interface StereoPannerNode extends AudioNode { - pan: AudioParam; + readonly pan: AudioParam; } declare var StereoPannerNode: { @@ -15819,9 +16964,9 @@ declare var StereoPannerNode: { } interface Storage { - length: number; + readonly length: number; clear(): void; - getItem(key: string): any; + getItem(key: string): string; key(index: number): string; removeItem(key: string): void; setItem(key: string, data: string): void; @@ -15835,7 +16980,7 @@ declare var Storage: { } interface StorageEvent extends Event { - url: string; + readonly url: string; key?: string; oldValue?: string; newValue?: string; @@ -15848,7 +16993,7 @@ declare var StorageEvent: { } interface StyleMedia { - type: string; + readonly type: string; matchMedium(mediaquery: string): boolean; } @@ -15859,12 +17004,12 @@ declare var StyleMedia: { interface StyleSheet { disabled: boolean; - href: string; - media: MediaList; - ownerNode: Node; - parentStyleSheet: StyleSheet; - title: string; - type: string; + readonly href: string; + readonly media: MediaList; + readonly ownerNode: Node; + readonly parentStyleSheet: StyleSheet; + readonly title: string; + readonly type: string; } declare var StyleSheet: { @@ -15873,7 +17018,7 @@ declare var StyleSheet: { } interface StyleSheetList { - length: number; + readonly length: number; item(index?: number): StyleSheet; [index: number]: StyleSheet; } @@ -15884,7 +17029,7 @@ declare var StyleSheetList: { } interface StyleSheetPageList { - length: number; + readonly length: number; item(index: number): CSSPageRule; [index: number]: CSSPageRule; } @@ -15895,18 +17040,18 @@ declare var StyleSheetPageList: { } interface SubtleCrypto { - decrypt(algorithm: string | Algorithm, key: CryptoKey, data: ArrayBufferView): any; - deriveBits(algorithm: string | Algorithm, baseKey: CryptoKey, length: number): any; - deriveKey(algorithm: string | Algorithm, baseKey: CryptoKey, derivedKeyType: string | Algorithm, extractable: boolean, keyUsages: string[]): any; - digest(algorithm: string | Algorithm, data: ArrayBufferView): any; - encrypt(algorithm: string | Algorithm, key: CryptoKey, data: ArrayBufferView): any; - exportKey(format: string, key: CryptoKey): any; - generateKey(algorithm: string | Algorithm, extractable: boolean, keyUsages: string[]): any; - importKey(format: string, keyData: ArrayBufferView, algorithm: string | Algorithm, extractable: boolean, keyUsages: string[]): any; - sign(algorithm: string | Algorithm, key: CryptoKey, data: ArrayBufferView): any; - unwrapKey(format: string, wrappedKey: ArrayBufferView, unwrappingKey: CryptoKey, unwrapAlgorithm: string | Algorithm, unwrappedKeyAlgorithm: string | Algorithm, extractable: boolean, keyUsages: string[]): any; - verify(algorithm: string | Algorithm, key: CryptoKey, signature: ArrayBufferView, data: ArrayBufferView): any; - wrapKey(format: string, key: CryptoKey, wrappingKey: CryptoKey, wrapAlgorithm: string | Algorithm): any; + decrypt(algorithm: string | Algorithm, key: CryptoKey, data: ArrayBufferView): PromiseLike; + deriveBits(algorithm: string | Algorithm, baseKey: CryptoKey, length: number): PromiseLike; + deriveKey(algorithm: string | Algorithm, baseKey: CryptoKey, derivedKeyType: string | Algorithm, extractable: boolean, keyUsages: string[]): PromiseLike; + digest(algorithm: string | Algorithm, data: ArrayBufferView): PromiseLike; + encrypt(algorithm: string | Algorithm, key: CryptoKey, data: ArrayBufferView): PromiseLike; + exportKey(format: string, key: CryptoKey): PromiseLike; + generateKey(algorithm: string | Algorithm, extractable: boolean, keyUsages: string[]): PromiseLike; + importKey(format: string, keyData: ArrayBufferView, algorithm: string | Algorithm, extractable: boolean, keyUsages: string[]): PromiseLike; + sign(algorithm: string | Algorithm, key: CryptoKey, data: ArrayBufferView): PromiseLike; + unwrapKey(format: string, wrappedKey: ArrayBufferView, unwrappingKey: CryptoKey, unwrapAlgorithm: string | Algorithm, unwrappedKeyAlgorithm: string | Algorithm, extractable: boolean, keyUsages: string[]): PromiseLike; + verify(algorithm: string | Algorithm, key: CryptoKey, signature: ArrayBufferView, data: ArrayBufferView): PromiseLike; + wrapKey(format: string, key: CryptoKey, wrappingKey: CryptoKey, wrapAlgorithm: string | Algorithm): PromiseLike; } declare var SubtleCrypto: { @@ -15915,8 +17060,7 @@ declare var SubtleCrypto: { } interface Text extends CharacterData { - wholeText: string; - replaceWholeText(content: string): Text; + readonly wholeText: string; splitText(offset: number): Text; } @@ -15926,39 +17070,39 @@ declare var Text: { } interface TextEvent extends UIEvent { - data: string; - inputMethod: number; - locale: string; + readonly data: string; + readonly inputMethod: number; + readonly locale: string; initTextEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, dataArg: string, inputMethod: number, locale: string): void; - DOM_INPUT_METHOD_DROP: number; - DOM_INPUT_METHOD_HANDWRITING: number; - DOM_INPUT_METHOD_IME: number; - DOM_INPUT_METHOD_KEYBOARD: number; - DOM_INPUT_METHOD_MULTIMODAL: number; - DOM_INPUT_METHOD_OPTION: number; - DOM_INPUT_METHOD_PASTE: number; - DOM_INPUT_METHOD_SCRIPT: number; - DOM_INPUT_METHOD_UNKNOWN: number; - DOM_INPUT_METHOD_VOICE: number; + readonly DOM_INPUT_METHOD_DROP: number; + readonly DOM_INPUT_METHOD_HANDWRITING: number; + readonly DOM_INPUT_METHOD_IME: number; + readonly DOM_INPUT_METHOD_KEYBOARD: number; + readonly DOM_INPUT_METHOD_MULTIMODAL: number; + readonly DOM_INPUT_METHOD_OPTION: number; + readonly DOM_INPUT_METHOD_PASTE: number; + readonly DOM_INPUT_METHOD_SCRIPT: number; + readonly DOM_INPUT_METHOD_UNKNOWN: number; + readonly DOM_INPUT_METHOD_VOICE: number; } declare var TextEvent: { prototype: TextEvent; new(): TextEvent; - DOM_INPUT_METHOD_DROP: number; - DOM_INPUT_METHOD_HANDWRITING: number; - DOM_INPUT_METHOD_IME: number; - DOM_INPUT_METHOD_KEYBOARD: number; - DOM_INPUT_METHOD_MULTIMODAL: number; - DOM_INPUT_METHOD_OPTION: number; - DOM_INPUT_METHOD_PASTE: number; - DOM_INPUT_METHOD_SCRIPT: number; - DOM_INPUT_METHOD_UNKNOWN: number; - DOM_INPUT_METHOD_VOICE: number; + readonly DOM_INPUT_METHOD_DROP: number; + readonly DOM_INPUT_METHOD_HANDWRITING: number; + readonly DOM_INPUT_METHOD_IME: number; + readonly DOM_INPUT_METHOD_KEYBOARD: number; + readonly DOM_INPUT_METHOD_MULTIMODAL: number; + readonly DOM_INPUT_METHOD_OPTION: number; + readonly DOM_INPUT_METHOD_PASTE: number; + readonly DOM_INPUT_METHOD_SCRIPT: number; + readonly DOM_INPUT_METHOD_UNKNOWN: number; + readonly DOM_INPUT_METHOD_VOICE: number; } interface TextMetrics { - width: number; + readonly width: number; } declare var TextMetrics: { @@ -15966,83 +17110,27 @@ declare var TextMetrics: { new(): TextMetrics; } -interface TextRange { - boundingHeight: number; - boundingLeft: number; - boundingTop: number; - boundingWidth: number; - htmlText: string; - offsetLeft: number; - offsetTop: number; - text: string; - collapse(start?: boolean): void; - compareEndPoints(how: string, sourceRange: TextRange): number; - duplicate(): TextRange; - execCommand(cmdID: string, showUI?: boolean, value?: any): boolean; - execCommandShowHelp(cmdID: string): boolean; - expand(Unit: string): boolean; - findText(string: string, count?: number, flags?: number): boolean; - getBookmark(): string; - getBoundingClientRect(): ClientRect; - getClientRects(): ClientRectList; - inRange(range: TextRange): boolean; - isEqual(range: TextRange): boolean; - move(unit: string, count?: number): number; - moveEnd(unit: string, count?: number): number; - moveStart(unit: string, count?: number): number; - moveToBookmark(bookmark: string): boolean; - moveToElementText(element: Element): void; - moveToPoint(x: number, y: number): void; - parentElement(): Element; - pasteHTML(html: string): void; - queryCommandEnabled(cmdID: string): boolean; - queryCommandIndeterm(cmdID: string): boolean; - queryCommandState(cmdID: string): boolean; - queryCommandSupported(cmdID: string): boolean; - queryCommandText(cmdID: string): string; - queryCommandValue(cmdID: string): any; - scrollIntoView(fStart?: boolean): void; - select(): void; - setEndPoint(how: string, SourceRange: TextRange): void; -} - -declare var TextRange: { - prototype: TextRange; - new(): TextRange; -} - -interface TextRangeCollection { - length: number; - item(index: number): TextRange; - [index: number]: TextRange; -} - -declare var TextRangeCollection: { - prototype: TextRangeCollection; - new(): TextRangeCollection; -} - interface TextTrack extends EventTarget { - activeCues: TextTrackCueList; - cues: TextTrackCueList; - inBandMetadataTrackDispatchType: string; - kind: string; - label: string; - language: string; + readonly activeCues: TextTrackCueList; + readonly cues: TextTrackCueList; + readonly inBandMetadataTrackDispatchType: string; + readonly kind: string; + readonly label: string; + readonly language: string; mode: any; oncuechange: (ev: Event) => any; onerror: (ev: Event) => any; onload: (ev: Event) => any; - readyState: number; + readonly readyState: number; addCue(cue: TextTrackCue): void; removeCue(cue: TextTrackCue): void; - DISABLED: number; - ERROR: number; - HIDDEN: number; - LOADED: number; - LOADING: number; - NONE: number; - SHOWING: number; + readonly DISABLED: number; + readonly ERROR: number; + readonly HIDDEN: number; + readonly LOADED: number; + readonly LOADING: number; + readonly NONE: number; + readonly SHOWING: number; addEventListener(type: "cuechange", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: "load", listener: (ev: Event) => any, useCapture?: boolean): void; @@ -16052,13 +17140,13 @@ interface TextTrack extends EventTarget { declare var TextTrack: { prototype: TextTrack; new(): TextTrack; - DISABLED: number; - ERROR: number; - HIDDEN: number; - LOADED: number; - LOADING: number; - NONE: number; - SHOWING: number; + readonly DISABLED: number; + readonly ERROR: number; + readonly HIDDEN: number; + readonly LOADED: number; + readonly LOADING: number; + readonly NONE: number; + readonly SHOWING: number; } interface TextTrackCue extends EventTarget { @@ -16069,7 +17157,7 @@ interface TextTrackCue extends EventTarget { pauseOnExit: boolean; startTime: number; text: string; - track: TextTrack; + readonly track: TextTrack; getCueAsHTML(): DocumentFragment; addEventListener(type: "enter", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "exit", listener: (ev: Event) => any, useCapture?: boolean): void; @@ -16082,7 +17170,7 @@ declare var TextTrackCue: { } interface TextTrackCueList { - length: number; + readonly length: number; getCueById(id: string): TextTrackCue; item(index: number): TextTrackCue; [index: number]: TextTrackCue; @@ -16094,7 +17182,7 @@ declare var TextTrackCueList: { } interface TextTrackList extends EventTarget { - length: number; + readonly length: number; onaddtrack: (ev: TrackEvent) => any; item(index: number): TextTrack; addEventListener(type: "addtrack", listener: (ev: TrackEvent) => any, useCapture?: boolean): void; @@ -16108,7 +17196,7 @@ declare var TextTrackList: { } interface TimeRanges { - length: number; + readonly length: number; end(index: number): number; start(index: number): number; } @@ -16119,14 +17207,14 @@ declare var TimeRanges: { } interface Touch { - clientX: number; - clientY: number; - identifier: number; - pageX: number; - pageY: number; - screenX: number; - screenY: number; - target: EventTarget; + readonly clientX: number; + readonly clientY: number; + readonly identifier: number; + readonly pageX: number; + readonly pageY: number; + readonly screenX: number; + readonly screenY: number; + readonly target: EventTarget; } declare var Touch: { @@ -16135,13 +17223,13 @@ declare var Touch: { } interface TouchEvent extends UIEvent { - altKey: boolean; - changedTouches: TouchList; - ctrlKey: boolean; - metaKey: boolean; - shiftKey: boolean; - targetTouches: TouchList; - touches: TouchList; + readonly altKey: boolean; + readonly changedTouches: TouchList; + readonly ctrlKey: boolean; + readonly metaKey: boolean; + readonly shiftKey: boolean; + readonly targetTouches: TouchList; + readonly touches: TouchList; } declare var TouchEvent: { @@ -16150,7 +17238,7 @@ declare var TouchEvent: { } interface TouchList { - length: number; + readonly length: number; item(index: number): Touch; [index: number]: Touch; } @@ -16161,7 +17249,7 @@ declare var TouchList: { } interface TrackEvent extends Event { - track: any; + readonly track: any; } declare var TrackEvent: { @@ -16170,8 +17258,8 @@ declare var TrackEvent: { } interface TransitionEvent extends Event { - elapsedTime: number; - propertyName: string; + readonly elapsedTime: number; + readonly propertyName: string; initTransitionEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, propertyNameArg: string, elapsedTimeArg: number): void; } @@ -16182,10 +17270,10 @@ declare var TransitionEvent: { interface TreeWalker { currentNode: Node; - expandEntityReferences: boolean; - filter: NodeFilter; - root: Node; - whatToShow: number; + readonly expandEntityReferences: boolean; + readonly filter: NodeFilter; + readonly root: Node; + readonly whatToShow: number; firstChild(): Node; lastChild(): Node; nextNode(): Node; @@ -16201,8 +17289,8 @@ declare var TreeWalker: { } interface UIEvent extends Event { - detail: number; - view: Window; + readonly detail: number; + readonly view: Window; initUIEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number): void; } @@ -16212,13 +17300,29 @@ declare var UIEvent: { } interface URL { + hash: string; + host: string; + hostname: string; + href: string; + readonly origin: string; + password: string; + pathname: string; + port: string; + protocol: string; + search: string; + username: string; + toString(): string; +} + +declare var URL: { + prototype: URL; + new(url: string, base?: string): URL; createObjectURL(object: any, options?: ObjectURLOptions): string; revokeObjectURL(url: string): void; } -declare var URL: URL; interface UnviewableContentIdentifiedEvent extends NavigationEventWithReferrer { - mediaType: string; + readonly mediaType: string; } declare var UnviewableContentIdentifiedEvent: { @@ -16227,16 +17331,16 @@ declare var UnviewableContentIdentifiedEvent: { } interface ValidityState { - badInput: boolean; - customError: boolean; - patternMismatch: boolean; - rangeOverflow: boolean; - rangeUnderflow: boolean; - stepMismatch: boolean; - tooLong: boolean; - typeMismatch: boolean; - valid: boolean; - valueMissing: boolean; + readonly badInput: boolean; + readonly customError: boolean; + readonly patternMismatch: boolean; + readonly rangeOverflow: boolean; + readonly rangeUnderflow: boolean; + readonly stepMismatch: boolean; + readonly tooLong: boolean; + readonly typeMismatch: boolean; + readonly valid: boolean; + readonly valueMissing: boolean; } declare var ValidityState: { @@ -16245,11 +17349,11 @@ declare var ValidityState: { } interface VideoPlaybackQuality { - corruptedVideoFrames: number; - creationTime: number; - droppedVideoFrames: number; - totalFrameDelay: number; - totalVideoFrames: number; + readonly corruptedVideoFrames: number; + readonly creationTime: number; + readonly droppedVideoFrames: number; + readonly totalFrameDelay: number; + readonly totalVideoFrames: number; } declare var VideoPlaybackQuality: { @@ -16258,12 +17362,12 @@ declare var VideoPlaybackQuality: { } interface VideoTrack { - id: string; + readonly id: string; kind: string; - label: string; + readonly label: string; language: string; selected: boolean; - sourceBuffer: SourceBuffer; + readonly sourceBuffer: SourceBuffer; } declare var VideoTrack: { @@ -16272,11 +17376,11 @@ declare var VideoTrack: { } interface VideoTrackList extends EventTarget { - length: number; + readonly length: number; onaddtrack: (ev: TrackEvent) => any; onchange: (ev: Event) => any; onremovetrack: (ev: TrackEvent) => any; - selectedIndex: number; + readonly selectedIndex: number; getTrackById(id: string): VideoTrack; item(index: number): VideoTrack; addEventListener(type: "addtrack", listener: (ev: TrackEvent) => any, useCapture?: boolean): void; @@ -16292,41 +17396,41 @@ declare var VideoTrackList: { } interface WEBGL_compressed_texture_s3tc { - COMPRESSED_RGBA_S3TC_DXT1_EXT: number; - COMPRESSED_RGBA_S3TC_DXT3_EXT: number; - COMPRESSED_RGBA_S3TC_DXT5_EXT: number; - COMPRESSED_RGB_S3TC_DXT1_EXT: number; + readonly COMPRESSED_RGBA_S3TC_DXT1_EXT: number; + readonly COMPRESSED_RGBA_S3TC_DXT3_EXT: number; + readonly COMPRESSED_RGBA_S3TC_DXT5_EXT: number; + readonly COMPRESSED_RGB_S3TC_DXT1_EXT: number; } declare var WEBGL_compressed_texture_s3tc: { prototype: WEBGL_compressed_texture_s3tc; new(): WEBGL_compressed_texture_s3tc; - COMPRESSED_RGBA_S3TC_DXT1_EXT: number; - COMPRESSED_RGBA_S3TC_DXT3_EXT: number; - COMPRESSED_RGBA_S3TC_DXT5_EXT: number; - COMPRESSED_RGB_S3TC_DXT1_EXT: number; + readonly COMPRESSED_RGBA_S3TC_DXT1_EXT: number; + readonly COMPRESSED_RGBA_S3TC_DXT3_EXT: number; + readonly COMPRESSED_RGBA_S3TC_DXT5_EXT: number; + readonly COMPRESSED_RGB_S3TC_DXT1_EXT: number; } interface WEBGL_debug_renderer_info { - UNMASKED_RENDERER_WEBGL: number; - UNMASKED_VENDOR_WEBGL: number; + readonly UNMASKED_RENDERER_WEBGL: number; + readonly UNMASKED_VENDOR_WEBGL: number; } declare var WEBGL_debug_renderer_info: { prototype: WEBGL_debug_renderer_info; new(): WEBGL_debug_renderer_info; - UNMASKED_RENDERER_WEBGL: number; - UNMASKED_VENDOR_WEBGL: number; + readonly UNMASKED_RENDERER_WEBGL: number; + readonly UNMASKED_VENDOR_WEBGL: number; } interface WEBGL_depth_texture { - UNSIGNED_INT_24_8_WEBGL: number; + readonly UNSIGNED_INT_24_8_WEBGL: number; } declare var WEBGL_depth_texture: { prototype: WEBGL_depth_texture; new(): WEBGL_depth_texture; - UNSIGNED_INT_24_8_WEBGL: number; + readonly UNSIGNED_INT_24_8_WEBGL: number; } interface WaveShaperNode extends AudioNode { @@ -16340,9 +17444,9 @@ declare var WaveShaperNode: { } interface WebGLActiveInfo { - name: string; - size: number; - type: number; + readonly name: string; + readonly size: number; + readonly type: number; } declare var WebGLActiveInfo: { @@ -16359,12 +17463,12 @@ declare var WebGLBuffer: { } interface WebGLContextEvent extends Event { - statusMessage: string; + readonly statusMessage: string; } declare var WebGLContextEvent: { prototype: WebGLContextEvent; - new(): WebGLContextEvent; + new(type: string, eventInitDict?: WebGLContextEventInit): WebGLContextEvent; } interface WebGLFramebuffer extends WebGLObject { @@ -16400,9 +17504,9 @@ declare var WebGLRenderbuffer: { } interface WebGLRenderingContext { - canvas: HTMLCanvasElement; - drawingBufferHeight: number; - drawingBufferWidth: number; + readonly canvas: HTMLCanvasElement; + readonly drawingBufferHeight: number; + readonly drawingBufferWidth: number; activeTexture(texture: number): void; attachShader(program: WebGLProgram, shader: WebGLShader): void; bindAttribLocation(program: WebGLProgram, index: number, name: string): void; @@ -16517,635 +17621,635 @@ interface WebGLRenderingContext { texSubImage2D(target: number, level: number, xoffset: number, yoffset: number, format: number, type: number, video: HTMLVideoElement): void; texSubImage2D(target: number, level: number, xoffset: number, yoffset: number, format: number, type: number, pixels: ImageData): void; uniform1f(location: WebGLUniformLocation, x: number): void; - uniform1fv(location: WebGLUniformLocation, v: Float32Array): void; + uniform1fv(location: WebGLUniformLocation, v: Float32Array | number[]): void; uniform1i(location: WebGLUniformLocation, x: number): void; - uniform1iv(location: WebGLUniformLocation, v: Int32Array): void; + uniform1iv(location: WebGLUniformLocation, v: Int32Array | number[]): void; uniform2f(location: WebGLUniformLocation, x: number, y: number): void; - uniform2fv(location: WebGLUniformLocation, v: Float32Array): void; + uniform2fv(location: WebGLUniformLocation, v: Float32Array | number[]): void; uniform2i(location: WebGLUniformLocation, x: number, y: number): void; - uniform2iv(location: WebGLUniformLocation, v: Int32Array): void; + uniform2iv(location: WebGLUniformLocation, v: Int32Array | number[]): void; uniform3f(location: WebGLUniformLocation, x: number, y: number, z: number): void; - uniform3fv(location: WebGLUniformLocation, v: Float32Array): void; + uniform3fv(location: WebGLUniformLocation, v: Float32Array | number[]): void; uniform3i(location: WebGLUniformLocation, x: number, y: number, z: number): void; - uniform3iv(location: WebGLUniformLocation, v: Int32Array): void; + uniform3iv(location: WebGLUniformLocation, v: Int32Array | number[]): void; uniform4f(location: WebGLUniformLocation, x: number, y: number, z: number, w: number): void; - uniform4fv(location: WebGLUniformLocation, v: Float32Array): void; + uniform4fv(location: WebGLUniformLocation, v: Float32Array | number[]): void; uniform4i(location: WebGLUniformLocation, x: number, y: number, z: number, w: number): void; - uniform4iv(location: WebGLUniformLocation, v: Int32Array): void; - uniformMatrix2fv(location: WebGLUniformLocation, transpose: boolean, value: Float32Array): void; - uniformMatrix3fv(location: WebGLUniformLocation, transpose: boolean, value: Float32Array): void; - uniformMatrix4fv(location: WebGLUniformLocation, transpose: boolean, value: Float32Array): void; + uniform4iv(location: WebGLUniformLocation, v: Int32Array | number[]): void; + uniformMatrix2fv(location: WebGLUniformLocation, transpose: boolean, value: Float32Array | number[]): void; + uniformMatrix3fv(location: WebGLUniformLocation, transpose: boolean, value: Float32Array | number[]): void; + uniformMatrix4fv(location: WebGLUniformLocation, transpose: boolean, value: Float32Array | number[]): void; useProgram(program: WebGLProgram): void; validateProgram(program: WebGLProgram): void; vertexAttrib1f(indx: number, x: number): void; - vertexAttrib1fv(indx: number, values: Float32Array): void; + vertexAttrib1fv(indx: number, values: Float32Array | number[]): void; vertexAttrib2f(indx: number, x: number, y: number): void; - vertexAttrib2fv(indx: number, values: Float32Array): void; + vertexAttrib2fv(indx: number, values: Float32Array | number[]): void; vertexAttrib3f(indx: number, x: number, y: number, z: number): void; - vertexAttrib3fv(indx: number, values: Float32Array): void; + vertexAttrib3fv(indx: number, values: Float32Array | number[]): void; vertexAttrib4f(indx: number, x: number, y: number, z: number, w: number): void; - vertexAttrib4fv(indx: number, values: Float32Array): void; + vertexAttrib4fv(indx: number, values: Float32Array | number[]): void; vertexAttribPointer(indx: number, size: number, type: number, normalized: boolean, stride: number, offset: number): void; viewport(x: number, y: number, width: number, height: number): void; - ACTIVE_ATTRIBUTES: number; - ACTIVE_TEXTURE: number; - ACTIVE_UNIFORMS: number; - ALIASED_LINE_WIDTH_RANGE: number; - ALIASED_POINT_SIZE_RANGE: number; - ALPHA: number; - ALPHA_BITS: number; - ALWAYS: number; - ARRAY_BUFFER: number; - ARRAY_BUFFER_BINDING: number; - ATTACHED_SHADERS: number; - BACK: number; - BLEND: number; - BLEND_COLOR: number; - BLEND_DST_ALPHA: number; - BLEND_DST_RGB: number; - BLEND_EQUATION: number; - BLEND_EQUATION_ALPHA: number; - BLEND_EQUATION_RGB: number; - BLEND_SRC_ALPHA: number; - BLEND_SRC_RGB: number; - BLUE_BITS: number; - BOOL: number; - BOOL_VEC2: number; - BOOL_VEC3: number; - BOOL_VEC4: number; - BROWSER_DEFAULT_WEBGL: number; - BUFFER_SIZE: number; - BUFFER_USAGE: number; - BYTE: number; - CCW: number; - CLAMP_TO_EDGE: number; - COLOR_ATTACHMENT0: number; - COLOR_BUFFER_BIT: number; - COLOR_CLEAR_VALUE: number; - COLOR_WRITEMASK: number; - COMPILE_STATUS: number; - COMPRESSED_TEXTURE_FORMATS: number; - CONSTANT_ALPHA: number; - CONSTANT_COLOR: number; - CONTEXT_LOST_WEBGL: number; - CULL_FACE: number; - CULL_FACE_MODE: number; - CURRENT_PROGRAM: number; - CURRENT_VERTEX_ATTRIB: number; - CW: number; - DECR: number; - DECR_WRAP: number; - DELETE_STATUS: number; - DEPTH_ATTACHMENT: number; - DEPTH_BITS: number; - DEPTH_BUFFER_BIT: number; - DEPTH_CLEAR_VALUE: number; - DEPTH_COMPONENT: number; - DEPTH_COMPONENT16: number; - DEPTH_FUNC: number; - DEPTH_RANGE: number; - DEPTH_STENCIL: number; - DEPTH_STENCIL_ATTACHMENT: number; - DEPTH_TEST: number; - DEPTH_WRITEMASK: number; - DITHER: number; - DONT_CARE: number; - DST_ALPHA: number; - DST_COLOR: number; - DYNAMIC_DRAW: number; - ELEMENT_ARRAY_BUFFER: number; - ELEMENT_ARRAY_BUFFER_BINDING: number; - EQUAL: number; - FASTEST: number; - FLOAT: number; - FLOAT_MAT2: number; - FLOAT_MAT3: number; - FLOAT_MAT4: number; - FLOAT_VEC2: number; - FLOAT_VEC3: number; - FLOAT_VEC4: number; - FRAGMENT_SHADER: number; - FRAMEBUFFER: number; - FRAMEBUFFER_ATTACHMENT_OBJECT_NAME: number; - FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE: number; - FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE: number; - FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL: number; - FRAMEBUFFER_BINDING: number; - FRAMEBUFFER_COMPLETE: number; - FRAMEBUFFER_INCOMPLETE_ATTACHMENT: number; - FRAMEBUFFER_INCOMPLETE_DIMENSIONS: number; - FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT: number; - FRAMEBUFFER_UNSUPPORTED: number; - FRONT: number; - FRONT_AND_BACK: number; - FRONT_FACE: number; - FUNC_ADD: number; - FUNC_REVERSE_SUBTRACT: number; - FUNC_SUBTRACT: number; - GENERATE_MIPMAP_HINT: number; - GEQUAL: number; - GREATER: number; - GREEN_BITS: number; - HIGH_FLOAT: number; - HIGH_INT: number; - IMPLEMENTATION_COLOR_READ_FORMAT: number; - IMPLEMENTATION_COLOR_READ_TYPE: number; - INCR: number; - INCR_WRAP: number; - INT: number; - INT_VEC2: number; - INT_VEC3: number; - INT_VEC4: number; - INVALID_ENUM: number; - INVALID_FRAMEBUFFER_OPERATION: number; - INVALID_OPERATION: number; - INVALID_VALUE: number; - INVERT: number; - KEEP: number; - LEQUAL: number; - LESS: number; - LINEAR: number; - LINEAR_MIPMAP_LINEAR: number; - LINEAR_MIPMAP_NEAREST: number; - LINES: number; - LINE_LOOP: number; - LINE_STRIP: number; - LINE_WIDTH: number; - LINK_STATUS: number; - LOW_FLOAT: number; - LOW_INT: number; - LUMINANCE: number; - LUMINANCE_ALPHA: number; - MAX_COMBINED_TEXTURE_IMAGE_UNITS: number; - MAX_CUBE_MAP_TEXTURE_SIZE: number; - MAX_FRAGMENT_UNIFORM_VECTORS: number; - MAX_RENDERBUFFER_SIZE: number; - MAX_TEXTURE_IMAGE_UNITS: number; - MAX_TEXTURE_SIZE: number; - MAX_VARYING_VECTORS: number; - MAX_VERTEX_ATTRIBS: number; - MAX_VERTEX_TEXTURE_IMAGE_UNITS: number; - MAX_VERTEX_UNIFORM_VECTORS: number; - MAX_VIEWPORT_DIMS: number; - MEDIUM_FLOAT: number; - MEDIUM_INT: number; - MIRRORED_REPEAT: number; - NEAREST: number; - NEAREST_MIPMAP_LINEAR: number; - NEAREST_MIPMAP_NEAREST: number; - NEVER: number; - NICEST: number; - NONE: number; - NOTEQUAL: number; - NO_ERROR: number; - ONE: number; - ONE_MINUS_CONSTANT_ALPHA: number; - ONE_MINUS_CONSTANT_COLOR: number; - ONE_MINUS_DST_ALPHA: number; - ONE_MINUS_DST_COLOR: number; - ONE_MINUS_SRC_ALPHA: number; - ONE_MINUS_SRC_COLOR: number; - OUT_OF_MEMORY: number; - PACK_ALIGNMENT: number; - POINTS: number; - POLYGON_OFFSET_FACTOR: number; - POLYGON_OFFSET_FILL: number; - POLYGON_OFFSET_UNITS: number; - RED_BITS: number; - RENDERBUFFER: number; - RENDERBUFFER_ALPHA_SIZE: number; - RENDERBUFFER_BINDING: number; - RENDERBUFFER_BLUE_SIZE: number; - RENDERBUFFER_DEPTH_SIZE: number; - RENDERBUFFER_GREEN_SIZE: number; - RENDERBUFFER_HEIGHT: number; - RENDERBUFFER_INTERNAL_FORMAT: number; - RENDERBUFFER_RED_SIZE: number; - RENDERBUFFER_STENCIL_SIZE: number; - RENDERBUFFER_WIDTH: number; - RENDERER: number; - REPEAT: number; - REPLACE: number; - RGB: number; - RGB565: number; - RGB5_A1: number; - RGBA: number; - RGBA4: number; - SAMPLER_2D: number; - SAMPLER_CUBE: number; - SAMPLES: number; - SAMPLE_ALPHA_TO_COVERAGE: number; - SAMPLE_BUFFERS: number; - SAMPLE_COVERAGE: number; - SAMPLE_COVERAGE_INVERT: number; - SAMPLE_COVERAGE_VALUE: number; - SCISSOR_BOX: number; - SCISSOR_TEST: number; - SHADER_TYPE: number; - SHADING_LANGUAGE_VERSION: number; - SHORT: number; - SRC_ALPHA: number; - SRC_ALPHA_SATURATE: number; - SRC_COLOR: number; - STATIC_DRAW: number; - STENCIL_ATTACHMENT: number; - STENCIL_BACK_FAIL: number; - STENCIL_BACK_FUNC: number; - STENCIL_BACK_PASS_DEPTH_FAIL: number; - STENCIL_BACK_PASS_DEPTH_PASS: number; - STENCIL_BACK_REF: number; - STENCIL_BACK_VALUE_MASK: number; - STENCIL_BACK_WRITEMASK: number; - STENCIL_BITS: number; - STENCIL_BUFFER_BIT: number; - STENCIL_CLEAR_VALUE: number; - STENCIL_FAIL: number; - STENCIL_FUNC: number; - STENCIL_INDEX: number; - STENCIL_INDEX8: number; - STENCIL_PASS_DEPTH_FAIL: number; - STENCIL_PASS_DEPTH_PASS: number; - STENCIL_REF: number; - STENCIL_TEST: number; - STENCIL_VALUE_MASK: number; - STENCIL_WRITEMASK: number; - STREAM_DRAW: number; - SUBPIXEL_BITS: number; - TEXTURE: number; - TEXTURE0: number; - TEXTURE1: number; - TEXTURE10: number; - TEXTURE11: number; - TEXTURE12: number; - TEXTURE13: number; - TEXTURE14: number; - TEXTURE15: number; - TEXTURE16: number; - TEXTURE17: number; - TEXTURE18: number; - TEXTURE19: number; - TEXTURE2: number; - TEXTURE20: number; - TEXTURE21: number; - TEXTURE22: number; - TEXTURE23: number; - TEXTURE24: number; - TEXTURE25: number; - TEXTURE26: number; - TEXTURE27: number; - TEXTURE28: number; - TEXTURE29: number; - TEXTURE3: number; - TEXTURE30: number; - TEXTURE31: number; - TEXTURE4: number; - TEXTURE5: number; - TEXTURE6: number; - TEXTURE7: number; - TEXTURE8: number; - TEXTURE9: number; - TEXTURE_2D: number; - TEXTURE_BINDING_2D: number; - TEXTURE_BINDING_CUBE_MAP: number; - TEXTURE_CUBE_MAP: number; - TEXTURE_CUBE_MAP_NEGATIVE_X: number; - TEXTURE_CUBE_MAP_NEGATIVE_Y: number; - TEXTURE_CUBE_MAP_NEGATIVE_Z: number; - TEXTURE_CUBE_MAP_POSITIVE_X: number; - TEXTURE_CUBE_MAP_POSITIVE_Y: number; - TEXTURE_CUBE_MAP_POSITIVE_Z: number; - TEXTURE_MAG_FILTER: number; - TEXTURE_MIN_FILTER: number; - TEXTURE_WRAP_S: number; - TEXTURE_WRAP_T: number; - TRIANGLES: number; - TRIANGLE_FAN: number; - TRIANGLE_STRIP: number; - UNPACK_ALIGNMENT: number; - UNPACK_COLORSPACE_CONVERSION_WEBGL: number; - UNPACK_FLIP_Y_WEBGL: number; - UNPACK_PREMULTIPLY_ALPHA_WEBGL: number; - UNSIGNED_BYTE: number; - UNSIGNED_INT: number; - UNSIGNED_SHORT: number; - UNSIGNED_SHORT_4_4_4_4: number; - UNSIGNED_SHORT_5_5_5_1: number; - UNSIGNED_SHORT_5_6_5: number; - VALIDATE_STATUS: number; - VENDOR: number; - VERSION: number; - VERTEX_ATTRIB_ARRAY_BUFFER_BINDING: number; - VERTEX_ATTRIB_ARRAY_ENABLED: number; - VERTEX_ATTRIB_ARRAY_NORMALIZED: number; - VERTEX_ATTRIB_ARRAY_POINTER: number; - VERTEX_ATTRIB_ARRAY_SIZE: number; - VERTEX_ATTRIB_ARRAY_STRIDE: number; - VERTEX_ATTRIB_ARRAY_TYPE: number; - VERTEX_SHADER: number; - VIEWPORT: number; - ZERO: number; + readonly ACTIVE_ATTRIBUTES: number; + readonly ACTIVE_TEXTURE: number; + readonly ACTIVE_UNIFORMS: number; + readonly ALIASED_LINE_WIDTH_RANGE: number; + readonly ALIASED_POINT_SIZE_RANGE: number; + readonly ALPHA: number; + readonly ALPHA_BITS: number; + readonly ALWAYS: number; + readonly ARRAY_BUFFER: number; + readonly ARRAY_BUFFER_BINDING: number; + readonly ATTACHED_SHADERS: number; + readonly BACK: number; + readonly BLEND: number; + readonly BLEND_COLOR: number; + readonly BLEND_DST_ALPHA: number; + readonly BLEND_DST_RGB: number; + readonly BLEND_EQUATION: number; + readonly BLEND_EQUATION_ALPHA: number; + readonly BLEND_EQUATION_RGB: number; + readonly BLEND_SRC_ALPHA: number; + readonly BLEND_SRC_RGB: number; + readonly BLUE_BITS: number; + readonly BOOL: number; + readonly BOOL_VEC2: number; + readonly BOOL_VEC3: number; + readonly BOOL_VEC4: number; + readonly BROWSER_DEFAULT_WEBGL: number; + readonly BUFFER_SIZE: number; + readonly BUFFER_USAGE: number; + readonly BYTE: number; + readonly CCW: number; + readonly CLAMP_TO_EDGE: number; + readonly COLOR_ATTACHMENT0: number; + readonly COLOR_BUFFER_BIT: number; + readonly COLOR_CLEAR_VALUE: number; + readonly COLOR_WRITEMASK: number; + readonly COMPILE_STATUS: number; + readonly COMPRESSED_TEXTURE_FORMATS: number; + readonly CONSTANT_ALPHA: number; + readonly CONSTANT_COLOR: number; + readonly CONTEXT_LOST_WEBGL: number; + readonly CULL_FACE: number; + readonly CULL_FACE_MODE: number; + readonly CURRENT_PROGRAM: number; + readonly CURRENT_VERTEX_ATTRIB: number; + readonly CW: number; + readonly DECR: number; + readonly DECR_WRAP: number; + readonly DELETE_STATUS: number; + readonly DEPTH_ATTACHMENT: number; + readonly DEPTH_BITS: number; + readonly DEPTH_BUFFER_BIT: number; + readonly DEPTH_CLEAR_VALUE: number; + readonly DEPTH_COMPONENT: number; + readonly DEPTH_COMPONENT16: number; + readonly DEPTH_FUNC: number; + readonly DEPTH_RANGE: number; + readonly DEPTH_STENCIL: number; + readonly DEPTH_STENCIL_ATTACHMENT: number; + readonly DEPTH_TEST: number; + readonly DEPTH_WRITEMASK: number; + readonly DITHER: number; + readonly DONT_CARE: number; + readonly DST_ALPHA: number; + readonly DST_COLOR: number; + readonly DYNAMIC_DRAW: number; + readonly ELEMENT_ARRAY_BUFFER: number; + readonly ELEMENT_ARRAY_BUFFER_BINDING: number; + readonly EQUAL: number; + readonly FASTEST: number; + readonly FLOAT: number; + readonly FLOAT_MAT2: number; + readonly FLOAT_MAT3: number; + readonly FLOAT_MAT4: number; + readonly FLOAT_VEC2: number; + readonly FLOAT_VEC3: number; + readonly FLOAT_VEC4: number; + readonly FRAGMENT_SHADER: number; + readonly FRAMEBUFFER: number; + readonly FRAMEBUFFER_ATTACHMENT_OBJECT_NAME: number; + readonly FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE: number; + readonly FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE: number; + readonly FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL: number; + readonly FRAMEBUFFER_BINDING: number; + readonly FRAMEBUFFER_COMPLETE: number; + readonly FRAMEBUFFER_INCOMPLETE_ATTACHMENT: number; + readonly FRAMEBUFFER_INCOMPLETE_DIMENSIONS: number; + readonly FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT: number; + readonly FRAMEBUFFER_UNSUPPORTED: number; + readonly FRONT: number; + readonly FRONT_AND_BACK: number; + readonly FRONT_FACE: number; + readonly FUNC_ADD: number; + readonly FUNC_REVERSE_SUBTRACT: number; + readonly FUNC_SUBTRACT: number; + readonly GENERATE_MIPMAP_HINT: number; + readonly GEQUAL: number; + readonly GREATER: number; + readonly GREEN_BITS: number; + readonly HIGH_FLOAT: number; + readonly HIGH_INT: number; + readonly IMPLEMENTATION_COLOR_READ_FORMAT: number; + readonly IMPLEMENTATION_COLOR_READ_TYPE: number; + readonly INCR: number; + readonly INCR_WRAP: number; + readonly INT: number; + readonly INT_VEC2: number; + readonly INT_VEC3: number; + readonly INT_VEC4: number; + readonly INVALID_ENUM: number; + readonly INVALID_FRAMEBUFFER_OPERATION: number; + readonly INVALID_OPERATION: number; + readonly INVALID_VALUE: number; + readonly INVERT: number; + readonly KEEP: number; + readonly LEQUAL: number; + readonly LESS: number; + readonly LINEAR: number; + readonly LINEAR_MIPMAP_LINEAR: number; + readonly LINEAR_MIPMAP_NEAREST: number; + readonly LINES: number; + readonly LINE_LOOP: number; + readonly LINE_STRIP: number; + readonly LINE_WIDTH: number; + readonly LINK_STATUS: number; + readonly LOW_FLOAT: number; + readonly LOW_INT: number; + readonly LUMINANCE: number; + readonly LUMINANCE_ALPHA: number; + readonly MAX_COMBINED_TEXTURE_IMAGE_UNITS: number; + readonly MAX_CUBE_MAP_TEXTURE_SIZE: number; + readonly MAX_FRAGMENT_UNIFORM_VECTORS: number; + readonly MAX_RENDERBUFFER_SIZE: number; + readonly MAX_TEXTURE_IMAGE_UNITS: number; + readonly MAX_TEXTURE_SIZE: number; + readonly MAX_VARYING_VECTORS: number; + readonly MAX_VERTEX_ATTRIBS: number; + readonly MAX_VERTEX_TEXTURE_IMAGE_UNITS: number; + readonly MAX_VERTEX_UNIFORM_VECTORS: number; + readonly MAX_VIEWPORT_DIMS: number; + readonly MEDIUM_FLOAT: number; + readonly MEDIUM_INT: number; + readonly MIRRORED_REPEAT: number; + readonly NEAREST: number; + readonly NEAREST_MIPMAP_LINEAR: number; + readonly NEAREST_MIPMAP_NEAREST: number; + readonly NEVER: number; + readonly NICEST: number; + readonly NONE: number; + readonly NOTEQUAL: number; + readonly NO_ERROR: number; + readonly ONE: number; + readonly ONE_MINUS_CONSTANT_ALPHA: number; + readonly ONE_MINUS_CONSTANT_COLOR: number; + readonly ONE_MINUS_DST_ALPHA: number; + readonly ONE_MINUS_DST_COLOR: number; + readonly ONE_MINUS_SRC_ALPHA: number; + readonly ONE_MINUS_SRC_COLOR: number; + readonly OUT_OF_MEMORY: number; + readonly PACK_ALIGNMENT: number; + readonly POINTS: number; + readonly POLYGON_OFFSET_FACTOR: number; + readonly POLYGON_OFFSET_FILL: number; + readonly POLYGON_OFFSET_UNITS: number; + readonly RED_BITS: number; + readonly RENDERBUFFER: number; + readonly RENDERBUFFER_ALPHA_SIZE: number; + readonly RENDERBUFFER_BINDING: number; + readonly RENDERBUFFER_BLUE_SIZE: number; + readonly RENDERBUFFER_DEPTH_SIZE: number; + readonly RENDERBUFFER_GREEN_SIZE: number; + readonly RENDERBUFFER_HEIGHT: number; + readonly RENDERBUFFER_INTERNAL_FORMAT: number; + readonly RENDERBUFFER_RED_SIZE: number; + readonly RENDERBUFFER_STENCIL_SIZE: number; + readonly RENDERBUFFER_WIDTH: number; + readonly RENDERER: number; + readonly REPEAT: number; + readonly REPLACE: number; + readonly RGB: number; + readonly RGB565: number; + readonly RGB5_A1: number; + readonly RGBA: number; + readonly RGBA4: number; + readonly SAMPLER_2D: number; + readonly SAMPLER_CUBE: number; + readonly SAMPLES: number; + readonly SAMPLE_ALPHA_TO_COVERAGE: number; + readonly SAMPLE_BUFFERS: number; + readonly SAMPLE_COVERAGE: number; + readonly SAMPLE_COVERAGE_INVERT: number; + readonly SAMPLE_COVERAGE_VALUE: number; + readonly SCISSOR_BOX: number; + readonly SCISSOR_TEST: number; + readonly SHADER_TYPE: number; + readonly SHADING_LANGUAGE_VERSION: number; + readonly SHORT: number; + readonly SRC_ALPHA: number; + readonly SRC_ALPHA_SATURATE: number; + readonly SRC_COLOR: number; + readonly STATIC_DRAW: number; + readonly STENCIL_ATTACHMENT: number; + readonly STENCIL_BACK_FAIL: number; + readonly STENCIL_BACK_FUNC: number; + readonly STENCIL_BACK_PASS_DEPTH_FAIL: number; + readonly STENCIL_BACK_PASS_DEPTH_PASS: number; + readonly STENCIL_BACK_REF: number; + readonly STENCIL_BACK_VALUE_MASK: number; + readonly STENCIL_BACK_WRITEMASK: number; + readonly STENCIL_BITS: number; + readonly STENCIL_BUFFER_BIT: number; + readonly STENCIL_CLEAR_VALUE: number; + readonly STENCIL_FAIL: number; + readonly STENCIL_FUNC: number; + readonly STENCIL_INDEX: number; + readonly STENCIL_INDEX8: number; + readonly STENCIL_PASS_DEPTH_FAIL: number; + readonly STENCIL_PASS_DEPTH_PASS: number; + readonly STENCIL_REF: number; + readonly STENCIL_TEST: number; + readonly STENCIL_VALUE_MASK: number; + readonly STENCIL_WRITEMASK: number; + readonly STREAM_DRAW: number; + readonly SUBPIXEL_BITS: number; + readonly TEXTURE: number; + readonly TEXTURE0: number; + readonly TEXTURE1: number; + readonly TEXTURE10: number; + readonly TEXTURE11: number; + readonly TEXTURE12: number; + readonly TEXTURE13: number; + readonly TEXTURE14: number; + readonly TEXTURE15: number; + readonly TEXTURE16: number; + readonly TEXTURE17: number; + readonly TEXTURE18: number; + readonly TEXTURE19: number; + readonly TEXTURE2: number; + readonly TEXTURE20: number; + readonly TEXTURE21: number; + readonly TEXTURE22: number; + readonly TEXTURE23: number; + readonly TEXTURE24: number; + readonly TEXTURE25: number; + readonly TEXTURE26: number; + readonly TEXTURE27: number; + readonly TEXTURE28: number; + readonly TEXTURE29: number; + readonly TEXTURE3: number; + readonly TEXTURE30: number; + readonly TEXTURE31: number; + readonly TEXTURE4: number; + readonly TEXTURE5: number; + readonly TEXTURE6: number; + readonly TEXTURE7: number; + readonly TEXTURE8: number; + readonly TEXTURE9: number; + readonly TEXTURE_2D: number; + readonly TEXTURE_BINDING_2D: number; + readonly TEXTURE_BINDING_CUBE_MAP: number; + readonly TEXTURE_CUBE_MAP: number; + readonly TEXTURE_CUBE_MAP_NEGATIVE_X: number; + readonly TEXTURE_CUBE_MAP_NEGATIVE_Y: number; + readonly TEXTURE_CUBE_MAP_NEGATIVE_Z: number; + readonly TEXTURE_CUBE_MAP_POSITIVE_X: number; + readonly TEXTURE_CUBE_MAP_POSITIVE_Y: number; + readonly TEXTURE_CUBE_MAP_POSITIVE_Z: number; + readonly TEXTURE_MAG_FILTER: number; + readonly TEXTURE_MIN_FILTER: number; + readonly TEXTURE_WRAP_S: number; + readonly TEXTURE_WRAP_T: number; + readonly TRIANGLES: number; + readonly TRIANGLE_FAN: number; + readonly TRIANGLE_STRIP: number; + readonly UNPACK_ALIGNMENT: number; + readonly UNPACK_COLORSPACE_CONVERSION_WEBGL: number; + readonly UNPACK_FLIP_Y_WEBGL: number; + readonly UNPACK_PREMULTIPLY_ALPHA_WEBGL: number; + readonly UNSIGNED_BYTE: number; + readonly UNSIGNED_INT: number; + readonly UNSIGNED_SHORT: number; + readonly UNSIGNED_SHORT_4_4_4_4: number; + readonly UNSIGNED_SHORT_5_5_5_1: number; + readonly UNSIGNED_SHORT_5_6_5: number; + readonly VALIDATE_STATUS: number; + readonly VENDOR: number; + readonly VERSION: number; + readonly VERTEX_ATTRIB_ARRAY_BUFFER_BINDING: number; + readonly VERTEX_ATTRIB_ARRAY_ENABLED: number; + readonly VERTEX_ATTRIB_ARRAY_NORMALIZED: number; + readonly VERTEX_ATTRIB_ARRAY_POINTER: number; + readonly VERTEX_ATTRIB_ARRAY_SIZE: number; + readonly VERTEX_ATTRIB_ARRAY_STRIDE: number; + readonly VERTEX_ATTRIB_ARRAY_TYPE: number; + readonly VERTEX_SHADER: number; + readonly VIEWPORT: number; + readonly ZERO: number; } declare var WebGLRenderingContext: { prototype: WebGLRenderingContext; new(): WebGLRenderingContext; - ACTIVE_ATTRIBUTES: number; - ACTIVE_TEXTURE: number; - ACTIVE_UNIFORMS: number; - ALIASED_LINE_WIDTH_RANGE: number; - ALIASED_POINT_SIZE_RANGE: number; - ALPHA: number; - ALPHA_BITS: number; - ALWAYS: number; - ARRAY_BUFFER: number; - ARRAY_BUFFER_BINDING: number; - ATTACHED_SHADERS: number; - BACK: number; - BLEND: number; - BLEND_COLOR: number; - BLEND_DST_ALPHA: number; - BLEND_DST_RGB: number; - BLEND_EQUATION: number; - BLEND_EQUATION_ALPHA: number; - BLEND_EQUATION_RGB: number; - BLEND_SRC_ALPHA: number; - BLEND_SRC_RGB: number; - BLUE_BITS: number; - BOOL: number; - BOOL_VEC2: number; - BOOL_VEC3: number; - BOOL_VEC4: number; - BROWSER_DEFAULT_WEBGL: number; - BUFFER_SIZE: number; - BUFFER_USAGE: number; - BYTE: number; - CCW: number; - CLAMP_TO_EDGE: number; - COLOR_ATTACHMENT0: number; - COLOR_BUFFER_BIT: number; - COLOR_CLEAR_VALUE: number; - COLOR_WRITEMASK: number; - COMPILE_STATUS: number; - COMPRESSED_TEXTURE_FORMATS: number; - CONSTANT_ALPHA: number; - CONSTANT_COLOR: number; - CONTEXT_LOST_WEBGL: number; - CULL_FACE: number; - CULL_FACE_MODE: number; - CURRENT_PROGRAM: number; - CURRENT_VERTEX_ATTRIB: number; - CW: number; - DECR: number; - DECR_WRAP: number; - DELETE_STATUS: number; - DEPTH_ATTACHMENT: number; - DEPTH_BITS: number; - DEPTH_BUFFER_BIT: number; - DEPTH_CLEAR_VALUE: number; - DEPTH_COMPONENT: number; - DEPTH_COMPONENT16: number; - DEPTH_FUNC: number; - DEPTH_RANGE: number; - DEPTH_STENCIL: number; - DEPTH_STENCIL_ATTACHMENT: number; - DEPTH_TEST: number; - DEPTH_WRITEMASK: number; - DITHER: number; - DONT_CARE: number; - DST_ALPHA: number; - DST_COLOR: number; - DYNAMIC_DRAW: number; - ELEMENT_ARRAY_BUFFER: number; - ELEMENT_ARRAY_BUFFER_BINDING: number; - EQUAL: number; - FASTEST: number; - FLOAT: number; - FLOAT_MAT2: number; - FLOAT_MAT3: number; - FLOAT_MAT4: number; - FLOAT_VEC2: number; - FLOAT_VEC3: number; - FLOAT_VEC4: number; - FRAGMENT_SHADER: number; - FRAMEBUFFER: number; - FRAMEBUFFER_ATTACHMENT_OBJECT_NAME: number; - FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE: number; - FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE: number; - FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL: number; - FRAMEBUFFER_BINDING: number; - FRAMEBUFFER_COMPLETE: number; - FRAMEBUFFER_INCOMPLETE_ATTACHMENT: number; - FRAMEBUFFER_INCOMPLETE_DIMENSIONS: number; - FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT: number; - FRAMEBUFFER_UNSUPPORTED: number; - FRONT: number; - FRONT_AND_BACK: number; - FRONT_FACE: number; - FUNC_ADD: number; - FUNC_REVERSE_SUBTRACT: number; - FUNC_SUBTRACT: number; - GENERATE_MIPMAP_HINT: number; - GEQUAL: number; - GREATER: number; - GREEN_BITS: number; - HIGH_FLOAT: number; - HIGH_INT: number; - IMPLEMENTATION_COLOR_READ_FORMAT: number; - IMPLEMENTATION_COLOR_READ_TYPE: number; - INCR: number; - INCR_WRAP: number; - INT: number; - INT_VEC2: number; - INT_VEC3: number; - INT_VEC4: number; - INVALID_ENUM: number; - INVALID_FRAMEBUFFER_OPERATION: number; - INVALID_OPERATION: number; - INVALID_VALUE: number; - INVERT: number; - KEEP: number; - LEQUAL: number; - LESS: number; - LINEAR: number; - LINEAR_MIPMAP_LINEAR: number; - LINEAR_MIPMAP_NEAREST: number; - LINES: number; - LINE_LOOP: number; - LINE_STRIP: number; - LINE_WIDTH: number; - LINK_STATUS: number; - LOW_FLOAT: number; - LOW_INT: number; - LUMINANCE: number; - LUMINANCE_ALPHA: number; - MAX_COMBINED_TEXTURE_IMAGE_UNITS: number; - MAX_CUBE_MAP_TEXTURE_SIZE: number; - MAX_FRAGMENT_UNIFORM_VECTORS: number; - MAX_RENDERBUFFER_SIZE: number; - MAX_TEXTURE_IMAGE_UNITS: number; - MAX_TEXTURE_SIZE: number; - MAX_VARYING_VECTORS: number; - MAX_VERTEX_ATTRIBS: number; - MAX_VERTEX_TEXTURE_IMAGE_UNITS: number; - MAX_VERTEX_UNIFORM_VECTORS: number; - MAX_VIEWPORT_DIMS: number; - MEDIUM_FLOAT: number; - MEDIUM_INT: number; - MIRRORED_REPEAT: number; - NEAREST: number; - NEAREST_MIPMAP_LINEAR: number; - NEAREST_MIPMAP_NEAREST: number; - NEVER: number; - NICEST: number; - NONE: number; - NOTEQUAL: number; - NO_ERROR: number; - ONE: number; - ONE_MINUS_CONSTANT_ALPHA: number; - ONE_MINUS_CONSTANT_COLOR: number; - ONE_MINUS_DST_ALPHA: number; - ONE_MINUS_DST_COLOR: number; - ONE_MINUS_SRC_ALPHA: number; - ONE_MINUS_SRC_COLOR: number; - OUT_OF_MEMORY: number; - PACK_ALIGNMENT: number; - POINTS: number; - POLYGON_OFFSET_FACTOR: number; - POLYGON_OFFSET_FILL: number; - POLYGON_OFFSET_UNITS: number; - RED_BITS: number; - RENDERBUFFER: number; - RENDERBUFFER_ALPHA_SIZE: number; - RENDERBUFFER_BINDING: number; - RENDERBUFFER_BLUE_SIZE: number; - RENDERBUFFER_DEPTH_SIZE: number; - RENDERBUFFER_GREEN_SIZE: number; - RENDERBUFFER_HEIGHT: number; - RENDERBUFFER_INTERNAL_FORMAT: number; - RENDERBUFFER_RED_SIZE: number; - RENDERBUFFER_STENCIL_SIZE: number; - RENDERBUFFER_WIDTH: number; - RENDERER: number; - REPEAT: number; - REPLACE: number; - RGB: number; - RGB565: number; - RGB5_A1: number; - RGBA: number; - RGBA4: number; - SAMPLER_2D: number; - SAMPLER_CUBE: number; - SAMPLES: number; - SAMPLE_ALPHA_TO_COVERAGE: number; - SAMPLE_BUFFERS: number; - SAMPLE_COVERAGE: number; - SAMPLE_COVERAGE_INVERT: number; - SAMPLE_COVERAGE_VALUE: number; - SCISSOR_BOX: number; - SCISSOR_TEST: number; - SHADER_TYPE: number; - SHADING_LANGUAGE_VERSION: number; - SHORT: number; - SRC_ALPHA: number; - SRC_ALPHA_SATURATE: number; - SRC_COLOR: number; - STATIC_DRAW: number; - STENCIL_ATTACHMENT: number; - STENCIL_BACK_FAIL: number; - STENCIL_BACK_FUNC: number; - STENCIL_BACK_PASS_DEPTH_FAIL: number; - STENCIL_BACK_PASS_DEPTH_PASS: number; - STENCIL_BACK_REF: number; - STENCIL_BACK_VALUE_MASK: number; - STENCIL_BACK_WRITEMASK: number; - STENCIL_BITS: number; - STENCIL_BUFFER_BIT: number; - STENCIL_CLEAR_VALUE: number; - STENCIL_FAIL: number; - STENCIL_FUNC: number; - STENCIL_INDEX: number; - STENCIL_INDEX8: number; - STENCIL_PASS_DEPTH_FAIL: number; - STENCIL_PASS_DEPTH_PASS: number; - STENCIL_REF: number; - STENCIL_TEST: number; - STENCIL_VALUE_MASK: number; - STENCIL_WRITEMASK: number; - STREAM_DRAW: number; - SUBPIXEL_BITS: number; - TEXTURE: number; - TEXTURE0: number; - TEXTURE1: number; - TEXTURE10: number; - TEXTURE11: number; - TEXTURE12: number; - TEXTURE13: number; - TEXTURE14: number; - TEXTURE15: number; - TEXTURE16: number; - TEXTURE17: number; - TEXTURE18: number; - TEXTURE19: number; - TEXTURE2: number; - TEXTURE20: number; - TEXTURE21: number; - TEXTURE22: number; - TEXTURE23: number; - TEXTURE24: number; - TEXTURE25: number; - TEXTURE26: number; - TEXTURE27: number; - TEXTURE28: number; - TEXTURE29: number; - TEXTURE3: number; - TEXTURE30: number; - TEXTURE31: number; - TEXTURE4: number; - TEXTURE5: number; - TEXTURE6: number; - TEXTURE7: number; - TEXTURE8: number; - TEXTURE9: number; - TEXTURE_2D: number; - TEXTURE_BINDING_2D: number; - TEXTURE_BINDING_CUBE_MAP: number; - TEXTURE_CUBE_MAP: number; - TEXTURE_CUBE_MAP_NEGATIVE_X: number; - TEXTURE_CUBE_MAP_NEGATIVE_Y: number; - TEXTURE_CUBE_MAP_NEGATIVE_Z: number; - TEXTURE_CUBE_MAP_POSITIVE_X: number; - TEXTURE_CUBE_MAP_POSITIVE_Y: number; - TEXTURE_CUBE_MAP_POSITIVE_Z: number; - TEXTURE_MAG_FILTER: number; - TEXTURE_MIN_FILTER: number; - TEXTURE_WRAP_S: number; - TEXTURE_WRAP_T: number; - TRIANGLES: number; - TRIANGLE_FAN: number; - TRIANGLE_STRIP: number; - UNPACK_ALIGNMENT: number; - UNPACK_COLORSPACE_CONVERSION_WEBGL: number; - UNPACK_FLIP_Y_WEBGL: number; - UNPACK_PREMULTIPLY_ALPHA_WEBGL: number; - UNSIGNED_BYTE: number; - UNSIGNED_INT: number; - UNSIGNED_SHORT: number; - UNSIGNED_SHORT_4_4_4_4: number; - UNSIGNED_SHORT_5_5_5_1: number; - UNSIGNED_SHORT_5_6_5: number; - VALIDATE_STATUS: number; - VENDOR: number; - VERSION: number; - VERTEX_ATTRIB_ARRAY_BUFFER_BINDING: number; - VERTEX_ATTRIB_ARRAY_ENABLED: number; - VERTEX_ATTRIB_ARRAY_NORMALIZED: number; - VERTEX_ATTRIB_ARRAY_POINTER: number; - VERTEX_ATTRIB_ARRAY_SIZE: number; - VERTEX_ATTRIB_ARRAY_STRIDE: number; - VERTEX_ATTRIB_ARRAY_TYPE: number; - VERTEX_SHADER: number; - VIEWPORT: number; - ZERO: number; + readonly ACTIVE_ATTRIBUTES: number; + readonly ACTIVE_TEXTURE: number; + readonly ACTIVE_UNIFORMS: number; + readonly ALIASED_LINE_WIDTH_RANGE: number; + readonly ALIASED_POINT_SIZE_RANGE: number; + readonly ALPHA: number; + readonly ALPHA_BITS: number; + readonly ALWAYS: number; + readonly ARRAY_BUFFER: number; + readonly ARRAY_BUFFER_BINDING: number; + readonly ATTACHED_SHADERS: number; + readonly BACK: number; + readonly BLEND: number; + readonly BLEND_COLOR: number; + readonly BLEND_DST_ALPHA: number; + readonly BLEND_DST_RGB: number; + readonly BLEND_EQUATION: number; + readonly BLEND_EQUATION_ALPHA: number; + readonly BLEND_EQUATION_RGB: number; + readonly BLEND_SRC_ALPHA: number; + readonly BLEND_SRC_RGB: number; + readonly BLUE_BITS: number; + readonly BOOL: number; + readonly BOOL_VEC2: number; + readonly BOOL_VEC3: number; + readonly BOOL_VEC4: number; + readonly BROWSER_DEFAULT_WEBGL: number; + readonly BUFFER_SIZE: number; + readonly BUFFER_USAGE: number; + readonly BYTE: number; + readonly CCW: number; + readonly CLAMP_TO_EDGE: number; + readonly COLOR_ATTACHMENT0: number; + readonly COLOR_BUFFER_BIT: number; + readonly COLOR_CLEAR_VALUE: number; + readonly COLOR_WRITEMASK: number; + readonly COMPILE_STATUS: number; + readonly COMPRESSED_TEXTURE_FORMATS: number; + readonly CONSTANT_ALPHA: number; + readonly CONSTANT_COLOR: number; + readonly CONTEXT_LOST_WEBGL: number; + readonly CULL_FACE: number; + readonly CULL_FACE_MODE: number; + readonly CURRENT_PROGRAM: number; + readonly CURRENT_VERTEX_ATTRIB: number; + readonly CW: number; + readonly DECR: number; + readonly DECR_WRAP: number; + readonly DELETE_STATUS: number; + readonly DEPTH_ATTACHMENT: number; + readonly DEPTH_BITS: number; + readonly DEPTH_BUFFER_BIT: number; + readonly DEPTH_CLEAR_VALUE: number; + readonly DEPTH_COMPONENT: number; + readonly DEPTH_COMPONENT16: number; + readonly DEPTH_FUNC: number; + readonly DEPTH_RANGE: number; + readonly DEPTH_STENCIL: number; + readonly DEPTH_STENCIL_ATTACHMENT: number; + readonly DEPTH_TEST: number; + readonly DEPTH_WRITEMASK: number; + readonly DITHER: number; + readonly DONT_CARE: number; + readonly DST_ALPHA: number; + readonly DST_COLOR: number; + readonly DYNAMIC_DRAW: number; + readonly ELEMENT_ARRAY_BUFFER: number; + readonly ELEMENT_ARRAY_BUFFER_BINDING: number; + readonly EQUAL: number; + readonly FASTEST: number; + readonly FLOAT: number; + readonly FLOAT_MAT2: number; + readonly FLOAT_MAT3: number; + readonly FLOAT_MAT4: number; + readonly FLOAT_VEC2: number; + readonly FLOAT_VEC3: number; + readonly FLOAT_VEC4: number; + readonly FRAGMENT_SHADER: number; + readonly FRAMEBUFFER: number; + readonly FRAMEBUFFER_ATTACHMENT_OBJECT_NAME: number; + readonly FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE: number; + readonly FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE: number; + readonly FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL: number; + readonly FRAMEBUFFER_BINDING: number; + readonly FRAMEBUFFER_COMPLETE: number; + readonly FRAMEBUFFER_INCOMPLETE_ATTACHMENT: number; + readonly FRAMEBUFFER_INCOMPLETE_DIMENSIONS: number; + readonly FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT: number; + readonly FRAMEBUFFER_UNSUPPORTED: number; + readonly FRONT: number; + readonly FRONT_AND_BACK: number; + readonly FRONT_FACE: number; + readonly FUNC_ADD: number; + readonly FUNC_REVERSE_SUBTRACT: number; + readonly FUNC_SUBTRACT: number; + readonly GENERATE_MIPMAP_HINT: number; + readonly GEQUAL: number; + readonly GREATER: number; + readonly GREEN_BITS: number; + readonly HIGH_FLOAT: number; + readonly HIGH_INT: number; + readonly IMPLEMENTATION_COLOR_READ_FORMAT: number; + readonly IMPLEMENTATION_COLOR_READ_TYPE: number; + readonly INCR: number; + readonly INCR_WRAP: number; + readonly INT: number; + readonly INT_VEC2: number; + readonly INT_VEC3: number; + readonly INT_VEC4: number; + readonly INVALID_ENUM: number; + readonly INVALID_FRAMEBUFFER_OPERATION: number; + readonly INVALID_OPERATION: number; + readonly INVALID_VALUE: number; + readonly INVERT: number; + readonly KEEP: number; + readonly LEQUAL: number; + readonly LESS: number; + readonly LINEAR: number; + readonly LINEAR_MIPMAP_LINEAR: number; + readonly LINEAR_MIPMAP_NEAREST: number; + readonly LINES: number; + readonly LINE_LOOP: number; + readonly LINE_STRIP: number; + readonly LINE_WIDTH: number; + readonly LINK_STATUS: number; + readonly LOW_FLOAT: number; + readonly LOW_INT: number; + readonly LUMINANCE: number; + readonly LUMINANCE_ALPHA: number; + readonly MAX_COMBINED_TEXTURE_IMAGE_UNITS: number; + readonly MAX_CUBE_MAP_TEXTURE_SIZE: number; + readonly MAX_FRAGMENT_UNIFORM_VECTORS: number; + readonly MAX_RENDERBUFFER_SIZE: number; + readonly MAX_TEXTURE_IMAGE_UNITS: number; + readonly MAX_TEXTURE_SIZE: number; + readonly MAX_VARYING_VECTORS: number; + readonly MAX_VERTEX_ATTRIBS: number; + readonly MAX_VERTEX_TEXTURE_IMAGE_UNITS: number; + readonly MAX_VERTEX_UNIFORM_VECTORS: number; + readonly MAX_VIEWPORT_DIMS: number; + readonly MEDIUM_FLOAT: number; + readonly MEDIUM_INT: number; + readonly MIRRORED_REPEAT: number; + readonly NEAREST: number; + readonly NEAREST_MIPMAP_LINEAR: number; + readonly NEAREST_MIPMAP_NEAREST: number; + readonly NEVER: number; + readonly NICEST: number; + readonly NONE: number; + readonly NOTEQUAL: number; + readonly NO_ERROR: number; + readonly ONE: number; + readonly ONE_MINUS_CONSTANT_ALPHA: number; + readonly ONE_MINUS_CONSTANT_COLOR: number; + readonly ONE_MINUS_DST_ALPHA: number; + readonly ONE_MINUS_DST_COLOR: number; + readonly ONE_MINUS_SRC_ALPHA: number; + readonly ONE_MINUS_SRC_COLOR: number; + readonly OUT_OF_MEMORY: number; + readonly PACK_ALIGNMENT: number; + readonly POINTS: number; + readonly POLYGON_OFFSET_FACTOR: number; + readonly POLYGON_OFFSET_FILL: number; + readonly POLYGON_OFFSET_UNITS: number; + readonly RED_BITS: number; + readonly RENDERBUFFER: number; + readonly RENDERBUFFER_ALPHA_SIZE: number; + readonly RENDERBUFFER_BINDING: number; + readonly RENDERBUFFER_BLUE_SIZE: number; + readonly RENDERBUFFER_DEPTH_SIZE: number; + readonly RENDERBUFFER_GREEN_SIZE: number; + readonly RENDERBUFFER_HEIGHT: number; + readonly RENDERBUFFER_INTERNAL_FORMAT: number; + readonly RENDERBUFFER_RED_SIZE: number; + readonly RENDERBUFFER_STENCIL_SIZE: number; + readonly RENDERBUFFER_WIDTH: number; + readonly RENDERER: number; + readonly REPEAT: number; + readonly REPLACE: number; + readonly RGB: number; + readonly RGB565: number; + readonly RGB5_A1: number; + readonly RGBA: number; + readonly RGBA4: number; + readonly SAMPLER_2D: number; + readonly SAMPLER_CUBE: number; + readonly SAMPLES: number; + readonly SAMPLE_ALPHA_TO_COVERAGE: number; + readonly SAMPLE_BUFFERS: number; + readonly SAMPLE_COVERAGE: number; + readonly SAMPLE_COVERAGE_INVERT: number; + readonly SAMPLE_COVERAGE_VALUE: number; + readonly SCISSOR_BOX: number; + readonly SCISSOR_TEST: number; + readonly SHADER_TYPE: number; + readonly SHADING_LANGUAGE_VERSION: number; + readonly SHORT: number; + readonly SRC_ALPHA: number; + readonly SRC_ALPHA_SATURATE: number; + readonly SRC_COLOR: number; + readonly STATIC_DRAW: number; + readonly STENCIL_ATTACHMENT: number; + readonly STENCIL_BACK_FAIL: number; + readonly STENCIL_BACK_FUNC: number; + readonly STENCIL_BACK_PASS_DEPTH_FAIL: number; + readonly STENCIL_BACK_PASS_DEPTH_PASS: number; + readonly STENCIL_BACK_REF: number; + readonly STENCIL_BACK_VALUE_MASK: number; + readonly STENCIL_BACK_WRITEMASK: number; + readonly STENCIL_BITS: number; + readonly STENCIL_BUFFER_BIT: number; + readonly STENCIL_CLEAR_VALUE: number; + readonly STENCIL_FAIL: number; + readonly STENCIL_FUNC: number; + readonly STENCIL_INDEX: number; + readonly STENCIL_INDEX8: number; + readonly STENCIL_PASS_DEPTH_FAIL: number; + readonly STENCIL_PASS_DEPTH_PASS: number; + readonly STENCIL_REF: number; + readonly STENCIL_TEST: number; + readonly STENCIL_VALUE_MASK: number; + readonly STENCIL_WRITEMASK: number; + readonly STREAM_DRAW: number; + readonly SUBPIXEL_BITS: number; + readonly TEXTURE: number; + readonly TEXTURE0: number; + readonly TEXTURE1: number; + readonly TEXTURE10: number; + readonly TEXTURE11: number; + readonly TEXTURE12: number; + readonly TEXTURE13: number; + readonly TEXTURE14: number; + readonly TEXTURE15: number; + readonly TEXTURE16: number; + readonly TEXTURE17: number; + readonly TEXTURE18: number; + readonly TEXTURE19: number; + readonly TEXTURE2: number; + readonly TEXTURE20: number; + readonly TEXTURE21: number; + readonly TEXTURE22: number; + readonly TEXTURE23: number; + readonly TEXTURE24: number; + readonly TEXTURE25: number; + readonly TEXTURE26: number; + readonly TEXTURE27: number; + readonly TEXTURE28: number; + readonly TEXTURE29: number; + readonly TEXTURE3: number; + readonly TEXTURE30: number; + readonly TEXTURE31: number; + readonly TEXTURE4: number; + readonly TEXTURE5: number; + readonly TEXTURE6: number; + readonly TEXTURE7: number; + readonly TEXTURE8: number; + readonly TEXTURE9: number; + readonly TEXTURE_2D: number; + readonly TEXTURE_BINDING_2D: number; + readonly TEXTURE_BINDING_CUBE_MAP: number; + readonly TEXTURE_CUBE_MAP: number; + readonly TEXTURE_CUBE_MAP_NEGATIVE_X: number; + readonly TEXTURE_CUBE_MAP_NEGATIVE_Y: number; + readonly TEXTURE_CUBE_MAP_NEGATIVE_Z: number; + readonly TEXTURE_CUBE_MAP_POSITIVE_X: number; + readonly TEXTURE_CUBE_MAP_POSITIVE_Y: number; + readonly TEXTURE_CUBE_MAP_POSITIVE_Z: number; + readonly TEXTURE_MAG_FILTER: number; + readonly TEXTURE_MIN_FILTER: number; + readonly TEXTURE_WRAP_S: number; + readonly TEXTURE_WRAP_T: number; + readonly TRIANGLES: number; + readonly TRIANGLE_FAN: number; + readonly TRIANGLE_STRIP: number; + readonly UNPACK_ALIGNMENT: number; + readonly UNPACK_COLORSPACE_CONVERSION_WEBGL: number; + readonly UNPACK_FLIP_Y_WEBGL: number; + readonly UNPACK_PREMULTIPLY_ALPHA_WEBGL: number; + readonly UNSIGNED_BYTE: number; + readonly UNSIGNED_INT: number; + readonly UNSIGNED_SHORT: number; + readonly UNSIGNED_SHORT_4_4_4_4: number; + readonly UNSIGNED_SHORT_5_5_5_1: number; + readonly UNSIGNED_SHORT_5_6_5: number; + readonly VALIDATE_STATUS: number; + readonly VENDOR: number; + readonly VERSION: number; + readonly VERTEX_ATTRIB_ARRAY_BUFFER_BINDING: number; + readonly VERTEX_ATTRIB_ARRAY_ENABLED: number; + readonly VERTEX_ATTRIB_ARRAY_NORMALIZED: number; + readonly VERTEX_ATTRIB_ARRAY_POINTER: number; + readonly VERTEX_ATTRIB_ARRAY_SIZE: number; + readonly VERTEX_ATTRIB_ARRAY_STRIDE: number; + readonly VERTEX_ATTRIB_ARRAY_TYPE: number; + readonly VERTEX_SHADER: number; + readonly VIEWPORT: number; + readonly ZERO: number; } interface WebGLShader extends WebGLObject { @@ -17157,9 +18261,9 @@ declare var WebGLShader: { } interface WebGLShaderPrecisionFormat { - precision: number; - rangeMax: number; - rangeMin: number; + readonly precision: number; + readonly rangeMax: number; + readonly rangeMin: number; } declare var WebGLShaderPrecisionFormat: { @@ -17235,21 +18339,21 @@ declare var WebKitPoint: { interface WebSocket extends EventTarget { binaryType: string; - bufferedAmount: number; - extensions: string; + readonly bufferedAmount: number; + readonly extensions: string; onclose: (ev: CloseEvent) => any; onerror: (ev: Event) => any; onmessage: (ev: MessageEvent) => any; onopen: (ev: Event) => any; - protocol: string; - readyState: number; - url: string; + readonly protocol: string; + readonly readyState: number; + readonly url: string; close(code?: number, reason?: string): void; send(data: any): void; - CLOSED: number; - CLOSING: number; - CONNECTING: number; - OPEN: number; + readonly CLOSED: number; + readonly CLOSING: number; + readonly CONNECTING: number; + readonly OPEN: number; addEventListener(type: "close", listener: (ev: CloseEvent) => any, useCapture?: boolean): void; addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: "message", listener: (ev: MessageEvent) => any, useCapture?: boolean): void; @@ -17260,56 +18364,58 @@ interface WebSocket extends EventTarget { declare var WebSocket: { prototype: WebSocket; new(url: string, protocols?: string | string[]): WebSocket; - CLOSED: number; - CLOSING: number; - CONNECTING: number; - OPEN: number; + readonly CLOSED: number; + readonly CLOSING: number; + readonly CONNECTING: number; + readonly OPEN: number; } interface WheelEvent extends MouseEvent { - deltaMode: number; - deltaX: number; - deltaY: number; - deltaZ: number; + readonly deltaMode: number; + readonly deltaX: number; + readonly deltaY: number; + readonly deltaZ: number; + readonly wheelDelta: number; + readonly wheelDeltaX: number; + readonly wheelDeltaY: number; getCurrentPoint(element: Element): void; 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; - DOM_DELTA_LINE: number; - DOM_DELTA_PAGE: number; - DOM_DELTA_PIXEL: number; + readonly DOM_DELTA_LINE: number; + readonly DOM_DELTA_PAGE: number; + readonly DOM_DELTA_PIXEL: number; } declare var WheelEvent: { prototype: WheelEvent; new(typeArg: string, eventInitDict?: WheelEventInit): WheelEvent; - DOM_DELTA_LINE: number; - DOM_DELTA_PAGE: number; - DOM_DELTA_PIXEL: number; + readonly DOM_DELTA_LINE: number; + readonly DOM_DELTA_PAGE: number; + readonly DOM_DELTA_PIXEL: number; } interface Window extends EventTarget, WindowTimers, WindowSessionStorage, WindowLocalStorage, WindowConsole, GlobalEventHandlers, IDBEnvironment, WindowBase64 { - animationStartTime: number; - applicationCache: ApplicationCache; - clientInformation: Navigator; - closed: boolean; - crypto: Crypto; + readonly applicationCache: ApplicationCache; + readonly clientInformation: Navigator; + readonly closed: boolean; + readonly crypto: Crypto; defaultStatus: string; - devicePixelRatio: number; - doNotTrack: string; - document: Document; + readonly devicePixelRatio: number; + readonly doNotTrack: string; + readonly document: Document; event: Event; - external: External; - frameElement: Element; - frames: Window; - history: History; - innerHeight: number; - innerWidth: number; - length: number; - location: Location; - locationbar: BarProp; - menubar: BarProp; - msAnimationStartTime: number; + readonly external: External; + readonly frameElement: Element; + readonly frames: Window; + readonly history: History; + readonly innerHeight: number; + readonly innerWidth: number; + readonly length: number; + readonly location: Location; + readonly locationbar: BarProp; + readonly menubar: BarProp; + readonly msCredentials: MSCredentials; name: string; - navigator: Navigator; + readonly navigator: Navigator; offscreenBuffering: string | boolean; onabort: (ev: Event) => any; onafterprint: (ev: Event) => any; @@ -17323,6 +18429,7 @@ interface Window extends EventTarget, WindowTimers, WindowSessionStorage, Window oncompassneedscalibration: (ev: Event) => any; oncontextmenu: (ev: PointerEvent) => any; ondblclick: (ev: MouseEvent) => any; + ondevicelight: (ev: DeviceLightEvent) => any; ondevicemotion: (ev: DeviceMotionEvent) => any; ondeviceorientation: (ev: DeviceOrientationEvent) => any; ondrag: (ev: DragEvent) => any; @@ -17334,11 +18441,12 @@ interface Window extends EventTarget, WindowTimers, WindowSessionStorage, Window ondrop: (ev: DragEvent) => any; ondurationchange: (ev: Event) => any; onemptied: (ev: Event) => any; - onended: (ev: Event) => any; + onended: (ev: MediaStreamErrorEvent) => any; onerror: ErrorEventHandler; onfocus: (ev: FocusEvent) => any; onhashchange: (ev: HashChangeEvent) => any; oninput: (ev: Event) => any; + oninvalid: (ev: Event) => any; onkeydown: (ev: KeyboardEvent) => any; onkeypress: (ev: KeyboardEvent) => any; onkeyup: (ev: KeyboardEvent) => any; @@ -17354,7 +18462,7 @@ interface Window extends EventTarget, WindowTimers, WindowSessionStorage, Window onmouseout: (ev: MouseEvent) => any; onmouseover: (ev: MouseEvent) => any; onmouseup: (ev: MouseEvent) => any; - onmousewheel: (ev: MouseWheelEvent) => any; + onmousewheel: (ev: WheelEvent) => any; onmsgesturechange: (ev: MSGestureEvent) => any; onmsgesturedoubletap: (ev: MSGestureEvent) => any; onmsgestureend: (ev: MSGestureEvent) => any; @@ -17393,38 +18501,38 @@ interface Window extends EventTarget, WindowTimers, WindowSessionStorage, Window onsubmit: (ev: Event) => any; onsuspend: (ev: Event) => any; ontimeupdate: (ev: Event) => any; - ontouchcancel: any; - ontouchend: any; - ontouchmove: any; - ontouchstart: any; + ontouchcancel: (ev: TouchEvent) => any; + ontouchend: (ev: TouchEvent) => any; + ontouchmove: (ev: TouchEvent) => any; + ontouchstart: (ev: TouchEvent) => any; onunload: (ev: Event) => any; onvolumechange: (ev: Event) => any; onwaiting: (ev: Event) => any; - opener: Window; + readonly opener: Window; orientation: string | number; - outerHeight: number; - outerWidth: number; - pageXOffset: number; - pageYOffset: number; - parent: Window; - performance: Performance; - personalbar: BarProp; - screen: Screen; - screenLeft: number; - screenTop: number; - screenX: number; - screenY: number; - scrollX: number; - scrollY: number; - scrollbars: BarProp; - self: Window; + readonly outerHeight: number; + readonly outerWidth: number; + readonly pageXOffset: number; + readonly pageYOffset: number; + readonly parent: Window; + readonly performance: Performance; + readonly personalbar: BarProp; + readonly screen: Screen; + readonly screenLeft: number; + readonly screenTop: number; + readonly screenX: number; + readonly screenY: number; + readonly scrollX: number; + readonly scrollY: number; + readonly scrollbars: BarProp; + readonly self: Window; status: string; - statusbar: BarProp; - styleMedia: StyleMedia; - toolbar: BarProp; - top: Window; - window: Window; - URL: URL; + readonly statusbar: BarProp; + readonly styleMedia: StyleMedia; + readonly toolbar: BarProp; + readonly top: Window; + readonly window: Window; + URL: typeof URL; alert(message?: any): void; blur(): void; cancelAnimationFrame(handle: number): void; @@ -17438,12 +18546,9 @@ interface Window extends EventTarget, WindowTimers, WindowSessionStorage, Window matchMedia(mediaQuery: string): MediaQueryList; moveBy(x?: number, y?: number): void; moveTo(x?: number, y?: number): void; - msCancelRequestAnimationFrame(handle: number): void; - msMatchMedia(mediaQuery: string): MediaQueryList; - msRequestAnimationFrame(callback: FrameRequestCallback): number; msWriteProfilerMark(profilerMarkName: string): void; open(url?: string, target?: string, features?: string, replace?: boolean): Window; - postMessage(message: any, targetOrigin: string, ports?: any): void; + postMessage(message: any, targetOrigin: string, transfer?: any[]): void; print(): void; prompt(message?: string, _default?: string): string; releaseEvents(): void; @@ -17453,8 +18558,10 @@ interface Window extends EventTarget, WindowTimers, WindowSessionStorage, Window scroll(x?: number, y?: number): void; scrollBy(x?: number, y?: number): void; scrollTo(x?: number, y?: number): void; + webkitCancelAnimationFrame(handle: number): void; webkitConvertPointFromNodeToPage(node: Node, pt: WebKitPoint): WebKitPoint; webkitConvertPointFromPageToNode(node: Node, pt: WebKitPoint): WebKitPoint; + webkitRequestAnimationFrame(callback: FrameRequestCallback): number; addEventListener(type: "MSGestureChange", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void; addEventListener(type: "MSGestureDoubleTap", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void; addEventListener(type: "MSGestureEnd", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void; @@ -17482,6 +18589,7 @@ interface Window extends EventTarget, WindowTimers, WindowSessionStorage, Window addEventListener(type: "compassneedscalibration", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "contextmenu", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; addEventListener(type: "dblclick", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "devicelight", listener: (ev: DeviceLightEvent) => any, useCapture?: boolean): void; addEventListener(type: "devicemotion", listener: (ev: DeviceMotionEvent) => any, useCapture?: boolean): void; addEventListener(type: "deviceorientation", listener: (ev: DeviceOrientationEvent) => any, useCapture?: boolean): void; addEventListener(type: "drag", listener: (ev: DragEvent) => any, useCapture?: boolean): void; @@ -17493,10 +18601,11 @@ interface Window extends EventTarget, WindowTimers, WindowSessionStorage, Window addEventListener(type: "drop", listener: (ev: DragEvent) => any, useCapture?: boolean): void; addEventListener(type: "durationchange", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "emptied", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "ended", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "ended", listener: (ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: "focus", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; addEventListener(type: "hashchange", listener: (ev: HashChangeEvent) => any, useCapture?: boolean): void; addEventListener(type: "input", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "invalid", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "keydown", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "keypress", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "keyup", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; @@ -17512,7 +18621,7 @@ interface Window extends EventTarget, WindowTimers, WindowSessionStorage, Window addEventListener(type: "mouseout", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "mouseover", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "mouseup", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousewheel", listener: (ev: MouseWheelEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mousewheel", listener: (ev: WheelEvent) => any, useCapture?: boolean): void; addEventListener(type: "offline", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "online", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "orientationchange", listener: (ev: Event) => any, useCapture?: boolean): void; @@ -17582,16 +18691,15 @@ declare var XMLDocument: { interface XMLHttpRequest extends EventTarget, XMLHttpRequestEventTarget { msCaching: string; onreadystatechange: (ev: ProgressEvent) => any; - readyState: number; - response: any; - responseBody: any; - responseText: string; + readonly readyState: number; + readonly response: any; + readonly responseText: string; responseType: string; - responseXML: any; - status: number; - statusText: string; + readonly responseXML: any; + readonly status: number; + readonly statusText: string; timeout: number; - upload: XMLHttpRequestUpload; + readonly upload: XMLHttpRequestUpload; withCredentials: boolean; abort(): void; getAllResponseHeaders(): string; @@ -17603,11 +18711,11 @@ interface XMLHttpRequest extends EventTarget, XMLHttpRequestEventTarget { send(data?: string): void; send(data?: any): void; setRequestHeader(header: string, value: string): void; - DONE: number; - HEADERS_RECEIVED: number; - LOADING: number; - OPENED: number; - UNSENT: number; + readonly DONE: number; + readonly HEADERS_RECEIVED: number; + readonly LOADING: number; + readonly OPENED: number; + readonly UNSENT: number; addEventListener(type: "abort", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: "load", listener: (ev: Event) => any, useCapture?: boolean): void; @@ -17622,11 +18730,11 @@ interface XMLHttpRequest extends EventTarget, XMLHttpRequestEventTarget { declare var XMLHttpRequest: { prototype: XMLHttpRequest; new(): XMLHttpRequest; - DONE: number; - HEADERS_RECEIVED: number; - LOADING: number; - OPENED: number; - UNSENT: number; + readonly DONE: number; + readonly HEADERS_RECEIVED: number; + readonly LOADING: number; + readonly OPENED: number; + readonly UNSENT: number; create(): XMLHttpRequest; } @@ -17678,40 +18786,40 @@ declare var XPathNSResolver: { } interface XPathResult { - booleanValue: boolean; - invalidIteratorState: boolean; - numberValue: number; - resultType: number; - singleNodeValue: Node; - snapshotLength: number; - stringValue: string; + readonly booleanValue: boolean; + readonly invalidIteratorState: boolean; + readonly numberValue: number; + readonly resultType: number; + readonly singleNodeValue: Node; + readonly snapshotLength: number; + readonly stringValue: string; iterateNext(): Node; snapshotItem(index: number): Node; - ANY_TYPE: number; - ANY_UNORDERED_NODE_TYPE: number; - BOOLEAN_TYPE: number; - FIRST_ORDERED_NODE_TYPE: number; - NUMBER_TYPE: number; - ORDERED_NODE_ITERATOR_TYPE: number; - ORDERED_NODE_SNAPSHOT_TYPE: number; - STRING_TYPE: number; - UNORDERED_NODE_ITERATOR_TYPE: number; - UNORDERED_NODE_SNAPSHOT_TYPE: number; + readonly ANY_TYPE: number; + readonly ANY_UNORDERED_NODE_TYPE: number; + readonly BOOLEAN_TYPE: number; + readonly FIRST_ORDERED_NODE_TYPE: number; + readonly NUMBER_TYPE: number; + readonly ORDERED_NODE_ITERATOR_TYPE: number; + readonly ORDERED_NODE_SNAPSHOT_TYPE: number; + readonly STRING_TYPE: number; + readonly UNORDERED_NODE_ITERATOR_TYPE: number; + readonly UNORDERED_NODE_SNAPSHOT_TYPE: number; } declare var XPathResult: { prototype: XPathResult; new(): XPathResult; - ANY_TYPE: number; - ANY_UNORDERED_NODE_TYPE: number; - BOOLEAN_TYPE: number; - FIRST_ORDERED_NODE_TYPE: number; - NUMBER_TYPE: number; - ORDERED_NODE_ITERATOR_TYPE: number; - ORDERED_NODE_SNAPSHOT_TYPE: number; - STRING_TYPE: number; - UNORDERED_NODE_ITERATOR_TYPE: number; - UNORDERED_NODE_SNAPSHOT_TYPE: number; + readonly ANY_TYPE: number; + readonly ANY_UNORDERED_NODE_TYPE: number; + readonly BOOLEAN_TYPE: number; + readonly FIRST_ORDERED_NODE_TYPE: number; + readonly NUMBER_TYPE: number; + readonly ORDERED_NODE_ITERATOR_TYPE: number; + readonly ORDERED_NODE_SNAPSHOT_TYPE: number; + readonly STRING_TYPE: number; + readonly UNORDERED_NODE_ITERATOR_TYPE: number; + readonly UNORDERED_NODE_SNAPSHOT_TYPE: number; } interface XSLTProcessor { @@ -17736,6 +18844,18 @@ interface AbstractWorker { addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } +interface CanvasPathMethods { + arc(x: number, y: number, radius: number, startAngle: number, endAngle: number, anticlockwise?: boolean): void; + arcTo(x1: number, y1: number, x2: number, y2: number, radius: number): void; + bezierCurveTo(cp1x: number, cp1y: number, cp2x: number, cp2y: number, x: number, y: number): void; + closePath(): void; + ellipse(x: number, y: number, radiusX: number, radiusY: number, rotation: number, startAngle: number, endAngle: number, anticlockwise?: boolean): void; + lineTo(x: number, y: number): void; + moveTo(x: number, y: number): void; + quadraticCurveTo(cpx: number, cpy: number, x: number, y: number): void; + rect(x: number, y: number, w: number, h: number): void; +} + interface ChildNode { remove(): void; } @@ -17758,6 +18878,7 @@ interface DocumentEvent { createEvent(eventInterface:"CommandEvent"): CommandEvent; createEvent(eventInterface:"CompositionEvent"): CompositionEvent; createEvent(eventInterface:"CustomEvent"): CustomEvent; + createEvent(eventInterface:"DeviceLightEvent"): DeviceLightEvent; createEvent(eventInterface:"DeviceMotionEvent"): DeviceMotionEvent; createEvent(eventInterface:"DeviceOrientationEvent"): DeviceOrientationEvent; createEvent(eventInterface:"DragEvent"): DragEvent; @@ -17769,6 +18890,7 @@ interface DocumentEvent { createEvent(eventInterface:"HashChangeEvent"): HashChangeEvent; createEvent(eventInterface:"IDBVersionChangeEvent"): IDBVersionChangeEvent; createEvent(eventInterface:"KeyboardEvent"): KeyboardEvent; + createEvent(eventInterface:"ListeningStateChangedEvent"): ListeningStateChangedEvent; createEvent(eventInterface:"LongRunningScriptDetectedEvent"): LongRunningScriptDetectedEvent; createEvent(eventInterface:"MSGestureEvent"): MSGestureEvent; createEvent(eventInterface:"MSManipulationEvent"): MSManipulationEvent; @@ -17776,21 +18898,31 @@ interface DocumentEvent { createEvent(eventInterface:"MSMediaKeyNeededEvent"): MSMediaKeyNeededEvent; createEvent(eventInterface:"MSPointerEvent"): MSPointerEvent; createEvent(eventInterface:"MSSiteModeEvent"): MSSiteModeEvent; + createEvent(eventInterface:"MediaEncryptedEvent"): MediaEncryptedEvent; + createEvent(eventInterface:"MediaKeyMessageEvent"): MediaKeyMessageEvent; + createEvent(eventInterface:"MediaStreamErrorEvent"): MediaStreamErrorEvent; + createEvent(eventInterface:"MediaStreamTrackEvent"): MediaStreamTrackEvent; createEvent(eventInterface:"MessageEvent"): MessageEvent; createEvent(eventInterface:"MouseEvent"): MouseEvent; createEvent(eventInterface:"MouseEvents"): MouseEvent; - createEvent(eventInterface:"MouseWheelEvent"): MouseWheelEvent; createEvent(eventInterface:"MutationEvent"): MutationEvent; createEvent(eventInterface:"MutationEvents"): MutationEvent; createEvent(eventInterface:"NavigationCompletedEvent"): NavigationCompletedEvent; createEvent(eventInterface:"NavigationEvent"): NavigationEvent; createEvent(eventInterface:"NavigationEventWithReferrer"): NavigationEventWithReferrer; createEvent(eventInterface:"OfflineAudioCompletionEvent"): OfflineAudioCompletionEvent; + createEvent(eventInterface:"OverflowEvent"): OverflowEvent; createEvent(eventInterface:"PageTransitionEvent"): PageTransitionEvent; createEvent(eventInterface:"PermissionRequestedEvent"): PermissionRequestedEvent; createEvent(eventInterface:"PointerEvent"): PointerEvent; createEvent(eventInterface:"PopStateEvent"): PopStateEvent; createEvent(eventInterface:"ProgressEvent"): ProgressEvent; + createEvent(eventInterface:"RTCDTMFToneChangeEvent"): RTCDTMFToneChangeEvent; + createEvent(eventInterface:"RTCDtlsTransportStateChangedEvent"): RTCDtlsTransportStateChangedEvent; + createEvent(eventInterface:"RTCIceCandidatePairChangedEvent"): RTCIceCandidatePairChangedEvent; + createEvent(eventInterface:"RTCIceGathererEvent"): RTCIceGathererEvent; + createEvent(eventInterface:"RTCIceTransportStateChangedEvent"): RTCIceTransportStateChangedEvent; + createEvent(eventInterface:"RTCSsrcConflictEvent"): RTCSsrcConflictEvent; createEvent(eventInterface:"SVGZoomEvent"): SVGZoomEvent; createEvent(eventInterface:"SVGZoomEvents"): SVGZoomEvent; createEvent(eventInterface:"ScriptNotifyEvent"): ScriptNotifyEvent; @@ -17808,11 +18940,11 @@ interface DocumentEvent { } interface ElementTraversal { - childElementCount: number; - firstElementChild: Element; - lastElementChild: Element; - nextElementSibling: Element; - previousElementSibling: Element; + readonly childElementCount: number; + readonly firstElementChild: Element; + readonly lastElementChild: Element; + readonly nextElementSibling: Element; + readonly previousElementSibling: Element; } interface GetSVGDocument { @@ -17857,12 +18989,11 @@ interface HTMLTableAlignment { } interface IDBEnvironment { - indexedDB: IDBFactory; - msIndexedDB: IDBFactory; + readonly indexedDB: IDBFactory; } interface LinkStyle { - sheet: StyleSheet; + readonly sheet: StyleSheet; } interface MSBaseReader { @@ -17872,12 +19003,12 @@ interface MSBaseReader { onloadend: (ev: ProgressEvent) => any; onloadstart: (ev: Event) => any; onprogress: (ev: ProgressEvent) => any; - readyState: number; - result: any; + readonly readyState: number; + readonly result: any; abort(): void; - DONE: number; - EMPTY: number; - LOADING: number; + readonly DONE: number; + readonly EMPTY: number; + readonly LOADING: number; addEventListener(type: "abort", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: "load", listener: (ev: Event) => any, useCapture?: boolean): void; @@ -17905,27 +19036,32 @@ interface NavigatorContentUtils { } interface NavigatorGeolocation { - geolocation: Geolocation; + readonly geolocation: Geolocation; } interface NavigatorID { - appName: string; - appVersion: string; - platform: string; - product: string; - productSub: string; - userAgent: string; - vendor: string; - vendorSub: string; + readonly appName: string; + readonly appVersion: string; + readonly platform: string; + readonly product: string; + readonly productSub: string; + readonly userAgent: string; + readonly vendor: string; + readonly vendorSub: string; } interface NavigatorOnLine { - onLine: boolean; + readonly onLine: boolean; } interface NavigatorStorageUtils { } +interface NavigatorUserMedia { + readonly mediaDevices: MediaDevices; + getUserMedia(constraints: MediaStreamConstraints, successCallback: NavigatorUserMediaSuccessCallback, errorCallback: NavigatorUserMediaErrorCallback): void; +} + interface NodeSelector { querySelector(selectors: string): Element; querySelectorAll(selectors: string): NodeListOf; @@ -17936,29 +19072,29 @@ interface RandomSource { } interface SVGAnimatedPathData { - pathSegList: SVGPathSegList; + readonly pathSegList: SVGPathSegList; } interface SVGAnimatedPoints { - animatedPoints: SVGPointList; - points: SVGPointList; + readonly animatedPoints: SVGPointList; + readonly points: SVGPointList; } interface SVGExternalResourcesRequired { - externalResourcesRequired: SVGAnimatedBoolean; + readonly externalResourcesRequired: SVGAnimatedBoolean; } interface SVGFilterPrimitiveStandardAttributes extends SVGStylable { - height: SVGAnimatedLength; - result: SVGAnimatedString; - width: SVGAnimatedLength; - x: SVGAnimatedLength; - y: SVGAnimatedLength; + readonly height: SVGAnimatedLength; + readonly result: SVGAnimatedString; + readonly width: SVGAnimatedLength; + readonly x: SVGAnimatedLength; + readonly y: SVGAnimatedLength; } interface SVGFitToViewBox { - preserveAspectRatio: SVGAnimatedPreserveAspectRatio; - viewBox: SVGAnimatedRect; + readonly preserveAspectRatio: SVGAnimatedPreserveAspectRatio; + readonly viewBox: SVGAnimatedRect; } interface SVGLangSpace { @@ -17967,8 +19103,8 @@ interface SVGLangSpace { } interface SVGLocatable { - farthestViewportElement: SVGElement; - nearestViewportElement: SVGElement; + readonly farthestViewportElement: SVGElement; + readonly nearestViewportElement: SVGElement; getBBox(): SVGRect; getCTM(): SVGMatrix; getScreenCTM(): SVGMatrix; @@ -17977,22 +19113,22 @@ interface SVGLocatable { interface SVGStylable { className: any; - style: CSSStyleDeclaration; + readonly style: CSSStyleDeclaration; } interface SVGTests { - requiredExtensions: SVGStringList; - requiredFeatures: SVGStringList; - systemLanguage: SVGStringList; + readonly requiredExtensions: SVGStringList; + readonly requiredFeatures: SVGStringList; + readonly systemLanguage: SVGStringList; hasExtension(extension: string): boolean; } interface SVGTransformable extends SVGLocatable { - transform: SVGAnimatedTransformList; + readonly transform: SVGAnimatedTransformList; } interface SVGURIReference { - href: SVGAnimatedString; + readonly href: SVGAnimatedString; } interface WindowBase64 { @@ -18001,15 +19137,15 @@ interface WindowBase64 { } interface WindowConsole { - console: Console; + readonly console: Console; } interface WindowLocalStorage { - localStorage: Storage; + readonly localStorage: Storage; } interface WindowSessionStorage { - sessionStorage: Storage; + readonly sessionStorage: Storage; } interface WindowTimers extends Object, WindowTimersExtension { @@ -18021,8 +19157,6 @@ interface WindowTimers extends Object, WindowTimersExtension { interface WindowTimersExtension { clearImmediate(handle: number): void; - msClearImmediate(handle: number): void; - msSetImmediate(expression: any, ...args: any[]): number; setImmediate(expression: any, ...args: any[]): number; } @@ -18052,22 +19186,18 @@ interface StorageEventInit extends EventInit { storageArea?: Storage; } -interface IDBObjectStoreParameters { - keyPath?: string | string[]; - autoIncrement?: boolean; -} - -interface IDBIndexParameters { - unique?: boolean; - multiEntry?: boolean; -} - interface NodeListOf extends NodeList { length: number; item(index: number): TNode; [index: number]: TNode; } +interface HTMLCollectionOf extends HTMLCollection { + item(index: number): T; + namedItem(name: string): T; + [index: number]: T; +} + interface BlobPropertyBag { type?: string; endings?: string; @@ -18097,15 +19227,6 @@ interface ProgressEventInit extends EventInit { total?: number; } -interface HTMLTemplateElement extends HTMLElement { - content: DocumentFragment; -} - -declare var HTMLTemplateElement: { - prototype: HTMLTemplateElement; - new(): HTMLTemplateElement; -} - interface HTMLPictureElement extends HTMLElement { } @@ -18114,6 +19235,14 @@ declare var HTMLPictureElement: { new(): HTMLPictureElement; } +interface ClipboardEventInit extends EventInit { + data?: string; + dataType?: string; +} + +interface IDBArrayKey extends Array { +} + declare type EventListenerOrEventListenerObject = EventListener | EventListenerObject; interface ErrorEventHandler { @@ -18152,10 +19281,18 @@ interface DecodeErrorCallback { interface FunctionStringCallback { (data: string): void; } +interface NavigatorUserMediaSuccessCallback { + (stream: MediaStream): void; +} +interface NavigatorUserMediaErrorCallback { + (error: MediaStreamError): void; +} +interface ForEachCallback { + (keyId: any, status: string): void; +} declare var Audio: {new(src?: string): HTMLAudioElement; }; declare var Image: {new(width?: number, height?: number): HTMLImageElement; }; declare var Option: {new(text?: string, value?: string, defaultSelected?: boolean, selected?: boolean): HTMLOptionElement; }; -declare var animationStartTime: number; declare var applicationCache: ApplicationCache; declare var clientInformation: Navigator; declare var closed: boolean; @@ -18175,7 +19312,7 @@ declare var length: number; declare var location: Location; declare var locationbar: BarProp; declare var menubar: BarProp; -declare var msAnimationStartTime: number; +declare var msCredentials: MSCredentials; declare var name: string; declare var navigator: Navigator; declare var offscreenBuffering: string | boolean; @@ -18191,6 +19328,7 @@ declare var onclick: (ev: MouseEvent) => any; declare var oncompassneedscalibration: (ev: Event) => any; declare var oncontextmenu: (ev: PointerEvent) => any; declare var ondblclick: (ev: MouseEvent) => any; +declare var ondevicelight: (ev: DeviceLightEvent) => any; declare var ondevicemotion: (ev: DeviceMotionEvent) => any; declare var ondeviceorientation: (ev: DeviceOrientationEvent) => any; declare var ondrag: (ev: DragEvent) => any; @@ -18202,11 +19340,12 @@ declare var ondragstart: (ev: DragEvent) => any; declare var ondrop: (ev: DragEvent) => any; declare var ondurationchange: (ev: Event) => any; declare var onemptied: (ev: Event) => any; -declare var onended: (ev: Event) => any; +declare var onended: (ev: MediaStreamErrorEvent) => any; declare var onerror: ErrorEventHandler; declare var onfocus: (ev: FocusEvent) => any; declare var onhashchange: (ev: HashChangeEvent) => any; declare var oninput: (ev: Event) => any; +declare var oninvalid: (ev: Event) => any; declare var onkeydown: (ev: KeyboardEvent) => any; declare var onkeypress: (ev: KeyboardEvent) => any; declare var onkeyup: (ev: KeyboardEvent) => any; @@ -18222,7 +19361,7 @@ declare var onmousemove: (ev: MouseEvent) => any; declare var onmouseout: (ev: MouseEvent) => any; declare var onmouseover: (ev: MouseEvent) => any; declare var onmouseup: (ev: MouseEvent) => any; -declare var onmousewheel: (ev: MouseWheelEvent) => any; +declare var onmousewheel: (ev: WheelEvent) => any; declare var onmsgesturechange: (ev: MSGestureEvent) => any; declare var onmsgesturedoubletap: (ev: MSGestureEvent) => any; declare var onmsgestureend: (ev: MSGestureEvent) => any; @@ -18261,10 +19400,10 @@ declare var onstorage: (ev: StorageEvent) => any; declare var onsubmit: (ev: Event) => any; declare var onsuspend: (ev: Event) => any; declare var ontimeupdate: (ev: Event) => any; -declare var ontouchcancel: any; -declare var ontouchend: any; -declare var ontouchmove: any; -declare var ontouchstart: any; +declare var ontouchcancel: (ev: TouchEvent) => any; +declare var ontouchend: (ev: TouchEvent) => any; +declare var ontouchmove: (ev: TouchEvent) => any; +declare var ontouchstart: (ev: TouchEvent) => any; declare var onunload: (ev: Event) => any; declare var onvolumechange: (ev: Event) => any; declare var onwaiting: (ev: Event) => any; @@ -18292,7 +19431,6 @@ declare var styleMedia: StyleMedia; declare var toolbar: BarProp; declare var top: Window; declare var window: Window; -declare var URL: URL; declare function alert(message?: any): void; declare function blur(): void; declare function cancelAnimationFrame(handle: number): void; @@ -18306,12 +19444,9 @@ declare function getSelection(): Selection; declare function matchMedia(mediaQuery: string): MediaQueryList; declare function moveBy(x?: number, y?: number): void; declare function moveTo(x?: number, y?: number): void; -declare function msCancelRequestAnimationFrame(handle: number): void; -declare function msMatchMedia(mediaQuery: string): MediaQueryList; -declare function msRequestAnimationFrame(callback: FrameRequestCallback): number; declare function msWriteProfilerMark(profilerMarkName: string): void; declare function open(url?: string, target?: string, features?: string, replace?: boolean): Window; -declare function postMessage(message: any, targetOrigin: string, ports?: any): void; +declare function postMessage(message: any, targetOrigin: string, transfer?: any[]): void; declare function print(): void; declare function prompt(message?: string, _default?: string): string; declare function releaseEvents(): void; @@ -18321,19 +19456,19 @@ declare function resizeTo(x?: number, y?: number): void; declare function scroll(x?: number, y?: number): void; declare function scrollBy(x?: number, y?: number): void; declare function scrollTo(x?: number, y?: number): void; +declare function webkitCancelAnimationFrame(handle: number): void; declare function webkitConvertPointFromNodeToPage(node: Node, pt: WebKitPoint): WebKitPoint; declare function webkitConvertPointFromPageToNode(node: Node, pt: WebKitPoint): WebKitPoint; +declare function webkitRequestAnimationFrame(callback: FrameRequestCallback): number; declare function toString(): string; -declare function addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +declare function addEventListener(type: string, listener?: EventListenerOrEventListenerObject, useCapture?: boolean): void; declare function dispatchEvent(evt: Event): boolean; -declare function removeEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +declare function removeEventListener(type: string, listener?: EventListenerOrEventListenerObject, useCapture?: boolean): void; declare function clearInterval(handle: number): void; declare function clearTimeout(handle: number): void; declare function setInterval(handler: any, timeout?: any, ...args: any[]): number; declare function setTimeout(handler: any, timeout?: any, ...args: any[]): number; declare function clearImmediate(handle: number): void; -declare function msClearImmediate(handle: number): void; -declare function msSetImmediate(expression: any, ...args: any[]): number; declare function setImmediate(expression: any, ...args: any[]): number; declare var sessionStorage: Storage; declare var localStorage: Storage; @@ -18348,7 +19483,6 @@ declare var onpointerover: (ev: PointerEvent) => any; declare var onpointerup: (ev: PointerEvent) => any; declare var onwheel: (ev: WheelEvent) => any; declare var indexedDB: IDBFactory; -declare var msIndexedDB: IDBFactory; declare function atob(encodedString: string): string; declare function btoa(rawString: string): string; declare function addEventListener(type: "MSGestureChange", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void; @@ -18378,6 +19512,7 @@ declare function addEventListener(type: "click", listener: (ev: MouseEvent) => a declare function addEventListener(type: "compassneedscalibration", listener: (ev: Event) => any, useCapture?: boolean): void; declare function addEventListener(type: "contextmenu", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; declare function addEventListener(type: "dblclick", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "devicelight", listener: (ev: DeviceLightEvent) => any, useCapture?: boolean): void; declare function addEventListener(type: "devicemotion", listener: (ev: DeviceMotionEvent) => any, useCapture?: boolean): void; declare function addEventListener(type: "deviceorientation", listener: (ev: DeviceOrientationEvent) => any, useCapture?: boolean): void; declare function addEventListener(type: "drag", listener: (ev: DragEvent) => any, useCapture?: boolean): void; @@ -18389,10 +19524,11 @@ declare function addEventListener(type: "dragstart", listener: (ev: DragEvent) = declare function addEventListener(type: "drop", listener: (ev: DragEvent) => any, useCapture?: boolean): void; declare function addEventListener(type: "durationchange", listener: (ev: Event) => any, useCapture?: boolean): void; declare function addEventListener(type: "emptied", listener: (ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "ended", listener: (ev: Event) => any, useCapture?: boolean): void; +declare function addEventListener(type: "ended", listener: (ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; declare function addEventListener(type: "focus", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; declare function addEventListener(type: "hashchange", listener: (ev: HashChangeEvent) => any, useCapture?: boolean): void; declare function addEventListener(type: "input", listener: (ev: Event) => any, useCapture?: boolean): void; +declare function addEventListener(type: "invalid", listener: (ev: Event) => any, useCapture?: boolean): void; declare function addEventListener(type: "keydown", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; declare function addEventListener(type: "keypress", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; declare function addEventListener(type: "keyup", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; @@ -18408,7 +19544,7 @@ declare function addEventListener(type: "mousemove", listener: (ev: MouseEvent) declare function addEventListener(type: "mouseout", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; declare function addEventListener(type: "mouseover", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; declare function addEventListener(type: "mouseup", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "mousewheel", listener: (ev: MouseWheelEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "mousewheel", listener: (ev: WheelEvent) => any, useCapture?: boolean): void; declare function addEventListener(type: "offline", listener: (ev: Event) => any, useCapture?: boolean): void; declare function addEventListener(type: "online", listener: (ev: Event) => any, useCapture?: boolean): void; declare function addEventListener(type: "orientationchange", listener: (ev: Event) => any, useCapture?: boolean): void; @@ -18444,18 +19580,39 @@ declare function addEventListener(type: "unload", listener: (ev: Event) => any, declare function addEventListener(type: "volumechange", listener: (ev: Event) => any, useCapture?: boolean): void; declare function addEventListener(type: "waiting", listener: (ev: Event) => any, useCapture?: boolean): void; declare function addEventListener(type: "wheel", listener: (ev: WheelEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;interface DOMTokenList { - [Symbol.iterator](): IterableIterator; -} - -interface NodeList { - [Symbol.iterator](): IterableIterator -} - -interface NodeListOf { - [Symbol.iterator](): IterableIterator -} - +declare function addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +type AAGUID = string; +type AlgorithmIdentifier = string | Algorithm; +type ConstrainBoolean = boolean | ConstrainBooleanParameters; +type ConstrainDOMString = string | string[] | ConstrainDOMStringParameters; +type ConstrainDouble = number | ConstrainDoubleRange; +type ConstrainLong = number | ConstrainLongRange; +type CryptoOperationData = ArrayBufferView; +type GLbitfield = number; +type GLboolean = boolean; +type GLbyte = number; +type GLclampf = number; +type GLenum = number; +type GLfloat = number; +type GLint = number; +type GLintptr = number; +type GLshort = number; +type GLsizei = number; +type GLsizeiptr = number; +type GLubyte = number; +type GLuint = number; +type GLushort = number; +type IDBKeyPath = string; +type KeyFormat = string; +type KeyType = string; +type KeyUsage = string; +type MSInboundPayload = MSVideoRecvPayload | MSAudioRecvPayload; +type MSLocalClientEvent = MSLocalClientEventBase | MSAudioLocalClientEvent; +type MSOutboundPayload = MSVideoSendPayload | MSAudioSendPayload; +type RTCIceGatherCandidate = RTCIceCandidate | RTCIceCandidateComplete; +type RTCTransport = RTCDtlsTransport | RTCSrtpSdesTransport; +type payloadtype = number; +type IDBValidKey = number | string | Date | IDBArrayKey; ///////////////////////////// /// WorkerGlobalScope APIs ///////////////////////////// diff --git a/lib/lib.es7.d.ts b/lib/lib.es7.d.ts deleted file mode 100644 index 4da974fb3bc..00000000000 --- a/lib/lib.es7.d.ts +++ /dev/null @@ -1,18829 +0,0 @@ -/*! ***************************************************************************** -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 type PropertyKey = string | number | symbol; - -interface Symbol { - /** Returns a string representation of an object. */ - toString(): string; - - /** Returns the primitive value of the specified object. */ - valueOf(): Object; - - readonly [Symbol.toStringTag]: "Symbol"; -} - -interface SymbolConstructor { - /** - * A reference to the prototype. - */ - readonly prototype: Symbol; - - /** - * Returns a new unique Symbol value. - * @param description Description of the new Symbol object. - */ - (description?: string|number): symbol; - - /** - * Returns a Symbol object from the global symbol registry matching the given key if found. - * Otherwise, returns a new symbol with this key. - * @param key key to search for. - */ - for(key: string): symbol; - - /** - * Returns a key from the global symbol registry matching the given Symbol if found. - * Otherwise, returns a undefined. - * @param sym Symbol to find the key for. - */ - keyFor(sym: symbol): string; - - // Well-known Symbols - - /** - * A method that determines if a constructor object recognizes an object as one of the - * constructor’s instances. Called by the semantics of the instanceof operator. - */ - readonly hasInstance: symbol; - - /** - * A Boolean value that if true indicates that an object should flatten to its array elements - * by Array.prototype.concat. - */ - readonly isConcatSpreadable: symbol; - - /** - * A method that returns the default iterator for an object. Called by the semantics of the - * for-of statement. - */ - readonly iterator: symbol; - - /** - * A regular expression method that matches the regular expression against a string. Called - * by the String.prototype.match method. - */ - readonly match: symbol; - - /** - * A regular expression method that replaces matched substrings of a string. Called by the - * String.prototype.replace method. - */ - readonly replace: symbol; - - /** - * A regular expression method that returns the index within a string that matches the - * regular expression. Called by the String.prototype.search method. - */ - readonly search: symbol; - - /** - * A function valued property that is the constructor function that is used to create - * derived objects. - */ - readonly species: symbol; - - /** - * A regular expression method that splits a string at the indices that match the regular - * expression. Called by the String.prototype.split method. - */ - readonly split: symbol; - - /** - * A method that converts an object to a corresponding primitive value. - * Called by the ToPrimitive abstract operation. - */ - readonly toPrimitive: symbol; - - /** - * A String value that is used in the creation of the default string description of an object. - * Called by the built-in method Object.prototype.toString. - */ - readonly toStringTag: symbol; - - /** - * An Object whose own property names are property names that are excluded from the 'with' - * environment bindings of the associated objects. - */ - readonly unscopables: symbol; -} -declare var Symbol: SymbolConstructor; - -interface Object { - /** - * Determines whether an object has a property with the specified name. - * @param v A property name. - */ - hasOwnProperty(v: PropertyKey): boolean; - - /** - * Determines whether a specified property is enumerable. - * @param v A property name. - */ - propertyIsEnumerable(v: PropertyKey): boolean; -} - -interface ObjectConstructor { - /** - * Copy the values of all of the enumerable own properties from one or more source objects to a - * target object. Returns the target object. - * @param target The target object to copy to. - * @param source The source object from which to copy properties. - */ - assign(target: T, source: U): T & U; - - /** - * Copy the values of all of the enumerable own properties from one or more source objects to a - * target object. Returns the target object. - * @param target The target object to copy to. - * @param source1 The first source object from which to copy properties. - * @param source2 The second source object from which to copy properties. - */ - assign(target: T, source1: U, source2: V): T & U & V; - - /** - * Copy the values of all of the enumerable own properties from one or more source objects to a - * target object. Returns the target object. - * @param target The target object to copy to. - * @param source1 The first source object from which to copy properties. - * @param source2 The second source object from which to copy properties. - * @param source3 The third source object from which to copy properties. - */ - assign(target: T, source1: U, source2: V, source3: W): T & U & V & W; - - /** - * Copy the values of all of the enumerable own properties from one or more source objects to a - * target object. Returns the target object. - * @param target The target object to copy to. - * @param sources One or more source objects from which to copy properties - */ - assign(target: any, ...sources: any[]): any; - - /** - * Returns an array of all symbol properties found directly on object o. - * @param o Object to retrieve the symbols from. - */ - getOwnPropertySymbols(o: any): symbol[]; - - /** - * Returns true if the values are the same value, false otherwise. - * @param value1 The first value. - * @param value2 The second value. - */ - is(value1: any, value2: any): boolean; - - /** - * Sets the prototype of a specified object o to object proto or null. Returns the object o. - * @param o The object to change its prototype. - * @param proto The value of the new prototype or null. - */ - setPrototypeOf(o: any, proto: any): any; - - /** - * Gets the own property descriptor of the specified object. - * An own property descriptor is one that is defined directly on the object and is not - * inherited from the object's prototype. - * @param o Object that contains the property. - * @param p Name of the property. - */ - getOwnPropertyDescriptor(o: any, propertyKey: PropertyKey): PropertyDescriptor; - - /** - * Adds a property to an object, or modifies attributes of an existing property. - * @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. - * @param p The property name. - * @param attributes Descriptor for the property. It can be for a data property or an accessor - * property. - */ - defineProperty(o: any, propertyKey: PropertyKey, attributes: PropertyDescriptor): any; -} - -interface Function { - /** - * Returns the name of the function. Function names are read-only and can not be changed. - */ - readonly name: string; - - /** - * Determines whether the given value inherits from this function if this function was used - * as a constructor function. - * - * A constructor function can control which objects are recognized as its instances by - * 'instanceof' by overriding this method. - */ - [Symbol.hasInstance](value: any): boolean; -} - -interface NumberConstructor { - /** - * The value of Number.EPSILON is the difference between 1 and the smallest value greater than 1 - * that is representable as a Number value, which is approximately: - * 2.2204460492503130808472633361816 x 10‍−‍16. - */ - readonly EPSILON: number; - - /** - * Returns true if passed value is finite. - * Unlike the global isFininte, Number.isFinite doesn't forcibly convert the parameter to a - * number. Only finite values of the type number, result in true. - * @param number A numeric value. - */ - isFinite(number: number): boolean; - - /** - * Returns true if the value passed is an integer, false otherwise. - * @param number A numeric value. - */ - isInteger(number: number): boolean; - - /** - * Returns a Boolean value that indicates whether a value is the reserved value NaN (not a - * number). Unlike the global isNaN(), Number.isNaN() doesn't forcefully convert the parameter - * to a number. Only values of the type number, that are also NaN, result in true. - * @param number A numeric value. - */ - isNaN(number: number): boolean; - - /** - * Returns true if the value passed is a safe integer. - * @param number A numeric value. - */ - isSafeInteger(number: number): boolean; - - /** - * The value of the largest integer n such that n and n + 1 are both exactly representable as - * a Number value. - * The value of Number.MIN_SAFE_INTEGER is 9007199254740991 2^53 − 1. - */ - readonly MAX_SAFE_INTEGER: number; - - /** - * The value of the smallest integer n such that n and n − 1 are both exactly representable as - * a Number value. - * The value of Number.MIN_SAFE_INTEGER is −9007199254740991 (−(2^53 − 1)). - */ - readonly MIN_SAFE_INTEGER: number; - - /** - * Converts a string to a floating-point number. - * @param string A string that contains a floating-point number. - */ - parseFloat(string: string): number; - - /** - * Converts A string to an integer. - * @param s A string to convert into a number. - * @param radix A value between 2 and 36 that specifies the base of the number in numString. - * If this argument is not supplied, strings with a prefix of '0x' are considered hexadecimal. - * All other strings are considered decimal. - */ - parseInt(string: string, radix?: number): number; -} - -interface Array { - /** Iterator */ - [Symbol.iterator](): IterableIterator; - - /** - * Returns an object whose properties have the value 'true' - * when they will be absent when used in a 'with' statement. - */ - [Symbol.unscopables](): { - copyWithin: boolean; - entries: boolean; - fill: boolean; - find: boolean; - findIndex: boolean; - keys: boolean; - values: boolean; - }; - - /** - * Returns an array of key, value pairs for every entry in the array - */ - entries(): IterableIterator<[number, T]>; - - /** - * Returns an list of keys in the array - */ - keys(): IterableIterator; - - /** - * Returns an list of values in the array - */ - values(): IterableIterator; - - /** - * Returns the value of the first element in the array where predicate is true, and undefined - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - find(predicate: (value: T, index: number, obj: Array) => boolean, thisArg?: any): T; - - /** - * Returns the index of the first element in the array where predicate is true, and undefined - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - findIndex(predicate: (value: T) => boolean, thisArg?: any): number; - - /** - * Returns the this object after filling the section identified by start and end with value - * @param value value to fill array section with - * @param start index to start filling the array at. If start is negative, it is treated as - * length+start where length is the length of the array. - * @param end index to stop filling the array at. If end is negative, it is treated as - * length+end. - */ - fill(value: T, start?: number, end?: number): T[]; - - /** - * Returns the this object after copying a section of the array identified by start and end - * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it - * is treated as length+end. - * @param end If not specified, length of the this object is used as its default value. - */ - copyWithin(target: number, start: number, end?: number): T[]; -} - -interface IArguments { - /** Iterator */ - [Symbol.iterator](): IterableIterator; -} - -interface ArrayConstructor { - /** - * Creates an array from an array-like object. - * @param arrayLike An array-like object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(arrayLike: ArrayLike, mapfn: (v: T, k: number) => U, thisArg?: any): Array; - - /** - * Creates an array from an iterable object. - * @param iterable An iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(iterable: Iterable, mapfn: (v: T, k: number) => U, thisArg?: any): Array; - - /** - * Creates an array from an array-like object. - * @param arrayLike An array-like object to convert to an array. - */ - from(arrayLike: ArrayLike): Array; - - /** - * Creates an array from an iterable object. - * @param iterable An iterable object to convert to an array. - */ - from(iterable: Iterable): Array; - - /** - * Returns a new array from a set of elements. - * @param items A set of elements to include in the new array object. - */ - of(...items: T[]): Array; -} - -interface String { - /** Iterator */ - [Symbol.iterator](): IterableIterator; - - /** - * Returns a nonnegative integer Number less than 1114112 (0x110000) that is the code point - * value of the UTF-16 encoded code point starting at the string element at position pos in - * the String resulting from converting this object to a String. - * If there is no element at that position, the result is undefined. - * If a valid UTF-16 surrogate pair does not begin at pos, the result is the code unit at pos. - */ - codePointAt(pos: number): number; - - /** - * Returns true if searchString appears as a substring of the result of converting this - * object to a String, at one or more positions that are - * greater than or equal to position; otherwise, returns false. - * @param searchString search string - * @param position If position is undefined, 0 is assumed, so as to search all of the String. - */ - includes(searchString: string, position?: number): boolean; - - /** - * Returns true if the sequence of elements of searchString converted to a String is the - * same as the corresponding elements of this object (converted to a String) starting at - * endPosition – length(this). Otherwise returns false. - */ - endsWith(searchString: string, endPosition?: number): boolean; - - /** - * Returns the String value result of normalizing the string into the normalization form - * named by form as specified in Unicode Standard Annex #15, Unicode Normalization Forms. - * @param form Applicable values: "NFC", "NFD", "NFKC", or "NFKD", If not specified default - * is "NFC" - */ - normalize(form?: string): string; - - /** - * Returns a String value that is made from count copies appended together. If count is 0, - * T is the empty String is returned. - * @param count number of copies to append - */ - repeat(count: number): string; - - /** - * Returns true if the sequence of elements of searchString converted to a String is the - * same as the corresponding elements of this object (converted to a String) starting at - * position. Otherwise returns false. - */ - startsWith(searchString: string, position?: number): boolean; - - // Overloads for objects with methods of well-known symbols. - - /** - * Matches a string an object that supports being matched against, and returns an array containing the results of that search. - * @param matcher An object that supports being matched against. - */ - match(matcher: { [Symbol.match](string: string): RegExpMatchArray; }): RegExpMatchArray; - - /** - * Replaces text in a string, using an object that supports replacement within a string. - * @param searchValue A object can search for and replace matches within a string. - * @param replaceValue A string containing the text to replace for every successful match of searchValue in this string. - */ - replace(searchValue: { [Symbol.replace](string: string, replaceValue: string): string; }, replaceValue: string): string; - - /** - * Replaces text in a string, using an object that supports replacement within a string. - * @param searchValue A object can search for and replace matches within a string. - * @param replacer A function that returns the replacement text. - */ - replace(searchValue: { [Symbol.replace](string: string, replacer: (substring: string, ...args: any[]) => string): string; }, replacer: (substring: string, ...args: any[]) => string): string; - - /** - * Finds the first substring match in a regular expression search. - * @param searcher An object which supports searching within a string. - */ - search(searcher: { [Symbol.search](string: string): number; }): number; - - /** - * Split a string into substrings using the specified separator and return them as an array. - * @param splitter An object that can split a string. - * @param limit A value used to limit the number of elements returned in the array. - */ - split(splitter: { [Symbol.split](string: string, limit?: number): string[]; }, limit?: number): string[]; - - /** - * Returns an HTML anchor element and sets the name attribute to the text value - * @param name - */ - anchor(name: string): string; - - /** Returns a HTML element */ - big(): string; - - /** Returns a HTML element */ - blink(): string; - - /** Returns a HTML element */ - bold(): string; - - /** Returns a HTML element */ - fixed(): string - - /** Returns a HTML element and sets the color attribute value */ - fontcolor(color: string): string - - /** Returns a HTML element and sets the size attribute value */ - fontsize(size: number): string; - - /** Returns a HTML element and sets the size attribute value */ - fontsize(size: string): string; - - /** Returns an HTML element */ - italics(): string; - - /** Returns an HTML element and sets the href attribute value */ - link(url: string): string; - - /** Returns a HTML element */ - small(): string; - - /** Returns a HTML element */ - strike(): string; - - /** Returns a HTML element */ - sub(): string; - - /** Returns a HTML element */ - sup(): string; -} - -interface StringConstructor { - /** - * Return the String value whose elements are, in order, the elements in the List elements. - * If length is 0, the empty string is returned. - */ - fromCodePoint(...codePoints: number[]): string; - - /** - * String.raw is intended for use as a tag function of a Tagged Template String. When called - * as such the first argument will be a well formed template call site object and the rest - * parameter will contain the substitution values. - * @param template A well-formed template string call site representation. - * @param substitutions A set of substitution values. - */ - raw(template: TemplateStringsArray, ...substitutions: any[]): string; -} - -interface IteratorResult { - done: boolean; - value?: T; -} - -interface Iterator { - next(value?: any): IteratorResult; - return?(value?: any): IteratorResult; - throw?(e?: any): IteratorResult; -} - -interface Iterable { - [Symbol.iterator](): Iterator; -} - -interface IterableIterator extends Iterator { - [Symbol.iterator](): IterableIterator; -} - -interface GeneratorFunction extends Function { - readonly [Symbol.toStringTag]: "GeneratorFunction"; -} - -interface GeneratorFunctionConstructor { - /** - * Creates a new Generator function. - * @param args A list of arguments the function accepts. - */ - new (...args: string[]): GeneratorFunction; - (...args: string[]): GeneratorFunction; - readonly prototype: GeneratorFunction; -} -declare var GeneratorFunction: GeneratorFunctionConstructor; - -interface Math { - /** - * Returns the number of leading zero bits in the 32-bit binary representation of a number. - * @param x A numeric expression. - */ - clz32(x: number): number; - - /** - * Returns the result of 32-bit multiplication of two numbers. - * @param x First number - * @param y Second number - */ - imul(x: number, y: number): number; - - /** - * Returns the sign of the x, indicating whether x is positive, negative or zero. - * @param x The numeric expression to test - */ - sign(x: number): number; - - /** - * Returns the base 10 logarithm of a number. - * @param x A numeric expression. - */ - log10(x: number): number; - - /** - * Returns the base 2 logarithm of a number. - * @param x A numeric expression. - */ - log2(x: number): number; - - /** - * Returns the natural logarithm of 1 + x. - * @param x A numeric expression. - */ - log1p(x: number): number; - - /** - * Returns the result of (e^x - 1) of x (e raised to the power of x, where e is the base of - * the natural logarithms). - * @param x A numeric expression. - */ - expm1(x: number): number; - - /** - * Returns the hyperbolic cosine of a number. - * @param x A numeric expression that contains an angle measured in radians. - */ - cosh(x: number): number; - - /** - * Returns the hyperbolic sine of a number. - * @param x A numeric expression that contains an angle measured in radians. - */ - sinh(x: number): number; - - /** - * Returns the hyperbolic tangent of a number. - * @param x A numeric expression that contains an angle measured in radians. - */ - tanh(x: number): number; - - /** - * Returns the inverse hyperbolic cosine of a number. - * @param x A numeric expression that contains an angle measured in radians. - */ - acosh(x: number): number; - - /** - * Returns the inverse hyperbolic sine of a number. - * @param x A numeric expression that contains an angle measured in radians. - */ - asinh(x: number): number; - - /** - * Returns the inverse hyperbolic tangent of a number. - * @param x A numeric expression that contains an angle measured in radians. - */ - atanh(x: number): number; - - /** - * Returns the square root of the sum of squares of its arguments. - * @param values Values to compute the square root for. - * If no arguments are passed, the result is +0. - * If there is only one argument, the result is the absolute value. - * If any argument is +Infinity or -Infinity, the result is +Infinity. - * If any argument is NaN, the result is NaN. - * If all arguments are either +0 or −0, the result is +0. - */ - hypot(...values: number[] ): number; - - /** - * Returns the integral part of the a numeric expression, x, removing any fractional digits. - * If x is already an integer, the result is x. - * @param x A numeric expression. - */ - trunc(x: number): number; - - /** - * Returns the nearest single precision float representation of a number. - * @param x A numeric expression. - */ - fround(x: number): number; - - /** - * Returns an implementation-dependent approximation to the cube root of number. - * @param x A numeric expression. - */ - cbrt(x: number): number; - - readonly [Symbol.toStringTag]: "Math"; -} - -interface Date { - /** - * Converts a Date object to a string. - */ - [Symbol.toPrimitive](hint: "default"): string; - /** - * Converts a Date object to a string. - */ - [Symbol.toPrimitive](hint: "string"): string; - /** - * Converts a Date object to a number. - */ - [Symbol.toPrimitive](hint: "number"): number; - /** - * Converts a Date object to a string or number. - * - * @param hint The strings "number", "string", or "default" to specify what primitive to return. - * - * @throws {TypeError} If 'hint' was given something other than "number", "string", or "default". - * @returns A number if 'hint' was "number", a string if 'hint' was "string" or "default". - */ - [Symbol.toPrimitive](hint: string): string | number; -} - -interface RegExp { - /** - * Matches a string with this regular expression, and returns an array containing the results of - * that search. - * @param string A string to search within. - */ - [Symbol.match](string: string): RegExpMatchArray; - - /** - * Replaces text in a string, using this regular expression. - * @param string A String object or string literal whose contents matching against - * this regular expression will be replaced - * @param replaceValue A String object or string literal containing the text to replace for every - * successful match of this regular expression. - */ - [Symbol.replace](string: string, replaceValue: string): string; - - /** - * Replaces text in a string, using this regular expression. - * @param string A String object or string literal whose contents matching against - * this regular expression will be replaced - * @param replacer A function that returns the replacement text. - */ - [Symbol.replace](string: string, replacer: (substring: string, ...args: any[]) => string): string; - - /** - * Finds the position beginning first substring match in a regular expression search - * using this regular expression. - * - * @param string The string to search within. - */ - [Symbol.search](string: string): number; - - /** - * Returns an array of substrings that were delimited by strings in the original input that - * match against this regular expression. - * - * If the regular expression contains capturing parentheses, then each time this - * regular expression matches, the results (including any undefined results) of the - * capturing parentheses are spliced. - * - * @param string string value to split - * @param limit if not undefined, the output array is truncated so that it contains no more - * than 'limit' elements. - */ - [Symbol.split](string: string, limit?: number): string[]; - - /** - * Returns a string indicating the flags of the regular expression in question. This field is read-only. - * The characters in this string are sequenced and concatenated in the following order: - * - * - "g" for global - * - "i" for ignoreCase - * - "m" for multiline - * - "u" for unicode - * - "y" for sticky - * - * If no flags are set, the value is the empty string. - */ - readonly flags: string; - - /** - * Returns a Boolean value indicating the state of the sticky flag (y) used with a regular - * expression. Default is false. Read-only. - */ - readonly sticky: boolean; - - /** - * Returns a Boolean value indicating the state of the Unicode flag (u) used with a regular - * expression. Default is false. Read-only. - */ - readonly unicode: boolean; -} - -interface RegExpConstructor { - [Symbol.species](): RegExpConstructor; -} - -interface Map { - clear(): void; - delete(key: K): boolean; - entries(): IterableIterator<[K, V]>; - forEach(callbackfn: (value: V, index: K, map: Map) => void, thisArg?: any): void; - get(key: K): V; - has(key: K): boolean; - keys(): IterableIterator; - set(key: K, value?: V): Map; - readonly size: number; - values(): IterableIterator; - [Symbol.iterator]():IterableIterator<[K,V]>; - readonly [Symbol.toStringTag]: "Map"; -} - -interface MapConstructor { - new (): Map; - new (): Map; - new (iterable: Iterable<[K, V]>): Map; - readonly prototype: Map; -} -declare var Map: MapConstructor; - -interface WeakMap { - clear(): void; - delete(key: K): boolean; - get(key: K): V; - has(key: K): boolean; - set(key: K, value?: V): WeakMap; - readonly [Symbol.toStringTag]: "WeakMap"; -} - -interface WeakMapConstructor { - new (): WeakMap; - new (): WeakMap; - new (iterable: Iterable<[K, V]>): WeakMap; - readonly prototype: WeakMap; -} -declare var WeakMap: WeakMapConstructor; - -interface Set { - add(value: T): Set; - clear(): void; - delete(value: T): boolean; - entries(): IterableIterator<[T, T]>; - forEach(callbackfn: (value: T, index: T, set: Set) => void, thisArg?: any): void; - has(value: T): boolean; - keys(): IterableIterator; - readonly size: number; - values(): IterableIterator; - [Symbol.iterator]():IterableIterator; - readonly [Symbol.toStringTag]: "Set"; -} - -interface SetConstructor { - new (): Set; - new (): Set; - new (iterable: Iterable): Set; - readonly prototype: Set; -} -declare var Set: SetConstructor; - -interface WeakSet { - add(value: T): WeakSet; - clear(): void; - delete(value: T): boolean; - has(value: T): boolean; - readonly [Symbol.toStringTag]: "WeakSet"; -} - -interface WeakSetConstructor { - new (): WeakSet; - new (): WeakSet; - new (iterable: Iterable): WeakSet; - readonly prototype: WeakSet; -} -declare var WeakSet: WeakSetConstructor; - -interface JSON { - readonly [Symbol.toStringTag]: "JSON"; -} - -/** - * Represents a raw buffer of binary data, which is used to store data for the - * different typed arrays. ArrayBuffers cannot be read from or written to directly, - * but can be passed to a typed array or DataView Object to interpret the raw - * buffer as needed. - */ -interface ArrayBuffer { - readonly [Symbol.toStringTag]: "ArrayBuffer"; -} - -interface DataView { - readonly [Symbol.toStringTag]: "DataView"; -} - -/** - * A typed array of 8-bit integer values. The contents are initialized to 0. If the requested - * number of bytes could not be allocated an exception is raised. - */ -interface Int8Array { - /** - * Returns an array of key, value pairs for every entry in the array - */ - entries(): IterableIterator<[number, number]>; - /** - * Returns an list of keys in the array - */ - keys(): IterableIterator; - /** - * Returns an list of values in the array - */ - values(): IterableIterator; - [Symbol.iterator](): IterableIterator; - readonly [Symbol.toStringTag]: "Int8Array"; -} - -interface Int8ArrayConstructor { - new (elements: Iterable): Int8Array; - - /** - * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Int8Array; -} - -/** - * A typed array of 8-bit unsigned integer values. The contents are initialized to 0. If the - * requested number of bytes could not be allocated an exception is raised. - */ -interface Uint8Array { - /** - * Returns an array of key, value pairs for every entry in the array - */ - entries(): IterableIterator<[number, number]>; - /** - * Returns an list of keys in the array - */ - keys(): IterableIterator; - /** - * Returns an list of values in the array - */ - values(): IterableIterator; - [Symbol.iterator](): IterableIterator; - readonly [Symbol.toStringTag]: "UInt8Array"; -} - -interface Uint8ArrayConstructor { - new (elements: Iterable): Uint8Array; - - /** - * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint8Array; -} - -/** - * A typed array of 8-bit unsigned integer (clamped) values. The contents are initialized to 0. - * If the requested number of bytes could not be allocated an exception is raised. - */ -interface Uint8ClampedArray { - /** - * Returns an array of key, value pairs for every entry in the array - */ - entries(): IterableIterator<[number, number]>; - - /** - * Returns an list of keys in the array - */ - keys(): IterableIterator; - - /** - * Returns an list of values in the array - */ - values(): IterableIterator; - - [Symbol.iterator](): IterableIterator; - readonly [Symbol.toStringTag]: "Uint8ClampedArray"; -} - -interface Uint8ClampedArrayConstructor { - new (elements: Iterable): Uint8ClampedArray; - - - /** - * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint8ClampedArray; -} - -/** - * A typed array of 16-bit signed integer values. The contents are initialized to 0. If the - * requested number of bytes could not be allocated an exception is raised. - */ -interface Int16Array { - /** - * Returns an array of key, value pairs for every entry in the array - */ - entries(): IterableIterator<[number, number]>; - - /** - * Returns an list of keys in the array - */ - keys(): IterableIterator; - - /** - * Returns an list of values in the array - */ - values(): IterableIterator; - - - [Symbol.iterator](): IterableIterator; - readonly [Symbol.toStringTag]: "Int16Array"; -} - -interface Int16ArrayConstructor { - new (elements: Iterable): Int16Array; - - /** - * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Int16Array; -} - -/** - * A typed array of 16-bit unsigned integer values. The contents are initialized to 0. If the - * requested number of bytes could not be allocated an exception is raised. - */ -interface Uint16Array { - /** - * Returns an array of key, value pairs for every entry in the array - */ - entries(): IterableIterator<[number, number]>; - /** - * Returns an list of keys in the array - */ - keys(): IterableIterator; - /** - * Returns an list of values in the array - */ - values(): IterableIterator; - [Symbol.iterator](): IterableIterator; - readonly [Symbol.toStringTag]: "Uint16Array"; -} - -interface Uint16ArrayConstructor { - new (elements: Iterable): Uint16Array; - - /** - * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint16Array; -} - -/** - * A typed array of 32-bit signed integer values. The contents are initialized to 0. If the - * requested number of bytes could not be allocated an exception is raised. - */ -interface Int32Array { - /** - * Returns an array of key, value pairs for every entry in the array - */ - entries(): IterableIterator<[number, number]>; - /** - * Returns an list of keys in the array - */ - keys(): IterableIterator; - /** - * Returns an list of values in the array - */ - values(): IterableIterator; - [Symbol.iterator](): IterableIterator; - readonly [Symbol.toStringTag]: "Int32Array"; -} - -interface Int32ArrayConstructor { - new (elements: Iterable): Int32Array; - - /** - * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Int32Array; -} - -/** - * A typed array of 32-bit unsigned integer values. The contents are initialized to 0. If the - * requested number of bytes could not be allocated an exception is raised. - */ -interface Uint32Array { - /** - * Returns an array of key, value pairs for every entry in the array - */ - entries(): IterableIterator<[number, number]>; - /** - * Returns an list of keys in the array - */ - keys(): IterableIterator; - /** - * Returns an list of values in the array - */ - values(): IterableIterator; - [Symbol.iterator](): IterableIterator; - readonly [Symbol.toStringTag]: "Uint32Array"; -} - -interface Uint32ArrayConstructor { - new (elements: Iterable): Uint32Array; - - /** - * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint32Array; -} - -/** - * A typed array of 32-bit float values. The contents are initialized to 0. If the requested number - * of bytes could not be allocated an exception is raised. - */ -interface Float32Array { - /** - * Returns an array of key, value pairs for every entry in the array - */ - entries(): IterableIterator<[number, number]>; - /** - * Returns an list of keys in the array - */ - keys(): IterableIterator; - /** - * Returns an list of values in the array - */ - values(): IterableIterator; - [Symbol.iterator](): IterableIterator; - readonly [Symbol.toStringTag]: "Float32Array"; -} - -interface Float32ArrayConstructor { - new (elements: Iterable): Float32Array; - - /** - * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Float32Array; -} - -/** - * A typed array of 64-bit float values. The contents are initialized to 0. If the requested - * number of bytes could not be allocated an exception is raised. - */ -interface Float64Array { - /** - * Returns an array of key, value pairs for every entry in the array - */ - entries(): IterableIterator<[number, number]>; - /** - * Returns an list of keys in the array - */ - keys(): IterableIterator; - /** - * Returns an list of values in the array - */ - values(): IterableIterator; - [Symbol.iterator](): IterableIterator; - readonly [Symbol.toStringTag]: "Float64Array"; -} - -interface Float64ArrayConstructor { - new (elements: Iterable): Float64Array; - - /** - * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Float64Array; -} - -interface ProxyHandler { - getPrototypeOf? (target: T): any; - setPrototypeOf? (target: T, v: any): boolean; - isExtensible? (target: T): boolean; - preventExtensions? (target: T): boolean; - getOwnPropertyDescriptor? (target: T, p: PropertyKey): PropertyDescriptor; - has? (target: T, p: PropertyKey): boolean; - get? (target: T, p: PropertyKey, receiver: any): any; - set? (target: T, p: PropertyKey, value: any, receiver: any): boolean; - deleteProperty? (target: T, p: PropertyKey): boolean; - defineProperty? (target: T, p: PropertyKey, attributes: PropertyDescriptor): boolean; - enumerate? (target: T): PropertyKey[]; - ownKeys? (target: T): PropertyKey[]; - apply? (target: T, thisArg: any, argArray?: any): any; - construct? (target: T, thisArg: any, argArray?: any): any; -} - -interface ProxyConstructor { - revocable(target: T, handler: ProxyHandler): { proxy: T; revoke: () => void; }; - new (target: T, handler: ProxyHandler): T -} -declare var Proxy: ProxyConstructor; - -declare namespace Reflect { - function apply(target: Function, thisArgument: any, argumentsList: ArrayLike): any; - function construct(target: Function, argumentsList: ArrayLike, newTarget?: any): any; - function defineProperty(target: any, propertyKey: PropertyKey, attributes: PropertyDescriptor): boolean; - function deleteProperty(target: any, propertyKey: PropertyKey): boolean; - function enumerate(target: any): IterableIterator; - function get(target: any, propertyKey: PropertyKey, receiver?: any): any; - function getOwnPropertyDescriptor(target: any, propertyKey: PropertyKey): PropertyDescriptor; - function getPrototypeOf(target: any): any; - function has(target: any, propertyKey: string): boolean; - function has(target: any, propertyKey: symbol): boolean; - function isExtensible(target: any): boolean; - function ownKeys(target: any): Array; - function preventExtensions(target: any): boolean; - function set(target: any, propertyKey: PropertyKey, value: any, receiver?: any): boolean; - function setPrototypeOf(target: any, proto: any): boolean; -} - -/** - * Represents the completion of an asynchronous operation - */ -interface Promise { - /** - * Attaches callbacks for the resolution and/or rejection of the Promise. - * @param onfulfilled The callback to execute when the Promise is resolved. - * @param onrejected The callback to execute when the Promise is rejected. - * @returns A Promise for the completion of which ever callback is executed. - */ - then(onfulfilled?: (value: T) => TResult | PromiseLike, onrejected?: (reason: any) => TResult | PromiseLike): Promise; - then(onfulfilled?: (value: T) => TResult | PromiseLike, onrejected?: (reason: any) => void): Promise; - - /** - * Attaches a callback for only the rejection of the Promise. - * @param onrejected The callback to execute when the Promise is rejected. - * @returns A Promise for the completion of the callback. - */ - catch(onrejected?: (reason: any) => T | PromiseLike): Promise; - catch(onrejected?: (reason: any) => void): Promise; - - readonly [Symbol.toStringTag]: "Promise"; -} - -interface PromiseConstructor { - /** - * A reference to the prototype. - */ - readonly prototype: Promise; - - /** - * Creates a new Promise. - * @param executor A callback used to initialize the promise. This callback is passed two arguments: - * a resolve callback used resolve the promise with a value or the result of another promise, - * and a reject callback used to reject the promise with a provided reason or error. - */ - new (executor: (resolve: (value?: T | PromiseLike) => void, reject: (reason?: any) => void) => void): Promise; - - /** - * Creates a Promise that is resolved with an array of results when all of the provided Promises - * resolve, or rejected when any Promise is rejected. - * @param values An array of Promises. - * @returns A new Promise. - */ - 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]>; - 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]>; - 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]>; - all(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike , T5 | PromiseLike, T6 | PromiseLike, T7 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6, T7]>; - all(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike , T5 | PromiseLike, T6 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6]>; - all(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike , T5 | PromiseLike]): Promise<[T1, T2, T3, T4, T5]>; - all(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike ]): Promise<[T1, T2, T3, T4]>; - all(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike]): Promise<[T1, T2, T3]>; - all(values: [T1 | PromiseLike, T2 | PromiseLike]): Promise<[T1, T2]>; - all(values: Iterable>): Promise; - - /** - * Creates a Promise that is resolved or rejected when any of the provided Promises are resolved - * or rejected. - * @param values An array of Promises. - * @returns A new Promise. - */ - race(values: Iterable>): Promise; - - /** - * Creates a new rejected promise for the provided reason. - * @param reason The reason the promise was rejected. - * @returns A new rejected Promise. - */ - reject(reason: any): Promise; - - /** - * Creates a new rejected promise for the provided reason. - * @param reason The reason the promise was rejected. - * @returns A new rejected Promise. - */ - reject(reason: any): Promise; - - /** - * Creates a new resolved promise for the provided value. - * @param value A promise. - * @returns A promise whose internal state matches the provided promise. - */ - resolve(value: T | PromiseLike): Promise; - - /** - * Creates a new resolved promise . - * @returns A resolved promise. - */ - resolve(): Promise; - - readonly [Symbol.species]: Function; -} - -declare var Promise: PromiseConstructor; -interface Array { - /** - * Determines whether an array includes a certain element, returning true or false as appropriate. - * @param searchElement The element to search for. - * @param fromIndex The position in this array at which to begin searching for searchElement. - */ - includes(searchElement: T, fromIndex?: number): boolean; -} - -interface Int8Array { - /** - * Determines whether an array includes a certain element, returning true or false as appropriate. - * @param searchElement The element to search for. - * @param fromIndex The position in this array at which to begin searching for searchElement. - */ - includes(searchElement: number, fromIndex?: number): boolean; -} - -interface Uint8Array { - /** - * Determines whether an array includes a certain element, returning true or false as appropriate. - * @param searchElement The element to search for. - * @param fromIndex The position in this array at which to begin searching for searchElement. - */ - includes(searchElement: number, fromIndex?: number): boolean; -} - -interface Uint8ClampedArray { - /** - * Determines whether an array includes a certain element, returning true or false as appropriate. - * @param searchElement The element to search for. - * @param fromIndex The position in this array at which to begin searching for searchElement. - */ - includes(searchElement: number, fromIndex?: number): boolean; -} - -interface Int16Array { - /** - * Determines whether an array includes a certain element, returning true or false as appropriate. - * @param searchElement The element to search for. - * @param fromIndex The position in this array at which to begin searching for searchElement. - */ - includes(searchElement: number, fromIndex?: number): boolean; -} - -interface Uint16Array { - /** - * Determines whether an array includes a certain element, returning true or false as appropriate. - * @param searchElement The element to search for. - * @param fromIndex The position in this array at which to begin searching for searchElement. - */ - includes(searchElement: number, fromIndex?: number): boolean; -} - -interface Int32Array { - /** - * Determines whether an array includes a certain element, returning true or false as appropriate. - * @param searchElement The element to search for. - * @param fromIndex The position in this array at which to begin searching for searchElement. - */ - includes(searchElement: number, fromIndex?: number): boolean; -} - -interface Uint32Array { - /** - * Determines whether an array includes a certain element, returning true or false as appropriate. - * @param searchElement The element to search for. - * @param fromIndex The position in this array at which to begin searching for searchElement. - */ - includes(searchElement: number, fromIndex?: number): boolean; -} - -interface Float32Array { - /** - * Determines whether an array includes a certain element, returning true or false as appropriate. - * @param searchElement The element to search for. - * @param fromIndex The position in this array at which to begin searching for searchElement. - */ - includes(searchElement: number, fromIndex?: number): boolean; -} - -interface Float64Array { - /** - * Determines whether an array includes a certain element, returning true or false as appropriate. - * @param searchElement The element to search for. - * @param fromIndex The position in this array at which to begin searching for searchElement. - */ - includes(searchElement: number, fromIndex?: number): boolean; -}///////////////////////////// -/// ECMAScript APIs -///////////////////////////// - -declare const NaN: number; -declare const Infinity: number; - -/** - * Evaluates JavaScript code and executes it. - * @param x A String value that contains valid JavaScript code. - */ -declare function eval(x: string): any; - -/** - * Converts A string to an integer. - * @param s A string to convert into a number. - * @param radix A value between 2 and 36 that specifies the base of the number in numString. - * If this argument is not supplied, strings with a prefix of '0x' are considered hexadecimal. - * All other strings are considered decimal. - */ -declare function parseInt(s: string, radix?: number): number; - -/** - * Converts a string to a floating-point number. - * @param string A string that contains a floating-point number. - */ -declare function parseFloat(string: string): number; - -/** - * Returns a Boolean value that indicates whether a value is the reserved value NaN (not a number). - * @param number A numeric value. - */ -declare function isNaN(number: number): boolean; - -/** - * Determines whether a supplied number is finite. - * @param number Any numeric value. - */ -declare function isFinite(number: number): boolean; - -/** - * Gets the unencoded version of an encoded Uniform Resource Identifier (URI). - * @param encodedURI A value representing an encoded URI. - */ -declare function decodeURI(encodedURI: string): string; - -/** - * Gets the unencoded version of an encoded component of a Uniform Resource Identifier (URI). - * @param encodedURIComponent A value representing an encoded URI component. - */ -declare function decodeURIComponent(encodedURIComponent: string): string; - -/** - * Encodes a text string as a valid Uniform Resource Identifier (URI) - * @param uri A value representing an encoded URI. - */ -declare function encodeURI(uri: string): string; - -/** - * Encodes a text string as a valid component of a Uniform Resource Identifier (URI). - * @param uriComponent A value representing an encoded URI component. - */ -declare function encodeURIComponent(uriComponent: string): string; - -interface PropertyDescriptor { - configurable?: boolean; - enumerable?: boolean; - value?: any; - writable?: boolean; - get? (): any; - set? (v: any): void; -} - -interface PropertyDescriptorMap { - [s: string]: PropertyDescriptor; -} - -interface Object { - /** The initial value of Object.prototype.constructor is the standard built-in Object constructor. */ - constructor: Function; - - /** Returns a string representation of an object. */ - toString(): string; - - /** Returns a date converted to a string using the current locale. */ - toLocaleString(): string; - - /** Returns the primitive value of the specified object. */ - valueOf(): Object; - - /** - * Determines whether an object has a property with the specified name. - * @param v A property name. - */ - hasOwnProperty(v: string): boolean; - - /** - * Determines whether an object exists in another object's prototype chain. - * @param v Another object whose prototype chain is to be checked. - */ - isPrototypeOf(v: Object): boolean; - - /** - * Determines whether a specified property is enumerable. - * @param v A property name. - */ - propertyIsEnumerable(v: string): boolean; -} - -interface ObjectConstructor { - new (value?: any): Object; - (): any; - (value: any): any; - - /** A reference to the prototype for a class of objects. */ - readonly prototype: Object; - - /** - * Returns the prototype of an object. - * @param o The object that references the prototype. - */ - getPrototypeOf(o: any): any; - - /** - * Gets the own property descriptor of the specified object. - * An own property descriptor is one that is defined directly on the object and is not inherited from the object's prototype. - * @param o Object that contains the property. - * @param p Name of the property. - */ - getOwnPropertyDescriptor(o: any, p: string): PropertyDescriptor; - - /** - * Returns the names of the own properties of an object. The own properties of an object are those that are defined directly - * on that object, and are not inherited from the object's prototype. The properties of an object include both fields (objects) and functions. - * @param o Object that contains the own properties. - */ - getOwnPropertyNames(o: any): string[]; - - /** - * Creates an object that has the specified prototype, and that optionally contains specified properties. - * @param o Object to use as a prototype. May be null - * @param properties JavaScript object that contains one or more property descriptors. - */ - create(o: any, properties?: PropertyDescriptorMap): any; - - /** - * Adds a property to an object, or modifies attributes of an existing property. - * @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. - * @param p The property name. - * @param attributes Descriptor for the property. It can be for a data property or an accessor property. - */ - defineProperty(o: any, p: string, attributes: PropertyDescriptor): any; - - /** - * Adds one or more properties to an object, and/or modifies attributes of existing properties. - * @param o Object on which to add or modify the properties. This can be a native JavaScript object or a DOM object. - * @param properties JavaScript object that contains one or more descriptor objects. Each descriptor object describes a data property or an accessor property. - */ - defineProperties(o: any, properties: PropertyDescriptorMap): any; - - /** - * Prevents the modification of attributes of existing properties, and prevents the addition of new properties. - * @param o Object on which to lock the attributes. - */ - seal(o: T): T; - - /** - * Prevents the modification of existing property attributes and values, and prevents the addition of new properties. - * @param o Object on which to lock the attributes. - */ - freeze(o: T): T; - - /** - * Prevents the addition of new properties to an object. - * @param o Object to make non-extensible. - */ - preventExtensions(o: T): T; - - /** - * Returns true if existing property attributes cannot be modified in an object and new properties cannot be added to the object. - * @param o Object to test. - */ - isSealed(o: any): boolean; - - /** - * Returns true if existing property attributes and values cannot be modified in an object, and new properties cannot be added to the object. - * @param o Object to test. - */ - isFrozen(o: any): boolean; - - /** - * Returns a value that indicates whether new properties can be added to an object. - * @param o Object to test. - */ - isExtensible(o: any): boolean; - - /** - * Returns the names of the enumerable properties and methods of an object. - * @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. - */ - keys(o: any): string[]; -} - -/** - * Provides functionality common to all JavaScript objects. - */ -declare const Object: ObjectConstructor; - -/** - * Creates a new function. - */ -interface Function { - /** - * Calls the function, substituting the specified object for the this value of the function, and the specified array for the arguments of the function. - * @param thisArg The object to be used as the this object. - * @param argArray A set of arguments to be passed to the function. - */ - apply(thisArg: any, argArray?: any): any; - - /** - * Calls a method of an object, substituting another object for the current object. - * @param thisArg The object to be used as the current object. - * @param argArray A list of arguments to be passed to the method. - */ - call(thisArg: any, ...argArray: any[]): any; - - /** - * For a given function, creates a bound function that has the same body as the original function. - * The this object of the bound function is associated with the specified object, and has the specified initial parameters. - * @param thisArg An object to which the this keyword can refer inside the new function. - * @param argArray A list of arguments to be passed to the new function. - */ - bind(thisArg: any, ...argArray: any[]): any; - - prototype: any; - readonly length: number; - - // Non-standard extensions - arguments: any; - caller: Function; -} - -interface FunctionConstructor { - /** - * Creates a new function. - * @param args A list of arguments the function accepts. - */ - new (...args: string[]): Function; - (...args: string[]): Function; - readonly prototype: Function; -} - -declare const Function: FunctionConstructor; - -interface IArguments { - [index: number]: any; - length: number; - callee: Function; -} - -interface String { - /** Returns a string representation of a string. */ - toString(): string; - - /** - * Returns the character at the specified index. - * @param pos The zero-based index of the desired character. - */ - charAt(pos: number): string; - - /** - * Returns the Unicode value of the character at the specified location. - * @param index The zero-based index of the desired character. If there is no character at the specified index, NaN is returned. - */ - charCodeAt(index: number): number; - - /** - * Returns a string that contains the concatenation of two or more strings. - * @param strings The strings to append to the end of the string. - */ - concat(...strings: string[]): string; - - /** - * Returns the position of the first occurrence of a substring. - * @param searchString The substring to search for in the string - * @param position The index at which to begin searching the String object. If omitted, search starts at the beginning of the string. - */ - indexOf(searchString: string, position?: number): number; - - /** - * Returns the last occurrence of a substring in the string. - * @param searchString The substring to search for. - * @param position The index at which to begin searching. If omitted, the search begins at the end of the string. - */ - lastIndexOf(searchString: string, position?: number): number; - - /** - * Determines whether two strings are equivalent in the current locale. - * @param that String to compare to target string - */ - localeCompare(that: string): number; - - /** - * Matches a string with a regular expression, and returns an array containing the results of that search. - * @param regexp A variable name or string literal containing the regular expression pattern and flags. - */ - match(regexp: string): RegExpMatchArray; - - /** - * Matches a string with a regular expression, and returns an array containing the results of that search. - * @param regexp A regular expression object that contains the regular expression pattern and applicable flags. - */ - match(regexp: RegExp): RegExpMatchArray; - - /** - * Replaces text in a string, using a regular expression or search string. - * @param searchValue A string that represents the regular expression. - * @param replaceValue A string containing the text to replace for every successful match of searchValue in this string. - */ - replace(searchValue: string, replaceValue: string): string; - - /** - * Replaces text in a string, using a regular expression or search string. - * @param searchValue A string that represents the regular expression. - * @param replacer A function that returns the replacement text. - */ - replace(searchValue: string, replacer: (substring: string, ...args: any[]) => string): string; - - /** - * Replaces text in a string, using a regular expression or search string. - * @param searchValue A Regular Expression object containing the regular expression pattern and applicable flags. - * @param replaceValue A string containing the text to replace for every successful match of searchValue in this string. - */ - replace(searchValue: RegExp, replaceValue: string): string; - - /** - * Replaces text in a string, using a regular expression or search string. - * @param searchValue A Regular Expression object containing the regular expression pattern and applicable flags - * @param replacer A function that returns the replacement text. - */ - replace(searchValue: RegExp, replacer: (substring: string, ...args: any[]) => string): string; - - /** - * Finds the first substring match in a regular expression search. - * @param regexp The regular expression pattern and applicable flags. - */ - search(regexp: string): number; - - /** - * Finds the first substring match in a regular expression search. - * @param regexp The regular expression pattern and applicable flags. - */ - search(regexp: RegExp): number; - - /** - * Returns a section of a string. - * @param start The index to the beginning of the specified portion of stringObj. - * @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. - * If this value is not specified, the substring continues to the end of stringObj. - */ - slice(start?: number, end?: number): string; - - /** - * Split a string into substrings using the specified separator and return them as an array. - * @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. - * @param limit A value used to limit the number of elements returned in the array. - */ - split(separator: string, limit?: number): string[]; - - /** - * Split a string into substrings using the specified separator and return them as an array. - * @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. - * @param limit A value used to limit the number of elements returned in the array. - */ - split(separator: RegExp, limit?: number): string[]; - - /** - * Returns the substring at the specified location within a String object. - * @param start The zero-based index number indicating the beginning of the substring. - * @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. - * If end is omitted, the characters from start through the end of the original string are returned. - */ - substring(start: number, end?: number): string; - - /** Converts all the alphabetic characters in a string to lowercase. */ - toLowerCase(): string; - - /** Converts all alphabetic characters to lowercase, taking into account the host environment's current locale. */ - toLocaleLowerCase(): string; - - /** Converts all the alphabetic characters in a string to uppercase. */ - toUpperCase(): string; - - /** Returns a string where all alphabetic characters have been converted to uppercase, taking into account the host environment's current locale. */ - toLocaleUpperCase(): string; - - /** Removes the leading and trailing white space and line terminator characters from a string. */ - trim(): string; - - /** Returns the length of a String object. */ - readonly length: number; - - // IE extensions - /** - * Gets a substring beginning at the specified location and having the specified length. - * @param from The starting position of the desired substring. The index of the first character in the string is zero. - * @param length The number of characters to include in the returned substring. - */ - substr(from: number, length?: number): string; - - /** Returns the primitive value of the specified object. */ - valueOf(): string; - - readonly [index: number]: string; -} - -interface StringConstructor { - new (value?: any): String; - (value?: any): string; - readonly prototype: String; - fromCharCode(...codes: number[]): string; -} - -/** - * Allows manipulation and formatting of text strings and determination and location of substrings within strings. - */ -declare const String: StringConstructor; - -interface Boolean { - /** Returns the primitive value of the specified object. */ - valueOf(): boolean; -} - -interface BooleanConstructor { - new (value?: any): Boolean; - (value?: any): boolean; - readonly prototype: Boolean; -} - -declare const Boolean: BooleanConstructor; - -interface Number { - /** - * Returns a string representation of an object. - * @param radix Specifies a radix for converting numeric values to strings. This value is only used for numbers. - */ - toString(radix?: number): string; - - /** - * Returns a string representing a number in fixed-point notation. - * @param fractionDigits Number of digits after the decimal point. Must be in the range 0 - 20, inclusive. - */ - toFixed(fractionDigits?: number): string; - - /** - * Returns a string containing a number represented in exponential notation. - * @param fractionDigits Number of digits after the decimal point. Must be in the range 0 - 20, inclusive. - */ - toExponential(fractionDigits?: number): string; - - /** - * Returns a string containing a number represented either in exponential or fixed-point notation with a specified number of digits. - * @param precision Number of significant digits. Must be in the range 1 - 21, inclusive. - */ - toPrecision(precision?: number): string; - - /** Returns the primitive value of the specified object. */ - valueOf(): number; -} - -interface NumberConstructor { - new (value?: any): Number; - (value?: any): number; - readonly prototype: Number; - - /** The largest number that can be represented in JavaScript. Equal to approximately 1.79E+308. */ - readonly MAX_VALUE: number; - - /** The closest number to zero that can be represented in JavaScript. Equal to approximately 5.00E-324. */ - readonly MIN_VALUE: number; - - /** - * A value that is not a number. - * In equality comparisons, NaN does not equal any value, including itself. To test whether a value is equivalent to NaN, use the isNaN function. - */ - readonly NaN: number; - - /** - * A value that is less than the largest negative number that can be represented in JavaScript. - * JavaScript displays NEGATIVE_INFINITY values as -infinity. - */ - readonly NEGATIVE_INFINITY: number; - - /** - * A value greater than the largest number that can be represented in JavaScript. - * JavaScript displays POSITIVE_INFINITY values as infinity. - */ - readonly POSITIVE_INFINITY: number; -} - -/** An object that represents a number of any kind. All JavaScript numbers are 64-bit floating-point numbers. */ -declare const Number: NumberConstructor; - -interface TemplateStringsArray extends Array { - readonly raw: string[]; -} - -interface Math { - /** The mathematical constant e. This is Euler's number, the base of natural logarithms. */ - readonly E: number; - /** The natural logarithm of 10. */ - readonly LN10: number; - /** The natural logarithm of 2. */ - readonly LN2: number; - /** The base-2 logarithm of e. */ - readonly LOG2E: number; - /** The base-10 logarithm of e. */ - readonly LOG10E: number; - /** Pi. This is the ratio of the circumference of a circle to its diameter. */ - readonly PI: number; - /** The square root of 0.5, or, equivalently, one divided by the square root of 2. */ - readonly SQRT1_2: number; - /** The square root of 2. */ - readonly SQRT2: number; - /** - * Returns the absolute value of a number (the value without regard to whether it is positive or negative). - * For example, the absolute value of -5 is the same as the absolute value of 5. - * @param x A numeric expression for which the absolute value is needed. - */ - abs(x: number): number; - /** - * Returns the arc cosine (or inverse cosine) of a number. - * @param x A numeric expression. - */ - acos(x: number): number; - /** - * Returns the arcsine of a number. - * @param x A numeric expression. - */ - asin(x: number): number; - /** - * Returns the arctangent of a number. - * @param x A numeric expression for which the arctangent is needed. - */ - atan(x: number): number; - /** - * Returns the angle (in radians) from the X axis to a point. - * @param y A numeric expression representing the cartesian y-coordinate. - * @param x A numeric expression representing the cartesian x-coordinate. - */ - atan2(y: number, x: number): number; - /** - * Returns the smallest number greater than or equal to its numeric argument. - * @param x A numeric expression. - */ - ceil(x: number): number; - /** - * Returns the cosine of a number. - * @param x A numeric expression that contains an angle measured in radians. - */ - cos(x: number): number; - /** - * Returns e (the base of natural logarithms) raised to a power. - * @param x A numeric expression representing the power of e. - */ - exp(x: number): number; - /** - * Returns the greatest number less than or equal to its numeric argument. - * @param x A numeric expression. - */ - floor(x: number): number; - /** - * Returns the natural logarithm (base e) of a number. - * @param x A numeric expression. - */ - log(x: number): number; - /** - * Returns the larger of a set of supplied numeric expressions. - * @param values Numeric expressions to be evaluated. - */ - max(...values: number[]): number; - /** - * Returns the smaller of a set of supplied numeric expressions. - * @param values Numeric expressions to be evaluated. - */ - min(...values: number[]): number; - /** - * Returns the value of a base expression taken to a specified power. - * @param x The base value of the expression. - * @param y The exponent value of the expression. - */ - pow(x: number, y: number): number; - /** Returns a pseudorandom number between 0 and 1. */ - random(): number; - /** - * Returns a supplied numeric expression rounded to the nearest number. - * @param x The value to be rounded to the nearest number. - */ - round(x: number): number; - /** - * Returns the sine of a number. - * @param x A numeric expression that contains an angle measured in radians. - */ - sin(x: number): number; - /** - * Returns the square root of a number. - * @param x A numeric expression. - */ - sqrt(x: number): number; - /** - * Returns the tangent of a number. - * @param x A numeric expression that contains an angle measured in radians. - */ - tan(x: number): number; -} -/** An intrinsic object that provides basic mathematics functionality and constants. */ -declare const Math: Math; - -/** Enables basic storage and retrieval of dates and times. */ -interface Date { - /** Returns a string representation of a date. The format of the string depends on the locale. */ - toString(): string; - /** Returns a date as a string value. */ - toDateString(): string; - /** Returns a time as a string value. */ - toTimeString(): string; - /** Returns a value as a string value appropriate to the host environment's current locale. */ - toLocaleString(): string; - /** Returns a date as a string value appropriate to the host environment's current locale. */ - toLocaleDateString(): string; - /** Returns a time as a string value appropriate to the host environment's current locale. */ - toLocaleTimeString(): string; - /** Returns the stored time value in milliseconds since midnight, January 1, 1970 UTC. */ - valueOf(): number; - /** Gets the time value in milliseconds. */ - getTime(): number; - /** Gets the year, using local time. */ - getFullYear(): number; - /** Gets the year using Universal Coordinated Time (UTC). */ - getUTCFullYear(): number; - /** Gets the month, using local time. */ - getMonth(): number; - /** Gets the month of a Date object using Universal Coordinated Time (UTC). */ - getUTCMonth(): number; - /** Gets the day-of-the-month, using local time. */ - getDate(): number; - /** Gets the day-of-the-month, using Universal Coordinated Time (UTC). */ - getUTCDate(): number; - /** Gets the day of the week, using local time. */ - getDay(): number; - /** Gets the day of the week using Universal Coordinated Time (UTC). */ - getUTCDay(): number; - /** Gets the hours in a date, using local time. */ - getHours(): number; - /** Gets the hours value in a Date object using Universal Coordinated Time (UTC). */ - getUTCHours(): number; - /** Gets the minutes of a Date object, using local time. */ - getMinutes(): number; - /** Gets the minutes of a Date object using Universal Coordinated Time (UTC). */ - getUTCMinutes(): number; - /** Gets the seconds of a Date object, using local time. */ - getSeconds(): number; - /** Gets the seconds of a Date object using Universal Coordinated Time (UTC). */ - getUTCSeconds(): number; - /** Gets the milliseconds of a Date, using local time. */ - getMilliseconds(): number; - /** Gets the milliseconds of a Date object using Universal Coordinated Time (UTC). */ - getUTCMilliseconds(): number; - /** Gets the difference in minutes between the time on the local computer and Universal Coordinated Time (UTC). */ - getTimezoneOffset(): number; - /** - * Sets the date and time value in the Date object. - * @param time A numeric value representing the number of elapsed milliseconds since midnight, January 1, 1970 GMT. - */ - setTime(time: number): number; - /** - * Sets the milliseconds value in the Date object using local time. - * @param ms A numeric value equal to the millisecond value. - */ - setMilliseconds(ms: number): number; - /** - * Sets the milliseconds value in the Date object using Universal Coordinated Time (UTC). - * @param ms A numeric value equal to the millisecond value. - */ - setUTCMilliseconds(ms: number): number; - - /** - * Sets the seconds value in the Date object using local time. - * @param sec A numeric value equal to the seconds value. - * @param ms A numeric value equal to the milliseconds value. - */ - setSeconds(sec: number, ms?: number): number; - /** - * Sets the seconds value in the Date object using Universal Coordinated Time (UTC). - * @param sec A numeric value equal to the seconds value. - * @param ms A numeric value equal to the milliseconds value. - */ - setUTCSeconds(sec: number, ms?: number): number; - /** - * Sets the minutes value in the Date object using local time. - * @param min A numeric value equal to the minutes value. - * @param sec A numeric value equal to the seconds value. - * @param ms A numeric value equal to the milliseconds value. - */ - setMinutes(min: number, sec?: number, ms?: number): number; - /** - * Sets the minutes value in the Date object using Universal Coordinated Time (UTC). - * @param min A numeric value equal to the minutes value. - * @param sec A numeric value equal to the seconds value. - * @param ms A numeric value equal to the milliseconds value. - */ - setUTCMinutes(min: number, sec?: number, ms?: number): number; - /** - * Sets the hour value in the Date object using local time. - * @param hours A numeric value equal to the hours value. - * @param min A numeric value equal to the minutes value. - * @param sec A numeric value equal to the seconds value. - * @param ms A numeric value equal to the milliseconds value. - */ - setHours(hours: number, min?: number, sec?: number, ms?: number): number; - /** - * Sets the hours value in the Date object using Universal Coordinated Time (UTC). - * @param hours A numeric value equal to the hours value. - * @param min A numeric value equal to the minutes value. - * @param sec A numeric value equal to the seconds value. - * @param ms A numeric value equal to the milliseconds value. - */ - setUTCHours(hours: number, min?: number, sec?: number, ms?: number): number; - /** - * Sets the numeric day-of-the-month value of the Date object using local time. - * @param date A numeric value equal to the day of the month. - */ - setDate(date: number): number; - /** - * Sets the numeric day of the month in the Date object using Universal Coordinated Time (UTC). - * @param date A numeric value equal to the day of the month. - */ - setUTCDate(date: number): number; - /** - * Sets the month value in the Date object using local time. - * @param month A numeric value equal to the month. The value for January is 0, and other month values follow consecutively. - * @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. - */ - setMonth(month: number, date?: number): number; - /** - * Sets the month value in the Date object using Universal Coordinated Time (UTC). - * @param month A numeric value equal to the month. The value for January is 0, and other month values follow consecutively. - * @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. - */ - setUTCMonth(month: number, date?: number): number; - /** - * Sets the year of the Date object using local time. - * @param year A numeric value for the year. - * @param month A zero-based numeric value for the month (0 for January, 11 for December). Must be specified if numDate is specified. - * @param date A numeric value equal for the day of the month. - */ - setFullYear(year: number, month?: number, date?: number): number; - /** - * Sets the year value in the Date object using Universal Coordinated Time (UTC). - * @param year A numeric value equal to the year. - * @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. - * @param date A numeric value equal to the day of the month. - */ - setUTCFullYear(year: number, month?: number, date?: number): number; - /** Returns a date converted to a string using Universal Coordinated Time (UTC). */ - toUTCString(): string; - /** Returns a date as a string value in ISO format. */ - toISOString(): string; - /** Used by the JSON.stringify method to enable the transformation of an object's data for JavaScript Object Notation (JSON) serialization. */ - toJSON(key?: any): string; -} - -interface DateConstructor { - new (): Date; - new (value: number): Date; - new (value: string): Date; - new (year: number, month: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): Date; - (): string; - readonly prototype: Date; - /** - * Parses a string containing a date, and returns the number of milliseconds between that date and midnight, January 1, 1970. - * @param s A date string - */ - parse(s: string): number; - /** - * Returns the number of milliseconds between midnight, January 1, 1970 Universal Coordinated Time (UTC) (or GMT) and the specified date. - * @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. - * @param month The month as an number between 0 and 11 (January to December). - * @param date The date as an number between 1 and 31. - * @param hours Must be supplied if minutes is supplied. An number from 0 to 23 (midnight to 11pm) that specifies the hour. - * @param minutes Must be supplied if seconds is supplied. An number from 0 to 59 that specifies the minutes. - * @param seconds Must be supplied if milliseconds is supplied. An number from 0 to 59 that specifies the seconds. - * @param ms An number from 0 to 999 that specifies the milliseconds. - */ - UTC(year: number, month: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): number; - now(): number; -} - -declare const Date: DateConstructor; - -interface RegExpMatchArray extends Array { - index?: number; - input?: string; -} - -interface RegExpExecArray extends Array { - index: number; - input: string; -} - -interface RegExp { - /** - * Executes a search on a string using a regular expression pattern, and returns an array containing the results of that search. - * @param string The String object or string literal on which to perform the search. - */ - exec(string: string): RegExpExecArray; - - /** - * Returns a Boolean value that indicates whether or not a pattern exists in a searched string. - * @param string String on which to perform the search. - */ - test(string: string): boolean; - - /** 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. */ - readonly source: string; - - /** Returns a Boolean value indicating the state of the global flag (g) used with a regular expression. Default is false. Read-only. */ - readonly global: boolean; - - /** Returns a Boolean value indicating the state of the ignoreCase flag (i) used with a regular expression. Default is false. Read-only. */ - readonly ignoreCase: boolean; - - /** Returns a Boolean value indicating the state of the multiline flag (m) used with a regular expression. Default is false. Read-only. */ - readonly multiline: boolean; - - lastIndex: number; - - // Non-standard extensions - compile(): RegExp; -} - -interface RegExpConstructor { - new (pattern: string, flags?: string): RegExp; - (pattern: string, flags?: string): RegExp; - readonly prototype: RegExp; - - // Non-standard extensions - $1: string; - $2: string; - $3: string; - $4: string; - $5: string; - $6: string; - $7: string; - $8: string; - $9: string; - lastMatch: string; -} - -declare const RegExp: RegExpConstructor; - -interface Error { - name: string; - message: string; -} - -interface ErrorConstructor { - new (message?: string): Error; - (message?: string): Error; - readonly prototype: Error; -} - -declare const Error: ErrorConstructor; - -interface EvalError extends Error { -} - -interface EvalErrorConstructor { - new (message?: string): EvalError; - (message?: string): EvalError; - readonly prototype: EvalError; -} - -declare const EvalError: EvalErrorConstructor; - -interface RangeError extends Error { -} - -interface RangeErrorConstructor { - new (message?: string): RangeError; - (message?: string): RangeError; - readonly prototype: RangeError; -} - -declare const RangeError: RangeErrorConstructor; - -interface ReferenceError extends Error { -} - -interface ReferenceErrorConstructor { - new (message?: string): ReferenceError; - (message?: string): ReferenceError; - readonly prototype: ReferenceError; -} - -declare const ReferenceError: ReferenceErrorConstructor; - -interface SyntaxError extends Error { -} - -interface SyntaxErrorConstructor { - new (message?: string): SyntaxError; - (message?: string): SyntaxError; - readonly prototype: SyntaxError; -} - -declare const SyntaxError: SyntaxErrorConstructor; - -interface TypeError extends Error { -} - -interface TypeErrorConstructor { - new (message?: string): TypeError; - (message?: string): TypeError; - readonly prototype: TypeError; -} - -declare const TypeError: TypeErrorConstructor; - -interface URIError extends Error { -} - -interface URIErrorConstructor { - new (message?: string): URIError; - (message?: string): URIError; - readonly prototype: URIError; -} - -declare const URIError: URIErrorConstructor; - -interface JSON { - /** - * Converts a JavaScript Object Notation (JSON) string into an object. - * @param text A valid JSON string. - * @param reviver A function that transforms the results. This function is called for each member of the object. - * If a member contains nested objects, the nested objects are transformed before the parent object is. - */ - parse(text: string, reviver?: (key: any, value: any) => any): any; - /** - * Converts a JavaScript value to a JavaScript Object Notation (JSON) string. - * @param value A JavaScript value, usually an object or array, to be converted. - */ - stringify(value: any): string; - /** - * Converts a JavaScript value to a JavaScript Object Notation (JSON) string. - * @param value A JavaScript value, usually an object or array, to be converted. - * @param replacer A function that transforms the results. - */ - stringify(value: any, replacer: (key: string, value: any) => any): string; - /** - * Converts a JavaScript value to a JavaScript Object Notation (JSON) string. - * @param value A JavaScript value, usually an object or array, to be converted. - * @param replacer Array that transforms the results. - */ - stringify(value: any, replacer: any[]): string; - /** - * Converts a JavaScript value to a JavaScript Object Notation (JSON) string. - * @param value A JavaScript value, usually an object or array, to be converted. - * @param replacer A function that transforms the results. - * @param space Adds indentation, white space, and line break characters to the return-value JSON text to make it easier to read. - */ - stringify(value: any, replacer: (key: string, value: any) => any, space: string | number): string; - /** - * Converts a JavaScript value to a JavaScript Object Notation (JSON) string. - * @param value A JavaScript value, usually an object or array, to be converted. - * @param replacer Array that transforms the results. - * @param space Adds indentation, white space, and line break characters to the return-value JSON text to make it easier to read. - */ - stringify(value: any, replacer: any[], space: string | number): string; -} -/** - * An intrinsic object that provides functions to convert JavaScript values to and from the JavaScript Object Notation (JSON) format. - */ -declare const JSON: JSON; - - -///////////////////////////// -/// ECMAScript Array API (specially handled by compiler) -///////////////////////////// - -interface ReadonlyArray { - /** - * Gets the length of the array. This is a number one higher than the highest element defined in an array. - */ - readonly length: number; - /** - * Returns a string representation of an array. - */ - toString(): string; - toLocaleString(): string; - /** - * Combines two or more arrays. - * @param items Additional items to add to the end of array1. - */ - concat>(...items: U[]): T[]; - /** - * Combines two or more arrays. - * @param items Additional items to add to the end of array1. - */ - concat(...items: T[]): T[]; - /** - * Adds all the elements of an array separated by the specified separator string. - * @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. - */ - join(separator?: string): string; - /** - * Returns a section of an array. - * @param start The beginning of the specified portion of the array. - * @param end The end of the specified portion of the array. - */ - slice(start?: number, end?: number): T[]; - /** - * Returns the index of the first occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the search starts at index 0. - */ - indexOf(searchElement: T, fromIndex?: number): number; - - /** - * Returns the index of the last occurrence of a specified value in an array. - * @param searchElement The value to locate in the array. - * @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. - */ - lastIndexOf(searchElement: T, fromIndex?: number): number; - /** - * Determines whether all the members of an array satisfy the specified test. - * @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. - * @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. - */ - every(callbackfn: (value: T, index: number, array: ReadonlyArray) => boolean, thisArg?: any): boolean; - /** - * Determines whether the specified callback function returns true for any element of an array. - * @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. - * @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. - */ - some(callbackfn: (value: T, index: number, array: ReadonlyArray) => boolean, thisArg?: any): boolean; - /** - * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the callbackfn function one time for each element in the array. - * @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. - */ - forEach(callbackfn: (value: T, index: number, array: ReadonlyArray) => void, thisArg?: any): void; - /** - * Calls a defined callback function on each element of an array, and returns an array that contains the results. - * @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. - * @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. - */ - map(callbackfn: (value: T, index: number, array: ReadonlyArray) => U, thisArg?: any): U[]; - /** - * Returns the elements of an array that meet the condition specified in a callback function. - * @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. - * @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. - */ - filter(callbackfn: (value: T, index: number, array: ReadonlyArray) => boolean, thisArg?: any): T[]; - /** - * 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. - * @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. - * @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. - */ - reduce(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: ReadonlyArray) => T, initialValue?: T): T; - /** - * 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. - * @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. - * @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. - */ - reduce(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: ReadonlyArray) => U, initialValue: U): U; - /** - * 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. - * @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. - * @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. - */ - reduceRight(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: ReadonlyArray) => T, initialValue?: T): T; - /** - * 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. - * @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. - * @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. - */ - reduceRight(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: ReadonlyArray) => U, initialValue: U): U; - - readonly [n: number]: T; -} - -interface Array { - /** - * Gets or sets the length of the array. This is a number one higher than the highest element defined in an array. - */ - length: number; - /** - * Returns a string representation of an array. - */ - toString(): string; - toLocaleString(): string; - /** - * Appends new elements to an array, and returns the new length of the array. - * @param items New elements of the Array. - */ - push(...items: T[]): number; - /** - * Removes the last element from an array and returns it. - */ - pop(): T; - /** - * Combines two or more arrays. - * @param items Additional items to add to the end of array1. - */ - concat(...items: (T | T[])[]): T[]; - /** - * Adds all the elements of an array separated by the specified separator string. - * @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. - */ - join(separator?: string): string; - /** - * Reverses the elements in an Array. - */ - reverse(): T[]; - /** - * Removes the first element from an array and returns it. - */ - shift(): T; - /** - * Returns a section of an array. - * @param start The beginning of the specified portion of the array. - * @param end The end of the specified portion of the array. - */ - slice(start?: number, end?: number): T[]; - /** - * Sorts an array. - * @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. - */ - sort(compareFn?: (a: T, b: T) => number): T[]; - /** - * Removes elements from an array and, if necessary, inserts new elements in their place, returning the deleted elements. - * @param start The zero-based location in the array from which to start removing elements. - */ - splice(start: number): T[]; - /** - * Removes elements from an array and, if necessary, inserts new elements in their place, returning the deleted elements. - * @param start The zero-based location in the array from which to start removing elements. - * @param deleteCount The number of elements to remove. - * @param items Elements to insert into the array in place of the deleted elements. - */ - splice(start: number, deleteCount: number, ...items: T[]): T[]; - /** - * Inserts new elements at the start of an array. - * @param items Elements to insert at the start of the Array. - */ - unshift(...items: T[]): number; - /** - * Returns the index of the first occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the search starts at index 0. - */ - indexOf(searchElement: T, fromIndex?: number): number; - /** - * Returns the index of the last occurrence of a specified value in an array. - * @param searchElement The value to locate in the array. - * @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. - */ - lastIndexOf(searchElement: T, fromIndex?: number): number; - /** - * Determines whether all the members of an array satisfy the specified test. - * @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. - * @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. - */ - every(callbackfn: (value: T, index: number, array: T[]) => boolean, thisArg?: any): boolean; - /** - * Determines whether the specified callback function returns true for any element of an array. - * @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. - * @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. - */ - some(callbackfn: (value: T, index: number, array: T[]) => boolean, thisArg?: any): boolean; - /** - * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the callbackfn function one time for each element in the array. - * @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. - */ - forEach(callbackfn: (value: T, index: number, array: T[]) => void, thisArg?: any): void; - /** - * Calls a defined callback function on each element of an array, and returns an array that contains the results. - * @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. - * @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. - */ - map(callbackfn: (value: T, index: number, array: T[]) => U, thisArg?: any): U[]; - /** - * Returns the elements of an array that meet the condition specified in a callback function. - * @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. - * @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. - */ - filter(callbackfn: (value: T, index: number, array: T[]) => boolean, thisArg?: any): T[]; - /** - * 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. - * @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. - * @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. - */ - reduce(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T, initialValue?: T): T; - /** - * 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. - * @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. - * @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. - */ - reduce(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: T[]) => U, initialValue: U): U; - /** - * 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. - * @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. - * @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. - */ - reduceRight(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T, initialValue?: T): T; - /** - * 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. - * @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. - * @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. - */ - reduceRight(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: T[]) => U, initialValue: U): U; - - [n: number]: T; -} - -interface ArrayConstructor { - new (arrayLength?: number): any[]; - new (arrayLength: number): T[]; - new (...items: T[]): T[]; - (arrayLength?: number): any[]; - (arrayLength: number): T[]; - (...items: T[]): T[]; - isArray(arg: any): arg is Array; - readonly prototype: Array; -} - -declare const Array: ArrayConstructor; - -interface TypedPropertyDescriptor { - enumerable?: boolean; - configurable?: boolean; - writable?: boolean; - value?: T; - get?: () => T; - set?: (value: T) => void; -} - -declare type ClassDecorator = (target: TFunction) => TFunction | void; -declare type PropertyDecorator = (target: Object, propertyKey: string | symbol) => void; -declare type MethodDecorator = (target: Object, propertyKey: string | symbol, descriptor: TypedPropertyDescriptor) => TypedPropertyDescriptor | void; -declare type ParameterDecorator = (target: Object, propertyKey: string | symbol, parameterIndex: number) => void; - -declare type PromiseConstructorLike = new (executor: (resolve: (value?: T | PromiseLike) => void, reject: (reason?: any) => void) => void) => PromiseLike; - -interface PromiseLike { - /** - * Attaches callbacks for the resolution and/or rejection of the Promise. - * @param onfulfilled The callback to execute when the Promise is resolved. - * @param onrejected The callback to execute when the Promise is rejected. - * @returns A Promise for the completion of which ever callback is executed. - */ - then(onfulfilled?: (value: T) => TResult | PromiseLike, onrejected?: (reason: any) => TResult | PromiseLike): PromiseLike; - then(onfulfilled?: (value: T) => TResult | PromiseLike, onrejected?: (reason: any) => void): PromiseLike; -} - -interface ArrayLike { - readonly length: number; - readonly [n: number]: T; -} - -/** - * Represents a raw buffer of binary data, which is used to store data for the - * different typed arrays. ArrayBuffers cannot be read from or written to directly, - * but can be passed to a typed array or DataView Object to interpret the raw - * buffer as needed. - */ -interface ArrayBuffer { - /** - * Read-only. The length of the ArrayBuffer (in bytes). - */ - readonly byteLength: number; - - /** - * Returns a section of an ArrayBuffer. - */ - slice(begin:number, end?:number): ArrayBuffer; -} - -interface ArrayBufferConstructor { - readonly prototype: ArrayBuffer; - new (byteLength: number): ArrayBuffer; - isView(arg: any): arg is ArrayBufferView; -} -declare const ArrayBuffer: ArrayBufferConstructor; - -interface ArrayBufferView { - /** - * The ArrayBuffer instance referenced by the array. - */ - buffer: ArrayBuffer; - - /** - * The length in bytes of the array. - */ - byteLength: number; - - /** - * The offset in bytes of the array. - */ - byteOffset: number; -} - -interface DataView { - readonly buffer: ArrayBuffer; - readonly byteLength: number; - readonly byteOffset: number; - /** - * Gets the Float32 value at the specified byte offset from the start of the view. There is - * no alignment constraint; multi-byte values may be fetched from any offset. - * @param byteOffset The place in the buffer at which the value should be retrieved. - */ - getFloat32(byteOffset: number, littleEndian?: boolean): number; - - /** - * Gets the Float64 value at the specified byte offset from the start of the view. There is - * no alignment constraint; multi-byte values may be fetched from any offset. - * @param byteOffset The place in the buffer at which the value should be retrieved. - */ - getFloat64(byteOffset: number, littleEndian?: boolean): number; - - /** - * Gets the Int8 value at the specified byte offset from the start of the view. There is - * no alignment constraint; multi-byte values may be fetched from any offset. - * @param byteOffset The place in the buffer at which the value should be retrieved. - */ - getInt8(byteOffset: number): number; - - /** - * Gets the Int16 value at the specified byte offset from the start of the view. There is - * no alignment constraint; multi-byte values may be fetched from any offset. - * @param byteOffset The place in the buffer at which the value should be retrieved. - */ - getInt16(byteOffset: number, littleEndian?: boolean): number; - /** - * Gets the Int32 value at the specified byte offset from the start of the view. There is - * no alignment constraint; multi-byte values may be fetched from any offset. - * @param byteOffset The place in the buffer at which the value should be retrieved. - */ - getInt32(byteOffset: number, littleEndian?: boolean): number; - - /** - * Gets the Uint8 value at the specified byte offset from the start of the view. There is - * no alignment constraint; multi-byte values may be fetched from any offset. - * @param byteOffset The place in the buffer at which the value should be retrieved. - */ - getUint8(byteOffset: number): number; - - /** - * Gets the Uint16 value at the specified byte offset from the start of the view. There is - * no alignment constraint; multi-byte values may be fetched from any offset. - * @param byteOffset The place in the buffer at which the value should be retrieved. - */ - getUint16(byteOffset: number, littleEndian?: boolean): number; - - /** - * Gets the Uint32 value at the specified byte offset from the start of the view. There is - * no alignment constraint; multi-byte values may be fetched from any offset. - * @param byteOffset The place in the buffer at which the value should be retrieved. - */ - getUint32(byteOffset: number, littleEndian?: boolean): number; - - /** - * Stores an Float32 value at the specified byte offset from the start of the view. - * @param byteOffset The place in the buffer at which the value should be set. - * @param value The value to set. - * @param littleEndian If false or undefined, a big-endian value should be written, - * otherwise a little-endian value should be written. - */ - setFloat32(byteOffset: number, value: number, littleEndian?: boolean): void; - - /** - * Stores an Float64 value at the specified byte offset from the start of the view. - * @param byteOffset The place in the buffer at which the value should be set. - * @param value The value to set. - * @param littleEndian If false or undefined, a big-endian value should be written, - * otherwise a little-endian value should be written. - */ - setFloat64(byteOffset: number, value: number, littleEndian?: boolean): void; - - /** - * Stores an Int8 value at the specified byte offset from the start of the view. - * @param byteOffset The place in the buffer at which the value should be set. - * @param value The value to set. - */ - setInt8(byteOffset: number, value: number): void; - - /** - * Stores an Int16 value at the specified byte offset from the start of the view. - * @param byteOffset The place in the buffer at which the value should be set. - * @param value The value to set. - * @param littleEndian If false or undefined, a big-endian value should be written, - * otherwise a little-endian value should be written. - */ - setInt16(byteOffset: number, value: number, littleEndian?: boolean): void; - - /** - * Stores an Int32 value at the specified byte offset from the start of the view. - * @param byteOffset The place in the buffer at which the value should be set. - * @param value The value to set. - * @param littleEndian If false or undefined, a big-endian value should be written, - * otherwise a little-endian value should be written. - */ - setInt32(byteOffset: number, value: number, littleEndian?: boolean): void; - - /** - * Stores an Uint8 value at the specified byte offset from the start of the view. - * @param byteOffset The place in the buffer at which the value should be set. - * @param value The value to set. - */ - setUint8(byteOffset: number, value: number): void; - - /** - * Stores an Uint16 value at the specified byte offset from the start of the view. - * @param byteOffset The place in the buffer at which the value should be set. - * @param value The value to set. - * @param littleEndian If false or undefined, a big-endian value should be written, - * otherwise a little-endian value should be written. - */ - setUint16(byteOffset: number, value: number, littleEndian?: boolean): void; - - /** - * Stores an Uint32 value at the specified byte offset from the start of the view. - * @param byteOffset The place in the buffer at which the value should be set. - * @param value The value to set. - * @param littleEndian If false or undefined, a big-endian value should be written, - * otherwise a little-endian value should be written. - */ - setUint32(byteOffset: number, value: number, littleEndian?: boolean): void; -} - -interface DataViewConstructor { - new (buffer: ArrayBuffer, byteOffset?: number, byteLength?: number): DataView; -} -declare const DataView: DataViewConstructor; - -/** - * A typed array of 8-bit integer values. The contents are initialized to 0. If the requested - * number of bytes could not be allocated an exception is raised. - */ -interface Int8Array { - /** - * The size in bytes of each element in the array. - */ - readonly BYTES_PER_ELEMENT: number; - - /** - * The ArrayBuffer instance referenced by the array. - */ - readonly buffer: ArrayBuffer; - - /** - * The length in bytes of the array. - */ - readonly byteLength: number; - - /** - * The offset in bytes of the array. - */ - readonly byteOffset: number; - - /** - * Returns the this object after copying a section of the array identified by start and end - * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it - * is treated as length+end. - * @param end If not specified, length of the this object is used as its default value. - */ - copyWithin(target: number, start: number, end?: number): Int8Array; - - /** - * Determines whether all the members of an array satisfy the specified test. - * @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. - * @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. - */ - every(callbackfn: (value: number, index: number, array: Int8Array) => boolean, thisArg?: any): boolean; - - /** - * Returns the this object after filling the section identified by start and end with value - * @param value value to fill array section with - * @param start index to start filling the array at. If start is negative, it is treated as - * length+start where length is the length of the array. - * @param end index to stop filling the array at. If end is negative, it is treated as - * length+end. - */ - fill(value: number, start?: number, end?: number): Int8Array; - - /** - * Returns the elements of an array that meet the condition specified in a callback function. - * @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. - * @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. - */ - filter(callbackfn: (value: number, index: number, array: Int8Array) => boolean, thisArg?: any): Int8Array; - - /** - * Returns the value of the first element in the array where predicate is true, and undefined - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; - - /** - * Returns the index of the first element in the array where predicate is true, and undefined - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - findIndex(predicate: (value: number) => boolean, thisArg?: any): number; - - /** - * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the - * callbackfn function one time for each element in the array. - * @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. - */ - forEach(callbackfn: (value: number, index: number, array: Int8Array) => void, thisArg?: any): void; - - /** - * Returns the index of the first occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - indexOf(searchElement: number, fromIndex?: number): number; - - /** - * Adds all the elements of an array separated by the specified separator string. - * @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. - */ - join(separator?: string): string; - - /** - * Returns the index of the last occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - lastIndexOf(searchElement: number, fromIndex?: number): number; - - /** - * The length of the array. - */ - readonly length: number; - - /** - * Calls a defined callback function on each element of an array, and returns an array that - * contains the results. - * @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. - * @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. - */ - map(callbackfn: (value: number, index: number, array: Int8Array) => number, thisArg?: any): Int8Array; - - /** - * 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. - * @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. - * @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. - */ - reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int8Array) => number, initialValue?: number): number; - - /** - * 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. - * @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. - * @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. - */ - reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int8Array) => U, initialValue: U): U; - - /** - * 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. - * @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. - * @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. - */ - reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int8Array) => number, initialValue?: number): number; - - /** - * 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. - * @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. - * @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. - */ - reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int8Array) => U, initialValue: U): U; - - /** - * Reverses the elements in an Array. - */ - reverse(): Int8Array; - - /** - * Sets a value or an array of values. - * @param index The index of the location to set. - * @param value The value to set. - */ - set(index: number, value: number): void; - - /** - * Sets a value or an array of values. - * @param array A typed or untyped array of values to set. - * @param offset The index in the current array at which the values are to be written. - */ - set(array: ArrayLike, offset?: number): void; - - /** - * Returns a section of an array. - * @param start The beginning of the specified portion of the array. - * @param end The end of the specified portion of the array. - */ - slice(start?: number, end?: number): Int8Array; - - /** - * Determines whether the specified callback function returns true for any element of an array. - * @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. - * @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. - */ - some(callbackfn: (value: number, index: number, array: Int8Array) => boolean, thisArg?: any): boolean; - - /** - * Sorts an array. - * @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. - */ - sort(compareFn?: (a: number, b: number) => number): Int8Array; - - /** - * Gets a new Int8Array view of the ArrayBuffer store for this array, referencing the elements - * at begin, inclusive, up to end, exclusive. - * @param begin The index of the beginning of the array. - * @param end The index of the end of the array. - */ - subarray(begin: number, end?: number): Int8Array; - - /** - * Converts a number to a string by using the current locale. - */ - toLocaleString(): string; - - /** - * Returns a string representation of an array. - */ - toString(): string; - - [index: number]: number; -} -interface Int8ArrayConstructor { - readonly prototype: Int8Array; - new (length: number): Int8Array; - new (array: ArrayLike): Int8Array; - new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Int8Array; - - /** - * The size in bytes of each element in the array. - */ - readonly BYTES_PER_ELEMENT: number; - - /** - * Returns a new array from a set of elements. - * @param items A set of elements to include in the new array object. - */ - of(...items: number[]): Int8Array; - - /** - * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Int8Array; - -} -declare const Int8Array: Int8ArrayConstructor; - -/** - * A typed array of 8-bit unsigned integer values. The contents are initialized to 0. If the - * requested number of bytes could not be allocated an exception is raised. - */ -interface Uint8Array { - /** - * The size in bytes of each element in the array. - */ - readonly BYTES_PER_ELEMENT: number; - - /** - * The ArrayBuffer instance referenced by the array. - */ - readonly buffer: ArrayBuffer; - - /** - * The length in bytes of the array. - */ - readonly byteLength: number; - - /** - * The offset in bytes of the array. - */ - readonly byteOffset: number; - - /** - * Returns the this object after copying a section of the array identified by start and end - * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it - * is treated as length+end. - * @param end If not specified, length of the this object is used as its default value. - */ - copyWithin(target: number, start: number, end?: number): Uint8Array; - - /** - * Determines whether all the members of an array satisfy the specified test. - * @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. - * @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. - */ - every(callbackfn: (value: number, index: number, array: Uint8Array) => boolean, thisArg?: any): boolean; - - /** - * Returns the this object after filling the section identified by start and end with value - * @param value value to fill array section with - * @param start index to start filling the array at. If start is negative, it is treated as - * length+start where length is the length of the array. - * @param end index to stop filling the array at. If end is negative, it is treated as - * length+end. - */ - fill(value: number, start?: number, end?: number): Uint8Array; - - /** - * Returns the elements of an array that meet the condition specified in a callback function. - * @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. - * @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. - */ - filter(callbackfn: (value: number, index: number, array: Uint8Array) => boolean, thisArg?: any): Uint8Array; - - /** - * Returns the value of the first element in the array where predicate is true, and undefined - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; - - /** - * Returns the index of the first element in the array where predicate is true, and undefined - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - findIndex(predicate: (value: number) => boolean, thisArg?: any): number; - - /** - * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the - * callbackfn function one time for each element in the array. - * @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. - */ - forEach(callbackfn: (value: number, index: number, array: Uint8Array) => void, thisArg?: any): void; - - /** - * Returns the index of the first occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - indexOf(searchElement: number, fromIndex?: number): number; - - /** - * Adds all the elements of an array separated by the specified separator string. - * @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. - */ - join(separator?: string): string; - - /** - * Returns the index of the last occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - lastIndexOf(searchElement: number, fromIndex?: number): number; - - /** - * The length of the array. - */ - readonly length: number; - - /** - * Calls a defined callback function on each element of an array, and returns an array that - * contains the results. - * @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. - * @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. - */ - map(callbackfn: (value: number, index: number, array: Uint8Array) => number, thisArg?: any): Uint8Array; - - /** - * 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. - * @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. - * @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. - */ - reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8Array) => number, initialValue?: number): number; - - /** - * 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. - * @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. - * @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. - */ - reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint8Array) => U, initialValue: U): U; - - /** - * 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. - * @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. - * @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. - */ - reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8Array) => number, initialValue?: number): number; - - /** - * 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. - * @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. - * @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. - */ - reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint8Array) => U, initialValue: U): U; - - /** - * Reverses the elements in an Array. - */ - reverse(): Uint8Array; - - /** - * Sets a value or an array of values. - * @param index The index of the location to set. - * @param value The value to set. - */ - set(index: number, value: number): void; - - /** - * Sets a value or an array of values. - * @param array A typed or untyped array of values to set. - * @param offset The index in the current array at which the values are to be written. - */ - set(array: ArrayLike, offset?: number): void; - - /** - * Returns a section of an array. - * @param start The beginning of the specified portion of the array. - * @param end The end of the specified portion of the array. - */ - slice(start?: number, end?: number): Uint8Array; - - /** - * Determines whether the specified callback function returns true for any element of an array. - * @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. - * @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. - */ - some(callbackfn: (value: number, index: number, array: Uint8Array) => boolean, thisArg?: any): boolean; - - /** - * Sorts an array. - * @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. - */ - sort(compareFn?: (a: number, b: number) => number): Uint8Array; - - /** - * Gets a new Uint8Array view of the ArrayBuffer store for this array, referencing the elements - * at begin, inclusive, up to end, exclusive. - * @param begin The index of the beginning of the array. - * @param end The index of the end of the array. - */ - subarray(begin: number, end?: number): Uint8Array; - - /** - * Converts a number to a string by using the current locale. - */ - toLocaleString(): string; - - /** - * Returns a string representation of an array. - */ - toString(): string; - - [index: number]: number; -} - -interface Uint8ArrayConstructor { - readonly prototype: Uint8Array; - new (length: number): Uint8Array; - new (array: ArrayLike): Uint8Array; - new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Uint8Array; - - /** - * The size in bytes of each element in the array. - */ - readonly BYTES_PER_ELEMENT: number; - - /** - * Returns a new array from a set of elements. - * @param items A set of elements to include in the new array object. - */ - of(...items: number[]): Uint8Array; - - /** - * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint8Array; - -} -declare const Uint8Array: Uint8ArrayConstructor; - -/** - * A typed array of 8-bit unsigned integer (clamped) values. The contents are initialized to 0. - * If the requested number of bytes could not be allocated an exception is raised. - */ -interface Uint8ClampedArray { - /** - * The size in bytes of each element in the array. - */ - readonly BYTES_PER_ELEMENT: number; - - /** - * The ArrayBuffer instance referenced by the array. - */ - readonly buffer: ArrayBuffer; - - /** - * The length in bytes of the array. - */ - readonly byteLength: number; - - /** - * The offset in bytes of the array. - */ - readonly byteOffset: number; - - /** - * Returns the this object after copying a section of the array identified by start and end - * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it - * is treated as length+end. - * @param end If not specified, length of the this object is used as its default value. - */ - copyWithin(target: number, start: number, end?: number): Uint8ClampedArray; - - /** - * Determines whether all the members of an array satisfy the specified test. - * @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. - * @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. - */ - every(callbackfn: (value: number, index: number, array: Uint8ClampedArray) => boolean, thisArg?: any): boolean; - - /** - * Returns the this object after filling the section identified by start and end with value - * @param value value to fill array section with - * @param start index to start filling the array at. If start is negative, it is treated as - * length+start where length is the length of the array. - * @param end index to stop filling the array at. If end is negative, it is treated as - * length+end. - */ - fill(value: number, start?: number, end?: number): Uint8ClampedArray; - - /** - * Returns the elements of an array that meet the condition specified in a callback function. - * @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. - * @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. - */ - filter(callbackfn: (value: number, index: number, array: Uint8ClampedArray) => boolean, thisArg?: any): Uint8ClampedArray; - - /** - * Returns the value of the first element in the array where predicate is true, and undefined - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; - - /** - * Returns the index of the first element in the array where predicate is true, and undefined - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - findIndex(predicate: (value: number) => boolean, thisArg?: any): number; - - /** - * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the - * callbackfn function one time for each element in the array. - * @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. - */ - forEach(callbackfn: (value: number, index: number, array: Uint8ClampedArray) => void, thisArg?: any): void; - - /** - * Returns the index of the first occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - indexOf(searchElement: number, fromIndex?: number): number; - - /** - * Adds all the elements of an array separated by the specified separator string. - * @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. - */ - join(separator?: string): string; - - /** - * Returns the index of the last occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - lastIndexOf(searchElement: number, fromIndex?: number): number; - - /** - * The length of the array. - */ - readonly length: number; - - /** - * Calls a defined callback function on each element of an array, and returns an array that - * contains the results. - * @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. - * @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. - */ - map(callbackfn: (value: number, index: number, array: Uint8ClampedArray) => number, thisArg?: any): Uint8ClampedArray; - - /** - * 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. - * @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. - * @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. - */ - reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8ClampedArray) => number, initialValue?: number): number; - - /** - * 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. - * @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. - * @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. - */ - reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint8ClampedArray) => U, initialValue: U): U; - - /** - * 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. - * @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. - * @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. - */ - reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8ClampedArray) => number, initialValue?: number): number; - - /** - * 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. - * @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. - * @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. - */ - reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint8ClampedArray) => U, initialValue: U): U; - - /** - * Reverses the elements in an Array. - */ - reverse(): Uint8ClampedArray; - - /** - * Sets a value or an array of values. - * @param index The index of the location to set. - * @param value The value to set. - */ - set(index: number, value: number): void; - - /** - * Sets a value or an array of values. - * @param array A typed or untyped array of values to set. - * @param offset The index in the current array at which the values are to be written. - */ - set(array: Uint8ClampedArray, offset?: number): void; - - /** - * Returns a section of an array. - * @param start The beginning of the specified portion of the array. - * @param end The end of the specified portion of the array. - */ - slice(start?: number, end?: number): Uint8ClampedArray; - - /** - * Determines whether the specified callback function returns true for any element of an array. - * @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. - * @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. - */ - some(callbackfn: (value: number, index: number, array: Uint8ClampedArray) => boolean, thisArg?: any): boolean; - - /** - * Sorts an array. - * @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. - */ - sort(compareFn?: (a: number, b: number) => number): Uint8ClampedArray; - - /** - * Gets a new Uint8ClampedArray view of the ArrayBuffer store for this array, referencing the elements - * at begin, inclusive, up to end, exclusive. - * @param begin The index of the beginning of the array. - * @param end The index of the end of the array. - */ - subarray(begin: number, end?: number): Uint8ClampedArray; - - /** - * Converts a number to a string by using the current locale. - */ - toLocaleString(): string; - - /** - * Returns a string representation of an array. - */ - toString(): string; - - [index: number]: number; -} - -interface Uint8ClampedArrayConstructor { - readonly prototype: Uint8ClampedArray; - new (length: number): Uint8ClampedArray; - new (array: ArrayLike): Uint8ClampedArray; - new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Uint8ClampedArray; - - /** - * The size in bytes of each element in the array. - */ - readonly BYTES_PER_ELEMENT: number; - - /** - * Returns a new array from a set of elements. - * @param items A set of elements to include in the new array object. - */ - of(...items: number[]): Uint8ClampedArray; - - /** - * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint8ClampedArray; -} -declare const Uint8ClampedArray: Uint8ClampedArrayConstructor; - -/** - * A typed array of 16-bit signed integer values. The contents are initialized to 0. If the - * requested number of bytes could not be allocated an exception is raised. - */ -interface Int16Array { - /** - * The size in bytes of each element in the array. - */ - readonly BYTES_PER_ELEMENT: number; - - /** - * The ArrayBuffer instance referenced by the array. - */ - readonly buffer: ArrayBuffer; - - /** - * The length in bytes of the array. - */ - readonly byteLength: number; - - /** - * The offset in bytes of the array. - */ - readonly byteOffset: number; - - /** - * Returns the this object after copying a section of the array identified by start and end - * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it - * is treated as length+end. - * @param end If not specified, length of the this object is used as its default value. - */ - copyWithin(target: number, start: number, end?: number): Int16Array; - - /** - * Determines whether all the members of an array satisfy the specified test. - * @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. - * @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. - */ - every(callbackfn: (value: number, index: number, array: Int16Array) => boolean, thisArg?: any): boolean; - - /** - * Returns the this object after filling the section identified by start and end with value - * @param value value to fill array section with - * @param start index to start filling the array at. If start is negative, it is treated as - * length+start where length is the length of the array. - * @param end index to stop filling the array at. If end is negative, it is treated as - * length+end. - */ - fill(value: number, start?: number, end?: number): Int16Array; - - /** - * Returns the elements of an array that meet the condition specified in a callback function. - * @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. - * @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. - */ - filter(callbackfn: (value: number, index: number, array: Int16Array) => boolean, thisArg?: any): Int16Array; - - /** - * Returns the value of the first element in the array where predicate is true, and undefined - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; - - /** - * Returns the index of the first element in the array where predicate is true, and undefined - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - findIndex(predicate: (value: number) => boolean, thisArg?: any): number; - - /** - * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the - * callbackfn function one time for each element in the array. - * @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. - */ - forEach(callbackfn: (value: number, index: number, array: Int16Array) => void, thisArg?: any): void; - - /** - * Returns the index of the first occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - indexOf(searchElement: number, fromIndex?: number): number; - - /** - * Adds all the elements of an array separated by the specified separator string. - * @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. - */ - join(separator?: string): string; - - /** - * Returns the index of the last occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - lastIndexOf(searchElement: number, fromIndex?: number): number; - - /** - * The length of the array. - */ - readonly length: number; - - /** - * Calls a defined callback function on each element of an array, and returns an array that - * contains the results. - * @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. - * @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. - */ - map(callbackfn: (value: number, index: number, array: Int16Array) => number, thisArg?: any): Int16Array; - - /** - * 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. - * @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. - * @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. - */ - reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int16Array) => number, initialValue?: number): number; - - /** - * 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. - * @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. - * @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. - */ - reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int16Array) => U, initialValue: U): U; - - /** - * 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. - * @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. - * @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. - */ - reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int16Array) => number, initialValue?: number): number; - - /** - * 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. - * @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. - * @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. - */ - reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int16Array) => U, initialValue: U): U; - - /** - * Reverses the elements in an Array. - */ - reverse(): Int16Array; - - /** - * Sets a value or an array of values. - * @param index The index of the location to set. - * @param value The value to set. - */ - set(index: number, value: number): void; - - /** - * Sets a value or an array of values. - * @param array A typed or untyped array of values to set. - * @param offset The index in the current array at which the values are to be written. - */ - set(array: ArrayLike, offset?: number): void; - - /** - * Returns a section of an array. - * @param start The beginning of the specified portion of the array. - * @param end The end of the specified portion of the array. - */ - slice(start?: number, end?: number): Int16Array; - - /** - * Determines whether the specified callback function returns true for any element of an array. - * @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. - * @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. - */ - some(callbackfn: (value: number, index: number, array: Int16Array) => boolean, thisArg?: any): boolean; - - /** - * Sorts an array. - * @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. - */ - sort(compareFn?: (a: number, b: number) => number): Int16Array; - - /** - * Gets a new Int16Array view of the ArrayBuffer store for this array, referencing the elements - * at begin, inclusive, up to end, exclusive. - * @param begin The index of the beginning of the array. - * @param end The index of the end of the array. - */ - subarray(begin: number, end?: number): Int16Array; - - /** - * Converts a number to a string by using the current locale. - */ - toLocaleString(): string; - - /** - * Returns a string representation of an array. - */ - toString(): string; - - [index: number]: number; -} - -interface Int16ArrayConstructor { - readonly prototype: Int16Array; - new (length: number): Int16Array; - new (array: ArrayLike): Int16Array; - new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Int16Array; - - /** - * The size in bytes of each element in the array. - */ - readonly BYTES_PER_ELEMENT: number; - - /** - * Returns a new array from a set of elements. - * @param items A set of elements to include in the new array object. - */ - of(...items: number[]): Int16Array; - - /** - * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Int16Array; - -} -declare const Int16Array: Int16ArrayConstructor; - -/** - * A typed array of 16-bit unsigned integer values. The contents are initialized to 0. If the - * requested number of bytes could not be allocated an exception is raised. - */ -interface Uint16Array { - /** - * The size in bytes of each element in the array. - */ - readonly BYTES_PER_ELEMENT: number; - - /** - * The ArrayBuffer instance referenced by the array. - */ - readonly buffer: ArrayBuffer; - - /** - * The length in bytes of the array. - */ - readonly byteLength: number; - - /** - * The offset in bytes of the array. - */ - readonly byteOffset: number; - - /** - * Returns the this object after copying a section of the array identified by start and end - * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it - * is treated as length+end. - * @param end If not specified, length of the this object is used as its default value. - */ - copyWithin(target: number, start: number, end?: number): Uint16Array; - - /** - * Determines whether all the members of an array satisfy the specified test. - * @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. - * @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. - */ - every(callbackfn: (value: number, index: number, array: Uint16Array) => boolean, thisArg?: any): boolean; - - /** - * Returns the this object after filling the section identified by start and end with value - * @param value value to fill array section with - * @param start index to start filling the array at. If start is negative, it is treated as - * length+start where length is the length of the array. - * @param end index to stop filling the array at. If end is negative, it is treated as - * length+end. - */ - fill(value: number, start?: number, end?: number): Uint16Array; - - /** - * Returns the elements of an array that meet the condition specified in a callback function. - * @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. - * @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. - */ - filter(callbackfn: (value: number, index: number, array: Uint16Array) => boolean, thisArg?: any): Uint16Array; - - /** - * Returns the value of the first element in the array where predicate is true, and undefined - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; - - /** - * Returns the index of the first element in the array where predicate is true, and undefined - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - findIndex(predicate: (value: number) => boolean, thisArg?: any): number; - - /** - * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the - * callbackfn function one time for each element in the array. - * @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. - */ - forEach(callbackfn: (value: number, index: number, array: Uint16Array) => void, thisArg?: any): void; - - /** - * Returns the index of the first occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - indexOf(searchElement: number, fromIndex?: number): number; - - /** - * Adds all the elements of an array separated by the specified separator string. - * @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. - */ - join(separator?: string): string; - - /** - * Returns the index of the last occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - lastIndexOf(searchElement: number, fromIndex?: number): number; - - /** - * The length of the array. - */ - readonly length: number; - - /** - * Calls a defined callback function on each element of an array, and returns an array that - * contains the results. - * @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. - * @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. - */ - map(callbackfn: (value: number, index: number, array: Uint16Array) => number, thisArg?: any): Uint16Array; - - /** - * 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. - * @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. - * @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. - */ - reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint16Array) => number, initialValue?: number): number; - - /** - * 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. - * @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. - * @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. - */ - reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint16Array) => U, initialValue: U): U; - - /** - * 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. - * @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. - * @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. - */ - reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint16Array) => number, initialValue?: number): number; - - /** - * 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. - * @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. - * @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. - */ - reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint16Array) => U, initialValue: U): U; - - /** - * Reverses the elements in an Array. - */ - reverse(): Uint16Array; - - /** - * Sets a value or an array of values. - * @param index The index of the location to set. - * @param value The value to set. - */ - set(index: number, value: number): void; - - /** - * Sets a value or an array of values. - * @param array A typed or untyped array of values to set. - * @param offset The index in the current array at which the values are to be written. - */ - set(array: ArrayLike, offset?: number): void; - - /** - * Returns a section of an array. - * @param start The beginning of the specified portion of the array. - * @param end The end of the specified portion of the array. - */ - slice(start?: number, end?: number): Uint16Array; - - /** - * Determines whether the specified callback function returns true for any element of an array. - * @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. - * @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. - */ - some(callbackfn: (value: number, index: number, array: Uint16Array) => boolean, thisArg?: any): boolean; - - /** - * Sorts an array. - * @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. - */ - sort(compareFn?: (a: number, b: number) => number): Uint16Array; - - /** - * Gets a new Uint16Array view of the ArrayBuffer store for this array, referencing the elements - * at begin, inclusive, up to end, exclusive. - * @param begin The index of the beginning of the array. - * @param end The index of the end of the array. - */ - subarray(begin: number, end?: number): Uint16Array; - - /** - * Converts a number to a string by using the current locale. - */ - toLocaleString(): string; - - /** - * Returns a string representation of an array. - */ - toString(): string; - - [index: number]: number; -} - -interface Uint16ArrayConstructor { - readonly prototype: Uint16Array; - new (length: number): Uint16Array; - new (array: ArrayLike): Uint16Array; - new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Uint16Array; - - /** - * The size in bytes of each element in the array. - */ - readonly BYTES_PER_ELEMENT: number; - - /** - * Returns a new array from a set of elements. - * @param items A set of elements to include in the new array object. - */ - of(...items: number[]): Uint16Array; - - /** - * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint16Array; - -} -declare const Uint16Array: Uint16ArrayConstructor; -/** - * A typed array of 32-bit signed integer values. The contents are initialized to 0. If the - * requested number of bytes could not be allocated an exception is raised. - */ -interface Int32Array { - /** - * The size in bytes of each element in the array. - */ - readonly BYTES_PER_ELEMENT: number; - - /** - * The ArrayBuffer instance referenced by the array. - */ - readonly buffer: ArrayBuffer; - - /** - * The length in bytes of the array. - */ - readonly byteLength: number; - - /** - * The offset in bytes of the array. - */ - readonly byteOffset: number; - - /** - * Returns the this object after copying a section of the array identified by start and end - * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it - * is treated as length+end. - * @param end If not specified, length of the this object is used as its default value. - */ - copyWithin(target: number, start: number, end?: number): Int32Array; - - /** - * Determines whether all the members of an array satisfy the specified test. - * @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. - * @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. - */ - every(callbackfn: (value: number, index: number, array: Int32Array) => boolean, thisArg?: any): boolean; - - /** - * Returns the this object after filling the section identified by start and end with value - * @param value value to fill array section with - * @param start index to start filling the array at. If start is negative, it is treated as - * length+start where length is the length of the array. - * @param end index to stop filling the array at. If end is negative, it is treated as - * length+end. - */ - fill(value: number, start?: number, end?: number): Int32Array; - - /** - * Returns the elements of an array that meet the condition specified in a callback function. - * @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. - * @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. - */ - filter(callbackfn: (value: number, index: number, array: Int32Array) => boolean, thisArg?: any): Int32Array; - - /** - * Returns the value of the first element in the array where predicate is true, and undefined - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; - - /** - * Returns the index of the first element in the array where predicate is true, and undefined - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - findIndex(predicate: (value: number) => boolean, thisArg?: any): number; - - /** - * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the - * callbackfn function one time for each element in the array. - * @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. - */ - forEach(callbackfn: (value: number, index: number, array: Int32Array) => void, thisArg?: any): void; - - /** - * Returns the index of the first occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - indexOf(searchElement: number, fromIndex?: number): number; - - /** - * Adds all the elements of an array separated by the specified separator string. - * @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. - */ - join(separator?: string): string; - - /** - * Returns the index of the last occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - lastIndexOf(searchElement: number, fromIndex?: number): number; - - /** - * The length of the array. - */ - readonly length: number; - - /** - * Calls a defined callback function on each element of an array, and returns an array that - * contains the results. - * @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. - * @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. - */ - map(callbackfn: (value: number, index: number, array: Int32Array) => number, thisArg?: any): Int32Array; - - /** - * 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. - * @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. - * @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. - */ - reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int32Array) => number, initialValue?: number): number; - - /** - * 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. - * @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. - * @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. - */ - reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int32Array) => U, initialValue: U): U; - - /** - * 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. - * @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. - * @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. - */ - reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int32Array) => number, initialValue?: number): number; - - /** - * 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. - * @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. - * @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. - */ - reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int32Array) => U, initialValue: U): U; - - /** - * Reverses the elements in an Array. - */ - reverse(): Int32Array; - - /** - * Sets a value or an array of values. - * @param index The index of the location to set. - * @param value The value to set. - */ - set(index: number, value: number): void; - - /** - * Sets a value or an array of values. - * @param array A typed or untyped array of values to set. - * @param offset The index in the current array at which the values are to be written. - */ - set(array: ArrayLike, offset?: number): void; - - /** - * Returns a section of an array. - * @param start The beginning of the specified portion of the array. - * @param end The end of the specified portion of the array. - */ - slice(start?: number, end?: number): Int32Array; - - /** - * Determines whether the specified callback function returns true for any element of an array. - * @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. - * @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. - */ - some(callbackfn: (value: number, index: number, array: Int32Array) => boolean, thisArg?: any): boolean; - - /** - * Sorts an array. - * @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. - */ - sort(compareFn?: (a: number, b: number) => number): Int32Array; - - /** - * Gets a new Int32Array view of the ArrayBuffer store for this array, referencing the elements - * at begin, inclusive, up to end, exclusive. - * @param begin The index of the beginning of the array. - * @param end The index of the end of the array. - */ - subarray(begin: number, end?: number): Int32Array; - - /** - * Converts a number to a string by using the current locale. - */ - toLocaleString(): string; - - /** - * Returns a string representation of an array. - */ - toString(): string; - - [index: number]: number; -} - -interface Int32ArrayConstructor { - readonly prototype: Int32Array; - new (length: number): Int32Array; - new (array: ArrayLike): Int32Array; - new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Int32Array; - - /** - * The size in bytes of each element in the array. - */ - readonly BYTES_PER_ELEMENT: number; - - /** - * Returns a new array from a set of elements. - * @param items A set of elements to include in the new array object. - */ - of(...items: number[]): Int32Array; - - /** - * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Int32Array; -} -declare const Int32Array: Int32ArrayConstructor; - -/** - * A typed array of 32-bit unsigned integer values. The contents are initialized to 0. If the - * requested number of bytes could not be allocated an exception is raised. - */ -interface Uint32Array { - /** - * The size in bytes of each element in the array. - */ - readonly BYTES_PER_ELEMENT: number; - - /** - * The ArrayBuffer instance referenced by the array. - */ - readonly buffer: ArrayBuffer; - - /** - * The length in bytes of the array. - */ - readonly byteLength: number; - - /** - * The offset in bytes of the array. - */ - readonly byteOffset: number; - - /** - * Returns the this object after copying a section of the array identified by start and end - * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it - * is treated as length+end. - * @param end If not specified, length of the this object is used as its default value. - */ - copyWithin(target: number, start: number, end?: number): Uint32Array; - - /** - * Determines whether all the members of an array satisfy the specified test. - * @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. - * @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. - */ - every(callbackfn: (value: number, index: number, array: Uint32Array) => boolean, thisArg?: any): boolean; - - /** - * Returns the this object after filling the section identified by start and end with value - * @param value value to fill array section with - * @param start index to start filling the array at. If start is negative, it is treated as - * length+start where length is the length of the array. - * @param end index to stop filling the array at. If end is negative, it is treated as - * length+end. - */ - fill(value: number, start?: number, end?: number): Uint32Array; - - /** - * Returns the elements of an array that meet the condition specified in a callback function. - * @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. - * @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. - */ - filter(callbackfn: (value: number, index: number, array: Uint32Array) => boolean, thisArg?: any): Uint32Array; - - /** - * Returns the value of the first element in the array where predicate is true, and undefined - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; - - /** - * Returns the index of the first element in the array where predicate is true, and undefined - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - findIndex(predicate: (value: number) => boolean, thisArg?: any): number; - - /** - * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the - * callbackfn function one time for each element in the array. - * @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. - */ - forEach(callbackfn: (value: number, index: number, array: Uint32Array) => void, thisArg?: any): void; - - /** - * Returns the index of the first occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - indexOf(searchElement: number, fromIndex?: number): number; - - /** - * Adds all the elements of an array separated by the specified separator string. - * @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. - */ - join(separator?: string): string; - - /** - * Returns the index of the last occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - lastIndexOf(searchElement: number, fromIndex?: number): number; - - /** - * The length of the array. - */ - readonly length: number; - - /** - * Calls a defined callback function on each element of an array, and returns an array that - * contains the results. - * @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. - * @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. - */ - map(callbackfn: (value: number, index: number, array: Uint32Array) => number, thisArg?: any): Uint32Array; - - /** - * 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. - * @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. - * @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. - */ - reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint32Array) => number, initialValue?: number): number; - - /** - * 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. - * @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. - * @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. - */ - reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint32Array) => U, initialValue: U): U; - - /** - * 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. - * @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. - * @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. - */ - reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint32Array) => number, initialValue?: number): number; - - /** - * 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. - * @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. - * @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. - */ - reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint32Array) => U, initialValue: U): U; - - /** - * Reverses the elements in an Array. - */ - reverse(): Uint32Array; - - /** - * Sets a value or an array of values. - * @param index The index of the location to set. - * @param value The value to set. - */ - set(index: number, value: number): void; - - /** - * Sets a value or an array of values. - * @param array A typed or untyped array of values to set. - * @param offset The index in the current array at which the values are to be written. - */ - set(array: ArrayLike, offset?: number): void; - - /** - * Returns a section of an array. - * @param start The beginning of the specified portion of the array. - * @param end The end of the specified portion of the array. - */ - slice(start?: number, end?: number): Uint32Array; - - /** - * Determines whether the specified callback function returns true for any element of an array. - * @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. - * @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. - */ - some(callbackfn: (value: number, index: number, array: Uint32Array) => boolean, thisArg?: any): boolean; - - /** - * Sorts an array. - * @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. - */ - sort(compareFn?: (a: number, b: number) => number): Uint32Array; - - /** - * Gets a new Uint32Array view of the ArrayBuffer store for this array, referencing the elements - * at begin, inclusive, up to end, exclusive. - * @param begin The index of the beginning of the array. - * @param end The index of the end of the array. - */ - subarray(begin: number, end?: number): Uint32Array; - - /** - * Converts a number to a string by using the current locale. - */ - toLocaleString(): string; - - /** - * Returns a string representation of an array. - */ - toString(): string; - - [index: number]: number; -} - -interface Uint32ArrayConstructor { - readonly prototype: Uint32Array; - new (length: number): Uint32Array; - new (array: ArrayLike): Uint32Array; - new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Uint32Array; - - /** - * The size in bytes of each element in the array. - */ - readonly BYTES_PER_ELEMENT: number; - - /** - * Returns a new array from a set of elements. - * @param items A set of elements to include in the new array object. - */ - of(...items: number[]): Uint32Array; - - /** - * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint32Array; -} -declare const Uint32Array: Uint32ArrayConstructor; - -/** - * A typed array of 32-bit float values. The contents are initialized to 0. If the requested number - * of bytes could not be allocated an exception is raised. - */ -interface Float32Array { - /** - * The size in bytes of each element in the array. - */ - readonly BYTES_PER_ELEMENT: number; - - /** - * The ArrayBuffer instance referenced by the array. - */ - readonly buffer: ArrayBuffer; - - /** - * The length in bytes of the array. - */ - readonly byteLength: number; - - /** - * The offset in bytes of the array. - */ - readonly byteOffset: number; - - /** - * Returns the this object after copying a section of the array identified by start and end - * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it - * is treated as length+end. - * @param end If not specified, length of the this object is used as its default value. - */ - copyWithin(target: number, start: number, end?: number): Float32Array; - - /** - * Determines whether all the members of an array satisfy the specified test. - * @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. - * @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. - */ - every(callbackfn: (value: number, index: number, array: Float32Array) => boolean, thisArg?: any): boolean; - - /** - * Returns the this object after filling the section identified by start and end with value - * @param value value to fill array section with - * @param start index to start filling the array at. If start is negative, it is treated as - * length+start where length is the length of the array. - * @param end index to stop filling the array at. If end is negative, it is treated as - * length+end. - */ - fill(value: number, start?: number, end?: number): Float32Array; - - /** - * Returns the elements of an array that meet the condition specified in a callback function. - * @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. - * @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. - */ - filter(callbackfn: (value: number, index: number, array: Float32Array) => boolean, thisArg?: any): Float32Array; - - /** - * Returns the value of the first element in the array where predicate is true, and undefined - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; - - /** - * Returns the index of the first element in the array where predicate is true, and undefined - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - findIndex(predicate: (value: number) => boolean, thisArg?: any): number; - - /** - * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the - * callbackfn function one time for each element in the array. - * @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. - */ - forEach(callbackfn: (value: number, index: number, array: Float32Array) => void, thisArg?: any): void; - - /** - * Returns the index of the first occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - indexOf(searchElement: number, fromIndex?: number): number; - - /** - * Adds all the elements of an array separated by the specified separator string. - * @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. - */ - join(separator?: string): string; - - /** - * Returns the index of the last occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - lastIndexOf(searchElement: number, fromIndex?: number): number; - - /** - * The length of the array. - */ - readonly length: number; - - /** - * Calls a defined callback function on each element of an array, and returns an array that - * contains the results. - * @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. - * @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. - */ - map(callbackfn: (value: number, index: number, array: Float32Array) => number, thisArg?: any): Float32Array; - - /** - * 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. - * @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. - * @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. - */ - reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float32Array) => number, initialValue?: number): number; - - /** - * 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. - * @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. - * @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. - */ - reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Float32Array) => U, initialValue: U): U; - - /** - * 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. - * @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. - * @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. - */ - reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float32Array) => number, initialValue?: number): number; - - /** - * 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. - * @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. - * @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. - */ - reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Float32Array) => U, initialValue: U): U; - - /** - * Reverses the elements in an Array. - */ - reverse(): Float32Array; - - /** - * Sets a value or an array of values. - * @param index The index of the location to set. - * @param value The value to set. - */ - set(index: number, value: number): void; - - /** - * Sets a value or an array of values. - * @param array A typed or untyped array of values to set. - * @param offset The index in the current array at which the values are to be written. - */ - set(array: ArrayLike, offset?: number): void; - - /** - * Returns a section of an array. - * @param start The beginning of the specified portion of the array. - * @param end The end of the specified portion of the array. - */ - slice(start?: number, end?: number): Float32Array; - - /** - * Determines whether the specified callback function returns true for any element of an array. - * @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. - * @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. - */ - some(callbackfn: (value: number, index: number, array: Float32Array) => boolean, thisArg?: any): boolean; - - /** - * Sorts an array. - * @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. - */ - sort(compareFn?: (a: number, b: number) => number): Float32Array; - - /** - * Gets a new Float32Array view of the ArrayBuffer store for this array, referencing the elements - * at begin, inclusive, up to end, exclusive. - * @param begin The index of the beginning of the array. - * @param end The index of the end of the array. - */ - subarray(begin: number, end?: number): Float32Array; - - /** - * Converts a number to a string by using the current locale. - */ - toLocaleString(): string; - - /** - * Returns a string representation of an array. - */ - toString(): string; - - [index: number]: number; -} - -interface Float32ArrayConstructor { - readonly prototype: Float32Array; - new (length: number): Float32Array; - new (array: ArrayLike): Float32Array; - new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Float32Array; - - /** - * The size in bytes of each element in the array. - */ - readonly BYTES_PER_ELEMENT: number; - - /** - * Returns a new array from a set of elements. - * @param items A set of elements to include in the new array object. - */ - of(...items: number[]): Float32Array; - - /** - * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Float32Array; - -} -declare const Float32Array: Float32ArrayConstructor; - -/** - * A typed array of 64-bit float values. The contents are initialized to 0. If the requested - * number of bytes could not be allocated an exception is raised. - */ -interface Float64Array { - /** - * The size in bytes of each element in the array. - */ - readonly BYTES_PER_ELEMENT: number; - - /** - * The ArrayBuffer instance referenced by the array. - */ - readonly buffer: ArrayBuffer; - - /** - * The length in bytes of the array. - */ - readonly byteLength: number; - - /** - * The offset in bytes of the array. - */ - readonly byteOffset: number; - - /** - * Returns the this object after copying a section of the array identified by start and end - * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it - * is treated as length+end. - * @param end If not specified, length of the this object is used as its default value. - */ - copyWithin(target: number, start: number, end?: number): Float64Array; - - /** - * Determines whether all the members of an array satisfy the specified test. - * @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. - * @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. - */ - every(callbackfn: (value: number, index: number, array: Float64Array) => boolean, thisArg?: any): boolean; - - /** - * Returns the this object after filling the section identified by start and end with value - * @param value value to fill array section with - * @param start index to start filling the array at. If start is negative, it is treated as - * length+start where length is the length of the array. - * @param end index to stop filling the array at. If end is negative, it is treated as - * length+end. - */ - fill(value: number, start?: number, end?: number): Float64Array; - - /** - * Returns the elements of an array that meet the condition specified in a callback function. - * @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. - * @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. - */ - filter(callbackfn: (value: number, index: number, array: Float64Array) => boolean, thisArg?: any): Float64Array; - - /** - * Returns the value of the first element in the array where predicate is true, and undefined - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; - - /** - * Returns the index of the first element in the array where predicate is true, and undefined - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - findIndex(predicate: (value: number) => boolean, thisArg?: any): number; - - /** - * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the - * callbackfn function one time for each element in the array. - * @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. - */ - forEach(callbackfn: (value: number, index: number, array: Float64Array) => void, thisArg?: any): void; - - /** - * Returns the index of the first occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - indexOf(searchElement: number, fromIndex?: number): number; - - /** - * Adds all the elements of an array separated by the specified separator string. - * @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. - */ - join(separator?: string): string; - - /** - * Returns the index of the last occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - lastIndexOf(searchElement: number, fromIndex?: number): number; - - /** - * The length of the array. - */ - readonly length: number; - - /** - * Calls a defined callback function on each element of an array, and returns an array that - * contains the results. - * @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. - * @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. - */ - map(callbackfn: (value: number, index: number, array: Float64Array) => number, thisArg?: any): Float64Array; - - /** - * 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. - * @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. - * @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. - */ - reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float64Array) => number, initialValue?: number): number; - - /** - * 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. - * @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. - * @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. - */ - reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Float64Array) => U, initialValue: U): U; - - /** - * 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. - * @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. - * @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. - */ - reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float64Array) => number, initialValue?: number): number; - - /** - * 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. - * @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. - * @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. - */ - reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Float64Array) => U, initialValue: U): U; - - /** - * Reverses the elements in an Array. - */ - reverse(): Float64Array; - - /** - * Sets a value or an array of values. - * @param index The index of the location to set. - * @param value The value to set. - */ - set(index: number, value: number): void; - - /** - * Sets a value or an array of values. - * @param array A typed or untyped array of values to set. - * @param offset The index in the current array at which the values are to be written. - */ - set(array: ArrayLike, offset?: number): void; - - /** - * Returns a section of an array. - * @param start The beginning of the specified portion of the array. - * @param end The end of the specified portion of the array. - */ - slice(start?: number, end?: number): Float64Array; - - /** - * Determines whether the specified callback function returns true for any element of an array. - * @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. - * @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. - */ - some(callbackfn: (value: number, index: number, array: Float64Array) => boolean, thisArg?: any): boolean; - - /** - * Sorts an array. - * @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. - */ - sort(compareFn?: (a: number, b: number) => number): Float64Array; - - /** - * Gets a new Float64Array view of the ArrayBuffer store for this array, referencing the elements - * at begin, inclusive, up to end, exclusive. - * @param begin The index of the beginning of the array. - * @param end The index of the end of the array. - */ - subarray(begin: number, end?: number): Float64Array; - - /** - * Converts a number to a string by using the current locale. - */ - toLocaleString(): string; - - /** - * Returns a string representation of an array. - */ - toString(): string; - - [index: number]: number; -} - -interface Float64ArrayConstructor { - readonly prototype: Float64Array; - new (length: number): Float64Array; - new (array: ArrayLike): Float64Array; - new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Float64Array; - - /** - * The size in bytes of each element in the array. - */ - readonly BYTES_PER_ELEMENT: number; - - /** - * Returns a new array from a set of elements. - * @param items A set of elements to include in the new array object. - */ - of(...items: number[]): Float64Array; - - /** - * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Float64Array; -} -declare const Float64Array: Float64ArrayConstructor; -///////////////////////////// -/// ECMAScript Internationalization API -///////////////////////////// - -declare module Intl { - interface CollatorOptions { - usage?: string; - localeMatcher?: string; - numeric?: boolean; - caseFirst?: string; - sensitivity?: string; - ignorePunctuation?: boolean; - } - - interface ResolvedCollatorOptions { - locale: string; - usage: string; - sensitivity: string; - ignorePunctuation: boolean; - collation: string; - caseFirst: string; - numeric: boolean; - } - - interface Collator { - compare(x: string, y: string): number; - resolvedOptions(): ResolvedCollatorOptions; - } - var Collator: { - new (locales?: string[], options?: CollatorOptions): Collator; - new (locale?: string, options?: CollatorOptions): Collator; - (locales?: string[], options?: CollatorOptions): Collator; - (locale?: string, options?: CollatorOptions): Collator; - supportedLocalesOf(locales: string[], options?: CollatorOptions): string[]; - supportedLocalesOf(locale: string, options?: CollatorOptions): string[]; - } - - interface NumberFormatOptions { - localeMatcher?: string; - style?: string; - currency?: string; - currencyDisplay?: string; - useGrouping?: boolean; - minimumIntegerDigits?: number; - minimumFractionDigits?: number; - maximumFractionDigits?: number; - minimumSignificantDigits?: number; - maximumSignificantDigits?: number; - } - - interface ResolvedNumberFormatOptions { - locale: string; - numberingSystem: string; - style: string; - currency?: string; - currencyDisplay?: string; - minimumIntegerDigits: number; - minimumFractionDigits: number; - maximumFractionDigits: number; - minimumSignificantDigits?: number; - maximumSignificantDigits?: number; - useGrouping: boolean; - } - - interface NumberFormat { - format(value: number): string; - resolvedOptions(): ResolvedNumberFormatOptions; - } - var NumberFormat: { - new (locales?: string[], options?: NumberFormatOptions): NumberFormat; - new (locale?: string, options?: NumberFormatOptions): NumberFormat; - (locales?: string[], options?: NumberFormatOptions): NumberFormat; - (locale?: string, options?: NumberFormatOptions): NumberFormat; - supportedLocalesOf(locales: string[], options?: NumberFormatOptions): string[]; - supportedLocalesOf(locale: string, options?: NumberFormatOptions): string[]; - } - - interface DateTimeFormatOptions { - localeMatcher?: string; - weekday?: string; - era?: string; - year?: string; - month?: string; - day?: string; - hour?: string; - minute?: string; - second?: string; - timeZoneName?: string; - formatMatcher?: string; - hour12?: boolean; - timeZone?: string; - } - - interface ResolvedDateTimeFormatOptions { - locale: string; - calendar: string; - numberingSystem: string; - timeZone: string; - hour12?: boolean; - weekday?: string; - era?: string; - year?: string; - month?: string; - day?: string; - hour?: string; - minute?: string; - second?: string; - timeZoneName?: string; - } - - interface DateTimeFormat { - format(date?: Date | number): string; - resolvedOptions(): ResolvedDateTimeFormatOptions; - } - var DateTimeFormat: { - new (locales?: string[], options?: DateTimeFormatOptions): DateTimeFormat; - new (locale?: string, options?: DateTimeFormatOptions): DateTimeFormat; - (locales?: string[], options?: DateTimeFormatOptions): DateTimeFormat; - (locale?: string, options?: DateTimeFormatOptions): DateTimeFormat; - supportedLocalesOf(locales: string[], options?: DateTimeFormatOptions): string[]; - supportedLocalesOf(locale: string, options?: DateTimeFormatOptions): string[]; - } -} - -interface String { - /** - * Determines whether two strings are equivalent in the current locale. - * @param that String to compare to target string - * @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. - * @param options An object that contains one or more properties that specify comparison options. see the Intl.Collator object for details. - */ - localeCompare(that: string, locales: string[], options?: Intl.CollatorOptions): number; - - /** - * Determines whether two strings are equivalent in the current locale. - * @param that String to compare to target string - * @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. - * @param options An object that contains one or more properties that specify comparison options. see the Intl.Collator object for details. - */ - localeCompare(that: string, locale: string, options?: Intl.CollatorOptions): number; -} - -interface Number { - /** - * Converts a number to a string by using the current or specified locale. - * @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. - * @param options An object that contains one or more properties that specify comparison options. - */ - toLocaleString(locales?: string[], options?: Intl.NumberFormatOptions): string; - - /** - * Converts a number to a string by using the current or specified locale. - * @param locale Locale tag. If you omit this parameter, the default locale of the JavaScript runtime is used. - * @param options An object that contains one or more properties that specify comparison options. - */ - toLocaleString(locale?: string, options?: Intl.NumberFormatOptions): string; -} - -interface Date { - /** - * Converts a date and time to a string by using the current or specified locale. - * @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. - * @param options An object that contains one or more properties that specify comparison options. - */ - toLocaleString(locales?: string[], options?: Intl.DateTimeFormatOptions): string; - /** - * Converts a date to a string by using the current or specified locale. - * @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. - * @param options An object that contains one or more properties that specify comparison options. - */ - toLocaleDateString(locales?: string[], options?: Intl.DateTimeFormatOptions): string; - - /** - * Converts a time to a string by using the current or specified locale. - * @param locale Locale tag. If you omit this parameter, the default locale of the JavaScript runtime is used. - * @param options An object that contains one or more properties that specify comparison options. - */ - toLocaleTimeString(locale?: string[], options?: Intl.DateTimeFormatOptions): string; - - /** - * Converts a date and time to a string by using the current or specified locale. - * @param locale Locale tag. If you omit this parameter, the default locale of the JavaScript runtime is used. - * @param options An object that contains one or more properties that specify comparison options. - */ - toLocaleString(locale?: string, options?: Intl.DateTimeFormatOptions): string; - - /** - * Converts a date to a string by using the current or specified locale. - * @param locale Locale tag. If you omit this parameter, the default locale of the JavaScript runtime is used. - * @param options An object that contains one or more properties that specify comparison options. - */ - toLocaleDateString(locale?: string, options?: Intl.DateTimeFormatOptions): string; - - /** - * Converts a time to a string by using the current or specified locale. - * @param locale Locale tag. If you omit this parameter, the default locale of the JavaScript runtime is used. - * @param options An object that contains one or more properties that specify comparison options. - */ - toLocaleTimeString(locale?: string, options?: Intl.DateTimeFormatOptions): string; -} - - -///////////////////////////// -/// IE DOM APIs -///////////////////////////// - -interface Algorithm { - name?: string; -} - -interface AriaRequestEventInit extends EventInit { - attributeName?: string; - attributeValue?: string; -} - -interface ClipboardEventInit extends EventInit { - data?: string; - dataType?: string; -} - -interface CommandEventInit extends EventInit { - commandName?: string; - detail?: string; -} - -interface CompositionEventInit extends UIEventInit { - data?: string; -} - -interface ConfirmSiteSpecificExceptionsInformation extends ExceptionInformation { - arrayOfDomainStrings?: string[]; -} - -interface CustomEventInit extends EventInit { - detail?: any; -} - -interface DeviceAccelerationDict { - x?: number; - y?: number; - z?: number; -} - -interface DeviceRotationRateDict { - alpha?: number; - beta?: number; - gamma?: number; -} - -interface EventInit { - bubbles?: boolean; - cancelable?: boolean; -} - -interface ExceptionInformation { - domain?: string; -} - -interface FocusEventInit extends UIEventInit { - relatedTarget?: EventTarget; -} - -interface HashChangeEventInit extends EventInit { - newURL?: string; - oldURL?: string; -} - -interface KeyAlgorithm { - name?: string; -} - -interface KeyboardEventInit extends SharedKeyboardAndMouseEventInit { - key?: string; - location?: number; - repeat?: boolean; -} - -interface MouseEventInit extends SharedKeyboardAndMouseEventInit { - screenX?: number; - screenY?: number; - clientX?: number; - clientY?: number; - button?: number; - buttons?: number; - relatedTarget?: EventTarget; -} - -interface MsZoomToOptions { - contentX?: number; - contentY?: number; - viewportX?: string; - viewportY?: string; - scaleFactor?: number; - animate?: string; -} - -interface MutationObserverInit { - childList?: boolean; - attributes?: boolean; - characterData?: boolean; - subtree?: boolean; - attributeOldValue?: boolean; - characterDataOldValue?: boolean; - attributeFilter?: string[]; -} - -interface ObjectURLOptions { - oneTimeOnly?: boolean; -} - -interface PointerEventInit extends MouseEventInit { - pointerId?: number; - width?: number; - height?: number; - pressure?: number; - tiltX?: number; - tiltY?: number; - pointerType?: string; - isPrimary?: boolean; -} - -interface PositionOptions { - enableHighAccuracy?: boolean; - timeout?: number; - maximumAge?: number; -} - -interface SharedKeyboardAndMouseEventInit extends UIEventInit { - ctrlKey?: boolean; - shiftKey?: boolean; - altKey?: boolean; - metaKey?: boolean; - keyModifierStateAltGraph?: boolean; - keyModifierStateCapsLock?: boolean; - keyModifierStateFn?: boolean; - keyModifierStateFnLock?: boolean; - keyModifierStateHyper?: boolean; - keyModifierStateNumLock?: boolean; - keyModifierStateOS?: boolean; - keyModifierStateScrollLock?: boolean; - keyModifierStateSuper?: boolean; - keyModifierStateSymbol?: boolean; - keyModifierStateSymbolLock?: boolean; -} - -interface StoreExceptionsInformation extends ExceptionInformation { - siteName?: string; - explanationString?: string; - detailURI?: string; -} - -interface StoreSiteSpecificExceptionsInformation extends StoreExceptionsInformation { - arrayOfDomainStrings?: string[]; -} - -interface UIEventInit extends EventInit { - view?: Window; - detail?: number; -} - -interface WebGLContextAttributes { - alpha?: boolean; - depth?: boolean; - stencil?: boolean; - antialias?: boolean; - premultipliedAlpha?: boolean; - preserveDrawingBuffer?: boolean; -} - -interface WebGLContextEventInit extends EventInit { - statusMessage?: string; -} - -interface WheelEventInit extends MouseEventInit { - deltaX?: number; - deltaY?: number; - deltaZ?: number; - deltaMode?: number; -} - -interface EventListener { - (evt: Event): void; -} - -interface ANGLE_instanced_arrays { - drawArraysInstancedANGLE(mode: number, first: number, count: number, primcount: number): void; - drawElementsInstancedANGLE(mode: number, count: number, type: number, offset: number, primcount: number): void; - vertexAttribDivisorANGLE(index: number, divisor: number): void; - VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE: number; -} - -declare var ANGLE_instanced_arrays: { - prototype: ANGLE_instanced_arrays; - new(): ANGLE_instanced_arrays; - VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE: number; -} - -interface AnalyserNode extends AudioNode { - fftSize: number; - frequencyBinCount: number; - maxDecibels: number; - minDecibels: number; - smoothingTimeConstant: number; - getByteFrequencyData(array: Uint8Array): void; - getByteTimeDomainData(array: Uint8Array): void; - getFloatFrequencyData(array: Float32Array): void; - getFloatTimeDomainData(array: Float32Array): void; -} - -declare var AnalyserNode: { - prototype: AnalyserNode; - new(): AnalyserNode; -} - -interface AnimationEvent extends Event { - animationName: string; - elapsedTime: number; - initAnimationEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, animationNameArg: string, elapsedTimeArg: number): void; -} - -declare var AnimationEvent: { - prototype: AnimationEvent; - new(): AnimationEvent; -} - -interface ApplicationCache extends EventTarget { - oncached: (ev: Event) => any; - onchecking: (ev: Event) => any; - ondownloading: (ev: Event) => any; - onerror: (ev: Event) => any; - onnoupdate: (ev: Event) => any; - onobsolete: (ev: Event) => any; - onprogress: (ev: ProgressEvent) => any; - onupdateready: (ev: Event) => any; - status: number; - abort(): void; - swapCache(): void; - update(): void; - CHECKING: number; - DOWNLOADING: number; - IDLE: number; - OBSOLETE: number; - UNCACHED: number; - UPDATEREADY: number; - addEventListener(type: "cached", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "checking", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "downloading", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "noupdate", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "obsolete", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "progress", listener: (ev: ProgressEvent) => any, useCapture?: boolean): void; - addEventListener(type: "updateready", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var ApplicationCache: { - prototype: ApplicationCache; - new(): ApplicationCache; - CHECKING: number; - DOWNLOADING: number; - IDLE: number; - OBSOLETE: number; - UNCACHED: number; - UPDATEREADY: number; -} - -interface AriaRequestEvent extends Event { - attributeName: string; - attributeValue: string; -} - -declare var AriaRequestEvent: { - prototype: AriaRequestEvent; - new(type: string, eventInitDict?: AriaRequestEventInit): AriaRequestEvent; -} - -interface Attr extends Node { - name: string; - ownerElement: Element; - specified: boolean; - value: string; -} - -declare var Attr: { - prototype: Attr; - new(): Attr; -} - -interface AudioBuffer { - duration: number; - length: number; - numberOfChannels: number; - sampleRate: number; - getChannelData(channel: number): Float32Array; -} - -declare var AudioBuffer: { - prototype: AudioBuffer; - new(): AudioBuffer; -} - -interface AudioBufferSourceNode extends AudioNode { - buffer: AudioBuffer; - loop: boolean; - loopEnd: number; - loopStart: number; - onended: (ev: Event) => any; - playbackRate: AudioParam; - start(when?: number, offset?: number, duration?: number): void; - stop(when?: number): void; - addEventListener(type: "ended", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var AudioBufferSourceNode: { - prototype: AudioBufferSourceNode; - new(): AudioBufferSourceNode; -} - -interface AudioContext extends EventTarget { - currentTime: number; - destination: AudioDestinationNode; - listener: AudioListener; - sampleRate: number; - state: string; - createAnalyser(): AnalyserNode; - createBiquadFilter(): BiquadFilterNode; - createBuffer(numberOfChannels: number, length: number, sampleRate: number): AudioBuffer; - createBufferSource(): AudioBufferSourceNode; - createChannelMerger(numberOfInputs?: number): ChannelMergerNode; - createChannelSplitter(numberOfOutputs?: number): ChannelSplitterNode; - createConvolver(): ConvolverNode; - createDelay(maxDelayTime?: number): DelayNode; - createDynamicsCompressor(): DynamicsCompressorNode; - createGain(): GainNode; - createMediaElementSource(mediaElement: HTMLMediaElement): MediaElementAudioSourceNode; - createOscillator(): OscillatorNode; - createPanner(): PannerNode; - createPeriodicWave(real: Float32Array, imag: Float32Array): PeriodicWave; - createScriptProcessor(bufferSize?: number, numberOfInputChannels?: number, numberOfOutputChannels?: number): ScriptProcessorNode; - createStereoPanner(): StereoPannerNode; - createWaveShaper(): WaveShaperNode; - decodeAudioData(audioData: ArrayBuffer, successCallback: DecodeSuccessCallback, errorCallback?: DecodeErrorCallback): void; -} - -declare var AudioContext: { - prototype: AudioContext; - new(): AudioContext; -} - -interface AudioDestinationNode extends AudioNode { - maxChannelCount: number; -} - -declare var AudioDestinationNode: { - prototype: AudioDestinationNode; - new(): AudioDestinationNode; -} - -interface AudioListener { - dopplerFactor: number; - speedOfSound: number; - setOrientation(x: number, y: number, z: number, xUp: number, yUp: number, zUp: number): void; - setPosition(x: number, y: number, z: number): void; - setVelocity(x: number, y: number, z: number): void; -} - -declare var AudioListener: { - prototype: AudioListener; - new(): AudioListener; -} - -interface AudioNode extends EventTarget { - channelCount: number; - channelCountMode: string; - channelInterpretation: string; - context: AudioContext; - numberOfInputs: number; - numberOfOutputs: number; - connect(destination: AudioNode, output?: number, input?: number): void; - disconnect(output?: number): void; - disconnect(destination: AudioNode, output?: number, input?: number): void; - disconnect(destination: AudioParam, output?: number): void; -} - -declare var AudioNode: { - prototype: AudioNode; - new(): AudioNode; -} - -interface AudioParam { - defaultValue: number; - value: number; - cancelScheduledValues(startTime: number): void; - exponentialRampToValueAtTime(value: number, endTime: number): void; - linearRampToValueAtTime(value: number, endTime: number): void; - setTargetAtTime(target: number, startTime: number, timeConstant: number): void; - setValueAtTime(value: number, startTime: number): void; - setValueCurveAtTime(values: Float32Array, startTime: number, duration: number): void; -} - -declare var AudioParam: { - prototype: AudioParam; - new(): AudioParam; -} - -interface AudioProcessingEvent extends Event { - inputBuffer: AudioBuffer; - outputBuffer: AudioBuffer; - playbackTime: number; -} - -declare var AudioProcessingEvent: { - prototype: AudioProcessingEvent; - new(): AudioProcessingEvent; -} - -interface AudioTrack { - enabled: boolean; - id: string; - kind: string; - label: string; - language: string; - sourceBuffer: SourceBuffer; -} - -declare var AudioTrack: { - prototype: AudioTrack; - new(): AudioTrack; -} - -interface AudioTrackList extends EventTarget { - length: number; - onaddtrack: (ev: TrackEvent) => any; - onchange: (ev: Event) => any; - onremovetrack: (ev: TrackEvent) => any; - getTrackById(id: string): AudioTrack; - item(index: number): AudioTrack; - addEventListener(type: "addtrack", listener: (ev: TrackEvent) => any, useCapture?: boolean): void; - addEventListener(type: "change", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "removetrack", listener: (ev: TrackEvent) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; - [index: number]: AudioTrack; -} - -declare var AudioTrackList: { - prototype: AudioTrackList; - new(): AudioTrackList; -} - -interface BarProp { - visible: boolean; -} - -declare var BarProp: { - prototype: BarProp; - new(): BarProp; -} - -interface BeforeUnloadEvent extends Event { - returnValue: any; -} - -declare var BeforeUnloadEvent: { - prototype: BeforeUnloadEvent; - new(): BeforeUnloadEvent; -} - -interface BiquadFilterNode extends AudioNode { - Q: AudioParam; - detune: AudioParam; - frequency: AudioParam; - gain: AudioParam; - type: string; - getFrequencyResponse(frequencyHz: Float32Array, magResponse: Float32Array, phaseResponse: Float32Array): void; -} - -declare var BiquadFilterNode: { - prototype: BiquadFilterNode; - new(): BiquadFilterNode; -} - -interface Blob { - size: number; - type: string; - msClose(): void; - msDetachStream(): any; - slice(start?: number, end?: number, contentType?: string): Blob; -} - -declare var Blob: { - prototype: Blob; - new (blobParts?: any[], options?: BlobPropertyBag): Blob; -} - -interface CDATASection extends Text { -} - -declare var CDATASection: { - prototype: CDATASection; - new(): CDATASection; -} - -interface CSS { - supports(property: string, value?: string): boolean; -} -declare var CSS: CSS; - -interface CSSConditionRule extends CSSGroupingRule { - conditionText: string; -} - -declare var CSSConditionRule: { - prototype: CSSConditionRule; - new(): CSSConditionRule; -} - -interface CSSFontFaceRule extends CSSRule { - style: CSSStyleDeclaration; -} - -declare var CSSFontFaceRule: { - prototype: CSSFontFaceRule; - new(): CSSFontFaceRule; -} - -interface CSSGroupingRule extends CSSRule { - cssRules: CSSRuleList; - deleteRule(index?: number): void; - insertRule(rule: string, index?: number): number; -} - -declare var CSSGroupingRule: { - prototype: CSSGroupingRule; - new(): CSSGroupingRule; -} - -interface CSSImportRule extends CSSRule { - href: string; - media: MediaList; - styleSheet: CSSStyleSheet; -} - -declare var CSSImportRule: { - prototype: CSSImportRule; - new(): CSSImportRule; -} - -interface CSSKeyframeRule extends CSSRule { - keyText: string; - style: CSSStyleDeclaration; -} - -declare var CSSKeyframeRule: { - prototype: CSSKeyframeRule; - new(): CSSKeyframeRule; -} - -interface CSSKeyframesRule extends CSSRule { - cssRules: CSSRuleList; - name: string; - appendRule(rule: string): void; - deleteRule(rule: string): void; - findRule(rule: string): CSSKeyframeRule; -} - -declare var CSSKeyframesRule: { - prototype: CSSKeyframesRule; - new(): CSSKeyframesRule; -} - -interface CSSMediaRule extends CSSConditionRule { - media: MediaList; -} - -declare var CSSMediaRule: { - prototype: CSSMediaRule; - new(): CSSMediaRule; -} - -interface CSSNamespaceRule extends CSSRule { - namespaceURI: string; - prefix: string; -} - -declare var CSSNamespaceRule: { - prototype: CSSNamespaceRule; - new(): CSSNamespaceRule; -} - -interface CSSPageRule extends CSSRule { - pseudoClass: string; - selector: string; - selectorText: string; - style: CSSStyleDeclaration; -} - -declare var CSSPageRule: { - prototype: CSSPageRule; - new(): CSSPageRule; -} - -interface CSSRule { - cssText: string; - parentRule: CSSRule; - parentStyleSheet: CSSStyleSheet; - type: number; - CHARSET_RULE: number; - FONT_FACE_RULE: number; - IMPORT_RULE: number; - KEYFRAMES_RULE: number; - KEYFRAME_RULE: number; - MEDIA_RULE: number; - NAMESPACE_RULE: number; - PAGE_RULE: number; - STYLE_RULE: number; - SUPPORTS_RULE: number; - UNKNOWN_RULE: number; - VIEWPORT_RULE: number; -} - -declare var CSSRule: { - prototype: CSSRule; - new(): CSSRule; - CHARSET_RULE: number; - FONT_FACE_RULE: number; - IMPORT_RULE: number; - KEYFRAMES_RULE: number; - KEYFRAME_RULE: number; - MEDIA_RULE: number; - NAMESPACE_RULE: number; - PAGE_RULE: number; - STYLE_RULE: number; - SUPPORTS_RULE: number; - UNKNOWN_RULE: number; - VIEWPORT_RULE: number; -} - -interface CSSRuleList { - length: number; - item(index: number): CSSRule; - [index: number]: CSSRule; -} - -declare var CSSRuleList: { - prototype: CSSRuleList; - new(): CSSRuleList; -} - -interface CSSStyleDeclaration { - alignContent: string; - alignItems: string; - alignSelf: string; - alignmentBaseline: string; - animation: string; - animationDelay: string; - animationDirection: string; - animationDuration: string; - animationFillMode: string; - animationIterationCount: string; - animationName: string; - animationPlayState: string; - animationTimingFunction: string; - backfaceVisibility: string; - background: string; - backgroundAttachment: string; - backgroundClip: string; - backgroundColor: string; - backgroundImage: string; - backgroundOrigin: string; - backgroundPosition: string; - backgroundPositionX: string; - backgroundPositionY: string; - backgroundRepeat: string; - backgroundSize: string; - baselineShift: string; - border: string; - borderBottom: string; - borderBottomColor: string; - borderBottomLeftRadius: string; - borderBottomRightRadius: string; - borderBottomStyle: string; - borderBottomWidth: string; - borderCollapse: string; - borderColor: string; - borderImage: string; - borderImageOutset: string; - borderImageRepeat: string; - borderImageSlice: string; - borderImageSource: string; - borderImageWidth: string; - borderLeft: string; - borderLeftColor: string; - borderLeftStyle: string; - borderLeftWidth: string; - borderRadius: string; - borderRight: string; - borderRightColor: string; - borderRightStyle: string; - borderRightWidth: string; - borderSpacing: string; - borderStyle: string; - borderTop: string; - borderTopColor: string; - borderTopLeftRadius: string; - borderTopRightRadius: string; - borderTopStyle: string; - borderTopWidth: string; - borderWidth: string; - bottom: string; - boxShadow: string; - boxSizing: string; - breakAfter: string; - breakBefore: string; - breakInside: string; - captionSide: string; - clear: string; - clip: string; - clipPath: string; - clipRule: string; - color: string; - colorInterpolationFilters: string; - columnCount: any; - columnFill: string; - columnGap: any; - columnRule: string; - columnRuleColor: any; - columnRuleStyle: string; - columnRuleWidth: any; - columnSpan: string; - columnWidth: any; - columns: string; - content: string; - counterIncrement: string; - counterReset: string; - cssFloat: string; - cssText: string; - cursor: string; - direction: string; - display: string; - dominantBaseline: string; - emptyCells: string; - enableBackground: string; - fill: string; - fillOpacity: string; - fillRule: string; - filter: string; - flex: string; - flexBasis: string; - flexDirection: string; - flexFlow: string; - flexGrow: string; - flexShrink: string; - flexWrap: string; - floodColor: string; - floodOpacity: string; - font: string; - fontFamily: string; - fontFeatureSettings: string; - fontSize: string; - fontSizeAdjust: string; - fontStretch: string; - fontStyle: string; - fontVariant: string; - fontWeight: string; - glyphOrientationHorizontal: string; - glyphOrientationVertical: string; - height: string; - imeMode: string; - justifyContent: string; - kerning: string; - left: string; - length: number; - letterSpacing: string; - lightingColor: string; - lineHeight: string; - listStyle: string; - listStyleImage: string; - listStylePosition: string; - listStyleType: string; - margin: string; - marginBottom: string; - marginLeft: string; - marginRight: string; - marginTop: string; - marker: string; - markerEnd: string; - markerMid: string; - markerStart: string; - mask: string; - maxHeight: string; - maxWidth: string; - minHeight: string; - minWidth: string; - msContentZoomChaining: string; - msContentZoomLimit: string; - msContentZoomLimitMax: any; - msContentZoomLimitMin: any; - msContentZoomSnap: string; - msContentZoomSnapPoints: string; - msContentZoomSnapType: string; - msContentZooming: string; - msFlowFrom: string; - msFlowInto: string; - msFontFeatureSettings: string; - msGridColumn: any; - msGridColumnAlign: string; - msGridColumnSpan: any; - msGridColumns: string; - msGridRow: any; - msGridRowAlign: string; - msGridRowSpan: any; - msGridRows: string; - msHighContrastAdjust: string; - msHyphenateLimitChars: string; - msHyphenateLimitLines: any; - msHyphenateLimitZone: any; - msHyphens: string; - msImeAlign: string; - msOverflowStyle: string; - msScrollChaining: string; - msScrollLimit: string; - msScrollLimitXMax: any; - msScrollLimitXMin: any; - msScrollLimitYMax: any; - msScrollLimitYMin: any; - msScrollRails: string; - msScrollSnapPointsX: string; - msScrollSnapPointsY: string; - msScrollSnapType: string; - msScrollSnapX: string; - msScrollSnapY: string; - msScrollTranslation: string; - msTextCombineHorizontal: string; - msTextSizeAdjust: any; - msTouchAction: string; - msTouchSelect: string; - msUserSelect: string; - msWrapFlow: string; - msWrapMargin: any; - msWrapThrough: string; - opacity: string; - order: string; - orphans: string; - outline: string; - outlineColor: string; - outlineStyle: string; - outlineWidth: string; - overflow: string; - overflowX: string; - overflowY: string; - padding: string; - paddingBottom: string; - paddingLeft: string; - paddingRight: string; - paddingTop: string; - pageBreakAfter: string; - pageBreakBefore: string; - pageBreakInside: string; - parentRule: CSSRule; - perspective: string; - perspectiveOrigin: string; - pointerEvents: string; - position: string; - quotes: string; - right: string; - rubyAlign: string; - rubyOverhang: string; - rubyPosition: string; - stopColor: string; - stopOpacity: string; - stroke: string; - strokeDasharray: string; - strokeDashoffset: string; - strokeLinecap: string; - strokeLinejoin: string; - strokeMiterlimit: string; - strokeOpacity: string; - strokeWidth: string; - tableLayout: string; - textAlign: string; - textAlignLast: string; - textAnchor: string; - textDecoration: string; - textFillColor: string; - textIndent: string; - textJustify: string; - textKashida: string; - textKashidaSpace: string; - textOverflow: string; - textShadow: string; - textTransform: string; - textUnderlinePosition: string; - top: string; - touchAction: string; - transform: string; - transformOrigin: string; - transformStyle: string; - transition: string; - transitionDelay: string; - transitionDuration: string; - transitionProperty: string; - transitionTimingFunction: string; - unicodeBidi: string; - verticalAlign: string; - visibility: string; - webkitAlignContent: string; - webkitAlignItems: string; - webkitAlignSelf: string; - webkitAnimation: string; - webkitAnimationDelay: string; - webkitAnimationDirection: string; - webkitAnimationDuration: string; - webkitAnimationFillMode: string; - webkitAnimationIterationCount: string; - webkitAnimationName: string; - webkitAnimationPlayState: string; - webkitAnimationTimingFunction: string; - webkitAppearance: string; - webkitBackfaceVisibility: string; - webkitBackground: string; - webkitBackgroundAttachment: string; - webkitBackgroundClip: string; - webkitBackgroundColor: string; - webkitBackgroundImage: string; - webkitBackgroundOrigin: string; - webkitBackgroundPosition: string; - webkitBackgroundPositionX: string; - webkitBackgroundPositionY: string; - webkitBackgroundRepeat: string; - webkitBackgroundSize: string; - webkitBorderBottomLeftRadius: string; - webkitBorderBottomRightRadius: string; - webkitBorderImage: string; - webkitBorderImageOutset: string; - webkitBorderImageRepeat: string; - webkitBorderImageSlice: string; - webkitBorderImageSource: string; - webkitBorderImageWidth: string; - webkitBorderRadius: string; - webkitBorderTopLeftRadius: string; - webkitBorderTopRightRadius: string; - webkitBoxAlign: string; - webkitBoxDirection: string; - webkitBoxFlex: string; - webkitBoxOrdinalGroup: string; - webkitBoxOrient: string; - webkitBoxPack: string; - webkitBoxSizing: string; - webkitColumnBreakAfter: string; - webkitColumnBreakBefore: string; - webkitColumnBreakInside: string; - webkitColumnCount: any; - webkitColumnGap: any; - webkitColumnRule: string; - webkitColumnRuleColor: any; - webkitColumnRuleStyle: string; - webkitColumnRuleWidth: any; - webkitColumnSpan: string; - webkitColumnWidth: any; - webkitColumns: string; - webkitFilter: string; - webkitFlex: string; - webkitFlexBasis: string; - webkitFlexDirection: string; - webkitFlexFlow: string; - webkitFlexGrow: string; - webkitFlexShrink: string; - webkitFlexWrap: string; - webkitJustifyContent: string; - webkitOrder: string; - webkitPerspective: string; - webkitPerspectiveOrigin: string; - webkitTapHighlightColor: string; - webkitTextFillColor: string; - webkitTextSizeAdjust: any; - webkitTransform: string; - webkitTransformOrigin: string; - webkitTransformStyle: string; - webkitTransition: string; - webkitTransitionDelay: string; - webkitTransitionDuration: string; - webkitTransitionProperty: string; - webkitTransitionTimingFunction: string; - webkitUserSelect: string; - webkitWritingMode: string; - whiteSpace: string; - widows: string; - width: string; - wordBreak: string; - wordSpacing: string; - wordWrap: string; - writingMode: string; - zIndex: string; - zoom: string; - getPropertyPriority(propertyName: string): string; - getPropertyValue(propertyName: string): string; - item(index: number): string; - removeProperty(propertyName: string): string; - setProperty(propertyName: string, value: string, priority?: string): void; - [index: number]: string; -} - -declare var CSSStyleDeclaration: { - prototype: CSSStyleDeclaration; - new(): CSSStyleDeclaration; -} - -interface CSSStyleRule extends CSSRule { - readOnly: boolean; - selectorText: string; - style: CSSStyleDeclaration; -} - -declare var CSSStyleRule: { - prototype: CSSStyleRule; - new(): CSSStyleRule; -} - -interface CSSStyleSheet extends StyleSheet { - cssRules: CSSRuleList; - cssText: string; - href: string; - id: string; - imports: StyleSheetList; - isAlternate: boolean; - isPrefAlternate: boolean; - ownerRule: CSSRule; - owningElement: Element; - pages: StyleSheetPageList; - readOnly: boolean; - rules: CSSRuleList; - addImport(bstrURL: string, lIndex?: number): number; - addPageRule(bstrSelector: string, bstrStyle: string, lIndex?: number): number; - addRule(bstrSelector: string, bstrStyle?: string, lIndex?: number): number; - deleteRule(index?: number): void; - insertRule(rule: string, index?: number): number; - removeImport(lIndex: number): void; - removeRule(lIndex: number): void; -} - -declare var CSSStyleSheet: { - prototype: CSSStyleSheet; - new(): CSSStyleSheet; -} - -interface CSSSupportsRule extends CSSConditionRule { -} - -declare var CSSSupportsRule: { - prototype: CSSSupportsRule; - new(): CSSSupportsRule; -} - -interface CanvasGradient { - addColorStop(offset: number, color: string): void; -} - -declare var CanvasGradient: { - prototype: CanvasGradient; - new(): CanvasGradient; -} - -interface CanvasPattern { -} - -declare var CanvasPattern: { - prototype: CanvasPattern; - new(): CanvasPattern; -} - -interface CanvasRenderingContext2D { - canvas: HTMLCanvasElement; - fillStyle: string | CanvasGradient | CanvasPattern; - font: string; - globalAlpha: number; - globalCompositeOperation: string; - lineCap: string; - lineDashOffset: number; - lineJoin: string; - lineWidth: number; - miterLimit: number; - msFillRule: string; - msImageSmoothingEnabled: boolean; - shadowBlur: number; - shadowColor: string; - shadowOffsetX: number; - shadowOffsetY: number; - strokeStyle: string | CanvasGradient | CanvasPattern; - textAlign: string; - textBaseline: string; - arc(x: number, y: number, radius: number, startAngle: number, endAngle: number, anticlockwise?: boolean): void; - arcTo(x1: number, y1: number, x2: number, y2: number, radius: number): void; - beginPath(): void; - bezierCurveTo(cp1x: number, cp1y: number, cp2x: number, cp2y: number, x: number, y: number): void; - clearRect(x: number, y: number, w: number, h: number): void; - clip(fillRule?: string): void; - closePath(): void; - createImageData(imageDataOrSw: number | ImageData, sh?: number): ImageData; - createLinearGradient(x0: number, y0: number, x1: number, y1: number): CanvasGradient; - createPattern(image: HTMLImageElement | HTMLCanvasElement | HTMLVideoElement, repetition: string): CanvasPattern; - createRadialGradient(x0: number, y0: number, r0: number, x1: number, y1: number, r1: number): CanvasGradient; - drawImage(image: HTMLImageElement | HTMLCanvasElement | HTMLVideoElement, offsetX: number, offsetY: number, width?: number, height?: number, canvasOffsetX?: number, canvasOffsetY?: number, canvasImageWidth?: number, canvasImageHeight?: number): void; - fill(fillRule?: string): void; - fillRect(x: number, y: number, w: number, h: number): void; - fillText(text: string, x: number, y: number, maxWidth?: number): void; - getImageData(sx: number, sy: number, sw: number, sh: number): ImageData; - getLineDash(): number[]; - isPointInPath(x: number, y: number, fillRule?: string): boolean; - lineTo(x: number, y: number): void; - measureText(text: string): TextMetrics; - moveTo(x: number, y: number): void; - putImageData(imagedata: ImageData, dx: number, dy: number, dirtyX?: number, dirtyY?: number, dirtyWidth?: number, dirtyHeight?: number): void; - quadraticCurveTo(cpx: number, cpy: number, x: number, y: number): void; - rect(x: number, y: number, w: number, h: number): void; - restore(): void; - rotate(angle: number): void; - save(): void; - scale(x: number, y: number): void; - setLineDash(segments: number[]): void; - setTransform(m11: number, m12: number, m21: number, m22: number, dx: number, dy: number): void; - stroke(): void; - strokeRect(x: number, y: number, w: number, h: number): void; - strokeText(text: string, x: number, y: number, maxWidth?: number): void; - transform(m11: number, m12: number, m21: number, m22: number, dx: number, dy: number): void; - translate(x: number, y: number): void; -} - -declare var CanvasRenderingContext2D: { - prototype: CanvasRenderingContext2D; - new(): CanvasRenderingContext2D; -} - -interface ChannelMergerNode extends AudioNode { -} - -declare var ChannelMergerNode: { - prototype: ChannelMergerNode; - new(): ChannelMergerNode; -} - -interface ChannelSplitterNode extends AudioNode { -} - -declare var ChannelSplitterNode: { - prototype: ChannelSplitterNode; - new(): ChannelSplitterNode; -} - -interface CharacterData extends Node, ChildNode { - data: string; - length: number; - appendData(arg: string): void; - deleteData(offset: number, count: number): void; - insertData(offset: number, arg: string): void; - replaceData(offset: number, count: number, arg: string): void; - substringData(offset: number, count: number): string; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var CharacterData: { - prototype: CharacterData; - new(): CharacterData; -} - -interface ClientRect { - bottom: number; - height: number; - left: number; - right: number; - top: number; - width: number; -} - -declare var ClientRect: { - prototype: ClientRect; - new(): ClientRect; -} - -interface ClientRectList { - length: number; - item(index: number): ClientRect; - [index: number]: ClientRect; -} - -declare var ClientRectList: { - prototype: ClientRectList; - new(): ClientRectList; -} - -interface ClipboardEvent extends Event { - clipboardData: DataTransfer; -} - -declare var ClipboardEvent: { - prototype: ClipboardEvent; - new(type: string, eventInitDict?: ClipboardEventInit): ClipboardEvent; -} - -interface CloseEvent extends Event { - code: number; - reason: string; - wasClean: boolean; - initCloseEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, wasCleanArg: boolean, codeArg: number, reasonArg: string): void; -} - -declare var CloseEvent: { - prototype: CloseEvent; - new(): CloseEvent; -} - -interface CommandEvent extends Event { - commandName: string; - detail: string; -} - -declare var CommandEvent: { - prototype: CommandEvent; - new(type: string, eventInitDict?: CommandEventInit): CommandEvent; -} - -interface Comment extends CharacterData { - text: string; -} - -declare var Comment: { - prototype: Comment; - new(): Comment; -} - -interface CompositionEvent extends UIEvent { - data: string; - locale: string; - initCompositionEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, dataArg: string, locale: string): void; -} - -declare var CompositionEvent: { - prototype: CompositionEvent; - new(typeArg: string, eventInitDict?: CompositionEventInit): CompositionEvent; -} - -interface Console { - assert(test?: boolean, message?: string, ...optionalParams: any[]): void; - clear(): void; - count(countTitle?: string): void; - debug(message?: string, ...optionalParams: any[]): void; - dir(value?: any, ...optionalParams: any[]): void; - dirxml(value: any): void; - error(message?: any, ...optionalParams: any[]): void; - group(groupTitle?: string): void; - groupCollapsed(groupTitle?: string): void; - groupEnd(): void; - info(message?: any, ...optionalParams: any[]): void; - log(message?: any, ...optionalParams: any[]): void; - msIsIndependentlyComposed(element: Element): boolean; - profile(reportName?: string): void; - profileEnd(): void; - select(element: Element): void; - time(timerName?: string): void; - timeEnd(timerName?: string): void; - trace(message?: any, ...optionalParams: any[]): void; - warn(message?: any, ...optionalParams: any[]): void; -} - -declare var Console: { - prototype: Console; - new(): Console; -} - -interface ConvolverNode extends AudioNode { - buffer: AudioBuffer; - normalize: boolean; -} - -declare var ConvolverNode: { - prototype: ConvolverNode; - new(): ConvolverNode; -} - -interface Coordinates { - accuracy: number; - altitude: number; - altitudeAccuracy: number; - heading: number; - latitude: number; - longitude: number; - speed: number; -} - -declare var Coordinates: { - prototype: Coordinates; - new(): Coordinates; -} - -interface Crypto extends Object, RandomSource { - subtle: SubtleCrypto; -} - -declare var Crypto: { - prototype: Crypto; - new(): Crypto; -} - -interface CryptoKey { - algorithm: KeyAlgorithm; - extractable: boolean; - type: string; - usages: string[]; -} - -declare var CryptoKey: { - prototype: CryptoKey; - new(): CryptoKey; -} - -interface CryptoKeyPair { - privateKey: CryptoKey; - publicKey: CryptoKey; -} - -declare var CryptoKeyPair: { - prototype: CryptoKeyPair; - new(): CryptoKeyPair; -} - -interface CustomEvent extends Event { - detail: any; - initCustomEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, detailArg: any): void; -} - -declare var CustomEvent: { - prototype: CustomEvent; - new(typeArg: string, eventInitDict?: CustomEventInit): CustomEvent; -} - -interface DOMError { - name: string; - toString(): string; -} - -declare var DOMError: { - prototype: DOMError; - new(): DOMError; -} - -interface DOMException { - code: number; - message: string; - name: string; - toString(): string; - ABORT_ERR: number; - DATA_CLONE_ERR: number; - DOMSTRING_SIZE_ERR: number; - HIERARCHY_REQUEST_ERR: number; - INDEX_SIZE_ERR: number; - INUSE_ATTRIBUTE_ERR: number; - INVALID_ACCESS_ERR: number; - INVALID_CHARACTER_ERR: number; - INVALID_MODIFICATION_ERR: number; - INVALID_NODE_TYPE_ERR: number; - INVALID_STATE_ERR: number; - NAMESPACE_ERR: number; - NETWORK_ERR: number; - NOT_FOUND_ERR: number; - NOT_SUPPORTED_ERR: number; - NO_DATA_ALLOWED_ERR: number; - NO_MODIFICATION_ALLOWED_ERR: number; - PARSE_ERR: number; - QUOTA_EXCEEDED_ERR: number; - SECURITY_ERR: number; - SERIALIZE_ERR: number; - SYNTAX_ERR: number; - TIMEOUT_ERR: number; - TYPE_MISMATCH_ERR: number; - URL_MISMATCH_ERR: number; - VALIDATION_ERR: number; - WRONG_DOCUMENT_ERR: number; -} - -declare var DOMException: { - prototype: DOMException; - new(): DOMException; - ABORT_ERR: number; - DATA_CLONE_ERR: number; - DOMSTRING_SIZE_ERR: number; - HIERARCHY_REQUEST_ERR: number; - INDEX_SIZE_ERR: number; - INUSE_ATTRIBUTE_ERR: number; - INVALID_ACCESS_ERR: number; - INVALID_CHARACTER_ERR: number; - INVALID_MODIFICATION_ERR: number; - INVALID_NODE_TYPE_ERR: number; - INVALID_STATE_ERR: number; - NAMESPACE_ERR: number; - NETWORK_ERR: number; - NOT_FOUND_ERR: number; - NOT_SUPPORTED_ERR: number; - NO_DATA_ALLOWED_ERR: number; - NO_MODIFICATION_ALLOWED_ERR: number; - PARSE_ERR: number; - QUOTA_EXCEEDED_ERR: number; - SECURITY_ERR: number; - SERIALIZE_ERR: number; - SYNTAX_ERR: number; - TIMEOUT_ERR: number; - TYPE_MISMATCH_ERR: number; - URL_MISMATCH_ERR: number; - VALIDATION_ERR: number; - WRONG_DOCUMENT_ERR: number; -} - -interface DOMImplementation { - createDocument(namespaceURI: string, qualifiedName: string, doctype: DocumentType): Document; - createDocumentType(qualifiedName: string, publicId: string, systemId: string): DocumentType; - createHTMLDocument(title: string): Document; - hasFeature(feature: string, version: string): boolean; -} - -declare var DOMImplementation: { - prototype: DOMImplementation; - new(): DOMImplementation; -} - -interface DOMParser { - parseFromString(source: string, mimeType: string): Document; -} - -declare var DOMParser: { - prototype: DOMParser; - new(): DOMParser; -} - -interface DOMSettableTokenList extends DOMTokenList { - value: string; -} - -declare var DOMSettableTokenList: { - prototype: DOMSettableTokenList; - new(): DOMSettableTokenList; -} - -interface DOMStringList { - length: number; - contains(str: string): boolean; - item(index: number): string; - [index: number]: string; -} - -declare var DOMStringList: { - prototype: DOMStringList; - new(): DOMStringList; -} - -interface DOMStringMap { - [name: string]: string; -} - -declare var DOMStringMap: { - prototype: DOMStringMap; - new(): DOMStringMap; -} - -interface DOMTokenList { - length: number; - add(...token: string[]): void; - contains(token: string): boolean; - item(index: number): string; - remove(...token: string[]): void; - toString(): string; - toggle(token: string, force?: boolean): boolean; - [index: number]: string; -} - -declare var DOMTokenList: { - prototype: DOMTokenList; - new(): DOMTokenList; -} - -interface DataCue extends TextTrackCue { - data: ArrayBuffer; -} - -declare var DataCue: { - prototype: DataCue; - new(): DataCue; -} - -interface DataTransfer { - dropEffect: string; - effectAllowed: string; - files: FileList; - items: DataTransferItemList; - types: DOMStringList; - clearData(format?: string): boolean; - getData(format: string): string; - setData(format: string, data: string): boolean; -} - -declare var DataTransfer: { - prototype: DataTransfer; - new(): DataTransfer; -} - -interface DataTransferItem { - kind: string; - type: string; - getAsFile(): File; - getAsString(_callback: FunctionStringCallback): void; -} - -declare var DataTransferItem: { - prototype: DataTransferItem; - new(): DataTransferItem; -} - -interface DataTransferItemList { - length: number; - add(data: File): DataTransferItem; - clear(): void; - item(index: number): DataTransferItem; - remove(index: number): void; - [index: number]: DataTransferItem; -} - -declare var DataTransferItemList: { - prototype: DataTransferItemList; - new(): DataTransferItemList; -} - -interface DeferredPermissionRequest { - id: number; - type: string; - uri: string; - allow(): void; - deny(): void; -} - -declare var DeferredPermissionRequest: { - prototype: DeferredPermissionRequest; - new(): DeferredPermissionRequest; -} - -interface DelayNode extends AudioNode { - delayTime: AudioParam; -} - -declare var DelayNode: { - prototype: DelayNode; - new(): DelayNode; -} - -interface DeviceAcceleration { - x: number; - y: number; - z: number; -} - -declare var DeviceAcceleration: { - prototype: DeviceAcceleration; - new(): DeviceAcceleration; -} - -interface DeviceMotionEvent extends Event { - acceleration: DeviceAcceleration; - accelerationIncludingGravity: DeviceAcceleration; - interval: number; - rotationRate: DeviceRotationRate; - initDeviceMotionEvent(type: string, bubbles: boolean, cancelable: boolean, acceleration: DeviceAccelerationDict, accelerationIncludingGravity: DeviceAccelerationDict, rotationRate: DeviceRotationRateDict, interval: number): void; -} - -declare var DeviceMotionEvent: { - prototype: DeviceMotionEvent; - new(): DeviceMotionEvent; -} - -interface DeviceOrientationEvent extends Event { - absolute: boolean; - alpha: number; - beta: number; - gamma: number; - initDeviceOrientationEvent(type: string, bubbles: boolean, cancelable: boolean, alpha: number, beta: number, gamma: number, absolute: boolean): void; -} - -declare var DeviceOrientationEvent: { - prototype: DeviceOrientationEvent; - new(): DeviceOrientationEvent; -} - -interface DeviceRotationRate { - alpha: number; - beta: number; - gamma: number; -} - -declare var DeviceRotationRate: { - prototype: DeviceRotationRate; - new(): DeviceRotationRate; -} - -interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEvent { - /** - * Sets or gets the URL for the current document. - */ - URL: string; - /** - * Gets the URL for the document, stripped of any character encoding. - */ - URLUnencoded: string; - /** - * Gets the object that has the focus when the parent document has focus. - */ - activeElement: Element; - /** - * Sets or gets the color of all active links in the document. - */ - alinkColor: string; - /** - * Returns a reference to the collection of elements contained by the object. - */ - all: HTMLCollection; - /** - * Retrieves a collection of all a objects that have a name and/or id property. Objects in this collection are in HTML source order. - */ - anchors: HTMLCollection; - /** - * Retrieves a collection of all applet objects in the document. - */ - applets: HTMLCollection; - /** - * Deprecated. Sets or retrieves a value that indicates the background color behind the object. - */ - bgColor: string; - /** - * Specifies the beginning and end of the document body. - */ - body: HTMLElement; - characterSet: string; - /** - * Gets or sets the character set used to encode the object. - */ - charset: string; - /** - * Gets a value that indicates whether standards-compliant mode is switched on for the object. - */ - compatMode: string; - cookie: string; - /** - * Gets the default character set from the current regional language settings. - */ - defaultCharset: string; - defaultView: Window; - /** - * Sets or gets a value that indicates whether the document can be edited. - */ - designMode: string; - /** - * Sets or retrieves a value that indicates the reading order of the object. - */ - dir: string; - /** - * Gets an object representing the document type declaration associated with the current document. - */ - doctype: DocumentType; - /** - * Gets a reference to the root node of the document. - */ - documentElement: HTMLElement; - /** - * Sets or gets the security domain of the document. - */ - domain: string; - /** - * Retrieves a collection of all embed objects in the document. - */ - embeds: HTMLCollection; - /** - * Sets or gets the foreground (text) color of the document. - */ - fgColor: string; - /** - * Retrieves a collection, in source order, of all form objects in the document. - */ - forms: HTMLCollection; - fullscreenElement: Element; - fullscreenEnabled: boolean; - head: HTMLHeadElement; - hidden: boolean; - /** - * Retrieves a collection, in source order, of img objects in the document. - */ - images: HTMLCollection; - /** - * Gets the implementation object of the current document. - */ - implementation: DOMImplementation; - /** - * Returns the character encoding used to create the webpage that is loaded into the document object. - */ - inputEncoding: string; - /** - * Gets the date that the page was last modified, if the page supplies one. - */ - lastModified: string; - /** - * Sets or gets the color of the document links. - */ - linkColor: string; - /** - * Retrieves a collection of all a objects that specify the href property and all area objects in the document. - */ - links: HTMLCollection; - /** - * Contains information about the current URL. - */ - location: Location; - media: string; - msCSSOMElementFloatMetrics: boolean; - msCapsLockWarningOff: boolean; - msHidden: boolean; - msVisibilityState: string; - /** - * Fires when the user aborts the download. - * @param ev The event. - */ - onabort: (ev: Event) => any; - /** - * Fires when the object is set as the active element. - * @param ev The event. - */ - onactivate: (ev: UIEvent) => any; - /** - * Fires immediately before the object is set as the active element. - * @param ev The event. - */ - onbeforeactivate: (ev: UIEvent) => any; - /** - * Fires immediately before the activeElement is changed from the current object to another object in the parent document. - * @param ev The event. - */ - onbeforedeactivate: (ev: UIEvent) => any; - /** - * Fires when the object loses the input focus. - * @param ev The focus event. - */ - onblur: (ev: FocusEvent) => any; - /** - * Occurs when playback is possible, but would require further buffering. - * @param ev The event. - */ - oncanplay: (ev: Event) => any; - oncanplaythrough: (ev: Event) => any; - /** - * Fires when the contents of the object or selection have changed. - * @param ev The event. - */ - onchange: (ev: Event) => any; - /** - * Fires when the user clicks the left mouse button on the object - * @param ev The mouse event. - */ - onclick: (ev: MouseEvent) => any; - /** - * Fires when the user clicks the right mouse button in the client area, opening the context menu. - * @param ev The mouse event. - */ - oncontextmenu: (ev: PointerEvent) => any; - /** - * Fires when the user double-clicks the object. - * @param ev The mouse event. - */ - ondblclick: (ev: MouseEvent) => any; - /** - * Fires when the activeElement is changed from the current object to another object in the parent document. - * @param ev The UI Event - */ - ondeactivate: (ev: UIEvent) => any; - /** - * Fires on the source object continuously during a drag operation. - * @param ev The event. - */ - ondrag: (ev: DragEvent) => any; - /** - * Fires on the source object when the user releases the mouse at the close of a drag operation. - * @param ev The event. - */ - ondragend: (ev: DragEvent) => any; - /** - * Fires on the target element when the user drags the object to a valid drop target. - * @param ev The drag event. - */ - ondragenter: (ev: DragEvent) => any; - /** - * Fires on the target object when the user moves the mouse out of a valid drop target during a drag operation. - * @param ev The drag event. - */ - ondragleave: (ev: DragEvent) => any; - /** - * Fires on the target element continuously while the user drags the object over a valid drop target. - * @param ev The event. - */ - ondragover: (ev: DragEvent) => any; - /** - * Fires on the source object when the user starts to drag a text selection or selected object. - * @param ev The event. - */ - ondragstart: (ev: DragEvent) => any; - ondrop: (ev: DragEvent) => any; - /** - * Occurs when the duration attribute is updated. - * @param ev The event. - */ - ondurationchange: (ev: Event) => any; - /** - * Occurs when the media element is reset to its initial state. - * @param ev The event. - */ - onemptied: (ev: Event) => any; - /** - * Occurs when the end of playback is reached. - * @param ev The event - */ - onended: (ev: Event) => any; - /** - * Fires when an error occurs during object loading. - * @param ev The event. - */ - onerror: (ev: Event) => any; - /** - * Fires when the object receives focus. - * @param ev The event. - */ - onfocus: (ev: FocusEvent) => any; - onfullscreenchange: (ev: Event) => any; - onfullscreenerror: (ev: Event) => any; - oninput: (ev: Event) => any; - /** - * Fires when the user presses a key. - * @param ev The keyboard event - */ - onkeydown: (ev: KeyboardEvent) => any; - /** - * Fires when the user presses an alphanumeric key. - * @param ev The event. - */ - onkeypress: (ev: KeyboardEvent) => any; - /** - * Fires when the user releases a key. - * @param ev The keyboard event - */ - onkeyup: (ev: KeyboardEvent) => any; - /** - * Fires immediately after the browser loads the object. - * @param ev The event. - */ - onload: (ev: Event) => any; - /** - * Occurs when media data is loaded at the current playback position. - * @param ev The event. - */ - onloadeddata: (ev: Event) => any; - /** - * Occurs when the duration and dimensions of the media have been determined. - * @param ev The event. - */ - onloadedmetadata: (ev: Event) => any; - /** - * Occurs when Internet Explorer begins looking for media data. - * @param ev The event. - */ - onloadstart: (ev: Event) => any; - /** - * Fires when the user clicks the object with either mouse button. - * @param ev The mouse event. - */ - onmousedown: (ev: MouseEvent) => any; - /** - * Fires when the user moves the mouse over the object. - * @param ev The mouse event. - */ - onmousemove: (ev: MouseEvent) => any; - /** - * Fires when the user moves the mouse pointer outside the boundaries of the object. - * @param ev The mouse event. - */ - onmouseout: (ev: MouseEvent) => any; - /** - * Fires when the user moves the mouse pointer into the object. - * @param ev The mouse event. - */ - onmouseover: (ev: MouseEvent) => any; - /** - * Fires when the user releases a mouse button while the mouse is over the object. - * @param ev The mouse event. - */ - onmouseup: (ev: MouseEvent) => any; - /** - * Fires when the wheel button is rotated. - * @param ev The mouse event - */ - onmousewheel: (ev: MouseWheelEvent) => any; - onmscontentzoom: (ev: UIEvent) => any; - onmsgesturechange: (ev: MSGestureEvent) => any; - onmsgesturedoubletap: (ev: MSGestureEvent) => any; - onmsgestureend: (ev: MSGestureEvent) => any; - onmsgesturehold: (ev: MSGestureEvent) => any; - onmsgesturestart: (ev: MSGestureEvent) => any; - onmsgesturetap: (ev: MSGestureEvent) => any; - onmsinertiastart: (ev: MSGestureEvent) => any; - onmsmanipulationstatechanged: (ev: MSManipulationEvent) => any; - onmspointercancel: (ev: MSPointerEvent) => any; - onmspointerdown: (ev: MSPointerEvent) => any; - onmspointerenter: (ev: MSPointerEvent) => any; - onmspointerleave: (ev: MSPointerEvent) => any; - onmspointermove: (ev: MSPointerEvent) => any; - onmspointerout: (ev: MSPointerEvent) => any; - onmspointerover: (ev: MSPointerEvent) => any; - onmspointerup: (ev: MSPointerEvent) => any; - /** - * Occurs when an item is removed from a Jump List of a webpage running in Site Mode. - * @param ev The event. - */ - onmssitemodejumplistitemremoved: (ev: MSSiteModeEvent) => any; - /** - * Occurs when a user clicks a button in a Thumbnail Toolbar of a webpage running in Site Mode. - * @param ev The event. - */ - onmsthumbnailclick: (ev: MSSiteModeEvent) => any; - /** - * Occurs when playback is paused. - * @param ev The event. - */ - onpause: (ev: Event) => any; - /** - * Occurs when the play method is requested. - * @param ev The event. - */ - onplay: (ev: Event) => any; - /** - * Occurs when the audio or video has started playing. - * @param ev The event. - */ - onplaying: (ev: Event) => any; - onpointerlockchange: (ev: Event) => any; - onpointerlockerror: (ev: Event) => any; - /** - * Occurs to indicate progress while downloading media data. - * @param ev The event. - */ - onprogress: (ev: ProgressEvent) => any; - /** - * Occurs when the playback rate is increased or decreased. - * @param ev The event. - */ - onratechange: (ev: Event) => any; - /** - * Fires when the state of the object has changed. - * @param ev The event - */ - onreadystatechange: (ev: ProgressEvent) => any; - /** - * Fires when the user resets a form. - * @param ev The event. - */ - onreset: (ev: Event) => any; - /** - * Fires when the user repositions the scroll box in the scroll bar on the object. - * @param ev The event. - */ - onscroll: (ev: UIEvent) => any; - /** - * Occurs when the seek operation ends. - * @param ev The event. - */ - onseeked: (ev: Event) => any; - /** - * Occurs when the current playback position is moved. - * @param ev The event. - */ - onseeking: (ev: Event) => any; - /** - * Fires when the current selection changes. - * @param ev The event. - */ - onselect: (ev: UIEvent) => any; - onselectstart: (ev: Event) => any; - /** - * Occurs when the download has stopped. - * @param ev The event. - */ - onstalled: (ev: Event) => any; - /** - * Fires when the user clicks the Stop button or leaves the Web page. - * @param ev The event. - */ - onstop: (ev: Event) => any; - onsubmit: (ev: Event) => any; - /** - * Occurs if the load operation has been intentionally halted. - * @param ev The event. - */ - onsuspend: (ev: Event) => any; - /** - * Occurs to indicate the current playback position. - * @param ev The event. - */ - ontimeupdate: (ev: Event) => any; - ontouchcancel: (ev: TouchEvent) => any; - ontouchend: (ev: TouchEvent) => any; - ontouchmove: (ev: TouchEvent) => any; - ontouchstart: (ev: TouchEvent) => any; - /** - * Occurs when the volume is changed, or playback is muted or unmuted. - * @param ev The event. - */ - onvolumechange: (ev: Event) => any; - /** - * Occurs when playback stops because the next frame of a video resource is not available. - * @param ev The event. - */ - onwaiting: (ev: Event) => any; - onwebkitfullscreenchange: (ev: Event) => any; - onwebkitfullscreenerror: (ev: Event) => any; - plugins: HTMLCollection; - pointerLockElement: Element; - /** - * Retrieves a value that indicates the current state of the object. - */ - readyState: string; - /** - * Gets the URL of the location that referred the user to the current page. - */ - referrer: string; - /** - * Gets the root svg element in the document hierarchy. - */ - rootElement: SVGSVGElement; - /** - * Retrieves a collection of all script objects in the document. - */ - scripts: HTMLCollection; - security: string; - /** - * Retrieves a collection of styleSheet objects representing the style sheets that correspond to each instance of a link or style object in the document. - */ - styleSheets: StyleSheetList; - /** - * Contains the title of the document. - */ - title: string; - visibilityState: string; - /** - * Sets or gets the color of the links that the user has visited. - */ - vlinkColor: string; - webkitCurrentFullScreenElement: Element; - webkitFullscreenElement: Element; - webkitFullscreenEnabled: boolean; - webkitIsFullScreen: boolean; - xmlEncoding: string; - xmlStandalone: boolean; - /** - * Gets or sets the version attribute specified in the declaration of an XML document. - */ - xmlVersion: string; - currentScript: HTMLScriptElement; - adoptNode(source: Node): Node; - captureEvents(): void; - clear(): void; - /** - * Closes an output stream and forces the sent data to display. - */ - close(): void; - /** - * Creates an attribute object with a specified name. - * @param name String that sets the attribute object's name. - */ - createAttribute(name: string): Attr; - createAttributeNS(namespaceURI: string, qualifiedName: string): Attr; - createCDATASection(data: string): CDATASection; - /** - * Creates a comment object with the specified data. - * @param data Sets the comment object's data. - */ - createComment(data: string): Comment; - /** - * Creates a new document. - */ - createDocumentFragment(): DocumentFragment; - /** - * Creates an instance of the element for the specified tag. - * @param tagName The name of an element. - */ - createElement(tagName: "a"): HTMLAnchorElement; - createElement(tagName: "abbr"): HTMLPhraseElement; - createElement(tagName: "acronym"): HTMLPhraseElement; - createElement(tagName: "address"): HTMLBlockElement; - createElement(tagName: "applet"): HTMLAppletElement; - createElement(tagName: "area"): HTMLAreaElement; - createElement(tagName: "audio"): HTMLAudioElement; - createElement(tagName: "b"): HTMLPhraseElement; - createElement(tagName: "base"): HTMLBaseElement; - createElement(tagName: "basefont"): HTMLBaseFontElement; - createElement(tagName: "bdo"): HTMLPhraseElement; - createElement(tagName: "big"): HTMLPhraseElement; - createElement(tagName: "blockquote"): HTMLBlockElement; - createElement(tagName: "body"): HTMLBodyElement; - createElement(tagName: "br"): HTMLBRElement; - createElement(tagName: "button"): HTMLButtonElement; - createElement(tagName: "canvas"): HTMLCanvasElement; - createElement(tagName: "caption"): HTMLTableCaptionElement; - createElement(tagName: "center"): HTMLBlockElement; - createElement(tagName: "cite"): HTMLPhraseElement; - createElement(tagName: "code"): HTMLPhraseElement; - createElement(tagName: "col"): HTMLTableColElement; - createElement(tagName: "colgroup"): HTMLTableColElement; - createElement(tagName: "datalist"): HTMLDataListElement; - createElement(tagName: "dd"): HTMLDDElement; - createElement(tagName: "del"): HTMLModElement; - createElement(tagName: "dfn"): HTMLPhraseElement; - createElement(tagName: "dir"): HTMLDirectoryElement; - createElement(tagName: "div"): HTMLDivElement; - createElement(tagName: "dl"): HTMLDListElement; - createElement(tagName: "dt"): HTMLDTElement; - createElement(tagName: "em"): HTMLPhraseElement; - createElement(tagName: "embed"): HTMLEmbedElement; - createElement(tagName: "fieldset"): HTMLFieldSetElement; - createElement(tagName: "font"): HTMLFontElement; - createElement(tagName: "form"): HTMLFormElement; - createElement(tagName: "frame"): HTMLFrameElement; - createElement(tagName: "frameset"): HTMLFrameSetElement; - createElement(tagName: "h1"): HTMLHeadingElement; - createElement(tagName: "h2"): HTMLHeadingElement; - createElement(tagName: "h3"): HTMLHeadingElement; - createElement(tagName: "h4"): HTMLHeadingElement; - createElement(tagName: "h5"): HTMLHeadingElement; - createElement(tagName: "h6"): HTMLHeadingElement; - createElement(tagName: "head"): HTMLHeadElement; - createElement(tagName: "hr"): HTMLHRElement; - createElement(tagName: "html"): HTMLHtmlElement; - createElement(tagName: "i"): HTMLPhraseElement; - createElement(tagName: "iframe"): HTMLIFrameElement; - createElement(tagName: "img"): HTMLImageElement; - createElement(tagName: "input"): HTMLInputElement; - createElement(tagName: "ins"): HTMLModElement; - createElement(tagName: "isindex"): HTMLIsIndexElement; - createElement(tagName: "kbd"): HTMLPhraseElement; - createElement(tagName: "keygen"): HTMLBlockElement; - createElement(tagName: "label"): HTMLLabelElement; - createElement(tagName: "legend"): HTMLLegendElement; - createElement(tagName: "li"): HTMLLIElement; - createElement(tagName: "link"): HTMLLinkElement; - createElement(tagName: "listing"): HTMLBlockElement; - createElement(tagName: "map"): HTMLMapElement; - createElement(tagName: "marquee"): HTMLMarqueeElement; - createElement(tagName: "menu"): HTMLMenuElement; - createElement(tagName: "meta"): HTMLMetaElement; - createElement(tagName: "nextid"): HTMLNextIdElement; - createElement(tagName: "nobr"): HTMLPhraseElement; - createElement(tagName: "object"): HTMLObjectElement; - createElement(tagName: "ol"): HTMLOListElement; - createElement(tagName: "optgroup"): HTMLOptGroupElement; - createElement(tagName: "option"): HTMLOptionElement; - createElement(tagName: "p"): HTMLParagraphElement; - createElement(tagName: "param"): HTMLParamElement; - createElement(tagName: "plaintext"): HTMLBlockElement; - createElement(tagName: "pre"): HTMLPreElement; - createElement(tagName: "progress"): HTMLProgressElement; - createElement(tagName: "q"): HTMLQuoteElement; - createElement(tagName: "rt"): HTMLPhraseElement; - createElement(tagName: "ruby"): HTMLPhraseElement; - createElement(tagName: "s"): HTMLPhraseElement; - createElement(tagName: "samp"): HTMLPhraseElement; - createElement(tagName: "script"): HTMLScriptElement; - createElement(tagName: "select"): HTMLSelectElement; - createElement(tagName: "small"): HTMLPhraseElement; - createElement(tagName: "source"): HTMLSourceElement; - createElement(tagName: "span"): HTMLSpanElement; - createElement(tagName: "strike"): HTMLPhraseElement; - createElement(tagName: "strong"): HTMLPhraseElement; - createElement(tagName: "style"): HTMLStyleElement; - createElement(tagName: "sub"): HTMLPhraseElement; - createElement(tagName: "sup"): HTMLPhraseElement; - createElement(tagName: "table"): HTMLTableElement; - createElement(tagName: "tbody"): HTMLTableSectionElement; - createElement(tagName: "td"): HTMLTableDataCellElement; - createElement(tagName: "textarea"): HTMLTextAreaElement; - createElement(tagName: "tfoot"): HTMLTableSectionElement; - createElement(tagName: "th"): HTMLTableHeaderCellElement; - createElement(tagName: "thead"): HTMLTableSectionElement; - createElement(tagName: "title"): HTMLTitleElement; - createElement(tagName: "tr"): HTMLTableRowElement; - createElement(tagName: "track"): HTMLTrackElement; - createElement(tagName: "tt"): HTMLPhraseElement; - createElement(tagName: "u"): HTMLPhraseElement; - createElement(tagName: "ul"): HTMLUListElement; - createElement(tagName: "var"): HTMLPhraseElement; - createElement(tagName: "video"): HTMLVideoElement; - createElement(tagName: "x-ms-webview"): MSHTMLWebViewElement; - createElement(tagName: "xmp"): HTMLBlockElement; - createElement(tagName: string): HTMLElement; - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "a"): SVGAElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "circle"): SVGCircleElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "clipPath"): SVGClipPathElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "componentTransferFunction"): SVGComponentTransferFunctionElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "defs"): SVGDefsElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "desc"): SVGDescElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "ellipse"): SVGEllipseElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feBlend"): SVGFEBlendElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feColorMatrix"): SVGFEColorMatrixElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feComponentTransfer"): SVGFEComponentTransferElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feComposite"): SVGFECompositeElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feConvolveMatrix"): SVGFEConvolveMatrixElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feDiffuseLighting"): SVGFEDiffuseLightingElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feDisplacementMap"): SVGFEDisplacementMapElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feDistantLight"): SVGFEDistantLightElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feFlood"): SVGFEFloodElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feFuncA"): SVGFEFuncAElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feFuncB"): SVGFEFuncBElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feFuncG"): SVGFEFuncGElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feFuncR"): SVGFEFuncRElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feGaussianBlur"): SVGFEGaussianBlurElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feImage"): SVGFEImageElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feMerge"): SVGFEMergeElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feMergeNode"): SVGFEMergeNodeElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feMorphology"): SVGFEMorphologyElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feOffset"): SVGFEOffsetElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "fePointLight"): SVGFEPointLightElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feSpecularLighting"): SVGFESpecularLightingElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feSpotLight"): SVGFESpotLightElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feTile"): SVGFETileElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feTurbulence"): SVGFETurbulenceElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "filter"): SVGFilterElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "foreignObject"): SVGForeignObjectElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "g"): SVGGElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "image"): SVGImageElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "gradient"): SVGGradientElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "line"): SVGLineElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "linearGradient"): SVGLinearGradientElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "marker"): SVGMarkerElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "mask"): SVGMaskElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "path"): SVGPathElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "metadata"): SVGMetadataElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "pattern"): SVGPatternElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "polygon"): SVGPolygonElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "polyline"): SVGPolylineElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "radialGradient"): SVGRadialGradientElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "rect"): SVGRectElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "svg"): SVGSVGElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "script"): SVGScriptElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "stop"): SVGStopElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "style"): SVGStyleElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "switch"): SVGSwitchElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "symbol"): SVGSymbolElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "tspan"): SVGTSpanElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "textContent"): SVGTextContentElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "text"): SVGTextElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "textPath"): SVGTextPathElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "textPositioning"): SVGTextPositioningElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "title"): SVGTitleElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "use"): SVGUseElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "view"): SVGViewElement - createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: string): SVGElement - createElementNS(namespaceURI: string, qualifiedName: string): Element; - createExpression(expression: string, resolver: XPathNSResolver): XPathExpression; - createNSResolver(nodeResolver: Node): XPathNSResolver; - /** - * Creates a NodeIterator object that you can use to traverse filtered lists of nodes or elements in a document. - * @param root The root element or node to start traversing on. - * @param whatToShow The type of nodes or elements to appear in the node list - * @param filter A custom NodeFilter function to use. For more information, see filter. Use null for no filter. - * @param entityReferenceExpansion A flag that specifies whether entity reference nodes are expanded. - */ - createNodeIterator(root: Node, whatToShow?: number, filter?: NodeFilter, entityReferenceExpansion?: boolean): NodeIterator; - createProcessingInstruction(target: string, data: string): ProcessingInstruction; - /** - * Returns an empty range object that has both of its boundary points positioned at the beginning of the document. - */ - createRange(): Range; - /** - * Creates a text string from the specified value. - * @param data String that specifies the nodeValue property of the text node. - */ - createTextNode(data: string): Text; - createTouch(view: any, target: EventTarget, identifier: number, pageX: number, pageY: number, screenX: number, screenY: number): Touch; - createTouchList(...touches: Touch[]): TouchList; - /** - * Creates a TreeWalker object that you can use to traverse filtered lists of nodes or elements in a document. - * @param root The root element or node to start traversing on. - * @param whatToShow The type of nodes or elements to appear in the node list. For more information, see whatToShow. - * @param filter A custom NodeFilter function to use. - * @param entityReferenceExpansion A flag that specifies whether entity reference nodes are expanded. - */ - createTreeWalker(root: Node, whatToShow?: number, filter?: NodeFilter, entityReferenceExpansion?: boolean): TreeWalker; - /** - * Returns the element for the specified x coordinate and the specified y coordinate. - * @param x The x-offset - * @param y The y-offset - */ - elementFromPoint(x: number, y: number): Element; - evaluate(expression: string, contextNode: Node, resolver: XPathNSResolver, type: number, result: XPathResult): XPathResult; - /** - * Executes a command on the current document, current selection, or the given range. - * @param commandId String that specifies the command to execute. This command can be any of the command identifiers that can be executed in script. - * @param showUI Display the user interface, defaults to false. - * @param value Value to assign. - */ - execCommand(commandId: string, showUI?: boolean, value?: any): boolean; - /** - * Displays help information for the given command identifier. - * @param commandId Displays help information for the given command identifier. - */ - execCommandShowHelp(commandId: string): boolean; - exitFullscreen(): void; - exitPointerLock(): void; - /** - * Causes the element to receive the focus and executes the code specified by the onfocus event. - */ - focus(): void; - /** - * Returns a reference to the first object with the specified value of the ID or NAME attribute. - * @param elementId String that specifies the ID value. Case-insensitive. - */ - getElementById(elementId: string): HTMLElement; - getElementsByClassName(classNames: string): NodeListOf; - /** - * Gets a collection of objects based on the value of the NAME or ID attribute. - * @param elementName Gets a collection of objects based on the value of the NAME or ID attribute. - */ - getElementsByName(elementName: string): NodeListOf; - /** - * Retrieves a collection of objects based on the specified element name. - * @param name Specifies the name of an element. - */ - getElementsByTagName(tagname: "a"): NodeListOf; - getElementsByTagName(tagname: "abbr"): NodeListOf; - getElementsByTagName(tagname: "acronym"): NodeListOf; - getElementsByTagName(tagname: "address"): NodeListOf; - getElementsByTagName(tagname: "applet"): NodeListOf; - getElementsByTagName(tagname: "area"): NodeListOf; - getElementsByTagName(tagname: "article"): NodeListOf; - getElementsByTagName(tagname: "aside"): NodeListOf; - getElementsByTagName(tagname: "audio"): NodeListOf; - getElementsByTagName(tagname: "b"): NodeListOf; - getElementsByTagName(tagname: "base"): NodeListOf; - getElementsByTagName(tagname: "basefont"): NodeListOf; - getElementsByTagName(tagname: "bdo"): NodeListOf; - getElementsByTagName(tagname: "big"): NodeListOf; - getElementsByTagName(tagname: "blockquote"): NodeListOf; - getElementsByTagName(tagname: "body"): NodeListOf; - getElementsByTagName(tagname: "br"): NodeListOf; - getElementsByTagName(tagname: "button"): NodeListOf; - getElementsByTagName(tagname: "canvas"): NodeListOf; - getElementsByTagName(tagname: "caption"): NodeListOf; - getElementsByTagName(tagname: "center"): NodeListOf; - getElementsByTagName(tagname: "circle"): NodeListOf; - getElementsByTagName(tagname: "cite"): NodeListOf; - getElementsByTagName(tagname: "clippath"): NodeListOf; - getElementsByTagName(tagname: "code"): NodeListOf; - getElementsByTagName(tagname: "col"): NodeListOf; - getElementsByTagName(tagname: "colgroup"): NodeListOf; - getElementsByTagName(tagname: "datalist"): NodeListOf; - getElementsByTagName(tagname: "dd"): NodeListOf; - getElementsByTagName(tagname: "defs"): NodeListOf; - getElementsByTagName(tagname: "del"): NodeListOf; - getElementsByTagName(tagname: "desc"): NodeListOf; - getElementsByTagName(tagname: "dfn"): NodeListOf; - getElementsByTagName(tagname: "dir"): NodeListOf; - getElementsByTagName(tagname: "div"): NodeListOf; - getElementsByTagName(tagname: "dl"): NodeListOf; - getElementsByTagName(tagname: "dt"): NodeListOf; - getElementsByTagName(tagname: "ellipse"): NodeListOf; - getElementsByTagName(tagname: "em"): NodeListOf; - getElementsByTagName(tagname: "embed"): NodeListOf; - getElementsByTagName(tagname: "feblend"): NodeListOf; - getElementsByTagName(tagname: "fecolormatrix"): NodeListOf; - getElementsByTagName(tagname: "fecomponenttransfer"): NodeListOf; - getElementsByTagName(tagname: "fecomposite"): NodeListOf; - getElementsByTagName(tagname: "feconvolvematrix"): NodeListOf; - getElementsByTagName(tagname: "fediffuselighting"): NodeListOf; - getElementsByTagName(tagname: "fedisplacementmap"): NodeListOf; - getElementsByTagName(tagname: "fedistantlight"): NodeListOf; - getElementsByTagName(tagname: "feflood"): NodeListOf; - getElementsByTagName(tagname: "fefunca"): NodeListOf; - getElementsByTagName(tagname: "fefuncb"): NodeListOf; - getElementsByTagName(tagname: "fefuncg"): NodeListOf; - getElementsByTagName(tagname: "fefuncr"): NodeListOf; - getElementsByTagName(tagname: "fegaussianblur"): NodeListOf; - getElementsByTagName(tagname: "feimage"): NodeListOf; - getElementsByTagName(tagname: "femerge"): NodeListOf; - getElementsByTagName(tagname: "femergenode"): NodeListOf; - getElementsByTagName(tagname: "femorphology"): NodeListOf; - getElementsByTagName(tagname: "feoffset"): NodeListOf; - getElementsByTagName(tagname: "fepointlight"): NodeListOf; - getElementsByTagName(tagname: "fespecularlighting"): NodeListOf; - getElementsByTagName(tagname: "fespotlight"): NodeListOf; - getElementsByTagName(tagname: "fetile"): NodeListOf; - getElementsByTagName(tagname: "feturbulence"): NodeListOf; - getElementsByTagName(tagname: "fieldset"): NodeListOf; - getElementsByTagName(tagname: "figcaption"): NodeListOf; - getElementsByTagName(tagname: "figure"): NodeListOf; - getElementsByTagName(tagname: "filter"): NodeListOf; - getElementsByTagName(tagname: "font"): NodeListOf; - getElementsByTagName(tagname: "footer"): NodeListOf; - getElementsByTagName(tagname: "foreignobject"): NodeListOf; - getElementsByTagName(tagname: "form"): NodeListOf; - getElementsByTagName(tagname: "frame"): NodeListOf; - getElementsByTagName(tagname: "frameset"): NodeListOf; - getElementsByTagName(tagname: "g"): NodeListOf; - getElementsByTagName(tagname: "h1"): NodeListOf; - getElementsByTagName(tagname: "h2"): NodeListOf; - getElementsByTagName(tagname: "h3"): NodeListOf; - getElementsByTagName(tagname: "h4"): NodeListOf; - getElementsByTagName(tagname: "h5"): NodeListOf; - getElementsByTagName(tagname: "h6"): NodeListOf; - getElementsByTagName(tagname: "head"): NodeListOf; - getElementsByTagName(tagname: "header"): NodeListOf; - getElementsByTagName(tagname: "hgroup"): NodeListOf; - getElementsByTagName(tagname: "hr"): NodeListOf; - getElementsByTagName(tagname: "html"): NodeListOf; - getElementsByTagName(tagname: "i"): NodeListOf; - getElementsByTagName(tagname: "iframe"): NodeListOf; - getElementsByTagName(tagname: "image"): NodeListOf; - getElementsByTagName(tagname: "img"): NodeListOf; - getElementsByTagName(tagname: "input"): NodeListOf; - getElementsByTagName(tagname: "ins"): NodeListOf; - getElementsByTagName(tagname: "isindex"): NodeListOf; - getElementsByTagName(tagname: "kbd"): NodeListOf; - getElementsByTagName(tagname: "keygen"): NodeListOf; - getElementsByTagName(tagname: "label"): NodeListOf; - getElementsByTagName(tagname: "legend"): NodeListOf; - getElementsByTagName(tagname: "li"): NodeListOf; - getElementsByTagName(tagname: "line"): NodeListOf; - getElementsByTagName(tagname: "lineargradient"): NodeListOf; - getElementsByTagName(tagname: "link"): NodeListOf; - getElementsByTagName(tagname: "listing"): NodeListOf; - getElementsByTagName(tagname: "map"): NodeListOf; - getElementsByTagName(tagname: "mark"): NodeListOf; - getElementsByTagName(tagname: "marker"): NodeListOf; - getElementsByTagName(tagname: "marquee"): NodeListOf; - getElementsByTagName(tagname: "mask"): NodeListOf; - getElementsByTagName(tagname: "menu"): NodeListOf; - getElementsByTagName(tagname: "meta"): NodeListOf; - getElementsByTagName(tagname: "metadata"): NodeListOf; - getElementsByTagName(tagname: "nav"): NodeListOf; - getElementsByTagName(tagname: "nextid"): NodeListOf; - getElementsByTagName(tagname: "nobr"): NodeListOf; - getElementsByTagName(tagname: "noframes"): NodeListOf; - getElementsByTagName(tagname: "noscript"): NodeListOf; - getElementsByTagName(tagname: "object"): NodeListOf; - getElementsByTagName(tagname: "ol"): NodeListOf; - getElementsByTagName(tagname: "optgroup"): NodeListOf; - getElementsByTagName(tagname: "option"): NodeListOf; - getElementsByTagName(tagname: "p"): NodeListOf; - getElementsByTagName(tagname: "param"): NodeListOf; - getElementsByTagName(tagname: "path"): NodeListOf; - getElementsByTagName(tagname: "pattern"): NodeListOf; - getElementsByTagName(tagname: "plaintext"): NodeListOf; - getElementsByTagName(tagname: "polygon"): NodeListOf; - getElementsByTagName(tagname: "polyline"): NodeListOf; - getElementsByTagName(tagname: "pre"): NodeListOf; - getElementsByTagName(tagname: "progress"): NodeListOf; - getElementsByTagName(tagname: "q"): NodeListOf; - getElementsByTagName(tagname: "radialgradient"): NodeListOf; - getElementsByTagName(tagname: "rect"): NodeListOf; - getElementsByTagName(tagname: "rt"): NodeListOf; - getElementsByTagName(tagname: "ruby"): NodeListOf; - getElementsByTagName(tagname: "s"): NodeListOf; - getElementsByTagName(tagname: "samp"): NodeListOf; - getElementsByTagName(tagname: "script"): NodeListOf; - getElementsByTagName(tagname: "section"): NodeListOf; - getElementsByTagName(tagname: "select"): NodeListOf; - getElementsByTagName(tagname: "small"): NodeListOf; - getElementsByTagName(tagname: "source"): NodeListOf; - getElementsByTagName(tagname: "span"): NodeListOf; - getElementsByTagName(tagname: "stop"): NodeListOf; - getElementsByTagName(tagname: "strike"): NodeListOf; - getElementsByTagName(tagname: "strong"): NodeListOf; - getElementsByTagName(tagname: "style"): NodeListOf; - getElementsByTagName(tagname: "sub"): NodeListOf; - getElementsByTagName(tagname: "sup"): NodeListOf; - getElementsByTagName(tagname: "svg"): NodeListOf; - getElementsByTagName(tagname: "switch"): NodeListOf; - getElementsByTagName(tagname: "symbol"): NodeListOf; - getElementsByTagName(tagname: "table"): NodeListOf; - getElementsByTagName(tagname: "tbody"): NodeListOf; - getElementsByTagName(tagname: "td"): NodeListOf; - getElementsByTagName(tagname: "text"): NodeListOf; - getElementsByTagName(tagname: "textpath"): NodeListOf; - getElementsByTagName(tagname: "textarea"): NodeListOf; - getElementsByTagName(tagname: "tfoot"): NodeListOf; - getElementsByTagName(tagname: "th"): NodeListOf; - getElementsByTagName(tagname: "thead"): NodeListOf; - getElementsByTagName(tagname: "title"): NodeListOf; - getElementsByTagName(tagname: "tr"): NodeListOf; - getElementsByTagName(tagname: "track"): NodeListOf; - getElementsByTagName(tagname: "tspan"): NodeListOf; - getElementsByTagName(tagname: "tt"): NodeListOf; - getElementsByTagName(tagname: "u"): NodeListOf; - getElementsByTagName(tagname: "ul"): NodeListOf; - getElementsByTagName(tagname: "use"): NodeListOf; - getElementsByTagName(tagname: "var"): NodeListOf; - getElementsByTagName(tagname: "video"): NodeListOf; - getElementsByTagName(tagname: "view"): NodeListOf; - getElementsByTagName(tagname: "wbr"): NodeListOf; - getElementsByTagName(tagname: "x-ms-webview"): NodeListOf; - getElementsByTagName(tagname: "xmp"): NodeListOf; - getElementsByTagName(tagname: string): NodeListOf; - getElementsByTagNameNS(namespaceURI: string, localName: string): NodeListOf; - /** - * Returns an object representing the current selection of the document that is loaded into the object displaying a webpage. - */ - getSelection(): Selection; - /** - * Gets a value indicating whether the object currently has focus. - */ - hasFocus(): boolean; - importNode(importedNode: Node, deep: boolean): Node; - msElementsFromPoint(x: number, y: number): NodeList; - msElementsFromRect(left: number, top: number, width: number, height: number): NodeList; - /** - * 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. - * @param url Specifies a MIME type for the document. - * @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. - * @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. - * @param replace Specifies whether the existing entry for the document is replaced in the history list. - */ - open(url?: string, name?: string, features?: string, replace?: boolean): Document; - /** - * Returns a Boolean value that indicates whether a specified command can be successfully executed using execCommand, given the current state of the document. - * @param commandId Specifies a command identifier. - */ - queryCommandEnabled(commandId: string): boolean; - /** - * Returns a Boolean value that indicates whether the specified command is in the indeterminate state. - * @param commandId String that specifies a command identifier. - */ - queryCommandIndeterm(commandId: string): boolean; - /** - * Returns a Boolean value that indicates the current state of the command. - * @param commandId String that specifies a command identifier. - */ - queryCommandState(commandId: string): boolean; - /** - * Returns a Boolean value that indicates whether the current command is supported on the current range. - * @param commandId Specifies a command identifier. - */ - queryCommandSupported(commandId: string): boolean; - /** - * Retrieves the string associated with a command. - * @param commandId String that contains the identifier of a command. This can be any command identifier given in the list of Command Identifiers. - */ - queryCommandText(commandId: string): string; - /** - * Returns the current value of the document, range, or current selection for the given command. - * @param commandId String that specifies a command identifier. - */ - queryCommandValue(commandId: string): string; - releaseEvents(): void; - /** - * Allows updating the print settings for the page. - */ - updateSettings(): void; - webkitCancelFullScreen(): void; - webkitExitFullscreen(): void; - /** - * Writes one or more HTML expressions to a document in the specified window. - * @param content Specifies the text and HTML tags to write. - */ - write(...content: string[]): void; - /** - * Writes one or more HTML expressions, followed by a carriage return, to a document in the specified window. - * @param content The text and HTML tags to write. - */ - writeln(...content: string[]): void; - createElement(tagName: "picture"): HTMLPictureElement; - getElementsByTagName(tagname: "picture"): NodeListOf; - addEventListener(type: "MSContentZoom", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureChange", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureDoubleTap", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureEnd", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureHold", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureStart", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureTap", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSInertiaStart", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSManipulationStateChanged", listener: (ev: MSManipulationEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerCancel", listener: (ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerDown", listener: (ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerEnter", listener: (ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerLeave", listener: (ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerMove", listener: (ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerOut", listener: (ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerOver", listener: (ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerUp", listener: (ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "abort", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "activate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforeactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforedeactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "blur", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "canplay", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "canplaythrough", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "change", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "click", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "contextmenu", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dblclick", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "deactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "drag", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragend", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragenter", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragleave", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragover", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragstart", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "drop", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "durationchange", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "emptied", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "ended", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "focus", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "fullscreenchange", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "fullscreenerror", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "input", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "keydown", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "keypress", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "keyup", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "load", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadeddata", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadedmetadata", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadstart", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "mousedown", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousemove", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseout", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseover", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseup", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousewheel", listener: (ev: MouseWheelEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mssitemodejumplistitemremoved", listener: (ev: MSSiteModeEvent) => any, useCapture?: boolean): void; - addEventListener(type: "msthumbnailclick", listener: (ev: MSSiteModeEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pause", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "play", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "playing", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "pointercancel", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerdown", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerenter", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerleave", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerlockchange", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "pointerlockerror", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "pointermove", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerout", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerover", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerup", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "progress", listener: (ev: ProgressEvent) => any, useCapture?: boolean): void; - addEventListener(type: "ratechange", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "readystatechange", listener: (ev: ProgressEvent) => any, useCapture?: boolean): void; - addEventListener(type: "reset", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "scroll", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "seeked", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "seeking", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "select", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "selectstart", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "stalled", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "stop", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "submit", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "suspend", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "timeupdate", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "touchcancel", listener: (ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchend", listener: (ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchmove", listener: (ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchstart", listener: (ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "volumechange", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "waiting", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "webkitfullscreenchange", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "webkitfullscreenerror", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "wheel", listener: (ev: WheelEvent) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var Document: { - prototype: Document; - new(): Document; -} - -interface DocumentFragment extends Node, NodeSelector { - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var DocumentFragment: { - prototype: DocumentFragment; - new(): DocumentFragment; -} - -interface DocumentType extends Node, ChildNode { - entities: NamedNodeMap; - internalSubset: string; - name: string; - notations: NamedNodeMap; - publicId: string; - systemId: string; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var DocumentType: { - prototype: DocumentType; - new(): DocumentType; -} - -interface DragEvent extends MouseEvent { - dataTransfer: DataTransfer; - 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; - msConvertURL(file: File, targetType: string, targetURL?: string): void; -} - -declare var DragEvent: { - prototype: DragEvent; - new(): DragEvent; -} - -interface DynamicsCompressorNode extends AudioNode { - attack: AudioParam; - knee: AudioParam; - ratio: AudioParam; - reduction: AudioParam; - release: AudioParam; - threshold: AudioParam; -} - -declare var DynamicsCompressorNode: { - prototype: DynamicsCompressorNode; - new(): DynamicsCompressorNode; -} - -interface EXT_texture_filter_anisotropic { - MAX_TEXTURE_MAX_ANISOTROPY_EXT: number; - TEXTURE_MAX_ANISOTROPY_EXT: number; -} - -declare var EXT_texture_filter_anisotropic: { - prototype: EXT_texture_filter_anisotropic; - new(): EXT_texture_filter_anisotropic; - MAX_TEXTURE_MAX_ANISOTROPY_EXT: number; - TEXTURE_MAX_ANISOTROPY_EXT: number; -} - -interface Element extends Node, GlobalEventHandlers, ElementTraversal, NodeSelector, ChildNode { - classList: DOMTokenList; - clientHeight: number; - clientLeft: number; - clientTop: number; - clientWidth: number; - msContentZoomFactor: number; - msRegionOverflow: string; - onariarequest: (ev: AriaRequestEvent) => any; - oncommand: (ev: CommandEvent) => any; - ongotpointercapture: (ev: PointerEvent) => any; - onlostpointercapture: (ev: PointerEvent) => any; - onmsgesturechange: (ev: MSGestureEvent) => any; - onmsgesturedoubletap: (ev: MSGestureEvent) => any; - onmsgestureend: (ev: MSGestureEvent) => any; - onmsgesturehold: (ev: MSGestureEvent) => any; - onmsgesturestart: (ev: MSGestureEvent) => any; - onmsgesturetap: (ev: MSGestureEvent) => any; - onmsgotpointercapture: (ev: MSPointerEvent) => any; - onmsinertiastart: (ev: MSGestureEvent) => any; - onmslostpointercapture: (ev: MSPointerEvent) => any; - onmspointercancel: (ev: MSPointerEvent) => any; - onmspointerdown: (ev: MSPointerEvent) => any; - onmspointerenter: (ev: MSPointerEvent) => any; - onmspointerleave: (ev: MSPointerEvent) => any; - onmspointermove: (ev: MSPointerEvent) => any; - onmspointerout: (ev: MSPointerEvent) => any; - onmspointerover: (ev: MSPointerEvent) => any; - onmspointerup: (ev: MSPointerEvent) => any; - ontouchcancel: (ev: TouchEvent) => any; - ontouchend: (ev: TouchEvent) => any; - ontouchmove: (ev: TouchEvent) => any; - ontouchstart: (ev: TouchEvent) => any; - onwebkitfullscreenchange: (ev: Event) => any; - onwebkitfullscreenerror: (ev: Event) => any; - scrollHeight: number; - scrollLeft: number; - scrollTop: number; - scrollWidth: number; - tagName: string; - id: string; - className: string; - innerHTML: string; - getAttribute(name?: string): string; - getAttributeNS(namespaceURI: string, localName: string): string; - getAttributeNode(name: string): Attr; - getAttributeNodeNS(namespaceURI: string, localName: string): Attr; - getBoundingClientRect(): ClientRect; - getClientRects(): ClientRectList; - getElementsByTagName(name: "a"): NodeListOf; - getElementsByTagName(name: "abbr"): NodeListOf; - getElementsByTagName(name: "acronym"): NodeListOf; - getElementsByTagName(name: "address"): NodeListOf; - getElementsByTagName(name: "applet"): NodeListOf; - getElementsByTagName(name: "area"): NodeListOf; - getElementsByTagName(name: "article"): NodeListOf; - getElementsByTagName(name: "aside"): NodeListOf; - getElementsByTagName(name: "audio"): NodeListOf; - getElementsByTagName(name: "b"): NodeListOf; - getElementsByTagName(name: "base"): NodeListOf; - getElementsByTagName(name: "basefont"): NodeListOf; - getElementsByTagName(name: "bdo"): NodeListOf; - getElementsByTagName(name: "big"): NodeListOf; - getElementsByTagName(name: "blockquote"): NodeListOf; - getElementsByTagName(name: "body"): NodeListOf; - getElementsByTagName(name: "br"): NodeListOf; - getElementsByTagName(name: "button"): NodeListOf; - getElementsByTagName(name: "canvas"): NodeListOf; - getElementsByTagName(name: "caption"): NodeListOf; - getElementsByTagName(name: "center"): NodeListOf; - getElementsByTagName(name: "circle"): NodeListOf; - getElementsByTagName(name: "cite"): NodeListOf; - getElementsByTagName(name: "clippath"): NodeListOf; - getElementsByTagName(name: "code"): NodeListOf; - getElementsByTagName(name: "col"): NodeListOf; - getElementsByTagName(name: "colgroup"): NodeListOf; - getElementsByTagName(name: "datalist"): NodeListOf; - getElementsByTagName(name: "dd"): NodeListOf; - getElementsByTagName(name: "defs"): NodeListOf; - getElementsByTagName(name: "del"): NodeListOf; - getElementsByTagName(name: "desc"): NodeListOf; - getElementsByTagName(name: "dfn"): NodeListOf; - getElementsByTagName(name: "dir"): NodeListOf; - getElementsByTagName(name: "div"): NodeListOf; - getElementsByTagName(name: "dl"): NodeListOf; - getElementsByTagName(name: "dt"): NodeListOf; - getElementsByTagName(name: "ellipse"): NodeListOf; - getElementsByTagName(name: "em"): NodeListOf; - getElementsByTagName(name: "embed"): NodeListOf; - getElementsByTagName(name: "feblend"): NodeListOf; - getElementsByTagName(name: "fecolormatrix"): NodeListOf; - getElementsByTagName(name: "fecomponenttransfer"): NodeListOf; - getElementsByTagName(name: "fecomposite"): NodeListOf; - getElementsByTagName(name: "feconvolvematrix"): NodeListOf; - getElementsByTagName(name: "fediffuselighting"): NodeListOf; - getElementsByTagName(name: "fedisplacementmap"): NodeListOf; - getElementsByTagName(name: "fedistantlight"): NodeListOf; - getElementsByTagName(name: "feflood"): NodeListOf; - getElementsByTagName(name: "fefunca"): NodeListOf; - getElementsByTagName(name: "fefuncb"): NodeListOf; - getElementsByTagName(name: "fefuncg"): NodeListOf; - getElementsByTagName(name: "fefuncr"): NodeListOf; - getElementsByTagName(name: "fegaussianblur"): NodeListOf; - getElementsByTagName(name: "feimage"): NodeListOf; - getElementsByTagName(name: "femerge"): NodeListOf; - getElementsByTagName(name: "femergenode"): NodeListOf; - getElementsByTagName(name: "femorphology"): NodeListOf; - getElementsByTagName(name: "feoffset"): NodeListOf; - getElementsByTagName(name: "fepointlight"): NodeListOf; - getElementsByTagName(name: "fespecularlighting"): NodeListOf; - getElementsByTagName(name: "fespotlight"): NodeListOf; - getElementsByTagName(name: "fetile"): NodeListOf; - getElementsByTagName(name: "feturbulence"): NodeListOf; - getElementsByTagName(name: "fieldset"): NodeListOf; - getElementsByTagName(name: "figcaption"): NodeListOf; - getElementsByTagName(name: "figure"): NodeListOf; - getElementsByTagName(name: "filter"): NodeListOf; - getElementsByTagName(name: "font"): NodeListOf; - getElementsByTagName(name: "footer"): NodeListOf; - getElementsByTagName(name: "foreignobject"): NodeListOf; - getElementsByTagName(name: "form"): NodeListOf; - getElementsByTagName(name: "frame"): NodeListOf; - getElementsByTagName(name: "frameset"): NodeListOf; - getElementsByTagName(name: "g"): NodeListOf; - getElementsByTagName(name: "h1"): NodeListOf; - getElementsByTagName(name: "h2"): NodeListOf; - getElementsByTagName(name: "h3"): NodeListOf; - getElementsByTagName(name: "h4"): NodeListOf; - getElementsByTagName(name: "h5"): NodeListOf; - getElementsByTagName(name: "h6"): NodeListOf; - getElementsByTagName(name: "head"): NodeListOf; - getElementsByTagName(name: "header"): NodeListOf; - getElementsByTagName(name: "hgroup"): NodeListOf; - getElementsByTagName(name: "hr"): NodeListOf; - getElementsByTagName(name: "html"): NodeListOf; - getElementsByTagName(name: "i"): NodeListOf; - getElementsByTagName(name: "iframe"): NodeListOf; - getElementsByTagName(name: "image"): NodeListOf; - getElementsByTagName(name: "img"): NodeListOf; - getElementsByTagName(name: "input"): NodeListOf; - getElementsByTagName(name: "ins"): NodeListOf; - getElementsByTagName(name: "isindex"): NodeListOf; - getElementsByTagName(name: "kbd"): NodeListOf; - getElementsByTagName(name: "keygen"): NodeListOf; - getElementsByTagName(name: "label"): NodeListOf; - getElementsByTagName(name: "legend"): NodeListOf; - getElementsByTagName(name: "li"): NodeListOf; - getElementsByTagName(name: "line"): NodeListOf; - getElementsByTagName(name: "lineargradient"): NodeListOf; - getElementsByTagName(name: "link"): NodeListOf; - getElementsByTagName(name: "listing"): NodeListOf; - getElementsByTagName(name: "map"): NodeListOf; - getElementsByTagName(name: "mark"): NodeListOf; - getElementsByTagName(name: "marker"): NodeListOf; - getElementsByTagName(name: "marquee"): NodeListOf; - getElementsByTagName(name: "mask"): NodeListOf; - getElementsByTagName(name: "menu"): NodeListOf; - getElementsByTagName(name: "meta"): NodeListOf; - getElementsByTagName(name: "metadata"): NodeListOf; - getElementsByTagName(name: "nav"): NodeListOf; - getElementsByTagName(name: "nextid"): NodeListOf; - getElementsByTagName(name: "nobr"): NodeListOf; - getElementsByTagName(name: "noframes"): NodeListOf; - getElementsByTagName(name: "noscript"): NodeListOf; - getElementsByTagName(name: "object"): NodeListOf; - getElementsByTagName(name: "ol"): NodeListOf; - getElementsByTagName(name: "optgroup"): NodeListOf; - getElementsByTagName(name: "option"): NodeListOf; - getElementsByTagName(name: "p"): NodeListOf; - getElementsByTagName(name: "param"): NodeListOf; - getElementsByTagName(name: "path"): NodeListOf; - getElementsByTagName(name: "pattern"): NodeListOf; - getElementsByTagName(name: "plaintext"): NodeListOf; - getElementsByTagName(name: "polygon"): NodeListOf; - getElementsByTagName(name: "polyline"): NodeListOf; - getElementsByTagName(name: "pre"): NodeListOf; - getElementsByTagName(name: "progress"): NodeListOf; - getElementsByTagName(name: "q"): NodeListOf; - getElementsByTagName(name: "radialgradient"): NodeListOf; - getElementsByTagName(name: "rect"): NodeListOf; - getElementsByTagName(name: "rt"): NodeListOf; - getElementsByTagName(name: "ruby"): NodeListOf; - getElementsByTagName(name: "s"): NodeListOf; - getElementsByTagName(name: "samp"): NodeListOf; - getElementsByTagName(name: "script"): NodeListOf; - getElementsByTagName(name: "section"): NodeListOf; - getElementsByTagName(name: "select"): NodeListOf; - getElementsByTagName(name: "small"): NodeListOf; - getElementsByTagName(name: "source"): NodeListOf; - getElementsByTagName(name: "span"): NodeListOf; - getElementsByTagName(name: "stop"): NodeListOf; - getElementsByTagName(name: "strike"): NodeListOf; - getElementsByTagName(name: "strong"): NodeListOf; - getElementsByTagName(name: "style"): NodeListOf; - getElementsByTagName(name: "sub"): NodeListOf; - getElementsByTagName(name: "sup"): NodeListOf; - getElementsByTagName(name: "svg"): NodeListOf; - getElementsByTagName(name: "switch"): NodeListOf; - getElementsByTagName(name: "symbol"): NodeListOf; - getElementsByTagName(name: "table"): NodeListOf; - getElementsByTagName(name: "tbody"): NodeListOf; - getElementsByTagName(name: "td"): NodeListOf; - getElementsByTagName(name: "text"): NodeListOf; - getElementsByTagName(name: "textpath"): NodeListOf; - getElementsByTagName(name: "textarea"): NodeListOf; - getElementsByTagName(name: "tfoot"): NodeListOf; - getElementsByTagName(name: "th"): NodeListOf; - getElementsByTagName(name: "thead"): NodeListOf; - getElementsByTagName(name: "title"): NodeListOf; - getElementsByTagName(name: "tr"): NodeListOf; - getElementsByTagName(name: "track"): NodeListOf; - getElementsByTagName(name: "tspan"): NodeListOf; - getElementsByTagName(name: "tt"): NodeListOf; - getElementsByTagName(name: "u"): NodeListOf; - getElementsByTagName(name: "ul"): NodeListOf; - getElementsByTagName(name: "use"): NodeListOf; - getElementsByTagName(name: "var"): NodeListOf; - getElementsByTagName(name: "video"): NodeListOf; - getElementsByTagName(name: "view"): NodeListOf; - getElementsByTagName(name: "wbr"): NodeListOf; - getElementsByTagName(name: "x-ms-webview"): NodeListOf; - getElementsByTagName(name: "xmp"): NodeListOf; - getElementsByTagName(name: string): NodeListOf; - getElementsByTagNameNS(namespaceURI: string, localName: string): NodeListOf; - hasAttribute(name: string): boolean; - hasAttributeNS(namespaceURI: string, localName: string): boolean; - msGetRegionContent(): MSRangeCollection; - msGetUntransformedBounds(): ClientRect; - msMatchesSelector(selectors: string): boolean; - msReleasePointerCapture(pointerId: number): void; - msSetPointerCapture(pointerId: number): void; - msZoomTo(args: MsZoomToOptions): void; - releasePointerCapture(pointerId: number): void; - removeAttribute(name?: string): void; - removeAttributeNS(namespaceURI: string, localName: string): void; - removeAttributeNode(oldAttr: Attr): Attr; - requestFullscreen(): void; - requestPointerLock(): void; - setAttribute(name: string, value: string): void; - setAttributeNS(namespaceURI: string, qualifiedName: string, value: string): void; - setAttributeNode(newAttr: Attr): Attr; - setAttributeNodeNS(newAttr: Attr): Attr; - setPointerCapture(pointerId: number): void; - webkitMatchesSelector(selectors: string): boolean; - webkitRequestFullScreen(): void; - webkitRequestFullscreen(): void; - getElementsByClassName(classNames: string): NodeListOf; - matches(selector: string): boolean; - getElementsByTagName(tagname: "picture"): NodeListOf; - addEventListener(type: "MSGestureChange", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureDoubleTap", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureEnd", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureHold", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureStart", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureTap", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGotPointerCapture", listener: (ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSInertiaStart", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSLostPointerCapture", listener: (ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerCancel", listener: (ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerDown", listener: (ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerEnter", listener: (ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerLeave", listener: (ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerMove", listener: (ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerOut", listener: (ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerOver", listener: (ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerUp", listener: (ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "ariarequest", listener: (ev: AriaRequestEvent) => any, useCapture?: boolean): void; - addEventListener(type: "command", listener: (ev: CommandEvent) => any, useCapture?: boolean): void; - addEventListener(type: "gotpointercapture", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "lostpointercapture", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointercancel", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerdown", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerenter", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerleave", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointermove", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerout", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerover", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerup", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchcancel", listener: (ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchend", listener: (ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchmove", listener: (ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchstart", listener: (ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "webkitfullscreenchange", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "webkitfullscreenerror", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "wheel", listener: (ev: WheelEvent) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var Element: { - prototype: Element; - new(): Element; -} - -interface ErrorEvent extends Event { - colno: number; - error: any; - filename: string; - lineno: number; - message: string; - initErrorEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, messageArg: string, filenameArg: string, linenoArg: number): void; -} - -declare var ErrorEvent: { - prototype: ErrorEvent; - new(): ErrorEvent; -} - -interface Event { - bubbles: boolean; - cancelBubble: boolean; - cancelable: boolean; - currentTarget: EventTarget; - defaultPrevented: boolean; - eventPhase: number; - isTrusted: boolean; - returnValue: boolean; - srcElement: Element; - target: EventTarget; - timeStamp: number; - type: string; - initEvent(eventTypeArg: string, canBubbleArg: boolean, cancelableArg: boolean): void; - preventDefault(): void; - stopImmediatePropagation(): void; - stopPropagation(): void; - AT_TARGET: number; - BUBBLING_PHASE: number; - CAPTURING_PHASE: number; -} - -declare var Event: { - prototype: Event; - new(type: string, eventInitDict?: EventInit): Event; - AT_TARGET: number; - BUBBLING_PHASE: number; - CAPTURING_PHASE: number; -} - -interface EventTarget { - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; - dispatchEvent(evt: Event): boolean; - removeEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var EventTarget: { - prototype: EventTarget; - new(): EventTarget; -} - -interface External { -} - -declare var External: { - prototype: External; - new(): External; -} - -interface File extends Blob { - lastModifiedDate: any; - name: string; -} - -declare var File: { - prototype: File; - new (parts: (ArrayBuffer | ArrayBufferView | Blob | string)[], filename: string, properties?: FilePropertyBag): File; -} - -interface FileList { - length: number; - item(index: number): File; - [index: number]: File; -} - -declare var FileList: { - prototype: FileList; - new(): FileList; -} - -interface FileReader extends EventTarget, MSBaseReader { - error: DOMError; - readAsArrayBuffer(blob: Blob): void; - readAsBinaryString(blob: Blob): void; - readAsDataURL(blob: Blob): void; - readAsText(blob: Blob, encoding?: string): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var FileReader: { - prototype: FileReader; - new(): FileReader; -} - -interface FocusEvent extends UIEvent { - relatedTarget: EventTarget; - initFocusEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, relatedTargetArg: EventTarget): void; -} - -declare var FocusEvent: { - prototype: FocusEvent; - new(typeArg: string, eventInitDict?: FocusEventInit): FocusEvent; -} - -interface FormData { - append(name: any, value: any, blobName?: string): void; -} - -declare var FormData: { - prototype: FormData; - new (form?: HTMLFormElement): FormData; -} - -interface GainNode extends AudioNode { - gain: AudioParam; -} - -declare var GainNode: { - prototype: GainNode; - new(): GainNode; -} - -interface Gamepad { - axes: number[]; - buttons: GamepadButton[]; - connected: boolean; - id: string; - index: number; - mapping: string; - timestamp: number; -} - -declare var Gamepad: { - prototype: Gamepad; - new(): Gamepad; -} - -interface GamepadButton { - pressed: boolean; - value: number; -} - -declare var GamepadButton: { - prototype: GamepadButton; - new(): GamepadButton; -} - -interface GamepadEvent extends Event { - gamepad: Gamepad; -} - -declare var GamepadEvent: { - prototype: GamepadEvent; - new(): GamepadEvent; -} - -interface Geolocation { - clearWatch(watchId: number): void; - getCurrentPosition(successCallback: PositionCallback, errorCallback?: PositionErrorCallback, options?: PositionOptions): void; - watchPosition(successCallback: PositionCallback, errorCallback?: PositionErrorCallback, options?: PositionOptions): number; -} - -declare var Geolocation: { - prototype: Geolocation; - new(): Geolocation; -} - -interface HTMLAllCollection extends HTMLCollection { - namedItem(name: string): Element; -} - -declare var HTMLAllCollection: { - prototype: HTMLAllCollection; - new(): HTMLAllCollection; -} - -interface HTMLAnchorElement extends HTMLElement { - Methods: string; - /** - * Sets or retrieves the character set used to encode the object. - */ - charset: string; - /** - * Sets or retrieves the coordinates of the object. - */ - coords: string; - /** - * Contains the anchor portion of the URL including the hash sign (#). - */ - hash: string; - /** - * Contains the hostname and port values of the URL. - */ - host: string; - /** - * Contains the hostname of a URL. - */ - hostname: string; - /** - * Sets or retrieves a destination URL or an anchor point. - */ - href: string; - /** - * Sets or retrieves the language code of the object. - */ - hreflang: string; - mimeType: string; - /** - * Sets or retrieves the shape of the object. - */ - name: string; - nameProp: string; - /** - * Contains the pathname of the URL. - */ - pathname: string; - /** - * Sets or retrieves the port number associated with a URL. - */ - port: string; - /** - * Contains the protocol of the URL. - */ - protocol: string; - protocolLong: string; - /** - * Sets or retrieves the relationship between the object and the destination of the link. - */ - rel: string; - /** - * Sets or retrieves the relationship between the object and the destination of the link. - */ - rev: string; - /** - * Sets or retrieves the substring of the href property that follows the question mark. - */ - search: string; - /** - * Sets or retrieves the shape of the object. - */ - shape: string; - /** - * Sets or retrieves the window or frame at which to target content. - */ - target: string; - /** - * Retrieves or sets the text of the object as a string. - */ - text: string; - type: string; - urn: string; - /** - * Returns a string representation of an object. - */ - toString(): string; -} - -declare var HTMLAnchorElement: { - prototype: HTMLAnchorElement; - new(): HTMLAnchorElement; -} - -interface HTMLAppletElement extends HTMLElement { - /** - * 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. - */ - BaseHref: string; - align: string; - /** - * Sets or retrieves a text alternative to the graphic. - */ - alt: string; - /** - * Gets or sets the optional alternative HTML script to execute if the object fails to load. - */ - altHtml: string; - /** - * Sets or retrieves a character string that can be used to implement your own archive functionality for the object. - */ - archive: string; - border: string; - code: string; - /** - * Sets or retrieves the URL of the component. - */ - codeBase: string; - /** - * Sets or retrieves the Internet media type for the code associated with the object. - */ - codeType: string; - /** - * Address of a pointer to the document this page or frame contains. If there is no document, then null will be returned. - */ - contentDocument: Document; - /** - * Sets or retrieves the URL that references the data of the object. - */ - data: string; - /** - * Sets or retrieves a character string that can be used to implement your own declare functionality for the object. - */ - declare: boolean; - form: HTMLFormElement; - /** - * Sets or retrieves the height of the object. - */ - height: string; - hspace: number; - /** - * Sets or retrieves the shape of the object. - */ - name: string; - object: string; - /** - * Sets or retrieves a message to be displayed while an object is loading. - */ - standby: string; - /** - * Returns the content type of the object. - */ - type: string; - /** - * Sets or retrieves the URL, often with a bookmark extension (#name), to use as a client-side image map. - */ - useMap: string; - vspace: number; - width: number; -} - -declare var HTMLAppletElement: { - prototype: HTMLAppletElement; - new(): HTMLAppletElement; -} - -interface HTMLAreaElement extends HTMLElement { - /** - * Sets or retrieves a text alternative to the graphic. - */ - alt: string; - /** - * Sets or retrieves the coordinates of the object. - */ - coords: string; - /** - * Sets or retrieves the subsection of the href property that follows the number sign (#). - */ - hash: string; - /** - * Sets or retrieves the hostname and port number of the location or URL. - */ - host: string; - /** - * Sets or retrieves the host name part of the location or URL. - */ - hostname: string; - /** - * Sets or retrieves a destination URL or an anchor point. - */ - href: string; - /** - * Sets or gets whether clicks in this region cause action. - */ - noHref: boolean; - /** - * Sets or retrieves the file name or path specified by the object. - */ - pathname: string; - /** - * Sets or retrieves the port number associated with a URL. - */ - port: string; - /** - * Sets or retrieves the protocol portion of a URL. - */ - protocol: string; - rel: string; - /** - * Sets or retrieves the substring of the href property that follows the question mark. - */ - search: string; - /** - * Sets or retrieves the shape of the object. - */ - shape: string; - /** - * Sets or retrieves the window or frame at which to target content. - */ - target: string; - /** - * Returns a string representation of an object. - */ - toString(): string; -} - -declare var HTMLAreaElement: { - prototype: HTMLAreaElement; - new(): HTMLAreaElement; -} - -interface HTMLAreasCollection extends HTMLCollection { - /** - * Adds an element to the areas, controlRange, or options collection. - */ - add(element: HTMLElement, before?: HTMLElement | number): void; - /** - * Removes an element from the collection. - */ - remove(index?: number): void; -} - -declare var HTMLAreasCollection: { - prototype: HTMLAreasCollection; - new(): HTMLAreasCollection; -} - -interface HTMLAudioElement extends HTMLMediaElement { -} - -declare var HTMLAudioElement: { - prototype: HTMLAudioElement; - new(): HTMLAudioElement; -} - -interface HTMLBRElement extends HTMLElement { - /** - * Sets or retrieves the side on which floating objects are not to be positioned when any IHTMLBlockElement is inserted into the document. - */ - clear: string; -} - -declare var HTMLBRElement: { - prototype: HTMLBRElement; - new(): HTMLBRElement; -} - -interface HTMLBaseElement extends HTMLElement { - /** - * Gets or sets the baseline URL on which relative links are based. - */ - href: string; - /** - * Sets or retrieves the window or frame at which to target content. - */ - target: string; -} - -declare var HTMLBaseElement: { - prototype: HTMLBaseElement; - new(): HTMLBaseElement; -} - -interface HTMLBaseFontElement extends HTMLElement, DOML2DeprecatedColorProperty { - /** - * Sets or retrieves the current typeface family. - */ - face: string; - /** - * Sets or retrieves the font size of the object. - */ - size: number; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLBaseFontElement: { - prototype: HTMLBaseFontElement; - new(): HTMLBaseFontElement; -} - -interface HTMLBlockElement extends HTMLElement { - /** - * Sets or retrieves reference information about the object. - */ - cite: string; - clear: string; - /** - * Sets or retrieves the width of the object. - */ - width: number; -} - -declare var HTMLBlockElement: { - prototype: HTMLBlockElement; - new(): HTMLBlockElement; -} - -interface HTMLBodyElement extends HTMLElement { - aLink: any; - background: string; - bgColor: any; - bgProperties: string; - link: any; - noWrap: boolean; - onafterprint: (ev: Event) => any; - onbeforeprint: (ev: Event) => any; - onbeforeunload: (ev: BeforeUnloadEvent) => any; - onblur: (ev: FocusEvent) => any; - onerror: (ev: Event) => any; - onfocus: (ev: FocusEvent) => any; - onhashchange: (ev: HashChangeEvent) => any; - onload: (ev: Event) => any; - onmessage: (ev: MessageEvent) => any; - onoffline: (ev: Event) => any; - ononline: (ev: Event) => any; - onorientationchange: (ev: Event) => any; - onpagehide: (ev: PageTransitionEvent) => any; - onpageshow: (ev: PageTransitionEvent) => any; - onpopstate: (ev: PopStateEvent) => any; - onresize: (ev: UIEvent) => any; - onstorage: (ev: StorageEvent) => any; - onunload: (ev: Event) => any; - text: any; - vLink: any; - createTextRange(): TextRange; - addEventListener(type: "MSContentZoom", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureChange", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureDoubleTap", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureEnd", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureHold", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureStart", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureTap", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGotPointerCapture", listener: (ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSInertiaStart", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSLostPointerCapture", listener: (ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSManipulationStateChanged", listener: (ev: MSManipulationEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerCancel", listener: (ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerDown", listener: (ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerEnter", listener: (ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerLeave", listener: (ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerMove", listener: (ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerOut", listener: (ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerOver", listener: (ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerUp", listener: (ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "abort", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "activate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "afterprint", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "ariarequest", listener: (ev: AriaRequestEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforeactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecopy", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecut", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforedeactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforepaste", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforeprint", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "beforeunload", listener: (ev: BeforeUnloadEvent) => any, useCapture?: boolean): void; - addEventListener(type: "blur", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "blur", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "canplay", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "canplaythrough", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "change", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "click", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "command", listener: (ev: CommandEvent) => any, useCapture?: boolean): void; - addEventListener(type: "contextmenu", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "copy", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "cuechange", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "cut", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dblclick", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "deactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "drag", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragend", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragenter", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragleave", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragover", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragstart", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "drop", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "durationchange", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "emptied", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "ended", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "focus", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "focus", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "gotpointercapture", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "hashchange", listener: (ev: HashChangeEvent) => any, useCapture?: boolean): void; - addEventListener(type: "input", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "keydown", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "keypress", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "keyup", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "load", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "load", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadeddata", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadedmetadata", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadstart", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "lostpointercapture", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "message", listener: (ev: MessageEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousedown", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseenter", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseleave", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousemove", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseout", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseover", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseup", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousewheel", listener: (ev: MouseWheelEvent) => any, useCapture?: boolean): void; - addEventListener(type: "offline", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "online", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "orientationchange", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "pagehide", listener: (ev: PageTransitionEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pageshow", listener: (ev: PageTransitionEvent) => any, useCapture?: boolean): void; - addEventListener(type: "paste", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pause", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "play", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "playing", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "pointercancel", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerdown", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerenter", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerleave", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointermove", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerout", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerover", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerup", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "popstate", listener: (ev: PopStateEvent) => any, useCapture?: boolean): void; - addEventListener(type: "progress", listener: (ev: ProgressEvent) => any, useCapture?: boolean): void; - addEventListener(type: "ratechange", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "reset", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "resize", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "scroll", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "seeked", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "seeking", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "select", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "selectstart", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "stalled", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "storage", listener: (ev: StorageEvent) => any, useCapture?: boolean): void; - addEventListener(type: "submit", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "suspend", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "timeupdate", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "touchcancel", listener: (ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchend", listener: (ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchmove", listener: (ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchstart", listener: (ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "unload", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "volumechange", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "waiting", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "webkitfullscreenchange", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "webkitfullscreenerror", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "wheel", listener: (ev: WheelEvent) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLBodyElement: { - prototype: HTMLBodyElement; - new(): HTMLBodyElement; -} - -interface HTMLButtonElement extends HTMLElement { - /** - * 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. - */ - autofocus: boolean; - disabled: boolean; - /** - * Retrieves a reference to the form that the object is embedded in. - */ - form: HTMLFormElement; - /** - * Overrides the action attribute (where the data on a form is sent) on the parent form element. - */ - formAction: string; - /** - * Used to override the encoding (formEnctype attribute) specified on the form element. - */ - formEnctype: string; - /** - * Overrides the submit method attribute previously specified on a form element. - */ - formMethod: string; - /** - * 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. - */ - formNoValidate: string; - /** - * Overrides the target attribute on a form element. - */ - formTarget: string; - /** - * Sets or retrieves the name of the object. - */ - name: string; - status: any; - /** - * Gets the classification and default behavior of the button. - */ - type: string; - /** - * 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. - */ - validationMessage: string; - /** - * Returns a ValidityState object that represents the validity states of an element. - */ - validity: ValidityState; - /** - * Sets or retrieves the default or selected value of the control. - */ - value: string; - /** - * Returns whether an element will successfully validate based on forms validation rules and constraints. - */ - willValidate: boolean; - /** - * Returns whether a form will validate when it is submitted, without having to submit it. - */ - checkValidity(): boolean; - /** - * Creates a TextRange object for the element. - */ - createTextRange(): TextRange; - /** - * Sets a custom error message that is displayed when a form is submitted. - * @param error Sets a custom error message that is displayed when a form is submitted. - */ - setCustomValidity(error: string): void; -} - -declare var HTMLButtonElement: { - prototype: HTMLButtonElement; - new(): HTMLButtonElement; -} - -interface HTMLCanvasElement extends HTMLElement { - /** - * Gets or sets the height of a canvas element on a document. - */ - height: number; - /** - * Gets or sets the width of a canvas element on a document. - */ - width: number; - /** - * 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. - * @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"); - */ - getContext(contextId: "2d"): CanvasRenderingContext2D; - getContext(contextId: "experimental-webgl"): WebGLRenderingContext; - getContext(contextId: string, ...args: any[]): CanvasRenderingContext2D | WebGLRenderingContext; - /** - * Returns a blob object encoded as a Portable Network Graphics (PNG) format from a canvas image or drawing. - */ - msToBlob(): Blob; - /** - * Returns the content of the current canvas as an image that you can use as a source for another canvas or an HTML element. - * @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. - */ - toDataURL(type?: string, ...args: any[]): string; - toBlob(): Blob; -} - -declare var HTMLCanvasElement: { - prototype: HTMLCanvasElement; - new(): HTMLCanvasElement; -} - -interface HTMLCollection { - /** - * Sets or retrieves the number of objects in a collection. - */ - length: number; - /** - * Retrieves an object from various collections. - */ - item(nameOrIndex?: any, optionalIndex?: any): Element; - /** - * Retrieves a select object or an object from an options collection. - */ - namedItem(name: string): Element; - [index: number]: Element; -} - -declare var HTMLCollection: { - prototype: HTMLCollection; - new(): HTMLCollection; -} - -interface HTMLDDElement extends HTMLElement { - /** - * Sets or retrieves whether the browser automatically performs wordwrap. - */ - noWrap: boolean; -} - -declare var HTMLDDElement: { - prototype: HTMLDDElement; - new(): HTMLDDElement; -} - -interface HTMLDListElement extends HTMLElement { - compact: boolean; -} - -declare var HTMLDListElement: { - prototype: HTMLDListElement; - new(): HTMLDListElement; -} - -interface HTMLDTElement extends HTMLElement { - /** - * Sets or retrieves whether the browser automatically performs wordwrap. - */ - noWrap: boolean; -} - -declare var HTMLDTElement: { - prototype: HTMLDTElement; - new(): HTMLDTElement; -} - -interface HTMLDataListElement extends HTMLElement { - options: HTMLCollection; -} - -declare var HTMLDataListElement: { - prototype: HTMLDataListElement; - new(): HTMLDataListElement; -} - -interface HTMLDirectoryElement extends HTMLElement { - compact: boolean; -} - -declare var HTMLDirectoryElement: { - prototype: HTMLDirectoryElement; - new(): HTMLDirectoryElement; -} - -interface HTMLDivElement extends HTMLElement { - /** - * Sets or retrieves how the object is aligned with adjacent text. - */ - align: string; - /** - * Sets or retrieves whether the browser automatically performs wordwrap. - */ - noWrap: boolean; -} - -declare var HTMLDivElement: { - prototype: HTMLDivElement; - new(): HTMLDivElement; -} - -interface HTMLDocument extends Document { -} - -declare var HTMLDocument: { - prototype: HTMLDocument; - new(): HTMLDocument; -} - -interface HTMLElement extends Element { - accessKey: string; - children: HTMLCollection; - contentEditable: string; - dataset: DOMStringMap; - dir: string; - draggable: boolean; - hidden: boolean; - hideFocus: boolean; - innerHTML: string; - innerText: string; - isContentEditable: boolean; - lang: string; - offsetHeight: number; - offsetLeft: number; - offsetParent: Element; - offsetTop: number; - offsetWidth: number; - onabort: (ev: Event) => any; - onactivate: (ev: UIEvent) => any; - onbeforeactivate: (ev: UIEvent) => any; - onbeforecopy: (ev: DragEvent) => any; - onbeforecut: (ev: DragEvent) => any; - onbeforedeactivate: (ev: UIEvent) => any; - onbeforepaste: (ev: DragEvent) => any; - onblur: (ev: FocusEvent) => any; - oncanplay: (ev: Event) => any; - oncanplaythrough: (ev: Event) => any; - onchange: (ev: Event) => any; - onclick: (ev: MouseEvent) => any; - oncontextmenu: (ev: PointerEvent) => any; - oncopy: (ev: DragEvent) => any; - oncuechange: (ev: Event) => any; - oncut: (ev: DragEvent) => any; - ondblclick: (ev: MouseEvent) => any; - ondeactivate: (ev: UIEvent) => any; - ondrag: (ev: DragEvent) => any; - ondragend: (ev: DragEvent) => any; - ondragenter: (ev: DragEvent) => any; - ondragleave: (ev: DragEvent) => any; - ondragover: (ev: DragEvent) => any; - ondragstart: (ev: DragEvent) => any; - ondrop: (ev: DragEvent) => any; - ondurationchange: (ev: Event) => any; - onemptied: (ev: Event) => any; - onended: (ev: Event) => any; - onerror: (ev: Event) => any; - onfocus: (ev: FocusEvent) => any; - oninput: (ev: Event) => any; - onkeydown: (ev: KeyboardEvent) => any; - onkeypress: (ev: KeyboardEvent) => any; - onkeyup: (ev: KeyboardEvent) => any; - onload: (ev: Event) => any; - onloadeddata: (ev: Event) => any; - onloadedmetadata: (ev: Event) => any; - onloadstart: (ev: Event) => any; - onmousedown: (ev: MouseEvent) => any; - onmouseenter: (ev: MouseEvent) => any; - onmouseleave: (ev: MouseEvent) => any; - onmousemove: (ev: MouseEvent) => any; - onmouseout: (ev: MouseEvent) => any; - onmouseover: (ev: MouseEvent) => any; - onmouseup: (ev: MouseEvent) => any; - onmousewheel: (ev: MouseWheelEvent) => any; - onmscontentzoom: (ev: UIEvent) => any; - onmsmanipulationstatechanged: (ev: MSManipulationEvent) => any; - onpaste: (ev: DragEvent) => any; - onpause: (ev: Event) => any; - onplay: (ev: Event) => any; - onplaying: (ev: Event) => any; - onprogress: (ev: ProgressEvent) => any; - onratechange: (ev: Event) => any; - onreset: (ev: Event) => any; - onscroll: (ev: UIEvent) => any; - onseeked: (ev: Event) => any; - onseeking: (ev: Event) => any; - onselect: (ev: UIEvent) => any; - onselectstart: (ev: Event) => any; - onstalled: (ev: Event) => any; - onsubmit: (ev: Event) => any; - onsuspend: (ev: Event) => any; - ontimeupdate: (ev: Event) => any; - onvolumechange: (ev: Event) => any; - onwaiting: (ev: Event) => any; - outerHTML: string; - outerText: string; - spellcheck: boolean; - style: CSSStyleDeclaration; - tabIndex: number; - title: string; - blur(): void; - click(): void; - dragDrop(): boolean; - focus(): void; - insertAdjacentElement(position: string, insertedElement: Element): Element; - insertAdjacentHTML(where: string, html: string): void; - insertAdjacentText(where: string, text: string): void; - msGetInputContext(): MSInputMethodContext; - scrollIntoView(top?: boolean): void; - setActive(): void; - addEventListener(type: "MSContentZoom", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureChange", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureDoubleTap", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureEnd", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureHold", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureStart", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureTap", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGotPointerCapture", listener: (ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSInertiaStart", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSLostPointerCapture", listener: (ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSManipulationStateChanged", listener: (ev: MSManipulationEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerCancel", listener: (ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerDown", listener: (ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerEnter", listener: (ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerLeave", listener: (ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerMove", listener: (ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerOut", listener: (ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerOver", listener: (ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerUp", listener: (ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "abort", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "activate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "ariarequest", listener: (ev: AriaRequestEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforeactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecopy", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecut", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforedeactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforepaste", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "blur", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "canplay", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "canplaythrough", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "change", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "click", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "command", listener: (ev: CommandEvent) => any, useCapture?: boolean): void; - addEventListener(type: "contextmenu", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "copy", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "cuechange", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "cut", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dblclick", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "deactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "drag", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragend", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragenter", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragleave", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragover", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragstart", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "drop", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "durationchange", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "emptied", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "ended", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "focus", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "gotpointercapture", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "input", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "keydown", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "keypress", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "keyup", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "load", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadeddata", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadedmetadata", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadstart", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "lostpointercapture", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousedown", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseenter", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseleave", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousemove", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseout", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseover", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseup", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousewheel", listener: (ev: MouseWheelEvent) => any, useCapture?: boolean): void; - addEventListener(type: "paste", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pause", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "play", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "playing", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "pointercancel", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerdown", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerenter", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerleave", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointermove", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerout", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerover", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerup", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "progress", listener: (ev: ProgressEvent) => any, useCapture?: boolean): void; - addEventListener(type: "ratechange", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "reset", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "scroll", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "seeked", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "seeking", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "select", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "selectstart", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "stalled", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "submit", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "suspend", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "timeupdate", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "touchcancel", listener: (ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchend", listener: (ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchmove", listener: (ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchstart", listener: (ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "volumechange", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "waiting", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "webkitfullscreenchange", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "webkitfullscreenerror", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "wheel", listener: (ev: WheelEvent) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLElement: { - prototype: HTMLElement; - new(): HTMLElement; -} - -interface HTMLEmbedElement extends HTMLElement, GetSVGDocument { - /** - * Sets or retrieves the height of the object. - */ - height: string; - hidden: any; - /** - * Gets or sets whether the DLNA PlayTo device is available. - */ - msPlayToDisabled: boolean; - /** - * 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. - */ - msPlayToPreferredSourceUri: string; - /** - * Gets or sets the primary DLNA PlayTo device. - */ - msPlayToPrimary: boolean; - /** - * Gets the source associated with the media element for use by the PlayToManager. - */ - msPlayToSource: any; - /** - * Sets or retrieves the name of the object. - */ - name: string; - /** - * Retrieves the palette used for the embedded document. - */ - palette: string; - /** - * Retrieves the URL of the plug-in used to view an embedded document. - */ - pluginspage: string; - readyState: string; - /** - * Sets or retrieves a URL to be loaded by the object. - */ - src: string; - /** - * Sets or retrieves the height and width units of the embed object. - */ - units: string; - /** - * Sets or retrieves the width of the object. - */ - width: string; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLEmbedElement: { - prototype: HTMLEmbedElement; - new(): HTMLEmbedElement; -} - -interface HTMLFieldSetElement extends HTMLElement { - /** - * Sets or retrieves how the object is aligned with adjacent text. - */ - align: string; - disabled: boolean; - /** - * Retrieves a reference to the form that the object is embedded in. - */ - form: HTMLFormElement; - /** - * 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. - */ - validationMessage: string; - /** - * Returns a ValidityState object that represents the validity states of an element. - */ - validity: ValidityState; - /** - * Returns whether an element will successfully validate based on forms validation rules and constraints. - */ - willValidate: boolean; - /** - * Returns whether a form will validate when it is submitted, without having to submit it. - */ - checkValidity(): boolean; - /** - * Sets a custom error message that is displayed when a form is submitted. - * @param error Sets a custom error message that is displayed when a form is submitted. - */ - setCustomValidity(error: string): void; -} - -declare var HTMLFieldSetElement: { - prototype: HTMLFieldSetElement; - new(): HTMLFieldSetElement; -} - -interface HTMLFontElement extends HTMLElement, DOML2DeprecatedColorProperty, DOML2DeprecatedSizeProperty { - /** - * Sets or retrieves the current typeface family. - */ - face: string; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLFontElement: { - prototype: HTMLFontElement; - new(): HTMLFontElement; -} - -interface HTMLFormElement extends HTMLElement { - /** - * Sets or retrieves a list of character encodings for input data that must be accepted by the server processing the form. - */ - acceptCharset: string; - /** - * Sets or retrieves the URL to which the form content is sent for processing. - */ - action: string; - /** - * Specifies whether autocomplete is applied to an editable text field. - */ - autocomplete: string; - /** - * Retrieves a collection, in source order, of all controls in a given form. - */ - elements: HTMLCollection; - /** - * Sets or retrieves the MIME encoding for the form. - */ - encoding: string; - /** - * Sets or retrieves the encoding type for the form. - */ - enctype: string; - /** - * Sets or retrieves the number of objects in a collection. - */ - length: number; - /** - * Sets or retrieves how to send the form data to the server. - */ - method: string; - /** - * Sets or retrieves the name of the object. - */ - name: string; - /** - * Designates a form that is not validated when submitted. - */ - noValidate: boolean; - /** - * Sets or retrieves the window or frame at which to target content. - */ - target: string; - /** - * Returns whether a form will validate when it is submitted, without having to submit it. - */ - checkValidity(): boolean; - /** - * Retrieves a form object or an object from an elements collection. - * @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. - * @param index Variant of type Number that specifies the zero-based index of the object to retrieve when a collection is returned. - */ - item(name?: any, index?: any): any; - /** - * Retrieves a form object or an object from an elements collection. - */ - namedItem(name: string): any; - /** - * Fires when the user resets a form. - */ - reset(): void; - /** - * Fires when a FORM is about to be submitted. - */ - submit(): void; - [name: string]: any; -} - -declare var HTMLFormElement: { - prototype: HTMLFormElement; - new(): HTMLFormElement; -} - -interface HTMLFrameElement extends HTMLElement, GetSVGDocument { - /** - * Specifies the properties of a border drawn around an object. - */ - border: string; - /** - * Sets or retrieves the border color of the object. - */ - borderColor: any; - /** - * Retrieves the document object of the page or frame. - */ - contentDocument: Document; - /** - * Retrieves the object of the specified. - */ - contentWindow: Window; - /** - * Sets or retrieves whether to display a border for the frame. - */ - frameBorder: string; - /** - * Sets or retrieves the amount of additional space between the frames. - */ - frameSpacing: any; - /** - * Sets or retrieves the height of the object. - */ - height: string | number; - /** - * Sets or retrieves a URI to a long description of the object. - */ - longDesc: string; - /** - * Sets or retrieves the top and bottom margin heights before displaying the text in a frame. - */ - marginHeight: string; - /** - * Sets or retrieves the left and right margin widths before displaying the text in a frame. - */ - marginWidth: string; - /** - * Sets or retrieves the frame name. - */ - name: string; - /** - * Sets or retrieves whether the user can resize the frame. - */ - noResize: boolean; - /** - * Raised when the object has been completely received from the server. - */ - onload: (ev: Event) => any; - /** - * Sets or retrieves whether the frame can be scrolled. - */ - scrolling: string; - /** - * Sets the value indicating whether the source file of a frame or iframe has specific security restrictions applied. - */ - security: any; - /** - * Sets or retrieves a URL to be loaded by the object. - */ - src: string; - /** - * Sets or retrieves the width of the object. - */ - width: string | number; - addEventListener(type: "MSContentZoom", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureChange", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureDoubleTap", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureEnd", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureHold", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureStart", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureTap", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGotPointerCapture", listener: (ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSInertiaStart", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSLostPointerCapture", listener: (ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSManipulationStateChanged", listener: (ev: MSManipulationEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerCancel", listener: (ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerDown", listener: (ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerEnter", listener: (ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerLeave", listener: (ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerMove", listener: (ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerOut", listener: (ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerOver", listener: (ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerUp", listener: (ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "abort", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "activate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "ariarequest", listener: (ev: AriaRequestEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforeactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecopy", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecut", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforedeactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforepaste", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "blur", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "canplay", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "canplaythrough", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "change", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "click", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "command", listener: (ev: CommandEvent) => any, useCapture?: boolean): void; - addEventListener(type: "contextmenu", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "copy", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "cuechange", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "cut", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dblclick", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "deactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "drag", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragend", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragenter", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragleave", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragover", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragstart", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "drop", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "durationchange", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "emptied", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "ended", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "focus", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "gotpointercapture", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "input", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "keydown", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "keypress", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "keyup", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "load", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "load", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadeddata", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadedmetadata", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadstart", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "lostpointercapture", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousedown", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseenter", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseleave", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousemove", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseout", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseover", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseup", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousewheel", listener: (ev: MouseWheelEvent) => any, useCapture?: boolean): void; - addEventListener(type: "paste", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pause", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "play", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "playing", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "pointercancel", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerdown", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerenter", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerleave", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointermove", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerout", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerover", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerup", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "progress", listener: (ev: ProgressEvent) => any, useCapture?: boolean): void; - addEventListener(type: "ratechange", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "reset", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "scroll", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "seeked", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "seeking", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "select", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "selectstart", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "stalled", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "submit", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "suspend", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "timeupdate", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "touchcancel", listener: (ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchend", listener: (ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchmove", listener: (ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchstart", listener: (ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "volumechange", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "waiting", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "webkitfullscreenchange", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "webkitfullscreenerror", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "wheel", listener: (ev: WheelEvent) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLFrameElement: { - prototype: HTMLFrameElement; - new(): HTMLFrameElement; -} - -interface HTMLFrameSetElement extends HTMLElement { - border: string; - /** - * Sets or retrieves the border color of the object. - */ - borderColor: any; - /** - * Sets or retrieves the frame widths of the object. - */ - cols: string; - /** - * Sets or retrieves whether to display a border for the frame. - */ - frameBorder: string; - /** - * Sets or retrieves the amount of additional space between the frames. - */ - frameSpacing: any; - name: string; - onafterprint: (ev: Event) => any; - onbeforeprint: (ev: Event) => any; - onbeforeunload: (ev: BeforeUnloadEvent) => any; - /** - * Fires when the object loses the input focus. - */ - onblur: (ev: FocusEvent) => any; - onerror: (ev: Event) => any; - /** - * Fires when the object receives focus. - */ - onfocus: (ev: FocusEvent) => any; - onhashchange: (ev: HashChangeEvent) => any; - onload: (ev: Event) => any; - onmessage: (ev: MessageEvent) => any; - onoffline: (ev: Event) => any; - ononline: (ev: Event) => any; - onorientationchange: (ev: Event) => any; - onpagehide: (ev: PageTransitionEvent) => any; - onpageshow: (ev: PageTransitionEvent) => any; - onresize: (ev: UIEvent) => any; - onstorage: (ev: StorageEvent) => any; - onunload: (ev: Event) => any; - /** - * Sets or retrieves the frame heights of the object. - */ - rows: string; - addEventListener(type: "MSContentZoom", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureChange", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureDoubleTap", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureEnd", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureHold", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureStart", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureTap", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGotPointerCapture", listener: (ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSInertiaStart", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSLostPointerCapture", listener: (ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSManipulationStateChanged", listener: (ev: MSManipulationEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerCancel", listener: (ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerDown", listener: (ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerEnter", listener: (ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerLeave", listener: (ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerMove", listener: (ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerOut", listener: (ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerOver", listener: (ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerUp", listener: (ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "abort", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "activate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "ariarequest", listener: (ev: AriaRequestEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforeactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecopy", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecut", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforedeactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforepaste", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforeprint", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "beforeunload", listener: (ev: BeforeUnloadEvent) => any, useCapture?: boolean): void; - addEventListener(type: "blur", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "blur", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "canplay", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "canplaythrough", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "change", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "click", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "command", listener: (ev: CommandEvent) => any, useCapture?: boolean): void; - addEventListener(type: "contextmenu", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "copy", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "cuechange", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "cut", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dblclick", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "deactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "drag", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragend", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragenter", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragleave", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragover", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragstart", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "drop", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "durationchange", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "emptied", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "ended", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "focus", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "focus", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "gotpointercapture", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "hashchange", listener: (ev: HashChangeEvent) => any, useCapture?: boolean): void; - addEventListener(type: "input", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "keydown", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "keypress", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "keyup", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "load", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "load", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadeddata", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadedmetadata", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadstart", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "lostpointercapture", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "message", listener: (ev: MessageEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousedown", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseenter", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseleave", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousemove", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseout", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseover", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseup", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousewheel", listener: (ev: MouseWheelEvent) => any, useCapture?: boolean): void; - addEventListener(type: "offline", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "online", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "orientationchange", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "pagehide", listener: (ev: PageTransitionEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pageshow", listener: (ev: PageTransitionEvent) => any, useCapture?: boolean): void; - addEventListener(type: "paste", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pause", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "play", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "playing", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "pointercancel", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerdown", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerenter", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerleave", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointermove", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerout", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerover", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerup", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "progress", listener: (ev: ProgressEvent) => any, useCapture?: boolean): void; - addEventListener(type: "ratechange", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "reset", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "resize", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "scroll", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "seeked", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "seeking", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "select", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "selectstart", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "stalled", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "storage", listener: (ev: StorageEvent) => any, useCapture?: boolean): void; - addEventListener(type: "submit", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "suspend", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "timeupdate", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "touchcancel", listener: (ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchend", listener: (ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchmove", listener: (ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchstart", listener: (ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "unload", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "volumechange", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "waiting", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "webkitfullscreenchange", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "webkitfullscreenerror", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "wheel", listener: (ev: WheelEvent) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLFrameSetElement: { - prototype: HTMLFrameSetElement; - new(): HTMLFrameSetElement; -} - -interface HTMLHRElement extends HTMLElement, DOML2DeprecatedColorProperty, DOML2DeprecatedSizeProperty { - /** - * Sets or retrieves how the object is aligned with adjacent text. - */ - align: string; - /** - * Sets or retrieves whether the horizontal rule is drawn with 3-D shading. - */ - noShade: boolean; - /** - * Sets or retrieves the width of the object. - */ - width: number; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLHRElement: { - prototype: HTMLHRElement; - new(): HTMLHRElement; -} - -interface HTMLHeadElement extends HTMLElement { - profile: string; -} - -declare var HTMLHeadElement: { - prototype: HTMLHeadElement; - new(): HTMLHeadElement; -} - -interface HTMLHeadingElement extends HTMLElement { - /** - * Sets or retrieves a value that indicates the table alignment. - */ - align: string; - clear: string; -} - -declare var HTMLHeadingElement: { - prototype: HTMLHeadingElement; - new(): HTMLHeadingElement; -} - -interface HTMLHtmlElement extends HTMLElement { - /** - * Sets or retrieves the DTD version that governs the current document. - */ - version: string; -} - -declare var HTMLHtmlElement: { - prototype: HTMLHtmlElement; - new(): HTMLHtmlElement; -} - -interface HTMLIFrameElement extends HTMLElement, GetSVGDocument { - /** - * Sets or retrieves how the object is aligned with adjacent text. - */ - align: string; - allowFullscreen: boolean; - /** - * Specifies the properties of a border drawn around an object. - */ - border: string; - /** - * Retrieves the document object of the page or frame. - */ - contentDocument: Document; - /** - * Retrieves the object of the specified. - */ - contentWindow: Window; - /** - * Sets or retrieves whether to display a border for the frame. - */ - frameBorder: string; - /** - * Sets or retrieves the amount of additional space between the frames. - */ - frameSpacing: any; - /** - * Sets or retrieves the height of the object. - */ - height: string; - /** - * Sets or retrieves the horizontal margin for the object. - */ - hspace: number; - /** - * Sets or retrieves a URI to a long description of the object. - */ - longDesc: string; - /** - * Sets or retrieves the top and bottom margin heights before displaying the text in a frame. - */ - marginHeight: string; - /** - * Sets or retrieves the left and right margin widths before displaying the text in a frame. - */ - marginWidth: string; - /** - * Sets or retrieves the frame name. - */ - name: string; - /** - * Sets or retrieves whether the user can resize the frame. - */ - noResize: boolean; - /** - * Raised when the object has been completely received from the server. - */ - onload: (ev: Event) => any; - sandbox: DOMSettableTokenList; - /** - * Sets or retrieves whether the frame can be scrolled. - */ - scrolling: string; - /** - * Sets the value indicating whether the source file of a frame or iframe has specific security restrictions applied. - */ - security: any; - /** - * Sets or retrieves a URL to be loaded by the object. - */ - src: string; - /** - * Sets or retrieves the vertical margin for the object. - */ - vspace: number; - /** - * Sets or retrieves the width of the object. - */ - width: string; - addEventListener(type: "MSContentZoom", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureChange", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureDoubleTap", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureEnd", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureHold", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureStart", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureTap", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGotPointerCapture", listener: (ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSInertiaStart", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSLostPointerCapture", listener: (ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSManipulationStateChanged", listener: (ev: MSManipulationEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerCancel", listener: (ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerDown", listener: (ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerEnter", listener: (ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerLeave", listener: (ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerMove", listener: (ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerOut", listener: (ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerOver", listener: (ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerUp", listener: (ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "abort", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "activate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "ariarequest", listener: (ev: AriaRequestEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforeactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecopy", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecut", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforedeactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforepaste", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "blur", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "canplay", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "canplaythrough", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "change", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "click", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "command", listener: (ev: CommandEvent) => any, useCapture?: boolean): void; - addEventListener(type: "contextmenu", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "copy", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "cuechange", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "cut", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dblclick", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "deactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "drag", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragend", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragenter", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragleave", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragover", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragstart", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "drop", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "durationchange", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "emptied", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "ended", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "focus", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "gotpointercapture", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "input", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "keydown", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "keypress", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "keyup", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "load", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "load", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadeddata", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadedmetadata", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadstart", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "lostpointercapture", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousedown", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseenter", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseleave", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousemove", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseout", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseover", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseup", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousewheel", listener: (ev: MouseWheelEvent) => any, useCapture?: boolean): void; - addEventListener(type: "paste", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pause", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "play", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "playing", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "pointercancel", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerdown", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerenter", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerleave", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointermove", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerout", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerover", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerup", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "progress", listener: (ev: ProgressEvent) => any, useCapture?: boolean): void; - addEventListener(type: "ratechange", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "reset", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "scroll", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "seeked", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "seeking", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "select", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "selectstart", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "stalled", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "submit", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "suspend", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "timeupdate", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "touchcancel", listener: (ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchend", listener: (ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchmove", listener: (ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchstart", listener: (ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "volumechange", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "waiting", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "webkitfullscreenchange", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "webkitfullscreenerror", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "wheel", listener: (ev: WheelEvent) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLIFrameElement: { - prototype: HTMLIFrameElement; - new(): HTMLIFrameElement; -} - -interface HTMLImageElement extends HTMLElement { - /** - * Sets or retrieves how the object is aligned with adjacent text. - */ - align: string; - /** - * Sets or retrieves a text alternative to the graphic. - */ - alt: string; - /** - * Specifies the properties of a border drawn around an object. - */ - border: string; - /** - * Retrieves whether the object is fully loaded. - */ - complete: boolean; - crossOrigin: string; - currentSrc: string; - /** - * Sets or retrieves the height of the object. - */ - height: number; - /** - * Sets or retrieves the width of the border to draw around the object. - */ - hspace: number; - /** - * Sets or retrieves whether the image is a server-side image map. - */ - isMap: boolean; - /** - * Sets or retrieves a Uniform Resource Identifier (URI) to a long description of the object. - */ - longDesc: string; - /** - * Gets or sets whether the DLNA PlayTo device is available. - */ - msPlayToDisabled: boolean; - msPlayToPreferredSourceUri: string; - /** - * Gets or sets the primary DLNA PlayTo device. - */ - msPlayToPrimary: boolean; - /** - * Gets the source associated with the media element for use by the PlayToManager. - */ - msPlayToSource: any; - /** - * Sets or retrieves the name of the object. - */ - name: string; - /** - * The original height of the image resource before sizing. - */ - naturalHeight: number; - /** - * The original width of the image resource before sizing. - */ - naturalWidth: number; - /** - * The address or URL of the a media resource that is to be considered. - */ - src: string; - srcset: string; - /** - * Sets or retrieves the URL, often with a bookmark extension (#name), to use as a client-side image map. - */ - useMap: string; - /** - * Sets or retrieves the vertical margin for the object. - */ - vspace: number; - /** - * Sets or retrieves the width of the object. - */ - width: number; - x: number; - y: number; - msGetAsCastingSource(): any; -} - -declare var HTMLImageElement: { - prototype: HTMLImageElement; - new(): HTMLImageElement; - create(): HTMLImageElement; -} - -interface HTMLInputElement extends HTMLElement { - /** - * Sets or retrieves a comma-separated list of content types. - */ - accept: string; - /** - * Sets or retrieves how the object is aligned with adjacent text. - */ - align: string; - /** - * Sets or retrieves a text alternative to the graphic. - */ - alt: string; - /** - * Specifies whether autocomplete is applied to an editable text field. - */ - autocomplete: string; - /** - * 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. - */ - autofocus: boolean; - /** - * Sets or retrieves the width of the border to draw around the object. - */ - border: string; - /** - * Sets or retrieves the state of the check box or radio button. - */ - checked: boolean; - /** - * Retrieves whether the object is fully loaded. - */ - complete: boolean; - /** - * Sets or retrieves the state of the check box or radio button. - */ - defaultChecked: boolean; - /** - * Sets or retrieves the initial contents of the object. - */ - defaultValue: string; - disabled: boolean; - /** - * Returns a FileList object on a file type input object. - */ - files: FileList; - /** - * Retrieves a reference to the form that the object is embedded in. - */ - form: HTMLFormElement; - /** - * Overrides the action attribute (where the data on a form is sent) on the parent form element. - */ - formAction: string; - /** - * Used to override the encoding (formEnctype attribute) specified on the form element. - */ - formEnctype: string; - /** - * Overrides the submit method attribute previously specified on a form element. - */ - formMethod: string; - /** - * 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. - */ - formNoValidate: string; - /** - * Overrides the target attribute on a form element. - */ - formTarget: string; - /** - * Sets or retrieves the height of the object. - */ - height: string; - /** - * Sets or retrieves the width of the border to draw around the object. - */ - hspace: number; - indeterminate: boolean; - /** - * Specifies the ID of a pre-defined datalist of options for an input element. - */ - list: HTMLElement; - /** - * 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. - */ - max: string; - /** - * Sets or retrieves the maximum number of characters that the user can enter in a text control. - */ - maxLength: number; - /** - * 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. - */ - min: string; - /** - * Sets or retrieves the Boolean value indicating whether multiple items can be selected from a list. - */ - multiple: boolean; - /** - * Sets or retrieves the name of the object. - */ - name: string; - /** - * Gets or sets a string containing a regular expression that the user's input must match. - */ - pattern: string; - /** - * 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. - */ - placeholder: string; - readOnly: boolean; - /** - * When present, marks an element that can't be submitted without a value. - */ - required: boolean; - /** - * Gets or sets the end position or offset of a text selection. - */ - selectionEnd: number; - /** - * Gets or sets the starting position or offset of a text selection. - */ - selectionStart: number; - size: number; - /** - * The address or URL of the a media resource that is to be considered. - */ - src: string; - status: boolean; - /** - * 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. - */ - step: string; - /** - * Returns the content type of the object. - */ - type: string; - /** - * Sets or retrieves the URL, often with a bookmark extension (#name), to use as a client-side image map. - */ - useMap: string; - /** - * 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. - */ - validationMessage: string; - /** - * Returns a ValidityState object that represents the validity states of an element. - */ - validity: ValidityState; - /** - * Returns the value of the data at the cursor's current position. - */ - value: string; - valueAsDate: Date; - /** - * Returns the input field value as a number. - */ - valueAsNumber: number; - /** - * Sets or retrieves the vertical margin for the object. - */ - vspace: number; - /** - * Sets or retrieves the width of the object. - */ - width: string; - /** - * Returns whether an element will successfully validate based on forms validation rules and constraints. - */ - willValidate: boolean; - /** - * Returns whether a form will validate when it is submitted, without having to submit it. - */ - checkValidity(): boolean; - /** - * Creates a TextRange object for the element. - */ - createTextRange(): TextRange; - /** - * Makes the selection equal to the current object. - */ - select(): void; - /** - * Sets a custom error message that is displayed when a form is submitted. - * @param error Sets a custom error message that is displayed when a form is submitted. - */ - setCustomValidity(error: string): void; - /** - * Sets the start and end positions of a selection in a text field. - * @param start The offset into the text field for the start of the selection. - * @param end The offset into the text field for the end of the selection. - */ - setSelectionRange(start: number, end: number): void; - /** - * 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. - * @param n Value to decrement the value by. - */ - stepDown(n?: number): void; - /** - * 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. - * @param n Value to increment the value by. - */ - stepUp(n?: number): void; -} - -declare var HTMLInputElement: { - prototype: HTMLInputElement; - new(): HTMLInputElement; -} - -interface HTMLIsIndexElement extends HTMLElement { - /** - * Sets or retrieves the URL to which the form content is sent for processing. - */ - action: string; - /** - * Retrieves a reference to the form that the object is embedded in. - */ - form: HTMLFormElement; - prompt: string; -} - -declare var HTMLIsIndexElement: { - prototype: HTMLIsIndexElement; - new(): HTMLIsIndexElement; -} - -interface HTMLLIElement extends HTMLElement { - type: string; - /** - * Sets or retrieves the value of a list item. - */ - value: number; -} - -declare var HTMLLIElement: { - prototype: HTMLLIElement; - new(): HTMLLIElement; -} - -interface HTMLLabelElement extends HTMLElement { - /** - * Retrieves a reference to the form that the object is embedded in. - */ - form: HTMLFormElement; - /** - * Sets or retrieves the object to which the given label object is assigned. - */ - htmlFor: string; -} - -declare var HTMLLabelElement: { - prototype: HTMLLabelElement; - new(): HTMLLabelElement; -} - -interface HTMLLegendElement extends HTMLElement { - /** - * Retrieves a reference to the form that the object is embedded in. - */ - align: string; - /** - * Retrieves a reference to the form that the object is embedded in. - */ - form: HTMLFormElement; -} - -declare var HTMLLegendElement: { - prototype: HTMLLegendElement; - new(): HTMLLegendElement; -} - -interface HTMLLinkElement extends HTMLElement, LinkStyle { - /** - * Sets or retrieves the character set used to encode the object. - */ - charset: string; - disabled: boolean; - /** - * Sets or retrieves a destination URL or an anchor point. - */ - href: string; - /** - * Sets or retrieves the language code of the object. - */ - hreflang: string; - /** - * Sets or retrieves the media type. - */ - media: string; - /** - * Sets or retrieves the relationship between the object and the destination of the link. - */ - rel: string; - /** - * Sets or retrieves the relationship between the object and the destination of the link. - */ - rev: string; - /** - * Sets or retrieves the window or frame at which to target content. - */ - target: string; - /** - * Sets or retrieves the MIME type of the object. - */ - type: string; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLLinkElement: { - prototype: HTMLLinkElement; - new(): HTMLLinkElement; -} - -interface HTMLMapElement extends HTMLElement { - /** - * Retrieves a collection of the area objects defined for the given map object. - */ - areas: HTMLAreasCollection; - /** - * Sets or retrieves the name of the object. - */ - name: string; -} - -declare var HTMLMapElement: { - prototype: HTMLMapElement; - new(): HTMLMapElement; -} - -interface HTMLMarqueeElement extends HTMLElement { - behavior: string; - bgColor: any; - direction: string; - height: string; - hspace: number; - loop: number; - onbounce: (ev: Event) => any; - onfinish: (ev: Event) => any; - onstart: (ev: Event) => any; - scrollAmount: number; - scrollDelay: number; - trueSpeed: boolean; - vspace: number; - width: string; - start(): void; - stop(): void; - addEventListener(type: "MSContentZoom", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureChange", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureDoubleTap", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureEnd", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureHold", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureStart", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureTap", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGotPointerCapture", listener: (ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSInertiaStart", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSLostPointerCapture", listener: (ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSManipulationStateChanged", listener: (ev: MSManipulationEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerCancel", listener: (ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerDown", listener: (ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerEnter", listener: (ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerLeave", listener: (ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerMove", listener: (ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerOut", listener: (ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerOver", listener: (ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerUp", listener: (ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "abort", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "activate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "ariarequest", listener: (ev: AriaRequestEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforeactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecopy", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecut", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforedeactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforepaste", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "blur", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "bounce", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "canplay", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "canplaythrough", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "change", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "click", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "command", listener: (ev: CommandEvent) => any, useCapture?: boolean): void; - addEventListener(type: "contextmenu", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "copy", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "cuechange", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "cut", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dblclick", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "deactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "drag", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragend", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragenter", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragleave", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragover", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragstart", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "drop", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "durationchange", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "emptied", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "ended", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "finish", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "focus", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "gotpointercapture", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "input", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "keydown", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "keypress", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "keyup", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "load", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadeddata", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadedmetadata", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadstart", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "lostpointercapture", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousedown", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseenter", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseleave", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousemove", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseout", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseover", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseup", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousewheel", listener: (ev: MouseWheelEvent) => any, useCapture?: boolean): void; - addEventListener(type: "paste", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pause", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "play", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "playing", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "pointercancel", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerdown", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerenter", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerleave", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointermove", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerout", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerover", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerup", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "progress", listener: (ev: ProgressEvent) => any, useCapture?: boolean): void; - addEventListener(type: "ratechange", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "reset", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "scroll", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "seeked", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "seeking", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "select", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "selectstart", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "stalled", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "start", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "submit", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "suspend", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "timeupdate", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "touchcancel", listener: (ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchend", listener: (ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchmove", listener: (ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchstart", listener: (ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "volumechange", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "waiting", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "webkitfullscreenchange", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "webkitfullscreenerror", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "wheel", listener: (ev: WheelEvent) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLMarqueeElement: { - prototype: HTMLMarqueeElement; - new(): HTMLMarqueeElement; -} - -interface HTMLMediaElement extends HTMLElement { - /** - * Returns an AudioTrackList object with the audio tracks for a given video element. - */ - audioTracks: AudioTrackList; - /** - * Gets or sets a value that indicates whether to start playing the media automatically. - */ - autoplay: boolean; - /** - * Gets a collection of buffered time ranges. - */ - buffered: TimeRanges; - /** - * 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). - */ - controls: boolean; - /** - * Gets the address or URL of the current media resource that is selected by IHTMLMediaElement. - */ - currentSrc: string; - /** - * Gets or sets the current playback position, in seconds. - */ - currentTime: number; - defaultMuted: boolean; - /** - * Gets or sets the default playback rate when the user is not using fast forward or reverse for a video or audio resource. - */ - defaultPlaybackRate: number; - /** - * 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. - */ - duration: number; - /** - * Gets information about whether the playback has ended or not. - */ - ended: boolean; - /** - * Returns an object representing the current error state of the audio or video element. - */ - error: MediaError; - /** - * Gets or sets a flag to specify whether playback should restart after it completes. - */ - loop: boolean; - /** - * Specifies the purpose of the audio or video media, such as background audio or alerts. - */ - msAudioCategory: string; - /** - * Specifies the output device id that the audio will be sent to. - */ - msAudioDeviceType: string; - msGraphicsTrustStatus: MSGraphicsTrust; - /** - * Gets the MSMediaKeys object, which is used for decrypting media data, that is associated with this media element. - */ - msKeys: MSMediaKeys; - /** - * Gets or sets whether the DLNA PlayTo device is available. - */ - msPlayToDisabled: boolean; - /** - * 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. - */ - msPlayToPreferredSourceUri: string; - /** - * Gets or sets the primary DLNA PlayTo device. - */ - msPlayToPrimary: boolean; - /** - * Gets the source associated with the media element for use by the PlayToManager. - */ - msPlayToSource: any; - /** - * Specifies whether or not to enable low-latency playback on the media element. - */ - msRealTime: boolean; - /** - * Gets or sets a flag that indicates whether the audio (either audio or the audio track on video media) is muted. - */ - muted: boolean; - /** - * Gets the current network activity for the element. - */ - networkState: number; - onmsneedkey: (ev: MSMediaKeyNeededEvent) => any; - /** - * Gets a flag that specifies whether playback is paused. - */ - paused: boolean; - /** - * 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. - */ - playbackRate: number; - /** - * Gets TimeRanges for the current media resource that has been played. - */ - played: TimeRanges; - /** - * Gets or sets the current playback position, in seconds. - */ - preload: string; - readyState: number; - /** - * Returns a TimeRanges object that represents the ranges of the current media resource that can be seeked. - */ - seekable: TimeRanges; - /** - * Gets a flag that indicates whether the the client is currently moving to a new playback position in the media resource. - */ - seeking: boolean; - /** - * The address or URL of the a media resource that is to be considered. - */ - src: string; - textTracks: TextTrackList; - videoTracks: VideoTrackList; - /** - * Gets or sets the volume level for audio portions of the media element. - */ - volume: number; - addTextTrack(kind: string, label?: string, language?: string): TextTrack; - /** - * Returns a string that specifies whether the client can play a given media resource type. - */ - canPlayType(type: string): string; - /** - * Fires immediately after the client loads the object. - */ - load(): void; - /** - * Clears all effects from the media pipeline. - */ - msClearEffects(): void; - msGetAsCastingSource(): any; - /** - * Inserts the specified audio effect into media pipeline. - */ - msInsertAudioEffect(activatableClassId: string, effectRequired: boolean, config?: any): void; - msSetMediaKeys(mediaKeys: MSMediaKeys): void; - /** - * Specifies the media protection manager for a given media pipeline. - */ - msSetMediaProtectionManager(mediaProtectionManager?: any): void; - /** - * 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. - */ - pause(): void; - /** - * Loads and starts playback of a media resource. - */ - play(): void; - HAVE_CURRENT_DATA: number; - HAVE_ENOUGH_DATA: number; - HAVE_FUTURE_DATA: number; - HAVE_METADATA: number; - HAVE_NOTHING: number; - NETWORK_EMPTY: number; - NETWORK_IDLE: number; - NETWORK_LOADING: number; - NETWORK_NO_SOURCE: number; - addEventListener(type: "MSContentZoom", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureChange", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureDoubleTap", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureEnd", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureHold", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureStart", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureTap", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGotPointerCapture", listener: (ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSInertiaStart", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSLostPointerCapture", listener: (ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSManipulationStateChanged", listener: (ev: MSManipulationEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerCancel", listener: (ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerDown", listener: (ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerEnter", listener: (ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerLeave", listener: (ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerMove", listener: (ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerOut", listener: (ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerOver", listener: (ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerUp", listener: (ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "abort", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "activate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "ariarequest", listener: (ev: AriaRequestEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforeactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecopy", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecut", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforedeactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforepaste", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "blur", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "canplay", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "canplaythrough", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "change", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "click", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "command", listener: (ev: CommandEvent) => any, useCapture?: boolean): void; - addEventListener(type: "contextmenu", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "copy", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "cuechange", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "cut", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dblclick", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "deactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "drag", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragend", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragenter", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragleave", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragover", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragstart", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "drop", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "durationchange", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "emptied", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "ended", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "focus", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "gotpointercapture", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "input", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "keydown", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "keypress", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "keyup", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "load", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadeddata", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadedmetadata", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadstart", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "lostpointercapture", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousedown", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseenter", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseleave", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousemove", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseout", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseover", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseup", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousewheel", listener: (ev: MouseWheelEvent) => any, useCapture?: boolean): void; - addEventListener(type: "msneedkey", listener: (ev: MSMediaKeyNeededEvent) => any, useCapture?: boolean): void; - addEventListener(type: "paste", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pause", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "play", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "playing", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "pointercancel", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerdown", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerenter", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerleave", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointermove", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerout", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerover", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerup", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "progress", listener: (ev: ProgressEvent) => any, useCapture?: boolean): void; - addEventListener(type: "ratechange", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "reset", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "scroll", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "seeked", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "seeking", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "select", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "selectstart", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "stalled", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "submit", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "suspend", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "timeupdate", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "touchcancel", listener: (ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchend", listener: (ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchmove", listener: (ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchstart", listener: (ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "volumechange", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "waiting", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "webkitfullscreenchange", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "webkitfullscreenerror", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "wheel", listener: (ev: WheelEvent) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLMediaElement: { - prototype: HTMLMediaElement; - new(): HTMLMediaElement; - HAVE_CURRENT_DATA: number; - HAVE_ENOUGH_DATA: number; - HAVE_FUTURE_DATA: number; - HAVE_METADATA: number; - HAVE_NOTHING: number; - NETWORK_EMPTY: number; - NETWORK_IDLE: number; - NETWORK_LOADING: number; - NETWORK_NO_SOURCE: number; -} - -interface HTMLMenuElement extends HTMLElement { - compact: boolean; - type: string; -} - -declare var HTMLMenuElement: { - prototype: HTMLMenuElement; - new(): HTMLMenuElement; -} - -interface HTMLMetaElement extends HTMLElement { - /** - * Sets or retrieves the character set used to encode the object. - */ - charset: string; - /** - * Gets or sets meta-information to associate with httpEquiv or name. - */ - content: string; - /** - * Gets or sets information used to bind the value of a content attribute of a meta element to an HTTP response header. - */ - httpEquiv: string; - /** - * Sets or retrieves the value specified in the content attribute of the meta object. - */ - name: string; - /** - * Sets or retrieves a scheme to be used in interpreting the value of a property specified for the object. - */ - scheme: string; - /** - * Sets or retrieves the URL property that will be loaded after the specified time has elapsed. - */ - url: string; -} - -declare var HTMLMetaElement: { - prototype: HTMLMetaElement; - new(): HTMLMetaElement; -} - -interface HTMLModElement extends HTMLElement { - /** - * Sets or retrieves reference information about the object. - */ - cite: string; - /** - * Sets or retrieves the date and time of a modification to the object. - */ - dateTime: string; -} - -declare var HTMLModElement: { - prototype: HTMLModElement; - new(): HTMLModElement; -} - -interface HTMLNextIdElement extends HTMLElement { - n: string; -} - -declare var HTMLNextIdElement: { - prototype: HTMLNextIdElement; - new(): HTMLNextIdElement; -} - -interface HTMLOListElement extends HTMLElement { - compact: boolean; - /** - * The starting number. - */ - start: number; - type: string; -} - -declare var HTMLOListElement: { - prototype: HTMLOListElement; - new(): HTMLOListElement; -} - -interface HTMLObjectElement extends HTMLElement, GetSVGDocument { - /** - * 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. - */ - BaseHref: string; - align: string; - /** - * Sets or retrieves a text alternative to the graphic. - */ - alt: string; - /** - * Gets or sets the optional alternative HTML script to execute if the object fails to load. - */ - altHtml: string; - /** - * Sets or retrieves a character string that can be used to implement your own archive functionality for the object. - */ - archive: string; - border: string; - /** - * Sets or retrieves the URL of the file containing the compiled Java class. - */ - code: string; - /** - * Sets or retrieves the URL of the component. - */ - codeBase: string; - /** - * Sets or retrieves the Internet media type for the code associated with the object. - */ - codeType: string; - /** - * Retrieves the document object of the page or frame. - */ - contentDocument: Document; - /** - * Sets or retrieves the URL that references the data of the object. - */ - data: string; - declare: boolean; - /** - * Retrieves a reference to the form that the object is embedded in. - */ - form: HTMLFormElement; - /** - * Sets or retrieves the height of the object. - */ - height: string; - hspace: number; - /** - * Gets or sets whether the DLNA PlayTo device is available. - */ - msPlayToDisabled: boolean; - /** - * 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. - */ - msPlayToPreferredSourceUri: string; - /** - * Gets or sets the primary DLNA PlayTo device. - */ - msPlayToPrimary: boolean; - /** - * Gets the source associated with the media element for use by the PlayToManager. - */ - msPlayToSource: any; - /** - * Sets or retrieves the name of the object. - */ - name: string; - /** - * Retrieves the contained object. - */ - object: any; - readyState: number; - /** - * Sets or retrieves a message to be displayed while an object is loading. - */ - standby: string; - /** - * Sets or retrieves the MIME type of the object. - */ - type: string; - /** - * Sets or retrieves the URL, often with a bookmark extension (#name), to use as a client-side image map. - */ - useMap: string; - /** - * 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. - */ - validationMessage: string; - /** - * Returns a ValidityState object that represents the validity states of an element. - */ - validity: ValidityState; - vspace: number; - /** - * Sets or retrieves the width of the object. - */ - width: string; - /** - * Returns whether an element will successfully validate based on forms validation rules and constraints. - */ - willValidate: boolean; - /** - * Returns whether a form will validate when it is submitted, without having to submit it. - */ - checkValidity(): boolean; - /** - * Sets a custom error message that is displayed when a form is submitted. - * @param error Sets a custom error message that is displayed when a form is submitted. - */ - setCustomValidity(error: string): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLObjectElement: { - prototype: HTMLObjectElement; - new(): HTMLObjectElement; -} - -interface HTMLOptGroupElement extends HTMLElement { - /** - * Sets or retrieves the status of an option. - */ - defaultSelected: boolean; - disabled: boolean; - /** - * Retrieves a reference to the form that the object is embedded in. - */ - form: HTMLFormElement; - /** - * Sets or retrieves the ordinal position of an option in a list box. - */ - index: number; - /** - * Sets or retrieves a value that you can use to implement your own label functionality for the object. - */ - label: string; - /** - * Sets or retrieves whether the option in the list box is the default item. - */ - selected: boolean; - /** - * Sets or retrieves the text string specified by the option tag. - */ - text: string; - /** - * Sets or retrieves the value which is returned to the server when the form control is submitted. - */ - value: string; -} - -declare var HTMLOptGroupElement: { - prototype: HTMLOptGroupElement; - new(): HTMLOptGroupElement; -} - -interface HTMLOptionElement extends HTMLElement { - /** - * Sets or retrieves the status of an option. - */ - defaultSelected: boolean; - disabled: boolean; - /** - * Retrieves a reference to the form that the object is embedded in. - */ - form: HTMLFormElement; - /** - * Sets or retrieves the ordinal position of an option in a list box. - */ - index: number; - /** - * Sets or retrieves a value that you can use to implement your own label functionality for the object. - */ - label: string; - /** - * Sets or retrieves whether the option in the list box is the default item. - */ - selected: boolean; - /** - * Sets or retrieves the text string specified by the option tag. - */ - text: string; - /** - * Sets or retrieves the value which is returned to the server when the form control is submitted. - */ - value: string; -} - -declare var HTMLOptionElement: { - prototype: HTMLOptionElement; - new(): HTMLOptionElement; - create(): HTMLOptionElement; -} - -interface HTMLParagraphElement extends HTMLElement { - /** - * Sets or retrieves how the object is aligned with adjacent text. - */ - align: string; - clear: string; -} - -declare var HTMLParagraphElement: { - prototype: HTMLParagraphElement; - new(): HTMLParagraphElement; -} - -interface HTMLParamElement extends HTMLElement { - /** - * Sets or retrieves the name of an input parameter for an element. - */ - name: string; - /** - * Sets or retrieves the content type of the resource designated by the value attribute. - */ - type: string; - /** - * Sets or retrieves the value of an input parameter for an element. - */ - value: string; - /** - * Sets or retrieves the data type of the value attribute. - */ - valueType: string; -} - -declare var HTMLParamElement: { - prototype: HTMLParamElement; - new(): HTMLParamElement; -} - -interface HTMLPhraseElement extends HTMLElement { - /** - * Sets or retrieves reference information about the object. - */ - cite: string; - /** - * Sets or retrieves the date and time of a modification to the object. - */ - dateTime: string; -} - -declare var HTMLPhraseElement: { - prototype: HTMLPhraseElement; - new(): HTMLPhraseElement; -} - -interface HTMLPreElement extends HTMLElement { - /** - * Indicates a citation by rendering text in italic type. - */ - cite: string; - clear: string; - /** - * Sets or gets a value that you can use to implement your own width functionality for the object. - */ - width: number; -} - -declare var HTMLPreElement: { - prototype: HTMLPreElement; - new(): HTMLPreElement; -} - -interface HTMLProgressElement extends HTMLElement { - /** - * Retrieves a reference to the form that the object is embedded in. - */ - form: HTMLFormElement; - /** - * Defines the maximum, or "done" value for a progress element. - */ - max: number; - /** - * 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). - */ - position: number; - /** - * Sets or gets the current value of a progress element. The value must be a non-negative number between 0 and the max value. - */ - value: number; -} - -declare var HTMLProgressElement: { - prototype: HTMLProgressElement; - new(): HTMLProgressElement; -} - -interface HTMLQuoteElement extends HTMLElement { - /** - * Sets or retrieves reference information about the object. - */ - cite: string; - /** - * Sets or retrieves the date and time of a modification to the object. - */ - dateTime: string; -} - -declare var HTMLQuoteElement: { - prototype: HTMLQuoteElement; - new(): HTMLQuoteElement; -} - -interface HTMLScriptElement extends HTMLElement { - async: boolean; - /** - * Sets or retrieves the character set used to encode the object. - */ - charset: string; - /** - * Sets or retrieves the status of the script. - */ - defer: boolean; - /** - * Sets or retrieves the event for which the script is written. - */ - event: string; - /** - * Sets or retrieves the object that is bound to the event script. - */ - htmlFor: string; - /** - * Retrieves the URL to an external file that contains the source code or data. - */ - src: string; - /** - * Retrieves or sets the text of the object as a string. - */ - text: string; - /** - * Sets or retrieves the MIME type for the associated scripting engine. - */ - type: string; -} - -declare var HTMLScriptElement: { - prototype: HTMLScriptElement; - new(): HTMLScriptElement; -} - -interface HTMLSelectElement extends HTMLElement { - /** - * 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. - */ - autofocus: boolean; - disabled: boolean; - /** - * Retrieves a reference to the form that the object is embedded in. - */ - form: HTMLFormElement; - /** - * Sets or retrieves the number of objects in a collection. - */ - length: number; - /** - * Sets or retrieves the Boolean value indicating whether multiple items can be selected from a list. - */ - multiple: boolean; - /** - * Sets or retrieves the name of the object. - */ - name: string; - options: HTMLCollection; - /** - * When present, marks an element that can't be submitted without a value. - */ - required: boolean; - /** - * Sets or retrieves the index of the selected option in a select object. - */ - selectedIndex: number; - /** - * Sets or retrieves the number of rows in the list box. - */ - size: number; - /** - * Retrieves the type of select control based on the value of the MULTIPLE attribute. - */ - type: string; - /** - * 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. - */ - validationMessage: string; - /** - * Returns a ValidityState object that represents the validity states of an element. - */ - validity: ValidityState; - /** - * Sets or retrieves the value which is returned to the server when the form control is submitted. - */ - value: string; - /** - * Returns whether an element will successfully validate based on forms validation rules and constraints. - */ - willValidate: boolean; - selectedOptions: HTMLCollection; - /** - * Adds an element to the areas, controlRange, or options collection. - * @param element Variant of type Number that specifies the index position in the collection where the element is placed. If no value is given, the method places the element at the end of the collection. - * @param before Variant of type Object that specifies an element to insert before, or null to append the object to the collection. - */ - add(element: HTMLElement, before?: HTMLElement | number): void; - /** - * Returns whether a form will validate when it is submitted, without having to submit it. - */ - checkValidity(): boolean; - /** - * Retrieves a select object or an object from an options collection. - * @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. - * @param index Variant of type Number that specifies the zero-based index of the object to retrieve when a collection is returned. - */ - item(name?: any, index?: any): any; - /** - * Retrieves a select object or an object from an options collection. - * @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. - */ - namedItem(name: string): any; - /** - * Removes an element from the collection. - * @param index Number that specifies the zero-based index of the element to remove from the collection. - */ - remove(index?: number): void; - /** - * Sets a custom error message that is displayed when a form is submitted. - * @param error Sets a custom error message that is displayed when a form is submitted. - */ - setCustomValidity(error: string): void; - [name: string]: any; -} - -declare var HTMLSelectElement: { - prototype: HTMLSelectElement; - new(): HTMLSelectElement; -} - -interface HTMLSourceElement extends HTMLElement { - /** - * Gets or sets the intended media type of the media source. - */ - media: string; - msKeySystem: string; - /** - * The address or URL of the a media resource that is to be considered. - */ - src: string; - /** - * Gets or sets the MIME type of a media resource. - */ - type: string; -} - -declare var HTMLSourceElement: { - prototype: HTMLSourceElement; - new(): HTMLSourceElement; -} - -interface HTMLSpanElement extends HTMLElement { -} - -declare var HTMLSpanElement: { - prototype: HTMLSpanElement; - new(): HTMLSpanElement; -} - -interface HTMLStyleElement extends HTMLElement, LinkStyle { - /** - * Sets or retrieves the media type. - */ - media: string; - /** - * Retrieves the CSS language in which the style sheet is written. - */ - type: string; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLStyleElement: { - prototype: HTMLStyleElement; - new(): HTMLStyleElement; -} - -interface HTMLTableCaptionElement extends HTMLElement { - /** - * Sets or retrieves the alignment of the caption or legend. - */ - align: string; - /** - * Sets or retrieves whether the caption appears at the top or bottom of the table. - */ - vAlign: string; -} - -declare var HTMLTableCaptionElement: { - prototype: HTMLTableCaptionElement; - new(): HTMLTableCaptionElement; -} - -interface HTMLTableCellElement extends HTMLElement, HTMLTableAlignment { - /** - * Sets or retrieves abbreviated text for the object. - */ - abbr: string; - /** - * Sets or retrieves how the object is aligned with adjacent text. - */ - align: string; - /** - * Sets or retrieves a comma-delimited list of conceptual categories associated with the object. - */ - axis: string; - bgColor: any; - /** - * Retrieves the position of the object in the cells collection of a row. - */ - cellIndex: number; - /** - * Sets or retrieves the number columns in the table that the object should span. - */ - colSpan: number; - /** - * Sets or retrieves a list of header cells that provide information for the object. - */ - headers: string; - /** - * Sets or retrieves the height of the object. - */ - height: any; - /** - * Sets or retrieves whether the browser automatically performs wordwrap. - */ - noWrap: boolean; - /** - * Sets or retrieves how many rows in a table the cell should span. - */ - rowSpan: number; - /** - * Sets or retrieves the group of cells in a table to which the object's information applies. - */ - scope: string; - /** - * Sets or retrieves the width of the object. - */ - width: string; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLTableCellElement: { - prototype: HTMLTableCellElement; - new(): HTMLTableCellElement; -} - -interface HTMLTableColElement extends HTMLElement, HTMLTableAlignment { - /** - * Sets or retrieves the alignment of the object relative to the display or table. - */ - align: string; - /** - * Sets or retrieves the number of columns in the group. - */ - span: number; - /** - * Sets or retrieves the width of the object. - */ - width: any; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLTableColElement: { - prototype: HTMLTableColElement; - new(): HTMLTableColElement; -} - -interface HTMLTableDataCellElement extends HTMLTableCellElement { -} - -declare var HTMLTableDataCellElement: { - prototype: HTMLTableDataCellElement; - new(): HTMLTableDataCellElement; -} - -interface HTMLTableElement extends HTMLElement { - /** - * Sets or retrieves a value that indicates the table alignment. - */ - align: string; - bgColor: any; - /** - * Sets or retrieves the width of the border to draw around the object. - */ - border: string; - /** - * Sets or retrieves the border color of the object. - */ - borderColor: any; - /** - * Retrieves the caption object of a table. - */ - caption: HTMLTableCaptionElement; - /** - * Sets or retrieves the amount of space between the border of the cell and the content of the cell. - */ - cellPadding: string; - /** - * Sets or retrieves the amount of space between cells in a table. - */ - cellSpacing: string; - /** - * Sets or retrieves the number of columns in the table. - */ - cols: number; - /** - * Sets or retrieves the way the border frame around the table is displayed. - */ - frame: string; - /** - * Sets or retrieves the height of the object. - */ - height: any; - /** - * Sets or retrieves the number of horizontal rows contained in the object. - */ - rows: HTMLCollection; - /** - * Sets or retrieves which dividing lines (inner borders) are displayed. - */ - rules: string; - /** - * Sets or retrieves a description and/or structure of the object. - */ - summary: string; - /** - * Retrieves a collection of all tBody objects in the table. Objects in this collection are in source order. - */ - tBodies: HTMLCollection; - /** - * Retrieves the tFoot object of the table. - */ - tFoot: HTMLTableSectionElement; - /** - * Retrieves the tHead object of the table. - */ - tHead: HTMLTableSectionElement; - /** - * Sets or retrieves the width of the object. - */ - width: string; - /** - * Creates an empty caption element in the table. - */ - createCaption(): HTMLTableCaptionElement; - /** - * Creates an empty tBody element in the table. - */ - createTBody(): HTMLTableSectionElement; - /** - * Creates an empty tFoot element in the table. - */ - createTFoot(): HTMLTableSectionElement; - /** - * Returns the tHead element object if successful, or null otherwise. - */ - createTHead(): HTMLTableSectionElement; - /** - * Deletes the caption element and its contents from the table. - */ - deleteCaption(): void; - /** - * Removes the specified row (tr) from the element and from the rows collection. - * @param index Number that specifies the zero-based position in the rows collection of the row to remove. - */ - deleteRow(index?: number): void; - /** - * Deletes the tFoot element and its contents from the table. - */ - deleteTFoot(): void; - /** - * Deletes the tHead element and its contents from the table. - */ - deleteTHead(): void; - /** - * Creates a new row (tr) in the table, and adds the row to the rows collection. - * @param index Number that specifies where to insert the row in the rows collection. The default value is -1, which appends the new row to the end of the rows collection. - */ - insertRow(index?: number): HTMLTableRowElement; -} - -declare var HTMLTableElement: { - prototype: HTMLTableElement; - new(): HTMLTableElement; -} - -interface HTMLTableHeaderCellElement extends HTMLTableCellElement { - /** - * Sets or retrieves the group of cells in a table to which the object's information applies. - */ - scope: string; -} - -declare var HTMLTableHeaderCellElement: { - prototype: HTMLTableHeaderCellElement; - new(): HTMLTableHeaderCellElement; -} - -interface HTMLTableRowElement extends HTMLElement, HTMLTableAlignment { - /** - * Sets or retrieves how the object is aligned with adjacent text. - */ - align: string; - bgColor: any; - /** - * Retrieves a collection of all cells in the table row. - */ - cells: HTMLCollection; - /** - * Sets or retrieves the height of the object. - */ - height: any; - /** - * Retrieves the position of the object in the rows collection for the table. - */ - rowIndex: number; - /** - * Retrieves the position of the object in the collection. - */ - sectionRowIndex: number; - /** - * Removes the specified cell from the table row, as well as from the cells collection. - * @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. - */ - deleteCell(index?: number): void; - /** - * Creates a new cell in the table row, and adds the cell to the cells collection. - * @param index Number that specifies where to insert the cell in the tr. The default value is -1, which appends the new cell to the end of the cells collection. - */ - insertCell(index?: number): HTMLTableCellElement; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLTableRowElement: { - prototype: HTMLTableRowElement; - new(): HTMLTableRowElement; -} - -interface HTMLTableSectionElement extends HTMLElement, HTMLTableAlignment { - /** - * Sets or retrieves a value that indicates the table alignment. - */ - align: string; - /** - * Sets or retrieves the number of horizontal rows contained in the object. - */ - rows: HTMLCollection; - /** - * Removes the specified row (tr) from the element and from the rows collection. - * @param index Number that specifies the zero-based position in the rows collection of the row to remove. - */ - deleteRow(index?: number): void; - /** - * Creates a new row (tr) in the table, and adds the row to the rows collection. - * @param index Number that specifies where to insert the row in the rows collection. The default value is -1, which appends the new row to the end of the rows collection. - */ - insertRow(index?: number): HTMLTableRowElement; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLTableSectionElement: { - prototype: HTMLTableSectionElement; - new(): HTMLTableSectionElement; -} - -interface HTMLTextAreaElement extends HTMLElement { - /** - * 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. - */ - autofocus: boolean; - /** - * Sets or retrieves the width of the object. - */ - cols: number; - /** - * Sets or retrieves the initial contents of the object. - */ - defaultValue: string; - disabled: boolean; - /** - * Retrieves a reference to the form that the object is embedded in. - */ - form: HTMLFormElement; - /** - * Sets or retrieves the maximum number of characters that the user can enter in a text control. - */ - maxLength: number; - /** - * Sets or retrieves the name of the object. - */ - name: string; - /** - * 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. - */ - placeholder: string; - /** - * Sets or retrieves the value indicated whether the content of the object is read-only. - */ - readOnly: boolean; - /** - * When present, marks an element that can't be submitted without a value. - */ - required: boolean; - /** - * Sets or retrieves the number of horizontal rows contained in the object. - */ - rows: number; - /** - * Gets or sets the end position or offset of a text selection. - */ - selectionEnd: number; - /** - * Gets or sets the starting position or offset of a text selection. - */ - selectionStart: number; - /** - * Sets or retrieves the value indicating whether the control is selected. - */ - status: any; - /** - * Retrieves the type of control. - */ - type: string; - /** - * 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. - */ - validationMessage: string; - /** - * Returns a ValidityState object that represents the validity states of an element. - */ - validity: ValidityState; - /** - * Retrieves or sets the text in the entry field of the textArea element. - */ - value: string; - /** - * Returns whether an element will successfully validate based on forms validation rules and constraints. - */ - willValidate: boolean; - /** - * Sets or retrieves how to handle wordwrapping in the object. - */ - wrap: string; - /** - * Returns whether a form will validate when it is submitted, without having to submit it. - */ - checkValidity(): boolean; - /** - * Creates a TextRange object for the element. - */ - createTextRange(): TextRange; - /** - * Highlights the input area of a form element. - */ - select(): void; - /** - * Sets a custom error message that is displayed when a form is submitted. - * @param error Sets a custom error message that is displayed when a form is submitted. - */ - setCustomValidity(error: string): void; - /** - * Sets the start and end positions of a selection in a text field. - * @param start The offset into the text field for the start of the selection. - * @param end The offset into the text field for the end of the selection. - */ - setSelectionRange(start: number, end: number): void; -} - -declare var HTMLTextAreaElement: { - prototype: HTMLTextAreaElement; - new(): HTMLTextAreaElement; -} - -interface HTMLTitleElement extends HTMLElement { - /** - * Retrieves or sets the text of the object as a string. - */ - text: string; -} - -declare var HTMLTitleElement: { - prototype: HTMLTitleElement; - new(): HTMLTitleElement; -} - -interface HTMLTrackElement extends HTMLElement { - default: boolean; - kind: string; - label: string; - readyState: number; - src: string; - srclang: string; - track: TextTrack; - ERROR: number; - LOADED: number; - LOADING: number; - NONE: number; -} - -declare var HTMLTrackElement: { - prototype: HTMLTrackElement; - new(): HTMLTrackElement; - ERROR: number; - LOADED: number; - LOADING: number; - NONE: number; -} - -interface HTMLUListElement extends HTMLElement { - compact: boolean; - type: string; -} - -declare var HTMLUListElement: { - prototype: HTMLUListElement; - new(): HTMLUListElement; -} - -interface HTMLUnknownElement extends HTMLElement { -} - -declare var HTMLUnknownElement: { - prototype: HTMLUnknownElement; - new(): HTMLUnknownElement; -} - -interface HTMLVideoElement extends HTMLMediaElement { - /** - * Gets or sets the height of the video element. - */ - height: number; - msHorizontalMirror: boolean; - msIsLayoutOptimalForPlayback: boolean; - msIsStereo3D: boolean; - msStereo3DPackingMode: string; - msStereo3DRenderMode: string; - msZoom: boolean; - onMSVideoFormatChanged: (ev: Event) => any; - onMSVideoFrameStepCompleted: (ev: Event) => any; - onMSVideoOptimalLayoutChanged: (ev: Event) => any; - /** - * Gets or sets a URL of an image to display, for example, like a movie poster. This can be a still frame from the video, or another image if no video data is available. - */ - poster: string; - /** - * Gets the intrinsic height of a video in CSS pixels, or zero if the dimensions are not known. - */ - videoHeight: number; - /** - * Gets the intrinsic width of a video in CSS pixels, or zero if the dimensions are not known. - */ - videoWidth: number; - webkitDisplayingFullscreen: boolean; - webkitSupportsFullscreen: boolean; - /** - * Gets or sets the width of the video element. - */ - width: number; - getVideoPlaybackQuality(): VideoPlaybackQuality; - msFrameStep(forward: boolean): void; - msInsertVideoEffect(activatableClassId: string, effectRequired: boolean, config?: any): void; - msSetVideoRectangle(left: number, top: number, right: number, bottom: number): void; - webkitEnterFullScreen(): void; - webkitEnterFullscreen(): void; - webkitExitFullScreen(): void; - webkitExitFullscreen(): void; - addEventListener(type: "MSContentZoom", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureChange", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureDoubleTap", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureEnd", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureHold", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureStart", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureTap", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGotPointerCapture", listener: (ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSInertiaStart", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSLostPointerCapture", listener: (ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSManipulationStateChanged", listener: (ev: MSManipulationEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerCancel", listener: (ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerDown", listener: (ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerEnter", listener: (ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerLeave", listener: (ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerMove", listener: (ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerOut", listener: (ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerOver", listener: (ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerUp", listener: (ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSVideoFormatChanged", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "MSVideoFrameStepCompleted", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "MSVideoOptimalLayoutChanged", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "abort", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "activate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "ariarequest", listener: (ev: AriaRequestEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforeactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecopy", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecut", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforedeactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforepaste", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "blur", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "canplay", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "canplaythrough", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "change", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "click", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "command", listener: (ev: CommandEvent) => any, useCapture?: boolean): void; - addEventListener(type: "contextmenu", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "copy", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "cuechange", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "cut", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dblclick", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "deactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "drag", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragend", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragenter", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragleave", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragover", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragstart", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "drop", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "durationchange", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "emptied", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "ended", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "focus", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "gotpointercapture", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "input", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "keydown", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "keypress", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "keyup", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "load", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadeddata", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadedmetadata", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadstart", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "lostpointercapture", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousedown", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseenter", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseleave", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousemove", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseout", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseover", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseup", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousewheel", listener: (ev: MouseWheelEvent) => any, useCapture?: boolean): void; - addEventListener(type: "msneedkey", listener: (ev: MSMediaKeyNeededEvent) => any, useCapture?: boolean): void; - addEventListener(type: "paste", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pause", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "play", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "playing", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "pointercancel", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerdown", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerenter", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerleave", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointermove", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerout", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerover", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerup", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "progress", listener: (ev: ProgressEvent) => any, useCapture?: boolean): void; - addEventListener(type: "ratechange", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "reset", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "scroll", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "seeked", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "seeking", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "select", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "selectstart", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "stalled", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "submit", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "suspend", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "timeupdate", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "touchcancel", listener: (ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchend", listener: (ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchmove", listener: (ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchstart", listener: (ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "volumechange", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "waiting", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "webkitfullscreenchange", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "webkitfullscreenerror", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "wheel", listener: (ev: WheelEvent) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var HTMLVideoElement: { - prototype: HTMLVideoElement; - new(): HTMLVideoElement; -} - -interface HashChangeEvent extends Event { - newURL: string; - oldURL: string; -} - -declare var HashChangeEvent: { - prototype: HashChangeEvent; - new(type: string, eventInitDict?: HashChangeEventInit): HashChangeEvent; -} - -interface History { - length: number; - state: any; - back(distance?: any): void; - forward(distance?: any): void; - go(delta?: any): void; - pushState(statedata: any, title?: string, url?: string): void; - replaceState(statedata: any, title?: string, url?: string): void; -} - -declare var History: { - prototype: History; - new(): History; -} - -interface IDBCursor { - direction: string; - key: any; - primaryKey: any; - source: IDBObjectStore | IDBIndex; - advance(count: number): void; - continue(key?: any): void; - delete(): IDBRequest; - update(value: any): IDBRequest; - NEXT: string; - NEXT_NO_DUPLICATE: string; - PREV: string; - PREV_NO_DUPLICATE: string; -} - -declare var IDBCursor: { - prototype: IDBCursor; - new(): IDBCursor; - NEXT: string; - NEXT_NO_DUPLICATE: string; - PREV: string; - PREV_NO_DUPLICATE: string; -} - -interface IDBCursorWithValue extends IDBCursor { - value: any; -} - -declare var IDBCursorWithValue: { - prototype: IDBCursorWithValue; - new(): IDBCursorWithValue; -} - -interface IDBDatabase extends EventTarget { - name: string; - objectStoreNames: DOMStringList; - onabort: (ev: Event) => any; - onerror: (ev: Event) => any; - version: number; - close(): void; - createObjectStore(name: string, optionalParameters?: IDBObjectStoreParameters): IDBObjectStore; - deleteObjectStore(name: string): void; - transaction(storeNames: string | string[], mode?: string): IDBTransaction; - addEventListener(type: "abort", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var IDBDatabase: { - prototype: IDBDatabase; - new(): IDBDatabase; -} - -interface IDBFactory { - cmp(first: any, second: any): number; - deleteDatabase(name: string): IDBOpenDBRequest; - open(name: string, version?: number): IDBOpenDBRequest; -} - -declare var IDBFactory: { - prototype: IDBFactory; - new(): IDBFactory; -} - -interface IDBIndex { - keyPath: string | string[]; - name: string; - objectStore: IDBObjectStore; - unique: boolean; - multiEntry: boolean; - count(key?: any): IDBRequest; - get(key: any): IDBRequest; - getKey(key: any): IDBRequest; - openCursor(range?: IDBKeyRange, direction?: string): IDBRequest; - openKeyCursor(range?: IDBKeyRange, direction?: string): IDBRequest; -} - -declare var IDBIndex: { - prototype: IDBIndex; - new(): IDBIndex; -} - -interface IDBKeyRange { - lower: any; - lowerOpen: boolean; - upper: any; - upperOpen: boolean; -} - -declare var IDBKeyRange: { - prototype: IDBKeyRange; - new(): IDBKeyRange; - bound(lower: any, upper: any, lowerOpen?: boolean, upperOpen?: boolean): IDBKeyRange; - lowerBound(bound: any, open?: boolean): IDBKeyRange; - only(value: any): IDBKeyRange; - upperBound(bound: any, open?: boolean): IDBKeyRange; -} - -interface IDBObjectStore { - indexNames: DOMStringList; - keyPath: string | string[]; - name: string; - transaction: IDBTransaction; - autoIncrement: boolean; - add(value: any, key?: any): IDBRequest; - clear(): IDBRequest; - count(key?: any): IDBRequest; - createIndex(name: string, keyPath: string | string[], optionalParameters?: IDBIndexParameters): IDBIndex; - delete(key: any): IDBRequest; - deleteIndex(indexName: string): void; - get(key: any): IDBRequest; - index(name: string): IDBIndex; - openCursor(range?: any, direction?: string): IDBRequest; - put(value: any, key?: any): IDBRequest; -} - -declare var IDBObjectStore: { - prototype: IDBObjectStore; - new(): IDBObjectStore; -} - -interface IDBOpenDBRequest extends IDBRequest { - onblocked: (ev: Event) => any; - onupgradeneeded: (ev: IDBVersionChangeEvent) => any; - addEventListener(type: "blocked", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "success", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "upgradeneeded", listener: (ev: IDBVersionChangeEvent) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var IDBOpenDBRequest: { - prototype: IDBOpenDBRequest; - new(): IDBOpenDBRequest; -} - -interface IDBRequest extends EventTarget { - error: DOMError; - onerror: (ev: Event) => any; - onsuccess: (ev: Event) => any; - readyState: string; - result: any; - source: IDBObjectStore | IDBIndex | IDBCursor; - transaction: IDBTransaction; - addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "success", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var IDBRequest: { - prototype: IDBRequest; - new(): IDBRequest; -} - -interface IDBTransaction extends EventTarget { - db: IDBDatabase; - error: DOMError; - mode: string; - onabort: (ev: Event) => any; - oncomplete: (ev: Event) => any; - onerror: (ev: Event) => any; - abort(): void; - objectStore(name: string): IDBObjectStore; - READ_ONLY: string; - READ_WRITE: string; - VERSION_CHANGE: string; - addEventListener(type: "abort", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "complete", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var IDBTransaction: { - prototype: IDBTransaction; - new(): IDBTransaction; - READ_ONLY: string; - READ_WRITE: string; - VERSION_CHANGE: string; -} - -interface IDBVersionChangeEvent extends Event { - newVersion: number; - oldVersion: number; -} - -declare var IDBVersionChangeEvent: { - prototype: IDBVersionChangeEvent; - new(): IDBVersionChangeEvent; -} - -interface ImageData { - data: Uint8ClampedArray; - height: number; - width: number; -} - -declare var ImageData: { - prototype: ImageData; - new(width: number, height: number): ImageData; - new(array: Uint8ClampedArray, width: number, height: number): ImageData; -} - -interface KeyboardEvent extends UIEvent { - altKey: boolean; - char: string; - charCode: number; - ctrlKey: boolean; - key: string; - keyCode: number; - locale: string; - location: number; - metaKey: boolean; - repeat: boolean; - shiftKey: boolean; - which: number; - getModifierState(keyArg: string): boolean; - initKeyboardEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, keyArg: string, locationArg: number, modifiersListArg: string, repeat: boolean, locale: string): void; - DOM_KEY_LOCATION_JOYSTICK: number; - DOM_KEY_LOCATION_LEFT: number; - DOM_KEY_LOCATION_MOBILE: number; - DOM_KEY_LOCATION_NUMPAD: number; - DOM_KEY_LOCATION_RIGHT: number; - DOM_KEY_LOCATION_STANDARD: number; -} - -declare var KeyboardEvent: { - prototype: KeyboardEvent; - new(typeArg: string, eventInitDict?: KeyboardEventInit): KeyboardEvent; - DOM_KEY_LOCATION_JOYSTICK: number; - DOM_KEY_LOCATION_LEFT: number; - DOM_KEY_LOCATION_MOBILE: number; - DOM_KEY_LOCATION_NUMPAD: number; - DOM_KEY_LOCATION_RIGHT: number; - DOM_KEY_LOCATION_STANDARD: number; -} - -interface Location { - hash: string; - host: string; - hostname: string; - href: string; - origin: string; - pathname: string; - port: string; - protocol: string; - search: string; - assign(url: string): void; - reload(forcedReload?: boolean): void; - replace(url: string): void; - toString(): string; -} - -declare var Location: { - prototype: Location; - new(): Location; -} - -interface LongRunningScriptDetectedEvent extends Event { - executionTime: number; - stopPageScriptExecution: boolean; -} - -declare var LongRunningScriptDetectedEvent: { - prototype: LongRunningScriptDetectedEvent; - new(): LongRunningScriptDetectedEvent; -} - -interface MSApp { - clearTemporaryWebDataAsync(): MSAppAsyncOperation; - createBlobFromRandomAccessStream(type: string, seeker: any): Blob; - createDataPackage(object: any): any; - createDataPackageFromSelection(): any; - createFileFromStorageFile(storageFile: any): File; - createStreamFromInputStream(type: string, inputStream: any): MSStream; - execAsyncAtPriority(asynchronousCallback: MSExecAtPriorityFunctionCallback, priority: string, ...args: any[]): void; - execAtPriority(synchronousCallback: MSExecAtPriorityFunctionCallback, priority: string, ...args: any[]): any; - getCurrentPriority(): string; - getHtmlPrintDocumentSourceAsync(htmlDoc: any): any; - getViewId(view: any): any; - isTaskScheduledAtPriorityOrHigher(priority: string): boolean; - pageHandlesAllApplicationActivations(enabled: boolean): void; - suppressSubdownloadCredentialPrompts(suppress: boolean): void; - terminateApp(exceptionObject: any): void; - CURRENT: string; - HIGH: string; - IDLE: string; - NORMAL: string; -} -declare var MSApp: MSApp; - -interface MSAppAsyncOperation extends EventTarget { - error: DOMError; - oncomplete: (ev: Event) => any; - onerror: (ev: Event) => any; - readyState: number; - result: any; - start(): void; - COMPLETED: number; - ERROR: number; - STARTED: number; - addEventListener(type: "complete", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var MSAppAsyncOperation: { - prototype: MSAppAsyncOperation; - new(): MSAppAsyncOperation; - COMPLETED: number; - ERROR: number; - STARTED: number; -} - -interface MSBlobBuilder { - append(data: any, endings?: string): void; - getBlob(contentType?: string): Blob; -} - -declare var MSBlobBuilder: { - prototype: MSBlobBuilder; - new(): MSBlobBuilder; -} - -interface MSCSSMatrix { - a: number; - b: number; - c: number; - d: number; - e: number; - f: number; - m11: number; - m12: number; - m13: number; - m14: number; - m21: number; - m22: number; - m23: number; - m24: number; - m31: number; - m32: number; - m33: number; - m34: number; - m41: number; - m42: number; - m43: number; - m44: number; - inverse(): MSCSSMatrix; - multiply(secondMatrix: MSCSSMatrix): MSCSSMatrix; - rotate(angleX: number, angleY?: number, angleZ?: number): MSCSSMatrix; - rotateAxisAngle(x: number, y: number, z: number, angle: number): MSCSSMatrix; - scale(scaleX: number, scaleY?: number, scaleZ?: number): MSCSSMatrix; - setMatrixValue(value: string): void; - skewX(angle: number): MSCSSMatrix; - skewY(angle: number): MSCSSMatrix; - toString(): string; - translate(x: number, y: number, z?: number): MSCSSMatrix; -} - -declare var MSCSSMatrix: { - prototype: MSCSSMatrix; - new(text?: string): MSCSSMatrix; -} - -interface MSGesture { - target: Element; - addPointer(pointerId: number): void; - stop(): void; -} - -declare var MSGesture: { - prototype: MSGesture; - new(): MSGesture; -} - -interface MSGestureEvent extends UIEvent { - clientX: number; - clientY: number; - expansion: number; - gestureObject: any; - hwTimestamp: number; - offsetX: number; - offsetY: number; - rotation: number; - scale: number; - screenX: number; - screenY: number; - translationX: number; - translationY: number; - velocityAngular: number; - velocityExpansion: number; - velocityX: number; - velocityY: number; - 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; - MSGESTURE_FLAG_BEGIN: number; - MSGESTURE_FLAG_CANCEL: number; - MSGESTURE_FLAG_END: number; - MSGESTURE_FLAG_INERTIA: number; - MSGESTURE_FLAG_NONE: number; -} - -declare var MSGestureEvent: { - prototype: MSGestureEvent; - new(): MSGestureEvent; - MSGESTURE_FLAG_BEGIN: number; - MSGESTURE_FLAG_CANCEL: number; - MSGESTURE_FLAG_END: number; - MSGESTURE_FLAG_INERTIA: number; - MSGESTURE_FLAG_NONE: number; -} - -interface MSGraphicsTrust { - constrictionActive: boolean; - status: string; -} - -declare var MSGraphicsTrust: { - prototype: MSGraphicsTrust; - new(): MSGraphicsTrust; -} - -interface MSHTMLWebViewElement extends HTMLElement { - canGoBack: boolean; - canGoForward: boolean; - containsFullScreenElement: boolean; - documentTitle: string; - height: number; - settings: MSWebViewSettings; - src: string; - width: number; - addWebAllowedObject(name: string, applicationObject: any): void; - buildLocalStreamUri(contentIdentifier: string, relativePath: string): string; - capturePreviewToBlobAsync(): MSWebViewAsyncOperation; - captureSelectedContentToDataPackageAsync(): MSWebViewAsyncOperation; - getDeferredPermissionRequestById(id: number): DeferredPermissionRequest; - getDeferredPermissionRequests(): DeferredPermissionRequest[]; - goBack(): void; - goForward(): void; - invokeScriptAsync(scriptName: string, ...args: any[]): MSWebViewAsyncOperation; - navigate(uri: string): void; - navigateToLocalStreamUri(source: string, streamResolver: any): void; - navigateToString(contents: string): void; - navigateWithHttpRequestMessage(requestMessage: any): void; - refresh(): void; - stop(): void; -} - -declare var MSHTMLWebViewElement: { - prototype: MSHTMLWebViewElement; - new(): MSHTMLWebViewElement; -} - -interface MSInputMethodContext extends EventTarget { - compositionEndOffset: number; - compositionStartOffset: number; - oncandidatewindowhide: (ev: Event) => any; - oncandidatewindowshow: (ev: Event) => any; - oncandidatewindowupdate: (ev: Event) => any; - target: HTMLElement; - getCandidateWindowClientRect(): ClientRect; - getCompositionAlternatives(): string[]; - hasComposition(): boolean; - isCandidateWindowVisible(): boolean; - addEventListener(type: "MSCandidateWindowHide", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "MSCandidateWindowShow", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "MSCandidateWindowUpdate", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var MSInputMethodContext: { - prototype: MSInputMethodContext; - new(): MSInputMethodContext; -} - -interface MSManipulationEvent extends UIEvent { - currentState: number; - inertiaDestinationX: number; - inertiaDestinationY: number; - lastState: number; - initMSManipulationEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, lastState: number, currentState: number): void; - MS_MANIPULATION_STATE_ACTIVE: number; - MS_MANIPULATION_STATE_CANCELLED: number; - MS_MANIPULATION_STATE_COMMITTED: number; - MS_MANIPULATION_STATE_DRAGGING: number; - MS_MANIPULATION_STATE_INERTIA: number; - MS_MANIPULATION_STATE_PRESELECT: number; - MS_MANIPULATION_STATE_SELECTING: number; - MS_MANIPULATION_STATE_STOPPED: number; -} - -declare var MSManipulationEvent: { - prototype: MSManipulationEvent; - new(): MSManipulationEvent; - MS_MANIPULATION_STATE_ACTIVE: number; - MS_MANIPULATION_STATE_CANCELLED: number; - MS_MANIPULATION_STATE_COMMITTED: number; - MS_MANIPULATION_STATE_DRAGGING: number; - MS_MANIPULATION_STATE_INERTIA: number; - MS_MANIPULATION_STATE_PRESELECT: number; - MS_MANIPULATION_STATE_SELECTING: number; - MS_MANIPULATION_STATE_STOPPED: number; -} - -interface MSMediaKeyError { - code: number; - systemCode: number; - MS_MEDIA_KEYERR_CLIENT: number; - MS_MEDIA_KEYERR_DOMAIN: number; - MS_MEDIA_KEYERR_HARDWARECHANGE: number; - MS_MEDIA_KEYERR_OUTPUT: number; - MS_MEDIA_KEYERR_SERVICE: number; - MS_MEDIA_KEYERR_UNKNOWN: number; -} - -declare var MSMediaKeyError: { - prototype: MSMediaKeyError; - new(): MSMediaKeyError; - MS_MEDIA_KEYERR_CLIENT: number; - MS_MEDIA_KEYERR_DOMAIN: number; - MS_MEDIA_KEYERR_HARDWARECHANGE: number; - MS_MEDIA_KEYERR_OUTPUT: number; - MS_MEDIA_KEYERR_SERVICE: number; - MS_MEDIA_KEYERR_UNKNOWN: number; -} - -interface MSMediaKeyMessageEvent extends Event { - destinationURL: string; - message: Uint8Array; -} - -declare var MSMediaKeyMessageEvent: { - prototype: MSMediaKeyMessageEvent; - new(): MSMediaKeyMessageEvent; -} - -interface MSMediaKeyNeededEvent extends Event { - initData: Uint8Array; -} - -declare var MSMediaKeyNeededEvent: { - prototype: MSMediaKeyNeededEvent; - new(): MSMediaKeyNeededEvent; -} - -interface MSMediaKeySession extends EventTarget { - error: MSMediaKeyError; - keySystem: string; - sessionId: string; - close(): void; - update(key: Uint8Array): void; -} - -declare var MSMediaKeySession: { - prototype: MSMediaKeySession; - new(): MSMediaKeySession; -} - -interface MSMediaKeys { - keySystem: string; - createSession(type: string, initData: Uint8Array, cdmData?: Uint8Array): MSMediaKeySession; -} - -declare var MSMediaKeys: { - prototype: MSMediaKeys; - new(keySystem: string): MSMediaKeys; - isTypeSupported(keySystem: string, type?: string): boolean; -} - -interface MSMimeTypesCollection { - length: number; -} - -declare var MSMimeTypesCollection: { - prototype: MSMimeTypesCollection; - new(): MSMimeTypesCollection; -} - -interface MSPluginsCollection { - length: number; - refresh(reload?: boolean): void; -} - -declare var MSPluginsCollection: { - prototype: MSPluginsCollection; - new(): MSPluginsCollection; -} - -interface MSPointerEvent extends MouseEvent { - currentPoint: any; - height: number; - hwTimestamp: number; - intermediatePoints: any; - isPrimary: boolean; - pointerId: number; - pointerType: any; - pressure: number; - rotation: number; - tiltX: number; - tiltY: number; - width: number; - getCurrentPoint(element: Element): void; - getIntermediatePoints(element: Element): void; - 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; -} - -declare var MSPointerEvent: { - prototype: MSPointerEvent; - new(typeArg: string, eventInitDict?: PointerEventInit): MSPointerEvent; -} - -interface MSRangeCollection { - length: number; - item(index: number): Range; - [index: number]: Range; -} - -declare var MSRangeCollection: { - prototype: MSRangeCollection; - new(): MSRangeCollection; -} - -interface MSSiteModeEvent extends Event { - actionURL: string; - buttonID: number; -} - -declare var MSSiteModeEvent: { - prototype: MSSiteModeEvent; - new(): MSSiteModeEvent; -} - -interface MSStream { - type: string; - msClose(): void; - msDetachStream(): any; -} - -declare var MSStream: { - prototype: MSStream; - new(): MSStream; -} - -interface MSStreamReader extends EventTarget, MSBaseReader { - error: DOMError; - readAsArrayBuffer(stream: MSStream, size?: number): void; - readAsBinaryString(stream: MSStream, size?: number): void; - readAsBlob(stream: MSStream, size?: number): void; - readAsDataURL(stream: MSStream, size?: number): void; - readAsText(stream: MSStream, encoding?: string, size?: number): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var MSStreamReader: { - prototype: MSStreamReader; - new(): MSStreamReader; -} - -interface MSWebViewAsyncOperation extends EventTarget { - error: DOMError; - oncomplete: (ev: Event) => any; - onerror: (ev: Event) => any; - readyState: number; - result: any; - target: MSHTMLWebViewElement; - type: number; - start(): void; - COMPLETED: number; - ERROR: number; - STARTED: number; - TYPE_CAPTURE_PREVIEW_TO_RANDOM_ACCESS_STREAM: number; - TYPE_CREATE_DATA_PACKAGE_FROM_SELECTION: number; - TYPE_INVOKE_SCRIPT: number; - addEventListener(type: "complete", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var MSWebViewAsyncOperation: { - prototype: MSWebViewAsyncOperation; - new(): MSWebViewAsyncOperation; - COMPLETED: number; - ERROR: number; - STARTED: number; - TYPE_CAPTURE_PREVIEW_TO_RANDOM_ACCESS_STREAM: number; - TYPE_CREATE_DATA_PACKAGE_FROM_SELECTION: number; - TYPE_INVOKE_SCRIPT: number; -} - -interface MSWebViewSettings { - isIndexedDBEnabled: boolean; - isJavaScriptEnabled: boolean; -} - -declare var MSWebViewSettings: { - prototype: MSWebViewSettings; - new(): MSWebViewSettings; -} - -interface MediaElementAudioSourceNode extends AudioNode { -} - -declare var MediaElementAudioSourceNode: { - prototype: MediaElementAudioSourceNode; - new(): MediaElementAudioSourceNode; -} - -interface MediaError { - code: number; - msExtendedCode: number; - MEDIA_ERR_ABORTED: number; - MEDIA_ERR_DECODE: number; - MEDIA_ERR_NETWORK: number; - MEDIA_ERR_SRC_NOT_SUPPORTED: number; - MS_MEDIA_ERR_ENCRYPTED: number; -} - -declare var MediaError: { - prototype: MediaError; - new(): MediaError; - MEDIA_ERR_ABORTED: number; - MEDIA_ERR_DECODE: number; - MEDIA_ERR_NETWORK: number; - MEDIA_ERR_SRC_NOT_SUPPORTED: number; - MS_MEDIA_ERR_ENCRYPTED: number; -} - -interface MediaList { - length: number; - mediaText: string; - appendMedium(newMedium: string): void; - deleteMedium(oldMedium: string): void; - item(index: number): string; - toString(): string; - [index: number]: string; -} - -declare var MediaList: { - prototype: MediaList; - new(): MediaList; -} - -interface MediaQueryList { - matches: boolean; - media: string; - addListener(listener: MediaQueryListListener): void; - removeListener(listener: MediaQueryListListener): void; -} - -declare var MediaQueryList: { - prototype: MediaQueryList; - new(): MediaQueryList; -} - -interface MediaSource extends EventTarget { - activeSourceBuffers: SourceBufferList; - duration: number; - readyState: string; - sourceBuffers: SourceBufferList; - addSourceBuffer(type: string): SourceBuffer; - endOfStream(error?: number): void; - removeSourceBuffer(sourceBuffer: SourceBuffer): void; -} - -declare var MediaSource: { - prototype: MediaSource; - new(): MediaSource; - isTypeSupported(type: string): boolean; -} - -interface MessageChannel { - port1: MessagePort; - port2: MessagePort; -} - -declare var MessageChannel: { - prototype: MessageChannel; - new(): MessageChannel; -} - -interface MessageEvent extends Event { - data: any; - origin: string; - ports: any; - source: Window; - initMessageEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, dataArg: any, originArg: string, lastEventIdArg: string, sourceArg: Window): void; -} - -declare var MessageEvent: { - prototype: MessageEvent; - new(type: string, eventInitDict?: MessageEventInit): MessageEvent; -} - -interface MessagePort extends EventTarget { - onmessage: (ev: MessageEvent) => any; - close(): void; - postMessage(message?: any, ports?: any): void; - start(): void; - addEventListener(type: "message", listener: (ev: MessageEvent) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var MessagePort: { - prototype: MessagePort; - new(): MessagePort; -} - -interface MimeType { - description: string; - enabledPlugin: Plugin; - suffixes: string; - type: string; -} - -declare var MimeType: { - prototype: MimeType; - new(): MimeType; -} - -interface MimeTypeArray { - length: number; - item(index: number): Plugin; - namedItem(type: string): Plugin; - [index: number]: Plugin; -} - -declare var MimeTypeArray: { - prototype: MimeTypeArray; - new(): MimeTypeArray; -} - -interface MouseEvent extends UIEvent { - altKey: boolean; - button: number; - buttons: number; - clientX: number; - clientY: number; - ctrlKey: boolean; - fromElement: Element; - layerX: number; - layerY: number; - metaKey: boolean; - movementX: number; - movementY: number; - offsetX: number; - offsetY: number; - pageX: number; - pageY: number; - relatedTarget: EventTarget; - screenX: number; - screenY: number; - shiftKey: boolean; - toElement: Element; - which: number; - x: number; - y: number; - getModifierState(keyArg: string): boolean; - 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; -} - -declare var MouseEvent: { - prototype: MouseEvent; - new(typeArg: string, eventInitDict?: MouseEventInit): MouseEvent; -} - -interface MouseWheelEvent extends MouseEvent { - wheelDelta: number; - wheelDeltaX: number; - wheelDeltaY: number; - initMouseWheelEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, screenXArg: number, screenYArg: number, clientXArg: number, clientYArg: number, buttonArg: number, relatedTargetArg: EventTarget, modifiersListArg: string, wheelDeltaArg: number): void; -} - -declare var MouseWheelEvent: { - prototype: MouseWheelEvent; - new(): MouseWheelEvent; -} - -interface MutationEvent extends Event { - attrChange: number; - attrName: string; - newValue: string; - prevValue: string; - relatedNode: Node; - initMutationEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, relatedNodeArg: Node, prevValueArg: string, newValueArg: string, attrNameArg: string, attrChangeArg: number): void; - ADDITION: number; - MODIFICATION: number; - REMOVAL: number; -} - -declare var MutationEvent: { - prototype: MutationEvent; - new(): MutationEvent; - ADDITION: number; - MODIFICATION: number; - REMOVAL: number; -} - -interface MutationObserver { - disconnect(): void; - observe(target: Node, options: MutationObserverInit): void; - takeRecords(): MutationRecord[]; -} - -declare var MutationObserver: { - prototype: MutationObserver; - new(callback: MutationCallback): MutationObserver; -} - -interface MutationRecord { - addedNodes: NodeList; - attributeName: string; - attributeNamespace: string; - nextSibling: Node; - oldValue: string; - previousSibling: Node; - removedNodes: NodeList; - target: Node; - type: string; -} - -declare var MutationRecord: { - prototype: MutationRecord; - new(): MutationRecord; -} - -interface NamedNodeMap { - length: number; - getNamedItem(name: string): Attr; - getNamedItemNS(namespaceURI: string, localName: string): Attr; - item(index: number): Attr; - removeNamedItem(name: string): Attr; - removeNamedItemNS(namespaceURI: string, localName: string): Attr; - setNamedItem(arg: Attr): Attr; - setNamedItemNS(arg: Attr): Attr; - [index: number]: Attr; -} - -declare var NamedNodeMap: { - prototype: NamedNodeMap; - new(): NamedNodeMap; -} - -interface NavigationCompletedEvent extends NavigationEvent { - isSuccess: boolean; - webErrorStatus: number; -} - -declare var NavigationCompletedEvent: { - prototype: NavigationCompletedEvent; - new(): NavigationCompletedEvent; -} - -interface NavigationEvent extends Event { - uri: string; -} - -declare var NavigationEvent: { - prototype: NavigationEvent; - new(): NavigationEvent; -} - -interface NavigationEventWithReferrer extends NavigationEvent { - referer: string; -} - -declare var NavigationEventWithReferrer: { - prototype: NavigationEventWithReferrer; - new(): NavigationEventWithReferrer; -} - -interface Navigator extends Object, NavigatorID, NavigatorOnLine, NavigatorContentUtils, NavigatorStorageUtils, NavigatorGeolocation, MSNavigatorDoNotTrack, MSFileSaver { - appCodeName: string; - appMinorVersion: string; - browserLanguage: string; - connectionSpeed: number; - cookieEnabled: boolean; - cpuClass: string; - language: string; - maxTouchPoints: number; - mimeTypes: MSMimeTypesCollection; - msManipulationViewsEnabled: boolean; - msMaxTouchPoints: number; - msPointerEnabled: boolean; - plugins: MSPluginsCollection; - pointerEnabled: boolean; - systemLanguage: string; - userLanguage: string; - webdriver: boolean; - getGamepads(): Gamepad[]; - javaEnabled(): boolean; - msLaunchUri(uri: string, successCallback?: MSLaunchUriCallback, noHandlerCallback?: MSLaunchUriCallback): void; - vibrate(pattern: number | number[]): boolean; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var Navigator: { - prototype: Navigator; - new(): Navigator; -} - -interface Node extends EventTarget { - attributes: NamedNodeMap; - baseURI: string; - childNodes: NodeList; - firstChild: Node; - lastChild: Node; - localName: string; - namespaceURI: string; - nextSibling: Node; - nodeName: string; - nodeType: number; - nodeValue: string; - ownerDocument: Document; - parentElement: HTMLElement; - parentNode: Node; - prefix: string; - previousSibling: Node; - textContent: string; - appendChild(newChild: Node): Node; - cloneNode(deep?: boolean): Node; - compareDocumentPosition(other: Node): number; - hasAttributes(): boolean; - hasChildNodes(): boolean; - insertBefore(newChild: Node, refChild?: Node): Node; - isDefaultNamespace(namespaceURI: string): boolean; - isEqualNode(arg: Node): boolean; - isSameNode(other: Node): boolean; - lookupNamespaceURI(prefix: string): string; - lookupPrefix(namespaceURI: string): string; - normalize(): void; - removeChild(oldChild: Node): Node; - replaceChild(newChild: Node, oldChild: Node): Node; - contains(node: Node): boolean; - ATTRIBUTE_NODE: number; - CDATA_SECTION_NODE: number; - COMMENT_NODE: number; - DOCUMENT_FRAGMENT_NODE: number; - DOCUMENT_NODE: number; - DOCUMENT_POSITION_CONTAINED_BY: number; - DOCUMENT_POSITION_CONTAINS: number; - DOCUMENT_POSITION_DISCONNECTED: number; - DOCUMENT_POSITION_FOLLOWING: number; - DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC: number; - DOCUMENT_POSITION_PRECEDING: number; - DOCUMENT_TYPE_NODE: number; - ELEMENT_NODE: number; - ENTITY_NODE: number; - ENTITY_REFERENCE_NODE: number; - NOTATION_NODE: number; - PROCESSING_INSTRUCTION_NODE: number; - TEXT_NODE: number; -} - -declare var Node: { - prototype: Node; - new(): Node; - ATTRIBUTE_NODE: number; - CDATA_SECTION_NODE: number; - COMMENT_NODE: number; - DOCUMENT_FRAGMENT_NODE: number; - DOCUMENT_NODE: number; - DOCUMENT_POSITION_CONTAINED_BY: number; - DOCUMENT_POSITION_CONTAINS: number; - DOCUMENT_POSITION_DISCONNECTED: number; - DOCUMENT_POSITION_FOLLOWING: number; - DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC: number; - DOCUMENT_POSITION_PRECEDING: number; - DOCUMENT_TYPE_NODE: number; - ELEMENT_NODE: number; - ENTITY_NODE: number; - ENTITY_REFERENCE_NODE: number; - NOTATION_NODE: number; - PROCESSING_INSTRUCTION_NODE: number; - TEXT_NODE: number; -} - -interface NodeFilter { - acceptNode(n: Node): number; -} - -declare var NodeFilter: { - FILTER_ACCEPT: number; - FILTER_REJECT: number; - FILTER_SKIP: number; - SHOW_ALL: number; - SHOW_ATTRIBUTE: number; - SHOW_CDATA_SECTION: number; - SHOW_COMMENT: number; - SHOW_DOCUMENT: number; - SHOW_DOCUMENT_FRAGMENT: number; - SHOW_DOCUMENT_TYPE: number; - SHOW_ELEMENT: number; - SHOW_ENTITY: number; - SHOW_ENTITY_REFERENCE: number; - SHOW_NOTATION: number; - SHOW_PROCESSING_INSTRUCTION: number; - SHOW_TEXT: number; -} - -interface NodeIterator { - expandEntityReferences: boolean; - filter: NodeFilter; - root: Node; - whatToShow: number; - detach(): void; - nextNode(): Node; - previousNode(): Node; -} - -declare var NodeIterator: { - prototype: NodeIterator; - new(): NodeIterator; -} - -interface NodeList { - length: number; - item(index: number): Node; - [index: number]: Node; -} - -declare var NodeList: { - prototype: NodeList; - new(): NodeList; -} - -interface OES_element_index_uint { -} - -declare var OES_element_index_uint: { - prototype: OES_element_index_uint; - new(): OES_element_index_uint; -} - -interface OES_standard_derivatives { - FRAGMENT_SHADER_DERIVATIVE_HINT_OES: number; -} - -declare var OES_standard_derivatives: { - prototype: OES_standard_derivatives; - new(): OES_standard_derivatives; - FRAGMENT_SHADER_DERIVATIVE_HINT_OES: number; -} - -interface OES_texture_float { -} - -declare var OES_texture_float: { - prototype: OES_texture_float; - new(): OES_texture_float; -} - -interface OES_texture_float_linear { -} - -declare var OES_texture_float_linear: { - prototype: OES_texture_float_linear; - new(): OES_texture_float_linear; -} - -interface OfflineAudioCompletionEvent extends Event { - renderedBuffer: AudioBuffer; -} - -declare var OfflineAudioCompletionEvent: { - prototype: OfflineAudioCompletionEvent; - new(): OfflineAudioCompletionEvent; -} - -interface OfflineAudioContext extends AudioContext { - oncomplete: (ev: Event) => any; - startRendering(): void; - addEventListener(type: "complete", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var OfflineAudioContext: { - prototype: OfflineAudioContext; - new(numberOfChannels: number, length: number, sampleRate: number): OfflineAudioContext; -} - -interface OscillatorNode extends AudioNode { - detune: AudioParam; - frequency: AudioParam; - onended: (ev: Event) => any; - type: string; - setPeriodicWave(periodicWave: PeriodicWave): void; - start(when?: number): void; - stop(when?: number): void; - addEventListener(type: "ended", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var OscillatorNode: { - prototype: OscillatorNode; - new(): OscillatorNode; -} - -interface PageTransitionEvent extends Event { - persisted: boolean; -} - -declare var PageTransitionEvent: { - prototype: PageTransitionEvent; - new(): PageTransitionEvent; -} - -interface PannerNode extends AudioNode { - coneInnerAngle: number; - coneOuterAngle: number; - coneOuterGain: number; - distanceModel: string; - maxDistance: number; - panningModel: string; - refDistance: number; - rolloffFactor: number; - setOrientation(x: number, y: number, z: number): void; - setPosition(x: number, y: number, z: number): void; - setVelocity(x: number, y: number, z: number): void; -} - -declare var PannerNode: { - prototype: PannerNode; - new(): PannerNode; -} - -interface PerfWidgetExternal { - activeNetworkRequestCount: number; - averageFrameTime: number; - averagePaintTime: number; - extraInformationEnabled: boolean; - independentRenderingEnabled: boolean; - irDisablingContentString: string; - irStatusAvailable: boolean; - maxCpuSpeed: number; - paintRequestsPerSecond: number; - performanceCounter: number; - performanceCounterFrequency: number; - addEventListener(eventType: string, callback: Function): void; - getMemoryUsage(): number; - getProcessCpuUsage(): number; - getRecentCpuUsage(last: number): any; - getRecentFrames(last: number): any; - getRecentMemoryUsage(last: number): any; - getRecentPaintRequests(last: number): any; - removeEventListener(eventType: string, callback: Function): void; - repositionWindow(x: number, y: number): void; - resizeWindow(width: number, height: number): void; -} - -declare var PerfWidgetExternal: { - prototype: PerfWidgetExternal; - new(): PerfWidgetExternal; -} - -interface Performance { - navigation: PerformanceNavigation; - timing: PerformanceTiming; - clearMarks(markName?: string): void; - clearMeasures(measureName?: string): void; - clearResourceTimings(): void; - getEntries(): any; - getEntriesByName(name: string, entryType?: string): any; - getEntriesByType(entryType: string): any; - getMarks(markName?: string): any; - getMeasures(measureName?: string): any; - mark(markName: string): void; - measure(measureName: string, startMarkName?: string, endMarkName?: string): void; - now(): number; - setResourceTimingBufferSize(maxSize: number): void; - toJSON(): any; -} - -declare var Performance: { - prototype: Performance; - new(): Performance; -} - -interface PerformanceEntry { - duration: number; - entryType: string; - name: string; - startTime: number; -} - -declare var PerformanceEntry: { - prototype: PerformanceEntry; - new(): PerformanceEntry; -} - -interface PerformanceMark extends PerformanceEntry { -} - -declare var PerformanceMark: { - prototype: PerformanceMark; - new(): PerformanceMark; -} - -interface PerformanceMeasure extends PerformanceEntry { -} - -declare var PerformanceMeasure: { - prototype: PerformanceMeasure; - new(): PerformanceMeasure; -} - -interface PerformanceNavigation { - redirectCount: number; - type: number; - toJSON(): any; - TYPE_BACK_FORWARD: number; - TYPE_NAVIGATE: number; - TYPE_RELOAD: number; - TYPE_RESERVED: number; -} - -declare var PerformanceNavigation: { - prototype: PerformanceNavigation; - new(): PerformanceNavigation; - TYPE_BACK_FORWARD: number; - TYPE_NAVIGATE: number; - TYPE_RELOAD: number; - TYPE_RESERVED: number; -} - -interface PerformanceNavigationTiming extends PerformanceEntry { - connectEnd: number; - connectStart: number; - domComplete: number; - domContentLoadedEventEnd: number; - domContentLoadedEventStart: number; - domInteractive: number; - domLoading: number; - domainLookupEnd: number; - domainLookupStart: number; - fetchStart: number; - loadEventEnd: number; - loadEventStart: number; - navigationStart: number; - redirectCount: number; - redirectEnd: number; - redirectStart: number; - requestStart: number; - responseEnd: number; - responseStart: number; - type: string; - unloadEventEnd: number; - unloadEventStart: number; -} - -declare var PerformanceNavigationTiming: { - prototype: PerformanceNavigationTiming; - new(): PerformanceNavigationTiming; -} - -interface PerformanceResourceTiming extends PerformanceEntry { - connectEnd: number; - connectStart: number; - domainLookupEnd: number; - domainLookupStart: number; - fetchStart: number; - initiatorType: string; - redirectEnd: number; - redirectStart: number; - requestStart: number; - responseEnd: number; - responseStart: number; -} - -declare var PerformanceResourceTiming: { - prototype: PerformanceResourceTiming; - new(): PerformanceResourceTiming; -} - -interface PerformanceTiming { - connectEnd: number; - connectStart: number; - domComplete: number; - domContentLoadedEventEnd: number; - domContentLoadedEventStart: number; - domInteractive: number; - domLoading: number; - domainLookupEnd: number; - domainLookupStart: number; - fetchStart: number; - loadEventEnd: number; - loadEventStart: number; - msFirstPaint: number; - navigationStart: number; - redirectEnd: number; - redirectStart: number; - requestStart: number; - responseEnd: number; - responseStart: number; - unloadEventEnd: number; - unloadEventStart: number; - toJSON(): any; -} - -declare var PerformanceTiming: { - prototype: PerformanceTiming; - new(): PerformanceTiming; -} - -interface PeriodicWave { -} - -declare var PeriodicWave: { - prototype: PeriodicWave; - new(): PeriodicWave; -} - -interface PermissionRequest extends DeferredPermissionRequest { - state: string; - defer(): void; -} - -declare var PermissionRequest: { - prototype: PermissionRequest; - new(): PermissionRequest; -} - -interface PermissionRequestedEvent extends Event { - permissionRequest: PermissionRequest; -} - -declare var PermissionRequestedEvent: { - prototype: PermissionRequestedEvent; - new(): PermissionRequestedEvent; -} - -interface Plugin { - description: string; - filename: string; - length: number; - name: string; - version: string; - item(index: number): MimeType; - namedItem(type: string): MimeType; - [index: number]: MimeType; -} - -declare var Plugin: { - prototype: Plugin; - new(): Plugin; -} - -interface PluginArray { - length: number; - item(index: number): Plugin; - namedItem(name: string): Plugin; - refresh(reload?: boolean): void; - [index: number]: Plugin; -} - -declare var PluginArray: { - prototype: PluginArray; - new(): PluginArray; -} - -interface PointerEvent extends MouseEvent { - currentPoint: any; - height: number; - hwTimestamp: number; - intermediatePoints: any; - isPrimary: boolean; - pointerId: number; - pointerType: any; - pressure: number; - rotation: number; - tiltX: number; - tiltY: number; - width: number; - getCurrentPoint(element: Element): void; - getIntermediatePoints(element: Element): void; - 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; -} - -declare var PointerEvent: { - prototype: PointerEvent; - new(typeArg: string, eventInitDict?: PointerEventInit): PointerEvent; -} - -interface PopStateEvent extends Event { - state: any; - initPopStateEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, stateArg: any): void; -} - -declare var PopStateEvent: { - prototype: PopStateEvent; - new(): PopStateEvent; -} - -interface Position { - coords: Coordinates; - timestamp: number; -} - -declare var Position: { - prototype: Position; - new(): Position; -} - -interface PositionError { - code: number; - message: string; - toString(): string; - PERMISSION_DENIED: number; - POSITION_UNAVAILABLE: number; - TIMEOUT: number; -} - -declare var PositionError: { - prototype: PositionError; - new(): PositionError; - PERMISSION_DENIED: number; - POSITION_UNAVAILABLE: number; - TIMEOUT: number; -} - -interface ProcessingInstruction extends CharacterData { - target: string; -} - -declare var ProcessingInstruction: { - prototype: ProcessingInstruction; - new(): ProcessingInstruction; -} - -interface ProgressEvent extends Event { - lengthComputable: boolean; - loaded: number; - total: number; - initProgressEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, lengthComputableArg: boolean, loadedArg: number, totalArg: number): void; -} - -declare var ProgressEvent: { - prototype: ProgressEvent; - new(type: string, eventInitDict?: ProgressEventInit): ProgressEvent; -} - -interface Range { - collapsed: boolean; - commonAncestorContainer: Node; - endContainer: Node; - endOffset: number; - startContainer: Node; - startOffset: number; - cloneContents(): DocumentFragment; - cloneRange(): Range; - collapse(toStart: boolean): void; - compareBoundaryPoints(how: number, sourceRange: Range): number; - createContextualFragment(fragment: string): DocumentFragment; - deleteContents(): void; - detach(): void; - expand(Unit: string): boolean; - extractContents(): DocumentFragment; - getBoundingClientRect(): ClientRect; - getClientRects(): ClientRectList; - insertNode(newNode: Node): void; - selectNode(refNode: Node): void; - selectNodeContents(refNode: Node): void; - setEnd(refNode: Node, offset: number): void; - setEndAfter(refNode: Node): void; - setEndBefore(refNode: Node): void; - setStart(refNode: Node, offset: number): void; - setStartAfter(refNode: Node): void; - setStartBefore(refNode: Node): void; - surroundContents(newParent: Node): void; - toString(): string; - END_TO_END: number; - END_TO_START: number; - START_TO_END: number; - START_TO_START: number; -} - -declare var Range: { - prototype: Range; - new(): Range; - END_TO_END: number; - END_TO_START: number; - START_TO_END: number; - START_TO_START: number; -} - -interface SVGAElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired, SVGURIReference { - target: SVGAnimatedString; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGAElement: { - prototype: SVGAElement; - new(): SVGAElement; -} - -interface SVGAngle { - unitType: number; - value: number; - valueAsString: string; - valueInSpecifiedUnits: number; - convertToSpecifiedUnits(unitType: number): void; - newValueSpecifiedUnits(unitType: number, valueInSpecifiedUnits: number): void; - SVG_ANGLETYPE_DEG: number; - SVG_ANGLETYPE_GRAD: number; - SVG_ANGLETYPE_RAD: number; - SVG_ANGLETYPE_UNKNOWN: number; - SVG_ANGLETYPE_UNSPECIFIED: number; -} - -declare var SVGAngle: { - prototype: SVGAngle; - new(): SVGAngle; - SVG_ANGLETYPE_DEG: number; - SVG_ANGLETYPE_GRAD: number; - SVG_ANGLETYPE_RAD: number; - SVG_ANGLETYPE_UNKNOWN: number; - SVG_ANGLETYPE_UNSPECIFIED: number; -} - -interface SVGAnimatedAngle { - animVal: SVGAngle; - baseVal: SVGAngle; -} - -declare var SVGAnimatedAngle: { - prototype: SVGAnimatedAngle; - new(): SVGAnimatedAngle; -} - -interface SVGAnimatedBoolean { - animVal: boolean; - baseVal: boolean; -} - -declare var SVGAnimatedBoolean: { - prototype: SVGAnimatedBoolean; - new(): SVGAnimatedBoolean; -} - -interface SVGAnimatedEnumeration { - animVal: number; - baseVal: number; -} - -declare var SVGAnimatedEnumeration: { - prototype: SVGAnimatedEnumeration; - new(): SVGAnimatedEnumeration; -} - -interface SVGAnimatedInteger { - animVal: number; - baseVal: number; -} - -declare var SVGAnimatedInteger: { - prototype: SVGAnimatedInteger; - new(): SVGAnimatedInteger; -} - -interface SVGAnimatedLength { - animVal: SVGLength; - baseVal: SVGLength; -} - -declare var SVGAnimatedLength: { - prototype: SVGAnimatedLength; - new(): SVGAnimatedLength; -} - -interface SVGAnimatedLengthList { - animVal: SVGLengthList; - baseVal: SVGLengthList; -} - -declare var SVGAnimatedLengthList: { - prototype: SVGAnimatedLengthList; - new(): SVGAnimatedLengthList; -} - -interface SVGAnimatedNumber { - animVal: number; - baseVal: number; -} - -declare var SVGAnimatedNumber: { - prototype: SVGAnimatedNumber; - new(): SVGAnimatedNumber; -} - -interface SVGAnimatedNumberList { - animVal: SVGNumberList; - baseVal: SVGNumberList; -} - -declare var SVGAnimatedNumberList: { - prototype: SVGAnimatedNumberList; - new(): SVGAnimatedNumberList; -} - -interface SVGAnimatedPreserveAspectRatio { - animVal: SVGPreserveAspectRatio; - baseVal: SVGPreserveAspectRatio; -} - -declare var SVGAnimatedPreserveAspectRatio: { - prototype: SVGAnimatedPreserveAspectRatio; - new(): SVGAnimatedPreserveAspectRatio; -} - -interface SVGAnimatedRect { - animVal: SVGRect; - baseVal: SVGRect; -} - -declare var SVGAnimatedRect: { - prototype: SVGAnimatedRect; - new(): SVGAnimatedRect; -} - -interface SVGAnimatedString { - animVal: string; - baseVal: string; -} - -declare var SVGAnimatedString: { - prototype: SVGAnimatedString; - new(): SVGAnimatedString; -} - -interface SVGAnimatedTransformList { - animVal: SVGTransformList; - baseVal: SVGTransformList; -} - -declare var SVGAnimatedTransformList: { - prototype: SVGAnimatedTransformList; - new(): SVGAnimatedTransformList; -} - -interface SVGCircleElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired { - cx: SVGAnimatedLength; - cy: SVGAnimatedLength; - r: SVGAnimatedLength; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGCircleElement: { - prototype: SVGCircleElement; - new(): SVGCircleElement; -} - -interface SVGClipPathElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired, SVGUnitTypes { - clipPathUnits: SVGAnimatedEnumeration; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGClipPathElement: { - prototype: SVGClipPathElement; - new(): SVGClipPathElement; -} - -interface SVGComponentTransferFunctionElement extends SVGElement { - amplitude: SVGAnimatedNumber; - exponent: SVGAnimatedNumber; - intercept: SVGAnimatedNumber; - offset: SVGAnimatedNumber; - slope: SVGAnimatedNumber; - tableValues: SVGAnimatedNumberList; - type: SVGAnimatedEnumeration; - SVG_FECOMPONENTTRANSFER_TYPE_DISCRETE: number; - SVG_FECOMPONENTTRANSFER_TYPE_GAMMA: number; - SVG_FECOMPONENTTRANSFER_TYPE_IDENTITY: number; - SVG_FECOMPONENTTRANSFER_TYPE_LINEAR: number; - SVG_FECOMPONENTTRANSFER_TYPE_TABLE: number; - SVG_FECOMPONENTTRANSFER_TYPE_UNKNOWN: number; -} - -declare var SVGComponentTransferFunctionElement: { - prototype: SVGComponentTransferFunctionElement; - new(): SVGComponentTransferFunctionElement; - SVG_FECOMPONENTTRANSFER_TYPE_DISCRETE: number; - SVG_FECOMPONENTTRANSFER_TYPE_GAMMA: number; - SVG_FECOMPONENTTRANSFER_TYPE_IDENTITY: number; - SVG_FECOMPONENTTRANSFER_TYPE_LINEAR: number; - SVG_FECOMPONENTTRANSFER_TYPE_TABLE: number; - SVG_FECOMPONENTTRANSFER_TYPE_UNKNOWN: number; -} - -interface SVGDefsElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired { - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGDefsElement: { - prototype: SVGDefsElement; - new(): SVGDefsElement; -} - -interface SVGDescElement extends SVGElement, SVGStylable, SVGLangSpace { - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGDescElement: { - prototype: SVGDescElement; - new(): SVGDescElement; -} - -interface SVGElement extends Element { - id: string; - onclick: (ev: MouseEvent) => any; - ondblclick: (ev: MouseEvent) => any; - onfocusin: (ev: FocusEvent) => any; - onfocusout: (ev: FocusEvent) => any; - onload: (ev: Event) => any; - onmousedown: (ev: MouseEvent) => any; - onmousemove: (ev: MouseEvent) => any; - onmouseout: (ev: MouseEvent) => any; - onmouseover: (ev: MouseEvent) => any; - onmouseup: (ev: MouseEvent) => any; - ownerSVGElement: SVGSVGElement; - viewportElement: SVGElement; - xmlbase: string; - className: any; - addEventListener(type: "MSGestureChange", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureDoubleTap", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureEnd", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureHold", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureStart", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureTap", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGotPointerCapture", listener: (ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSInertiaStart", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSLostPointerCapture", listener: (ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerCancel", listener: (ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerDown", listener: (ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerEnter", listener: (ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerLeave", listener: (ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerMove", listener: (ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerOut", listener: (ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerOver", listener: (ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerUp", listener: (ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "ariarequest", listener: (ev: AriaRequestEvent) => any, useCapture?: boolean): void; - addEventListener(type: "click", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "command", listener: (ev: CommandEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dblclick", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "focusin", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "focusout", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "gotpointercapture", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "load", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "lostpointercapture", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousedown", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousemove", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseout", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseover", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseup", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointercancel", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerdown", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerenter", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerleave", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointermove", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerout", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerover", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerup", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchcancel", listener: (ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchend", listener: (ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchmove", listener: (ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchstart", listener: (ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "webkitfullscreenchange", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "webkitfullscreenerror", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "wheel", listener: (ev: WheelEvent) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGElement: { - prototype: SVGElement; - new(): SVGElement; -} - -interface SVGElementInstance extends EventTarget { - childNodes: SVGElementInstanceList; - correspondingElement: SVGElement; - correspondingUseElement: SVGUseElement; - firstChild: SVGElementInstance; - lastChild: SVGElementInstance; - nextSibling: SVGElementInstance; - parentNode: SVGElementInstance; - previousSibling: SVGElementInstance; -} - -declare var SVGElementInstance: { - prototype: SVGElementInstance; - new(): SVGElementInstance; -} - -interface SVGElementInstanceList { - length: number; - item(index: number): SVGElementInstance; -} - -declare var SVGElementInstanceList: { - prototype: SVGElementInstanceList; - new(): SVGElementInstanceList; -} - -interface SVGEllipseElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired { - cx: SVGAnimatedLength; - cy: SVGAnimatedLength; - rx: SVGAnimatedLength; - ry: SVGAnimatedLength; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGEllipseElement: { - prototype: SVGEllipseElement; - new(): SVGEllipseElement; -} - -interface SVGFEBlendElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { - in1: SVGAnimatedString; - in2: SVGAnimatedString; - mode: SVGAnimatedEnumeration; - SVG_FEBLEND_MODE_COLOR: number; - SVG_FEBLEND_MODE_COLOR_BURN: number; - SVG_FEBLEND_MODE_COLOR_DODGE: number; - SVG_FEBLEND_MODE_DARKEN: number; - SVG_FEBLEND_MODE_DIFFERENCE: number; - SVG_FEBLEND_MODE_EXCLUSION: number; - SVG_FEBLEND_MODE_HARD_LIGHT: number; - SVG_FEBLEND_MODE_HUE: number; - SVG_FEBLEND_MODE_LIGHTEN: number; - SVG_FEBLEND_MODE_LUMINOSITY: number; - SVG_FEBLEND_MODE_MULTIPLY: number; - SVG_FEBLEND_MODE_NORMAL: number; - SVG_FEBLEND_MODE_OVERLAY: number; - SVG_FEBLEND_MODE_SATURATION: number; - SVG_FEBLEND_MODE_SCREEN: number; - SVG_FEBLEND_MODE_SOFT_LIGHT: number; - SVG_FEBLEND_MODE_UNKNOWN: number; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGFEBlendElement: { - prototype: SVGFEBlendElement; - new(): SVGFEBlendElement; - SVG_FEBLEND_MODE_COLOR: number; - SVG_FEBLEND_MODE_COLOR_BURN: number; - SVG_FEBLEND_MODE_COLOR_DODGE: number; - SVG_FEBLEND_MODE_DARKEN: number; - SVG_FEBLEND_MODE_DIFFERENCE: number; - SVG_FEBLEND_MODE_EXCLUSION: number; - SVG_FEBLEND_MODE_HARD_LIGHT: number; - SVG_FEBLEND_MODE_HUE: number; - SVG_FEBLEND_MODE_LIGHTEN: number; - SVG_FEBLEND_MODE_LUMINOSITY: number; - SVG_FEBLEND_MODE_MULTIPLY: number; - SVG_FEBLEND_MODE_NORMAL: number; - SVG_FEBLEND_MODE_OVERLAY: number; - SVG_FEBLEND_MODE_SATURATION: number; - SVG_FEBLEND_MODE_SCREEN: number; - SVG_FEBLEND_MODE_SOFT_LIGHT: number; - SVG_FEBLEND_MODE_UNKNOWN: number; -} - -interface SVGFEColorMatrixElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { - in1: SVGAnimatedString; - type: SVGAnimatedEnumeration; - values: SVGAnimatedNumberList; - SVG_FECOLORMATRIX_TYPE_HUEROTATE: number; - SVG_FECOLORMATRIX_TYPE_LUMINANCETOALPHA: number; - SVG_FECOLORMATRIX_TYPE_MATRIX: number; - SVG_FECOLORMATRIX_TYPE_SATURATE: number; - SVG_FECOLORMATRIX_TYPE_UNKNOWN: number; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGFEColorMatrixElement: { - prototype: SVGFEColorMatrixElement; - new(): SVGFEColorMatrixElement; - SVG_FECOLORMATRIX_TYPE_HUEROTATE: number; - SVG_FECOLORMATRIX_TYPE_LUMINANCETOALPHA: number; - SVG_FECOLORMATRIX_TYPE_MATRIX: number; - SVG_FECOLORMATRIX_TYPE_SATURATE: number; - SVG_FECOLORMATRIX_TYPE_UNKNOWN: number; -} - -interface SVGFEComponentTransferElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { - in1: SVGAnimatedString; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGFEComponentTransferElement: { - prototype: SVGFEComponentTransferElement; - new(): SVGFEComponentTransferElement; -} - -interface SVGFECompositeElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { - in1: SVGAnimatedString; - in2: SVGAnimatedString; - k1: SVGAnimatedNumber; - k2: SVGAnimatedNumber; - k3: SVGAnimatedNumber; - k4: SVGAnimatedNumber; - operator: SVGAnimatedEnumeration; - SVG_FECOMPOSITE_OPERATOR_ARITHMETIC: number; - SVG_FECOMPOSITE_OPERATOR_ATOP: number; - SVG_FECOMPOSITE_OPERATOR_IN: number; - SVG_FECOMPOSITE_OPERATOR_OUT: number; - SVG_FECOMPOSITE_OPERATOR_OVER: number; - SVG_FECOMPOSITE_OPERATOR_UNKNOWN: number; - SVG_FECOMPOSITE_OPERATOR_XOR: number; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGFECompositeElement: { - prototype: SVGFECompositeElement; - new(): SVGFECompositeElement; - SVG_FECOMPOSITE_OPERATOR_ARITHMETIC: number; - SVG_FECOMPOSITE_OPERATOR_ATOP: number; - SVG_FECOMPOSITE_OPERATOR_IN: number; - SVG_FECOMPOSITE_OPERATOR_OUT: number; - SVG_FECOMPOSITE_OPERATOR_OVER: number; - SVG_FECOMPOSITE_OPERATOR_UNKNOWN: number; - SVG_FECOMPOSITE_OPERATOR_XOR: number; -} - -interface SVGFEConvolveMatrixElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { - bias: SVGAnimatedNumber; - divisor: SVGAnimatedNumber; - edgeMode: SVGAnimatedEnumeration; - in1: SVGAnimatedString; - kernelMatrix: SVGAnimatedNumberList; - kernelUnitLengthX: SVGAnimatedNumber; - kernelUnitLengthY: SVGAnimatedNumber; - orderX: SVGAnimatedInteger; - orderY: SVGAnimatedInteger; - preserveAlpha: SVGAnimatedBoolean; - targetX: SVGAnimatedInteger; - targetY: SVGAnimatedInteger; - SVG_EDGEMODE_DUPLICATE: number; - SVG_EDGEMODE_NONE: number; - SVG_EDGEMODE_UNKNOWN: number; - SVG_EDGEMODE_WRAP: number; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGFEConvolveMatrixElement: { - prototype: SVGFEConvolveMatrixElement; - new(): SVGFEConvolveMatrixElement; - SVG_EDGEMODE_DUPLICATE: number; - SVG_EDGEMODE_NONE: number; - SVG_EDGEMODE_UNKNOWN: number; - SVG_EDGEMODE_WRAP: number; -} - -interface SVGFEDiffuseLightingElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { - diffuseConstant: SVGAnimatedNumber; - in1: SVGAnimatedString; - kernelUnitLengthX: SVGAnimatedNumber; - kernelUnitLengthY: SVGAnimatedNumber; - surfaceScale: SVGAnimatedNumber; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGFEDiffuseLightingElement: { - prototype: SVGFEDiffuseLightingElement; - new(): SVGFEDiffuseLightingElement; -} - -interface SVGFEDisplacementMapElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { - in1: SVGAnimatedString; - in2: SVGAnimatedString; - scale: SVGAnimatedNumber; - xChannelSelector: SVGAnimatedEnumeration; - yChannelSelector: SVGAnimatedEnumeration; - SVG_CHANNEL_A: number; - SVG_CHANNEL_B: number; - SVG_CHANNEL_G: number; - SVG_CHANNEL_R: number; - SVG_CHANNEL_UNKNOWN: number; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGFEDisplacementMapElement: { - prototype: SVGFEDisplacementMapElement; - new(): SVGFEDisplacementMapElement; - SVG_CHANNEL_A: number; - SVG_CHANNEL_B: number; - SVG_CHANNEL_G: number; - SVG_CHANNEL_R: number; - SVG_CHANNEL_UNKNOWN: number; -} - -interface SVGFEDistantLightElement extends SVGElement { - azimuth: SVGAnimatedNumber; - elevation: SVGAnimatedNumber; -} - -declare var SVGFEDistantLightElement: { - prototype: SVGFEDistantLightElement; - new(): SVGFEDistantLightElement; -} - -interface SVGFEFloodElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGFEFloodElement: { - prototype: SVGFEFloodElement; - new(): SVGFEFloodElement; -} - -interface SVGFEFuncAElement extends SVGComponentTransferFunctionElement { -} - -declare var SVGFEFuncAElement: { - prototype: SVGFEFuncAElement; - new(): SVGFEFuncAElement; -} - -interface SVGFEFuncBElement extends SVGComponentTransferFunctionElement { -} - -declare var SVGFEFuncBElement: { - prototype: SVGFEFuncBElement; - new(): SVGFEFuncBElement; -} - -interface SVGFEFuncGElement extends SVGComponentTransferFunctionElement { -} - -declare var SVGFEFuncGElement: { - prototype: SVGFEFuncGElement; - new(): SVGFEFuncGElement; -} - -interface SVGFEFuncRElement extends SVGComponentTransferFunctionElement { -} - -declare var SVGFEFuncRElement: { - prototype: SVGFEFuncRElement; - new(): SVGFEFuncRElement; -} - -interface SVGFEGaussianBlurElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { - in1: SVGAnimatedString; - stdDeviationX: SVGAnimatedNumber; - stdDeviationY: SVGAnimatedNumber; - setStdDeviation(stdDeviationX: number, stdDeviationY: number): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGFEGaussianBlurElement: { - prototype: SVGFEGaussianBlurElement; - new(): SVGFEGaussianBlurElement; -} - -interface SVGFEImageElement extends SVGElement, SVGFilterPrimitiveStandardAttributes, SVGLangSpace, SVGURIReference, SVGExternalResourcesRequired { - preserveAspectRatio: SVGAnimatedPreserveAspectRatio; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGFEImageElement: { - prototype: SVGFEImageElement; - new(): SVGFEImageElement; -} - -interface SVGFEMergeElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGFEMergeElement: { - prototype: SVGFEMergeElement; - new(): SVGFEMergeElement; -} - -interface SVGFEMergeNodeElement extends SVGElement { - in1: SVGAnimatedString; -} - -declare var SVGFEMergeNodeElement: { - prototype: SVGFEMergeNodeElement; - new(): SVGFEMergeNodeElement; -} - -interface SVGFEMorphologyElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { - in1: SVGAnimatedString; - operator: SVGAnimatedEnumeration; - radiusX: SVGAnimatedNumber; - radiusY: SVGAnimatedNumber; - SVG_MORPHOLOGY_OPERATOR_DILATE: number; - SVG_MORPHOLOGY_OPERATOR_ERODE: number; - SVG_MORPHOLOGY_OPERATOR_UNKNOWN: number; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGFEMorphologyElement: { - prototype: SVGFEMorphologyElement; - new(): SVGFEMorphologyElement; - SVG_MORPHOLOGY_OPERATOR_DILATE: number; - SVG_MORPHOLOGY_OPERATOR_ERODE: number; - SVG_MORPHOLOGY_OPERATOR_UNKNOWN: number; -} - -interface SVGFEOffsetElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { - dx: SVGAnimatedNumber; - dy: SVGAnimatedNumber; - in1: SVGAnimatedString; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGFEOffsetElement: { - prototype: SVGFEOffsetElement; - new(): SVGFEOffsetElement; -} - -interface SVGFEPointLightElement extends SVGElement { - x: SVGAnimatedNumber; - y: SVGAnimatedNumber; - z: SVGAnimatedNumber; -} - -declare var SVGFEPointLightElement: { - prototype: SVGFEPointLightElement; - new(): SVGFEPointLightElement; -} - -interface SVGFESpecularLightingElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { - in1: SVGAnimatedString; - kernelUnitLengthX: SVGAnimatedNumber; - kernelUnitLengthY: SVGAnimatedNumber; - specularConstant: SVGAnimatedNumber; - specularExponent: SVGAnimatedNumber; - surfaceScale: SVGAnimatedNumber; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGFESpecularLightingElement: { - prototype: SVGFESpecularLightingElement; - new(): SVGFESpecularLightingElement; -} - -interface SVGFESpotLightElement extends SVGElement { - limitingConeAngle: SVGAnimatedNumber; - pointsAtX: SVGAnimatedNumber; - pointsAtY: SVGAnimatedNumber; - pointsAtZ: SVGAnimatedNumber; - specularExponent: SVGAnimatedNumber; - x: SVGAnimatedNumber; - y: SVGAnimatedNumber; - z: SVGAnimatedNumber; -} - -declare var SVGFESpotLightElement: { - prototype: SVGFESpotLightElement; - new(): SVGFESpotLightElement; -} - -interface SVGFETileElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { - in1: SVGAnimatedString; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGFETileElement: { - prototype: SVGFETileElement; - new(): SVGFETileElement; -} - -interface SVGFETurbulenceElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { - baseFrequencyX: SVGAnimatedNumber; - baseFrequencyY: SVGAnimatedNumber; - numOctaves: SVGAnimatedInteger; - seed: SVGAnimatedNumber; - stitchTiles: SVGAnimatedEnumeration; - type: SVGAnimatedEnumeration; - SVG_STITCHTYPE_NOSTITCH: number; - SVG_STITCHTYPE_STITCH: number; - SVG_STITCHTYPE_UNKNOWN: number; - SVG_TURBULENCE_TYPE_FRACTALNOISE: number; - SVG_TURBULENCE_TYPE_TURBULENCE: number; - SVG_TURBULENCE_TYPE_UNKNOWN: number; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGFETurbulenceElement: { - prototype: SVGFETurbulenceElement; - new(): SVGFETurbulenceElement; - SVG_STITCHTYPE_NOSTITCH: number; - SVG_STITCHTYPE_STITCH: number; - SVG_STITCHTYPE_UNKNOWN: number; - SVG_TURBULENCE_TYPE_FRACTALNOISE: number; - SVG_TURBULENCE_TYPE_TURBULENCE: number; - SVG_TURBULENCE_TYPE_UNKNOWN: number; -} - -interface SVGFilterElement extends SVGElement, SVGUnitTypes, SVGStylable, SVGLangSpace, SVGURIReference, SVGExternalResourcesRequired { - filterResX: SVGAnimatedInteger; - filterResY: SVGAnimatedInteger; - filterUnits: SVGAnimatedEnumeration; - height: SVGAnimatedLength; - primitiveUnits: SVGAnimatedEnumeration; - width: SVGAnimatedLength; - x: SVGAnimatedLength; - y: SVGAnimatedLength; - setFilterRes(filterResX: number, filterResY: number): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGFilterElement: { - prototype: SVGFilterElement; - new(): SVGFilterElement; -} - -interface SVGForeignObjectElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired { - height: SVGAnimatedLength; - width: SVGAnimatedLength; - x: SVGAnimatedLength; - y: SVGAnimatedLength; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGForeignObjectElement: { - prototype: SVGForeignObjectElement; - new(): SVGForeignObjectElement; -} - -interface SVGGElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired { - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGGElement: { - prototype: SVGGElement; - new(): SVGGElement; -} - -interface SVGGradientElement extends SVGElement, SVGStylable, SVGExternalResourcesRequired, SVGURIReference, SVGUnitTypes { - gradientTransform: SVGAnimatedTransformList; - gradientUnits: SVGAnimatedEnumeration; - spreadMethod: SVGAnimatedEnumeration; - SVG_SPREADMETHOD_PAD: number; - SVG_SPREADMETHOD_REFLECT: number; - SVG_SPREADMETHOD_REPEAT: number; - SVG_SPREADMETHOD_UNKNOWN: number; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGGradientElement: { - prototype: SVGGradientElement; - new(): SVGGradientElement; - SVG_SPREADMETHOD_PAD: number; - SVG_SPREADMETHOD_REFLECT: number; - SVG_SPREADMETHOD_REPEAT: number; - SVG_SPREADMETHOD_UNKNOWN: number; -} - -interface SVGImageElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired, SVGURIReference { - height: SVGAnimatedLength; - preserveAspectRatio: SVGAnimatedPreserveAspectRatio; - width: SVGAnimatedLength; - x: SVGAnimatedLength; - y: SVGAnimatedLength; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGImageElement: { - prototype: SVGImageElement; - new(): SVGImageElement; -} - -interface SVGLength { - unitType: number; - value: number; - valueAsString: string; - valueInSpecifiedUnits: number; - convertToSpecifiedUnits(unitType: number): void; - newValueSpecifiedUnits(unitType: number, valueInSpecifiedUnits: number): void; - SVG_LENGTHTYPE_CM: number; - SVG_LENGTHTYPE_EMS: number; - SVG_LENGTHTYPE_EXS: number; - SVG_LENGTHTYPE_IN: number; - SVG_LENGTHTYPE_MM: number; - SVG_LENGTHTYPE_NUMBER: number; - SVG_LENGTHTYPE_PC: number; - SVG_LENGTHTYPE_PERCENTAGE: number; - SVG_LENGTHTYPE_PT: number; - SVG_LENGTHTYPE_PX: number; - SVG_LENGTHTYPE_UNKNOWN: number; -} - -declare var SVGLength: { - prototype: SVGLength; - new(): SVGLength; - SVG_LENGTHTYPE_CM: number; - SVG_LENGTHTYPE_EMS: number; - SVG_LENGTHTYPE_EXS: number; - SVG_LENGTHTYPE_IN: number; - SVG_LENGTHTYPE_MM: number; - SVG_LENGTHTYPE_NUMBER: number; - SVG_LENGTHTYPE_PC: number; - SVG_LENGTHTYPE_PERCENTAGE: number; - SVG_LENGTHTYPE_PT: number; - SVG_LENGTHTYPE_PX: number; - SVG_LENGTHTYPE_UNKNOWN: number; -} - -interface SVGLengthList { - numberOfItems: number; - appendItem(newItem: SVGLength): SVGLength; - clear(): void; - getItem(index: number): SVGLength; - initialize(newItem: SVGLength): SVGLength; - insertItemBefore(newItem: SVGLength, index: number): SVGLength; - removeItem(index: number): SVGLength; - replaceItem(newItem: SVGLength, index: number): SVGLength; -} - -declare var SVGLengthList: { - prototype: SVGLengthList; - new(): SVGLengthList; -} - -interface SVGLineElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired { - x1: SVGAnimatedLength; - x2: SVGAnimatedLength; - y1: SVGAnimatedLength; - y2: SVGAnimatedLength; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGLineElement: { - prototype: SVGLineElement; - new(): SVGLineElement; -} - -interface SVGLinearGradientElement extends SVGGradientElement { - x1: SVGAnimatedLength; - x2: SVGAnimatedLength; - y1: SVGAnimatedLength; - y2: SVGAnimatedLength; -} - -declare var SVGLinearGradientElement: { - prototype: SVGLinearGradientElement; - new(): SVGLinearGradientElement; -} - -interface SVGMarkerElement extends SVGElement, SVGStylable, SVGLangSpace, SVGExternalResourcesRequired, SVGFitToViewBox { - markerHeight: SVGAnimatedLength; - markerUnits: SVGAnimatedEnumeration; - markerWidth: SVGAnimatedLength; - orientAngle: SVGAnimatedAngle; - orientType: SVGAnimatedEnumeration; - refX: SVGAnimatedLength; - refY: SVGAnimatedLength; - setOrientToAngle(angle: SVGAngle): void; - setOrientToAuto(): void; - SVG_MARKERUNITS_STROKEWIDTH: number; - SVG_MARKERUNITS_UNKNOWN: number; - SVG_MARKERUNITS_USERSPACEONUSE: number; - SVG_MARKER_ORIENT_ANGLE: number; - SVG_MARKER_ORIENT_AUTO: number; - SVG_MARKER_ORIENT_UNKNOWN: number; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGMarkerElement: { - prototype: SVGMarkerElement; - new(): SVGMarkerElement; - SVG_MARKERUNITS_STROKEWIDTH: number; - SVG_MARKERUNITS_UNKNOWN: number; - SVG_MARKERUNITS_USERSPACEONUSE: number; - SVG_MARKER_ORIENT_ANGLE: number; - SVG_MARKER_ORIENT_AUTO: number; - SVG_MARKER_ORIENT_UNKNOWN: number; -} - -interface SVGMaskElement extends SVGElement, SVGStylable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired, SVGUnitTypes { - height: SVGAnimatedLength; - maskContentUnits: SVGAnimatedEnumeration; - maskUnits: SVGAnimatedEnumeration; - width: SVGAnimatedLength; - x: SVGAnimatedLength; - y: SVGAnimatedLength; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGMaskElement: { - prototype: SVGMaskElement; - new(): SVGMaskElement; -} - -interface SVGMatrix { - a: number; - b: number; - c: number; - d: number; - e: number; - f: number; - flipX(): SVGMatrix; - flipY(): SVGMatrix; - inverse(): SVGMatrix; - multiply(secondMatrix: SVGMatrix): SVGMatrix; - rotate(angle: number): SVGMatrix; - rotateFromVector(x: number, y: number): SVGMatrix; - scale(scaleFactor: number): SVGMatrix; - scaleNonUniform(scaleFactorX: number, scaleFactorY: number): SVGMatrix; - skewX(angle: number): SVGMatrix; - skewY(angle: number): SVGMatrix; - translate(x: number, y: number): SVGMatrix; -} - -declare var SVGMatrix: { - prototype: SVGMatrix; - new(): SVGMatrix; -} - -interface SVGMetadataElement extends SVGElement { -} - -declare var SVGMetadataElement: { - prototype: SVGMetadataElement; - new(): SVGMetadataElement; -} - -interface SVGNumber { - value: number; -} - -declare var SVGNumber: { - prototype: SVGNumber; - new(): SVGNumber; -} - -interface SVGNumberList { - numberOfItems: number; - appendItem(newItem: SVGNumber): SVGNumber; - clear(): void; - getItem(index: number): SVGNumber; - initialize(newItem: SVGNumber): SVGNumber; - insertItemBefore(newItem: SVGNumber, index: number): SVGNumber; - removeItem(index: number): SVGNumber; - replaceItem(newItem: SVGNumber, index: number): SVGNumber; -} - -declare var SVGNumberList: { - prototype: SVGNumberList; - new(): SVGNumberList; -} - -interface SVGPathElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired, SVGAnimatedPathData { - createSVGPathSegArcAbs(x: number, y: number, r1: number, r2: number, angle: number, largeArcFlag: boolean, sweepFlag: boolean): SVGPathSegArcAbs; - createSVGPathSegArcRel(x: number, y: number, r1: number, r2: number, angle: number, largeArcFlag: boolean, sweepFlag: boolean): SVGPathSegArcRel; - createSVGPathSegClosePath(): SVGPathSegClosePath; - createSVGPathSegCurvetoCubicAbs(x: number, y: number, x1: number, y1: number, x2: number, y2: number): SVGPathSegCurvetoCubicAbs; - createSVGPathSegCurvetoCubicRel(x: number, y: number, x1: number, y1: number, x2: number, y2: number): SVGPathSegCurvetoCubicRel; - createSVGPathSegCurvetoCubicSmoothAbs(x: number, y: number, x2: number, y2: number): SVGPathSegCurvetoCubicSmoothAbs; - createSVGPathSegCurvetoCubicSmoothRel(x: number, y: number, x2: number, y2: number): SVGPathSegCurvetoCubicSmoothRel; - createSVGPathSegCurvetoQuadraticAbs(x: number, y: number, x1: number, y1: number): SVGPathSegCurvetoQuadraticAbs; - createSVGPathSegCurvetoQuadraticRel(x: number, y: number, x1: number, y1: number): SVGPathSegCurvetoQuadraticRel; - createSVGPathSegCurvetoQuadraticSmoothAbs(x: number, y: number): SVGPathSegCurvetoQuadraticSmoothAbs; - createSVGPathSegCurvetoQuadraticSmoothRel(x: number, y: number): SVGPathSegCurvetoQuadraticSmoothRel; - createSVGPathSegLinetoAbs(x: number, y: number): SVGPathSegLinetoAbs; - createSVGPathSegLinetoHorizontalAbs(x: number): SVGPathSegLinetoHorizontalAbs; - createSVGPathSegLinetoHorizontalRel(x: number): SVGPathSegLinetoHorizontalRel; - createSVGPathSegLinetoRel(x: number, y: number): SVGPathSegLinetoRel; - createSVGPathSegLinetoVerticalAbs(y: number): SVGPathSegLinetoVerticalAbs; - createSVGPathSegLinetoVerticalRel(y: number): SVGPathSegLinetoVerticalRel; - createSVGPathSegMovetoAbs(x: number, y: number): SVGPathSegMovetoAbs; - createSVGPathSegMovetoRel(x: number, y: number): SVGPathSegMovetoRel; - getPathSegAtLength(distance: number): number; - getPointAtLength(distance: number): SVGPoint; - getTotalLength(): number; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGPathElement: { - prototype: SVGPathElement; - new(): SVGPathElement; -} - -interface SVGPathSeg { - pathSegType: number; - pathSegTypeAsLetter: string; - PATHSEG_ARC_ABS: number; - PATHSEG_ARC_REL: number; - PATHSEG_CLOSEPATH: number; - PATHSEG_CURVETO_CUBIC_ABS: number; - PATHSEG_CURVETO_CUBIC_REL: number; - PATHSEG_CURVETO_CUBIC_SMOOTH_ABS: number; - PATHSEG_CURVETO_CUBIC_SMOOTH_REL: number; - PATHSEG_CURVETO_QUADRATIC_ABS: number; - PATHSEG_CURVETO_QUADRATIC_REL: number; - PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS: number; - PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL: number; - PATHSEG_LINETO_ABS: number; - PATHSEG_LINETO_HORIZONTAL_ABS: number; - PATHSEG_LINETO_HORIZONTAL_REL: number; - PATHSEG_LINETO_REL: number; - PATHSEG_LINETO_VERTICAL_ABS: number; - PATHSEG_LINETO_VERTICAL_REL: number; - PATHSEG_MOVETO_ABS: number; - PATHSEG_MOVETO_REL: number; - PATHSEG_UNKNOWN: number; -} - -declare var SVGPathSeg: { - prototype: SVGPathSeg; - new(): SVGPathSeg; - PATHSEG_ARC_ABS: number; - PATHSEG_ARC_REL: number; - PATHSEG_CLOSEPATH: number; - PATHSEG_CURVETO_CUBIC_ABS: number; - PATHSEG_CURVETO_CUBIC_REL: number; - PATHSEG_CURVETO_CUBIC_SMOOTH_ABS: number; - PATHSEG_CURVETO_CUBIC_SMOOTH_REL: number; - PATHSEG_CURVETO_QUADRATIC_ABS: number; - PATHSEG_CURVETO_QUADRATIC_REL: number; - PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS: number; - PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL: number; - PATHSEG_LINETO_ABS: number; - PATHSEG_LINETO_HORIZONTAL_ABS: number; - PATHSEG_LINETO_HORIZONTAL_REL: number; - PATHSEG_LINETO_REL: number; - PATHSEG_LINETO_VERTICAL_ABS: number; - PATHSEG_LINETO_VERTICAL_REL: number; - PATHSEG_MOVETO_ABS: number; - PATHSEG_MOVETO_REL: number; - PATHSEG_UNKNOWN: number; -} - -interface SVGPathSegArcAbs extends SVGPathSeg { - angle: number; - largeArcFlag: boolean; - r1: number; - r2: number; - sweepFlag: boolean; - x: number; - y: number; -} - -declare var SVGPathSegArcAbs: { - prototype: SVGPathSegArcAbs; - new(): SVGPathSegArcAbs; -} - -interface SVGPathSegArcRel extends SVGPathSeg { - angle: number; - largeArcFlag: boolean; - r1: number; - r2: number; - sweepFlag: boolean; - x: number; - y: number; -} - -declare var SVGPathSegArcRel: { - prototype: SVGPathSegArcRel; - new(): SVGPathSegArcRel; -} - -interface SVGPathSegClosePath extends SVGPathSeg { -} - -declare var SVGPathSegClosePath: { - prototype: SVGPathSegClosePath; - new(): SVGPathSegClosePath; -} - -interface SVGPathSegCurvetoCubicAbs extends SVGPathSeg { - x: number; - x1: number; - x2: number; - y: number; - y1: number; - y2: number; -} - -declare var SVGPathSegCurvetoCubicAbs: { - prototype: SVGPathSegCurvetoCubicAbs; - new(): SVGPathSegCurvetoCubicAbs; -} - -interface SVGPathSegCurvetoCubicRel extends SVGPathSeg { - x: number; - x1: number; - x2: number; - y: number; - y1: number; - y2: number; -} - -declare var SVGPathSegCurvetoCubicRel: { - prototype: SVGPathSegCurvetoCubicRel; - new(): SVGPathSegCurvetoCubicRel; -} - -interface SVGPathSegCurvetoCubicSmoothAbs extends SVGPathSeg { - x: number; - x2: number; - y: number; - y2: number; -} - -declare var SVGPathSegCurvetoCubicSmoothAbs: { - prototype: SVGPathSegCurvetoCubicSmoothAbs; - new(): SVGPathSegCurvetoCubicSmoothAbs; -} - -interface SVGPathSegCurvetoCubicSmoothRel extends SVGPathSeg { - x: number; - x2: number; - y: number; - y2: number; -} - -declare var SVGPathSegCurvetoCubicSmoothRel: { - prototype: SVGPathSegCurvetoCubicSmoothRel; - new(): SVGPathSegCurvetoCubicSmoothRel; -} - -interface SVGPathSegCurvetoQuadraticAbs extends SVGPathSeg { - x: number; - x1: number; - y: number; - y1: number; -} - -declare var SVGPathSegCurvetoQuadraticAbs: { - prototype: SVGPathSegCurvetoQuadraticAbs; - new(): SVGPathSegCurvetoQuadraticAbs; -} - -interface SVGPathSegCurvetoQuadraticRel extends SVGPathSeg { - x: number; - x1: number; - y: number; - y1: number; -} - -declare var SVGPathSegCurvetoQuadraticRel: { - prototype: SVGPathSegCurvetoQuadraticRel; - new(): SVGPathSegCurvetoQuadraticRel; -} - -interface SVGPathSegCurvetoQuadraticSmoothAbs extends SVGPathSeg { - x: number; - y: number; -} - -declare var SVGPathSegCurvetoQuadraticSmoothAbs: { - prototype: SVGPathSegCurvetoQuadraticSmoothAbs; - new(): SVGPathSegCurvetoQuadraticSmoothAbs; -} - -interface SVGPathSegCurvetoQuadraticSmoothRel extends SVGPathSeg { - x: number; - y: number; -} - -declare var SVGPathSegCurvetoQuadraticSmoothRel: { - prototype: SVGPathSegCurvetoQuadraticSmoothRel; - new(): SVGPathSegCurvetoQuadraticSmoothRel; -} - -interface SVGPathSegLinetoAbs extends SVGPathSeg { - x: number; - y: number; -} - -declare var SVGPathSegLinetoAbs: { - prototype: SVGPathSegLinetoAbs; - new(): SVGPathSegLinetoAbs; -} - -interface SVGPathSegLinetoHorizontalAbs extends SVGPathSeg { - x: number; -} - -declare var SVGPathSegLinetoHorizontalAbs: { - prototype: SVGPathSegLinetoHorizontalAbs; - new(): SVGPathSegLinetoHorizontalAbs; -} - -interface SVGPathSegLinetoHorizontalRel extends SVGPathSeg { - x: number; -} - -declare var SVGPathSegLinetoHorizontalRel: { - prototype: SVGPathSegLinetoHorizontalRel; - new(): SVGPathSegLinetoHorizontalRel; -} - -interface SVGPathSegLinetoRel extends SVGPathSeg { - x: number; - y: number; -} - -declare var SVGPathSegLinetoRel: { - prototype: SVGPathSegLinetoRel; - new(): SVGPathSegLinetoRel; -} - -interface SVGPathSegLinetoVerticalAbs extends SVGPathSeg { - y: number; -} - -declare var SVGPathSegLinetoVerticalAbs: { - prototype: SVGPathSegLinetoVerticalAbs; - new(): SVGPathSegLinetoVerticalAbs; -} - -interface SVGPathSegLinetoVerticalRel extends SVGPathSeg { - y: number; -} - -declare var SVGPathSegLinetoVerticalRel: { - prototype: SVGPathSegLinetoVerticalRel; - new(): SVGPathSegLinetoVerticalRel; -} - -interface SVGPathSegList { - numberOfItems: number; - appendItem(newItem: SVGPathSeg): SVGPathSeg; - clear(): void; - getItem(index: number): SVGPathSeg; - initialize(newItem: SVGPathSeg): SVGPathSeg; - insertItemBefore(newItem: SVGPathSeg, index: number): SVGPathSeg; - removeItem(index: number): SVGPathSeg; - replaceItem(newItem: SVGPathSeg, index: number): SVGPathSeg; -} - -declare var SVGPathSegList: { - prototype: SVGPathSegList; - new(): SVGPathSegList; -} - -interface SVGPathSegMovetoAbs extends SVGPathSeg { - x: number; - y: number; -} - -declare var SVGPathSegMovetoAbs: { - prototype: SVGPathSegMovetoAbs; - new(): SVGPathSegMovetoAbs; -} - -interface SVGPathSegMovetoRel extends SVGPathSeg { - x: number; - y: number; -} - -declare var SVGPathSegMovetoRel: { - prototype: SVGPathSegMovetoRel; - new(): SVGPathSegMovetoRel; -} - -interface SVGPatternElement extends SVGElement, SVGStylable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired, SVGFitToViewBox, SVGURIReference, SVGUnitTypes { - height: SVGAnimatedLength; - patternContentUnits: SVGAnimatedEnumeration; - patternTransform: SVGAnimatedTransformList; - patternUnits: SVGAnimatedEnumeration; - width: SVGAnimatedLength; - x: SVGAnimatedLength; - y: SVGAnimatedLength; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGPatternElement: { - prototype: SVGPatternElement; - new(): SVGPatternElement; -} - -interface SVGPoint { - x: number; - y: number; - matrixTransform(matrix: SVGMatrix): SVGPoint; -} - -declare var SVGPoint: { - prototype: SVGPoint; - new(): SVGPoint; -} - -interface SVGPointList { - numberOfItems: number; - appendItem(newItem: SVGPoint): SVGPoint; - clear(): void; - getItem(index: number): SVGPoint; - initialize(newItem: SVGPoint): SVGPoint; - insertItemBefore(newItem: SVGPoint, index: number): SVGPoint; - removeItem(index: number): SVGPoint; - replaceItem(newItem: SVGPoint, index: number): SVGPoint; -} - -declare var SVGPointList: { - prototype: SVGPointList; - new(): SVGPointList; -} - -interface SVGPolygonElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired, SVGAnimatedPoints { - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGPolygonElement: { - prototype: SVGPolygonElement; - new(): SVGPolygonElement; -} - -interface SVGPolylineElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired, SVGAnimatedPoints { - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGPolylineElement: { - prototype: SVGPolylineElement; - new(): SVGPolylineElement; -} - -interface SVGPreserveAspectRatio { - align: number; - meetOrSlice: number; - SVG_MEETORSLICE_MEET: number; - SVG_MEETORSLICE_SLICE: number; - SVG_MEETORSLICE_UNKNOWN: number; - SVG_PRESERVEASPECTRATIO_NONE: number; - SVG_PRESERVEASPECTRATIO_UNKNOWN: number; - SVG_PRESERVEASPECTRATIO_XMAXYMAX: number; - SVG_PRESERVEASPECTRATIO_XMAXYMID: number; - SVG_PRESERVEASPECTRATIO_XMAXYMIN: number; - SVG_PRESERVEASPECTRATIO_XMIDYMAX: number; - SVG_PRESERVEASPECTRATIO_XMIDYMID: number; - SVG_PRESERVEASPECTRATIO_XMIDYMIN: number; - SVG_PRESERVEASPECTRATIO_XMINYMAX: number; - SVG_PRESERVEASPECTRATIO_XMINYMID: number; - SVG_PRESERVEASPECTRATIO_XMINYMIN: number; -} - -declare var SVGPreserveAspectRatio: { - prototype: SVGPreserveAspectRatio; - new(): SVGPreserveAspectRatio; - SVG_MEETORSLICE_MEET: number; - SVG_MEETORSLICE_SLICE: number; - SVG_MEETORSLICE_UNKNOWN: number; - SVG_PRESERVEASPECTRATIO_NONE: number; - SVG_PRESERVEASPECTRATIO_UNKNOWN: number; - SVG_PRESERVEASPECTRATIO_XMAXYMAX: number; - SVG_PRESERVEASPECTRATIO_XMAXYMID: number; - SVG_PRESERVEASPECTRATIO_XMAXYMIN: number; - SVG_PRESERVEASPECTRATIO_XMIDYMAX: number; - SVG_PRESERVEASPECTRATIO_XMIDYMID: number; - SVG_PRESERVEASPECTRATIO_XMIDYMIN: number; - SVG_PRESERVEASPECTRATIO_XMINYMAX: number; - SVG_PRESERVEASPECTRATIO_XMINYMID: number; - SVG_PRESERVEASPECTRATIO_XMINYMIN: number; -} - -interface SVGRadialGradientElement extends SVGGradientElement { - cx: SVGAnimatedLength; - cy: SVGAnimatedLength; - fx: SVGAnimatedLength; - fy: SVGAnimatedLength; - r: SVGAnimatedLength; -} - -declare var SVGRadialGradientElement: { - prototype: SVGRadialGradientElement; - new(): SVGRadialGradientElement; -} - -interface SVGRect { - height: number; - width: number; - x: number; - y: number; -} - -declare var SVGRect: { - prototype: SVGRect; - new(): SVGRect; -} - -interface SVGRectElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired { - height: SVGAnimatedLength; - rx: SVGAnimatedLength; - ry: SVGAnimatedLength; - width: SVGAnimatedLength; - x: SVGAnimatedLength; - y: SVGAnimatedLength; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGRectElement: { - prototype: SVGRectElement; - new(): SVGRectElement; -} - -interface SVGSVGElement extends SVGElement, DocumentEvent, SVGLocatable, SVGTests, SVGStylable, SVGLangSpace, SVGExternalResourcesRequired, SVGFitToViewBox, SVGZoomAndPan { - contentScriptType: string; - contentStyleType: string; - currentScale: number; - currentTranslate: SVGPoint; - height: SVGAnimatedLength; - onabort: (ev: Event) => any; - onerror: (ev: Event) => any; - onresize: (ev: UIEvent) => any; - onscroll: (ev: UIEvent) => any; - onunload: (ev: Event) => any; - onzoom: (ev: SVGZoomEvent) => any; - pixelUnitToMillimeterX: number; - pixelUnitToMillimeterY: number; - screenPixelToMillimeterX: number; - screenPixelToMillimeterY: number; - viewport: SVGRect; - width: SVGAnimatedLength; - x: SVGAnimatedLength; - y: SVGAnimatedLength; - checkEnclosure(element: SVGElement, rect: SVGRect): boolean; - checkIntersection(element: SVGElement, rect: SVGRect): boolean; - createSVGAngle(): SVGAngle; - createSVGLength(): SVGLength; - createSVGMatrix(): SVGMatrix; - createSVGNumber(): SVGNumber; - createSVGPoint(): SVGPoint; - createSVGRect(): SVGRect; - createSVGTransform(): SVGTransform; - createSVGTransformFromMatrix(matrix: SVGMatrix): SVGTransform; - deselectAll(): void; - forceRedraw(): void; - getComputedStyle(elt: Element, pseudoElt?: string): CSSStyleDeclaration; - getCurrentTime(): number; - getElementById(elementId: string): Element; - getEnclosureList(rect: SVGRect, referenceElement: SVGElement): NodeList; - getIntersectionList(rect: SVGRect, referenceElement: SVGElement): NodeList; - pauseAnimations(): void; - setCurrentTime(seconds: number): void; - suspendRedraw(maxWaitMilliseconds: number): number; - unpauseAnimations(): void; - unsuspendRedraw(suspendHandleID: number): void; - unsuspendRedrawAll(): void; - addEventListener(type: "MSGestureChange", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureDoubleTap", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureEnd", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureHold", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureStart", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureTap", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGotPointerCapture", listener: (ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSInertiaStart", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSLostPointerCapture", listener: (ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerCancel", listener: (ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerDown", listener: (ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerEnter", listener: (ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerLeave", listener: (ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerMove", listener: (ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerOut", listener: (ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerOver", listener: (ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerUp", listener: (ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "SVGAbort", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "SVGError", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "SVGUnload", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "SVGZoom", listener: (ev: SVGZoomEvent) => any, useCapture?: boolean): void; - addEventListener(type: "ariarequest", listener: (ev: AriaRequestEvent) => any, useCapture?: boolean): void; - addEventListener(type: "click", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "command", listener: (ev: CommandEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dblclick", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "focusin", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "focusout", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "gotpointercapture", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "load", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "lostpointercapture", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousedown", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousemove", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseout", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseover", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseup", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointercancel", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerdown", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerenter", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerleave", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointermove", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerout", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerover", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerup", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "resize", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "scroll", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchcancel", listener: (ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchend", listener: (ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchmove", listener: (ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "touchstart", listener: (ev: TouchEvent) => any, useCapture?: boolean): void; - addEventListener(type: "webkitfullscreenchange", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "webkitfullscreenerror", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "wheel", listener: (ev: WheelEvent) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGSVGElement: { - prototype: SVGSVGElement; - new(): SVGSVGElement; -} - -interface SVGScriptElement extends SVGElement, SVGExternalResourcesRequired, SVGURIReference { - type: string; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGScriptElement: { - prototype: SVGScriptElement; - new(): SVGScriptElement; -} - -interface SVGStopElement extends SVGElement, SVGStylable { - offset: SVGAnimatedNumber; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGStopElement: { - prototype: SVGStopElement; - new(): SVGStopElement; -} - -interface SVGStringList { - numberOfItems: number; - appendItem(newItem: string): string; - clear(): void; - getItem(index: number): string; - initialize(newItem: string): string; - insertItemBefore(newItem: string, index: number): string; - removeItem(index: number): string; - replaceItem(newItem: string, index: number): string; -} - -declare var SVGStringList: { - prototype: SVGStringList; - new(): SVGStringList; -} - -interface SVGStyleElement extends SVGElement, SVGLangSpace { - media: string; - title: string; - type: string; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGStyleElement: { - prototype: SVGStyleElement; - new(): SVGStyleElement; -} - -interface SVGSwitchElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired { - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGSwitchElement: { - prototype: SVGSwitchElement; - new(): SVGSwitchElement; -} - -interface SVGSymbolElement extends SVGElement, SVGStylable, SVGLangSpace, SVGExternalResourcesRequired, SVGFitToViewBox { - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGSymbolElement: { - prototype: SVGSymbolElement; - new(): SVGSymbolElement; -} - -interface SVGTSpanElement extends SVGTextPositioningElement { -} - -declare var SVGTSpanElement: { - prototype: SVGTSpanElement; - new(): SVGTSpanElement; -} - -interface SVGTextContentElement extends SVGElement, SVGStylable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired { - lengthAdjust: SVGAnimatedEnumeration; - textLength: SVGAnimatedLength; - getCharNumAtPosition(point: SVGPoint): number; - getComputedTextLength(): number; - getEndPositionOfChar(charnum: number): SVGPoint; - getExtentOfChar(charnum: number): SVGRect; - getNumberOfChars(): number; - getRotationOfChar(charnum: number): number; - getStartPositionOfChar(charnum: number): SVGPoint; - getSubStringLength(charnum: number, nchars: number): number; - selectSubString(charnum: number, nchars: number): void; - LENGTHADJUST_SPACING: number; - LENGTHADJUST_SPACINGANDGLYPHS: number; - LENGTHADJUST_UNKNOWN: number; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGTextContentElement: { - prototype: SVGTextContentElement; - new(): SVGTextContentElement; - LENGTHADJUST_SPACING: number; - LENGTHADJUST_SPACINGANDGLYPHS: number; - LENGTHADJUST_UNKNOWN: number; -} - -interface SVGTextElement extends SVGTextPositioningElement, SVGTransformable { - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGTextElement: { - prototype: SVGTextElement; - new(): SVGTextElement; -} - -interface SVGTextPathElement extends SVGTextContentElement, SVGURIReference { - method: SVGAnimatedEnumeration; - spacing: SVGAnimatedEnumeration; - startOffset: SVGAnimatedLength; - TEXTPATH_METHODTYPE_ALIGN: number; - TEXTPATH_METHODTYPE_STRETCH: number; - TEXTPATH_METHODTYPE_UNKNOWN: number; - TEXTPATH_SPACINGTYPE_AUTO: number; - TEXTPATH_SPACINGTYPE_EXACT: number; - TEXTPATH_SPACINGTYPE_UNKNOWN: number; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGTextPathElement: { - prototype: SVGTextPathElement; - new(): SVGTextPathElement; - TEXTPATH_METHODTYPE_ALIGN: number; - TEXTPATH_METHODTYPE_STRETCH: number; - TEXTPATH_METHODTYPE_UNKNOWN: number; - TEXTPATH_SPACINGTYPE_AUTO: number; - TEXTPATH_SPACINGTYPE_EXACT: number; - TEXTPATH_SPACINGTYPE_UNKNOWN: number; -} - -interface SVGTextPositioningElement extends SVGTextContentElement { - dx: SVGAnimatedLengthList; - dy: SVGAnimatedLengthList; - rotate: SVGAnimatedNumberList; - x: SVGAnimatedLengthList; - y: SVGAnimatedLengthList; -} - -declare var SVGTextPositioningElement: { - prototype: SVGTextPositioningElement; - new(): SVGTextPositioningElement; -} - -interface SVGTitleElement extends SVGElement, SVGStylable, SVGLangSpace { - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGTitleElement: { - prototype: SVGTitleElement; - new(): SVGTitleElement; -} - -interface SVGTransform { - angle: number; - matrix: SVGMatrix; - type: number; - setMatrix(matrix: SVGMatrix): void; - setRotate(angle: number, cx: number, cy: number): void; - setScale(sx: number, sy: number): void; - setSkewX(angle: number): void; - setSkewY(angle: number): void; - setTranslate(tx: number, ty: number): void; - SVG_TRANSFORM_MATRIX: number; - SVG_TRANSFORM_ROTATE: number; - SVG_TRANSFORM_SCALE: number; - SVG_TRANSFORM_SKEWX: number; - SVG_TRANSFORM_SKEWY: number; - SVG_TRANSFORM_TRANSLATE: number; - SVG_TRANSFORM_UNKNOWN: number; -} - -declare var SVGTransform: { - prototype: SVGTransform; - new(): SVGTransform; - SVG_TRANSFORM_MATRIX: number; - SVG_TRANSFORM_ROTATE: number; - SVG_TRANSFORM_SCALE: number; - SVG_TRANSFORM_SKEWX: number; - SVG_TRANSFORM_SKEWY: number; - SVG_TRANSFORM_TRANSLATE: number; - SVG_TRANSFORM_UNKNOWN: number; -} - -interface SVGTransformList { - numberOfItems: number; - appendItem(newItem: SVGTransform): SVGTransform; - clear(): void; - consolidate(): SVGTransform; - createSVGTransformFromMatrix(matrix: SVGMatrix): SVGTransform; - getItem(index: number): SVGTransform; - initialize(newItem: SVGTransform): SVGTransform; - insertItemBefore(newItem: SVGTransform, index: number): SVGTransform; - removeItem(index: number): SVGTransform; - replaceItem(newItem: SVGTransform, index: number): SVGTransform; -} - -declare var SVGTransformList: { - prototype: SVGTransformList; - new(): SVGTransformList; -} - -interface SVGUnitTypes { - SVG_UNIT_TYPE_OBJECTBOUNDINGBOX: number; - SVG_UNIT_TYPE_UNKNOWN: number; - SVG_UNIT_TYPE_USERSPACEONUSE: number; -} -declare var SVGUnitTypes: SVGUnitTypes; - -interface SVGUseElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired, SVGURIReference { - animatedInstanceRoot: SVGElementInstance; - height: SVGAnimatedLength; - instanceRoot: SVGElementInstance; - width: SVGAnimatedLength; - x: SVGAnimatedLength; - y: SVGAnimatedLength; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGUseElement: { - prototype: SVGUseElement; - new(): SVGUseElement; -} - -interface SVGViewElement extends SVGElement, SVGExternalResourcesRequired, SVGFitToViewBox, SVGZoomAndPan { - viewTarget: SVGStringList; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var SVGViewElement: { - prototype: SVGViewElement; - new(): SVGViewElement; -} - -interface SVGZoomAndPan { - zoomAndPan: number; -} - -declare var SVGZoomAndPan: { - SVG_ZOOMANDPAN_DISABLE: number; - SVG_ZOOMANDPAN_MAGNIFY: number; - SVG_ZOOMANDPAN_UNKNOWN: number; -} - -interface SVGZoomEvent extends UIEvent { - newScale: number; - newTranslate: SVGPoint; - previousScale: number; - previousTranslate: SVGPoint; - zoomRectScreen: SVGRect; -} - -declare var SVGZoomEvent: { - prototype: SVGZoomEvent; - new(): SVGZoomEvent; -} - -interface Screen extends EventTarget { - availHeight: number; - availWidth: number; - bufferDepth: number; - colorDepth: number; - deviceXDPI: number; - deviceYDPI: number; - fontSmoothingEnabled: boolean; - height: number; - logicalXDPI: number; - logicalYDPI: number; - msOrientation: string; - onmsorientationchange: (ev: Event) => any; - pixelDepth: number; - systemXDPI: number; - systemYDPI: number; - width: number; - msLockOrientation(orientations: string | string[]): boolean; - msUnlockOrientation(): void; - addEventListener(type: "MSOrientationChange", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var Screen: { - prototype: Screen; - new(): Screen; -} - -interface ScriptNotifyEvent extends Event { - callingUri: string; - value: string; -} - -declare var ScriptNotifyEvent: { - prototype: ScriptNotifyEvent; - new(): ScriptNotifyEvent; -} - -interface ScriptProcessorNode extends AudioNode { - bufferSize: number; - onaudioprocess: (ev: AudioProcessingEvent) => any; - addEventListener(type: "audioprocess", listener: (ev: AudioProcessingEvent) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var ScriptProcessorNode: { - prototype: ScriptProcessorNode; - new(): ScriptProcessorNode; -} - -interface Selection { - anchorNode: Node; - anchorOffset: number; - focusNode: Node; - focusOffset: number; - isCollapsed: boolean; - rangeCount: number; - type: string; - addRange(range: Range): void; - collapse(parentNode: Node, offset: number): void; - collapseToEnd(): void; - collapseToStart(): void; - containsNode(node: Node, partlyContained: boolean): boolean; - deleteFromDocument(): void; - empty(): void; - extend(newNode: Node, offset: number): void; - getRangeAt(index: number): Range; - removeAllRanges(): void; - removeRange(range: Range): void; - selectAllChildren(parentNode: Node): void; - setBaseAndExtent(baseNode: Node, baseOffset: number, extentNode: Node, extentOffset: number): void; - toString(): string; -} - -declare var Selection: { - prototype: Selection; - new(): Selection; -} - -interface SourceBuffer extends EventTarget { - appendWindowEnd: number; - appendWindowStart: number; - audioTracks: AudioTrackList; - buffered: TimeRanges; - mode: string; - timestampOffset: number; - updating: boolean; - videoTracks: VideoTrackList; - abort(): void; - appendBuffer(data: ArrayBuffer | ArrayBufferView): void; - appendStream(stream: MSStream, maxSize?: number): void; - remove(start: number, end: number): void; -} - -declare var SourceBuffer: { - prototype: SourceBuffer; - new(): SourceBuffer; -} - -interface SourceBufferList extends EventTarget { - length: number; - item(index: number): SourceBuffer; - [index: number]: SourceBuffer; -} - -declare var SourceBufferList: { - prototype: SourceBufferList; - new(): SourceBufferList; -} - -interface StereoPannerNode extends AudioNode { - pan: AudioParam; -} - -declare var StereoPannerNode: { - prototype: StereoPannerNode; - new(): StereoPannerNode; -} - -interface Storage { - length: number; - clear(): void; - getItem(key: string): any; - key(index: number): string; - removeItem(key: string): void; - setItem(key: string, data: string): void; - [key: string]: any; - [index: number]: string; -} - -declare var Storage: { - prototype: Storage; - new(): Storage; -} - -interface StorageEvent extends Event { - url: string; - key?: string; - oldValue?: string; - newValue?: string; - storageArea?: Storage; -} - -declare var StorageEvent: { - prototype: StorageEvent; - new (type: string, eventInitDict?: StorageEventInit): StorageEvent; -} - -interface StyleMedia { - type: string; - matchMedium(mediaquery: string): boolean; -} - -declare var StyleMedia: { - prototype: StyleMedia; - new(): StyleMedia; -} - -interface StyleSheet { - disabled: boolean; - href: string; - media: MediaList; - ownerNode: Node; - parentStyleSheet: StyleSheet; - title: string; - type: string; -} - -declare var StyleSheet: { - prototype: StyleSheet; - new(): StyleSheet; -} - -interface StyleSheetList { - length: number; - item(index?: number): StyleSheet; - [index: number]: StyleSheet; -} - -declare var StyleSheetList: { - prototype: StyleSheetList; - new(): StyleSheetList; -} - -interface StyleSheetPageList { - length: number; - item(index: number): CSSPageRule; - [index: number]: CSSPageRule; -} - -declare var StyleSheetPageList: { - prototype: StyleSheetPageList; - new(): StyleSheetPageList; -} - -interface SubtleCrypto { - decrypt(algorithm: string | Algorithm, key: CryptoKey, data: ArrayBufferView): any; - deriveBits(algorithm: string | Algorithm, baseKey: CryptoKey, length: number): any; - deriveKey(algorithm: string | Algorithm, baseKey: CryptoKey, derivedKeyType: string | Algorithm, extractable: boolean, keyUsages: string[]): any; - digest(algorithm: string | Algorithm, data: ArrayBufferView): any; - encrypt(algorithm: string | Algorithm, key: CryptoKey, data: ArrayBufferView): any; - exportKey(format: string, key: CryptoKey): any; - generateKey(algorithm: string | Algorithm, extractable: boolean, keyUsages: string[]): any; - importKey(format: string, keyData: ArrayBufferView, algorithm: string | Algorithm, extractable: boolean, keyUsages: string[]): any; - sign(algorithm: string | Algorithm, key: CryptoKey, data: ArrayBufferView): any; - unwrapKey(format: string, wrappedKey: ArrayBufferView, unwrappingKey: CryptoKey, unwrapAlgorithm: string | Algorithm, unwrappedKeyAlgorithm: string | Algorithm, extractable: boolean, keyUsages: string[]): any; - verify(algorithm: string | Algorithm, key: CryptoKey, signature: ArrayBufferView, data: ArrayBufferView): any; - wrapKey(format: string, key: CryptoKey, wrappingKey: CryptoKey, wrapAlgorithm: string | Algorithm): any; -} - -declare var SubtleCrypto: { - prototype: SubtleCrypto; - new(): SubtleCrypto; -} - -interface Text extends CharacterData { - wholeText: string; - replaceWholeText(content: string): Text; - splitText(offset: number): Text; -} - -declare var Text: { - prototype: Text; - new(): Text; -} - -interface TextEvent extends UIEvent { - data: string; - inputMethod: number; - locale: string; - initTextEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, dataArg: string, inputMethod: number, locale: string): void; - DOM_INPUT_METHOD_DROP: number; - DOM_INPUT_METHOD_HANDWRITING: number; - DOM_INPUT_METHOD_IME: number; - DOM_INPUT_METHOD_KEYBOARD: number; - DOM_INPUT_METHOD_MULTIMODAL: number; - DOM_INPUT_METHOD_OPTION: number; - DOM_INPUT_METHOD_PASTE: number; - DOM_INPUT_METHOD_SCRIPT: number; - DOM_INPUT_METHOD_UNKNOWN: number; - DOM_INPUT_METHOD_VOICE: number; -} - -declare var TextEvent: { - prototype: TextEvent; - new(): TextEvent; - DOM_INPUT_METHOD_DROP: number; - DOM_INPUT_METHOD_HANDWRITING: number; - DOM_INPUT_METHOD_IME: number; - DOM_INPUT_METHOD_KEYBOARD: number; - DOM_INPUT_METHOD_MULTIMODAL: number; - DOM_INPUT_METHOD_OPTION: number; - DOM_INPUT_METHOD_PASTE: number; - DOM_INPUT_METHOD_SCRIPT: number; - DOM_INPUT_METHOD_UNKNOWN: number; - DOM_INPUT_METHOD_VOICE: number; -} - -interface TextMetrics { - width: number; -} - -declare var TextMetrics: { - prototype: TextMetrics; - new(): TextMetrics; -} - -interface TextRange { - boundingHeight: number; - boundingLeft: number; - boundingTop: number; - boundingWidth: number; - htmlText: string; - offsetLeft: number; - offsetTop: number; - text: string; - collapse(start?: boolean): void; - compareEndPoints(how: string, sourceRange: TextRange): number; - duplicate(): TextRange; - execCommand(cmdID: string, showUI?: boolean, value?: any): boolean; - execCommandShowHelp(cmdID: string): boolean; - expand(Unit: string): boolean; - findText(string: string, count?: number, flags?: number): boolean; - getBookmark(): string; - getBoundingClientRect(): ClientRect; - getClientRects(): ClientRectList; - inRange(range: TextRange): boolean; - isEqual(range: TextRange): boolean; - move(unit: string, count?: number): number; - moveEnd(unit: string, count?: number): number; - moveStart(unit: string, count?: number): number; - moveToBookmark(bookmark: string): boolean; - moveToElementText(element: Element): void; - moveToPoint(x: number, y: number): void; - parentElement(): Element; - pasteHTML(html: string): void; - queryCommandEnabled(cmdID: string): boolean; - queryCommandIndeterm(cmdID: string): boolean; - queryCommandState(cmdID: string): boolean; - queryCommandSupported(cmdID: string): boolean; - queryCommandText(cmdID: string): string; - queryCommandValue(cmdID: string): any; - scrollIntoView(fStart?: boolean): void; - select(): void; - setEndPoint(how: string, SourceRange: TextRange): void; -} - -declare var TextRange: { - prototype: TextRange; - new(): TextRange; -} - -interface TextRangeCollection { - length: number; - item(index: number): TextRange; - [index: number]: TextRange; -} - -declare var TextRangeCollection: { - prototype: TextRangeCollection; - new(): TextRangeCollection; -} - -interface TextTrack extends EventTarget { - activeCues: TextTrackCueList; - cues: TextTrackCueList; - inBandMetadataTrackDispatchType: string; - kind: string; - label: string; - language: string; - mode: any; - oncuechange: (ev: Event) => any; - onerror: (ev: Event) => any; - onload: (ev: Event) => any; - readyState: number; - addCue(cue: TextTrackCue): void; - removeCue(cue: TextTrackCue): void; - DISABLED: number; - ERROR: number; - HIDDEN: number; - LOADED: number; - LOADING: number; - NONE: number; - SHOWING: number; - addEventListener(type: "cuechange", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "load", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var TextTrack: { - prototype: TextTrack; - new(): TextTrack; - DISABLED: number; - ERROR: number; - HIDDEN: number; - LOADED: number; - LOADING: number; - NONE: number; - SHOWING: number; -} - -interface TextTrackCue extends EventTarget { - endTime: number; - id: string; - onenter: (ev: Event) => any; - onexit: (ev: Event) => any; - pauseOnExit: boolean; - startTime: number; - text: string; - track: TextTrack; - getCueAsHTML(): DocumentFragment; - addEventListener(type: "enter", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "exit", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var TextTrackCue: { - prototype: TextTrackCue; - new(startTime: number, endTime: number, text: string): TextTrackCue; -} - -interface TextTrackCueList { - length: number; - getCueById(id: string): TextTrackCue; - item(index: number): TextTrackCue; - [index: number]: TextTrackCue; -} - -declare var TextTrackCueList: { - prototype: TextTrackCueList; - new(): TextTrackCueList; -} - -interface TextTrackList extends EventTarget { - length: number; - onaddtrack: (ev: TrackEvent) => any; - item(index: number): TextTrack; - addEventListener(type: "addtrack", listener: (ev: TrackEvent) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; - [index: number]: TextTrack; -} - -declare var TextTrackList: { - prototype: TextTrackList; - new(): TextTrackList; -} - -interface TimeRanges { - length: number; - end(index: number): number; - start(index: number): number; -} - -declare var TimeRanges: { - prototype: TimeRanges; - new(): TimeRanges; -} - -interface Touch { - clientX: number; - clientY: number; - identifier: number; - pageX: number; - pageY: number; - screenX: number; - screenY: number; - target: EventTarget; -} - -declare var Touch: { - prototype: Touch; - new(): Touch; -} - -interface TouchEvent extends UIEvent { - altKey: boolean; - changedTouches: TouchList; - ctrlKey: boolean; - metaKey: boolean; - shiftKey: boolean; - targetTouches: TouchList; - touches: TouchList; -} - -declare var TouchEvent: { - prototype: TouchEvent; - new(): TouchEvent; -} - -interface TouchList { - length: number; - item(index: number): Touch; - [index: number]: Touch; -} - -declare var TouchList: { - prototype: TouchList; - new(): TouchList; -} - -interface TrackEvent extends Event { - track: any; -} - -declare var TrackEvent: { - prototype: TrackEvent; - new(): TrackEvent; -} - -interface TransitionEvent extends Event { - elapsedTime: number; - propertyName: string; - initTransitionEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, propertyNameArg: string, elapsedTimeArg: number): void; -} - -declare var TransitionEvent: { - prototype: TransitionEvent; - new(): TransitionEvent; -} - -interface TreeWalker { - currentNode: Node; - expandEntityReferences: boolean; - filter: NodeFilter; - root: Node; - whatToShow: number; - firstChild(): Node; - lastChild(): Node; - nextNode(): Node; - nextSibling(): Node; - parentNode(): Node; - previousNode(): Node; - previousSibling(): Node; -} - -declare var TreeWalker: { - prototype: TreeWalker; - new(): TreeWalker; -} - -interface UIEvent extends Event { - detail: number; - view: Window; - initUIEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number): void; -} - -declare var UIEvent: { - prototype: UIEvent; - new(type: string, eventInitDict?: UIEventInit): UIEvent; -} - -interface URL { - createObjectURL(object: any, options?: ObjectURLOptions): string; - revokeObjectURL(url: string): void; -} -declare var URL: URL; - -interface UnviewableContentIdentifiedEvent extends NavigationEventWithReferrer { - mediaType: string; -} - -declare var UnviewableContentIdentifiedEvent: { - prototype: UnviewableContentIdentifiedEvent; - new(): UnviewableContentIdentifiedEvent; -} - -interface ValidityState { - badInput: boolean; - customError: boolean; - patternMismatch: boolean; - rangeOverflow: boolean; - rangeUnderflow: boolean; - stepMismatch: boolean; - tooLong: boolean; - typeMismatch: boolean; - valid: boolean; - valueMissing: boolean; -} - -declare var ValidityState: { - prototype: ValidityState; - new(): ValidityState; -} - -interface VideoPlaybackQuality { - corruptedVideoFrames: number; - creationTime: number; - droppedVideoFrames: number; - totalFrameDelay: number; - totalVideoFrames: number; -} - -declare var VideoPlaybackQuality: { - prototype: VideoPlaybackQuality; - new(): VideoPlaybackQuality; -} - -interface VideoTrack { - id: string; - kind: string; - label: string; - language: string; - selected: boolean; - sourceBuffer: SourceBuffer; -} - -declare var VideoTrack: { - prototype: VideoTrack; - new(): VideoTrack; -} - -interface VideoTrackList extends EventTarget { - length: number; - onaddtrack: (ev: TrackEvent) => any; - onchange: (ev: Event) => any; - onremovetrack: (ev: TrackEvent) => any; - selectedIndex: number; - getTrackById(id: string): VideoTrack; - item(index: number): VideoTrack; - addEventListener(type: "addtrack", listener: (ev: TrackEvent) => any, useCapture?: boolean): void; - addEventListener(type: "change", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "removetrack", listener: (ev: TrackEvent) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; - [index: number]: VideoTrack; -} - -declare var VideoTrackList: { - prototype: VideoTrackList; - new(): VideoTrackList; -} - -interface WEBGL_compressed_texture_s3tc { - COMPRESSED_RGBA_S3TC_DXT1_EXT: number; - COMPRESSED_RGBA_S3TC_DXT3_EXT: number; - COMPRESSED_RGBA_S3TC_DXT5_EXT: number; - COMPRESSED_RGB_S3TC_DXT1_EXT: number; -} - -declare var WEBGL_compressed_texture_s3tc: { - prototype: WEBGL_compressed_texture_s3tc; - new(): WEBGL_compressed_texture_s3tc; - COMPRESSED_RGBA_S3TC_DXT1_EXT: number; - COMPRESSED_RGBA_S3TC_DXT3_EXT: number; - COMPRESSED_RGBA_S3TC_DXT5_EXT: number; - COMPRESSED_RGB_S3TC_DXT1_EXT: number; -} - -interface WEBGL_debug_renderer_info { - UNMASKED_RENDERER_WEBGL: number; - UNMASKED_VENDOR_WEBGL: number; -} - -declare var WEBGL_debug_renderer_info: { - prototype: WEBGL_debug_renderer_info; - new(): WEBGL_debug_renderer_info; - UNMASKED_RENDERER_WEBGL: number; - UNMASKED_VENDOR_WEBGL: number; -} - -interface WEBGL_depth_texture { - UNSIGNED_INT_24_8_WEBGL: number; -} - -declare var WEBGL_depth_texture: { - prototype: WEBGL_depth_texture; - new(): WEBGL_depth_texture; - UNSIGNED_INT_24_8_WEBGL: number; -} - -interface WaveShaperNode extends AudioNode { - curve: Float32Array; - oversample: string; -} - -declare var WaveShaperNode: { - prototype: WaveShaperNode; - new(): WaveShaperNode; -} - -interface WebGLActiveInfo { - name: string; - size: number; - type: number; -} - -declare var WebGLActiveInfo: { - prototype: WebGLActiveInfo; - new(): WebGLActiveInfo; -} - -interface WebGLBuffer extends WebGLObject { -} - -declare var WebGLBuffer: { - prototype: WebGLBuffer; - new(): WebGLBuffer; -} - -interface WebGLContextEvent extends Event { - statusMessage: string; -} - -declare var WebGLContextEvent: { - prototype: WebGLContextEvent; - new(): WebGLContextEvent; -} - -interface WebGLFramebuffer extends WebGLObject { -} - -declare var WebGLFramebuffer: { - prototype: WebGLFramebuffer; - new(): WebGLFramebuffer; -} - -interface WebGLObject { -} - -declare var WebGLObject: { - prototype: WebGLObject; - new(): WebGLObject; -} - -interface WebGLProgram extends WebGLObject { -} - -declare var WebGLProgram: { - prototype: WebGLProgram; - new(): WebGLProgram; -} - -interface WebGLRenderbuffer extends WebGLObject { -} - -declare var WebGLRenderbuffer: { - prototype: WebGLRenderbuffer; - new(): WebGLRenderbuffer; -} - -interface WebGLRenderingContext { - canvas: HTMLCanvasElement; - drawingBufferHeight: number; - drawingBufferWidth: number; - activeTexture(texture: number): void; - attachShader(program: WebGLProgram, shader: WebGLShader): void; - bindAttribLocation(program: WebGLProgram, index: number, name: string): void; - bindBuffer(target: number, buffer: WebGLBuffer): void; - bindFramebuffer(target: number, framebuffer: WebGLFramebuffer): void; - bindRenderbuffer(target: number, renderbuffer: WebGLRenderbuffer): void; - bindTexture(target: number, texture: WebGLTexture): void; - blendColor(red: number, green: number, blue: number, alpha: number): void; - blendEquation(mode: number): void; - blendEquationSeparate(modeRGB: number, modeAlpha: number): void; - blendFunc(sfactor: number, dfactor: number): void; - blendFuncSeparate(srcRGB: number, dstRGB: number, srcAlpha: number, dstAlpha: number): void; - bufferData(target: number, size: number | ArrayBufferView | ArrayBuffer, usage: number): void; - bufferSubData(target: number, offset: number, data: ArrayBufferView | ArrayBuffer): void; - checkFramebufferStatus(target: number): number; - clear(mask: number): void; - clearColor(red: number, green: number, blue: number, alpha: number): void; - clearDepth(depth: number): void; - clearStencil(s: number): void; - colorMask(red: boolean, green: boolean, blue: boolean, alpha: boolean): void; - compileShader(shader: WebGLShader): void; - compressedTexImage2D(target: number, level: number, internalformat: number, width: number, height: number, border: number, data: ArrayBufferView): void; - compressedTexSubImage2D(target: number, level: number, xoffset: number, yoffset: number, width: number, height: number, format: number, data: ArrayBufferView): void; - copyTexImage2D(target: number, level: number, internalformat: number, x: number, y: number, width: number, height: number, border: number): void; - copyTexSubImage2D(target: number, level: number, xoffset: number, yoffset: number, x: number, y: number, width: number, height: number): void; - createBuffer(): WebGLBuffer; - createFramebuffer(): WebGLFramebuffer; - createProgram(): WebGLProgram; - createRenderbuffer(): WebGLRenderbuffer; - createShader(type: number): WebGLShader; - createTexture(): WebGLTexture; - cullFace(mode: number): void; - deleteBuffer(buffer: WebGLBuffer): void; - deleteFramebuffer(framebuffer: WebGLFramebuffer): void; - deleteProgram(program: WebGLProgram): void; - deleteRenderbuffer(renderbuffer: WebGLRenderbuffer): void; - deleteShader(shader: WebGLShader): void; - deleteTexture(texture: WebGLTexture): void; - depthFunc(func: number): void; - depthMask(flag: boolean): void; - depthRange(zNear: number, zFar: number): void; - detachShader(program: WebGLProgram, shader: WebGLShader): void; - disable(cap: number): void; - disableVertexAttribArray(index: number): void; - drawArrays(mode: number, first: number, count: number): void; - drawElements(mode: number, count: number, type: number, offset: number): void; - enable(cap: number): void; - enableVertexAttribArray(index: number): void; - finish(): void; - flush(): void; - framebufferRenderbuffer(target: number, attachment: number, renderbuffertarget: number, renderbuffer: WebGLRenderbuffer): void; - framebufferTexture2D(target: number, attachment: number, textarget: number, texture: WebGLTexture, level: number): void; - frontFace(mode: number): void; - generateMipmap(target: number): void; - getActiveAttrib(program: WebGLProgram, index: number): WebGLActiveInfo; - getActiveUniform(program: WebGLProgram, index: number): WebGLActiveInfo; - getAttachedShaders(program: WebGLProgram): WebGLShader[]; - getAttribLocation(program: WebGLProgram, name: string): number; - getBufferParameter(target: number, pname: number): any; - getContextAttributes(): WebGLContextAttributes; - getError(): number; - getExtension(name: string): any; - getFramebufferAttachmentParameter(target: number, attachment: number, pname: number): any; - getParameter(pname: number): any; - getProgramInfoLog(program: WebGLProgram): string; - getProgramParameter(program: WebGLProgram, pname: number): any; - getRenderbufferParameter(target: number, pname: number): any; - getShaderInfoLog(shader: WebGLShader): string; - getShaderParameter(shader: WebGLShader, pname: number): any; - getShaderPrecisionFormat(shadertype: number, precisiontype: number): WebGLShaderPrecisionFormat; - getShaderSource(shader: WebGLShader): string; - getSupportedExtensions(): string[]; - getTexParameter(target: number, pname: number): any; - getUniform(program: WebGLProgram, location: WebGLUniformLocation): any; - getUniformLocation(program: WebGLProgram, name: string): WebGLUniformLocation; - getVertexAttrib(index: number, pname: number): any; - getVertexAttribOffset(index: number, pname: number): number; - hint(target: number, mode: number): void; - isBuffer(buffer: WebGLBuffer): boolean; - isContextLost(): boolean; - isEnabled(cap: number): boolean; - isFramebuffer(framebuffer: WebGLFramebuffer): boolean; - isProgram(program: WebGLProgram): boolean; - isRenderbuffer(renderbuffer: WebGLRenderbuffer): boolean; - isShader(shader: WebGLShader): boolean; - isTexture(texture: WebGLTexture): boolean; - lineWidth(width: number): void; - linkProgram(program: WebGLProgram): void; - pixelStorei(pname: number, param: number): void; - polygonOffset(factor: number, units: number): void; - readPixels(x: number, y: number, width: number, height: number, format: number, type: number, pixels: ArrayBufferView): void; - renderbufferStorage(target: number, internalformat: number, width: number, height: number): void; - sampleCoverage(value: number, invert: boolean): void; - scissor(x: number, y: number, width: number, height: number): void; - shaderSource(shader: WebGLShader, source: string): void; - stencilFunc(func: number, ref: number, mask: number): void; - stencilFuncSeparate(face: number, func: number, ref: number, mask: number): void; - stencilMask(mask: number): void; - stencilMaskSeparate(face: number, mask: number): void; - stencilOp(fail: number, zfail: number, zpass: number): void; - stencilOpSeparate(face: number, fail: number, zfail: number, zpass: number): void; - texImage2D(target: number, level: number, internalformat: number, width: number, height: number, border: number, format: number, type: number, pixels: ArrayBufferView): void; - texImage2D(target: number, level: number, internalformat: number, format: number, type: number, image: HTMLImageElement): void; - texImage2D(target: number, level: number, internalformat: number, format: number, type: number, canvas: HTMLCanvasElement): void; - texImage2D(target: number, level: number, internalformat: number, format: number, type: number, video: HTMLVideoElement): void; - texImage2D(target: number, level: number, internalformat: number, format: number, type: number, pixels: ImageData): void; - texParameterf(target: number, pname: number, param: number): void; - texParameteri(target: number, pname: number, param: number): void; - texSubImage2D(target: number, level: number, xoffset: number, yoffset: number, width: number, height: number, format: number, type: number, pixels: ArrayBufferView): void; - texSubImage2D(target: number, level: number, xoffset: number, yoffset: number, format: number, type: number, image: HTMLImageElement): void; - texSubImage2D(target: number, level: number, xoffset: number, yoffset: number, format: number, type: number, canvas: HTMLCanvasElement): void; - texSubImage2D(target: number, level: number, xoffset: number, yoffset: number, format: number, type: number, video: HTMLVideoElement): void; - texSubImage2D(target: number, level: number, xoffset: number, yoffset: number, format: number, type: number, pixels: ImageData): void; - uniform1f(location: WebGLUniformLocation, x: number): void; - uniform1fv(location: WebGLUniformLocation, v: Float32Array): void; - uniform1i(location: WebGLUniformLocation, x: number): void; - uniform1iv(location: WebGLUniformLocation, v: Int32Array): void; - uniform2f(location: WebGLUniformLocation, x: number, y: number): void; - uniform2fv(location: WebGLUniformLocation, v: Float32Array): void; - uniform2i(location: WebGLUniformLocation, x: number, y: number): void; - uniform2iv(location: WebGLUniformLocation, v: Int32Array): void; - uniform3f(location: WebGLUniformLocation, x: number, y: number, z: number): void; - uniform3fv(location: WebGLUniformLocation, v: Float32Array): void; - uniform3i(location: WebGLUniformLocation, x: number, y: number, z: number): void; - uniform3iv(location: WebGLUniformLocation, v: Int32Array): void; - uniform4f(location: WebGLUniformLocation, x: number, y: number, z: number, w: number): void; - uniform4fv(location: WebGLUniformLocation, v: Float32Array): void; - uniform4i(location: WebGLUniformLocation, x: number, y: number, z: number, w: number): void; - uniform4iv(location: WebGLUniformLocation, v: Int32Array): void; - uniformMatrix2fv(location: WebGLUniformLocation, transpose: boolean, value: Float32Array): void; - uniformMatrix3fv(location: WebGLUniformLocation, transpose: boolean, value: Float32Array): void; - uniformMatrix4fv(location: WebGLUniformLocation, transpose: boolean, value: Float32Array): void; - useProgram(program: WebGLProgram): void; - validateProgram(program: WebGLProgram): void; - vertexAttrib1f(indx: number, x: number): void; - vertexAttrib1fv(indx: number, values: Float32Array): void; - vertexAttrib2f(indx: number, x: number, y: number): void; - vertexAttrib2fv(indx: number, values: Float32Array): void; - vertexAttrib3f(indx: number, x: number, y: number, z: number): void; - vertexAttrib3fv(indx: number, values: Float32Array): void; - vertexAttrib4f(indx: number, x: number, y: number, z: number, w: number): void; - vertexAttrib4fv(indx: number, values: Float32Array): void; - vertexAttribPointer(indx: number, size: number, type: number, normalized: boolean, stride: number, offset: number): void; - viewport(x: number, y: number, width: number, height: number): void; - ACTIVE_ATTRIBUTES: number; - ACTIVE_TEXTURE: number; - ACTIVE_UNIFORMS: number; - ALIASED_LINE_WIDTH_RANGE: number; - ALIASED_POINT_SIZE_RANGE: number; - ALPHA: number; - ALPHA_BITS: number; - ALWAYS: number; - ARRAY_BUFFER: number; - ARRAY_BUFFER_BINDING: number; - ATTACHED_SHADERS: number; - BACK: number; - BLEND: number; - BLEND_COLOR: number; - BLEND_DST_ALPHA: number; - BLEND_DST_RGB: number; - BLEND_EQUATION: number; - BLEND_EQUATION_ALPHA: number; - BLEND_EQUATION_RGB: number; - BLEND_SRC_ALPHA: number; - BLEND_SRC_RGB: number; - BLUE_BITS: number; - BOOL: number; - BOOL_VEC2: number; - BOOL_VEC3: number; - BOOL_VEC4: number; - BROWSER_DEFAULT_WEBGL: number; - BUFFER_SIZE: number; - BUFFER_USAGE: number; - BYTE: number; - CCW: number; - CLAMP_TO_EDGE: number; - COLOR_ATTACHMENT0: number; - COLOR_BUFFER_BIT: number; - COLOR_CLEAR_VALUE: number; - COLOR_WRITEMASK: number; - COMPILE_STATUS: number; - COMPRESSED_TEXTURE_FORMATS: number; - CONSTANT_ALPHA: number; - CONSTANT_COLOR: number; - CONTEXT_LOST_WEBGL: number; - CULL_FACE: number; - CULL_FACE_MODE: number; - CURRENT_PROGRAM: number; - CURRENT_VERTEX_ATTRIB: number; - CW: number; - DECR: number; - DECR_WRAP: number; - DELETE_STATUS: number; - DEPTH_ATTACHMENT: number; - DEPTH_BITS: number; - DEPTH_BUFFER_BIT: number; - DEPTH_CLEAR_VALUE: number; - DEPTH_COMPONENT: number; - DEPTH_COMPONENT16: number; - DEPTH_FUNC: number; - DEPTH_RANGE: number; - DEPTH_STENCIL: number; - DEPTH_STENCIL_ATTACHMENT: number; - DEPTH_TEST: number; - DEPTH_WRITEMASK: number; - DITHER: number; - DONT_CARE: number; - DST_ALPHA: number; - DST_COLOR: number; - DYNAMIC_DRAW: number; - ELEMENT_ARRAY_BUFFER: number; - ELEMENT_ARRAY_BUFFER_BINDING: number; - EQUAL: number; - FASTEST: number; - FLOAT: number; - FLOAT_MAT2: number; - FLOAT_MAT3: number; - FLOAT_MAT4: number; - FLOAT_VEC2: number; - FLOAT_VEC3: number; - FLOAT_VEC4: number; - FRAGMENT_SHADER: number; - FRAMEBUFFER: number; - FRAMEBUFFER_ATTACHMENT_OBJECT_NAME: number; - FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE: number; - FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE: number; - FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL: number; - FRAMEBUFFER_BINDING: number; - FRAMEBUFFER_COMPLETE: number; - FRAMEBUFFER_INCOMPLETE_ATTACHMENT: number; - FRAMEBUFFER_INCOMPLETE_DIMENSIONS: number; - FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT: number; - FRAMEBUFFER_UNSUPPORTED: number; - FRONT: number; - FRONT_AND_BACK: number; - FRONT_FACE: number; - FUNC_ADD: number; - FUNC_REVERSE_SUBTRACT: number; - FUNC_SUBTRACT: number; - GENERATE_MIPMAP_HINT: number; - GEQUAL: number; - GREATER: number; - GREEN_BITS: number; - HIGH_FLOAT: number; - HIGH_INT: number; - IMPLEMENTATION_COLOR_READ_FORMAT: number; - IMPLEMENTATION_COLOR_READ_TYPE: number; - INCR: number; - INCR_WRAP: number; - INT: number; - INT_VEC2: number; - INT_VEC3: number; - INT_VEC4: number; - INVALID_ENUM: number; - INVALID_FRAMEBUFFER_OPERATION: number; - INVALID_OPERATION: number; - INVALID_VALUE: number; - INVERT: number; - KEEP: number; - LEQUAL: number; - LESS: number; - LINEAR: number; - LINEAR_MIPMAP_LINEAR: number; - LINEAR_MIPMAP_NEAREST: number; - LINES: number; - LINE_LOOP: number; - LINE_STRIP: number; - LINE_WIDTH: number; - LINK_STATUS: number; - LOW_FLOAT: number; - LOW_INT: number; - LUMINANCE: number; - LUMINANCE_ALPHA: number; - MAX_COMBINED_TEXTURE_IMAGE_UNITS: number; - MAX_CUBE_MAP_TEXTURE_SIZE: number; - MAX_FRAGMENT_UNIFORM_VECTORS: number; - MAX_RENDERBUFFER_SIZE: number; - MAX_TEXTURE_IMAGE_UNITS: number; - MAX_TEXTURE_SIZE: number; - MAX_VARYING_VECTORS: number; - MAX_VERTEX_ATTRIBS: number; - MAX_VERTEX_TEXTURE_IMAGE_UNITS: number; - MAX_VERTEX_UNIFORM_VECTORS: number; - MAX_VIEWPORT_DIMS: number; - MEDIUM_FLOAT: number; - MEDIUM_INT: number; - MIRRORED_REPEAT: number; - NEAREST: number; - NEAREST_MIPMAP_LINEAR: number; - NEAREST_MIPMAP_NEAREST: number; - NEVER: number; - NICEST: number; - NONE: number; - NOTEQUAL: number; - NO_ERROR: number; - ONE: number; - ONE_MINUS_CONSTANT_ALPHA: number; - ONE_MINUS_CONSTANT_COLOR: number; - ONE_MINUS_DST_ALPHA: number; - ONE_MINUS_DST_COLOR: number; - ONE_MINUS_SRC_ALPHA: number; - ONE_MINUS_SRC_COLOR: number; - OUT_OF_MEMORY: number; - PACK_ALIGNMENT: number; - POINTS: number; - POLYGON_OFFSET_FACTOR: number; - POLYGON_OFFSET_FILL: number; - POLYGON_OFFSET_UNITS: number; - RED_BITS: number; - RENDERBUFFER: number; - RENDERBUFFER_ALPHA_SIZE: number; - RENDERBUFFER_BINDING: number; - RENDERBUFFER_BLUE_SIZE: number; - RENDERBUFFER_DEPTH_SIZE: number; - RENDERBUFFER_GREEN_SIZE: number; - RENDERBUFFER_HEIGHT: number; - RENDERBUFFER_INTERNAL_FORMAT: number; - RENDERBUFFER_RED_SIZE: number; - RENDERBUFFER_STENCIL_SIZE: number; - RENDERBUFFER_WIDTH: number; - RENDERER: number; - REPEAT: number; - REPLACE: number; - RGB: number; - RGB565: number; - RGB5_A1: number; - RGBA: number; - RGBA4: number; - SAMPLER_2D: number; - SAMPLER_CUBE: number; - SAMPLES: number; - SAMPLE_ALPHA_TO_COVERAGE: number; - SAMPLE_BUFFERS: number; - SAMPLE_COVERAGE: number; - SAMPLE_COVERAGE_INVERT: number; - SAMPLE_COVERAGE_VALUE: number; - SCISSOR_BOX: number; - SCISSOR_TEST: number; - SHADER_TYPE: number; - SHADING_LANGUAGE_VERSION: number; - SHORT: number; - SRC_ALPHA: number; - SRC_ALPHA_SATURATE: number; - SRC_COLOR: number; - STATIC_DRAW: number; - STENCIL_ATTACHMENT: number; - STENCIL_BACK_FAIL: number; - STENCIL_BACK_FUNC: number; - STENCIL_BACK_PASS_DEPTH_FAIL: number; - STENCIL_BACK_PASS_DEPTH_PASS: number; - STENCIL_BACK_REF: number; - STENCIL_BACK_VALUE_MASK: number; - STENCIL_BACK_WRITEMASK: number; - STENCIL_BITS: number; - STENCIL_BUFFER_BIT: number; - STENCIL_CLEAR_VALUE: number; - STENCIL_FAIL: number; - STENCIL_FUNC: number; - STENCIL_INDEX: number; - STENCIL_INDEX8: number; - STENCIL_PASS_DEPTH_FAIL: number; - STENCIL_PASS_DEPTH_PASS: number; - STENCIL_REF: number; - STENCIL_TEST: number; - STENCIL_VALUE_MASK: number; - STENCIL_WRITEMASK: number; - STREAM_DRAW: number; - SUBPIXEL_BITS: number; - TEXTURE: number; - TEXTURE0: number; - TEXTURE1: number; - TEXTURE10: number; - TEXTURE11: number; - TEXTURE12: number; - TEXTURE13: number; - TEXTURE14: number; - TEXTURE15: number; - TEXTURE16: number; - TEXTURE17: number; - TEXTURE18: number; - TEXTURE19: number; - TEXTURE2: number; - TEXTURE20: number; - TEXTURE21: number; - TEXTURE22: number; - TEXTURE23: number; - TEXTURE24: number; - TEXTURE25: number; - TEXTURE26: number; - TEXTURE27: number; - TEXTURE28: number; - TEXTURE29: number; - TEXTURE3: number; - TEXTURE30: number; - TEXTURE31: number; - TEXTURE4: number; - TEXTURE5: number; - TEXTURE6: number; - TEXTURE7: number; - TEXTURE8: number; - TEXTURE9: number; - TEXTURE_2D: number; - TEXTURE_BINDING_2D: number; - TEXTURE_BINDING_CUBE_MAP: number; - TEXTURE_CUBE_MAP: number; - TEXTURE_CUBE_MAP_NEGATIVE_X: number; - TEXTURE_CUBE_MAP_NEGATIVE_Y: number; - TEXTURE_CUBE_MAP_NEGATIVE_Z: number; - TEXTURE_CUBE_MAP_POSITIVE_X: number; - TEXTURE_CUBE_MAP_POSITIVE_Y: number; - TEXTURE_CUBE_MAP_POSITIVE_Z: number; - TEXTURE_MAG_FILTER: number; - TEXTURE_MIN_FILTER: number; - TEXTURE_WRAP_S: number; - TEXTURE_WRAP_T: number; - TRIANGLES: number; - TRIANGLE_FAN: number; - TRIANGLE_STRIP: number; - UNPACK_ALIGNMENT: number; - UNPACK_COLORSPACE_CONVERSION_WEBGL: number; - UNPACK_FLIP_Y_WEBGL: number; - UNPACK_PREMULTIPLY_ALPHA_WEBGL: number; - UNSIGNED_BYTE: number; - UNSIGNED_INT: number; - UNSIGNED_SHORT: number; - UNSIGNED_SHORT_4_4_4_4: number; - UNSIGNED_SHORT_5_5_5_1: number; - UNSIGNED_SHORT_5_6_5: number; - VALIDATE_STATUS: number; - VENDOR: number; - VERSION: number; - VERTEX_ATTRIB_ARRAY_BUFFER_BINDING: number; - VERTEX_ATTRIB_ARRAY_ENABLED: number; - VERTEX_ATTRIB_ARRAY_NORMALIZED: number; - VERTEX_ATTRIB_ARRAY_POINTER: number; - VERTEX_ATTRIB_ARRAY_SIZE: number; - VERTEX_ATTRIB_ARRAY_STRIDE: number; - VERTEX_ATTRIB_ARRAY_TYPE: number; - VERTEX_SHADER: number; - VIEWPORT: number; - ZERO: number; -} - -declare var WebGLRenderingContext: { - prototype: WebGLRenderingContext; - new(): WebGLRenderingContext; - ACTIVE_ATTRIBUTES: number; - ACTIVE_TEXTURE: number; - ACTIVE_UNIFORMS: number; - ALIASED_LINE_WIDTH_RANGE: number; - ALIASED_POINT_SIZE_RANGE: number; - ALPHA: number; - ALPHA_BITS: number; - ALWAYS: number; - ARRAY_BUFFER: number; - ARRAY_BUFFER_BINDING: number; - ATTACHED_SHADERS: number; - BACK: number; - BLEND: number; - BLEND_COLOR: number; - BLEND_DST_ALPHA: number; - BLEND_DST_RGB: number; - BLEND_EQUATION: number; - BLEND_EQUATION_ALPHA: number; - BLEND_EQUATION_RGB: number; - BLEND_SRC_ALPHA: number; - BLEND_SRC_RGB: number; - BLUE_BITS: number; - BOOL: number; - BOOL_VEC2: number; - BOOL_VEC3: number; - BOOL_VEC4: number; - BROWSER_DEFAULT_WEBGL: number; - BUFFER_SIZE: number; - BUFFER_USAGE: number; - BYTE: number; - CCW: number; - CLAMP_TO_EDGE: number; - COLOR_ATTACHMENT0: number; - COLOR_BUFFER_BIT: number; - COLOR_CLEAR_VALUE: number; - COLOR_WRITEMASK: number; - COMPILE_STATUS: number; - COMPRESSED_TEXTURE_FORMATS: number; - CONSTANT_ALPHA: number; - CONSTANT_COLOR: number; - CONTEXT_LOST_WEBGL: number; - CULL_FACE: number; - CULL_FACE_MODE: number; - CURRENT_PROGRAM: number; - CURRENT_VERTEX_ATTRIB: number; - CW: number; - DECR: number; - DECR_WRAP: number; - DELETE_STATUS: number; - DEPTH_ATTACHMENT: number; - DEPTH_BITS: number; - DEPTH_BUFFER_BIT: number; - DEPTH_CLEAR_VALUE: number; - DEPTH_COMPONENT: number; - DEPTH_COMPONENT16: number; - DEPTH_FUNC: number; - DEPTH_RANGE: number; - DEPTH_STENCIL: number; - DEPTH_STENCIL_ATTACHMENT: number; - DEPTH_TEST: number; - DEPTH_WRITEMASK: number; - DITHER: number; - DONT_CARE: number; - DST_ALPHA: number; - DST_COLOR: number; - DYNAMIC_DRAW: number; - ELEMENT_ARRAY_BUFFER: number; - ELEMENT_ARRAY_BUFFER_BINDING: number; - EQUAL: number; - FASTEST: number; - FLOAT: number; - FLOAT_MAT2: number; - FLOAT_MAT3: number; - FLOAT_MAT4: number; - FLOAT_VEC2: number; - FLOAT_VEC3: number; - FLOAT_VEC4: number; - FRAGMENT_SHADER: number; - FRAMEBUFFER: number; - FRAMEBUFFER_ATTACHMENT_OBJECT_NAME: number; - FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE: number; - FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE: number; - FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL: number; - FRAMEBUFFER_BINDING: number; - FRAMEBUFFER_COMPLETE: number; - FRAMEBUFFER_INCOMPLETE_ATTACHMENT: number; - FRAMEBUFFER_INCOMPLETE_DIMENSIONS: number; - FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT: number; - FRAMEBUFFER_UNSUPPORTED: number; - FRONT: number; - FRONT_AND_BACK: number; - FRONT_FACE: number; - FUNC_ADD: number; - FUNC_REVERSE_SUBTRACT: number; - FUNC_SUBTRACT: number; - GENERATE_MIPMAP_HINT: number; - GEQUAL: number; - GREATER: number; - GREEN_BITS: number; - HIGH_FLOAT: number; - HIGH_INT: number; - IMPLEMENTATION_COLOR_READ_FORMAT: number; - IMPLEMENTATION_COLOR_READ_TYPE: number; - INCR: number; - INCR_WRAP: number; - INT: number; - INT_VEC2: number; - INT_VEC3: number; - INT_VEC4: number; - INVALID_ENUM: number; - INVALID_FRAMEBUFFER_OPERATION: number; - INVALID_OPERATION: number; - INVALID_VALUE: number; - INVERT: number; - KEEP: number; - LEQUAL: number; - LESS: number; - LINEAR: number; - LINEAR_MIPMAP_LINEAR: number; - LINEAR_MIPMAP_NEAREST: number; - LINES: number; - LINE_LOOP: number; - LINE_STRIP: number; - LINE_WIDTH: number; - LINK_STATUS: number; - LOW_FLOAT: number; - LOW_INT: number; - LUMINANCE: number; - LUMINANCE_ALPHA: number; - MAX_COMBINED_TEXTURE_IMAGE_UNITS: number; - MAX_CUBE_MAP_TEXTURE_SIZE: number; - MAX_FRAGMENT_UNIFORM_VECTORS: number; - MAX_RENDERBUFFER_SIZE: number; - MAX_TEXTURE_IMAGE_UNITS: number; - MAX_TEXTURE_SIZE: number; - MAX_VARYING_VECTORS: number; - MAX_VERTEX_ATTRIBS: number; - MAX_VERTEX_TEXTURE_IMAGE_UNITS: number; - MAX_VERTEX_UNIFORM_VECTORS: number; - MAX_VIEWPORT_DIMS: number; - MEDIUM_FLOAT: number; - MEDIUM_INT: number; - MIRRORED_REPEAT: number; - NEAREST: number; - NEAREST_MIPMAP_LINEAR: number; - NEAREST_MIPMAP_NEAREST: number; - NEVER: number; - NICEST: number; - NONE: number; - NOTEQUAL: number; - NO_ERROR: number; - ONE: number; - ONE_MINUS_CONSTANT_ALPHA: number; - ONE_MINUS_CONSTANT_COLOR: number; - ONE_MINUS_DST_ALPHA: number; - ONE_MINUS_DST_COLOR: number; - ONE_MINUS_SRC_ALPHA: number; - ONE_MINUS_SRC_COLOR: number; - OUT_OF_MEMORY: number; - PACK_ALIGNMENT: number; - POINTS: number; - POLYGON_OFFSET_FACTOR: number; - POLYGON_OFFSET_FILL: number; - POLYGON_OFFSET_UNITS: number; - RED_BITS: number; - RENDERBUFFER: number; - RENDERBUFFER_ALPHA_SIZE: number; - RENDERBUFFER_BINDING: number; - RENDERBUFFER_BLUE_SIZE: number; - RENDERBUFFER_DEPTH_SIZE: number; - RENDERBUFFER_GREEN_SIZE: number; - RENDERBUFFER_HEIGHT: number; - RENDERBUFFER_INTERNAL_FORMAT: number; - RENDERBUFFER_RED_SIZE: number; - RENDERBUFFER_STENCIL_SIZE: number; - RENDERBUFFER_WIDTH: number; - RENDERER: number; - REPEAT: number; - REPLACE: number; - RGB: number; - RGB565: number; - RGB5_A1: number; - RGBA: number; - RGBA4: number; - SAMPLER_2D: number; - SAMPLER_CUBE: number; - SAMPLES: number; - SAMPLE_ALPHA_TO_COVERAGE: number; - SAMPLE_BUFFERS: number; - SAMPLE_COVERAGE: number; - SAMPLE_COVERAGE_INVERT: number; - SAMPLE_COVERAGE_VALUE: number; - SCISSOR_BOX: number; - SCISSOR_TEST: number; - SHADER_TYPE: number; - SHADING_LANGUAGE_VERSION: number; - SHORT: number; - SRC_ALPHA: number; - SRC_ALPHA_SATURATE: number; - SRC_COLOR: number; - STATIC_DRAW: number; - STENCIL_ATTACHMENT: number; - STENCIL_BACK_FAIL: number; - STENCIL_BACK_FUNC: number; - STENCIL_BACK_PASS_DEPTH_FAIL: number; - STENCIL_BACK_PASS_DEPTH_PASS: number; - STENCIL_BACK_REF: number; - STENCIL_BACK_VALUE_MASK: number; - STENCIL_BACK_WRITEMASK: number; - STENCIL_BITS: number; - STENCIL_BUFFER_BIT: number; - STENCIL_CLEAR_VALUE: number; - STENCIL_FAIL: number; - STENCIL_FUNC: number; - STENCIL_INDEX: number; - STENCIL_INDEX8: number; - STENCIL_PASS_DEPTH_FAIL: number; - STENCIL_PASS_DEPTH_PASS: number; - STENCIL_REF: number; - STENCIL_TEST: number; - STENCIL_VALUE_MASK: number; - STENCIL_WRITEMASK: number; - STREAM_DRAW: number; - SUBPIXEL_BITS: number; - TEXTURE: number; - TEXTURE0: number; - TEXTURE1: number; - TEXTURE10: number; - TEXTURE11: number; - TEXTURE12: number; - TEXTURE13: number; - TEXTURE14: number; - TEXTURE15: number; - TEXTURE16: number; - TEXTURE17: number; - TEXTURE18: number; - TEXTURE19: number; - TEXTURE2: number; - TEXTURE20: number; - TEXTURE21: number; - TEXTURE22: number; - TEXTURE23: number; - TEXTURE24: number; - TEXTURE25: number; - TEXTURE26: number; - TEXTURE27: number; - TEXTURE28: number; - TEXTURE29: number; - TEXTURE3: number; - TEXTURE30: number; - TEXTURE31: number; - TEXTURE4: number; - TEXTURE5: number; - TEXTURE6: number; - TEXTURE7: number; - TEXTURE8: number; - TEXTURE9: number; - TEXTURE_2D: number; - TEXTURE_BINDING_2D: number; - TEXTURE_BINDING_CUBE_MAP: number; - TEXTURE_CUBE_MAP: number; - TEXTURE_CUBE_MAP_NEGATIVE_X: number; - TEXTURE_CUBE_MAP_NEGATIVE_Y: number; - TEXTURE_CUBE_MAP_NEGATIVE_Z: number; - TEXTURE_CUBE_MAP_POSITIVE_X: number; - TEXTURE_CUBE_MAP_POSITIVE_Y: number; - TEXTURE_CUBE_MAP_POSITIVE_Z: number; - TEXTURE_MAG_FILTER: number; - TEXTURE_MIN_FILTER: number; - TEXTURE_WRAP_S: number; - TEXTURE_WRAP_T: number; - TRIANGLES: number; - TRIANGLE_FAN: number; - TRIANGLE_STRIP: number; - UNPACK_ALIGNMENT: number; - UNPACK_COLORSPACE_CONVERSION_WEBGL: number; - UNPACK_FLIP_Y_WEBGL: number; - UNPACK_PREMULTIPLY_ALPHA_WEBGL: number; - UNSIGNED_BYTE: number; - UNSIGNED_INT: number; - UNSIGNED_SHORT: number; - UNSIGNED_SHORT_4_4_4_4: number; - UNSIGNED_SHORT_5_5_5_1: number; - UNSIGNED_SHORT_5_6_5: number; - VALIDATE_STATUS: number; - VENDOR: number; - VERSION: number; - VERTEX_ATTRIB_ARRAY_BUFFER_BINDING: number; - VERTEX_ATTRIB_ARRAY_ENABLED: number; - VERTEX_ATTRIB_ARRAY_NORMALIZED: number; - VERTEX_ATTRIB_ARRAY_POINTER: number; - VERTEX_ATTRIB_ARRAY_SIZE: number; - VERTEX_ATTRIB_ARRAY_STRIDE: number; - VERTEX_ATTRIB_ARRAY_TYPE: number; - VERTEX_SHADER: number; - VIEWPORT: number; - ZERO: number; -} - -interface WebGLShader extends WebGLObject { -} - -declare var WebGLShader: { - prototype: WebGLShader; - new(): WebGLShader; -} - -interface WebGLShaderPrecisionFormat { - precision: number; - rangeMax: number; - rangeMin: number; -} - -declare var WebGLShaderPrecisionFormat: { - prototype: WebGLShaderPrecisionFormat; - new(): WebGLShaderPrecisionFormat; -} - -interface WebGLTexture extends WebGLObject { -} - -declare var WebGLTexture: { - prototype: WebGLTexture; - new(): WebGLTexture; -} - -interface WebGLUniformLocation { -} - -declare var WebGLUniformLocation: { - prototype: WebGLUniformLocation; - new(): WebGLUniformLocation; -} - -interface WebKitCSSMatrix { - a: number; - b: number; - c: number; - d: number; - e: number; - f: number; - m11: number; - m12: number; - m13: number; - m14: number; - m21: number; - m22: number; - m23: number; - m24: number; - m31: number; - m32: number; - m33: number; - m34: number; - m41: number; - m42: number; - m43: number; - m44: number; - inverse(): WebKitCSSMatrix; - multiply(secondMatrix: WebKitCSSMatrix): WebKitCSSMatrix; - rotate(angleX: number, angleY?: number, angleZ?: number): WebKitCSSMatrix; - rotateAxisAngle(x: number, y: number, z: number, angle: number): WebKitCSSMatrix; - scale(scaleX: number, scaleY?: number, scaleZ?: number): WebKitCSSMatrix; - setMatrixValue(value: string): void; - skewX(angle: number): WebKitCSSMatrix; - skewY(angle: number): WebKitCSSMatrix; - toString(): string; - translate(x: number, y: number, z?: number): WebKitCSSMatrix; -} - -declare var WebKitCSSMatrix: { - prototype: WebKitCSSMatrix; - new(text?: string): WebKitCSSMatrix; -} - -interface WebKitPoint { - x: number; - y: number; -} - -declare var WebKitPoint: { - prototype: WebKitPoint; - new(x?: number, y?: number): WebKitPoint; -} - -interface WebSocket extends EventTarget { - binaryType: string; - bufferedAmount: number; - extensions: string; - onclose: (ev: CloseEvent) => any; - onerror: (ev: Event) => any; - onmessage: (ev: MessageEvent) => any; - onopen: (ev: Event) => any; - protocol: string; - readyState: number; - url: string; - close(code?: number, reason?: string): void; - send(data: any): void; - CLOSED: number; - CLOSING: number; - CONNECTING: number; - OPEN: number; - addEventListener(type: "close", listener: (ev: CloseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "message", listener: (ev: MessageEvent) => any, useCapture?: boolean): void; - addEventListener(type: "open", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var WebSocket: { - prototype: WebSocket; - new(url: string, protocols?: string | string[]): WebSocket; - CLOSED: number; - CLOSING: number; - CONNECTING: number; - OPEN: number; -} - -interface WheelEvent extends MouseEvent { - deltaMode: number; - deltaX: number; - deltaY: number; - deltaZ: number; - getCurrentPoint(element: Element): void; - 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; - DOM_DELTA_LINE: number; - DOM_DELTA_PAGE: number; - DOM_DELTA_PIXEL: number; -} - -declare var WheelEvent: { - prototype: WheelEvent; - new(typeArg: string, eventInitDict?: WheelEventInit): WheelEvent; - DOM_DELTA_LINE: number; - DOM_DELTA_PAGE: number; - DOM_DELTA_PIXEL: number; -} - -interface Window extends EventTarget, WindowTimers, WindowSessionStorage, WindowLocalStorage, WindowConsole, GlobalEventHandlers, IDBEnvironment, WindowBase64 { - animationStartTime: number; - applicationCache: ApplicationCache; - clientInformation: Navigator; - closed: boolean; - crypto: Crypto; - defaultStatus: string; - devicePixelRatio: number; - doNotTrack: string; - document: Document; - event: Event; - external: External; - frameElement: Element; - frames: Window; - history: History; - innerHeight: number; - innerWidth: number; - length: number; - location: Location; - locationbar: BarProp; - menubar: BarProp; - msAnimationStartTime: number; - name: string; - navigator: Navigator; - offscreenBuffering: string | boolean; - onabort: (ev: Event) => any; - onafterprint: (ev: Event) => any; - onbeforeprint: (ev: Event) => any; - onbeforeunload: (ev: BeforeUnloadEvent) => any; - onblur: (ev: FocusEvent) => any; - oncanplay: (ev: Event) => any; - oncanplaythrough: (ev: Event) => any; - onchange: (ev: Event) => any; - onclick: (ev: MouseEvent) => any; - oncompassneedscalibration: (ev: Event) => any; - oncontextmenu: (ev: PointerEvent) => any; - ondblclick: (ev: MouseEvent) => any; - ondevicemotion: (ev: DeviceMotionEvent) => any; - ondeviceorientation: (ev: DeviceOrientationEvent) => any; - ondrag: (ev: DragEvent) => any; - ondragend: (ev: DragEvent) => any; - ondragenter: (ev: DragEvent) => any; - ondragleave: (ev: DragEvent) => any; - ondragover: (ev: DragEvent) => any; - ondragstart: (ev: DragEvent) => any; - ondrop: (ev: DragEvent) => any; - ondurationchange: (ev: Event) => any; - onemptied: (ev: Event) => any; - onended: (ev: Event) => any; - onerror: ErrorEventHandler; - onfocus: (ev: FocusEvent) => any; - onhashchange: (ev: HashChangeEvent) => any; - oninput: (ev: Event) => any; - onkeydown: (ev: KeyboardEvent) => any; - onkeypress: (ev: KeyboardEvent) => any; - onkeyup: (ev: KeyboardEvent) => any; - onload: (ev: Event) => any; - onloadeddata: (ev: Event) => any; - onloadedmetadata: (ev: Event) => any; - onloadstart: (ev: Event) => any; - onmessage: (ev: MessageEvent) => any; - onmousedown: (ev: MouseEvent) => any; - onmouseenter: (ev: MouseEvent) => any; - onmouseleave: (ev: MouseEvent) => any; - onmousemove: (ev: MouseEvent) => any; - onmouseout: (ev: MouseEvent) => any; - onmouseover: (ev: MouseEvent) => any; - onmouseup: (ev: MouseEvent) => any; - onmousewheel: (ev: MouseWheelEvent) => any; - onmsgesturechange: (ev: MSGestureEvent) => any; - onmsgesturedoubletap: (ev: MSGestureEvent) => any; - onmsgestureend: (ev: MSGestureEvent) => any; - onmsgesturehold: (ev: MSGestureEvent) => any; - onmsgesturestart: (ev: MSGestureEvent) => any; - onmsgesturetap: (ev: MSGestureEvent) => any; - onmsinertiastart: (ev: MSGestureEvent) => any; - onmspointercancel: (ev: MSPointerEvent) => any; - onmspointerdown: (ev: MSPointerEvent) => any; - onmspointerenter: (ev: MSPointerEvent) => any; - onmspointerleave: (ev: MSPointerEvent) => any; - onmspointermove: (ev: MSPointerEvent) => any; - onmspointerout: (ev: MSPointerEvent) => any; - onmspointerover: (ev: MSPointerEvent) => any; - onmspointerup: (ev: MSPointerEvent) => any; - onoffline: (ev: Event) => any; - ononline: (ev: Event) => any; - onorientationchange: (ev: Event) => any; - onpagehide: (ev: PageTransitionEvent) => any; - onpageshow: (ev: PageTransitionEvent) => any; - onpause: (ev: Event) => any; - onplay: (ev: Event) => any; - onplaying: (ev: Event) => any; - onpopstate: (ev: PopStateEvent) => any; - onprogress: (ev: ProgressEvent) => any; - onratechange: (ev: Event) => any; - onreadystatechange: (ev: ProgressEvent) => any; - onreset: (ev: Event) => any; - onresize: (ev: UIEvent) => any; - onscroll: (ev: UIEvent) => any; - onseeked: (ev: Event) => any; - onseeking: (ev: Event) => any; - onselect: (ev: UIEvent) => any; - onstalled: (ev: Event) => any; - onstorage: (ev: StorageEvent) => any; - onsubmit: (ev: Event) => any; - onsuspend: (ev: Event) => any; - ontimeupdate: (ev: Event) => any; - ontouchcancel: any; - ontouchend: any; - ontouchmove: any; - ontouchstart: any; - onunload: (ev: Event) => any; - onvolumechange: (ev: Event) => any; - onwaiting: (ev: Event) => any; - opener: Window; - orientation: string | number; - outerHeight: number; - outerWidth: number; - pageXOffset: number; - pageYOffset: number; - parent: Window; - performance: Performance; - personalbar: BarProp; - screen: Screen; - screenLeft: number; - screenTop: number; - screenX: number; - screenY: number; - scrollX: number; - scrollY: number; - scrollbars: BarProp; - self: Window; - status: string; - statusbar: BarProp; - styleMedia: StyleMedia; - toolbar: BarProp; - top: Window; - window: Window; - URL: URL; - alert(message?: any): void; - blur(): void; - cancelAnimationFrame(handle: number): void; - captureEvents(): void; - close(): void; - confirm(message?: string): boolean; - focus(): void; - getComputedStyle(elt: Element, pseudoElt?: string): CSSStyleDeclaration; - getMatchedCSSRules(elt: Element, pseudoElt?: string): CSSRuleList; - getSelection(): Selection; - matchMedia(mediaQuery: string): MediaQueryList; - moveBy(x?: number, y?: number): void; - moveTo(x?: number, y?: number): void; - msCancelRequestAnimationFrame(handle: number): void; - msMatchMedia(mediaQuery: string): MediaQueryList; - msRequestAnimationFrame(callback: FrameRequestCallback): number; - msWriteProfilerMark(profilerMarkName: string): void; - open(url?: string, target?: string, features?: string, replace?: boolean): Window; - postMessage(message: any, targetOrigin: string, ports?: any): void; - print(): void; - prompt(message?: string, _default?: string): string; - releaseEvents(): void; - requestAnimationFrame(callback: FrameRequestCallback): number; - resizeBy(x?: number, y?: number): void; - resizeTo(x?: number, y?: number): void; - scroll(x?: number, y?: number): void; - scrollBy(x?: number, y?: number): void; - scrollTo(x?: number, y?: number): void; - webkitConvertPointFromNodeToPage(node: Node, pt: WebKitPoint): WebKitPoint; - webkitConvertPointFromPageToNode(node: Node, pt: WebKitPoint): WebKitPoint; - addEventListener(type: "MSGestureChange", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureDoubleTap", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureEnd", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureHold", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureStart", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSGestureTap", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSInertiaStart", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerCancel", listener: (ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerDown", listener: (ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerEnter", listener: (ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerLeave", listener: (ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerMove", listener: (ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerOut", listener: (ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerOver", listener: (ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "MSPointerUp", listener: (ev: MSPointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "abort", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "afterprint", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "beforeprint", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "beforeunload", listener: (ev: BeforeUnloadEvent) => any, useCapture?: boolean): void; - addEventListener(type: "blur", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "canplay", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "canplaythrough", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "change", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "click", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "compassneedscalibration", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "contextmenu", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dblclick", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "devicemotion", listener: (ev: DeviceMotionEvent) => any, useCapture?: boolean): void; - addEventListener(type: "deviceorientation", listener: (ev: DeviceOrientationEvent) => any, useCapture?: boolean): void; - addEventListener(type: "drag", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragend", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragenter", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragleave", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragover", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "dragstart", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "drop", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "durationchange", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "emptied", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "ended", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "focus", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; - addEventListener(type: "hashchange", listener: (ev: HashChangeEvent) => any, useCapture?: boolean): void; - addEventListener(type: "input", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "keydown", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "keypress", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "keyup", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; - addEventListener(type: "load", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadeddata", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadedmetadata", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadstart", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "message", listener: (ev: MessageEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousedown", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseenter", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseleave", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousemove", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseout", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseover", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mouseup", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousewheel", listener: (ev: MouseWheelEvent) => any, useCapture?: boolean): void; - addEventListener(type: "offline", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "online", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "orientationchange", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "pagehide", listener: (ev: PageTransitionEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pageshow", listener: (ev: PageTransitionEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pause", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "play", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "playing", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "pointercancel", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerdown", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerenter", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerleave", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointermove", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerout", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerover", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerup", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "popstate", listener: (ev: PopStateEvent) => any, useCapture?: boolean): void; - addEventListener(type: "progress", listener: (ev: ProgressEvent) => any, useCapture?: boolean): void; - addEventListener(type: "ratechange", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "readystatechange", listener: (ev: ProgressEvent) => any, useCapture?: boolean): void; - addEventListener(type: "reset", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "resize", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "scroll", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "seeked", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "seeking", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "select", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "stalled", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "storage", listener: (ev: StorageEvent) => any, useCapture?: boolean): void; - addEventListener(type: "submit", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "suspend", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "timeupdate", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "unload", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "volumechange", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "waiting", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "wheel", listener: (ev: WheelEvent) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; - [index: number]: Window; -} - -declare var Window: { - prototype: Window; - new(): Window; -} - -interface Worker extends EventTarget, AbstractWorker { - onmessage: (ev: MessageEvent) => any; - postMessage(message: any, ports?: any): void; - terminate(): void; - addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "message", listener: (ev: MessageEvent) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var Worker: { - prototype: Worker; - new(stringUrl: string): Worker; -} - -interface XMLDocument extends Document { -} - -declare var XMLDocument: { - prototype: XMLDocument; - new(): XMLDocument; -} - -interface XMLHttpRequest extends EventTarget, XMLHttpRequestEventTarget { - msCaching: string; - onreadystatechange: (ev: ProgressEvent) => any; - readyState: number; - response: any; - responseBody: any; - responseText: string; - responseType: string; - responseXML: any; - status: number; - statusText: string; - timeout: number; - upload: XMLHttpRequestUpload; - withCredentials: boolean; - abort(): void; - getAllResponseHeaders(): string; - getResponseHeader(header: string): string; - msCachingEnabled(): boolean; - open(method: string, url: string, async?: boolean, user?: string, password?: string): void; - overrideMimeType(mime: string): void; - send(data?: Document): void; - send(data?: string): void; - send(data?: any): void; - setRequestHeader(header: string, value: string): void; - DONE: number; - HEADERS_RECEIVED: number; - LOADING: number; - OPENED: number; - UNSENT: number; - addEventListener(type: "abort", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "load", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadend", listener: (ev: ProgressEvent) => any, useCapture?: boolean): void; - addEventListener(type: "loadstart", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "progress", listener: (ev: ProgressEvent) => any, useCapture?: boolean): void; - addEventListener(type: "readystatechange", listener: (ev: ProgressEvent) => any, useCapture?: boolean): void; - addEventListener(type: "timeout", listener: (ev: ProgressEvent) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var XMLHttpRequest: { - prototype: XMLHttpRequest; - new(): XMLHttpRequest; - DONE: number; - HEADERS_RECEIVED: number; - LOADING: number; - OPENED: number; - UNSENT: number; - create(): XMLHttpRequest; -} - -interface XMLHttpRequestUpload extends EventTarget, XMLHttpRequestEventTarget { - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -declare var XMLHttpRequestUpload: { - prototype: XMLHttpRequestUpload; - new(): XMLHttpRequestUpload; -} - -interface XMLSerializer { - serializeToString(target: Node): string; -} - -declare var XMLSerializer: { - prototype: XMLSerializer; - new(): XMLSerializer; -} - -interface XPathEvaluator { - createExpression(expression: string, resolver: XPathNSResolver): XPathExpression; - createNSResolver(nodeResolver?: Node): XPathNSResolver; - evaluate(expression: string, contextNode: Node, resolver: XPathNSResolver, type: number, result: XPathResult): XPathResult; -} - -declare var XPathEvaluator: { - prototype: XPathEvaluator; - new(): XPathEvaluator; -} - -interface XPathExpression { - evaluate(contextNode: Node, type: number, result: XPathResult): XPathExpression; -} - -declare var XPathExpression: { - prototype: XPathExpression; - new(): XPathExpression; -} - -interface XPathNSResolver { - lookupNamespaceURI(prefix: string): string; -} - -declare var XPathNSResolver: { - prototype: XPathNSResolver; - new(): XPathNSResolver; -} - -interface XPathResult { - booleanValue: boolean; - invalidIteratorState: boolean; - numberValue: number; - resultType: number; - singleNodeValue: Node; - snapshotLength: number; - stringValue: string; - iterateNext(): Node; - snapshotItem(index: number): Node; - ANY_TYPE: number; - ANY_UNORDERED_NODE_TYPE: number; - BOOLEAN_TYPE: number; - FIRST_ORDERED_NODE_TYPE: number; - NUMBER_TYPE: number; - ORDERED_NODE_ITERATOR_TYPE: number; - ORDERED_NODE_SNAPSHOT_TYPE: number; - STRING_TYPE: number; - UNORDERED_NODE_ITERATOR_TYPE: number; - UNORDERED_NODE_SNAPSHOT_TYPE: number; -} - -declare var XPathResult: { - prototype: XPathResult; - new(): XPathResult; - ANY_TYPE: number; - ANY_UNORDERED_NODE_TYPE: number; - BOOLEAN_TYPE: number; - FIRST_ORDERED_NODE_TYPE: number; - NUMBER_TYPE: number; - ORDERED_NODE_ITERATOR_TYPE: number; - ORDERED_NODE_SNAPSHOT_TYPE: number; - STRING_TYPE: number; - UNORDERED_NODE_ITERATOR_TYPE: number; - UNORDERED_NODE_SNAPSHOT_TYPE: number; -} - -interface XSLTProcessor { - clearParameters(): void; - getParameter(namespaceURI: string, localName: string): any; - importStylesheet(style: Node): void; - removeParameter(namespaceURI: string, localName: string): void; - reset(): void; - setParameter(namespaceURI: string, localName: string, value: any): void; - transformToDocument(source: Node): Document; - transformToFragment(source: Node, document: Document): DocumentFragment; -} - -declare var XSLTProcessor: { - prototype: XSLTProcessor; - new(): XSLTProcessor; -} - -interface AbstractWorker { - onerror: (ev: Event) => any; - addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -interface ChildNode { - remove(): void; -} - -interface DOML2DeprecatedColorProperty { - color: string; -} - -interface DOML2DeprecatedSizeProperty { - size: number; -} - -interface DocumentEvent { - createEvent(eventInterface:"AnimationEvent"): AnimationEvent; - createEvent(eventInterface:"AriaRequestEvent"): AriaRequestEvent; - createEvent(eventInterface:"AudioProcessingEvent"): AudioProcessingEvent; - createEvent(eventInterface:"BeforeUnloadEvent"): BeforeUnloadEvent; - createEvent(eventInterface:"ClipboardEvent"): ClipboardEvent; - createEvent(eventInterface:"CloseEvent"): CloseEvent; - createEvent(eventInterface:"CommandEvent"): CommandEvent; - createEvent(eventInterface:"CompositionEvent"): CompositionEvent; - createEvent(eventInterface:"CustomEvent"): CustomEvent; - createEvent(eventInterface:"DeviceMotionEvent"): DeviceMotionEvent; - createEvent(eventInterface:"DeviceOrientationEvent"): DeviceOrientationEvent; - createEvent(eventInterface:"DragEvent"): DragEvent; - createEvent(eventInterface:"ErrorEvent"): ErrorEvent; - createEvent(eventInterface:"Event"): Event; - createEvent(eventInterface:"Events"): Event; - createEvent(eventInterface:"FocusEvent"): FocusEvent; - createEvent(eventInterface:"GamepadEvent"): GamepadEvent; - createEvent(eventInterface:"HashChangeEvent"): HashChangeEvent; - createEvent(eventInterface:"IDBVersionChangeEvent"): IDBVersionChangeEvent; - createEvent(eventInterface:"KeyboardEvent"): KeyboardEvent; - createEvent(eventInterface:"LongRunningScriptDetectedEvent"): LongRunningScriptDetectedEvent; - createEvent(eventInterface:"MSGestureEvent"): MSGestureEvent; - createEvent(eventInterface:"MSManipulationEvent"): MSManipulationEvent; - createEvent(eventInterface:"MSMediaKeyMessageEvent"): MSMediaKeyMessageEvent; - createEvent(eventInterface:"MSMediaKeyNeededEvent"): MSMediaKeyNeededEvent; - createEvent(eventInterface:"MSPointerEvent"): MSPointerEvent; - createEvent(eventInterface:"MSSiteModeEvent"): MSSiteModeEvent; - createEvent(eventInterface:"MessageEvent"): MessageEvent; - createEvent(eventInterface:"MouseEvent"): MouseEvent; - createEvent(eventInterface:"MouseEvents"): MouseEvent; - createEvent(eventInterface:"MouseWheelEvent"): MouseWheelEvent; - createEvent(eventInterface:"MutationEvent"): MutationEvent; - createEvent(eventInterface:"MutationEvents"): MutationEvent; - createEvent(eventInterface:"NavigationCompletedEvent"): NavigationCompletedEvent; - createEvent(eventInterface:"NavigationEvent"): NavigationEvent; - createEvent(eventInterface:"NavigationEventWithReferrer"): NavigationEventWithReferrer; - createEvent(eventInterface:"OfflineAudioCompletionEvent"): OfflineAudioCompletionEvent; - createEvent(eventInterface:"PageTransitionEvent"): PageTransitionEvent; - createEvent(eventInterface:"PermissionRequestedEvent"): PermissionRequestedEvent; - createEvent(eventInterface:"PointerEvent"): PointerEvent; - createEvent(eventInterface:"PopStateEvent"): PopStateEvent; - createEvent(eventInterface:"ProgressEvent"): ProgressEvent; - createEvent(eventInterface:"SVGZoomEvent"): SVGZoomEvent; - createEvent(eventInterface:"SVGZoomEvents"): SVGZoomEvent; - createEvent(eventInterface:"ScriptNotifyEvent"): ScriptNotifyEvent; - createEvent(eventInterface:"StorageEvent"): StorageEvent; - createEvent(eventInterface:"TextEvent"): TextEvent; - createEvent(eventInterface:"TouchEvent"): TouchEvent; - createEvent(eventInterface:"TrackEvent"): TrackEvent; - createEvent(eventInterface:"TransitionEvent"): TransitionEvent; - createEvent(eventInterface:"UIEvent"): UIEvent; - createEvent(eventInterface:"UIEvents"): UIEvent; - createEvent(eventInterface:"UnviewableContentIdentifiedEvent"): UnviewableContentIdentifiedEvent; - createEvent(eventInterface:"WebGLContextEvent"): WebGLContextEvent; - createEvent(eventInterface:"WheelEvent"): WheelEvent; - createEvent(eventInterface: string): Event; -} - -interface ElementTraversal { - childElementCount: number; - firstElementChild: Element; - lastElementChild: Element; - nextElementSibling: Element; - previousElementSibling: Element; -} - -interface GetSVGDocument { - getSVGDocument(): Document; -} - -interface GlobalEventHandlers { - onpointercancel: (ev: PointerEvent) => any; - onpointerdown: (ev: PointerEvent) => any; - onpointerenter: (ev: PointerEvent) => any; - onpointerleave: (ev: PointerEvent) => any; - onpointermove: (ev: PointerEvent) => any; - onpointerout: (ev: PointerEvent) => any; - onpointerover: (ev: PointerEvent) => any; - onpointerup: (ev: PointerEvent) => any; - onwheel: (ev: WheelEvent) => any; - addEventListener(type: "pointercancel", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerdown", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerenter", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerleave", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointermove", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerout", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerover", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "pointerup", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "wheel", listener: (ev: WheelEvent) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -interface HTMLTableAlignment { - /** - * Sets or retrieves a value that you can use to implement your own ch functionality for the object. - */ - ch: string; - /** - * Sets or retrieves a value that you can use to implement your own chOff functionality for the object. - */ - chOff: string; - /** - * Sets or retrieves how text and other content are vertically aligned within the object that contains them. - */ - vAlign: string; -} - -interface IDBEnvironment { - indexedDB: IDBFactory; - msIndexedDB: IDBFactory; -} - -interface LinkStyle { - sheet: StyleSheet; -} - -interface MSBaseReader { - onabort: (ev: Event) => any; - onerror: (ev: Event) => any; - onload: (ev: Event) => any; - onloadend: (ev: ProgressEvent) => any; - onloadstart: (ev: Event) => any; - onprogress: (ev: ProgressEvent) => any; - readyState: number; - result: any; - abort(): void; - DONE: number; - EMPTY: number; - LOADING: number; - addEventListener(type: "abort", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "load", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadend", listener: (ev: ProgressEvent) => any, useCapture?: boolean): void; - addEventListener(type: "loadstart", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "progress", listener: (ev: ProgressEvent) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -interface MSFileSaver { - msSaveBlob(blob: any, defaultName?: string): boolean; - msSaveOrOpenBlob(blob: any, defaultName?: string): boolean; -} - -interface MSNavigatorDoNotTrack { - confirmSiteSpecificTrackingException(args: ConfirmSiteSpecificExceptionsInformation): boolean; - confirmWebWideTrackingException(args: ExceptionInformation): boolean; - removeSiteSpecificTrackingException(args: ExceptionInformation): void; - removeWebWideTrackingException(args: ExceptionInformation): void; - storeSiteSpecificTrackingException(args: StoreSiteSpecificExceptionsInformation): void; - storeWebWideTrackingException(args: StoreExceptionsInformation): void; -} - -interface NavigatorContentUtils { -} - -interface NavigatorGeolocation { - geolocation: Geolocation; -} - -interface NavigatorID { - appName: string; - appVersion: string; - platform: string; - product: string; - productSub: string; - userAgent: string; - vendor: string; - vendorSub: string; -} - -interface NavigatorOnLine { - onLine: boolean; -} - -interface NavigatorStorageUtils { -} - -interface NodeSelector { - querySelector(selectors: string): Element; - querySelectorAll(selectors: string): NodeListOf; -} - -interface RandomSource { - getRandomValues(array: ArrayBufferView): ArrayBufferView; -} - -interface SVGAnimatedPathData { - pathSegList: SVGPathSegList; -} - -interface SVGAnimatedPoints { - animatedPoints: SVGPointList; - points: SVGPointList; -} - -interface SVGExternalResourcesRequired { - externalResourcesRequired: SVGAnimatedBoolean; -} - -interface SVGFilterPrimitiveStandardAttributes extends SVGStylable { - height: SVGAnimatedLength; - result: SVGAnimatedString; - width: SVGAnimatedLength; - x: SVGAnimatedLength; - y: SVGAnimatedLength; -} - -interface SVGFitToViewBox { - preserveAspectRatio: SVGAnimatedPreserveAspectRatio; - viewBox: SVGAnimatedRect; -} - -interface SVGLangSpace { - xmllang: string; - xmlspace: string; -} - -interface SVGLocatable { - farthestViewportElement: SVGElement; - nearestViewportElement: SVGElement; - getBBox(): SVGRect; - getCTM(): SVGMatrix; - getScreenCTM(): SVGMatrix; - getTransformToElement(element: SVGElement): SVGMatrix; -} - -interface SVGStylable { - className: any; - style: CSSStyleDeclaration; -} - -interface SVGTests { - requiredExtensions: SVGStringList; - requiredFeatures: SVGStringList; - systemLanguage: SVGStringList; - hasExtension(extension: string): boolean; -} - -interface SVGTransformable extends SVGLocatable { - transform: SVGAnimatedTransformList; -} - -interface SVGURIReference { - href: SVGAnimatedString; -} - -interface WindowBase64 { - atob(encodedString: string): string; - btoa(rawString: string): string; -} - -interface WindowConsole { - console: Console; -} - -interface WindowLocalStorage { - localStorage: Storage; -} - -interface WindowSessionStorage { - sessionStorage: Storage; -} - -interface WindowTimers extends Object, WindowTimersExtension { - clearInterval(handle: number): void; - clearTimeout(handle: number): void; - setInterval(handler: any, timeout?: any, ...args: any[]): number; - setTimeout(handler: any, timeout?: any, ...args: any[]): number; -} - -interface WindowTimersExtension { - clearImmediate(handle: number): void; - msClearImmediate(handle: number): void; - msSetImmediate(expression: any, ...args: any[]): number; - setImmediate(expression: any, ...args: any[]): number; -} - -interface XMLHttpRequestEventTarget { - onabort: (ev: Event) => any; - onerror: (ev: Event) => any; - onload: (ev: Event) => any; - onloadend: (ev: ProgressEvent) => any; - onloadstart: (ev: Event) => any; - onprogress: (ev: ProgressEvent) => any; - ontimeout: (ev: ProgressEvent) => any; - addEventListener(type: "abort", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; - addEventListener(type: "load", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "loadend", listener: (ev: ProgressEvent) => any, useCapture?: boolean): void; - addEventListener(type: "loadstart", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "progress", listener: (ev: ProgressEvent) => any, useCapture?: boolean): void; - addEventListener(type: "timeout", listener: (ev: ProgressEvent) => any, useCapture?: boolean): void; - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -} - -interface StorageEventInit extends EventInit { - key?: string; - oldValue?: string; - newValue?: string; - url: string; - storageArea?: Storage; -} - -interface IDBObjectStoreParameters { - keyPath?: string | string[]; - autoIncrement?: boolean; -} - -interface IDBIndexParameters { - unique?: boolean; - multiEntry?: boolean; -} - -interface NodeListOf extends NodeList { - length: number; - item(index: number): TNode; - [index: number]: TNode; -} - -interface BlobPropertyBag { - type?: string; - endings?: string; -} - -interface FilePropertyBag { - type?: string; - lastModified?: number; -} - -interface EventListenerObject { - handleEvent(evt: Event): void; -} - -interface MessageEventInit extends EventInit { - data?: any; - origin?: string; - lastEventId?: string; - channel?: string; - source?: any; - ports?: MessagePort[]; -} - -interface ProgressEventInit extends EventInit { - lengthComputable?: boolean; - loaded?: number; - total?: number; -} - -interface HTMLTemplateElement extends HTMLElement { - content: DocumentFragment; -} - -declare var HTMLTemplateElement: { - prototype: HTMLTemplateElement; - new(): HTMLTemplateElement; -} - -interface HTMLPictureElement extends HTMLElement { -} - -declare var HTMLPictureElement: { - prototype: HTMLPictureElement; - new(): HTMLPictureElement; -} - -declare type EventListenerOrEventListenerObject = EventListener | EventListenerObject; - -interface ErrorEventHandler { - (message: string, filename?: string, lineno?: number, colno?: number, error?:Error): void; -} -interface PositionCallback { - (position: Position): void; -} -interface PositionErrorCallback { - (error: PositionError): void; -} -interface MediaQueryListListener { - (mql: MediaQueryList): void; -} -interface MSLaunchUriCallback { - (): void; -} -interface FrameRequestCallback { - (time: number): void; -} -interface MSUnsafeFunctionCallback { - (): any; -} -interface MSExecAtPriorityFunctionCallback { - (...args: any[]): any; -} -interface MutationCallback { - (mutations: MutationRecord[], observer: MutationObserver): void; -} -interface DecodeSuccessCallback { - (decodedData: AudioBuffer): void; -} -interface DecodeErrorCallback { - (error: DOMException): void; -} -interface FunctionStringCallback { - (data: string): void; -} -declare var Audio: {new(src?: string): HTMLAudioElement; }; -declare var Image: {new(width?: number, height?: number): HTMLImageElement; }; -declare var Option: {new(text?: string, value?: string, defaultSelected?: boolean, selected?: boolean): HTMLOptionElement; }; -declare var animationStartTime: number; -declare var applicationCache: ApplicationCache; -declare var clientInformation: Navigator; -declare var closed: boolean; -declare var crypto: Crypto; -declare var defaultStatus: string; -declare var devicePixelRatio: number; -declare var doNotTrack: string; -declare var document: Document; -declare var event: Event; -declare var external: External; -declare var frameElement: Element; -declare var frames: Window; -declare var history: History; -declare var innerHeight: number; -declare var innerWidth: number; -declare var length: number; -declare var location: Location; -declare var locationbar: BarProp; -declare var menubar: BarProp; -declare var msAnimationStartTime: number; -declare var name: string; -declare var navigator: Navigator; -declare var offscreenBuffering: string | boolean; -declare var onabort: (ev: Event) => any; -declare var onafterprint: (ev: Event) => any; -declare var onbeforeprint: (ev: Event) => any; -declare var onbeforeunload: (ev: BeforeUnloadEvent) => any; -declare var onblur: (ev: FocusEvent) => any; -declare var oncanplay: (ev: Event) => any; -declare var oncanplaythrough: (ev: Event) => any; -declare var onchange: (ev: Event) => any; -declare var onclick: (ev: MouseEvent) => any; -declare var oncompassneedscalibration: (ev: Event) => any; -declare var oncontextmenu: (ev: PointerEvent) => any; -declare var ondblclick: (ev: MouseEvent) => any; -declare var ondevicemotion: (ev: DeviceMotionEvent) => any; -declare var ondeviceorientation: (ev: DeviceOrientationEvent) => any; -declare var ondrag: (ev: DragEvent) => any; -declare var ondragend: (ev: DragEvent) => any; -declare var ondragenter: (ev: DragEvent) => any; -declare var ondragleave: (ev: DragEvent) => any; -declare var ondragover: (ev: DragEvent) => any; -declare var ondragstart: (ev: DragEvent) => any; -declare var ondrop: (ev: DragEvent) => any; -declare var ondurationchange: (ev: Event) => any; -declare var onemptied: (ev: Event) => any; -declare var onended: (ev: Event) => any; -declare var onerror: ErrorEventHandler; -declare var onfocus: (ev: FocusEvent) => any; -declare var onhashchange: (ev: HashChangeEvent) => any; -declare var oninput: (ev: Event) => any; -declare var onkeydown: (ev: KeyboardEvent) => any; -declare var onkeypress: (ev: KeyboardEvent) => any; -declare var onkeyup: (ev: KeyboardEvent) => any; -declare var onload: (ev: Event) => any; -declare var onloadeddata: (ev: Event) => any; -declare var onloadedmetadata: (ev: Event) => any; -declare var onloadstart: (ev: Event) => any; -declare var onmessage: (ev: MessageEvent) => any; -declare var onmousedown: (ev: MouseEvent) => any; -declare var onmouseenter: (ev: MouseEvent) => any; -declare var onmouseleave: (ev: MouseEvent) => any; -declare var onmousemove: (ev: MouseEvent) => any; -declare var onmouseout: (ev: MouseEvent) => any; -declare var onmouseover: (ev: MouseEvent) => any; -declare var onmouseup: (ev: MouseEvent) => any; -declare var onmousewheel: (ev: MouseWheelEvent) => any; -declare var onmsgesturechange: (ev: MSGestureEvent) => any; -declare var onmsgesturedoubletap: (ev: MSGestureEvent) => any; -declare var onmsgestureend: (ev: MSGestureEvent) => any; -declare var onmsgesturehold: (ev: MSGestureEvent) => any; -declare var onmsgesturestart: (ev: MSGestureEvent) => any; -declare var onmsgesturetap: (ev: MSGestureEvent) => any; -declare var onmsinertiastart: (ev: MSGestureEvent) => any; -declare var onmspointercancel: (ev: MSPointerEvent) => any; -declare var onmspointerdown: (ev: MSPointerEvent) => any; -declare var onmspointerenter: (ev: MSPointerEvent) => any; -declare var onmspointerleave: (ev: MSPointerEvent) => any; -declare var onmspointermove: (ev: MSPointerEvent) => any; -declare var onmspointerout: (ev: MSPointerEvent) => any; -declare var onmspointerover: (ev: MSPointerEvent) => any; -declare var onmspointerup: (ev: MSPointerEvent) => any; -declare var onoffline: (ev: Event) => any; -declare var ononline: (ev: Event) => any; -declare var onorientationchange: (ev: Event) => any; -declare var onpagehide: (ev: PageTransitionEvent) => any; -declare var onpageshow: (ev: PageTransitionEvent) => any; -declare var onpause: (ev: Event) => any; -declare var onplay: (ev: Event) => any; -declare var onplaying: (ev: Event) => any; -declare var onpopstate: (ev: PopStateEvent) => any; -declare var onprogress: (ev: ProgressEvent) => any; -declare var onratechange: (ev: Event) => any; -declare var onreadystatechange: (ev: ProgressEvent) => any; -declare var onreset: (ev: Event) => any; -declare var onresize: (ev: UIEvent) => any; -declare var onscroll: (ev: UIEvent) => any; -declare var onseeked: (ev: Event) => any; -declare var onseeking: (ev: Event) => any; -declare var onselect: (ev: UIEvent) => any; -declare var onstalled: (ev: Event) => any; -declare var onstorage: (ev: StorageEvent) => any; -declare var onsubmit: (ev: Event) => any; -declare var onsuspend: (ev: Event) => any; -declare var ontimeupdate: (ev: Event) => any; -declare var ontouchcancel: any; -declare var ontouchend: any; -declare var ontouchmove: any; -declare var ontouchstart: any; -declare var onunload: (ev: Event) => any; -declare var onvolumechange: (ev: Event) => any; -declare var onwaiting: (ev: Event) => any; -declare var opener: Window; -declare var orientation: string | number; -declare var outerHeight: number; -declare var outerWidth: number; -declare var pageXOffset: number; -declare var pageYOffset: number; -declare var parent: Window; -declare var performance: Performance; -declare var personalbar: BarProp; -declare var screen: Screen; -declare var screenLeft: number; -declare var screenTop: number; -declare var screenX: number; -declare var screenY: number; -declare var scrollX: number; -declare var scrollY: number; -declare var scrollbars: BarProp; -declare var self: Window; -declare var status: string; -declare var statusbar: BarProp; -declare var styleMedia: StyleMedia; -declare var toolbar: BarProp; -declare var top: Window; -declare var window: Window; -declare var URL: URL; -declare function alert(message?: any): void; -declare function blur(): void; -declare function cancelAnimationFrame(handle: number): void; -declare function captureEvents(): void; -declare function close(): void; -declare function confirm(message?: string): boolean; -declare function focus(): void; -declare function getComputedStyle(elt: Element, pseudoElt?: string): CSSStyleDeclaration; -declare function getMatchedCSSRules(elt: Element, pseudoElt?: string): CSSRuleList; -declare function getSelection(): Selection; -declare function matchMedia(mediaQuery: string): MediaQueryList; -declare function moveBy(x?: number, y?: number): void; -declare function moveTo(x?: number, y?: number): void; -declare function msCancelRequestAnimationFrame(handle: number): void; -declare function msMatchMedia(mediaQuery: string): MediaQueryList; -declare function msRequestAnimationFrame(callback: FrameRequestCallback): number; -declare function msWriteProfilerMark(profilerMarkName: string): void; -declare function open(url?: string, target?: string, features?: string, replace?: boolean): Window; -declare function postMessage(message: any, targetOrigin: string, ports?: any): void; -declare function print(): void; -declare function prompt(message?: string, _default?: string): string; -declare function releaseEvents(): void; -declare function requestAnimationFrame(callback: FrameRequestCallback): number; -declare function resizeBy(x?: number, y?: number): void; -declare function resizeTo(x?: number, y?: number): void; -declare function scroll(x?: number, y?: number): void; -declare function scrollBy(x?: number, y?: number): void; -declare function scrollTo(x?: number, y?: number): void; -declare function webkitConvertPointFromNodeToPage(node: Node, pt: WebKitPoint): WebKitPoint; -declare function webkitConvertPointFromPageToNode(node: Node, pt: WebKitPoint): WebKitPoint; -declare function toString(): string; -declare function addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -declare function dispatchEvent(evt: Event): boolean; -declare function removeEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; -declare function clearInterval(handle: number): void; -declare function clearTimeout(handle: number): void; -declare function setInterval(handler: any, timeout?: any, ...args: any[]): number; -declare function setTimeout(handler: any, timeout?: any, ...args: any[]): number; -declare function clearImmediate(handle: number): void; -declare function msClearImmediate(handle: number): void; -declare function msSetImmediate(expression: any, ...args: any[]): number; -declare function setImmediate(expression: any, ...args: any[]): number; -declare var sessionStorage: Storage; -declare var localStorage: Storage; -declare var console: Console; -declare var onpointercancel: (ev: PointerEvent) => any; -declare var onpointerdown: (ev: PointerEvent) => any; -declare var onpointerenter: (ev: PointerEvent) => any; -declare var onpointerleave: (ev: PointerEvent) => any; -declare var onpointermove: (ev: PointerEvent) => any; -declare var onpointerout: (ev: PointerEvent) => any; -declare var onpointerover: (ev: PointerEvent) => any; -declare var onpointerup: (ev: PointerEvent) => any; -declare var onwheel: (ev: WheelEvent) => any; -declare var indexedDB: IDBFactory; -declare var msIndexedDB: IDBFactory; -declare function atob(encodedString: string): string; -declare function btoa(rawString: string): string; -declare function addEventListener(type: "MSGestureChange", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "MSGestureDoubleTap", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "MSGestureEnd", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "MSGestureHold", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "MSGestureStart", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "MSGestureTap", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "MSInertiaStart", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "MSPointerCancel", listener: (ev: MSPointerEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "MSPointerDown", listener: (ev: MSPointerEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "MSPointerEnter", listener: (ev: MSPointerEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "MSPointerLeave", listener: (ev: MSPointerEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "MSPointerMove", listener: (ev: MSPointerEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "MSPointerOut", listener: (ev: MSPointerEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "MSPointerOver", listener: (ev: MSPointerEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "MSPointerUp", listener: (ev: MSPointerEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "abort", listener: (ev: UIEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "afterprint", listener: (ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "beforeprint", listener: (ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "beforeunload", listener: (ev: BeforeUnloadEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "blur", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "canplay", listener: (ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "canplaythrough", listener: (ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "change", listener: (ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "click", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "compassneedscalibration", listener: (ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "contextmenu", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "dblclick", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "devicemotion", listener: (ev: DeviceMotionEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "deviceorientation", listener: (ev: DeviceOrientationEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "drag", listener: (ev: DragEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "dragend", listener: (ev: DragEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "dragenter", listener: (ev: DragEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "dragleave", listener: (ev: DragEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "dragover", listener: (ev: DragEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "dragstart", listener: (ev: DragEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "drop", listener: (ev: DragEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "durationchange", listener: (ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "emptied", listener: (ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "ended", listener: (ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "focus", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "hashchange", listener: (ev: HashChangeEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "input", listener: (ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "keydown", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "keypress", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "keyup", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "load", listener: (ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "loadeddata", listener: (ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "loadedmetadata", listener: (ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "loadstart", listener: (ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "message", listener: (ev: MessageEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "mousedown", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "mouseenter", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "mouseleave", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "mousemove", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "mouseout", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "mouseover", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "mouseup", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "mousewheel", listener: (ev: MouseWheelEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "offline", listener: (ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "online", listener: (ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "orientationchange", listener: (ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "pagehide", listener: (ev: PageTransitionEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "pageshow", listener: (ev: PageTransitionEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "pause", listener: (ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "play", listener: (ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "playing", listener: (ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "pointercancel", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "pointerdown", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "pointerenter", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "pointerleave", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "pointermove", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "pointerout", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "pointerover", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "pointerup", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "popstate", listener: (ev: PopStateEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "progress", listener: (ev: ProgressEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "ratechange", listener: (ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "readystatechange", listener: (ev: ProgressEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "reset", listener: (ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "resize", listener: (ev: UIEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "scroll", listener: (ev: UIEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "seeked", listener: (ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "seeking", listener: (ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "select", listener: (ev: UIEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "stalled", listener: (ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "storage", listener: (ev: StorageEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "submit", listener: (ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "suspend", listener: (ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "timeupdate", listener: (ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "unload", listener: (ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "volumechange", listener: (ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "waiting", listener: (ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "wheel", listener: (ev: WheelEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;interface DOMTokenList { - [Symbol.iterator](): IterableIterator; -} - -interface NodeList { - [Symbol.iterator](): IterableIterator -} - -interface NodeListOf { - [Symbol.iterator](): IterableIterator -} - -///////////////////////////// -/// WorkerGlobalScope APIs -///////////////////////////// -// These are only available in a Web Worker -declare function importScripts(...urls: string[]): void; - - -///////////////////////////// -/// Windows Script Host APIS -///////////////////////////// - - -interface ActiveXObject { - new (s: string): any; -} -declare var ActiveXObject: ActiveXObject; - -interface ITextWriter { - Write(s: string): void; - WriteLine(s: string): void; - Close(): void; -} - -interface TextStreamBase { - /** - * The column number of the current character position in an input stream. - */ - Column: number; - - /** - * The current line number in an input stream. - */ - Line: number; - - /** - * Closes a text stream. - * It is not necessary to close standard streams; they close automatically when the process ends. If - * you close a standard stream, be aware that any other pointers to that standard stream become invalid. - */ - Close(): void; -} - -interface TextStreamWriter extends TextStreamBase { - /** - * Sends a string to an output stream. - */ - Write(s: string): void; - - /** - * Sends a specified number of blank lines (newline characters) to an output stream. - */ - WriteBlankLines(intLines: number): void; - - /** - * Sends a string followed by a newline character to an output stream. - */ - WriteLine(s: string): void; -} - -interface TextStreamReader extends TextStreamBase { - /** - * Returns a specified number of characters from an input stream, starting at the current pointer position. - * Does not return until the ENTER key is pressed. - * Can only be used on a stream in reading mode; causes an error in writing or appending mode. - */ - Read(characters: number): string; - - /** - * Returns all characters from an input stream. - * Can only be used on a stream in reading mode; causes an error in writing or appending mode. - */ - ReadAll(): string; - - /** - * Returns an entire line from an input stream. - * Although this method extracts the newline character, it does not add it to the returned string. - * Can only be used on a stream in reading mode; causes an error in writing or appending mode. - */ - ReadLine(): string; - - /** - * Skips a specified number of characters when reading from an input text stream. - * Can only be used on a stream in reading mode; causes an error in writing or appending mode. - * @param characters Positive number of characters to skip forward. (Backward skipping is not supported.) - */ - Skip(characters: number): void; - - /** - * Skips the next line when reading from an input text stream. - * Can only be used on a stream in reading mode, not writing or appending mode. - */ - SkipLine(): void; - - /** - * Indicates whether the stream pointer position is at the end of a line. - */ - AtEndOfLine: boolean; - - /** - * Indicates whether the stream pointer position is at the end of a stream. - */ - AtEndOfStream: boolean; -} - -declare var WScript: { - /** - * Outputs text to either a message box (under WScript.exe) or the command console window followed by - * a newline (under CScript.exe). - */ - Echo(s: any): void; - - /** - * Exposes the write-only error output stream for the current script. - * Can be accessed only while using CScript.exe. - */ - StdErr: TextStreamWriter; - - /** - * Exposes the write-only output stream for the current script. - * Can be accessed only while using CScript.exe. - */ - StdOut: TextStreamWriter; - Arguments: { length: number; Item(n: number): string; }; - - /** - * The full path of the currently running script. - */ - ScriptFullName: string; - - /** - * Forces the script to stop immediately, with an optional exit code. - */ - Quit(exitCode?: number): number; - - /** - * The Windows Script Host build version number. - */ - BuildVersion: number; - - /** - * Fully qualified path of the host executable. - */ - FullName: string; - - /** - * Gets/sets the script mode - interactive(true) or batch(false). - */ - Interactive: boolean; - - /** - * The name of the host executable (WScript.exe or CScript.exe). - */ - Name: string; - - /** - * Path of the directory containing the host executable. - */ - Path: string; - - /** - * The filename of the currently running script. - */ - ScriptName: string; - - /** - * Exposes the read-only input stream for the current script. - * Can be accessed only while using CScript.exe. - */ - StdIn: TextStreamReader; - - /** - * Windows Script Host version - */ - Version: string; - - /** - * Connects a COM object's event sources to functions named with a given prefix, in the form prefix_event. - */ - ConnectObject(objEventSource: any, strPrefix: string): void; - - /** - * Creates a COM object. - * @param strProgiID - * @param strPrefix Function names in the form prefix_event will be bound to this object's COM events. - */ - CreateObject(strProgID: string, strPrefix?: string): any; - - /** - * Disconnects a COM object from its event sources. - */ - DisconnectObject(obj: any): void; - - /** - * Retrieves an existing object with the specified ProgID from memory, or creates a new one from a file. - * @param strPathname Fully qualified path to the file containing the object persisted to disk. - * For objects in memory, pass a zero-length string. - * @param strProgID - * @param strPrefix Function names in the form prefix_event will be bound to this object's COM events. - */ - GetObject(strPathname: string, strProgID?: string, strPrefix?: string): any; - - /** - * Suspends script execution for a specified length of time, then continues execution. - * @param intTime Interval (in milliseconds) to suspend script execution. - */ - Sleep(intTime: number): void; -}; - -/** - * Allows enumerating over a COM collection, which may not have indexed item access. - */ -interface Enumerator { - /** - * Returns true if the current item is the last one in the collection, or the collection is empty, - * or the current item is undefined. - */ - atEnd(): boolean; - - /** - * Returns the current item in the collection - */ - item(): T; - - /** - * Resets the current item in the collection to the first item. If there are no items in the collection, - * the current item is set to undefined. - */ - moveFirst(): void; - - /** - * Moves the current item to the next item in the collection. If the enumerator is at the end of - * the collection or the collection is empty, the current item is set to undefined. - */ - moveNext(): void; -} - -interface EnumeratorConstructor { - new (collection: any): Enumerator; - new (collection: any): Enumerator; -} - -declare var Enumerator: EnumeratorConstructor; - -/** - * Enables reading from a COM safe array, which might have an alternate lower bound, or multiple dimensions. - */ -interface VBArray { - /** - * Returns the number of dimensions (1-based). - */ - dimensions(): number; - - /** - * Takes an index for each dimension in the array, and returns the item at the corresponding location. - */ - getItem(dimension1Index: number, ...dimensionNIndexes: number[]): T; - - /** - * Returns the smallest available index for a given dimension. - * @param dimension 1-based dimension (defaults to 1) - */ - lbound(dimension?: number): number; - - /** - * Returns the largest available index for a given dimension. - * @param dimension 1-based dimension (defaults to 1) - */ - ubound(dimension?: number): number; - - /** - * Returns a Javascript array with all the elements in the VBArray. If there are multiple dimensions, - * each successive dimension is appended to the end of the array. - * Example: [[1,2,3],[4,5,6]] becomes [1,2,3,4,5,6] - */ - toArray(): T[]; -} - -interface VBArrayConstructor { - new (safeArray: any): VBArray; - new (safeArray: any): VBArray; -} - -declare var VBArray: VBArrayConstructor; diff --git a/lib/lib.scriptHost.d.ts b/lib/lib.scriptHost.d.ts index 12e04fb4144..d4c6131fd93 100644 --- a/lib/lib.scriptHost.d.ts +++ b/lib/lib.scriptHost.d.ts @@ -13,7 +13,7 @@ See the Apache Version 2.0 License for specific language governing permissions and limitations under the License. ***************************************************************************** */ -/// +/// ///////////////////////////// diff --git a/lib/lib.webworker.d.ts b/lib/lib.webworker.d.ts index 43bc6fad9a0..9c54643a2ce 100644 --- a/lib/lib.webworker.d.ts +++ b/lib/lib.webworker.d.ts @@ -13,208 +13,7 @@ See the Apache Version 2.0 License for specific language governing permissions and limitations under the License. ***************************************************************************** */ -/// -///////////////////////////// -/// ECMAScript Internationalization API -///////////////////////////// - -declare module Intl { - interface CollatorOptions { - usage?: string; - localeMatcher?: string; - numeric?: boolean; - caseFirst?: string; - sensitivity?: string; - ignorePunctuation?: boolean; - } - - interface ResolvedCollatorOptions { - locale: string; - usage: string; - sensitivity: string; - ignorePunctuation: boolean; - collation: string; - caseFirst: string; - numeric: boolean; - } - - interface Collator { - compare(x: string, y: string): number; - resolvedOptions(): ResolvedCollatorOptions; - } - var Collator: { - new (locales?: string[], options?: CollatorOptions): Collator; - new (locale?: string, options?: CollatorOptions): Collator; - (locales?: string[], options?: CollatorOptions): Collator; - (locale?: string, options?: CollatorOptions): Collator; - supportedLocalesOf(locales: string[], options?: CollatorOptions): string[]; - supportedLocalesOf(locale: string, options?: CollatorOptions): string[]; - } - - interface NumberFormatOptions { - localeMatcher?: string; - style?: string; - currency?: string; - currencyDisplay?: string; - useGrouping?: boolean; - minimumIntegerDigits?: number; - minimumFractionDigits?: number; - maximumFractionDigits?: number; - minimumSignificantDigits?: number; - maximumSignificantDigits?: number; - } - - interface ResolvedNumberFormatOptions { - locale: string; - numberingSystem: string; - style: string; - currency?: string; - currencyDisplay?: string; - minimumIntegerDigits: number; - minimumFractionDigits: number; - maximumFractionDigits: number; - minimumSignificantDigits?: number; - maximumSignificantDigits?: number; - useGrouping: boolean; - } - - interface NumberFormat { - format(value: number): string; - resolvedOptions(): ResolvedNumberFormatOptions; - } - var NumberFormat: { - new (locales?: string[], options?: NumberFormatOptions): NumberFormat; - new (locale?: string, options?: NumberFormatOptions): NumberFormat; - (locales?: string[], options?: NumberFormatOptions): NumberFormat; - (locale?: string, options?: NumberFormatOptions): NumberFormat; - supportedLocalesOf(locales: string[], options?: NumberFormatOptions): string[]; - supportedLocalesOf(locale: string, options?: NumberFormatOptions): string[]; - } - - interface DateTimeFormatOptions { - localeMatcher?: string; - weekday?: string; - era?: string; - year?: string; - month?: string; - day?: string; - hour?: string; - minute?: string; - second?: string; - timeZoneName?: string; - formatMatcher?: string; - hour12?: boolean; - timeZone?: string; - } - - interface ResolvedDateTimeFormatOptions { - locale: string; - calendar: string; - numberingSystem: string; - timeZone: string; - hour12?: boolean; - weekday?: string; - era?: string; - year?: string; - month?: string; - day?: string; - hour?: string; - minute?: string; - second?: string; - timeZoneName?: string; - } - - interface DateTimeFormat { - format(date?: Date | number): string; - resolvedOptions(): ResolvedDateTimeFormatOptions; - } - var DateTimeFormat: { - new (locales?: string[], options?: DateTimeFormatOptions): DateTimeFormat; - new (locale?: string, options?: DateTimeFormatOptions): DateTimeFormat; - (locales?: string[], options?: DateTimeFormatOptions): DateTimeFormat; - (locale?: string, options?: DateTimeFormatOptions): DateTimeFormat; - supportedLocalesOf(locales: string[], options?: DateTimeFormatOptions): string[]; - supportedLocalesOf(locale: string, options?: DateTimeFormatOptions): string[]; - } -} - -interface String { - /** - * Determines whether two strings are equivalent in the current locale. - * @param that String to compare to target string - * @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. - * @param options An object that contains one or more properties that specify comparison options. see the Intl.Collator object for details. - */ - localeCompare(that: string, locales: string[], options?: Intl.CollatorOptions): number; - - /** - * Determines whether two strings are equivalent in the current locale. - * @param that String to compare to target string - * @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. - * @param options An object that contains one or more properties that specify comparison options. see the Intl.Collator object for details. - */ - localeCompare(that: string, locale: string, options?: Intl.CollatorOptions): number; -} - -interface Number { - /** - * Converts a number to a string by using the current or specified locale. - * @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. - * @param options An object that contains one or more properties that specify comparison options. - */ - toLocaleString(locales?: string[], options?: Intl.NumberFormatOptions): string; - - /** - * Converts a number to a string by using the current or specified locale. - * @param locale Locale tag. If you omit this parameter, the default locale of the JavaScript runtime is used. - * @param options An object that contains one or more properties that specify comparison options. - */ - toLocaleString(locale?: string, options?: Intl.NumberFormatOptions): string; -} - -interface Date { - /** - * Converts a date and time to a string by using the current or specified locale. - * @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. - * @param options An object that contains one or more properties that specify comparison options. - */ - toLocaleString(locales?: string[], options?: Intl.DateTimeFormatOptions): string; - /** - * Converts a date to a string by using the current or specified locale. - * @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. - * @param options An object that contains one or more properties that specify comparison options. - */ - toLocaleDateString(locales?: string[], options?: Intl.DateTimeFormatOptions): string; - - /** - * Converts a time to a string by using the current or specified locale. - * @param locale Locale tag. If you omit this parameter, the default locale of the JavaScript runtime is used. - * @param options An object that contains one or more properties that specify comparison options. - */ - toLocaleTimeString(locale?: string[], options?: Intl.DateTimeFormatOptions): string; - - /** - * Converts a date and time to a string by using the current or specified locale. - * @param locale Locale tag. If you omit this parameter, the default locale of the JavaScript runtime is used. - * @param options An object that contains one or more properties that specify comparison options. - */ - toLocaleString(locale?: string, options?: Intl.DateTimeFormatOptions): string; - - /** - * Converts a date to a string by using the current or specified locale. - * @param locale Locale tag. If you omit this parameter, the default locale of the JavaScript runtime is used. - * @param options An object that contains one or more properties that specify comparison options. - */ - toLocaleDateString(locale?: string, options?: Intl.DateTimeFormatOptions): string; - - /** - * Converts a time to a string by using the current or specified locale. - * @param locale Locale tag. If you omit this parameter, the default locale of the JavaScript runtime is used. - * @param options An object that contains one or more properties that specify comparison options. - */ - toLocaleTimeString(locale?: string, options?: Intl.DateTimeFormatOptions): string; -} - +/// ///////////////////////////// /// IE Worker APIs @@ -230,10 +29,12 @@ interface EventListener { } interface AudioBuffer { - duration: number; - length: number; - numberOfChannels: number; - sampleRate: number; + readonly duration: number; + readonly length: number; + readonly numberOfChannels: number; + readonly sampleRate: number; + copyFromChannel(destination: Float32Array, channelNumber: number, startInChannel?: number): void; + copyToChannel(source: Float32Array, channelNumber: number, startInChannel?: number): void; getChannelData(channel: number): Float32Array; } @@ -243,8 +44,8 @@ declare var AudioBuffer: { } interface Blob { - size: number; - type: string; + readonly size: number; + readonly type: string; msClose(): void; msDetachStream(): any; slice(start?: number, end?: number, contentType?: string): Blob; @@ -256,9 +57,9 @@ declare var Blob: { } interface CloseEvent extends Event { - code: number; - reason: string; - wasClean: boolean; + readonly code: number; + readonly reason: string; + readonly wasClean: boolean; initCloseEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, wasCleanArg: boolean, codeArg: number, reasonArg: string): void; } @@ -275,6 +76,7 @@ interface Console { dir(value?: any, ...optionalParams: any[]): void; dirxml(value: any): void; error(message?: any, ...optionalParams: any[]): void; + exception(message?: string, ...optionalParams: any[]): void; group(groupTitle?: string): void; groupCollapsed(groupTitle?: string): void; groupEnd(): void; @@ -284,6 +86,7 @@ interface Console { profile(reportName?: string): void; profileEnd(): void; select(element: any): void; + table(...data: any[]): void; time(timerName?: string): void; timeEnd(timerName?: string): void; trace(message?: any, ...optionalParams: any[]): void; @@ -296,13 +99,13 @@ declare var Console: { } interface Coordinates { - accuracy: number; - altitude: number; - altitudeAccuracy: number; - heading: number; - latitude: number; - longitude: number; - speed: number; + readonly accuracy: number; + readonly altitude: number; + readonly altitudeAccuracy: number; + readonly heading: number; + readonly latitude: number; + readonly longitude: number; + readonly speed: number; } declare var Coordinates: { @@ -311,7 +114,7 @@ declare var Coordinates: { } interface DOMError { - name: string; + readonly name: string; toString(): string; } @@ -321,73 +124,73 @@ declare var DOMError: { } interface DOMException { - code: number; - message: string; - name: string; + readonly code: number; + readonly message: string; + readonly name: string; toString(): string; - ABORT_ERR: number; - DATA_CLONE_ERR: number; - DOMSTRING_SIZE_ERR: number; - HIERARCHY_REQUEST_ERR: number; - INDEX_SIZE_ERR: number; - INUSE_ATTRIBUTE_ERR: number; - INVALID_ACCESS_ERR: number; - INVALID_CHARACTER_ERR: number; - INVALID_MODIFICATION_ERR: number; - INVALID_NODE_TYPE_ERR: number; - INVALID_STATE_ERR: number; - NAMESPACE_ERR: number; - NETWORK_ERR: number; - NOT_FOUND_ERR: number; - NOT_SUPPORTED_ERR: number; - NO_DATA_ALLOWED_ERR: number; - NO_MODIFICATION_ALLOWED_ERR: number; - PARSE_ERR: number; - QUOTA_EXCEEDED_ERR: number; - SECURITY_ERR: number; - SERIALIZE_ERR: number; - SYNTAX_ERR: number; - TIMEOUT_ERR: number; - TYPE_MISMATCH_ERR: number; - URL_MISMATCH_ERR: number; - VALIDATION_ERR: number; - WRONG_DOCUMENT_ERR: number; + readonly ABORT_ERR: number; + readonly DATA_CLONE_ERR: number; + readonly DOMSTRING_SIZE_ERR: number; + readonly HIERARCHY_REQUEST_ERR: number; + readonly INDEX_SIZE_ERR: number; + readonly INUSE_ATTRIBUTE_ERR: number; + readonly INVALID_ACCESS_ERR: number; + readonly INVALID_CHARACTER_ERR: number; + readonly INVALID_MODIFICATION_ERR: number; + readonly INVALID_NODE_TYPE_ERR: number; + readonly INVALID_STATE_ERR: number; + readonly NAMESPACE_ERR: number; + readonly NETWORK_ERR: number; + readonly NOT_FOUND_ERR: number; + readonly NOT_SUPPORTED_ERR: number; + readonly NO_DATA_ALLOWED_ERR: number; + readonly NO_MODIFICATION_ALLOWED_ERR: number; + readonly PARSE_ERR: number; + readonly QUOTA_EXCEEDED_ERR: number; + readonly SECURITY_ERR: number; + readonly SERIALIZE_ERR: number; + readonly SYNTAX_ERR: number; + readonly TIMEOUT_ERR: number; + readonly TYPE_MISMATCH_ERR: number; + readonly URL_MISMATCH_ERR: number; + readonly VALIDATION_ERR: number; + readonly WRONG_DOCUMENT_ERR: number; } declare var DOMException: { prototype: DOMException; new(): DOMException; - ABORT_ERR: number; - DATA_CLONE_ERR: number; - DOMSTRING_SIZE_ERR: number; - HIERARCHY_REQUEST_ERR: number; - INDEX_SIZE_ERR: number; - INUSE_ATTRIBUTE_ERR: number; - INVALID_ACCESS_ERR: number; - INVALID_CHARACTER_ERR: number; - INVALID_MODIFICATION_ERR: number; - INVALID_NODE_TYPE_ERR: number; - INVALID_STATE_ERR: number; - NAMESPACE_ERR: number; - NETWORK_ERR: number; - NOT_FOUND_ERR: number; - NOT_SUPPORTED_ERR: number; - NO_DATA_ALLOWED_ERR: number; - NO_MODIFICATION_ALLOWED_ERR: number; - PARSE_ERR: number; - QUOTA_EXCEEDED_ERR: number; - SECURITY_ERR: number; - SERIALIZE_ERR: number; - SYNTAX_ERR: number; - TIMEOUT_ERR: number; - TYPE_MISMATCH_ERR: number; - URL_MISMATCH_ERR: number; - VALIDATION_ERR: number; - WRONG_DOCUMENT_ERR: number; + readonly ABORT_ERR: number; + readonly DATA_CLONE_ERR: number; + readonly DOMSTRING_SIZE_ERR: number; + readonly HIERARCHY_REQUEST_ERR: number; + readonly INDEX_SIZE_ERR: number; + readonly INUSE_ATTRIBUTE_ERR: number; + readonly INVALID_ACCESS_ERR: number; + readonly INVALID_CHARACTER_ERR: number; + readonly INVALID_MODIFICATION_ERR: number; + readonly INVALID_NODE_TYPE_ERR: number; + readonly INVALID_STATE_ERR: number; + readonly NAMESPACE_ERR: number; + readonly NETWORK_ERR: number; + readonly NOT_FOUND_ERR: number; + readonly NOT_SUPPORTED_ERR: number; + readonly NO_DATA_ALLOWED_ERR: number; + readonly NO_MODIFICATION_ALLOWED_ERR: number; + readonly PARSE_ERR: number; + readonly QUOTA_EXCEEDED_ERR: number; + readonly SECURITY_ERR: number; + readonly SERIALIZE_ERR: number; + readonly SYNTAX_ERR: number; + readonly TIMEOUT_ERR: number; + readonly TYPE_MISMATCH_ERR: number; + readonly URL_MISMATCH_ERR: number; + readonly VALIDATION_ERR: number; + readonly WRONG_DOCUMENT_ERR: number; } interface DOMStringList { - length: number; + readonly length: number; contains(str: string): boolean; item(index: number): string; [index: number]: string; @@ -399,11 +202,11 @@ declare var DOMStringList: { } interface ErrorEvent extends Event { - colno: number; - error: any; - filename: string; - lineno: number; - message: string; + readonly colno: number; + readonly error: any; + readonly filename: string; + readonly lineno: number; + readonly message: string; initErrorEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, messageArg: string, filenameArg: string, linenoArg: number): void; } @@ -413,39 +216,39 @@ declare var ErrorEvent: { } interface Event { - bubbles: boolean; + readonly bubbles: boolean; cancelBubble: boolean; - cancelable: boolean; - currentTarget: EventTarget; - defaultPrevented: boolean; - eventPhase: number; - isTrusted: boolean; + readonly cancelable: boolean; + readonly currentTarget: EventTarget; + readonly defaultPrevented: boolean; + readonly eventPhase: number; + readonly isTrusted: boolean; returnValue: boolean; - srcElement: any; - target: EventTarget; - timeStamp: number; - type: string; + readonly srcElement: any; + readonly target: EventTarget; + readonly timeStamp: number; + readonly type: string; initEvent(eventTypeArg: string, canBubbleArg: boolean, cancelableArg: boolean): void; preventDefault(): void; stopImmediatePropagation(): void; stopPropagation(): void; - AT_TARGET: number; - BUBBLING_PHASE: number; - CAPTURING_PHASE: number; + readonly AT_TARGET: number; + readonly BUBBLING_PHASE: number; + readonly CAPTURING_PHASE: number; } declare var Event: { prototype: Event; new(type: string, eventInitDict?: EventInit): Event; - AT_TARGET: number; - BUBBLING_PHASE: number; - CAPTURING_PHASE: number; + readonly AT_TARGET: number; + readonly BUBBLING_PHASE: number; + readonly CAPTURING_PHASE: number; } interface EventTarget { - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; + addEventListener(type: string, listener?: EventListenerOrEventListenerObject, useCapture?: boolean): void; dispatchEvent(evt: Event): boolean; - removeEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; + removeEventListener(type: string, listener?: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var EventTarget: { @@ -454,8 +257,9 @@ declare var EventTarget: { } interface File extends Blob { - lastModifiedDate: any; - name: string; + readonly lastModifiedDate: any; + readonly name: string; + readonly webkitRelativePath: string; } declare var File: { @@ -464,7 +268,7 @@ declare var File: { } interface FileList { - length: number; + readonly length: number; item(index: number): File; [index: number]: File; } @@ -475,7 +279,7 @@ declare var FileList: { } interface FileReader extends EventTarget, MSBaseReader { - error: DOMError; + readonly error: DOMError; readAsArrayBuffer(blob: Blob): void; readAsBinaryString(blob: Blob): void; readAsDataURL(blob: Blob): void; @@ -489,31 +293,31 @@ declare var FileReader: { } interface IDBCursor { - direction: string; - key: any; - primaryKey: any; + readonly direction: string; + key: IDBKeyRange | IDBValidKey; + readonly primaryKey: any; source: IDBObjectStore | IDBIndex; advance(count: number): void; - continue(key?: any): void; + continue(key?: IDBKeyRange | IDBValidKey): void; delete(): IDBRequest; update(value: any): IDBRequest; - NEXT: string; - NEXT_NO_DUPLICATE: string; - PREV: string; - PREV_NO_DUPLICATE: string; + readonly NEXT: string; + readonly NEXT_NO_DUPLICATE: string; + readonly PREV: string; + readonly PREV_NO_DUPLICATE: string; } declare var IDBCursor: { prototype: IDBCursor; new(): IDBCursor; - NEXT: string; - NEXT_NO_DUPLICATE: string; - PREV: string; - PREV_NO_DUPLICATE: string; + readonly NEXT: string; + readonly NEXT_NO_DUPLICATE: string; + readonly PREV: string; + readonly PREV_NO_DUPLICATE: string; } interface IDBCursorWithValue extends IDBCursor { - value: any; + readonly value: any; } declare var IDBCursorWithValue: { @@ -522,15 +326,17 @@ declare var IDBCursorWithValue: { } interface IDBDatabase extends EventTarget { - name: string; - objectStoreNames: DOMStringList; + readonly name: string; + readonly objectStoreNames: DOMStringList; onabort: (ev: Event) => any; onerror: (ev: Event) => any; version: number; + onversionchange: (ev: IDBVersionChangeEvent) => any; close(): void; createObjectStore(name: string, optionalParameters?: IDBObjectStoreParameters): IDBObjectStore; deleteObjectStore(name: string): void; transaction(storeNames: string | string[], mode?: string): IDBTransaction; + addEventListener(type: "versionchange", listener: (ev: IDBVersionChangeEvent) => any, useCapture?: boolean): void; addEventListener(type: "abort", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; @@ -554,15 +360,15 @@ declare var IDBFactory: { interface IDBIndex { keyPath: string | string[]; - name: string; - objectStore: IDBObjectStore; - unique: boolean; + readonly name: string; + readonly objectStore: IDBObjectStore; + readonly unique: boolean; multiEntry: boolean; - count(key?: any): IDBRequest; - get(key: any): IDBRequest; - getKey(key: any): IDBRequest; - openCursor(range?: IDBKeyRange, direction?: string): IDBRequest; - openKeyCursor(range?: IDBKeyRange, direction?: string): IDBRequest; + count(key?: IDBKeyRange | IDBValidKey): IDBRequest; + get(key: IDBKeyRange | IDBValidKey): IDBRequest; + getKey(key: IDBKeyRange | IDBValidKey): IDBRequest; + openCursor(range?: IDBKeyRange | IDBValidKey, direction?: string): IDBRequest; + openKeyCursor(range?: IDBKeyRange | IDBValidKey, direction?: string): IDBRequest; } declare var IDBIndex: { @@ -571,37 +377,37 @@ declare var IDBIndex: { } interface IDBKeyRange { - lower: any; - lowerOpen: boolean; - upper: any; - upperOpen: boolean; + readonly lower: any; + readonly lowerOpen: boolean; + readonly upper: any; + readonly upperOpen: boolean; } declare var IDBKeyRange: { prototype: IDBKeyRange; new(): IDBKeyRange; bound(lower: any, upper: any, lowerOpen?: boolean, upperOpen?: boolean): IDBKeyRange; - lowerBound(bound: any, open?: boolean): IDBKeyRange; + lowerBound(lower: any, open?: boolean): IDBKeyRange; only(value: any): IDBKeyRange; - upperBound(bound: any, open?: boolean): IDBKeyRange; + upperBound(upper: any, open?: boolean): IDBKeyRange; } interface IDBObjectStore { - indexNames: DOMStringList; + readonly indexNames: DOMStringList; keyPath: string | string[]; - name: string; - transaction: IDBTransaction; + readonly name: string; + readonly transaction: IDBTransaction; autoIncrement: boolean; - add(value: any, key?: any): IDBRequest; + add(value: any, key?: IDBKeyRange | IDBValidKey): IDBRequest; clear(): IDBRequest; - count(key?: any): IDBRequest; + count(key?: IDBKeyRange | IDBValidKey): IDBRequest; createIndex(name: string, keyPath: string | string[], optionalParameters?: IDBIndexParameters): IDBIndex; - delete(key: any): IDBRequest; + delete(key: IDBKeyRange | IDBValidKey): IDBRequest; deleteIndex(indexName: string): void; get(key: any): IDBRequest; index(name: string): IDBIndex; - openCursor(range?: any, direction?: string): IDBRequest; - put(value: any, key?: any): IDBRequest; + openCursor(range?: IDBKeyRange | IDBValidKey, direction?: string): IDBRequest; + put(value: any, key?: IDBKeyRange | IDBValidKey): IDBRequest; } declare var IDBObjectStore: { @@ -625,13 +431,13 @@ declare var IDBOpenDBRequest: { } interface IDBRequest extends EventTarget { - error: DOMError; + readonly error: DOMError; onerror: (ev: Event) => any; onsuccess: (ev: Event) => any; - readyState: string; - result: any; + readonly readyState: string; + readonly result: any; source: IDBObjectStore | IDBIndex | IDBCursor; - transaction: IDBTransaction; + readonly transaction: IDBTransaction; addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: "success", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; @@ -643,17 +449,17 @@ declare var IDBRequest: { } interface IDBTransaction extends EventTarget { - db: IDBDatabase; - error: DOMError; - mode: string; + readonly db: IDBDatabase; + readonly error: DOMError; + readonly mode: string; onabort: (ev: Event) => any; oncomplete: (ev: Event) => any; onerror: (ev: Event) => any; abort(): void; objectStore(name: string): IDBObjectStore; - READ_ONLY: string; - READ_WRITE: string; - VERSION_CHANGE: string; + readonly READ_ONLY: string; + readonly READ_WRITE: string; + readonly VERSION_CHANGE: string; addEventListener(type: "abort", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "complete", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; @@ -663,14 +469,14 @@ interface IDBTransaction extends EventTarget { declare var IDBTransaction: { prototype: IDBTransaction; new(): IDBTransaction; - READ_ONLY: string; - READ_WRITE: string; - VERSION_CHANGE: string; + readonly READ_ONLY: string; + readonly READ_WRITE: string; + readonly VERSION_CHANGE: string; } interface IDBVersionChangeEvent extends Event { - newVersion: number; - oldVersion: number; + readonly newVersion: number; + readonly oldVersion: number; } declare var IDBVersionChangeEvent: { @@ -680,8 +486,8 @@ declare var IDBVersionChangeEvent: { interface ImageData { data: Uint8ClampedArray; - height: number; - width: number; + readonly height: number; + readonly width: number; } declare var ImageData: { @@ -700,29 +506,29 @@ interface MSApp { execAsyncAtPriority(asynchronousCallback: MSExecAtPriorityFunctionCallback, priority: string, ...args: any[]): void; execAtPriority(synchronousCallback: MSExecAtPriorityFunctionCallback, priority: string, ...args: any[]): any; getCurrentPriority(): string; - getHtmlPrintDocumentSourceAsync(htmlDoc: any): any; + getHtmlPrintDocumentSourceAsync(htmlDoc: any): PromiseLike; getViewId(view: any): any; isTaskScheduledAtPriorityOrHigher(priority: string): boolean; pageHandlesAllApplicationActivations(enabled: boolean): void; suppressSubdownloadCredentialPrompts(suppress: boolean): void; terminateApp(exceptionObject: any): void; - CURRENT: string; - HIGH: string; - IDLE: string; - NORMAL: string; + readonly CURRENT: string; + readonly HIGH: string; + readonly IDLE: string; + readonly NORMAL: string; } declare var MSApp: MSApp; interface MSAppAsyncOperation extends EventTarget { - error: DOMError; + readonly error: DOMError; oncomplete: (ev: Event) => any; onerror: (ev: Event) => any; - readyState: number; - result: any; + readonly readyState: number; + readonly result: any; start(): void; - COMPLETED: number; - ERROR: number; - STARTED: number; + readonly COMPLETED: number; + readonly ERROR: number; + readonly STARTED: number; addEventListener(type: "complete", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; @@ -731,9 +537,9 @@ interface MSAppAsyncOperation extends EventTarget { declare var MSAppAsyncOperation: { prototype: MSAppAsyncOperation; new(): MSAppAsyncOperation; - COMPLETED: number; - ERROR: number; - STARTED: number; + readonly COMPLETED: number; + readonly ERROR: number; + readonly STARTED: number; } interface MSBlobBuilder { @@ -747,7 +553,7 @@ declare var MSBlobBuilder: { } interface MSStream { - type: string; + readonly type: string; msClose(): void; msDetachStream(): any; } @@ -758,7 +564,7 @@ declare var MSStream: { } interface MSStreamReader extends EventTarget, MSBaseReader { - error: DOMError; + readonly error: DOMError; readAsArrayBuffer(stream: MSStream, size?: number): void; readAsBinaryString(stream: MSStream, size?: number): void; readAsBlob(stream: MSStream, size?: number): void; @@ -773,8 +579,8 @@ declare var MSStreamReader: { } interface MediaQueryList { - matches: boolean; - media: string; + readonly matches: boolean; + readonly media: string; addListener(listener: MediaQueryListListener): void; removeListener(listener: MediaQueryListListener): void; } @@ -785,8 +591,8 @@ declare var MediaQueryList: { } interface MessageChannel { - port1: MessagePort; - port2: MessagePort; + readonly port1: MessagePort; + readonly port2: MessagePort; } declare var MessageChannel: { @@ -795,10 +601,10 @@ declare var MessageChannel: { } interface MessageEvent extends Event { - data: any; - origin: string; - ports: any; - source: any; + readonly data: any; + readonly origin: string; + readonly ports: any; + readonly source: any; initMessageEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, dataArg: any, originArg: string, lastEventIdArg: string, sourceArg: any): void; } @@ -822,8 +628,8 @@ declare var MessagePort: { } interface Position { - coords: Coordinates; - timestamp: number; + readonly coords: Coordinates; + readonly timestamp: number; } declare var Position: { @@ -832,26 +638,26 @@ declare var Position: { } interface PositionError { - code: number; - message: string; + readonly code: number; + readonly message: string; toString(): string; - PERMISSION_DENIED: number; - POSITION_UNAVAILABLE: number; - TIMEOUT: number; + readonly PERMISSION_DENIED: number; + readonly POSITION_UNAVAILABLE: number; + readonly TIMEOUT: number; } declare var PositionError: { prototype: PositionError; new(): PositionError; - PERMISSION_DENIED: number; - POSITION_UNAVAILABLE: number; - TIMEOUT: number; + readonly PERMISSION_DENIED: number; + readonly POSITION_UNAVAILABLE: number; + readonly TIMEOUT: number; } interface ProgressEvent extends Event { - lengthComputable: boolean; - loaded: number; - total: number; + readonly lengthComputable: boolean; + readonly loaded: number; + readonly total: number; initProgressEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, lengthComputableArg: boolean, loadedArg: number, totalArg: number): void; } @@ -862,21 +668,21 @@ declare var ProgressEvent: { interface WebSocket extends EventTarget { binaryType: string; - bufferedAmount: number; - extensions: string; + readonly bufferedAmount: number; + readonly extensions: string; onclose: (ev: CloseEvent) => any; onerror: (ev: Event) => any; onmessage: (ev: MessageEvent) => any; onopen: (ev: Event) => any; - protocol: string; - readyState: number; - url: string; + readonly protocol: string; + readonly readyState: number; + readonly url: string; close(code?: number, reason?: string): void; send(data: any): void; - CLOSED: number; - CLOSING: number; - CONNECTING: number; - OPEN: number; + readonly CLOSED: number; + readonly CLOSING: number; + readonly CONNECTING: number; + readonly OPEN: number; addEventListener(type: "close", listener: (ev: CloseEvent) => any, useCapture?: boolean): void; addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: "message", listener: (ev: MessageEvent) => any, useCapture?: boolean): void; @@ -887,10 +693,10 @@ interface WebSocket extends EventTarget { declare var WebSocket: { prototype: WebSocket; new(url: string, protocols?: string | string[]): WebSocket; - CLOSED: number; - CLOSING: number; - CONNECTING: number; - OPEN: number; + readonly CLOSED: number; + readonly CLOSING: number; + readonly CONNECTING: number; + readonly OPEN: number; } interface Worker extends EventTarget, AbstractWorker { @@ -910,16 +716,15 @@ declare var Worker: { interface XMLHttpRequest extends EventTarget, XMLHttpRequestEventTarget { msCaching: string; onreadystatechange: (ev: ProgressEvent) => any; - readyState: number; - response: any; - responseBody: any; - responseText: string; + readonly readyState: number; + readonly response: any; + readonly responseText: string; responseType: string; - responseXML: any; - status: number; - statusText: string; + readonly responseXML: any; + readonly status: number; + readonly statusText: string; timeout: number; - upload: XMLHttpRequestUpload; + readonly upload: XMLHttpRequestUpload; withCredentials: boolean; abort(): void; getAllResponseHeaders(): string; @@ -930,11 +735,11 @@ interface XMLHttpRequest extends EventTarget, XMLHttpRequestEventTarget { send(data?: string): void; send(data?: any): void; setRequestHeader(header: string, value: string): void; - DONE: number; - HEADERS_RECEIVED: number; - LOADING: number; - OPENED: number; - UNSENT: number; + readonly DONE: number; + readonly HEADERS_RECEIVED: number; + readonly LOADING: number; + readonly OPENED: number; + readonly UNSENT: number; addEventListener(type: "abort", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: "load", listener: (ev: Event) => any, useCapture?: boolean): void; @@ -949,11 +754,11 @@ interface XMLHttpRequest extends EventTarget, XMLHttpRequestEventTarget { declare var XMLHttpRequest: { prototype: XMLHttpRequest; new(): XMLHttpRequest; - DONE: number; - HEADERS_RECEIVED: number; - LOADING: number; - OPENED: number; - UNSENT: number; + readonly DONE: number; + readonly HEADERS_RECEIVED: number; + readonly LOADING: number; + readonly OPENED: number; + readonly UNSENT: number; create(): XMLHttpRequest; } @@ -979,12 +784,12 @@ interface MSBaseReader { onloadend: (ev: ProgressEvent) => any; onloadstart: (ev: Event) => any; onprogress: (ev: ProgressEvent) => any; - readyState: number; - result: any; + readonly readyState: number; + readonly result: any; abort(): void; - DONE: number; - EMPTY: number; - LOADING: number; + readonly DONE: number; + readonly EMPTY: number; + readonly LOADING: number; addEventListener(type: "abort", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: "load", listener: (ev: Event) => any, useCapture?: boolean): void; @@ -995,18 +800,18 @@ interface MSBaseReader { } interface NavigatorID { - appName: string; - appVersion: string; - platform: string; - product: string; - productSub: string; - userAgent: string; - vendor: string; - vendorSub: string; + readonly appName: string; + readonly appVersion: string; + readonly platform: string; + readonly product: string; + readonly productSub: string; + readonly userAgent: string; + readonly vendor: string; + readonly vendorSub: string; } interface NavigatorOnLine { - onLine: boolean; + readonly onLine: boolean; } interface WindowBase64 { @@ -1015,7 +820,7 @@ interface WindowBase64 { } interface WindowConsole { - console: Console; + readonly console: Console; } interface XMLHttpRequestEventTarget { @@ -1049,9 +854,9 @@ declare var FileReaderSync: { } interface WorkerGlobalScope extends EventTarget, WorkerUtils, DedicatedWorkerGlobalScope, WindowConsole { - location: WorkerLocation; + readonly location: WorkerLocation; onerror: (ev: Event) => any; - self: WorkerGlobalScope; + readonly self: WorkerGlobalScope; close(): void; msWriteProfilerMark(profilerMarkName: string): void; toString(): string; @@ -1066,14 +871,14 @@ declare var WorkerGlobalScope: { } interface WorkerLocation { - hash: string; - host: string; - hostname: string; - href: string; - pathname: string; - port: string; - protocol: string; - search: string; + readonly hash: string; + readonly host: string; + readonly hostname: string; + readonly href: string; + readonly pathname: string; + readonly port: string; + readonly protocol: string; + readonly search: string; toString(): string; } @@ -1099,9 +904,9 @@ interface DedicatedWorkerGlobalScope { } interface WorkerUtils extends Object, WindowBase64 { - indexedDB: IDBFactory; - msIndexedDB: IDBFactory; - navigator: WorkerNavigator; + readonly indexedDB: IDBFactory; + readonly msIndexedDB: IDBFactory; + readonly navigator: WorkerNavigator; clearImmediate(handle: number): void; clearInterval(handle: number): void; clearTimeout(handle: number): void; @@ -1111,16 +916,6 @@ interface WorkerUtils extends Object, WindowBase64 { setTimeout(handler: any, timeout?: any, ...args: any[]): number; } -interface IDBObjectStoreParameters { - keyPath?: string | string[]; - autoIncrement?: boolean; -} - -interface IDBIndexParameters { - unique?: boolean; - multiEntry?: boolean; -} - interface BlobPropertyBag { type?: string; endings?: string; @@ -1150,6 +945,9 @@ interface ProgressEventInit extends EventInit { total?: number; } +interface IDBArrayKey extends Array { +} + declare type EventListenerOrEventListenerObject = EventListener | EventListenerObject; interface ErrorEventHandler { @@ -1188,9 +986,9 @@ declare var self: WorkerGlobalScope; declare function close(): void; declare function msWriteProfilerMark(profilerMarkName: string): void; declare function toString(): string; -declare function addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +declare function addEventListener(type: string, listener?: EventListenerOrEventListenerObject, useCapture?: boolean): void; declare function dispatchEvent(evt: Event): boolean; -declare function removeEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +declare function removeEventListener(type: string, listener?: EventListenerOrEventListenerObject, useCapture?: boolean): void; declare var indexedDB: IDBFactory; declare var msIndexedDB: IDBFactory; declare var navigator: WorkerNavigator; @@ -1208,4 +1006,5 @@ declare function postMessage(data: any): void; declare var console: Console; declare function addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; declare function addEventListener(type: "message", listener: (ev: MessageEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; \ No newline at end of file +declare function addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +type IDBValidKey = number | string | Date | IDBArrayKey; \ No newline at end of file diff --git a/lib/tsc.js b/lib/tsc.js index 4bdf0f84fae..9e14712261a 100644 --- a/lib/tsc.js +++ b/lib/tsc.js @@ -262,8 +262,14 @@ var ts; var count = array.length; if (count > 0) { var pos = 0; - var result = arguments.length <= 2 ? array[pos] : initial; - pos++; + var result = void 0; + if (arguments.length <= 2) { + result = array[pos]; + pos++; + } + else { + result = initial; + } while (pos < count) { result = f(result, array[pos]); pos++; @@ -278,8 +284,14 @@ var ts; if (array) { var pos = array.length - 1; if (pos >= 0) { - var result = arguments.length <= 2 ? array[pos] : initial; - pos--; + var result = void 0; + if (arguments.length <= 2) { + result = array[pos]; + pos--; + } + else { + result = initial; + } while (pos >= 0) { result = f(result, array[pos]); pos--; @@ -295,6 +307,14 @@ var ts; return hasOwnProperty.call(map, key); } ts.hasProperty = hasProperty; + function getKeys(map) { + var keys = []; + for (var key in map) { + keys.push(key); + } + return keys; + } + ts.getKeys = getKeys; function getProperty(map, key) { return hasOwnProperty.call(map, key) ? map[key] : undefined; } @@ -708,6 +728,26 @@ var ts; return pathLen > extLen && path.substr(pathLen - extLen, extLen) === extension; } ts.fileExtensionIs = fileExtensionIs; + function ensureScriptKind(fileName, scriptKind) { + return (scriptKind || getScriptKindFromFileName(fileName)) || 3; + } + ts.ensureScriptKind = ensureScriptKind; + function getScriptKindFromFileName(fileName) { + var ext = fileName.substr(fileName.lastIndexOf(".")); + switch (ext.toLowerCase()) { + case ".js": + return 1; + case ".jsx": + return 2; + case ".ts": + return 3; + case ".tsx": + return 4; + default: + return 0; + } + } + ts.getScriptKindFromFileName = getScriptKindFromFileName; ts.supportedTypeScriptExtensions = [".ts", ".tsx", ".d.ts"]; ts.supportedJavascriptExtensions = [".js", ".jsx"]; var allSupportedExtensions = ts.supportedTypeScriptExtensions.concat(ts.supportedJavascriptExtensions); @@ -941,6 +981,7 @@ var ts; var _fs = require("fs"); var _path = require("path"); var _os = require("os"); + var _crypto = require("crypto"); function createPollingWatchedFileSet(interval, chunkSize) { if (interval === void 0) { interval = 2500; } if (chunkSize === void 0) { chunkSize = 30; } @@ -955,13 +996,13 @@ var ts; if (!watchedFile) { return; } - _fs.stat(watchedFile.filePath, function (err, stats) { + _fs.stat(watchedFile.fileName, function (err, stats) { if (err) { - watchedFile.callback(watchedFile.filePath); + watchedFile.callback(watchedFile.fileName); } else if (watchedFile.mtime.getTime() !== stats.mtime.getTime()) { - watchedFile.mtime = getModifiedTime(watchedFile.filePath); - watchedFile.callback(watchedFile.filePath, watchedFile.mtime.getTime() === 0); + watchedFile.mtime = getModifiedTime(watchedFile.fileName); + watchedFile.callback(watchedFile.fileName, watchedFile.mtime.getTime() === 0); } }); } @@ -984,11 +1025,11 @@ var ts; nextFileToCheck = nextToCheck; }, interval); } - function addFile(filePath, callback) { + function addFile(fileName, callback) { var file = { - filePath: filePath, + fileName: fileName, callback: callback, - mtime: getModifiedTime(filePath) + mtime: getModifiedTime(fileName) }; watchedFiles.push(file); if (watchedFiles.length === 1) { @@ -1008,67 +1049,67 @@ var ts; }; } function createWatchedFileSet() { - var dirWatchers = ts.createFileMap(); - var fileWatcherCallbacks = ts.createFileMap(); + var dirWatchers = {}; + var fileWatcherCallbacks = {}; return { addFile: addFile, removeFile: removeFile }; - function reduceDirWatcherRefCountForFile(filePath) { - var dirPath = ts.getDirectoryPath(filePath); - if (dirWatchers.contains(dirPath)) { - var watcher = dirWatchers.get(dirPath); + function reduceDirWatcherRefCountForFile(fileName) { + var dirName = ts.getDirectoryPath(fileName); + if (ts.hasProperty(dirWatchers, dirName)) { + var watcher = dirWatchers[dirName]; watcher.referenceCount -= 1; if (watcher.referenceCount <= 0) { watcher.close(); - dirWatchers.remove(dirPath); + delete dirWatchers[dirName]; } } } function addDirWatcher(dirPath) { - if (dirWatchers.contains(dirPath)) { - var watcher_1 = dirWatchers.get(dirPath); + if (ts.hasProperty(dirWatchers, dirPath)) { + var watcher_1 = dirWatchers[dirPath]; watcher_1.referenceCount += 1; return; } var watcher = _fs.watch(dirPath, { persistent: true }, function (eventName, relativeFileName) { return fileEventHandler(eventName, relativeFileName, dirPath); }); watcher.referenceCount = 1; - dirWatchers.set(dirPath, watcher); + dirWatchers[dirPath] = watcher; return; } function addFileWatcherCallback(filePath, callback) { - if (fileWatcherCallbacks.contains(filePath)) { - fileWatcherCallbacks.get(filePath).push(callback); + if (ts.hasProperty(fileWatcherCallbacks, filePath)) { + fileWatcherCallbacks[filePath].push(callback); } else { - fileWatcherCallbacks.set(filePath, [callback]); + fileWatcherCallbacks[filePath] = [callback]; } } - function addFile(filePath, callback) { - addFileWatcherCallback(filePath, callback); - addDirWatcher(ts.getDirectoryPath(filePath)); - return { filePath: filePath, callback: callback }; + function addFile(fileName, callback) { + addFileWatcherCallback(fileName, callback); + addDirWatcher(ts.getDirectoryPath(fileName)); + return { fileName: fileName, callback: callback }; } function removeFile(watchedFile) { - removeFileWatcherCallback(watchedFile.filePath, watchedFile.callback); - reduceDirWatcherRefCountForFile(watchedFile.filePath); + removeFileWatcherCallback(watchedFile.fileName, watchedFile.callback); + reduceDirWatcherRefCountForFile(watchedFile.fileName); } function removeFileWatcherCallback(filePath, callback) { - if (fileWatcherCallbacks.contains(filePath)) { - var newCallbacks = ts.copyListRemovingItem(callback, fileWatcherCallbacks.get(filePath)); + if (ts.hasProperty(fileWatcherCallbacks, filePath)) { + var newCallbacks = ts.copyListRemovingItem(callback, fileWatcherCallbacks[filePath]); if (newCallbacks.length === 0) { - fileWatcherCallbacks.remove(filePath); + delete fileWatcherCallbacks[filePath]; } else { - fileWatcherCallbacks.set(filePath, newCallbacks); + fileWatcherCallbacks[filePath] = newCallbacks; } } } function fileEventHandler(eventName, relativeFileName, baseDirPath) { - var filePath = typeof relativeFileName !== "string" + var fileName = typeof relativeFileName !== "string" ? undefined - : ts.toPath(relativeFileName, baseDirPath, ts.createGetCanonicalFileName(ts.sys.useCaseSensitiveFileNames)); - if ((eventName === "change" || eventName === "rename") && fileWatcherCallbacks.contains(filePath)) { - for (var _i = 0, _a = fileWatcherCallbacks.get(filePath); _i < _a.length; _i++) { + : ts.getNormalizedAbsolutePath(relativeFileName, baseDirPath); + if ((eventName === "change" || eventName === "rename") && ts.hasProperty(fileWatcherCallbacks, fileName)) { + for (var _i = 0, _a = fileWatcherCallbacks[fileName]; _i < _a.length; _i++) { var fileCallback = _a[_i]; - fileCallback(filePath); + fileCallback(fileName); } } } @@ -1149,6 +1190,9 @@ var ts; var directories = []; for (var _i = 0, files_2 = files; _i < files_2.length; _i++) { var current = files_2[_i]; + if (current === "." || current === "..") { + continue; + } var name_3 = ts.combinePaths(path, current); if (!ts.contains(exclude, getCanonicalPath(name_3))) { var stat = _fs.statSync(name_3); @@ -1177,14 +1221,14 @@ var ts; }, readFile: readFile, writeFile: writeFile, - watchFile: function (filePath, callback) { + watchFile: function (fileName, callback) { var watchSet = isNode4OrLater() ? watchedFileSet : pollingWatchedFileSet; - var watchedFile = watchSet.addFile(filePath, callback); + var watchedFile = watchSet.addFile(fileName, callback); return { close: function () { return watchSet.removeFile(watchedFile); } }; }, - watchDirectory: function (path, callback, recursive) { + watchDirectory: function (directoryName, callback, recursive) { var options; if (isNode4OrLater() && (process.platform === "win32" || process.platform === "darwin")) { options = { persistent: true, recursive: !!recursive }; @@ -1192,9 +1236,9 @@ var ts; else { options = { persistent: true }; } - return _fs.watch(path, options, function (eventName, relativeFileName) { + return _fs.watch(directoryName, options, function (eventName, relativeFileName) { if (eventName === "rename") { - callback(!relativeFileName ? relativeFileName : ts.normalizePath(ts.combinePaths(path, relativeFileName))); + callback(!relativeFileName ? relativeFileName : ts.normalizePath(ts.combinePaths(directoryName, relativeFileName))); } ; }); @@ -1216,6 +1260,19 @@ var ts; return process.cwd(); }, readDirectory: readDirectory, + getModifiedTime: function (path) { + try { + return _fs.statSync(path).mtime; + } + catch (e) { + return undefined; + } + }, + createHash: function (data) { + var hash = _crypto.createHash("md5"); + hash.update(data); + return hash.digest("hex"); + }, getMemoryUsage: function () { if (global.gc) { global.gc(); @@ -1477,6 +1534,9 @@ var ts; Async_functions_are_only_available_when_targeting_ECMAScript_6_and_higher: { code: 1311, category: ts.DiagnosticCategory.Error, key: "Async_functions_are_only_available_when_targeting_ECMAScript_6_and_higher_1311", message: "Async functions are only available when targeting ECMAScript 6 and 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." }, 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." }, @@ -1528,7 +1588,7 @@ var ts; 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." }, 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." }, - Neither_type_0_nor_type_1_is_assignable_to_the_other: { code: 2352, category: ts.DiagnosticCategory.Error, key: "Neither_type_0_nor_type_1_is_assignable_to_the_other_2352", message: "Neither type '{0}' nor type '{1}' is assignable to the other." }, + 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." }, 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." }, @@ -1542,6 +1602,7 @@ var ts; 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." }, 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}'" }, A_parameter_property_is_only_allowed_in_a_constructor_implementation: { code: 2369, category: ts.DiagnosticCategory.Error, key: "A_parameter_property_is_only_allowed_in_a_constructor_implementation_2369", message: "A parameter property is only allowed in a constructor implementation." }, A_rest_parameter_must_be_of_an_array_type: { code: 2370, category: ts.DiagnosticCategory.Error, key: "A_rest_parameter_must_be_of_an_array_type_2370", message: "A rest parameter must be of an array type." }, @@ -1622,6 +1683,7 @@ var ts; 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." }, + Variable_0_is_used_before_being_assigned: { code: 2454, category: ts.DiagnosticCategory.Error, key: "Variable_0_is_used_before_being_assigned_2454", message: "Variable '{0}' is used before being assigned." }, Type_argument_candidate_1_is_not_a_valid_type_argument_because_it_is_not_a_supertype_of_candidate_0: { code: 2455, category: ts.DiagnosticCategory.Error, key: "Type_argument_candidate_1_is_not_a_valid_type_argument_because_it_is_not_a_supertype_of_candidate_0_2455", message: "Type argument candidate '{1}' is not a valid type argument because it is not a supertype of candidate '{0}'." }, Type_alias_0_circularly_references_itself: { code: 2456, category: ts.DiagnosticCategory.Error, key: "Type_alias_0_circularly_references_itself_2456", message: "Type alias '{0}' circularly references itself." }, Type_alias_name_cannot_be_0: { code: 2457, category: ts.DiagnosticCategory.Error, key: "Type_alias_name_cannot_be_0_2457", message: "Type alias name cannot be '{0}'" }, @@ -1696,6 +1758,7 @@ var ts; A_module_cannot_have_multiple_default_exports: { code: 2528, category: ts.DiagnosticCategory.Error, key: "A_module_cannot_have_multiple_default_exports_2528", message: "A module cannot have multiple default exports." }, Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module_containing_async_functions: { code: 2529, category: ts.DiagnosticCategory.Error, key: "Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module_containing_async_func_2529", message: "Duplicate identifier '{0}'. Compiler reserves name '{1}' in top level scope of a module containing async functions." }, Property_0_is_incompatible_with_index_signature: { code: 2530, category: ts.DiagnosticCategory.Error, key: "Property_0_is_incompatible_with_index_signature_2530", message: "Property '{0}' is incompatible with index signature." }, + Object_is_possibly_null_or_undefined: { code: 2531, category: ts.DiagnosticCategory.Error, key: "Object_is_possibly_null_or_undefined_2531", message: "Object is possibly 'null' or 'undefined'." }, 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." }, @@ -1731,6 +1794,15 @@ var ts; Constructor_of_class_0_is_protected_and_only_accessible_within_the_class_declaration: { code: 2674, category: ts.DiagnosticCategory.Error, key: "Constructor_of_class_0_is_protected_and_only_accessible_within_the_class_declaration_2674", message: "Constructor of class '{0}' is protected and only accessible within the class declaration." }, Cannot_extend_a_class_0_Class_constructor_is_marked_as_private: { code: 2675, category: ts.DiagnosticCategory.Error, key: "Cannot_extend_a_class_0_Class_constructor_is_marked_as_private_2675", message: "Cannot extend a class '{0}'. Class constructor is marked as private." }, Accessors_must_both_be_abstract_or_non_abstract: { code: 2676, category: ts.DiagnosticCategory.Error, key: "Accessors_must_both_be_abstract_or_non_abstract_2676", message: "Accessors must both be abstract or non-abstract." }, + A_type_predicate_s_type_must_be_assignable_to_its_parameter_s_type: { code: 2677, category: ts.DiagnosticCategory.Error, key: "A_type_predicate_s_type_must_be_assignable_to_its_parameter_s_type_2677", message: "A type predicate's type must be assignable to its parameter's type." }, + Type_0_is_not_comparable_to_type_1: { code: 2678, category: ts.DiagnosticCategory.Error, key: "Type_0_is_not_comparable_to_type_1_2678", message: "Type '{0}' is not comparable to type '{1}'." }, + A_function_that_is_called_with_the_new_keyword_cannot_have_a_this_type_that_is_void: { code: 2679, category: ts.DiagnosticCategory.Error, key: "A_function_that_is_called_with_the_new_keyword_cannot_have_a_this_type_that_is_void_2679", message: "A function that is called with the 'new' keyword cannot have a 'this' type that is 'void'." }, + A_this_parameter_must_be_the_first_parameter: { code: 2680, category: ts.DiagnosticCategory.Error, key: "A_this_parameter_must_be_the_first_parameter_2680", message: "A 'this' parameter must be the first parameter." }, + A_constructor_cannot_have_a_this_parameter: { code: 2681, category: ts.DiagnosticCategory.Error, key: "A_constructor_cannot_have_a_this_parameter_2681", message: "A constructor cannot have a 'this' parameter." }, + A_setter_cannot_have_a_this_parameter: { code: 2682, category: ts.DiagnosticCategory.Error, key: "A_setter_cannot_have_a_this_parameter_2682", message: "A setter cannot have a 'this' parameter." }, + 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." }, 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}'." }, @@ -1801,6 +1873,7 @@ var ts; Parameter_0_of_exported_function_has_or_is_using_private_name_1: { code: 4078, category: ts.DiagnosticCategory.Error, key: "Parameter_0_of_exported_function_has_or_is_using_private_name_1_4078", message: "Parameter '{0}' of exported function has or is using private name '{1}'." }, Exported_type_alias_0_has_or_is_using_private_name_1: { code: 4081, category: ts.DiagnosticCategory.Error, key: "Exported_type_alias_0_has_or_is_using_private_name_1_4081", message: "Exported type alias '{0}' has or is using private name '{1}'." }, Default_export_of_the_module_has_or_is_using_private_name_0: { code: 4082, category: ts.DiagnosticCategory.Error, key: "Default_export_of_the_module_has_or_is_using_private_name_0_4082", message: "Default export of the module has or is using private name '{0}'." }, + Conflicting_library_definitions_for_0_found_at_1_and_2_Copy_the_correct_file_to_the_typings_folder_to_resolve_this_conflict: { code: 4090, category: ts.DiagnosticCategory.Message, key: "Conflicting_library_definitions_for_0_found_at_1_and_2_Copy_the_correct_file_to_the_typings_folder_t_4090", message: "Conflicting library definitions for '{0}' found at '{1}' and '{2}'. Copy the correct file to the 'typings' folder to resolve this conflict." }, The_current_host_does_not_support_the_0_option: { code: 5001, category: ts.DiagnosticCategory.Error, key: "The_current_host_does_not_support_the_0_option_5001", message: "The current host does not support the '{0}' option." }, Cannot_find_the_common_subdirectory_path_for_the_input_files: { code: 5009, category: ts.DiagnosticCategory.Error, key: "Cannot_find_the_common_subdirectory_path_for_the_input_files_5009", message: "Cannot find the common subdirectory path for the input files." }, Cannot_read_file_0_Colon_1: { code: 5012, category: ts.DiagnosticCategory.Error, key: "Cannot_read_file_0_Colon_1_5012", message: "Cannot read file '{0}': {1}" }, @@ -1825,8 +1898,8 @@ var ts; Substitution_0_in_pattern_1_in_can_have_at_most_one_Asterisk_character: { code: 5062, category: ts.DiagnosticCategory.Error, key: "Substitution_0_in_pattern_1_in_can_have_at_most_one_Asterisk_character_5062", message: "Substitution '{0}' in pattern '{1}' in can have at most one '*' character" }, 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." }, - Specifies_the_location_where_debugger_should_locate_map_files_instead_of_generated_locations: { code: 6003, category: ts.DiagnosticCategory.Message, key: "Specifies_the_location_where_debugger_should_locate_map_files_instead_of_generated_locations_6003", message: "Specifies the location where debugger should locate map files instead of generated locations." }, - Specifies_the_location_where_debugger_should_locate_TypeScript_files_instead_of_source_locations: { code: 6004, category: ts.DiagnosticCategory.Message, key: "Specifies_the_location_where_debugger_should_locate_TypeScript_files_instead_of_source_locations_6004", message: "Specifies the location where debugger should locate TypeScript files instead of source locations." }, + 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." }, + Specify_the_location_where_debugger_should_locate_TypeScript_files_instead_of_source_locations: { code: 6004, category: ts.DiagnosticCategory.Message, key: "Specify_the_location_where_debugger_should_locate_TypeScript_files_instead_of_source_locations_6004", message: "Specify the location where debugger should locate TypeScript files instead of source locations." }, Watch_input_files: { code: 6005, category: ts.DiagnosticCategory.Message, key: "Watch_input_files_6005", message: "Watch input files." }, Redirect_output_structure_to_the_directory: { code: 6006, category: ts.DiagnosticCategory.Message, key: "Redirect_output_structure_to_the_directory_6006", message: "Redirect output structure to the directory." }, Do_not_erase_const_enum_declarations_in_generated_code: { code: 6007, category: ts.DiagnosticCategory.Message, key: "Do_not_erase_const_enum_declarations_in_generated_code_6007", message: "Do not erase const enum declarations in generated code." }, @@ -1834,7 +1907,7 @@ var ts; Do_not_emit_comments_to_output: { code: 6009, category: ts.DiagnosticCategory.Message, key: "Do_not_emit_comments_to_output_6009", message: "Do not emit comments to output." }, 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." }, - Specify_ECMAScript_target_version_Colon_ES3_default_ES5_or_ES2015_experimental: { code: 6015, category: ts.DiagnosticCategory.Message, key: "Specify_ECMAScript_target_version_Colon_ES3_default_ES5_or_ES2015_experimental_6015", message: "Specify ECMAScript target version: 'ES3' (default), 'ES5', or 'ES2015' (experimental)" }, + 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_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." }, @@ -1856,8 +1929,7 @@ var ts; 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." }, Unterminated_quoted_string_in_response_file_0: { code: 6045, category: ts.DiagnosticCategory.Error, key: "Unterminated_quoted_string_in_response_file_0_6045", message: "Unterminated quoted string in response file '{0}'." }, - Argument_for_module_option_must_be_commonjs_amd_system_umd_es2015_or_none: { code: 6046, category: ts.DiagnosticCategory.Error, key: "Argument_for_module_option_must_be_commonjs_amd_system_umd_es2015_or_none_6046", message: "Argument for '--module' option must be 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'none'." }, - Argument_for_target_option_must_be_ES3_ES5_or_ES2015: { code: 6047, category: ts.DiagnosticCategory.Error, key: "Argument_for_target_option_must_be_ES3_ES5_or_ES2015_6047", message: "Argument for '--target' option must be 'ES3', 'ES5', or 'ES2015'." }, + Argument_for_0_option_must_be_Colon_1: { code: 6046, category: ts.DiagnosticCategory.Error, key: "Argument_for_0_option_must_be_Colon_1_6046", message: "Argument for '{0}' option must be: {1}" }, Locale_must_be_of_the_form_language_or_language_territory_For_example_0_or_1: { code: 6048, category: ts.DiagnosticCategory.Error, key: "Locale_must_be_of_the_form_language_or_language_territory_For_example_0_or_1_6048", message: "Locale must be of the form or -. For example '{0}' or '{1}'." }, Unsupported_locale_0: { code: 6049, category: ts.DiagnosticCategory.Error, key: "Unsupported_locale_0_6049", message: "Unsupported locale '{0}'." }, Unable_to_open_file_0: { code: 6050, category: ts.DiagnosticCategory.Error, key: "Unable_to_open_file_0_6050", message: "Unable to open file '{0}'." }, @@ -1867,17 +1939,15 @@ var ts; File_0_has_unsupported_extension_The_only_supported_extensions_are_1: { code: 6054, category: ts.DiagnosticCategory.Error, key: "File_0_has_unsupported_extension_The_only_supported_extensions_are_1_6054", message: "File '{0}' has unsupported extension. The only supported extensions are {1}." }, Suppress_noImplicitAny_errors_for_indexing_objects_lacking_index_signatures: { code: 6055, category: ts.DiagnosticCategory.Message, key: "Suppress_noImplicitAny_errors_for_indexing_objects_lacking_index_signatures_6055", message: "Suppress noImplicitAny errors for indexing objects lacking index signatures." }, Do_not_emit_declarations_for_code_that_has_an_internal_annotation: { code: 6056, category: ts.DiagnosticCategory.Message, key: "Do_not_emit_declarations_for_code_that_has_an_internal_annotation_6056", message: "Do not emit declarations for code that has an '@internal' annotation." }, - Specifies_the_root_directory_of_input_files_Use_to_control_the_output_directory_structure_with_outDir: { code: 6058, category: ts.DiagnosticCategory.Message, key: "Specifies_the_root_directory_of_input_files_Use_to_control_the_output_directory_structure_with_outDi_6058", message: "Specifies the root directory of input files. Use to control the output directory structure with --outDir." }, + Specify_the_root_directory_of_input_files_Use_to_control_the_output_directory_structure_with_outDir: { code: 6058, category: ts.DiagnosticCategory.Message, key: "Specify_the_root_directory_of_input_files_Use_to_control_the_output_directory_structure_with_outDir_6058", message: "Specify the root directory of input files. Use to control the output directory structure with --outDir." }, File_0_is_not_under_rootDir_1_rootDir_is_expected_to_contain_all_source_files: { code: 6059, category: ts.DiagnosticCategory.Error, key: "File_0_is_not_under_rootDir_1_rootDir_is_expected_to_contain_all_source_files_6059", message: "File '{0}' is not under 'rootDir' '{1}'. 'rootDir' is expected to contain all source files." }, - Specifies_the_end_of_line_sequence_to_be_used_when_emitting_files_Colon_CRLF_dos_or_LF_unix: { code: 6060, category: ts.DiagnosticCategory.Message, key: "Specifies_the_end_of_line_sequence_to_be_used_when_emitting_files_Colon_CRLF_dos_or_LF_unix_6060", message: "Specifies the end of line sequence to be used when emitting files: 'CRLF' (dos) or 'LF' (unix)." }, + Specify_the_end_of_line_sequence_to_be_used_when_emitting_files_Colon_CRLF_dos_or_LF_unix: { code: 6060, category: ts.DiagnosticCategory.Message, key: "Specify_the_end_of_line_sequence_to_be_used_when_emitting_files_Colon_CRLF_dos_or_LF_unix_6060", message: "Specify the end of line sequence to be used when emitting files: 'CRLF' (dos) or 'LF' (unix)." }, NEWLINE: { code: 6061, category: ts.DiagnosticCategory.Message, key: "NEWLINE_6061", message: "NEWLINE" }, - Argument_for_newLine_option_must_be_CRLF_or_LF: { code: 6062, category: ts.DiagnosticCategory.Error, key: "Argument_for_newLine_option_must_be_CRLF_or_LF_6062", message: "Argument for '--newLine' option must be 'CRLF' or 'LF'." }, - Argument_for_moduleResolution_option_must_be_node_or_classic: { code: 6063, category: ts.DiagnosticCategory.Error, key: "Argument_for_moduleResolution_option_must_be_node_or_classic_6063", message: "Argument for '--moduleResolution' option must be 'node' or 'classic'." }, Option_0_can_only_be_specified_in_tsconfig_json_file: { code: 6064, category: ts.DiagnosticCategory.Error, key: "Option_0_can_only_be_specified_in_tsconfig_json_file_6064", message: "Option '{0}' can only be specified in 'tsconfig.json' file." }, Enables_experimental_support_for_ES7_decorators: { code: 6065, category: ts.DiagnosticCategory.Message, key: "Enables_experimental_support_for_ES7_decorators_6065", message: "Enables experimental support for ES7 decorators." }, Enables_experimental_support_for_emitting_type_metadata_for_decorators: { code: 6066, category: ts.DiagnosticCategory.Message, key: "Enables_experimental_support_for_emitting_type_metadata_for_decorators_6066", message: "Enables experimental support for emitting type metadata for decorators." }, Enables_experimental_support_for_ES7_async_functions: { code: 6068, category: ts.DiagnosticCategory.Message, key: "Enables_experimental_support_for_ES7_async_functions_6068", message: "Enables experimental support for ES7 async functions." }, - Specifies_module_resolution_strategy_Colon_node_Node_js_or_classic_TypeScript_pre_1_6: { code: 6069, category: ts.DiagnosticCategory.Message, key: "Specifies_module_resolution_strategy_Colon_node_Node_js_or_classic_TypeScript_pre_1_6_6069", message: "Specifies module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6)." }, + Specify_module_resolution_strategy_Colon_node_Node_js_or_classic_TypeScript_pre_1_6: { code: 6069, category: ts.DiagnosticCategory.Message, key: "Specify_module_resolution_strategy_Colon_node_Node_js_or_classic_TypeScript_pre_1_6_6069", message: "Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6)." }, Initializes_a_TypeScript_project_and_creates_a_tsconfig_json_file: { code: 6070, category: ts.DiagnosticCategory.Message, key: "Initializes_a_TypeScript_project_and_creates_a_tsconfig_json_file_6070", message: "Initializes a TypeScript project and creates a tsconfig.json file." }, Successfully_created_a_tsconfig_json_file: { code: 6071, category: ts.DiagnosticCategory.Message, key: "Successfully_created_a_tsconfig_json_file_6071", message: "Successfully created a tsconfig.json file." }, Suppress_excess_property_checks_for_object_literals: { code: 6072, category: ts.DiagnosticCategory.Message, key: "Suppress_excess_property_checks_for_object_literals_6072", message: "Suppress excess property checks for object literals." }, @@ -1887,12 +1957,12 @@ var ts; Report_errors_for_fallthrough_cases_in_switch_statement: { code: 6076, category: ts.DiagnosticCategory.Message, key: "Report_errors_for_fallthrough_cases_in_switch_statement_6076", message: "Report errors for fallthrough cases in switch statement." }, Do_not_report_errors_on_unreachable_code: { code: 6077, category: ts.DiagnosticCategory.Message, key: "Do_not_report_errors_on_unreachable_code_6077", message: "Do not report errors on unreachable code." }, 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'" }, - Argument_for_jsx_must_be_preserve_or_react: { code: 6081, category: ts.DiagnosticCategory.Message, key: "Argument_for_jsx_must_be_preserve_or_react_6081", message: "Argument for '--jsx' must be 'preserve' or 'react'." }, 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." }, - Specifies_the_object_invoked_for_createElement_and_spread_when_targeting_react_JSX_emit: { code: 6084, category: ts.DiagnosticCategory.Message, key: "Specifies_the_object_invoked_for_createElement_and_spread_when_targeting_react_JSX_emit_6084", message: "Specifies the object invoked for createElement and __spread when targeting 'react' JSX emit" }, - Enable_tracing_of_the_module_resolution_process: { code: 6085, category: ts.DiagnosticCategory.Message, key: "Enable_tracing_of_the_module_resolution_process_6085", message: "Enable tracing of the module resolution process." }, + 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" }, + Enable_tracing_of_the_name_resolution_process: { code: 6085, category: ts.DiagnosticCategory.Message, key: "Enable_tracing_of_the_name_resolution_process_6085", message: "Enable tracing of the name resolution process." }, Resolving_module_0_from_1: { code: 6086, category: ts.DiagnosticCategory.Message, key: "Resolving_module_0_from_1_6086", message: "======== Resolving module '{0}' from '{1}'. ========" }, Explicitly_specified_module_resolution_kind_Colon_0: { code: 6087, category: ts.DiagnosticCategory.Message, key: "Explicitly_specified_module_resolution_kind_Colon_0_6087", message: "Explicitly specified module resolution kind: '{0}'." }, Module_resolution_kind_is_not_specified_using_0: { code: 6088, category: ts.DiagnosticCategory.Message, key: "Module_resolution_kind_is_not_specified_using_0_6088", message: "Module resolution kind is not specified, using '{0}'." }, @@ -1904,15 +1974,15 @@ var ts; Resolving_module_name_0_relative_to_base_url_1_2: { code: 6094, category: ts.DiagnosticCategory.Message, key: "Resolving_module_name_0_relative_to_base_url_1_2_6094", message: "Resolving module name '{0}' relative to base url '{1}' - '{2}'." }, Loading_module_as_file_Slash_folder_candidate_module_location_0: { code: 6095, category: ts.DiagnosticCategory.Message, key: "Loading_module_as_file_Slash_folder_candidate_module_location_0_6095", message: "Loading module as file / folder, candidate module location '{0}'." }, File_0_does_not_exist: { code: 6096, category: ts.DiagnosticCategory.Message, key: "File_0_does_not_exist_6096", message: "File '{0}' does not exist." }, - File_0_exist_use_it_as_a_module_resolution_result: { code: 6097, category: ts.DiagnosticCategory.Message, key: "File_0_exist_use_it_as_a_module_resolution_result_6097", message: "File '{0}' exist - use it as a module resolution result." }, + 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_typings_field: { code: 6100, category: ts.DiagnosticCategory.Message, key: "package_json_does_not_have_typings_field_6100", message: "'package.json' does not have 'typings' field." }, - package_json_has_typings_field_0_that_references_1: { code: 6101, category: ts.DiagnosticCategory.Message, key: "package_json_has_typings_field_0_that_references_1_6101", message: "'package.json' has 'typings' field '{0}' that references '{1}'." }, + 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_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." }, Checking_if_0_is_the_longest_matching_prefix_for_1_2: { code: 6104, category: ts.DiagnosticCategory.Message, key: "Checking_if_0_is_the_longest_matching_prefix_for_1_2_6104", message: "Checking if '{0}' is the longest matching prefix for '{1}' - '{2}'." }, - Expected_type_of_typings_field_in_package_json_to_be_string_got_0: { code: 6105, category: ts.DiagnosticCategory.Message, key: "Expected_type_of_typings_field_in_package_json_to_be_string_got_0_6105", message: "Expected type of 'typings' field in 'package.json' to be 'string', got '{0}'." }, + Expected_type_of_0_field_in_package_json_to_be_string_got_1: { code: 6105, category: ts.DiagnosticCategory.Message, key: "Expected_type_of_0_field_in_package_json_to_be_string_got_1_6105", message: "Expected type of '{0}' field in 'package.json' to be 'string', got '{1}'." }, baseUrl_option_is_set_to_0_using_this_value_to_resolve_non_relative_module_name_1: { code: 6106, category: ts.DiagnosticCategory.Message, key: "baseUrl_option_is_set_to_0_using_this_value_to_resolve_non_relative_module_name_1_6106", message: "'baseUrl' option is set to '{0}', using this value to resolve non-relative module name '{1}'" }, rootDirs_option_is_set_using_it_to_resolve_relative_module_name_0: { code: 6107, category: ts.DiagnosticCategory.Message, key: "rootDirs_option_is_set_using_it_to_resolve_relative_module_name_0_6107", message: "'rootDirs' option is set, using it to resolve relative module name '{0}'" }, Longest_matching_prefix_for_0_is_1: { code: 6108, category: ts.DiagnosticCategory.Message, key: "Longest_matching_prefix_for_0_is_1_6108", message: "Longest matching prefix for '{0}' is '{1}'" }, @@ -1920,6 +1990,22 @@ var ts; Trying_other_entries_in_rootDirs: { code: 6110, category: ts.DiagnosticCategory.Message, key: "Trying_other_entries_in_rootDirs_6110", message: "Trying other entries in 'rootDirs'" }, Module_resolution_using_rootDirs_has_failed: { code: 6111, category: ts.DiagnosticCategory.Message, key: "Module_resolution_using_rootDirs_has_failed_6111", message: "Module resolution using 'rootDirs' has failed" }, Do_not_emit_use_strict_directives_in_module_output: { code: 6112, category: ts.DiagnosticCategory.Message, key: "Do_not_emit_use_strict_directives_in_module_output_6112", message: "Do not emit 'use strict' directives in module output." }, + Enable_strict_null_checks: { code: 6113, category: ts.DiagnosticCategory.Message, key: "Enable_strict_null_checks_6113", message: "Enable strict null checks." }, + Unknown_option_excludes_Did_you_mean_exclude: { code: 6114, category: ts.DiagnosticCategory.Error, key: "Unknown_option_excludes_Did_you_mean_exclude_6114", message: "Unknown option 'excludes'. Did you mean 'exclude'?" }, + Raise_error_on_this_expressions_with_an_implied_any_type: { code: 6115, category: ts.DiagnosticCategory.Message, key: "Raise_error_on_this_expressions_with_an_implied_any_type_6115", message: "Raise error on 'this' expressions with an implied 'any' type." }, + Resolving_type_reference_directive_0_containing_file_1_root_directory_2: { code: 6116, category: ts.DiagnosticCategory.Message, key: "Resolving_type_reference_directive_0_containing_file_1_root_directory_2_6116", message: "======== Resolving type reference directive '{0}', containing file '{1}', root directory '{2}'. ========" }, + Resolving_using_primary_search_paths: { code: 6117, category: ts.DiagnosticCategory.Message, key: "Resolving_using_primary_search_paths_6117", message: "Resolving using primary search paths..." }, + Resolving_from_node_modules_folder: { code: 6118, category: ts.DiagnosticCategory.Message, key: "Resolving_from_node_modules_folder_6118", message: "Resolving from node_modules folder..." }, + Type_reference_directive_0_was_successfully_resolved_to_1_primary_Colon_2: { code: 6119, category: ts.DiagnosticCategory.Message, key: "Type_reference_directive_0_was_successfully_resolved_to_1_primary_Colon_2_6119", message: "======== Type reference directive '{0}' was successfully resolved to '{1}', primary: {2}. ========" }, + Type_reference_directive_0_was_not_resolved: { code: 6120, category: ts.DiagnosticCategory.Message, key: "Type_reference_directive_0_was_not_resolved_6120", message: "======== Type reference directive '{0}' was not resolved. ========" }, + Resolving_with_primary_search_path_0: { code: 6121, category: ts.DiagnosticCategory.Message, key: "Resolving_with_primary_search_path_0_6121", message: "Resolving with primary search path '{0}'" }, + Root_directory_cannot_be_determined_skipping_primary_search_paths: { code: 6122, category: ts.DiagnosticCategory.Message, key: "Root_directory_cannot_be_determined_skipping_primary_search_paths_6122", message: "Root directory cannot be determined, skipping primary search paths." }, + Resolving_type_reference_directive_0_containing_file_1_root_directory_not_set: { code: 6123, category: ts.DiagnosticCategory.Message, key: "Resolving_type_reference_directive_0_containing_file_1_root_directory_not_set_6123", message: "======== Resolving type reference directive '{0}', containing file '{1}', root directory not set. ========" }, + Type_declaration_files_to_be_included_in_compilation: { code: 6124, category: ts.DiagnosticCategory.Message, key: "Type_declaration_files_to_be_included_in_compilation_6124", message: "Type declaration files to be included in compilation." }, + Looking_up_in_node_modules_folder_initial_location_0: { code: 6125, category: ts.DiagnosticCategory.Message, key: "Looking_up_in_node_modules_folder_initial_location_0_6125", message: "Looking up in 'node_modules' folder, initial location '{0}'" }, + Containing_file_is_not_specified_and_root_directory_cannot_be_determined_skipping_lookup_in_node_modules_folder: { code: 6126, category: ts.DiagnosticCategory.Message, key: "Containing_file_is_not_specified_and_root_directory_cannot_be_determined_skipping_lookup_in_node_mod_6126", message: "Containing file is not specified and root directory cannot be determined, skipping lookup in 'node_modules' folder." }, + Resolving_type_reference_directive_0_containing_file_not_set_root_directory_1: { code: 6127, category: ts.DiagnosticCategory.Message, key: "Resolving_type_reference_directive_0_containing_file_not_set_root_directory_1_6127", message: "======== Resolving type reference directive '{0}', containing file not set, root directory '{1}'. ========" }, + Resolving_type_reference_directive_0_containing_file_not_set_root_directory_not_set: { code: 6128, category: ts.DiagnosticCategory.Message, key: "Resolving_type_reference_directive_0_containing_file_not_set_root_directory_not_set_6128", message: "======== Resolving type reference directive '{0}', containing file not set, root directory not set. ========" }, 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." }, @@ -1942,6 +2028,7 @@ var ts; Unused_label: { code: 7028, category: ts.DiagnosticCategory.Error, key: "Unused_label_7028", message: "Unused label." }, 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." }, 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." }, @@ -1969,7 +2056,8 @@ var ts; An_unary_expression_with_the_0_operator_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_expression_Consider_enclosing_the_expression_in_parentheses: { code: 17006, category: ts.DiagnosticCategory.Error, key: "An_unary_expression_with_the_0_operator_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_ex_17006", message: "An unary expression with the '{0}' operator is not allowed in the left-hand side of an exponentiation expression. Consider enclosing the expression in parentheses." }, 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." } + 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}'." } }; })(ts || (ts = {})); var ts; @@ -2002,7 +2090,7 @@ var ts; "false": 84, "finally": 85, "for": 86, - "from": 134, + "from": 135, "function": 87, "get": 123, "if": 88, @@ -2024,7 +2112,7 @@ var ts; "public": 112, "readonly": 127, "require": 128, - "global": 135, + "global": 136, "return": 94, "set": 130, "static": 113, @@ -2038,6 +2126,7 @@ var ts; "try": 100, "type": 133, "typeof": 101, + "undefined": 134, "var": 102, "void": 103, "while": 104, @@ -2045,7 +2134,7 @@ var ts; "yield": 114, "async": 118, "await": 119, - "of": 136, + "of": 137, "{": 15, "}": 16, "(": 17, @@ -3308,7 +3397,7 @@ var ts; break; } } - return token = 240; + return token = 243; } function scanJsxIdentifier() { if (tokenIsIdentifierOrKeyword(token)) { @@ -3467,10 +3556,10 @@ var ts; var stringWriters = []; function getSingleLineStringWriter() { if (stringWriters.length === 0) { - var str = ""; - var writeText = function (text) { return str += text; }; + var str_1 = ""; + var writeText = function (text) { return str_1 += text; }; return { - string: function () { return str; }, + string: function () { return str_1; }, writeKeyword: writeText, writeOperator: writeText, writePunctuation: writeText, @@ -3478,10 +3567,10 @@ var ts; writeStringLiteral: writeText, writeParameter: writeText, writeSymbol: writeText, - writeLine: function () { return str += " "; }, + writeLine: function () { return str_1 += " "; }, increaseIndent: function () { }, decreaseIndent: function () { }, - clear: function () { return str = ""; }, + clear: function () { return str_1 = ""; }, trackSymbol: function () { }, reportInaccessibleThisError: function () { } }; @@ -3529,6 +3618,38 @@ var ts; sourceFile.resolvedModules[moduleNameText] = resolvedModule; } ts.setResolvedModule = setResolvedModule; + function setResolvedTypeReferenceDirective(sourceFile, typeReferenceDirectiveName, resolvedTypeReferenceDirective) { + if (!sourceFile.resolvedTypeReferenceDirectiveNames) { + sourceFile.resolvedTypeReferenceDirectiveNames = {}; + } + sourceFile.resolvedTypeReferenceDirectiveNames[typeReferenceDirectiveName] = resolvedTypeReferenceDirective; + } + ts.setResolvedTypeReferenceDirective = setResolvedTypeReferenceDirective; + function moduleResolutionIsEqualTo(oldResolution, newResolution) { + return oldResolution.resolvedFileName === newResolution.resolvedFileName && oldResolution.isExternalLibraryImport === newResolution.isExternalLibraryImport; + } + ts.moduleResolutionIsEqualTo = moduleResolutionIsEqualTo; + function typeDirectiveIsEqualTo(oldResolution, newResolution) { + return oldResolution.resolvedFileName === newResolution.resolvedFileName && oldResolution.primary === newResolution.primary; + } + ts.typeDirectiveIsEqualTo = typeDirectiveIsEqualTo; + function hasChangesInResolutions(names, newResolutions, oldResolutions, comparer) { + if (names.length !== newResolutions.length) { + return false; + } + for (var i = 0; i < names.length; i++) { + var newResolution = newResolutions[i]; + var oldResolution = oldResolutions && ts.hasProperty(oldResolutions, names[i]) ? oldResolutions[names[i]] : undefined; + var changed = oldResolution + ? !newResolution || !comparer(oldResolution, newResolution) + : newResolution; + if (changed) { + return true; + } + } + return false; + } + ts.hasChangesInResolutions = hasChangesInResolutions; function containsParseError(node) { aggregateChildData(node); return (node.flags & 268435456) !== 0; @@ -3545,7 +3666,7 @@ var ts; } } function getSourceFileOfNode(node) { - while (node && node.kind !== 252) { + while (node && node.kind !== 255) { node = node.parent; } return node; @@ -3553,11 +3674,11 @@ var ts; ts.getSourceFileOfNode = getSourceFileOfNode; function isStatementWithLocals(node) { switch (node.kind) { - case 196: - case 224: - case 203: - case 204: + case 198: + case 226: case 205: + case 206: + case 207: return true; } return false; @@ -3578,6 +3699,25 @@ var ts; return node.pos; } ts.getStartPosOfNode = getStartPosOfNode; + function getEndLinePosition(line, sourceFile) { + ts.Debug.assert(line >= 0); + var lineStarts = ts.getLineStarts(sourceFile); + var lineIndex = line; + var sourceText = sourceFile.text; + if (lineIndex + 1 === lineStarts.length) { + return sourceText.length - 1; + } + else { + var start = lineStarts[lineIndex]; + var pos = lineStarts[lineIndex + 1] - 1; + ts.Debug.assert(ts.isLineBreak(sourceText.charCodeAt(pos))); + while (start <= pos && ts.isLineBreak(sourceText.charCodeAt(pos))) { + pos--; + } + return pos; + } + } + ts.getEndLinePosition = getEndLinePosition; function nodeIsMissing(node) { if (!node) { return true; @@ -3642,13 +3782,13 @@ var ts; } ts.isBlockOrCatchScoped = isBlockOrCatchScoped; function isAmbientModule(node) { - return node && node.kind === 222 && + return node && node.kind === 224 && (node.name.kind === 9 || isGlobalScopeAugmentation(node)); } ts.isAmbientModule = isAmbientModule; function isBlockScopedContainerTopLevel(node) { - return node.kind === 252 || - node.kind === 222 || + return node.kind === 255 || + node.kind === 224 || isFunctionLike(node) || isFunctionBlock(node); } @@ -3662,10 +3802,10 @@ var ts; return false; } switch (node.parent.kind) { - case 252: - return isExternalModule(node.parent); - case 223: - return isAmbientModule(node.parent.parent) && !isExternalModule(node.parent.parent.parent); + case 255: + return ts.isExternalModule(node.parent); + case 225: + return isAmbientModule(node.parent.parent) && !ts.isExternalModule(node.parent.parent.parent); } return false; } @@ -3677,15 +3817,15 @@ var ts; return current; } switch (current.kind) { - case 252: + case 255: + case 226: + case 251: case 224: - case 248: - case 222: - case 203: - case 204: case 205: + case 206: + case 207: return current; - case 196: + case 198: if (!isFunctionLike(current.parent)) { return current; } @@ -3696,9 +3836,9 @@ var ts; ts.getEnclosingBlockScopeContainer = getEnclosingBlockScopeContainer; function isCatchClauseVariableDeclaration(declaration) { return declaration && - declaration.kind === 215 && + declaration.kind === 217 && declaration.parent && - declaration.parent.kind === 248; + declaration.parent.kind === 251; } ts.isCatchClauseVariableDeclaration = isCatchClauseVariableDeclaration; function declarationNameToString(name) { @@ -3731,31 +3871,44 @@ var ts; return ts.createTextSpanFromBounds(start, scanner.getTextPos()); } ts.getSpanOfTokenAtPosition = getSpanOfTokenAtPosition; + function getErrorSpanForArrowFunction(sourceFile, node) { + var pos = ts.skipTrivia(sourceFile.text, node.pos); + if (node.body && node.body.kind === 198) { + var startLine = ts.getLineAndCharacterOfPosition(sourceFile, node.body.pos).line; + var endLine = ts.getLineAndCharacterOfPosition(sourceFile, node.body.end).line; + if (startLine < endLine) { + return ts.createTextSpan(pos, getEndLinePosition(startLine, sourceFile) - pos + 1); + } + } + return ts.createTextSpanFromBounds(pos, node.end); + } function getErrorSpanForNode(sourceFile, node) { var errorNode = node; switch (node.kind) { - case 252: + case 255: var pos_1 = ts.skipTrivia(sourceFile.text, 0, false); if (pos_1 === sourceFile.text.length) { return ts.createTextSpan(0, 0); } return getSpanOfTokenAtPosition(sourceFile, pos_1); - case 215: - case 167: - case 218: - case 190: - case 219: - case 222: - case 221: - case 251: case 217: - case 177: - case 145: - case 147: - case 148: + case 168: case 220: + case 191: + case 221: + case 224: + case 223: + case 254: + case 219: + case 178: + case 146: + case 148: + case 149: + case 222: errorNode = node.name; break; + case 179: + return getErrorSpanForArrowFunction(sourceFile, node); } if (errorNode === undefined) { return getSpanOfTokenAtPosition(sourceFile, node.pos); @@ -3766,10 +3919,6 @@ var ts; return ts.createTextSpanFromBounds(pos, errorNode.end); } ts.getErrorSpanForNode = getErrorSpanForNode; - function isExternalModule(file) { - return file.externalModuleIndicator !== undefined; - } - ts.isExternalModule = isExternalModule; function isExternalOrCommonJsModule(file) { return (file.externalModuleIndicator || file.commonJsModuleIndicator) !== undefined; } @@ -3779,11 +3928,11 @@ var ts; } ts.isDeclarationFile = isDeclarationFile; function isConstEnumDeclaration(node) { - return node.kind === 221 && isConst(node); + return node.kind === 223 && isConst(node); } ts.isConstEnumDeclaration = isConstEnumDeclaration; function walkUpBindingElementsAndPatterns(node) { - while (node && (node.kind === 167 || isBindingPattern(node))) { + while (node && (node.kind === 168 || isBindingPattern(node))) { node = node.parent; } return node; @@ -3791,14 +3940,14 @@ var ts; function getCombinedNodeFlags(node) { node = walkUpBindingElementsAndPatterns(node); var flags = node.flags; - if (node.kind === 215) { + if (node.kind === 217) { node = node.parent; } - if (node && node.kind === 216) { + if (node && node.kind === 218) { flags |= node.flags; node = node.parent; } - if (node && node.kind === 197) { + if (node && node.kind === 199) { flags |= node.flags; } return flags; @@ -3813,11 +3962,11 @@ var ts; } ts.isLet = isLet; function isSuperCallExpression(n) { - return n.kind === 172 && n.expression.kind === 95; + return n.kind === 173 && n.expression.kind === 95; } ts.isSuperCallExpression = isSuperCallExpression; function isPrologueDirective(node) { - return node.kind === 199 && node.expression.kind === 9; + return node.kind === 201 && node.expression.kind === 9; } ts.isPrologueDirective = isPrologueDirective; function getLeadingCommentRangesOfNode(node, sourceFileOfNode) { @@ -3833,7 +3982,7 @@ var ts; } ts.getJsDocComments = getJsDocComments; function getJsDocCommentsFromText(node, text) { - var commentRanges = (node.kind === 140 || node.kind === 139) ? + var commentRanges = (node.kind === 141 || node.kind === 140) ? ts.concatenate(ts.getTrailingCommentRanges(text, node.pos), ts.getLeadingCommentRanges(text, node.pos)) : getLeadingCommentRangesOfNodeFromText(node, text); return ts.filter(commentRanges, isJsDocComment); @@ -3845,9 +3994,10 @@ var ts; } ts.getJsDocCommentsFromText = getJsDocCommentsFromText; ts.fullTripleSlashReferencePathRegEx = /^(\/\/\/\s*/; + ts.fullTripleSlashReferenceTypeReferenceDirectiveRegEx = /^(\/\/\/\s*/; ts.fullTripleSlashAMDReferencePathRegEx = /^(\/\/\/\s*/; function isTypeNode(node) { - if (152 <= node.kind && node.kind <= 164) { + if (153 <= node.kind && node.kind <= 165) { return true; } switch (node.kind) { @@ -3856,58 +4006,59 @@ var ts; case 131: case 120: case 132: + case 134: return true; case 103: - return node.parent.kind !== 181; - case 192: + return node.parent.kind !== 182; + case 193: return !isExpressionWithTypeArgumentsInClassExtendsClause(node); case 69: - if (node.parent.kind === 137 && node.parent.right === node) { + if (node.parent.kind === 138 && node.parent.right === node) { node = node.parent; } - else if (node.parent.kind === 170 && node.parent.name === node) { + else if (node.parent.kind === 171 && node.parent.name === node) { node = node.parent; } - ts.Debug.assert(node.kind === 69 || node.kind === 137 || node.kind === 170, "'node' was expected to be a qualified name, identifier or property access in 'isTypeNode'."); - case 137: - case 170: + ts.Debug.assert(node.kind === 69 || node.kind === 138 || node.kind === 171, "'node' was expected to be a qualified name, identifier or property access in 'isTypeNode'."); + case 138: + case 171: case 97: var parent_1 = node.parent; - if (parent_1.kind === 156) { + if (parent_1.kind === 157) { return false; } - if (152 <= parent_1.kind && parent_1.kind <= 164) { + if (153 <= parent_1.kind && parent_1.kind <= 165) { return true; } switch (parent_1.kind) { - case 192: + case 193: return !isExpressionWithTypeArgumentsInClassExtendsClause(parent_1); - case 139: - return node === parent_1.constraint; - case 143: - case 142: case 140: - case 215: - return node === parent_1.type; + return node === parent_1.constraint; + case 144: + case 143: + case 141: case 217: - case 177: + return node === parent_1.type; + case 219: case 178: + case 179: + case 147: case 146: case 145: - case 144: - case 147: case 148: - return node === parent_1.type; case 149: + return node === parent_1.type; case 150: case 151: + case 152: return node === parent_1.type; - case 175: + case 176: return node === parent_1.type; - case 172: case 173: - return parent_1.typeArguments && ts.indexOf(parent_1.typeArguments, node) >= 0; case 174: + return parent_1.typeArguments && ts.indexOf(parent_1.typeArguments, node) >= 0; + case 175: return false; } } @@ -3918,23 +4069,23 @@ var ts; return traverse(body); function traverse(node) { switch (node.kind) { - case 208: + case 210: return visitor(node); - case 224: - case 196: - case 200: - case 201: + case 226: + case 198: case 202: case 203: case 204: case 205: - case 209: - case 210: - case 245: - case 246: + case 206: + case 207: case 211: - case 213: + case 212: case 248: + case 249: + case 213: + case 215: + case 251: return ts.forEachChild(node, traverse); } } @@ -3944,23 +4095,23 @@ var ts; return traverse(body); function traverse(node) { switch (node.kind) { - case 188: + case 189: visitor(node); var operand = node.expression; if (operand) { traverse(operand); } + case 223: case 221: - case 219: + case 224: case 222: case 220: - case 218: - case 190: + case 191: return; default: if (isFunctionLike(node)) { var name_5 = node.name; - if (name_5 && name_5.kind === 138) { + if (name_5 && name_5.kind === 139) { traverse(name_5.expression); return; } @@ -3975,14 +4126,14 @@ var ts; function isVariableLike(node) { if (node) { switch (node.kind) { - case 167: - case 251: - case 140: - case 249: + case 168: + case 254: + case 141: + case 252: + case 144: case 143: - case 142: - case 250: - case 215: + case 253: + case 217: return true; } } @@ -3990,11 +4141,11 @@ var ts; } ts.isVariableLike = isVariableLike; function isAccessor(node) { - return node && (node.kind === 147 || node.kind === 148); + return node && (node.kind === 148 || node.kind === 149); } ts.isAccessor = isAccessor; function isClassLike(node) { - return node && (node.kind === 218 || node.kind === 190); + return node && (node.kind === 220 || node.kind === 191); } ts.isClassLike = isClassLike; function isFunctionLike(node) { @@ -4003,32 +4154,32 @@ var ts; ts.isFunctionLike = isFunctionLike; function isFunctionLikeKind(kind) { switch (kind) { - case 146: - case 177: - case 217: - case 178: - case 145: - case 144: case 147: + case 178: + case 219: + case 179: + case 146: + case 145: case 148: case 149: case 150: case 151: - case 154: + case 152: case 155: + case 156: return true; } } ts.isFunctionLikeKind = isFunctionLikeKind; function introducesArgumentsExoticObject(node) { switch (node.kind) { - case 145: - case 144: case 146: + case 145: case 147: case 148: - case 217: - case 177: + case 149: + case 219: + case 178: return true; } return false; @@ -4036,24 +4187,24 @@ var ts; ts.introducesArgumentsExoticObject = introducesArgumentsExoticObject; function isIterationStatement(node, lookInLabeledStatements) { switch (node.kind) { + case 205: + case 206: + case 207: case 203: case 204: - case 205: - case 201: - case 202: return true; - case 211: + case 213: return lookInLabeledStatements && isIterationStatement(node.statement, lookInLabeledStatements); } return false; } ts.isIterationStatement = isIterationStatement; function isFunctionBlock(node) { - return node && node.kind === 196 && isFunctionLike(node.parent); + return node && node.kind === 198 && isFunctionLike(node.parent); } ts.isFunctionBlock = isFunctionBlock; function isObjectLiteralMethod(node) { - return node && node.kind === 145 && node.parent.kind === 169; + return node && node.kind === 146 && node.parent.kind === 170; } ts.isObjectLiteralMethod = isObjectLiteralMethod; function isIdentifierTypePredicate(predicate) { @@ -4089,39 +4240,39 @@ var ts; return undefined; } switch (node.kind) { - case 138: + case 139: if (isClassLike(node.parent.parent)) { return node; } node = node.parent; break; - case 141: - if (node.parent.kind === 140 && isClassElement(node.parent.parent)) { + case 142: + if (node.parent.kind === 141 && isClassElement(node.parent.parent)) { node = node.parent.parent; } else if (isClassElement(node.parent)) { node = node.parent; } break; - case 178: + case 179: if (!includeArrowFunctions) { continue; } - case 217: - case 177: - case 222: - case 143: - case 142: - case 145: + case 219: + case 178: + case 224: case 144: + case 143: case 146: + case 145: case 147: case 148: case 149: case 150: case 151: - case 221: - case 252: + case 152: + case 223: + case 255: return node; } } @@ -4134,25 +4285,25 @@ var ts; return node; } switch (node.kind) { - case 138: + case 139: node = node.parent; break; - case 217: - case 177: + case 219: case 178: + case 179: if (!stopOnFunctions) { continue; } - case 143: - case 142: - case 145: case 144: + case 143: case 146: + case 145: case 147: case 148: + case 149: return node; - case 141: - if (node.parent.kind === 140 && isClassElement(node.parent.parent)) { + case 142: + if (node.parent.kind === 141 && isClassElement(node.parent.parent)) { node = node.parent.parent; } else if (isClassElement(node.parent)) { @@ -4164,20 +4315,20 @@ var ts; } ts.getSuperContainer = getSuperContainer; function isSuperPropertyOrElementAccess(node) { - return (node.kind === 170 - || node.kind === 171) + return (node.kind === 171 + || node.kind === 172) && node.expression.kind === 95; } ts.isSuperPropertyOrElementAccess = isSuperPropertyOrElementAccess; function getEntityNameFromTypeNode(node) { if (node) { switch (node.kind) { - case 153: + case 154: return node.typeName; - case 192: + case 193: return node.expression; case 69: - case 137: + case 138: return node; } } @@ -4185,7 +4336,7 @@ var ts; } ts.getEntityNameFromTypeNode = getEntityNameFromTypeNode; function getInvokedExpression(node) { - if (node.kind === 174) { + if (node.kind === 175) { return node.tag; } return node.expression; @@ -4193,21 +4344,21 @@ var ts; ts.getInvokedExpression = getInvokedExpression; function nodeCanBeDecorated(node) { switch (node.kind) { - case 218: + case 220: return true; - case 143: - return node.parent.kind === 218; - case 147: + case 144: + return node.parent.kind === 220; case 148: - case 145: + case 149: + case 146: return node.body !== undefined - && node.parent.kind === 218; - case 140: + && node.parent.kind === 220; + case 141: return node.parent.body !== undefined - && (node.parent.kind === 146 - || node.parent.kind === 145 - || node.parent.kind === 148) - && node.parent.parent.kind === 218; + && (node.parent.kind === 147 + || node.parent.kind === 146 + || node.parent.kind === 149) + && node.parent.parent.kind === 220; } return false; } @@ -4218,13 +4369,23 @@ var ts; } ts.nodeIsDecorated = nodeIsDecorated; function isPropertyAccessExpression(node) { - return node.kind === 170; + return node.kind === 171; } ts.isPropertyAccessExpression = isPropertyAccessExpression; function isElementAccessExpression(node) { - return node.kind === 171; + return node.kind === 172; } ts.isElementAccessExpression = isElementAccessExpression; + function isJSXTagName(node) { + var parent = node.parent; + if (parent.kind === 242 || + parent.kind === 241 || + parent.kind === 244) { + return parent.tagName === node; + } + return false; + } + ts.isJSXTagName = isJSXTagName; function isExpression(node) { switch (node.kind) { case 95: @@ -4232,42 +4393,43 @@ var ts; case 99: case 84: case 10: - case 168: case 169: case 170: case 171: case 172: case 173: case 174: - case 193: case 175: + case 194: case 176: + case 195: case 177: - case 190: case 178: - case 181: + case 191: case 179: + case 182: case 180: - case 183: + case 181: case 184: case 185: case 186: - case 189: case 187: - case 11: - case 191: - case 237: - case 238: + case 190: case 188: - case 182: + case 11: + case 192: + case 240: + case 241: + case 189: + case 183: return true; - case 137: - while (node.parent.kind === 137) { + case 138: + while (node.parent.kind === 138) { node = node.parent; } - return node.parent.kind === 156; + return node.parent.kind === 157 || isJSXTagName(node); case 69: - if (node.parent.kind === 156) { + if (node.parent.kind === 157 || isJSXTagName(node)) { return true; } case 8: @@ -4275,47 +4437,47 @@ var ts; case 97: var parent_2 = node.parent; switch (parent_2.kind) { - case 215: - case 140: + case 217: + case 141: + case 144: case 143: - case 142: - case 251: - case 249: - case 167: + case 254: + case 252: + case 168: return parent_2.initializer === node; - case 199: - case 200: case 201: case 202: - case 208: - case 209: - case 210: - case 245: - case 212: - case 210: - return parent_2.expression === node; case 203: + case 204: + case 210: + case 211: + case 212: + case 248: + case 214: + case 212: + return parent_2.expression === node; + case 205: var forStatement = parent_2; - return (forStatement.initializer === node && forStatement.initializer.kind !== 216) || + return (forStatement.initializer === node && forStatement.initializer.kind !== 218) || forStatement.condition === node || forStatement.incrementor === node; - case 204: - case 205: + case 206: + case 207: var forInStatement = parent_2; - return (forInStatement.initializer === node && forInStatement.initializer.kind !== 216) || + return (forInStatement.initializer === node && forInStatement.initializer.kind !== 218) || forInStatement.expression === node; - case 175: - case 193: - return node === parent_2.expression; + case 176: case 194: return node === parent_2.expression; - case 138: + case 196: return node === parent_2.expression; - case 141: - case 244: - case 243: + case 139: + return node === parent_2.expression; + case 142: + case 247: + case 246: return true; - case 192: + case 193: return parent_2.expression === node && isExpressionWithTypeArgumentsInClassExtendsClause(parent_2); default: if (isExpression(parent_2)) { @@ -4337,7 +4499,7 @@ var ts; } ts.isInstantiatedModule = isInstantiatedModule; function isExternalModuleImportEqualsDeclaration(node) { - return node.kind === 225 && node.moduleReference.kind === 236; + return node.kind === 228 && node.moduleReference.kind === 239; } ts.isExternalModuleImportEqualsDeclaration = isExternalModuleImportEqualsDeclaration; function getExternalModuleImportEqualsDeclarationExpression(node) { @@ -4346,7 +4508,7 @@ var ts; } ts.getExternalModuleImportEqualsDeclarationExpression = getExternalModuleImportEqualsDeclarationExpression; function isInternalModuleImportEqualsDeclaration(node) { - return node.kind === 225 && node.moduleReference.kind !== 236; + return node.kind === 228 && node.moduleReference.kind !== 239; } ts.isInternalModuleImportEqualsDeclaration = isInternalModuleImportEqualsDeclaration; function isSourceFileJavaScript(file) { @@ -4358,7 +4520,7 @@ var ts; } ts.isInJavaScriptFile = isInJavaScriptFile; function isRequireCall(expression, checkArgumentIsStringLiteral) { - var isRequire = expression.kind === 172 && + var isRequire = expression.kind === 173 && expression.expression.kind === 69 && expression.expression.text === "require" && expression.arguments.length === 1; @@ -4366,11 +4528,14 @@ var ts; } ts.isRequireCall = isRequireCall; function getSpecialPropertyAssignmentKind(expression) { - if (expression.kind !== 185) { + if (!isInJavaScriptFile(expression)) { + return 0; + } + if (expression.kind !== 186) { return 0; } var expr = expression; - if (expr.operatorToken.kind !== 56 || expr.left.kind !== 170) { + if (expr.operatorToken.kind !== 56 || expr.left.kind !== 171) { return 0; } var lhs = expr.left; @@ -4386,7 +4551,7 @@ var ts; else if (lhs.expression.kind === 97) { return 4; } - else if (lhs.expression.kind === 170) { + else if (lhs.expression.kind === 171) { var innerPropertyAccess = lhs.expression; if (innerPropertyAccess.expression.kind === 69 && innerPropertyAccess.name.text === "prototype") { return 3; @@ -4396,19 +4561,19 @@ var ts; } ts.getSpecialPropertyAssignmentKind = getSpecialPropertyAssignmentKind; function getExternalModuleName(node) { - if (node.kind === 226) { + if (node.kind === 229) { return node.moduleSpecifier; } - if (node.kind === 225) { + if (node.kind === 228) { var reference = node.moduleReference; - if (reference.kind === 236) { + if (reference.kind === 239) { return reference.expression; } } - if (node.kind === 232) { + if (node.kind === 235) { return node.moduleSpecifier; } - if (node.kind === 222 && node.name.kind === 9) { + if (node.kind === 224 && node.name.kind === 9) { return node.name; } } @@ -4416,13 +4581,13 @@ var ts; function hasQuestionToken(node) { if (node) { switch (node.kind) { - case 140: + case 141: + case 146: case 145: + case 253: + case 252: case 144: - case 250: - case 249: case 143: - case 142: return node.questionToken !== undefined; } } @@ -4430,9 +4595,9 @@ var ts; } ts.hasQuestionToken = hasQuestionToken; function isJSDocConstructSignature(node) { - return node.kind === 265 && + return node.kind === 268 && node.parameters.length > 0 && - node.parameters[0].type.kind === 267; + node.parameters[0].type.kind === 270; } ts.isJSDocConstructSignature = isJSDocConstructSignature; function getJSDocTag(node, kind, checkParentVariableStatement) { @@ -4455,22 +4620,22 @@ var ts; return node.jsDocComment; } if (checkParentVariableStatement) { - var isInitializerOfVariableDeclarationInStatement = node.parent.kind === 215 && + var isInitializerOfVariableDeclarationInStatement = node.parent.kind === 217 && node.parent.initializer === node && - node.parent.parent.parent.kind === 197; + node.parent.parent.parent.kind === 199; var variableStatementNode = isInitializerOfVariableDeclarationInStatement ? node.parent.parent.parent : undefined; if (variableStatementNode) { return variableStatementNode.jsDocComment; } var parent_3 = node.parent; var isSourceOfAssignmentExpressionStatement = parent_3 && parent_3.parent && - parent_3.kind === 185 && + parent_3.kind === 186 && parent_3.operatorToken.kind === 56 && - parent_3.parent.kind === 199; + parent_3.parent.kind === 201; if (isSourceOfAssignmentExpressionStatement) { return parent_3.parent.jsDocComment; } - var isPropertyAssignmentExpression = parent_3 && parent_3.kind === 249; + var isPropertyAssignmentExpression = parent_3 && parent_3.kind === 252; if (isPropertyAssignmentExpression) { return parent_3.jsDocComment; } @@ -4478,15 +4643,15 @@ var ts; return undefined; } function getJSDocTypeTag(node) { - return getJSDocTag(node, 273, false); + return getJSDocTag(node, 276, false); } ts.getJSDocTypeTag = getJSDocTypeTag; function getJSDocReturnTag(node) { - return getJSDocTag(node, 272, true); + return getJSDocTag(node, 275, true); } ts.getJSDocReturnTag = getJSDocReturnTag; function getJSDocTemplateTag(node) { - return getJSDocTag(node, 274, false); + return getJSDocTag(node, 277, false); } ts.getJSDocTemplateTag = getJSDocTemplateTag; function getCorrespondingJSDocParameterTag(parameter) { @@ -4496,7 +4661,7 @@ var ts; if (jsDocComment) { for (var _i = 0, _a = jsDocComment.tags; _i < _a.length; _i++) { var tag = _a[_i]; - if (tag.kind === 271) { + if (tag.kind === 274) { var parameterTag = tag; var name_6 = parameterTag.preParameterName || parameterTag.postParameterName; if (name_6.text === parameterName) { @@ -4516,12 +4681,12 @@ var ts; function isRestParameter(node) { if (node) { if (node.flags & 134217728) { - if (node.type && node.type.kind === 266) { + if (node.type && node.type.kind === 269) { return true; } var paramTag = getCorrespondingJSDocParameterTag(node); if (paramTag && paramTag.typeExpression) { - return paramTag.typeExpression.type.kind === 266; + return paramTag.typeExpression.type.kind === 269; } } return node.dotDotDotToken !== undefined; @@ -4542,7 +4707,7 @@ var ts; } ts.isTemplateLiteralKind = isTemplateLiteralKind; function isBindingPattern(node) { - return !!node && (node.kind === 166 || node.kind === 165); + return !!node && (node.kind === 167 || node.kind === 166); } ts.isBindingPattern = isBindingPattern; function isNodeDescendentOf(node, ancestor) { @@ -4556,7 +4721,7 @@ var ts; ts.isNodeDescendentOf = isNodeDescendentOf; function isInAmbientContext(node) { while (node) { - if (node.flags & 2 || (node.kind === 252 && node.isDeclarationFile)) { + if (node.flags & 2 || (node.kind === 255 && node.isDeclarationFile)) { return true; } node = node.parent; @@ -4566,34 +4731,34 @@ var ts; ts.isInAmbientContext = isInAmbientContext; function isDeclaration(node) { switch (node.kind) { - case 178: - case 167: - case 218: - case 190: - case 146: - case 221: - case 251: - case 234: - case 217: - case 177: - case 147: - case 227: - case 225: - case 230: - case 219: - case 145: - case 144: - case 222: - case 228: - case 140: - case 249: - case 143: - case 142: - case 148: - case 250: + case 179: + case 168: case 220: - case 139: - case 215: + case 191: + case 147: + case 223: + case 254: + case 237: + case 219: + case 178: + case 148: + case 230: + case 228: + case 233: + case 221: + case 146: + case 145: + case 224: + case 231: + case 141: + case 252: + case 144: + case 143: + case 149: + case 253: + case 222: + case 140: + case 217: return true; } return false; @@ -4601,25 +4766,25 @@ var ts; ts.isDeclaration = isDeclaration; function isStatement(n) { switch (n.kind) { - case 207: - case 206: - case 214: - case 201: - case 199: - case 198: - case 204: - case 205: - case 203: - case 200: - case 211: + case 209: case 208: + case 216: + case 203: + case 201: + case 200: + case 206: + case 207: + case 205: + case 202: + case 213: case 210: case 212: - case 213: - case 197: - case 202: - case 209: - case 231: + case 214: + case 215: + case 199: + case 204: + case 211: + case 234: return true; default: return false; @@ -4628,13 +4793,13 @@ var ts; ts.isStatement = isStatement; function isClassElement(n) { switch (n.kind) { - case 146: - case 143: - case 145: case 147: - case 148: case 144: - case 151: + case 146: + case 148: + case 149: + case 145: + case 152: return true; default: return false; @@ -4646,7 +4811,7 @@ var ts; return false; } var parent = name.parent; - if (parent.kind === 230 || parent.kind === 234) { + if (parent.kind === 233 || parent.kind === 237) { if (parent.propertyName) { return true; } @@ -4660,40 +4825,41 @@ var ts; function isIdentifierName(node) { var parent = node.parent; switch (parent.kind) { - case 143: - case 142: - case 145: case 144: - case 147: + case 143: + case 146: + case 145: case 148: - case 251: - case 249: - case 170: + case 149: + case 254: + case 252: + case 171: return parent.name === node; - case 137: + case 138: if (parent.right === node) { - while (parent.kind === 137) { + while (parent.kind === 138) { parent = parent.parent; } - return parent.kind === 156; + return parent.kind === 157; } return false; - case 167: - case 230: + case 168: + case 233: return parent.propertyName === node; - case 234: + case 237: return true; } return false; } ts.isIdentifierName = isIdentifierName; function isAliasSymbolDeclaration(node) { - return node.kind === 225 || - node.kind === 227 && !!node.name || - node.kind === 228 || - node.kind === 230 || - node.kind === 234 || - node.kind === 231 && node.expression.kind === 69; + return node.kind === 228 || + node.kind === 227 || + node.kind === 230 && !!node.name || + node.kind === 231 || + node.kind === 233 || + node.kind === 237 || + node.kind === 234 && node.expression.kind === 69; } ts.isAliasSymbolDeclaration = isAliasSymbolDeclaration; function getClassExtendsHeritageClauseElement(node) { @@ -4750,32 +4916,32 @@ var ts; }; } else { - var matchResult = ts.fullTripleSlashReferencePathRegEx.exec(comment); - if (matchResult) { + var refMatchResult = ts.fullTripleSlashReferencePathRegEx.exec(comment); + var refLibResult = !refMatchResult && ts.fullTripleSlashReferenceTypeReferenceDirectiveRegEx.exec(comment); + if (refMatchResult || refLibResult) { var start = commentRange.pos; var end = commentRange.end; return { fileReference: { pos: start, end: end, - fileName: matchResult[3] + fileName: (refMatchResult || refLibResult)[3] }, - isNoDefaultLib: false - }; - } - else { - return { - diagnosticMessage: ts.Diagnostics.Invalid_reference_directive_syntax, - isNoDefaultLib: false + isNoDefaultLib: false, + isTypeReferenceDirective: !!refLibResult }; } + return { + diagnosticMessage: ts.Diagnostics.Invalid_reference_directive_syntax, + isNoDefaultLib: false + }; } } return undefined; } ts.getFileReferenceFromReferencePath = getFileReferenceFromReferencePath; function isKeyword(token) { - return 70 <= token && token <= 136; + return 70 <= token && token <= 137; } ts.isKeyword = isKeyword; function isTrivia(token) { @@ -4795,7 +4961,7 @@ var ts; } ts.hasDynamicName = hasDynamicName; function isDynamicName(name) { - return name.kind === 138 && + return name.kind === 139 && !isStringOrNumericLiteral(name.expression.kind) && !isWellKnownSymbolSyntactically(name.expression); } @@ -4808,7 +4974,7 @@ var ts; if (name.kind === 69 || name.kind === 9 || name.kind === 8) { return name.text; } - if (name.kind === 138) { + if (name.kind === 139) { var nameExpression = name.expression; if (isWellKnownSymbolSyntactically(nameExpression)) { var rightHandSideName = nameExpression.name.text; @@ -4846,18 +5012,18 @@ var ts; ts.isModifierKind = isModifierKind; function isParameterDeclaration(node) { var root = getRootDeclaration(node); - return root.kind === 140; + return root.kind === 141; } ts.isParameterDeclaration = isParameterDeclaration; function getRootDeclaration(node) { - while (node.kind === 167) { + while (node.kind === 168) { node = node.parent.parent; } return node; } ts.getRootDeclaration = getRootDeclaration; function nodeStartsNewLexicalEnvironment(n) { - return isFunctionLike(n) || n.kind === 222 || n.kind === 252; + return isFunctionLike(n) || n.kind === 224 || n.kind === 255; } ts.nodeStartsNewLexicalEnvironment = nodeStartsNewLexicalEnvironment; function cloneNode(node, location, flags, parent) { @@ -4890,7 +5056,7 @@ var ts; } ts.cloneEntityName = cloneEntityName; function isQualifiedName(node) { - return node.kind === 137; + return node.kind === 138; } ts.isQualifiedName = isQualifiedName; function nodeIsSynthesized(node) { @@ -5126,6 +5292,17 @@ var ts; return emitOutputFilePathWithoutExtension + extension; } ts.getOwnEmitOutputFilePath = getOwnEmitOutputFilePath; + function getDeclarationEmitOutputFilePath(sourceFile, host) { + var options = host.getCompilerOptions(); + var outputDir = options.declarationDir || options.outDir; + if (options.declaration) { + 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; } @@ -5166,20 +5343,21 @@ var ts; var emitFileNames = { jsFilePath: jsFilePath, sourceMapFilePath: getSourceMapFilePath(jsFilePath, options), - declarationFilePath: !isSourceFileJavaScript(sourceFile) ? getDeclarationEmitFilePath(jsFilePath, options) : undefined + declarationFilePath: !isSourceFileJavaScript(sourceFile) ? getDeclarationEmitOutputFilePath(sourceFile, host) : undefined }; action(emitFileNames, [sourceFile], false); } function onBundledEmit(host) { - var bundledSources = ts.filter(host.getSourceFiles(), function (sourceFile) { return !isDeclarationFile(sourceFile) && - (!isExternalModule(sourceFile) || - (getEmitModuleKind(options) && isExternalModule(sourceFile))); }); + var bundledSources = ts.filter(host.getSourceFiles(), function (sourceFile) { + return !isDeclarationFile(sourceFile) + && (!ts.isExternalModule(sourceFile) || !!getEmitModuleKind(options)); + }); if (bundledSources.length) { var jsFilePath = options.outFile || options.out; var emitFileNames = { jsFilePath: jsFilePath, sourceMapFilePath: getSourceMapFilePath(jsFilePath, options), - declarationFilePath: getDeclarationEmitFilePath(jsFilePath, options) + declarationFilePath: options.declaration ? ts.removeFileExtension(jsFilePath) + ".d.ts" : undefined }; action(emitFileNames, bundledSources, true); } @@ -5187,9 +5365,6 @@ var ts; function getSourceMapFilePath(jsFilePath, options) { return options.sourceMap ? jsFilePath + ".map" : undefined; } - function getDeclarationEmitFilePath(jsFilePath, options) { - return options.declaration ? ts.removeFileExtension(jsFilePath) + ".d.ts" : undefined; - } } ts.forEachExpectedEmitFile = forEachExpectedEmitFile; function getSourceFilePathInNewDir(sourceFile, host, newDirPath) { @@ -5198,10 +5373,10 @@ var ts; return ts.combinePaths(newDirPath, sourceFilePath); } ts.getSourceFilePathInNewDir = getSourceFilePathInNewDir; - function writeFile(host, diagnostics, fileName, data, writeByteOrderMark) { + function writeFile(host, diagnostics, fileName, data, writeByteOrderMark, sourceFiles) { host.writeFile(fileName, data, writeByteOrderMark, function (hostErrorMessage) { diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Could_not_write_file_0_Colon_1, fileName, hostErrorMessage)); - }); + }, sourceFiles); } ts.writeFile = writeFile; function getLineOfLocalPosition(currentSourceFile, pos) { @@ -5214,7 +5389,7 @@ var ts; ts.getLineOfLocalPositionFromLineMap = getLineOfLocalPositionFromLineMap; function getFirstConstructorWithBody(node) { return ts.forEach(node.members, function (member) { - if (member.kind === 146 && nodeIsPresent(member.body)) { + if (member.kind === 147 && nodeIsPresent(member.body)) { return member; } }); @@ -5231,10 +5406,10 @@ var ts; var setAccessor; if (hasDynamicName(accessor)) { firstAccessor = accessor; - if (accessor.kind === 147) { + if (accessor.kind === 148) { getAccessor = accessor; } - else if (accessor.kind === 148) { + else if (accessor.kind === 149) { setAccessor = accessor; } else { @@ -5243,7 +5418,7 @@ var ts; } else { ts.forEach(declarations, function (member) { - if ((member.kind === 147 || member.kind === 148) + if ((member.kind === 148 || member.kind === 149) && (member.flags & 32) === (accessor.flags & 32)) { var memberName = getPropertyNameForPropertyNameNode(member.name); var accessorName = getPropertyNameForPropertyNameNode(accessor.name); @@ -5254,10 +5429,10 @@ var ts; else if (!secondAccessor) { secondAccessor = member; } - if (member.kind === 147 && !getAccessor) { + if (member.kind === 148 && !getAccessor) { getAccessor = member; } - if (member.kind === 148 && !setAccessor) { + if (member.kind === 149 && !setAccessor) { setAccessor = member; } } @@ -5312,7 +5487,7 @@ var ts; } if (leadingComments) { var detachedComments = []; - var lastComment; + var lastComment = void 0; for (var _i = 0, leadingComments_1 = leadingComments; _i < leadingComments_1.length; _i++) { var comment = leadingComments_1[_i]; if (lastComment) { @@ -5346,7 +5521,7 @@ var ts; if (text.charCodeAt(comment.pos + 1) === 42) { var firstCommentLineAndCharacter = ts.computeLineAndCharacterOfPosition(lineMap, comment.pos); var lineCount = lineMap.length; - var firstCommentLineIndent; + var firstCommentLineIndent = void 0; for (var pos = comment.pos, currentLine = firstCommentLineAndCharacter.line; pos < comment.end; currentLine++) { var nextLineStart = (currentLine + 1) === lineCount ? text.length + 1 @@ -5424,24 +5599,25 @@ var ts; function isLeftHandSideExpression(expr) { if (expr) { switch (expr.kind) { - case 170: case 171: - case 173: case 172: - case 237: - case 238: case 174: - case 168: - case 176: + case 173: + case 195: + case 240: + case 241: + case 175: case 169: - case 190: case 177: + case 170: + case 191: + case 178: case 69: case 10: case 8: case 9: case 11: - case 187: + case 188: case 84: case 93: case 97: @@ -5458,7 +5634,7 @@ var ts; } ts.isAssignmentOperator = isAssignmentOperator; function isExpressionWithTypeArgumentsInClassExtendsClause(node) { - return node.kind === 192 && + return node.kind === 193 && node.parent.token === 83 && isClassLike(node.parent.parent); } @@ -5479,16 +5655,16 @@ var ts; } } function isRightSideOfQualifiedNameOrPropertyAccess(node) { - return (node.parent.kind === 137 && node.parent.right === node) || - (node.parent.kind === 170 && node.parent.name === node); + return (node.parent.kind === 138 && node.parent.right === node) || + (node.parent.kind === 171 && node.parent.name === node); } ts.isRightSideOfQualifiedNameOrPropertyAccess = isRightSideOfQualifiedNameOrPropertyAccess; function isEmptyObjectLiteralOrArrayLiteral(expression) { var kind = expression.kind; - if (kind === 169) { + if (kind === 170) { return expression.properties.length === 0; } - if (kind === 168) { + if (kind === 169) { return expression.elements.length === 0; } return false; @@ -5609,6 +5785,10 @@ var ts; return carriageReturnLineFeed; } ts.getNewLineCharacter = getNewLineCharacter; + function isWatchSet(options) { + return options.watch && options.hasOwnProperty("watch"); + } + ts.isWatchSet = isWatchSet; })(ts || (ts = {})); var ts; (function (ts) { @@ -5732,9 +5912,9 @@ var ts; } ts.collapseTextChangeRangesAcrossMultipleVersions = collapseTextChangeRangesAcrossMultipleVersions; function getTypeParameterOwner(d) { - if (d && d.kind === 139) { + if (d && d.kind === 140) { for (var current = d; current; current = current.parent) { - if (ts.isFunctionLike(current) || ts.isClassLike(current) || current.kind === 219) { + if (ts.isFunctionLike(current) || ts.isClassLike(current) || current.kind === 221) { return current; } } @@ -5742,9 +5922,18 @@ var ts; } ts.getTypeParameterOwner = getTypeParameterOwner; function isParameterPropertyDeclaration(node) { - return node.flags & 28 && node.parent.kind === 146 && ts.isClassLike(node.parent.parent); + return node.flags & 28 && node.parent.kind === 147 && ts.isClassLike(node.parent.parent); } ts.isParameterPropertyDeclaration = isParameterPropertyDeclaration; + function startsWith(str, prefix) { + return str.lastIndexOf(prefix, 0) === 0; + } + ts.startsWith = startsWith; + function endsWith(str, suffix) { + var expectedPos = str.length - suffix.length; + return str.indexOf(suffix, expectedPos) === expectedPos; + } + ts.endsWith = endsWith; })(ts || (ts = {})); var ts; (function (ts) { @@ -5752,7 +5941,7 @@ var ts; var NodeConstructor; var SourceFileConstructor; function createNode(kind, pos, end) { - if (kind === 252) { + if (kind === 255) { return new (SourceFileConstructor || (SourceFileConstructor = ts.objectAllocator.getSourceFileConstructor()))(kind, pos, end); } else { @@ -5788,26 +5977,26 @@ var ts; var visitNodes = cbNodeArray ? visitNodeArray : visitEachNode; var cbNodes = cbNodeArray || cbNode; switch (node.kind) { - case 137: + case 138: return visitNode(cbNode, node.left) || visitNode(cbNode, node.right); - case 139: + case 140: return visitNode(cbNode, node.name) || visitNode(cbNode, node.constraint) || visitNode(cbNode, node.expression); - case 250: + case 253: 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 140: + case 141: + case 144: case 143: - case 142: - case 249: - case 215: - case 167: + case 252: + case 217: + case 168: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.propertyName) || @@ -5816,24 +6005,24 @@ var ts; visitNode(cbNode, node.questionToken) || visitNode(cbNode, node.type) || visitNode(cbNode, node.initializer); - case 154: case 155: - case 149: + case 156: case 150: case 151: + case 152: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNodes(cbNodes, node.typeParameters) || visitNodes(cbNodes, node.parameters) || visitNode(cbNode, node.type); - case 145: - case 144: case 146: + case 145: case 147: case 148: - case 177: - case 217: + case 149: case 178: + case 219: + case 179: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.asteriskToken) || @@ -5844,290 +6033,294 @@ var ts; visitNode(cbNode, node.type) || visitNode(cbNode, node.equalsGreaterThanToken) || visitNode(cbNode, node.body); - case 153: + case 154: return visitNode(cbNode, node.typeName) || visitNodes(cbNodes, node.typeArguments); - case 152: + case 153: return visitNode(cbNode, node.parameterName) || visitNode(cbNode, node.type); - case 156: - return visitNode(cbNode, node.exprName); case 157: - return visitNodes(cbNodes, node.members); + return visitNode(cbNode, node.exprName); case 158: - return visitNode(cbNode, node.elementType); + return visitNodes(cbNodes, node.members); case 159: - return visitNodes(cbNodes, node.elementTypes); + return visitNode(cbNode, node.elementType); case 160: + return visitNodes(cbNodes, node.elementTypes); case 161: - return visitNodes(cbNodes, node.types); case 162: + return visitNodes(cbNodes, node.types); + case 163: return visitNode(cbNode, node.type); - case 165: case 166: - return visitNodes(cbNodes, node.elements); - case 168: + case 167: return visitNodes(cbNodes, node.elements); case 169: - return visitNodes(cbNodes, node.properties); + return visitNodes(cbNodes, node.elements); case 170: + return visitNodes(cbNodes, node.properties); + case 171: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.dotToken) || visitNode(cbNode, node.name); - case 171: + case 172: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.argumentExpression); - case 172: case 173: + case 174: return visitNode(cbNode, node.expression) || visitNodes(cbNodes, node.typeArguments) || visitNodes(cbNodes, node.arguments); - case 174: + case 175: return visitNode(cbNode, node.tag) || visitNode(cbNode, node.template); - case 175: + case 176: return visitNode(cbNode, node.type) || visitNode(cbNode, node.expression); - case 176: - return visitNode(cbNode, node.expression); - case 179: + case 177: return visitNode(cbNode, node.expression); case 180: return visitNode(cbNode, node.expression); case 181: return visitNode(cbNode, node.expression); - case 183: - return visitNode(cbNode, node.operand); - case 188: - return visitNode(cbNode, node.asteriskToken) || - visitNode(cbNode, node.expression); case 182: return visitNode(cbNode, node.expression); case 184: return visitNode(cbNode, node.operand); + case 189: + return visitNode(cbNode, node.asteriskToken) || + visitNode(cbNode, node.expression); + case 183: + return visitNode(cbNode, node.expression); case 185: + return visitNode(cbNode, node.operand); + case 186: return visitNode(cbNode, node.left) || visitNode(cbNode, node.operatorToken) || visitNode(cbNode, node.right); - case 193: + case 194: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.type); - case 186: + case 195: + return visitNode(cbNode, node.expression); + case 187: return visitNode(cbNode, node.condition) || visitNode(cbNode, node.questionToken) || visitNode(cbNode, node.whenTrue) || visitNode(cbNode, node.colonToken) || visitNode(cbNode, node.whenFalse); - case 189: + case 190: return visitNode(cbNode, node.expression); - case 196: - case 223: + case 198: + case 225: return visitNodes(cbNodes, node.statements); - case 252: + case 255: return visitNodes(cbNodes, node.statements) || visitNode(cbNode, node.endOfFileToken); - case 197: + case 199: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.declarationList); - case 216: + case 218: return visitNodes(cbNodes, node.declarations); - case 199: + case 201: return visitNode(cbNode, node.expression); - case 200: + case 202: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.thenStatement) || visitNode(cbNode, node.elseStatement); - case 201: + case 203: return visitNode(cbNode, node.statement) || visitNode(cbNode, node.expression); - case 202: + case 204: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.statement); - case 203: + case 205: return visitNode(cbNode, node.initializer) || visitNode(cbNode, node.condition) || visitNode(cbNode, node.incrementor) || visitNode(cbNode, node.statement); - case 204: - return visitNode(cbNode, node.initializer) || - visitNode(cbNode, node.expression) || - visitNode(cbNode, node.statement); - case 205: - return visitNode(cbNode, node.initializer) || - visitNode(cbNode, node.expression) || - visitNode(cbNode, node.statement); case 206: - case 207: - return visitNode(cbNode, node.label); - case 208: - return visitNode(cbNode, node.expression); - case 209: - return visitNode(cbNode, node.expression) || + return visitNode(cbNode, node.initializer) || + visitNode(cbNode, node.expression) || visitNode(cbNode, node.statement); + case 207: + return visitNode(cbNode, node.initializer) || + visitNode(cbNode, node.expression) || + visitNode(cbNode, node.statement); + case 208: + case 209: + return visitNode(cbNode, node.label); case 210: - return visitNode(cbNode, node.expression) || - visitNode(cbNode, node.caseBlock); - case 224: - return visitNodes(cbNodes, node.clauses); - case 245: - return visitNode(cbNode, node.expression) || - visitNodes(cbNodes, node.statements); - case 246: - return visitNodes(cbNodes, node.statements); + return visitNode(cbNode, node.expression); case 211: - return visitNode(cbNode, node.label) || + return visitNode(cbNode, node.expression) || visitNode(cbNode, node.statement); case 212: - return visitNode(cbNode, node.expression); + return visitNode(cbNode, node.expression) || + visitNode(cbNode, node.caseBlock); + case 226: + return visitNodes(cbNodes, node.clauses); + case 248: + return visitNode(cbNode, node.expression) || + visitNodes(cbNodes, node.statements); + case 249: + return visitNodes(cbNodes, node.statements); case 213: + return visitNode(cbNode, node.label) || + visitNode(cbNode, node.statement); + case 214: + return visitNode(cbNode, node.expression); + case 215: return visitNode(cbNode, node.tryBlock) || visitNode(cbNode, node.catchClause) || visitNode(cbNode, node.finallyBlock); - case 248: + case 251: return visitNode(cbNode, node.variableDeclaration) || visitNode(cbNode, node.block); - case 141: + case 142: return visitNode(cbNode, node.expression); - case 218: - case 190: - 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 219: - 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 220: + case 191: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNodes(cbNodes, node.typeParameters) || - visitNode(cbNode, node.type); + visitNodes(cbNodes, node.heritageClauses) || + visitNodes(cbNodes, node.members); case 221: 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 251: - return visitNode(cbNode, node.name) || - visitNode(cbNode, node.initializer); case 222: + return visitNodes(cbNodes, node.decorators) || + visitNodes(cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNodes(cbNodes, node.typeParameters) || + visitNode(cbNode, node.type); + case 223: + return visitNodes(cbNodes, node.decorators) || + visitNodes(cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNodes(cbNodes, node.members); + case 254: + return visitNode(cbNode, node.name) || + visitNode(cbNode, node.initializer); + case 224: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNode(cbNode, node.body); - case 225: + case 228: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNode(cbNode, node.moduleReference); - case 226: + case 229: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.importClause) || visitNode(cbNode, node.moduleSpecifier); - case 227: + case 230: return visitNode(cbNode, node.name) || visitNode(cbNode, node.namedBindings); - case 228: + case 227: + return visitNode(cbNode, node.name); + case 231: return visitNode(cbNode, node.name); - case 229: - case 233: - return visitNodes(cbNodes, node.elements); case 232: + case 236: + return visitNodes(cbNodes, node.elements); + case 235: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.exportClause) || visitNode(cbNode, node.moduleSpecifier); - case 230: - case 234: + case 233: + case 237: return visitNode(cbNode, node.propertyName) || visitNode(cbNode, node.name); - case 231: + case 234: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.expression); - case 187: + case 188: return visitNode(cbNode, node.head) || visitNodes(cbNodes, node.templateSpans); - case 194: + case 196: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.literal); - case 138: + case 139: return visitNode(cbNode, node.expression); - case 247: + case 250: return visitNodes(cbNodes, node.types); - case 192: + case 193: return visitNode(cbNode, node.expression) || visitNodes(cbNodes, node.typeArguments); - case 236: + case 239: return visitNode(cbNode, node.expression); - case 235: + case 238: return visitNodes(cbNodes, node.decorators); - case 237: + case 240: return visitNode(cbNode, node.openingElement) || visitNodes(cbNodes, node.children) || visitNode(cbNode, node.closingElement); - case 238: - case 239: + case 241: + case 242: return visitNode(cbNode, node.tagName) || visitNodes(cbNodes, node.attributes); - case 242: + case 245: return visitNode(cbNode, node.name) || visitNode(cbNode, node.initializer); - case 243: + case 246: + return visitNode(cbNode, node.expression); + case 247: return visitNode(cbNode, node.expression); case 244: - return visitNode(cbNode, node.expression); - case 241: return visitNode(cbNode, node.tagName); - case 253: - return visitNode(cbNode, node.type); - case 257: - return visitNodes(cbNodes, node.types); - case 258: - return visitNodes(cbNodes, node.types); case 256: - return visitNode(cbNode, node.elementType); + return visitNode(cbNode, node.type); case 260: - return visitNode(cbNode, node.type); - case 259: - return visitNode(cbNode, node.type); + return visitNodes(cbNodes, node.types); case 261: - return visitNodes(cbNodes, node.members); + return visitNodes(cbNodes, node.types); + case 259: + return visitNode(cbNode, node.elementType); case 263: + return visitNode(cbNode, node.type); + case 262: + return visitNode(cbNode, node.type); + case 264: + return visitNodes(cbNodes, node.members); + case 266: return visitNode(cbNode, node.name) || visitNodes(cbNodes, node.typeArguments); - case 264: - return visitNode(cbNode, node.type); - case 265: - return visitNodes(cbNodes, node.parameters) || - visitNode(cbNode, node.type); - case 266: - return visitNode(cbNode, node.type); case 267: return visitNode(cbNode, node.type); case 268: - return visitNode(cbNode, node.type); - case 262: - return visitNode(cbNode, node.name) || + return visitNodes(cbNodes, node.parameters) || visitNode(cbNode, node.type); case 269: - return visitNodes(cbNodes, node.tags); + return visitNode(cbNode, node.type); + case 270: + return visitNode(cbNode, node.type); case 271: + return visitNode(cbNode, node.type); + case 265: + return visitNode(cbNode, node.name) || + visitNode(cbNode, node.type); + case 272: + return visitNodes(cbNodes, node.tags); + case 274: return visitNode(cbNode, node.preParameterName) || visitNode(cbNode, node.typeExpression) || visitNode(cbNode, node.postParameterName); - case 272: + case 275: return visitNode(cbNode, node.typeExpression); - case 273: + case 276: return visitNode(cbNode, node.typeExpression); - case 274: + case 277: return visitNodes(cbNodes, node.typeParameters); } } @@ -6140,22 +6333,10 @@ var ts; return result; } ts.createSourceFile = createSourceFile; - function getScriptKindFromFileName(fileName) { - var ext = fileName.substr(fileName.lastIndexOf(".")); - switch (ext.toLowerCase()) { - case ".js": - return 1; - case ".jsx": - return 2; - case ".ts": - return 3; - case ".tsx": - return 4; - default: - return 3; - } + function isExternalModule(file) { + return file.externalModuleIndicator !== undefined; } - ts.getScriptKindFromFileName = getScriptKindFromFileName; + ts.isExternalModule = isExternalModule; function updateSourceFile(sourceFile, newText, textChangeRange, aggressiveChecks) { return IncrementalParser.updateSourceFile(sourceFile, newText, textChangeRange, aggressiveChecks); } @@ -6186,7 +6367,7 @@ var ts; var contextFlags; var parseErrorBeforeNextFinishedNode = false; function parseSourceFile(fileName, _sourceText, languageVersion, _syntaxCursor, setParentNodes, scriptKind) { - scriptKind = scriptKind ? scriptKind : getScriptKindFromFileName(fileName); + scriptKind = ts.ensureScriptKind(fileName, scriptKind); initializeState(fileName, _sourceText, languageVersion, _syntaxCursor, scriptKind); var result = parseSourceFileWorker(fileName, languageVersion, setParentNodes, scriptKind); clearState(); @@ -6271,7 +6452,7 @@ var ts; } Parser.fixupParentReferences = fixupParentReferences; function createSourceFile(fileName, languageVersion, scriptKind) { - var sourceFile = new SourceFileConstructor(252, 0, sourceText.length); + var sourceFile = new SourceFileConstructor(255, 0, sourceText.length); nodeCount++; sourceFile.text = sourceText; sourceFile.bindDiagnostics = []; @@ -6563,7 +6744,7 @@ var ts; return token === 9 || token === 8 || ts.tokenIsIdentifierOrKeyword(token); } function parseComputedPropertyName() { - var node = createNode(138); + var node = createNode(139); parseExpected(19); node.expression = allowInAnd(parseExpression); parseExpected(20); @@ -6588,7 +6769,7 @@ var ts; if (token === 77) { return lookAhead(nextTokenIsClassOrFunction); } - return token !== 37 && token !== 15 && canFollowModifier(); + return token !== 37 && token !== 116 && token !== 15 && canFollowModifier(); } if (token === 77) { return nextTokenIsClassOrFunction(); @@ -6815,7 +6996,7 @@ var ts; if (ts.containsParseError(node)) { return undefined; } - var nodeContextFlags = node.flags & 62914560; + var nodeContextFlags = node.flags & 197132288; if (nodeContextFlags !== contextFlags) { return undefined; } @@ -6862,14 +7043,14 @@ var ts; function isReusableClassMember(node) { if (node) { switch (node.kind) { - case 146: - case 151: case 147: + case 152: case 148: - case 143: - case 195: + case 149: + case 144: + case 197: return true; - case 145: + case 146: var methodDeclaration = node; var nameIsConstructor = methodDeclaration.name.kind === 69 && methodDeclaration.name.originalKeywordKind === 121; @@ -6881,8 +7062,8 @@ var ts; function isReusableSwitchClause(node) { if (node) { switch (node.kind) { - case 245: - case 246: + case 248: + case 249: return true; } } @@ -6891,65 +7072,65 @@ var ts; function isReusableStatement(node) { if (node) { switch (node.kind) { - case 217: - case 197: - case 196: - case 200: + case 219: case 199: - case 212: - case 208: - case 210: - case 207: - case 206: - case 204: - case 205: - case 203: - case 202: - case 209: case 198: - case 213: - case 211: + case 202: case 201: case 214: - case 226: - case 225: - case 232: - case 231: - case 222: - case 218: - case 219: - case 221: + case 210: + case 212: + case 209: + case 208: + case 206: + case 207: + case 205: + case 204: + case 211: + case 200: + case 215: + case 213: + case 203: + case 216: + case 229: + case 228: + case 235: + case 234: + case 224: case 220: + case 221: + case 223: + case 222: return true; } } return false; } function isReusableEnumMember(node) { - return node.kind === 251; + return node.kind === 254; } function isReusableTypeMember(node) { if (node) { switch (node.kind) { - case 150: - case 144: case 151: - case 142: - case 149: + case 145: + case 152: + case 143: + case 150: return true; } } return false; } function isReusableVariableDeclaration(node) { - if (node.kind !== 215) { + if (node.kind !== 217) { return false; } var variableDeclarator = node; return variableDeclarator.initializer === undefined; } function isReusableParameter(node) { - if (node.kind !== 140) { + if (node.kind !== 141) { return false; } var parameter = node; @@ -7049,7 +7230,7 @@ var ts; function parseEntityName(allowReservedWords, diagnosticMessage) { var entity = parseIdentifier(diagnosticMessage); while (parseOptional(21)) { - var node = createNode(137, entity.pos); + var node = createNode(138, entity.pos); node.left = entity; node.right = parseRightSideOfDot(allowReservedWords); entity = finishNode(node); @@ -7066,7 +7247,7 @@ var ts; return allowIdentifierNames ? parseIdentifierName() : parseIdentifier(); } function parseTemplateExpression() { - var template = createNode(187); + var template = createNode(188); template.head = parseTemplateLiteralFragment(); ts.Debug.assert(template.head.kind === 12, "Template head has wrong token kind"); var templateSpans = []; @@ -7079,7 +7260,7 @@ var ts; return finishNode(template); } function parseTemplateSpan() { - var span = createNode(194); + var span = createNode(196); span.expression = allowInAnd(parseExpression); var literal; if (token === 16) { @@ -7093,7 +7274,7 @@ var ts; return finishNode(span); } function parseStringLiteralTypeNode() { - return parseLiteralLikeNode(164, true); + return parseLiteralLikeNode(165, true); } function parseLiteralNode(internName) { return parseLiteralLikeNode(token, internName); @@ -7123,7 +7304,7 @@ var ts; } function parseTypeReference() { var typeName = parseEntityName(false, ts.Diagnostics.Type_expected); - var node = createNode(153, typeName.pos); + var node = createNode(154, typeName.pos); node.typeName = typeName; if (!scanner.hasPrecedingLineBreak() && token === 25) { node.typeArguments = parseBracketedList(18, parseType, 25, 27); @@ -7132,24 +7313,24 @@ var ts; } function parseThisTypePredicate(lhs) { nextToken(); - var node = createNode(152, lhs.pos); + var node = createNode(153, lhs.pos); node.parameterName = lhs; node.type = parseType(); return finishNode(node); } function parseThisTypeNode() { - var node = createNode(163); + var node = createNode(164); nextToken(); return finishNode(node); } function parseTypeQuery() { - var node = createNode(156); + var node = createNode(157); parseExpected(101); node.exprName = parseEntityName(true); return finishNode(node); } function parseTypeParameter() { - var node = createNode(139); + var node = createNode(140); node.name = parseIdentifier(); if (parseOptional(83)) { if (isStartOfType() || !isStartOfExpression()) { @@ -7173,7 +7354,7 @@ var ts; return undefined; } function isStartOfParameter() { - return token === 22 || isIdentifierOrPattern() || ts.isModifierKind(token) || token === 55; + return token === 22 || isIdentifierOrPattern() || ts.isModifierKind(token) || token === 55 || token === 97; } function setModifiers(node, modifiers) { if (modifiers) { @@ -7182,7 +7363,12 @@ var ts; } } function parseParameter() { - var node = createNode(140); + var node = createNode(141); + if (token === 97) { + node.name = createIdentifier(true, undefined); + node.type = parseParameterType(); + return finishNode(node); + } node.decorators = parseDecorators(); setModifiers(node, parseModifiers()); node.dotDotDotToken = parseOptionalToken(22); @@ -7237,7 +7423,7 @@ var ts; } function parseSignatureMember(kind) { var node = createNode(kind); - if (kind === 150) { + if (kind === 151) { parseExpected(92); } fillSignature(54, false, false, false, node); @@ -7277,7 +7463,7 @@ var ts; return token === 54 || token === 24 || token === 20; } function parseIndexSignatureDeclaration(fullStart, decorators, modifiers) { - var node = createNode(151, fullStart); + var node = createNode(152, fullStart); node.decorators = decorators; setModifiers(node, modifiers); node.parameters = parseBracketedList(16, parseParameter, 19, 20); @@ -7289,7 +7475,7 @@ var ts; var name = parsePropertyName(); var questionToken = parseOptionalToken(53); if (token === 17 || token === 25) { - var method = createNode(144, fullStart); + var method = createNode(145, fullStart); setModifiers(method, modifiers); method.name = name; method.questionToken = questionToken; @@ -7298,7 +7484,7 @@ var ts; return finishNode(method); } else { - var property = createNode(142, fullStart); + var property = createNode(143, fullStart); setModifiers(property, modifiers); property.name = name; property.questionToken = questionToken; @@ -7337,10 +7523,10 @@ var ts; } function parseTypeMember() { if (token === 17 || token === 25) { - return parseSignatureMember(149); + return parseSignatureMember(150); } if (token === 92 && lookAhead(isStartOfConstructSignature)) { - return parseSignatureMember(150); + return parseSignatureMember(151); } var fullStart = getNodePos(); var modifiers = parseModifiers(); @@ -7354,7 +7540,7 @@ var ts; return token === 17 || token === 25; } function parseTypeLiteral() { - var node = createNode(157); + var node = createNode(158); node.members = parseObjectTypeMembers(); return finishNode(node); } @@ -7370,12 +7556,12 @@ var ts; return members; } function parseTupleType() { - var node = createNode(159); + var node = createNode(160); node.elementTypes = parseBracketedList(19, parseType, 19, 20); return finishNode(node); } function parseParenthesizedType() { - var node = createNode(162); + var node = createNode(163); parseExpected(17); node.type = parseType(); parseExpected(18); @@ -7383,7 +7569,7 @@ var ts; } function parseFunctionOrConstructorType(kind) { var node = createNode(kind); - if (kind === 155) { + if (kind === 156) { parseExpected(92); } fillSignature(34, false, false, false, node); @@ -7400,11 +7586,13 @@ var ts; case 129: case 120: case 132: + case 134: var node = tryParse(parseKeywordAndNoDot); return node || parseTypeReference(); case 9: return parseStringLiteralTypeNode(); case 103: + case 93: return parseTokenNode(); case 97: { var thisKeyword = parseThisTypeNode(); @@ -7435,6 +7623,8 @@ var ts; case 120: case 132: case 103: + case 134: + case 93: case 97: case 101: case 15: @@ -7457,7 +7647,7 @@ var ts; var type = parseNonArrayType(); while (!scanner.hasPrecedingLineBreak() && parseOptional(19)) { parseExpected(20); - var node = createNode(158, type.pos); + var node = createNode(159, type.pos); node.elementType = type; type = finishNode(node); } @@ -7479,10 +7669,10 @@ var ts; return type; } function parseIntersectionTypeOrHigher() { - return parseUnionOrIntersectionType(161, parseArrayTypeOrHigher, 46); + return parseUnionOrIntersectionType(162, parseArrayTypeOrHigher, 46); } function parseUnionTypeOrHigher() { - return parseUnionOrIntersectionType(160, parseIntersectionTypeOrHigher, 47); + return parseUnionOrIntersectionType(161, parseIntersectionTypeOrHigher, 47); } function isStartOfFunctionType() { if (token === 25) { @@ -7494,7 +7684,7 @@ var ts; if (ts.isModifierKind(token)) { parseModifiers(); } - if (isIdentifier()) { + if (isIdentifier() || token === 97) { nextToken(); return true; } @@ -7528,7 +7718,7 @@ var ts; var typePredicateVariable = isIdentifier() && tryParse(parseTypePredicatePrefix); var type = parseType(); if (typePredicateVariable) { - var node = createNode(152, typePredicateVariable.pos); + var node = createNode(153, typePredicateVariable.pos); node.parameterName = typePredicateVariable; node.type = type; return finishNode(node); @@ -7549,10 +7739,10 @@ var ts; } function parseTypeWorker() { if (isStartOfFunctionType()) { - return parseFunctionOrConstructorType(154); + return parseFunctionOrConstructorType(155); } if (token === 92) { - return parseFunctionOrConstructorType(155); + return parseFunctionOrConstructorType(156); } return parseUnionTypeOrHigher(); } @@ -7671,7 +7861,7 @@ var ts; return !scanner.hasPrecedingLineBreak() && isIdentifier(); } function parseYieldExpression() { - var node = createNode(188); + var node = createNode(189); nextToken(); if (!scanner.hasPrecedingLineBreak() && (token === 37 || isStartOfExpression())) { @@ -7685,8 +7875,8 @@ var ts; } function parseSimpleArrowFunctionExpression(identifier) { ts.Debug.assert(token === 34, "parseSimpleArrowFunctionExpression should only have been called if we had a =>"); - var node = createNode(178, identifier.pos); - var parameter = createNode(140, identifier.pos); + var node = createNode(179, identifier.pos); + var parameter = createNode(141, identifier.pos); parameter.name = identifier; finishNode(parameter); node.parameters = [parameter]; @@ -7797,7 +7987,7 @@ var ts; return parseParenthesizedArrowFunctionExpressionHead(false); } function parseParenthesizedArrowFunctionExpressionHead(allowAmbiguity) { - var node = createNode(178); + var node = createNode(179); setModifiers(node, parseModifiersForArrowFunction()); var isAsync = !!(node.flags & 256); fillSignature(54, false, isAsync, !allowAmbiguity, node); @@ -7829,7 +8019,7 @@ var ts; if (!questionToken) { return leftOperand; } - var node = createNode(186, leftOperand.pos); + var node = createNode(187, leftOperand.pos); node.condition = leftOperand; node.questionToken = questionToken; node.whenTrue = doOutsideOfContext(disallowInAndDecoratorContext, parseAssignmentExpressionOrHigher); @@ -7842,7 +8032,7 @@ var ts; return parseBinaryExpressionRest(precedence, leftOperand); } function isInOrOfKeyword(t) { - return t === 90 || t === 136; + return t === 90 || t === 137; } function parseBinaryExpressionRest(precedence, leftOperand) { while (true) { @@ -7920,43 +8110,43 @@ var ts; return -1; } function makeBinaryExpression(left, operatorToken, right) { - var node = createNode(185, left.pos); + var node = createNode(186, left.pos); node.left = left; node.operatorToken = operatorToken; node.right = right; return finishNode(node); } function makeAsExpression(left, right) { - var node = createNode(193, left.pos); + var node = createNode(194, left.pos); node.expression = left; node.type = right; return finishNode(node); } function parsePrefixUnaryExpression() { - var node = createNode(183); + var node = createNode(184); node.operator = token; nextToken(); node.operand = parseSimpleUnaryExpression(); return finishNode(node); } function parseDeleteExpression() { - var node = createNode(179); - nextToken(); - node.expression = parseSimpleUnaryExpression(); - return finishNode(node); - } - function parseTypeOfExpression() { var node = createNode(180); nextToken(); node.expression = parseSimpleUnaryExpression(); return finishNode(node); } - function parseVoidExpression() { + function parseTypeOfExpression() { var node = createNode(181); nextToken(); node.expression = parseSimpleUnaryExpression(); return finishNode(node); } + function parseVoidExpression() { + var node = createNode(182); + nextToken(); + node.expression = parseSimpleUnaryExpression(); + return finishNode(node); + } function isAwaitExpression() { if (token === 119) { if (inAwaitContext()) { @@ -7967,7 +8157,7 @@ var ts; return false; } function parseAwaitExpression() { - var node = createNode(182); + var node = createNode(183); nextToken(); node.expression = parseSimpleUnaryExpression(); return finishNode(node); @@ -7986,7 +8176,7 @@ var ts; var simpleUnaryExpression = parseSimpleUnaryExpression(); if (token === 38) { var start = ts.skipTrivia(sourceText, simpleUnaryExpression.pos); - if (simpleUnaryExpression.kind === 175) { + if (simpleUnaryExpression.kind === 176) { 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 { @@ -8034,7 +8224,7 @@ var ts; } function parseIncrementExpression() { if (token === 41 || token === 42) { - var node = createNode(183); + var node = createNode(184); node.operator = token; nextToken(); node.operand = parseLeftHandSideExpressionOrHigher(); @@ -8046,7 +8236,7 @@ var ts; var expression = parseLeftHandSideExpressionOrHigher(); ts.Debug.assert(ts.isLeftHandSideExpression(expression)); if ((token === 41 || token === 42) && !scanner.hasPrecedingLineBreak()) { - var node = createNode(184, expression.pos); + var node = createNode(185, expression.pos); node.operand = expression; node.operator = token; nextToken(); @@ -8069,7 +8259,7 @@ var ts; if (token === 17 || token === 21 || token === 19) { return expression; } - var node = createNode(170, expression.pos); + var node = createNode(171, expression.pos); node.expression = expression; node.dotToken = parseExpectedToken(21, false, ts.Diagnostics.super_must_be_followed_by_an_argument_list_or_member_access); node.name = parseRightSideOfDot(true); @@ -8088,8 +8278,8 @@ var ts; function parseJsxElementOrSelfClosingElement(inExpressionContext) { var opening = parseJsxOpeningOrSelfClosingElement(inExpressionContext); var result; - if (opening.kind === 239) { - var node = createNode(237, opening.pos); + if (opening.kind === 242) { + var node = createNode(240, opening.pos); node.openingElement = opening; node.children = parseJsxChildren(node.openingElement.tagName); node.closingElement = parseJsxClosingElement(inExpressionContext); @@ -8099,14 +8289,14 @@ var ts; result = finishNode(node); } else { - ts.Debug.assert(opening.kind === 238); + ts.Debug.assert(opening.kind === 241); result = opening; } if (inExpressionContext && token === 25) { var invalidElement = tryParse(function () { return parseJsxElementOrSelfClosingElement(true); }); if (invalidElement) { parseErrorAtCurrentToken(ts.Diagnostics.JSX_expressions_must_have_one_parent_element); - var badNode = createNode(185, result.pos); + var badNode = createNode(186, result.pos); badNode.end = invalidElement.end; badNode.left = result; badNode.right = invalidElement; @@ -8118,13 +8308,13 @@ var ts; return result; } function parseJsxText() { - var node = createNode(240, scanner.getStartPos()); + var node = createNode(243, scanner.getStartPos()); token = scanner.scanJsxToken(); return finishNode(node); } function parseJsxChild() { switch (token) { - case 240: + case 243: return parseJsxText(); case 15: return parseJsxExpression(false); @@ -8160,7 +8350,7 @@ var ts; var attributes = parseList(13, parseJsxAttribute); var node; if (token === 27) { - node = createNode(239, fullStart); + node = createNode(242, fullStart); scanJsxText(); } else { @@ -8172,7 +8362,7 @@ var ts; parseExpected(27, undefined, false); scanJsxText(); } - node = createNode(238, fullStart); + node = createNode(241, fullStart); } node.tagName = tagName; node.attributes = attributes; @@ -8183,7 +8373,7 @@ var ts; var elementName = parseIdentifierName(); while (parseOptional(21)) { scanJsxIdentifier(); - var node = createNode(137, elementName.pos); + var node = createNode(138, elementName.pos); node.left = elementName; node.right = parseIdentifierName(); elementName = finishNode(node); @@ -8191,7 +8381,7 @@ var ts; return elementName; } function parseJsxExpression(inExpressionContext) { - var node = createNode(244); + var node = createNode(247); parseExpected(15); if (token !== 16) { node.expression = parseAssignmentExpressionOrHigher(); @@ -8210,7 +8400,7 @@ var ts; return parseJsxSpreadAttribute(); } scanJsxIdentifier(); - var node = createNode(242); + var node = createNode(245); node.name = parseIdentifierName(); if (parseOptional(56)) { switch (token) { @@ -8225,7 +8415,7 @@ var ts; return finishNode(node); } function parseJsxSpreadAttribute() { - var node = createNode(243); + var node = createNode(246); parseExpected(15); parseExpected(22); node.expression = parseExpression(); @@ -8233,7 +8423,7 @@ var ts; return finishNode(node); } function parseJsxClosingElement(inExpressionContext) { - var node = createNode(241); + var node = createNode(244); parseExpected(26); node.tagName = parseJsxElementName(); if (inExpressionContext) { @@ -8246,7 +8436,7 @@ var ts; return finishNode(node); } function parseTypeAssertion() { - var node = createNode(175); + var node = createNode(176); parseExpected(25); node.type = parseType(); parseExpected(27); @@ -8257,15 +8447,22 @@ var ts; while (true) { var dotToken = parseOptionalToken(21); if (dotToken) { - var propertyAccess = createNode(170, expression.pos); + var propertyAccess = createNode(171, expression.pos); propertyAccess.expression = expression; propertyAccess.dotToken = dotToken; propertyAccess.name = parseRightSideOfDot(true); expression = finishNode(propertyAccess); continue; } + if (token === 49 && !scanner.hasPrecedingLineBreak()) { + nextToken(); + var nonNullExpression = createNode(195, expression.pos); + nonNullExpression.expression = expression; + expression = finishNode(nonNullExpression); + continue; + } if (!inDecoratorContext() && parseOptional(19)) { - var indexedAccess = createNode(171, expression.pos); + var indexedAccess = createNode(172, expression.pos); indexedAccess.expression = expression; if (token !== 20) { indexedAccess.argumentExpression = allowInAnd(parseExpression); @@ -8279,7 +8476,7 @@ var ts; continue; } if (token === 11 || token === 12) { - var tagExpression = createNode(174, expression.pos); + var tagExpression = createNode(175, expression.pos); tagExpression.tag = expression; tagExpression.template = token === 11 ? parseLiteralNode() @@ -8298,7 +8495,7 @@ var ts; if (!typeArguments) { return expression; } - var callExpr = createNode(172, expression.pos); + var callExpr = createNode(173, expression.pos); callExpr.expression = expression; callExpr.typeArguments = typeArguments; callExpr.arguments = parseArgumentList(); @@ -8306,7 +8503,7 @@ var ts; continue; } else if (token === 17) { - var callExpr = createNode(172, expression.pos); + var callExpr = createNode(173, expression.pos); callExpr.expression = expression; callExpr.arguments = parseArgumentList(); expression = finishNode(callExpr); @@ -8401,28 +8598,28 @@ var ts; return parseIdentifier(ts.Diagnostics.Expression_expected); } function parseParenthesizedExpression() { - var node = createNode(176); + var node = createNode(177); parseExpected(17); node.expression = allowInAnd(parseExpression); parseExpected(18); return finishNode(node); } function parseSpreadElement() { - var node = createNode(189); + var node = createNode(190); parseExpected(22); node.expression = parseAssignmentExpressionOrHigher(); return finishNode(node); } function parseArgumentOrArrayLiteralElement() { return token === 22 ? parseSpreadElement() : - token === 24 ? createNode(191) : + token === 24 ? createNode(192) : parseAssignmentExpressionOrHigher(); } function parseArgumentExpression() { return doOutsideOfContext(disallowInAndDecoratorContext, parseArgumentOrArrayLiteralElement); } function parseArrayLiteralExpression() { - var node = createNode(168); + var node = createNode(169); parseExpected(19); if (scanner.hasPrecedingLineBreak()) { node.multiLine = true; @@ -8433,10 +8630,10 @@ var ts; } function tryParseAccessorDeclaration(fullStart, decorators, modifiers) { if (parseContextualModifier(123)) { - return parseAccessorDeclaration(147, fullStart, decorators, modifiers); + return addJSDocComment(parseAccessorDeclaration(148, fullStart, decorators, modifiers)); } else if (parseContextualModifier(130)) { - return parseAccessorDeclaration(148, fullStart, decorators, modifiers); + return parseAccessorDeclaration(149, fullStart, decorators, modifiers); } return undefined; } @@ -8457,7 +8654,7 @@ var ts; } var isShorthandPropertyAssignment = tokenIsIdentifier && (token === 24 || token === 16 || token === 56); if (isShorthandPropertyAssignment) { - var shorthandDeclaration = createNode(250, fullStart); + var shorthandDeclaration = createNode(253, fullStart); shorthandDeclaration.name = propertyName; shorthandDeclaration.questionToken = questionToken; var equalsToken = parseOptionalToken(56); @@ -8468,7 +8665,7 @@ var ts; return addJSDocComment(finishNode(shorthandDeclaration)); } else { - var propertyAssignment = createNode(249, fullStart); + var propertyAssignment = createNode(252, fullStart); propertyAssignment.modifiers = modifiers; propertyAssignment.name = propertyName; propertyAssignment.questionToken = questionToken; @@ -8478,7 +8675,7 @@ var ts; } } function parseObjectLiteralExpression() { - var node = createNode(169); + var node = createNode(170); parseExpected(15); if (scanner.hasPrecedingLineBreak()) { node.multiLine = true; @@ -8492,7 +8689,7 @@ var ts; if (saveDecoratorContext) { setDecoratorContext(false); } - var node = createNode(177); + var node = createNode(178); setModifiers(node, parseModifiers()); parseExpected(87); node.asteriskToken = parseOptionalToken(37); @@ -8514,7 +8711,7 @@ var ts; return isIdentifier() ? parseIdentifier() : undefined; } function parseNewExpression() { - var node = createNode(173); + var node = createNode(174); parseExpected(92); node.expression = parseMemberExpressionOrHigher(); node.typeArguments = tryParse(parseTypeArgumentsInExpression); @@ -8524,7 +8721,7 @@ var ts; return finishNode(node); } function parseBlock(ignoreMissingOpenBrace, diagnosticMessage) { - var node = createNode(196); + var node = createNode(198); if (parseExpected(15, diagnosticMessage) || ignoreMissingOpenBrace) { node.statements = parseList(1, parseStatement); parseExpected(16); @@ -8552,12 +8749,12 @@ var ts; return block; } function parseEmptyStatement() { - var node = createNode(198); + var node = createNode(200); parseExpected(23); return finishNode(node); } function parseIfStatement() { - var node = createNode(200); + var node = createNode(202); parseExpected(88); parseExpected(17); node.expression = allowInAnd(parseExpression); @@ -8567,7 +8764,7 @@ var ts; return finishNode(node); } function parseDoStatement() { - var node = createNode(201); + var node = createNode(203); parseExpected(79); node.statement = parseStatement(); parseExpected(104); @@ -8578,7 +8775,7 @@ var ts; return finishNode(node); } function parseWhileStatement() { - var node = createNode(202); + var node = createNode(204); parseExpected(104); parseExpected(17); node.expression = allowInAnd(parseExpression); @@ -8601,21 +8798,21 @@ var ts; } var forOrForInOrForOfStatement; if (parseOptional(90)) { - var forInStatement = createNode(204, pos); + var forInStatement = createNode(206, pos); forInStatement.initializer = initializer; forInStatement.expression = allowInAnd(parseExpression); parseExpected(18); forOrForInOrForOfStatement = forInStatement; } - else if (parseOptional(136)) { - var forOfStatement = createNode(205, pos); + else if (parseOptional(137)) { + var forOfStatement = createNode(207, pos); forOfStatement.initializer = initializer; forOfStatement.expression = allowInAnd(parseAssignmentExpressionOrHigher); parseExpected(18); forOrForInOrForOfStatement = forOfStatement; } else { - var forStatement = createNode(203, pos); + var forStatement = createNode(205, pos); forStatement.initializer = initializer; parseExpected(23); if (token !== 23 && token !== 18) { @@ -8633,7 +8830,7 @@ var ts; } function parseBreakOrContinueStatement(kind) { var node = createNode(kind); - parseExpected(kind === 207 ? 70 : 75); + parseExpected(kind === 209 ? 70 : 75); if (!canParseSemicolon()) { node.label = parseIdentifier(); } @@ -8641,7 +8838,7 @@ var ts; return finishNode(node); } function parseReturnStatement() { - var node = createNode(208); + var node = createNode(210); parseExpected(94); if (!canParseSemicolon()) { node.expression = allowInAnd(parseExpression); @@ -8650,7 +8847,7 @@ var ts; return finishNode(node); } function parseWithStatement() { - var node = createNode(209); + var node = createNode(211); parseExpected(105); parseExpected(17); node.expression = allowInAnd(parseExpression); @@ -8659,7 +8856,7 @@ var ts; return finishNode(node); } function parseCaseClause() { - var node = createNode(245); + var node = createNode(248); parseExpected(71); node.expression = allowInAnd(parseExpression); parseExpected(54); @@ -8667,7 +8864,7 @@ var ts; return finishNode(node); } function parseDefaultClause() { - var node = createNode(246); + var node = createNode(249); parseExpected(77); parseExpected(54); node.statements = parseList(3, parseStatement); @@ -8677,12 +8874,12 @@ var ts; return token === 71 ? parseCaseClause() : parseDefaultClause(); } function parseSwitchStatement() { - var node = createNode(210); + var node = createNode(212); parseExpected(96); parseExpected(17); node.expression = allowInAnd(parseExpression); parseExpected(18); - var caseBlock = createNode(224, scanner.getStartPos()); + var caseBlock = createNode(226, scanner.getStartPos()); parseExpected(15); caseBlock.clauses = parseList(2, parseCaseOrDefaultClause); parseExpected(16); @@ -8690,14 +8887,14 @@ var ts; return finishNode(node); } function parseThrowStatement() { - var node = createNode(212); + var node = createNode(214); parseExpected(98); node.expression = scanner.hasPrecedingLineBreak() ? undefined : allowInAnd(parseExpression); parseSemicolon(); return finishNode(node); } function parseTryStatement() { - var node = createNode(213); + var node = createNode(215); parseExpected(100); node.tryBlock = parseBlock(false); node.catchClause = token === 72 ? parseCatchClause() : undefined; @@ -8708,7 +8905,7 @@ var ts; return finishNode(node); } function parseCatchClause() { - var result = createNode(248); + var result = createNode(251); parseExpected(72); if (parseExpected(17)) { result.variableDeclaration = parseVariableDeclaration(); @@ -8718,7 +8915,7 @@ var ts; return finishNode(result); } function parseDebuggerStatement() { - var node = createNode(214); + var node = createNode(216); parseExpected(76); parseSemicolon(); return finishNode(node); @@ -8727,13 +8924,13 @@ var ts; var fullStart = scanner.getStartPos(); var expression = allowInAnd(parseExpression); if (expression.kind === 69 && parseOptional(54)) { - var labeledStatement = createNode(211, fullStart); + var labeledStatement = createNode(213, fullStart); labeledStatement.label = expression; labeledStatement.statement = parseStatement(); return addJSDocComment(finishNode(labeledStatement)); } else { - var expressionStatement = createNode(199, fullStart); + var expressionStatement = createNode(201, fullStart); expressionStatement.expression = expression; parseSemicolon(); return addJSDocComment(finishNode(expressionStatement)); @@ -8779,8 +8976,9 @@ var ts; return false; } continue; - case 135: - return nextToken() === 15; + case 136: + nextToken(); + return token === 15 || token === 69 || token === 82; case 89: nextToken(); return token === 9 || token === 37 || @@ -8788,7 +8986,8 @@ var ts; case 82: nextToken(); if (token === 56 || token === 37 || - token === 15 || token === 77) { + token === 15 || token === 77 || + token === 116) { return true; } continue; @@ -8838,7 +9037,7 @@ var ts; case 125: case 126: case 133: - case 135: + case 136: return true; case 112: case 110: @@ -8883,9 +9082,9 @@ var ts; case 86: return parseForOrForInOrForOfStatement(); case 75: - return parseBreakOrContinueStatement(206); + return parseBreakOrContinueStatement(208); case 70: - return parseBreakOrContinueStatement(207); + return parseBreakOrContinueStatement(209); case 94: return parseReturnStatement(); case 105: @@ -8918,7 +9117,7 @@ var ts; case 115: case 113: case 127: - case 135: + case 136: if (isStartOfDeclaration()) { return parseDeclaration(); } @@ -8945,7 +9144,7 @@ var ts; return parseTypeAliasDeclaration(fullStart, decorators, modifiers); case 81: return parseEnumDeclaration(fullStart, decorators, modifiers); - case 135: + case 136: case 125: case 126: return parseModuleDeclaration(fullStart, decorators, modifiers); @@ -8953,12 +9152,18 @@ var ts; return parseImportDeclarationOrImportEqualsDeclaration(fullStart, decorators, modifiers); case 82: nextToken(); - return token === 77 || token === 56 ? - parseExportAssignment(fullStart, decorators, modifiers) : - parseExportDeclaration(fullStart, decorators, modifiers); + switch (token) { + case 77: + case 56: + return parseExportAssignment(fullStart, decorators, modifiers); + case 116: + return parseGlobalModuleExportDeclaration(fullStart, decorators, modifiers); + default: + return parseExportDeclaration(fullStart, decorators, modifiers); + } default: if (decorators || modifiers) { - var node = createMissingNode(235, true, ts.Diagnostics.Declaration_expected); + var node = createMissingNode(238, true, ts.Diagnostics.Declaration_expected); node.pos = fullStart; node.decorators = decorators; setModifiers(node, modifiers); @@ -8979,16 +9184,16 @@ var ts; } function parseArrayBindingElement() { if (token === 24) { - return createNode(191); + return createNode(192); } - var node = createNode(167); + var node = createNode(168); node.dotDotDotToken = parseOptionalToken(22); node.name = parseIdentifierOrPattern(); node.initializer = parseBindingElementInitializer(false); return finishNode(node); } function parseObjectBindingElement() { - var node = createNode(167); + var node = createNode(168); var tokenIsIdentifier = isIdentifier(); var propertyName = parsePropertyName(); if (tokenIsIdentifier && token !== 54) { @@ -9003,14 +9208,14 @@ var ts; return finishNode(node); } function parseObjectBindingPattern() { - var node = createNode(165); + var node = createNode(166); parseExpected(15); node.elements = parseDelimitedList(9, parseObjectBindingElement); parseExpected(16); return finishNode(node); } function parseArrayBindingPattern() { - var node = createNode(166); + var node = createNode(167); parseExpected(19); node.elements = parseDelimitedList(10, parseArrayBindingElement); parseExpected(20); @@ -9029,7 +9234,7 @@ var ts; return parseIdentifier(); } function parseVariableDeclaration() { - var node = createNode(215); + var node = createNode(217); node.name = parseIdentifierOrPattern(); node.type = parseTypeAnnotation(); if (!isInOrOfKeyword(token)) { @@ -9038,7 +9243,7 @@ var ts; return finishNode(node); } function parseVariableDeclarationList(inForStatementInitializer) { - var node = createNode(216); + var node = createNode(218); switch (token) { case 102: break; @@ -9052,7 +9257,7 @@ var ts; ts.Debug.fail(); } nextToken(); - if (token === 136 && lookAhead(canFollowContextualOfKeyword)) { + if (token === 137 && lookAhead(canFollowContextualOfKeyword)) { node.declarations = createMissingList(); } else { @@ -9067,7 +9272,7 @@ var ts; return nextTokenIsIdentifier() && nextToken() === 18; } function parseVariableStatement(fullStart, decorators, modifiers) { - var node = createNode(197, fullStart); + var node = createNode(199, fullStart); node.decorators = decorators; setModifiers(node, modifiers); node.declarationList = parseVariableDeclarationList(false); @@ -9075,7 +9280,7 @@ var ts; return addJSDocComment(finishNode(node)); } function parseFunctionDeclaration(fullStart, decorators, modifiers) { - var node = createNode(217, fullStart); + var node = createNode(219, fullStart); node.decorators = decorators; setModifiers(node, modifiers); parseExpected(87); @@ -9088,7 +9293,7 @@ var ts; return addJSDocComment(finishNode(node)); } function parseConstructorDeclaration(pos, decorators, modifiers) { - var node = createNode(146, pos); + var node = createNode(147, pos); node.decorators = decorators; setModifiers(node, modifiers); parseExpected(121); @@ -9097,7 +9302,7 @@ var ts; return addJSDocComment(finishNode(node)); } function parseMethodDeclaration(fullStart, decorators, modifiers, asteriskToken, name, questionToken, diagnosticMessage) { - var method = createNode(145, fullStart); + var method = createNode(146, fullStart); method.decorators = decorators; setModifiers(method, modifiers); method.asteriskToken = asteriskToken; @@ -9110,7 +9315,7 @@ var ts; return addJSDocComment(finishNode(method)); } function parsePropertyDeclaration(fullStart, decorators, modifiers, name, questionToken) { - var property = createNode(143, fullStart); + var property = createNode(144, fullStart); property.decorators = decorators; setModifiers(property, modifiers); property.name = name; @@ -9207,7 +9412,7 @@ var ts; decorators = []; decorators.pos = decoratorStart; } - var decorator = createNode(141, decoratorStart); + var decorator = createNode(142, decoratorStart); decorator.expression = doInDecoratorContext(parseLeftHandSideExpressionOrHigher); decorators.push(finishNode(decorator)); } @@ -9263,7 +9468,7 @@ var ts; } function parseClassElement() { if (token === 23) { - var result = createNode(195); + var result = createNode(197); nextToken(); return finishNode(result); } @@ -9294,10 +9499,10 @@ var ts; ts.Debug.fail("Should not have attempted to parse class member declaration."); } function parseClassExpression() { - return parseClassDeclarationOrExpression(scanner.getStartPos(), undefined, undefined, 190); + return parseClassDeclarationOrExpression(scanner.getStartPos(), undefined, undefined, 191); } function parseClassDeclaration(fullStart, decorators, modifiers) { - return parseClassDeclarationOrExpression(fullStart, decorators, modifiers, 218); + return parseClassDeclarationOrExpression(fullStart, decorators, modifiers, 220); } function parseClassDeclarationOrExpression(fullStart, decorators, modifiers, kind) { var node = createNode(kind, fullStart); @@ -9332,7 +9537,7 @@ var ts; } function parseHeritageClause() { if (token === 83 || token === 106) { - var node = createNode(247); + var node = createNode(250); node.token = token; nextToken(); node.types = parseDelimitedList(7, parseExpressionWithTypeArguments); @@ -9341,7 +9546,7 @@ var ts; return undefined; } function parseExpressionWithTypeArguments() { - var node = createNode(192); + var node = createNode(193); node.expression = parseLeftHandSideExpressionOrHigher(); if (token === 25) { node.typeArguments = parseBracketedList(18, parseType, 25, 27); @@ -9355,7 +9560,7 @@ var ts; return parseList(5, parseClassElement); } function parseInterfaceDeclaration(fullStart, decorators, modifiers) { - var node = createNode(219, fullStart); + var node = createNode(221, fullStart); node.decorators = decorators; setModifiers(node, modifiers); parseExpected(107); @@ -9366,7 +9571,7 @@ var ts; return finishNode(node); } function parseTypeAliasDeclaration(fullStart, decorators, modifiers) { - var node = createNode(220, fullStart); + var node = createNode(222, fullStart); node.decorators = decorators; setModifiers(node, modifiers); parseExpected(133); @@ -9378,13 +9583,13 @@ var ts; return finishNode(node); } function parseEnumMember() { - var node = createNode(251, scanner.getStartPos()); + var node = createNode(254, scanner.getStartPos()); node.name = parsePropertyName(); node.initializer = allowInAnd(parseNonParameterInitializer); return finishNode(node); } function parseEnumDeclaration(fullStart, decorators, modifiers) { - var node = createNode(221, fullStart); + var node = createNode(223, fullStart); node.decorators = decorators; setModifiers(node, modifiers); parseExpected(81); @@ -9399,7 +9604,7 @@ var ts; return finishNode(node); } function parseModuleBlock() { - var node = createNode(223, scanner.getStartPos()); + var node = createNode(225, scanner.getStartPos()); if (parseExpected(15)) { node.statements = parseList(1, parseStatement); parseExpected(16); @@ -9410,7 +9615,7 @@ var ts; return finishNode(node); } function parseModuleOrNamespaceDeclaration(fullStart, decorators, modifiers, flags) { - var node = createNode(222, fullStart); + var node = createNode(224, fullStart); var namespaceFlag = flags & 4096; node.decorators = decorators; setModifiers(node, modifiers); @@ -9422,10 +9627,10 @@ var ts; return finishNode(node); } function parseAmbientExternalModuleDeclaration(fullStart, decorators, modifiers) { - var node = createNode(222, fullStart); + var node = createNode(224, fullStart); node.decorators = decorators; setModifiers(node, modifiers); - if (token === 135) { + if (token === 136) { node.name = parseIdentifier(); node.flags |= 131072; } @@ -9437,7 +9642,7 @@ var ts; } function parseModuleDeclaration(fullStart, decorators, modifiers) { var flags = modifiers ? modifiers.flags : 0; - if (token === 135) { + if (token === 136) { return parseAmbientExternalModuleDeclaration(fullStart, decorators, modifiers); } else if (parseOptional(126)) { @@ -9461,14 +9666,24 @@ var ts; function nextTokenIsSlash() { return nextToken() === 39; } + function parseGlobalModuleExportDeclaration(fullStart, decorators, modifiers) { + var exportDeclaration = createNode(227, fullStart); + exportDeclaration.decorators = decorators; + exportDeclaration.modifiers = modifiers; + parseExpected(116); + parseExpected(126); + exportDeclaration.name = parseIdentifier(); + parseExpected(23); + return finishNode(exportDeclaration); + } function parseImportDeclarationOrImportEqualsDeclaration(fullStart, decorators, modifiers) { parseExpected(89); var afterImportPos = scanner.getStartPos(); var identifier; if (isIdentifier()) { identifier = parseIdentifier(); - if (token !== 24 && token !== 134) { - var importEqualsDeclaration = createNode(225, fullStart); + if (token !== 24 && token !== 135) { + var importEqualsDeclaration = createNode(228, fullStart); importEqualsDeclaration.decorators = decorators; setModifiers(importEqualsDeclaration, modifiers); importEqualsDeclaration.name = identifier; @@ -9478,27 +9693,27 @@ var ts; return finishNode(importEqualsDeclaration); } } - var importDeclaration = createNode(226, fullStart); + var importDeclaration = createNode(229, fullStart); importDeclaration.decorators = decorators; setModifiers(importDeclaration, modifiers); if (identifier || token === 37 || token === 15) { importDeclaration.importClause = parseImportClause(identifier, afterImportPos); - parseExpected(134); + parseExpected(135); } importDeclaration.moduleSpecifier = parseModuleSpecifier(); parseSemicolon(); return finishNode(importDeclaration); } function parseImportClause(identifier, fullStart) { - var importClause = createNode(227, fullStart); + var importClause = createNode(230, fullStart); if (identifier) { importClause.name = identifier; } if (!importClause.name || parseOptional(24)) { - importClause.namedBindings = token === 37 ? parseNamespaceImport() : parseNamedImportsOrExports(229); + importClause.namedBindings = token === 37 ? parseNamespaceImport() : parseNamedImportsOrExports(232); } return finishNode(importClause); } @@ -9508,7 +9723,7 @@ var ts; : parseEntityName(false); } function parseExternalModuleReference() { - var node = createNode(236); + var node = createNode(239); parseExpected(128); parseExpected(17); node.expression = parseModuleSpecifier(); @@ -9526,7 +9741,7 @@ var ts; } } function parseNamespaceImport() { - var namespaceImport = createNode(228); + var namespaceImport = createNode(231); parseExpected(37); parseExpected(116); namespaceImport.name = parseIdentifier(); @@ -9534,14 +9749,14 @@ var ts; } function parseNamedImportsOrExports(kind) { var node = createNode(kind); - node.elements = parseBracketedList(21, kind === 229 ? parseImportSpecifier : parseExportSpecifier, 15, 16); + node.elements = parseBracketedList(21, kind === 232 ? parseImportSpecifier : parseExportSpecifier, 15, 16); return finishNode(node); } function parseExportSpecifier() { - return parseImportOrExportSpecifier(234); + return parseImportOrExportSpecifier(237); } function parseImportSpecifier() { - return parseImportOrExportSpecifier(230); + return parseImportOrExportSpecifier(233); } function parseImportOrExportSpecifier(kind) { var node = createNode(kind); @@ -9560,23 +9775,23 @@ var ts; else { node.name = identifierName; } - if (kind === 230 && checkIdentifierIsKeyword) { + if (kind === 233 && checkIdentifierIsKeyword) { parseErrorAtPosition(checkIdentifierStart, checkIdentifierEnd - checkIdentifierStart, ts.Diagnostics.Identifier_expected); } return finishNode(node); } function parseExportDeclaration(fullStart, decorators, modifiers) { - var node = createNode(232, fullStart); + var node = createNode(235, fullStart); node.decorators = decorators; setModifiers(node, modifiers); if (parseOptional(37)) { - parseExpected(134); + parseExpected(135); node.moduleSpecifier = parseModuleSpecifier(); } else { - node.exportClause = parseNamedImportsOrExports(233); - if (token === 134 || (token === 9 && !scanner.hasPrecedingLineBreak())) { - parseExpected(134); + node.exportClause = parseNamedImportsOrExports(236); + if (token === 135 || (token === 9 && !scanner.hasPrecedingLineBreak())) { + parseExpected(135); node.moduleSpecifier = parseModuleSpecifier(); } } @@ -9584,7 +9799,7 @@ var ts; return finishNode(node); } function parseExportAssignment(fullStart, decorators, modifiers) { - var node = createNode(231, fullStart); + var node = createNode(234, fullStart); node.decorators = decorators; setModifiers(node, modifiers); if (parseOptional(56)) { @@ -9600,6 +9815,7 @@ var ts; function processReferenceComments(sourceFile) { var triviaScanner = ts.createScanner(sourceFile.languageVersion, false, 0, sourceText); var referencedFiles = []; + var typeReferenceDirectives = []; var amdDependencies = []; var amdModuleName; while (true) { @@ -9620,7 +9836,12 @@ var ts; sourceFile.hasNoDefaultLib = referencePathMatchResult.isNoDefaultLib; var diagnosticMessage = referencePathMatchResult.diagnosticMessage; if (fileReference) { - referencedFiles.push(fileReference); + if (referencePathMatchResult.isTypeReferenceDirective) { + typeReferenceDirectives.push(fileReference); + } + else { + referencedFiles.push(fileReference); + } } if (diagnosticMessage) { parseDiagnostics.push(ts.createFileDiagnostic(sourceFile, range.pos, range.end - range.pos, diagnosticMessage)); @@ -9650,16 +9871,17 @@ var ts; } } sourceFile.referencedFiles = referencedFiles; + sourceFile.typeReferenceDirectives = typeReferenceDirectives; sourceFile.amdDependencies = amdDependencies; sourceFile.moduleName = amdModuleName; } function setExternalModuleIndicator(sourceFile) { sourceFile.externalModuleIndicator = ts.forEach(sourceFile.statements, function (node) { return node.flags & 1 - || node.kind === 225 && node.moduleReference.kind === 236 - || node.kind === 226 - || node.kind === 231 - || node.kind === 232 + || node.kind === 228 && node.moduleReference.kind === 239 + || node.kind === 229 + || node.kind === 234 + || node.kind === 235 ? node : undefined; }); @@ -9694,7 +9916,7 @@ var ts; } JSDocParser.parseJSDocTypeExpressionForTests = parseJSDocTypeExpressionForTests; function parseJSDocTypeExpression() { - var result = createNode(253, scanner.getTokenPos()); + var result = createNode(256, scanner.getTokenPos()); parseExpected(15); result.type = parseJSDocTopLevelType(); parseExpected(16); @@ -9705,12 +9927,12 @@ var ts; function parseJSDocTopLevelType() { var type = parseJSDocType(); if (token === 47) { - var unionType = createNode(257, type.pos); + var unionType = createNode(260, type.pos); unionType.types = parseJSDocTypeList(type); type = finishNode(unionType); } if (token === 56) { - var optionalType = createNode(264, type.pos); + var optionalType = createNode(267, type.pos); nextToken(); optionalType.type = type; type = finishNode(optionalType); @@ -9721,20 +9943,20 @@ var ts; var type = parseBasicTypeExpression(); while (true) { if (token === 19) { - var arrayType = createNode(256, type.pos); + var arrayType = createNode(259, type.pos); arrayType.elementType = type; nextToken(); parseExpected(20); type = finishNode(arrayType); } else if (token === 53) { - var nullableType = createNode(259, type.pos); + var nullableType = createNode(262, type.pos); nullableType.type = type; nextToken(); type = finishNode(nullableType); } else if (token === 49) { - var nonNullableType = createNode(260, type.pos); + var nonNullableType = createNode(263, type.pos); nonNullableType.type = type; nextToken(); type = finishNode(nonNullableType); @@ -9778,27 +10000,27 @@ var ts; return parseJSDocTypeReference(); } function parseJSDocThisType() { - var result = createNode(268); + var result = createNode(271); nextToken(); parseExpected(54); result.type = parseJSDocType(); return finishNode(result); } function parseJSDocConstructorType() { - var result = createNode(267); + var result = createNode(270); nextToken(); parseExpected(54); result.type = parseJSDocType(); return finishNode(result); } function parseJSDocVariadicType() { - var result = createNode(266); + var result = createNode(269); nextToken(); result.type = parseJSDocType(); return finishNode(result); } function parseJSDocFunctionType() { - var result = createNode(265); + var result = createNode(268); nextToken(); parseExpected(17); result.parameters = parseDelimitedList(22, parseJSDocParameter); @@ -9811,7 +10033,7 @@ var ts; return finishNode(result); } function parseJSDocParameter() { - var parameter = createNode(140); + var parameter = createNode(141); parameter.type = parseJSDocType(); if (parseOptional(56)) { parameter.questionToken = createNode(56); @@ -9819,7 +10041,7 @@ var ts; return finishNode(parameter); } function parseJSDocTypeReference() { - var result = createNode(263); + var result = createNode(266); result.name = parseSimplePropertyName(); if (token === 25) { result.typeArguments = parseTypeArguments(); @@ -9853,13 +10075,13 @@ var ts; } } function parseQualifiedName(left) { - var result = createNode(137, left.pos); + var result = createNode(138, left.pos); result.left = left; result.right = parseIdentifierName(); return finishNode(result); } function parseJSDocRecordType() { - var result = createNode(261); + var result = createNode(264); nextToken(); result.members = parseDelimitedList(24, parseJSDocRecordMember); checkForTrailingComma(result.members); @@ -9867,7 +10089,7 @@ var ts; return finishNode(result); } function parseJSDocRecordMember() { - var result = createNode(262); + var result = createNode(265); result.name = parseSimplePropertyName(); if (token === 54) { nextToken(); @@ -9876,13 +10098,13 @@ var ts; return finishNode(result); } function parseJSDocNonNullableType() { - var result = createNode(260); + var result = createNode(263); nextToken(); result.type = parseJSDocType(); return finishNode(result); } function parseJSDocTupleType() { - var result = createNode(258); + var result = createNode(261); nextToken(); result.types = parseDelimitedList(25, parseJSDocType); checkForTrailingComma(result.types); @@ -9896,7 +10118,7 @@ var ts; } } function parseJSDocUnionType() { - var result = createNode(257); + var result = createNode(260); nextToken(); result.types = parseJSDocTypeList(parseJSDocType()); parseExpected(18); @@ -9914,7 +10136,7 @@ var ts; return types; } function parseJSDocAllType() { - var result = createNode(254); + var result = createNode(257); nextToken(); return finishNode(result); } @@ -9927,11 +10149,11 @@ var ts; token === 27 || token === 56 || token === 47) { - var result = createNode(255, pos); + var result = createNode(258, pos); return finishNode(result); } else { - var result = createNode(259, pos); + var result = createNode(262, pos); result.type = parseJSDocType(); return finishNode(result); } @@ -10011,7 +10233,7 @@ var ts; if (!tags) { return undefined; } - var result = createNode(269, start); + var result = createNode(272, start); result.tags = tags; return finishNode(result, end); } @@ -10049,7 +10271,7 @@ var ts; return undefined; } function handleUnknownTag(atToken, tagName) { - var result = createNode(270, atToken.pos); + var result = createNode(273, atToken.pos); result.atToken = atToken; result.tagName = tagName; return finishNode(result); @@ -10101,7 +10323,7 @@ var ts; if (!typeExpression) { typeExpression = tryParseTypeExpression(); } - var result = createNode(271, atToken.pos); + var result = createNode(274, atToken.pos); result.atToken = atToken; result.tagName = tagName; result.preParameterName = preName; @@ -10111,27 +10333,27 @@ var ts; return finishNode(result); } function handleReturnTag(atToken, tagName) { - if (ts.forEach(tags, function (t) { return t.kind === 272; })) { + if (ts.forEach(tags, function (t) { return t.kind === 275; })) { parseErrorAtPosition(tagName.pos, scanner.getTokenPos() - tagName.pos, ts.Diagnostics._0_tag_already_specified, tagName.text); } - var result = createNode(272, atToken.pos); + var result = createNode(275, 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 === 273; })) { + if (ts.forEach(tags, function (t) { return t.kind === 276; })) { parseErrorAtPosition(tagName.pos, scanner.getTokenPos() - tagName.pos, ts.Diagnostics._0_tag_already_specified, tagName.text); } - var result = createNode(273, atToken.pos); + var result = createNode(276, atToken.pos); result.atToken = atToken; result.tagName = tagName; result.typeExpression = tryParseTypeExpression(); return finishNode(result); } function handleTemplateTag(atToken, tagName) { - if (ts.forEach(tags, function (t) { return t.kind === 274; })) { + if (ts.forEach(tags, function (t) { return t.kind === 277; })) { parseErrorAtPosition(tagName.pos, scanner.getTokenPos() - tagName.pos, ts.Diagnostics._0_tag_already_specified, tagName.text); } var typeParameters = []; @@ -10142,7 +10364,7 @@ var ts; parseErrorAtPosition(scanner.getStartPos(), 0, ts.Diagnostics.Identifier_expected); return undefined; } - var typeParameter = createNode(139, name_8.pos); + var typeParameter = createNode(140, name_8.pos); typeParameter.name = name_8; finishNode(typeParameter); typeParameters.push(typeParameter); @@ -10153,7 +10375,7 @@ var ts; break; } } - var result = createNode(274, atToken.pos); + var result = createNode(277, atToken.pos); result.atToken = atToken; result.tagName = tagName; result.typeParameters = typeParameters; @@ -10273,12 +10495,12 @@ var ts; } function checkNodePositions(node, aggressiveChecks) { if (aggressiveChecks) { - var pos = node.pos; + var pos_2 = node.pos; forEachChild(node, function (child) { - ts.Debug.assert(child.pos >= pos); - pos = child.end; + ts.Debug.assert(child.pos >= pos_2); + pos_2 = child.end; }); - ts.Debug.assert(pos <= node.end); + ts.Debug.assert(pos_2 <= node.end); } } function updateTokenPositionsAndMarkElements(sourceFile, changeStart, changeRangeOldEnd, changeRangeNewEnd, delta, oldText, newText, aggressiveChecks) { @@ -10474,32 +10696,32 @@ var ts; : 4; } function getModuleInstanceState(node) { - if (node.kind === 219 || node.kind === 220) { + if (node.kind === 221 || node.kind === 222) { return 0; } else if (ts.isConstEnumDeclaration(node)) { return 2; } - else if ((node.kind === 226 || node.kind === 225) && !(node.flags & 1)) { + else if ((node.kind === 229 || node.kind === 228) && !(node.flags & 1)) { return 0; } - else if (node.kind === 223) { - var state = 0; + else if (node.kind === 225) { + var state_1 = 0; ts.forEachChild(node, function (n) { switch (getModuleInstanceState(n)) { case 0: return false; case 2: - state = 2; + state_1 = 2; return false; case 1: - state = 1; + state_1 = 1; return true; } }); - return state; + return state_1; } - else if (node.kind === 222) { + else if (node.kind === 224) { return getModuleInstanceState(node.body); } else { @@ -10531,6 +10753,7 @@ var ts; var hasAsyncFunctions; var hasDecorators; var hasParameterDecorators; + var hasJsxSpreadAttribute; var inStrictMode; var symbolCount = 0; var Symbol; @@ -10561,6 +10784,7 @@ var ts; hasAsyncFunctions = false; hasDecorators = false; hasParameterDecorators = false; + hasJsxSpreadAttribute = false; } return bindSourceFile; function createSymbol(flags, name) { @@ -10583,7 +10807,7 @@ var ts; if (symbolFlags & 107455) { var valueDeclaration = symbol.valueDeclaration; if (!valueDeclaration || - (valueDeclaration.kind !== node.kind && valueDeclaration.kind === 222)) { + (valueDeclaration.kind !== node.kind && valueDeclaration.kind === 224)) { symbol.valueDeclaration = node; } } @@ -10593,7 +10817,7 @@ var ts; if (ts.isAmbientModule(node)) { return ts.isGlobalScopeAugmentation(node) ? "__global" : "\"" + node.name.text + "\""; } - if (node.name.kind === 138) { + if (node.name.kind === 139) { var nameExpression = node.name.expression; if (ts.isStringOrNumericLiteral(nameExpression.kind)) { return nameExpression.text; @@ -10604,21 +10828,21 @@ var ts; return node.name.text; } switch (node.kind) { - case 146: + case 147: return "__constructor"; - case 154: - case 149: - return "__call"; case 155: case 150: - return "__new"; + return "__call"; + case 156: case 151: + return "__new"; + case 152: return "__index"; - case 232: + case 235: return "__export"; - case 231: + case 234: return node.isExportEquals ? "export=" : "default"; - case 185: + case 186: switch (ts.getSpecialPropertyAssignmentKind(node)) { case 2: return "export="; @@ -10630,13 +10854,13 @@ var ts; } ts.Debug.fail("Unknown binary declaration kind"); break; - case 217: - case 218: + case 219: + case 220: return node.flags & 512 ? "default" : undefined; - case 265: + case 268: return ts.isJSDocConstructSignature(node) ? "__new" : "__call"; - case 140: - ts.Debug.assert(node.parent.kind === 265); + case 141: + ts.Debug.assert(node.parent.kind === 268); var functionType = node.parent; var index = ts.indexOf(functionType.parameters, node); return "p" + index; @@ -10661,18 +10885,18 @@ var ts; if (node.name) { node.name.parent = node; } - var message = symbol.flags & 2 + var message_1 = symbol.flags & 2 ? ts.Diagnostics.Cannot_redeclare_block_scoped_variable_0 : ts.Diagnostics.Duplicate_identifier_0; ts.forEach(symbol.declarations, function (declaration) { if (declaration.flags & 512) { - message = ts.Diagnostics.A_module_cannot_have_multiple_default_exports; + 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, getDisplayName(declaration))); + file.bindDiagnostics.push(ts.createDiagnosticForNode(declaration.name || declaration, message_1, getDisplayName(declaration))); }); - file.bindDiagnostics.push(ts.createDiagnosticForNode(node.name || node, message, getDisplayName(node))); + file.bindDiagnostics.push(ts.createDiagnosticForNode(node.name || node, message_1, getDisplayName(node))); symbol = createSymbol(0, name); } } @@ -10686,7 +10910,7 @@ var ts; function declareModuleMember(node, symbolFlags, symbolExcludes) { var hasExportModifier = ts.getCombinedNodeFlags(node) & 1; if (symbolFlags & 8388608) { - if (node.kind === 234 || (node.kind === 225 && hasExportModifier)) { + if (node.kind === 237 || (node.kind === 228 && hasExportModifier)) { return declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes); } else { @@ -10734,10 +10958,10 @@ var ts; var flags = node.flags; flags &= ~98304; flags &= ~3932160; - if (kind === 219) { + if (kind === 221) { seenThisKeyword = false; } - var saveState = kind === 252 || kind === 223 || ts.isFunctionLikeKind(kind); + var saveState = kind === 255 || kind === 225 || ts.isFunctionLikeKind(kind); if (saveState) { savedReachabilityState = currentReachabilityState; savedLabelStack = labelStack; @@ -10758,10 +10982,10 @@ var ts; flags |= 65536; } } - if (kind === 219) { + if (kind === 221) { flags = seenThisKeyword ? flags | 16384 : flags & ~16384; } - if (kind === 252) { + if (kind === 255) { if (hasClassExtends) { flags |= 262144; } @@ -10774,6 +10998,9 @@ var ts; if (hasAsyncFunctions) { flags |= 2097152; } + if (hasJsxSpreadAttribute) { + flags |= 1073741824; + } } node.flags = flags; if (saveState) { @@ -10793,40 +11020,40 @@ var ts; return; } switch (node.kind) { - case 202: + case 204: bindWhileStatement(node); break; - case 201: + case 203: bindDoStatement(node); break; - case 203: + case 205: bindForStatement(node); break; - case 204: - case 205: + case 206: + case 207: bindForInOrForOfStatement(node); break; - case 200: + case 202: bindIfStatement(node); break; - case 208: - case 212: + case 210: + case 214: bindReturnOrThrow(node); break; - case 207: - case 206: + case 209: + case 208: bindBreakOrContinueStatement(node); break; - case 213: + case 215: bindTryStatement(node); break; - case 210: + case 212: bindSwitchStatement(node); break; - case 224: + case 226: bindCaseBlock(node); break; - case 211: + case 213: bindLabeledStatement(node); break; default: @@ -10888,14 +11115,14 @@ var ts; } function bindReturnOrThrow(n) { bind(n.expression); - if (n.kind === 208) { + if (n.kind === 210) { hasExplicitReturn = true; } currentReachabilityState = 4; } function bindBreakOrContinueStatement(n) { bind(n.label); - var isValidJump = jumpToLabel(n.label, n.kind === 207 ? currentReachabilityState : 4); + var isValidJump = jumpToLabel(n.label, n.kind === 209 ? currentReachabilityState : 4); if (isValidJump) { currentReachabilityState = 4; } @@ -10909,24 +11136,27 @@ var ts; var postCatchState = currentReachabilityState; currentReachabilityState = preTryState; bind(n.finallyBlock); - currentReachabilityState = or(postTryState, postCatchState); + currentReachabilityState = n.catchClause ? or(postTryState, postCatchState) : postTryState; } function bindSwitchStatement(n) { var preSwitchState = currentReachabilityState; var postSwitchLabel = pushImplicitLabel(); bind(n.expression); bind(n.caseBlock); - var hasDefault = ts.forEach(n.caseBlock.clauses, function (c) { return c.kind === 246; }); + var hasDefault = ts.forEach(n.caseBlock.clauses, function (c) { return c.kind === 249; }); var postSwitchState = hasDefault && currentReachabilityState !== 2 ? 4 : preSwitchState; popImplicitLabel(postSwitchLabel, postSwitchState); } function bindCaseBlock(n) { var startState = currentReachabilityState; - for (var _i = 0, _a = n.clauses; _i < _a.length; _i++) { - var clause = _a[_i]; + for (var i = 0; i < n.clauses.length; i++) { + var clause = n.clauses[i]; currentReachabilityState = startState; bind(clause); - if (clause.statements.length && currentReachabilityState === 2 && options.noFallthroughCasesInSwitch) { + if (clause.statements.length && + i !== n.clauses.length - 1 && + currentReachabilityState === 2 && + options.noFallthroughCasesInSwitch) { errorOnFirstToken(clause, ts.Diagnostics.Fallthrough_case_in_switch); } } @@ -10941,38 +11171,39 @@ var ts; } function getContainerFlags(node) { switch (node.kind) { - case 190: - case 218: - case 219: + case 191: + case 220: case 221: - case 169: - case 157: - case 261: + case 223: + case 170: + case 158: + case 264: return 1; - case 149: case 150: case 151: - case 145: - case 144: - case 217: + case 152: case 146: + case 145: + case 219: case 147: case 148: - case 154: + case 149: case 155: - case 177: + case 268: + case 156: case 178: - case 222: - case 252: - case 220: - return 5; - case 248: - case 203: - case 204: - case 205: + case 179: case 224: + case 255: + case 222: + return 5; + case 251: + case 205: + case 206: + case 207: + case 226: return 2; - case 196: + case 198: return ts.isFunctionLike(node.parent) ? 0 : 2; } return 0; @@ -10988,35 +11219,35 @@ var ts; } function declareSymbolAndAddToSymbolTableWorker(node, symbolFlags, symbolExcludes) { switch (container.kind) { - case 222: + case 224: return declareModuleMember(node, symbolFlags, symbolExcludes); - case 252: + case 255: return declareSourceFileMember(node, symbolFlags, symbolExcludes); - case 190: - case 218: + case 191: + case 220: return declareClassMember(node, symbolFlags, symbolExcludes); - case 221: + case 223: return declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes); - case 157: - case 169: - case 219: - case 261: + case 158: + case 170: + case 221: + case 264: return declareSymbol(container.symbol.members, container.symbol, node, symbolFlags, symbolExcludes); - case 154: case 155: - case 149: + case 156: case 150: case 151: - case 145: - case 144: + case 152: case 146: + case 145: case 147: case 148: - case 217: - case 177: + case 149: + case 219: case 178: - case 265: - case 220: + case 179: + case 268: + case 222: return declareSymbol(container.locals, undefined, node, symbolFlags, symbolExcludes); } } @@ -11031,11 +11262,11 @@ var ts; : declareSymbol(file.locals, undefined, node, symbolFlags, symbolExcludes); } function hasExportDeclarations(node) { - var body = node.kind === 252 ? node : node.body; - if (body.kind === 252 || body.kind === 223) { + var body = node.kind === 255 ? node : node.body; + if (body.kind === 255 || body.kind === 225) { for (var _i = 0, _a = body.statements; _i < _a.length; _i++) { var stat = _a[_i]; - if (stat.kind === 232 || stat.kind === 231) { + if (stat.kind === 235 || stat.kind === 234) { return true; } } @@ -11056,7 +11287,12 @@ var ts; if (node.flags & 1) { errorOnFirstToken(node, ts.Diagnostics.export_modifier_cannot_be_applied_to_ambient_modules_and_module_augmentations_since_they_are_always_visible); } - declareSymbolAndAddToSymbolTable(node, 512, 106639); + if (ts.isExternalModuleAugmentation(node)) { + declareSymbolAndAddToSymbolTable(node, 1024, 0); + } + else { + declareSymbolAndAddToSymbolTable(node, 512, 106639); + } } else { var state = getModuleInstanceState(node); @@ -11097,7 +11333,7 @@ var ts; continue; } var identifier = prop.name; - var currentKind = prop.kind === 249 || prop.kind === 250 || prop.kind === 145 + var currentKind = prop.kind === 252 || prop.kind === 253 || prop.kind === 146 ? 1 : 2; var existingKind = seen[identifier.text]; @@ -11119,10 +11355,10 @@ var ts; } function bindBlockScopedDeclaration(node, symbolFlags, symbolExcludes) { switch (blockScopeContainer.kind) { - case 222: + case 224: declareModuleMember(node, symbolFlags, symbolExcludes); break; - case 252: + case 255: if (ts.isExternalModule(container)) { declareModuleMember(node, symbolFlags, symbolExcludes); break; @@ -11244,17 +11480,17 @@ var ts; } function updateStrictMode(node) { switch (node.kind) { - case 252: - case 223: + case 255: + case 225: updateStrictModeStatementList(node.statements); return; - case 196: + case 198: if (ts.isFunctionLike(node.parent)) { updateStrictModeStatementList(node.statements); } return; - case 218: - case 190: + case 220: + case 191: inStrictMode = true; return; } @@ -11273,13 +11509,13 @@ var ts; } function isUseStrictPrologueDirective(node) { var nodeText = ts.getTextOfNodeFromSourceText(file.text, node.expression); - return nodeText === "\"use strict\"" || nodeText === "'use strict'"; + return nodeText === '"use strict"' || nodeText === "'use strict'"; } function bindWorker(node) { switch (node.kind) { case 69: return checkStrictModeIdentifier(node); - case 185: + case 186: if (ts.isInJavaScriptFile(node)) { var specialKind = ts.getSpecialPropertyAssignmentKind(node); switch (specialKind) { @@ -11302,94 +11538,99 @@ var ts; } } return checkStrictModeBinaryExpression(node); - case 248: + case 251: return checkStrictModeCatchClause(node); - case 179: + case 180: return checkStrictModeDeleteExpression(node); case 8: return checkStrictModeNumericLiteral(node); - case 184: + case 185: return checkStrictModePostfixUnaryExpression(node); - case 183: + case 184: return checkStrictModePrefixUnaryExpression(node); - case 209: + case 211: return checkStrictModeWithStatement(node); - case 163: + case 164: seenThisKeyword = true; return; - case 152: + case 153: return checkTypePredicate(node); - case 139: - return declareSymbolAndAddToSymbolTable(node, 262144, 530912); case 140: + return declareSymbolAndAddToSymbolTable(node, 262144, 530912); + case 141: return bindParameter(node); - case 215: - case 167: + case 217: + case 168: return bindVariableDeclarationOrBindingElement(node); + case 144: case 143: - case 142: - case 262: + case 265: return bindPropertyOrMethodOrAccessor(node, 4 | (node.questionToken ? 536870912 : 0), 107455); - case 249: - case 250: + case 252: + case 253: return bindPropertyOrMethodOrAccessor(node, 4, 107455); - case 251: + case 254: return bindPropertyOrMethodOrAccessor(node, 8, 107455); - case 149: + case 246: + hasJsxSpreadAttribute = true; + return; case 150: case 151: + case 152: return declareSymbolAndAddToSymbolTable(node, 131072, 0); - case 145: - case 144: - return bindPropertyOrMethodOrAccessor(node, 8192 | (node.questionToken ? 536870912 : 0), ts.isObjectLiteralMethod(node) ? 107455 : 99263); - case 217: - return bindFunctionDeclaration(node); case 146: - return declareSymbolAndAddToSymbolTable(node, 16384, 0); + case 145: + return bindPropertyOrMethodOrAccessor(node, 8192 | (node.questionToken ? 536870912 : 0), ts.isObjectLiteralMethod(node) ? 107455 : 99263); + case 219: + return bindFunctionDeclaration(node); case 147: - return bindPropertyOrMethodOrAccessor(node, 32768, 41919); + return declareSymbolAndAddToSymbolTable(node, 16384, 0); case 148: + return bindPropertyOrMethodOrAccessor(node, 32768, 41919); + case 149: return bindPropertyOrMethodOrAccessor(node, 65536, 74687); - case 154: case 155: - case 265: + case 156: + case 268: return bindFunctionOrConstructorType(node); - case 157: - case 261: + case 158: + case 264: return bindAnonymousDeclaration(node, 2048, "__type"); - case 169: + case 170: return bindObjectLiteralExpression(node); - case 177: case 178: + case 179: return bindFunctionExpression(node); - case 172: + case 173: if (ts.isInJavaScriptFile(node)) { bindCallExpression(node); } break; - case 190: - case 218: - return bindClassLikeDeclaration(node); - case 219: - return bindBlockScopedDeclaration(node, 64, 792960); + case 191: case 220: - return bindBlockScopedDeclaration(node, 524288, 793056); + return bindClassLikeDeclaration(node); case 221: - return bindEnumDeclaration(node); + return bindBlockScopedDeclaration(node, 64, 792960); case 222: + return bindBlockScopedDeclaration(node, 524288, 793056); + case 223: + return bindEnumDeclaration(node); + case 224: return bindModuleDeclaration(node); - case 225: case 228: - case 230: - case 234: + case 231: + case 233: + case 237: return declareSymbolAndAddToSymbolTable(node, 8388608, 8388608); case 227: + return bindGlobalModuleExportDeclaration(node); + case 230: return bindImportClause(node); - case 232: + case 235: return bindExportDeclaration(node); - case 231: + case 234: return bindExportAssignment(node); - case 252: + case 255: return bindSourceFileIfExternalModule(); } } @@ -11398,7 +11639,7 @@ var ts; if (parameterName && parameterName.kind === 69) { checkStrictModeIdentifier(parameterName); } - if (parameterName && parameterName.kind === 163) { + if (parameterName && parameterName.kind === 164) { seenThisKeyword = true; } bind(type); @@ -11413,17 +11654,39 @@ var ts; bindAnonymousDeclaration(file, 512, "\"" + ts.removeFileExtension(file.fileName) + "\""); } function bindExportAssignment(node) { - var boundExpression = node.kind === 231 ? node.expression : node.right; + var boundExpression = node.kind === 234 ? node.expression : node.right; if (!container.symbol || !container.symbol.exports) { bindAnonymousDeclaration(node, 8388608, getDeclarationName(node)); } - else if (boundExpression.kind === 69 && node.kind === 231) { + else if (boundExpression.kind === 69 && node.kind === 234) { declareSymbol(container.symbol.exports, container.symbol, node, 8388608, 107455 | 8388608); } else { declareSymbol(container.symbol.exports, container.symbol, node, 4, 107455 | 8388608); } } + function bindGlobalModuleExportDeclaration(node) { + if (node.modifiers && node.modifiers.length) { + file.bindDiagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.Modifiers_cannot_appear_here)); + } + if (node.parent.kind !== 255) { + file.bindDiagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.Global_module_exports_may_only_appear_at_top_level)); + return; + } + else { + 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_4.isDeclarationFile) { + file.bindDiagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.Global_module_exports_may_only_appear_in_declaration_files)); + return; + } + } + file.symbol.globalExports = file.symbol.globalExports || {}; + declareSymbol(file.symbol.globalExports, file.symbol, node, 8388608, 8388608); + } function bindExportDeclaration(node) { if (!container.symbol || !container.symbol.exports) { bindAnonymousDeclaration(node, 1073741824, getDeclarationName(node)); @@ -11449,10 +11712,10 @@ var ts; } function bindModuleExportsAssignment(node) { setCommonJsModuleIndicator(node); - bindExportAssignment(node); + declareSymbol(file.symbol.exports, file.symbol, node, 4 | 7340032 | 512, 0); } function bindThisPropertyAssignment(node) { - if (container.kind === 177 || container.kind === 217) { + if (container.kind === 178 || container.kind === 219) { container.symbol.members = container.symbol.members || {}; declareSymbol(container.symbol.members, container.symbol, node, 4, 107455 & ~4); } @@ -11487,7 +11750,7 @@ var ts; hasDecorators = true; } } - if (node.kind === 218) { + if (node.kind === 220) { bindBlockScopedDeclaration(node, 32, 899519); } else { @@ -11637,15 +11900,15 @@ var ts; function checkUnreachable(node) { switch (currentReachabilityState) { case 4: - var reportError = (ts.isStatement(node) && node.kind !== 198) || - node.kind === 218 || - (node.kind === 222 && shouldReportErrorOnModuleDeclaration(node)) || - (node.kind === 221 && (!ts.isConstEnumDeclaration(node) || options.preserveConstEnums)); + var reportError = (ts.isStatement(node) && node.kind !== 200) || + node.kind === 220 || + (node.kind === 224 && shouldReportErrorOnModuleDeclaration(node)) || + (node.kind === 223 && (!ts.isConstEnumDeclaration(node) || options.preserveConstEnums)); if (reportError) { currentReachabilityState = 8; var reportUnreachableCode = !options.allowUnreachableCode && !ts.isInAmbientContext(node) && - (node.kind !== 197 || + (node.kind !== 199 || ts.getCombinedNodeFlags(node.declarationList) & 3072 || ts.forEach(node.declarationList.declarations, function (d) { return d.initializer; })); if (reportUnreachableCode) { @@ -11708,6 +11971,7 @@ var ts; var languageVersion = compilerOptions.target || 0; var modulekind = ts.getEmitModuleKind(compilerOptions); var allowSyntheticDefaultImports = typeof compilerOptions.allowSyntheticDefaultImports !== "undefined" ? compilerOptions.allowSyntheticDefaultImports : modulekind === ts.ModuleKind.System; + var strictNullChecks = compilerOptions.strictNullChecks; var emitResolver = createResolver(); var undefinedSymbol = createSymbol(4 | 67108864, "undefined"); undefinedSymbol.declarations = []; @@ -11722,7 +11986,7 @@ var ts; isUnknownSymbol: function (symbol) { return symbol === unknownSymbol; }, getDiagnostics: getDiagnostics, getGlobalDiagnostics: getGlobalDiagnostics, - getTypeOfSymbolAtLocation: getNarrowedTypeOfSymbol, + getTypeOfSymbolAtLocation: getTypeOfSymbolAtLocation, getSymbolsOfParameterPropertyDeclaration: getSymbolsOfParameterPropertyDeclaration, getDeclaredTypeOfSymbol: getDeclaredTypeOfSymbol, getPropertiesOfType: getPropertiesOfType, @@ -11757,14 +12021,16 @@ var ts; }; var unknownSymbol = createSymbol(4 | 67108864, "unknown"); var resolvingSymbol = createSymbol(67108864, "__resolving__"); + var nullableWideningFlags = strictNullChecks ? 0 : 2097152; var anyType = createIntrinsicType(1, "any"); var stringType = createIntrinsicType(2, "string"); var numberType = createIntrinsicType(4, "number"); var booleanType = createIntrinsicType(8, "boolean"); var esSymbolType = createIntrinsicType(16777216, "symbol"); var voidType = createIntrinsicType(16, "void"); - var undefinedType = createIntrinsicType(32 | 2097152, "undefined"); - var nullType = createIntrinsicType(64 | 2097152, "null"); + var undefinedType = createIntrinsicType(32 | nullableWideningFlags, "undefined"); + var nullType = createIntrinsicType(64 | nullableWideningFlags, "null"); + var emptyArrayElementType = createIntrinsicType(32 | 2097152, "undefined"); var unknownType = createIntrinsicType(1, "unknown"); var emptyObjectType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined); var emptyUnionType = emptyObjectType; @@ -11773,11 +12039,11 @@ var ts; var anyFunctionType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined); anyFunctionType.flags |= 8388608; var noConstraintType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined); - var anySignature = createSignature(undefined, undefined, emptyArray, anyType, undefined, 0, false, false); - var unknownSignature = createSignature(undefined, undefined, emptyArray, unknownType, undefined, 0, false, false); + var anySignature = createSignature(undefined, undefined, undefined, emptyArray, anyType, undefined, 0, false, false); + var unknownSignature = createSignature(undefined, undefined, undefined, emptyArray, unknownType, undefined, 0, false, false); var enumNumberIndexInfo = createIndexInfo(stringType, true); var globals = {}; - var globalESSymbolConstructorSymbol; + var getGlobalESSymbolConstructorSymbol; var getGlobalPromiseConstructorSymbol; var globalObjectType; var globalFunctionType; @@ -11787,13 +12053,13 @@ var ts; var globalNumberType; var globalBooleanType; var globalRegExpType; - var globalTemplateStringsArrayType; - var globalESSymbolType; - var globalIterableType; - var globalIteratorType; - var globalIterableIteratorType; var anyArrayType; var anyReadonlyArrayType; + var getGlobalTemplateStringsArrayType; + var getGlobalESSymbolType; + var getGlobalIterableType; + var getGlobalIteratorType; + var getGlobalIterableIteratorType; var getGlobalClassDecoratorType; var getGlobalParameterDecoratorType; var getGlobalPropertyDecoratorType; @@ -11855,6 +12121,7 @@ var ts; }; var subtypeRelation = {}; var assignableRelation = {}; + var comparableRelation = {}; var identityRelation = {}; var _displayBuilder; var builtinGlobals = (_a = {}, @@ -11943,7 +12210,7 @@ var ts; target.flags |= source.flags; if (source.valueDeclaration && (!target.valueDeclaration || - (target.valueDeclaration.kind === 222 && source.valueDeclaration.kind !== 222))) { + (target.valueDeclaration.kind === 224 && source.valueDeclaration.kind !== 224))) { target.valueDeclaration = source.valueDeclaration; } ts.forEach(source.declarations, function (node) { @@ -11962,13 +12229,13 @@ var ts; recordMergedSymbol(target, source); } else { - var message = target.flags & 2 || source.flags & 2 + var message_2 = target.flags & 2 || source.flags & 2 ? ts.Diagnostics.Cannot_redeclare_block_scoped_variable_0 : ts.Diagnostics.Duplicate_identifier_0; ts.forEach(source.declarations, function (node) { - error(node.name ? node.name : node, message, symbolToString(source)); + error(node.name ? node.name : node, message_2, symbolToString(source)); }); ts.forEach(target.declarations, function (node) { - error(node.name ? node.name : node, message, symbolToString(source)); + error(node.name ? node.name : node, message_2, symbolToString(source)); }); } } @@ -11999,7 +12266,7 @@ var ts; } function mergeModuleAugmentation(moduleName) { var moduleAugmentation = moduleName.parent; - if (moduleAugmentation.symbol.valueDeclaration !== moduleAugmentation) { + if (moduleAugmentation.symbol.declarations[0] !== moduleAugmentation) { ts.Debug.assert(moduleAugmentation.symbol.declarations.length > 1); return; } @@ -12047,7 +12314,7 @@ var ts; return nodeLinks[nodeId] || (nodeLinks[nodeId] = {}); } function isGlobalSourceFile(node) { - return node.kind === 252 && !ts.isExternalOrCommonJsModule(node); + return node.kind === 255 && !ts.isExternalOrCommonJsModule(node); } function getSymbol(symbols, name, meaning) { if (meaning && ts.hasProperty(symbols, name)) { @@ -12085,18 +12352,18 @@ var ts; return ts.indexOf(sourceFiles, declarationFile) <= ts.indexOf(sourceFiles, useFile); } if (declaration.pos <= usage.pos) { - return declaration.kind !== 215 || + return declaration.kind !== 217 || !isImmediatelyUsedInInitializerOfBlockScopedVariable(declaration, usage); } return isUsedInFunctionOrNonStaticProperty(declaration, usage); function isImmediatelyUsedInInitializerOfBlockScopedVariable(declaration, usage) { var container = ts.getEnclosingBlockScopeContainer(declaration); - if (declaration.parent.parent.kind === 197 || - declaration.parent.parent.kind === 203) { + if (declaration.parent.parent.kind === 199 || + declaration.parent.parent.kind === 205) { return isSameScopeDescendentOf(usage, declaration, container); } - else if (declaration.parent.parent.kind === 205 || - declaration.parent.parent.kind === 204) { + else if (declaration.parent.parent.kind === 207 || + declaration.parent.parent.kind === 206) { var expression = declaration.parent.parent.expression; return isSameScopeDescendentOf(usage, expression, container); } @@ -12112,7 +12379,7 @@ var ts; return true; } var initializerOfNonStaticProperty = current.parent && - current.parent.kind === 143 && + current.parent.kind === 144 && (current.parent.flags & 32) === 0 && current.parent.initializer === current; if (initializerOfNonStaticProperty) { @@ -12134,18 +12401,18 @@ var ts; if (result = getSymbol(location.locals, name, meaning)) { var useResult = true; if (ts.isFunctionLike(location) && lastLocation && lastLocation !== location.body) { - if (meaning & result.flags & 793056 && lastLocation.kind !== 269) { + if (meaning & result.flags & 793056 && lastLocation.kind !== 272) { useResult = result.flags & 262144 ? lastLocation === location.type || - lastLocation.kind === 140 || - lastLocation.kind === 139 + lastLocation.kind === 141 || + lastLocation.kind === 140 : false; } if (meaning & 107455 && result.flags & 1) { useResult = - lastLocation.kind === 140 || + lastLocation.kind === 141 || (lastLocation === location.type && - result.valueDeclaration.kind === 140); + result.valueDeclaration.kind === 141); } } if (useResult) { @@ -12157,12 +12424,12 @@ var ts; } } switch (location.kind) { - case 252: + case 255: if (!ts.isExternalOrCommonJsModule(location)) break; - case 222: + case 224: var moduleExports = getSymbolOfNode(location).exports; - if (location.kind === 252 || ts.isAmbientModule(location)) { + if (location.kind === 255 || ts.isAmbientModule(location)) { if (result = moduleExports["default"]) { var localSymbol = ts.getLocalSymbolForExportDefault(result); if (localSymbol && (result.flags & meaning) && localSymbol.name === name) { @@ -12172,7 +12439,7 @@ var ts; } if (ts.hasProperty(moduleExports, name) && moduleExports[name].flags === 8388608 && - ts.getDeclarationOfKind(moduleExports[name], 234)) { + ts.getDeclarationOfKind(moduleExports[name], 237)) { break; } } @@ -12180,13 +12447,13 @@ var ts; break loop; } break; - case 221: + case 223: if (result = getSymbol(getSymbolOfNode(location).exports, name, meaning & 8)) { break loop; } break; + case 144: case 143: - case 142: if (ts.isClassLike(location.parent) && !(location.flags & 32)) { var ctor = findConstructorDeclaration(location.parent); if (ctor && ctor.locals) { @@ -12196,9 +12463,9 @@ var ts; } } break; - case 218: - case 190: - case 219: + case 220: + case 191: + case 221: if (result = getSymbol(getSymbolOfNode(location).members, name, meaning & 793056)) { if (lastLocation && lastLocation.flags & 32) { error(errorLocation, ts.Diagnostics.Static_members_cannot_reference_class_type_parameters); @@ -12206,7 +12473,7 @@ var ts; } break loop; } - if (location.kind === 190 && meaning & 32) { + if (location.kind === 191 && meaning & 32) { var className = location.name; if (className && name === className.text) { result = location.symbol; @@ -12214,28 +12481,28 @@ var ts; } } break; - case 138: + case 139: grandparent = location.parent.parent; - if (ts.isClassLike(grandparent) || grandparent.kind === 219) { + if (ts.isClassLike(grandparent) || grandparent.kind === 221) { if (result = getSymbol(getSymbolOfNode(grandparent).members, name, meaning & 793056)) { error(errorLocation, ts.Diagnostics.A_computed_property_name_cannot_reference_a_type_parameter_from_its_containing_type); return undefined; } } break; - case 145: - case 144: case 146: + case 145: case 147: case 148: - case 217: - case 178: + case 149: + case 219: + case 179: if (meaning & 3 && name === "arguments") { result = argumentsSymbol; break loop; } break; - case 177: + case 178: if (meaning & 3 && name === "arguments") { result = argumentsSymbol; break loop; @@ -12248,8 +12515,8 @@ var ts; } } break; - case 141: - if (location.parent && location.parent.kind === 140) { + case 142: + if (location.parent && location.parent.kind === 141) { location = location.parent; } if (location.parent && ts.isClassElement(location.parent)) { @@ -12319,7 +12586,7 @@ var ts; ts.Debug.assert((result.flags & 2) !== 0); 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 (!isBlockScopedNameDeclaredBeforeUse(ts.getAncestor(declaration, 215), errorLocation)) { + if (!isBlockScopedNameDeclaredBeforeUse(ts.getAncestor(declaration, 217), errorLocation)) { error(errorLocation, ts.Diagnostics.Block_scoped_variable_0_used_before_its_declaration, ts.declarationNameToString(declaration.name)); } } @@ -12336,10 +12603,10 @@ var ts; } function getAnyImportSyntax(node) { if (ts.isAliasSymbolDeclaration(node)) { - if (node.kind === 225) { + if (node.kind === 228) { return node; } - while (node && node.kind !== 226) { + while (node && node.kind !== 229) { node = node.parent; } return node; @@ -12349,7 +12616,7 @@ var ts; return ts.forEach(symbol.declarations, function (d) { return ts.isAliasSymbolDeclaration(d) ? d : undefined; }); } function getTargetOfImportEqualsDeclaration(node) { - if (node.moduleReference.kind === 236) { + if (node.moduleReference.kind === 239) { return resolveExternalModuleSymbol(resolveExternalModuleName(node, ts.getExternalModuleImportEqualsDeclarationExpression(node))); } return getSymbolOfPartOfRightHandSideOfImportEquals(node.moduleReference, node); @@ -12357,7 +12624,9 @@ var ts; function getTargetOfImportClause(node) { var moduleSymbol = resolveExternalModuleName(node, node.parent.moduleSpecifier); if (moduleSymbol) { - var exportDefaultSymbol = resolveSymbol(moduleSymbol.exports["default"]); + var exportDefaultSymbol = moduleSymbol.exports["export="] ? + getPropertyOfType(getTypeOfSymbol(moduleSymbol.exports["export="]), "default") : + resolveSymbol(moduleSymbol.exports["default"]); if (!exportDefaultSymbol && !allowSyntheticDefaultImports) { error(node.name, ts.Diagnostics.Module_0_has_no_default_export, symbolToString(moduleSymbol)); } @@ -12408,8 +12677,14 @@ var ts; if (targetSymbol) { var name_9 = specifier.propertyName || specifier.name; if (name_9.text) { + var symbolFromVariable = void 0; + if (moduleSymbol && moduleSymbol.exports && moduleSymbol.exports["export="]) { + symbolFromVariable = getPropertyOfType(getTypeOfSymbol(targetSymbol), name_9.text); + } + else { + symbolFromVariable = getPropertyOfVariable(targetSymbol, name_9.text); + } var symbolFromModule = getExportOfModule(targetSymbol, name_9.text); - var symbolFromVariable = getPropertyOfVariable(targetSymbol, name_9.text); var symbol = symbolFromModule && symbolFromVariable ? combineValueAndTypeSymbols(symbolFromVariable, symbolFromModule) : symbolFromModule || symbolFromVariable; @@ -12423,6 +12698,9 @@ var ts; function getTargetOfImportSpecifier(node) { return getExternalModuleMember(node.parent.parent.parent, node); } + function getTargetOfGlobalModuleExportDeclaration(node) { + return resolveExternalModuleSymbol(node.parent.symbol); + } function getTargetOfExportSpecifier(node) { return node.parent.parent.moduleSpecifier ? getExternalModuleMember(node.parent.parent, node) : @@ -12433,18 +12711,20 @@ var ts; } function getTargetOfAliasDeclaration(node) { switch (node.kind) { - case 225: - return getTargetOfImportEqualsDeclaration(node); - case 227: - return getTargetOfImportClause(node); case 228: - return getTargetOfNamespaceImport(node); + return getTargetOfImportEqualsDeclaration(node); case 230: - return getTargetOfImportSpecifier(node); - case 234: - return getTargetOfExportSpecifier(node); + return getTargetOfImportClause(node); case 231: + return getTargetOfNamespaceImport(node); + case 233: + return getTargetOfImportSpecifier(node); + case 237: + return getTargetOfExportSpecifier(node); + case 234: return getTargetOfExportAssignment(node); + case 227: + return getTargetOfGlobalModuleExportDeclaration(node); } } function resolveSymbol(symbol) { @@ -12485,10 +12765,10 @@ var ts; if (!links.referenced) { links.referenced = true; var node = getDeclarationOfAliasSymbol(symbol); - if (node.kind === 231) { + if (node.kind === 234) { checkExpressionCached(node.expression); } - else if (node.kind === 234) { + else if (node.kind === 237) { checkExpressionCached(node.propertyName || node.name); } else if (ts.isInternalModuleImportEqualsDeclaration(node)) { @@ -12498,17 +12778,17 @@ var ts; } function getSymbolOfPartOfRightHandSideOfImportEquals(entityName, importDeclaration) { if (!importDeclaration) { - importDeclaration = ts.getAncestor(entityName, 225); + importDeclaration = ts.getAncestor(entityName, 228); ts.Debug.assert(importDeclaration !== undefined); } if (entityName.kind === 69 && ts.isRightSideOfQualifiedNameOrPropertyAccess(entityName)) { entityName = entityName.parent; } - if (entityName.kind === 69 || entityName.parent.kind === 137) { + if (entityName.kind === 69 || entityName.parent.kind === 138) { return resolveEntityName(entityName, 1536); } else { - ts.Debug.assert(entityName.parent.kind === 225); + ts.Debug.assert(entityName.parent.kind === 228); return resolveEntityName(entityName, 107455 | 793056 | 1536); } } @@ -12527,9 +12807,9 @@ var ts; return undefined; } } - else if (name.kind === 137 || name.kind === 170) { - var left = name.kind === 137 ? name.left : name.expression; - var right = name.kind === 137 ? name.right : name.name; + else if (name.kind === 138 || name.kind === 171) { + var left = name.kind === 138 ? name.left : name.expression; + var right = name.kind === 138 ? name.right : name.name; var namespace = resolveEntityName(left, 1536, ignoreErrors); if (!namespace || namespace === unknownSymbol || ts.nodeIsMissing(right)) { return undefined; @@ -12562,7 +12842,7 @@ var ts; } var isRelative = ts.isExternalModuleNameRelative(moduleName); if (!isRelative) { - var symbol = getSymbol(globals, "\"" + moduleName + "\"", 512); + var symbol = getSymbol(globals, '"' + moduleName + '"', 512); if (symbol) { return getMergedSymbol(symbol); } @@ -12692,7 +12972,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 === 146 && ts.nodeIsPresent(member.body)) { + if (member.kind === 147 && ts.nodeIsPresent(member.body)) { return member; } } @@ -12758,21 +13038,15 @@ var ts; } } switch (location_1.kind) { - case 252: + case 255: if (!ts.isExternalOrCommonJsModule(location_1)) { break; } - case 222: + case 224: if (result = callback(getSymbolOfNode(location_1).exports)) { return result; } break; - case 218: - case 219: - if (result = callback(getSymbolOfNode(location_1).members)) { - return result; - } - break; } } return callback(globals); @@ -12801,7 +13075,7 @@ var ts; return ts.forEachValue(symbols, function (symbolFromSymbolTable) { if (symbolFromSymbolTable.flags & 8388608 && symbolFromSymbolTable.name !== "export=" - && !ts.getDeclarationOfKind(symbolFromSymbolTable, 234)) { + && !ts.getDeclarationOfKind(symbolFromSymbolTable, 237)) { if (!useOnlyExternalAliasing || ts.forEach(symbolFromSymbolTable.declarations, ts.isExternalModuleImportEqualsDeclaration)) { var resolvedImportedSymbol = resolveAlias(symbolFromSymbolTable); @@ -12817,7 +13091,9 @@ var ts; }); } if (symbol) { - return forEachSymbolTableInScope(enclosingDeclaration, getAccessibleSymbolChainFromSymbolTable); + if (!(isPropertyOrMethodDeclarationSymbol(symbol))) { + return forEachSymbolTableInScope(enclosingDeclaration, getAccessibleSymbolChainFromSymbolTable); + } } } function needsQualification(symbol, enclosingDeclaration, meaning) { @@ -12830,7 +13106,7 @@ var ts; if (symbolFromSymbolTable === symbol) { return true; } - symbolFromSymbolTable = (symbolFromSymbolTable.flags & 8388608 && !ts.getDeclarationOfKind(symbolFromSymbolTable, 234)) ? resolveAlias(symbolFromSymbolTable) : symbolFromSymbolTable; + symbolFromSymbolTable = (symbolFromSymbolTable.flags & 8388608 && !ts.getDeclarationOfKind(symbolFromSymbolTable, 237)) ? resolveAlias(symbolFromSymbolTable) : symbolFromSymbolTable; if (symbolFromSymbolTable.flags & meaning) { qualify = true; return true; @@ -12839,6 +13115,24 @@ var ts; }); return qualify; } + function isPropertyOrMethodDeclarationSymbol(symbol) { + if (symbol.declarations && symbol.declarations.length) { + for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { + var declaration = _a[_i]; + switch (declaration.kind) { + case 144: + case 146: + case 148: + case 149: + continue; + default: + return false; + } + } + return true; + } + return false; + } function isSymbolAccessible(symbol, enclosingDeclaration, meaning) { if (symbol && enclosingDeclaration && !(symbol.flags & 262144)) { var initialSymbol = symbol; @@ -12885,7 +13179,7 @@ var ts; } } function hasExternalModuleSymbol(declaration) { - return ts.isAmbientModule(declaration) || (declaration.kind === 252 && ts.isExternalOrCommonJsModule(declaration)); + return ts.isAmbientModule(declaration) || (declaration.kind === 255 && ts.isExternalOrCommonJsModule(declaration)); } function hasVisibleDeclarations(symbol) { var aliasesToMakeVisible; @@ -12917,11 +13211,11 @@ var ts; } function isEntityNameVisible(entityName, enclosingDeclaration) { var meaning; - if (entityName.parent.kind === 156) { + if (entityName.parent.kind === 157 || ts.isExpressionWithTypeArgumentsInClassExtendsClause(entityName.parent)) { meaning = 107455 | 1048576; } - else if (entityName.kind === 137 || entityName.kind === 170 || - entityName.parent.kind === 225) { + else if (entityName.kind === 138 || entityName.kind === 171 || + entityName.parent.kind === 228) { meaning = 1536; } else { @@ -12988,10 +13282,10 @@ var ts; function getTypeAliasForTypeLiteral(type) { if (type.symbol && type.symbol.flags & 2048) { var node = type.symbol.declarations[0].parent; - while (node.kind === 162) { + while (node.kind === 163) { node = node.parent; } - if (node.kind === 220) { + if (node.kind === 222) { return getSymbolOfNode(node); } } @@ -12999,7 +13293,7 @@ var ts; } function isTopLevelInExternalModuleAugmentation(node) { return node && node.parent && - node.parent.kind === 223 && + node.parent.kind === 225 && ts.isExternalModuleAugmentation(node.parent.parent); } function getSymbolDisplayBuilder() { @@ -13010,10 +13304,10 @@ var ts; return ts.declarationNameToString(declaration.name); } switch (declaration.kind) { - case 190: + case 191: return "(Anonymous class)"; - case 177: case 178: + case 179: return "(Anonymous function)"; } } @@ -13157,12 +13451,12 @@ var ts; var length_1 = outerTypeParameters.length; while (i < length_1) { var start = i; - var parent_4 = getParentSymbolOfTypeParameter(outerTypeParameters[i]); + var parent_5 = getParentSymbolOfTypeParameter(outerTypeParameters[i]); do { i++; - } while (i < length_1 && getParentSymbolOfTypeParameter(outerTypeParameters[i]) === parent_4); + } while (i < length_1 && getParentSymbolOfTypeParameter(outerTypeParameters[i]) === parent_5); if (!ts.rangeEquals(outerTypeParameters, typeArguments, start, i)) { - writeSymbolTypeReference(parent_4, typeArguments, start, i, flags); + writeSymbolTypeReference(parent_5, typeArguments, start, i, flags); writePunctuation(writer, 21); } } @@ -13221,7 +13515,7 @@ var ts; var isNonLocalFunctionSymbol = !!(symbol.flags & 16) && (symbol.parent || ts.forEach(symbol.declarations, function (declaration) { - return declaration.parent.kind === 252 || declaration.parent.kind === 223; + return declaration.parent.kind === 255 || declaration.parent.kind === 225; })); if (isStaticMethodSymbol || isNonLocalFunctionSymbol) { return !!(flags & 2) || @@ -13361,7 +13655,12 @@ var ts; if (ts.isRestParameter(parameterNode)) { writePunctuation(writer, 22); } - appendSymbolNameOnly(p, writer); + if (ts.isBindingPattern(parameterNode.name)) { + buildBindingPatternDisplay(parameterNode.name, writer, enclosingDeclaration, flags, symbolStack); + } + else { + appendSymbolNameOnly(p, writer); + } if (isOptionalParameter(parameterNode)) { writePunctuation(writer, 53); } @@ -13369,19 +13668,58 @@ var ts; writeSpace(writer); buildTypeDisplay(getTypeOfSymbol(p), writer, enclosingDeclaration, flags, symbolStack); } + function buildBindingPatternDisplay(bindingPattern, writer, enclosingDeclaration, flags, symbolStack) { + if (bindingPattern.kind === 166) { + writePunctuation(writer, 15); + buildDisplayForCommaSeparatedList(bindingPattern.elements, writer, function (e) { return buildBindingElementDisplay(e, writer, enclosingDeclaration, flags, symbolStack); }); + writePunctuation(writer, 16); + } + else if (bindingPattern.kind === 167) { + writePunctuation(writer, 19); + var elements = bindingPattern.elements; + buildDisplayForCommaSeparatedList(elements, writer, function (e) { return buildBindingElementDisplay(e, writer, enclosingDeclaration, flags, symbolStack); }); + if (elements && elements.hasTrailingComma) { + writePunctuation(writer, 24); + } + writePunctuation(writer, 20); + } + } + function buildBindingElementDisplay(bindingElement, writer, enclosingDeclaration, flags, symbolStack) { + if (bindingElement.kind === 192) { + return; + } + ts.Debug.assert(bindingElement.kind === 168); + if (bindingElement.propertyName) { + writer.writeSymbol(ts.getTextOfNode(bindingElement.propertyName), bindingElement.symbol); + writePunctuation(writer, 54); + writeSpace(writer); + } + if (ts.isBindingPattern(bindingElement.name)) { + buildBindingPatternDisplay(bindingElement.name, writer, enclosingDeclaration, flags, symbolStack); + } + else { + if (bindingElement.dotDotDotToken) { + writePunctuation(writer, 22); + } + appendSymbolNameOnly(bindingElement.symbol, writer); + } + } function buildDisplayForTypeParametersAndDelimiters(typeParameters, writer, enclosingDeclaration, flags, symbolStack) { if (typeParameters && typeParameters.length) { writePunctuation(writer, 25); - for (var i = 0; i < typeParameters.length; i++) { - if (i > 0) { - writePunctuation(writer, 24); - writeSpace(writer); - } - buildTypeParameterDisplay(typeParameters[i], writer, enclosingDeclaration, flags, symbolStack); - } + buildDisplayForCommaSeparatedList(typeParameters, writer, function (p) { return buildTypeParameterDisplay(p, writer, enclosingDeclaration, flags, symbolStack); }); writePunctuation(writer, 27); } } + function buildDisplayForCommaSeparatedList(list, writer, action) { + for (var i = 0; i < list.length; i++) { + if (i > 0) { + writePunctuation(writer, 24); + writeSpace(writer); + } + action(list[i]); + } + } function buildDisplayForTypeArgumentsAndDelimiters(typeParameters, mapper, writer, enclosingDeclaration, flags, symbolStack) { if (typeParameters && typeParameters.length) { writePunctuation(writer, 25); @@ -13395,10 +13733,16 @@ var ts; writePunctuation(writer, 27); } } - function buildDisplayForParametersAndDelimiters(parameters, writer, enclosingDeclaration, flags, symbolStack) { + function buildDisplayForParametersAndDelimiters(thisType, parameters, writer, enclosingDeclaration, flags, symbolStack) { writePunctuation(writer, 17); + if (thisType) { + writeKeyword(writer, 97); + writePunctuation(writer, 54); + writeSpace(writer); + buildTypeDisplay(thisType, writer, enclosingDeclaration, flags, symbolStack); + } for (var i = 0; i < parameters.length; i++) { - if (i > 0) { + if (i > 0 || thisType) { writePunctuation(writer, 24); writeSpace(writer); } @@ -13446,7 +13790,7 @@ var ts; else { buildDisplayForTypeParametersAndDelimiters(signature.typeParameters, writer, enclosingDeclaration, flags, symbolStack); } - buildDisplayForParametersAndDelimiters(signature.parameters, writer, enclosingDeclaration, flags, symbolStack); + buildDisplayForParametersAndDelimiters(signature.thisType, signature.parameters, writer, enclosingDeclaration, flags, symbolStack); buildReturnTypeDisplay(signature, writer, enclosingDeclaration, flags, symbolStack); } return _displayBuilder || (_displayBuilder = { @@ -13473,74 +13817,74 @@ var ts; return false; function determineIfDeclarationIsVisible() { switch (node.kind) { - case 167: + case 168: return isDeclarationVisible(node.parent.parent); - case 215: + case 217: if (ts.isBindingPattern(node.name) && !node.name.elements.length) { return false; } - case 222: - case 218: - case 219: + case 224: case 220: - case 217: case 221: - case 225: + case 222: + case 219: + case 223: + case 228: if (ts.isExternalModuleAugmentation(node)) { return true; } - var parent_5 = getDeclarationContainer(node); + var parent_6 = getDeclarationContainer(node); if (!(ts.getCombinedNodeFlags(node) & 1) && - !(node.kind !== 225 && parent_5.kind !== 252 && ts.isInAmbientContext(parent_5))) { - return isGlobalSourceFile(parent_5); + !(node.kind !== 228 && parent_6.kind !== 255 && ts.isInAmbientContext(parent_6))) { + return isGlobalSourceFile(parent_6); } - return isDeclarationVisible(parent_5); - case 143: - case 142: - case 147: - case 148: - case 145: + return isDeclarationVisible(parent_6); case 144: + case 143: + case 148: + case 149: + case 146: + case 145: if (node.flags & (8 | 16)) { return false; } - case 146: - case 150: - case 149: + case 147: case 151: - case 140: - case 223: - case 154: + case 150: + case 152: + case 141: + case 225: case 155: - case 157: - case 153: + case 156: case 158: + case 154: case 159: case 160: case 161: case 162: + case 163: return isDeclarationVisible(node.parent); - case 227: - case 228: case 230: - return false; - case 139: - case 252: - return true; case 231: + case 233: + return false; + case 140: + case 255: + return true; + case 234: return false; default: - ts.Debug.fail("isDeclarationVisible unknown: SyntaxKind: " + node.kind); + return false; } } } function collectLinkedAliases(node) { var exportSymbol; - if (node.parent && node.parent.kind === 231) { + if (node.parent && node.parent.kind === 234) { exportSymbol = resolveName(node.parent, node.text, 107455 | 793056 | 1536 | 8388608, ts.Diagnostics.Cannot_find_name_0, node); } - else if (node.parent.kind === 234) { + else if (node.parent.kind === 237) { var exportSpecifier = node.parent; exportSymbol = exportSpecifier.parent.parent.moduleSpecifier ? getExternalModuleMember(exportSpecifier.parent.parent, exportSpecifier) : @@ -13619,12 +13963,12 @@ var ts; node = ts.getRootDeclaration(node); while (node) { switch (node.kind) { - case 215: - case 216: + case 217: + case 218: + case 233: + case 232: + case 231: case 230: - case 229: - case 228: - case 227: node = node.parent; break; default: @@ -13654,7 +13998,7 @@ var ts; case 9: case 8: return name.text; - case 138: + case 139: if (ts.isStringOrNumericLiteral(name.expression.kind)) { return name.expression.text; } @@ -13662,7 +14006,7 @@ var ts; return undefined; } function isComputedNonLiteralName(name) { - return name.kind === 138 && !ts.isStringOrNumericLiteral(name.expression.kind); + return name.kind === 139 && !ts.isStringOrNumericLiteral(name.expression.kind); } function getTypeForBindingElement(declaration) { var pattern = declaration.parent; @@ -13677,11 +14021,14 @@ var ts; return parentType; } var type; - if (pattern.kind === 165) { + if (pattern.kind === 166) { var name_10 = declaration.propertyName || declaration.name; if (isComputedNonLiteralName(name_10)) { return anyType; } + if (declaration.initializer) { + getContextualType(declaration.initializer); + } var text = getTextOfPropertyName(name_10); type = getTypeOfPropertyOfType(parentType, text) || isNumericLiteralName(text) && getIndexTypeOfType(parentType, 1) || @@ -13712,6 +14059,9 @@ var ts; type = createArrayType(elementType); } } + if (strictNullChecks && declaration.initializer && !(getNullableKind(checkExpressionCached(declaration.initializer)) & 32)) { + type = removeNullableKind(type, 32); + } return type; } function getTypeForVariableLikeDeclarationFromJSDocComment(declaration) { @@ -13725,15 +14075,15 @@ var ts; if (typeTag && typeTag.typeExpression) { return typeTag.typeExpression.type; } - if (declaration.kind === 215 && - declaration.parent.kind === 216 && - declaration.parent.parent.kind === 197) { + if (declaration.kind === 217 && + declaration.parent.kind === 218 && + declaration.parent.parent.kind === 199) { var annotation = ts.getJSDocTypeTag(declaration.parent.parent); if (annotation && annotation.typeExpression) { return annotation.typeExpression.type; } } - else if (declaration.kind === 140) { + else if (declaration.kind === 141) { var paramTag = ts.getCorrespondingJSDocParameterTag(declaration); if (paramTag && paramTag.typeExpression) { return paramTag.typeExpression.type; @@ -13748,35 +14098,38 @@ var ts; return type; } } - if (declaration.parent.parent.kind === 204) { + if (declaration.parent.parent.kind === 206) { return stringType; } - if (declaration.parent.parent.kind === 205) { + if (declaration.parent.parent.kind === 207) { return checkRightHandSideOfForOf(declaration.parent.parent.expression) || anyType; } if (ts.isBindingPattern(declaration.parent)) { return getTypeForBindingElement(declaration); } if (declaration.type) { - return getTypeFromTypeNode(declaration.type); + var type = getTypeFromTypeNode(declaration.type); + return strictNullChecks && declaration.questionToken ? addNullableKind(type, 32) : type; } - if (declaration.kind === 140) { + if (declaration.kind === 141) { var func = declaration.parent; - if (func.kind === 148 && !ts.hasDynamicName(func)) { - var getter = ts.getDeclarationOfKind(declaration.parent.symbol, 147); + if (func.kind === 149 && !ts.hasDynamicName(func)) { + var getter = ts.getDeclarationOfKind(declaration.parent.symbol, 148); if (getter) { return getReturnTypeOfSignature(getSignatureFromDeclaration(getter)); } } - var type = getContextuallyTypedParameterType(declaration); + var type = declaration.symbol.name === "this" + ? getContextuallyTypedThisType(func) + : getContextuallyTypedParameterType(declaration); if (type) { - return type; + return strictNullChecks && declaration.questionToken ? addNullableKind(type, 32) : type; } } if (declaration.initializer) { return checkExpressionCached(declaration.initializer); } - if (declaration.kind === 250) { + if (declaration.kind === 253) { return checkIdentifier(declaration.name); } if (ts.isBindingPattern(declaration.name)) { @@ -13786,11 +14139,16 @@ var ts; } function getTypeFromBindingElement(element, includePatternInType) { if (element.initializer) { - return getWidenedType(checkExpressionCached(element.initializer)); + var type = checkExpressionCached(element.initializer); + reportErrorsFromWidening(element, type); + return getWidenedType(type); } if (ts.isBindingPattern(element.name)) { return getTypeFromBindingPattern(element.name, includePatternInType); } + if (compilerOptions.noImplicitAny) { + reportImplicitAnyError(element, anyType); + } return anyType; } function getTypeFromObjectBindingPattern(pattern, includePatternInType) { @@ -13823,7 +14181,7 @@ var ts; if (elements.length === 0 || elements[elements.length - 1].dotDotDotToken) { return languageVersion >= 2 ? createIterableType(anyType) : anyArrayType; } - var elementTypes = ts.map(elements, function (e) { return e.kind === 191 ? anyType : getTypeFromBindingElement(e, includePatternInType); }); + var elementTypes = ts.map(elements, function (e) { return e.kind === 192 ? anyType : getTypeFromBindingElement(e, includePatternInType); }); if (includePatternInType) { var result = createNewTupleType(elementTypes); result.pattern = pattern; @@ -13832,7 +14190,7 @@ var ts; return createTupleType(elementTypes); } function getTypeFromBindingPattern(pattern, includePatternInType) { - return pattern.kind === 165 + return pattern.kind === 166 ? getTypeFromObjectBindingPattern(pattern, includePatternInType) : getTypeFromArrayBindingPattern(pattern, includePatternInType); } @@ -13842,7 +14200,7 @@ var ts; if (reportErrors) { reportErrorsFromWidening(declaration, type); } - if (declaration.kind === 249) { + if (declaration.kind === 252) { return type; } return getWidenedType(type); @@ -13850,7 +14208,7 @@ var ts; type = declaration.dotDotDotToken ? anyArrayType : anyType; if (reportErrors && compilerOptions.noImplicitAny) { var root = ts.getRootDeclaration(declaration); - if (!isPrivateWithinAmbient(root) && !(root.kind === 140 && isPrivateWithinAmbient(root.parent))) { + if (!isPrivateWithinAmbient(root) && !(root.kind === 141 && isPrivateWithinAmbient(root.parent))) { reportImplicitAnyError(declaration, type); } } @@ -13863,17 +14221,17 @@ var ts; return links.type = getTypeOfPrototypeProperty(symbol); } var declaration = symbol.valueDeclaration; - if (declaration.parent.kind === 248) { + if (declaration.parent.kind === 251) { return links.type = anyType; } - if (declaration.kind === 231) { + if (declaration.kind === 234) { return links.type = checkExpression(declaration.expression); } - if (declaration.kind === 185) { + if (declaration.kind === 186) { return links.type = getUnionType(ts.map(symbol.declarations, function (decl) { return checkExpressionCached(decl.right); })); } - if (declaration.kind === 170) { - if (declaration.parent.kind === 185) { + if (declaration.kind === 171) { + if (declaration.parent.kind === 186) { return links.type = checkExpressionCached(declaration.parent.right); } } @@ -13899,7 +14257,7 @@ var ts; } function getAnnotatedAccessorType(accessor) { if (accessor) { - if (accessor.kind === 147) { + if (accessor.kind === 148) { return accessor.type && getTypeFromTypeNode(accessor.type); } else { @@ -13912,12 +14270,18 @@ var ts; function getTypeOfAccessors(symbol) { var links = getSymbolLinks(symbol); if (!links.type) { + var getter = ts.getDeclarationOfKind(symbol, 148); + var setter = ts.getDeclarationOfKind(symbol, 149); + if (getter && getter.flags & 134217728) { + var jsDocType = getTypeForVariableLikeDeclarationFromJSDocComment(getter); + if (jsDocType) { + return links.type = jsDocType; + } + } if (!pushTypeResolution(symbol, 0)) { return unknownType; } - var getter = ts.getDeclarationOfKind(symbol, 147); - var setter = ts.getDeclarationOfKind(symbol, 148); - var type; + var type = void 0; var getterReturnType = getAnnotatedAccessorType(getter); if (getterReturnType) { type = getterReturnType; @@ -13942,7 +14306,7 @@ var ts; if (!popTypeResolution()) { type = anyType; if (compilerOptions.noImplicitAny) { - var getter_1 = ts.getDeclarationOfKind(symbol, 147); + var getter_1 = ts.getDeclarationOfKind(symbol, 148); 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)); } } @@ -14031,9 +14395,9 @@ var ts; if (!node) { return typeParameters; } - if (node.kind === 218 || node.kind === 190 || - node.kind === 217 || node.kind === 177 || - node.kind === 145 || node.kind === 178) { + if (node.kind === 220 || node.kind === 191 || + node.kind === 219 || node.kind === 178 || + node.kind === 146 || node.kind === 179) { var declarations = node.typeParameters; if (declarations) { return appendTypeParameters(appendOuterTypeParameters(typeParameters, node), declarations); @@ -14042,15 +14406,15 @@ var ts; } } function getOuterTypeParametersOfClassOrInterface(symbol) { - var declaration = symbol.flags & 32 ? symbol.valueDeclaration : ts.getDeclarationOfKind(symbol, 219); + var declaration = symbol.flags & 32 ? symbol.valueDeclaration : ts.getDeclarationOfKind(symbol, 221); return appendOuterTypeParameters(undefined, declaration); } function getLocalTypeParametersOfClassOrInterfaceOrTypeAlias(symbol) { var result; for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var node = _a[_i]; - if (node.kind === 219 || node.kind === 218 || - node.kind === 190 || node.kind === 220) { + if (node.kind === 221 || node.kind === 220 || + node.kind === 191 || node.kind === 222) { var declaration = node; if (declaration.typeParameters) { result = appendTypeParameters(result, declaration.typeParameters); @@ -14075,8 +14439,8 @@ var ts; function getInstantiatedConstructorsForTypeArguments(type, typeArgumentNodes) { var signatures = getConstructorsForTypeArguments(type, typeArgumentNodes); if (typeArgumentNodes) { - var typeArguments = ts.map(typeArgumentNodes, getTypeFromTypeNode); - signatures = ts.map(signatures, function (sig) { return getSignatureInstantiation(sig, typeArguments); }); + var typeArguments_1 = ts.map(typeArgumentNodes, getTypeFromTypeNode); + signatures = ts.map(signatures, function (sig) { return getSignatureInstantiation(sig, typeArguments_1); }); } return signatures; } @@ -14173,7 +14537,7 @@ 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 === 219 && ts.getInterfaceBaseTypeNodes(declaration)) { + if (declaration.kind === 221 && ts.getInterfaceBaseTypeNodes(declaration)) { for (var _b = 0, _c = ts.getInterfaceBaseTypeNodes(declaration); _b < _c.length; _b++) { var node = _c[_b]; var baseType = getTypeFromTypeNode(node); @@ -14202,7 +14566,7 @@ var ts; function isIndependentInterface(symbol) { for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; - if (declaration.kind === 219) { + if (declaration.kind === 221) { if (declaration.flags & 16384) { return false; } @@ -14251,7 +14615,7 @@ var ts; if (!pushTypeResolution(symbol, 2)) { return unknownType; } - var declaration = ts.getDeclarationOfKind(symbol, 220); + var declaration = ts.getDeclarationOfKind(symbol, 222); var type = getTypeFromTypeNode(declaration.type); if (popTypeResolution()) { links.typeParameters = getLocalTypeParametersOfClassOrInterfaceOrTypeAlias(symbol); @@ -14282,7 +14646,7 @@ var ts; if (!links.declaredType) { var type = createType(512); type.symbol = symbol; - if (!ts.getDeclarationOfKind(symbol, 139).constraint) { + if (!ts.getDeclarationOfKind(symbol, 140).constraint) { type.constraint = noConstraintType; } links.declaredType = type; @@ -14334,11 +14698,13 @@ var ts; case 120: case 132: case 103: - case 164: + case 134: + case 93: + case 165: return true; - case 158: + case 159: return isIndependentType(node.elementType); - case 153: + case 154: return isIndependentTypeReference(node); } return false; @@ -14347,7 +14713,7 @@ var ts; return node.type && isIndependentType(node.type) || !node.type && !node.initializer; } function isIndependentFunctionLikeDeclaration(node) { - if (node.kind !== 146 && (!node.type || !isIndependentType(node.type))) { + if (node.kind !== 147 && (!node.type || !isIndependentType(node.type))) { return false; } for (var _i = 0, _a = node.parameters; _i < _a.length; _i++) { @@ -14363,12 +14729,12 @@ var ts; var declaration = symbol.declarations[0]; if (declaration) { switch (declaration.kind) { - case 143: - case 142: - return isIndependentVariableLikeDeclaration(declaration); - case 145: case 144: + case 143: + return isIndependentVariableLikeDeclaration(declaration); case 146: + case 145: + case 147: return isIndependentFunctionLikeDeclaration(declaration); } } @@ -14459,11 +14825,12 @@ var ts; type.typeArguments : ts.concatenate(type.typeArguments, [type]); resolveObjectTypeMembers(type, source, typeParameters, typeArguments); } - function createSignature(declaration, typeParameters, parameters, resolvedReturnType, typePredicate, minArgumentCount, hasRestParameter, hasStringLiterals) { + function createSignature(declaration, typeParameters, thisType, parameters, resolvedReturnType, typePredicate, minArgumentCount, hasRestParameter, hasStringLiterals) { var sig = new Signature(checker); sig.declaration = declaration; sig.typeParameters = typeParameters; sig.parameters = parameters; + sig.thisType = thisType; sig.resolvedReturnType = resolvedReturnType; sig.typePredicate = typePredicate; sig.minArgumentCount = minArgumentCount; @@ -14472,13 +14839,13 @@ var ts; return sig; } function cloneSignature(sig) { - return createSignature(sig.declaration, sig.typeParameters, sig.parameters, sig.resolvedReturnType, sig.typePredicate, sig.minArgumentCount, sig.hasRestParameter, sig.hasStringLiterals); + return createSignature(sig.declaration, sig.typeParameters, sig.thisType, sig.parameters, sig.resolvedReturnType, sig.typePredicate, sig.minArgumentCount, sig.hasRestParameter, sig.hasStringLiterals); } function getDefaultConstructSignatures(classType) { var baseConstructorType = getBaseConstructorTypeOfClass(classType); var baseSignatures = getSignaturesOfType(baseConstructorType, 1); if (baseSignatures.length === 0) { - return [createSignature(undefined, classType.localTypeParameters, emptyArray, classType, undefined, 0, false, false)]; + return [createSignature(undefined, classType.localTypeParameters, undefined, emptyArray, classType, undefined, 0, false, false)]; } var baseTypeNode = getBaseTypeNodeOfClass(classType); var typeArguments = ts.map(baseTypeNode.typeArguments, getTypeFromTypeNode); @@ -14512,10 +14879,10 @@ var ts; addInheritedMembers(members, arrayType.properties); setObjectTypeMembers(type, members, arrayType.callSignatures, arrayType.constructSignatures, arrayType.stringIndexInfo, arrayType.numberIndexInfo); } - function findMatchingSignature(signatureList, signature, partialMatch, ignoreReturnTypes) { + function findMatchingSignature(signatureList, signature, partialMatch, ignoreThisTypes, ignoreReturnTypes) { for (var _i = 0, signatureList_1 = signatureList; _i < signatureList_1.length; _i++) { var s = signatureList_1[_i]; - if (compareSignaturesIdentical(s, signature, partialMatch, ignoreReturnTypes, compareTypesIdentical)) { + if (compareSignaturesIdentical(s, signature, partialMatch, ignoreThisTypes, ignoreReturnTypes, compareTypesIdentical)) { return s; } } @@ -14526,7 +14893,7 @@ var ts; return undefined; } for (var i = 1; i < signatureLists.length; i++) { - if (!findMatchingSignature(signatureLists[i], signature, false, false)) { + if (!findMatchingSignature(signatureLists[i], signature, false, false, false)) { return undefined; } } @@ -14534,7 +14901,7 @@ var ts; } var result = undefined; for (var i = 0; i < signatureLists.length; i++) { - var match = i === listIndex ? signature : findMatchingSignature(signatureLists[i], signature, true, true); + var match = i === listIndex ? signature : findMatchingSignature(signatureLists[i], signature, true, true, true); if (!match) { return undefined; } @@ -14550,12 +14917,15 @@ var ts; for (var i = 0; i < signatureLists.length; i++) { for (var _i = 0, _a = signatureLists[i]; _i < _a.length; _i++) { var signature = _a[_i]; - if (!result || !findMatchingSignature(result, signature, false, true)) { + if (!result || !findMatchingSignature(result, signature, false, true, true)) { var unionSignatures = findMatchingSignatures(signatureLists, signature, i); if (unionSignatures) { var s = signature; if (unionSignatures.length > 1) { s = cloneSignature(signature); + if (ts.forEach(unionSignatures, function (sig) { return sig.thisType; })) { + s.thisType = getUnionType(ts.map(unionSignatures, function (sig) { return sig.thisType || anyType; })); + } s.resolvedReturnType = undefined; s.unionSignatures = unionSignatures; } @@ -14731,7 +15101,7 @@ var ts; type = globalBooleanType; } else if (type.flags & 16777216) { - type = globalESSymbolType; + type = getGlobalESSymbolType(); } return type; } @@ -14885,7 +15255,7 @@ var ts; } function isOptionalParameter(node) { if (node.flags & 134217728) { - if (node.type && node.type.kind === 264) { + if (node.type && node.type.kind === 267) { return true; } var paramTag = ts.getCorrespondingJSDocParameterTag(node); @@ -14894,7 +15264,7 @@ var ts; return true; } if (paramTag.typeExpression) { - return paramTag.typeExpression.type.kind === 264; + return paramTag.typeExpression.type.kind === 267; } } } @@ -14930,7 +15300,7 @@ var ts; function getSignatureFromDeclaration(declaration) { var links = getNodeLinks(declaration); if (!links.resolvedSignature) { - var classType = declaration.kind === 146 ? + var classType = declaration.kind === 147 ? getDeclaredTypeOfClassOrInterface(getMergedSymbol(declaration.parent.symbol)) : undefined; var typeParameters = classType ? classType.localTypeParameters : @@ -14939,6 +15309,8 @@ var ts; var parameters = []; var hasStringLiterals = false; var minArgumentCount = -1; + var thisType = undefined; + var hasThisParameter = void 0; var isJSConstructSignature = ts.isJSDocConstructSignature(declaration); var returnType = undefined; var typePredicate = undefined; @@ -14949,13 +15321,19 @@ var ts; var resolvedSymbol = resolveName(param, paramSymbol.name, 107455, undefined, undefined); paramSymbol = resolvedSymbol; } - parameters.push(paramSymbol); - if (param.type && param.type.kind === 164) { + if (i === 0 && paramSymbol.name === "this") { + hasThisParameter = true; + thisType = param.type ? getTypeFromTypeNode(param.type) : unknownType; + } + else { + parameters.push(paramSymbol); + } + if (param.type && param.type.kind === 165) { hasStringLiterals = true; } if (param.initializer || param.questionToken || param.dotDotDotToken) { if (minArgumentCount < 0) { - minArgumentCount = i; + minArgumentCount = i - (hasThisParameter ? 1 : 0); } } else { @@ -14963,7 +15341,7 @@ var ts; } } if (minArgumentCount < 0) { - minArgumentCount = declaration.parameters.length; + minArgumentCount = declaration.parameters.length - (hasThisParameter ? 1 : 0); } if (isJSConstructSignature) { minArgumentCount--; @@ -14974,7 +15352,7 @@ var ts; } else if (declaration.type) { returnType = getTypeFromTypeNode(declaration.type); - if (declaration.type.kind === 152) { + if (declaration.type.kind === 153) { typePredicate = createTypePredicateFromTypePredicateNode(declaration.type); } } @@ -14985,15 +15363,15 @@ var ts; returnType = type; } } - if (declaration.kind === 147 && !ts.hasDynamicName(declaration)) { - var setter = ts.getDeclarationOfKind(declaration.symbol, 148); + if (declaration.kind === 148 && !ts.hasDynamicName(declaration)) { + var setter = ts.getDeclarationOfKind(declaration.symbol, 149); returnType = getAnnotatedAccessorType(setter); } if (!returnType && ts.nodeIsMissing(declaration.body)) { returnType = anyType; } } - links.resolvedSignature = createSignature(declaration, typeParameters, parameters, returnType, typePredicate, minArgumentCount, ts.hasRestParameter(declaration), hasStringLiterals); + links.resolvedSignature = createSignature(declaration, typeParameters, thisType, parameters, returnType, typePredicate, minArgumentCount, ts.hasRestParameter(declaration), hasStringLiterals); } return links.resolvedSignature; } @@ -15004,20 +15382,20 @@ var ts; for (var i = 0, len = symbol.declarations.length; i < len; i++) { var node = symbol.declarations[i]; switch (node.kind) { - case 154: case 155: - case 217: - case 145: - case 144: + case 156: + case 219: case 146: - case 149: + case 145: + case 147: case 150: case 151: - case 147: + case 152: case 148: - case 177: + case 149: case 178: - case 265: + case 179: + case 268: if (i > 0 && node.body) { var previous = symbol.declarations[i - 1]; if (node.parent === previous.parent && node.kind === previous.kind && node.pos === previous.end) { @@ -15044,7 +15422,7 @@ var ts; if (!pushTypeResolution(signature, 3)) { return unknownType; } - var type; + var type = void 0; if (signature.target) { type = instantiateType(getReturnTypeOfSignature(signature.target), signature.mapper); } @@ -15097,7 +15475,7 @@ var ts; } function getOrCreateTypeFromSignature(signature) { if (!signature.isolatedSignatureType) { - var isConstructor = signature.declaration.kind === 146 || signature.declaration.kind === 150; + var isConstructor = signature.declaration.kind === 147 || signature.declaration.kind === 151; var type = createObjectType(65536 | 262144); type.members = emptySymbols; type.properties = emptyArray; @@ -15138,7 +15516,7 @@ var ts; return undefined; } function getConstraintDeclaration(type) { - return ts.getDeclarationOfKind(type.symbol, 139).constraint; + return ts.getDeclarationOfKind(type.symbol, 140).constraint; } function hasConstraintReferenceTo(type, target) { var checked; @@ -15171,7 +15549,7 @@ var ts; return typeParameter.constraint === noConstraintType ? undefined : typeParameter.constraint; } function getParentSymbolOfTypeParameter(typeParameter) { - return getSymbolOfNode(ts.getDeclarationOfKind(typeParameter.symbol, 139).parent); + return getSymbolOfNode(ts.getDeclarationOfKind(typeParameter.symbol, 140).parent); } function getTypeListId(types) { if (types) { @@ -15193,11 +15571,13 @@ var ts; } return ""; } - function getPropagatingFlagsOfTypes(types) { + function getPropagatingFlagsOfTypes(types, excludeKinds) { var result = 0; for (var _i = 0, types_3 = types; _i < types_3.length; _i++) { var type = types_3[_i]; - result |= type.flags; + if (!(type.flags & excludeKinds)) { + result |= type.flags; + } } return result & 14680064; } @@ -15205,7 +15585,8 @@ var ts; var id = getTypeListId(typeArguments); var type = target.instantiations[id]; if (!type) { - var flags = 4096 | (typeArguments ? getPropagatingFlagsOfTypes(typeArguments) : 0); + var propagatedFlags = typeArguments ? getPropagatingFlagsOfTypes(typeArguments, 0) : 0; + var flags = 4096 | propagatedFlags; type = target.instantiations[id] = createObjectType(flags, target.symbol); type.target = target; type.typeArguments = typeArguments; @@ -15213,7 +15594,7 @@ var ts; return type; } function getTypeFromClassOrInterfaceReference(node, symbol) { - var type = getDeclaredTypeOfSymbol(symbol); + var type = getDeclaredTypeOfSymbol(getMergedSymbol(symbol)); var typeParameters = type.localTypeParameters; if (typeParameters) { if (!node.typeArguments || node.typeArguments.length !== typeParameters.length) { @@ -15256,11 +15637,11 @@ var ts; } function getTypeReferenceName(node) { switch (node.kind) { - case 153: + case 154: return node.typeName; - case 263: + case 266: return node.name; - case 192: + case 193: if (ts.isSupportedExpressionWithTypeArguments(node)) { return node.expression; } @@ -15283,7 +15664,7 @@ var ts; if (symbol.flags & 524288) { return getTypeFromTypeAliasReference(node, symbol); } - if (symbol.flags & 107455 && node.kind === 263) { + if (symbol.flags & 107455 && node.kind === 266) { return getTypeOfSymbol(symbol); } return getTypeFromNonGenericTypeReference(node, symbol); @@ -15291,9 +15672,9 @@ var ts; function getTypeFromTypeReference(node) { var links = getNodeLinks(node); if (!links.resolvedType) { - var symbol; - var type; - if (node.kind === 263) { + var symbol = void 0; + var type = void 0; + if (node.kind === 266) { var typeReferenceName = getTypeReferenceName(node); symbol = resolveTypeReferenceName(node, typeReferenceName); type = getTypeReferenceType(node, symbol); @@ -15301,7 +15682,7 @@ var ts; links.resolvedType = type; } else { - var typeNameOrExpression = node.kind === 153 ? node.typeName : + var typeNameOrExpression = node.kind === 154 ? node.typeName : ts.isSupportedExpressionWithTypeArguments(node) ? node.expression : undefined; symbol = typeNameOrExpression && resolveEntityName(typeNameOrExpression, 793056) || unknownSymbol; @@ -15328,9 +15709,9 @@ var ts; for (var _i = 0, declarations_3 = declarations; _i < declarations_3.length; _i++) { var declaration = declarations_3[_i]; switch (declaration.kind) { - case 218: - case 219: + case 220: case 221: + case 223: return declaration; } } @@ -15367,9 +15748,6 @@ var ts; var typeSymbol = namespaceSymbol && getSymbol(namespaceSymbol.exports, name, 793056); return typeSymbol && getDeclaredTypeOfSymbol(typeSymbol); } - function getGlobalESSymbolConstructorSymbol() { - return globalESSymbolConstructorSymbol || (globalESSymbolConstructorSymbol = getGlobalValueSymbol("Symbol")); - } function createTypedPropertyDescriptorType(propertyType) { var globalTypedPropertyDescriptorType = getGlobalTypedPropertyDescriptorType(); return globalTypedPropertyDescriptorType !== emptyGenericType @@ -15380,10 +15758,10 @@ var ts; return genericGlobalType !== emptyGenericType ? createTypeReference(genericGlobalType, typeArguments) : emptyObjectType; } function createIterableType(elementType) { - return createTypeFromGenericGlobalType(globalIterableType, [elementType]); + return createTypeFromGenericGlobalType(getGlobalIterableType(), [elementType]); } function createIterableIteratorType(elementType) { - return createTypeFromGenericGlobalType(globalIterableIteratorType, [elementType]); + return createTypeFromGenericGlobalType(getGlobalIterableIteratorType(), [elementType]); } function createArrayType(elementType) { return createTypeFromGenericGlobalType(globalArrayType, [elementType]); @@ -15400,7 +15778,8 @@ var ts; return tupleTypes[id] || (tupleTypes[id] = createNewTupleType(elementTypes)); } function createNewTupleType(elementTypes) { - var type = createObjectType(8192 | getPropagatingFlagsOfTypes(elementTypes)); + var propagatedFlags = getPropagatingFlagsOfTypes(elementTypes, 0); + var type = createObjectType(8192 | propagatedFlags); type.elementTypes = elementTypes; return type; } @@ -15415,6 +15794,14 @@ var ts; if (type.flags & typeSetKind) { addTypesToSet(typeSet, type.types, typeSetKind); } + else if (type.flags & (1 | 32 | 64)) { + if (type.flags & 1) + typeSet.containsAny = true; + if (type.flags & 32) + typeSet.containsUndefined = true; + if (type.flags & 64) + typeSet.containsNull = true; + } else if (!ts.contains(typeSet, type)) { typeSet.push(type); } @@ -15442,47 +15829,35 @@ var ts; } } } - function containsTypeAny(types) { - for (var _i = 0, types_5 = types; _i < types_5.length; _i++) { - var type = types_5[_i]; - if (isTypeAny(type)) { - return true; - } - } - return false; - } - function removeAllButLast(types, typeToRemove) { - var i = types.length; - while (i > 0 && types.length > 1) { - i--; - if (types[i] === typeToRemove) { - types.splice(i, 1); - } - } - } function getUnionType(types, noSubtypeReduction) { if (types.length === 0) { return emptyUnionType; } var typeSet = []; addTypesToSet(typeSet, types, 16384); - if (containsTypeAny(typeSet)) { + if (typeSet.containsAny) { return anyType; } - if (noSubtypeReduction) { - removeAllButLast(typeSet, undefinedType); - removeAllButLast(typeSet, nullType); + if (strictNullChecks) { + if (typeSet.containsNull) + typeSet.push(nullType); + if (typeSet.containsUndefined) + typeSet.push(undefinedType); } - else { + if (!noSubtypeReduction) { removeSubtypes(typeSet); } - if (typeSet.length === 1) { + if (typeSet.length === 0) { + return typeSet.containsNull ? nullType : undefinedType; + } + else if (typeSet.length === 1) { return typeSet[0]; } var id = getTypeListId(typeSet); var type = unionTypes[id]; if (!type) { - type = unionTypes[id] = createObjectType(16384 | getPropagatingFlagsOfTypes(typeSet)); + var propagatedFlags = getPropagatingFlagsOfTypes(typeSet, 96); + type = unionTypes[id] = createObjectType(16384 | propagatedFlags); type.types = typeSet; } return type; @@ -15500,16 +15875,23 @@ var ts; } var typeSet = []; addTypesToSet(typeSet, types, 32768); - if (containsTypeAny(typeSet)) { + if (typeSet.containsAny) { return anyType; } + if (strictNullChecks) { + if (typeSet.containsNull) + typeSet.push(nullType); + if (typeSet.containsUndefined) + typeSet.push(undefinedType); + } if (typeSet.length === 1) { return typeSet[0]; } var id = getTypeListId(typeSet); var type = intersectionTypes[id]; if (!type) { - type = intersectionTypes[id] = createObjectType(32768 | getPropagatingFlagsOfTypes(typeSet)); + var propagatedFlags = getPropagatingFlagsOfTypes(typeSet, 96); + type = intersectionTypes[id] = createObjectType(32768 | propagatedFlags); type.types = typeSet; } return type; @@ -15562,9 +15944,9 @@ var ts; function getThisType(node) { var container = ts.getThisContainer(node, false); var parent = container && container.parent; - if (parent && (ts.isClassLike(parent) || parent.kind === 219)) { + if (parent && (ts.isClassLike(parent) || parent.kind === 221)) { if (!(container.flags & 32) && - (container.kind !== 146 || ts.isNodeDescendentOf(node, container.body))) { + (container.kind !== 147 || ts.isNodeDescendentOf(node, container.body))) { return getDeclaredTypeOfClassOrInterface(getSymbolOfNode(parent)).thisType; } } @@ -15581,8 +15963,8 @@ var ts; function getTypeFromTypeNode(node) { switch (node.kind) { case 117: - case 254: - case 255: + case 257: + case 258: return anyType; case 131: return stringType; @@ -15594,49 +15976,53 @@ var ts; return esSymbolType; case 103: return voidType; - case 163: - return getTypeFromThisTypeNode(node); + case 134: + return undefinedType; + case 93: + return nullType; case 164: + return getTypeFromThisTypeNode(node); + case 165: return getTypeFromStringLiteralTypeNode(node); + case 154: + case 266: + return getTypeFromTypeReference(node); case 153: - case 263: - return getTypeFromTypeReference(node); - case 152: return booleanType; - case 192: + case 193: return getTypeFromTypeReference(node); - case 156: + case 157: return getTypeFromTypeQueryNode(node); - case 158: - case 256: - return getTypeFromArrayTypeNode(node); case 159: - return getTypeFromTupleTypeNode(node); - case 160: - case 257: - return getTypeFromUnionTypeNode(node); - case 161: - return getTypeFromIntersectionTypeNode(node); - case 162: case 259: + return getTypeFromArrayTypeNode(node); + case 160: + return getTypeFromTupleTypeNode(node); + case 161: case 260: + return getTypeFromUnionTypeNode(node); + case 162: + return getTypeFromIntersectionTypeNode(node); + case 163: + case 262: + case 263: + case 270: + case 271: case 267: + return getTypeFromTypeNode(node.type); + case 155: + case 156: + case 158: case 268: case 264: - return getTypeFromTypeNode(node.type); - case 154: - case 155: - case 157: - case 265: - case 261: return getTypeFromTypeLiteralOrFunctionOrConstructorTypeNode(node); case 69: - case 137: + case 138: var symbol = getSymbolAtLocation(node); return symbol && getDeclaredTypeOfSymbol(symbol); - case 258: + case 261: return getTypeFromJSDocTupleType(node); - case 266: + case 269: return getTypeFromJSDocVariadicType(node); default: return unknownType; @@ -15659,40 +16045,26 @@ var ts; function createBinaryTypeMapper(source1, target1, source2, target2) { return function (t) { return t === source1 ? target1 : t === source2 ? target2 : t; }; } - function createTypeMapper(sources, targets) { - switch (sources.length) { - case 1: return createUnaryTypeMapper(sources[0], targets[0]); - case 2: return createBinaryTypeMapper(sources[0], targets[0], sources[1], targets[1]); - } + function createArrayTypeMapper(sources, targets) { return function (t) { for (var i = 0; i < sources.length; i++) { if (t === sources[i]) { - return targets[i]; + return targets ? targets[i] : anyType; } } return t; }; } - function createUnaryTypeEraser(source) { - return function (t) { return t === source ? anyType : t; }; - } - function createBinaryTypeEraser(source1, source2) { - return function (t) { return t === source1 || t === source2 ? anyType : t; }; + function createTypeMapper(sources, targets) { + var count = sources.length; + var mapper = count == 1 ? createUnaryTypeMapper(sources[0], targets ? targets[0] : anyType) : + count == 2 ? createBinaryTypeMapper(sources[0], targets ? targets[0] : anyType, sources[1], targets ? targets[1] : anyType) : + createArrayTypeMapper(sources, targets); + mapper.mappedTypes = sources; + return mapper; } function createTypeEraser(sources) { - switch (sources.length) { - case 1: return createUnaryTypeEraser(sources[0]); - case 2: return createBinaryTypeEraser(sources[0], sources[1]); - } - return function (t) { - for (var _i = 0, sources_1 = sources; _i < sources_1.length; _i++) { - var source = sources_1[_i]; - if (t === source) { - return anyType; - } - } - return t; - }; + return createTypeMapper(sources, undefined); } function getInferenceMapper(context) { if (!context.mapper) { @@ -15706,6 +16078,7 @@ var ts; } return t; }; + mapper.mappedTypes = context.typeParameters; mapper.context = context; context.mapper = mapper; } @@ -15715,7 +16088,9 @@ var ts; return type; } function combineTypeMappers(mapper1, mapper2) { - return function (t) { return instantiateType(mapper1(t), mapper2); }; + var mapper = function (t) { return instantiateType(mapper1(t), mapper2); }; + mapper.mappedTypes = mapper1.mappedTypes; + return mapper; } function cloneTypeParameter(typeParameter) { var result = createType(512); @@ -15753,7 +16128,7 @@ var ts; if (signature.typePredicate) { freshTypePredicate = cloneTypePredicate(signature.typePredicate, mapper); } - var result = createSignature(signature.declaration, freshTypeParameters, instantiateList(signature.parameters, mapper, instantiateSymbol), instantiateType(signature.resolvedReturnType, mapper), freshTypePredicate, signature.minArgumentCount, signature.hasRestParameter, signature.hasStringLiterals); + var result = createSignature(signature.declaration, freshTypeParameters, signature.thisType && instantiateType(signature.thisType, mapper), instantiateList(signature.parameters, mapper, instantiateSymbol), instantiateType(signature.resolvedReturnType, mapper), freshTypePredicate, signature.minArgumentCount, signature.hasRestParameter, signature.hasStringLiterals); result.target = signature; result.mapper = mapper; return result; @@ -15790,13 +16165,61 @@ var ts; mapper.instantiations[type.id] = result; return result; } + function isSymbolInScopeOfMappedTypeParameter(symbol, mapper) { + var mappedTypes = mapper.mappedTypes; + var node = symbol.declarations[0].parent; + while (node) { + switch (node.kind) { + case 155: + case 156: + case 219: + case 146: + case 145: + case 147: + case 150: + case 151: + case 152: + case 148: + case 149: + case 178: + case 179: + case 220: + case 191: + case 221: + case 222: + var declaration = node; + if (declaration.typeParameters) { + for (var _i = 0, _a = declaration.typeParameters; _i < _a.length; _i++) { + var d = _a[_i]; + if (ts.contains(mappedTypes, getDeclaredTypeOfTypeParameter(d.symbol))) { + return true; + } + } + } + if (ts.isClassLike(node) || node.kind === 221) { + var thisType = getDeclaredTypeOfClassOrInterface(getSymbolOfNode(node)).thisType; + if (thisType && ts.contains(mappedTypes, thisType)) { + return true; + } + } + break; + case 224: + case 255: + return false; + } + node = node.parent; + } + return false; + } function instantiateType(type, mapper) { if (type && mapper !== identityMapper) { if (type.flags & 512) { return mapper(type); } if (type.flags & 65536) { - return type.symbol && type.symbol.flags & (16 | 8192 | 32 | 2048 | 4096) ? + return type.symbol && + type.symbol.flags & (16 | 8192 | 32 | 2048 | 4096) && + (type.flags & 131072 || isSymbolInScopeOfMappedTypeParameter(type.symbol, mapper)) ? instantiateAnonymousType(type, mapper) : type; } if (type.flags & 4096) { @@ -15818,33 +16241,35 @@ var ts; return info && createIndexInfo(instantiateType(info.type, mapper), info.isReadonly, info.declaration); } function isContextSensitive(node) { - ts.Debug.assert(node.kind !== 145 || ts.isObjectLiteralMethod(node)); + ts.Debug.assert(node.kind !== 146 || ts.isObjectLiteralMethod(node)); switch (node.kind) { - case 177: case 178: + case 179: return isContextSensitiveFunctionLikeDeclaration(node); - case 169: + case 170: return ts.forEach(node.properties, isContextSensitive); - case 168: + case 169: return ts.forEach(node.elements, isContextSensitive); - case 186: + case 187: return isContextSensitive(node.whenTrue) || isContextSensitive(node.whenFalse); - case 185: + case 186: return node.operatorToken.kind === 52 && (isContextSensitive(node.left) || isContextSensitive(node.right)); - case 249: + case 252: return isContextSensitive(node.initializer); + case 146: case 145: - case 144: return isContextSensitiveFunctionLikeDeclaration(node); - case 176: + case 177: return isContextSensitive(node.expression); } return false; } function isContextSensitiveFunctionLikeDeclaration(node) { - return !node.typeParameters && node.parameters.length && !ts.forEach(node.parameters, function (p) { return p.type; }); + var areAllParametersUntyped = !ts.forEach(node.parameters, function (p) { return p.type; }); + var isNullaryArrow = node.kind === 179 && !node.parameters.length; + return !node.typeParameters && areAllParametersUntyped && !isNullaryArrow; } function getTypeWithoutSignatures(type) { if (type.flags & 80896) { @@ -15875,12 +16300,18 @@ var ts; function isTypeAssignableTo(source, target) { return checkTypeAssignableTo(source, target, undefined); } + function isTypeComparableTo(source, target) { + return checkTypeComparableTo(source, target, undefined); + } function checkTypeSubtypeOf(source, target, errorNode, headMessage, containingMessageChain) { return checkTypeRelatedTo(source, target, subtypeRelation, errorNode, headMessage, containingMessageChain); } function checkTypeAssignableTo(source, target, errorNode, headMessage, containingMessageChain) { return checkTypeRelatedTo(source, target, assignableRelation, errorNode, headMessage, containingMessageChain); } + function checkTypeComparableTo(source, target, errorNode, headMessage, containingMessageChain) { + return checkTypeRelatedTo(source, target, comparableRelation, errorNode, headMessage, containingMessageChain); + } function isSignatureAssignableTo(source, target, ignoreReturnTypes) { return compareSignaturesRelated(source, target, ignoreReturnTypes, false, undefined, compareTypesAssignable) !== 0; } @@ -15894,15 +16325,26 @@ var ts; source = getErasedSignature(source); target = getErasedSignature(target); var result = -1; + if (source.thisType && target.thisType && source.thisType !== voidType) { + var related = compareTypes(source.thisType, target.thisType, false) + || compareTypes(target.thisType, source.thisType, reportErrors); + if (!related) { + if (reportErrors) { + errorReporter(ts.Diagnostics.The_this_types_of_each_signature_are_incompatible); + } + return 0; + } + result &= related; + } var sourceMax = getNumNonRestParameters(source); var targetMax = getNumNonRestParameters(target); var checkCount = getNumParametersToCheckForSignatureRelatability(source, sourceMax, target, targetMax); var sourceParams = source.parameters; var targetParams = target.parameters; for (var i = 0; i < checkCount; i++) { - var s = i < sourceMax ? getTypeOfSymbol(sourceParams[i]) : getRestTypeOfSignature(source); - var t = i < targetMax ? getTypeOfSymbol(targetParams[i]) : getRestTypeOfSignature(target); - var related = compareTypes(t, s, false) || compareTypes(s, t, reportErrors); + var s = i < sourceMax ? getTypeOfParameter(sourceParams[i]) : getRestTypeOfSignature(source); + var t = i < targetMax ? getTypeOfParameter(targetParams[i]) : getRestTypeOfSignature(target); + var related = compareTypes(s, t, false) || compareTypes(t, s, reportErrors); if (!related) { if (reportErrors) { errorReporter(ts.Diagnostics.Types_of_parameters_0_and_1_are_incompatible, sourceParams[i < sourceMax ? i : sourceMax].name, targetParams[i < targetMax ? i : targetMax].name); @@ -16023,7 +16465,12 @@ var ts; sourceType = typeToString(source, undefined, 128); targetType = typeToString(target, undefined, 128); } - reportError(message || ts.Diagnostics.Type_0_is_not_assignable_to_type_1, sourceType, targetType); + 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; + } + reportError(message, sourceType, targetType); } function isRelatedTo(source, target, reportErrors, headMessage) { var result; @@ -16034,20 +16481,24 @@ var ts; } if (isTypeAny(target)) return -1; - if (source === undefinedType) - return -1; - if (source === nullType && target !== undefinedType) - return -1; + if (source.flags & 32) { + if (!strictNullChecks || target.flags & (32 | 16) || source === emptyArrayElementType) + return -1; + } + if (source.flags & 64) { + if (!strictNullChecks || target.flags & 64) + return -1; + } if (source.flags & 128 && target === numberType) return -1; if (source.flags & 128 && target.flags & 128) { - if (result = enumRelatedTo(source, target)) { + if (result = enumRelatedTo(source, target, reportErrors)) { return result; } } if (source.flags & 256 && target === stringType) return -1; - if (relation === assignableRelation) { + if (relation === assignableRelation || relation === comparableRelation) { if (isTypeAny(source)) return -1; if (source === numberType && target.flags & 128) @@ -16069,23 +16520,30 @@ var ts; } var saveErrorInfo = errorInfo; if (source.flags & 16384) { - if (result = eachTypeRelatedToType(source, target, reportErrors)) { + if (relation === comparableRelation) { + result = someTypeRelatedToType(source, target, reportErrors); + } + else { + result = eachTypeRelatedToType(source, target, reportErrors); + } + if (result) { return result; } } else if (target.flags & 32768) { - if (result = typeRelatedToEachType(source, target, reportErrors)) { + result = typeRelatedToEachType(source, target, reportErrors); + if (result) { return result; } } else { if (source.flags & 32768) { - if (result = someTypeRelatedToType(source, target, reportErrors && !(target.flags & 16384))) { + if (result = someTypeRelatedToType(source, target, false)) { return result; } } if (target.flags & 16384) { - if (result = typeRelatedToSomeType(source, target, reportErrors)) { + if (result = typeRelatedToSomeType(source, target, reportErrors && !(source.flags & 16777726))) { return result; } } @@ -16133,8 +16591,8 @@ var ts; } if (source.flags & 16384 && target.flags & 16384 || source.flags & 32768 && target.flags & 32768) { - if (result = eachTypeRelatedToSomeType(source, target)) { - if (result &= eachTypeRelatedToSomeType(target, source)) { + if (result = eachTypeRelatedToSomeType(source, target, false)) { + if (result &= eachTypeRelatedToSomeType(target, source, false)) { return result; } } @@ -16144,7 +16602,8 @@ var ts; function isKnownProperty(type, name) { if (type.flags & 80896) { var resolved = resolveStructuredTypeMembers(type); - if (relation === assignableRelation && (type === globalObjectType || resolved.properties.length === 0) || + if ((relation === assignableRelation || relation === comparableRelation) && + (type === globalObjectType || resolved.properties.length === 0) || resolved.stringIndexInfo || resolved.numberIndexInfo || getPropertyOfType(type, name)) { return true; } @@ -16175,7 +16634,7 @@ var ts; } return false; } - function eachTypeRelatedToSomeType(source, target) { + function eachTypeRelatedToSomeType(source, target, reportErrors) { var result = -1; var sourceTypes = source.types; for (var _i = 0, sourceTypes_1 = sourceTypes; _i < sourceTypes_1.length; _i++) { @@ -16190,7 +16649,15 @@ var ts; } function typeRelatedToSomeType(source, target, reportErrors) { var targetTypes = target.types; - for (var i = 0, len = targetTypes.length; i < len; i++) { + var len = targetTypes.length; + while (len >= 2 && targetTypes[len - 1].flags & 96) { + var related = isRelatedTo(source, targetTypes[len - 1], false); + if (related) { + return related; + } + len--; + } + for (var i = 0; i < len; i++) { var related = isRelatedTo(source, targetTypes[i], reportErrors && i === len - 1); if (related) { return related; @@ -16213,7 +16680,15 @@ var ts; } function someTypeRelatedToType(source, target, reportErrors) { var sourceTypes = source.types; - for (var i = 0, len = sourceTypes.length; i < len; i++) { + var len = sourceTypes.length; + while (len >= 2 && sourceTypes[len - 1].flags & 96) { + var related = isRelatedTo(sourceTypes[len - 1], target, false); + if (related) { + return related; + } + len--; + } + for (var i = 0; i < len; i++) { var related = isRelatedTo(sourceTypes[i], target, reportErrors && i === len - 1); if (related) { return related; @@ -16471,7 +16946,7 @@ var ts; } var result = -1; for (var i = 0, len = sourceSignatures.length; i < len; i++) { - var related = compareSignaturesIdentical(sourceSignatures[i], targetSignatures[i], false, false, isRelatedTo); + var related = compareSignaturesIdentical(sourceSignatures[i], targetSignatures[i], false, false, false, isRelatedTo); if (!related) { return 0; } @@ -16545,7 +17020,7 @@ var ts; } return 0; } - function enumRelatedTo(source, target) { + function enumRelatedTo(source, target, reportErrors) { if (source.symbol.name !== target.symbol.name || source.symbol.flags & 128 || target.symbol.flags & 128) { @@ -16557,7 +17032,9 @@ var ts; if (property.flags & 8) { var targetProperty = getPropertyOfType(targetEnumType, property.name); if (!targetProperty || !(targetProperty.flags & 8)) { - reportError(ts.Diagnostics.Property_0_is_missing_in_type_1, property.name, typeToString(target, undefined, 128)); + if (reportErrors) { + reportError(ts.Diagnostics.Property_0_is_missing_in_type_1, property.name, typeToString(target, undefined, 128)); + } return 0; } } @@ -16651,7 +17128,7 @@ var ts; } return false; } - function compareSignaturesIdentical(source, target, partialMatch, ignoreReturnTypes, compareTypes) { + function compareSignaturesIdentical(source, target, partialMatch, ignoreThisTypes, ignoreReturnTypes, compareTypes) { if (source === target) { return -1; } @@ -16664,10 +17141,17 @@ var ts; source = getErasedSignature(source); target = getErasedSignature(target); var result = -1; + if (!ignoreThisTypes && source.thisType && target.thisType) { + var related = compareTypes(source.thisType, target.thisType); + if (!related) { + return 0; + } + result &= related; + } var targetLen = target.parameters.length; for (var i = 0; i < targetLen; i++) { - var s = isRestParameterIndex(source, i) ? getRestTypeOfSignature(source) : getTypeOfSymbol(source.parameters[i]); - var t = isRestParameterIndex(target, i) ? getRestTypeOfSignature(target) : getTypeOfSymbol(target.parameters[i]); + var s = isRestParameterIndex(source, i) ? getRestTypeOfSignature(source) : getTypeOfParameter(source.parameters[i]); + var t = isRestParameterIndex(target, i) ? getRestTypeOfSignature(target) : getTypeOfParameter(target.parameters[i]); var related = compareTypes(s, t); if (!related) { return 0; @@ -16683,15 +17167,31 @@ var ts; return signature.hasRestParameter && parameterIndex >= signature.parameters.length - 1; } function isSupertypeOfEach(candidate, types) { - for (var _i = 0, types_6 = types; _i < types_6.length; _i++) { - var type = types_6[_i]; - if (candidate !== type && !isTypeSubtypeOf(type, candidate)) + for (var _i = 0, types_5 = types; _i < types_5.length; _i++) { + var t = types_5[_i]; + if (candidate !== t && !isTypeSubtypeOf(t, candidate)) return false; } return true; } + function getCombinedFlagsOfTypes(types) { + var flags = 0; + for (var _i = 0, types_6 = types; _i < types_6.length; _i++) { + var t = types_6[_i]; + flags |= t.flags; + } + return flags; + } function getCommonSupertype(types) { - return ts.forEach(types, function (t) { return isSupertypeOfEach(t, types) ? t : undefined; }); + if (!strictNullChecks) { + return ts.forEach(types, function (t) { return isSupertypeOfEach(t, types) ? t : undefined; }); + } + var primaryTypes = ts.filter(types, function (t) { return !(t.flags & 96); }); + if (!primaryTypes.length) { + return getUnionType(types); + } + var supertype = ts.forEach(primaryTypes, function (t) { return isSupertypeOfEach(t, primaryTypes) ? t : undefined; }); + return supertype && addNullableKind(supertype, getCombinedFlagsOfTypes(types) & 96); } function reportNoCommonSupertypeError(types, errorLocation, errorMessageChainHead) { var bestSupertype; @@ -16725,7 +17225,7 @@ var ts; } function isArrayLikeType(type) { return type.flags & 4096 && (type.target === globalArrayType || type.target === globalReadonlyArrayType) || - !(type.flags & (32 | 64)) && isTypeAssignableTo(type, anyReadonlyArrayType); + !(type.flags & 96) && isTypeAssignableTo(type, anyReadonlyArrayType); } function isTupleLikeType(type) { return !!getPropertyOfType(type, "0"); @@ -16736,6 +17236,60 @@ var ts; function isTupleType(type) { return !!(type.flags & 8192); } + function getNullableKind(type) { + var flags = type.flags; + if (flags & 16384) { + for (var _i = 0, _a = type.types; _i < _a.length; _i++) { + var t = _a[_i]; + flags |= t.flags; + } + } + return flags & 96; + } + function getNullableTypeOfKind(kind) { + return kind & 64 ? kind & 32 ? + getUnionType([nullType, undefinedType]) : nullType : undefinedType; + } + function addNullableKind(type, kind) { + if ((getNullableKind(type) & kind) !== kind) { + var types = [type]; + if (kind & 32) { + types.push(undefinedType); + } + if (kind & 64) { + types.push(nullType); + } + type = getUnionType(types); + } + return type; + } + function removeNullableKind(type, kind) { + if (type.flags & 16384 && getNullableKind(type) & kind) { + var firstType = void 0; + var types = void 0; + for (var _i = 0, _a = type.types; _i < _a.length; _i++) { + var t = _a[_i]; + if (!(t.flags & kind)) { + if (!firstType) { + firstType = t; + } + else { + if (!types) { + types = [firstType]; + } + types.push(t); + } + } + } + if (firstType) { + type = types ? getUnionType(types) : firstType; + } + } + return type; + } + function getNonNullableType(type) { + return strictNullChecks ? removeNullableKind(type, 96) : type; + } function isObjectLiteralType(type) { return type.symbol && (type.symbol.flags & (4096 | 2048)) !== 0 && getSignaturesOfType(type, 0).length === 0 && @@ -16781,16 +17335,19 @@ var ts; var numberIndexInfo = getIndexInfoOfType(type, 1); return createAnonymousType(type.symbol, members, emptyArray, emptyArray, stringIndexInfo && createIndexInfo(getWidenedType(stringIndexInfo.type), stringIndexInfo.isReadonly), numberIndexInfo && createIndexInfo(getWidenedType(numberIndexInfo.type), numberIndexInfo.isReadonly)); } + function getWidenedConstituentType(type) { + return type.flags & 96 ? type : getWidenedType(type); + } function getWidenedType(type) { if (type.flags & 6291456) { - if (type.flags & (32 | 64)) { + if (type.flags & 96) { return anyType; } if (type.flags & 524288) { return getWidenedTypeOfObjectLiteral(type); } if (type.flags & 16384) { - return getUnionType(ts.map(type.types, getWidenedType), true); + return getUnionType(ts.map(type.types, getWidenedConstituentType), true); } if (isArrayType(type)) { return createArrayType(getWidenedType(type.typeArguments[0])); @@ -16840,22 +17397,25 @@ var ts; var typeAsString = typeToString(getWidenedType(type)); var diagnostic; switch (declaration.kind) { + case 144: case 143: - case 142: diagnostic = ts.Diagnostics.Member_0_implicitly_has_an_1_type; break; - case 140: + case 141: diagnostic = declaration.dotDotDotToken ? ts.Diagnostics.Rest_parameter_0_implicitly_has_an_any_type : ts.Diagnostics.Parameter_0_implicitly_has_an_1_type; break; - case 217: + case 168: + diagnostic = ts.Diagnostics.Binding_element_0_implicitly_has_an_1_type; + break; + case 219: + case 146: case 145: - case 144: - case 147: case 148: - case 177: + case 149: case 178: + case 179: if (!declaration.name) { error(declaration, ts.Diagnostics.Function_expression_which_lacks_return_type_annotation_implicitly_has_an_0_return_type, typeAsString); return; @@ -16879,25 +17439,19 @@ var ts; var targetMax = target.parameters.length; var count; if (source.hasRestParameter && target.hasRestParameter) { - count = sourceMax > targetMax ? sourceMax : targetMax; - sourceMax--; - targetMax--; + count = Math.max(sourceMax, targetMax); } else if (source.hasRestParameter) { - sourceMax--; count = targetMax; } else if (target.hasRestParameter) { - targetMax--; count = sourceMax; } else { - count = sourceMax < targetMax ? sourceMax : targetMax; + count = Math.min(sourceMax, targetMax); } for (var i = 0; i < count; i++) { - var s = i < sourceMax ? getTypeOfSymbol(source.parameters[i]) : getRestTypeOfSignature(source); - var t = i < targetMax ? getTypeOfSymbol(target.parameters[i]) : getRestTypeOfSignature(target); - callback(s, t); + callback(getTypeAtPosition(source, i), getTypeAtPosition(target, i)); } } function createInferenceContext(typeParameters, inferUnionTypes) { @@ -16934,7 +17488,7 @@ var ts; function inferFromTypes(source, target) { if (source.flags & 16384 && target.flags & 16384 || source.flags & 32768 && target.flags & 32768) { - var matchingTypes; + var matchingTypes = void 0; for (var _i = 0, _a = target.types; _i < _a.length; _i++) { var t = _a[_i]; if (typeIdenticalToSomeType(t, source.types)) { @@ -16985,7 +17539,7 @@ var ts; else if (target.flags & 49152) { var targetTypes = target.types; var typeParameterCount = 0; - var typeParameter; + var typeParameter = void 0; for (var _b = 0, targetTypes_2 = targetTypes; _b < targetTypes_2.length; _b++) { var t = targetTypes_2[_b]; if (t.flags & 512 && ts.contains(context.typeParameters, t)) { @@ -17148,20 +17702,31 @@ var ts; } return context.inferredTypes; } + function createTransientIdentifier(symbol, location) { + var result = ts.createNode(69); + result.text = symbol.name; + result.resolvedSymbol = symbol; + result.parent = location; + result.id = -1; + return result; + } function getResolvedSymbol(node) { + if (node.id === -1) { + return node.resolvedSymbol; + } var links = getNodeLinks(node); if (!links.resolvedSymbol) { - links.resolvedSymbol = (!ts.nodeIsMissing(node) && resolveName(node, node.text, 107455 | 1048576, ts.Diagnostics.Cannot_find_name_0, node)) || unknownSymbol; + links.resolvedSymbol = !ts.nodeIsMissing(node) && resolveName(node, node.text, 107455 | 1048576, ts.Diagnostics.Cannot_find_name_0, node) || unknownSymbol; } return links.resolvedSymbol; } function isInTypeQuery(node) { while (node) { switch (node.kind) { - case 156: + case 157: return true; case 69: - case 137: + case 138: node = node.parent; continue; default: @@ -17170,164 +17735,279 @@ var ts; } ts.Debug.fail("should not get here"); } + function getAssignmentKey(node) { + if (node.kind === 69) { + var symbol = getResolvedSymbol(node); + return symbol !== unknownSymbol ? "" + getSymbolId(symbol) : undefined; + } + if (node.kind === 97) { + return "0"; + } + if (node.kind === 171) { + var key = getAssignmentKey(node.expression); + return key && key + "." + node.name.text; + } + return undefined; + } function hasInitializer(node) { return !!(node.initializer || ts.isBindingPattern(node.parent) && hasInitializer(node.parent.parent)); } - function isVariableAssignedWithin(symbol, node) { - var links = getNodeLinks(node); - if (links.assignmentChecks) { - var cachedResult = links.assignmentChecks[symbol.id]; - if (cachedResult !== undefined) { - return cachedResult; - } - } - else { - links.assignmentChecks = {}; - } - return links.assignmentChecks[symbol.id] = isAssignedIn(node); - function isAssignedInBinaryExpression(node) { - if (node.operatorToken.kind >= 56 && node.operatorToken.kind <= 68) { - var n = skipParenthesizedNodes(node.left); - if (n.kind === 69 && getResolvedSymbol(n) === symbol) { - return true; + function getAssignmentMap(node) { + var assignmentMap = {}; + visit(node); + return assignmentMap; + function visitReference(node) { + if (isAssignmentTarget(node) || isCompoundAssignmentTarget(node)) { + var key = getAssignmentKey(node); + if (key) { + assignmentMap[key] = true; } } - return ts.forEachChild(node, isAssignedIn); + ts.forEachChild(node, visit); } - function isAssignedInVariableDeclaration(node) { - if (!ts.isBindingPattern(node.name) && getSymbolOfNode(node) === symbol && hasInitializer(node)) { - return true; + function visitVariableDeclaration(node) { + if (!ts.isBindingPattern(node.name) && hasInitializer(node)) { + assignmentMap[getSymbolId(getSymbolOfNode(node))] = true; } - return ts.forEachChild(node, isAssignedIn); + ts.forEachChild(node, visit); } - function isAssignedIn(node) { + function visit(node) { switch (node.kind) { - case 185: - return isAssignedInBinaryExpression(node); - case 215: - case 167: - return isAssignedInVariableDeclaration(node); - case 165: - case 166: + case 69: + case 171: + visitReference(node); + break; + case 217: case 168: + visitVariableDeclaration(node); + break; + case 186: + case 166: + case 167: case 169: case 170: - case 171: case 172: case 173: - case 175: - case 193: + case 174: case 176: - case 183: - case 179: - case 182: - case 180: - case 181: + case 194: + case 195: + case 177: case 184: - case 188: - case 186: + case 180: + case 183: + case 181: + case 182: + case 185: case 189: - case 196: - case 197: + case 187: + case 190: + case 198: case 199: - case 200: case 201: case 202: case 203: case 204: case 205: - case 208: - case 209: + case 206: + case 207: case 210: - case 245: - case 246: case 211: case 212: - case 213: + case 226: case 248: - case 237: - case 238: + case 249: + case 213: + case 214: + case 215: + case 251: + case 240: + case 241: + case 245: + case 246: case 242: - case 243: - case 239: - case 244: - return ts.forEachChild(node, isAssignedIn); + case 247: + ts.forEachChild(node, visit); + break; } - return false; } } - function getNarrowedTypeOfSymbol(symbol, node) { - var type = getTypeOfSymbol(symbol); - if (node && symbol.flags & 3) { - if (isTypeAny(type) || type.flags & (80896 | 16384 | 512)) { - var declaration = ts.getDeclarationOfKind(symbol, 215); - var top_1 = declaration && getDeclarationContainer(declaration); - var originalType = type; - var nodeStack = []; - loop: while (node.parent) { - var child = node; - node = node.parent; - switch (node.kind) { - case 200: - case 186: - case 185: - nodeStack.push({ node: node, child: child }); - break; - case 252: - case 222: - break loop; - } - if (node === top_1) { - break; - } - } - var nodes; - while (nodes = nodeStack.pop()) { - var node_1 = nodes.node, child = nodes.child; - switch (node_1.kind) { - case 200: - if (child !== node_1.expression) { - type = narrowType(type, node_1.expression, child === node_1.thenStatement); - } - break; - case 186: - if (child !== node_1.condition) { - type = narrowType(type, node_1.condition, child === node_1.whenTrue); - } - break; - case 185: - if (child === node_1.right) { - if (node_1.operatorToken.kind === 51) { - type = narrowType(type, node_1.left, true); - } - else if (node_1.operatorToken.kind === 52) { - type = narrowType(type, node_1.left, false); - } - } - break; - default: - ts.Debug.fail("Unreachable!"); - } - if (type !== originalType && isVariableAssignedWithin(symbol, node_1)) { - type = originalType; - } - } - if (type === emptyUnionType) { - type = originalType; - } + function isReferenceAssignedWithin(reference, node) { + if (reference.kind !== 97) { + var key = getAssignmentKey(reference); + if (key) { + var links = getNodeLinks(node); + return (links.assignmentMap || (links.assignmentMap = getAssignmentMap(node)))[key]; } } - return type; - function narrowTypeByEquality(type, expr, assumeTrue) { - if (expr.left.kind !== 180 || expr.right.kind !== 9) { + return false; + } + function isAnyPartOfReferenceAssignedWithin(reference, node) { + while (true) { + if (isReferenceAssignedWithin(reference, node)) { + return true; + } + if (reference.kind !== 171) { + return false; + } + reference = reference.expression; + } + } + function isNullOrUndefinedLiteral(node) { + return node.kind === 93 || + node.kind === 69 && getResolvedSymbol(node) === undefinedSymbol; + } + function getLeftmostIdentifierOrThis(node) { + switch (node.kind) { + case 69: + case 97: + return node; + case 171: + return getLeftmostIdentifierOrThis(node.expression); + } + return undefined; + } + function isMatchingReference(source, target) { + if (source.kind === target.kind) { + switch (source.kind) { + case 69: + return getResolvedSymbol(source) === getResolvedSymbol(target); + case 97: + return true; + case 171: + return source.name.text === target.name.text && + isMatchingReference(source.expression, target.expression); + } + } + return false; + } + function getNarrowedTypeOfReference(type, reference) { + if (!(type.flags & (1 | 80896 | 16384 | 512))) { + return type; + } + var leftmostNode = getLeftmostIdentifierOrThis(reference); + if (!leftmostNode) { + return type; + } + var top; + if (leftmostNode.kind === 69) { + var leftmostSymbol = getExportSymbolOfValueSymbolIfExported(getResolvedSymbol(leftmostNode)); + if (!leftmostSymbol) { return type; } + var declaration = leftmostSymbol.valueDeclaration; + if (!declaration || declaration.kind !== 217 && declaration.kind !== 141 && declaration.kind !== 168) { + return type; + } + top = getDeclarationContainer(declaration); + } + var originalType = type; + var nodeStack = []; + var node = reference; + loop: while (node.parent) { + var child = node; + node = node.parent; + switch (node.kind) { + case 202: + case 187: + case 186: + nodeStack.push({ node: node, child: child }); + break; + case 255: + case 224: + break loop; + default: + if (node === top || ts.isFunctionLikeKind(node.kind)) { + break loop; + } + break; + } + } + var nodes; + while (nodes = nodeStack.pop()) { + var node_1 = nodes.node, child = nodes.child; + switch (node_1.kind) { + case 202: + if (child !== node_1.expression) { + type = narrowType(type, node_1.expression, child === node_1.thenStatement); + } + break; + case 187: + if (child !== node_1.condition) { + type = narrowType(type, node_1.condition, child === node_1.whenTrue); + } + break; + case 186: + if (child === node_1.right) { + if (node_1.operatorToken.kind === 51) { + type = narrowType(type, node_1.left, true); + } + else if (node_1.operatorToken.kind === 52) { + type = narrowType(type, node_1.left, false); + } + } + break; + default: + ts.Debug.fail("Unreachable!"); + } + if (type !== originalType && isAnyPartOfReferenceAssignedWithin(reference, node_1)) { + type = originalType; + } + } + if (type === emptyUnionType) { + type = originalType; + } + return type; + function narrowTypeByTruthiness(type, expr, assumeTrue) { + return strictNullChecks && assumeTrue && isMatchingReference(expr, reference) ? getNonNullableType(type) : type; + } + function narrowTypeByBinaryExpression(type, expr, assumeTrue) { + switch (expr.operatorToken.kind) { + case 30: + case 31: + case 32: + case 33: + if (isNullOrUndefinedLiteral(expr.right)) { + return narrowTypeByNullCheck(type, expr, assumeTrue); + } + if (expr.left.kind === 181 && expr.right.kind === 9) { + return narrowTypeByTypeof(type, expr, assumeTrue); + } + break; + case 51: + return narrowTypeByAnd(type, expr, assumeTrue); + case 52: + return narrowTypeByOr(type, expr, assumeTrue); + case 91: + return narrowTypeByInstanceof(type, expr, assumeTrue); + } + return type; + } + function narrowTypeByNullCheck(type, expr, assumeTrue) { + var operator = expr.operatorToken.kind; + if (operator === 31 || operator === 33) { + assumeTrue = !assumeTrue; + } + if (!strictNullChecks || !isMatchingReference(expr.left, reference)) { + return type; + } + var doubleEquals = operator === 30 || operator === 31; + var exprNullableKind = doubleEquals ? 96 : + expr.right.kind === 93 ? 64 : 32; + if (assumeTrue) { + var nullableKind = getNullableKind(type) & exprNullableKind; + return nullableKind ? getNullableTypeOfKind(nullableKind) : type; + } + return removeNullableKind(type, exprNullableKind); + } + function narrowTypeByTypeof(type, expr, assumeTrue) { var left = expr.left; var right = expr.right; - if (left.expression.kind !== 69 || getResolvedSymbol(left.expression) !== symbol) { + if (!isMatchingReference(left.expression, reference)) { return type; } - if (expr.operatorToken.kind === 33) { + if (expr.operatorToken.kind === 31 || + expr.operatorToken.kind === 33) { assumeTrue = !assumeTrue; } var typeInfo = primitiveTypeInfo[right.text]; @@ -17376,7 +18056,7 @@ var ts; } } function narrowTypeByInstanceof(type, expr, assumeTrue) { - if (isTypeAny(type) || expr.left.kind !== 69 || getResolvedSymbol(expr.left) !== symbol) { + if (isTypeAny(type) || !isMatchingReference(expr.left, reference)) { return type; } var rightType = checkExpression(expr.right); @@ -17392,7 +18072,7 @@ var ts; } } if (!targetType) { - var constructSignatures; + var constructSignatures = void 0; if (rightType.flags & 2048) { constructSignatures = resolveDeclaredMembers(rightType).declaredConstructSignatures; } @@ -17421,7 +18101,8 @@ var ts; return getUnionType(assignableConstituents); } } - if (isTypeAssignableTo(narrowedTypeCandidate, originalType)) { + var targetType = originalType.flags & 512 ? getApparentType(originalType) : originalType; + if (isTypeAssignableTo(narrowedTypeCandidate, targetType)) { return narrowedTypeCandidate; } return originalType; @@ -17436,57 +18117,36 @@ var ts; return type; } if (ts.isIdentifierTypePredicate(predicate)) { - if (callExpression.arguments[predicate.parameterIndex] && - getSymbolAtTypePredicatePosition(callExpression.arguments[predicate.parameterIndex]) === symbol) { + var predicateArgument = callExpression.arguments[predicate.parameterIndex]; + if (predicateArgument && isMatchingReference(predicateArgument, reference)) { return getNarrowedType(type, predicate.type, assumeTrue); } } else { var invokedExpression = skipParenthesizedNodes(callExpression.expression); - return narrowTypeByThisTypePredicate(type, predicate, invokedExpression, assumeTrue); - } - return type; - } - function narrowTypeByThisTypePredicate(type, predicate, invokedExpression, assumeTrue) { - if (invokedExpression.kind === 171 || invokedExpression.kind === 170) { - var accessExpression = invokedExpression; - var possibleIdentifier = skipParenthesizedNodes(accessExpression.expression); - if (possibleIdentifier.kind === 69 && getSymbolAtTypePredicatePosition(possibleIdentifier) === symbol) { - return getNarrowedType(type, predicate.type, assumeTrue); + if (invokedExpression.kind === 172 || invokedExpression.kind === 171) { + var accessExpression = invokedExpression; + var possibleReference = skipParenthesizedNodes(accessExpression.expression); + if (isMatchingReference(possibleReference, reference)) { + return getNarrowedType(type, predicate.type, assumeTrue); + } } } return type; } - function getSymbolAtTypePredicatePosition(expr) { - expr = skipParenthesizedNodes(expr); - switch (expr.kind) { - case 69: - case 170: - return getSymbolOfEntityNameOrPropertyAccessExpression(expr); - } - } function narrowType(type, expr, assumeTrue) { switch (expr.kind) { - case 172: + case 69: + case 97: + case 171: + return narrowTypeByTruthiness(type, expr, assumeTrue); + case 173: return narrowTypeByTypePredicate(type, expr, assumeTrue); - case 176: + case 177: return narrowType(type, expr.expression, assumeTrue); - case 185: - var operator = expr.operatorToken.kind; - if (operator === 32 || operator === 33) { - return narrowTypeByEquality(type, expr, assumeTrue); - } - else if (operator === 51) { - return narrowTypeByAnd(type, expr, assumeTrue); - } - else if (operator === 52) { - return narrowTypeByOr(type, expr, assumeTrue); - } - else if (operator === 91) { - return narrowTypeByInstanceof(type, expr, assumeTrue); - } - break; - case 183: + case 186: + return narrowTypeByBinaryExpression(type, expr, assumeTrue); + case 184: if (expr.operator === 49) { return narrowType(type, expr.operand, !assumeTrue); } @@ -17495,17 +18155,121 @@ var ts; return type; } } + function getTypeOfSymbolAtLocation(symbol, location) { + var type = getTypeOfSymbol(symbol); + if (location.kind === 69) { + if (ts.isRightSideOfQualifiedNameOrPropertyAccess(location)) { + location = location.parent; + } + if (ts.isExpression(location)) { + checkExpression(location); + if (getNodeLinks(location).resolvedSymbol === symbol) { + return getNarrowedTypeOfReference(type, location); + } + } + } + return getNarrowedTypeOfReference(type, createTransientIdentifier(symbol, location)); + } function skipParenthesizedNodes(expression) { - while (expression.kind === 176) { + while (expression.kind === 177) { expression = expression.expression; } return expression; } + function findFirstAssignment(symbol, container) { + return visit(ts.isFunctionLike(container) ? container.body : container); + function visit(node) { + switch (node.kind) { + case 69: + var assignment = getAssignmentRoot(node); + return assignment && getResolvedSymbol(node) === symbol ? assignment : undefined; + case 186: + case 217: + case 168: + case 166: + case 167: + case 169: + case 170: + case 171: + case 172: + case 173: + case 174: + case 176: + case 194: + case 195: + case 177: + case 184: + case 180: + case 183: + case 181: + case 182: + case 185: + case 189: + case 187: + case 190: + case 199: + case 201: + case 202: + case 203: + case 204: + case 205: + case 206: + case 207: + case 210: + case 211: + case 212: + case 226: + case 248: + case 249: + case 213: + case 214: + case 215: + case 251: + case 240: + case 241: + case 245: + case 246: + case 242: + case 247: + case 198: + case 255: + return ts.forEachChild(node, visit); + } + return undefined; + } + } + function checkVariableAssignedBefore(symbol, reference) { + if (!(symbol.flags & 3)) { + return; + } + var declaration = symbol.valueDeclaration; + if (!declaration || declaration.kind !== 217 || declaration.initializer || ts.isInAmbientContext(declaration)) { + return; + } + var parentParentKind = declaration.parent.parent.kind; + if (parentParentKind === 207 || parentParentKind === 206) { + return; + } + var declarationContainer = ts.getContainingFunction(declaration) || ts.getSourceFileOfNode(declaration); + var referenceContainer = ts.getContainingFunction(reference) || ts.getSourceFileOfNode(reference); + if (declarationContainer !== referenceContainer) { + return; + } + var links = getSymbolLinks(symbol); + if (!links.firstAssignmentChecked) { + links.firstAssignmentChecked = true; + links.firstAssignment = findFirstAssignment(symbol, declarationContainer); + } + if (links.firstAssignment && links.firstAssignment.end <= reference.pos) { + return; + } + error(reference, ts.Diagnostics.Variable_0_is_used_before_being_assigned, symbolToString(symbol)); + } function checkIdentifier(node) { var symbol = getResolvedSymbol(node); if (symbol === argumentsSymbol) { var container = ts.getContainingFunction(node); - if (container.kind === 178) { + if (container.kind === 179) { if (languageVersion < 2) { error(node, ts.Diagnostics.The_arguments_object_cannot_be_referenced_in_an_arrow_function_in_ES3_and_ES5_Consider_using_a_standard_function_expression); } @@ -17520,7 +18284,7 @@ var ts; var localOrExportSymbol = getExportSymbolOfValueSymbolIfExported(symbol); if (languageVersion === 2 && localOrExportSymbol.flags & 32 - && localOrExportSymbol.valueDeclaration.kind === 218 + && localOrExportSymbol.valueDeclaration.kind === 220 && ts.nodeIsDecorated(localOrExportSymbol.valueDeclaration)) { var container = ts.getContainingClass(node); while (container !== undefined) { @@ -17535,7 +18299,11 @@ var ts; checkCollisionWithCapturedSuperVariable(node, node); checkCollisionWithCapturedThisVariable(node, node); checkNestedBlockScopedBinding(node, symbol); - return getNarrowedTypeOfSymbol(localOrExportSymbol, node); + var type = getTypeOfSymbol(localOrExportSymbol); + if (strictNullChecks && !isAssignmentTarget(node) && !(type.flags & 1) && !(getNullableKind(type) & 32)) { + checkVariableAssignedBefore(symbol, node); + } + return getNarrowedTypeOfReference(type, node); } function isInsideFunction(node, threshold) { var current = node; @@ -17550,7 +18318,7 @@ var ts; function checkNestedBlockScopedBinding(node, symbol) { if (languageVersion >= 2 || (symbol.flags & (2 | 32)) === 0 || - symbol.valueDeclaration.parent.kind === 248) { + symbol.valueDeclaration.parent.kind === 251) { return; } var container = ts.getEnclosingBlockScopeContainer(symbol.valueDeclaration); @@ -17568,8 +18336,8 @@ var ts; if (usedInFunction) { getNodeLinks(current).flags |= 65536; } - if (container.kind === 203 && - ts.getAncestor(symbol.valueDeclaration, 216).parent === container && + if (container.kind === 205 && + ts.getAncestor(symbol.valueDeclaration, 218).parent === container && isAssignedInBodyOfForStatement(node, container)) { getNodeLinks(symbol.valueDeclaration).flags |= 2097152; } @@ -17581,14 +18349,14 @@ var ts; } function isAssignedInBodyOfForStatement(node, container) { var current = node; - while (current.parent.kind === 176) { + while (current.parent.kind === 177) { current = current.parent; } var isAssigned = false; - if (current.parent.kind === 185) { - isAssigned = current.parent.left === current && ts.isAssignmentOperator(current.parent.operatorToken.kind); + if (isAssignmentTarget(current)) { + isAssigned = true; } - if ((current.parent.kind === 183 || current.parent.kind === 184)) { + else if ((current.parent.kind === 184 || current.parent.kind === 185)) { var expr = current.parent; isAssigned = expr.operator === 41 || expr.operator === 42; } @@ -17607,7 +18375,7 @@ var ts; } function captureLexicalThis(node, container) { getNodeLinks(node).flags |= 2; - if (container.kind === 143 || container.kind === 146) { + if (container.kind === 144 || container.kind === 147) { var classNode = container.parent; getNodeLinks(classNode).flags |= 4; } @@ -17641,7 +18409,7 @@ var ts; function checkThisExpression(node) { var container = ts.getThisContainer(node, true); var needToCaptureLexicalThis = false; - if (container.kind === 146) { + if (container.kind === 147) { var containingClassDecl = container.parent; var baseTypeNode = ts.getClassExtendsHeritageClauseElement(containingClassDecl); if (baseTypeNode && !classDeclarationExtendsNull(containingClassDecl)) { @@ -17651,45 +18419,62 @@ var ts; } } } - if (container.kind === 178) { + if (container.kind === 179) { container = ts.getThisContainer(container, false); needToCaptureLexicalThis = (languageVersion < 2); } switch (container.kind) { - case 222: + case 224: error(node, ts.Diagnostics.this_cannot_be_referenced_in_a_module_or_namespace_body); break; - case 221: + case 223: error(node, ts.Diagnostics.this_cannot_be_referenced_in_current_location); break; - case 146: + case 147: if (isInConstructorArgumentInitializer(node, container)) { error(node, ts.Diagnostics.this_cannot_be_referenced_in_constructor_arguments); } break; + case 144: case 143: - case 142: if (container.flags & 32) { error(node, ts.Diagnostics.this_cannot_be_referenced_in_a_static_property_initializer); } break; - case 138: + case 139: error(node, ts.Diagnostics.this_cannot_be_referenced_in_a_computed_property_name); break; } if (needToCaptureLexicalThis) { captureLexicalThis(node, container); } + if (ts.isFunctionLike(container)) { + var type = getContextuallyTypedThisType(container); + if (type) { + return type; + } + var signature = getSignatureFromDeclaration(container); + if (signature.thisType) { + return signature.thisType; + } + if (container.parent && container.parent.kind === 170) { + var type_1 = checkExpressionCached(container.parent); + if (type_1) { + return type_1; + } + } + } if (ts.isClassLike(container.parent)) { var symbol = getSymbolOfNode(container.parent); - return container.flags & 32 ? getTypeOfSymbol(symbol) : getDeclaredTypeOfSymbol(symbol).thisType; + var type = container.flags & 32 ? getTypeOfSymbol(symbol) : getDeclaredTypeOfSymbol(symbol).thisType; + return getNarrowedTypeOfReference(type, node); } if (ts.isInJavaScriptFile(node)) { var type = getTypeForThisExpressionFromJSDoc(container); if (type && type !== unknownType) { return type; } - if (container.kind === 177) { + if (container.kind === 178) { if (ts.getSpecialPropertyAssignmentKind(container.parent) === 3) { var className = container.parent .left @@ -17702,31 +18487,34 @@ var ts; } } } + if (compilerOptions.noImplicitThis) { + error(node, ts.Diagnostics.this_implicitly_has_type_any_because_it_does_not_have_a_type_annotation); + } return anyType; } function getTypeForThisExpressionFromJSDoc(node) { var typeTag = ts.getJSDocTypeTag(node); - if (typeTag && typeTag.typeExpression && typeTag.typeExpression.type && typeTag.typeExpression.type.kind === 265) { + if (typeTag && typeTag.typeExpression && typeTag.typeExpression.type && typeTag.typeExpression.type.kind === 268) { var jsDocFunctionType = typeTag.typeExpression.type; - if (jsDocFunctionType.parameters.length > 0 && jsDocFunctionType.parameters[0].type.kind === 268) { + if (jsDocFunctionType.parameters.length > 0 && jsDocFunctionType.parameters[0].type.kind === 271) { return getTypeFromTypeNode(jsDocFunctionType.parameters[0].type); } } } function isInConstructorArgumentInitializer(node, constructorDecl) { for (var n = node; n && n !== constructorDecl; n = n.parent) { - if (n.kind === 140) { + if (n.kind === 141) { return true; } } return false; } function checkSuperExpression(node) { - var isCallExpression = node.parent.kind === 172 && node.parent.expression === node; + var isCallExpression = node.parent.kind === 173 && node.parent.expression === node; var container = ts.getSuperContainer(node, true); var needToCaptureLexicalThis = false; if (!isCallExpression) { - while (container && container.kind === 178) { + while (container && container.kind === 179) { container = ts.getSuperContainer(container, true); needToCaptureLexicalThis = languageVersion < 2; } @@ -17735,16 +18523,16 @@ var ts; var nodeCheckFlag = 0; if (!canUseSuperExpression) { var current = node; - while (current && current !== container && current.kind !== 138) { + while (current && current !== container && current.kind !== 139) { current = current.parent; } - if (current && current.kind === 138) { + if (current && current.kind === 139) { 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 === 169)) { + else if (!container || !container.parent || !(ts.isClassLike(container.parent) || container.parent.kind === 170)) { error(node, ts.Diagnostics.super_can_only_be_referenced_in_members_of_derived_classes_or_object_literal_expressions); } else { @@ -17759,7 +18547,7 @@ var ts; nodeCheckFlag = 256; } getNodeLinks(node).flags |= nodeCheckFlag; - if (container.kind === 145 && container.flags & 256) { + if (container.kind === 146 && container.flags & 256) { if (ts.isSuperPropertyOrElementAccess(node.parent) && isAssignmentTarget(node.parent)) { getNodeLinks(container).flags |= 4096; } @@ -17770,7 +18558,7 @@ var ts; if (needToCaptureLexicalThis) { captureLexicalThis(node.parent, container); } - if (container.parent.kind === 169) { + if (container.parent.kind === 170) { if (languageVersion < 2) { error(node, ts.Diagnostics.super_is_only_allowed_in_members_of_object_literal_expressions_when_option_target_is_ES2015_or_higher); return unknownType; @@ -17788,7 +18576,7 @@ var ts; } return unknownType; } - if (container.kind === 146 && isInConstructorArgumentInitializer(node, container)) { + if (container.kind === 147 && isInConstructorArgumentInitializer(node, container)) { error(node, ts.Diagnostics.super_cannot_be_referenced_in_constructor_arguments); return unknownType; } @@ -17800,30 +18588,41 @@ var ts; return false; } if (isCallExpression) { - return container.kind === 146; + return container.kind === 147; } else { - if (ts.isClassLike(container.parent) || container.parent.kind === 169) { + if (ts.isClassLike(container.parent) || container.parent.kind === 170) { if (container.flags & 32) { - return container.kind === 145 || - container.kind === 144 || - container.kind === 147 || - container.kind === 148; + return container.kind === 146 || + container.kind === 145 || + container.kind === 148 || + container.kind === 149; } else { - return container.kind === 145 || - container.kind === 144 || - container.kind === 147 || + return container.kind === 146 || + container.kind === 145 || container.kind === 148 || + container.kind === 149 || + container.kind === 144 || container.kind === 143 || - container.kind === 142 || - container.kind === 146; + container.kind === 147; } } } return false; } } + function getContextuallyTypedThisType(func) { + if ((isFunctionExpressionOrArrowFunction(func) || ts.isObjectLiteralMethod(func)) && + isContextSensitive(func) && + func.kind !== 179) { + var contextualSignature = getContextualSignature(func); + if (contextualSignature) { + return contextualSignature.thisType; + } + } + return undefined; + } function getContextuallyTypedParameterType(parameter) { var func = parameter.parent; if (isFunctionExpressionOrArrowFunction(func) || ts.isObjectLiteralMethod(func)) { @@ -17852,7 +18651,7 @@ var ts; if (declaration.type) { return getTypeFromTypeNode(declaration.type); } - if (declaration.kind === 140) { + if (declaration.kind === 141) { var type = getContextuallyTypedParameterType(declaration); if (type) { return type; @@ -17861,6 +18660,18 @@ var ts; if (ts.isBindingPattern(declaration.name)) { return getTypeFromBindingPattern(declaration.name, true); } + if (ts.isBindingPattern(declaration.parent)) { + var parentDeclaration = declaration.parent.parent; + var name_11 = declaration.propertyName || declaration.name; + if (ts.isVariableLike(parentDeclaration) && + parentDeclaration.type && + !ts.isBindingPattern(name_11)) { + var text = getTextOfPropertyName(name_11); + if (text) { + return getTypeOfPropertyOfType(getTypeFromTypeNode(parentDeclaration.type), text); + } + } + } } return undefined; } @@ -17885,7 +18696,7 @@ var ts; } function isInParameterInitializerBeforeContainingFunction(node) { while (node.parent && !ts.isFunctionLike(node.parent)) { - if (node.parent.kind === 140 && node.parent.initializer === node) { + if (node.parent.kind === 141 && node.parent.initializer === node) { return true; } node = node.parent; @@ -17894,8 +18705,8 @@ var ts; } function getContextualReturnType(functionDecl) { if (functionDecl.type || - functionDecl.kind === 146 || - functionDecl.kind === 147 && ts.getSetAccessorTypeAnnotationNode(ts.getDeclarationOfKind(functionDecl.symbol, 148))) { + functionDecl.kind === 147 || + functionDecl.kind === 148 && ts.getSetAccessorTypeAnnotationNode(ts.getDeclarationOfKind(functionDecl.symbol, 149))) { return getReturnTypeOfSignature(getSignatureFromDeclaration(functionDecl)); } var signature = getContextualSignatureForFunctionLikeDeclaration(functionDecl); @@ -17914,7 +18725,7 @@ var ts; return undefined; } function getContextualTypeForSubstitutionExpression(template, substitutionExpression) { - if (template.parent.kind === 174) { + if (template.parent.kind === 175) { return getContextualTypeForArgument(template.parent, substitutionExpression); } return undefined; @@ -18022,13 +18833,13 @@ var ts; var kind = attribute.kind; var jsxElement = attribute.parent; var attrsType = getJsxElementAttributesType(jsxElement); - if (attribute.kind === 242) { + if (attribute.kind === 245) { if (!attrsType || isTypeAny(attrsType)) { return undefined; } return getTypeOfPropertyOfType(attrsType, attribute.name.text); } - else if (attribute.kind === 243) { + else if (attribute.kind === 246) { return attrsType; } ts.Debug.fail("Expected JsxAttribute or JsxSpreadAttribute, got ts.SyntaxKind[" + kind + "]"); @@ -18046,40 +18857,40 @@ var ts; } var parent = node.parent; switch (parent.kind) { - case 215: - case 140: + case 217: + case 141: + case 144: case 143: - case 142: - case 167: - return getContextualTypeForInitializerExpression(node); - case 178: - case 208: - return getContextualTypeForReturnExpression(node); - case 188: - return getContextualTypeForYieldOperand(parent); - case 172: - case 173: - return getContextualTypeForArgument(parent, node); - case 175: - case 193: - return getTypeFromTypeNode(parent.type); - case 185: - return getContextualTypeForBinaryOperand(node); - case 249: - return getContextualTypeForObjectLiteralElement(parent); case 168: - return getContextualTypeForElementExpression(node); - case 186: - return getContextualTypeForConditionalOperand(node); - case 194: - ts.Debug.assert(parent.parent.kind === 187); - return getContextualTypeForSubstitutionExpression(parent.parent, node); + return getContextualTypeForInitializerExpression(node); + case 179: + case 210: + return getContextualTypeForReturnExpression(node); + case 189: + return getContextualTypeForYieldOperand(parent); + case 173: + case 174: + return getContextualTypeForArgument(parent, node); case 176: + case 194: + return getTypeFromTypeNode(parent.type); + case 186: + return getContextualTypeForBinaryOperand(node); + case 252: + return getContextualTypeForObjectLiteralElement(parent); + case 169: + return getContextualTypeForElementExpression(node); + case 187: + return getContextualTypeForConditionalOperand(node); + case 196: + ts.Debug.assert(parent.parent.kind === 188); + return getContextualTypeForSubstitutionExpression(parent.parent, node); + case 177: return getContextualType(parent); - case 244: + case 247: return getContextualType(parent); - case 242: - case 243: + case 245: + case 246: return getContextualTypeForJsxAttribute(parent); } return undefined; @@ -18094,7 +18905,7 @@ var ts; } } function isFunctionExpressionOrArrowFunction(node) { - return node.kind === 177 || node.kind === 178; + return node.kind === 178 || node.kind === 179; } function getContextualSignatureForFunctionLikeDeclaration(node) { return isFunctionExpressionOrArrowFunction(node) || ts.isObjectLiteralMethod(node) @@ -18102,7 +18913,7 @@ var ts; : undefined; } function getContextualSignature(node) { - ts.Debug.assert(node.kind !== 145 || ts.isObjectLiteralMethod(node)); + ts.Debug.assert(node.kind !== 146 || ts.isObjectLiteralMethod(node)); var type = ts.isObjectLiteralMethod(node) ? getContextualTypeForObjectLiteralMethod(node) : getApparentTypeOfContextualType(node); @@ -18121,7 +18932,7 @@ var ts; if (!signatureList) { signatureList = [signature]; } - else if (!compareSignaturesIdentical(signatureList[0], signature, false, true, compareTypesIdentical)) { + else if (!compareSignaturesIdentical(signatureList[0], signature, false, true, true, compareTypesIdentical)) { return undefined; } else { @@ -18140,16 +18951,34 @@ var ts; function isInferentialContext(mapper) { return mapper && mapper.context; } - function isAssignmentTarget(node) { + function getAssignmentRoot(node) { + while (node.parent.kind === 177) { + node = node.parent; + } + while (true) { + if (node.parent.kind === 252) { + node = node.parent.parent; + } + else if (node.parent.kind === 169) { + node = node.parent; + } + else { + break; + } + } var parent = node.parent; - if (parent.kind === 185 && parent.operatorToken.kind === 56 && parent.left === node) { - return true; - } - if (parent.kind === 249) { - return isAssignmentTarget(parent.parent); - } - if (parent.kind === 168) { - return isAssignmentTarget(parent); + return parent.kind === 186 && + parent.operatorToken.kind === 56 && + parent.left === node ? parent : undefined; + } + function isAssignmentTarget(node) { + return !!getAssignmentRoot(node); + } + function isCompoundAssignmentTarget(node) { + var parent = node.parent; + if (parent.kind === 186 && parent.left === node) { + var operator = parent.operatorToken.kind; + return operator >= 56 && operator <= 68; } return false; } @@ -18158,8 +18987,8 @@ var ts; return checkIteratedTypeOrElementType(arrayOrIterableType, node.expression, false); } function hasDefaultValue(node) { - return (node.kind === 167 && !!node.initializer) || - (node.kind === 185 && node.operatorToken.kind === 56); + return (node.kind === 168 && !!node.initializer) || + (node.kind === 186 && node.operatorToken.kind === 56); } function checkArrayLiteral(node, contextualMapper) { var elements = node.elements; @@ -18168,7 +18997,7 @@ var ts; var inDestructuringPattern = isAssignmentTarget(node); for (var _i = 0, elements_1 = elements; _i < elements_1.length; _i++) { var e = elements_1[_i]; - if (inDestructuringPattern && e.kind === 189) { + if (inDestructuringPattern && e.kind === 190) { var restArrayType = checkExpression(e.expression, contextualMapper); var restElementType = getIndexTypeOfType(restArrayType, 1) || (languageVersion >= 2 ? getElementTypeOfIterable(restArrayType, undefined) : undefined); @@ -18180,7 +19009,7 @@ var ts; var type = checkExpression(e, contextualMapper); elementTypes.push(type); } - hasSpreadElement = hasSpreadElement || e.kind === 189; + hasSpreadElement = hasSpreadElement || e.kind === 190; } if (!hasSpreadElement) { if (inDestructuringPattern && elementTypes.length) { @@ -18191,7 +19020,7 @@ var ts; var contextualType = getApparentTypeOfContextualType(node); if (contextualType && contextualTypeIsTupleLikeType(contextualType)) { var pattern = contextualType.pattern; - if (pattern && (pattern.kind === 166 || pattern.kind === 168)) { + if (pattern && (pattern.kind === 167 || pattern.kind === 169)) { var patternElements = pattern.elements; for (var i = elementTypes.length; i < patternElements.length; i++) { var patternElement = patternElements[i]; @@ -18199,7 +19028,7 @@ var ts; elementTypes.push(contextualType.elementTypes[i]); } else { - if (patternElement.kind !== 191) { + if (patternElement.kind !== 192) { error(patternElement, ts.Diagnostics.Initializer_provides_no_value_for_this_binding_element_and_the_binding_element_has_no_default_value); } elementTypes.push(unknownType); @@ -18211,10 +19040,10 @@ var ts; } } } - return createArrayType(elementTypes.length ? getUnionType(elementTypes) : undefinedType); + return createArrayType(elementTypes.length ? getUnionType(elementTypes) : emptyArrayElementType); } function isNumericName(name) { - return name.kind === 138 ? isNumericComputedName(name) : isNumericLiteralName(name.text); + return name.kind === 139 ? isNumericComputedName(name) : isNumericLiteralName(name.text); } function isNumericComputedName(name) { return isTypeAnyOrAllConstituentTypesHaveKind(checkComputedPropertyName(name), 132); @@ -18255,7 +19084,7 @@ var ts; var propertiesArray = []; var contextualType = getApparentTypeOfContextualType(node); var contextualTypeHasPattern = contextualType && contextualType.pattern && - (contextualType.pattern.kind === 165 || contextualType.pattern.kind === 169); + (contextualType.pattern.kind === 166 || contextualType.pattern.kind === 170); var typeFlags = 0; var patternWithComputedProperties = false; var hasComputedStringProperty = false; @@ -18263,25 +19092,25 @@ var ts; for (var _i = 0, _a = node.properties; _i < _a.length; _i++) { var memberDecl = _a[_i]; var member = memberDecl.symbol; - if (memberDecl.kind === 249 || - memberDecl.kind === 250 || + if (memberDecl.kind === 252 || + memberDecl.kind === 253 || ts.isObjectLiteralMethod(memberDecl)) { var type = void 0; - if (memberDecl.kind === 249) { + if (memberDecl.kind === 252) { type = checkPropertyAssignment(memberDecl, contextualMapper); } - else if (memberDecl.kind === 145) { + else if (memberDecl.kind === 146) { type = checkObjectLiteralMethod(memberDecl, contextualMapper); } else { - ts.Debug.assert(memberDecl.kind === 250); + ts.Debug.assert(memberDecl.kind === 253); type = checkExpression(memberDecl.name, contextualMapper); } typeFlags |= type.flags; var prop = createSymbol(4 | 67108864 | member.flags, member.name); if (inDestructuringPattern) { - var isOptional = (memberDecl.kind === 249 && hasDefaultValue(memberDecl.initializer)) || - (memberDecl.kind === 250 && memberDecl.objectAssignmentInitializer); + var isOptional = (memberDecl.kind === 252 && hasDefaultValue(memberDecl.initializer)) || + (memberDecl.kind === 253 && memberDecl.objectAssignmentInitializer); if (isOptional) { prop.flags |= 536870912; } @@ -18308,7 +19137,7 @@ var ts; member = prop; } else { - ts.Debug.assert(memberDecl.kind === 147 || memberDecl.kind === 148); + ts.Debug.assert(memberDecl.kind === 148 || memberDecl.kind === 149); checkAccessorDeclaration(memberDecl); } if (ts.hasDynamicName(memberDecl)) { @@ -18352,17 +19181,22 @@ var ts; } function checkJsxElement(node) { checkJsxOpeningLikeElement(node.openingElement); - getJsxTagSymbol(node.closingElement); + if (isJsxIntrinsicIdentifier(node.closingElement.tagName)) { + getIntrinsicTagSymbol(node.closingElement); + } + else { + checkExpression(node.closingElement.tagName); + } for (var _i = 0, _a = node.children; _i < _a.length; _i++) { var child = _a[_i]; switch (child.kind) { - case 244: + case 247: checkJsxExpression(child); break; - case 237: + case 240: checkJsxElement(child); break; - case 238: + case 241: checkJsxSelfClosingElement(child); break; } @@ -18373,7 +19207,7 @@ var ts; return name.indexOf("-") < 0; } function isJsxIntrinsicIdentifier(tagName) { - if (tagName.kind === 137) { + if (tagName.kind === 138) { return false; } else { @@ -18436,14 +19270,6 @@ var ts; } return jsxTypes[name]; } - function getJsxTagSymbol(node) { - if (isJsxIntrinsicIdentifier(node.tagName)) { - return getIntrinsicTagSymbol(node); - } - else { - return checkExpression(node.tagName).symbol; - } - } function getIntrinsicTagSymbol(node) { var links = getNodeLinks(node); if (!links.resolvedSymbol) { @@ -18523,17 +19349,19 @@ var ts; var elemInstanceType = getJsxElementInstanceType(node); var elemClassType = getJsxGlobalElementClassType(); if (!elemClassType || !isTypeAssignableTo(elemInstanceType, elemClassType)) { - var elemType = checkExpression(node.tagName); - var callSignatures = elemType && getSignaturesOfType(elemType, 0); - var callSignature = callSignatures && callSignatures.length > 0 && callSignatures[0]; - var callReturnType = callSignature && getReturnTypeOfSignature(callSignature); - var paramType = callReturnType && (callSignature.parameters.length === 0 ? emptyObjectType : getTypeOfSymbol(callSignature.parameters[0])); - if (callReturnType && isTypeAssignableTo(callReturnType, jsxElementType)) { - var intrinsicAttributes = getJsxType(JsxNames.IntrinsicAttributes); - if (intrinsicAttributes !== unknownType) { - paramType = intersectTypes(intrinsicAttributes, paramType); + if (jsxElementType) { + var elemType = checkExpression(node.tagName); + var callSignatures = elemType && getSignaturesOfType(elemType, 0); + var callSignature = callSignatures && callSignatures.length > 0 && callSignatures[0]; + var callReturnType = callSignature && getReturnTypeOfSignature(callSignature); + var paramType = callReturnType && (callSignature.parameters.length === 0 ? emptyObjectType : getTypeOfSymbol(callSignature.parameters[0])); + if (callReturnType && isTypeAssignableTo(callReturnType, jsxElementType)) { + var intrinsicAttributes = getJsxType(JsxNames.IntrinsicAttributes); + if (intrinsicAttributes !== unknownType) { + paramType = intersectTypes(intrinsicAttributes, paramType); + } + return links.resolvedJsxType = paramType; } - return links.resolvedJsxType = paramType; } } if (elemClassType) { @@ -18625,11 +19453,11 @@ var ts; var nameTable = {}; var sawSpreadedAny = false; for (var i = node.attributes.length - 1; i >= 0; i--) { - if (node.attributes[i].kind === 242) { + if (node.attributes[i].kind === 245) { checkJsxAttribute((node.attributes[i]), targetAttributesType, nameTable); } else { - ts.Debug.assert(node.attributes[i].kind === 243); + ts.Debug.assert(node.attributes[i].kind === 246); var spreadType = checkJsxSpreadAttribute((node.attributes[i]), targetAttributesType, nameTable); if (isTypeAny(spreadType)) { sawSpreadedAny = true; @@ -18655,7 +19483,7 @@ var ts; } } function getDeclarationKindFromSymbol(s) { - return s.valueDeclaration ? s.valueDeclaration.kind : 143; + return s.valueDeclaration ? s.valueDeclaration.kind : 144; } function getDeclarationFlagsFromSymbol(s) { return s.valueDeclaration ? ts.getCombinedNodeFlags(s.valueDeclaration) : s.flags & 134217728 ? 4 | 32 : 0; @@ -18663,11 +19491,11 @@ var ts; function checkClassPropertyAccess(node, left, type, prop) { var flags = getDeclarationFlagsFromSymbol(prop); var declaringClass = getDeclaredTypeOfSymbol(getParentOfSymbol(prop)); + var errorNode = node.kind === 171 || node.kind === 217 ? + node.name : + node.right; if (left.kind === 95) { - var errorNode = node.kind === 170 ? - node.name : - node.right; - if (languageVersion < 2 && getDeclarationKindFromSymbol(prop) !== 145) { + if (languageVersion < 2 && getDeclarationKindFromSymbol(prop) !== 146) { error(errorNode, ts.Diagnostics.Only_public_and_protected_methods_of_the_base_class_are_accessible_via_the_super_keyword); return false; } @@ -18679,11 +19507,10 @@ var ts; if (!(flags & (8 | 16))) { return true; } - var enclosingClassDeclaration = ts.getContainingClass(node); - var enclosingClass = enclosingClassDeclaration ? getDeclaredTypeOfSymbol(getSymbolOfNode(enclosingClassDeclaration)) : undefined; if (flags & 8) { - if (declaringClass !== enclosingClass) { - error(node, ts.Diagnostics.Property_0_is_private_and_only_accessible_within_class_1, symbolToString(prop), typeToString(declaringClass)); + var declaringClassDeclaration = getClassLikeDeclarationOfSymbol(getParentOfSymbol(prop)); + if (!isNodeWithinClass(node, declaringClassDeclaration)) { + error(errorNode, ts.Diagnostics.Property_0_is_private_and_only_accessible_within_class_1, symbolToString(prop), typeToString(declaringClass)); return false; } return true; @@ -18691,8 +19518,12 @@ var ts; if (left.kind === 95) { return true; } - if (!enclosingClass || !hasBaseType(enclosingClass, declaringClass)) { - error(node, ts.Diagnostics.Property_0_is_protected_and_only_accessible_within_class_1_and_its_subclasses, symbolToString(prop), typeToString(declaringClass)); + var enclosingClass = forEachEnclosingClass(node, function (enclosingDeclaration) { + var enclosingClass = getDeclaredTypeOfSymbol(getSymbolOfNode(enclosingDeclaration)); + return hasBaseType(enclosingClass, declaringClass) ? enclosingClass : undefined; + }); + if (!enclosingClass) { + error(errorNode, ts.Diagnostics.Property_0_is_protected_and_only_accessible_within_class_1_and_its_subclasses, symbolToString(prop), typeToString(declaringClass)); return false; } if (flags & 32) { @@ -18702,11 +19533,19 @@ var ts; type = getConstraintOfTypeParameter(type); } if (!(getTargetType(type).flags & (1024 | 2048) && hasBaseType(type, enclosingClass))) { - error(node, ts.Diagnostics.Property_0_is_protected_and_only_accessible_through_an_instance_of_class_1, symbolToString(prop), typeToString(enclosingClass)); + error(errorNode, ts.Diagnostics.Property_0_is_protected_and_only_accessible_through_an_instance_of_class_1, symbolToString(prop), typeToString(enclosingClass)); return false; } return true; } + function checkNonNullExpression(node) { + var type = checkExpression(node); + if (strictNullChecks && getNullableKind(type)) { + error(node, ts.Diagnostics.Object_is_possibly_null_or_undefined); + return getNonNullableType(type); + } + return type; + } function checkPropertyAccessExpression(node) { return checkPropertyAccessExpressionOrQualifiedName(node, node.expression, node.name); } @@ -18714,7 +19553,7 @@ var ts; return checkPropertyAccessExpressionOrQualifiedName(node, node.left, node.right); } function checkPropertyAccessExpressionOrQualifiedName(node, left, right) { - var type = checkExpression(left); + var type = checkNonNullExpression(left); if (isTypeAny(type)) { return type; } @@ -18733,10 +19572,12 @@ var ts; if (prop.parent && prop.parent.flags & 32) { checkClassPropertyAccess(node, left, apparentType, prop); } - return getTypeOfSymbol(prop); + var propType = getTypeOfSymbol(prop); + return node.kind === 171 && prop.flags & 4 ? + getNarrowedTypeOfReference(propType, node) : propType; } function isValidPropertyAccess(node, propertyName) { - var left = node.kind === 170 + var left = node.kind === 171 ? node.expression : node.left; var type = checkExpression(left); @@ -18750,7 +19591,7 @@ var ts; } function getForInVariableSymbol(node) { var initializer = node.initializer; - if (initializer.kind === 216) { + if (initializer.kind === 218) { var variable = initializer.declarations[0]; if (variable && !ts.isBindingPattern(variable.name)) { return getSymbolOfNode(variable); @@ -18772,7 +19613,7 @@ var ts; var child = expr; var node = expr.parent; while (node) { - if (node.kind === 204 && + if (node.kind === 206 && child === node.statement && getForInVariableSymbol(node) === symbol && hasNumericPropertyNames(checkExpression(node.expression))) { @@ -18788,7 +19629,7 @@ var ts; function checkIndexedAccess(node) { if (!node.argumentExpression) { var sourceFile = ts.getSourceFileOfNode(node); - if (node.parent.kind === 173 && node.parent.expression === node) { + if (node.parent.kind === 174 && 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); @@ -18799,7 +19640,7 @@ var ts; grammarErrorAtPos(sourceFile, start, end - start, ts.Diagnostics.Expression_expected); } } - var objectType = getApparentType(checkExpression(node.expression)); + var objectType = getApparentType(checkNonNullExpression(node.expression)); var indexType = node.argumentExpression ? checkExpression(node.argumentExpression) : unknownType; if (objectType === unknownType) { return unknownType; @@ -18811,15 +19652,15 @@ var ts; return unknownType; } if (node.argumentExpression) { - var name_11 = getPropertyNameForIndexedAccess(node.argumentExpression, indexType); - if (name_11 !== undefined) { - var prop = getPropertyOfType(objectType, name_11); + var name_12 = getPropertyNameForIndexedAccess(node.argumentExpression, indexType); + if (name_12 !== undefined) { + var prop = getPropertyOfType(objectType, name_12); 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_11, symbolToString(objectType.symbol)); + error(node.argumentExpression, ts.Diagnostics.Property_0_does_not_exist_on_const_enum_1, name_12, symbolToString(objectType.symbol)); return unknownType; } } @@ -18851,7 +19692,7 @@ var ts; if (indexArgumentExpression.kind === 9 || indexArgumentExpression.kind === 8) { return indexArgumentExpression.text; } - if (indexArgumentExpression.kind === 171 || indexArgumentExpression.kind === 170) { + if (indexArgumentExpression.kind === 172 || indexArgumentExpression.kind === 171) { var value = getConstantValue(indexArgumentExpression); if (value !== undefined) { return value.toString(); @@ -18894,10 +19735,10 @@ var ts; return true; } function resolveUntypedCall(node) { - if (node.kind === 174) { + if (node.kind === 175) { checkExpression(node.template); } - else if (node.kind !== 141) { + else if (node.kind !== 142) { ts.forEach(node.arguments, function (argument) { checkExpression(argument); }); @@ -18919,19 +19760,19 @@ var ts; for (var _i = 0, signatures_2 = signatures; _i < signatures_2.length; _i++) { var signature = signatures_2[_i]; var symbol = signature.declaration && getSymbolOfNode(signature.declaration); - var parent_6 = signature.declaration && signature.declaration.parent; + var parent_7 = signature.declaration && signature.declaration.parent; if (!lastSymbol || symbol === lastSymbol) { - if (lastParent && parent_6 === lastParent) { + if (lastParent && parent_7 === lastParent) { index++; } else { - lastParent = parent_6; + lastParent = parent_7; index = cutoffIndex; } } else { index = cutoffIndex = result.length; - lastParent = parent_6; + lastParent = parent_7; } lastSymbol = symbol; if (signature.hasStringLiterals) { @@ -18948,7 +19789,7 @@ var ts; function getSpreadArgumentIndex(args) { for (var i = 0; i < args.length; i++) { var arg = args[i]; - if (arg && arg.kind === 189) { + if (arg && arg.kind === 190) { return i; } } @@ -18960,11 +19801,11 @@ var ts; var callIsIncomplete; var isDecorator; var spreadArgIndex = -1; - if (node.kind === 174) { + if (node.kind === 175) { var tagExpression = node; adjustedArgCount = args.length; typeArguments = undefined; - if (tagExpression.template.kind === 187) { + if (tagExpression.template.kind === 188) { var templateExpression = tagExpression.template; var lastSpan = ts.lastOrUndefined(templateExpression.templateSpans); ts.Debug.assert(lastSpan !== undefined); @@ -18976,7 +19817,7 @@ var ts; callIsIncomplete = !!templateLiteral.isUnterminated; } } - else if (node.kind === 141) { + else if (node.kind === 142) { isDecorator = true; typeArguments = undefined; adjustedArgCount = getEffectiveArgumentCount(node, undefined, signature); @@ -18984,7 +19825,7 @@ var ts; else { var callExpression = node; if (!callExpression.arguments) { - ts.Debug.assert(callExpression.kind === 173); + ts.Debug.assert(callExpression.kind === 174); return signature.minArgumentCount === 0; } adjustedArgCount = callExpression.arguments.hasTrailingComma ? args.length + 1 : args.length; @@ -19034,10 +19875,15 @@ var ts; if (context.failedTypeParameterIndex !== undefined && !context.inferences[context.failedTypeParameterIndex].isFixed) { context.failedTypeParameterIndex = undefined; } + if (signature.thisType) { + var thisArgumentNode = getThisArgumentOfCall(node); + var thisArgumentType = thisArgumentNode ? checkExpression(thisArgumentNode) : voidType; + inferTypes(context, thisArgumentType, signature.thisType); + } var argCount = getEffectiveArgumentCount(node, args, signature); for (var i = 0; i < argCount; i++) { var arg = getEffectiveArgument(node, args, i); - if (arg === undefined || arg.kind !== 191) { + if (arg === undefined || arg.kind !== 192) { var paramType = getTypeAtPosition(signature, i); var argType = getEffectiveArgumentType(node, i, arg); if (argType === undefined) { @@ -19083,10 +19929,20 @@ var ts; return typeArgumentsAreAssignable; } function checkApplicableSignature(node, args, signature, relation, excludeArgument, reportErrors) { + if (signature.thisType && signature.thisType !== voidType && node.kind !== 174) { + var thisArgumentNode = getThisArgumentOfCall(node); + var thisArgumentType = thisArgumentNode ? checkExpression(thisArgumentNode) : voidType; + var errorNode = reportErrors ? (thisArgumentNode || node) : undefined; + var headMessage_1 = ts.Diagnostics.The_this_context_of_type_0_is_not_assignable_to_method_s_this_of_type_1; + if (!checkTypeRelatedTo(thisArgumentType, signature.thisType, relation, errorNode, headMessage_1)) { + return false; + } + } + var headMessage = ts.Diagnostics.Argument_of_type_0_is_not_assignable_to_parameter_of_type_1; var argCount = getEffectiveArgumentCount(node, args, signature); for (var i = 0; i < argCount; i++) { var arg = getEffectiveArgument(node, args, i); - if (arg === undefined || arg.kind !== 191) { + if (arg === undefined || arg.kind !== 192) { var paramType = getTypeAtPosition(signature, i); var argType = getEffectiveArgumentType(node, i, arg); if (argType === undefined) { @@ -19095,7 +19951,6 @@ var ts; : checkExpressionWithContextualType(arg, paramType, excludeArgument && excludeArgument[i] ? identityMapper : undefined); } var errorNode = reportErrors ? getEffectiveArgumentErrorNode(node, i, arg) : undefined; - var headMessage = ts.Diagnostics.Argument_of_type_0_is_not_assignable_to_parameter_of_type_1; if (!checkTypeRelatedTo(argType, paramType, relation, errorNode, headMessage)) { return false; } @@ -19103,18 +19958,29 @@ var ts; } return true; } + function getThisArgumentOfCall(node) { + if (node.kind === 173) { + var callee = node.expression; + if (callee.kind === 171) { + return callee.expression; + } + else if (callee.kind === 172) { + return callee.expression; + } + } + } function getEffectiveCallArguments(node) { var args; - if (node.kind === 174) { + if (node.kind === 175) { var template = node.template; args = [undefined]; - if (template.kind === 187) { + if (template.kind === 188) { ts.forEach(template.templateSpans, function (span) { args.push(span.expression); }); } } - else if (node.kind === 141) { + else if (node.kind === 142) { return undefined; } else { @@ -19123,21 +19989,21 @@ var ts; return args; } function getEffectiveArgumentCount(node, args, signature) { - if (node.kind === 141) { + if (node.kind === 142) { switch (node.parent.kind) { - case 218: - case 190: + case 220: + case 191: return 1; - case 143: + case 144: return 2; - case 145: - case 147: + case 146: case 148: + case 149: if (languageVersion === 0) { return 2; } return signature.parameters.length >= 3 ? 3 : 2; - case 140: + case 141: return 3; } } @@ -19146,48 +20012,48 @@ var ts; } } function getEffectiveDecoratorFirstArgumentType(node) { - if (node.kind === 218) { + if (node.kind === 220) { var classSymbol = getSymbolOfNode(node); return getTypeOfSymbol(classSymbol); } - if (node.kind === 140) { + if (node.kind === 141) { node = node.parent; - if (node.kind === 146) { + if (node.kind === 147) { var classSymbol = getSymbolOfNode(node); return getTypeOfSymbol(classSymbol); } } - if (node.kind === 143 || - node.kind === 145 || - node.kind === 147 || - node.kind === 148) { + if (node.kind === 144 || + node.kind === 146 || + node.kind === 148 || + node.kind === 149) { return getParentTypeOfClassElement(node); } ts.Debug.fail("Unsupported decorator target."); return unknownType; } function getEffectiveDecoratorSecondArgumentType(node) { - if (node.kind === 218) { + if (node.kind === 220) { ts.Debug.fail("Class decorators should not have a second synthetic argument."); return unknownType; } - if (node.kind === 140) { + if (node.kind === 141) { node = node.parent; - if (node.kind === 146) { + if (node.kind === 147) { return anyType; } } - if (node.kind === 143 || - node.kind === 145 || - node.kind === 147 || - node.kind === 148) { + if (node.kind === 144 || + node.kind === 146 || + node.kind === 148 || + node.kind === 149) { var element = node; switch (element.name.kind) { case 69: case 8: case 9: return getStringLiteralTypeForText(element.name.text); - case 138: + case 139: var nameType = checkComputedPropertyName(element.name); if (isTypeOfKind(nameType, 16777216)) { return nameType; @@ -19204,20 +20070,20 @@ var ts; return unknownType; } function getEffectiveDecoratorThirdArgumentType(node) { - if (node.kind === 218) { + if (node.kind === 220) { ts.Debug.fail("Class decorators should not have a third synthetic argument."); return unknownType; } - if (node.kind === 140) { + if (node.kind === 141) { return numberType; } - if (node.kind === 143) { + if (node.kind === 144) { ts.Debug.fail("Property decorators should not have a third synthetic argument."); return unknownType; } - if (node.kind === 145 || - node.kind === 147 || - node.kind === 148) { + if (node.kind === 146 || + node.kind === 148 || + node.kind === 149) { var propertyType = getTypeOfNode(node); return createTypedPropertyDescriptorType(propertyType); } @@ -19238,26 +20104,26 @@ var ts; return unknownType; } function getEffectiveArgumentType(node, argIndex, arg) { - if (node.kind === 141) { + if (node.kind === 142) { return getEffectiveDecoratorArgumentType(node, argIndex); } - else if (argIndex === 0 && node.kind === 174) { - return globalTemplateStringsArrayType; + else if (argIndex === 0 && node.kind === 175) { + return getGlobalTemplateStringsArrayType(); } return undefined; } function getEffectiveArgument(node, args, argIndex) { - if (node.kind === 141 || - (argIndex === 0 && node.kind === 174)) { + if (node.kind === 142 || + (argIndex === 0 && node.kind === 175)) { return undefined; } return args[argIndex]; } function getEffectiveArgumentErrorNode(node, argIndex, arg) { - if (node.kind === 141) { + if (node.kind === 142) { return node.expression; } - else if (argIndex === 0 && node.kind === 174) { + else if (argIndex === 0 && node.kind === 175) { return node.template; } else { @@ -19265,8 +20131,8 @@ var ts; } } function resolveCall(node, signatures, candidatesOutArray, headMessage) { - var isTaggedTemplate = node.kind === 174; - var isDecorator = node.kind === 141; + var isTaggedTemplate = node.kind === 175; + var isDecorator = node.kind === 142; var typeArguments; if (!isTaggedTemplate && !isDecorator) { typeArguments = node.typeArguments; @@ -19313,8 +20179,8 @@ var ts; } else if (candidateForTypeArgumentError) { if (!isTaggedTemplate && !isDecorator && typeArguments) { - var typeArguments_1 = node.typeArguments; - checkTypeArguments(candidateForTypeArgumentError, typeArguments_1, ts.map(typeArguments_1, getTypeFromTypeNode), true, headMessage); + var typeArguments_2 = node.typeArguments; + checkTypeArguments(candidateForTypeArgumentError, typeArguments_2, ts.map(typeArguments_2, getTypeFromTypeNode), true, headMessage); } else { ts.Debug.assert(resultOfFailedInference.failedTypeParameterIndex >= 0); @@ -19420,7 +20286,7 @@ var ts; } return resolveUntypedCall(node); } - var funcType = checkExpression(node.expression); + var funcType = checkNonNullExpression(node.expression); var apparentType = getApparentType(funcType); if (apparentType === unknownType) { return resolveErrorCall(node); @@ -19451,7 +20317,7 @@ var ts; error(node.arguments[spreadIndex], ts.Diagnostics.Spread_operator_in_new_expressions_is_only_available_when_targeting_ECMAScript_5_and_higher); } } - var expressionType = checkExpression(node.expression); + var expressionType = checkNonNullExpression(node.expression); expressionType = getApparentType(expressionType); if (expressionType === unknownType) { return resolveErrorCall(node); @@ -19480,6 +20346,9 @@ var ts; if (getReturnTypeOfSignature(signature) !== voidType) { error(node, ts.Diagnostics.Only_a_void_function_can_be_called_with_the_new_keyword); } + if (signature.thisType === voidType) { + error(node, ts.Diagnostics.A_function_that_is_called_with_the_new_keyword_cannot_have_a_this_type_that_is_void); + } return signature; } error(node, ts.Diagnostics.Cannot_use_new_with_an_expression_whose_type_lacks_a_call_or_construct_signature); @@ -19525,16 +20394,16 @@ var ts; } function getDiagnosticHeadMessageForDecoratorResolution(node) { switch (node.parent.kind) { - case 218: - case 190: + case 220: + case 191: return ts.Diagnostics.Unable_to_resolve_signature_of_class_decorator_when_called_as_an_expression; - case 140: + case 141: return ts.Diagnostics.Unable_to_resolve_signature_of_parameter_decorator_when_called_as_an_expression; - case 143: + case 144: return ts.Diagnostics.Unable_to_resolve_signature_of_property_decorator_when_called_as_an_expression; - case 145: - case 147: + case 146: case 148: + case 149: return ts.Diagnostics.Unable_to_resolve_signature_of_method_decorator_when_called_as_an_expression; } } @@ -19550,7 +20419,7 @@ var ts; } var headMessage = getDiagnosticHeadMessageForDecoratorResolution(node); if (!callSignatures.length) { - var errorInfo; + var errorInfo = void 0; errorInfo = ts.chainDiagnosticMessages(errorInfo, ts.Diagnostics.Cannot_invoke_an_expression_whose_type_lacks_a_call_signature); errorInfo = ts.chainDiagnosticMessages(errorInfo, headMessage); diagnostics.add(ts.createDiagnosticForNodeFromMessageChain(node, errorInfo)); @@ -19562,16 +20431,16 @@ var ts; var links = getNodeLinks(node); if (!links.resolvedSignature || candidatesOutArray) { links.resolvedSignature = anySignature; - if (node.kind === 172) { + if (node.kind === 173) { links.resolvedSignature = resolveCallExpression(node, candidatesOutArray); } - else if (node.kind === 173) { + else if (node.kind === 174) { links.resolvedSignature = resolveNewExpression(node, candidatesOutArray); } - else if (node.kind === 174) { + else if (node.kind === 175) { links.resolvedSignature = resolveTaggedTemplateExpression(node, candidatesOutArray); } - else if (node.kind === 141) { + else if (node.kind === 142) { links.resolvedSignature = resolveDecorator(node, candidatesOutArray); } else { @@ -19593,12 +20462,12 @@ var ts; if (node.expression.kind === 95) { return voidType; } - if (node.kind === 173) { + if (node.kind === 174) { var declaration = signature.declaration; if (declaration && - declaration.kind !== 146 && - declaration.kind !== 150 && - declaration.kind !== 155 && + declaration.kind !== 147 && + declaration.kind !== 151 && + declaration.kind !== 156 && !ts.isJSDocConstructSignature(declaration)) { var funcSymbol = checkExpression(node.expression).symbol; if (funcSymbol && funcSymbol.members && (funcSymbol.flags & 16)) { @@ -19623,18 +20492,29 @@ var ts; var targetType = getTypeFromTypeNode(node.type); if (produceDiagnostics && targetType !== unknownType) { var widenedType = getWidenedType(exprType); - var bothAreStringLike = maybeTypeOfKind(targetType, 258) && - maybeTypeOfKind(widenedType, 258); - if (!bothAreStringLike && !(isTypeAssignableTo(targetType, widenedType))) { - checkTypeAssignableTo(exprType, targetType, node, ts.Diagnostics.Neither_type_0_nor_type_1_is_assignable_to_the_other); + if (!isTypeComparableTo(targetType, widenedType)) { + checkTypeComparableTo(exprType, targetType, node, ts.Diagnostics.Type_0_cannot_be_converted_to_type_1); } } return targetType; } + function checkNonNullAssertion(node) { + return getNonNullableType(checkExpression(node.expression)); + } + function getTypeOfParameter(symbol) { + var type = getTypeOfSymbol(symbol); + if (strictNullChecks) { + var declaration = symbol.valueDeclaration; + if (declaration && declaration.initializer) { + return addNullableKind(type, 32); + } + } + return type; + } function getTypeAtPosition(signature, pos) { return signature.hasRestParameter ? - pos < signature.parameters.length - 1 ? getTypeOfSymbol(signature.parameters[pos]) : getRestTypeOfSignature(signature) : - pos < signature.parameters.length ? getTypeOfSymbol(signature.parameters[pos]) : anyType; + pos < signature.parameters.length - 1 ? getTypeOfParameter(signature.parameters[pos]) : getRestTypeOfSignature(signature) : + pos < signature.parameters.length ? getTypeOfParameter(signature.parameters[pos]) : anyType; } function assignContextualParameterTypes(signature, context, mapper) { var len = signature.parameters.length - (signature.hasRestParameter ? 1 : 0); @@ -19653,7 +20533,7 @@ 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 !== 191) { + if (element.kind !== 192) { if (element.name.kind === 69) { getSymbolLinks(getSymbolOfNode(element)).type = getTypeForBindingElement(element); } @@ -19694,14 +20574,14 @@ var ts; } var isAsync = ts.isAsyncFunctionLike(func); var type; - if (func.body.kind !== 196) { + if (func.body.kind !== 198) { type = checkExpressionCached(func.body, contextualMapper); if (isAsync) { type = checkAwaitedType(type, func, ts.Diagnostics.Return_expression_in_async_function_does_not_have_a_valid_callable_then_member); } } else { - var types; + var types = void 0; var funcIsGenerator = !!func.asteriskToken; if (funcIsGenerator) { types = checkAndAggregateYieldOperandTypes(func.body, contextualMapper); @@ -19714,7 +20594,8 @@ var ts; } } else { - types = checkAndAggregateReturnExpressionTypes(func.body, contextualMapper, isAsync); + var hasImplicitReturn = !!(func.flags & 32768); + types = checkAndAggregateReturnExpressionTypes(func.body, contextualMapper, isAsync, hasImplicitReturn); if (types.length === 0) { if (isAsync) { var promiseType = createPromiseType(voidType); @@ -19776,8 +20657,9 @@ var ts; }); return aggregatedTypes; } - function checkAndAggregateReturnExpressionTypes(body, contextualMapper, isAsync) { + function checkAndAggregateReturnExpressionTypes(body, contextualMapper, isAsync, hasImplicitReturn) { var aggregatedTypes = []; + var hasOmittedExpressions = false; ts.forEachReturnStatement(body, function (returnStatement) { var expr = returnStatement.expression; if (expr) { @@ -19789,7 +20671,15 @@ var ts; aggregatedTypes.push(type); } } + else { + hasOmittedExpressions = true; + } }); + if (strictNullChecks && aggregatedTypes.length && (hasOmittedExpressions || hasImplicitReturn)) { + if (!ts.contains(aggregatedTypes, undefinedType)) { + aggregatedTypes.push(undefinedType); + } + } return aggregatedTypes; } function checkAllCodePathsInNonVoidFunctionReturnOrThrow(func, returnType) { @@ -19799,19 +20689,23 @@ var ts; if (returnType && maybeTypeOfKind(returnType, 1 | 16)) { return; } - if (ts.nodeIsMissing(func.body) || func.body.kind !== 196 || !(func.flags & 32768)) { + if (ts.nodeIsMissing(func.body) || func.body.kind !== 198 || !(func.flags & 32768)) { return; } var hasExplicitReturn = func.flags & 65536; if (returnType && !hasExplicitReturn) { error(func.type, ts.Diagnostics.A_function_whose_declared_type_is_neither_void_nor_any_must_return_a_value); } + else if (returnType && strictNullChecks && !isTypeAssignableTo(undefinedType, returnType)) { + error(func.type, ts.Diagnostics.Function_lacks_ending_return_statement_and_return_type_does_not_include_undefined); + } else if (compilerOptions.noImplicitReturns) { if (!returnType) { - var inferredReturnType = hasExplicitReturn - ? getReturnTypeOfSignature(getSignatureFromDeclaration(func)) - : voidType; - if (inferredReturnType === voidType || isTypeAny(inferredReturnType)) { + if (!hasExplicitReturn) { + return; + } + var inferredReturnType = getReturnTypeOfSignature(getSignatureFromDeclaration(func)); + if (isUnwrappedReturnTypeVoidOrAny(func, inferredReturnType)) { return; } } @@ -19819,12 +20713,13 @@ var ts; } } function checkFunctionExpressionOrObjectLiteralMethod(node, contextualMapper) { - ts.Debug.assert(node.kind !== 145 || ts.isObjectLiteralMethod(node)); + ts.Debug.assert(node.kind !== 146 || ts.isObjectLiteralMethod(node)); var hasGrammarError = checkGrammarFunctionLikeDeclaration(node); - if (!hasGrammarError && node.kind === 177) { + if (!hasGrammarError && node.kind === 178) { checkGrammarForGenerator(node); } if (contextualMapper === identityMapper && isContextSensitive(node)) { + checkNodeDeferred(node); return anyFunctionType; } var links = getNodeLinks(node); @@ -19854,14 +20749,14 @@ var ts; } } } - if (produceDiagnostics && node.kind !== 145 && node.kind !== 144) { + if (produceDiagnostics && node.kind !== 146 && node.kind !== 145) { checkCollisionWithCapturedSuperVariable(node, node.name); checkCollisionWithCapturedThisVariable(node, node.name); } return type; } function checkFunctionExpressionOrObjectLiteralMethodDeferred(node) { - ts.Debug.assert(node.kind !== 145 || ts.isObjectLiteralMethod(node)); + ts.Debug.assert(node.kind !== 146 || ts.isObjectLiteralMethod(node)); var isAsync = ts.isAsyncFunctionLike(node); var returnOrPromisedType = node.type && (isAsync ? checkAsyncFunctionReturnType(node) : getTypeFromTypeNode(node.type)); if (!node.asteriskToken) { @@ -19871,7 +20766,7 @@ var ts; if (!node.type) { getReturnTypeOfSignature(getSignatureFromDeclaration(node)); } - if (node.body.kind === 196) { + if (node.body.kind === 198) { checkSourceElement(node.body); } else { @@ -19904,23 +20799,23 @@ var ts; function isReferenceToReadonlyEntity(expr, symbol) { if (isReadonlySymbol(symbol)) { if (symbol.flags & 4 && - (expr.kind === 170 || expr.kind === 171) && + (expr.kind === 171 || expr.kind === 172) && expr.expression.kind === 97) { var func = ts.getContainingFunction(expr); - return !(func && func.kind === 146 && func.parent === symbol.valueDeclaration.parent); + return !(func && func.kind === 147 && func.parent === symbol.valueDeclaration.parent); } return true; } return false; } function isReferenceThroughNamespaceImport(expr) { - if (expr.kind === 170 || expr.kind === 171) { + if (expr.kind === 171 || expr.kind === 172) { var node = skipParenthesizedNodes(expr.expression); if (node.kind === 69) { var symbol = getNodeLinks(node).resolvedSymbol; if (symbol.flags & 8388608) { var declaration = getDeclarationOfAliasSymbol(symbol); - return declaration && declaration.kind === 228; + return declaration && declaration.kind === 231; } } } @@ -19928,7 +20823,7 @@ var ts; } function checkReferenceExpression(expr, invalidReferenceMessage, constantVariableMessage) { var node = skipParenthesizedNodes(expr); - if (node.kind !== 69 && node.kind !== 170 && node.kind !== 171) { + if (node.kind !== 69 && node.kind !== 171 && node.kind !== 172) { error(expr, invalidReferenceMessage); return false; } @@ -19946,7 +20841,7 @@ var ts; } } } - else if (node.kind === 171) { + else if (node.kind === 172) { if (links.resolvedIndexInfo && links.resolvedIndexInfo.isReadonly) { error(expr, constantVariableMessage); return false; @@ -19992,7 +20887,7 @@ var ts; return booleanType; case 41: case 42: - var ok = checkArithmeticOperandType(node.operand, operandType, ts.Diagnostics.An_arithmetic_operand_must_be_of_type_any_number_or_an_enum_type); + var ok = checkArithmeticOperandType(node.operand, getNonNullableType(operandType), ts.Diagnostics.An_arithmetic_operand_must_be_of_type_any_number_or_an_enum_type); if (ok) { 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); } @@ -20002,7 +20897,7 @@ var ts; } function checkPostfixUnaryExpression(node) { var operandType = checkExpression(node.operand); - var ok = checkArithmeticOperandType(node.operand, operandType, ts.Diagnostics.An_arithmetic_operand_must_be_of_type_any_number_or_an_enum_type); + var ok = checkArithmeticOperandType(node.operand, getNonNullableType(operandType), ts.Diagnostics.An_arithmetic_operand_must_be_of_type_any_number_or_an_enum_type); if (ok) { 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); } @@ -20076,22 +20971,22 @@ var ts; var properties = node.properties; for (var _i = 0, properties_3 = properties; _i < properties_3.length; _i++) { var p = properties_3[_i]; - if (p.kind === 249 || p.kind === 250) { - var name_12 = p.name; - if (name_12.kind === 138) { - checkComputedPropertyName(name_12); + if (p.kind === 252 || p.kind === 253) { + var name_13 = p.name; + if (name_13.kind === 139) { + checkComputedPropertyName(name_13); } - if (isComputedNonLiteralName(name_12)) { + if (isComputedNonLiteralName(name_13)) { continue; } - var text = getTextOfPropertyName(name_12); + var text = getTextOfPropertyName(name_13); var type = isTypeAny(sourceType) ? sourceType : getTypeOfPropertyOfType(sourceType, text) || isNumericLiteralName(text) && getIndexTypeOfType(sourceType, 1) || getIndexTypeOfType(sourceType, 0); if (type) { - if (p.kind === 250) { + if (p.kind === 253) { checkDestructuringAssignment(p, type); } else { @@ -20099,7 +20994,7 @@ var ts; } } else { - error(name_12, ts.Diagnostics.Type_0_has_no_property_1_and_no_string_index_signature, typeToString(sourceType), ts.declarationNameToString(name_12)); + error(name_13, ts.Diagnostics.Type_0_has_no_property_1_and_no_string_index_signature, typeToString(sourceType), ts.declarationNameToString(name_13)); } } else { @@ -20113,8 +21008,8 @@ var ts; var elements = node.elements; for (var i = 0; i < elements.length; i++) { var e = elements[i]; - if (e.kind !== 191) { - if (e.kind !== 189) { + if (e.kind !== 192) { + if (e.kind !== 190) { var propName = "" + i; var type = isTypeAny(sourceType) ? sourceType @@ -20139,7 +21034,7 @@ var ts; } else { var restExpression = e.expression; - if (restExpression.kind === 185 && restExpression.operatorToken.kind === 56) { + if (restExpression.kind === 186 && restExpression.operatorToken.kind === 56) { error(restExpression.operatorToken, ts.Diagnostics.A_rest_element_cannot_have_an_initializer); } else { @@ -20153,7 +21048,7 @@ var ts; } function checkDestructuringAssignment(exprOrAssignment, sourceType, contextualMapper) { var target; - if (exprOrAssignment.kind === 250) { + if (exprOrAssignment.kind === 253) { var prop = exprOrAssignment; if (prop.objectAssignmentInitializer) { checkBinaryLikeExpression(prop.name, prop.equalsToken, prop.objectAssignmentInitializer, contextualMapper); @@ -20163,14 +21058,14 @@ var ts; else { target = exprOrAssignment; } - if (target.kind === 185 && target.operatorToken.kind === 56) { + if (target.kind === 186 && target.operatorToken.kind === 56) { checkBinaryExpression(target, contextualMapper); target = target.left; } - if (target.kind === 169) { + if (target.kind === 170) { return checkObjectLiteralAssignment(target, sourceType, contextualMapper); } - if (target.kind === 168) { + if (target.kind === 169) { return checkArrayLiteralAssignment(target, sourceType, contextualMapper); } return checkReferenceAssignment(target, sourceType, contextualMapper); @@ -20187,7 +21082,7 @@ var ts; } function checkBinaryLikeExpression(left, operatorToken, right, contextualMapper, errorNode) { var operator = operatorToken.kind; - if (operator === 56 && (left.kind === 169 || left.kind === 168)) { + if (operator === 56 && (left.kind === 170 || left.kind === 169)) { return checkDestructuringAssignment(left, checkExpression(right, contextualMapper), contextualMapper); } var leftType = checkExpression(left, contextualMapper); @@ -20215,11 +21110,13 @@ var ts; case 68: case 46: case 66: - if (leftType.flags & (32 | 64)) + if (leftType.flags & 96) leftType = rightType; - if (rightType.flags & (32 | 64)) + if (rightType.flags & 96) rightType = leftType; - var suggestedOperator; + leftType = getNonNullableType(leftType); + rightType = getNonNullableType(rightType); + var suggestedOperator = void 0; if ((leftType.flags & 8) && (rightType.flags & 8) && (suggestedOperator = getSuggestedBooleanOperator(operatorToken.kind)) !== undefined) { @@ -20235,11 +21132,13 @@ var ts; return numberType; case 35: case 57: - if (leftType.flags & (32 | 64)) + if (leftType.flags & 96) leftType = rightType; - if (rightType.flags & (32 | 64)) + if (rightType.flags & 96) rightType = leftType; - var resultType; + leftType = getNonNullableType(leftType); + rightType = getNonNullableType(rightType); + var resultType = void 0; if (isTypeOfKind(leftType, 132) && isTypeOfKind(rightType, 132)) { resultType = numberType; } @@ -20273,10 +21172,7 @@ var ts; case 31: case 32: case 33: - if (maybeTypeOfKind(leftType, 258) && maybeTypeOfKind(rightType, 258)) { - return booleanType; - } - if (!isTypeAssignableTo(leftType, rightType) && !isTypeAssignableTo(rightType, leftType)) { + if (!isTypeComparableTo(leftType, rightType) && !isTypeComparableTo(rightType, leftType)) { reportOperatorError(); } return booleanType; @@ -20285,9 +21181,9 @@ var ts; case 90: return checkInExpression(left, right, leftType, rightType); case 51: - return rightType; + return addNullableKind(rightType, getNullableKind(leftType)); case 52: - return getUnionType([leftType, rightType]); + return getUnionType([getNonNullableType(leftType), rightType]); case 56: checkAssignmentOperator(rightType); return getRegularTypeOfObjectLiteral(rightType); @@ -20359,7 +21255,7 @@ var ts; var func = ts.getContainingFunction(node); if (func && func.asteriskToken) { var expressionType = checkExpressionCached(node.expression, undefined); - var expressionElementType; + var expressionElementType = void 0; var nodeIsYieldStar = !!node.asteriskToken; if (nodeIsYieldStar) { expressionElementType = checkElementTypeOfIterable(expressionType, node.expression); @@ -20411,14 +21307,14 @@ var ts; return links.resolvedType; } function checkPropertyAssignment(node, contextualMapper) { - if (node.name.kind === 138) { + if (node.name.kind === 139) { checkComputedPropertyName(node.name); } return checkExpression(node.initializer, contextualMapper); } function checkObjectLiteralMethod(node, contextualMapper) { checkGrammarMethod(node); - if (node.name.kind === 138) { + if (node.name.kind === 139) { checkComputedPropertyName(node.name); } var uninstantiatedType = checkFunctionExpressionOrObjectLiteralMethod(node, contextualMapper); @@ -20441,7 +21337,7 @@ var ts; } function checkExpression(node, contextualMapper) { var type; - if (node.kind === 137) { + if (node.kind === 138) { type = checkQualifiedName(node); } else { @@ -20449,9 +21345,9 @@ var ts; type = instantiateTypeWithSingleGenericCallSignature(node, uninstantiatedType, contextualMapper); } if (isConstEnumObjectType(type)) { - var ok = (node.parent.kind === 170 && node.parent.expression === node) || - (node.parent.kind === 171 && node.parent.expression === node) || - ((node.kind === 69 || node.kind === 137) && isInRightSideOfImportOrExportAssignment(node)); + var ok = (node.parent.kind === 171 && node.parent.expression === node) || + (node.parent.kind === 172 && node.parent.expression === node) || + ((node.kind === 69 || node.kind === 138) && 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); } @@ -20477,7 +21373,7 @@ var ts; return booleanType; case 8: return checkNumericLiteral(node); - case 187: + case 188: return checkTemplateExpression(node); case 9: return checkStringLiteralExpression(node); @@ -20485,58 +21381,60 @@ var ts; return stringType; case 10: return globalRegExpType; - case 168: - return checkArrayLiteral(node, contextualMapper); case 169: - return checkObjectLiteral(node, contextualMapper); + return checkArrayLiteral(node, contextualMapper); case 170: - return checkPropertyAccessExpression(node); + return checkObjectLiteral(node, contextualMapper); case 171: - return checkIndexedAccess(node); + return checkPropertyAccessExpression(node); case 172: + return checkIndexedAccess(node); case 173: - return checkCallExpression(node); case 174: - return checkTaggedTemplateExpression(node); - case 176: - return checkExpression(node.expression, contextualMapper); - case 190: - return checkClassExpression(node); - case 177: - case 178: - return checkFunctionExpressionOrObjectLiteralMethod(node, contextualMapper); - case 180: - return checkTypeOfExpression(node); + return checkCallExpression(node); case 175: - case 193: - return checkAssertion(node); - case 179: - return checkDeleteExpression(node); - case 181: - return checkVoidExpression(node); - case 182: - return checkAwaitExpression(node); - case 183: - return checkPrefixUnaryExpression(node); - case 184: - return checkPostfixUnaryExpression(node); - case 185: - return checkBinaryExpression(node, contextualMapper); - case 186: - return checkConditionalExpression(node, contextualMapper); - case 189: - return checkSpreadElementExpression(node, contextualMapper); + return checkTaggedTemplateExpression(node); + case 177: + return checkExpression(node.expression, contextualMapper); case 191: + return checkClassExpression(node); + case 178: + case 179: + return checkFunctionExpressionOrObjectLiteralMethod(node, contextualMapper); + case 181: + return checkTypeOfExpression(node); + case 176: + case 194: + return checkAssertion(node); + case 195: + return checkNonNullAssertion(node); + case 180: + return checkDeleteExpression(node); + case 182: + return checkVoidExpression(node); + case 183: + return checkAwaitExpression(node); + case 184: + return checkPrefixUnaryExpression(node); + case 185: + return checkPostfixUnaryExpression(node); + case 186: + return checkBinaryExpression(node, contextualMapper); + case 187: + return checkConditionalExpression(node, contextualMapper); + case 190: + return checkSpreadElementExpression(node, contextualMapper); + case 192: return undefinedType; - case 188: + case 189: return checkYieldExpression(node); - case 244: + case 247: return checkJsxExpression(node); - case 237: + case 240: return checkJsxElement(node); - case 238: + case 241: return checkJsxSelfClosingElement(node); - case 239: + case 242: ts.Debug.fail("Shouldn't ever directly check a JsxOpeningElement"); } return unknownType; @@ -20557,13 +21455,24 @@ var ts; var func = ts.getContainingFunction(node); if (node.flags & 28) { func = ts.getContainingFunction(node); - if (!(func.kind === 146 && ts.nodeIsPresent(func.body))) { + if (!(func.kind === 147 && ts.nodeIsPresent(func.body))) { error(node, ts.Diagnostics.A_parameter_property_is_only_allowed_in_a_constructor_implementation); } } if (node.questionToken && ts.isBindingPattern(node.name) && func.body) { error(node, ts.Diagnostics.A_binding_pattern_parameter_cannot_be_optional_in_an_implementation_signature); } + if (node.name.text === "this") { + if (ts.indexOf(func.parameters, node) !== 0) { + error(node, ts.Diagnostics.A_this_parameter_must_be_the_first_parameter); + } + if (func.kind === 147 || func.kind === 151 || func.kind === 156) { + error(node, ts.Diagnostics.A_constructor_cannot_have_a_this_parameter); + } + if (func.kind === 149) { + error(node, ts.Diagnostics.A_setter_cannot_have_a_this_parameter); + } + } if (node.dotDotDotToken && !ts.isBindingPattern(node.name) && !isArrayType(getTypeOfSymbol(node.symbol))) { error(node, ts.Diagnostics.A_rest_parameter_must_be_of_an_array_type); } @@ -20572,9 +21481,9 @@ var ts; if (!node.asteriskToken || !node.body) { return false; } - return node.kind === 145 || - node.kind === 217 || - node.kind === 177; + return node.kind === 146 || + node.kind === 219 || + node.kind === 178; } function getTypePredicateParameterIndex(parameterList, parameter) { if (parameterList) { @@ -20608,15 +21517,16 @@ var ts; error(parameterName, ts.Diagnostics.A_type_predicate_cannot_reference_a_rest_parameter); } else { - checkTypeAssignableTo(typePredicate.type, getTypeOfNode(parent.parameters[typePredicate.parameterIndex]), node.type); + 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, undefined, leadingError); } } else if (parameterName) { var hasReportedError = false; for (var _i = 0, _a = parent.parameters; _i < _a.length; _i++) { - var name_13 = _a[_i].name; - if (ts.isBindingPattern(name_13) && - checkIfTypePredicateVariableIsDeclaredInBindingPattern(name_13, parameterName, typePredicate.parameterName)) { + var name_14 = _a[_i].name; + if (ts.isBindingPattern(name_14) && + checkIfTypePredicateVariableIsDeclaredInBindingPattern(name_14, parameterName, typePredicate.parameterName)) { hasReportedError = true; break; } @@ -20629,42 +21539,42 @@ var ts; } function getTypePredicateParent(node) { switch (node.parent.kind) { + case 179: + case 150: + case 219: case 178: - case 149: - case 217: - case 177: - case 154: + case 155: + case 146: case 145: - case 144: - var parent_7 = node.parent; - if (node === parent_7.type) { - return parent_7; + var parent_8 = node.parent; + if (node === parent_8.type) { + return parent_8; } } } function checkIfTypePredicateVariableIsDeclaredInBindingPattern(pattern, predicateVariableNode, predicateVariableName) { for (var _i = 0, _a = pattern.elements; _i < _a.length; _i++) { - var name_14 = _a[_i].name; - if (name_14.kind === 69 && - name_14.text === predicateVariableName) { + var name_15 = _a[_i].name; + if (name_15.kind === 69 && + name_15.text === predicateVariableName) { error(predicateVariableNode, ts.Diagnostics.A_type_predicate_cannot_reference_element_0_in_a_binding_pattern, predicateVariableName); return true; } - else if (name_14.kind === 166 || - name_14.kind === 165) { - if (checkIfTypePredicateVariableIsDeclaredInBindingPattern(name_14, predicateVariableNode, predicateVariableName)) { + else if (name_15.kind === 167 || + name_15.kind === 166) { + if (checkIfTypePredicateVariableIsDeclaredInBindingPattern(name_15, predicateVariableNode, predicateVariableName)) { return true; } } } } function checkSignatureDeclaration(node) { - if (node.kind === 151) { + if (node.kind === 152) { checkGrammarIndexSignature(node); } - else if (node.kind === 154 || node.kind === 217 || node.kind === 155 || - node.kind === 149 || node.kind === 146 || - node.kind === 150) { + else if (node.kind === 155 || node.kind === 219 || node.kind === 156 || + node.kind === 150 || node.kind === 147 || + node.kind === 151) { checkGrammarFunctionLikeDeclaration(node); } checkTypeParameters(node.typeParameters); @@ -20676,10 +21586,10 @@ var ts; checkCollisionWithArgumentsInGeneratedCode(node); if (compilerOptions.noImplicitAny && !node.type) { switch (node.kind) { - case 150: + case 151: error(node, ts.Diagnostics.Construct_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type); break; - case 149: + case 150: error(node, ts.Diagnostics.Call_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type); break; } @@ -20703,7 +21613,7 @@ var ts; } } function checkTypeForDuplicateIndexSignatures(node) { - if (node.kind === 219) { + if (node.kind === 221) { var nodeSymbol = getSymbolOfNode(node); if (nodeSymbol.declarations.length > 0 && nodeSymbol.declarations[0] !== node) { return; @@ -20784,12 +21694,12 @@ var ts; if (n.kind === 97) { error(n, ts.Diagnostics.this_cannot_be_referenced_in_current_location); } - else if (n.kind !== 177 && n.kind !== 217) { + else if (n.kind !== 178 && n.kind !== 219) { ts.forEachChild(n, markThisReferencesAsErrors); } } function isInstancePropertyWithInitializer(n) { - return n.kind === 143 && + return n.kind === 144 && !(n.flags & 32) && !!n.initializer; } @@ -20805,10 +21715,10 @@ var ts; ts.forEach(node.parameters, function (p) { return p.flags & (4 | 8 | 16); }); if (superCallShouldBeFirst) { var statements = node.body.statements; - var superCallStatement; + var superCallStatement = void 0; for (var _i = 0, statements_2 = statements; _i < statements_2.length; _i++) { var statement = statements_2[_i]; - if (statement.kind === 199 && ts.isSuperCallExpression(statement.expression)) { + if (statement.kind === 201 && ts.isSuperCallExpression(statement.expression)) { superCallStatement = statement; break; } @@ -20831,7 +21741,7 @@ var ts; checkGrammarFunctionLikeDeclaration(node) || checkGrammarAccessor(node) || checkGrammarComputedPropertyName(node.name); checkDecorators(node); checkSignatureDeclaration(node); - if (node.kind === 147) { + if (node.kind === 148) { if (!ts.isInAmbientContext(node) && ts.nodeIsPresent(node.body) && (node.flags & 32768)) { if (node.flags & 65536) { if (compilerOptions.noImplicitReturns) { @@ -20843,11 +21753,11 @@ var ts; } } } - if (node.name.kind === 138) { + if (node.name.kind === 139) { checkComputedPropertyName(node.name); } if (!ts.hasDynamicName(node)) { - var otherKind = node.kind === 147 ? 148 : 147; + var otherKind = node.kind === 148 ? 149 : 148; var otherAccessor = ts.getDeclarationOfKind(node.symbol, otherKind); if (otherAccessor) { if (((node.flags & 28) !== (otherAccessor.flags & 28))) { @@ -20867,7 +21777,7 @@ var ts; } getTypeOfAccessors(getSymbolOfNode(node)); } - if (node.parent.kind !== 169) { + if (node.parent.kind !== 170) { checkSourceElement(node.body); } else { @@ -20938,9 +21848,9 @@ var ts; } function getEffectiveDeclarationFlags(n, flagsToCheck) { var flags = ts.getCombinedNodeFlags(n); - if (n.parent.kind !== 219 && - n.parent.kind !== 218 && - n.parent.kind !== 190 && + if (n.parent.kind !== 221 && + n.parent.kind !== 220 && + n.parent.kind !== 191 && ts.isInAmbientContext(n)) { if (!(flags & 2)) { flags |= 1; @@ -20960,9 +21870,9 @@ var ts; function checkFlagAgreementBetweenOverloads(overloads, implementation, flagsToCheck, someOverloadFlags, allOverloadFlags) { var someButNotAllOverloadFlags = someOverloadFlags ^ allOverloadFlags; if (someButNotAllOverloadFlags !== 0) { - var canonicalFlags = getEffectiveDeclarationFlags(getCanonicalOverload(overloads, implementation), flagsToCheck); + var canonicalFlags_1 = getEffectiveDeclarationFlags(getCanonicalOverload(overloads, implementation), flagsToCheck); ts.forEach(overloads, function (o) { - var deviation = getEffectiveDeclarationFlags(o, flagsToCheck) ^ canonicalFlags; + var deviation = getEffectiveDeclarationFlags(o, flagsToCheck) ^ canonicalFlags_1; if (deviation & 1) { error(o.name, ts.Diagnostics.Overload_signatures_must_all_be_exported_or_non_exported); } @@ -20980,9 +21890,9 @@ var ts; } function checkQuestionTokenAgreementBetweenOverloads(overloads, implementation, someHaveQuestionToken, allHaveQuestionToken) { if (someHaveQuestionToken !== allHaveQuestionToken) { - var canonicalHasQuestionToken = ts.hasQuestionToken(getCanonicalOverload(overloads, implementation)); + var canonicalHasQuestionToken_1 = ts.hasQuestionToken(getCanonicalOverload(overloads, implementation)); ts.forEach(overloads, function (o) { - var deviation = ts.hasQuestionToken(o) !== canonicalHasQuestionToken; + var deviation = ts.hasQuestionToken(o) !== canonicalHasQuestionToken_1; if (deviation) { error(o.name, ts.Diagnostics.Overload_signatures_must_all_be_optional_or_required); } @@ -21017,7 +21927,7 @@ var ts; if (subsequentNode.kind === node.kind) { var errorNode_1 = subsequentNode.name || subsequentNode; if (node.name && subsequentNode.name && node.name.text === subsequentNode.name.text) { - var reportError = (node.kind === 145 || node.kind === 144) && + var reportError = (node.kind === 146 || node.kind === 145) && (node.flags & 32) !== (subsequentNode.flags & 32); if (reportError) { var diagnostic = node.flags & 32 ? ts.Diagnostics.Function_overload_must_be_static : ts.Diagnostics.Function_overload_must_not_be_static; @@ -21051,11 +21961,11 @@ var ts; var current = declarations_4[_i]; var node = current; var inAmbientContext = ts.isInAmbientContext(node); - var inAmbientContextOrInterface = node.parent.kind === 219 || node.parent.kind === 157 || inAmbientContext; + var inAmbientContextOrInterface = node.parent.kind === 221 || node.parent.kind === 158 || inAmbientContext; if (inAmbientContextOrInterface) { previousDeclaration = undefined; } - if (node.kind === 217 || node.kind === 145 || node.kind === 144 || node.kind === 146) { + if (node.kind === 219 || node.kind === 146 || node.kind === 145 || node.kind === 147) { var currentNodeFlags = getEffectiveDeclarationFlags(node, flagsToCheck); someNodeFlags |= currentNodeFlags; allNodeFlags &= currentNodeFlags; @@ -21166,20 +22076,20 @@ var ts; } function getDeclarationSpaces(d) { switch (d.kind) { - case 219: + case 221: return 2097152; - case 222: + case 224: return ts.isAmbientModule(d) || ts.getModuleInstanceState(d) !== 0 ? 4194304 | 1048576 : 4194304; - case 218: - case 221: + case 220: + case 223: return 2097152 | 1048576; - case 225: - var result = 0; + case 228: + var result_1 = 0; var target = resolveAlias(getSymbolOfNode(d)); - ts.forEach(target.declarations, function (d) { result |= getDeclarationSpaces(d); }); - return result; + ts.forEach(target.declarations, function (d) { result_1 |= getDeclarationSpaces(d); }); + return result_1; default: return 1048576; } @@ -21251,7 +22161,7 @@ var ts; return checkNonThenableType(type, location, message); } else { - if (type.id === promisedType.id || awaitedTypeStack.indexOf(promisedType.id) >= 0) { + if (type.id === promisedType.id || ts.indexOf(awaitedTypeStack, promisedType.id) >= 0) { if (location) { error(location, ts.Diagnostics._0_is_referenced_directly_or_indirectly_in_the_fulfillment_callback_of_its_own_then_method, symbolToString(type.symbol)); } @@ -21322,22 +22232,22 @@ var ts; var headMessage = getDiagnosticHeadMessageForDecoratorResolution(node); var errorInfo; switch (node.parent.kind) { - case 218: + case 220: var classSymbol = getSymbolOfNode(node.parent); var classConstructorType = getTypeOfSymbol(classSymbol); expectedReturnType = getUnionType([classConstructorType, voidType]); break; - case 140: + case 141: expectedReturnType = voidType; errorInfo = ts.chainDiagnosticMessages(errorInfo, ts.Diagnostics.The_return_type_of_a_parameter_decorator_function_must_be_either_void_or_any); break; - case 143: + case 144: expectedReturnType = voidType; errorInfo = ts.chainDiagnosticMessages(errorInfo, ts.Diagnostics.The_return_type_of_a_property_decorator_function_must_be_either_void_or_any); break; - case 145: - case 147: + case 146: case 148: + case 149: var methodType = getTypeOfNode(node.parent); var descriptorType = createTypedPropertyDescriptorType(methodType); expectedReturnType = getUnionType([descriptorType, voidType]); @@ -21346,9 +22256,9 @@ var ts; checkTypeAssignableTo(returnType, expectedReturnType, node, headMessage, errorInfo); } function checkTypeNodeAsExpression(node) { - if (node && node.kind === 153) { + if (node && node.kind === 154) { var root = getFirstIdentifier(node.typeName); - var meaning = root.parent.kind === 153 ? 793056 : 1536; + var meaning = root.parent.kind === 154 ? 793056 : 1536; var rootSymbol = resolveName(root, root.text, meaning | 8388608, undefined, undefined); if (rootSymbol && rootSymbol.flags & 8388608) { var aliasTarget = resolveAlias(rootSymbol); @@ -21382,20 +22292,20 @@ var ts; } if (compilerOptions.emitDecoratorMetadata) { switch (node.kind) { - case 218: + case 220: var constructor = ts.getFirstConstructorWithBody(node); if (constructor) { checkParameterTypeAnnotationsAsExpressions(constructor); } break; - case 145: - case 147: + case 146: case 148: + case 149: checkParameterTypeAnnotationsAsExpressions(node); checkReturnTypeAnnotationAsExpression(node); break; - case 143: - case 140: + case 144: + case 141: checkTypeAnnotationAsExpression(node); break; } @@ -21415,7 +22325,7 @@ var ts; checkDecorators(node); checkSignatureDeclaration(node); var isAsync = ts.isAsyncFunctionLike(node); - if (node.name && node.name.kind === 138) { + if (node.name && node.name.kind === 139) { checkComputedPropertyName(node.name); } if (!ts.hasDynamicName(node)) { @@ -21447,7 +22357,7 @@ var ts; } } function checkBlock(node) { - if (node.kind === 196) { + if (node.kind === 198) { checkGrammarStatementInAmbientContext(node); } ts.forEach(node.statements, checkSourceElement); @@ -21466,19 +22376,19 @@ var ts; if (!(identifier && identifier.text === name)) { return false; } - if (node.kind === 143 || - node.kind === 142 || + if (node.kind === 144 || + node.kind === 143 || + node.kind === 146 || node.kind === 145 || - node.kind === 144 || - node.kind === 147 || - node.kind === 148) { + node.kind === 148 || + node.kind === 149) { return false; } if (ts.isInAmbientContext(node)) { return false; } var root = ts.getRootDeclaration(node); - if (root.kind === 140 && ts.nodeIsMissing(root.parent.body)) { + if (root.kind === 141 && ts.nodeIsMissing(root.parent.body)) { return false; } return true; @@ -21526,11 +22436,11 @@ var ts; if (!needCollisionCheckForIdentifier(node, name, "require") && !needCollisionCheckForIdentifier(node, name, "exports")) { return; } - if (node.kind === 222 && ts.getModuleInstanceState(node) !== 1) { + if (node.kind === 224 && ts.getModuleInstanceState(node) !== 1) { return; } var parent = getDeclarationContainer(node); - if (parent.kind === 252 && ts.isExternalOrCommonJsModule(parent)) { + if (parent.kind === 255 && ts.isExternalOrCommonJsModule(parent)) { error(name, ts.Diagnostics.Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module, ts.declarationNameToString(name), ts.declarationNameToString(name)); } } @@ -21538,11 +22448,11 @@ var ts; if (!needCollisionCheckForIdentifier(node, name, "Promise")) { return; } - if (node.kind === 222 && ts.getModuleInstanceState(node) !== 1) { + if (node.kind === 224 && ts.getModuleInstanceState(node) !== 1) { return; } var parent = getDeclarationContainer(node); - if (parent.kind === 252 && ts.isExternalOrCommonJsModule(parent) && parent.flags & 2097152) { + if (parent.kind === 255 && ts.isExternalOrCommonJsModule(parent) && parent.flags & 2097152) { 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)); } } @@ -21550,7 +22460,7 @@ var ts; if ((ts.getCombinedNodeFlags(node) & 3072) !== 0 || ts.isParameterDeclaration(node)) { return; } - if (node.kind === 215 && !node.initializer) { + if (node.kind === 217 && !node.initializer) { return; } var symbol = getSymbolOfNode(node); @@ -21560,25 +22470,25 @@ var ts; localDeclarationSymbol !== symbol && localDeclarationSymbol.flags & 2) { if (getDeclarationFlagsFromSymbol(localDeclarationSymbol) & 3072) { - var varDeclList = ts.getAncestor(localDeclarationSymbol.valueDeclaration, 216); - var container = varDeclList.parent.kind === 197 && varDeclList.parent.parent + var varDeclList = ts.getAncestor(localDeclarationSymbol.valueDeclaration, 218); + var container = varDeclList.parent.kind === 199 && varDeclList.parent.parent ? varDeclList.parent.parent : undefined; var namesShareScope = container && - (container.kind === 196 && ts.isFunctionLike(container.parent) || - container.kind === 223 || - container.kind === 222 || - container.kind === 252); + (container.kind === 198 && ts.isFunctionLike(container.parent) || + container.kind === 225 || + container.kind === 224 || + container.kind === 255); if (!namesShareScope) { - var name_15 = symbolToString(localDeclarationSymbol); - error(node, ts.Diagnostics.Cannot_initialize_outer_scoped_variable_0_in_the_same_scope_as_block_scoped_declaration_1, name_15, name_15); + var name_16 = symbolToString(localDeclarationSymbol); + error(node, ts.Diagnostics.Cannot_initialize_outer_scoped_variable_0_in_the_same_scope_as_block_scoped_declaration_1, name_16, name_16); } } } } } function checkParameterInitializer(node) { - if (ts.getRootDeclaration(node).kind !== 140) { + if (ts.getRootDeclaration(node).kind !== 141) { return; } var func = ts.getContainingFunction(node); @@ -21587,7 +22497,7 @@ var ts; if (n.kind === 69) { var referencedSymbol = getNodeLinks(n).resolvedSymbol; if (referencedSymbol && referencedSymbol !== unknownSymbol && getSymbol(func.locals, referencedSymbol.name, 107455) === referencedSymbol) { - if (referencedSymbol.valueDeclaration.kind === 140) { + if (referencedSymbol.valueDeclaration.kind === 141) { if (referencedSymbol.valueDeclaration === node) { error(n, ts.Diagnostics.Parameter_0_cannot_be_referenced_in_its_initializer, ts.declarationNameToString(node.name)); return; @@ -21607,26 +22517,33 @@ var ts; function checkVariableLikeDeclaration(node) { checkDecorators(node); checkSourceElement(node.type); - if (node.name.kind === 138) { + if (node.name.kind === 139) { checkComputedPropertyName(node.name); if (node.initializer) { checkExpressionCached(node.initializer); } } - if (node.kind === 167) { - if (node.propertyName && node.propertyName.kind === 138) { + if (node.kind === 168) { + if (node.propertyName && node.propertyName.kind === 139) { checkComputedPropertyName(node.propertyName); } + var parent_9 = node.parent.parent; + var parentType = getTypeForBindingElementParent(parent_9); + var name_17 = node.propertyName || node.name; + var property = getPropertyOfType(parentType, getTextOfPropertyName(name_17)); + if (parent_9.initializer && property && getParentOfSymbol(property)) { + checkClassPropertyAccess(parent_9, parent_9.initializer, parentType, property); + } } if (ts.isBindingPattern(node.name)) { ts.forEach(node.name.elements, checkSourceElement); } - if (node.initializer && ts.getRootDeclaration(node).kind === 140 && ts.nodeIsMissing(ts.getContainingFunction(node).body)) { + if (node.initializer && ts.getRootDeclaration(node).kind === 141 && ts.nodeIsMissing(ts.getContainingFunction(node).body)) { error(node, ts.Diagnostics.A_parameter_initializer_is_only_allowed_in_a_function_or_constructor_implementation); return; } if (ts.isBindingPattern(node.name)) { - if (node.initializer && node.parent.parent.kind !== 204) { + if (node.initializer && node.parent.parent.kind !== 206) { checkTypeAssignableTo(checkExpressionCached(node.initializer), getWidenedTypeForVariableLikeDeclaration(node), node, undefined); checkParameterInitializer(node); } @@ -21635,7 +22552,7 @@ var ts; var symbol = getSymbolOfNode(node); var type = getTypeOfVariableOrParameterOrProperty(symbol); if (node === symbol.valueDeclaration) { - if (node.initializer && node.parent.parent.kind !== 204) { + if (node.initializer && node.parent.parent.kind !== 206) { checkTypeAssignableTo(checkExpressionCached(node.initializer), type, node, undefined); checkParameterInitializer(node); } @@ -21649,9 +22566,9 @@ var ts; checkTypeAssignableTo(checkExpressionCached(node.initializer), declarationType, node, undefined); } } - if (node.kind !== 143 && node.kind !== 142) { + if (node.kind !== 144 && node.kind !== 143) { checkExportsOnMergedDeclarations(node); - if (node.kind === 215 || node.kind === 167) { + if (node.kind === 217 || node.kind === 168) { checkVarDeclaredNamesNotShadowed(node); } checkCollisionWithCapturedSuperVariable(node, node.name); @@ -21673,7 +22590,7 @@ var ts; ts.forEach(node.declarationList.declarations, checkSourceElement); } function checkGrammarDisallowedModifiersOnObjectLiteralExpressionMethod(node) { - if (node.modifiers && node.parent.kind === 169) { + if (node.modifiers && node.parent.kind === 170) { if (ts.isAsyncFunctionLike(node)) { if (node.modifiers.length > 1) { return grammarErrorOnFirstToken(node, ts.Diagnostics.Modifiers_cannot_appear_here); @@ -21692,7 +22609,7 @@ var ts; checkGrammarStatementInAmbientContext(node); checkExpression(node.expression); checkSourceElement(node.thenStatement); - if (node.thenStatement.kind === 198) { + if (node.thenStatement.kind === 200) { error(node.thenStatement, ts.Diagnostics.The_body_of_an_if_statement_cannot_be_the_empty_statement); } checkSourceElement(node.elseStatement); @@ -21709,12 +22626,12 @@ var ts; } function checkForStatement(node) { if (!checkGrammarStatementInAmbientContext(node)) { - if (node.initializer && node.initializer.kind === 216) { + if (node.initializer && node.initializer.kind === 218) { checkGrammarVariableDeclarationList(node.initializer); } } if (node.initializer) { - if (node.initializer.kind === 216) { + if (node.initializer.kind === 218) { ts.forEach(node.initializer.declarations, checkVariableDeclaration); } else { @@ -21729,13 +22646,13 @@ var ts; } function checkForOfStatement(node) { checkGrammarForInOrForOfStatement(node); - if (node.initializer.kind === 216) { + if (node.initializer.kind === 218) { checkForInOrForOfVariableDeclaration(node); } else { var varExpr = node.initializer; var iteratedType = checkRightHandSideOfForOf(node.expression); - if (varExpr.kind === 168 || varExpr.kind === 169) { + if (varExpr.kind === 169 || varExpr.kind === 170) { checkDestructuringAssignment(varExpr, iteratedType || unknownType); } else { @@ -21750,7 +22667,7 @@ var ts; } function checkForInStatement(node) { checkGrammarForInOrForOfStatement(node); - if (node.initializer.kind === 216) { + if (node.initializer.kind === 218) { 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); @@ -21760,7 +22677,7 @@ var ts; else { var varExpr = node.initializer; var leftType = checkExpression(varExpr); - if (varExpr.kind === 168 || varExpr.kind === 169) { + if (varExpr.kind === 169 || varExpr.kind === 170) { error(varExpr, ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern); } else if (!isTypeAnyOrAllConstituentTypesHaveKind(leftType, 258)) { @@ -21770,7 +22687,7 @@ var ts; 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); } } - var rightType = checkExpression(node.expression); + var rightType = checkNonNullExpression(node.expression); if (!isTypeAnyOrAllConstituentTypesHaveKind(rightType, 80896 | 512)) { 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); } @@ -21784,7 +22701,7 @@ var ts; } } function checkRightHandSideOfForOf(rhsExpression) { - var expressionType = getTypeOfExpression(rhsExpression); + var expressionType = checkNonNullExpression(rhsExpression); return checkIteratedTypeOrElementType(expressionType, rhsExpression, true); } function checkIteratedTypeOrElementType(inputType, errorNode, allowStringInput) { @@ -21819,7 +22736,7 @@ var ts; } var typeAsIterable = type; if (!typeAsIterable.iterableElementType) { - if ((type.flags & 4096) && type.target === globalIterableType) { + if ((type.flags & 4096) && type.target === getGlobalIterableType()) { typeAsIterable.iterableElementType = type.typeArguments[0]; } else { @@ -21845,7 +22762,7 @@ var ts; } var typeAsIterator = type; if (!typeAsIterator.iteratorElementType) { - if ((type.flags & 4096) && type.target === globalIteratorType) { + if ((type.flags & 4096) && type.target === getGlobalIteratorType()) { typeAsIterator.iteratorElementType = type.typeArguments[0]; } else { @@ -21880,7 +22797,7 @@ var ts; if (isTypeAny(type)) { return undefined; } - if ((type.flags & 4096) && type.target === globalIterableIteratorType) { + if ((type.flags & 4096) && type.target === getGlobalIterableIteratorType()) { return type.typeArguments[0]; } return getElementTypeOfIterable(type, undefined) || @@ -21928,7 +22845,11 @@ var ts; checkGrammarStatementInAmbientContext(node) || checkGrammarBreakOrContinueStatement(node); } function isGetAccessorWithAnnotatedSetAccessor(node) { - return !!(node.kind === 147 && ts.getSetAccessorTypeAnnotationNode(ts.getDeclarationOfKind(node.symbol, 148))); + return !!(node.kind === 148 && ts.getSetAccessorTypeAnnotationNode(ts.getDeclarationOfKind(node.symbol, 149))); + } + function isUnwrappedReturnTypeVoidOrAny(func, returnType) { + var unwrappedReturnType = ts.isAsyncFunctionLike(func) ? getPromisedType(returnType) : returnType; + return maybeTypeOfKind(unwrappedReturnType, 16 | 1); } function checkReturnStatement(node) { if (!checkGrammarStatementInAmbientContext(node)) { @@ -21937,36 +22858,41 @@ var ts; grammarErrorOnFirstToken(node, ts.Diagnostics.A_return_statement_can_only_be_used_within_a_function_body); } } - if (node.expression) { - var func = ts.getContainingFunction(node); - if (func) { - var signature = getSignatureFromDeclaration(func); - var returnType = getReturnTypeOfSignature(signature); - var exprType = checkExpressionCached(node.expression); + var func = ts.getContainingFunction(node); + if (func) { + var signature = getSignatureFromDeclaration(func); + var returnType = getReturnTypeOfSignature(signature); + if (strictNullChecks || node.expression) { + var exprType = node.expression ? checkExpressionCached(node.expression) : undefinedType; if (func.asteriskToken) { return; } - if (func.kind === 148) { - error(node.expression, ts.Diagnostics.Setters_cannot_return_a_value); + if (func.kind === 149) { + if (node.expression) { + error(node.expression, ts.Diagnostics.Setters_cannot_return_a_value); + } } - else if (func.kind === 146) { - if (!checkTypeAssignableTo(exprType, returnType, node.expression)) { + else if (func.kind === 147) { + 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); } } else if (func.type || isGetAccessorWithAnnotatedSetAccessor(func)) { if (ts.isAsyncFunctionLike(func)) { var promisedType = getPromisedType(returnType); - var awaitedType = checkAwaitedType(exprType, node.expression, ts.Diagnostics.Return_expression_in_async_function_does_not_have_a_valid_callable_then_member); + var awaitedType = checkAwaitedType(exprType, node.expression || node, ts.Diagnostics.Return_expression_in_async_function_does_not_have_a_valid_callable_then_member); if (promisedType) { - checkTypeAssignableTo(awaitedType, promisedType, node.expression); + checkTypeAssignableTo(awaitedType, promisedType, node.expression || node); } } else { - checkTypeAssignableTo(exprType, returnType, node.expression); + checkTypeAssignableTo(exprType, returnType, node.expression || node); } } } + else if (func.kind !== 147 && compilerOptions.noImplicitReturns && !isUnwrappedReturnTypeVoidOrAny(func, returnType)) { + error(node, ts.Diagnostics.Not_all_code_paths_return_a_value); + } } } function checkWithStatement(node) { @@ -21983,9 +22909,8 @@ var ts; var firstDefaultClause; var hasDuplicateDefaultClause = false; var expressionType = checkExpression(node.expression); - var expressionTypeIsStringLike = maybeTypeOfKind(expressionType, 258); ts.forEach(node.caseBlock.clauses, function (clause) { - if (clause.kind === 246 && !hasDuplicateDefaultClause) { + if (clause.kind === 249 && !hasDuplicateDefaultClause) { if (firstDefaultClause === undefined) { firstDefaultClause = clause; } @@ -21997,13 +22922,11 @@ var ts; hasDuplicateDefaultClause = true; } } - if (produceDiagnostics && clause.kind === 245) { + if (produceDiagnostics && clause.kind === 248) { var caseClause = clause; var caseType = checkExpression(caseClause.expression); - var expressionTypeIsAssignableToCaseType = (expressionTypeIsStringLike && maybeTypeOfKind(caseType, 258)) || - isTypeAssignableTo(expressionType, caseType); - if (!expressionTypeIsAssignableToCaseType) { - checkTypeAssignableTo(caseType, expressionType, caseClause.expression, undefined); + if (!isTypeComparableTo(expressionType, caseType)) { + checkTypeComparableTo(caseType, expressionType, caseClause.expression, undefined); } } ts.forEach(clause.statements, checkSourceElement); @@ -22016,7 +22939,7 @@ var ts; if (ts.isFunctionLike(current)) { break; } - if (current.kind === 211 && current.label.text === node.label.text) { + if (current.kind === 213 && 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; @@ -22110,7 +23033,7 @@ var ts; return; } var errorNode; - if (prop.valueDeclaration.name.kind === 138 || prop.parent === containingType.symbol) { + if (prop.valueDeclaration.name.kind === 139 || prop.parent === containingType.symbol) { errorNode = prop.valueDeclaration; } else if (indexDeclaration) { @@ -22161,7 +23084,7 @@ var ts; var firstDecl; for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; - if (declaration.kind === 218 || declaration.kind === 219) { + if (declaration.kind === 220 || declaration.kind === 221) { if (!firstDecl) { firstDecl = declaration; } @@ -22206,7 +23129,7 @@ var ts; if (baseTypeNode) { var baseTypes = getBaseTypes(type); if (baseTypes.length && produceDiagnostics) { - var baseType = baseTypes[0]; + var baseType_1 = baseTypes[0]; var staticBaseType = getBaseConstructorTypeOfClass(type); checkBaseTypeAccessibility(staticBaseType, baseTypeNode); checkSourceElement(baseTypeNode.expression); @@ -22219,15 +23142,15 @@ var ts; } } } - checkTypeAssignableTo(typeWithThis, getTypeWithThisArgument(baseType, type.thisType), node.name || node, ts.Diagnostics.Class_0_incorrectly_extends_base_class_1); + 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 (!(staticBaseType.symbol && staticBaseType.symbol.flags & 32)) { var constructors = getInstantiatedConstructorsForTypeArguments(staticBaseType, baseTypeNode.typeArguments); - if (ts.forEach(constructors, function (sig) { return getReturnTypeOfSignature(sig) !== baseType; })) { + if (ts.forEach(constructors, function (sig) { return getReturnTypeOfSignature(sig) !== baseType_1; })) { error(baseTypeNode.expression, ts.Diagnostics.Base_constructors_must_all_have_the_same_return_type); } } - checkKindsOfPropertyMemberOverrides(type, baseType); + checkKindsOfPropertyMemberOverrides(type, baseType_1); } } var implementedTypeNodes = ts.getClassImplementsHeritageClauseElements(node); @@ -22290,7 +23213,7 @@ var ts; if (derived === base) { var derivedClassDecl = getClassLikeDeclarationOfSymbol(type.symbol); if (baseDeclarationFlags & 128 && (!derivedClassDecl || !(derivedClassDecl.flags & 128))) { - if (derivedClassDecl.kind === 190) { + if (derivedClassDecl.kind === 191) { error(derivedClassDecl, ts.Diagnostics.Non_abstract_class_expression_does_not_implement_inherited_abstract_member_0_from_class_1, symbolToString(baseProperty), typeToString(baseType)); } else { @@ -22334,7 +23257,7 @@ var ts; } } function isAccessor(kind) { - return kind === 147 || kind === 148; + return kind === 148 || kind === 149; } function areTypeParametersIdentical(list1, list2) { if (!list1 && !list2) { @@ -22401,7 +23324,7 @@ var ts; checkExportsOnMergedDeclarations(node); var symbol = getSymbolOfNode(node); checkTypeParameterListsIdentical(node, symbol); - var firstInterfaceDecl = ts.getDeclarationOfKind(symbol, 219); + var firstInterfaceDecl = ts.getDeclarationOfKind(symbol, 221); if (node === firstInterfaceDecl) { var type = getDeclaredTypeOfSymbol(symbol); var typeWithThis = getTypeWithThisArgument(type); @@ -22494,7 +23417,7 @@ var ts; return value; function evalConstant(e) { switch (e.kind) { - case 183: + case 184: var value_1 = evalConstant(e.operand); if (value_1 === undefined) { return undefined; @@ -22505,7 +23428,7 @@ var ts; case 50: return ~value_1; } return undefined; - case 185: + case 186: var left = evalConstant(e.left); if (left === undefined) { return undefined; @@ -22530,22 +23453,22 @@ var ts; return undefined; case 8: return +e.text; - case 176: + case 177: return evalConstant(e.expression); case 69: + case 172: case 171: - case 170: var member = initializer.parent; var currentType = getTypeOfSymbol(getSymbolOfNode(member.parent)); var enumType_1; - var propertyName; + var propertyName = void 0; if (e.kind === 69) { enumType_1 = currentType; propertyName = e.text; } else { - var expression; - if (e.kind === 171) { + var expression = void 0; + if (e.kind === 172) { if (e.argumentExpression === undefined || e.argumentExpression.kind !== 9) { return undefined; @@ -22562,7 +23485,7 @@ var ts; if (current.kind === 69) { break; } - else if (current.kind === 170) { + else if (current.kind === 171) { current = current.expression; } else { @@ -22620,9 +23543,9 @@ var ts; } }); } - var seenEnumMissingInitialInitializer = false; + var seenEnumMissingInitialInitializer_1 = false; ts.forEach(enumSymbol.declarations, function (declaration) { - if (declaration.kind !== 221) { + if (declaration.kind !== 223) { return false; } var enumDeclaration = declaration; @@ -22631,11 +23554,11 @@ var ts; } var firstEnumMember = enumDeclaration.members[0]; if (!firstEnumMember.initializer) { - if (seenEnumMissingInitialInitializer) { + if (seenEnumMissingInitialInitializer_1) { error(firstEnumMember.name, ts.Diagnostics.In_an_enum_with_multiple_declarations_only_one_declaration_can_omit_an_initializer_for_its_first_enum_element); } else { - seenEnumMissingInitialInitializer = true; + seenEnumMissingInitialInitializer_1 = true; } } }); @@ -22645,8 +23568,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 === 218 || - (declaration.kind === 217 && ts.nodeIsPresent(declaration.body))) && + if ((declaration.kind === 220 || + (declaration.kind === 219 && ts.nodeIsPresent(declaration.body))) && !ts.isInAmbientContext(declaration)) { return declaration; } @@ -22703,7 +23626,7 @@ var ts; error(node.name, ts.Diagnostics.A_namespace_declaration_cannot_be_located_prior_to_a_class_or_function_with_which_it_is_merged); } } - var mergedClass = ts.getDeclarationOfKind(symbol, 218); + var mergedClass = ts.getDeclarationOfKind(symbol, 220); if (mergedClass && inSameLexicalScope(node, mergedClass)) { getNodeLinks(node).flags |= 32768; @@ -22741,40 +23664,40 @@ var ts; } function checkModuleAugmentationElement(node, isGlobalAugmentation) { switch (node.kind) { - case 197: + case 199: for (var _i = 0, _a = node.declarationList.declarations; _i < _a.length; _i++) { var decl = _a[_i]; checkModuleAugmentationElement(decl, isGlobalAugmentation); } break; - case 231: - case 232: + case 234: + case 235: grammarErrorOnFirstToken(node, ts.Diagnostics.Exports_and_export_assignments_are_not_permitted_in_module_augmentations); break; - case 225: + case 228: if (node.moduleReference.kind !== 9) { error(node.name, ts.Diagnostics.Module_augmentation_cannot_introduce_new_names_in_the_top_level_scope); break; } - case 226: + case 229: grammarErrorOnFirstToken(node, ts.Diagnostics.Imports_are_not_permitted_in_module_augmentations_Consider_moving_them_to_the_enclosing_external_module); break; - case 167: - case 215: - var name_16 = node.name; - if (ts.isBindingPattern(name_16)) { - for (var _b = 0, _c = name_16.elements; _b < _c.length; _b++) { + case 168: + case 217: + var name_18 = node.name; + if (ts.isBindingPattern(name_18)) { + for (var _b = 0, _c = name_18.elements; _b < _c.length; _b++) { var el = _c[_b]; checkModuleAugmentationElement(el, isGlobalAugmentation); } break; } - case 218: - case 221: - case 217: - case 219: - case 222: case 220: + case 223: + case 219: + case 221: + case 224: + case 222: var symbol = getSymbolOfNode(node); if (symbol) { var reportError = !(symbol.flags & 33554432); @@ -22783,7 +23706,7 @@ var ts; reportError = symbol.parent !== undefined; } else { - reportError = ts.isExternalModuleAugmentation(symbol.parent.valueDeclaration); + reportError = ts.isExternalModuleAugmentation(symbol.parent.declarations[0]); } } if (reportError) { @@ -22795,10 +23718,10 @@ var ts; } function getFirstIdentifier(node) { while (true) { - if (node.kind === 137) { + if (node.kind === 138) { node = node.left; } - else if (node.kind === 170) { + else if (node.kind === 171) { node = node.expression; } else { @@ -22814,9 +23737,9 @@ var ts; error(moduleName, ts.Diagnostics.String_literal_expected); return false; } - var inAmbientExternalModule = node.parent.kind === 223 && ts.isAmbientModule(node.parent.parent); - if (node.parent.kind !== 252 && !inAmbientExternalModule) { - error(moduleName, node.kind === 232 ? + var inAmbientExternalModule = node.parent.kind === 225 && ts.isAmbientModule(node.parent.parent); + if (node.parent.kind !== 255 && !inAmbientExternalModule) { + error(moduleName, node.kind === 235 ? ts.Diagnostics.Export_declarations_are_not_permitted_in_a_namespace : ts.Diagnostics.Import_declarations_in_a_namespace_cannot_reference_a_module); return false; @@ -22833,11 +23756,11 @@ var ts; var symbol = getSymbolOfNode(node); var target = resolveAlias(symbol); if (target !== unknownSymbol) { - var excludedMeanings = (symbol.flags & 107455 ? 107455 : 0) | + var excludedMeanings = (symbol.flags & (107455 | 1048576) ? 107455 : 0) | (symbol.flags & 793056 ? 793056 : 0) | (symbol.flags & 1536 ? 1536 : 0); if (target.flags & excludedMeanings) { - var message = node.kind === 234 ? + var message = node.kind === 237 ? 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)); @@ -22864,7 +23787,7 @@ var ts; checkImportBinding(importClause); } if (importClause.namedBindings) { - if (importClause.namedBindings.kind === 228) { + if (importClause.namedBindings.kind === 231) { checkImportBinding(importClause.namedBindings); } else { @@ -22915,8 +23838,8 @@ var ts; if (!node.moduleSpecifier || checkExternalImportOrExportDeclaration(node)) { if (node.exportClause) { ts.forEach(node.exportClause.elements, checkExportSpecifier); - var inAmbientExternalModule = node.parent.kind === 223 && ts.isAmbientModule(node.parent.parent); - if (node.parent.kind !== 252 && !inAmbientExternalModule) { + var inAmbientExternalModule = node.parent.kind === 225 && ts.isAmbientModule(node.parent.parent); + if (node.parent.kind !== 255 && !inAmbientExternalModule) { error(node, ts.Diagnostics.Export_declarations_are_not_permitted_in_a_namespace); } } @@ -22929,7 +23852,7 @@ var ts; } } function checkGrammarModuleElementContext(node, errorMessage) { - if (node.parent.kind !== 252 && node.parent.kind !== 223 && node.parent.kind !== 222) { + if (node.parent.kind !== 255 && node.parent.kind !== 225 && node.parent.kind !== 224) { return grammarErrorOnFirstToken(node, errorMessage); } } @@ -22950,8 +23873,8 @@ var ts; if (checkGrammarModuleElementContext(node, ts.Diagnostics.An_export_assignment_can_only_be_used_in_a_module)) { return; } - var container = node.parent.kind === 252 ? node.parent : node.parent.parent; - if (container.kind === 222 && !ts.isAmbientModule(container)) { + var container = node.parent.kind === 255 ? node.parent : node.parent.parent; + if (container.kind === 224 && !ts.isAmbientModule(container)) { error(node, ts.Diagnostics.An_export_assignment_cannot_be_used_in_a_namespace); return; } @@ -23018,7 +23941,7 @@ var ts; links.exportsChecked = true; } function isNotOverload(declaration) { - return declaration.kind !== 217 || !!declaration.body; + return declaration.kind !== 219 || !!declaration.body; } } function checkSourceElement(node) { @@ -23028,118 +23951,118 @@ var ts; var kind = node.kind; if (cancellationToken) { switch (kind) { - case 222: - case 218: + case 224: + case 220: + case 221: case 219: - case 217: cancellationToken.throwIfCancellationRequested(); } } switch (kind) { - case 139: - return checkTypeParameter(node); case 140: + return checkTypeParameter(node); + case 141: return checkParameter(node); + case 144: case 143: - case 142: return checkPropertyDeclaration(node); - case 154: case 155: - case 149: + case 156: case 150: - return checkSignatureDeclaration(node); case 151: return checkSignatureDeclaration(node); - case 145: - case 144: - return checkMethodDeclaration(node); - case 146: - return checkConstructorDeclaration(node); - case 147: - case 148: - return checkAccessorDeclaration(node); - case 153: - return checkTypeReferenceNode(node); case 152: + return checkSignatureDeclaration(node); + case 146: + case 145: + return checkMethodDeclaration(node); + case 147: + return checkConstructorDeclaration(node); + case 148: + case 149: + return checkAccessorDeclaration(node); + case 154: + return checkTypeReferenceNode(node); + case 153: return checkTypePredicate(node); - case 156: - return checkTypeQuery(node); case 157: - return checkTypeLiteral(node); + return checkTypeQuery(node); case 158: - return checkArrayType(node); + return checkTypeLiteral(node); case 159: - return checkTupleType(node); + return checkArrayType(node); case 160: + return checkTupleType(node); case 161: - return checkUnionOrIntersectionType(node); case 162: + return checkUnionOrIntersectionType(node); + case 163: return checkSourceElement(node.type); - case 217: - return checkFunctionDeclaration(node); - case 196: - case 223: - return checkBlock(node); - case 197: - return checkVariableStatement(node); - case 199: - return checkExpressionStatement(node); - case 200: - return checkIfStatement(node); - case 201: - return checkDoStatement(node); - case 202: - return checkWhileStatement(node); - case 203: - return checkForStatement(node); - case 204: - return checkForInStatement(node); - case 205: - return checkForOfStatement(node); - case 206: - case 207: - return checkBreakOrContinueStatement(node); - case 208: - return checkReturnStatement(node); - case 209: - return checkWithStatement(node); - case 210: - return checkSwitchStatement(node); - case 211: - return checkLabeledStatement(node); - case 212: - return checkThrowStatement(node); - case 213: - return checkTryStatement(node); - case 215: - return checkVariableDeclaration(node); - case 167: - return checkBindingElement(node); - case 218: - return checkClassDeclaration(node); case 219: - return checkInterfaceDeclaration(node); - case 220: - return checkTypeAliasDeclaration(node); - case 221: - return checkEnumDeclaration(node); - case 222: - return checkModuleDeclaration(node); - case 226: - return checkImportDeclaration(node); - case 225: - return checkImportEqualsDeclaration(node); - case 232: - return checkExportDeclaration(node); - case 231: - return checkExportAssignment(node); + return checkFunctionDeclaration(node); case 198: - checkGrammarStatementInAmbientContext(node); - return; + case 225: + return checkBlock(node); + case 199: + return checkVariableStatement(node); + case 201: + return checkExpressionStatement(node); + case 202: + return checkIfStatement(node); + case 203: + return checkDoStatement(node); + case 204: + return checkWhileStatement(node); + case 205: + return checkForStatement(node); + case 206: + return checkForInStatement(node); + case 207: + return checkForOfStatement(node); + case 208: + case 209: + return checkBreakOrContinueStatement(node); + case 210: + return checkReturnStatement(node); + case 211: + return checkWithStatement(node); + case 212: + return checkSwitchStatement(node); + case 213: + return checkLabeledStatement(node); case 214: + return checkThrowStatement(node); + case 215: + return checkTryStatement(node); + case 217: + return checkVariableDeclaration(node); + case 168: + return checkBindingElement(node); + case 220: + return checkClassDeclaration(node); + case 221: + return checkInterfaceDeclaration(node); + case 222: + return checkTypeAliasDeclaration(node); + case 223: + return checkEnumDeclaration(node); + case 224: + return checkModuleDeclaration(node); + case 229: + return checkImportDeclaration(node); + case 228: + return checkImportEqualsDeclaration(node); + case 235: + return checkExportDeclaration(node); + case 234: + return checkExportAssignment(node); + case 200: checkGrammarStatementInAmbientContext(node); return; - case 235: + case 216: + checkGrammarStatementInAmbientContext(node); + return; + case 238: return checkMissingDeclaration(node); } } @@ -23152,17 +24075,17 @@ var ts; for (var _i = 0, deferredNodes_1 = deferredNodes; _i < deferredNodes_1.length; _i++) { var node = deferredNodes_1[_i]; switch (node.kind) { - case 177: case 178: + case 179: + case 146: case 145: - case 144: checkFunctionExpressionOrObjectLiteralMethodDeferred(node); break; - case 147: case 148: + case 149: checkAccessorDeferred(node); break; - case 190: + case 191: checkClassExpressionDeferred(node); break; } @@ -23227,7 +24150,7 @@ var ts; function isInsideWithStatementBody(node) { if (node) { while (node.parent) { - if (node.parent.kind === 209 && node.parent.statement === node) { + if (node.parent.kind === 211 && node.parent.statement === node) { return true; } node = node.parent; @@ -23249,28 +24172,28 @@ var ts; copySymbols(location.locals, meaning); } switch (location.kind) { - case 252: + case 255: if (!ts.isExternalOrCommonJsModule(location)) { break; } - case 222: + case 224: copySymbols(getSymbolOfNode(location).exports, meaning & 8914931); break; - case 221: + case 223: copySymbols(getSymbolOfNode(location).exports, meaning & 8); break; - case 190: + case 191: var className = location.name; if (className) { copySymbol(location.symbol, meaning); } - case 218: - case 219: + case 220: + case 221: if (!(memberFlags & 32)) { copySymbols(getSymbolOfNode(location).members, meaning & 793056); } break; - case 177: + case 178: var funcName = location.name; if (funcName) { copySymbol(location.symbol, meaning); @@ -23309,47 +24232,50 @@ var ts; } function isTypeDeclaration(node) { switch (node.kind) { - case 139: - case 218: - case 219: + case 140: case 220: case 221: + case 222: + case 223: return true; } } function isTypeReferenceIdentifier(entityName) { var node = entityName; - while (node.parent && node.parent.kind === 137) { + while (node.parent && node.parent.kind === 138) { node = node.parent; } - return node.parent && node.parent.kind === 153; + return node.parent && node.parent.kind === 154; } function isHeritageClauseElementIdentifier(entityName) { var node = entityName; - while (node.parent && node.parent.kind === 170) { + while (node.parent && node.parent.kind === 171) { node = node.parent; } - return node.parent && node.parent.kind === 192; + return node.parent && node.parent.kind === 193; } - function isNodeWithinClass(node, classDeclaration) { + function forEachEnclosingClass(node, callback) { + var result; while (true) { node = ts.getContainingClass(node); - if (!node) { - return false; - } - if (node === classDeclaration) { - return true; - } + if (!node) + break; + if (result = callback(node)) + break; } + return result; + } + function isNodeWithinClass(node, classDeclaration) { + return !!forEachEnclosingClass(node, function (n) { return n === classDeclaration; }); } function getLeftSideOfImportEqualsOrExportAssignment(nodeOnRightSide) { - while (nodeOnRightSide.parent.kind === 137) { + while (nodeOnRightSide.parent.kind === 138) { nodeOnRightSide = nodeOnRightSide.parent; } - if (nodeOnRightSide.parent.kind === 225) { + if (nodeOnRightSide.parent.kind === 228) { return nodeOnRightSide.parent.moduleReference === nodeOnRightSide && nodeOnRightSide.parent; } - if (nodeOnRightSide.parent.kind === 231) { + if (nodeOnRightSide.parent.kind === 234) { return nodeOnRightSide.parent.expression === nodeOnRightSide && nodeOnRightSide.parent; } return undefined; @@ -23361,7 +24287,7 @@ var ts; if (ts.isDeclarationName(entityName)) { return getSymbolOfNode(entityName.parent); } - if (ts.isInJavaScriptFile(entityName) && entityName.parent.kind === 170) { + if (ts.isInJavaScriptFile(entityName) && entityName.parent.kind === 171) { var specialPropertyAssignmentKind = ts.getSpecialPropertyAssignmentKind(entityName.parent.parent); switch (specialPropertyAssignmentKind) { case 1: @@ -23373,10 +24299,10 @@ var ts; default: } } - if (entityName.parent.kind === 231) { + if (entityName.parent.kind === 234) { return resolveEntityName(entityName, 107455 | 793056 | 1536 | 8388608); } - if (entityName.kind !== 170) { + if (entityName.kind !== 171) { if (isInRightSideOfImportOrExportAssignment(entityName)) { return getSymbolOfPartOfRightHandSideOfImportEquals(entityName); } @@ -23386,7 +24312,7 @@ var ts; } if (isHeritageClauseElementIdentifier(entityName)) { var meaning = 0; - if (entityName.parent.kind === 192) { + if (entityName.parent.kind === 193) { meaning = 793056; if (ts.isExpressionWithTypeArgumentsInClassExtendsClause(entityName.parent)) { meaning |= 107455; @@ -23398,27 +24324,25 @@ var ts; meaning |= 8388608; return resolveEntityName(entityName, meaning); } - else if ((entityName.parent.kind === 239) || - (entityName.parent.kind === 238) || - (entityName.parent.kind === 241)) { - return getJsxTagSymbol(entityName.parent); - } else if (ts.isExpression(entityName)) { if (ts.nodeIsMissing(entityName)) { return undefined; } if (entityName.kind === 69) { + if (ts.isJSXTagName(entityName) && isJsxIntrinsicIdentifier(entityName)) { + return getIntrinsicTagSymbol(entityName.parent); + } var meaning = 107455 | 8388608; return resolveEntityName(entityName, meaning); } - else if (entityName.kind === 170) { + else if (entityName.kind === 171) { var symbol = getNodeLinks(entityName).resolvedSymbol; if (!symbol) { checkPropertyAccessExpression(entityName); } return getNodeLinks(entityName).resolvedSymbol; } - else if (entityName.kind === 137) { + else if (entityName.kind === 138) { var symbol = getNodeLinks(entityName).resolvedSymbol; if (!symbol) { checkQualifiedName(entityName); @@ -23427,14 +24351,14 @@ var ts; } } else if (isTypeReferenceIdentifier(entityName)) { - var meaning = entityName.parent.kind === 153 ? 793056 : 1536; + var meaning = entityName.parent.kind === 154 ? 793056 : 1536; meaning |= 8388608; return resolveEntityName(entityName, meaning); } - else if (entityName.parent.kind === 242) { + else if (entityName.parent.kind === 245) { return getJsxAttributePropertySymbol(entityName.parent); } - if (entityName.parent.kind === 152) { + if (entityName.parent.kind === 153) { return resolveEntityName(entityName, 1); } return undefined; @@ -23448,12 +24372,12 @@ var ts; } if (node.kind === 69) { if (isInRightSideOfImportOrExportAssignment(node)) { - return node.parent.kind === 231 + return node.parent.kind === 234 ? getSymbolOfEntityNameOrPropertyAccessExpression(node) : getSymbolOfPartOfRightHandSideOfImportEquals(node); } - else if (node.parent.kind === 167 && - node.parent.parent.kind === 165 && + else if (node.parent.kind === 168 && + node.parent.parent.kind === 166 && node === node.parent.propertyName) { var typeOfPattern = getTypeOfNode(node.parent.parent); var propertyDeclaration = typeOfPattern && getPropertyOfType(typeOfPattern, node.text); @@ -23464,30 +24388,30 @@ var ts; } switch (node.kind) { case 69: - case 170: - case 137: + case 171: + case 138: return getSymbolOfEntityNameOrPropertyAccessExpression(node); case 97: case 95: var type = ts.isExpression(node) ? checkExpression(node) : getTypeFromTypeNode(node); return type.symbol; - case 163: + case 164: return getTypeFromTypeNode(node).symbol; case 121: var constructorDeclaration = node.parent; - if (constructorDeclaration && constructorDeclaration.kind === 146) { + if (constructorDeclaration && constructorDeclaration.kind === 147) { return constructorDeclaration.parent.symbol; } return undefined; case 9: if ((ts.isExternalModuleImportEqualsDeclaration(node.parent.parent) && ts.getExternalModuleImportEqualsDeclarationExpression(node.parent.parent) === node) || - ((node.parent.kind === 226 || node.parent.kind === 232) && + ((node.parent.kind === 229 || node.parent.kind === 235) && node.parent.moduleSpecifier === node)) { return resolveExternalModuleName(node, node); } case 8: - if (node.parent.kind === 171 && node.parent.argumentExpression === node) { + if (node.parent.kind === 172 && node.parent.argumentExpression === node) { var objectType = checkExpression(node.parent.expression); if (objectType === unknownType) return undefined; @@ -23501,7 +24425,7 @@ var ts; return undefined; } function getShorthandAssignmentValueSymbol(location) { - if (location && location.kind === 250) { + if (location && location.kind === 253) { return resolveEntityName(location.name, 107455 | 8388608); } return undefined; @@ -23576,15 +24500,15 @@ var ts; } function getRootSymbols(symbol) { if (symbol.flags & 268435456) { - var symbols = []; - var name_17 = symbol.name; + var symbols_3 = []; + var name_19 = symbol.name; ts.forEach(getSymbolLinks(symbol).containingType.types, function (t) { - var symbol = getPropertyOfType(t, name_17); + var symbol = getPropertyOfType(t, name_19); if (symbol) { - symbols.push(symbol); + symbols_3.push(symbol); } }); - return symbols; + return symbols_3; } else if (symbol.flags & 67108864) { var target = getSymbolLinks(symbol).target; @@ -23628,11 +24552,11 @@ var ts; } var parentSymbol = getParentOfSymbol(symbol); if (parentSymbol) { - if (parentSymbol.flags & 512 && parentSymbol.valueDeclaration.kind === 252) { + if (parentSymbol.flags & 512 && parentSymbol.valueDeclaration.kind === 255) { return parentSymbol.valueDeclaration; } for (var n = node.parent; n; n = n.parent) { - if ((n.kind === 222 || n.kind === 221) && getSymbolOfNode(n) === parentSymbol) { + if ((n.kind === 224 || n.kind === 223) && getSymbolOfNode(n) === parentSymbol) { return n; } } @@ -23656,7 +24580,7 @@ var ts; else if (nodeLinks_1.flags & 131072) { var isDeclaredInLoop = nodeLinks_1.flags & 262144; var inLoopInitializer = ts.isIterationStatement(container, false); - var inLoopBodyBlock = container.kind === 196 && ts.isIterationStatement(container.parent, false); + var inLoopBodyBlock = container.kind === 198 && ts.isIterationStatement(container.parent, false); links.isDeclarationWithCollidingName = !ts.isBlockScopedContainerTopLevel(container) && (!isDeclaredInLoop || (!inLoopInitializer && !inLoopBodyBlock)); } else { @@ -23677,22 +24601,22 @@ var ts; } function isValueAliasDeclaration(node) { switch (node.kind) { - case 225: - case 227: case 228: case 230: - case 234: + case 231: + case 233: + case 237: return isAliasResolvedToValue(getSymbolOfNode(node)); - case 232: + case 235: var exportClause = node.exportClause; return exportClause && ts.forEach(exportClause.elements, isValueAliasDeclaration); - case 231: + case 234: return node.expression && node.expression.kind === 69 ? isAliasResolvedToValue(getSymbolOfNode(node)) : true; } return false; } function isTopLevelValueImportEqualsWithEntityName(node) { - if (node.parent.kind !== 252 || !ts.isInternalModuleImportEqualsDeclaration(node)) { + if (node.parent.kind !== 255 || !ts.isInternalModuleImportEqualsDeclaration(node)) { return false; } var isValue = isAliasResolvedToValue(getSymbolOfNode(node)); @@ -23740,7 +24664,7 @@ var ts; return getNodeLinks(node).enumMemberValue; } function getConstantValue(node) { - if (node.kind === 251) { + if (node.kind === 254) { return getEnumMemberValue(node); } var symbol = getNodeLinks(node).resolvedSymbol; @@ -23811,9 +24735,15 @@ var ts; getSymbolDisplayBuilder().buildTypeDisplay(getReturnTypeOfSignature(signature), writer, enclosingDeclaration, flags); } function writeTypeOfExpression(expr, enclosingDeclaration, flags, writer) { - var type = getTypeOfExpression(expr); + var type = getWidenedType(getTypeOfExpression(expr)); getSymbolDisplayBuilder().buildTypeDisplay(type, writer, enclosingDeclaration, flags); } + function writeBaseConstructorTypeOfClass(node, enclosingDeclaration, flags, writer) { + var classType = getDeclaredTypeOfSymbol(getSymbolOfNode(node)); + resolveBaseTypesOfClass(classType); + var baseType = classType.resolvedBaseTypes.length ? classType.resolvedBaseTypes[0] : unknownType; + getSymbolDisplayBuilder().buildTypeDisplay(baseType, writer, enclosingDeclaration, flags); + } function hasGlobalName(name) { return ts.hasProperty(globals, name); } @@ -23842,6 +24772,7 @@ var ts; writeTypeOfDeclaration: writeTypeOfDeclaration, writeReturnTypeOfSignatureDeclaration: writeReturnTypeOfSignatureDeclaration, writeTypeOfExpression: writeTypeOfExpression, + writeBaseConstructorTypeOfClass: writeBaseConstructorTypeOfClass, isSymbolAccessible: isSymbolAccessible, isEntityNameVisible: isEntityNameVisible, getConstantValue: getConstantValue, @@ -23860,7 +24791,7 @@ var ts; if (!moduleSymbol) { return undefined; } - return ts.getDeclarationOfKind(moduleSymbol, 252); + return ts.getDeclarationOfKind(moduleSymbol, 255); } function initializeTypeChecker() { ts.forEach(host.getSourceFiles(), function (file) { @@ -23874,6 +24805,9 @@ var ts; if (file.moduleAugmentations.length) { (augmentations || (augmentations = [])).push(file.moduleAugmentations); } + if (file.wasReferenced && file.symbol && file.symbol.globalExports) { + mergeSymbolTable(globals, file.symbol.globalExports); + } }); if (augmentations) { for (var _i = 0, augmentations_1 = augmentations; _i < augmentations_1.length; _i++) { @@ -23901,6 +24835,7 @@ var ts; getGlobalMethodDecoratorType = ts.memoize(function () { return getGlobalType("MethodDecorator"); }); getGlobalParameterDecoratorType = ts.memoize(function () { return getGlobalType("ParameterDecorator"); }); getGlobalTypedPropertyDescriptorType = ts.memoize(function () { return getGlobalType("TypedPropertyDescriptor", 1); }); + getGlobalESSymbolConstructorSymbol = ts.memoize(function () { return getGlobalValueSymbol("Symbol"); }); getGlobalPromiseType = ts.memoize(function () { return getGlobalType("Promise", 1); }); tryGetGlobalPromiseType = ts.memoize(function () { return getGlobalSymbol("Promise", 793056, undefined) && getGlobalPromiseType(); }); getGlobalPromiseLikeType = ts.memoize(function () { return getGlobalType("PromiseLike", 1); }); @@ -23908,21 +24843,18 @@ var ts; getGlobalPromiseConstructorSymbol = ts.memoize(function () { return getGlobalValueSymbol("Promise"); }); getGlobalPromiseConstructorLikeType = ts.memoize(function () { return getGlobalType("PromiseConstructorLike"); }); getGlobalThenableType = ts.memoize(createThenableType); + getGlobalTemplateStringsArrayType = ts.memoize(function () { return getGlobalType("TemplateStringsArray"); }); if (languageVersion >= 2) { - globalTemplateStringsArrayType = getGlobalType("TemplateStringsArray"); - globalESSymbolType = getGlobalType("Symbol"); - globalESSymbolConstructorSymbol = getGlobalValueSymbol("Symbol"); - globalIterableType = getGlobalType("Iterable", 1); - globalIteratorType = getGlobalType("Iterator", 1); - globalIterableIteratorType = getGlobalType("IterableIterator", 1); + getGlobalESSymbolType = ts.memoize(function () { return getGlobalType("Symbol"); }); + getGlobalIterableType = ts.memoize(function () { return getGlobalType("Iterable", 1); }); + getGlobalIteratorType = ts.memoize(function () { return getGlobalType("Iterator", 1); }); + getGlobalIterableIteratorType = ts.memoize(function () { return getGlobalType("IterableIterator", 1); }); } else { - globalTemplateStringsArrayType = unknownType; - globalESSymbolType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined); - globalESSymbolConstructorSymbol = undefined; - globalIterableType = emptyGenericType; - globalIteratorType = emptyGenericType; - globalIterableIteratorType = emptyGenericType; + getGlobalESSymbolType = ts.memoize(function () { return emptyObjectType; }); + getGlobalIterableType = ts.memoize(function () { return emptyGenericType; }); + getGlobalIteratorType = ts.memoize(function () { return emptyGenericType; }); + getGlobalIterableIteratorType = ts.memoize(function () { return emptyGenericType; }); } anyArrayType = createArrayType(anyType); var symbol = getGlobalSymbol("ReadonlyArray", 793056, undefined); @@ -23951,14 +24883,14 @@ var ts; return false; } if (!ts.nodeCanBeDecorated(node)) { - if (node.kind === 145 && !ts.nodeIsPresent(node.body)) { + if (node.kind === 146 && !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 === 147 || node.kind === 148) { + else if (node.kind === 148 || node.kind === 149) { 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); @@ -23968,38 +24900,38 @@ var ts; } function checkGrammarModifiers(node) { switch (node.kind) { - case 147: case 148: - case 146: - case 143: - case 142: - case 145: + case 149: + case 147: case 144: - case 151: - case 222: - case 226: - case 225: - case 232: - case 231: - case 140: + case 143: + case 146: + case 145: + case 152: + case 224: + case 229: + case 228: + case 235: + case 234: + case 141: break; - case 217: - if (node.modifiers && (node.modifiers.length > 1 || node.modifiers[0].kind !== 118) && - node.parent.kind !== 223 && node.parent.kind !== 252) { - return grammarErrorOnFirstToken(node, ts.Diagnostics.Modifiers_cannot_appear_here); - } - break; - case 218: case 219: - case 197: - case 220: - if (node.modifiers && node.parent.kind !== 223 && node.parent.kind !== 252) { + if (node.modifiers && (node.modifiers.length > 1 || node.modifiers[0].kind !== 118) && + node.parent.kind !== 225 && node.parent.kind !== 255) { return grammarErrorOnFirstToken(node, ts.Diagnostics.Modifiers_cannot_appear_here); } break; + case 220: case 221: + case 199: + case 222: + if (node.modifiers && node.parent.kind !== 225 && node.parent.kind !== 255) { + return grammarErrorOnFirstToken(node, ts.Diagnostics.Modifiers_cannot_appear_here); + } + break; + case 223: if (node.modifiers && (node.modifiers.length > 1 || node.modifiers[0].kind !== 74) && - node.parent.kind !== 223 && node.parent.kind !== 252) { + node.parent.kind !== 225 && node.parent.kind !== 255) { return grammarErrorOnFirstToken(node, ts.Diagnostics.Modifiers_cannot_appear_here); } break; @@ -24014,16 +24946,16 @@ var ts; for (var _i = 0, _a = node.modifiers; _i < _a.length; _i++) { var modifier = _a[_i]; if (modifier.kind !== 127) { - if (node.kind === 142 || node.kind === 144) { + if (node.kind === 143 || node.kind === 145) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_type_member, ts.tokenToString(modifier.kind)); } - if (node.kind === 151) { + if (node.kind === 152) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_an_index_signature, ts.tokenToString(modifier.kind)); } } switch (modifier.kind) { case 74: - if (node.kind !== 221 && node.parent.kind === 218) { + if (node.kind !== 223 && node.parent.kind === 220) { return grammarErrorOnNode(node, ts.Diagnostics.A_class_member_cannot_have_the_0_keyword, ts.tokenToString(74)); } break; @@ -24049,7 +24981,7 @@ var ts; else if (flags & 256) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, text, "async"); } - else if (node.parent.kind === 223 || node.parent.kind === 252) { + else if (node.parent.kind === 225 || node.parent.kind === 255) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_module_or_namespace_element, text); } else if (flags & 128) { @@ -24072,10 +25004,10 @@ var ts; else if (flags & 256) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "static", "async"); } - else if (node.parent.kind === 223 || node.parent.kind === 252) { + else if (node.parent.kind === 225 || node.parent.kind === 255) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_module_or_namespace_element, "static"); } - else if (node.kind === 140) { + else if (node.kind === 141) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "static"); } else if (flags & 128) { @@ -24088,7 +25020,7 @@ var ts; if (flags & 64) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "readonly"); } - else if (node.kind !== 143 && node.kind !== 142 && node.kind !== 151) { + else if (node.kind !== 144 && node.kind !== 143 && node.kind !== 152) { return grammarErrorOnNode(modifier, ts.Diagnostics.readonly_modifier_can_only_appear_on_a_property_declaration_or_index_signature); } flags |= 64; @@ -24107,10 +25039,10 @@ var ts; else if (flags & 256) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "export", "async"); } - else if (node.parent.kind === 218) { + else if (node.parent.kind === 220) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_class_element, "export"); } - else if (node.kind === 140) { + else if (node.kind === 141) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "export"); } flags |= 1; @@ -24122,13 +25054,13 @@ var ts; else if (flags & 256) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_in_an_ambient_context, "async"); } - else if (node.parent.kind === 218) { + else if (node.parent.kind === 220) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_class_element, "declare"); } - else if (node.kind === 140) { + else if (node.kind === 141) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "declare"); } - else if (ts.isInAmbientContext(node.parent) && node.parent.kind === 223) { + else if (ts.isInAmbientContext(node.parent) && node.parent.kind === 225) { return grammarErrorOnNode(modifier, ts.Diagnostics.A_declare_modifier_cannot_be_used_in_an_already_ambient_context); } flags |= 2; @@ -24138,14 +25070,14 @@ var ts; if (flags & 128) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "abstract"); } - if (node.kind !== 218) { - if (node.kind !== 145 && - node.kind !== 143 && - node.kind !== 147 && - node.kind !== 148) { + if (node.kind !== 220) { + if (node.kind !== 146 && + node.kind !== 144 && + node.kind !== 148 && + node.kind !== 149) { return grammarErrorOnNode(modifier, ts.Diagnostics.abstract_modifier_can_only_appear_on_a_class_method_or_property_declaration); } - if (!(node.parent.kind === 218 && node.parent.flags & 128)) { + if (!(node.parent.kind === 220 && node.parent.flags & 128)) { return grammarErrorOnNode(modifier, ts.Diagnostics.Abstract_methods_can_only_appear_within_an_abstract_class); } if (flags & 32) { @@ -24164,7 +25096,7 @@ var ts; else if (flags & 2 || ts.isInAmbientContext(node.parent)) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_in_an_ambient_context, "async"); } - else if (node.kind === 140) { + else if (node.kind === 141) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "async"); } flags |= 256; @@ -24172,7 +25104,7 @@ var ts; break; } } - if (node.kind === 146) { + if (node.kind === 147) { if (flags & 32) { return grammarErrorOnNode(lastStatic, ts.Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration, "static"); } @@ -24187,10 +25119,10 @@ var ts; } return; } - else if ((node.kind === 226 || node.kind === 225) && flags & 2) { + else if ((node.kind === 229 || node.kind === 228) && flags & 2) { return grammarErrorOnNode(lastDeclare, ts.Diagnostics.A_0_modifier_cannot_be_used_with_an_import_declaration, "declare"); } - else if (node.kind === 140 && (flags & 28) && ts.isBindingPattern(node.name)) { + else if (node.kind === 141 && (flags & 28) && ts.isBindingPattern(node.name)) { return grammarErrorOnNode(node, ts.Diagnostics.A_parameter_property_may_not_be_a_binding_pattern); } if (flags & 256) { @@ -24202,10 +25134,10 @@ var ts; return grammarErrorOnNode(asyncModifier, ts.Diagnostics.Async_functions_are_only_available_when_targeting_ECMAScript_6_and_higher); } switch (node.kind) { - case 145: - case 217: - case 177: + case 146: + case 219: case 178: + case 179: if (!node.asteriskToken) { return false; } @@ -24270,7 +25202,7 @@ var ts; checkGrammarParameterList(node.parameters) || checkGrammarArrowFunction(node, file); } function checkGrammarArrowFunction(node, file) { - if (node.kind === 178) { + if (node.kind === 179) { var arrowFunction = node; var startLine = ts.getLineAndCharacterOfPosition(file, arrowFunction.equalsGreaterThanToken.pos).line; var endLine = ts.getLineAndCharacterOfPosition(file, arrowFunction.equalsGreaterThanToken.end).line; @@ -24332,7 +25264,7 @@ var ts; 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 === 191) { + if (arg.kind === 192) { return grammarErrorAtPos(sourceFile, arg.pos, 0, ts.Diagnostics.Argument_expression_expected); } } @@ -24403,19 +25335,19 @@ var ts; return false; } function checkGrammarComputedPropertyName(node) { - if (node.kind !== 138) { + if (node.kind !== 139) { return false; } var computedPropertyName = node; - if (computedPropertyName.expression.kind === 185 && computedPropertyName.expression.operatorToken.kind === 24) { + if (computedPropertyName.expression.kind === 186 && computedPropertyName.expression.operatorToken.kind === 24) { 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 === 217 || - node.kind === 177 || - node.kind === 145); + ts.Debug.assert(node.kind === 219 || + node.kind === 178 || + node.kind === 146); if (ts.isInAmbientContext(node)) { return grammarErrorOnNode(node.asteriskToken, ts.Diagnostics.Generators_are_not_allowed_in_an_ambient_context); } @@ -24439,85 +25371,84 @@ var ts; var SetAccessor = 4; var GetOrSetAccessor = GetAccessor | SetAccessor; var _loop_1 = function(prop) { - var name_18 = prop.name; - if (prop.kind === 191 || - name_18.kind === 138) { - checkGrammarComputedPropertyName(name_18); + var name_20 = prop.name; + if (prop.kind === 192 || + name_20.kind === 139) { + checkGrammarComputedPropertyName(name_20); return "continue"; } - if (prop.kind === 250 && !inDestructuring && prop.objectAssignmentInitializer) { + if (prop.kind === 253 && !inDestructuring && prop.objectAssignmentInitializer) { return { value: grammarErrorOnNode(prop.equalsToken, ts.Diagnostics.can_only_be_used_in_an_object_literal_property_inside_a_destructuring_assignment) }; } ts.forEach(prop.modifiers, function (mod) { - if (mod.kind !== 118 || prop.kind !== 145) { + if (mod.kind !== 118 || prop.kind !== 146) { grammarErrorOnNode(mod, ts.Diagnostics._0_modifier_cannot_be_used_here, ts.getTextOfNode(mod)); } }); var currentKind = void 0; - if (prop.kind === 249 || prop.kind === 250) { + if (prop.kind === 252 || prop.kind === 253) { checkGrammarForInvalidQuestionMark(prop, prop.questionToken, ts.Diagnostics.An_object_member_cannot_be_declared_optional); - if (name_18.kind === 8) { - checkGrammarNumericLiteral(name_18); + if (name_20.kind === 8) { + checkGrammarNumericLiteral(name_20); } currentKind = Property; } - else if (prop.kind === 145) { + else if (prop.kind === 146) { currentKind = Property; } - else if (prop.kind === 147) { + else if (prop.kind === 148) { currentKind = GetAccessor; } - else if (prop.kind === 148) { + else if (prop.kind === 149) { currentKind = SetAccessor; } else { ts.Debug.fail("Unexpected syntax kind:" + prop.kind); } - if (!ts.hasProperty(seen, name_18.text)) { - seen[name_18.text] = currentKind; + if (!ts.hasProperty(seen, name_20.text)) { + seen[name_20.text] = currentKind; } else { - var existingKind = seen[name_18.text]; + var existingKind = seen[name_20.text]; if (currentKind === Property && existingKind === Property) { return "continue"; } else if ((currentKind & GetOrSetAccessor) && (existingKind & GetOrSetAccessor)) { if (existingKind !== GetOrSetAccessor && currentKind !== existingKind) { - seen[name_18.text] = currentKind | existingKind; + seen[name_20.text] = currentKind | existingKind; } else { - return { value: grammarErrorOnNode(name_18, ts.Diagnostics.An_object_literal_cannot_have_multiple_get_Slashset_accessors_with_the_same_name) }; + return { value: grammarErrorOnNode(name_20, ts.Diagnostics.An_object_literal_cannot_have_multiple_get_Slashset_accessors_with_the_same_name) }; } } else { - return { value: grammarErrorOnNode(name_18, ts.Diagnostics.An_object_literal_cannot_have_property_and_accessor_with_the_same_name) }; + return { value: grammarErrorOnNode(name_20, 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_1 = _loop_1(prop); - if (typeof state_1 === "object") return state_1.value - if (state_1 === "continue") continue; + var state_2 = _loop_1(prop); + if (typeof state_2 === "object") return state_2.value; } } function checkGrammarJsxElement(node) { var seen = {}; for (var _i = 0, _a = node.attributes; _i < _a.length; _i++) { var attr = _a[_i]; - if (attr.kind === 243) { + if (attr.kind === 246) { continue; } var jsxAttr = attr; - var name_19 = jsxAttr.name; - if (!ts.hasProperty(seen, name_19.text)) { - seen[name_19.text] = true; + var name_21 = jsxAttr.name; + if (!ts.hasProperty(seen, name_21.text)) { + seen[name_21.text] = true; } else { - return grammarErrorOnNode(name_19, ts.Diagnostics.JSX_elements_cannot_have_multiple_attributes_with_the_same_name); + return grammarErrorOnNode(name_21, ts.Diagnostics.JSX_elements_cannot_have_multiple_attributes_with_the_same_name); } var initializer = jsxAttr.initializer; - if (initializer && initializer.kind === 244 && !initializer.expression) { + if (initializer && initializer.kind === 247 && !initializer.expression) { return grammarErrorOnNode(jsxAttr.initializer, ts.Diagnostics.JSX_attributes_must_only_be_assigned_a_non_empty_expression); } } @@ -24526,7 +25457,7 @@ var ts; if (checkGrammarStatementInAmbientContext(forInOrOfStatement)) { return true; } - if (forInOrOfStatement.initializer.kind === 216) { + if (forInOrOfStatement.initializer.kind === 218) { var variableList = forInOrOfStatement.initializer; if (!checkGrammarVariableDeclarationList(variableList)) { var declarations = variableList.declarations; @@ -24534,20 +25465,20 @@ var ts; return false; } if (declarations.length > 1) { - var diagnostic = forInOrOfStatement.kind === 204 + var diagnostic = forInOrOfStatement.kind === 206 ? 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 === 204 + var diagnostic = forInOrOfStatement.kind === 206 ? 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 === 204 + var diagnostic = forInOrOfStatement.kind === 206 ? 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); @@ -24570,10 +25501,10 @@ var ts; else if (accessor.typeParameters) { return grammarErrorOnNode(accessor.name, ts.Diagnostics.An_accessor_cannot_have_type_parameters); } - else if (kind === 147 && accessor.parameters.length) { + else if (kind === 148 && accessor.parameters.length) { return grammarErrorOnNode(accessor.name, ts.Diagnostics.A_get_accessor_cannot_have_parameters); } - else if (kind === 148) { + else if (kind === 149) { if (accessor.type) { return grammarErrorOnNode(accessor.name, ts.Diagnostics.A_set_accessor_cannot_have_a_return_type_annotation); } @@ -24608,7 +25539,7 @@ var ts; checkGrammarForGenerator(node)) { return true; } - if (node.parent.kind === 169) { + if (node.parent.kind === 170) { if (checkGrammarForInvalidQuestionMark(node, node.questionToken, ts.Diagnostics.A_class_member_cannot_be_declared_optional)) { return true; } @@ -24627,10 +25558,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 === 219) { + else if (node.parent.kind === 221) { 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 === 157) { + else if (node.parent.kind === 158) { return checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_a_type_literal_must_directly_refer_to_a_built_in_symbol); } } @@ -24641,9 +25572,9 @@ var ts; return grammarErrorOnNode(node, ts.Diagnostics.Jump_target_cannot_cross_function_boundary); } switch (current.kind) { - case 211: + case 213: if (node.label && current.label.text === node.label.text) { - var isMisplacedContinueLabel = node.kind === 206 + var isMisplacedContinueLabel = node.kind === 208 && !ts.isIterationStatement(current.statement, true); if (isMisplacedContinueLabel) { return grammarErrorOnNode(node, ts.Diagnostics.A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement); @@ -24651,8 +25582,8 @@ var ts; return false; } break; - case 210: - if (node.kind === 207 && !node.label) { + case 212: + if (node.kind === 209 && !node.label) { return false; } break; @@ -24665,13 +25596,13 @@ var ts; current = current.parent; } if (node.label) { - var message = node.kind === 207 + var message = node.kind === 209 ? 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 === 207 + var message = node.kind === 209 ? 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); @@ -24683,7 +25614,7 @@ var ts; if (node !== ts.lastOrUndefined(elements)) { return grammarErrorOnNode(node, ts.Diagnostics.A_rest_element_must_be_last_in_an_array_destructuring_pattern); } - if (node.name.kind === 166 || node.name.kind === 165) { + if (node.name.kind === 167 || node.name.kind === 166) { return grammarErrorOnNode(node.name, ts.Diagnostics.A_rest_element_cannot_contain_a_binding_pattern); } if (node.initializer) { @@ -24692,7 +25623,7 @@ var ts; } } function checkGrammarVariableDeclaration(node) { - if (node.parent.parent.kind !== 204 && node.parent.parent.kind !== 205) { + if (node.parent.parent.kind !== 206 && node.parent.parent.kind !== 207) { if (ts.isInAmbientContext(node)) { if (node.initializer) { var equalsTokenLength = "=".length; @@ -24721,7 +25652,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 !== 191) { + if (element.kind !== 192) { checkGrammarNameInLetOrConstDeclarations(element.name); } } @@ -24738,15 +25669,15 @@ var ts; } function allowLetAndConstDeclarations(parent) { switch (parent.kind) { - case 200: - case 201: case 202: - case 209: case 203: case 204: - case 205: - return false; case 211: + case 205: + case 206: + case 207: + return false; + case 213: return allowLetAndConstDeclarations(parent.parent); } return true; @@ -24802,7 +25733,7 @@ var ts; return true; } } - else if (node.parent.kind === 219) { + else if (node.parent.kind === 221) { if (checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_an_interface_must_directly_refer_to_a_built_in_symbol)) { return true; } @@ -24810,7 +25741,7 @@ var ts; return grammarErrorOnNode(node.initializer, ts.Diagnostics.An_interface_property_cannot_have_an_initializer); } } - else if (node.parent.kind === 157) { + else if (node.parent.kind === 158) { if (checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_a_type_literal_must_directly_refer_to_a_built_in_symbol)) { return true; } @@ -24823,12 +25754,12 @@ var ts; } } function checkGrammarTopLevelElementForRequiredDeclareModifier(node) { - if (node.kind === 219 || - node.kind === 220 || - node.kind === 226 || - node.kind === 225 || - node.kind === 232 || - node.kind === 231 || + if (node.kind === 221 || + node.kind === 222 || + node.kind === 229 || + node.kind === 228 || + node.kind === 235 || + node.kind === 234 || (node.flags & 2) || (node.flags & (1 | 512))) { return false; @@ -24838,7 +25769,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 === 197) { + if (ts.isDeclaration(decl) || decl.kind === 199) { if (checkGrammarTopLevelElementForRequiredDeclareModifier(decl)) { return true; } @@ -24857,7 +25788,7 @@ var ts; if (!links.hasReportedStatementInAmbientContext && ts.isFunctionLike(node.parent)) { return getNodeLinks(node).hasReportedStatementInAmbientContext = grammarErrorOnFirstToken(node, ts.Diagnostics.An_implementation_cannot_be_declared_in_ambient_contexts); } - if (node.parent.kind === 196 || node.parent.kind === 223 || node.parent.kind === 252) { + if (node.parent.kind === 198 || node.parent.kind === 225 || node.parent.kind === 255) { var links_1 = getNodeLinks(node.parent); if (!links_1.hasReportedStatementInAmbientContext) { return links_1.hasReportedStatementInAmbientContext = grammarErrorOnFirstToken(node, ts.Diagnostics.Statements_are_not_allowed_in_ambient_contexts); @@ -25153,7 +26084,7 @@ var ts; function getDeclarationDiagnostics(host, resolver, targetSourceFile) { var declarationDiagnostics = ts.createDiagnosticCollection(); ts.forEachExpectedEmitFile(host, getDeclarationDiagnosticsFromFile, targetSourceFile); - return declarationDiagnostics.getDiagnostics(targetSourceFile.fileName); + return declarationDiagnostics.getDiagnostics(targetSourceFile ? targetSourceFile.fileName : undefined); function getDeclarationDiagnosticsFromFile(_a, sources, isBundledEmit) { var declarationFilePath = _a.declarationFilePath; emitDeclarations(host, resolver, declarationDiagnostics, declarationFilePath, sources, isBundledEmit); @@ -25221,7 +26152,7 @@ var ts; var oldWriter = writer; ts.forEach(moduleElementDeclarationEmitInfo, function (aliasEmitInfo) { if (aliasEmitInfo.isVisible && !aliasEmitInfo.asynchronousOutput) { - ts.Debug.assert(aliasEmitInfo.node.kind === 226); + ts.Debug.assert(aliasEmitInfo.node.kind === 229); createAndSetNewTextWriterWithSymbolWriter(); ts.Debug.assert(aliasEmitInfo.indent === 0 || (aliasEmitInfo.indent === 1 && isBundledEmit)); for (var i = 0; i < aliasEmitInfo.indent; i++) { @@ -25287,10 +26218,10 @@ var ts; var oldWriter = writer; ts.forEach(nodes, function (declaration) { var nodeToCheck; - if (declaration.kind === 215) { + if (declaration.kind === 217) { nodeToCheck = declaration.parent.parent; } - else if (declaration.kind === 229 || declaration.kind === 230 || declaration.kind === 227) { + else if (declaration.kind === 232 || declaration.kind === 233 || declaration.kind === 230) { ts.Debug.fail("We should be getting ImportDeclaration instead to write"); } else { @@ -25301,7 +26232,7 @@ var ts; moduleElementEmitInfo = ts.forEach(asynchronousSubModuleDeclarationEmitInfo, function (declEmitInfo) { return declEmitInfo.node === nodeToCheck ? declEmitInfo : undefined; }); } if (moduleElementEmitInfo) { - if (moduleElementEmitInfo.node.kind === 226) { + if (moduleElementEmitInfo.node.kind === 229) { moduleElementEmitInfo.isVisible = true; } else { @@ -25309,12 +26240,12 @@ var ts; for (var declarationIndent = moduleElementEmitInfo.indent; declarationIndent; declarationIndent--) { increaseIndent(); } - if (nodeToCheck.kind === 222) { + if (nodeToCheck.kind === 224) { ts.Debug.assert(asynchronousSubModuleDeclarationEmitInfo === undefined); asynchronousSubModuleDeclarationEmitInfo = []; } writeModuleElement(nodeToCheck); - if (nodeToCheck.kind === 222) { + if (nodeToCheck.kind === 224) { moduleElementEmitInfo.subModuleElementDeclarationEmitInfo = asynchronousSubModuleDeclarationEmitInfo; asynchronousSubModuleDeclarationEmitInfo = undefined; } @@ -25417,35 +26348,37 @@ var ts; case 120: case 132: case 103: - case 163: + case 134: + case 93: case 164: + case 165: return writeTextOfNode(currentText, type); - case 192: + case 193: return emitExpressionWithTypeArguments(type); - case 153: - return emitTypeReference(type); - case 156: - return emitTypeQuery(type); - case 158: - return emitArrayType(type); - case 159: - return emitTupleType(type); - case 160: - return emitUnionType(type); - case 161: - return emitIntersectionType(type); - case 162: - return emitParenType(type); case 154: - case 155: - return emitSignatureDeclarationWithJsDocComments(type); + return emitTypeReference(type); case 157: + return emitTypeQuery(type); + case 159: + return emitArrayType(type); + case 160: + return emitTupleType(type); + case 161: + return emitUnionType(type); + case 162: + return emitIntersectionType(type); + case 163: + return emitParenType(type); + case 155: + case 156: + return emitSignatureDeclarationWithJsDocComments(type); + case 158: return emitTypeLiteral(type); case 69: return emitEntityName(type); - case 137: + case 138: return emitEntityName(type); - case 152: + case 153: return emitTypePredicate(type); } function writeEntityName(entityName) { @@ -25453,21 +26386,21 @@ var ts; writeTextOfNode(currentText, entityName); } else { - var left = entityName.kind === 137 ? entityName.left : entityName.expression; - var right = entityName.kind === 137 ? entityName.right : entityName.name; + var left = entityName.kind === 138 ? entityName.left : entityName.expression; + var right = entityName.kind === 138 ? entityName.right : entityName.name; writeEntityName(left); write("."); writeTextOfNode(currentText, right); } } function emitEntityName(entityName) { - var visibilityResult = resolver.isEntityNameVisible(entityName, entityName.parent.kind === 225 ? entityName.parent : enclosingDeclaration); + var visibilityResult = resolver.isEntityNameVisible(entityName, entityName.parent.kind === 228 ? entityName.parent : enclosingDeclaration); handleSymbolAccessibilityError(visibilityResult); writeEntityName(entityName); } function emitExpressionWithTypeArguments(node) { if (ts.isSupportedExpressionWithTypeArguments(node)) { - ts.Debug.assert(node.expression.kind === 69 || node.expression.kind === 170); + ts.Debug.assert(node.expression.kind === 69 || node.expression.kind === 171); emitEntityName(node.expression); if (node.typeArguments) { write("<"); @@ -25541,9 +26474,9 @@ var ts; var count = 0; while (true) { count++; - var name_20 = baseName + "_" + count; - if (!ts.hasProperty(currentIdentifiers, name_20)) { - return name_20; + var name_22 = baseName + "_" + count; + if (!ts.hasProperty(currentIdentifiers, name_22)) { + return name_22; } } } @@ -25554,7 +26487,10 @@ var ts; } else { var tempVarName = getExportDefaultTempVariableName(); - write("declare var "); + if (!noDeclare) { + write("declare "); + } + write("var "); write(tempVarName); write(": "); writer.getSymbolAccessibilityDiagnostic = getDefaultExportAccessibilityDiagnostic; @@ -25584,10 +26520,10 @@ var ts; if (isModuleElementVisible) { writeModuleElement(node); } - else if (node.kind === 225 || - (node.parent.kind === 252 && isCurrentFileExternalModule)) { - var isVisible; - if (asynchronousSubModuleDeclarationEmitInfo && node.parent.kind !== 252) { + else if (node.kind === 228 || + (node.parent.kind === 255 && isCurrentFileExternalModule)) { + var isVisible = void 0; + if (asynchronousSubModuleDeclarationEmitInfo && node.parent.kind !== 255) { asynchronousSubModuleDeclarationEmitInfo.push({ node: node, outputPos: writer.getTextPos(), @@ -25596,7 +26532,7 @@ var ts; }); } else { - if (node.kind === 226) { + if (node.kind === 229) { var importDeclaration = node; if (importDeclaration.importClause) { isVisible = (importDeclaration.importClause.name && resolver.isDeclarationVisible(importDeclaration.importClause)) || @@ -25614,37 +26550,37 @@ var ts; } function writeModuleElement(node) { switch (node.kind) { - case 217: - return writeFunctionDeclaration(node); - case 197: - return writeVariableStatement(node); case 219: - return writeInterfaceDeclaration(node); - case 218: - return writeClassDeclaration(node); - case 220: - return writeTypeAliasDeclaration(node); + return writeFunctionDeclaration(node); + case 199: + return writeVariableStatement(node); case 221: - return writeEnumDeclaration(node); + return writeInterfaceDeclaration(node); + case 220: + return writeClassDeclaration(node); case 222: + return writeTypeAliasDeclaration(node); + case 223: + return writeEnumDeclaration(node); + case 224: return writeModuleDeclaration(node); - case 225: + case 228: return writeImportEqualsDeclaration(node); - case 226: + case 229: return writeImportDeclaration(node); default: ts.Debug.fail("Unknown symbol kind"); } } function emitModuleElementDeclarationFlags(node) { - if (node.parent.kind === 252) { + if (node.parent.kind === 255) { if (node.flags & 1) { write("export "); } if (node.flags & 512) { write("default "); } - else if (node.kind !== 219 && !noDeclare) { + else if (node.kind !== 221 && !noDeclare) { write("declare "); } } @@ -25694,7 +26630,7 @@ var ts; } function isVisibleNamedBinding(namedBindings) { if (namedBindings) { - if (namedBindings.kind === 228) { + if (namedBindings.kind === 231) { return resolver.isDeclarationVisible(namedBindings); } else { @@ -25717,7 +26653,7 @@ var ts; if (currentWriterPos !== writer.getTextPos()) { write(", "); } - if (node.importClause.namedBindings.kind === 228) { + if (node.importClause.namedBindings.kind === 231) { write("* as "); writeTextOfNode(currentText, node.importClause.namedBindings.name); } @@ -25734,13 +26670,13 @@ var ts; writer.writeLine(); } function emitExternalModuleSpecifier(parent) { - resultHasExternalModuleIndicator = resultHasExternalModuleIndicator || parent.kind !== 222; + resultHasExternalModuleIndicator = resultHasExternalModuleIndicator || parent.kind !== 224; var moduleSpecifier; - if (parent.kind === 225) { + if (parent.kind === 228) { var node = parent; moduleSpecifier = ts.getExternalModuleImportEqualsDeclarationExpression(node); } - else if (parent.kind === 222) { + else if (parent.kind === 224) { moduleSpecifier = parent.name; } else { @@ -25750,9 +26686,9 @@ var ts; if (moduleSpecifier.kind === 9 && isBundledEmit && (compilerOptions.out || compilerOptions.outFile)) { var moduleName = ts.getExternalModuleNameFromDeclaration(host, resolver, parent); if (moduleName) { - write("\""); + write('"'); write(moduleName); - write("\""); + write('"'); return; } } @@ -25808,7 +26744,7 @@ var ts; writeTextOfNode(currentText, node.name); } } - while (node.body.kind !== 223) { + while (node.body.kind !== 225) { node = node.body; write("."); writeTextOfNode(currentText, node.name); @@ -25873,7 +26809,7 @@ var ts; writeLine(); } function isPrivateMethodTypeParameter(node) { - return node.parent.kind === 145 && (node.parent.flags & 8); + return node.parent.kind === 146 && (node.parent.flags & 8); } function emitTypeParameters(typeParameters) { function emitTypeParameter(node) { @@ -25883,15 +26819,15 @@ var ts; writeTextOfNode(currentText, node.name); if (node.constraint && !isPrivateMethodTypeParameter(node)) { write(" extends "); - if (node.parent.kind === 154 || - node.parent.kind === 155 || - (node.parent.parent && node.parent.parent.kind === 157)) { - ts.Debug.assert(node.parent.kind === 145 || - node.parent.kind === 144 || - node.parent.kind === 154 || + if (node.parent.kind === 155 || + node.parent.kind === 156 || + (node.parent.parent && node.parent.parent.kind === 158)) { + ts.Debug.assert(node.parent.kind === 146 || + node.parent.kind === 145 || node.parent.kind === 155 || - node.parent.kind === 149 || - node.parent.kind === 150); + node.parent.kind === 156 || + node.parent.kind === 150 || + node.parent.kind === 151); emitType(node.constraint); } else { @@ -25901,31 +26837,31 @@ var ts; function getTypeParameterConstraintVisibilityError(symbolAccessibilityResult) { var diagnosticMessage; switch (node.parent.kind) { - case 218: + case 220: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_class_has_or_is_using_private_name_1; break; - case 219: + case 221: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1; break; - case 150: + case 151: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1; break; - case 149: + case 150: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1; break; + case 146: case 145: - case 144: if (node.parent.flags & 32) { 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 === 218) { + else if (node.parent.parent.kind === 220) { 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 217: + case 219: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_function_has_or_is_using_private_name_1; break; default: @@ -25956,9 +26892,13 @@ var ts; else if (!isImplementsList && node.expression.kind === 93) { write("null"); } + else { + writer.getSymbolAccessibilityDiagnostic = getHeritageClauseVisibilityError; + resolver.writeBaseConstructorTypeOfClass(enclosingDeclaration, enclosingDeclaration, 2, writer); + } function getHeritageClauseVisibilityError(symbolAccessibilityResult) { var diagnosticMessage; - if (node.parent.parent.kind === 218) { + if (node.parent.parent.kind === 220) { 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; @@ -26038,16 +26978,16 @@ var ts; writeLine(); } function emitVariableDeclaration(node) { - if (node.kind !== 215 || resolver.isDeclarationVisible(node)) { + if (node.kind !== 217 || resolver.isDeclarationVisible(node)) { if (ts.isBindingPattern(node.name)) { emitBindingPattern(node.name); } else { writeTextOfNode(currentText, node.name); - if ((node.kind === 143 || node.kind === 142) && ts.hasQuestionToken(node)) { + if ((node.kind === 144 || node.kind === 143) && ts.hasQuestionToken(node)) { write("?"); } - if ((node.kind === 143 || node.kind === 142) && node.parent.kind === 157) { + if ((node.kind === 144 || node.kind === 143) && node.parent.kind === 158) { emitTypeOfVariableDeclarationFromTypeLiteral(node); } else if (!(node.flags & 8)) { @@ -26056,14 +26996,14 @@ var ts; } } function getVariableDeclarationTypeVisibilityDiagnosticMessage(symbolAccessibilityResult) { - if (node.kind === 215) { + if (node.kind === 217) { return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 ? 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 === 143 || node.kind === 142) { + else if (node.kind === 144 || node.kind === 143) { if (node.flags & 32) { return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 ? @@ -26071,7 +27011,7 @@ var ts; 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 === 218) { + else if (node.parent.kind === 220) { return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 ? ts.Diagnostics.Public_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : @@ -26097,7 +27037,7 @@ var ts; var elements = []; for (var _i = 0, _a = bindingPattern.elements; _i < _a.length; _i++) { var element = _a[_i]; - if (element.kind !== 191) { + if (element.kind !== 192) { elements.push(element); } } @@ -26163,7 +27103,7 @@ var ts; accessorWithTypeAnnotation = node; var type = getTypeAnnotationFromAccessor(node); if (!type) { - var anotherAccessor = node.kind === 147 ? accessors.setAccessor : accessors.getAccessor; + var anotherAccessor = node.kind === 148 ? accessors.setAccessor : accessors.getAccessor; type = getTypeAnnotationFromAccessor(anotherAccessor); if (type) { accessorWithTypeAnnotation = anotherAccessor; @@ -26176,7 +27116,7 @@ var ts; } function getTypeAnnotationFromAccessor(accessor) { if (accessor) { - return accessor.kind === 147 + return accessor.kind === 148 ? accessor.type : accessor.parameters.length > 0 ? accessor.parameters[0].type @@ -26185,7 +27125,7 @@ var ts; } function getAccessorDeclarationTypeVisibilityError(symbolAccessibilityResult) { var diagnosticMessage; - if (accessorWithTypeAnnotation.kind === 148) { + if (accessorWithTypeAnnotation.kind === 149) { if (accessorWithTypeAnnotation.parent.flags & 32) { 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 : @@ -26231,17 +27171,17 @@ var ts; } if (!resolver.isImplementationOfOverload(node)) { emitJsDocComments(node); - if (node.kind === 217) { + if (node.kind === 219) { emitModuleElementDeclarationFlags(node); } - else if (node.kind === 145 || node.kind === 146) { + else if (node.kind === 146 || node.kind === 147) { emitClassMemberDeclarationFlags(node.flags); } - if (node.kind === 217) { + if (node.kind === 219) { write("function "); writeTextOfNode(currentText, node.name); } - else if (node.kind === 146) { + else if (node.kind === 147) { write("constructor"); } else { @@ -26260,32 +27200,32 @@ var ts; function emitSignatureDeclaration(node) { var prevEnclosingDeclaration = enclosingDeclaration; enclosingDeclaration = node; - if (node.kind === 151) { + if (node.kind === 152) { emitClassMemberDeclarationFlags(node.flags); write("["); } else { - if (node.kind === 150 || node.kind === 155) { + if (node.kind === 151 || node.kind === 156) { write("new "); } emitTypeParameters(node.typeParameters); write("("); } emitCommaList(node.parameters, emitParameterDeclaration); - if (node.kind === 151) { + if (node.kind === 152) { write("]"); } else { write(")"); } - var isFunctionTypeOrConstructorType = node.kind === 154 || node.kind === 155; - if (isFunctionTypeOrConstructorType || node.parent.kind === 157) { + var isFunctionTypeOrConstructorType = node.kind === 155 || node.kind === 156; + if (isFunctionTypeOrConstructorType || node.parent.kind === 158) { if (node.type) { write(isFunctionTypeOrConstructorType ? " => " : ": "); emitType(node.type); } } - else if (node.kind !== 146 && !(node.flags & 8)) { + else if (node.kind !== 147 && !(node.flags & 8)) { writeReturnTypeAtSignature(node, getReturnTypeVisibilityError); } enclosingDeclaration = prevEnclosingDeclaration; @@ -26296,23 +27236,23 @@ var ts; function getReturnTypeVisibilityError(symbolAccessibilityResult) { var diagnosticMessage; switch (node.kind) { - case 150: + case 151: 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 149: + case 150: 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 151: + case 152: 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 146: case 145: - case 144: if (node.flags & 32) { diagnosticMessage = symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 ? @@ -26320,7 +27260,7 @@ var ts; 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 === 218) { + else if (node.parent.kind === 220) { diagnosticMessage = symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 ? ts.Diagnostics.Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : @@ -26333,7 +27273,7 @@ var ts; ts.Diagnostics.Return_type_of_method_from_exported_interface_has_or_is_using_private_name_0; } break; - case 217: + case 219: diagnosticMessage = symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 ? ts.Diagnostics.Return_type_of_exported_function_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : @@ -26365,9 +27305,9 @@ var ts; write("?"); } decreaseIndent(); - if (node.parent.kind === 154 || - node.parent.kind === 155 || - node.parent.parent.kind === 157) { + if (node.parent.kind === 155 || + node.parent.kind === 156 || + node.parent.parent.kind === 158) { emitTypeOfVariableDeclarationFromTypeLiteral(node); } else if (!(node.parent.flags & 8)) { @@ -26383,22 +27323,22 @@ var ts; } function getParameterDeclarationTypeVisibilityDiagnosticMessage(symbolAccessibilityResult) { switch (node.parent.kind) { - case 146: + case 147: return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 ? 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 150: + case 151: 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 149: + case 150: 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 146: case 145: - case 144: if (node.parent.flags & 32) { return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 ? @@ -26406,7 +27346,7 @@ var ts; 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 === 218) { + else if (node.parent.parent.kind === 220) { return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 ? ts.Diagnostics.Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : @@ -26418,7 +27358,7 @@ var ts; 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 217: + case 219: return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 ? ts.Diagnostics.Parameter_0_of_exported_function_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : @@ -26429,12 +27369,12 @@ var ts; } } function emitBindingPattern(bindingPattern) { - if (bindingPattern.kind === 165) { + if (bindingPattern.kind === 166) { write("{"); emitCommaList(bindingPattern.elements, emitBindingElement); write("}"); } - else if (bindingPattern.kind === 166) { + else if (bindingPattern.kind === 167) { write("["); var elements = bindingPattern.elements; emitCommaList(elements, emitBindingElement); @@ -26445,10 +27385,10 @@ var ts; } } function emitBindingElement(bindingElement) { - if (bindingElement.kind === 191) { + if (bindingElement.kind === 192) { write(" "); } - else if (bindingElement.kind === 167) { + else if (bindingElement.kind === 168) { if (bindingElement.propertyName) { writeTextOfNode(currentText, bindingElement.propertyName); write(": "); @@ -26470,39 +27410,39 @@ var ts; } function emitNode(node) { switch (node.kind) { - case 217: - case 222: - case 225: case 219: - case 218: - case 220: + case 224: + case 228: case 221: + case 220: + case 222: + case 223: return emitModuleElement(node, isModuleElementVisible(node)); - case 197: + case 199: return emitModuleElement(node, isVariableStatementVisible(node)); - case 226: + case 229: return emitModuleElement(node, !node.importClause); - case 232: + case 235: return emitExportDeclaration(node); + case 147: case 146: case 145: - case 144: return writeFunctionDeclaration(node); - case 150: - case 149: case 151: + case 150: + case 152: return emitSignatureDeclarationWithJsDocComments(node); - case 147: case 148: + case 149: return emitAccessorDeclaration(node); + case 144: case 143: - case 142: return emitPropertyDeclaration(node); - case 251: + case 254: return emitEnumMemberDeclaration(node); - case 231: + case 234: return emitExportAssignment(node); - case 252: + case 255: return emitSourceFile(node); } } @@ -26517,7 +27457,7 @@ var ts; } if (declFileName) { declFileName = ts.getRelativePathToDirectoryOrUrl(ts.getDirectoryPath(ts.normalizeSlashes(declarationFilePath)), declFileName, host.getCurrentDirectory(), host.getCanonicalFileName, false); - referencePathsOutput += "/// " + newLine; + referencePathsOutput += '/// ' + newLine; } return addedBundledEmitReference; function getDeclFileName(emitFileNames, sourceFiles, isBundledEmit) { @@ -26826,6 +27766,7 @@ var ts; }; function emitFiles(resolver, host, targetSourceFile) { var extendsHelper = "\nvar __extends = (this && this.__extends) || function (d, b) {\n for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n};"; + var assignHelper = "\nvar __assign = (this && this.__assign) || Object.assign || function(t) {\n for (var s, i = 1, n = arguments.length; i < n; i++) {\n s = arguments[i];\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))\n t[p] = s[p];\n }\n return t;\n};"; var decorateHelper = "\nvar __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};"; var metadataHelper = "\nvar __metadata = (this && this.__metadata) || function (k, v) {\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(k, v);\n};"; var paramHelper = "\nvar __param = (this && this.__param) || function (paramIndex, decorator) {\n return function (target, key) { decorator(target, key, paramIndex); }\n};"; @@ -26834,6 +27775,7 @@ var ts; 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(); @@ -26842,6 +27784,7 @@ var ts; return { emitSkipped: emitSkipped, diagnostics: emitterDiagnostics.getDiagnostics(), + emittedFiles: emittedFilesList, sourceMaps: sourceMapDataList }; function isUniqueLocalName(name, container) { @@ -26905,6 +27848,7 @@ var ts; var decoratedClassAliases; var convertedLoopState; var extendsEmitted; + var assignEmitted; var decorateEmitted; var paramEmitted; var awaiterEmitted; @@ -26952,7 +27896,7 @@ var ts; if (sourceMappingURL) { write("//# sourceMappingURL=" + sourceMappingURL); } - writeEmittedFiles(writer.getText(), jsFilePath, sourceMapFilePath, compilerOptions.emitBOM); + writeEmittedFiles(writer.getText(), jsFilePath, sourceMapFilePath, compilerOptions.emitBOM, sourceFiles); sourceMap.reset(); writer.reset(); currentSourceFile = undefined; @@ -26969,6 +27913,7 @@ var ts; decorateEmitted = false; paramEmitted = false; awaiterEmitted = false; + assignEmitted = false; tempFlags = 0; tempVariables = undefined; tempParameters = undefined; @@ -27002,19 +27947,19 @@ var ts; } function makeTempVariableName(flags) { if (flags && !(tempFlags & flags)) { - var name_21 = flags === 268435456 ? "_i" : "_n"; - if (isUniqueName(name_21)) { + var name_23 = flags === 268435456 ? "_i" : "_n"; + if (isUniqueName(name_23)) { tempFlags |= flags; - return name_21; + return name_23; } } while (true) { var count = tempFlags & 268435455; tempFlags++; if (count !== 8 && count !== 13) { - var name_22 = count < 26 ? "_" + String.fromCharCode(97 + count) : "_" + (count - 26); - if (isUniqueName(name_22)) { - return name_22; + var name_24 = count < 26 ? "_" + String.fromCharCode(97 + count) : "_" + (count - 26); + if (isUniqueName(name_24)) { + return name_24; } } } @@ -27052,17 +27997,17 @@ var ts; switch (node.kind) { case 69: return makeUniqueName(node.text); - case 222: - case 221: + case 224: + case 223: return generateNameForModuleOrEnum(node); - case 226: - case 232: + case 229: + case 235: return generateNameForImportOrExportDeclaration(node); - case 217: - case 218: - case 231: + case 219: + case 220: + case 234: return generateNameForExportDefault(); - case 190: + case 191: return generateNameForClassExpression(); } } @@ -27070,14 +28015,14 @@ var ts; var id = ts.getNodeId(node); return nodeToGeneratedName[id] || (nodeToGeneratedName[id] = ts.unescapeIdentifier(generateNameForNode(node))); } - function writeEmittedFiles(emitOutput, jsFilePath, sourceMapFilePath, writeByteOrderMark) { + function writeEmittedFiles(emitOutput, jsFilePath, sourceMapFilePath, writeByteOrderMark, sourceFiles) { if (compilerOptions.sourceMap && !compilerOptions.inlineSourceMap) { - ts.writeFile(host, emitterDiagnostics, sourceMapFilePath, sourceMap.getText(), false); + ts.writeFile(host, emitterDiagnostics, sourceMapFilePath, sourceMap.getText(), false, sourceFiles); } if (sourceMapDataList) { sourceMapDataList.push(sourceMap.getSourceMapData()); } - ts.writeFile(host, emitterDiagnostics, jsFilePath, emitOutput, writeByteOrderMark); + ts.writeFile(host, emitterDiagnostics, jsFilePath, emitOutput, writeByteOrderMark, sourceFiles); } function createTempVariable(flags) { var result = ts.createSynthesizedNode(69); @@ -27242,14 +28187,14 @@ var ts; } function getLiteralText(node) { if (languageVersion < 2 && (ts.isTemplateLiteralKind(node.kind) || node.hasExtendedUnicodeEscape)) { - return getQuotedEscapedLiteralText("\"", node.text, "\""); + return getQuotedEscapedLiteralText('"', node.text, '"'); } if (node.parent) { return ts.getTextOfNodeFromSourceText(currentText, node); } switch (node.kind) { case 9: - return getQuotedEscapedLiteralText("\"", node.text, "\""); + return getQuotedEscapedLiteralText('"', node.text, '"'); case 11: return getQuotedEscapedLiteralText("`", node.text, "`"); case 12: @@ -27302,10 +28247,10 @@ var ts; emitParenthesizedIf(node.tag, needsParenthesisForPropertyAccessOrInvocation(node.tag)); write("("); emit(tempVariable); - if (node.template.kind === 187) { + if (node.template.kind === 188) { ts.forEach(node.template.templateSpans, function (templateSpan) { write(", "); - var needsParens = templateSpan.expression.kind === 185 + var needsParens = templateSpan.expression.kind === 186 && templateSpan.expression.operatorToken.kind === 24; emitParenthesizedIf(templateSpan.expression, needsParens); }); @@ -27329,7 +28274,7 @@ var ts; } for (var i = 0, n = node.templateSpans.length; i < n; i++) { var templateSpan = node.templateSpans[i]; - var needsParens = templateSpan.expression.kind !== 176 + var needsParens = templateSpan.expression.kind !== 177 && comparePrecedenceToBinaryPlus(templateSpan.expression) !== 1; if (i > 0 || headEmitted) { write(" + "); @@ -27349,11 +28294,11 @@ var ts; } function templateNeedsParens(template, parent) { switch (parent.kind) { - case 172: case 173: - return parent.expression === template; case 174: - case 176: + return parent.expression === template; + case 175: + case 177: return false; default: return comparePrecedenceToBinaryPlus(parent) !== -1; @@ -27361,7 +28306,7 @@ var ts; } function comparePrecedenceToBinaryPlus(expression) { switch (expression.kind) { - case 185: + case 186: switch (expression.operatorToken.kind) { case 37: case 39: @@ -27373,8 +28318,8 @@ var ts; default: return -1; } - case 188: - case 186: + case 189: + case 187: return -1; default: return 1; @@ -27388,9 +28333,9 @@ var ts; function jsxEmitReact(node) { function emitTagName(name) { if (name.kind === 69 && ts.isIntrinsicJsxName(name.text)) { - write("\""); + write('"'); emit(name); - write("\""); + write('"'); } else { emit(name); @@ -27401,9 +28346,9 @@ var ts; emit(name); } else { - write("\""); + write('"'); emit(name); - write("\""); + write('"'); } } function emitJsxAttribute(node) { @@ -27430,12 +28375,11 @@ var ts; } else { var attrs = openingNode.attributes; - if (ts.forEach(attrs, function (attr) { return attr.kind === 243; })) { - emitExpressionIdentifier(syntheticReactRef); - write(".__spread("); + if (ts.forEach(attrs, function (attr) { return attr.kind === 246; })) { + write("__assign("); var haveOpenedObjectLiteral = false; for (var i = 0; i < attrs.length; i++) { - if (attrs[i].kind === 243) { + if (attrs[i].kind === 246) { if (i === 0) { write("{}, "); } @@ -27449,7 +28393,7 @@ var ts; emit(attrs[i].expression); } else { - ts.Debug.assert(attrs[i].kind === 242); + ts.Debug.assert(attrs[i].kind === 245); if (haveOpenedObjectLiteral) { write(", "); } @@ -27479,7 +28423,7 @@ var ts; } } if (children) { - var firstChild; + var firstChild = void 0; var multipleEmittableChildren = false; for (var i = 0, n = children.length; i < n; i++) { var jsxChild = children[i]; @@ -27505,7 +28449,7 @@ var ts; decreaseIndent(); } else if (firstChild) { - if (firstChild.kind !== 237 && firstChild.kind !== 238) { + if (firstChild.kind !== 240 && firstChild.kind !== 241) { emit(firstChild); } else { @@ -27520,11 +28464,11 @@ var ts; write(")"); emitTrailingComments(openingNode); } - if (node.kind === 237) { + if (node.kind === 240) { emitJsxElement(node.openingElement, node.children); } else { - ts.Debug.assert(node.kind === 238); + ts.Debug.assert(node.kind === 241); emitJsxElement(node); } } @@ -27546,11 +28490,11 @@ var ts; if (i > 0) { write(" "); } - if (attribs[i].kind === 243) { + if (attribs[i].kind === 246) { emitJsxSpreadAttribute(attribs[i]); } else { - ts.Debug.assert(attribs[i].kind === 242); + ts.Debug.assert(attribs[i].kind === 245); emitJsxAttribute(attribs[i]); } } @@ -27558,11 +28502,11 @@ var ts; function emitJsxOpeningOrSelfClosingElement(node) { write("<"); emit(node.tagName); - if (node.attributes.length > 0 || (node.kind === 238)) { + if (node.attributes.length > 0 || (node.kind === 241)) { write(" "); } emitAttributes(node.attributes); - if (node.kind === 238) { + if (node.kind === 241) { write("/>"); } else { @@ -27581,20 +28525,20 @@ var ts; } emitJsxClosingElement(node.closingElement); } - if (node.kind === 237) { + if (node.kind === 240) { emitJsxElement(node); } else { - ts.Debug.assert(node.kind === 238); + ts.Debug.assert(node.kind === 241); emitJsxOpeningOrSelfClosingElement(node); } } function emitExpressionForPropertyName(node) { - ts.Debug.assert(node.kind !== 167); + ts.Debug.assert(node.kind !== 168); if (node.kind === 9) { emitLiteral(node); } - else if (node.kind === 138) { + else if (node.kind === 139) { if (ts.nodeIsDecorated(node.parent)) { if (!computedPropertyNamesToGeneratedNames) { computedPropertyNamesToGeneratedNames = []; @@ -27612,75 +28556,76 @@ var ts; emit(node.expression); } else { - write("\""); + write('"'); if (node.kind === 8) { write(node.text); } else { writeTextOfNode(currentText, node); } - write("\""); + write('"'); } } function isExpressionIdentifier(node) { var parent = node.parent; switch (parent.kind) { - case 168: - case 193: - case 185: - case 172: - case 245: - case 138: - case 186: - case 141: - case 179: - case 201: - case 171: - case 231: - case 199: - case 192: - case 203: - case 204: - case 205: - case 200: - case 241: - case 238: - case 239: - case 243: - case 244: - case 173: - case 176: - case 184: - case 183: - case 208: - case 250: - case 189: - case 210: - case 174: + case 169: case 194: + case 186: + case 173: + case 248: + case 139: + case 187: + case 142: + case 180: + case 203: + case 172: + case 234: + case 201: + case 193: + case 205: + case 206: + case 207: + case 202: + case 244: + case 241: + case 242: + case 246: + case 247: + case 174: + case 195: + case 177: + case 185: + case 184: + case 210: + case 253: + case 190: case 212: case 175: - case 180: + case 196: + case 214: + case 176: case 181: - case 202: - case 209: - case 188: + case 182: + case 204: + case 211: + case 189: return true; - case 167: - case 251: - case 140: - case 249: - case 143: - case 215: + case 168: + case 254: + case 141: + case 252: + case 144: + case 217: return parent.initializer === node; - case 170: + case 171: return parent.expression === node; + case 179: case 178: - case 177: return parent.body === node; - case 225: + case 228: return parent.moduleReference === node; - case 137: + case 138: return parent.left === node; } return false; @@ -27688,7 +28633,7 @@ var ts; function emitExpressionIdentifier(node) { var container = resolver.getReferencedExportContainer(node); if (container) { - if (container.kind === 252) { + if (container.kind === 255) { if (modulekind !== ts.ModuleKind.ES6 && modulekind !== ts.ModuleKind.System) { write("exports."); } @@ -27702,17 +28647,17 @@ var ts; if (modulekind !== ts.ModuleKind.ES6) { var declaration = resolver.getReferencedImportDeclaration(node); if (declaration) { - if (declaration.kind === 227) { + if (declaration.kind === 230) { write(getGeneratedNameForNode(declaration.parent)); - write(languageVersion === 0 ? "[\"default\"]" : ".default"); + write(languageVersion === 0 ? '["default"]' : ".default"); return; } - else if (declaration.kind === 230) { + else if (declaration.kind === 233) { write(getGeneratedNameForNode(declaration.parent.parent.parent)); - var name_23 = declaration.propertyName || declaration.name; - var identifier = ts.getTextOfNodeFromSourceText(currentText, name_23); + var name_25 = declaration.propertyName || declaration.name; + var identifier = ts.getTextOfNodeFromSourceText(currentText, name_25); if (languageVersion === 0 && identifier === "default") { - write("[\"default\"]"); + write('["default"]'); } else { write("."); @@ -27749,13 +28694,13 @@ var ts; } function isNameOfNestedBlockScopedRedeclarationOrCapturedBinding(node) { if (languageVersion < 2) { - var parent_8 = node.parent; - switch (parent_8.kind) { - case 167: - case 218: - case 221: - case 215: - return parent_8.name === node && resolver.isDeclarationWithCollidingName(parent_8); + var parent_10 = node.parent; + switch (parent_10.kind) { + case 168: + case 220: + case 223: + case 217: + return parent_10.name === node && resolver.isDeclarationWithCollidingName(parent_10); } } return false; @@ -27763,8 +28708,8 @@ var ts; function emitIdentifier(node) { if (convertedLoopState) { if (node.text == "arguments" && resolver.isArgumentsLocalBinding(node)) { - var name_24 = convertedLoopState.argumentsName || (convertedLoopState.argumentsName = makeUniqueName("arguments")); - write(name_24); + var name_26 = convertedLoopState.argumentsName || (convertedLoopState.argumentsName = makeUniqueName("arguments")); + write(name_26); return; } } @@ -27864,10 +28809,10 @@ var ts; } } function needsParenthesisForAwaitExpressionAsYield(node) { - if (node.parent.kind === 185 && !ts.isAssignmentOperator(node.parent.operatorToken.kind)) { + if (node.parent.kind === 186 && !ts.isAssignmentOperator(node.parent.operatorToken.kind)) { return true; } - else if (node.parent.kind === 186 && node.parent.condition === node) { + else if (node.parent.kind === 187 && node.parent.condition === node) { return true; } return false; @@ -27875,11 +28820,11 @@ var ts; function needsParenthesisForPropertyAccessOrInvocation(node) { switch (node.kind) { case 69: - case 168: - case 170: + case 169: case 171: case 172: - case 176: + case 173: + case 177: return false; } return true; @@ -27896,17 +28841,17 @@ var ts; write(", "); } var e = elements[pos]; - if (e.kind === 189) { + if (e.kind === 190) { e = e.expression; emitParenthesizedIf(e, group === 0 && needsParenthesisForPropertyAccessOrInvocation(e)); pos++; - if (pos === length && group === 0 && needsUniqueCopy && e.kind !== 168) { + if (pos === length && group === 0 && needsUniqueCopy && e.kind !== 169) { write(".slice()"); } } else { var i = pos; - while (i < length && elements[i].kind !== 189) { + while (i < length && elements[i].kind !== 190) { i++; } write("["); @@ -27929,7 +28874,7 @@ var ts; } } function isSpreadElementExpression(node) { - return node.kind === 189; + return node.kind === 190; } function emitArrayLiteral(node) { var elements = node.elements; @@ -27990,7 +28935,7 @@ var ts; writeComma(); var property = properties[i]; emitStart(property); - if (property.kind === 147 || property.kind === 148) { + if (property.kind === 148 || property.kind === 149) { var accessors = ts.getAllAccessorDeclarations(node.properties, property); if (property !== accessors.firstAccessor) { continue; @@ -28041,13 +28986,13 @@ var ts; emitMemberAccessForPropertyName(property.name); emitEnd(property.name); write(" = "); - if (property.kind === 249) { + if (property.kind === 252) { emit(property.initializer); } - else if (property.kind === 250) { + else if (property.kind === 253) { emitExpressionIdentifier(property.name); } - else if (property.kind === 145) { + else if (property.kind === 146) { emitFunctionDeclaration(property); } else { @@ -28079,7 +29024,7 @@ var ts; var numProperties = properties.length; var numInitialNonComputedProperties = numProperties; for (var i = 0, n = properties.length; i < n; i++) { - if (properties[i].name.kind === 138) { + if (properties[i].name.kind === 139) { numInitialNonComputedProperties = i; break; } @@ -28093,35 +29038,37 @@ var ts; emitObjectLiteralBody(node, properties.length); } function createBinaryExpression(left, operator, right, startsOnNewLine) { - var result = ts.createSynthesizedNode(185, startsOnNewLine); + var result = ts.createSynthesizedNode(186, startsOnNewLine); result.operatorToken = ts.createSynthesizedNode(operator); result.left = left; result.right = right; return result; } function createPropertyAccessExpression(expression, name) { - var result = ts.createSynthesizedNode(170); + var result = ts.createSynthesizedNode(171); result.expression = parenthesizeForAccess(expression); result.dotToken = ts.createSynthesizedNode(21); result.name = name; return result; } function createElementAccessExpression(expression, argumentExpression) { - var result = ts.createSynthesizedNode(171); + var result = ts.createSynthesizedNode(172); result.expression = parenthesizeForAccess(expression); result.argumentExpression = argumentExpression; return result; } function parenthesizeForAccess(expr) { - while (expr.kind === 175 || expr.kind === 193) { + while (expr.kind === 176 || + expr.kind === 194 || + expr.kind === 195) { expr = expr.expression; } if (ts.isLeftHandSideExpression(expr) && - expr.kind !== 173 && + expr.kind !== 174 && expr.kind !== 8) { return expr; } - var node = ts.createSynthesizedNode(176); + var node = ts.createSynthesizedNode(177); node.expression = expr; return node; } @@ -28148,11 +29095,15 @@ var ts; } function isNamespaceExportReference(node) { var container = resolver.getReferencedExportContainer(node); - return container && container.kind !== 252; + return container && container.kind !== 255; + } + function isImportedReference(node) { + var declaration = resolver.getReferencedImportDeclaration(node); + return declaration && (declaration.kind === 230 || declaration.kind === 233); } function emitShorthandPropertyAssignment(node) { writeTextOfNode(currentText, node.name); - if (modulekind !== ts.ModuleKind.ES6 || isNamespaceExportReference(node.name)) { + if (languageVersion < 2 || (modulekind !== ts.ModuleKind.ES6 && isImportedReference(node.name)) || isNamespaceExportReference(node.name)) { write(": "); emit(node.name); } @@ -28166,7 +29117,7 @@ var ts; if (constantValue !== undefined) { write(constantValue.toString()); if (!compilerOptions.removeComments) { - var propertyName = node.kind === 170 ? ts.declarationNameToString(node.name) : ts.getTextOfNode(node.argumentExpression); + var propertyName = node.kind === 171 ? ts.declarationNameToString(node.name) : ts.getTextOfNode(node.argumentExpression); write(" /* " + propertyName + " */"); } return true; @@ -28177,7 +29128,7 @@ var ts; if (compilerOptions.isolatedModules) { return undefined; } - return node.kind === 170 || node.kind === 171 + return node.kind === 171 || node.kind === 172 ? resolver.getConstantValue(node) : undefined; } @@ -28203,9 +29154,9 @@ var ts; if (languageVersion === 2 && node.expression.kind === 95 && isInAsyncMethodWithSuperInES6(node)) { - var name_25 = ts.createSynthesizedNode(9); - name_25.text = node.name.text; - emitSuperAccessInAsyncMethod(node.expression, name_25); + var name_27 = ts.createSynthesizedNode(9); + name_27.text = node.name.text; + emitSuperAccessInAsyncMethod(node.expression, name_27); return; } emit(node.expression); @@ -28265,7 +29216,7 @@ var ts; } emitExpressionIdentifier(node); break; - case 137: + case 138: emitQualifiedNameAsExpression(node, useFallback); break; default: @@ -28289,10 +29240,13 @@ var ts; write("]"); } function hasSpreadElement(elements) { - return ts.forEach(elements, function (e) { return e.kind === 189; }); + return ts.forEach(elements, function (e) { return e.kind === 190; }); } function skipParentheses(node) { - while (node.kind === 176 || node.kind === 175 || node.kind === 193) { + while (node.kind === 177 || + node.kind === 176 || + node.kind === 194 || + node.kind === 195) { node = node.expression; } return node; @@ -28313,12 +29267,12 @@ var ts; function emitCallWithSpread(node) { var target; var expr = skipParentheses(node.expression); - if (expr.kind === 170) { + if (expr.kind === 171) { target = emitCallTarget(expr.expression); write("."); emit(expr.name); } - else if (expr.kind === 171) { + else if (expr.kind === 172) { target = emitCallTarget(expr.expression); write("["); emit(expr.argumentExpression); @@ -28429,21 +29383,25 @@ var ts; } } function emitParenExpression(node) { - if (!ts.nodeIsSynthesized(node) && node.parent.kind !== 178) { - if (node.expression.kind === 175 || node.expression.kind === 193) { + if (!ts.nodeIsSynthesized(node) && node.parent.kind !== 179) { + if (node.expression.kind === 176 || + node.expression.kind === 194 || + node.expression.kind === 195) { var operand = node.expression.expression; - while (operand.kind === 175 || operand.kind === 193) { + while (operand.kind === 176 || + operand.kind === 194 || + operand.kind === 195) { operand = operand.expression; } - if (operand.kind !== 183 && + if (operand.kind !== 184 && + operand.kind !== 182 && operand.kind !== 181 && operand.kind !== 180 && - operand.kind !== 179 && - operand.kind !== 184 && - operand.kind !== 173 && - !(operand.kind === 172 && node.parent.kind === 173) && - !(operand.kind === 177 && node.parent.kind === 172) && - !(operand.kind === 8 && node.parent.kind === 170)) { + operand.kind !== 185 && + operand.kind !== 174 && + !(operand.kind === 173 && node.parent.kind === 174) && + !(operand.kind === 178 && node.parent.kind === 173) && + !(operand.kind === 8 && node.parent.kind === 171)) { emit(operand); return; } @@ -28472,7 +29430,7 @@ var ts; if (!isCurrentFileSystemExternalModule() || node.kind !== 69 || ts.nodeIsSynthesized(node)) { return false; } - var isVariableDeclarationOrBindingElement = node.parent && (node.parent.kind === 215 || node.parent.kind === 167); + var isVariableDeclarationOrBindingElement = node.parent && (node.parent.kind === 217 || node.parent.kind === 168); var targetDeclaration = isVariableDeclarationOrBindingElement ? node.parent : resolver.getReferencedValueDeclaration(node); @@ -28487,7 +29445,7 @@ var ts; write("\", "); } write(ts.tokenToString(node.operator)); - if (node.operand.kind === 183) { + if (node.operand.kind === 184) { var operand = node.operand; if (node.operator === 35 && (operand.operator === 35 || operand.operator === 41)) { write(" "); @@ -28530,7 +29488,7 @@ var ts; } var current = ts.getRootDeclaration(node).parent; while (current) { - if (current.kind === 252) { + if (current.kind === 255) { return !isExported || ((ts.getCombinedNodeFlags(node) & 1) !== 0); } else if (ts.isDeclaration(current)) { @@ -28544,12 +29502,12 @@ var ts; function emitExponentiationOperator(node) { var leftHandSideExpression = node.left; if (node.operatorToken.kind === 60) { - var synthesizedLHS; + var synthesizedLHS = void 0; var shouldEmitParentheses = false; if (ts.isElementAccessExpression(leftHandSideExpression)) { shouldEmitParentheses = true; write("("); - synthesizedLHS = ts.createSynthesizedNode(171, false); + synthesizedLHS = ts.createSynthesizedNode(172, false); var identifier = emitTempVariableAssignment(leftHandSideExpression.expression, false, false); synthesizedLHS.expression = identifier; if (leftHandSideExpression.argumentExpression.kind !== 8 && @@ -28566,7 +29524,7 @@ var ts; else if (ts.isPropertyAccessExpression(leftHandSideExpression)) { shouldEmitParentheses = true; write("("); - synthesizedLHS = ts.createSynthesizedNode(170, false); + synthesizedLHS = ts.createSynthesizedNode(171, false); var identifier = emitTempVariableAssignment(leftHandSideExpression.expression, false, false); synthesizedLHS.expression = identifier; synthesizedLHS.dotToken = leftHandSideExpression.dotToken; @@ -28594,8 +29552,8 @@ var ts; } function emitBinaryExpression(node) { if (languageVersion < 2 && node.operatorToken.kind === 56 && - (node.left.kind === 169 || node.left.kind === 168)) { - emitDestructuring(node, node.parent.kind === 199); + (node.left.kind === 170 || node.left.kind === 169)) { + emitDestructuring(node, node.parent.kind === 201); } else { var exportChanged = node.operatorToken.kind >= 56 && @@ -28647,7 +29605,7 @@ var ts; } } function isSingleLineEmptyBlock(node) { - if (node && node.kind === 196) { + if (node && node.kind === 198) { var block = node; return block.statements.length === 0 && nodeEndIsOnSameLineAsNodeStart(block, block); } @@ -28661,12 +29619,12 @@ var ts; } emitToken(15, node.pos); increaseIndent(); - if (node.kind === 223) { - ts.Debug.assert(node.parent.kind === 222); + if (node.kind === 225) { + ts.Debug.assert(node.parent.kind === 224); emitCaptureThisForNodeIfNecessary(node.parent); } emitLines(node.statements); - if (node.kind === 223) { + if (node.kind === 225) { emitTempDeclarations(true); } decreaseIndent(); @@ -28674,7 +29632,7 @@ var ts; emitToken(16, node.statements.end); } function emitEmbeddedStatement(node) { - if (node.kind === 196) { + if (node.kind === 198) { write(" "); emit(node); } @@ -28686,7 +29644,7 @@ var ts; } } function emitExpressionStatement(node) { - emitParenthesizedIf(node.expression, node.expression.kind === 178); + emitParenthesizedIf(node.expression, node.expression.kind === 179); write(";"); } function emitIfStatement(node) { @@ -28699,7 +29657,7 @@ var ts; if (node.elseStatement) { writeLine(); emitToken(80, node.thenStatement.end); - if (node.elseStatement.kind === 200) { + if (node.elseStatement.kind === 202) { write(" "); emit(node.elseStatement); } @@ -28719,7 +29677,7 @@ var ts; else { emitNormalLoopBody(node, true); } - if (node.statement.kind === 196) { + if (node.statement.kind === 198) { write(" "); } else { @@ -28799,7 +29757,7 @@ var ts; } else { var loop = convertLoopBody(node); - if (node.parent.kind === 211) { + if (node.parent.kind === 213) { emitLabelAndColon(node.parent); } loopEmitter(node, loop); @@ -28809,11 +29767,11 @@ var ts; var functionName = makeUniqueName("_loop"); var loopInitializer; switch (node.kind) { - case 203: - case 204: case 205: + case 206: + case 207: var initializer = node.initializer; - if (initializer && initializer.kind === 216) { + if (initializer && initializer.kind === 218) { loopInitializer = node.initializer; } break; @@ -28827,7 +29785,7 @@ var ts; processVariableDeclaration(varDeclaration.name); } } - var bodyIsBlock = node.statement.kind === 196; + var bodyIsBlock = node.statement.kind === 198; var paramList = loopParameters ? loopParameters.join(", ") : ""; writeLine(); write("var " + functionName + " = function(" + paramList + ")"); @@ -28894,7 +29852,7 @@ var ts; } else { write("var "); - var seen; + var seen = void 0; for (var _c = 0, _d = convertedLoopState.hoistedLocalVariables; _c < _d.length; _c++) { var id = _d[_c]; if (!seen) { @@ -28943,7 +29901,7 @@ var ts; if (emitAsEmbeddedStatement) { emitEmbeddedStatement(node.statement); } - else if (node.statement.kind === 196) { + else if (node.statement.kind === 198) { emitLines(node.statement.statements); } else { @@ -28982,7 +29940,7 @@ var ts; writeLine(); increaseIndent(); } - var isSimpleLoop = !loop.state.nonLocalJumps && + var isSimpleLoop = !(loop.state.nonLocalJumps & ~4) && !loop.state.labeledNonLocalBreaks && !loop.state.labeledNonLocalContinues; var loopResult = makeUniqueName("state"); @@ -29009,10 +29967,6 @@ var ts; write("if (" + loopResult + " === \"break\") break;"); writeLine(); } - if (loop.state.nonLocalJumps & 4) { - write("if (" + loopResult + " === \"continue\") continue;"); - writeLine(); - } emitDispatchTableForLabeledJumps(loopResult, loop.state, convertedLoopState); } if (emitAsBlock) { @@ -29063,7 +30017,7 @@ var ts; var endPos = emitToken(86, node.pos); write(" "); endPos = emitToken(17, endPos); - if (node.initializer && node.initializer.kind === 216) { + if (node.initializer && node.initializer.kind === 218) { var variableDeclarationList = node.initializer; var startIsEmitted = tryEmitStartOfVariableDeclarationList(variableDeclarationList); if (startIsEmitted) { @@ -29089,7 +30043,7 @@ var ts; } } function emitForInOrForOfStatement(node) { - if (languageVersion < 2 && node.kind === 205) { + if (languageVersion < 2 && node.kind === 207) { emitLoop(node, emitDownLevelForOfStatementWorker); } else { @@ -29100,7 +30054,7 @@ var ts; var endPos = emitToken(86, node.pos); write(" "); endPos = emitToken(17, endPos); - if (node.initializer.kind === 216) { + if (node.initializer.kind === 218) { var variableDeclarationList = node.initializer; if (variableDeclarationList.declarations.length >= 1) { tryEmitStartOfVariableDeclarationList(variableDeclarationList); @@ -29110,7 +30064,7 @@ var ts; else { emit(node.initializer); } - if (node.kind === 204) { + if (node.kind === 206) { write(" in "); } else { @@ -29163,7 +30117,7 @@ var ts; increaseIndent(); var rhsIterationValue = createElementAccessExpression(rhsReference, counter); emitStart(node.initializer); - if (node.initializer.kind === 216) { + if (node.initializer.kind === 218) { write("var "); var variableDeclarationList = node.initializer; if (variableDeclarationList.declarations.length > 0) { @@ -29185,7 +30139,7 @@ var ts; } else { var assignmentExpression = createBinaryExpression(node.initializer, 56, rhsIterationValue, false); - if (node.initializer.kind === 168 || node.initializer.kind === 169) { + if (node.initializer.kind === 169 || node.initializer.kind === 170) { emitDestructuring(assignmentExpression, true, undefined); } else { @@ -29207,14 +30161,14 @@ var ts; } function emitBreakOrContinueStatement(node) { if (convertedLoopState) { - var jump = node.kind === 207 ? 2 : 4; + var jump = node.kind === 209 ? 2 : 4; var canUseBreakOrContinue = (node.label && convertedLoopState.labels && convertedLoopState.labels[node.label.text]) || (!node.label && (convertedLoopState.allowedNonLabeledJumps & jump)); if (!canUseBreakOrContinue) { write("return "); copyLoopOutParameters(convertedLoopState, 1, false); if (!node.label) { - if (node.kind === 207) { + if (node.kind === 209) { convertedLoopState.nonLocalJumps |= 2; write("\"break\";"); } @@ -29224,8 +30178,8 @@ var ts; } } else { - var labelMarker; - if (node.kind === 207) { + var labelMarker = void 0; + if (node.kind === 209) { labelMarker = "break-" + node.label.text; setLabeledJump(convertedLoopState, true, node.label.text, labelMarker); } @@ -29238,7 +30192,7 @@ var ts; return; } } - emitToken(node.kind === 207 ? 70 : 75, node.pos); + emitToken(node.kind === 209 ? 70 : 75, node.pos); emitOptional(" ", node.label); write(";"); } @@ -29303,7 +30257,7 @@ var ts; ts.getLineOfLocalPositionFromLineMap(currentLineMap, ts.skipTrivia(currentText, node2.pos)); } function emitCaseOrDefaultClause(node) { - if (node.kind === 245) { + if (node.kind === 248) { write("case "); emit(node.expression); write(":"); @@ -29372,7 +30326,7 @@ var ts; function getContainingModule(node) { do { node = node.parent; - } while (node && node.kind !== 222); + } while (node && node.kind !== 224); return node; } function emitContainingModuleName(node) { @@ -29397,17 +30351,17 @@ var ts; function createVoidZero() { var zero = ts.createSynthesizedNode(8); zero.text = "0"; - var result = ts.createSynthesizedNode(181); + var result = ts.createSynthesizedNode(182); result.expression = zero; return result; } function emitEs6ExportDefaultCompat(node) { - if (node.parent.kind === 252) { - ts.Debug.assert(!!(node.flags & 512) || node.kind === 231); + if (node.parent.kind === 255) { + ts.Debug.assert(!!(node.flags & 512) || node.kind === 234); if (modulekind === ts.ModuleKind.CommonJS || modulekind === ts.ModuleKind.AMD || modulekind === ts.ModuleKind.UMD) { if (!isEs6Module) { if (languageVersion !== 0) { - write("Object.defineProperty(exports, \"__esModule\", { value: true });"); + write('Object.defineProperty(exports, "__esModule", { value: true });'); writeLine(); } else { @@ -29438,7 +30392,7 @@ var ts; if (node.flags & 512) { emitEs6ExportDefaultCompat(node); if (languageVersion === 0) { - write("exports[\"default\"]"); + write('exports["default"]'); } else { write("exports.default"); @@ -29498,7 +30452,7 @@ var ts; emitNodeWithCommentsAndWithoutSourcemap(name); write("\", "); } - var isVariableDeclarationOrBindingElement = name.parent && (name.parent.kind === 215 || name.parent.kind === 167); + var isVariableDeclarationOrBindingElement = name.parent && (name.parent.kind === 217 || name.parent.kind === 168); emitStart(isFirstVariableDeclaration(nodeForSourceMap) ? nodeForSourceMap.parent : nodeForSourceMap); withTemporaryNoSourceMap(function () { if (isVariableDeclarationOrBindingElement) { @@ -29524,22 +30478,22 @@ var ts; return identifier; } function isFirstVariableDeclaration(root) { - return root.kind === 215 && - root.parent.kind === 216 && + return root.kind === 217 && + root.parent.kind === 218 && root.parent.declarations[0] === root; } function emitDestructuring(root, isAssignmentExpressionStatement, value) { var emitCount = 0; var canDefineTempVariablesInPlace = false; - if (root.kind === 215) { + if (root.kind === 217) { var isExported = ts.getCombinedNodeFlags(root) & 1; var isSourceLevelForSystemModuleKind = shouldHoistDeclarationInSystemJsModule(root); canDefineTempVariablesInPlace = !isExported && !isSourceLevelForSystemModuleKind; } - else if (root.kind === 140) { + else if (root.kind === 141) { canDefineTempVariablesInPlace = true; } - if (root.kind === 185) { + if (root.kind === 186) { emitAssignmentExpression(root); } else { @@ -29559,14 +30513,14 @@ var ts; } function createDefaultValueCheck(value, defaultValue, sourceMapNode) { value = ensureIdentifier(value, true, sourceMapNode); - var equals = ts.createSynthesizedNode(185); + var equals = ts.createSynthesizedNode(186); equals.left = value; equals.operatorToken = ts.createSynthesizedNode(32); equals.right = createVoidZero(); return createConditionalExpression(equals, defaultValue, value); } function createConditionalExpression(condition, whenTrue, whenFalse) { - var cond = ts.createSynthesizedNode(186); + var cond = ts.createSynthesizedNode(187); cond.condition = condition; cond.questionToken = ts.createSynthesizedNode(53); cond.whenTrue = whenTrue; @@ -29581,7 +30535,7 @@ var ts; } function createPropertyAccessForDestructuringProperty(object, propName) { var index; - var nameIsComputed = propName.kind === 138; + var nameIsComputed = propName.kind === 139; if (nameIsComputed) { index = ensureIdentifier(propName.expression, false, propName); } @@ -29594,7 +30548,7 @@ var ts; : createElementAccessExpression(object, index); } function createSliceCall(value, sliceIndex) { - var call = ts.createSynthesizedNode(172); + var call = ts.createSynthesizedNode(173); var sliceIdentifier = ts.createSynthesizedNode(69); sliceIdentifier.text = "slice"; call.expression = createPropertyAccessExpression(value, sliceIdentifier); @@ -29609,9 +30563,9 @@ var ts; } for (var _a = 0, properties_5 = properties; _a < properties_5.length; _a++) { var p = properties_5[_a]; - if (p.kind === 249 || p.kind === 250) { + if (p.kind === 252 || p.kind === 253) { var propName = p.name; - var target_1 = p.kind === 250 ? p : p.initializer || propName; + var target_1 = p.kind === 253 ? p : p.initializer || propName; emitDestructuringAssignment(target_1, createPropertyAccessForDestructuringProperty(value, propName), p); } } @@ -29623,8 +30577,8 @@ var ts; } for (var i = 0; i < elements.length; i++) { var e = elements[i]; - if (e.kind !== 191) { - if (e.kind !== 189) { + if (e.kind !== 192) { + if (e.kind !== 190) { emitDestructuringAssignment(e, createElementAccessExpression(value, createNumericLiteral(i)), e); } else if (i === elements.length - 1) { @@ -29634,20 +30588,20 @@ var ts; } } function emitDestructuringAssignment(target, value, sourceMapNode) { - if (target.kind === 250) { + if (target.kind === 253) { if (target.objectAssignmentInitializer) { value = createDefaultValueCheck(value, target.objectAssignmentInitializer, sourceMapNode); } target = target.name; } - else if (target.kind === 185 && target.operatorToken.kind === 56) { + else if (target.kind === 186 && target.operatorToken.kind === 56) { value = createDefaultValueCheck(value, target.right, sourceMapNode); target = target.left; } - if (target.kind === 169) { + if (target.kind === 170) { emitObjectLiteralAssignment(target, value, sourceMapNode); } - else if (target.kind === 168) { + else if (target.kind === 169) { emitArrayLiteralAssignment(target, value, sourceMapNode); } else { @@ -29665,14 +30619,14 @@ var ts; emitDestructuringAssignment(target, value, ts.nodeIsSynthesized(root) ? target : root); } else { - if (root.parent.kind !== 176) { + if (root.parent.kind !== 177) { write("("); } value = ensureIdentifier(value, true, root); emitDestructuringAssignment(target, value, root); write(", "); emit(value); - if (root.parent.kind !== 176) { + if (root.parent.kind !== 177) { write(")"); } } @@ -29693,11 +30647,11 @@ var ts; } for (var i = 0; i < numElements; i++) { var element = elements[i]; - if (pattern.kind === 165) { + if (pattern.kind === 166) { var propName = element.propertyName || element.name; emitBindingElement(element, createPropertyAccessForDestructuringProperty(value, propName)); } - else if (element.kind !== 191) { + else if (element.kind !== 192) { if (!element.dotDotDotToken) { emitBindingElement(element, createElementAccessExpression(value, createNumericLiteral(i))); } @@ -29715,12 +30669,21 @@ var ts; } function emitVariableDeclaration(node) { if (ts.isBindingPattern(node.name)) { - if (languageVersion < 2) { - emitDestructuring(node, false); - } - else { + var isExported = ts.getCombinedNodeFlags(node) & 1; + if (languageVersion >= 2 && (!isExported || modulekind === ts.ModuleKind.ES6)) { + var isTopLevelDeclarationInSystemModule = modulekind === ts.ModuleKind.System && + shouldHoistVariable(node, true); + if (isTopLevelDeclarationInSystemModule) { + write("("); + } emit(node.name); emitOptional(" = ", node.initializer); + if (isTopLevelDeclarationInSystemModule) { + write(")"); + } + } + else { + emitDestructuring(node, false); } } else { @@ -29733,12 +30696,12 @@ var ts; var isCapturedInFunction = flags & 131072; var isDeclaredInLoop = flags & 262144; var emittedAsTopLevel = ts.isBlockScopedContainerTopLevel(container) || - (isCapturedInFunction && isDeclaredInLoop && container.kind === 196 && ts.isIterationStatement(container.parent, false)); + (isCapturedInFunction && isDeclaredInLoop && container.kind === 198 && ts.isIterationStatement(container.parent, false)); var emittedAsNestedLetDeclaration = ts.getCombinedNodeFlags(node) & 1024 && !emittedAsTopLevel; var emitExplicitInitializer = emittedAsNestedLetDeclaration && - container.kind !== 204 && - container.kind !== 205 && + container.kind !== 206 && + container.kind !== 207 && (!resolver.isDeclarationWithCollidingName(node) || (isDeclaredInLoop && !isCapturedInFunction && !ts.isIterationStatement(container, false))); if (emitExplicitInitializer) { @@ -29759,7 +30722,7 @@ var ts; } } function emitExportVariableAssignments(node) { - if (node.kind === 191) { + if (node.kind === 192) { return; } var name = node.name; @@ -29773,7 +30736,7 @@ var ts; function isES6ExportedDeclaration(node) { return !!(node.flags & 1) && modulekind === ts.ModuleKind.ES6 && - node.parent.kind === 252; + node.parent.kind === 255; } function emitVariableStatement(node) { var startIsEmitted = false; @@ -29818,12 +30781,12 @@ var ts; function emitParameter(node) { if (languageVersion < 2) { if (ts.isBindingPattern(node.name)) { - var name_26 = createTempVariable(0); + var name_28 = createTempVariable(0); if (!tempParameters) { tempParameters = []; } - tempParameters.push(name_26); - emit(name_26); + tempParameters.push(name_28); + emit(name_28); } else { emit(node.name); @@ -29839,7 +30802,7 @@ var ts; } function emitDefaultValueAssignments(node) { if (languageVersion < 2) { - var tempIndex = 0; + var tempIndex_1 = 0; ts.forEach(node.parameters, function (parameter) { if (parameter.dotDotDotToken) { return; @@ -29851,15 +30814,15 @@ var ts; writeLine(); write("var "); if (hasBindingElements) { - emitDestructuring(parameter, false, tempParameters[tempIndex]); + emitDestructuring(parameter, false, tempParameters[tempIndex_1]); } else { - emit(tempParameters[tempIndex]); + emit(tempParameters[tempIndex_1]); write(" = "); emit(initializer); } write(";"); - tempIndex++; + tempIndex_1++; } } else if (initializer) { @@ -29922,12 +30885,12 @@ var ts; } } function emitAccessor(node) { - write(node.kind === 147 ? "get " : "set "); + write(node.kind === 148 ? "get " : "set "); emit(node.name); emitSignatureAndBody(node); } function shouldEmitAsArrowFunction(node) { - return node.kind === 178 && languageVersion >= 2; + return node.kind === 179 && languageVersion >= 2; } function emitDeclarationName(node) { if (node.name) { @@ -29938,10 +30901,10 @@ var ts; } } function shouldEmitFunctionName(node) { - if (node.kind === 177) { + if (node.kind === 178) { return !!node.name; } - if (node.kind === 217) { + if (node.kind === 219) { return !!node.name || modulekind !== ts.ModuleKind.ES6; } } @@ -29950,12 +30913,12 @@ var ts; return emitCommentsOnNotEmittedNode(node); } var kind = node.kind, parent = node.parent; - if (kind !== 145 && - kind !== 144 && + if (kind !== 146 && + kind !== 145 && parent && - parent.kind !== 249 && - parent.kind !== 172 && - parent.kind !== 168) { + parent.kind !== 252 && + parent.kind !== 173 && + parent.kind !== 169) { emitLeadingComments(node); } emitStart(node); @@ -29976,11 +30939,13 @@ var ts; emitDeclarationName(node); } emitSignatureAndBody(node); - if (modulekind !== ts.ModuleKind.ES6 && kind === 217 && parent === currentSourceFile && node.name) { + if (modulekind !== ts.ModuleKind.ES6 && kind === 219 && parent === currentSourceFile && node.name) { emitExportMemberAssignments(node.name); } emitEnd(node); - if (kind !== 145 && kind !== 144) { + if (kind !== 146 && + kind !== 145 && + kind !== 179) { emitTrailingComments(node); } } @@ -29997,8 +30962,9 @@ var ts; write("("); if (node) { var parameters = node.parameters; + var skipCount = node.parameters.length && node.parameters[0].name.text === "this" ? 1 : 0; var omitCount = languageVersion < 2 && ts.hasRestParameter(node) ? 1 : 0; - emitList(parameters, 0, parameters.length - omitCount, false, false); + emitList(parameters, skipCount, parameters.length - omitCount - skipCount, false, false); } write(")"); decreaseIndent(); @@ -30012,7 +30978,7 @@ var ts; } function emitAsyncFunctionBodyForES6(node) { var promiseConstructor = ts.getEntityNameFromTypeNode(node.type); - var isArrowFunction = node.kind === 178; + var isArrowFunction = node.kind === 179; var hasLexicalArguments = (resolver.getNodeCheckFlags(node) & 8192) !== 0; if (!isArrowFunction) { write(" {"); @@ -30056,7 +31022,7 @@ var ts; write(" { }"); } else { - if (node.body.kind === 196) { + if (node.body.kind === 198) { emitBlockFunctionBody(node, node.body); } else { @@ -30108,10 +31074,10 @@ var ts; } write(" "); var current = body; - while (current.kind === 175) { + while (current.kind === 176) { current = current.expression; } - emitParenthesizedIf(body, current.kind === 169); + emitParenthesizedIf(body, current.kind === 170); } function emitDownLevelExpressionFunctionBody(node, body) { write(" {"); @@ -30187,7 +31153,7 @@ var ts; return undefined; } var statement = statements[index]; - if (statement.kind === 199) { + if (statement.kind === 201) { return ts.isSuperCallExpression(statement.expression) ? statement : undefined; } } @@ -30213,7 +31179,7 @@ var ts; emitNodeWithCommentsAndWithoutSourcemap(memberName); write("]"); } - else if (memberName.kind === 138) { + else if (memberName.kind === 139) { emitComputedPropertyName(memberName); } else { @@ -30225,7 +31191,7 @@ var ts; var properties = []; for (var _a = 0, _b = node.members; _a < _b.length; _a++) { var member = _b[_a]; - if (member.kind === 143 && isStatic === ((member.flags & 32) !== 0) && member.initializer) { + if (member.kind === 144 && isStatic === ((member.flags & 32) !== 0) && member.initializer) { properties.push(member); } } @@ -30265,11 +31231,11 @@ var ts; } function emitMemberFunctionsForES5AndLower(node) { ts.forEach(node.members, function (member) { - if (member.kind === 195) { + if (member.kind === 197) { writeLine(); write(";"); } - else if (member.kind === 145 || node.kind === 144) { + else if (member.kind === 146 || node.kind === 145) { if (!member.body) { return emitCommentsOnNotEmittedNode(member); } @@ -30286,7 +31252,7 @@ var ts; write(";"); emitTrailingComments(member); } - else if (member.kind === 147 || member.kind === 148) { + else if (member.kind === 148 || member.kind === 149) { var accessors = ts.getAllAccessorDeclarations(node.members, member); if (member === accessors.firstAccessor) { writeLine(); @@ -30336,22 +31302,22 @@ var ts; function emitMemberFunctionsForES6AndHigher(node) { for (var _a = 0, _b = node.members; _a < _b.length; _a++) { var member = _b[_a]; - if ((member.kind === 145 || node.kind === 144) && !member.body) { + if ((member.kind === 146 || node.kind === 145) && !member.body) { emitCommentsOnNotEmittedNode(member); } - else if (member.kind === 145 || - member.kind === 147 || - member.kind === 148) { + else if (member.kind === 146 || + member.kind === 148 || + member.kind === 149) { writeLine(); emitLeadingComments(member); emitStart(member); if (member.flags & 32) { write("static "); } - if (member.kind === 147) { + if (member.kind === 148) { write("get "); } - else if (member.kind === 148) { + else if (member.kind === 149) { write("set "); } if (member.asteriskToken) { @@ -30362,7 +31328,7 @@ var ts; emitEnd(member); emitTrailingComments(member); } - else if (member.kind === 195) { + else if (member.kind === 197) { writeLine(); write(";"); } @@ -30387,10 +31353,10 @@ var ts; function emitConstructorWorker(node, baseTypeElement) { var hasInstancePropertyWithInitializer = false; ts.forEach(node.members, function (member) { - if (member.kind === 146 && !member.body) { + if (member.kind === 147 && !member.body) { emitCommentsOnNotEmittedNode(member); } - if (member.kind === 143 && member.initializer && (member.flags & 32) === 0) { + if (member.kind === 144 && member.initializer && (member.flags & 32) === 0) { hasInstancePropertyWithInitializer = true; } }); @@ -30494,10 +31460,12 @@ var ts; } function emitClassLikeDeclarationForES6AndHigher(node) { var decoratedClassAlias; - var thisNodeIsDecorated = ts.nodeIsDecorated(node); - if (node.kind === 218) { - if (thisNodeIsDecorated) { - if (resolver.getNodeCheckFlags(node) & 524288) { + var isHoistedDeclarationInSystemModule = shouldHoistDeclarationInSystemJsModule(node); + var isDecorated = ts.nodeIsDecorated(node); + var rewriteAsClassExpression = isDecorated || isHoistedDeclarationInSystemModule; + if (node.kind === 220) { + if (rewriteAsClassExpression) { + if (isDecorated && resolver.getNodeCheckFlags(node) & 524288) { decoratedClassAlias = ts.unescapeIdentifier(makeUniqueName(node.name ? node.name.text : "default")); decoratedClassAliases[ts.getNodeId(node)] = decoratedClassAlias; write("let " + decoratedClassAlias + ";"); @@ -30506,7 +31474,9 @@ var ts; if (isES6ExportedDeclaration(node) && !(node.flags & 512)) { write("export "); } - write("let "); + if (!isHoistedDeclarationInSystemModule) { + write("let "); + } emitDeclarationName(node); if (decoratedClassAlias !== undefined) { write(" = " + decoratedClassAlias); @@ -30521,7 +31491,7 @@ var ts; } } var staticProperties = getInitializedProperties(node, true); - var isClassExpressionWithStaticProperties = staticProperties.length > 0 && node.kind === 190; + var isClassExpressionWithStaticProperties = staticProperties.length > 0 && node.kind === 191; var tempVariable; if (isClassExpressionWithStaticProperties) { tempVariable = createAndRecordTempVariable(0); @@ -30531,7 +31501,7 @@ var ts; write(" = "); } write("class"); - if (node.name || (node.flags & 512 && (staticProperties.length > 0 || modulekind !== ts.ModuleKind.ES6) && !thisNodeIsDecorated)) { + if (node.name || (node.flags & 512 && (staticProperties.length > 0 || modulekind !== ts.ModuleKind.ES6) && !rewriteAsClassExpression)) { write(" "); emitDeclarationName(node); } @@ -30548,7 +31518,7 @@ var ts; decreaseIndent(); writeLine(); emitToken(16, node.members.end); - if (thisNodeIsDecorated) { + if (rewriteAsClassExpression) { decoratedClassAliases[ts.getNodeId(node)] = undefined; write(";"); } @@ -30578,14 +31548,14 @@ var ts; } else { if (node.flags & 512) { - if (thisNodeIsDecorated) { + if (isDecorated) { writeLine(); write("export default "); emitDeclarationName(node); write(";"); } } - else if (node.parent.kind !== 252) { + else if (node.parent.kind !== 255) { writeLine(); emitStart(node); emitModuleMemberName(node); @@ -30597,7 +31567,7 @@ var ts; } } function emitClassLikeDeclarationBelowES6(node) { - if (node.kind === 218) { + if (node.kind === 220) { if (!shouldHoistDeclarationInSystemJsModule(node)) { write("var "); } @@ -30657,11 +31627,11 @@ var ts; emit(baseTypeNode.expression); } write("))"); - if (node.kind === 218) { + if (node.kind === 220) { write(";"); } emitEnd(node); - if (node.kind === 218) { + if (node.kind === 220) { emitExportMemberAssignment(node); } } @@ -30731,7 +31701,7 @@ var ts; } else { decorators = member.decorators; - if (member.kind === 145) { + if (member.kind === 146) { functionLikeMember = member; } } @@ -30757,7 +31727,7 @@ var ts; write(", "); emitExpressionForPropertyName(member.name); if (languageVersion > 0) { - if (member.kind !== 143) { + if (member.kind !== 144) { write(", null"); } else { @@ -30773,64 +31743,64 @@ var ts; function emitDecoratorsOfParameters(node, leadingComma) { var argumentsWritten = 0; if (node) { - var parameterIndex = 0; + 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, true, false, leadingComma, true, function (decorator) { - write("__param(" + parameterIndex + ", "); + write("__param(" + parameterIndex_1 + ", "); emit(decorator.expression); write(")"); }); leadingComma = true; } - parameterIndex++; + parameterIndex_1++; } } return argumentsWritten; } function shouldEmitTypeMetadata(node) { switch (node.kind) { - case 145: - case 147: + case 146: case 148: - case 143: + case 149: + case 144: return true; } return false; } function shouldEmitReturnTypeMetadata(node) { switch (node.kind) { - case 145: + case 146: return true; } return false; } function shouldEmitParamTypesMetadata(node) { switch (node.kind) { - case 218: - case 145: - case 148: + case 220: + case 146: + case 149: return true; } return false; } function emitSerializedTypeOfNode(node) { switch (node.kind) { - case 218: + case 220: write("Function"); return; - case 143: + case 144: emitSerializedTypeNode(node.type); return; - case 140: - emitSerializedTypeNode(node.type); - return; - case 147: + case 141: emitSerializedTypeNode(node.type); return; case 148: + emitSerializedTypeNode(node.type); + return; + case 149: emitSerializedTypeNode(ts.getSetAccessorTypeAnnotationNode(node)); return; } @@ -30846,23 +31816,23 @@ var ts; case 103: write("void 0"); return; - case 162: + case 163: emitSerializedTypeNode(node.type); return; - case 154: case 155: + case 156: write("Function"); return; - case 158: case 159: + case 160: write("Array"); return; - case 152: + case 153: case 120: write("Boolean"); return; case 131: - case 164: + case 165: write("String"); return; case 129: @@ -30871,15 +31841,15 @@ var ts; case 132: write("Symbol"); return; - case 153: + case 154: emitSerializedTypeReferenceNode(node); return; - case 156: case 157: - case 160: + case 158: case 161: + case 162: case 117: - case 163: + case 164: break; default: ts.Debug.fail("Cannot serialize unexpected type node."); @@ -30942,8 +31912,8 @@ var ts; } function emitSerializedParameterTypesOfNode(node) { if (node) { - var valueDeclaration; - if (node.kind === 218) { + var valueDeclaration = void 0; + if (node.kind === 220) { valueDeclaration = ts.getFirstConstructorWithBody(node); } else if (ts.isFunctionLike(node) && ts.nodeIsPresent(node.body)) { @@ -30959,10 +31929,10 @@ var ts; } if (parameters[i].dotDotDotToken) { var parameterType = parameters[i].type; - if (parameterType.kind === 158) { + if (parameterType.kind === 159) { parameterType = parameterType.elementType; } - else if (parameterType.kind === 153 && parameterType.typeArguments && parameterType.typeArguments.length === 1) { + else if (parameterType.kind === 154 && parameterType.typeArguments && parameterType.typeArguments.length === 1) { parameterType = parameterType.typeArguments[0]; } else { @@ -31034,7 +32004,7 @@ var ts; } if (!shouldHoistDeclarationInSystemJsModule(node)) { var isES6ExportedEnum = isES6ExportedDeclaration(node); - if (!(node.flags & 1) || (isES6ExportedEnum && isFirstDeclarationOfKind(node, node.symbol && node.symbol.declarations, 221))) { + if (!(node.flags & 1) || (isES6ExportedEnum && isFirstDeclarationOfKind(node, node.symbol && node.symbol.declarations, 223))) { emitStart(node); if (isES6ExportedEnum) { write("export "); @@ -31114,7 +32084,7 @@ var ts; } } function getInnerMostModuleDeclarationFromDottedModule(moduleDeclaration) { - if (moduleDeclaration.body.kind === 222) { + if (moduleDeclaration.body.kind === 224) { var recursiveInnerModule = getInnerMostModuleDeclarationFromDottedModule(moduleDeclaration.body); return recursiveInnerModule || moduleDeclaration.body; } @@ -31137,7 +32107,7 @@ var ts; var emitVarForModule = !hoistedInDeclarationScope && !isModuleMergedWithES6Class(node); if (emitVarForModule) { var isES6ExportedNamespace = isES6ExportedDeclaration(node); - if (!isES6ExportedNamespace || isFirstDeclarationOfKind(node, node.symbol && node.symbol.declarations, 222)) { + if (!isES6ExportedNamespace || isFirstDeclarationOfKind(node, node.symbol && node.symbol.declarations, 224)) { emitStart(node); if (isES6ExportedNamespace) { write("export "); @@ -31155,7 +32125,7 @@ var ts; write(getGeneratedNameForNode(node)); emitEnd(node.name); write(") "); - if (node.body.kind === 223) { + if (node.body.kind === 225) { var saveConvertedLoopState = convertedLoopState; var saveTempFlags = tempFlags; var saveTempVariables = tempVariables; @@ -31226,16 +32196,16 @@ var ts; } } function getNamespaceDeclarationNode(node) { - if (node.kind === 225) { + if (node.kind === 228) { return node; } var importClause = node.importClause; - if (importClause && importClause.namedBindings && importClause.namedBindings.kind === 228) { + if (importClause && importClause.namedBindings && importClause.namedBindings.kind === 231) { return importClause.namedBindings; } } function isDefaultImport(node) { - return node.kind === 226 && node.importClause && !!node.importClause.name; + return node.kind === 229 && node.importClause && !!node.importClause.name; } function emitExportImportAssignments(node) { if (ts.isAliasSymbolDeclaration(node) && resolver.isValueAliasDeclaration(node)) { @@ -31262,7 +32232,7 @@ var ts; if (shouldEmitNamedBindings) { emitLeadingComments(node.importClause.namedBindings); emitStart(node.importClause.namedBindings); - if (node.importClause.namedBindings.kind === 228) { + if (node.importClause.namedBindings.kind === 231) { write("* as "); emit(node.importClause.namedBindings.name); } @@ -31288,7 +32258,7 @@ var ts; } function emitExternalImportDeclaration(node) { if (ts.contains(externalImports, node)) { - var isExportedImport = node.kind === 225 && (node.flags & 1) !== 0; + var isExportedImport = node.kind === 228 && (node.flags & 1) !== 0; var namespaceDeclaration = getNamespaceDeclarationNode(node); var varOrConst = (languageVersion <= 1) ? "var " : "const "; if (modulekind !== ts.ModuleKind.AMD) { @@ -31303,7 +32273,7 @@ var ts; write(" = "); } else { - var isNakedImport = 226 && !node.importClause; + var isNakedImport = 229 && !node.importClause; if (!isNakedImport) { write(varOrConst); write(getGeneratedNameForNode(node)); @@ -31470,8 +32440,8 @@ var ts; write("export default "); var expression = node.expression; emit(expression); - if (expression.kind !== 217 && - expression.kind !== 218) { + if (expression.kind !== 219 && + expression.kind !== 220) { write(";"); } emitEnd(node); @@ -31488,7 +32458,7 @@ var ts; emitEs6ExportDefaultCompat(node); emitContainingModuleName(node); if (languageVersion === 0) { - write("[\"default\"] = "); + write('["default"] = '); } else { write(".default = "); @@ -31508,18 +32478,18 @@ var ts; for (var _a = 0, _b = sourceFile.statements; _a < _b.length; _a++) { var node = _b[_a]; switch (node.kind) { - case 226: + case 229: if (!node.importClause || resolver.isReferencedAliasDeclaration(node.importClause, true)) { externalImports.push(node); } break; - case 225: - if (node.moduleReference.kind === 236 && resolver.isReferencedAliasDeclaration(node)) { + case 228: + if (node.moduleReference.kind === 239 && resolver.isReferencedAliasDeclaration(node)) { externalImports.push(node); } break; - case 232: + case 235: if (node.moduleSpecifier) { if (!node.exportClause) { if (resolver.moduleExportsSomeValue(node.moduleSpecifier)) { @@ -31534,12 +32504,12 @@ var ts; else { for (var _c = 0, _d = node.exportClause.elements; _c < _d.length; _c++) { var specifier = _d[_c]; - var name_27 = (specifier.propertyName || specifier.name).text; - (exportSpecifiers[name_27] || (exportSpecifiers[name_27] = [])).push(specifier); + var name_29 = (specifier.propertyName || specifier.name).text; + (exportSpecifiers[name_29] || (exportSpecifiers[name_29] = [])).push(specifier); } } break; - case 231: + case 234: if (node.isExportEquals && !exportEquals) { exportEquals = node; } @@ -31564,18 +32534,18 @@ var ts; if (namespaceDeclaration && !isDefaultImport(node)) { return ts.getTextOfNodeFromSourceText(currentText, namespaceDeclaration.name); } - if (node.kind === 226 && node.importClause) { + if (node.kind === 229 && node.importClause) { return getGeneratedNameForNode(node); } - if (node.kind === 232 && node.moduleSpecifier) { + if (node.kind === 235 && node.moduleSpecifier) { return getGeneratedNameForNode(node); } } function getExternalModuleNameText(importNode, emitRelativePathAsModuleName) { if (emitRelativePathAsModuleName) { - var name_28 = getExternalModuleNameFromDeclaration(host, resolver, importNode); - if (name_28) { - return "\"" + name_28 + "\""; + var name_30 = getExternalModuleNameFromDeclaration(host, resolver, importNode); + if (name_30) { + return "\"" + name_30 + "\""; } } var moduleName = ts.getExternalModuleName(importNode); @@ -31592,8 +32562,8 @@ var ts; var started = false; for (var _a = 0, externalImports_1 = externalImports; _a < externalImports_1.length; _a++) { var importNode = externalImports_1[_a]; - var skipNode = importNode.kind === 232 || - (importNode.kind === 226 && !importNode.importClause); + var skipNode = importNode.kind === 235 || + (importNode.kind === 229 && !importNode.importClause); if (skipNode) { continue; } @@ -31618,7 +32588,7 @@ var ts; var hasExportDeclarationWithExportClause = false; for (var _a = 0, externalImports_2 = externalImports; _a < externalImports_2.length; _a++) { var externalImport = externalImports_2[_a]; - if (externalImport.kind === 232 && externalImport.exportClause) { + if (externalImport.kind === 235 && externalImport.exportClause) { hasExportDeclarationWithExportClause = true; break; } @@ -31647,7 +32617,7 @@ var ts; } for (var _d = 0, externalImports_3 = externalImports; _d < externalImports_3.length; _d++) { var externalImport = externalImports_3[_d]; - if (externalImport.kind !== 232) { + if (externalImport.kind !== 235) { continue; } var exportDecl = externalImport; @@ -31721,11 +32691,11 @@ var ts; var seen = {}; for (var i = 0; i < hoistedVars.length; i++) { var local = hoistedVars[i]; - var name_29 = local.kind === 69 + var name_31 = local.kind === 69 ? local : local.name; - if (name_29) { - var text = ts.unescapeIdentifier(name_29.text); + if (name_31) { + var text = ts.unescapeIdentifier(name_31.text); if (ts.hasProperty(seen, text)) { continue; } @@ -31736,7 +32706,7 @@ var ts; if (i !== 0) { write(", "); } - if (local.kind === 218 || local.kind === 222 || local.kind === 221) { + if (local.kind === 220 || local.kind === 224 || local.kind === 223) { emitDeclarationName(local); } else { @@ -31770,21 +32740,21 @@ var ts; if (node.flags & 2) { return; } - if (node.kind === 217) { + if (node.kind === 219) { if (!hoistedFunctionDeclarations) { hoistedFunctionDeclarations = []; } hoistedFunctionDeclarations.push(node); return; } - if (node.kind === 218) { + if (node.kind === 220) { if (!hoistedVars) { hoistedVars = []; } hoistedVars.push(node); return; } - if (node.kind === 221) { + if (node.kind === 223) { if (shouldEmitEnumDeclaration(node)) { if (!hoistedVars) { hoistedVars = []; @@ -31793,7 +32763,7 @@ var ts; } return; } - if (node.kind === 222) { + if (node.kind === 224) { if (shouldEmitModuleDeclaration(node)) { if (!hoistedVars) { hoistedVars = []; @@ -31802,17 +32772,17 @@ var ts; } return; } - if (node.kind === 215 || node.kind === 167) { + if (node.kind === 217 || node.kind === 168) { if (shouldHoistVariable(node, false)) { - var name_30 = node.name; - if (name_30.kind === 69) { + var name_32 = node.name; + if (name_32.kind === 69) { if (!hoistedVars) { hoistedVars = []; } - hoistedVars.push(name_30); + hoistedVars.push(name_32); } else { - ts.forEachChild(name_30, visit); + ts.forEachChild(name_32, visit); } } return; @@ -31838,7 +32808,7 @@ var ts; return false; } return (ts.getCombinedNodeFlags(node) & 3072) === 0 || - ts.getEnclosingBlockScopeContainer(node).kind === 252; + ts.getEnclosingBlockScopeContainer(node).kind === 255; } function isCurrentFileSystemExternalModule() { return modulekind === ts.ModuleKind.System && isCurrentFileExternalModule; @@ -31876,17 +32846,17 @@ var ts; var entry = group_1[_a]; var importVariableName = getLocalNameForExternalImport(entry) || ""; switch (entry.kind) { - case 226: + case 229: if (!entry.importClause) { break; } - case 225: + case 228: ts.Debug.assert(importVariableName !== ""); writeLine(); write(importVariableName + " = " + parameterName + ";"); writeLine(); break; - case 232: + case 235: ts.Debug.assert(importVariableName !== ""); if (entry.exportClause) { writeLine(); @@ -31930,10 +32900,10 @@ var ts; for (var i = startIndex; i < node.statements.length; i++) { var statement = node.statements[i]; switch (statement.kind) { - case 217: - case 226: + case 219: + case 229: continue; - case 232: + case 235: if (!statement.moduleSpecifier) { for (var _a = 0, _b = statement.exportClause.elements; _a < _b.length; _a++) { var element = _b[_a]; @@ -31941,7 +32911,7 @@ var ts; } } continue; - case 225: + case 228: if (!ts.isInternalModuleImportEqualsDeclaration(statement)) { continue; } @@ -32012,11 +32982,11 @@ var ts; for (var _a = 0, _b = node.amdDependencies; _a < _b.length; _a++) { var amdDependency = _b[_a]; if (amdDependency.name) { - aliasedModuleNames.push("\"" + amdDependency.path + "\""); + aliasedModuleNames.push('"' + amdDependency.path + '"'); importAliasNames.push(amdDependency.name); } else { - unaliasedModuleNames.push("\"" + amdDependency.path + "\""); + unaliasedModuleNames.push('"' + amdDependency.path + '"'); } } for (var _c = 0, externalImports_4 = externalImports; _c < externalImports_4.length; _c++) { @@ -32041,7 +33011,7 @@ var ts; } function emitAMDDependencyList(_a) { var aliasedModuleNames = _a.aliasedModuleNames, unaliasedModuleNames = _a.unaliasedModuleNames; - write("[\"require\", \"exports\""); + write('["require", "exports"'); if (aliasedModuleNames.length) { write(", "); write(aliasedModuleNames.join(", ")); @@ -32073,8 +33043,8 @@ var ts; emitExportStarHelper(); emitCaptureThisForNodeIfNecessary(node); emitLinesStartingAt(node.statements, startIndex); - emitTempDeclarations(true); emitExportEquals(true); + emitTempDeclarations(true); decreaseIndent(); writeLine(); write("});"); @@ -32086,8 +33056,8 @@ var ts; emitExportStarHelper(); emitCaptureThisForNodeIfNecessary(node); emitLinesStartingAt(node.statements, startIndex); - emitTempDeclarations(true); emitExportEquals(false); + emitTempDeclarations(true); } function emitUMDModule(node) { emitEmitHelpers(node); @@ -32103,8 +33073,8 @@ var ts; emitExportStarHelper(); emitCaptureThisForNodeIfNecessary(node); emitLinesStartingAt(node.statements, startIndex); - emitTempDeclarations(true); emitExportEquals(true); + emitTempDeclarations(true); decreaseIndent(); writeLine(); write("});"); @@ -32170,7 +33140,7 @@ var ts; result = result.replace(/&(\w+);/g, function (s, m) { if (entities[m] !== undefined) { var ch = String.fromCharCode(entities[m]); - return ch === "\"" ? "\\\"" : ch; + return ch === '"' ? "\\\"" : ch; } else { return s; @@ -32180,10 +33150,10 @@ var ts; return result; } function isJsxChildEmittable(child) { - if (child.kind === 244) { + if (child.kind === 247) { return !!child.expression; } - else if (child.kind === 240) { + else if (child.kind === 243) { return !!getTextToEmit(child); } return true; @@ -32207,9 +33177,9 @@ var ts; function emitJsxText(node) { switch (compilerOptions.jsx) { case 2: - write("\""); + write('"'); write(trimReactWhitespaceAndApplyEntities(node)); - write("\""); + write('"'); break; case 1: default: @@ -32233,7 +33203,7 @@ var ts; } } function isUseStrictPrologue(node) { - return !!node.expression.text.match(/use strict/); + return node.expression.text === "use strict"; } function ensureUseStrictPrologue(startWithNewLine, writeUseStrict) { if (writeUseStrict) { @@ -32275,10 +33245,14 @@ var ts; } function emitEmitHelpers(node) { if (!compilerOptions.noEmitHelpers) { - if ((languageVersion < 2) && (!extendsEmitted && node.flags & 262144)) { + if (languageVersion < 2 && !extendsEmitted && node.flags & 262144) { writeLines(extendsHelper); extendsEmitted = true; } + if (compilerOptions.jsx !== 1 && !assignEmitted && (node.flags & 1073741824)) { + writeLines(assignHelper); + assignEmitted = true; + } if (!decorateEmitted && node.flags & 524288) { writeLines(decorateHelper); if (compilerOptions.emitDecoratorMetadata) { @@ -32373,28 +33347,28 @@ var ts; } function isSpecializedCommentHandling(node) { switch (node.kind) { + case 221: case 219: - case 217: - case 226: - case 225: - case 220: - case 231: + case 229: + case 228: + case 222: + case 234: return true; } } function shouldEmitLeadingAndTrailingComments(node) { switch (node.kind) { - case 197: + case 199: return shouldEmitLeadingAndTrailingCommentsForVariableStatement(node); - case 222: + case 224: return shouldEmitModuleDeclaration(node); - case 221: + case 223: return shouldEmitEnumDeclaration(node); } ts.Debug.assert(!isSpecializedCommentHandling(node)); - if (node.kind !== 196 && + if (node.kind !== 198 && node.parent && - node.parent.kind === 178 && + node.parent.kind === 179 && node.parent.body === node && compilerOptions.target <= 1) { return false; @@ -32405,13 +33379,13 @@ var ts; switch (node.kind) { case 69: return emitIdentifier(node); - case 140: + case 141: return emitParameter(node); + case 146: case 145: - case 144: return emitMethod(node); - case 147: case 148: + case 149: return emitAccessor(node); case 97: return emitThis(node); @@ -32431,142 +33405,142 @@ var ts; case 13: case 14: return emitLiteral(node); - case 187: - return emitTemplateExpression(node); - case 194: - return emitTemplateSpan(node); - case 237: - case 238: - return emitJsxElement(node); - case 240: - return emitJsxText(node); - case 244: - return emitJsxExpression(node); - case 137: - return emitQualifiedName(node); - case 165: - return emitObjectBindingPattern(node); - case 166: - return emitArrayBindingPattern(node); - case 167: - return emitBindingElement(node); - case 168: - return emitArrayLiteral(node); - case 169: - return emitObjectLiteral(node); - case 249: - return emitPropertyAssignment(node); - case 250: - return emitShorthandPropertyAssignment(node); - case 138: - return emitComputedPropertyName(node); - case 170: - return emitPropertyAccess(node); - case 171: - return emitIndexedAccess(node); - case 172: - return emitCallExpression(node); - case 173: - return emitNewExpression(node); - case 174: - return emitTaggedTemplateExpression(node); - case 175: - return emit(node.expression); - case 193: - return emit(node.expression); - case 176: - return emitParenExpression(node); - case 217: - case 177: - case 178: - return emitFunctionDeclaration(node); - case 179: - return emitDeleteExpression(node); - case 180: - return emitTypeOfExpression(node); - case 181: - return emitVoidExpression(node); - case 182: - return emitAwaitExpression(node); - case 183: - return emitPrefixUnaryExpression(node); - case 184: - return emitPostfixUnaryExpression(node); - case 185: - return emitBinaryExpression(node); - case 186: - return emitConditionalExpression(node); - case 189: - return emitSpreadElementExpression(node); case 188: - return emitYieldExpression(node); - case 191: - return; + return emitTemplateExpression(node); case 196: - case 223: - return emitBlock(node); - case 197: - return emitVariableStatement(node); - case 198: - return write(";"); - case 199: - return emitExpressionStatement(node); - case 200: - return emitIfStatement(node); - case 201: - return emitDoStatement(node); - case 202: - return emitWhileStatement(node); - case 203: - return emitForStatement(node); - case 205: - case 204: - return emitForInOrForOfStatement(node); - case 206: - case 207: - return emitBreakOrContinueStatement(node); - case 208: - return emitReturnStatement(node); - case 209: - return emitWithStatement(node); - case 210: - return emitSwitchStatement(node); - case 245: - case 246: - return emitCaseOrDefaultClause(node); - case 211: - return emitLabeledStatement(node); - case 212: - return emitThrowStatement(node); - case 213: - return emitTryStatement(node); - case 248: - return emitCatchClause(node); - case 214: - return emitDebuggerStatement(node); - case 215: - return emitVariableDeclaration(node); - case 190: - return emitClassExpression(node); - case 218: - return emitClassDeclaration(node); - case 219: - return emitInterfaceDeclaration(node); - case 221: - return emitEnumDeclaration(node); - case 251: - return emitEnumMember(node); - case 222: - return emitModuleDeclaration(node); - case 226: - return emitImportDeclaration(node); - case 225: - return emitImportEqualsDeclaration(node); - case 232: - return emitExportDeclaration(node); - case 231: - return emitExportAssignment(node); + return emitTemplateSpan(node); + case 240: + case 241: + return emitJsxElement(node); + case 243: + return emitJsxText(node); + case 247: + return emitJsxExpression(node); + case 138: + return emitQualifiedName(node); + case 166: + return emitObjectBindingPattern(node); + case 167: + return emitArrayBindingPattern(node); + case 168: + return emitBindingElement(node); + case 169: + return emitArrayLiteral(node); + case 170: + return emitObjectLiteral(node); case 252: + return emitPropertyAssignment(node); + case 253: + return emitShorthandPropertyAssignment(node); + case 139: + return emitComputedPropertyName(node); + case 171: + return emitPropertyAccess(node); + case 172: + return emitIndexedAccess(node); + case 173: + return emitCallExpression(node); + case 174: + return emitNewExpression(node); + case 175: + return emitTaggedTemplateExpression(node); + case 176: + case 194: + case 195: + return emit(node.expression); + case 177: + return emitParenExpression(node); + case 219: + case 178: + case 179: + return emitFunctionDeclaration(node); + case 180: + return emitDeleteExpression(node); + case 181: + return emitTypeOfExpression(node); + case 182: + return emitVoidExpression(node); + case 183: + return emitAwaitExpression(node); + case 184: + return emitPrefixUnaryExpression(node); + case 185: + return emitPostfixUnaryExpression(node); + case 186: + return emitBinaryExpression(node); + case 187: + return emitConditionalExpression(node); + case 190: + return emitSpreadElementExpression(node); + case 189: + return emitYieldExpression(node); + case 192: + return; + case 198: + case 225: + return emitBlock(node); + case 199: + return emitVariableStatement(node); + case 200: + return write(";"); + case 201: + return emitExpressionStatement(node); + case 202: + return emitIfStatement(node); + case 203: + return emitDoStatement(node); + case 204: + return emitWhileStatement(node); + case 205: + return emitForStatement(node); + case 207: + case 206: + return emitForInOrForOfStatement(node); + case 208: + case 209: + return emitBreakOrContinueStatement(node); + case 210: + return emitReturnStatement(node); + case 211: + return emitWithStatement(node); + case 212: + return emitSwitchStatement(node); + case 248: + case 249: + return emitCaseOrDefaultClause(node); + case 213: + return emitLabeledStatement(node); + case 214: + return emitThrowStatement(node); + case 215: + return emitTryStatement(node); + case 251: + return emitCatchClause(node); + case 216: + return emitDebuggerStatement(node); + case 217: + return emitVariableDeclaration(node); + case 191: + return emitClassExpression(node); + case 220: + return emitClassDeclaration(node); + case 221: + return emitInterfaceDeclaration(node); + case 223: + return emitEnumDeclaration(node); + case 254: + return emitEnumMember(node); + case 224: + return emitModuleDeclaration(node); + case 229: + return emitImportDeclaration(node); + case 228: + return emitImportEqualsDeclaration(node); + case 235: + return emitExportDeclaration(node); + case 234: + return emitExportAssignment(node); + case 255: return emitSourceFileNode(node); } } @@ -32596,7 +33570,7 @@ var ts; } function getLeadingCommentsToEmit(node) { if (node.parent) { - if (node.parent.kind === 252 || node.pos !== node.parent.pos) { + if (node.parent.kind === 255 || node.pos !== node.parent.pos) { if (hasDetachedComments(node.pos)) { return getLeadingCommentsWithoutDetachedComments(); } @@ -32608,7 +33582,7 @@ var ts; } function getTrailingCommentsToEmit(node) { if (node.parent) { - if (node.parent.kind === 252 || node.end !== node.parent.end) { + if (node.parent.kind === 255 || node.end !== node.parent.end) { return ts.getTrailingCommentRanges(currentText, node.end); } } @@ -32699,6 +33673,15 @@ var ts; if (declarationFilePath) { emitSkipped = ts.writeDeclarationFile(declarationFilePath, sourceFiles, isBundledEmit, host, resolver, emitterDiagnostics) || emitSkipped; } + if (!emitSkipped && emittedFilesList) { + emittedFilesList.push(jsFilePath); + if (sourceMapFilePath) { + emittedFilesList.push(sourceMapFilePath); + } + if (declarationFilePath) { + emittedFilesList.push(declarationFilePath); + } + } } } ts.emitFiles = emitFiles; @@ -32710,10 +33693,15 @@ var ts; ts.ioReadTime = 0; ts.ioWriteTime = 0; var emptyArray = []; + var defaultLibrarySearchPaths = [ + "types/", + "node_modules/", + "node_modules/@types/", + ]; ts.version = "1.9.0"; function findConfigFile(searchPath, fileExists) { - var fileName = "tsconfig.json"; while (true) { + var fileName = ts.combinePaths(searchPath, "tsconfig.json"); if (fileExists(fileName)) { return fileName; } @@ -32722,7 +33710,6 @@ var ts; break; } searchPath = parentPath; - fileName = "../" + fileName; } return undefined; } @@ -32733,18 +33720,42 @@ var ts; return ts.normalizePath(referencedFileName); } ts.resolveTripleslashReference = resolveTripleslashReference; + function computeCommonSourceDirectoryOfFilenames(fileNames, currentDirectory, getCanonicalFileName) { + var commonPathComponents; + var failed = ts.forEach(fileNames, function (sourceFile) { + var sourcePathComponents = ts.getNormalizedPathComponents(sourceFile, currentDirectory); + sourcePathComponents.pop(); + if (!commonPathComponents) { + commonPathComponents = sourcePathComponents; + return; + } + for (var i = 0, n = Math.min(commonPathComponents.length, sourcePathComponents.length); i < n; i++) { + if (getCanonicalFileName(commonPathComponents[i]) !== getCanonicalFileName(sourcePathComponents[i])) { + if (i === 0) { + return true; + } + commonPathComponents.length = i; + break; + } + } + if (sourcePathComponents.length < commonPathComponents.length) { + commonPathComponents.length = sourcePathComponents.length; + } + }); + if (failed) { + return ""; + } + if (!commonPathComponents) { + return currentDirectory; + } + return ts.getNormalizedPathFromPathComponents(commonPathComponents); + } + ts.computeCommonSourceDirectoryOfFilenames = computeCommonSourceDirectoryOfFilenames; function trace(host, message) { host.trace(ts.formatMessage.apply(undefined, arguments)); } function isTraceEnabled(compilerOptions, host) { - return compilerOptions.traceModuleResolution && host.trace !== undefined; - } - function startsWith(str, prefix) { - return str.lastIndexOf(prefix, 0) === 0; - } - function endsWith(str, suffix) { - var expectedPos = str.length - suffix.length; - return str.indexOf(suffix, expectedPos) === expectedPos; + return compilerOptions.traceResolution && host.trace !== undefined; } function hasZeroOrOneAsteriskCharacter(str) { var seenAsterisk = false; @@ -32771,6 +33782,139 @@ var ts; var startsWithDotSlashOrDotDotSlash = i === 0 || (i === 1 && moduleName.charCodeAt(0) === 46); return !startsWithDotSlashOrDotDotSlash; } + function tryReadTypesSection(packageJsonPath, baseDirectory, state) { + var jsonContent; + try { + var jsonText = state.host.readFile(packageJsonPath); + jsonContent = jsonText ? JSON.parse(jsonText) : {}; + } + catch (e) { + jsonContent = {}; + } + var typesFile; + var fieldName; + if (jsonContent.typings) { + if (typeof jsonContent.typings === "string") { + fieldName = "typings"; + typesFile = jsonContent.typings; + } + else { + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.Expected_type_of_0_field_in_package_json_to_be_string_got_1, "typings", typeof jsonContent.typings); + } + } + } + if (!typesFile && jsonContent.types) { + if (typeof jsonContent.types === "string") { + fieldName = "types"; + typesFile = jsonContent.types; + } + else { + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.Expected_type_of_0_field_in_package_json_to_be_string_got_1, "types", typeof jsonContent.types); + } + } + } + if (typesFile) { + 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; + } + return undefined; + } + var typeReferenceExtensions = [".d.ts"]; + function resolveTypeReferenceDirective(typeReferenceDirectiveName, containingFile, options, host) { + var traceEnabled = isTraceEnabled(options, host); + var moduleResolutionState = { + compilerOptions: options, + host: host, + skipTsx: true, + traceEnabled: traceEnabled + }; + var rootDir = options.typesRoot || (options.configFilePath ? ts.getDirectoryPath(options.configFilePath) : undefined); + if (traceEnabled) { + if (containingFile === undefined) { + if (rootDir === 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, rootDir); + } + } + else { + if (rootDir === 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, rootDir); + } + } + } + var failedLookupLocations = []; + if (rootDir !== undefined) { + var effectivePrimarySearchPaths = options.typesSearchPaths || defaultLibrarySearchPaths; + for (var _i = 0, effectivePrimarySearchPaths_1 = effectivePrimarySearchPaths; _i < effectivePrimarySearchPaths_1.length; _i++) { + var searchPath = effectivePrimarySearchPaths_1[_i]; + var primaryPath = ts.combinePaths(rootDir, searchPath); + if (traceEnabled) { + trace(host, ts.Diagnostics.Resolving_with_primary_search_path_0, primaryPath); + } + var candidate = ts.combinePaths(primaryPath, 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); + } + else { + initialLocationForSecondaryLookup = rootDir; + } + if (initialLocationForSecondaryLookup !== undefined) { + 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) { @@ -32829,10 +33973,10 @@ var ts; for (var _i = 0, _a = state.compilerOptions.rootDirs; _i < _a.length; _i++) { var rootDir = _a[_i]; var normalizedRoot = ts.normalizePath(rootDir); - if (!endsWith(normalizedRoot, ts.directorySeparator)) { + if (!ts.endsWith(normalizedRoot, ts.directorySeparator)) { normalizedRoot += ts.directorySeparator; } - var isLongestMatchingPrefix = startsWith(candidate, normalizedRoot) && + 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); @@ -32899,8 +34043,8 @@ var ts; var prefix = pattern.substr(0, indexOfStar); var suffix = pattern.substr(indexOfStar + 1); if (moduleName.length >= prefix.length + suffix.length && - startsWith(moduleName, prefix) && - endsWith(moduleName, suffix)) { + ts.startsWith(moduleName, prefix) && + ts.endsWith(moduleName, suffix)) { if (prefix.length > longestMatchPrefixLength) { longestMatchPrefixLength = prefix.length; matchedPattern = pattern; @@ -32978,6 +34122,12 @@ var ts; } ts.directoryProbablyExists = directoryProbablyExists; function loadModuleFromFile(candidate, extensions, failedLookupLocation, onlyRecordFailures, state) { + if (!onlyRecordFailures) { + var directory = ts.getDirectoryPath(candidate); + if (directory) { + onlyRecordFailures = !directoryProbablyExists(directory, state.host); + } + } return ts.forEach(extensions, tryLoad); function tryLoad(ext) { if (ext === ".tsx" && state.skipTsx) { @@ -32986,7 +34136,7 @@ var ts; var fileName = ts.fileExtensionIs(candidate, ext) ? candidate : candidate + ext; if (!onlyRecordFailures && state.host.fileExists(fileName)) { if (state.traceEnabled) { - trace(state.host, ts.Diagnostics.File_0_exist_use_it_as_a_module_resolution_result, fileName); + trace(state.host, ts.Diagnostics.File_0_exist_use_it_as_a_name_resolution_result, fileName); } return fileName; } @@ -33006,32 +34156,16 @@ var ts; if (state.traceEnabled) { trace(state.host, ts.Diagnostics.Found_package_json_at_0, packageJsonPath); } - var jsonContent; - try { - var jsonText = state.host.readFile(packageJsonPath); - jsonContent = jsonText ? JSON.parse(jsonText) : { typings: undefined }; - } - catch (e) { - jsonContent = { typings: undefined }; - } - if (jsonContent.typings) { - if (typeof jsonContent.typings === "string") { - var typingsFile = ts.normalizePath(ts.combinePaths(candidate, jsonContent.typings)); - if (state.traceEnabled) { - trace(state.host, ts.Diagnostics.package_json_has_typings_field_0_that_references_1, jsonContent.typings, typingsFile); - } - var result = loadModuleFromFile(typingsFile, extensions, failedLookupLocation, !directoryProbablyExists(ts.getDirectoryPath(typingsFile), state.host), state); - if (result) { - return result; - } - } - else if (state.traceEnabled) { - trace(state.host, ts.Diagnostics.Expected_type_of_typings_field_in_package_json_to_be_string_got_0, typeof jsonContent.typings); + var typesFile = tryReadTypesSection(packageJsonPath, candidate, state); + if (typesFile) { + var result = loadModuleFromFile(typesFile, extensions, failedLookupLocation, !directoryProbablyExists(ts.getDirectoryPath(typesFile), state.host), state); + if (result) { + return result; } } else { if (state.traceEnabled) { - trace(state.host, ts.Diagnostics.package_json_does_not_have_typings_field); + trace(state.host, ts.Diagnostics.package_json_does_not_have_types_field); } } } @@ -33043,19 +34177,26 @@ var ts; } return loadModuleFromFile(ts.combinePaths(candidate, "index"), extensions, failedLookupLocation, !directoryExists, state); } + 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 result = loadModuleFromFile(candidate, ts.supportedTypeScriptExtensions, failedLookupLocations, !nodeModulesFolderExists, state); + if (result) { + return result; + } + result = loadNodeModuleFromDirectory(ts.supportedTypeScriptExtensions, 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") { - var nodeModulesFolder = ts.combinePaths(directory, "node_modules"); - var nodeModulesFolderExists = directoryProbablyExists(nodeModulesFolder, state.host); - var candidate = ts.normalizePath(ts.combinePaths(nodeModulesFolder, moduleName)); - var result = loadModuleFromFile(candidate, ts.supportedTypeScriptExtensions, failedLookupLocations, !nodeModulesFolderExists, state); - if (result) { - return result; - } - result = loadNodeModuleFromDirectory(ts.supportedTypeScriptExtensions, candidate, failedLookupLocations, !nodeModulesFolderExists, state); + var result = loadModuleFromNodeModulesFolder(moduleName, directory, failedLookupLocations, state) || + loadModuleFromNodeModulesFolder(ts.combinePaths("@types", moduleName), directory, failedLookupLocations, state); if (result) { return result; } @@ -33148,11 +34289,39 @@ var ts; ts.sys.createDirectory(directoryPath); } } + var outputFingerprints; + function writeFileIfUpdated(fileName, data, writeByteOrderMark) { + if (!outputFingerprints) { + outputFingerprints = {}; + } + var hash = ts.sys.createHash(data); + var mtimeBefore = ts.sys.getModifiedTime(fileName); + if (mtimeBefore && ts.hasProperty(outputFingerprints, fileName)) { + var fingerprint = outputFingerprints[fileName]; + if (fingerprint.byteOrderMark === writeByteOrderMark && + fingerprint.hash === hash && + fingerprint.mtime.getTime() === mtimeBefore.getTime()) { + return; + } + } + ts.sys.writeFile(fileName, data, writeByteOrderMark); + var mtimeAfter = ts.sys.getModifiedTime(fileName); + outputFingerprints[fileName] = { + hash: hash, + byteOrderMark: writeByteOrderMark, + mtime: mtimeAfter + }; + } function writeFile(fileName, data, writeByteOrderMark, onError) { try { var start = new Date().getTime(); ensureDirectoriesExist(ts.getDirectoryPath(ts.normalizePath(fileName))); - ts.sys.writeFile(fileName, data, writeByteOrderMark); + if (ts.isWatchSet(options) && ts.sys.createHash && ts.sys.getModifiedTime) { + writeFileIfUpdated(fileName, data, writeByteOrderMark); + } + else { + ts.sys.writeFile(fileName, data, writeByteOrderMark); + } ts.ioWriteTime += new Date().getTime() - start; } catch (e) { @@ -33161,10 +34330,14 @@ var ts; } } } + function getDefaultLibLocation() { + return ts.getDirectoryPath(ts.normalizePath(ts.sys.getExecutingFilePath())); + } var newLine = ts.getNewLineCharacter(options); return { getSourceFile: getSourceFile, - getDefaultLibFileName: function (options) { return ts.combinePaths(ts.getDirectoryPath(ts.normalizePath(ts.sys.getExecutingFilePath())), ts.getDefaultLibFileName(options)); }, + getDefaultLibLocation: getDefaultLibLocation, + getDefaultLibFileName: function (options) { return ts.combinePaths(getDefaultLibLocation(), ts.getDefaultLibFileName(options)); }, writeFile: writeFile, getCurrentDirectory: ts.memoize(function () { return ts.sys.getCurrentDirectory(); }), useCaseSensitiveFileNames: function () { return ts.sys.useCaseSensitiveFileNames; }, @@ -33208,57 +34381,78 @@ var ts; } } ts.flattenDiagnosticMessageText = flattenDiagnosticMessageText; + function loadWithLocalCache(names, containingFile, loader) { + if (names.length === 0) { + return []; + } + var resolutions = []; + var cache = {}; + for (var _i = 0, names_1 = names; _i < names_1.length; _i++) { + var name_33 = names_1[_i]; + var result = void 0; + if (ts.hasProperty(cache, name_33)) { + result = cache[name_33]; + } + else { + result = loader(name_33, containingFile); + cache[name_33] = result; + } + resolutions.push(result); + } + return resolutions; + } function createProgram(rootNames, options, host, oldProgram) { var program; var files = []; - var fileProcessingDiagnostics = ts.createDiagnosticCollection(); - var programDiagnostics = ts.createDiagnosticCollection(); var commonSourceDirectory; var diagnosticsProducingTypeChecker; var noDiagnosticsTypeChecker; var classifiableNames; - var skipDefaultLib = options.noLib; - var supportedExtensions = ts.getSupportedExtensions(options); + var resolvedTypeReferenceDirectives = {}; + var fileProcessingDiagnostics = ts.createDiagnosticCollection(); var start = new Date().getTime(); host = host || createCompilerHost(options); - var hasEmitBlockingDiagnostics = ts.createFileMap(getCanonicalFileName); + var skipDefaultLib = options.noLib; + var programDiagnostics = ts.createDiagnosticCollection(); var currentDirectory = host.getCurrentDirectory(); - var resolveModuleNamesWorker = host.resolveModuleNames - ? (function (moduleNames, containingFile) { return host.resolveModuleNames(moduleNames, containingFile); }) - : (function (moduleNames, containingFile) { - var resolvedModuleNames = []; - var lookup = {}; - for (var _i = 0, moduleNames_1 = moduleNames; _i < moduleNames_1.length; _i++) { - var moduleName = moduleNames_1[_i]; - var resolvedName = void 0; - if (ts.hasProperty(lookup, moduleName)) { - resolvedName = lookup[moduleName]; - } - else { - resolvedName = resolveModuleName(moduleName, containingFile, options, host).resolvedModule; - lookup[moduleName] = resolvedName; - } - resolvedModuleNames.push(resolvedName); - } - return resolvedModuleNames; - }); + var supportedExtensions = ts.getSupportedExtensions(options); + var hasEmitBlockingDiagnostics = ts.createFileMap(getCanonicalFileName); + var resolveModuleNamesWorker; + if (host.resolveModuleNames) { + resolveModuleNamesWorker = function (moduleNames, containingFile) { return host.resolveModuleNames(moduleNames, containingFile); }; + } + else { + var loader_1 = function (moduleName, containingFile) { return resolveModuleName(moduleName, containingFile, options, host).resolvedModule; }; + resolveModuleNamesWorker = function (moduleNames, containingFile) { return loadWithLocalCache(moduleNames, containingFile, loader_1); }; + } + var resolveTypeReferenceDirectiveNamesWorker; + if (host.resolveTypeReferenceDirectives) { + resolveTypeReferenceDirectiveNamesWorker = function (typeDirectiveNames, containingFile) { return host.resolveTypeReferenceDirectives(typeDirectiveNames, containingFile); }; + } + else { + var loader_2 = function (typesRef, containingFile) { return resolveTypeReferenceDirective(typesRef, containingFile, options, host).resolvedTypeReferenceDirective; }; + resolveTypeReferenceDirectiveNamesWorker = function (typeReferenceDirectiveNames, containingFile) { return loadWithLocalCache(typeReferenceDirectiveNames, containingFile, loader_2); }; + } var filesByName = ts.createFileMap(); var filesByNameIgnoreCase = host.useCaseSensitiveFileNames() ? ts.createFileMap(function (fileName) { return fileName.toLowerCase(); }) : undefined; - if (oldProgram) { - var oldOptions = oldProgram.getCompilerOptions(); - if ((oldOptions.module !== options.module) || - (oldOptions.noResolve !== options.noResolve) || - (oldOptions.target !== options.target) || - (oldOptions.noLib !== options.noLib) || - (oldOptions.jsx !== options.jsx) || - (oldOptions.allowJs !== options.allowJs)) { - oldProgram = undefined; - } - } if (!tryReuseStructureFromOldProgram()) { + if (options.types && options.types.length) { + var resolutions = resolveTypeReferenceDirectiveNamesWorker(options.types, undefined); + for (var i = 0; i < options.types.length; i++) { + processTypeReferenceDirective(options.types[i], resolutions[i]); + } + } ts.forEach(rootNames, function (name) { return processRootFile(name, false); }); if (!skipDefaultLib) { - processRootFile(host.getDefaultLibFileName(options), true); + if (!options.lib) { + processRootFile(host.getDefaultLibFileName(options), true); + } + else { + var libDirectory_1 = host.getDefaultLibLocation ? host.getDefaultLibLocation() : ts.getDirectoryPath(host.getDefaultLibFileName(options)); + ts.forEach(options.lib, function (libFileName) { + processRootFile(ts.combinePaths(libDirectory_1, libFileName), true); + }); + } } } oldProgram = undefined; @@ -33282,7 +34476,8 @@ var ts; getIdentifierCount: function () { return getDiagnosticsProducingTypeChecker().getIdentifierCount(); }, getSymbolCount: function () { return getDiagnosticsProducingTypeChecker().getSymbolCount(); }, getTypeCount: function () { return getDiagnosticsProducingTypeChecker().getTypeCount(); }, - getFileProcessingDiagnostics: function () { return fileProcessingDiagnostics; } + getFileProcessingDiagnostics: function () { return fileProcessingDiagnostics; }, + resolvedTypeReferenceDirectives: resolvedTypeReferenceDirectives }; verifyCompilerOptions(); ts.programTime += new Date().getTime() - start; @@ -33316,11 +34511,26 @@ var ts; if (!oldProgram) { return false; } + var oldOptions = oldProgram.getCompilerOptions(); + if ((oldOptions.module !== options.module) || + (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.typesSearchPaths !== options.typesSearchPaths) || + (oldOptions.configFilePath !== options.configFilePath)) { + return false; + } ts.Debug.assert(!oldProgram.structureIsReused); var oldRootNames = oldProgram.getRootFileNames(); if (!ts.arrayIsEqualTo(oldRootNames, rootNames)) { return false; } + if (!ts.arrayIsEqualTo(options.types, oldOptions.types)) { + return false; + } var newSourceFiles = []; var filePaths = []; var modifiedSourceFiles = []; @@ -33346,23 +34556,28 @@ var ts; if (!ts.arrayIsEqualTo(oldSourceFile.moduleAugmentations, newSourceFile.moduleAugmentations, moduleNameIsEqualTo)) { return false; } + if (!ts.arrayIsEqualTo(oldSourceFile.typeReferenceDirectives, newSourceFile.typeReferenceDirectives, fileReferenceIsEqualTo)) { + 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, ts.getNormalizedAbsolutePath(newSourceFile.fileName, currentDirectory)); - for (var i = 0; i < moduleNames.length; i++) { - var newResolution = resolutions[i]; - var oldResolution = ts.getResolvedModule(oldSourceFile, moduleNames[i]); - var resolutionChanged = oldResolution - ? !newResolution || - oldResolution.resolvedFileName !== newResolution.resolvedFileName || - !!oldResolution.isExternalLibraryImport !== !!newResolution.isExternalLibraryImport - : newResolution; - if (resolutionChanged) { - return false; - } + var resolutions = resolveModuleNamesWorker(moduleNames, newSourceFilePath); + 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); + var resolutionsChanged = ts.hasChangesInResolutions(typesReferenceDirectives, resolutions, oldSourceFile.resolvedTypeReferenceDirectiveNames, ts.typeDirectiveIsEqualTo); + if (resolutionsChanged) { + return false; } } newSourceFile.resolvedModules = oldSourceFile.resolvedModules; + newSourceFile.resolvedTypeReferenceDirectiveNames = oldSourceFile.resolvedTypeReferenceDirectiveNames; modifiedSourceFiles.push(newSourceFile); } else { @@ -33379,6 +34594,7 @@ var ts; var modifiedFile = modifiedSourceFiles_1[_b]; fileProcessingDiagnostics.reattachFileDiagnostics(modifiedFile); } + resolvedTypeReferenceDirectives = oldProgram.resolvedTypeReferenceDirectives; oldProgram.structureIsReused = true; return true; } @@ -33391,7 +34607,7 @@ var ts; getNewLine: function () { return host.getNewLine(); }, getSourceFile: program.getSourceFile, getSourceFiles: program.getSourceFiles, - writeFile: writeFileCallback || (function (fileName, data, writeByteOrderMark, onError) { return host.writeFile(fileName, data, writeByteOrderMark, onError); }), + writeFile: writeFileCallback || (function (fileName, data, writeByteOrderMark, onError, sourceFiles) { return host.writeFile(fileName, data, writeByteOrderMark, onError, sourceFiles); }), isEmitBlocked: isEmitBlocked }; } @@ -33411,7 +34627,7 @@ var ts; function emitWorker(program, sourceFile, writeFileCallback, cancellationToken) { var declarationDiagnostics = []; if (options.noEmit) { - return { diagnostics: declarationDiagnostics, sourceMaps: undefined, emitSkipped: true }; + return { diagnostics: declarationDiagnostics, sourceMaps: undefined, emittedFiles: undefined, emitSkipped: true }; } if (options.noEmitOnError) { var diagnostics = program.getOptionsDiagnostics(cancellationToken).concat(program.getSyntacticDiagnostics(sourceFile, cancellationToken), program.getGlobalDiagnostics(cancellationToken), program.getSemanticDiagnostics(sourceFile, cancellationToken)); @@ -33419,7 +34635,12 @@ var ts; declarationDiagnostics = program.getDeclarationDiagnostics(undefined, cancellationToken); } if (diagnostics.length > 0 || declarationDiagnostics.length > 0) { - return { diagnostics: diagnostics, sourceMaps: undefined, emitSkipped: true }; + return { + diagnostics: ts.concatenate(diagnostics, declarationDiagnostics), + sourceMaps: undefined, + emittedFiles: undefined, + emitSkipped: true + }; } } var emitResolver = getDiagnosticsProducingTypeChecker().getEmitResolver((options.outFile || options.out) ? undefined : sourceFile); @@ -33451,7 +34672,13 @@ var ts; return getDiagnosticsHelper(sourceFile, getSemanticDiagnosticsForFile, cancellationToken); } function getDeclarationDiagnostics(sourceFile, cancellationToken) { - return getDiagnosticsHelper(sourceFile, getDeclarationDiagnosticsForFile, cancellationToken); + var options = program.getCompilerOptions(); + if (!sourceFile || options.out || options.outFile) { + return getDeclarationDiagnosticsWorker(sourceFile, cancellationToken); + } + else { + return getDiagnosticsHelper(sourceFile, getDeclarationDiagnosticsForFile, cancellationToken); + } } function getSyntacticDiagnosticsForFile(sourceFile, cancellationToken) { return sourceFile.parseDiagnostics; @@ -33491,47 +34718,47 @@ var ts; return false; } switch (node.kind) { - case 225: + case 228: diagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.import_can_only_be_used_in_a_ts_file)); return true; - case 231: + case 234: if (node.isExportEquals) { diagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.export_can_only_be_used_in_a_ts_file)); return true; } break; - case 218: + case 220: var classDeclaration = node; if (checkModifiers(classDeclaration.modifiers) || checkTypeParameters(classDeclaration.typeParameters)) { return true; } break; - case 247: + case 250: var heritageClause = node; if (heritageClause.token === 106) { diagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.implements_clauses_can_only_be_used_in_a_ts_file)); return true; } break; - case 219: + case 221: diagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.interface_declarations_can_only_be_used_in_a_ts_file)); return true; - case 222: + case 224: diagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.module_declarations_can_only_be_used_in_a_ts_file)); return true; - case 220: + case 222: diagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.type_aliases_can_only_be_used_in_a_ts_file)); return true; - case 145: - case 144: case 146: + case 145: case 147: case 148: - case 177: - case 217: + case 149: case 178: - case 217: + case 219: + case 179: + case 219: var functionDeclaration = node; if (checkModifiers(functionDeclaration.modifiers) || checkTypeParameters(functionDeclaration.typeParameters) || @@ -33539,20 +34766,20 @@ var ts; return true; } break; - case 197: + case 199: var variableStatement = node; if (checkModifiers(variableStatement.modifiers)) { return true; } break; - case 215: + case 217: var variableDeclaration = node; if (checkTypeAnnotation(variableDeclaration.type)) { return true; } break; - case 172: case 173: + case 174: var expression = node; if (expression.typeArguments && expression.typeArguments.length > 0) { var start_2 = expression.typeArguments.pos; @@ -33560,7 +34787,7 @@ var ts; return true; } break; - case 140: + case 141: var parameter = node; if (parameter.modifiers) { var start_3 = parameter.modifiers.pos; @@ -33576,17 +34803,17 @@ var ts; return true; } break; - case 143: + case 144: diagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.property_declarations_can_only_be_used_in_a_ts_file)); return true; - case 221: + case 223: diagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.enum_declarations_can_only_be_used_in_a_ts_file)); return true; - case 175: + case 176: 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 141: + case 142: 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)); } @@ -33633,15 +34860,16 @@ var ts; } }); } - function getDeclarationDiagnosticsForFile(sourceFile, cancellationToken) { + function getDeclarationDiagnosticsWorker(sourceFile, cancellationToken) { return runWithCancellationToken(function () { - if (!ts.isDeclarationFile(sourceFile)) { - var resolver = getDiagnosticsProducingTypeChecker().getEmitResolver(sourceFile, cancellationToken); - var writeFile_1 = function () { }; - return ts.getDeclarationDiagnostics(getEmitHost(writeFile_1), resolver, sourceFile); - } + var resolver = getDiagnosticsProducingTypeChecker().getEmitResolver(sourceFile, cancellationToken); + var writeFile = function () { }; + return ts.getDeclarationDiagnostics(getEmitHost(writeFile), resolver, sourceFile); }); } + function getDeclarationDiagnosticsForFile(sourceFile, cancellationToken) { + return ts.isDeclarationFile(sourceFile) ? [] : getDeclarationDiagnosticsWorker(sourceFile, cancellationToken); + } function getOptionsDiagnostics() { var allDiagnostics = []; ts.addRange(allDiagnostics, fileProcessingDiagnostics.getGlobalDiagnostics()); @@ -33657,7 +34885,7 @@ var ts; return ts.getBaseFileName(fileName).indexOf(".") >= 0; } function processRootFile(fileName, isDefaultLib) { - processSourceFile(ts.normalizePath(fileName), isDefaultLib); + processSourceFile(ts.normalizePath(fileName), isDefaultLib, true); } function fileReferenceIsEqualTo(a, b) { return a.fileName === b.fileName; @@ -33688,9 +34916,9 @@ var ts; return; function collectModuleReferences(node, inAmbientModule) { switch (node.kind) { - case 226: - case 225: - case 232: + case 229: + case 228: + case 235: var moduleNameExpr = ts.getExternalModuleName(node); if (!moduleNameExpr || moduleNameExpr.kind !== 9) { break; @@ -33702,7 +34930,7 @@ var ts; (imports || (imports = [])).push(moduleNameExpr); } break; - case 222: + case 224: if (ts.isAmbientModule(node) && (inAmbientModule || node.flags & 2 || ts.isDeclarationFile(file))) { var moduleName = node.name; if (isExternalModuleFile || (inAmbientModule && !ts.isExternalModuleNameRelative(moduleName.text))) { @@ -33726,7 +34954,7 @@ var ts; } } } - function processSourceFile(fileName, isDefaultLib, refFile, refPos, refEnd) { + function processSourceFile(fileName, isDefaultLib, isReference, refFile, refPos, refEnd) { var diagnosticArgument; var diagnostic; if (hasExtension(fileName)) { @@ -33734,7 +34962,7 @@ var ts; 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, refFile, refPos, refEnd)) { + else if (!findSourceFile(fileName, ts.toPath(fileName, currentDirectory, getCanonicalFileName), isDefaultLib, isReference, refFile, refPos, refEnd)) { diagnostic = ts.Diagnostics.File_0_not_found; diagnosticArgument = [fileName]; } @@ -33744,13 +34972,13 @@ var ts; } } else { - var nonTsFile = options.allowNonTsExtensions && findSourceFile(fileName, ts.toPath(fileName, currentDirectory, getCanonicalFileName), isDefaultLib, refFile, refPos, refEnd); + var nonTsFile = options.allowNonTsExtensions && findSourceFile(fileName, ts.toPath(fileName, currentDirectory, getCanonicalFileName), isDefaultLib, isReference, 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, refFile, refPos, refEnd); })) { + else if (!ts.forEach(supportedExtensions, function (extension) { return findSourceFile(fileName + extension, ts.toPath(fileName + extension, currentDirectory, getCanonicalFileName), isDefaultLib, isReference, refFile, refPos, refEnd); })) { diagnostic = ts.Diagnostics.File_0_not_found; fileName += ".ts"; diagnosticArgument = [fileName]; @@ -33774,12 +35002,15 @@ var ts; fileProcessingDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.File_name_0_differs_from_already_included_file_name_1_only_in_casing, fileName, existingFileName)); } } - function findSourceFile(fileName, path, isDefaultLib, refFile, refPos, refEnd) { + function findSourceFile(fileName, path, isDefaultLib, isReference, refFile, refPos, refEnd) { if (filesByName.contains(path)) { var file_1 = filesByName.get(path); if (file_1 && options.forceConsistentCasingInFileNames && ts.getNormalizedAbsolutePath(file_1.fileName, currentDirectory) !== ts.getNormalizedAbsolutePath(fileName, currentDirectory)) { reportFileNamesDifferOnlyInCasingError(fileName, file_1.fileName, refFile, refPos, refEnd); } + if (file_1) { + file_1.wasReferenced = file_1.wasReferenced || isReference; + } return file_1; } var file = host.getSourceFile(fileName, options.target, function (hostErrorMessage) { @@ -33792,6 +35023,7 @@ var ts; }); filesByName.set(path, file); if (file) { + file.wasReferenced = file.wasReferenced || isReference; file.path = path; if (host.useCaseSensitiveFileNames()) { var existingFile = filesByNameIgnoreCase.get(path); @@ -33805,7 +35037,8 @@ var ts; skipDefaultLib = skipDefaultLib || file.hasNoDefaultLib; var basePath = ts.getDirectoryPath(fileName); if (!options.noResolve) { - processReferencedFiles(file, basePath); + processReferencedFiles(file, basePath, isDefaultLib); + processTypeReferenceDirectives(file); } processImportedModules(file, basePath); if (isDefaultLib) { @@ -33817,12 +35050,64 @@ var ts; } return file; } - function processReferencedFiles(file, basePath) { + function processReferencedFiles(file, basePath, isDefaultLib) { ts.forEach(file.referencedFiles, function (ref) { var referencedFileName = resolveTripleslashReference(ref.fileName, file.fileName); - processSourceFile(referencedFileName, false, file, ref.pos, ref.end); + processSourceFile(referencedFileName, isDefaultLib, true, file, ref.pos, ref.end); }); } + function processTypeReferenceDirectives(file) { + var typeDirectives = ts.map(file.typeReferenceDirectives, function (l) { return l.fileName; }); + var resolutions = resolveTypeReferenceDirectiveNamesWorker(typeDirectives, file.fileName); + for (var i = 0; i < typeDirectives.length; i++) { + var ref = file.typeReferenceDirectives[i]; + var resolvedTypeReferenceDirective = resolutions[i]; + ts.setResolvedTypeReferenceDirective(file, ref.fileName, resolvedTypeReferenceDirective); + processTypeReferenceDirective(ref.fileName, resolvedTypeReferenceDirective, file, ref.pos, ref.end); + } + } + function processTypeReferenceDirective(typeReferenceDirective, resolvedTypeReferenceDirective, refFile, refPos, refEnd) { + var previousResolution = resolvedTypeReferenceDirectives[typeReferenceDirective]; + if (previousResolution && previousResolution.primary) { + return; + } + var saveResolution = true; + if (resolvedTypeReferenceDirective) { + if (resolvedTypeReferenceDirective.primary) { + processSourceFile(resolvedTypeReferenceDirective.resolvedFileName, false, true, refFile, refPos, refEnd); + } + else { + if (previousResolution) { + var otherFileText = host.readFile(resolvedTypeReferenceDirective.resolvedFileName); + if (otherFileText !== getSourceFile(previousResolution.resolvedFileName).text) { + fileProcessingDiagnostics.add(createDiagnostic(refFile, refPos, refEnd, ts.Diagnostics.Conflicting_library_definitions_for_0_found_at_1_and_2_Copy_the_correct_file_to_the_typings_folder_to_resolve_this_conflict, typeReferenceDirective, resolvedTypeReferenceDirective.resolvedFileName, previousResolution.resolvedFileName)); + } + saveResolution = false; + } + else { + processSourceFile(resolvedTypeReferenceDirective.resolvedFileName, false, true, refFile, refPos, refEnd); + } + } + } + else { + fileProcessingDiagnostics.add(createDiagnostic(refFile, refPos, refEnd, ts.Diagnostics.Cannot_find_name_0, typeReferenceDirective)); + } + if (saveResolution) { + resolvedTypeReferenceDirectives[typeReferenceDirective] = resolvedTypeReferenceDirective; + } + } + function createDiagnostic(refFile, refPos, refEnd, message) { + var args = []; + for (var _i = 4; _i < arguments.length; _i++) { + args[_i - 4] = arguments[_i]; + } + if (refFile === undefined || refPos === undefined || refEnd === undefined) { + return ts.createCompilerDiagnostic.apply(void 0, [message].concat(args)); + } + else { + return ts.createFileDiagnostic.apply(void 0, [refFile, refPos, refEnd - refPos, message].concat(args)); + } + } function getCanonicalFileName(fileName) { return host.getCanonicalFileName(fileName); } @@ -33839,7 +35124,7 @@ var ts; !options.noResolve && i < file.imports.length; if (shouldAddFile) { - var importedFile = findSourceFile(resolution.resolvedFileName, ts.toPath(resolution.resolvedFileName, currentDirectory, getCanonicalFileName), false, file, ts.skipTrivia(file.text, file.imports[i].pos), file.imports[i].end); + var importedFile = findSourceFile(resolution.resolvedFileName, ts.toPath(resolution.resolvedFileName, currentDirectory, getCanonicalFileName), false, false, file, ts.skipTrivia(file.text, file.imports[i].pos), file.imports[i].end); if (importedFile && resolution.isExternalLibraryImport) { if (!ts.isExternalModule(importedFile) && importedFile.statements.length) { var start_5 = ts.getTokenPosOfNode(file.imports[i], file); @@ -33859,44 +35144,21 @@ var ts; return; } function computeCommonSourceDirectory(sourceFiles) { - var commonPathComponents; - var failed = ts.forEach(files, function (sourceFile) { - if (ts.isDeclarationFile(sourceFile)) { - return; + var fileNames = []; + for (var _i = 0, sourceFiles_2 = sourceFiles; _i < sourceFiles_2.length; _i++) { + var file = sourceFiles_2[_i]; + if (!file.isDeclarationFile) { + fileNames.push(file.fileName); } - var sourcePathComponents = ts.getNormalizedPathComponents(sourceFile.fileName, currentDirectory); - sourcePathComponents.pop(); - if (!commonPathComponents) { - commonPathComponents = sourcePathComponents; - return; - } - for (var i = 0, n = Math.min(commonPathComponents.length, sourcePathComponents.length); i < n; i++) { - if (getCanonicalFileName(commonPathComponents[i]) !== getCanonicalFileName(sourcePathComponents[i])) { - if (i === 0) { - return true; - } - commonPathComponents.length = i; - break; - } - } - if (sourcePathComponents.length < commonPathComponents.length) { - commonPathComponents.length = sourcePathComponents.length; - } - }); - if (failed) { - return ""; } - if (!commonPathComponents) { - return currentDirectory; - } - return ts.getNormalizedPathFromPathComponents(commonPathComponents); + return computeCommonSourceDirectoryOfFilenames(fileNames, currentDirectory, getCanonicalFileName); } function checkSourceFilesBelongToPath(sourceFiles, rootDirectory) { var allFilesBelongToPath = true; if (sourceFiles) { var absoluteRootDirectoryPath = host.getCanonicalFileName(ts.getNormalizedAbsolutePath(rootDirectory, currentDirectory)); - for (var _i = 0, sourceFiles_2 = sourceFiles; _i < sourceFiles_2.length; _i++) { - var sourceFile = sourceFiles_2[_i]; + for (var _i = 0, sourceFiles_3 = sourceFiles; _i < sourceFiles_3.length; _i++) { + var sourceFile = sourceFiles_3[_i]; if (!ts.isDeclarationFile(sourceFile)) { var absoluteSourceFilePath = host.getCanonicalFileName(ts.getNormalizedAbsolutePath(sourceFile.fileName, currentDirectory)); if (absoluteSourceFilePath.indexOf(absoluteRootDirectoryPath) !== 0) { @@ -33969,6 +35231,17 @@ var ts; programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "sourceRoot", "sourceMap")); } } + if (options.declarationDir) { + if (!options.declaration) { + programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "declarationDir", "declaration")); + } + if (options.out || options.outFile) { + programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "declarationDir", options.out ? "out" : "outFile")); + } + } + if (options.lib && options.noLib) { + programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "lib", "noLib")); + } var languageVersion = options.target || 0; var outFile = options.outFile || options.out; var firstExternalModuleSourceFile = ts.forEach(files, function (f) { return ts.isExternalModule(f) ? f : undefined; }); @@ -34000,21 +35273,7 @@ var ts; programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Cannot_find_the_common_subdirectory_path_for_the_input_files)); } } - if (options.noEmit) { - if (options.out) { - programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "noEmit", "out")); - } - if (options.outFile) { - programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "noEmit", "outFile")); - } - if (options.outDir) { - programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "noEmit", "outDir")); - } - if (options.declaration) { - programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "noEmit", "declaration")); - } - } - else if (options.allowJs && options.declaration) { + if (!options.noEmit && options.allowJs && options.declaration) { programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "allowJs", "declaration")); } if (options.emitDecoratorMetadata && @@ -34026,10 +35285,10 @@ var ts; } if (!options.noEmit && !options.suppressOutputPathCheck) { var emitHost = getEmitHost(); - var emitFilesSeen = ts.createFileMap(!host.useCaseSensitiveFileNames() ? function (key) { return key.toLocaleLowerCase(); } : undefined); + var emitFilesSeen_1 = ts.createFileMap(!host.useCaseSensitiveFileNames() ? function (key) { return key.toLocaleLowerCase(); } : undefined); ts.forEachExpectedEmitFile(emitHost, function (emitFileNames, sourceFiles, isBundledEmit) { - verifyEmitFilePath(emitFileNames.jsFilePath, emitFilesSeen); - verifyEmitFilePath(emitFileNames.declarationFilePath, emitFilesSeen); + verifyEmitFilePath(emitFileNames.jsFilePath, emitFilesSeen_1); + verifyEmitFilePath(emitFileNames.declarationFilePath, emitFilesSeen_1); }); } function verifyEmitFilePath(emitFileName, emitFilesSeen) { @@ -34067,6 +35326,12 @@ var ts; type: "boolean", description: ts.Diagnostics.Generates_corresponding_d_ts_file }, + { + name: "declarationDir", + type: "string", + isFilePath: true, + paramType: ts.Diagnostics.DIRECTORY + }, { name: "diagnostics", type: "boolean" @@ -34101,13 +35366,12 @@ var ts; "react": 2 }, paramType: ts.Diagnostics.KIND, - description: ts.Diagnostics.Specify_JSX_code_generation_Colon_preserve_or_react, - error: ts.Diagnostics.Argument_for_jsx_must_be_preserve_or_react + description: ts.Diagnostics.Specify_JSX_code_generation_Colon_preserve_or_react }, { name: "reactNamespace", type: "string", - description: ts.Diagnostics.Specifies_the_object_invoked_for_createElement_and_spread_when_targeting_react_JSX_emit + description: ts.Diagnostics.Specify_the_object_invoked_for_createElement_and_spread_when_targeting_react_JSX_emit }, { name: "listFiles", @@ -34121,7 +35385,7 @@ var ts; name: "mapRoot", type: "string", isFilePath: true, - description: ts.Diagnostics.Specifies_the_location_where_debugger_should_locate_map_files_instead_of_generated_locations, + description: ts.Diagnostics.Specify_the_location_where_debugger_should_locate_map_files_instead_of_generated_locations, paramType: ts.Diagnostics.LOCATION }, { @@ -34137,8 +35401,7 @@ var ts; "es2015": ts.ModuleKind.ES2015 }, description: ts.Diagnostics.Specify_module_code_generation_Colon_commonjs_amd_system_umd_or_es2015, - paramType: ts.Diagnostics.KIND, - error: ts.Diagnostics.Argument_for_module_option_must_be_commonjs_amd_system_umd_es2015_or_none + paramType: ts.Diagnostics.KIND }, { name: "newLine", @@ -34146,9 +35409,8 @@ var ts; "crlf": 0, "lf": 1 }, - description: ts.Diagnostics.Specifies_the_end_of_line_sequence_to_be_used_when_emitting_files_Colon_CRLF_dos_or_LF_unix, - paramType: ts.Diagnostics.NEWLINE, - error: ts.Diagnostics.Argument_for_newLine_option_must_be_CRLF_or_LF + 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 }, { name: "noEmit", @@ -34169,6 +35431,11 @@ var ts; type: "boolean", 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 + }, { name: "noLib", type: "boolean" @@ -34208,7 +35475,6 @@ var ts; }, { name: "pretty", - paramType: ts.Diagnostics.KIND, description: ts.Diagnostics.Stylize_errors_and_messages_using_color_and_context_experimental, type: "boolean" }, @@ -34229,8 +35495,8 @@ var ts; name: "rootDir", type: "string", isFilePath: true, - description: ts.Diagnostics.Specifies_the_root_directory_of_input_files_Use_to_control_the_output_directory_structure_with_outDir, - paramType: ts.Diagnostics.LOCATION + paramType: ts.Diagnostics.LOCATION, + description: ts.Diagnostics.Specify_the_root_directory_of_input_files_Use_to_control_the_output_directory_structure_with_outDir }, { name: "isolatedModules", @@ -34245,7 +35511,7 @@ var ts; name: "sourceRoot", type: "string", isFilePath: true, - description: ts.Diagnostics.Specifies_the_location_where_debugger_should_locate_TypeScript_files_instead_of_source_locations, + description: ts.Diagnostics.Specify_the_location_where_debugger_should_locate_TypeScript_files_instead_of_source_locations, paramType: ts.Diagnostics.LOCATION }, { @@ -34274,9 +35540,8 @@ var ts; "es6": 2, "es2015": 2 }, - description: ts.Diagnostics.Specify_ECMAScript_target_version_Colon_ES3_default_ES5_or_ES2015_experimental, - paramType: ts.Diagnostics.VERSION, - error: ts.Diagnostics.Argument_for_target_option_must_be_ES3_ES5_or_ES2015 + description: ts.Diagnostics.Specify_ECMAScript_target_version_Colon_ES3_default_ES5_or_ES2015, + paramType: ts.Diagnostics.VERSION }, { name: "version", @@ -34307,8 +35572,7 @@ var ts; "node": ts.ModuleResolutionKind.NodeJs, "classic": ts.ModuleResolutionKind.Classic }, - description: ts.Diagnostics.Specifies_module_resolution_strategy_Colon_node_Node_js_or_classic_TypeScript_pre_1_6, - error: ts.Diagnostics.Argument_for_moduleResolution_option_must_be_node_or_classic + description: ts.Diagnostics.Specify_module_resolution_strategy_Colon_node_Node_js_or_classic_TypeScript_pre_1_6 }, { name: "allowUnusedLabels", @@ -34348,14 +35612,41 @@ var ts; }, { name: "rootDirs", - type: "object", + type: "list", isTSConfigOnly: true, - isFilePath: true + element: { + name: "rootDirs", + type: "string", + isFilePath: true + } }, { - name: "traceModuleResolution", + name: "typesSearchPaths", + type: "list", + isTSConfigOnly: true, + element: { + name: "typesSearchPaths", + type: "string", + isFilePath: true + } + }, + { + name: "typesRoot", + type: "string" + }, + { + name: "types", + type: "list", + element: { + name: "types", + type: "string" + }, + description: ts.Diagnostics.Type_declaration_files_to_be_included_in_compilation + }, + { + name: "traceResolution", type: "boolean", - description: ts.Diagnostics.Enable_tracing_of_the_module_resolution_process + description: ts.Diagnostics.Enable_tracing_of_the_name_resolution_process }, { name: "allowJs", @@ -34371,6 +35662,65 @@ var ts; name: "noImplicitUseStrict", type: "boolean", description: ts.Diagnostics.Do_not_emit_use_strict_directives_in_module_output + }, + { + name: "listEmittedFiles", + type: "boolean" + }, + { + name: "lib", + type: "list", + element: { + name: "lib", + type: { + "es5": "lib.es5.d.ts", + "es6": "lib.es2015.d.ts", + "es2015": "lib.es2015.d.ts", + "es7": "lib.es2016.d.ts", + "es2016": "lib.es2016.d.ts", + "dom": "lib.dom.d.ts", + "webworker": "lib.webworker.d.ts", + "scripthost": "lib.scripthost.d.ts", + "es2015.core": "lib.es2015.core.d.ts", + "es2015.collection": "lib.es2015.collection.d.ts", + "es2015.generator": "lib.es2015.generator.d.ts", + "es2015.iterable": "lib.es2015.iterable.d.ts", + "es2015.promise": "lib.es2015.promise.d.ts", + "es2015.proxy": "lib.es2015.proxy.d.ts", + "es2015.reflect": "lib.es2015.reflect.d.ts", + "es2015.symbol": "lib.es2015.symbol.d.ts", + "es2015.symbol.wellknown": "lib.es2015.symbol.wellknown.d.ts", + "es2016.array.include": "lib.es2016.array.include.d.ts" + } + }, + description: ts.Diagnostics.Specify_library_files_to_be_included_in_the_compilation_Colon + }, + { + name: "strictNullChecks", + type: "boolean", + description: ts.Diagnostics.Enable_strict_null_checks + } + ]; + ts.typingOptionDeclarations = [ + { + name: "enableAutoDiscovery", + type: "boolean" + }, + { + name: "include", + type: "list", + element: { + name: "include", + type: "string" + } + }, + { + name: "exclude", + type: "list", + element: { + name: "exclude", + type: "string" + } } ]; var optionNameMapCache; @@ -34390,6 +35740,37 @@ var ts; return optionNameMapCache; } ts.getOptionNameMap = getOptionNameMap; + function createCompilerDiagnosticForInvalidCustomType(opt) { + var namesOfType = []; + ts.forEachKey(opt.type, function (key) { + namesOfType.push(" '" + key + "'"); + }); + return ts.createCompilerDiagnostic(ts.Diagnostics.Argument_for_0_option_must_be_Colon_1, "--" + opt.name, namesOfType); + } + ts.createCompilerDiagnosticForInvalidCustomType = createCompilerDiagnosticForInvalidCustomType; + function parseCustomTypeOption(opt, value, errors) { + var key = (value || "").trim().toLowerCase(); + var map = opt.type; + if (ts.hasProperty(map, key)) { + return map[key]; + } + else { + errors.push(createCompilerDiagnosticForInvalidCustomType(opt)); + } + } + ts.parseCustomTypeOption = parseCustomTypeOption; + function parseListTypeOption(opt, value, errors) { + var values = (value || "").trim().split(","); + switch (opt.element.type) { + case "number": + return ts.map(values, parseInt); + case "string": + return ts.map(values, function (v) { return v || ""; }); + default: + return ts.filter(ts.map(values, function (v) { return parseCustomTypeOption(opt.element, v, errors); }), function (v) { return !!v; }); + } + } + ts.parseListTypeOption = parseListTypeOption; function parseCommandLine(commandLine, readFile) { var options = {}; var fileNames = []; @@ -34435,16 +35816,14 @@ var ts; options[opt.name] = args[i] || ""; i++; break; - default: - var map_1 = opt.type; - var key = (args[i] || "").toLowerCase(); + case "list": + options[opt.name] = parseListTypeOption(opt, args[i], errors); i++; - if (ts.hasProperty(map_1, key)) { - options[opt.name] = map_1[key]; - } - else { - errors.push(ts.createCompilerDiagnostic(opt.error)); - } + break; + default: + options[opt.name] = parseCustomTypeOption(opt, args[i], errors); + i++; + break; } } } @@ -34533,17 +35912,22 @@ var ts; } function parseJsonConfigFileContent(json, host, basePath, existingOptions, configFileName) { if (existingOptions === void 0) { existingOptions = {}; } - var _a = convertCompilerOptionsFromJson(json["compilerOptions"], basePath, configFileName), optionsFromJsonConfigFile = _a.options, errors = _a.errors; - var options = ts.extend(existingOptions, optionsFromJsonConfigFile); + var errors = []; + var compilerOptions = convertCompilerOptionsFromJsonWorker(json["compilerOptions"], basePath, errors, configFileName); + var options = ts.extend(existingOptions, compilerOptions); + var typingOptions = convertTypingOptionsFromJsonWorker(json["typingOptions"], basePath, errors, configFileName); + options.configFilePath = configFileName; + var fileNames = getFileNames(errors); return { options: options, - fileNames: getFileNames(), + fileNames: fileNames, + typingOptions: typingOptions, errors: errors }; - function getFileNames() { + function getFileNames(errors) { var fileNames = []; if (ts.hasProperty(json, "files")) { - if (json["files"] instanceof Array) { + if (ts.isArray(json["files"])) { fileNames = ts.map(json["files"], function (s) { return ts.combinePaths(basePath, s); }); } else { @@ -34553,7 +35937,7 @@ var ts; else { var filesSeen = {}; var exclude = []; - if (json["exclude"] instanceof Array) { + if (ts.isArray(json["exclude"])) { exclude = json["exclude"]; } else { @@ -34588,85 +35972,88 @@ var ts; } } } + if (ts.hasProperty(json, "excludes") && !ts.hasProperty(json, "exclude")) { + errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Unknown_option_excludes_Did_you_mean_exclude)); + } return fileNames; } } ts.parseJsonConfigFileContent = parseJsonConfigFileContent; function convertCompilerOptionsFromJson(jsonOptions, basePath, configFileName) { - var options = {}; var errors = []; - if (configFileName && ts.getBaseFileName(configFileName) === "jsconfig.json") { - options.allowJs = true; - } - if (!jsonOptions) { - return { options: options, errors: errors }; - } - var optionNameMap = ts.arrayToMap(ts.optionDeclarations, function (opt) { return opt.name; }); - for (var id in jsonOptions) { - if (ts.hasProperty(optionNameMap, id)) { - var opt = optionNameMap[id]; - var optType = opt.type; - var value = jsonOptions[id]; - var expectedType = typeof optType === "string" ? optType : "string"; - if (typeof value === expectedType) { - if (typeof optType !== "string") { - var key = value.toLowerCase(); - if (ts.hasProperty(optType, key)) { - value = optType[key]; - } - else { - errors.push(ts.createCompilerDiagnostic(opt.error)); - value = 0; - } - } - if (opt.isFilePath) { - switch (typeof value) { - case "string": - value = ts.normalizePath(ts.combinePaths(basePath, value)); - break; - case "object": - var paths = []; - var invalidOptionType = false; - if (!ts.isArray(value)) { - invalidOptionType = true; - } - else { - for (var _i = 0, _a = value; _i < _a.length; _i++) { - var element = _a[_i]; - if (typeof element === "string") { - paths.push(ts.normalizePath(ts.combinePaths(basePath, element))); - } - else { - invalidOptionType = true; - break; - } - } - } - if (invalidOptionType) { - errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_should_have_array_of_strings_as_a_value, opt.name)); - } - else { - value = paths; - } - break; - } - if (value === "") { - value = "."; - } - } - options[opt.name] = value; - } - else { - errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Compiler_option_0_requires_a_value_of_type_1, id, expectedType)); - } - } - else { - errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Unknown_compiler_option_0, id)); - } - } + var options = convertCompilerOptionsFromJsonWorker(jsonOptions, basePath, errors, configFileName); return { options: options, errors: errors }; } ts.convertCompilerOptionsFromJson = convertCompilerOptionsFromJson; + function convertTypingOptionsFromJson(jsonOptions, basePath, configFileName) { + var errors = []; + var options = convertTypingOptionsFromJsonWorker(jsonOptions, basePath, errors, configFileName); + return { options: options, errors: errors }; + } + ts.convertTypingOptionsFromJson = convertTypingOptionsFromJson; + function convertCompilerOptionsFromJsonWorker(jsonOptions, basePath, errors, configFileName) { + var options = ts.getBaseFileName(configFileName) === "jsconfig.json" ? { allowJs: 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); + return options; + } + function convertOptionsFromJson(optionDeclarations, jsonOptions, basePath, defaultOptions, diagnosticMessage, errors) { + if (!jsonOptions) { + return; + } + var optionNameMap = ts.arrayToMap(optionDeclarations, function (opt) { return opt.name; }); + for (var id in jsonOptions) { + if (ts.hasProperty(optionNameMap, id)) { + var opt = optionNameMap[id]; + defaultOptions[opt.name] = convertJsonOption(opt, jsonOptions[id], basePath, errors); + } + else { + errors.push(ts.createCompilerDiagnostic(diagnosticMessage, id)); + } + } + } + function convertJsonOption(opt, value, basePath, errors) { + var optType = opt.type; + var expectedType = typeof optType === "string" ? optType : "string"; + if (optType === "list" && ts.isArray(value)) { + return convertJsonOptionOfListType(opt, value, basePath, errors); + } + else if (typeof value === expectedType) { + if (typeof optType !== "string") { + return convertJsonOptionOfCustomType(opt, value, errors); + } + else { + if (opt.isFilePath) { + value = ts.normalizePath(ts.combinePaths(basePath, value)); + if (value === "") { + value = "."; + } + } + } + return value; + } + else { + errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Compiler_option_0_requires_a_value_of_type_1, opt.name, expectedType)); + } + } + function convertJsonOptionOfCustomType(opt, value, errors) { + var key = value.toLowerCase(); + if (ts.hasProperty(opt.type, key)) { + return opt.type[key]; + } + else { + errors.push(createCompilerDiagnosticForInvalidCustomType(opt)); + } + } + function convertJsonOptionOfListType(option, values, basePath, errors) { + return ts.filter(ts.map(values, function (v) { return convertJsonOption(option.element, v, basePath, errors); }), function (v) { return !!v; }); + } })(ts || (ts = {})); var ts; (function (ts) { @@ -34677,6 +36064,17 @@ var ts; reportDiagnostic(diagnostic, host); } } + function reportEmittedFiles(files, host) { + if (!files || files.length == 0) { + return; + } + var currentDir = ts.sys.getCurrentDirectory(); + for (var _i = 0, files_4 = files; _i < files_4.length; _i++) { + var file = files_4[_i]; + var filepath = ts.getNormalizedAbsolutePath(file, currentDir); + ts.sys.write("TSFILE: " + filepath + ts.sys.newLine); + } + } function validateLocaleAndSetLanguage(locale, errors) { var matchResult = /^([a-z]+)([_\-]([a-z]+))?$/.exec(locale.toLowerCase()); if (!matchResult) { @@ -34849,9 +36247,6 @@ var ts; function isJSONSupported() { return typeof JSON === "object" && typeof JSON.parse === "function"; } - function isWatchSet(options) { - return options.watch && options.hasOwnProperty("watch"); - } function executeCommandLine(args) { var commandLine = ts.parseCommandLine(args); var configFileName; @@ -34925,14 +36320,13 @@ var ts; printHelp(); return ts.sys.exit(ts.ExitStatus.Success); } - if (isWatchSet(commandLine.options)) { + if (ts.isWatchSet(commandLine.options)) { if (!ts.sys.watchFile) { reportDiagnostic(ts.createCompilerDiagnostic(ts.Diagnostics.The_current_host_does_not_support_the_0_option, "--watch"), undefined); return ts.sys.exit(ts.ExitStatus.DiagnosticsPresent_OutputsSkipped); } if (configFileName) { - var configFilePath = ts.toPath(configFileName, ts.sys.getCurrentDirectory(), ts.createGetCanonicalFileName(ts.sys.useCaseSensitiveFileNames)); - configFileWatcher = ts.sys.watchFile(configFilePath, configFileChanged); + configFileWatcher = ts.sys.watchFile(configFileName, configFileChanged); } if (ts.sys.watchDirectory && configFileName) { var directory = ts.getDirectoryPath(configFileName); @@ -34971,6 +36365,10 @@ var ts; ts.sys.exit(ts.ExitStatus.DiagnosticsPresent_OutputsSkipped); return; } + if (ts.isWatchSet(configParseResult.options) && !ts.sys.watchFile) { + reportDiagnostic(ts.createCompilerDiagnostic(ts.Diagnostics.The_current_host_does_not_support_the_0_option, "--watch"), undefined); + ts.sys.exit(ts.ExitStatus.DiagnosticsPresent_OutputsSkipped); + } return configParseResult; } function performCompilation() { @@ -34995,7 +36393,7 @@ var ts; } cachedExistingFiles = {}; var compileResult = compile(rootFileNames, compilerOptions, compilerHost); - if (!isWatchSet(compilerOptions)) { + if (!ts.isWatchSet(compilerOptions)) { return ts.sys.exit(compileResult.exitStatus); } setCachedProgram(compileResult.program); @@ -35015,17 +36413,16 @@ var ts; } } var sourceFile = hostGetSourceFile(fileName, languageVersion, onError); - if (sourceFile && isWatchSet(compilerOptions)) { - var filePath = ts.toPath(sourceFile.fileName, ts.sys.getCurrentDirectory(), ts.createGetCanonicalFileName(ts.sys.useCaseSensitiveFileNames)); - sourceFile.fileWatcher = ts.sys.watchFile(filePath, function (fileName, removed) { return sourceFileChanged(sourceFile, removed); }); + if (sourceFile && ts.isWatchSet(compilerOptions) && ts.sys.watchFile) { + sourceFile.fileWatcher = ts.sys.watchFile(sourceFile.fileName, function (fileName, removed) { return sourceFileChanged(sourceFile, removed); }); } return sourceFile; } function setCachedProgram(program) { if (cachedProgram) { - var newSourceFiles = program ? program.getSourceFiles() : undefined; + var newSourceFiles_1 = program ? program.getSourceFiles() : undefined; ts.forEach(cachedProgram.getSourceFiles(), function (sourceFile) { - if (!(newSourceFiles && ts.contains(newSourceFiles, sourceFile))) { + if (!(newSourceFiles_1 && ts.contains(newSourceFiles_1, sourceFile))) { if (sourceFile.fileWatcher) { sourceFile.fileWatcher.close(); sourceFile.fileWatcher = undefined; @@ -35131,6 +36528,7 @@ var ts; var emitOutput = program.emit(); diagnostics = diagnostics.concat(emitOutput.diagnostics); reportDiagnostics(ts.sortAndDeduplicateDiagnostics(diagnostics), compilerHost); + reportEmittedFiles(emitOutput.emittedFiles, compilerHost); if (emitOutput.emitSkipped && diagnostics.length > 0) { return ts.ExitStatus.DiagnosticsPresent_OutputsSkipped; } @@ -35163,10 +36561,11 @@ var ts; marginLength = 0; var usageColumn = []; var descriptionColumn = []; - for (var i = 0; i < optsList.length; i++) { + var optionsDescriptionMap = {}; + var _loop_2 = function(i) { var option = optsList[i]; if (!option.description) { - continue; + return "continue"; } var usageText_1 = " "; if (option.shortName) { @@ -35177,8 +36576,24 @@ var ts; usageText_1 += "--" + option.name; usageText_1 += getParamType(option); usageColumn.push(usageText_1); - descriptionColumn.push(getDiagnosticText(option.description)); + var description = void 0; + if (option.name === "lib") { + description = getDiagnosticText(option.description); + var options_1 = []; + var element = option.element; + ts.forEachKey(element.type, function (key) { + options_1.push("'" + key + "'"); + }); + optionsDescriptionMap[description] = options_1; + } + else { + description = getDiagnosticText(option.description); + } + descriptionColumn.push(description); marginLength = Math.max(usageText_1.length, marginLength); + }; + for (var i = 0; i < optsList.length; i++) { + _loop_2(i); } var usageText = " @<" + getDiagnosticText(ts.Diagnostics.file) + ">"; usageColumn.push(usageText); @@ -35187,7 +36602,16 @@ var ts; for (var i = 0; i < usageColumn.length; i++) { var usage = usageColumn[i]; var description = descriptionColumn[i]; + var kindsList = optionsDescriptionMap[description]; output += usage + makePadding(marginLength - usage.length + 2) + description + ts.sys.newLine; + if (kindsList) { + output += makePadding(marginLength + 4); + for (var _i = 0, kindsList_1 = kindsList; _i < kindsList_1.length; _i++) { + var kind = kindsList_1[_i]; + output += kind + " "; + } + output += ts.sys.newLine; + } } ts.sys.write(output); return; @@ -35228,10 +36652,10 @@ var ts; function serializeCompilerOptions(options) { var result = {}; var optionsNameMap = ts.getOptionNameMap().optionNameMap; - for (var name_31 in options) { - if (ts.hasProperty(options, name_31)) { - var value = options[name_31]; - switch (name_31) { + for (var name_34 in options) { + if (ts.hasProperty(options, name_34)) { + var value = options[name_34]; + switch (name_34) { case "init": case "watch": case "version": @@ -35239,17 +36663,17 @@ var ts; case "project": break; default: - var optionDefinition = optionsNameMap[name_31.toLowerCase()]; + var optionDefinition = optionsNameMap[name_34.toLowerCase()]; if (optionDefinition) { if (typeof optionDefinition.type === "string") { - result[name_31] = value; + result[name_34] = value; } else { var typeMap = optionDefinition.type; for (var key in typeMap) { if (ts.hasProperty(typeMap, key)) { if (typeMap[key] === value) - result[name_31] = key; + result[name_34] = key; } } } diff --git a/lib/tsserver.js b/lib/tsserver.js index 8c33f866268..7b671727da5 100644 --- a/lib/tsserver.js +++ b/lib/tsserver.js @@ -267,8 +267,14 @@ var ts; var count = array.length; if (count > 0) { var pos = 0; - var result = arguments.length <= 2 ? array[pos] : initial; - pos++; + var result = void 0; + if (arguments.length <= 2) { + result = array[pos]; + pos++; + } + else { + result = initial; + } while (pos < count) { result = f(result, array[pos]); pos++; @@ -283,8 +289,14 @@ var ts; if (array) { var pos = array.length - 1; if (pos >= 0) { - var result = arguments.length <= 2 ? array[pos] : initial; - pos--; + var result = void 0; + if (arguments.length <= 2) { + result = array[pos]; + pos--; + } + else { + result = initial; + } while (pos >= 0) { result = f(result, array[pos]); pos--; @@ -300,6 +312,14 @@ var ts; return hasOwnProperty.call(map, key); } ts.hasProperty = hasProperty; + function getKeys(map) { + var keys = []; + for (var key in map) { + keys.push(key); + } + return keys; + } + ts.getKeys = getKeys; function getProperty(map, key) { return hasOwnProperty.call(map, key) ? map[key] : undefined; } @@ -713,6 +733,26 @@ var ts; return pathLen > extLen && path.substr(pathLen - extLen, extLen) === extension; } ts.fileExtensionIs = fileExtensionIs; + function ensureScriptKind(fileName, scriptKind) { + return (scriptKind || getScriptKindFromFileName(fileName)) || 3; + } + ts.ensureScriptKind = ensureScriptKind; + function getScriptKindFromFileName(fileName) { + var ext = fileName.substr(fileName.lastIndexOf(".")); + switch (ext.toLowerCase()) { + case ".js": + return 1; + case ".jsx": + return 2; + case ".ts": + return 3; + case ".tsx": + return 4; + default: + return 0; + } + } + ts.getScriptKindFromFileName = getScriptKindFromFileName; ts.supportedTypeScriptExtensions = [".ts", ".tsx", ".d.ts"]; ts.supportedJavascriptExtensions = [".js", ".jsx"]; var allSupportedExtensions = ts.supportedTypeScriptExtensions.concat(ts.supportedJavascriptExtensions); @@ -946,6 +986,7 @@ var ts; var _fs = require("fs"); var _path = require("path"); var _os = require("os"); + var _crypto = require("crypto"); function createPollingWatchedFileSet(interval, chunkSize) { if (interval === void 0) { interval = 2500; } if (chunkSize === void 0) { chunkSize = 30; } @@ -960,13 +1001,13 @@ var ts; if (!watchedFile) { return; } - _fs.stat(watchedFile.filePath, function (err, stats) { + _fs.stat(watchedFile.fileName, function (err, stats) { if (err) { - watchedFile.callback(watchedFile.filePath); + watchedFile.callback(watchedFile.fileName); } else if (watchedFile.mtime.getTime() !== stats.mtime.getTime()) { - watchedFile.mtime = getModifiedTime(watchedFile.filePath); - watchedFile.callback(watchedFile.filePath, watchedFile.mtime.getTime() === 0); + watchedFile.mtime = getModifiedTime(watchedFile.fileName); + watchedFile.callback(watchedFile.fileName, watchedFile.mtime.getTime() === 0); } }); } @@ -989,11 +1030,11 @@ var ts; nextFileToCheck = nextToCheck; }, interval); } - function addFile(filePath, callback) { + function addFile(fileName, callback) { var file = { - filePath: filePath, + fileName: fileName, callback: callback, - mtime: getModifiedTime(filePath) + mtime: getModifiedTime(fileName) }; watchedFiles.push(file); if (watchedFiles.length === 1) { @@ -1013,67 +1054,67 @@ var ts; }; } function createWatchedFileSet() { - var dirWatchers = ts.createFileMap(); - var fileWatcherCallbacks = ts.createFileMap(); + var dirWatchers = {}; + var fileWatcherCallbacks = {}; return { addFile: addFile, removeFile: removeFile }; - function reduceDirWatcherRefCountForFile(filePath) { - var dirPath = ts.getDirectoryPath(filePath); - if (dirWatchers.contains(dirPath)) { - var watcher = dirWatchers.get(dirPath); + function reduceDirWatcherRefCountForFile(fileName) { + var dirName = ts.getDirectoryPath(fileName); + if (ts.hasProperty(dirWatchers, dirName)) { + var watcher = dirWatchers[dirName]; watcher.referenceCount -= 1; if (watcher.referenceCount <= 0) { watcher.close(); - dirWatchers.remove(dirPath); + delete dirWatchers[dirName]; } } } function addDirWatcher(dirPath) { - if (dirWatchers.contains(dirPath)) { - var watcher_1 = dirWatchers.get(dirPath); + if (ts.hasProperty(dirWatchers, dirPath)) { + var watcher_1 = dirWatchers[dirPath]; watcher_1.referenceCount += 1; return; } var watcher = _fs.watch(dirPath, { persistent: true }, function (eventName, relativeFileName) { return fileEventHandler(eventName, relativeFileName, dirPath); }); watcher.referenceCount = 1; - dirWatchers.set(dirPath, watcher); + dirWatchers[dirPath] = watcher; return; } function addFileWatcherCallback(filePath, callback) { - if (fileWatcherCallbacks.contains(filePath)) { - fileWatcherCallbacks.get(filePath).push(callback); + if (ts.hasProperty(fileWatcherCallbacks, filePath)) { + fileWatcherCallbacks[filePath].push(callback); } else { - fileWatcherCallbacks.set(filePath, [callback]); + fileWatcherCallbacks[filePath] = [callback]; } } - function addFile(filePath, callback) { - addFileWatcherCallback(filePath, callback); - addDirWatcher(ts.getDirectoryPath(filePath)); - return { filePath: filePath, callback: callback }; + function addFile(fileName, callback) { + addFileWatcherCallback(fileName, callback); + addDirWatcher(ts.getDirectoryPath(fileName)); + return { fileName: fileName, callback: callback }; } function removeFile(watchedFile) { - removeFileWatcherCallback(watchedFile.filePath, watchedFile.callback); - reduceDirWatcherRefCountForFile(watchedFile.filePath); + removeFileWatcherCallback(watchedFile.fileName, watchedFile.callback); + reduceDirWatcherRefCountForFile(watchedFile.fileName); } function removeFileWatcherCallback(filePath, callback) { - if (fileWatcherCallbacks.contains(filePath)) { - var newCallbacks = ts.copyListRemovingItem(callback, fileWatcherCallbacks.get(filePath)); + if (ts.hasProperty(fileWatcherCallbacks, filePath)) { + var newCallbacks = ts.copyListRemovingItem(callback, fileWatcherCallbacks[filePath]); if (newCallbacks.length === 0) { - fileWatcherCallbacks.remove(filePath); + delete fileWatcherCallbacks[filePath]; } else { - fileWatcherCallbacks.set(filePath, newCallbacks); + fileWatcherCallbacks[filePath] = newCallbacks; } } } function fileEventHandler(eventName, relativeFileName, baseDirPath) { - var filePath = typeof relativeFileName !== "string" + var fileName = typeof relativeFileName !== "string" ? undefined - : ts.toPath(relativeFileName, baseDirPath, ts.createGetCanonicalFileName(ts.sys.useCaseSensitiveFileNames)); - if ((eventName === "change" || eventName === "rename") && fileWatcherCallbacks.contains(filePath)) { - for (var _i = 0, _a = fileWatcherCallbacks.get(filePath); _i < _a.length; _i++) { + : ts.getNormalizedAbsolutePath(relativeFileName, baseDirPath); + if ((eventName === "change" || eventName === "rename") && ts.hasProperty(fileWatcherCallbacks, fileName)) { + for (var _i = 0, _a = fileWatcherCallbacks[fileName]; _i < _a.length; _i++) { var fileCallback = _a[_i]; - fileCallback(filePath); + fileCallback(fileName); } } } @@ -1154,6 +1195,9 @@ var ts; var directories = []; for (var _i = 0, files_2 = files; _i < files_2.length; _i++) { var current = files_2[_i]; + if (current === "." || current === "..") { + continue; + } var name_3 = ts.combinePaths(path, current); if (!ts.contains(exclude, getCanonicalPath(name_3))) { var stat = _fs.statSync(name_3); @@ -1182,14 +1226,14 @@ var ts; }, readFile: readFile, writeFile: writeFile, - watchFile: function (filePath, callback) { + watchFile: function (fileName, callback) { var watchSet = isNode4OrLater() ? watchedFileSet : pollingWatchedFileSet; - var watchedFile = watchSet.addFile(filePath, callback); + var watchedFile = watchSet.addFile(fileName, callback); return { close: function () { return watchSet.removeFile(watchedFile); } }; }, - watchDirectory: function (path, callback, recursive) { + watchDirectory: function (directoryName, callback, recursive) { var options; if (isNode4OrLater() && (process.platform === "win32" || process.platform === "darwin")) { options = { persistent: true, recursive: !!recursive }; @@ -1197,9 +1241,9 @@ var ts; else { options = { persistent: true }; } - return _fs.watch(path, options, function (eventName, relativeFileName) { + return _fs.watch(directoryName, options, function (eventName, relativeFileName) { if (eventName === "rename") { - callback(!relativeFileName ? relativeFileName : ts.normalizePath(ts.combinePaths(path, relativeFileName))); + callback(!relativeFileName ? relativeFileName : ts.normalizePath(ts.combinePaths(directoryName, relativeFileName))); } ; }); @@ -1221,6 +1265,19 @@ var ts; return process.cwd(); }, readDirectory: readDirectory, + getModifiedTime: function (path) { + try { + return _fs.statSync(path).mtime; + } + catch (e) { + return undefined; + } + }, + createHash: function (data) { + var hash = _crypto.createHash("md5"); + hash.update(data); + return hash.digest("hex"); + }, getMemoryUsage: function () { if (global.gc) { global.gc(); @@ -1482,6 +1539,9 @@ var ts; Async_functions_are_only_available_when_targeting_ECMAScript_6_and_higher: { code: 1311, category: ts.DiagnosticCategory.Error, key: "Async_functions_are_only_available_when_targeting_ECMAScript_6_and_higher_1311", message: "Async functions are only available when targeting ECMAScript 6 and 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." }, 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." }, @@ -1533,7 +1593,7 @@ var ts; 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." }, 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." }, - Neither_type_0_nor_type_1_is_assignable_to_the_other: { code: 2352, category: ts.DiagnosticCategory.Error, key: "Neither_type_0_nor_type_1_is_assignable_to_the_other_2352", message: "Neither type '{0}' nor type '{1}' is assignable to the other." }, + 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." }, 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." }, @@ -1547,6 +1607,7 @@ var ts; 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." }, 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}'" }, A_parameter_property_is_only_allowed_in_a_constructor_implementation: { code: 2369, category: ts.DiagnosticCategory.Error, key: "A_parameter_property_is_only_allowed_in_a_constructor_implementation_2369", message: "A parameter property is only allowed in a constructor implementation." }, A_rest_parameter_must_be_of_an_array_type: { code: 2370, category: ts.DiagnosticCategory.Error, key: "A_rest_parameter_must_be_of_an_array_type_2370", message: "A rest parameter must be of an array type." }, @@ -1627,6 +1688,7 @@ var ts; 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." }, + Variable_0_is_used_before_being_assigned: { code: 2454, category: ts.DiagnosticCategory.Error, key: "Variable_0_is_used_before_being_assigned_2454", message: "Variable '{0}' is used before being assigned." }, Type_argument_candidate_1_is_not_a_valid_type_argument_because_it_is_not_a_supertype_of_candidate_0: { code: 2455, category: ts.DiagnosticCategory.Error, key: "Type_argument_candidate_1_is_not_a_valid_type_argument_because_it_is_not_a_supertype_of_candidate_0_2455", message: "Type argument candidate '{1}' is not a valid type argument because it is not a supertype of candidate '{0}'." }, Type_alias_0_circularly_references_itself: { code: 2456, category: ts.DiagnosticCategory.Error, key: "Type_alias_0_circularly_references_itself_2456", message: "Type alias '{0}' circularly references itself." }, Type_alias_name_cannot_be_0: { code: 2457, category: ts.DiagnosticCategory.Error, key: "Type_alias_name_cannot_be_0_2457", message: "Type alias name cannot be '{0}'" }, @@ -1701,6 +1763,7 @@ var ts; A_module_cannot_have_multiple_default_exports: { code: 2528, category: ts.DiagnosticCategory.Error, key: "A_module_cannot_have_multiple_default_exports_2528", message: "A module cannot have multiple default exports." }, Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module_containing_async_functions: { code: 2529, category: ts.DiagnosticCategory.Error, key: "Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module_containing_async_func_2529", message: "Duplicate identifier '{0}'. Compiler reserves name '{1}' in top level scope of a module containing async functions." }, Property_0_is_incompatible_with_index_signature: { code: 2530, category: ts.DiagnosticCategory.Error, key: "Property_0_is_incompatible_with_index_signature_2530", message: "Property '{0}' is incompatible with index signature." }, + Object_is_possibly_null_or_undefined: { code: 2531, category: ts.DiagnosticCategory.Error, key: "Object_is_possibly_null_or_undefined_2531", message: "Object is possibly 'null' or 'undefined'." }, 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." }, @@ -1736,6 +1799,15 @@ var ts; Constructor_of_class_0_is_protected_and_only_accessible_within_the_class_declaration: { code: 2674, category: ts.DiagnosticCategory.Error, key: "Constructor_of_class_0_is_protected_and_only_accessible_within_the_class_declaration_2674", message: "Constructor of class '{0}' is protected and only accessible within the class declaration." }, Cannot_extend_a_class_0_Class_constructor_is_marked_as_private: { code: 2675, category: ts.DiagnosticCategory.Error, key: "Cannot_extend_a_class_0_Class_constructor_is_marked_as_private_2675", message: "Cannot extend a class '{0}'. Class constructor is marked as private." }, Accessors_must_both_be_abstract_or_non_abstract: { code: 2676, category: ts.DiagnosticCategory.Error, key: "Accessors_must_both_be_abstract_or_non_abstract_2676", message: "Accessors must both be abstract or non-abstract." }, + A_type_predicate_s_type_must_be_assignable_to_its_parameter_s_type: { code: 2677, category: ts.DiagnosticCategory.Error, key: "A_type_predicate_s_type_must_be_assignable_to_its_parameter_s_type_2677", message: "A type predicate's type must be assignable to its parameter's type." }, + Type_0_is_not_comparable_to_type_1: { code: 2678, category: ts.DiagnosticCategory.Error, key: "Type_0_is_not_comparable_to_type_1_2678", message: "Type '{0}' is not comparable to type '{1}'." }, + A_function_that_is_called_with_the_new_keyword_cannot_have_a_this_type_that_is_void: { code: 2679, category: ts.DiagnosticCategory.Error, key: "A_function_that_is_called_with_the_new_keyword_cannot_have_a_this_type_that_is_void_2679", message: "A function that is called with the 'new' keyword cannot have a 'this' type that is 'void'." }, + A_this_parameter_must_be_the_first_parameter: { code: 2680, category: ts.DiagnosticCategory.Error, key: "A_this_parameter_must_be_the_first_parameter_2680", message: "A 'this' parameter must be the first parameter." }, + A_constructor_cannot_have_a_this_parameter: { code: 2681, category: ts.DiagnosticCategory.Error, key: "A_constructor_cannot_have_a_this_parameter_2681", message: "A constructor cannot have a 'this' parameter." }, + A_setter_cannot_have_a_this_parameter: { code: 2682, category: ts.DiagnosticCategory.Error, key: "A_setter_cannot_have_a_this_parameter_2682", message: "A setter cannot have a 'this' parameter." }, + 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." }, 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}'." }, @@ -1806,6 +1878,7 @@ var ts; Parameter_0_of_exported_function_has_or_is_using_private_name_1: { code: 4078, category: ts.DiagnosticCategory.Error, key: "Parameter_0_of_exported_function_has_or_is_using_private_name_1_4078", message: "Parameter '{0}' of exported function has or is using private name '{1}'." }, Exported_type_alias_0_has_or_is_using_private_name_1: { code: 4081, category: ts.DiagnosticCategory.Error, key: "Exported_type_alias_0_has_or_is_using_private_name_1_4081", message: "Exported type alias '{0}' has or is using private name '{1}'." }, Default_export_of_the_module_has_or_is_using_private_name_0: { code: 4082, category: ts.DiagnosticCategory.Error, key: "Default_export_of_the_module_has_or_is_using_private_name_0_4082", message: "Default export of the module has or is using private name '{0}'." }, + Conflicting_library_definitions_for_0_found_at_1_and_2_Copy_the_correct_file_to_the_typings_folder_to_resolve_this_conflict: { code: 4090, category: ts.DiagnosticCategory.Message, key: "Conflicting_library_definitions_for_0_found_at_1_and_2_Copy_the_correct_file_to_the_typings_folder_t_4090", message: "Conflicting library definitions for '{0}' found at '{1}' and '{2}'. Copy the correct file to the 'typings' folder to resolve this conflict." }, The_current_host_does_not_support_the_0_option: { code: 5001, category: ts.DiagnosticCategory.Error, key: "The_current_host_does_not_support_the_0_option_5001", message: "The current host does not support the '{0}' option." }, Cannot_find_the_common_subdirectory_path_for_the_input_files: { code: 5009, category: ts.DiagnosticCategory.Error, key: "Cannot_find_the_common_subdirectory_path_for_the_input_files_5009", message: "Cannot find the common subdirectory path for the input files." }, Cannot_read_file_0_Colon_1: { code: 5012, category: ts.DiagnosticCategory.Error, key: "Cannot_read_file_0_Colon_1_5012", message: "Cannot read file '{0}': {1}" }, @@ -1830,8 +1903,8 @@ var ts; Substitution_0_in_pattern_1_in_can_have_at_most_one_Asterisk_character: { code: 5062, category: ts.DiagnosticCategory.Error, key: "Substitution_0_in_pattern_1_in_can_have_at_most_one_Asterisk_character_5062", message: "Substitution '{0}' in pattern '{1}' in can have at most one '*' character" }, 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." }, - Specifies_the_location_where_debugger_should_locate_map_files_instead_of_generated_locations: { code: 6003, category: ts.DiagnosticCategory.Message, key: "Specifies_the_location_where_debugger_should_locate_map_files_instead_of_generated_locations_6003", message: "Specifies the location where debugger should locate map files instead of generated locations." }, - Specifies_the_location_where_debugger_should_locate_TypeScript_files_instead_of_source_locations: { code: 6004, category: ts.DiagnosticCategory.Message, key: "Specifies_the_location_where_debugger_should_locate_TypeScript_files_instead_of_source_locations_6004", message: "Specifies the location where debugger should locate TypeScript files instead of source locations." }, + 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." }, + Specify_the_location_where_debugger_should_locate_TypeScript_files_instead_of_source_locations: { code: 6004, category: ts.DiagnosticCategory.Message, key: "Specify_the_location_where_debugger_should_locate_TypeScript_files_instead_of_source_locations_6004", message: "Specify the location where debugger should locate TypeScript files instead of source locations." }, Watch_input_files: { code: 6005, category: ts.DiagnosticCategory.Message, key: "Watch_input_files_6005", message: "Watch input files." }, Redirect_output_structure_to_the_directory: { code: 6006, category: ts.DiagnosticCategory.Message, key: "Redirect_output_structure_to_the_directory_6006", message: "Redirect output structure to the directory." }, Do_not_erase_const_enum_declarations_in_generated_code: { code: 6007, category: ts.DiagnosticCategory.Message, key: "Do_not_erase_const_enum_declarations_in_generated_code_6007", message: "Do not erase const enum declarations in generated code." }, @@ -1839,7 +1912,7 @@ var ts; Do_not_emit_comments_to_output: { code: 6009, category: ts.DiagnosticCategory.Message, key: "Do_not_emit_comments_to_output_6009", message: "Do not emit comments to output." }, 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." }, - Specify_ECMAScript_target_version_Colon_ES3_default_ES5_or_ES2015_experimental: { code: 6015, category: ts.DiagnosticCategory.Message, key: "Specify_ECMAScript_target_version_Colon_ES3_default_ES5_or_ES2015_experimental_6015", message: "Specify ECMAScript target version: 'ES3' (default), 'ES5', or 'ES2015' (experimental)" }, + 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_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." }, @@ -1861,8 +1934,7 @@ var ts; 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." }, Unterminated_quoted_string_in_response_file_0: { code: 6045, category: ts.DiagnosticCategory.Error, key: "Unterminated_quoted_string_in_response_file_0_6045", message: "Unterminated quoted string in response file '{0}'." }, - Argument_for_module_option_must_be_commonjs_amd_system_umd_es2015_or_none: { code: 6046, category: ts.DiagnosticCategory.Error, key: "Argument_for_module_option_must_be_commonjs_amd_system_umd_es2015_or_none_6046", message: "Argument for '--module' option must be 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'none'." }, - Argument_for_target_option_must_be_ES3_ES5_or_ES2015: { code: 6047, category: ts.DiagnosticCategory.Error, key: "Argument_for_target_option_must_be_ES3_ES5_or_ES2015_6047", message: "Argument for '--target' option must be 'ES3', 'ES5', or 'ES2015'." }, + Argument_for_0_option_must_be_Colon_1: { code: 6046, category: ts.DiagnosticCategory.Error, key: "Argument_for_0_option_must_be_Colon_1_6046", message: "Argument for '{0}' option must be: {1}" }, Locale_must_be_of_the_form_language_or_language_territory_For_example_0_or_1: { code: 6048, category: ts.DiagnosticCategory.Error, key: "Locale_must_be_of_the_form_language_or_language_territory_For_example_0_or_1_6048", message: "Locale must be of the form or -. For example '{0}' or '{1}'." }, Unsupported_locale_0: { code: 6049, category: ts.DiagnosticCategory.Error, key: "Unsupported_locale_0_6049", message: "Unsupported locale '{0}'." }, Unable_to_open_file_0: { code: 6050, category: ts.DiagnosticCategory.Error, key: "Unable_to_open_file_0_6050", message: "Unable to open file '{0}'." }, @@ -1872,17 +1944,15 @@ var ts; File_0_has_unsupported_extension_The_only_supported_extensions_are_1: { code: 6054, category: ts.DiagnosticCategory.Error, key: "File_0_has_unsupported_extension_The_only_supported_extensions_are_1_6054", message: "File '{0}' has unsupported extension. The only supported extensions are {1}." }, Suppress_noImplicitAny_errors_for_indexing_objects_lacking_index_signatures: { code: 6055, category: ts.DiagnosticCategory.Message, key: "Suppress_noImplicitAny_errors_for_indexing_objects_lacking_index_signatures_6055", message: "Suppress noImplicitAny errors for indexing objects lacking index signatures." }, Do_not_emit_declarations_for_code_that_has_an_internal_annotation: { code: 6056, category: ts.DiagnosticCategory.Message, key: "Do_not_emit_declarations_for_code_that_has_an_internal_annotation_6056", message: "Do not emit declarations for code that has an '@internal' annotation." }, - Specifies_the_root_directory_of_input_files_Use_to_control_the_output_directory_structure_with_outDir: { code: 6058, category: ts.DiagnosticCategory.Message, key: "Specifies_the_root_directory_of_input_files_Use_to_control_the_output_directory_structure_with_outDi_6058", message: "Specifies the root directory of input files. Use to control the output directory structure with --outDir." }, + Specify_the_root_directory_of_input_files_Use_to_control_the_output_directory_structure_with_outDir: { code: 6058, category: ts.DiagnosticCategory.Message, key: "Specify_the_root_directory_of_input_files_Use_to_control_the_output_directory_structure_with_outDir_6058", message: "Specify the root directory of input files. Use to control the output directory structure with --outDir." }, File_0_is_not_under_rootDir_1_rootDir_is_expected_to_contain_all_source_files: { code: 6059, category: ts.DiagnosticCategory.Error, key: "File_0_is_not_under_rootDir_1_rootDir_is_expected_to_contain_all_source_files_6059", message: "File '{0}' is not under 'rootDir' '{1}'. 'rootDir' is expected to contain all source files." }, - Specifies_the_end_of_line_sequence_to_be_used_when_emitting_files_Colon_CRLF_dos_or_LF_unix: { code: 6060, category: ts.DiagnosticCategory.Message, key: "Specifies_the_end_of_line_sequence_to_be_used_when_emitting_files_Colon_CRLF_dos_or_LF_unix_6060", message: "Specifies the end of line sequence to be used when emitting files: 'CRLF' (dos) or 'LF' (unix)." }, + Specify_the_end_of_line_sequence_to_be_used_when_emitting_files_Colon_CRLF_dos_or_LF_unix: { code: 6060, category: ts.DiagnosticCategory.Message, key: "Specify_the_end_of_line_sequence_to_be_used_when_emitting_files_Colon_CRLF_dos_or_LF_unix_6060", message: "Specify the end of line sequence to be used when emitting files: 'CRLF' (dos) or 'LF' (unix)." }, NEWLINE: { code: 6061, category: ts.DiagnosticCategory.Message, key: "NEWLINE_6061", message: "NEWLINE" }, - Argument_for_newLine_option_must_be_CRLF_or_LF: { code: 6062, category: ts.DiagnosticCategory.Error, key: "Argument_for_newLine_option_must_be_CRLF_or_LF_6062", message: "Argument for '--newLine' option must be 'CRLF' or 'LF'." }, - Argument_for_moduleResolution_option_must_be_node_or_classic: { code: 6063, category: ts.DiagnosticCategory.Error, key: "Argument_for_moduleResolution_option_must_be_node_or_classic_6063", message: "Argument for '--moduleResolution' option must be 'node' or 'classic'." }, Option_0_can_only_be_specified_in_tsconfig_json_file: { code: 6064, category: ts.DiagnosticCategory.Error, key: "Option_0_can_only_be_specified_in_tsconfig_json_file_6064", message: "Option '{0}' can only be specified in 'tsconfig.json' file." }, Enables_experimental_support_for_ES7_decorators: { code: 6065, category: ts.DiagnosticCategory.Message, key: "Enables_experimental_support_for_ES7_decorators_6065", message: "Enables experimental support for ES7 decorators." }, Enables_experimental_support_for_emitting_type_metadata_for_decorators: { code: 6066, category: ts.DiagnosticCategory.Message, key: "Enables_experimental_support_for_emitting_type_metadata_for_decorators_6066", message: "Enables experimental support for emitting type metadata for decorators." }, Enables_experimental_support_for_ES7_async_functions: { code: 6068, category: ts.DiagnosticCategory.Message, key: "Enables_experimental_support_for_ES7_async_functions_6068", message: "Enables experimental support for ES7 async functions." }, - Specifies_module_resolution_strategy_Colon_node_Node_js_or_classic_TypeScript_pre_1_6: { code: 6069, category: ts.DiagnosticCategory.Message, key: "Specifies_module_resolution_strategy_Colon_node_Node_js_or_classic_TypeScript_pre_1_6_6069", message: "Specifies module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6)." }, + Specify_module_resolution_strategy_Colon_node_Node_js_or_classic_TypeScript_pre_1_6: { code: 6069, category: ts.DiagnosticCategory.Message, key: "Specify_module_resolution_strategy_Colon_node_Node_js_or_classic_TypeScript_pre_1_6_6069", message: "Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6)." }, Initializes_a_TypeScript_project_and_creates_a_tsconfig_json_file: { code: 6070, category: ts.DiagnosticCategory.Message, key: "Initializes_a_TypeScript_project_and_creates_a_tsconfig_json_file_6070", message: "Initializes a TypeScript project and creates a tsconfig.json file." }, Successfully_created_a_tsconfig_json_file: { code: 6071, category: ts.DiagnosticCategory.Message, key: "Successfully_created_a_tsconfig_json_file_6071", message: "Successfully created a tsconfig.json file." }, Suppress_excess_property_checks_for_object_literals: { code: 6072, category: ts.DiagnosticCategory.Message, key: "Suppress_excess_property_checks_for_object_literals_6072", message: "Suppress excess property checks for object literals." }, @@ -1892,12 +1962,12 @@ var ts; Report_errors_for_fallthrough_cases_in_switch_statement: { code: 6076, category: ts.DiagnosticCategory.Message, key: "Report_errors_for_fallthrough_cases_in_switch_statement_6076", message: "Report errors for fallthrough cases in switch statement." }, Do_not_report_errors_on_unreachable_code: { code: 6077, category: ts.DiagnosticCategory.Message, key: "Do_not_report_errors_on_unreachable_code_6077", message: "Do not report errors on unreachable code." }, 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'" }, - Argument_for_jsx_must_be_preserve_or_react: { code: 6081, category: ts.DiagnosticCategory.Message, key: "Argument_for_jsx_must_be_preserve_or_react_6081", message: "Argument for '--jsx' must be 'preserve' or 'react'." }, 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." }, - Specifies_the_object_invoked_for_createElement_and_spread_when_targeting_react_JSX_emit: { code: 6084, category: ts.DiagnosticCategory.Message, key: "Specifies_the_object_invoked_for_createElement_and_spread_when_targeting_react_JSX_emit_6084", message: "Specifies the object invoked for createElement and __spread when targeting 'react' JSX emit" }, - Enable_tracing_of_the_module_resolution_process: { code: 6085, category: ts.DiagnosticCategory.Message, key: "Enable_tracing_of_the_module_resolution_process_6085", message: "Enable tracing of the module resolution process." }, + 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" }, + Enable_tracing_of_the_name_resolution_process: { code: 6085, category: ts.DiagnosticCategory.Message, key: "Enable_tracing_of_the_name_resolution_process_6085", message: "Enable tracing of the name resolution process." }, Resolving_module_0_from_1: { code: 6086, category: ts.DiagnosticCategory.Message, key: "Resolving_module_0_from_1_6086", message: "======== Resolving module '{0}' from '{1}'. ========" }, Explicitly_specified_module_resolution_kind_Colon_0: { code: 6087, category: ts.DiagnosticCategory.Message, key: "Explicitly_specified_module_resolution_kind_Colon_0_6087", message: "Explicitly specified module resolution kind: '{0}'." }, Module_resolution_kind_is_not_specified_using_0: { code: 6088, category: ts.DiagnosticCategory.Message, key: "Module_resolution_kind_is_not_specified_using_0_6088", message: "Module resolution kind is not specified, using '{0}'." }, @@ -1909,15 +1979,15 @@ var ts; Resolving_module_name_0_relative_to_base_url_1_2: { code: 6094, category: ts.DiagnosticCategory.Message, key: "Resolving_module_name_0_relative_to_base_url_1_2_6094", message: "Resolving module name '{0}' relative to base url '{1}' - '{2}'." }, Loading_module_as_file_Slash_folder_candidate_module_location_0: { code: 6095, category: ts.DiagnosticCategory.Message, key: "Loading_module_as_file_Slash_folder_candidate_module_location_0_6095", message: "Loading module as file / folder, candidate module location '{0}'." }, File_0_does_not_exist: { code: 6096, category: ts.DiagnosticCategory.Message, key: "File_0_does_not_exist_6096", message: "File '{0}' does not exist." }, - File_0_exist_use_it_as_a_module_resolution_result: { code: 6097, category: ts.DiagnosticCategory.Message, key: "File_0_exist_use_it_as_a_module_resolution_result_6097", message: "File '{0}' exist - use it as a module resolution result." }, + 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_typings_field: { code: 6100, category: ts.DiagnosticCategory.Message, key: "package_json_does_not_have_typings_field_6100", message: "'package.json' does not have 'typings' field." }, - package_json_has_typings_field_0_that_references_1: { code: 6101, category: ts.DiagnosticCategory.Message, key: "package_json_has_typings_field_0_that_references_1_6101", message: "'package.json' has 'typings' field '{0}' that references '{1}'." }, + 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_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." }, Checking_if_0_is_the_longest_matching_prefix_for_1_2: { code: 6104, category: ts.DiagnosticCategory.Message, key: "Checking_if_0_is_the_longest_matching_prefix_for_1_2_6104", message: "Checking if '{0}' is the longest matching prefix for '{1}' - '{2}'." }, - Expected_type_of_typings_field_in_package_json_to_be_string_got_0: { code: 6105, category: ts.DiagnosticCategory.Message, key: "Expected_type_of_typings_field_in_package_json_to_be_string_got_0_6105", message: "Expected type of 'typings' field in 'package.json' to be 'string', got '{0}'." }, + Expected_type_of_0_field_in_package_json_to_be_string_got_1: { code: 6105, category: ts.DiagnosticCategory.Message, key: "Expected_type_of_0_field_in_package_json_to_be_string_got_1_6105", message: "Expected type of '{0}' field in 'package.json' to be 'string', got '{1}'." }, baseUrl_option_is_set_to_0_using_this_value_to_resolve_non_relative_module_name_1: { code: 6106, category: ts.DiagnosticCategory.Message, key: "baseUrl_option_is_set_to_0_using_this_value_to_resolve_non_relative_module_name_1_6106", message: "'baseUrl' option is set to '{0}', using this value to resolve non-relative module name '{1}'" }, rootDirs_option_is_set_using_it_to_resolve_relative_module_name_0: { code: 6107, category: ts.DiagnosticCategory.Message, key: "rootDirs_option_is_set_using_it_to_resolve_relative_module_name_0_6107", message: "'rootDirs' option is set, using it to resolve relative module name '{0}'" }, Longest_matching_prefix_for_0_is_1: { code: 6108, category: ts.DiagnosticCategory.Message, key: "Longest_matching_prefix_for_0_is_1_6108", message: "Longest matching prefix for '{0}' is '{1}'" }, @@ -1925,6 +1995,22 @@ var ts; Trying_other_entries_in_rootDirs: { code: 6110, category: ts.DiagnosticCategory.Message, key: "Trying_other_entries_in_rootDirs_6110", message: "Trying other entries in 'rootDirs'" }, Module_resolution_using_rootDirs_has_failed: { code: 6111, category: ts.DiagnosticCategory.Message, key: "Module_resolution_using_rootDirs_has_failed_6111", message: "Module resolution using 'rootDirs' has failed" }, Do_not_emit_use_strict_directives_in_module_output: { code: 6112, category: ts.DiagnosticCategory.Message, key: "Do_not_emit_use_strict_directives_in_module_output_6112", message: "Do not emit 'use strict' directives in module output." }, + Enable_strict_null_checks: { code: 6113, category: ts.DiagnosticCategory.Message, key: "Enable_strict_null_checks_6113", message: "Enable strict null checks." }, + Unknown_option_excludes_Did_you_mean_exclude: { code: 6114, category: ts.DiagnosticCategory.Error, key: "Unknown_option_excludes_Did_you_mean_exclude_6114", message: "Unknown option 'excludes'. Did you mean 'exclude'?" }, + Raise_error_on_this_expressions_with_an_implied_any_type: { code: 6115, category: ts.DiagnosticCategory.Message, key: "Raise_error_on_this_expressions_with_an_implied_any_type_6115", message: "Raise error on 'this' expressions with an implied 'any' type." }, + Resolving_type_reference_directive_0_containing_file_1_root_directory_2: { code: 6116, category: ts.DiagnosticCategory.Message, key: "Resolving_type_reference_directive_0_containing_file_1_root_directory_2_6116", message: "======== Resolving type reference directive '{0}', containing file '{1}', root directory '{2}'. ========" }, + Resolving_using_primary_search_paths: { code: 6117, category: ts.DiagnosticCategory.Message, key: "Resolving_using_primary_search_paths_6117", message: "Resolving using primary search paths..." }, + Resolving_from_node_modules_folder: { code: 6118, category: ts.DiagnosticCategory.Message, key: "Resolving_from_node_modules_folder_6118", message: "Resolving from node_modules folder..." }, + Type_reference_directive_0_was_successfully_resolved_to_1_primary_Colon_2: { code: 6119, category: ts.DiagnosticCategory.Message, key: "Type_reference_directive_0_was_successfully_resolved_to_1_primary_Colon_2_6119", message: "======== Type reference directive '{0}' was successfully resolved to '{1}', primary: {2}. ========" }, + Type_reference_directive_0_was_not_resolved: { code: 6120, category: ts.DiagnosticCategory.Message, key: "Type_reference_directive_0_was_not_resolved_6120", message: "======== Type reference directive '{0}' was not resolved. ========" }, + Resolving_with_primary_search_path_0: { code: 6121, category: ts.DiagnosticCategory.Message, key: "Resolving_with_primary_search_path_0_6121", message: "Resolving with primary search path '{0}'" }, + Root_directory_cannot_be_determined_skipping_primary_search_paths: { code: 6122, category: ts.DiagnosticCategory.Message, key: "Root_directory_cannot_be_determined_skipping_primary_search_paths_6122", message: "Root directory cannot be determined, skipping primary search paths." }, + Resolving_type_reference_directive_0_containing_file_1_root_directory_not_set: { code: 6123, category: ts.DiagnosticCategory.Message, key: "Resolving_type_reference_directive_0_containing_file_1_root_directory_not_set_6123", message: "======== Resolving type reference directive '{0}', containing file '{1}', root directory not set. ========" }, + Type_declaration_files_to_be_included_in_compilation: { code: 6124, category: ts.DiagnosticCategory.Message, key: "Type_declaration_files_to_be_included_in_compilation_6124", message: "Type declaration files to be included in compilation." }, + Looking_up_in_node_modules_folder_initial_location_0: { code: 6125, category: ts.DiagnosticCategory.Message, key: "Looking_up_in_node_modules_folder_initial_location_0_6125", message: "Looking up in 'node_modules' folder, initial location '{0}'" }, + Containing_file_is_not_specified_and_root_directory_cannot_be_determined_skipping_lookup_in_node_modules_folder: { code: 6126, category: ts.DiagnosticCategory.Message, key: "Containing_file_is_not_specified_and_root_directory_cannot_be_determined_skipping_lookup_in_node_mod_6126", message: "Containing file is not specified and root directory cannot be determined, skipping lookup in 'node_modules' folder." }, + Resolving_type_reference_directive_0_containing_file_not_set_root_directory_1: { code: 6127, category: ts.DiagnosticCategory.Message, key: "Resolving_type_reference_directive_0_containing_file_not_set_root_directory_1_6127", message: "======== Resolving type reference directive '{0}', containing file not set, root directory '{1}'. ========" }, + Resolving_type_reference_directive_0_containing_file_not_set_root_directory_not_set: { code: 6128, category: ts.DiagnosticCategory.Message, key: "Resolving_type_reference_directive_0_containing_file_not_set_root_directory_not_set_6128", message: "======== Resolving type reference directive '{0}', containing file not set, root directory not set. ========" }, 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." }, @@ -1947,6 +2033,7 @@ var ts; Unused_label: { code: 7028, category: ts.DiagnosticCategory.Error, key: "Unused_label_7028", message: "Unused label." }, 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." }, 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." }, @@ -1974,7 +2061,8 @@ var ts; An_unary_expression_with_the_0_operator_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_expression_Consider_enclosing_the_expression_in_parentheses: { code: 17006, category: ts.DiagnosticCategory.Error, key: "An_unary_expression_with_the_0_operator_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_ex_17006", message: "An unary expression with the '{0}' operator is not allowed in the left-hand side of an exponentiation expression. Consider enclosing the expression in parentheses." }, 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." } + 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}'." } }; })(ts || (ts = {})); var ts; @@ -2007,7 +2095,7 @@ var ts; "false": 84, "finally": 85, "for": 86, - "from": 134, + "from": 135, "function": 87, "get": 123, "if": 88, @@ -2029,7 +2117,7 @@ var ts; "public": 112, "readonly": 127, "require": 128, - "global": 135, + "global": 136, "return": 94, "set": 130, "static": 113, @@ -2043,6 +2131,7 @@ var ts; "try": 100, "type": 133, "typeof": 101, + "undefined": 134, "var": 102, "void": 103, "while": 104, @@ -2050,7 +2139,7 @@ var ts; "yield": 114, "async": 118, "await": 119, - "of": 136, + "of": 137, "{": 15, "}": 16, "(": 17, @@ -3313,7 +3402,7 @@ var ts; break; } } - return token = 240; + return token = 243; } function scanJsxIdentifier() { if (tokenIsIdentifierOrKeyword(token)) { @@ -3467,6 +3556,12 @@ var ts; type: "boolean", description: ts.Diagnostics.Generates_corresponding_d_ts_file }, + { + name: "declarationDir", + type: "string", + isFilePath: true, + paramType: ts.Diagnostics.DIRECTORY + }, { name: "diagnostics", type: "boolean" @@ -3501,13 +3596,12 @@ var ts; "react": 2 }, paramType: ts.Diagnostics.KIND, - description: ts.Diagnostics.Specify_JSX_code_generation_Colon_preserve_or_react, - error: ts.Diagnostics.Argument_for_jsx_must_be_preserve_or_react + description: ts.Diagnostics.Specify_JSX_code_generation_Colon_preserve_or_react }, { name: "reactNamespace", type: "string", - description: ts.Diagnostics.Specifies_the_object_invoked_for_createElement_and_spread_when_targeting_react_JSX_emit + description: ts.Diagnostics.Specify_the_object_invoked_for_createElement_and_spread_when_targeting_react_JSX_emit }, { name: "listFiles", @@ -3521,7 +3615,7 @@ var ts; name: "mapRoot", type: "string", isFilePath: true, - description: ts.Diagnostics.Specifies_the_location_where_debugger_should_locate_map_files_instead_of_generated_locations, + description: ts.Diagnostics.Specify_the_location_where_debugger_should_locate_map_files_instead_of_generated_locations, paramType: ts.Diagnostics.LOCATION }, { @@ -3537,8 +3631,7 @@ var ts; "es2015": ts.ModuleKind.ES2015 }, description: ts.Diagnostics.Specify_module_code_generation_Colon_commonjs_amd_system_umd_or_es2015, - paramType: ts.Diagnostics.KIND, - error: ts.Diagnostics.Argument_for_module_option_must_be_commonjs_amd_system_umd_es2015_or_none + paramType: ts.Diagnostics.KIND }, { name: "newLine", @@ -3546,9 +3639,8 @@ var ts; "crlf": 0, "lf": 1 }, - description: ts.Diagnostics.Specifies_the_end_of_line_sequence_to_be_used_when_emitting_files_Colon_CRLF_dos_or_LF_unix, - paramType: ts.Diagnostics.NEWLINE, - error: ts.Diagnostics.Argument_for_newLine_option_must_be_CRLF_or_LF + 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 }, { name: "noEmit", @@ -3569,6 +3661,11 @@ var ts; type: "boolean", 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 + }, { name: "noLib", type: "boolean" @@ -3608,7 +3705,6 @@ var ts; }, { name: "pretty", - paramType: ts.Diagnostics.KIND, description: ts.Diagnostics.Stylize_errors_and_messages_using_color_and_context_experimental, type: "boolean" }, @@ -3629,8 +3725,8 @@ var ts; name: "rootDir", type: "string", isFilePath: true, - description: ts.Diagnostics.Specifies_the_root_directory_of_input_files_Use_to_control_the_output_directory_structure_with_outDir, - paramType: ts.Diagnostics.LOCATION + paramType: ts.Diagnostics.LOCATION, + description: ts.Diagnostics.Specify_the_root_directory_of_input_files_Use_to_control_the_output_directory_structure_with_outDir }, { name: "isolatedModules", @@ -3645,7 +3741,7 @@ var ts; name: "sourceRoot", type: "string", isFilePath: true, - description: ts.Diagnostics.Specifies_the_location_where_debugger_should_locate_TypeScript_files_instead_of_source_locations, + description: ts.Diagnostics.Specify_the_location_where_debugger_should_locate_TypeScript_files_instead_of_source_locations, paramType: ts.Diagnostics.LOCATION }, { @@ -3674,9 +3770,8 @@ var ts; "es6": 2, "es2015": 2 }, - description: ts.Diagnostics.Specify_ECMAScript_target_version_Colon_ES3_default_ES5_or_ES2015_experimental, - paramType: ts.Diagnostics.VERSION, - error: ts.Diagnostics.Argument_for_target_option_must_be_ES3_ES5_or_ES2015 + description: ts.Diagnostics.Specify_ECMAScript_target_version_Colon_ES3_default_ES5_or_ES2015, + paramType: ts.Diagnostics.VERSION }, { name: "version", @@ -3707,8 +3802,7 @@ var ts; "node": ts.ModuleResolutionKind.NodeJs, "classic": ts.ModuleResolutionKind.Classic }, - description: ts.Diagnostics.Specifies_module_resolution_strategy_Colon_node_Node_js_or_classic_TypeScript_pre_1_6, - error: ts.Diagnostics.Argument_for_moduleResolution_option_must_be_node_or_classic + description: ts.Diagnostics.Specify_module_resolution_strategy_Colon_node_Node_js_or_classic_TypeScript_pre_1_6 }, { name: "allowUnusedLabels", @@ -3748,14 +3842,41 @@ var ts; }, { name: "rootDirs", - type: "object", + type: "list", isTSConfigOnly: true, - isFilePath: true + element: { + name: "rootDirs", + type: "string", + isFilePath: true + } }, { - name: "traceModuleResolution", + name: "typesSearchPaths", + type: "list", + isTSConfigOnly: true, + element: { + name: "typesSearchPaths", + type: "string", + isFilePath: true + } + }, + { + name: "typesRoot", + type: "string" + }, + { + name: "types", + type: "list", + element: { + name: "types", + type: "string" + }, + description: ts.Diagnostics.Type_declaration_files_to_be_included_in_compilation + }, + { + name: "traceResolution", type: "boolean", - description: ts.Diagnostics.Enable_tracing_of_the_module_resolution_process + description: ts.Diagnostics.Enable_tracing_of_the_name_resolution_process }, { name: "allowJs", @@ -3771,6 +3892,65 @@ var ts; name: "noImplicitUseStrict", type: "boolean", description: ts.Diagnostics.Do_not_emit_use_strict_directives_in_module_output + }, + { + name: "listEmittedFiles", + type: "boolean" + }, + { + name: "lib", + type: "list", + element: { + name: "lib", + type: { + "es5": "lib.es5.d.ts", + "es6": "lib.es2015.d.ts", + "es2015": "lib.es2015.d.ts", + "es7": "lib.es2016.d.ts", + "es2016": "lib.es2016.d.ts", + "dom": "lib.dom.d.ts", + "webworker": "lib.webworker.d.ts", + "scripthost": "lib.scripthost.d.ts", + "es2015.core": "lib.es2015.core.d.ts", + "es2015.collection": "lib.es2015.collection.d.ts", + "es2015.generator": "lib.es2015.generator.d.ts", + "es2015.iterable": "lib.es2015.iterable.d.ts", + "es2015.promise": "lib.es2015.promise.d.ts", + "es2015.proxy": "lib.es2015.proxy.d.ts", + "es2015.reflect": "lib.es2015.reflect.d.ts", + "es2015.symbol": "lib.es2015.symbol.d.ts", + "es2015.symbol.wellknown": "lib.es2015.symbol.wellknown.d.ts", + "es2016.array.include": "lib.es2016.array.include.d.ts" + } + }, + description: ts.Diagnostics.Specify_library_files_to_be_included_in_the_compilation_Colon + }, + { + name: "strictNullChecks", + type: "boolean", + description: ts.Diagnostics.Enable_strict_null_checks + } + ]; + ts.typingOptionDeclarations = [ + { + name: "enableAutoDiscovery", + type: "boolean" + }, + { + name: "include", + type: "list", + element: { + name: "include", + type: "string" + } + }, + { + name: "exclude", + type: "list", + element: { + name: "exclude", + type: "string" + } } ]; var optionNameMapCache; @@ -3790,6 +3970,37 @@ var ts; return optionNameMapCache; } ts.getOptionNameMap = getOptionNameMap; + function createCompilerDiagnosticForInvalidCustomType(opt) { + var namesOfType = []; + ts.forEachKey(opt.type, function (key) { + namesOfType.push(" '" + key + "'"); + }); + return ts.createCompilerDiagnostic(ts.Diagnostics.Argument_for_0_option_must_be_Colon_1, "--" + opt.name, namesOfType); + } + ts.createCompilerDiagnosticForInvalidCustomType = createCompilerDiagnosticForInvalidCustomType; + function parseCustomTypeOption(opt, value, errors) { + var key = (value || "").trim().toLowerCase(); + var map = opt.type; + if (ts.hasProperty(map, key)) { + return map[key]; + } + else { + errors.push(createCompilerDiagnosticForInvalidCustomType(opt)); + } + } + ts.parseCustomTypeOption = parseCustomTypeOption; + function parseListTypeOption(opt, value, errors) { + var values = (value || "").trim().split(","); + switch (opt.element.type) { + case "number": + return ts.map(values, parseInt); + case "string": + return ts.map(values, function (v) { return v || ""; }); + default: + return ts.filter(ts.map(values, function (v) { return parseCustomTypeOption(opt.element, v, errors); }), function (v) { return !!v; }); + } + } + ts.parseListTypeOption = parseListTypeOption; function parseCommandLine(commandLine, readFile) { var options = {}; var fileNames = []; @@ -3835,16 +4046,14 @@ var ts; options[opt.name] = args[i] || ""; i++; break; - default: - var map_1 = opt.type; - var key = (args[i] || "").toLowerCase(); + case "list": + options[opt.name] = parseListTypeOption(opt, args[i], errors); i++; - if (ts.hasProperty(map_1, key)) { - options[opt.name] = map_1[key]; - } - else { - errors.push(ts.createCompilerDiagnostic(opt.error)); - } + break; + default: + options[opt.name] = parseCustomTypeOption(opt, args[i], errors); + i++; + break; } } } @@ -3933,17 +4142,22 @@ var ts; } function parseJsonConfigFileContent(json, host, basePath, existingOptions, configFileName) { if (existingOptions === void 0) { existingOptions = {}; } - var _a = convertCompilerOptionsFromJson(json["compilerOptions"], basePath, configFileName), optionsFromJsonConfigFile = _a.options, errors = _a.errors; - var options = ts.extend(existingOptions, optionsFromJsonConfigFile); + var errors = []; + var compilerOptions = convertCompilerOptionsFromJsonWorker(json["compilerOptions"], basePath, errors, configFileName); + var options = ts.extend(existingOptions, compilerOptions); + var typingOptions = convertTypingOptionsFromJsonWorker(json["typingOptions"], basePath, errors, configFileName); + options.configFilePath = configFileName; + var fileNames = getFileNames(errors); return { options: options, - fileNames: getFileNames(), + fileNames: fileNames, + typingOptions: typingOptions, errors: errors }; - function getFileNames() { + function getFileNames(errors) { var fileNames = []; if (ts.hasProperty(json, "files")) { - if (json["files"] instanceof Array) { + if (ts.isArray(json["files"])) { fileNames = ts.map(json["files"], function (s) { return ts.combinePaths(basePath, s); }); } else { @@ -3953,7 +4167,7 @@ var ts; else { var filesSeen = {}; var exclude = []; - if (json["exclude"] instanceof Array) { + if (ts.isArray(json["exclude"])) { exclude = json["exclude"]; } else { @@ -3988,85 +4202,88 @@ var ts; } } } + if (ts.hasProperty(json, "excludes") && !ts.hasProperty(json, "exclude")) { + errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Unknown_option_excludes_Did_you_mean_exclude)); + } return fileNames; } } ts.parseJsonConfigFileContent = parseJsonConfigFileContent; function convertCompilerOptionsFromJson(jsonOptions, basePath, configFileName) { - var options = {}; var errors = []; - if (configFileName && ts.getBaseFileName(configFileName) === "jsconfig.json") { - options.allowJs = true; - } - if (!jsonOptions) { - return { options: options, errors: errors }; - } - var optionNameMap = ts.arrayToMap(ts.optionDeclarations, function (opt) { return opt.name; }); - for (var id in jsonOptions) { - if (ts.hasProperty(optionNameMap, id)) { - var opt = optionNameMap[id]; - var optType = opt.type; - var value = jsonOptions[id]; - var expectedType = typeof optType === "string" ? optType : "string"; - if (typeof value === expectedType) { - if (typeof optType !== "string") { - var key = value.toLowerCase(); - if (ts.hasProperty(optType, key)) { - value = optType[key]; - } - else { - errors.push(ts.createCompilerDiagnostic(opt.error)); - value = 0; - } - } - if (opt.isFilePath) { - switch (typeof value) { - case "string": - value = ts.normalizePath(ts.combinePaths(basePath, value)); - break; - case "object": - var paths = []; - var invalidOptionType = false; - if (!ts.isArray(value)) { - invalidOptionType = true; - } - else { - for (var _i = 0, _a = value; _i < _a.length; _i++) { - var element = _a[_i]; - if (typeof element === "string") { - paths.push(ts.normalizePath(ts.combinePaths(basePath, element))); - } - else { - invalidOptionType = true; - break; - } - } - } - if (invalidOptionType) { - errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_should_have_array_of_strings_as_a_value, opt.name)); - } - else { - value = paths; - } - break; - } - if (value === "") { - value = "."; - } - } - options[opt.name] = value; - } - else { - errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Compiler_option_0_requires_a_value_of_type_1, id, expectedType)); - } - } - else { - errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Unknown_compiler_option_0, id)); - } - } + var options = convertCompilerOptionsFromJsonWorker(jsonOptions, basePath, errors, configFileName); return { options: options, errors: errors }; } ts.convertCompilerOptionsFromJson = convertCompilerOptionsFromJson; + function convertTypingOptionsFromJson(jsonOptions, basePath, configFileName) { + var errors = []; + var options = convertTypingOptionsFromJsonWorker(jsonOptions, basePath, errors, configFileName); + return { options: options, errors: errors }; + } + ts.convertTypingOptionsFromJson = convertTypingOptionsFromJson; + function convertCompilerOptionsFromJsonWorker(jsonOptions, basePath, errors, configFileName) { + var options = ts.getBaseFileName(configFileName) === "jsconfig.json" ? { allowJs: 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); + return options; + } + function convertOptionsFromJson(optionDeclarations, jsonOptions, basePath, defaultOptions, diagnosticMessage, errors) { + if (!jsonOptions) { + return; + } + var optionNameMap = ts.arrayToMap(optionDeclarations, function (opt) { return opt.name; }); + for (var id in jsonOptions) { + if (ts.hasProperty(optionNameMap, id)) { + var opt = optionNameMap[id]; + defaultOptions[opt.name] = convertJsonOption(opt, jsonOptions[id], basePath, errors); + } + else { + errors.push(ts.createCompilerDiagnostic(diagnosticMessage, id)); + } + } + } + function convertJsonOption(opt, value, basePath, errors) { + var optType = opt.type; + var expectedType = typeof optType === "string" ? optType : "string"; + if (optType === "list" && ts.isArray(value)) { + return convertJsonOptionOfListType(opt, value, basePath, errors); + } + else if (typeof value === expectedType) { + if (typeof optType !== "string") { + return convertJsonOptionOfCustomType(opt, value, errors); + } + else { + if (opt.isFilePath) { + value = ts.normalizePath(ts.combinePaths(basePath, value)); + if (value === "") { + value = "."; + } + } + } + return value; + } + else { + errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Compiler_option_0_requires_a_value_of_type_1, opt.name, expectedType)); + } + } + function convertJsonOptionOfCustomType(opt, value, errors) { + var key = value.toLowerCase(); + if (ts.hasProperty(opt.type, key)) { + return opt.type[key]; + } + else { + errors.push(createCompilerDiagnosticForInvalidCustomType(opt)); + } + } + function convertJsonOptionOfListType(option, values, basePath, errors) { + return ts.filter(ts.map(values, function (v) { return convertJsonOption(option.element, v, basePath, errors); }), function (v) { return !!v; }); + } })(ts || (ts = {})); var ts; (function (ts) { @@ -4148,6 +4365,38 @@ var ts; sourceFile.resolvedModules[moduleNameText] = resolvedModule; } ts.setResolvedModule = setResolvedModule; + function setResolvedTypeReferenceDirective(sourceFile, typeReferenceDirectiveName, resolvedTypeReferenceDirective) { + if (!sourceFile.resolvedTypeReferenceDirectiveNames) { + sourceFile.resolvedTypeReferenceDirectiveNames = {}; + } + sourceFile.resolvedTypeReferenceDirectiveNames[typeReferenceDirectiveName] = resolvedTypeReferenceDirective; + } + ts.setResolvedTypeReferenceDirective = setResolvedTypeReferenceDirective; + function moduleResolutionIsEqualTo(oldResolution, newResolution) { + return oldResolution.resolvedFileName === newResolution.resolvedFileName && oldResolution.isExternalLibraryImport === newResolution.isExternalLibraryImport; + } + ts.moduleResolutionIsEqualTo = moduleResolutionIsEqualTo; + function typeDirectiveIsEqualTo(oldResolution, newResolution) { + return oldResolution.resolvedFileName === newResolution.resolvedFileName && oldResolution.primary === newResolution.primary; + } + ts.typeDirectiveIsEqualTo = typeDirectiveIsEqualTo; + function hasChangesInResolutions(names, newResolutions, oldResolutions, comparer) { + if (names.length !== newResolutions.length) { + return false; + } + for (var i = 0; i < names.length; i++) { + var newResolution = newResolutions[i]; + var oldResolution = oldResolutions && ts.hasProperty(oldResolutions, names[i]) ? oldResolutions[names[i]] : undefined; + var changed = oldResolution + ? !newResolution || !comparer(oldResolution, newResolution) + : newResolution; + if (changed) { + return true; + } + } + return false; + } + ts.hasChangesInResolutions = hasChangesInResolutions; function containsParseError(node) { aggregateChildData(node); return (node.flags & 268435456) !== 0; @@ -4164,7 +4413,7 @@ var ts; } } function getSourceFileOfNode(node) { - while (node && node.kind !== 252) { + while (node && node.kind !== 255) { node = node.parent; } return node; @@ -4172,11 +4421,11 @@ var ts; ts.getSourceFileOfNode = getSourceFileOfNode; function isStatementWithLocals(node) { switch (node.kind) { - case 196: - case 224: - case 203: - case 204: + case 198: + case 226: case 205: + case 206: + case 207: return true; } return false; @@ -4197,6 +4446,25 @@ var ts; return node.pos; } ts.getStartPosOfNode = getStartPosOfNode; + function getEndLinePosition(line, sourceFile) { + ts.Debug.assert(line >= 0); + var lineStarts = ts.getLineStarts(sourceFile); + var lineIndex = line; + var sourceText = sourceFile.text; + if (lineIndex + 1 === lineStarts.length) { + return sourceText.length - 1; + } + else { + var start = lineStarts[lineIndex]; + var pos = lineStarts[lineIndex + 1] - 1; + ts.Debug.assert(ts.isLineBreak(sourceText.charCodeAt(pos))); + while (start <= pos && ts.isLineBreak(sourceText.charCodeAt(pos))) { + pos--; + } + return pos; + } + } + ts.getEndLinePosition = getEndLinePosition; function nodeIsMissing(node) { if (!node) { return true; @@ -4261,13 +4529,13 @@ var ts; } ts.isBlockOrCatchScoped = isBlockOrCatchScoped; function isAmbientModule(node) { - return node && node.kind === 222 && + return node && node.kind === 224 && (node.name.kind === 9 || isGlobalScopeAugmentation(node)); } ts.isAmbientModule = isAmbientModule; function isBlockScopedContainerTopLevel(node) { - return node.kind === 252 || - node.kind === 222 || + return node.kind === 255 || + node.kind === 224 || isFunctionLike(node) || isFunctionBlock(node); } @@ -4281,10 +4549,10 @@ var ts; return false; } switch (node.parent.kind) { - case 252: - return isExternalModule(node.parent); - case 223: - return isAmbientModule(node.parent.parent) && !isExternalModule(node.parent.parent.parent); + case 255: + return ts.isExternalModule(node.parent); + case 225: + return isAmbientModule(node.parent.parent) && !ts.isExternalModule(node.parent.parent.parent); } return false; } @@ -4296,15 +4564,15 @@ var ts; return current; } switch (current.kind) { - case 252: + case 255: + case 226: + case 251: case 224: - case 248: - case 222: - case 203: - case 204: case 205: + case 206: + case 207: return current; - case 196: + case 198: if (!isFunctionLike(current.parent)) { return current; } @@ -4315,9 +4583,9 @@ var ts; ts.getEnclosingBlockScopeContainer = getEnclosingBlockScopeContainer; function isCatchClauseVariableDeclaration(declaration) { return declaration && - declaration.kind === 215 && + declaration.kind === 217 && declaration.parent && - declaration.parent.kind === 248; + declaration.parent.kind === 251; } ts.isCatchClauseVariableDeclaration = isCatchClauseVariableDeclaration; function declarationNameToString(name) { @@ -4350,31 +4618,44 @@ var ts; return ts.createTextSpanFromBounds(start, scanner.getTextPos()); } ts.getSpanOfTokenAtPosition = getSpanOfTokenAtPosition; + function getErrorSpanForArrowFunction(sourceFile, node) { + var pos = ts.skipTrivia(sourceFile.text, node.pos); + if (node.body && node.body.kind === 198) { + var startLine = ts.getLineAndCharacterOfPosition(sourceFile, node.body.pos).line; + var endLine = ts.getLineAndCharacterOfPosition(sourceFile, node.body.end).line; + if (startLine < endLine) { + return ts.createTextSpan(pos, getEndLinePosition(startLine, sourceFile) - pos + 1); + } + } + return ts.createTextSpanFromBounds(pos, node.end); + } function getErrorSpanForNode(sourceFile, node) { var errorNode = node; switch (node.kind) { - case 252: + case 255: var pos_1 = ts.skipTrivia(sourceFile.text, 0, false); if (pos_1 === sourceFile.text.length) { return ts.createTextSpan(0, 0); } return getSpanOfTokenAtPosition(sourceFile, pos_1); - case 215: - case 167: - case 218: - case 190: - case 219: - case 222: - case 221: - case 251: case 217: - case 177: - case 145: - case 147: - case 148: + case 168: case 220: + case 191: + case 221: + case 224: + case 223: + case 254: + case 219: + case 178: + case 146: + case 148: + case 149: + case 222: errorNode = node.name; break; + case 179: + return getErrorSpanForArrowFunction(sourceFile, node); } if (errorNode === undefined) { return getSpanOfTokenAtPosition(sourceFile, node.pos); @@ -4385,10 +4666,6 @@ var ts; return ts.createTextSpanFromBounds(pos, errorNode.end); } ts.getErrorSpanForNode = getErrorSpanForNode; - function isExternalModule(file) { - return file.externalModuleIndicator !== undefined; - } - ts.isExternalModule = isExternalModule; function isExternalOrCommonJsModule(file) { return (file.externalModuleIndicator || file.commonJsModuleIndicator) !== undefined; } @@ -4398,11 +4675,11 @@ var ts; } ts.isDeclarationFile = isDeclarationFile; function isConstEnumDeclaration(node) { - return node.kind === 221 && isConst(node); + return node.kind === 223 && isConst(node); } ts.isConstEnumDeclaration = isConstEnumDeclaration; function walkUpBindingElementsAndPatterns(node) { - while (node && (node.kind === 167 || isBindingPattern(node))) { + while (node && (node.kind === 168 || isBindingPattern(node))) { node = node.parent; } return node; @@ -4410,14 +4687,14 @@ var ts; function getCombinedNodeFlags(node) { node = walkUpBindingElementsAndPatterns(node); var flags = node.flags; - if (node.kind === 215) { + if (node.kind === 217) { node = node.parent; } - if (node && node.kind === 216) { + if (node && node.kind === 218) { flags |= node.flags; node = node.parent; } - if (node && node.kind === 197) { + if (node && node.kind === 199) { flags |= node.flags; } return flags; @@ -4432,11 +4709,11 @@ var ts; } ts.isLet = isLet; function isSuperCallExpression(n) { - return n.kind === 172 && n.expression.kind === 95; + return n.kind === 173 && n.expression.kind === 95; } ts.isSuperCallExpression = isSuperCallExpression; function isPrologueDirective(node) { - return node.kind === 199 && node.expression.kind === 9; + return node.kind === 201 && node.expression.kind === 9; } ts.isPrologueDirective = isPrologueDirective; function getLeadingCommentRangesOfNode(node, sourceFileOfNode) { @@ -4452,7 +4729,7 @@ var ts; } ts.getJsDocComments = getJsDocComments; function getJsDocCommentsFromText(node, text) { - var commentRanges = (node.kind === 140 || node.kind === 139) ? + var commentRanges = (node.kind === 141 || node.kind === 140) ? ts.concatenate(ts.getTrailingCommentRanges(text, node.pos), ts.getLeadingCommentRanges(text, node.pos)) : getLeadingCommentRangesOfNodeFromText(node, text); return ts.filter(commentRanges, isJsDocComment); @@ -4464,9 +4741,10 @@ var ts; } ts.getJsDocCommentsFromText = getJsDocCommentsFromText; ts.fullTripleSlashReferencePathRegEx = /^(\/\/\/\s*/; + ts.fullTripleSlashReferenceTypeReferenceDirectiveRegEx = /^(\/\/\/\s*/; ts.fullTripleSlashAMDReferencePathRegEx = /^(\/\/\/\s*/; function isTypeNode(node) { - if (152 <= node.kind && node.kind <= 164) { + if (153 <= node.kind && node.kind <= 165) { return true; } switch (node.kind) { @@ -4475,58 +4753,59 @@ var ts; case 131: case 120: case 132: + case 134: return true; case 103: - return node.parent.kind !== 181; - case 192: + return node.parent.kind !== 182; + case 193: return !isExpressionWithTypeArgumentsInClassExtendsClause(node); case 69: - if (node.parent.kind === 137 && node.parent.right === node) { + if (node.parent.kind === 138 && node.parent.right === node) { node = node.parent; } - else if (node.parent.kind === 170 && node.parent.name === node) { + else if (node.parent.kind === 171 && node.parent.name === node) { node = node.parent; } - ts.Debug.assert(node.kind === 69 || node.kind === 137 || node.kind === 170, "'node' was expected to be a qualified name, identifier or property access in 'isTypeNode'."); - case 137: - case 170: + ts.Debug.assert(node.kind === 69 || node.kind === 138 || node.kind === 171, "'node' was expected to be a qualified name, identifier or property access in 'isTypeNode'."); + case 138: + case 171: case 97: var parent_1 = node.parent; - if (parent_1.kind === 156) { + if (parent_1.kind === 157) { return false; } - if (152 <= parent_1.kind && parent_1.kind <= 164) { + if (153 <= parent_1.kind && parent_1.kind <= 165) { return true; } switch (parent_1.kind) { - case 192: + case 193: return !isExpressionWithTypeArgumentsInClassExtendsClause(parent_1); - case 139: - return node === parent_1.constraint; - case 143: - case 142: case 140: - case 215: - return node === parent_1.type; + return node === parent_1.constraint; + case 144: + case 143: + case 141: case 217: - case 177: + return node === parent_1.type; + case 219: case 178: + case 179: + case 147: case 146: case 145: - case 144: - case 147: case 148: - return node === parent_1.type; case 149: + return node === parent_1.type; case 150: case 151: + case 152: return node === parent_1.type; - case 175: + case 176: return node === parent_1.type; - case 172: case 173: - return parent_1.typeArguments && ts.indexOf(parent_1.typeArguments, node) >= 0; case 174: + return parent_1.typeArguments && ts.indexOf(parent_1.typeArguments, node) >= 0; + case 175: return false; } } @@ -4537,23 +4816,23 @@ var ts; return traverse(body); function traverse(node) { switch (node.kind) { - case 208: + case 210: return visitor(node); - case 224: - case 196: - case 200: - case 201: + case 226: + case 198: case 202: case 203: case 204: case 205: - case 209: - case 210: - case 245: - case 246: + case 206: + case 207: case 211: - case 213: + case 212: case 248: + case 249: + case 213: + case 215: + case 251: return ts.forEachChild(node, traverse); } } @@ -4563,23 +4842,23 @@ var ts; return traverse(body); function traverse(node) { switch (node.kind) { - case 188: + case 189: visitor(node); var operand = node.expression; if (operand) { traverse(operand); } + case 223: case 221: - case 219: + case 224: case 222: case 220: - case 218: - case 190: + case 191: return; default: if (isFunctionLike(node)) { var name_5 = node.name; - if (name_5 && name_5.kind === 138) { + if (name_5 && name_5.kind === 139) { traverse(name_5.expression); return; } @@ -4594,14 +4873,14 @@ var ts; function isVariableLike(node) { if (node) { switch (node.kind) { - case 167: - case 251: - case 140: - case 249: + case 168: + case 254: + case 141: + case 252: + case 144: case 143: - case 142: - case 250: - case 215: + case 253: + case 217: return true; } } @@ -4609,11 +4888,11 @@ var ts; } ts.isVariableLike = isVariableLike; function isAccessor(node) { - return node && (node.kind === 147 || node.kind === 148); + return node && (node.kind === 148 || node.kind === 149); } ts.isAccessor = isAccessor; function isClassLike(node) { - return node && (node.kind === 218 || node.kind === 190); + return node && (node.kind === 220 || node.kind === 191); } ts.isClassLike = isClassLike; function isFunctionLike(node) { @@ -4622,32 +4901,32 @@ var ts; ts.isFunctionLike = isFunctionLike; function isFunctionLikeKind(kind) { switch (kind) { - case 146: - case 177: - case 217: - case 178: - case 145: - case 144: case 147: + case 178: + case 219: + case 179: + case 146: + case 145: case 148: case 149: case 150: case 151: - case 154: + case 152: case 155: + case 156: return true; } } ts.isFunctionLikeKind = isFunctionLikeKind; function introducesArgumentsExoticObject(node) { switch (node.kind) { - case 145: - case 144: case 146: + case 145: case 147: case 148: - case 217: - case 177: + case 149: + case 219: + case 178: return true; } return false; @@ -4655,24 +4934,24 @@ var ts; ts.introducesArgumentsExoticObject = introducesArgumentsExoticObject; function isIterationStatement(node, lookInLabeledStatements) { switch (node.kind) { + case 205: + case 206: + case 207: case 203: case 204: - case 205: - case 201: - case 202: return true; - case 211: + case 213: return lookInLabeledStatements && isIterationStatement(node.statement, lookInLabeledStatements); } return false; } ts.isIterationStatement = isIterationStatement; function isFunctionBlock(node) { - return node && node.kind === 196 && isFunctionLike(node.parent); + return node && node.kind === 198 && isFunctionLike(node.parent); } ts.isFunctionBlock = isFunctionBlock; function isObjectLiteralMethod(node) { - return node && node.kind === 145 && node.parent.kind === 169; + return node && node.kind === 146 && node.parent.kind === 170; } ts.isObjectLiteralMethod = isObjectLiteralMethod; function isIdentifierTypePredicate(predicate) { @@ -4708,39 +4987,39 @@ var ts; return undefined; } switch (node.kind) { - case 138: + case 139: if (isClassLike(node.parent.parent)) { return node; } node = node.parent; break; - case 141: - if (node.parent.kind === 140 && isClassElement(node.parent.parent)) { + case 142: + if (node.parent.kind === 141 && isClassElement(node.parent.parent)) { node = node.parent.parent; } else if (isClassElement(node.parent)) { node = node.parent; } break; - case 178: + case 179: if (!includeArrowFunctions) { continue; } - case 217: - case 177: - case 222: - case 143: - case 142: - case 145: + case 219: + case 178: + case 224: case 144: + case 143: case 146: + case 145: case 147: case 148: case 149: case 150: case 151: - case 221: - case 252: + case 152: + case 223: + case 255: return node; } } @@ -4753,25 +5032,25 @@ var ts; return node; } switch (node.kind) { - case 138: + case 139: node = node.parent; break; - case 217: - case 177: + case 219: case 178: + case 179: if (!stopOnFunctions) { continue; } - case 143: - case 142: - case 145: case 144: + case 143: case 146: + case 145: case 147: case 148: + case 149: return node; - case 141: - if (node.parent.kind === 140 && isClassElement(node.parent.parent)) { + case 142: + if (node.parent.kind === 141 && isClassElement(node.parent.parent)) { node = node.parent.parent; } else if (isClassElement(node.parent)) { @@ -4783,20 +5062,20 @@ var ts; } ts.getSuperContainer = getSuperContainer; function isSuperPropertyOrElementAccess(node) { - return (node.kind === 170 - || node.kind === 171) + return (node.kind === 171 + || node.kind === 172) && node.expression.kind === 95; } ts.isSuperPropertyOrElementAccess = isSuperPropertyOrElementAccess; function getEntityNameFromTypeNode(node) { if (node) { switch (node.kind) { - case 153: + case 154: return node.typeName; - case 192: + case 193: return node.expression; case 69: - case 137: + case 138: return node; } } @@ -4804,7 +5083,7 @@ var ts; } ts.getEntityNameFromTypeNode = getEntityNameFromTypeNode; function getInvokedExpression(node) { - if (node.kind === 174) { + if (node.kind === 175) { return node.tag; } return node.expression; @@ -4812,21 +5091,21 @@ var ts; ts.getInvokedExpression = getInvokedExpression; function nodeCanBeDecorated(node) { switch (node.kind) { - case 218: + case 220: return true; - case 143: - return node.parent.kind === 218; - case 147: + case 144: + return node.parent.kind === 220; case 148: - case 145: + case 149: + case 146: return node.body !== undefined - && node.parent.kind === 218; - case 140: + && node.parent.kind === 220; + case 141: return node.parent.body !== undefined - && (node.parent.kind === 146 - || node.parent.kind === 145 - || node.parent.kind === 148) - && node.parent.parent.kind === 218; + && (node.parent.kind === 147 + || node.parent.kind === 146 + || node.parent.kind === 149) + && node.parent.parent.kind === 220; } return false; } @@ -4837,13 +5116,23 @@ var ts; } ts.nodeIsDecorated = nodeIsDecorated; function isPropertyAccessExpression(node) { - return node.kind === 170; + return node.kind === 171; } ts.isPropertyAccessExpression = isPropertyAccessExpression; function isElementAccessExpression(node) { - return node.kind === 171; + return node.kind === 172; } ts.isElementAccessExpression = isElementAccessExpression; + function isJSXTagName(node) { + var parent = node.parent; + if (parent.kind === 242 || + parent.kind === 241 || + parent.kind === 244) { + return parent.tagName === node; + } + return false; + } + ts.isJSXTagName = isJSXTagName; function isExpression(node) { switch (node.kind) { case 95: @@ -4851,42 +5140,43 @@ var ts; case 99: case 84: case 10: - case 168: case 169: case 170: case 171: case 172: case 173: case 174: - case 193: case 175: + case 194: case 176: + case 195: case 177: - case 190: case 178: - case 181: + case 191: case 179: + case 182: case 180: - case 183: + case 181: case 184: case 185: case 186: - case 189: case 187: - case 11: - case 191: - case 237: - case 238: + case 190: case 188: - case 182: + case 11: + case 192: + case 240: + case 241: + case 189: + case 183: return true; - case 137: - while (node.parent.kind === 137) { + case 138: + while (node.parent.kind === 138) { node = node.parent; } - return node.parent.kind === 156; + return node.parent.kind === 157 || isJSXTagName(node); case 69: - if (node.parent.kind === 156) { + if (node.parent.kind === 157 || isJSXTagName(node)) { return true; } case 8: @@ -4894,47 +5184,47 @@ var ts; case 97: var parent_2 = node.parent; switch (parent_2.kind) { - case 215: - case 140: + case 217: + case 141: + case 144: case 143: - case 142: - case 251: - case 249: - case 167: + case 254: + case 252: + case 168: return parent_2.initializer === node; - case 199: - case 200: case 201: case 202: - case 208: - case 209: - case 210: - case 245: - case 212: - case 210: - return parent_2.expression === node; case 203: + case 204: + case 210: + case 211: + case 212: + case 248: + case 214: + case 212: + return parent_2.expression === node; + case 205: var forStatement = parent_2; - return (forStatement.initializer === node && forStatement.initializer.kind !== 216) || + return (forStatement.initializer === node && forStatement.initializer.kind !== 218) || forStatement.condition === node || forStatement.incrementor === node; - case 204: - case 205: + case 206: + case 207: var forInStatement = parent_2; - return (forInStatement.initializer === node && forInStatement.initializer.kind !== 216) || + return (forInStatement.initializer === node && forInStatement.initializer.kind !== 218) || forInStatement.expression === node; - case 175: - case 193: - return node === parent_2.expression; + case 176: case 194: return node === parent_2.expression; - case 138: + case 196: return node === parent_2.expression; - case 141: - case 244: - case 243: + case 139: + return node === parent_2.expression; + case 142: + case 247: + case 246: return true; - case 192: + case 193: return parent_2.expression === node && isExpressionWithTypeArgumentsInClassExtendsClause(parent_2); default: if (isExpression(parent_2)) { @@ -4956,7 +5246,7 @@ var ts; } ts.isInstantiatedModule = isInstantiatedModule; function isExternalModuleImportEqualsDeclaration(node) { - return node.kind === 225 && node.moduleReference.kind === 236; + return node.kind === 228 && node.moduleReference.kind === 239; } ts.isExternalModuleImportEqualsDeclaration = isExternalModuleImportEqualsDeclaration; function getExternalModuleImportEqualsDeclarationExpression(node) { @@ -4965,7 +5255,7 @@ var ts; } ts.getExternalModuleImportEqualsDeclarationExpression = getExternalModuleImportEqualsDeclarationExpression; function isInternalModuleImportEqualsDeclaration(node) { - return node.kind === 225 && node.moduleReference.kind !== 236; + return node.kind === 228 && node.moduleReference.kind !== 239; } ts.isInternalModuleImportEqualsDeclaration = isInternalModuleImportEqualsDeclaration; function isSourceFileJavaScript(file) { @@ -4977,7 +5267,7 @@ var ts; } ts.isInJavaScriptFile = isInJavaScriptFile; function isRequireCall(expression, checkArgumentIsStringLiteral) { - var isRequire = expression.kind === 172 && + var isRequire = expression.kind === 173 && expression.expression.kind === 69 && expression.expression.text === "require" && expression.arguments.length === 1; @@ -4985,11 +5275,14 @@ var ts; } ts.isRequireCall = isRequireCall; function getSpecialPropertyAssignmentKind(expression) { - if (expression.kind !== 185) { + if (!isInJavaScriptFile(expression)) { + return 0; + } + if (expression.kind !== 186) { return 0; } var expr = expression; - if (expr.operatorToken.kind !== 56 || expr.left.kind !== 170) { + if (expr.operatorToken.kind !== 56 || expr.left.kind !== 171) { return 0; } var lhs = expr.left; @@ -5005,7 +5298,7 @@ var ts; else if (lhs.expression.kind === 97) { return 4; } - else if (lhs.expression.kind === 170) { + else if (lhs.expression.kind === 171) { var innerPropertyAccess = lhs.expression; if (innerPropertyAccess.expression.kind === 69 && innerPropertyAccess.name.text === "prototype") { return 3; @@ -5015,19 +5308,19 @@ var ts; } ts.getSpecialPropertyAssignmentKind = getSpecialPropertyAssignmentKind; function getExternalModuleName(node) { - if (node.kind === 226) { + if (node.kind === 229) { return node.moduleSpecifier; } - if (node.kind === 225) { + if (node.kind === 228) { var reference = node.moduleReference; - if (reference.kind === 236) { + if (reference.kind === 239) { return reference.expression; } } - if (node.kind === 232) { + if (node.kind === 235) { return node.moduleSpecifier; } - if (node.kind === 222 && node.name.kind === 9) { + if (node.kind === 224 && node.name.kind === 9) { return node.name; } } @@ -5035,13 +5328,13 @@ var ts; function hasQuestionToken(node) { if (node) { switch (node.kind) { - case 140: + case 141: + case 146: case 145: + case 253: + case 252: case 144: - case 250: - case 249: case 143: - case 142: return node.questionToken !== undefined; } } @@ -5049,9 +5342,9 @@ var ts; } ts.hasQuestionToken = hasQuestionToken; function isJSDocConstructSignature(node) { - return node.kind === 265 && + return node.kind === 268 && node.parameters.length > 0 && - node.parameters[0].type.kind === 267; + node.parameters[0].type.kind === 270; } ts.isJSDocConstructSignature = isJSDocConstructSignature; function getJSDocTag(node, kind, checkParentVariableStatement) { @@ -5074,22 +5367,22 @@ var ts; return node.jsDocComment; } if (checkParentVariableStatement) { - var isInitializerOfVariableDeclarationInStatement = node.parent.kind === 215 && + var isInitializerOfVariableDeclarationInStatement = node.parent.kind === 217 && node.parent.initializer === node && - node.parent.parent.parent.kind === 197; + node.parent.parent.parent.kind === 199; var variableStatementNode = isInitializerOfVariableDeclarationInStatement ? node.parent.parent.parent : undefined; if (variableStatementNode) { return variableStatementNode.jsDocComment; } var parent_3 = node.parent; var isSourceOfAssignmentExpressionStatement = parent_3 && parent_3.parent && - parent_3.kind === 185 && + parent_3.kind === 186 && parent_3.operatorToken.kind === 56 && - parent_3.parent.kind === 199; + parent_3.parent.kind === 201; if (isSourceOfAssignmentExpressionStatement) { return parent_3.parent.jsDocComment; } - var isPropertyAssignmentExpression = parent_3 && parent_3.kind === 249; + var isPropertyAssignmentExpression = parent_3 && parent_3.kind === 252; if (isPropertyAssignmentExpression) { return parent_3.jsDocComment; } @@ -5097,15 +5390,15 @@ var ts; return undefined; } function getJSDocTypeTag(node) { - return getJSDocTag(node, 273, false); + return getJSDocTag(node, 276, false); } ts.getJSDocTypeTag = getJSDocTypeTag; function getJSDocReturnTag(node) { - return getJSDocTag(node, 272, true); + return getJSDocTag(node, 275, true); } ts.getJSDocReturnTag = getJSDocReturnTag; function getJSDocTemplateTag(node) { - return getJSDocTag(node, 274, false); + return getJSDocTag(node, 277, false); } ts.getJSDocTemplateTag = getJSDocTemplateTag; function getCorrespondingJSDocParameterTag(parameter) { @@ -5115,7 +5408,7 @@ var ts; if (jsDocComment) { for (var _i = 0, _a = jsDocComment.tags; _i < _a.length; _i++) { var tag = _a[_i]; - if (tag.kind === 271) { + if (tag.kind === 274) { var parameterTag = tag; var name_6 = parameterTag.preParameterName || parameterTag.postParameterName; if (name_6.text === parameterName) { @@ -5135,12 +5428,12 @@ var ts; function isRestParameter(node) { if (node) { if (node.flags & 134217728) { - if (node.type && node.type.kind === 266) { + if (node.type && node.type.kind === 269) { return true; } var paramTag = getCorrespondingJSDocParameterTag(node); if (paramTag && paramTag.typeExpression) { - return paramTag.typeExpression.type.kind === 266; + return paramTag.typeExpression.type.kind === 269; } } return node.dotDotDotToken !== undefined; @@ -5161,7 +5454,7 @@ var ts; } ts.isTemplateLiteralKind = isTemplateLiteralKind; function isBindingPattern(node) { - return !!node && (node.kind === 166 || node.kind === 165); + return !!node && (node.kind === 167 || node.kind === 166); } ts.isBindingPattern = isBindingPattern; function isNodeDescendentOf(node, ancestor) { @@ -5175,7 +5468,7 @@ var ts; ts.isNodeDescendentOf = isNodeDescendentOf; function isInAmbientContext(node) { while (node) { - if (node.flags & 2 || (node.kind === 252 && node.isDeclarationFile)) { + if (node.flags & 2 || (node.kind === 255 && node.isDeclarationFile)) { return true; } node = node.parent; @@ -5185,34 +5478,34 @@ var ts; ts.isInAmbientContext = isInAmbientContext; function isDeclaration(node) { switch (node.kind) { - case 178: - case 167: - case 218: - case 190: - case 146: - case 221: - case 251: - case 234: - case 217: - case 177: - case 147: - case 227: - case 225: - case 230: - case 219: - case 145: - case 144: - case 222: - case 228: - case 140: - case 249: - case 143: - case 142: - case 148: - case 250: + case 179: + case 168: case 220: - case 139: - case 215: + case 191: + case 147: + case 223: + case 254: + case 237: + case 219: + case 178: + case 148: + case 230: + case 228: + case 233: + case 221: + case 146: + case 145: + case 224: + case 231: + case 141: + case 252: + case 144: + case 143: + case 149: + case 253: + case 222: + case 140: + case 217: return true; } return false; @@ -5220,25 +5513,25 @@ var ts; ts.isDeclaration = isDeclaration; function isStatement(n) { switch (n.kind) { - case 207: - case 206: - case 214: - case 201: - case 199: - case 198: - case 204: - case 205: - case 203: - case 200: - case 211: + case 209: case 208: + case 216: + case 203: + case 201: + case 200: + case 206: + case 207: + case 205: + case 202: + case 213: case 210: case 212: - case 213: - case 197: - case 202: - case 209: - case 231: + case 214: + case 215: + case 199: + case 204: + case 211: + case 234: return true; default: return false; @@ -5247,13 +5540,13 @@ var ts; ts.isStatement = isStatement; function isClassElement(n) { switch (n.kind) { - case 146: - case 143: - case 145: case 147: - case 148: case 144: - case 151: + case 146: + case 148: + case 149: + case 145: + case 152: return true; default: return false; @@ -5265,7 +5558,7 @@ var ts; return false; } var parent = name.parent; - if (parent.kind === 230 || parent.kind === 234) { + if (parent.kind === 233 || parent.kind === 237) { if (parent.propertyName) { return true; } @@ -5279,40 +5572,41 @@ var ts; function isIdentifierName(node) { var parent = node.parent; switch (parent.kind) { - case 143: - case 142: - case 145: case 144: - case 147: + case 143: + case 146: + case 145: case 148: - case 251: - case 249: - case 170: + case 149: + case 254: + case 252: + case 171: return parent.name === node; - case 137: + case 138: if (parent.right === node) { - while (parent.kind === 137) { + while (parent.kind === 138) { parent = parent.parent; } - return parent.kind === 156; + return parent.kind === 157; } return false; - case 167: - case 230: + case 168: + case 233: return parent.propertyName === node; - case 234: + case 237: return true; } return false; } ts.isIdentifierName = isIdentifierName; function isAliasSymbolDeclaration(node) { - return node.kind === 225 || - node.kind === 227 && !!node.name || - node.kind === 228 || - node.kind === 230 || - node.kind === 234 || - node.kind === 231 && node.expression.kind === 69; + return node.kind === 228 || + node.kind === 227 || + node.kind === 230 && !!node.name || + node.kind === 231 || + node.kind === 233 || + node.kind === 237 || + node.kind === 234 && node.expression.kind === 69; } ts.isAliasSymbolDeclaration = isAliasSymbolDeclaration; function getClassExtendsHeritageClauseElement(node) { @@ -5369,32 +5663,32 @@ var ts; }; } else { - var matchResult = ts.fullTripleSlashReferencePathRegEx.exec(comment); - if (matchResult) { + var refMatchResult = ts.fullTripleSlashReferencePathRegEx.exec(comment); + var refLibResult = !refMatchResult && ts.fullTripleSlashReferenceTypeReferenceDirectiveRegEx.exec(comment); + if (refMatchResult || refLibResult) { var start = commentRange.pos; var end = commentRange.end; return { fileReference: { pos: start, end: end, - fileName: matchResult[3] + fileName: (refMatchResult || refLibResult)[3] }, - isNoDefaultLib: false - }; - } - else { - return { - diagnosticMessage: ts.Diagnostics.Invalid_reference_directive_syntax, - isNoDefaultLib: false + isNoDefaultLib: false, + isTypeReferenceDirective: !!refLibResult }; } + return { + diagnosticMessage: ts.Diagnostics.Invalid_reference_directive_syntax, + isNoDefaultLib: false + }; } } return undefined; } ts.getFileReferenceFromReferencePath = getFileReferenceFromReferencePath; function isKeyword(token) { - return 70 <= token && token <= 136; + return 70 <= token && token <= 137; } ts.isKeyword = isKeyword; function isTrivia(token) { @@ -5414,7 +5708,7 @@ var ts; } ts.hasDynamicName = hasDynamicName; function isDynamicName(name) { - return name.kind === 138 && + return name.kind === 139 && !isStringOrNumericLiteral(name.expression.kind) && !isWellKnownSymbolSyntactically(name.expression); } @@ -5427,7 +5721,7 @@ var ts; if (name.kind === 69 || name.kind === 9 || name.kind === 8) { return name.text; } - if (name.kind === 138) { + if (name.kind === 139) { var nameExpression = name.expression; if (isWellKnownSymbolSyntactically(nameExpression)) { var rightHandSideName = nameExpression.name.text; @@ -5465,18 +5759,18 @@ var ts; ts.isModifierKind = isModifierKind; function isParameterDeclaration(node) { var root = getRootDeclaration(node); - return root.kind === 140; + return root.kind === 141; } ts.isParameterDeclaration = isParameterDeclaration; function getRootDeclaration(node) { - while (node.kind === 167) { + while (node.kind === 168) { node = node.parent.parent; } return node; } ts.getRootDeclaration = getRootDeclaration; function nodeStartsNewLexicalEnvironment(n) { - return isFunctionLike(n) || n.kind === 222 || n.kind === 252; + return isFunctionLike(n) || n.kind === 224 || n.kind === 255; } ts.nodeStartsNewLexicalEnvironment = nodeStartsNewLexicalEnvironment; function cloneNode(node, location, flags, parent) { @@ -5509,7 +5803,7 @@ var ts; } ts.cloneEntityName = cloneEntityName; function isQualifiedName(node) { - return node.kind === 137; + return node.kind === 138; } ts.isQualifiedName = isQualifiedName; function nodeIsSynthesized(node) { @@ -5745,6 +6039,17 @@ var ts; return emitOutputFilePathWithoutExtension + extension; } ts.getOwnEmitOutputFilePath = getOwnEmitOutputFilePath; + function getDeclarationEmitOutputFilePath(sourceFile, host) { + var options = host.getCompilerOptions(); + var outputDir = options.declarationDir || options.outDir; + if (options.declaration) { + 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; } @@ -5785,20 +6090,21 @@ var ts; var emitFileNames = { jsFilePath: jsFilePath, sourceMapFilePath: getSourceMapFilePath(jsFilePath, options), - declarationFilePath: !isSourceFileJavaScript(sourceFile) ? getDeclarationEmitFilePath(jsFilePath, options) : undefined + declarationFilePath: !isSourceFileJavaScript(sourceFile) ? getDeclarationEmitOutputFilePath(sourceFile, host) : undefined }; action(emitFileNames, [sourceFile], false); } function onBundledEmit(host) { - var bundledSources = ts.filter(host.getSourceFiles(), function (sourceFile) { return !isDeclarationFile(sourceFile) && - (!isExternalModule(sourceFile) || - (getEmitModuleKind(options) && isExternalModule(sourceFile))); }); + var bundledSources = ts.filter(host.getSourceFiles(), function (sourceFile) { + return !isDeclarationFile(sourceFile) + && (!ts.isExternalModule(sourceFile) || !!getEmitModuleKind(options)); + }); if (bundledSources.length) { var jsFilePath = options.outFile || options.out; var emitFileNames = { jsFilePath: jsFilePath, sourceMapFilePath: getSourceMapFilePath(jsFilePath, options), - declarationFilePath: getDeclarationEmitFilePath(jsFilePath, options) + declarationFilePath: options.declaration ? ts.removeFileExtension(jsFilePath) + ".d.ts" : undefined }; action(emitFileNames, bundledSources, true); } @@ -5806,9 +6112,6 @@ var ts; function getSourceMapFilePath(jsFilePath, options) { return options.sourceMap ? jsFilePath + ".map" : undefined; } - function getDeclarationEmitFilePath(jsFilePath, options) { - return options.declaration ? ts.removeFileExtension(jsFilePath) + ".d.ts" : undefined; - } } ts.forEachExpectedEmitFile = forEachExpectedEmitFile; function getSourceFilePathInNewDir(sourceFile, host, newDirPath) { @@ -5817,10 +6120,10 @@ var ts; return ts.combinePaths(newDirPath, sourceFilePath); } ts.getSourceFilePathInNewDir = getSourceFilePathInNewDir; - function writeFile(host, diagnostics, fileName, data, writeByteOrderMark) { + function writeFile(host, diagnostics, fileName, data, writeByteOrderMark, sourceFiles) { host.writeFile(fileName, data, writeByteOrderMark, function (hostErrorMessage) { diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Could_not_write_file_0_Colon_1, fileName, hostErrorMessage)); - }); + }, sourceFiles); } ts.writeFile = writeFile; function getLineOfLocalPosition(currentSourceFile, pos) { @@ -5833,7 +6136,7 @@ var ts; ts.getLineOfLocalPositionFromLineMap = getLineOfLocalPositionFromLineMap; function getFirstConstructorWithBody(node) { return ts.forEach(node.members, function (member) { - if (member.kind === 146 && nodeIsPresent(member.body)) { + if (member.kind === 147 && nodeIsPresent(member.body)) { return member; } }); @@ -5850,10 +6153,10 @@ var ts; var setAccessor; if (hasDynamicName(accessor)) { firstAccessor = accessor; - if (accessor.kind === 147) { + if (accessor.kind === 148) { getAccessor = accessor; } - else if (accessor.kind === 148) { + else if (accessor.kind === 149) { setAccessor = accessor; } else { @@ -5862,7 +6165,7 @@ var ts; } else { ts.forEach(declarations, function (member) { - if ((member.kind === 147 || member.kind === 148) + if ((member.kind === 148 || member.kind === 149) && (member.flags & 32) === (accessor.flags & 32)) { var memberName = getPropertyNameForPropertyNameNode(member.name); var accessorName = getPropertyNameForPropertyNameNode(accessor.name); @@ -5873,10 +6176,10 @@ var ts; else if (!secondAccessor) { secondAccessor = member; } - if (member.kind === 147 && !getAccessor) { + if (member.kind === 148 && !getAccessor) { getAccessor = member; } - if (member.kind === 148 && !setAccessor) { + if (member.kind === 149 && !setAccessor) { setAccessor = member; } } @@ -6043,24 +6346,25 @@ var ts; function isLeftHandSideExpression(expr) { if (expr) { switch (expr.kind) { - case 170: case 171: - case 173: case 172: - case 237: - case 238: case 174: - case 168: - case 176: + case 173: + case 195: + case 240: + case 241: + case 175: case 169: - case 190: case 177: + case 170: + case 191: + case 178: case 69: case 10: case 8: case 9: case 11: - case 187: + case 188: case 84: case 93: case 97: @@ -6077,7 +6381,7 @@ var ts; } ts.isAssignmentOperator = isAssignmentOperator; function isExpressionWithTypeArgumentsInClassExtendsClause(node) { - return node.kind === 192 && + return node.kind === 193 && node.parent.token === 83 && isClassLike(node.parent.parent); } @@ -6098,16 +6402,16 @@ var ts; } } function isRightSideOfQualifiedNameOrPropertyAccess(node) { - return (node.parent.kind === 137 && node.parent.right === node) || - (node.parent.kind === 170 && node.parent.name === node); + return (node.parent.kind === 138 && node.parent.right === node) || + (node.parent.kind === 171 && node.parent.name === node); } ts.isRightSideOfQualifiedNameOrPropertyAccess = isRightSideOfQualifiedNameOrPropertyAccess; function isEmptyObjectLiteralOrArrayLiteral(expression) { var kind = expression.kind; - if (kind === 169) { + if (kind === 170) { return expression.properties.length === 0; } - if (kind === 168) { + if (kind === 169) { return expression.elements.length === 0; } return false; @@ -6228,6 +6532,10 @@ var ts; return carriageReturnLineFeed; } ts.getNewLineCharacter = getNewLineCharacter; + function isWatchSet(options) { + return options.watch && options.hasOwnProperty("watch"); + } + ts.isWatchSet = isWatchSet; })(ts || (ts = {})); var ts; (function (ts) { @@ -6351,9 +6659,9 @@ var ts; } ts.collapseTextChangeRangesAcrossMultipleVersions = collapseTextChangeRangesAcrossMultipleVersions; function getTypeParameterOwner(d) { - if (d && d.kind === 139) { + if (d && d.kind === 140) { for (var current = d; current; current = current.parent) { - if (ts.isFunctionLike(current) || ts.isClassLike(current) || current.kind === 219) { + if (ts.isFunctionLike(current) || ts.isClassLike(current) || current.kind === 221) { return current; } } @@ -6361,9 +6669,18 @@ var ts; } ts.getTypeParameterOwner = getTypeParameterOwner; function isParameterPropertyDeclaration(node) { - return node.flags & 28 && node.parent.kind === 146 && ts.isClassLike(node.parent.parent); + return node.flags & 28 && node.parent.kind === 147 && ts.isClassLike(node.parent.parent); } ts.isParameterPropertyDeclaration = isParameterPropertyDeclaration; + function startsWith(str, prefix) { + return str.lastIndexOf(prefix, 0) === 0; + } + ts.startsWith = startsWith; + function endsWith(str, suffix) { + var expectedPos = str.length - suffix.length; + return str.indexOf(suffix, expectedPos) === expectedPos; + } + ts.endsWith = endsWith; })(ts || (ts = {})); var ts; (function (ts) { @@ -6371,7 +6688,7 @@ var ts; var NodeConstructor; var SourceFileConstructor; function createNode(kind, pos, end) { - if (kind === 252) { + if (kind === 255) { return new (SourceFileConstructor || (SourceFileConstructor = ts.objectAllocator.getSourceFileConstructor()))(kind, pos, end); } else { @@ -6407,26 +6724,26 @@ var ts; var visitNodes = cbNodeArray ? visitNodeArray : visitEachNode; var cbNodes = cbNodeArray || cbNode; switch (node.kind) { - case 137: + case 138: return visitNode(cbNode, node.left) || visitNode(cbNode, node.right); - case 139: + case 140: return visitNode(cbNode, node.name) || visitNode(cbNode, node.constraint) || visitNode(cbNode, node.expression); - case 250: + case 253: 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 140: + case 141: + case 144: case 143: - case 142: - case 249: - case 215: - case 167: + case 252: + case 217: + case 168: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.propertyName) || @@ -6435,24 +6752,24 @@ var ts; visitNode(cbNode, node.questionToken) || visitNode(cbNode, node.type) || visitNode(cbNode, node.initializer); - case 154: case 155: - case 149: + case 156: case 150: case 151: + case 152: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNodes(cbNodes, node.typeParameters) || visitNodes(cbNodes, node.parameters) || visitNode(cbNode, node.type); - case 145: - case 144: case 146: + case 145: case 147: case 148: - case 177: - case 217: + case 149: case 178: + case 219: + case 179: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.asteriskToken) || @@ -6463,290 +6780,294 @@ var ts; visitNode(cbNode, node.type) || visitNode(cbNode, node.equalsGreaterThanToken) || visitNode(cbNode, node.body); - case 153: + case 154: return visitNode(cbNode, node.typeName) || visitNodes(cbNodes, node.typeArguments); - case 152: + case 153: return visitNode(cbNode, node.parameterName) || visitNode(cbNode, node.type); - case 156: - return visitNode(cbNode, node.exprName); case 157: - return visitNodes(cbNodes, node.members); + return visitNode(cbNode, node.exprName); case 158: - return visitNode(cbNode, node.elementType); + return visitNodes(cbNodes, node.members); case 159: - return visitNodes(cbNodes, node.elementTypes); + return visitNode(cbNode, node.elementType); case 160: + return visitNodes(cbNodes, node.elementTypes); case 161: - return visitNodes(cbNodes, node.types); case 162: + return visitNodes(cbNodes, node.types); + case 163: return visitNode(cbNode, node.type); - case 165: case 166: - return visitNodes(cbNodes, node.elements); - case 168: + case 167: return visitNodes(cbNodes, node.elements); case 169: - return visitNodes(cbNodes, node.properties); + return visitNodes(cbNodes, node.elements); case 170: + return visitNodes(cbNodes, node.properties); + case 171: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.dotToken) || visitNode(cbNode, node.name); - case 171: + case 172: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.argumentExpression); - case 172: case 173: + case 174: return visitNode(cbNode, node.expression) || visitNodes(cbNodes, node.typeArguments) || visitNodes(cbNodes, node.arguments); - case 174: + case 175: return visitNode(cbNode, node.tag) || visitNode(cbNode, node.template); - case 175: + case 176: return visitNode(cbNode, node.type) || visitNode(cbNode, node.expression); - case 176: - return visitNode(cbNode, node.expression); - case 179: + case 177: return visitNode(cbNode, node.expression); case 180: return visitNode(cbNode, node.expression); case 181: return visitNode(cbNode, node.expression); - case 183: - return visitNode(cbNode, node.operand); - case 188: - return visitNode(cbNode, node.asteriskToken) || - visitNode(cbNode, node.expression); case 182: return visitNode(cbNode, node.expression); case 184: return visitNode(cbNode, node.operand); + case 189: + return visitNode(cbNode, node.asteriskToken) || + visitNode(cbNode, node.expression); + case 183: + return visitNode(cbNode, node.expression); case 185: + return visitNode(cbNode, node.operand); + case 186: return visitNode(cbNode, node.left) || visitNode(cbNode, node.operatorToken) || visitNode(cbNode, node.right); - case 193: + case 194: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.type); - case 186: + case 195: + return visitNode(cbNode, node.expression); + case 187: return visitNode(cbNode, node.condition) || visitNode(cbNode, node.questionToken) || visitNode(cbNode, node.whenTrue) || visitNode(cbNode, node.colonToken) || visitNode(cbNode, node.whenFalse); - case 189: + case 190: return visitNode(cbNode, node.expression); - case 196: - case 223: + case 198: + case 225: return visitNodes(cbNodes, node.statements); - case 252: + case 255: return visitNodes(cbNodes, node.statements) || visitNode(cbNode, node.endOfFileToken); - case 197: + case 199: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.declarationList); - case 216: + case 218: return visitNodes(cbNodes, node.declarations); - case 199: + case 201: return visitNode(cbNode, node.expression); - case 200: + case 202: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.thenStatement) || visitNode(cbNode, node.elseStatement); - case 201: + case 203: return visitNode(cbNode, node.statement) || visitNode(cbNode, node.expression); - case 202: + case 204: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.statement); - case 203: + case 205: return visitNode(cbNode, node.initializer) || visitNode(cbNode, node.condition) || visitNode(cbNode, node.incrementor) || visitNode(cbNode, node.statement); - case 204: - return visitNode(cbNode, node.initializer) || - visitNode(cbNode, node.expression) || - visitNode(cbNode, node.statement); - case 205: - return visitNode(cbNode, node.initializer) || - visitNode(cbNode, node.expression) || - visitNode(cbNode, node.statement); case 206: - case 207: - return visitNode(cbNode, node.label); - case 208: - return visitNode(cbNode, node.expression); - case 209: - return visitNode(cbNode, node.expression) || + return visitNode(cbNode, node.initializer) || + visitNode(cbNode, node.expression) || visitNode(cbNode, node.statement); + case 207: + return visitNode(cbNode, node.initializer) || + visitNode(cbNode, node.expression) || + visitNode(cbNode, node.statement); + case 208: + case 209: + return visitNode(cbNode, node.label); case 210: - return visitNode(cbNode, node.expression) || - visitNode(cbNode, node.caseBlock); - case 224: - return visitNodes(cbNodes, node.clauses); - case 245: - return visitNode(cbNode, node.expression) || - visitNodes(cbNodes, node.statements); - case 246: - return visitNodes(cbNodes, node.statements); + return visitNode(cbNode, node.expression); case 211: - return visitNode(cbNode, node.label) || + return visitNode(cbNode, node.expression) || visitNode(cbNode, node.statement); case 212: - return visitNode(cbNode, node.expression); + return visitNode(cbNode, node.expression) || + visitNode(cbNode, node.caseBlock); + case 226: + return visitNodes(cbNodes, node.clauses); + case 248: + return visitNode(cbNode, node.expression) || + visitNodes(cbNodes, node.statements); + case 249: + return visitNodes(cbNodes, node.statements); case 213: + return visitNode(cbNode, node.label) || + visitNode(cbNode, node.statement); + case 214: + return visitNode(cbNode, node.expression); + case 215: return visitNode(cbNode, node.tryBlock) || visitNode(cbNode, node.catchClause) || visitNode(cbNode, node.finallyBlock); - case 248: + case 251: return visitNode(cbNode, node.variableDeclaration) || visitNode(cbNode, node.block); - case 141: + case 142: return visitNode(cbNode, node.expression); - case 218: - case 190: - 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 219: - 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 220: + case 191: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNodes(cbNodes, node.typeParameters) || - visitNode(cbNode, node.type); + visitNodes(cbNodes, node.heritageClauses) || + visitNodes(cbNodes, node.members); case 221: 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 251: - return visitNode(cbNode, node.name) || - visitNode(cbNode, node.initializer); case 222: + return visitNodes(cbNodes, node.decorators) || + visitNodes(cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNodes(cbNodes, node.typeParameters) || + visitNode(cbNode, node.type); + case 223: + return visitNodes(cbNodes, node.decorators) || + visitNodes(cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNodes(cbNodes, node.members); + case 254: + return visitNode(cbNode, node.name) || + visitNode(cbNode, node.initializer); + case 224: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNode(cbNode, node.body); - case 225: + case 228: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNode(cbNode, node.moduleReference); - case 226: + case 229: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.importClause) || visitNode(cbNode, node.moduleSpecifier); - case 227: + case 230: return visitNode(cbNode, node.name) || visitNode(cbNode, node.namedBindings); - case 228: + case 227: + return visitNode(cbNode, node.name); + case 231: return visitNode(cbNode, node.name); - case 229: - case 233: - return visitNodes(cbNodes, node.elements); case 232: + case 236: + return visitNodes(cbNodes, node.elements); + case 235: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.exportClause) || visitNode(cbNode, node.moduleSpecifier); - case 230: - case 234: + case 233: + case 237: return visitNode(cbNode, node.propertyName) || visitNode(cbNode, node.name); - case 231: + case 234: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.expression); - case 187: + case 188: return visitNode(cbNode, node.head) || visitNodes(cbNodes, node.templateSpans); - case 194: + case 196: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.literal); - case 138: + case 139: return visitNode(cbNode, node.expression); - case 247: + case 250: return visitNodes(cbNodes, node.types); - case 192: + case 193: return visitNode(cbNode, node.expression) || visitNodes(cbNodes, node.typeArguments); - case 236: + case 239: return visitNode(cbNode, node.expression); - case 235: + case 238: return visitNodes(cbNodes, node.decorators); - case 237: + case 240: return visitNode(cbNode, node.openingElement) || visitNodes(cbNodes, node.children) || visitNode(cbNode, node.closingElement); - case 238: - case 239: + case 241: + case 242: return visitNode(cbNode, node.tagName) || visitNodes(cbNodes, node.attributes); - case 242: + case 245: return visitNode(cbNode, node.name) || visitNode(cbNode, node.initializer); - case 243: + case 246: + return visitNode(cbNode, node.expression); + case 247: return visitNode(cbNode, node.expression); case 244: - return visitNode(cbNode, node.expression); - case 241: return visitNode(cbNode, node.tagName); - case 253: - return visitNode(cbNode, node.type); - case 257: - return visitNodes(cbNodes, node.types); - case 258: - return visitNodes(cbNodes, node.types); case 256: - return visitNode(cbNode, node.elementType); + return visitNode(cbNode, node.type); case 260: - return visitNode(cbNode, node.type); - case 259: - return visitNode(cbNode, node.type); + return visitNodes(cbNodes, node.types); case 261: - return visitNodes(cbNodes, node.members); + return visitNodes(cbNodes, node.types); + case 259: + return visitNode(cbNode, node.elementType); case 263: + return visitNode(cbNode, node.type); + case 262: + return visitNode(cbNode, node.type); + case 264: + return visitNodes(cbNodes, node.members); + case 266: return visitNode(cbNode, node.name) || visitNodes(cbNodes, node.typeArguments); - case 264: - return visitNode(cbNode, node.type); - case 265: - return visitNodes(cbNodes, node.parameters) || - visitNode(cbNode, node.type); - case 266: - return visitNode(cbNode, node.type); case 267: return visitNode(cbNode, node.type); case 268: - return visitNode(cbNode, node.type); - case 262: - return visitNode(cbNode, node.name) || + return visitNodes(cbNodes, node.parameters) || visitNode(cbNode, node.type); case 269: - return visitNodes(cbNodes, node.tags); + return visitNode(cbNode, node.type); + case 270: + return visitNode(cbNode, node.type); case 271: + return visitNode(cbNode, node.type); + case 265: + return visitNode(cbNode, node.name) || + visitNode(cbNode, node.type); + case 272: + return visitNodes(cbNodes, node.tags); + case 274: return visitNode(cbNode, node.preParameterName) || visitNode(cbNode, node.typeExpression) || visitNode(cbNode, node.postParameterName); - case 272: + case 275: return visitNode(cbNode, node.typeExpression); - case 273: + case 276: return visitNode(cbNode, node.typeExpression); - case 274: + case 277: return visitNodes(cbNodes, node.typeParameters); } } @@ -6759,22 +7080,10 @@ var ts; return result; } ts.createSourceFile = createSourceFile; - function getScriptKindFromFileName(fileName) { - var ext = fileName.substr(fileName.lastIndexOf(".")); - switch (ext.toLowerCase()) { - case ".js": - return 1; - case ".jsx": - return 2; - case ".ts": - return 3; - case ".tsx": - return 4; - default: - return 3; - } + function isExternalModule(file) { + return file.externalModuleIndicator !== undefined; } - ts.getScriptKindFromFileName = getScriptKindFromFileName; + ts.isExternalModule = isExternalModule; function updateSourceFile(sourceFile, newText, textChangeRange, aggressiveChecks) { return IncrementalParser.updateSourceFile(sourceFile, newText, textChangeRange, aggressiveChecks); } @@ -6805,7 +7114,7 @@ var ts; var contextFlags; var parseErrorBeforeNextFinishedNode = false; function parseSourceFile(fileName, _sourceText, languageVersion, _syntaxCursor, setParentNodes, scriptKind) { - scriptKind = scriptKind ? scriptKind : getScriptKindFromFileName(fileName); + scriptKind = ts.ensureScriptKind(fileName, scriptKind); initializeState(fileName, _sourceText, languageVersion, _syntaxCursor, scriptKind); var result = parseSourceFileWorker(fileName, languageVersion, setParentNodes, scriptKind); clearState(); @@ -6890,7 +7199,7 @@ var ts; } Parser.fixupParentReferences = fixupParentReferences; function createSourceFile(fileName, languageVersion, scriptKind) { - var sourceFile = new SourceFileConstructor(252, 0, sourceText.length); + var sourceFile = new SourceFileConstructor(255, 0, sourceText.length); nodeCount++; sourceFile.text = sourceText; sourceFile.bindDiagnostics = []; @@ -7182,7 +7491,7 @@ var ts; return token === 9 || token === 8 || ts.tokenIsIdentifierOrKeyword(token); } function parseComputedPropertyName() { - var node = createNode(138); + var node = createNode(139); parseExpected(19); node.expression = allowInAnd(parseExpression); parseExpected(20); @@ -7207,7 +7516,7 @@ var ts; if (token === 77) { return lookAhead(nextTokenIsClassOrFunction); } - return token !== 37 && token !== 15 && canFollowModifier(); + return token !== 37 && token !== 116 && token !== 15 && canFollowModifier(); } if (token === 77) { return nextTokenIsClassOrFunction(); @@ -7434,7 +7743,7 @@ var ts; if (ts.containsParseError(node)) { return undefined; } - var nodeContextFlags = node.flags & 62914560; + var nodeContextFlags = node.flags & 197132288; if (nodeContextFlags !== contextFlags) { return undefined; } @@ -7481,14 +7790,14 @@ var ts; function isReusableClassMember(node) { if (node) { switch (node.kind) { - case 146: - case 151: case 147: + case 152: case 148: - case 143: - case 195: + case 149: + case 144: + case 197: return true; - case 145: + case 146: var methodDeclaration = node; var nameIsConstructor = methodDeclaration.name.kind === 69 && methodDeclaration.name.originalKeywordKind === 121; @@ -7500,8 +7809,8 @@ var ts; function isReusableSwitchClause(node) { if (node) { switch (node.kind) { - case 245: - case 246: + case 248: + case 249: return true; } } @@ -7510,65 +7819,65 @@ var ts; function isReusableStatement(node) { if (node) { switch (node.kind) { - case 217: - case 197: - case 196: - case 200: + case 219: case 199: - case 212: - case 208: - case 210: - case 207: - case 206: - case 204: - case 205: - case 203: - case 202: - case 209: case 198: - case 213: - case 211: + case 202: case 201: case 214: - case 226: - case 225: - case 232: - case 231: - case 222: - case 218: - case 219: - case 221: + case 210: + case 212: + case 209: + case 208: + case 206: + case 207: + case 205: + case 204: + case 211: + case 200: + case 215: + case 213: + case 203: + case 216: + case 229: + case 228: + case 235: + case 234: + case 224: case 220: + case 221: + case 223: + case 222: return true; } } return false; } function isReusableEnumMember(node) { - return node.kind === 251; + return node.kind === 254; } function isReusableTypeMember(node) { if (node) { switch (node.kind) { - case 150: - case 144: case 151: - case 142: - case 149: + case 145: + case 152: + case 143: + case 150: return true; } } return false; } function isReusableVariableDeclaration(node) { - if (node.kind !== 215) { + if (node.kind !== 217) { return false; } var variableDeclarator = node; return variableDeclarator.initializer === undefined; } function isReusableParameter(node) { - if (node.kind !== 140) { + if (node.kind !== 141) { return false; } var parameter = node; @@ -7668,7 +7977,7 @@ var ts; function parseEntityName(allowReservedWords, diagnosticMessage) { var entity = parseIdentifier(diagnosticMessage); while (parseOptional(21)) { - var node = createNode(137, entity.pos); + var node = createNode(138, entity.pos); node.left = entity; node.right = parseRightSideOfDot(allowReservedWords); entity = finishNode(node); @@ -7685,7 +7994,7 @@ var ts; return allowIdentifierNames ? parseIdentifierName() : parseIdentifier(); } function parseTemplateExpression() { - var template = createNode(187); + var template = createNode(188); template.head = parseTemplateLiteralFragment(); ts.Debug.assert(template.head.kind === 12, "Template head has wrong token kind"); var templateSpans = []; @@ -7698,7 +8007,7 @@ var ts; return finishNode(template); } function parseTemplateSpan() { - var span = createNode(194); + var span = createNode(196); span.expression = allowInAnd(parseExpression); var literal; if (token === 16) { @@ -7712,7 +8021,7 @@ var ts; return finishNode(span); } function parseStringLiteralTypeNode() { - return parseLiteralLikeNode(164, true); + return parseLiteralLikeNode(165, true); } function parseLiteralNode(internName) { return parseLiteralLikeNode(token, internName); @@ -7742,7 +8051,7 @@ var ts; } function parseTypeReference() { var typeName = parseEntityName(false, ts.Diagnostics.Type_expected); - var node = createNode(153, typeName.pos); + var node = createNode(154, typeName.pos); node.typeName = typeName; if (!scanner.hasPrecedingLineBreak() && token === 25) { node.typeArguments = parseBracketedList(18, parseType, 25, 27); @@ -7751,24 +8060,24 @@ var ts; } function parseThisTypePredicate(lhs) { nextToken(); - var node = createNode(152, lhs.pos); + var node = createNode(153, lhs.pos); node.parameterName = lhs; node.type = parseType(); return finishNode(node); } function parseThisTypeNode() { - var node = createNode(163); + var node = createNode(164); nextToken(); return finishNode(node); } function parseTypeQuery() { - var node = createNode(156); + var node = createNode(157); parseExpected(101); node.exprName = parseEntityName(true); return finishNode(node); } function parseTypeParameter() { - var node = createNode(139); + var node = createNode(140); node.name = parseIdentifier(); if (parseOptional(83)) { if (isStartOfType() || !isStartOfExpression()) { @@ -7792,7 +8101,7 @@ var ts; return undefined; } function isStartOfParameter() { - return token === 22 || isIdentifierOrPattern() || ts.isModifierKind(token) || token === 55; + return token === 22 || isIdentifierOrPattern() || ts.isModifierKind(token) || token === 55 || token === 97; } function setModifiers(node, modifiers) { if (modifiers) { @@ -7801,7 +8110,12 @@ var ts; } } function parseParameter() { - var node = createNode(140); + var node = createNode(141); + if (token === 97) { + node.name = createIdentifier(true, undefined); + node.type = parseParameterType(); + return finishNode(node); + } node.decorators = parseDecorators(); setModifiers(node, parseModifiers()); node.dotDotDotToken = parseOptionalToken(22); @@ -7856,7 +8170,7 @@ var ts; } function parseSignatureMember(kind) { var node = createNode(kind); - if (kind === 150) { + if (kind === 151) { parseExpected(92); } fillSignature(54, false, false, false, node); @@ -7896,7 +8210,7 @@ var ts; return token === 54 || token === 24 || token === 20; } function parseIndexSignatureDeclaration(fullStart, decorators, modifiers) { - var node = createNode(151, fullStart); + var node = createNode(152, fullStart); node.decorators = decorators; setModifiers(node, modifiers); node.parameters = parseBracketedList(16, parseParameter, 19, 20); @@ -7908,7 +8222,7 @@ var ts; var name = parsePropertyName(); var questionToken = parseOptionalToken(53); if (token === 17 || token === 25) { - var method = createNode(144, fullStart); + var method = createNode(145, fullStart); setModifiers(method, modifiers); method.name = name; method.questionToken = questionToken; @@ -7917,7 +8231,7 @@ var ts; return finishNode(method); } else { - var property = createNode(142, fullStart); + var property = createNode(143, fullStart); setModifiers(property, modifiers); property.name = name; property.questionToken = questionToken; @@ -7956,10 +8270,10 @@ var ts; } function parseTypeMember() { if (token === 17 || token === 25) { - return parseSignatureMember(149); + return parseSignatureMember(150); } if (token === 92 && lookAhead(isStartOfConstructSignature)) { - return parseSignatureMember(150); + return parseSignatureMember(151); } var fullStart = getNodePos(); var modifiers = parseModifiers(); @@ -7973,7 +8287,7 @@ var ts; return token === 17 || token === 25; } function parseTypeLiteral() { - var node = createNode(157); + var node = createNode(158); node.members = parseObjectTypeMembers(); return finishNode(node); } @@ -7989,12 +8303,12 @@ var ts; return members; } function parseTupleType() { - var node = createNode(159); + var node = createNode(160); node.elementTypes = parseBracketedList(19, parseType, 19, 20); return finishNode(node); } function parseParenthesizedType() { - var node = createNode(162); + var node = createNode(163); parseExpected(17); node.type = parseType(); parseExpected(18); @@ -8002,7 +8316,7 @@ var ts; } function parseFunctionOrConstructorType(kind) { var node = createNode(kind); - if (kind === 155) { + if (kind === 156) { parseExpected(92); } fillSignature(34, false, false, false, node); @@ -8019,11 +8333,13 @@ var ts; case 129: case 120: case 132: + case 134: var node = tryParse(parseKeywordAndNoDot); return node || parseTypeReference(); case 9: return parseStringLiteralTypeNode(); case 103: + case 93: return parseTokenNode(); case 97: { var thisKeyword = parseThisTypeNode(); @@ -8054,6 +8370,8 @@ var ts; case 120: case 132: case 103: + case 134: + case 93: case 97: case 101: case 15: @@ -8076,7 +8394,7 @@ var ts; var type = parseNonArrayType(); while (!scanner.hasPrecedingLineBreak() && parseOptional(19)) { parseExpected(20); - var node = createNode(158, type.pos); + var node = createNode(159, type.pos); node.elementType = type; type = finishNode(node); } @@ -8098,10 +8416,10 @@ var ts; return type; } function parseIntersectionTypeOrHigher() { - return parseUnionOrIntersectionType(161, parseArrayTypeOrHigher, 46); + return parseUnionOrIntersectionType(162, parseArrayTypeOrHigher, 46); } function parseUnionTypeOrHigher() { - return parseUnionOrIntersectionType(160, parseIntersectionTypeOrHigher, 47); + return parseUnionOrIntersectionType(161, parseIntersectionTypeOrHigher, 47); } function isStartOfFunctionType() { if (token === 25) { @@ -8113,7 +8431,7 @@ var ts; if (ts.isModifierKind(token)) { parseModifiers(); } - if (isIdentifier()) { + if (isIdentifier() || token === 97) { nextToken(); return true; } @@ -8147,7 +8465,7 @@ var ts; var typePredicateVariable = isIdentifier() && tryParse(parseTypePredicatePrefix); var type = parseType(); if (typePredicateVariable) { - var node = createNode(152, typePredicateVariable.pos); + var node = createNode(153, typePredicateVariable.pos); node.parameterName = typePredicateVariable; node.type = type; return finishNode(node); @@ -8168,10 +8486,10 @@ var ts; } function parseTypeWorker() { if (isStartOfFunctionType()) { - return parseFunctionOrConstructorType(154); + return parseFunctionOrConstructorType(155); } if (token === 92) { - return parseFunctionOrConstructorType(155); + return parseFunctionOrConstructorType(156); } return parseUnionTypeOrHigher(); } @@ -8290,7 +8608,7 @@ var ts; return !scanner.hasPrecedingLineBreak() && isIdentifier(); } function parseYieldExpression() { - var node = createNode(188); + var node = createNode(189); nextToken(); if (!scanner.hasPrecedingLineBreak() && (token === 37 || isStartOfExpression())) { @@ -8304,8 +8622,8 @@ var ts; } function parseSimpleArrowFunctionExpression(identifier) { ts.Debug.assert(token === 34, "parseSimpleArrowFunctionExpression should only have been called if we had a =>"); - var node = createNode(178, identifier.pos); - var parameter = createNode(140, identifier.pos); + var node = createNode(179, identifier.pos); + var parameter = createNode(141, identifier.pos); parameter.name = identifier; finishNode(parameter); node.parameters = [parameter]; @@ -8416,7 +8734,7 @@ var ts; return parseParenthesizedArrowFunctionExpressionHead(false); } function parseParenthesizedArrowFunctionExpressionHead(allowAmbiguity) { - var node = createNode(178); + var node = createNode(179); setModifiers(node, parseModifiersForArrowFunction()); var isAsync = !!(node.flags & 256); fillSignature(54, false, isAsync, !allowAmbiguity, node); @@ -8448,7 +8766,7 @@ var ts; if (!questionToken) { return leftOperand; } - var node = createNode(186, leftOperand.pos); + var node = createNode(187, leftOperand.pos); node.condition = leftOperand; node.questionToken = questionToken; node.whenTrue = doOutsideOfContext(disallowInAndDecoratorContext, parseAssignmentExpressionOrHigher); @@ -8461,7 +8779,7 @@ var ts; return parseBinaryExpressionRest(precedence, leftOperand); } function isInOrOfKeyword(t) { - return t === 90 || t === 136; + return t === 90 || t === 137; } function parseBinaryExpressionRest(precedence, leftOperand) { while (true) { @@ -8539,43 +8857,43 @@ var ts; return -1; } function makeBinaryExpression(left, operatorToken, right) { - var node = createNode(185, left.pos); + var node = createNode(186, left.pos); node.left = left; node.operatorToken = operatorToken; node.right = right; return finishNode(node); } function makeAsExpression(left, right) { - var node = createNode(193, left.pos); + var node = createNode(194, left.pos); node.expression = left; node.type = right; return finishNode(node); } function parsePrefixUnaryExpression() { - var node = createNode(183); + var node = createNode(184); node.operator = token; nextToken(); node.operand = parseSimpleUnaryExpression(); return finishNode(node); } function parseDeleteExpression() { - var node = createNode(179); - nextToken(); - node.expression = parseSimpleUnaryExpression(); - return finishNode(node); - } - function parseTypeOfExpression() { var node = createNode(180); nextToken(); node.expression = parseSimpleUnaryExpression(); return finishNode(node); } - function parseVoidExpression() { + function parseTypeOfExpression() { var node = createNode(181); nextToken(); node.expression = parseSimpleUnaryExpression(); return finishNode(node); } + function parseVoidExpression() { + var node = createNode(182); + nextToken(); + node.expression = parseSimpleUnaryExpression(); + return finishNode(node); + } function isAwaitExpression() { if (token === 119) { if (inAwaitContext()) { @@ -8586,7 +8904,7 @@ var ts; return false; } function parseAwaitExpression() { - var node = createNode(182); + var node = createNode(183); nextToken(); node.expression = parseSimpleUnaryExpression(); return finishNode(node); @@ -8605,7 +8923,7 @@ var ts; var simpleUnaryExpression = parseSimpleUnaryExpression(); if (token === 38) { var start = ts.skipTrivia(sourceText, simpleUnaryExpression.pos); - if (simpleUnaryExpression.kind === 175) { + if (simpleUnaryExpression.kind === 176) { 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 { @@ -8653,7 +8971,7 @@ var ts; } function parseIncrementExpression() { if (token === 41 || token === 42) { - var node = createNode(183); + var node = createNode(184); node.operator = token; nextToken(); node.operand = parseLeftHandSideExpressionOrHigher(); @@ -8665,7 +8983,7 @@ var ts; var expression = parseLeftHandSideExpressionOrHigher(); ts.Debug.assert(ts.isLeftHandSideExpression(expression)); if ((token === 41 || token === 42) && !scanner.hasPrecedingLineBreak()) { - var node = createNode(184, expression.pos); + var node = createNode(185, expression.pos); node.operand = expression; node.operator = token; nextToken(); @@ -8688,7 +9006,7 @@ var ts; if (token === 17 || token === 21 || token === 19) { return expression; } - var node = createNode(170, expression.pos); + var node = createNode(171, expression.pos); node.expression = expression; node.dotToken = parseExpectedToken(21, false, ts.Diagnostics.super_must_be_followed_by_an_argument_list_or_member_access); node.name = parseRightSideOfDot(true); @@ -8707,8 +9025,8 @@ var ts; function parseJsxElementOrSelfClosingElement(inExpressionContext) { var opening = parseJsxOpeningOrSelfClosingElement(inExpressionContext); var result; - if (opening.kind === 239) { - var node = createNode(237, opening.pos); + if (opening.kind === 242) { + var node = createNode(240, opening.pos); node.openingElement = opening; node.children = parseJsxChildren(node.openingElement.tagName); node.closingElement = parseJsxClosingElement(inExpressionContext); @@ -8718,14 +9036,14 @@ var ts; result = finishNode(node); } else { - ts.Debug.assert(opening.kind === 238); + ts.Debug.assert(opening.kind === 241); result = opening; } if (inExpressionContext && token === 25) { var invalidElement = tryParse(function () { return parseJsxElementOrSelfClosingElement(true); }); if (invalidElement) { parseErrorAtCurrentToken(ts.Diagnostics.JSX_expressions_must_have_one_parent_element); - var badNode = createNode(185, result.pos); + var badNode = createNode(186, result.pos); badNode.end = invalidElement.end; badNode.left = result; badNode.right = invalidElement; @@ -8737,13 +9055,13 @@ var ts; return result; } function parseJsxText() { - var node = createNode(240, scanner.getStartPos()); + var node = createNode(243, scanner.getStartPos()); token = scanner.scanJsxToken(); return finishNode(node); } function parseJsxChild() { switch (token) { - case 240: + case 243: return parseJsxText(); case 15: return parseJsxExpression(false); @@ -8779,7 +9097,7 @@ var ts; var attributes = parseList(13, parseJsxAttribute); var node; if (token === 27) { - node = createNode(239, fullStart); + node = createNode(242, fullStart); scanJsxText(); } else { @@ -8791,7 +9109,7 @@ var ts; parseExpected(27, undefined, false); scanJsxText(); } - node = createNode(238, fullStart); + node = createNode(241, fullStart); } node.tagName = tagName; node.attributes = attributes; @@ -8802,7 +9120,7 @@ var ts; var elementName = parseIdentifierName(); while (parseOptional(21)) { scanJsxIdentifier(); - var node = createNode(137, elementName.pos); + var node = createNode(138, elementName.pos); node.left = elementName; node.right = parseIdentifierName(); elementName = finishNode(node); @@ -8810,7 +9128,7 @@ var ts; return elementName; } function parseJsxExpression(inExpressionContext) { - var node = createNode(244); + var node = createNode(247); parseExpected(15); if (token !== 16) { node.expression = parseAssignmentExpressionOrHigher(); @@ -8829,7 +9147,7 @@ var ts; return parseJsxSpreadAttribute(); } scanJsxIdentifier(); - var node = createNode(242); + var node = createNode(245); node.name = parseIdentifierName(); if (parseOptional(56)) { switch (token) { @@ -8844,7 +9162,7 @@ var ts; return finishNode(node); } function parseJsxSpreadAttribute() { - var node = createNode(243); + var node = createNode(246); parseExpected(15); parseExpected(22); node.expression = parseExpression(); @@ -8852,7 +9170,7 @@ var ts; return finishNode(node); } function parseJsxClosingElement(inExpressionContext) { - var node = createNode(241); + var node = createNode(244); parseExpected(26); node.tagName = parseJsxElementName(); if (inExpressionContext) { @@ -8865,7 +9183,7 @@ var ts; return finishNode(node); } function parseTypeAssertion() { - var node = createNode(175); + var node = createNode(176); parseExpected(25); node.type = parseType(); parseExpected(27); @@ -8876,15 +9194,22 @@ var ts; while (true) { var dotToken = parseOptionalToken(21); if (dotToken) { - var propertyAccess = createNode(170, expression.pos); + var propertyAccess = createNode(171, expression.pos); propertyAccess.expression = expression; propertyAccess.dotToken = dotToken; propertyAccess.name = parseRightSideOfDot(true); expression = finishNode(propertyAccess); continue; } + if (token === 49 && !scanner.hasPrecedingLineBreak()) { + nextToken(); + var nonNullExpression = createNode(195, expression.pos); + nonNullExpression.expression = expression; + expression = finishNode(nonNullExpression); + continue; + } if (!inDecoratorContext() && parseOptional(19)) { - var indexedAccess = createNode(171, expression.pos); + var indexedAccess = createNode(172, expression.pos); indexedAccess.expression = expression; if (token !== 20) { indexedAccess.argumentExpression = allowInAnd(parseExpression); @@ -8898,7 +9223,7 @@ var ts; continue; } if (token === 11 || token === 12) { - var tagExpression = createNode(174, expression.pos); + var tagExpression = createNode(175, expression.pos); tagExpression.tag = expression; tagExpression.template = token === 11 ? parseLiteralNode() @@ -8917,7 +9242,7 @@ var ts; if (!typeArguments) { return expression; } - var callExpr = createNode(172, expression.pos); + var callExpr = createNode(173, expression.pos); callExpr.expression = expression; callExpr.typeArguments = typeArguments; callExpr.arguments = parseArgumentList(); @@ -8925,7 +9250,7 @@ var ts; continue; } else if (token === 17) { - var callExpr = createNode(172, expression.pos); + var callExpr = createNode(173, expression.pos); callExpr.expression = expression; callExpr.arguments = parseArgumentList(); expression = finishNode(callExpr); @@ -9020,28 +9345,28 @@ var ts; return parseIdentifier(ts.Diagnostics.Expression_expected); } function parseParenthesizedExpression() { - var node = createNode(176); + var node = createNode(177); parseExpected(17); node.expression = allowInAnd(parseExpression); parseExpected(18); return finishNode(node); } function parseSpreadElement() { - var node = createNode(189); + var node = createNode(190); parseExpected(22); node.expression = parseAssignmentExpressionOrHigher(); return finishNode(node); } function parseArgumentOrArrayLiteralElement() { return token === 22 ? parseSpreadElement() : - token === 24 ? createNode(191) : + token === 24 ? createNode(192) : parseAssignmentExpressionOrHigher(); } function parseArgumentExpression() { return doOutsideOfContext(disallowInAndDecoratorContext, parseArgumentOrArrayLiteralElement); } function parseArrayLiteralExpression() { - var node = createNode(168); + var node = createNode(169); parseExpected(19); if (scanner.hasPrecedingLineBreak()) { node.multiLine = true; @@ -9052,10 +9377,10 @@ var ts; } function tryParseAccessorDeclaration(fullStart, decorators, modifiers) { if (parseContextualModifier(123)) { - return parseAccessorDeclaration(147, fullStart, decorators, modifiers); + return addJSDocComment(parseAccessorDeclaration(148, fullStart, decorators, modifiers)); } else if (parseContextualModifier(130)) { - return parseAccessorDeclaration(148, fullStart, decorators, modifiers); + return parseAccessorDeclaration(149, fullStart, decorators, modifiers); } return undefined; } @@ -9076,7 +9401,7 @@ var ts; } var isShorthandPropertyAssignment = tokenIsIdentifier && (token === 24 || token === 16 || token === 56); if (isShorthandPropertyAssignment) { - var shorthandDeclaration = createNode(250, fullStart); + var shorthandDeclaration = createNode(253, fullStart); shorthandDeclaration.name = propertyName; shorthandDeclaration.questionToken = questionToken; var equalsToken = parseOptionalToken(56); @@ -9087,7 +9412,7 @@ var ts; return addJSDocComment(finishNode(shorthandDeclaration)); } else { - var propertyAssignment = createNode(249, fullStart); + var propertyAssignment = createNode(252, fullStart); propertyAssignment.modifiers = modifiers; propertyAssignment.name = propertyName; propertyAssignment.questionToken = questionToken; @@ -9097,7 +9422,7 @@ var ts; } } function parseObjectLiteralExpression() { - var node = createNode(169); + var node = createNode(170); parseExpected(15); if (scanner.hasPrecedingLineBreak()) { node.multiLine = true; @@ -9111,7 +9436,7 @@ var ts; if (saveDecoratorContext) { setDecoratorContext(false); } - var node = createNode(177); + var node = createNode(178); setModifiers(node, parseModifiers()); parseExpected(87); node.asteriskToken = parseOptionalToken(37); @@ -9133,7 +9458,7 @@ var ts; return isIdentifier() ? parseIdentifier() : undefined; } function parseNewExpression() { - var node = createNode(173); + var node = createNode(174); parseExpected(92); node.expression = parseMemberExpressionOrHigher(); node.typeArguments = tryParse(parseTypeArgumentsInExpression); @@ -9143,7 +9468,7 @@ var ts; return finishNode(node); } function parseBlock(ignoreMissingOpenBrace, diagnosticMessage) { - var node = createNode(196); + var node = createNode(198); if (parseExpected(15, diagnosticMessage) || ignoreMissingOpenBrace) { node.statements = parseList(1, parseStatement); parseExpected(16); @@ -9171,12 +9496,12 @@ var ts; return block; } function parseEmptyStatement() { - var node = createNode(198); + var node = createNode(200); parseExpected(23); return finishNode(node); } function parseIfStatement() { - var node = createNode(200); + var node = createNode(202); parseExpected(88); parseExpected(17); node.expression = allowInAnd(parseExpression); @@ -9186,7 +9511,7 @@ var ts; return finishNode(node); } function parseDoStatement() { - var node = createNode(201); + var node = createNode(203); parseExpected(79); node.statement = parseStatement(); parseExpected(104); @@ -9197,7 +9522,7 @@ var ts; return finishNode(node); } function parseWhileStatement() { - var node = createNode(202); + var node = createNode(204); parseExpected(104); parseExpected(17); node.expression = allowInAnd(parseExpression); @@ -9220,21 +9545,21 @@ var ts; } var forOrForInOrForOfStatement; if (parseOptional(90)) { - var forInStatement = createNode(204, pos); + var forInStatement = createNode(206, pos); forInStatement.initializer = initializer; forInStatement.expression = allowInAnd(parseExpression); parseExpected(18); forOrForInOrForOfStatement = forInStatement; } - else if (parseOptional(136)) { - var forOfStatement = createNode(205, pos); + else if (parseOptional(137)) { + var forOfStatement = createNode(207, pos); forOfStatement.initializer = initializer; forOfStatement.expression = allowInAnd(parseAssignmentExpressionOrHigher); parseExpected(18); forOrForInOrForOfStatement = forOfStatement; } else { - var forStatement = createNode(203, pos); + var forStatement = createNode(205, pos); forStatement.initializer = initializer; parseExpected(23); if (token !== 23 && token !== 18) { @@ -9252,7 +9577,7 @@ var ts; } function parseBreakOrContinueStatement(kind) { var node = createNode(kind); - parseExpected(kind === 207 ? 70 : 75); + parseExpected(kind === 209 ? 70 : 75); if (!canParseSemicolon()) { node.label = parseIdentifier(); } @@ -9260,7 +9585,7 @@ var ts; return finishNode(node); } function parseReturnStatement() { - var node = createNode(208); + var node = createNode(210); parseExpected(94); if (!canParseSemicolon()) { node.expression = allowInAnd(parseExpression); @@ -9269,7 +9594,7 @@ var ts; return finishNode(node); } function parseWithStatement() { - var node = createNode(209); + var node = createNode(211); parseExpected(105); parseExpected(17); node.expression = allowInAnd(parseExpression); @@ -9278,7 +9603,7 @@ var ts; return finishNode(node); } function parseCaseClause() { - var node = createNode(245); + var node = createNode(248); parseExpected(71); node.expression = allowInAnd(parseExpression); parseExpected(54); @@ -9286,7 +9611,7 @@ var ts; return finishNode(node); } function parseDefaultClause() { - var node = createNode(246); + var node = createNode(249); parseExpected(77); parseExpected(54); node.statements = parseList(3, parseStatement); @@ -9296,12 +9621,12 @@ var ts; return token === 71 ? parseCaseClause() : parseDefaultClause(); } function parseSwitchStatement() { - var node = createNode(210); + var node = createNode(212); parseExpected(96); parseExpected(17); node.expression = allowInAnd(parseExpression); parseExpected(18); - var caseBlock = createNode(224, scanner.getStartPos()); + var caseBlock = createNode(226, scanner.getStartPos()); parseExpected(15); caseBlock.clauses = parseList(2, parseCaseOrDefaultClause); parseExpected(16); @@ -9309,14 +9634,14 @@ var ts; return finishNode(node); } function parseThrowStatement() { - var node = createNode(212); + var node = createNode(214); parseExpected(98); node.expression = scanner.hasPrecedingLineBreak() ? undefined : allowInAnd(parseExpression); parseSemicolon(); return finishNode(node); } function parseTryStatement() { - var node = createNode(213); + var node = createNode(215); parseExpected(100); node.tryBlock = parseBlock(false); node.catchClause = token === 72 ? parseCatchClause() : undefined; @@ -9327,7 +9652,7 @@ var ts; return finishNode(node); } function parseCatchClause() { - var result = createNode(248); + var result = createNode(251); parseExpected(72); if (parseExpected(17)) { result.variableDeclaration = parseVariableDeclaration(); @@ -9337,7 +9662,7 @@ var ts; return finishNode(result); } function parseDebuggerStatement() { - var node = createNode(214); + var node = createNode(216); parseExpected(76); parseSemicolon(); return finishNode(node); @@ -9346,13 +9671,13 @@ var ts; var fullStart = scanner.getStartPos(); var expression = allowInAnd(parseExpression); if (expression.kind === 69 && parseOptional(54)) { - var labeledStatement = createNode(211, fullStart); + var labeledStatement = createNode(213, fullStart); labeledStatement.label = expression; labeledStatement.statement = parseStatement(); return addJSDocComment(finishNode(labeledStatement)); } else { - var expressionStatement = createNode(199, fullStart); + var expressionStatement = createNode(201, fullStart); expressionStatement.expression = expression; parseSemicolon(); return addJSDocComment(finishNode(expressionStatement)); @@ -9398,8 +9723,9 @@ var ts; return false; } continue; - case 135: - return nextToken() === 15; + case 136: + nextToken(); + return token === 15 || token === 69 || token === 82; case 89: nextToken(); return token === 9 || token === 37 || @@ -9407,7 +9733,8 @@ var ts; case 82: nextToken(); if (token === 56 || token === 37 || - token === 15 || token === 77) { + token === 15 || token === 77 || + token === 116) { return true; } continue; @@ -9457,7 +9784,7 @@ var ts; case 125: case 126: case 133: - case 135: + case 136: return true; case 112: case 110: @@ -9502,9 +9829,9 @@ var ts; case 86: return parseForOrForInOrForOfStatement(); case 75: - return parseBreakOrContinueStatement(206); + return parseBreakOrContinueStatement(208); case 70: - return parseBreakOrContinueStatement(207); + return parseBreakOrContinueStatement(209); case 94: return parseReturnStatement(); case 105: @@ -9537,7 +9864,7 @@ var ts; case 115: case 113: case 127: - case 135: + case 136: if (isStartOfDeclaration()) { return parseDeclaration(); } @@ -9564,7 +9891,7 @@ var ts; return parseTypeAliasDeclaration(fullStart, decorators, modifiers); case 81: return parseEnumDeclaration(fullStart, decorators, modifiers); - case 135: + case 136: case 125: case 126: return parseModuleDeclaration(fullStart, decorators, modifiers); @@ -9572,12 +9899,18 @@ var ts; return parseImportDeclarationOrImportEqualsDeclaration(fullStart, decorators, modifiers); case 82: nextToken(); - return token === 77 || token === 56 ? - parseExportAssignment(fullStart, decorators, modifiers) : - parseExportDeclaration(fullStart, decorators, modifiers); + switch (token) { + case 77: + case 56: + return parseExportAssignment(fullStart, decorators, modifiers); + case 116: + return parseGlobalModuleExportDeclaration(fullStart, decorators, modifiers); + default: + return parseExportDeclaration(fullStart, decorators, modifiers); + } default: if (decorators || modifiers) { - var node = createMissingNode(235, true, ts.Diagnostics.Declaration_expected); + var node = createMissingNode(238, true, ts.Diagnostics.Declaration_expected); node.pos = fullStart; node.decorators = decorators; setModifiers(node, modifiers); @@ -9598,16 +9931,16 @@ var ts; } function parseArrayBindingElement() { if (token === 24) { - return createNode(191); + return createNode(192); } - var node = createNode(167); + var node = createNode(168); node.dotDotDotToken = parseOptionalToken(22); node.name = parseIdentifierOrPattern(); node.initializer = parseBindingElementInitializer(false); return finishNode(node); } function parseObjectBindingElement() { - var node = createNode(167); + var node = createNode(168); var tokenIsIdentifier = isIdentifier(); var propertyName = parsePropertyName(); if (tokenIsIdentifier && token !== 54) { @@ -9622,14 +9955,14 @@ var ts; return finishNode(node); } function parseObjectBindingPattern() { - var node = createNode(165); + var node = createNode(166); parseExpected(15); node.elements = parseDelimitedList(9, parseObjectBindingElement); parseExpected(16); return finishNode(node); } function parseArrayBindingPattern() { - var node = createNode(166); + var node = createNode(167); parseExpected(19); node.elements = parseDelimitedList(10, parseArrayBindingElement); parseExpected(20); @@ -9648,7 +9981,7 @@ var ts; return parseIdentifier(); } function parseVariableDeclaration() { - var node = createNode(215); + var node = createNode(217); node.name = parseIdentifierOrPattern(); node.type = parseTypeAnnotation(); if (!isInOrOfKeyword(token)) { @@ -9657,7 +9990,7 @@ var ts; return finishNode(node); } function parseVariableDeclarationList(inForStatementInitializer) { - var node = createNode(216); + var node = createNode(218); switch (token) { case 102: break; @@ -9671,7 +10004,7 @@ var ts; ts.Debug.fail(); } nextToken(); - if (token === 136 && lookAhead(canFollowContextualOfKeyword)) { + if (token === 137 && lookAhead(canFollowContextualOfKeyword)) { node.declarations = createMissingList(); } else { @@ -9686,7 +10019,7 @@ var ts; return nextTokenIsIdentifier() && nextToken() === 18; } function parseVariableStatement(fullStart, decorators, modifiers) { - var node = createNode(197, fullStart); + var node = createNode(199, fullStart); node.decorators = decorators; setModifiers(node, modifiers); node.declarationList = parseVariableDeclarationList(false); @@ -9694,7 +10027,7 @@ var ts; return addJSDocComment(finishNode(node)); } function parseFunctionDeclaration(fullStart, decorators, modifiers) { - var node = createNode(217, fullStart); + var node = createNode(219, fullStart); node.decorators = decorators; setModifiers(node, modifiers); parseExpected(87); @@ -9707,7 +10040,7 @@ var ts; return addJSDocComment(finishNode(node)); } function parseConstructorDeclaration(pos, decorators, modifiers) { - var node = createNode(146, pos); + var node = createNode(147, pos); node.decorators = decorators; setModifiers(node, modifiers); parseExpected(121); @@ -9716,7 +10049,7 @@ var ts; return addJSDocComment(finishNode(node)); } function parseMethodDeclaration(fullStart, decorators, modifiers, asteriskToken, name, questionToken, diagnosticMessage) { - var method = createNode(145, fullStart); + var method = createNode(146, fullStart); method.decorators = decorators; setModifiers(method, modifiers); method.asteriskToken = asteriskToken; @@ -9729,7 +10062,7 @@ var ts; return addJSDocComment(finishNode(method)); } function parsePropertyDeclaration(fullStart, decorators, modifiers, name, questionToken) { - var property = createNode(143, fullStart); + var property = createNode(144, fullStart); property.decorators = decorators; setModifiers(property, modifiers); property.name = name; @@ -9826,7 +10159,7 @@ var ts; decorators = []; decorators.pos = decoratorStart; } - var decorator = createNode(141, decoratorStart); + var decorator = createNode(142, decoratorStart); decorator.expression = doInDecoratorContext(parseLeftHandSideExpressionOrHigher); decorators.push(finishNode(decorator)); } @@ -9882,7 +10215,7 @@ var ts; } function parseClassElement() { if (token === 23) { - var result = createNode(195); + var result = createNode(197); nextToken(); return finishNode(result); } @@ -9913,10 +10246,10 @@ var ts; ts.Debug.fail("Should not have attempted to parse class member declaration."); } function parseClassExpression() { - return parseClassDeclarationOrExpression(scanner.getStartPos(), undefined, undefined, 190); + return parseClassDeclarationOrExpression(scanner.getStartPos(), undefined, undefined, 191); } function parseClassDeclaration(fullStart, decorators, modifiers) { - return parseClassDeclarationOrExpression(fullStart, decorators, modifiers, 218); + return parseClassDeclarationOrExpression(fullStart, decorators, modifiers, 220); } function parseClassDeclarationOrExpression(fullStart, decorators, modifiers, kind) { var node = createNode(kind, fullStart); @@ -9951,7 +10284,7 @@ var ts; } function parseHeritageClause() { if (token === 83 || token === 106) { - var node = createNode(247); + var node = createNode(250); node.token = token; nextToken(); node.types = parseDelimitedList(7, parseExpressionWithTypeArguments); @@ -9960,7 +10293,7 @@ var ts; return undefined; } function parseExpressionWithTypeArguments() { - var node = createNode(192); + var node = createNode(193); node.expression = parseLeftHandSideExpressionOrHigher(); if (token === 25) { node.typeArguments = parseBracketedList(18, parseType, 25, 27); @@ -9974,7 +10307,7 @@ var ts; return parseList(5, parseClassElement); } function parseInterfaceDeclaration(fullStart, decorators, modifiers) { - var node = createNode(219, fullStart); + var node = createNode(221, fullStart); node.decorators = decorators; setModifiers(node, modifiers); parseExpected(107); @@ -9985,7 +10318,7 @@ var ts; return finishNode(node); } function parseTypeAliasDeclaration(fullStart, decorators, modifiers) { - var node = createNode(220, fullStart); + var node = createNode(222, fullStart); node.decorators = decorators; setModifiers(node, modifiers); parseExpected(133); @@ -9997,13 +10330,13 @@ var ts; return finishNode(node); } function parseEnumMember() { - var node = createNode(251, scanner.getStartPos()); + var node = createNode(254, scanner.getStartPos()); node.name = parsePropertyName(); node.initializer = allowInAnd(parseNonParameterInitializer); return finishNode(node); } function parseEnumDeclaration(fullStart, decorators, modifiers) { - var node = createNode(221, fullStart); + var node = createNode(223, fullStart); node.decorators = decorators; setModifiers(node, modifiers); parseExpected(81); @@ -10018,7 +10351,7 @@ var ts; return finishNode(node); } function parseModuleBlock() { - var node = createNode(223, scanner.getStartPos()); + var node = createNode(225, scanner.getStartPos()); if (parseExpected(15)) { node.statements = parseList(1, parseStatement); parseExpected(16); @@ -10029,7 +10362,7 @@ var ts; return finishNode(node); } function parseModuleOrNamespaceDeclaration(fullStart, decorators, modifiers, flags) { - var node = createNode(222, fullStart); + var node = createNode(224, fullStart); var namespaceFlag = flags & 4096; node.decorators = decorators; setModifiers(node, modifiers); @@ -10041,10 +10374,10 @@ var ts; return finishNode(node); } function parseAmbientExternalModuleDeclaration(fullStart, decorators, modifiers) { - var node = createNode(222, fullStart); + var node = createNode(224, fullStart); node.decorators = decorators; setModifiers(node, modifiers); - if (token === 135) { + if (token === 136) { node.name = parseIdentifier(); node.flags |= 131072; } @@ -10056,7 +10389,7 @@ var ts; } function parseModuleDeclaration(fullStart, decorators, modifiers) { var flags = modifiers ? modifiers.flags : 0; - if (token === 135) { + if (token === 136) { return parseAmbientExternalModuleDeclaration(fullStart, decorators, modifiers); } else if (parseOptional(126)) { @@ -10080,14 +10413,24 @@ var ts; function nextTokenIsSlash() { return nextToken() === 39; } + function parseGlobalModuleExportDeclaration(fullStart, decorators, modifiers) { + var exportDeclaration = createNode(227, fullStart); + exportDeclaration.decorators = decorators; + exportDeclaration.modifiers = modifiers; + parseExpected(116); + parseExpected(126); + exportDeclaration.name = parseIdentifier(); + parseExpected(23); + return finishNode(exportDeclaration); + } function parseImportDeclarationOrImportEqualsDeclaration(fullStart, decorators, modifiers) { parseExpected(89); var afterImportPos = scanner.getStartPos(); var identifier; if (isIdentifier()) { identifier = parseIdentifier(); - if (token !== 24 && token !== 134) { - var importEqualsDeclaration = createNode(225, fullStart); + if (token !== 24 && token !== 135) { + var importEqualsDeclaration = createNode(228, fullStart); importEqualsDeclaration.decorators = decorators; setModifiers(importEqualsDeclaration, modifiers); importEqualsDeclaration.name = identifier; @@ -10097,27 +10440,27 @@ var ts; return finishNode(importEqualsDeclaration); } } - var importDeclaration = createNode(226, fullStart); + var importDeclaration = createNode(229, fullStart); importDeclaration.decorators = decorators; setModifiers(importDeclaration, modifiers); if (identifier || token === 37 || token === 15) { importDeclaration.importClause = parseImportClause(identifier, afterImportPos); - parseExpected(134); + parseExpected(135); } importDeclaration.moduleSpecifier = parseModuleSpecifier(); parseSemicolon(); return finishNode(importDeclaration); } function parseImportClause(identifier, fullStart) { - var importClause = createNode(227, fullStart); + var importClause = createNode(230, fullStart); if (identifier) { importClause.name = identifier; } if (!importClause.name || parseOptional(24)) { - importClause.namedBindings = token === 37 ? parseNamespaceImport() : parseNamedImportsOrExports(229); + importClause.namedBindings = token === 37 ? parseNamespaceImport() : parseNamedImportsOrExports(232); } return finishNode(importClause); } @@ -10127,7 +10470,7 @@ var ts; : parseEntityName(false); } function parseExternalModuleReference() { - var node = createNode(236); + var node = createNode(239); parseExpected(128); parseExpected(17); node.expression = parseModuleSpecifier(); @@ -10145,7 +10488,7 @@ var ts; } } function parseNamespaceImport() { - var namespaceImport = createNode(228); + var namespaceImport = createNode(231); parseExpected(37); parseExpected(116); namespaceImport.name = parseIdentifier(); @@ -10153,14 +10496,14 @@ var ts; } function parseNamedImportsOrExports(kind) { var node = createNode(kind); - node.elements = parseBracketedList(21, kind === 229 ? parseImportSpecifier : parseExportSpecifier, 15, 16); + node.elements = parseBracketedList(21, kind === 232 ? parseImportSpecifier : parseExportSpecifier, 15, 16); return finishNode(node); } function parseExportSpecifier() { - return parseImportOrExportSpecifier(234); + return parseImportOrExportSpecifier(237); } function parseImportSpecifier() { - return parseImportOrExportSpecifier(230); + return parseImportOrExportSpecifier(233); } function parseImportOrExportSpecifier(kind) { var node = createNode(kind); @@ -10179,23 +10522,23 @@ var ts; else { node.name = identifierName; } - if (kind === 230 && checkIdentifierIsKeyword) { + if (kind === 233 && checkIdentifierIsKeyword) { parseErrorAtPosition(checkIdentifierStart, checkIdentifierEnd - checkIdentifierStart, ts.Diagnostics.Identifier_expected); } return finishNode(node); } function parseExportDeclaration(fullStart, decorators, modifiers) { - var node = createNode(232, fullStart); + var node = createNode(235, fullStart); node.decorators = decorators; setModifiers(node, modifiers); if (parseOptional(37)) { - parseExpected(134); + parseExpected(135); node.moduleSpecifier = parseModuleSpecifier(); } else { - node.exportClause = parseNamedImportsOrExports(233); - if (token === 134 || (token === 9 && !scanner.hasPrecedingLineBreak())) { - parseExpected(134); + node.exportClause = parseNamedImportsOrExports(236); + if (token === 135 || (token === 9 && !scanner.hasPrecedingLineBreak())) { + parseExpected(135); node.moduleSpecifier = parseModuleSpecifier(); } } @@ -10203,7 +10546,7 @@ var ts; return finishNode(node); } function parseExportAssignment(fullStart, decorators, modifiers) { - var node = createNode(231, fullStart); + var node = createNode(234, fullStart); node.decorators = decorators; setModifiers(node, modifiers); if (parseOptional(56)) { @@ -10219,6 +10562,7 @@ var ts; function processReferenceComments(sourceFile) { var triviaScanner = ts.createScanner(sourceFile.languageVersion, false, 0, sourceText); var referencedFiles = []; + var typeReferenceDirectives = []; var amdDependencies = []; var amdModuleName; while (true) { @@ -10239,7 +10583,12 @@ var ts; sourceFile.hasNoDefaultLib = referencePathMatchResult.isNoDefaultLib; var diagnosticMessage = referencePathMatchResult.diagnosticMessage; if (fileReference) { - referencedFiles.push(fileReference); + if (referencePathMatchResult.isTypeReferenceDirective) { + typeReferenceDirectives.push(fileReference); + } + else { + referencedFiles.push(fileReference); + } } if (diagnosticMessage) { parseDiagnostics.push(ts.createFileDiagnostic(sourceFile, range.pos, range.end - range.pos, diagnosticMessage)); @@ -10269,16 +10618,17 @@ var ts; } } sourceFile.referencedFiles = referencedFiles; + sourceFile.typeReferenceDirectives = typeReferenceDirectives; sourceFile.amdDependencies = amdDependencies; sourceFile.moduleName = amdModuleName; } function setExternalModuleIndicator(sourceFile) { sourceFile.externalModuleIndicator = ts.forEach(sourceFile.statements, function (node) { return node.flags & 1 - || node.kind === 225 && node.moduleReference.kind === 236 - || node.kind === 226 - || node.kind === 231 - || node.kind === 232 + || node.kind === 228 && node.moduleReference.kind === 239 + || node.kind === 229 + || node.kind === 234 + || node.kind === 235 ? node : undefined; }); @@ -10313,7 +10663,7 @@ var ts; } JSDocParser.parseJSDocTypeExpressionForTests = parseJSDocTypeExpressionForTests; function parseJSDocTypeExpression() { - var result = createNode(253, scanner.getTokenPos()); + var result = createNode(256, scanner.getTokenPos()); parseExpected(15); result.type = parseJSDocTopLevelType(); parseExpected(16); @@ -10324,12 +10674,12 @@ var ts; function parseJSDocTopLevelType() { var type = parseJSDocType(); if (token === 47) { - var unionType = createNode(257, type.pos); + var unionType = createNode(260, type.pos); unionType.types = parseJSDocTypeList(type); type = finishNode(unionType); } if (token === 56) { - var optionalType = createNode(264, type.pos); + var optionalType = createNode(267, type.pos); nextToken(); optionalType.type = type; type = finishNode(optionalType); @@ -10340,20 +10690,20 @@ var ts; var type = parseBasicTypeExpression(); while (true) { if (token === 19) { - var arrayType = createNode(256, type.pos); + var arrayType = createNode(259, type.pos); arrayType.elementType = type; nextToken(); parseExpected(20); type = finishNode(arrayType); } else if (token === 53) { - var nullableType = createNode(259, type.pos); + var nullableType = createNode(262, type.pos); nullableType.type = type; nextToken(); type = finishNode(nullableType); } else if (token === 49) { - var nonNullableType = createNode(260, type.pos); + var nonNullableType = createNode(263, type.pos); nonNullableType.type = type; nextToken(); type = finishNode(nonNullableType); @@ -10397,27 +10747,27 @@ var ts; return parseJSDocTypeReference(); } function parseJSDocThisType() { - var result = createNode(268); + var result = createNode(271); nextToken(); parseExpected(54); result.type = parseJSDocType(); return finishNode(result); } function parseJSDocConstructorType() { - var result = createNode(267); + var result = createNode(270); nextToken(); parseExpected(54); result.type = parseJSDocType(); return finishNode(result); } function parseJSDocVariadicType() { - var result = createNode(266); + var result = createNode(269); nextToken(); result.type = parseJSDocType(); return finishNode(result); } function parseJSDocFunctionType() { - var result = createNode(265); + var result = createNode(268); nextToken(); parseExpected(17); result.parameters = parseDelimitedList(22, parseJSDocParameter); @@ -10430,7 +10780,7 @@ var ts; return finishNode(result); } function parseJSDocParameter() { - var parameter = createNode(140); + var parameter = createNode(141); parameter.type = parseJSDocType(); if (parseOptional(56)) { parameter.questionToken = createNode(56); @@ -10438,7 +10788,7 @@ var ts; return finishNode(parameter); } function parseJSDocTypeReference() { - var result = createNode(263); + var result = createNode(266); result.name = parseSimplePropertyName(); if (token === 25) { result.typeArguments = parseTypeArguments(); @@ -10472,13 +10822,13 @@ var ts; } } function parseQualifiedName(left) { - var result = createNode(137, left.pos); + var result = createNode(138, left.pos); result.left = left; result.right = parseIdentifierName(); return finishNode(result); } function parseJSDocRecordType() { - var result = createNode(261); + var result = createNode(264); nextToken(); result.members = parseDelimitedList(24, parseJSDocRecordMember); checkForTrailingComma(result.members); @@ -10486,7 +10836,7 @@ var ts; return finishNode(result); } function parseJSDocRecordMember() { - var result = createNode(262); + var result = createNode(265); result.name = parseSimplePropertyName(); if (token === 54) { nextToken(); @@ -10495,13 +10845,13 @@ var ts; return finishNode(result); } function parseJSDocNonNullableType() { - var result = createNode(260); + var result = createNode(263); nextToken(); result.type = parseJSDocType(); return finishNode(result); } function parseJSDocTupleType() { - var result = createNode(258); + var result = createNode(261); nextToken(); result.types = parseDelimitedList(25, parseJSDocType); checkForTrailingComma(result.types); @@ -10515,7 +10865,7 @@ var ts; } } function parseJSDocUnionType() { - var result = createNode(257); + var result = createNode(260); nextToken(); result.types = parseJSDocTypeList(parseJSDocType()); parseExpected(18); @@ -10533,7 +10883,7 @@ var ts; return types; } function parseJSDocAllType() { - var result = createNode(254); + var result = createNode(257); nextToken(); return finishNode(result); } @@ -10546,11 +10896,11 @@ var ts; token === 27 || token === 56 || token === 47) { - var result = createNode(255, pos); + var result = createNode(258, pos); return finishNode(result); } else { - var result = createNode(259, pos); + var result = createNode(262, pos); result.type = parseJSDocType(); return finishNode(result); } @@ -10630,7 +10980,7 @@ var ts; if (!tags) { return undefined; } - var result = createNode(269, start); + var result = createNode(272, start); result.tags = tags; return finishNode(result, end); } @@ -10668,7 +11018,7 @@ var ts; return undefined; } function handleUnknownTag(atToken, tagName) { - var result = createNode(270, atToken.pos); + var result = createNode(273, atToken.pos); result.atToken = atToken; result.tagName = tagName; return finishNode(result); @@ -10720,7 +11070,7 @@ var ts; if (!typeExpression) { typeExpression = tryParseTypeExpression(); } - var result = createNode(271, atToken.pos); + var result = createNode(274, atToken.pos); result.atToken = atToken; result.tagName = tagName; result.preParameterName = preName; @@ -10730,27 +11080,27 @@ var ts; return finishNode(result); } function handleReturnTag(atToken, tagName) { - if (ts.forEach(tags, function (t) { return t.kind === 272; })) { + if (ts.forEach(tags, function (t) { return t.kind === 275; })) { parseErrorAtPosition(tagName.pos, scanner.getTokenPos() - tagName.pos, ts.Diagnostics._0_tag_already_specified, tagName.text); } - var result = createNode(272, atToken.pos); + var result = createNode(275, 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 === 273; })) { + if (ts.forEach(tags, function (t) { return t.kind === 276; })) { parseErrorAtPosition(tagName.pos, scanner.getTokenPos() - tagName.pos, ts.Diagnostics._0_tag_already_specified, tagName.text); } - var result = createNode(273, atToken.pos); + var result = createNode(276, atToken.pos); result.atToken = atToken; result.tagName = tagName; result.typeExpression = tryParseTypeExpression(); return finishNode(result); } function handleTemplateTag(atToken, tagName) { - if (ts.forEach(tags, function (t) { return t.kind === 274; })) { + if (ts.forEach(tags, function (t) { return t.kind === 277; })) { parseErrorAtPosition(tagName.pos, scanner.getTokenPos() - tagName.pos, ts.Diagnostics._0_tag_already_specified, tagName.text); } var typeParameters = []; @@ -10761,7 +11111,7 @@ var ts; parseErrorAtPosition(scanner.getStartPos(), 0, ts.Diagnostics.Identifier_expected); return undefined; } - var typeParameter = createNode(139, name_8.pos); + var typeParameter = createNode(140, name_8.pos); typeParameter.name = name_8; finishNode(typeParameter); typeParameters.push(typeParameter); @@ -10772,7 +11122,7 @@ var ts; break; } } - var result = createNode(274, atToken.pos); + var result = createNode(277, atToken.pos); result.atToken = atToken; result.tagName = tagName; result.typeParameters = typeParameters; @@ -11093,16 +11443,16 @@ var ts; : 4; } function getModuleInstanceState(node) { - if (node.kind === 219 || node.kind === 220) { + if (node.kind === 221 || node.kind === 222) { return 0; } else if (ts.isConstEnumDeclaration(node)) { return 2; } - else if ((node.kind === 226 || node.kind === 225) && !(node.flags & 1)) { + else if ((node.kind === 229 || node.kind === 228) && !(node.flags & 1)) { return 0; } - else if (node.kind === 223) { + else if (node.kind === 225) { var state_1 = 0; ts.forEachChild(node, function (n) { switch (getModuleInstanceState(n)) { @@ -11118,7 +11468,7 @@ var ts; }); return state_1; } - else if (node.kind === 222) { + else if (node.kind === 224) { return getModuleInstanceState(node.body); } else { @@ -11150,6 +11500,7 @@ var ts; var hasAsyncFunctions; var hasDecorators; var hasParameterDecorators; + var hasJsxSpreadAttribute; var inStrictMode; var symbolCount = 0; var Symbol; @@ -11180,6 +11531,7 @@ var ts; hasAsyncFunctions = false; hasDecorators = false; hasParameterDecorators = false; + hasJsxSpreadAttribute = false; } return bindSourceFile; function createSymbol(flags, name) { @@ -11202,7 +11554,7 @@ var ts; if (symbolFlags & 107455) { var valueDeclaration = symbol.valueDeclaration; if (!valueDeclaration || - (valueDeclaration.kind !== node.kind && valueDeclaration.kind === 222)) { + (valueDeclaration.kind !== node.kind && valueDeclaration.kind === 224)) { symbol.valueDeclaration = node; } } @@ -11212,7 +11564,7 @@ var ts; if (ts.isAmbientModule(node)) { return ts.isGlobalScopeAugmentation(node) ? "__global" : "\"" + node.name.text + "\""; } - if (node.name.kind === 138) { + if (node.name.kind === 139) { var nameExpression = node.name.expression; if (ts.isStringOrNumericLiteral(nameExpression.kind)) { return nameExpression.text; @@ -11223,21 +11575,21 @@ var ts; return node.name.text; } switch (node.kind) { - case 146: + case 147: return "__constructor"; - case 154: - case 149: - return "__call"; case 155: case 150: - return "__new"; + return "__call"; + case 156: case 151: + return "__new"; + case 152: return "__index"; - case 232: + case 235: return "__export"; - case 231: + case 234: return node.isExportEquals ? "export=" : "default"; - case 185: + case 186: switch (ts.getSpecialPropertyAssignmentKind(node)) { case 2: return "export="; @@ -11249,13 +11601,13 @@ var ts; } ts.Debug.fail("Unknown binary declaration kind"); break; - case 217: - case 218: + case 219: + case 220: return node.flags & 512 ? "default" : undefined; - case 265: + case 268: return ts.isJSDocConstructSignature(node) ? "__new" : "__call"; - case 140: - ts.Debug.assert(node.parent.kind === 265); + case 141: + ts.Debug.assert(node.parent.kind === 268); var functionType = node.parent; var index = ts.indexOf(functionType.parameters, node); return "p" + index; @@ -11305,7 +11657,7 @@ var ts; function declareModuleMember(node, symbolFlags, symbolExcludes) { var hasExportModifier = ts.getCombinedNodeFlags(node) & 1; if (symbolFlags & 8388608) { - if (node.kind === 234 || (node.kind === 225 && hasExportModifier)) { + if (node.kind === 237 || (node.kind === 228 && hasExportModifier)) { return declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes); } else { @@ -11353,10 +11705,10 @@ var ts; var flags = node.flags; flags &= ~98304; flags &= ~3932160; - if (kind === 219) { + if (kind === 221) { seenThisKeyword = false; } - var saveState = kind === 252 || kind === 223 || ts.isFunctionLikeKind(kind); + var saveState = kind === 255 || kind === 225 || ts.isFunctionLikeKind(kind); if (saveState) { savedReachabilityState = currentReachabilityState; savedLabelStack = labelStack; @@ -11377,10 +11729,10 @@ var ts; flags |= 65536; } } - if (kind === 219) { + if (kind === 221) { flags = seenThisKeyword ? flags | 16384 : flags & ~16384; } - if (kind === 252) { + if (kind === 255) { if (hasClassExtends) { flags |= 262144; } @@ -11393,6 +11745,9 @@ var ts; if (hasAsyncFunctions) { flags |= 2097152; } + if (hasJsxSpreadAttribute) { + flags |= 1073741824; + } } node.flags = flags; if (saveState) { @@ -11412,40 +11767,40 @@ var ts; return; } switch (node.kind) { - case 202: + case 204: bindWhileStatement(node); break; - case 201: + case 203: bindDoStatement(node); break; - case 203: + case 205: bindForStatement(node); break; - case 204: - case 205: + case 206: + case 207: bindForInOrForOfStatement(node); break; - case 200: + case 202: bindIfStatement(node); break; - case 208: - case 212: + case 210: + case 214: bindReturnOrThrow(node); break; - case 207: - case 206: + case 209: + case 208: bindBreakOrContinueStatement(node); break; - case 213: + case 215: bindTryStatement(node); break; - case 210: + case 212: bindSwitchStatement(node); break; - case 224: + case 226: bindCaseBlock(node); break; - case 211: + case 213: bindLabeledStatement(node); break; default: @@ -11507,14 +11862,14 @@ var ts; } function bindReturnOrThrow(n) { bind(n.expression); - if (n.kind === 208) { + if (n.kind === 210) { hasExplicitReturn = true; } currentReachabilityState = 4; } function bindBreakOrContinueStatement(n) { bind(n.label); - var isValidJump = jumpToLabel(n.label, n.kind === 207 ? currentReachabilityState : 4); + var isValidJump = jumpToLabel(n.label, n.kind === 209 ? currentReachabilityState : 4); if (isValidJump) { currentReachabilityState = 4; } @@ -11528,24 +11883,27 @@ var ts; var postCatchState = currentReachabilityState; currentReachabilityState = preTryState; bind(n.finallyBlock); - currentReachabilityState = or(postTryState, postCatchState); + currentReachabilityState = n.catchClause ? or(postTryState, postCatchState) : postTryState; } function bindSwitchStatement(n) { var preSwitchState = currentReachabilityState; var postSwitchLabel = pushImplicitLabel(); bind(n.expression); bind(n.caseBlock); - var hasDefault = ts.forEach(n.caseBlock.clauses, function (c) { return c.kind === 246; }); + var hasDefault = ts.forEach(n.caseBlock.clauses, function (c) { return c.kind === 249; }); var postSwitchState = hasDefault && currentReachabilityState !== 2 ? 4 : preSwitchState; popImplicitLabel(postSwitchLabel, postSwitchState); } function bindCaseBlock(n) { var startState = currentReachabilityState; - for (var _i = 0, _a = n.clauses; _i < _a.length; _i++) { - var clause = _a[_i]; + for (var i = 0; i < n.clauses.length; i++) { + var clause = n.clauses[i]; currentReachabilityState = startState; bind(clause); - if (clause.statements.length && currentReachabilityState === 2 && options.noFallthroughCasesInSwitch) { + if (clause.statements.length && + i !== n.clauses.length - 1 && + currentReachabilityState === 2 && + options.noFallthroughCasesInSwitch) { errorOnFirstToken(clause, ts.Diagnostics.Fallthrough_case_in_switch); } } @@ -11560,38 +11918,39 @@ var ts; } function getContainerFlags(node) { switch (node.kind) { - case 190: - case 218: - case 219: + case 191: + case 220: case 221: - case 169: - case 157: - case 261: + case 223: + case 170: + case 158: + case 264: return 1; - case 149: case 150: case 151: - case 145: - case 144: - case 217: + case 152: case 146: + case 145: + case 219: case 147: case 148: - case 154: + case 149: case 155: - case 177: + case 268: + case 156: case 178: - case 222: - case 252: - case 220: - return 5; - case 248: - case 203: - case 204: - case 205: + case 179: case 224: + case 255: + case 222: + return 5; + case 251: + case 205: + case 206: + case 207: + case 226: return 2; - case 196: + case 198: return ts.isFunctionLike(node.parent) ? 0 : 2; } return 0; @@ -11607,35 +11966,35 @@ var ts; } function declareSymbolAndAddToSymbolTableWorker(node, symbolFlags, symbolExcludes) { switch (container.kind) { - case 222: + case 224: return declareModuleMember(node, symbolFlags, symbolExcludes); - case 252: + case 255: return declareSourceFileMember(node, symbolFlags, symbolExcludes); - case 190: - case 218: + case 191: + case 220: return declareClassMember(node, symbolFlags, symbolExcludes); - case 221: + case 223: return declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes); - case 157: - case 169: - case 219: - case 261: + case 158: + case 170: + case 221: + case 264: return declareSymbol(container.symbol.members, container.symbol, node, symbolFlags, symbolExcludes); - case 154: case 155: - case 149: + case 156: case 150: case 151: - case 145: - case 144: + case 152: case 146: + case 145: case 147: case 148: - case 217: - case 177: + case 149: + case 219: case 178: - case 265: - case 220: + case 179: + case 268: + case 222: return declareSymbol(container.locals, undefined, node, symbolFlags, symbolExcludes); } } @@ -11650,11 +12009,11 @@ var ts; : declareSymbol(file.locals, undefined, node, symbolFlags, symbolExcludes); } function hasExportDeclarations(node) { - var body = node.kind === 252 ? node : node.body; - if (body.kind === 252 || body.kind === 223) { + var body = node.kind === 255 ? node : node.body; + if (body.kind === 255 || body.kind === 225) { for (var _i = 0, _a = body.statements; _i < _a.length; _i++) { var stat = _a[_i]; - if (stat.kind === 232 || stat.kind === 231) { + if (stat.kind === 235 || stat.kind === 234) { return true; } } @@ -11675,7 +12034,12 @@ var ts; if (node.flags & 1) { errorOnFirstToken(node, ts.Diagnostics.export_modifier_cannot_be_applied_to_ambient_modules_and_module_augmentations_since_they_are_always_visible); } - declareSymbolAndAddToSymbolTable(node, 512, 106639); + if (ts.isExternalModuleAugmentation(node)) { + declareSymbolAndAddToSymbolTable(node, 1024, 0); + } + else { + declareSymbolAndAddToSymbolTable(node, 512, 106639); + } } else { var state = getModuleInstanceState(node); @@ -11716,7 +12080,7 @@ var ts; continue; } var identifier = prop.name; - var currentKind = prop.kind === 249 || prop.kind === 250 || prop.kind === 145 + var currentKind = prop.kind === 252 || prop.kind === 253 || prop.kind === 146 ? 1 : 2; var existingKind = seen[identifier.text]; @@ -11738,10 +12102,10 @@ var ts; } function bindBlockScopedDeclaration(node, symbolFlags, symbolExcludes) { switch (blockScopeContainer.kind) { - case 222: + case 224: declareModuleMember(node, symbolFlags, symbolExcludes); break; - case 252: + case 255: if (ts.isExternalModule(container)) { declareModuleMember(node, symbolFlags, symbolExcludes); break; @@ -11863,17 +12227,17 @@ var ts; } function updateStrictMode(node) { switch (node.kind) { - case 252: - case 223: + case 255: + case 225: updateStrictModeStatementList(node.statements); return; - case 196: + case 198: if (ts.isFunctionLike(node.parent)) { updateStrictModeStatementList(node.statements); } return; - case 218: - case 190: + case 220: + case 191: inStrictMode = true; return; } @@ -11892,13 +12256,13 @@ var ts; } function isUseStrictPrologueDirective(node) { var nodeText = ts.getTextOfNodeFromSourceText(file.text, node.expression); - return nodeText === "\"use strict\"" || nodeText === "'use strict'"; + return nodeText === '"use strict"' || nodeText === "'use strict'"; } function bindWorker(node) { switch (node.kind) { case 69: return checkStrictModeIdentifier(node); - case 185: + case 186: if (ts.isInJavaScriptFile(node)) { var specialKind = ts.getSpecialPropertyAssignmentKind(node); switch (specialKind) { @@ -11921,94 +12285,99 @@ var ts; } } return checkStrictModeBinaryExpression(node); - case 248: + case 251: return checkStrictModeCatchClause(node); - case 179: + case 180: return checkStrictModeDeleteExpression(node); case 8: return checkStrictModeNumericLiteral(node); - case 184: + case 185: return checkStrictModePostfixUnaryExpression(node); - case 183: + case 184: return checkStrictModePrefixUnaryExpression(node); - case 209: + case 211: return checkStrictModeWithStatement(node); - case 163: + case 164: seenThisKeyword = true; return; - case 152: + case 153: return checkTypePredicate(node); - case 139: - return declareSymbolAndAddToSymbolTable(node, 262144, 530912); case 140: + return declareSymbolAndAddToSymbolTable(node, 262144, 530912); + case 141: return bindParameter(node); - case 215: - case 167: + case 217: + case 168: return bindVariableDeclarationOrBindingElement(node); + case 144: case 143: - case 142: - case 262: + case 265: return bindPropertyOrMethodOrAccessor(node, 4 | (node.questionToken ? 536870912 : 0), 107455); - case 249: - case 250: + case 252: + case 253: return bindPropertyOrMethodOrAccessor(node, 4, 107455); - case 251: + case 254: return bindPropertyOrMethodOrAccessor(node, 8, 107455); - case 149: + case 246: + hasJsxSpreadAttribute = true; + return; case 150: case 151: + case 152: return declareSymbolAndAddToSymbolTable(node, 131072, 0); - case 145: - case 144: - return bindPropertyOrMethodOrAccessor(node, 8192 | (node.questionToken ? 536870912 : 0), ts.isObjectLiteralMethod(node) ? 107455 : 99263); - case 217: - return bindFunctionDeclaration(node); case 146: - return declareSymbolAndAddToSymbolTable(node, 16384, 0); + case 145: + return bindPropertyOrMethodOrAccessor(node, 8192 | (node.questionToken ? 536870912 : 0), ts.isObjectLiteralMethod(node) ? 107455 : 99263); + case 219: + return bindFunctionDeclaration(node); case 147: - return bindPropertyOrMethodOrAccessor(node, 32768, 41919); + return declareSymbolAndAddToSymbolTable(node, 16384, 0); case 148: + return bindPropertyOrMethodOrAccessor(node, 32768, 41919); + case 149: return bindPropertyOrMethodOrAccessor(node, 65536, 74687); - case 154: case 155: - case 265: + case 156: + case 268: return bindFunctionOrConstructorType(node); - case 157: - case 261: + case 158: + case 264: return bindAnonymousDeclaration(node, 2048, "__type"); - case 169: + case 170: return bindObjectLiteralExpression(node); - case 177: case 178: + case 179: return bindFunctionExpression(node); - case 172: + case 173: if (ts.isInJavaScriptFile(node)) { bindCallExpression(node); } break; - case 190: - case 218: - return bindClassLikeDeclaration(node); - case 219: - return bindBlockScopedDeclaration(node, 64, 792960); + case 191: case 220: - return bindBlockScopedDeclaration(node, 524288, 793056); + return bindClassLikeDeclaration(node); case 221: - return bindEnumDeclaration(node); + return bindBlockScopedDeclaration(node, 64, 792960); case 222: + return bindBlockScopedDeclaration(node, 524288, 793056); + case 223: + return bindEnumDeclaration(node); + case 224: return bindModuleDeclaration(node); - case 225: case 228: - case 230: - case 234: + case 231: + case 233: + case 237: return declareSymbolAndAddToSymbolTable(node, 8388608, 8388608); case 227: + return bindGlobalModuleExportDeclaration(node); + case 230: return bindImportClause(node); - case 232: + case 235: return bindExportDeclaration(node); - case 231: + case 234: return bindExportAssignment(node); - case 252: + case 255: return bindSourceFileIfExternalModule(); } } @@ -12017,7 +12386,7 @@ var ts; if (parameterName && parameterName.kind === 69) { checkStrictModeIdentifier(parameterName); } - if (parameterName && parameterName.kind === 163) { + if (parameterName && parameterName.kind === 164) { seenThisKeyword = true; } bind(type); @@ -12032,17 +12401,39 @@ var ts; bindAnonymousDeclaration(file, 512, "\"" + ts.removeFileExtension(file.fileName) + "\""); } function bindExportAssignment(node) { - var boundExpression = node.kind === 231 ? node.expression : node.right; + var boundExpression = node.kind === 234 ? node.expression : node.right; if (!container.symbol || !container.symbol.exports) { bindAnonymousDeclaration(node, 8388608, getDeclarationName(node)); } - else if (boundExpression.kind === 69 && node.kind === 231) { + else if (boundExpression.kind === 69 && node.kind === 234) { declareSymbol(container.symbol.exports, container.symbol, node, 8388608, 107455 | 8388608); } else { declareSymbol(container.symbol.exports, container.symbol, node, 4, 107455 | 8388608); } } + function bindGlobalModuleExportDeclaration(node) { + if (node.modifiers && node.modifiers.length) { + file.bindDiagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.Modifiers_cannot_appear_here)); + } + if (node.parent.kind !== 255) { + file.bindDiagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.Global_module_exports_may_only_appear_at_top_level)); + return; + } + else { + 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_4.isDeclarationFile) { + file.bindDiagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.Global_module_exports_may_only_appear_in_declaration_files)); + return; + } + } + file.symbol.globalExports = file.symbol.globalExports || {}; + declareSymbol(file.symbol.globalExports, file.symbol, node, 8388608, 8388608); + } function bindExportDeclaration(node) { if (!container.symbol || !container.symbol.exports) { bindAnonymousDeclaration(node, 1073741824, getDeclarationName(node)); @@ -12068,10 +12459,10 @@ var ts; } function bindModuleExportsAssignment(node) { setCommonJsModuleIndicator(node); - bindExportAssignment(node); + declareSymbol(file.symbol.exports, file.symbol, node, 4 | 7340032 | 512, 0); } function bindThisPropertyAssignment(node) { - if (container.kind === 177 || container.kind === 217) { + if (container.kind === 178 || container.kind === 219) { container.symbol.members = container.symbol.members || {}; declareSymbol(container.symbol.members, container.symbol, node, 4, 107455 & ~4); } @@ -12106,7 +12497,7 @@ var ts; hasDecorators = true; } } - if (node.kind === 218) { + if (node.kind === 220) { bindBlockScopedDeclaration(node, 32, 899519); } else { @@ -12256,15 +12647,15 @@ var ts; function checkUnreachable(node) { switch (currentReachabilityState) { case 4: - var reportError = (ts.isStatement(node) && node.kind !== 198) || - node.kind === 218 || - (node.kind === 222 && shouldReportErrorOnModuleDeclaration(node)) || - (node.kind === 221 && (!ts.isConstEnumDeclaration(node) || options.preserveConstEnums)); + var reportError = (ts.isStatement(node) && node.kind !== 200) || + node.kind === 220 || + (node.kind === 224 && shouldReportErrorOnModuleDeclaration(node)) || + (node.kind === 223 && (!ts.isConstEnumDeclaration(node) || options.preserveConstEnums)); if (reportError) { currentReachabilityState = 8; var reportUnreachableCode = !options.allowUnreachableCode && !ts.isInAmbientContext(node) && - (node.kind !== 197 || + (node.kind !== 199 || ts.getCombinedNodeFlags(node.declarationList) & 3072 || ts.forEach(node.declarationList.declarations, function (d) { return d.initializer; })); if (reportUnreachableCode) { @@ -12327,6 +12718,7 @@ var ts; var languageVersion = compilerOptions.target || 0; var modulekind = ts.getEmitModuleKind(compilerOptions); var allowSyntheticDefaultImports = typeof compilerOptions.allowSyntheticDefaultImports !== "undefined" ? compilerOptions.allowSyntheticDefaultImports : modulekind === ts.ModuleKind.System; + var strictNullChecks = compilerOptions.strictNullChecks; var emitResolver = createResolver(); var undefinedSymbol = createSymbol(4 | 67108864, "undefined"); undefinedSymbol.declarations = []; @@ -12341,7 +12733,7 @@ var ts; isUnknownSymbol: function (symbol) { return symbol === unknownSymbol; }, getDiagnostics: getDiagnostics, getGlobalDiagnostics: getGlobalDiagnostics, - getTypeOfSymbolAtLocation: getNarrowedTypeOfSymbol, + getTypeOfSymbolAtLocation: getTypeOfSymbolAtLocation, getSymbolsOfParameterPropertyDeclaration: getSymbolsOfParameterPropertyDeclaration, getDeclaredTypeOfSymbol: getDeclaredTypeOfSymbol, getPropertiesOfType: getPropertiesOfType, @@ -12376,14 +12768,16 @@ var ts; }; var unknownSymbol = createSymbol(4 | 67108864, "unknown"); var resolvingSymbol = createSymbol(67108864, "__resolving__"); + var nullableWideningFlags = strictNullChecks ? 0 : 2097152; var anyType = createIntrinsicType(1, "any"); var stringType = createIntrinsicType(2, "string"); var numberType = createIntrinsicType(4, "number"); var booleanType = createIntrinsicType(8, "boolean"); var esSymbolType = createIntrinsicType(16777216, "symbol"); var voidType = createIntrinsicType(16, "void"); - var undefinedType = createIntrinsicType(32 | 2097152, "undefined"); - var nullType = createIntrinsicType(64 | 2097152, "null"); + var undefinedType = createIntrinsicType(32 | nullableWideningFlags, "undefined"); + var nullType = createIntrinsicType(64 | nullableWideningFlags, "null"); + var emptyArrayElementType = createIntrinsicType(32 | 2097152, "undefined"); var unknownType = createIntrinsicType(1, "unknown"); var emptyObjectType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined); var emptyUnionType = emptyObjectType; @@ -12392,11 +12786,11 @@ var ts; var anyFunctionType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined); anyFunctionType.flags |= 8388608; var noConstraintType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined); - var anySignature = createSignature(undefined, undefined, emptyArray, anyType, undefined, 0, false, false); - var unknownSignature = createSignature(undefined, undefined, emptyArray, unknownType, undefined, 0, false, false); + var anySignature = createSignature(undefined, undefined, undefined, emptyArray, anyType, undefined, 0, false, false); + var unknownSignature = createSignature(undefined, undefined, undefined, emptyArray, unknownType, undefined, 0, false, false); var enumNumberIndexInfo = createIndexInfo(stringType, true); var globals = {}; - var globalESSymbolConstructorSymbol; + var getGlobalESSymbolConstructorSymbol; var getGlobalPromiseConstructorSymbol; var globalObjectType; var globalFunctionType; @@ -12406,13 +12800,13 @@ var ts; var globalNumberType; var globalBooleanType; var globalRegExpType; - var globalTemplateStringsArrayType; - var globalESSymbolType; - var globalIterableType; - var globalIteratorType; - var globalIterableIteratorType; var anyArrayType; var anyReadonlyArrayType; + var getGlobalTemplateStringsArrayType; + var getGlobalESSymbolType; + var getGlobalIterableType; + var getGlobalIteratorType; + var getGlobalIterableIteratorType; var getGlobalClassDecoratorType; var getGlobalParameterDecoratorType; var getGlobalPropertyDecoratorType; @@ -12474,6 +12868,7 @@ var ts; }; var subtypeRelation = {}; var assignableRelation = {}; + var comparableRelation = {}; var identityRelation = {}; var _displayBuilder; var builtinGlobals = (_a = {}, @@ -12562,7 +12957,7 @@ var ts; target.flags |= source.flags; if (source.valueDeclaration && (!target.valueDeclaration || - (target.valueDeclaration.kind === 222 && source.valueDeclaration.kind !== 222))) { + (target.valueDeclaration.kind === 224 && source.valueDeclaration.kind !== 224))) { target.valueDeclaration = source.valueDeclaration; } ts.forEach(source.declarations, function (node) { @@ -12618,7 +13013,7 @@ var ts; } function mergeModuleAugmentation(moduleName) { var moduleAugmentation = moduleName.parent; - if (moduleAugmentation.symbol.valueDeclaration !== moduleAugmentation) { + if (moduleAugmentation.symbol.declarations[0] !== moduleAugmentation) { ts.Debug.assert(moduleAugmentation.symbol.declarations.length > 1); return; } @@ -12666,7 +13061,7 @@ var ts; return nodeLinks[nodeId] || (nodeLinks[nodeId] = {}); } function isGlobalSourceFile(node) { - return node.kind === 252 && !ts.isExternalOrCommonJsModule(node); + return node.kind === 255 && !ts.isExternalOrCommonJsModule(node); } function getSymbol(symbols, name, meaning) { if (meaning && ts.hasProperty(symbols, name)) { @@ -12704,18 +13099,18 @@ var ts; return ts.indexOf(sourceFiles, declarationFile) <= ts.indexOf(sourceFiles, useFile); } if (declaration.pos <= usage.pos) { - return declaration.kind !== 215 || + return declaration.kind !== 217 || !isImmediatelyUsedInInitializerOfBlockScopedVariable(declaration, usage); } return isUsedInFunctionOrNonStaticProperty(declaration, usage); function isImmediatelyUsedInInitializerOfBlockScopedVariable(declaration, usage) { var container = ts.getEnclosingBlockScopeContainer(declaration); - if (declaration.parent.parent.kind === 197 || - declaration.parent.parent.kind === 203) { + if (declaration.parent.parent.kind === 199 || + declaration.parent.parent.kind === 205) { return isSameScopeDescendentOf(usage, declaration, container); } - else if (declaration.parent.parent.kind === 205 || - declaration.parent.parent.kind === 204) { + else if (declaration.parent.parent.kind === 207 || + declaration.parent.parent.kind === 206) { var expression = declaration.parent.parent.expression; return isSameScopeDescendentOf(usage, expression, container); } @@ -12731,7 +13126,7 @@ var ts; return true; } var initializerOfNonStaticProperty = current.parent && - current.parent.kind === 143 && + current.parent.kind === 144 && (current.parent.flags & 32) === 0 && current.parent.initializer === current; if (initializerOfNonStaticProperty) { @@ -12753,18 +13148,18 @@ var ts; if (result = getSymbol(location.locals, name, meaning)) { var useResult = true; if (ts.isFunctionLike(location) && lastLocation && lastLocation !== location.body) { - if (meaning & result.flags & 793056 && lastLocation.kind !== 269) { + if (meaning & result.flags & 793056 && lastLocation.kind !== 272) { useResult = result.flags & 262144 ? lastLocation === location.type || - lastLocation.kind === 140 || - lastLocation.kind === 139 + lastLocation.kind === 141 || + lastLocation.kind === 140 : false; } if (meaning & 107455 && result.flags & 1) { useResult = - lastLocation.kind === 140 || + lastLocation.kind === 141 || (lastLocation === location.type && - result.valueDeclaration.kind === 140); + result.valueDeclaration.kind === 141); } } if (useResult) { @@ -12776,12 +13171,12 @@ var ts; } } switch (location.kind) { - case 252: + case 255: if (!ts.isExternalOrCommonJsModule(location)) break; - case 222: + case 224: var moduleExports = getSymbolOfNode(location).exports; - if (location.kind === 252 || ts.isAmbientModule(location)) { + if (location.kind === 255 || ts.isAmbientModule(location)) { if (result = moduleExports["default"]) { var localSymbol = ts.getLocalSymbolForExportDefault(result); if (localSymbol && (result.flags & meaning) && localSymbol.name === name) { @@ -12791,7 +13186,7 @@ var ts; } if (ts.hasProperty(moduleExports, name) && moduleExports[name].flags === 8388608 && - ts.getDeclarationOfKind(moduleExports[name], 234)) { + ts.getDeclarationOfKind(moduleExports[name], 237)) { break; } } @@ -12799,13 +13194,13 @@ var ts; break loop; } break; - case 221: + case 223: if (result = getSymbol(getSymbolOfNode(location).exports, name, meaning & 8)) { break loop; } break; + case 144: case 143: - case 142: if (ts.isClassLike(location.parent) && !(location.flags & 32)) { var ctor = findConstructorDeclaration(location.parent); if (ctor && ctor.locals) { @@ -12815,9 +13210,9 @@ var ts; } } break; - case 218: - case 190: - case 219: + case 220: + case 191: + case 221: if (result = getSymbol(getSymbolOfNode(location).members, name, meaning & 793056)) { if (lastLocation && lastLocation.flags & 32) { error(errorLocation, ts.Diagnostics.Static_members_cannot_reference_class_type_parameters); @@ -12825,7 +13220,7 @@ var ts; } break loop; } - if (location.kind === 190 && meaning & 32) { + if (location.kind === 191 && meaning & 32) { var className = location.name; if (className && name === className.text) { result = location.symbol; @@ -12833,28 +13228,28 @@ var ts; } } break; - case 138: + case 139: grandparent = location.parent.parent; - if (ts.isClassLike(grandparent) || grandparent.kind === 219) { + if (ts.isClassLike(grandparent) || grandparent.kind === 221) { if (result = getSymbol(getSymbolOfNode(grandparent).members, name, meaning & 793056)) { error(errorLocation, ts.Diagnostics.A_computed_property_name_cannot_reference_a_type_parameter_from_its_containing_type); return undefined; } } break; - case 145: - case 144: case 146: + case 145: case 147: case 148: - case 217: - case 178: + case 149: + case 219: + case 179: if (meaning & 3 && name === "arguments") { result = argumentsSymbol; break loop; } break; - case 177: + case 178: if (meaning & 3 && name === "arguments") { result = argumentsSymbol; break loop; @@ -12867,8 +13262,8 @@ var ts; } } break; - case 141: - if (location.parent && location.parent.kind === 140) { + case 142: + if (location.parent && location.parent.kind === 141) { location = location.parent; } if (location.parent && ts.isClassElement(location.parent)) { @@ -12938,7 +13333,7 @@ var ts; ts.Debug.assert((result.flags & 2) !== 0); 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 (!isBlockScopedNameDeclaredBeforeUse(ts.getAncestor(declaration, 215), errorLocation)) { + if (!isBlockScopedNameDeclaredBeforeUse(ts.getAncestor(declaration, 217), errorLocation)) { error(errorLocation, ts.Diagnostics.Block_scoped_variable_0_used_before_its_declaration, ts.declarationNameToString(declaration.name)); } } @@ -12955,10 +13350,10 @@ var ts; } function getAnyImportSyntax(node) { if (ts.isAliasSymbolDeclaration(node)) { - if (node.kind === 225) { + if (node.kind === 228) { return node; } - while (node && node.kind !== 226) { + while (node && node.kind !== 229) { node = node.parent; } return node; @@ -12968,7 +13363,7 @@ var ts; return ts.forEach(symbol.declarations, function (d) { return ts.isAliasSymbolDeclaration(d) ? d : undefined; }); } function getTargetOfImportEqualsDeclaration(node) { - if (node.moduleReference.kind === 236) { + if (node.moduleReference.kind === 239) { return resolveExternalModuleSymbol(resolveExternalModuleName(node, ts.getExternalModuleImportEqualsDeclarationExpression(node))); } return getSymbolOfPartOfRightHandSideOfImportEquals(node.moduleReference, node); @@ -12976,7 +13371,9 @@ var ts; function getTargetOfImportClause(node) { var moduleSymbol = resolveExternalModuleName(node, node.parent.moduleSpecifier); if (moduleSymbol) { - var exportDefaultSymbol = resolveSymbol(moduleSymbol.exports["default"]); + var exportDefaultSymbol = moduleSymbol.exports["export="] ? + getPropertyOfType(getTypeOfSymbol(moduleSymbol.exports["export="]), "default") : + resolveSymbol(moduleSymbol.exports["default"]); if (!exportDefaultSymbol && !allowSyntheticDefaultImports) { error(node.name, ts.Diagnostics.Module_0_has_no_default_export, symbolToString(moduleSymbol)); } @@ -13027,8 +13424,14 @@ var ts; if (targetSymbol) { var name_9 = specifier.propertyName || specifier.name; if (name_9.text) { + var symbolFromVariable = void 0; + if (moduleSymbol && moduleSymbol.exports && moduleSymbol.exports["export="]) { + symbolFromVariable = getPropertyOfType(getTypeOfSymbol(targetSymbol), name_9.text); + } + else { + symbolFromVariable = getPropertyOfVariable(targetSymbol, name_9.text); + } var symbolFromModule = getExportOfModule(targetSymbol, name_9.text); - var symbolFromVariable = getPropertyOfVariable(targetSymbol, name_9.text); var symbol = symbolFromModule && symbolFromVariable ? combineValueAndTypeSymbols(symbolFromVariable, symbolFromModule) : symbolFromModule || symbolFromVariable; @@ -13042,6 +13445,9 @@ var ts; function getTargetOfImportSpecifier(node) { return getExternalModuleMember(node.parent.parent.parent, node); } + function getTargetOfGlobalModuleExportDeclaration(node) { + return resolveExternalModuleSymbol(node.parent.symbol); + } function getTargetOfExportSpecifier(node) { return node.parent.parent.moduleSpecifier ? getExternalModuleMember(node.parent.parent, node) : @@ -13052,18 +13458,20 @@ var ts; } function getTargetOfAliasDeclaration(node) { switch (node.kind) { - case 225: - return getTargetOfImportEqualsDeclaration(node); - case 227: - return getTargetOfImportClause(node); case 228: - return getTargetOfNamespaceImport(node); + return getTargetOfImportEqualsDeclaration(node); case 230: - return getTargetOfImportSpecifier(node); - case 234: - return getTargetOfExportSpecifier(node); + return getTargetOfImportClause(node); case 231: + return getTargetOfNamespaceImport(node); + case 233: + return getTargetOfImportSpecifier(node); + case 237: + return getTargetOfExportSpecifier(node); + case 234: return getTargetOfExportAssignment(node); + case 227: + return getTargetOfGlobalModuleExportDeclaration(node); } } function resolveSymbol(symbol) { @@ -13104,10 +13512,10 @@ var ts; if (!links.referenced) { links.referenced = true; var node = getDeclarationOfAliasSymbol(symbol); - if (node.kind === 231) { + if (node.kind === 234) { checkExpressionCached(node.expression); } - else if (node.kind === 234) { + else if (node.kind === 237) { checkExpressionCached(node.propertyName || node.name); } else if (ts.isInternalModuleImportEqualsDeclaration(node)) { @@ -13117,17 +13525,17 @@ var ts; } function getSymbolOfPartOfRightHandSideOfImportEquals(entityName, importDeclaration) { if (!importDeclaration) { - importDeclaration = ts.getAncestor(entityName, 225); + importDeclaration = ts.getAncestor(entityName, 228); ts.Debug.assert(importDeclaration !== undefined); } if (entityName.kind === 69 && ts.isRightSideOfQualifiedNameOrPropertyAccess(entityName)) { entityName = entityName.parent; } - if (entityName.kind === 69 || entityName.parent.kind === 137) { + if (entityName.kind === 69 || entityName.parent.kind === 138) { return resolveEntityName(entityName, 1536); } else { - ts.Debug.assert(entityName.parent.kind === 225); + ts.Debug.assert(entityName.parent.kind === 228); return resolveEntityName(entityName, 107455 | 793056 | 1536); } } @@ -13146,9 +13554,9 @@ var ts; return undefined; } } - else if (name.kind === 137 || name.kind === 170) { - var left = name.kind === 137 ? name.left : name.expression; - var right = name.kind === 137 ? name.right : name.name; + else if (name.kind === 138 || name.kind === 171) { + var left = name.kind === 138 ? name.left : name.expression; + var right = name.kind === 138 ? name.right : name.name; var namespace = resolveEntityName(left, 1536, ignoreErrors); if (!namespace || namespace === unknownSymbol || ts.nodeIsMissing(right)) { return undefined; @@ -13181,7 +13589,7 @@ var ts; } var isRelative = ts.isExternalModuleNameRelative(moduleName); if (!isRelative) { - var symbol = getSymbol(globals, "\"" + moduleName + "\"", 512); + var symbol = getSymbol(globals, '"' + moduleName + '"', 512); if (symbol) { return getMergedSymbol(symbol); } @@ -13311,7 +13719,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 === 146 && ts.nodeIsPresent(member.body)) { + if (member.kind === 147 && ts.nodeIsPresent(member.body)) { return member; } } @@ -13377,21 +13785,15 @@ var ts; } } switch (location_1.kind) { - case 252: + case 255: if (!ts.isExternalOrCommonJsModule(location_1)) { break; } - case 222: + case 224: if (result = callback(getSymbolOfNode(location_1).exports)) { return result; } break; - case 218: - case 219: - if (result = callback(getSymbolOfNode(location_1).members)) { - return result; - } - break; } } return callback(globals); @@ -13420,7 +13822,7 @@ var ts; return ts.forEachValue(symbols, function (symbolFromSymbolTable) { if (symbolFromSymbolTable.flags & 8388608 && symbolFromSymbolTable.name !== "export=" - && !ts.getDeclarationOfKind(symbolFromSymbolTable, 234)) { + && !ts.getDeclarationOfKind(symbolFromSymbolTable, 237)) { if (!useOnlyExternalAliasing || ts.forEach(symbolFromSymbolTable.declarations, ts.isExternalModuleImportEqualsDeclaration)) { var resolvedImportedSymbol = resolveAlias(symbolFromSymbolTable); @@ -13436,7 +13838,9 @@ var ts; }); } if (symbol) { - return forEachSymbolTableInScope(enclosingDeclaration, getAccessibleSymbolChainFromSymbolTable); + if (!(isPropertyOrMethodDeclarationSymbol(symbol))) { + return forEachSymbolTableInScope(enclosingDeclaration, getAccessibleSymbolChainFromSymbolTable); + } } } function needsQualification(symbol, enclosingDeclaration, meaning) { @@ -13449,7 +13853,7 @@ var ts; if (symbolFromSymbolTable === symbol) { return true; } - symbolFromSymbolTable = (symbolFromSymbolTable.flags & 8388608 && !ts.getDeclarationOfKind(symbolFromSymbolTable, 234)) ? resolveAlias(symbolFromSymbolTable) : symbolFromSymbolTable; + symbolFromSymbolTable = (symbolFromSymbolTable.flags & 8388608 && !ts.getDeclarationOfKind(symbolFromSymbolTable, 237)) ? resolveAlias(symbolFromSymbolTable) : symbolFromSymbolTable; if (symbolFromSymbolTable.flags & meaning) { qualify = true; return true; @@ -13458,6 +13862,24 @@ var ts; }); return qualify; } + function isPropertyOrMethodDeclarationSymbol(symbol) { + if (symbol.declarations && symbol.declarations.length) { + for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { + var declaration = _a[_i]; + switch (declaration.kind) { + case 144: + case 146: + case 148: + case 149: + continue; + default: + return false; + } + } + return true; + } + return false; + } function isSymbolAccessible(symbol, enclosingDeclaration, meaning) { if (symbol && enclosingDeclaration && !(symbol.flags & 262144)) { var initialSymbol = symbol; @@ -13504,7 +13926,7 @@ var ts; } } function hasExternalModuleSymbol(declaration) { - return ts.isAmbientModule(declaration) || (declaration.kind === 252 && ts.isExternalOrCommonJsModule(declaration)); + return ts.isAmbientModule(declaration) || (declaration.kind === 255 && ts.isExternalOrCommonJsModule(declaration)); } function hasVisibleDeclarations(symbol) { var aliasesToMakeVisible; @@ -13536,11 +13958,11 @@ var ts; } function isEntityNameVisible(entityName, enclosingDeclaration) { var meaning; - if (entityName.parent.kind === 156) { + if (entityName.parent.kind === 157 || ts.isExpressionWithTypeArgumentsInClassExtendsClause(entityName.parent)) { meaning = 107455 | 1048576; } - else if (entityName.kind === 137 || entityName.kind === 170 || - entityName.parent.kind === 225) { + else if (entityName.kind === 138 || entityName.kind === 171 || + entityName.parent.kind === 228) { meaning = 1536; } else { @@ -13607,10 +14029,10 @@ var ts; function getTypeAliasForTypeLiteral(type) { if (type.symbol && type.symbol.flags & 2048) { var node = type.symbol.declarations[0].parent; - while (node.kind === 162) { + while (node.kind === 163) { node = node.parent; } - if (node.kind === 220) { + if (node.kind === 222) { return getSymbolOfNode(node); } } @@ -13618,7 +14040,7 @@ var ts; } function isTopLevelInExternalModuleAugmentation(node) { return node && node.parent && - node.parent.kind === 223 && + node.parent.kind === 225 && ts.isExternalModuleAugmentation(node.parent.parent); } function getSymbolDisplayBuilder() { @@ -13629,10 +14051,10 @@ var ts; return ts.declarationNameToString(declaration.name); } switch (declaration.kind) { - case 190: + case 191: return "(Anonymous class)"; - case 177: case 178: + case 179: return "(Anonymous function)"; } } @@ -13776,12 +14198,12 @@ var ts; var length_1 = outerTypeParameters.length; while (i < length_1) { var start = i; - var parent_4 = getParentSymbolOfTypeParameter(outerTypeParameters[i]); + var parent_5 = getParentSymbolOfTypeParameter(outerTypeParameters[i]); do { i++; - } while (i < length_1 && getParentSymbolOfTypeParameter(outerTypeParameters[i]) === parent_4); + } while (i < length_1 && getParentSymbolOfTypeParameter(outerTypeParameters[i]) === parent_5); if (!ts.rangeEquals(outerTypeParameters, typeArguments, start, i)) { - writeSymbolTypeReference(parent_4, typeArguments, start, i, flags); + writeSymbolTypeReference(parent_5, typeArguments, start, i, flags); writePunctuation(writer, 21); } } @@ -13840,7 +14262,7 @@ var ts; var isNonLocalFunctionSymbol = !!(symbol.flags & 16) && (symbol.parent || ts.forEach(symbol.declarations, function (declaration) { - return declaration.parent.kind === 252 || declaration.parent.kind === 223; + return declaration.parent.kind === 255 || declaration.parent.kind === 225; })); if (isStaticMethodSymbol || isNonLocalFunctionSymbol) { return !!(flags & 2) || @@ -13980,7 +14402,12 @@ var ts; if (ts.isRestParameter(parameterNode)) { writePunctuation(writer, 22); } - appendSymbolNameOnly(p, writer); + if (ts.isBindingPattern(parameterNode.name)) { + buildBindingPatternDisplay(parameterNode.name, writer, enclosingDeclaration, flags, symbolStack); + } + else { + appendSymbolNameOnly(p, writer); + } if (isOptionalParameter(parameterNode)) { writePunctuation(writer, 53); } @@ -13988,19 +14415,58 @@ var ts; writeSpace(writer); buildTypeDisplay(getTypeOfSymbol(p), writer, enclosingDeclaration, flags, symbolStack); } + function buildBindingPatternDisplay(bindingPattern, writer, enclosingDeclaration, flags, symbolStack) { + if (bindingPattern.kind === 166) { + writePunctuation(writer, 15); + buildDisplayForCommaSeparatedList(bindingPattern.elements, writer, function (e) { return buildBindingElementDisplay(e, writer, enclosingDeclaration, flags, symbolStack); }); + writePunctuation(writer, 16); + } + else if (bindingPattern.kind === 167) { + writePunctuation(writer, 19); + var elements = bindingPattern.elements; + buildDisplayForCommaSeparatedList(elements, writer, function (e) { return buildBindingElementDisplay(e, writer, enclosingDeclaration, flags, symbolStack); }); + if (elements && elements.hasTrailingComma) { + writePunctuation(writer, 24); + } + writePunctuation(writer, 20); + } + } + function buildBindingElementDisplay(bindingElement, writer, enclosingDeclaration, flags, symbolStack) { + if (bindingElement.kind === 192) { + return; + } + ts.Debug.assert(bindingElement.kind === 168); + if (bindingElement.propertyName) { + writer.writeSymbol(ts.getTextOfNode(bindingElement.propertyName), bindingElement.symbol); + writePunctuation(writer, 54); + writeSpace(writer); + } + if (ts.isBindingPattern(bindingElement.name)) { + buildBindingPatternDisplay(bindingElement.name, writer, enclosingDeclaration, flags, symbolStack); + } + else { + if (bindingElement.dotDotDotToken) { + writePunctuation(writer, 22); + } + appendSymbolNameOnly(bindingElement.symbol, writer); + } + } function buildDisplayForTypeParametersAndDelimiters(typeParameters, writer, enclosingDeclaration, flags, symbolStack) { if (typeParameters && typeParameters.length) { writePunctuation(writer, 25); - for (var i = 0; i < typeParameters.length; i++) { - if (i > 0) { - writePunctuation(writer, 24); - writeSpace(writer); - } - buildTypeParameterDisplay(typeParameters[i], writer, enclosingDeclaration, flags, symbolStack); - } + buildDisplayForCommaSeparatedList(typeParameters, writer, function (p) { return buildTypeParameterDisplay(p, writer, enclosingDeclaration, flags, symbolStack); }); writePunctuation(writer, 27); } } + function buildDisplayForCommaSeparatedList(list, writer, action) { + for (var i = 0; i < list.length; i++) { + if (i > 0) { + writePunctuation(writer, 24); + writeSpace(writer); + } + action(list[i]); + } + } function buildDisplayForTypeArgumentsAndDelimiters(typeParameters, mapper, writer, enclosingDeclaration, flags, symbolStack) { if (typeParameters && typeParameters.length) { writePunctuation(writer, 25); @@ -14014,10 +14480,16 @@ var ts; writePunctuation(writer, 27); } } - function buildDisplayForParametersAndDelimiters(parameters, writer, enclosingDeclaration, flags, symbolStack) { + function buildDisplayForParametersAndDelimiters(thisType, parameters, writer, enclosingDeclaration, flags, symbolStack) { writePunctuation(writer, 17); + if (thisType) { + writeKeyword(writer, 97); + writePunctuation(writer, 54); + writeSpace(writer); + buildTypeDisplay(thisType, writer, enclosingDeclaration, flags, symbolStack); + } for (var i = 0; i < parameters.length; i++) { - if (i > 0) { + if (i > 0 || thisType) { writePunctuation(writer, 24); writeSpace(writer); } @@ -14065,7 +14537,7 @@ var ts; else { buildDisplayForTypeParametersAndDelimiters(signature.typeParameters, writer, enclosingDeclaration, flags, symbolStack); } - buildDisplayForParametersAndDelimiters(signature.parameters, writer, enclosingDeclaration, flags, symbolStack); + buildDisplayForParametersAndDelimiters(signature.thisType, signature.parameters, writer, enclosingDeclaration, flags, symbolStack); buildReturnTypeDisplay(signature, writer, enclosingDeclaration, flags, symbolStack); } return _displayBuilder || (_displayBuilder = { @@ -14092,74 +14564,74 @@ var ts; return false; function determineIfDeclarationIsVisible() { switch (node.kind) { - case 167: + case 168: return isDeclarationVisible(node.parent.parent); - case 215: + case 217: if (ts.isBindingPattern(node.name) && !node.name.elements.length) { return false; } - case 222: - case 218: - case 219: + case 224: case 220: - case 217: case 221: - case 225: + case 222: + case 219: + case 223: + case 228: if (ts.isExternalModuleAugmentation(node)) { return true; } - var parent_5 = getDeclarationContainer(node); + var parent_6 = getDeclarationContainer(node); if (!(ts.getCombinedNodeFlags(node) & 1) && - !(node.kind !== 225 && parent_5.kind !== 252 && ts.isInAmbientContext(parent_5))) { - return isGlobalSourceFile(parent_5); + !(node.kind !== 228 && parent_6.kind !== 255 && ts.isInAmbientContext(parent_6))) { + return isGlobalSourceFile(parent_6); } - return isDeclarationVisible(parent_5); - case 143: - case 142: - case 147: - case 148: - case 145: + return isDeclarationVisible(parent_6); case 144: + case 143: + case 148: + case 149: + case 146: + case 145: if (node.flags & (8 | 16)) { return false; } - case 146: - case 150: - case 149: + case 147: case 151: - case 140: - case 223: - case 154: + case 150: + case 152: + case 141: + case 225: case 155: - case 157: - case 153: + case 156: case 158: + case 154: case 159: case 160: case 161: case 162: + case 163: return isDeclarationVisible(node.parent); - case 227: - case 228: case 230: - return false; - case 139: - case 252: - return true; case 231: + case 233: + return false; + case 140: + case 255: + return true; + case 234: return false; default: - ts.Debug.fail("isDeclarationVisible unknown: SyntaxKind: " + node.kind); + return false; } } } function collectLinkedAliases(node) { var exportSymbol; - if (node.parent && node.parent.kind === 231) { + if (node.parent && node.parent.kind === 234) { exportSymbol = resolveName(node.parent, node.text, 107455 | 793056 | 1536 | 8388608, ts.Diagnostics.Cannot_find_name_0, node); } - else if (node.parent.kind === 234) { + else if (node.parent.kind === 237) { var exportSpecifier = node.parent; exportSymbol = exportSpecifier.parent.parent.moduleSpecifier ? getExternalModuleMember(exportSpecifier.parent.parent, exportSpecifier) : @@ -14238,12 +14710,12 @@ var ts; node = ts.getRootDeclaration(node); while (node) { switch (node.kind) { - case 215: - case 216: + case 217: + case 218: + case 233: + case 232: + case 231: case 230: - case 229: - case 228: - case 227: node = node.parent; break; default: @@ -14273,7 +14745,7 @@ var ts; case 9: case 8: return name.text; - case 138: + case 139: if (ts.isStringOrNumericLiteral(name.expression.kind)) { return name.expression.text; } @@ -14281,7 +14753,7 @@ var ts; return undefined; } function isComputedNonLiteralName(name) { - return name.kind === 138 && !ts.isStringOrNumericLiteral(name.expression.kind); + return name.kind === 139 && !ts.isStringOrNumericLiteral(name.expression.kind); } function getTypeForBindingElement(declaration) { var pattern = declaration.parent; @@ -14296,11 +14768,14 @@ var ts; return parentType; } var type; - if (pattern.kind === 165) { + if (pattern.kind === 166) { var name_10 = declaration.propertyName || declaration.name; if (isComputedNonLiteralName(name_10)) { return anyType; } + if (declaration.initializer) { + getContextualType(declaration.initializer); + } var text = getTextOfPropertyName(name_10); type = getTypeOfPropertyOfType(parentType, text) || isNumericLiteralName(text) && getIndexTypeOfType(parentType, 1) || @@ -14331,6 +14806,9 @@ var ts; type = createArrayType(elementType); } } + if (strictNullChecks && declaration.initializer && !(getNullableKind(checkExpressionCached(declaration.initializer)) & 32)) { + type = removeNullableKind(type, 32); + } return type; } function getTypeForVariableLikeDeclarationFromJSDocComment(declaration) { @@ -14344,15 +14822,15 @@ var ts; if (typeTag && typeTag.typeExpression) { return typeTag.typeExpression.type; } - if (declaration.kind === 215 && - declaration.parent.kind === 216 && - declaration.parent.parent.kind === 197) { + if (declaration.kind === 217 && + declaration.parent.kind === 218 && + declaration.parent.parent.kind === 199) { var annotation = ts.getJSDocTypeTag(declaration.parent.parent); if (annotation && annotation.typeExpression) { return annotation.typeExpression.type; } } - else if (declaration.kind === 140) { + else if (declaration.kind === 141) { var paramTag = ts.getCorrespondingJSDocParameterTag(declaration); if (paramTag && paramTag.typeExpression) { return paramTag.typeExpression.type; @@ -14367,35 +14845,38 @@ var ts; return type; } } - if (declaration.parent.parent.kind === 204) { + if (declaration.parent.parent.kind === 206) { return stringType; } - if (declaration.parent.parent.kind === 205) { + if (declaration.parent.parent.kind === 207) { return checkRightHandSideOfForOf(declaration.parent.parent.expression) || anyType; } if (ts.isBindingPattern(declaration.parent)) { return getTypeForBindingElement(declaration); } if (declaration.type) { - return getTypeFromTypeNode(declaration.type); + var type = getTypeFromTypeNode(declaration.type); + return strictNullChecks && declaration.questionToken ? addNullableKind(type, 32) : type; } - if (declaration.kind === 140) { + if (declaration.kind === 141) { var func = declaration.parent; - if (func.kind === 148 && !ts.hasDynamicName(func)) { - var getter = ts.getDeclarationOfKind(declaration.parent.symbol, 147); + if (func.kind === 149 && !ts.hasDynamicName(func)) { + var getter = ts.getDeclarationOfKind(declaration.parent.symbol, 148); if (getter) { return getReturnTypeOfSignature(getSignatureFromDeclaration(getter)); } } - var type = getContextuallyTypedParameterType(declaration); + var type = declaration.symbol.name === "this" + ? getContextuallyTypedThisType(func) + : getContextuallyTypedParameterType(declaration); if (type) { - return type; + return strictNullChecks && declaration.questionToken ? addNullableKind(type, 32) : type; } } if (declaration.initializer) { return checkExpressionCached(declaration.initializer); } - if (declaration.kind === 250) { + if (declaration.kind === 253) { return checkIdentifier(declaration.name); } if (ts.isBindingPattern(declaration.name)) { @@ -14405,11 +14886,16 @@ var ts; } function getTypeFromBindingElement(element, includePatternInType) { if (element.initializer) { - return getWidenedType(checkExpressionCached(element.initializer)); + var type = checkExpressionCached(element.initializer); + reportErrorsFromWidening(element, type); + return getWidenedType(type); } if (ts.isBindingPattern(element.name)) { return getTypeFromBindingPattern(element.name, includePatternInType); } + if (compilerOptions.noImplicitAny) { + reportImplicitAnyError(element, anyType); + } return anyType; } function getTypeFromObjectBindingPattern(pattern, includePatternInType) { @@ -14442,7 +14928,7 @@ var ts; if (elements.length === 0 || elements[elements.length - 1].dotDotDotToken) { return languageVersion >= 2 ? createIterableType(anyType) : anyArrayType; } - var elementTypes = ts.map(elements, function (e) { return e.kind === 191 ? anyType : getTypeFromBindingElement(e, includePatternInType); }); + var elementTypes = ts.map(elements, function (e) { return e.kind === 192 ? anyType : getTypeFromBindingElement(e, includePatternInType); }); if (includePatternInType) { var result = createNewTupleType(elementTypes); result.pattern = pattern; @@ -14451,7 +14937,7 @@ var ts; return createTupleType(elementTypes); } function getTypeFromBindingPattern(pattern, includePatternInType) { - return pattern.kind === 165 + return pattern.kind === 166 ? getTypeFromObjectBindingPattern(pattern, includePatternInType) : getTypeFromArrayBindingPattern(pattern, includePatternInType); } @@ -14461,7 +14947,7 @@ var ts; if (reportErrors) { reportErrorsFromWidening(declaration, type); } - if (declaration.kind === 249) { + if (declaration.kind === 252) { return type; } return getWidenedType(type); @@ -14469,7 +14955,7 @@ var ts; type = declaration.dotDotDotToken ? anyArrayType : anyType; if (reportErrors && compilerOptions.noImplicitAny) { var root = ts.getRootDeclaration(declaration); - if (!isPrivateWithinAmbient(root) && !(root.kind === 140 && isPrivateWithinAmbient(root.parent))) { + if (!isPrivateWithinAmbient(root) && !(root.kind === 141 && isPrivateWithinAmbient(root.parent))) { reportImplicitAnyError(declaration, type); } } @@ -14482,17 +14968,17 @@ var ts; return links.type = getTypeOfPrototypeProperty(symbol); } var declaration = symbol.valueDeclaration; - if (declaration.parent.kind === 248) { + if (declaration.parent.kind === 251) { return links.type = anyType; } - if (declaration.kind === 231) { + if (declaration.kind === 234) { return links.type = checkExpression(declaration.expression); } - if (declaration.kind === 185) { + if (declaration.kind === 186) { return links.type = getUnionType(ts.map(symbol.declarations, function (decl) { return checkExpressionCached(decl.right); })); } - if (declaration.kind === 170) { - if (declaration.parent.kind === 185) { + if (declaration.kind === 171) { + if (declaration.parent.kind === 186) { return links.type = checkExpressionCached(declaration.parent.right); } } @@ -14518,7 +15004,7 @@ var ts; } function getAnnotatedAccessorType(accessor) { if (accessor) { - if (accessor.kind === 147) { + if (accessor.kind === 148) { return accessor.type && getTypeFromTypeNode(accessor.type); } else { @@ -14531,11 +15017,17 @@ var ts; function getTypeOfAccessors(symbol) { var links = getSymbolLinks(symbol); if (!links.type) { + var getter = ts.getDeclarationOfKind(symbol, 148); + var setter = ts.getDeclarationOfKind(symbol, 149); + if (getter && getter.flags & 134217728) { + var jsDocType = getTypeForVariableLikeDeclarationFromJSDocComment(getter); + if (jsDocType) { + return links.type = jsDocType; + } + } if (!pushTypeResolution(symbol, 0)) { return unknownType; } - var getter = ts.getDeclarationOfKind(symbol, 147); - var setter = ts.getDeclarationOfKind(symbol, 148); var type = void 0; var getterReturnType = getAnnotatedAccessorType(getter); if (getterReturnType) { @@ -14561,7 +15053,7 @@ var ts; if (!popTypeResolution()) { type = anyType; if (compilerOptions.noImplicitAny) { - var getter_1 = ts.getDeclarationOfKind(symbol, 147); + var getter_1 = ts.getDeclarationOfKind(symbol, 148); 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)); } } @@ -14650,9 +15142,9 @@ var ts; if (!node) { return typeParameters; } - if (node.kind === 218 || node.kind === 190 || - node.kind === 217 || node.kind === 177 || - node.kind === 145 || node.kind === 178) { + if (node.kind === 220 || node.kind === 191 || + node.kind === 219 || node.kind === 178 || + node.kind === 146 || node.kind === 179) { var declarations = node.typeParameters; if (declarations) { return appendTypeParameters(appendOuterTypeParameters(typeParameters, node), declarations); @@ -14661,15 +15153,15 @@ var ts; } } function getOuterTypeParametersOfClassOrInterface(symbol) { - var declaration = symbol.flags & 32 ? symbol.valueDeclaration : ts.getDeclarationOfKind(symbol, 219); + var declaration = symbol.flags & 32 ? symbol.valueDeclaration : ts.getDeclarationOfKind(symbol, 221); return appendOuterTypeParameters(undefined, declaration); } function getLocalTypeParametersOfClassOrInterfaceOrTypeAlias(symbol) { var result; for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var node = _a[_i]; - if (node.kind === 219 || node.kind === 218 || - node.kind === 190 || node.kind === 220) { + if (node.kind === 221 || node.kind === 220 || + node.kind === 191 || node.kind === 222) { var declaration = node; if (declaration.typeParameters) { result = appendTypeParameters(result, declaration.typeParameters); @@ -14792,7 +15284,7 @@ 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 === 219 && ts.getInterfaceBaseTypeNodes(declaration)) { + if (declaration.kind === 221 && ts.getInterfaceBaseTypeNodes(declaration)) { for (var _b = 0, _c = ts.getInterfaceBaseTypeNodes(declaration); _b < _c.length; _b++) { var node = _c[_b]; var baseType = getTypeFromTypeNode(node); @@ -14821,7 +15313,7 @@ var ts; function isIndependentInterface(symbol) { for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; - if (declaration.kind === 219) { + if (declaration.kind === 221) { if (declaration.flags & 16384) { return false; } @@ -14870,7 +15362,7 @@ var ts; if (!pushTypeResolution(symbol, 2)) { return unknownType; } - var declaration = ts.getDeclarationOfKind(symbol, 220); + var declaration = ts.getDeclarationOfKind(symbol, 222); var type = getTypeFromTypeNode(declaration.type); if (popTypeResolution()) { links.typeParameters = getLocalTypeParametersOfClassOrInterfaceOrTypeAlias(symbol); @@ -14901,7 +15393,7 @@ var ts; if (!links.declaredType) { var type = createType(512); type.symbol = symbol; - if (!ts.getDeclarationOfKind(symbol, 139).constraint) { + if (!ts.getDeclarationOfKind(symbol, 140).constraint) { type.constraint = noConstraintType; } links.declaredType = type; @@ -14953,11 +15445,13 @@ var ts; case 120: case 132: case 103: - case 164: + case 134: + case 93: + case 165: return true; - case 158: + case 159: return isIndependentType(node.elementType); - case 153: + case 154: return isIndependentTypeReference(node); } return false; @@ -14966,7 +15460,7 @@ var ts; return node.type && isIndependentType(node.type) || !node.type && !node.initializer; } function isIndependentFunctionLikeDeclaration(node) { - if (node.kind !== 146 && (!node.type || !isIndependentType(node.type))) { + if (node.kind !== 147 && (!node.type || !isIndependentType(node.type))) { return false; } for (var _i = 0, _a = node.parameters; _i < _a.length; _i++) { @@ -14982,12 +15476,12 @@ var ts; var declaration = symbol.declarations[0]; if (declaration) { switch (declaration.kind) { - case 143: - case 142: - return isIndependentVariableLikeDeclaration(declaration); - case 145: case 144: + case 143: + return isIndependentVariableLikeDeclaration(declaration); case 146: + case 145: + case 147: return isIndependentFunctionLikeDeclaration(declaration); } } @@ -15078,11 +15572,12 @@ var ts; type.typeArguments : ts.concatenate(type.typeArguments, [type]); resolveObjectTypeMembers(type, source, typeParameters, typeArguments); } - function createSignature(declaration, typeParameters, parameters, resolvedReturnType, typePredicate, minArgumentCount, hasRestParameter, hasStringLiterals) { + function createSignature(declaration, typeParameters, thisType, parameters, resolvedReturnType, typePredicate, minArgumentCount, hasRestParameter, hasStringLiterals) { var sig = new Signature(checker); sig.declaration = declaration; sig.typeParameters = typeParameters; sig.parameters = parameters; + sig.thisType = thisType; sig.resolvedReturnType = resolvedReturnType; sig.typePredicate = typePredicate; sig.minArgumentCount = minArgumentCount; @@ -15091,13 +15586,13 @@ var ts; return sig; } function cloneSignature(sig) { - return createSignature(sig.declaration, sig.typeParameters, sig.parameters, sig.resolvedReturnType, sig.typePredicate, sig.minArgumentCount, sig.hasRestParameter, sig.hasStringLiterals); + return createSignature(sig.declaration, sig.typeParameters, sig.thisType, sig.parameters, sig.resolvedReturnType, sig.typePredicate, sig.minArgumentCount, sig.hasRestParameter, sig.hasStringLiterals); } function getDefaultConstructSignatures(classType) { var baseConstructorType = getBaseConstructorTypeOfClass(classType); var baseSignatures = getSignaturesOfType(baseConstructorType, 1); if (baseSignatures.length === 0) { - return [createSignature(undefined, classType.localTypeParameters, emptyArray, classType, undefined, 0, false, false)]; + return [createSignature(undefined, classType.localTypeParameters, undefined, emptyArray, classType, undefined, 0, false, false)]; } var baseTypeNode = getBaseTypeNodeOfClass(classType); var typeArguments = ts.map(baseTypeNode.typeArguments, getTypeFromTypeNode); @@ -15131,10 +15626,10 @@ var ts; addInheritedMembers(members, arrayType.properties); setObjectTypeMembers(type, members, arrayType.callSignatures, arrayType.constructSignatures, arrayType.stringIndexInfo, arrayType.numberIndexInfo); } - function findMatchingSignature(signatureList, signature, partialMatch, ignoreReturnTypes) { + function findMatchingSignature(signatureList, signature, partialMatch, ignoreThisTypes, ignoreReturnTypes) { for (var _i = 0, signatureList_1 = signatureList; _i < signatureList_1.length; _i++) { var s = signatureList_1[_i]; - if (compareSignaturesIdentical(s, signature, partialMatch, ignoreReturnTypes, compareTypesIdentical)) { + if (compareSignaturesIdentical(s, signature, partialMatch, ignoreThisTypes, ignoreReturnTypes, compareTypesIdentical)) { return s; } } @@ -15145,7 +15640,7 @@ var ts; return undefined; } for (var i = 1; i < signatureLists.length; i++) { - if (!findMatchingSignature(signatureLists[i], signature, false, false)) { + if (!findMatchingSignature(signatureLists[i], signature, false, false, false)) { return undefined; } } @@ -15153,7 +15648,7 @@ var ts; } var result = undefined; for (var i = 0; i < signatureLists.length; i++) { - var match = i === listIndex ? signature : findMatchingSignature(signatureLists[i], signature, true, true); + var match = i === listIndex ? signature : findMatchingSignature(signatureLists[i], signature, true, true, true); if (!match) { return undefined; } @@ -15169,12 +15664,15 @@ var ts; for (var i = 0; i < signatureLists.length; i++) { for (var _i = 0, _a = signatureLists[i]; _i < _a.length; _i++) { var signature = _a[_i]; - if (!result || !findMatchingSignature(result, signature, false, true)) { + if (!result || !findMatchingSignature(result, signature, false, true, true)) { var unionSignatures = findMatchingSignatures(signatureLists, signature, i); if (unionSignatures) { var s = signature; if (unionSignatures.length > 1) { s = cloneSignature(signature); + if (ts.forEach(unionSignatures, function (sig) { return sig.thisType; })) { + s.thisType = getUnionType(ts.map(unionSignatures, function (sig) { return sig.thisType || anyType; })); + } s.resolvedReturnType = undefined; s.unionSignatures = unionSignatures; } @@ -15350,7 +15848,7 @@ var ts; type = globalBooleanType; } else if (type.flags & 16777216) { - type = globalESSymbolType; + type = getGlobalESSymbolType(); } return type; } @@ -15504,7 +16002,7 @@ var ts; } function isOptionalParameter(node) { if (node.flags & 134217728) { - if (node.type && node.type.kind === 264) { + if (node.type && node.type.kind === 267) { return true; } var paramTag = ts.getCorrespondingJSDocParameterTag(node); @@ -15513,7 +16011,7 @@ var ts; return true; } if (paramTag.typeExpression) { - return paramTag.typeExpression.type.kind === 264; + return paramTag.typeExpression.type.kind === 267; } } } @@ -15549,7 +16047,7 @@ var ts; function getSignatureFromDeclaration(declaration) { var links = getNodeLinks(declaration); if (!links.resolvedSignature) { - var classType = declaration.kind === 146 ? + var classType = declaration.kind === 147 ? getDeclaredTypeOfClassOrInterface(getMergedSymbol(declaration.parent.symbol)) : undefined; var typeParameters = classType ? classType.localTypeParameters : @@ -15558,6 +16056,8 @@ var ts; var parameters = []; var hasStringLiterals = false; var minArgumentCount = -1; + var thisType = undefined; + var hasThisParameter = void 0; var isJSConstructSignature = ts.isJSDocConstructSignature(declaration); var returnType = undefined; var typePredicate = undefined; @@ -15568,13 +16068,19 @@ var ts; var resolvedSymbol = resolveName(param, paramSymbol.name, 107455, undefined, undefined); paramSymbol = resolvedSymbol; } - parameters.push(paramSymbol); - if (param.type && param.type.kind === 164) { + if (i === 0 && paramSymbol.name === "this") { + hasThisParameter = true; + thisType = param.type ? getTypeFromTypeNode(param.type) : unknownType; + } + else { + parameters.push(paramSymbol); + } + if (param.type && param.type.kind === 165) { hasStringLiterals = true; } if (param.initializer || param.questionToken || param.dotDotDotToken) { if (minArgumentCount < 0) { - minArgumentCount = i; + minArgumentCount = i - (hasThisParameter ? 1 : 0); } } else { @@ -15582,7 +16088,7 @@ var ts; } } if (minArgumentCount < 0) { - minArgumentCount = declaration.parameters.length; + minArgumentCount = declaration.parameters.length - (hasThisParameter ? 1 : 0); } if (isJSConstructSignature) { minArgumentCount--; @@ -15593,7 +16099,7 @@ var ts; } else if (declaration.type) { returnType = getTypeFromTypeNode(declaration.type); - if (declaration.type.kind === 152) { + if (declaration.type.kind === 153) { typePredicate = createTypePredicateFromTypePredicateNode(declaration.type); } } @@ -15604,15 +16110,15 @@ var ts; returnType = type; } } - if (declaration.kind === 147 && !ts.hasDynamicName(declaration)) { - var setter = ts.getDeclarationOfKind(declaration.symbol, 148); + if (declaration.kind === 148 && !ts.hasDynamicName(declaration)) { + var setter = ts.getDeclarationOfKind(declaration.symbol, 149); returnType = getAnnotatedAccessorType(setter); } if (!returnType && ts.nodeIsMissing(declaration.body)) { returnType = anyType; } } - links.resolvedSignature = createSignature(declaration, typeParameters, parameters, returnType, typePredicate, minArgumentCount, ts.hasRestParameter(declaration), hasStringLiterals); + links.resolvedSignature = createSignature(declaration, typeParameters, thisType, parameters, returnType, typePredicate, minArgumentCount, ts.hasRestParameter(declaration), hasStringLiterals); } return links.resolvedSignature; } @@ -15623,20 +16129,20 @@ var ts; for (var i = 0, len = symbol.declarations.length; i < len; i++) { var node = symbol.declarations[i]; switch (node.kind) { - case 154: case 155: - case 217: - case 145: - case 144: + case 156: + case 219: case 146: - case 149: + case 145: + case 147: case 150: case 151: - case 147: + case 152: case 148: - case 177: + case 149: case 178: - case 265: + case 179: + case 268: if (i > 0 && node.body) { var previous = symbol.declarations[i - 1]; if (node.parent === previous.parent && node.kind === previous.kind && node.pos === previous.end) { @@ -15716,7 +16222,7 @@ var ts; } function getOrCreateTypeFromSignature(signature) { if (!signature.isolatedSignatureType) { - var isConstructor = signature.declaration.kind === 146 || signature.declaration.kind === 150; + var isConstructor = signature.declaration.kind === 147 || signature.declaration.kind === 151; var type = createObjectType(65536 | 262144); type.members = emptySymbols; type.properties = emptyArray; @@ -15757,7 +16263,7 @@ var ts; return undefined; } function getConstraintDeclaration(type) { - return ts.getDeclarationOfKind(type.symbol, 139).constraint; + return ts.getDeclarationOfKind(type.symbol, 140).constraint; } function hasConstraintReferenceTo(type, target) { var checked; @@ -15790,7 +16296,7 @@ var ts; return typeParameter.constraint === noConstraintType ? undefined : typeParameter.constraint; } function getParentSymbolOfTypeParameter(typeParameter) { - return getSymbolOfNode(ts.getDeclarationOfKind(typeParameter.symbol, 139).parent); + return getSymbolOfNode(ts.getDeclarationOfKind(typeParameter.symbol, 140).parent); } function getTypeListId(types) { if (types) { @@ -15812,11 +16318,13 @@ var ts; } return ""; } - function getPropagatingFlagsOfTypes(types) { + function getPropagatingFlagsOfTypes(types, excludeKinds) { var result = 0; for (var _i = 0, types_3 = types; _i < types_3.length; _i++) { var type = types_3[_i]; - result |= type.flags; + if (!(type.flags & excludeKinds)) { + result |= type.flags; + } } return result & 14680064; } @@ -15824,7 +16332,8 @@ var ts; var id = getTypeListId(typeArguments); var type = target.instantiations[id]; if (!type) { - var flags = 4096 | (typeArguments ? getPropagatingFlagsOfTypes(typeArguments) : 0); + var propagatedFlags = typeArguments ? getPropagatingFlagsOfTypes(typeArguments, 0) : 0; + var flags = 4096 | propagatedFlags; type = target.instantiations[id] = createObjectType(flags, target.symbol); type.target = target; type.typeArguments = typeArguments; @@ -15832,7 +16341,7 @@ var ts; return type; } function getTypeFromClassOrInterfaceReference(node, symbol) { - var type = getDeclaredTypeOfSymbol(symbol); + var type = getDeclaredTypeOfSymbol(getMergedSymbol(symbol)); var typeParameters = type.localTypeParameters; if (typeParameters) { if (!node.typeArguments || node.typeArguments.length !== typeParameters.length) { @@ -15875,11 +16384,11 @@ var ts; } function getTypeReferenceName(node) { switch (node.kind) { - case 153: + case 154: return node.typeName; - case 263: + case 266: return node.name; - case 192: + case 193: if (ts.isSupportedExpressionWithTypeArguments(node)) { return node.expression; } @@ -15902,7 +16411,7 @@ var ts; if (symbol.flags & 524288) { return getTypeFromTypeAliasReference(node, symbol); } - if (symbol.flags & 107455 && node.kind === 263) { + if (symbol.flags & 107455 && node.kind === 266) { return getTypeOfSymbol(symbol); } return getTypeFromNonGenericTypeReference(node, symbol); @@ -15912,7 +16421,7 @@ var ts; if (!links.resolvedType) { var symbol = void 0; var type = void 0; - if (node.kind === 263) { + if (node.kind === 266) { var typeReferenceName = getTypeReferenceName(node); symbol = resolveTypeReferenceName(node, typeReferenceName); type = getTypeReferenceType(node, symbol); @@ -15920,7 +16429,7 @@ var ts; links.resolvedType = type; } else { - var typeNameOrExpression = node.kind === 153 ? node.typeName : + var typeNameOrExpression = node.kind === 154 ? node.typeName : ts.isSupportedExpressionWithTypeArguments(node) ? node.expression : undefined; symbol = typeNameOrExpression && resolveEntityName(typeNameOrExpression, 793056) || unknownSymbol; @@ -15947,9 +16456,9 @@ var ts; for (var _i = 0, declarations_3 = declarations; _i < declarations_3.length; _i++) { var declaration = declarations_3[_i]; switch (declaration.kind) { - case 218: - case 219: + case 220: case 221: + case 223: return declaration; } } @@ -15986,9 +16495,6 @@ var ts; var typeSymbol = namespaceSymbol && getSymbol(namespaceSymbol.exports, name, 793056); return typeSymbol && getDeclaredTypeOfSymbol(typeSymbol); } - function getGlobalESSymbolConstructorSymbol() { - return globalESSymbolConstructorSymbol || (globalESSymbolConstructorSymbol = getGlobalValueSymbol("Symbol")); - } function createTypedPropertyDescriptorType(propertyType) { var globalTypedPropertyDescriptorType = getGlobalTypedPropertyDescriptorType(); return globalTypedPropertyDescriptorType !== emptyGenericType @@ -15999,10 +16505,10 @@ var ts; return genericGlobalType !== emptyGenericType ? createTypeReference(genericGlobalType, typeArguments) : emptyObjectType; } function createIterableType(elementType) { - return createTypeFromGenericGlobalType(globalIterableType, [elementType]); + return createTypeFromGenericGlobalType(getGlobalIterableType(), [elementType]); } function createIterableIteratorType(elementType) { - return createTypeFromGenericGlobalType(globalIterableIteratorType, [elementType]); + return createTypeFromGenericGlobalType(getGlobalIterableIteratorType(), [elementType]); } function createArrayType(elementType) { return createTypeFromGenericGlobalType(globalArrayType, [elementType]); @@ -16019,7 +16525,8 @@ var ts; return tupleTypes[id] || (tupleTypes[id] = createNewTupleType(elementTypes)); } function createNewTupleType(elementTypes) { - var type = createObjectType(8192 | getPropagatingFlagsOfTypes(elementTypes)); + var propagatedFlags = getPropagatingFlagsOfTypes(elementTypes, 0); + var type = createObjectType(8192 | propagatedFlags); type.elementTypes = elementTypes; return type; } @@ -16034,6 +16541,14 @@ var ts; if (type.flags & typeSetKind) { addTypesToSet(typeSet, type.types, typeSetKind); } + else if (type.flags & (1 | 32 | 64)) { + if (type.flags & 1) + typeSet.containsAny = true; + if (type.flags & 32) + typeSet.containsUndefined = true; + if (type.flags & 64) + typeSet.containsNull = true; + } else if (!ts.contains(typeSet, type)) { typeSet.push(type); } @@ -16061,47 +16576,35 @@ var ts; } } } - function containsTypeAny(types) { - for (var _i = 0, types_5 = types; _i < types_5.length; _i++) { - var type = types_5[_i]; - if (isTypeAny(type)) { - return true; - } - } - return false; - } - function removeAllButLast(types, typeToRemove) { - var i = types.length; - while (i > 0 && types.length > 1) { - i--; - if (types[i] === typeToRemove) { - types.splice(i, 1); - } - } - } function getUnionType(types, noSubtypeReduction) { if (types.length === 0) { return emptyUnionType; } var typeSet = []; addTypesToSet(typeSet, types, 16384); - if (containsTypeAny(typeSet)) { + if (typeSet.containsAny) { return anyType; } - if (noSubtypeReduction) { - removeAllButLast(typeSet, undefinedType); - removeAllButLast(typeSet, nullType); + if (strictNullChecks) { + if (typeSet.containsNull) + typeSet.push(nullType); + if (typeSet.containsUndefined) + typeSet.push(undefinedType); } - else { + if (!noSubtypeReduction) { removeSubtypes(typeSet); } - if (typeSet.length === 1) { + if (typeSet.length === 0) { + return typeSet.containsNull ? nullType : undefinedType; + } + else if (typeSet.length === 1) { return typeSet[0]; } var id = getTypeListId(typeSet); var type = unionTypes[id]; if (!type) { - type = unionTypes[id] = createObjectType(16384 | getPropagatingFlagsOfTypes(typeSet)); + var propagatedFlags = getPropagatingFlagsOfTypes(typeSet, 96); + type = unionTypes[id] = createObjectType(16384 | propagatedFlags); type.types = typeSet; } return type; @@ -16119,16 +16622,23 @@ var ts; } var typeSet = []; addTypesToSet(typeSet, types, 32768); - if (containsTypeAny(typeSet)) { + if (typeSet.containsAny) { return anyType; } + if (strictNullChecks) { + if (typeSet.containsNull) + typeSet.push(nullType); + if (typeSet.containsUndefined) + typeSet.push(undefinedType); + } if (typeSet.length === 1) { return typeSet[0]; } var id = getTypeListId(typeSet); var type = intersectionTypes[id]; if (!type) { - type = intersectionTypes[id] = createObjectType(32768 | getPropagatingFlagsOfTypes(typeSet)); + var propagatedFlags = getPropagatingFlagsOfTypes(typeSet, 96); + type = intersectionTypes[id] = createObjectType(32768 | propagatedFlags); type.types = typeSet; } return type; @@ -16181,9 +16691,9 @@ var ts; function getThisType(node) { var container = ts.getThisContainer(node, false); var parent = container && container.parent; - if (parent && (ts.isClassLike(parent) || parent.kind === 219)) { + if (parent && (ts.isClassLike(parent) || parent.kind === 221)) { if (!(container.flags & 32) && - (container.kind !== 146 || ts.isNodeDescendentOf(node, container.body))) { + (container.kind !== 147 || ts.isNodeDescendentOf(node, container.body))) { return getDeclaredTypeOfClassOrInterface(getSymbolOfNode(parent)).thisType; } } @@ -16200,8 +16710,8 @@ var ts; function getTypeFromTypeNode(node) { switch (node.kind) { case 117: - case 254: - case 255: + case 257: + case 258: return anyType; case 131: return stringType; @@ -16213,49 +16723,53 @@ var ts; return esSymbolType; case 103: return voidType; - case 163: - return getTypeFromThisTypeNode(node); + case 134: + return undefinedType; + case 93: + return nullType; case 164: + return getTypeFromThisTypeNode(node); + case 165: return getTypeFromStringLiteralTypeNode(node); + case 154: + case 266: + return getTypeFromTypeReference(node); case 153: - case 263: - return getTypeFromTypeReference(node); - case 152: return booleanType; - case 192: + case 193: return getTypeFromTypeReference(node); - case 156: + case 157: return getTypeFromTypeQueryNode(node); - case 158: - case 256: - return getTypeFromArrayTypeNode(node); case 159: - return getTypeFromTupleTypeNode(node); - case 160: - case 257: - return getTypeFromUnionTypeNode(node); - case 161: - return getTypeFromIntersectionTypeNode(node); - case 162: case 259: + return getTypeFromArrayTypeNode(node); + case 160: + return getTypeFromTupleTypeNode(node); + case 161: case 260: + return getTypeFromUnionTypeNode(node); + case 162: + return getTypeFromIntersectionTypeNode(node); + case 163: + case 262: + case 263: + case 270: + case 271: case 267: + return getTypeFromTypeNode(node.type); + case 155: + case 156: + case 158: case 268: case 264: - return getTypeFromTypeNode(node.type); - case 154: - case 155: - case 157: - case 265: - case 261: return getTypeFromTypeLiteralOrFunctionOrConstructorTypeNode(node); case 69: - case 137: + case 138: var symbol = getSymbolAtLocation(node); return symbol && getDeclaredTypeOfSymbol(symbol); - case 258: + case 261: return getTypeFromJSDocTupleType(node); - case 266: + case 269: return getTypeFromJSDocVariadicType(node); default: return unknownType; @@ -16278,40 +16792,26 @@ var ts; function createBinaryTypeMapper(source1, target1, source2, target2) { return function (t) { return t === source1 ? target1 : t === source2 ? target2 : t; }; } - function createTypeMapper(sources, targets) { - switch (sources.length) { - case 1: return createUnaryTypeMapper(sources[0], targets[0]); - case 2: return createBinaryTypeMapper(sources[0], targets[0], sources[1], targets[1]); - } + function createArrayTypeMapper(sources, targets) { return function (t) { for (var i = 0; i < sources.length; i++) { if (t === sources[i]) { - return targets[i]; + return targets ? targets[i] : anyType; } } return t; }; } - function createUnaryTypeEraser(source) { - return function (t) { return t === source ? anyType : t; }; - } - function createBinaryTypeEraser(source1, source2) { - return function (t) { return t === source1 || t === source2 ? anyType : t; }; + function createTypeMapper(sources, targets) { + var count = sources.length; + var mapper = count == 1 ? createUnaryTypeMapper(sources[0], targets ? targets[0] : anyType) : + count == 2 ? createBinaryTypeMapper(sources[0], targets ? targets[0] : anyType, sources[1], targets ? targets[1] : anyType) : + createArrayTypeMapper(sources, targets); + mapper.mappedTypes = sources; + return mapper; } function createTypeEraser(sources) { - switch (sources.length) { - case 1: return createUnaryTypeEraser(sources[0]); - case 2: return createBinaryTypeEraser(sources[0], sources[1]); - } - return function (t) { - for (var _i = 0, sources_1 = sources; _i < sources_1.length; _i++) { - var source = sources_1[_i]; - if (t === source) { - return anyType; - } - } - return t; - }; + return createTypeMapper(sources, undefined); } function getInferenceMapper(context) { if (!context.mapper) { @@ -16325,6 +16825,7 @@ var ts; } return t; }; + mapper.mappedTypes = context.typeParameters; mapper.context = context; context.mapper = mapper; } @@ -16334,7 +16835,9 @@ var ts; return type; } function combineTypeMappers(mapper1, mapper2) { - return function (t) { return instantiateType(mapper1(t), mapper2); }; + var mapper = function (t) { return instantiateType(mapper1(t), mapper2); }; + mapper.mappedTypes = mapper1.mappedTypes; + return mapper; } function cloneTypeParameter(typeParameter) { var result = createType(512); @@ -16372,7 +16875,7 @@ var ts; if (signature.typePredicate) { freshTypePredicate = cloneTypePredicate(signature.typePredicate, mapper); } - var result = createSignature(signature.declaration, freshTypeParameters, instantiateList(signature.parameters, mapper, instantiateSymbol), instantiateType(signature.resolvedReturnType, mapper), freshTypePredicate, signature.minArgumentCount, signature.hasRestParameter, signature.hasStringLiterals); + var result = createSignature(signature.declaration, freshTypeParameters, signature.thisType && instantiateType(signature.thisType, mapper), instantiateList(signature.parameters, mapper, instantiateSymbol), instantiateType(signature.resolvedReturnType, mapper), freshTypePredicate, signature.minArgumentCount, signature.hasRestParameter, signature.hasStringLiterals); result.target = signature; result.mapper = mapper; return result; @@ -16409,13 +16912,61 @@ var ts; mapper.instantiations[type.id] = result; return result; } + function isSymbolInScopeOfMappedTypeParameter(symbol, mapper) { + var mappedTypes = mapper.mappedTypes; + var node = symbol.declarations[0].parent; + while (node) { + switch (node.kind) { + case 155: + case 156: + case 219: + case 146: + case 145: + case 147: + case 150: + case 151: + case 152: + case 148: + case 149: + case 178: + case 179: + case 220: + case 191: + case 221: + case 222: + var declaration = node; + if (declaration.typeParameters) { + for (var _i = 0, _a = declaration.typeParameters; _i < _a.length; _i++) { + var d = _a[_i]; + if (ts.contains(mappedTypes, getDeclaredTypeOfTypeParameter(d.symbol))) { + return true; + } + } + } + if (ts.isClassLike(node) || node.kind === 221) { + var thisType = getDeclaredTypeOfClassOrInterface(getSymbolOfNode(node)).thisType; + if (thisType && ts.contains(mappedTypes, thisType)) { + return true; + } + } + break; + case 224: + case 255: + return false; + } + node = node.parent; + } + return false; + } function instantiateType(type, mapper) { if (type && mapper !== identityMapper) { if (type.flags & 512) { return mapper(type); } if (type.flags & 65536) { - return type.symbol && type.symbol.flags & (16 | 8192 | 32 | 2048 | 4096) ? + return type.symbol && + type.symbol.flags & (16 | 8192 | 32 | 2048 | 4096) && + (type.flags & 131072 || isSymbolInScopeOfMappedTypeParameter(type.symbol, mapper)) ? instantiateAnonymousType(type, mapper) : type; } if (type.flags & 4096) { @@ -16437,33 +16988,35 @@ var ts; return info && createIndexInfo(instantiateType(info.type, mapper), info.isReadonly, info.declaration); } function isContextSensitive(node) { - ts.Debug.assert(node.kind !== 145 || ts.isObjectLiteralMethod(node)); + ts.Debug.assert(node.kind !== 146 || ts.isObjectLiteralMethod(node)); switch (node.kind) { - case 177: case 178: + case 179: return isContextSensitiveFunctionLikeDeclaration(node); - case 169: + case 170: return ts.forEach(node.properties, isContextSensitive); - case 168: + case 169: return ts.forEach(node.elements, isContextSensitive); - case 186: + case 187: return isContextSensitive(node.whenTrue) || isContextSensitive(node.whenFalse); - case 185: + case 186: return node.operatorToken.kind === 52 && (isContextSensitive(node.left) || isContextSensitive(node.right)); - case 249: + case 252: return isContextSensitive(node.initializer); + case 146: case 145: - case 144: return isContextSensitiveFunctionLikeDeclaration(node); - case 176: + case 177: return isContextSensitive(node.expression); } return false; } function isContextSensitiveFunctionLikeDeclaration(node) { - return !node.typeParameters && node.parameters.length && !ts.forEach(node.parameters, function (p) { return p.type; }); + var areAllParametersUntyped = !ts.forEach(node.parameters, function (p) { return p.type; }); + var isNullaryArrow = node.kind === 179 && !node.parameters.length; + return !node.typeParameters && areAllParametersUntyped && !isNullaryArrow; } function getTypeWithoutSignatures(type) { if (type.flags & 80896) { @@ -16494,12 +17047,18 @@ var ts; function isTypeAssignableTo(source, target) { return checkTypeAssignableTo(source, target, undefined); } + function isTypeComparableTo(source, target) { + return checkTypeComparableTo(source, target, undefined); + } function checkTypeSubtypeOf(source, target, errorNode, headMessage, containingMessageChain) { return checkTypeRelatedTo(source, target, subtypeRelation, errorNode, headMessage, containingMessageChain); } function checkTypeAssignableTo(source, target, errorNode, headMessage, containingMessageChain) { return checkTypeRelatedTo(source, target, assignableRelation, errorNode, headMessage, containingMessageChain); } + function checkTypeComparableTo(source, target, errorNode, headMessage, containingMessageChain) { + return checkTypeRelatedTo(source, target, comparableRelation, errorNode, headMessage, containingMessageChain); + } function isSignatureAssignableTo(source, target, ignoreReturnTypes) { return compareSignaturesRelated(source, target, ignoreReturnTypes, false, undefined, compareTypesAssignable) !== 0; } @@ -16513,15 +17072,26 @@ var ts; source = getErasedSignature(source); target = getErasedSignature(target); var result = -1; + if (source.thisType && target.thisType && source.thisType !== voidType) { + var related = compareTypes(source.thisType, target.thisType, false) + || compareTypes(target.thisType, source.thisType, reportErrors); + if (!related) { + if (reportErrors) { + errorReporter(ts.Diagnostics.The_this_types_of_each_signature_are_incompatible); + } + return 0; + } + result &= related; + } var sourceMax = getNumNonRestParameters(source); var targetMax = getNumNonRestParameters(target); var checkCount = getNumParametersToCheckForSignatureRelatability(source, sourceMax, target, targetMax); var sourceParams = source.parameters; var targetParams = target.parameters; for (var i = 0; i < checkCount; i++) { - var s = i < sourceMax ? getTypeOfSymbol(sourceParams[i]) : getRestTypeOfSignature(source); - var t = i < targetMax ? getTypeOfSymbol(targetParams[i]) : getRestTypeOfSignature(target); - var related = compareTypes(t, s, false) || compareTypes(s, t, reportErrors); + var s = i < sourceMax ? getTypeOfParameter(sourceParams[i]) : getRestTypeOfSignature(source); + var t = i < targetMax ? getTypeOfParameter(targetParams[i]) : getRestTypeOfSignature(target); + var related = compareTypes(s, t, false) || compareTypes(t, s, reportErrors); if (!related) { if (reportErrors) { errorReporter(ts.Diagnostics.Types_of_parameters_0_and_1_are_incompatible, sourceParams[i < sourceMax ? i : sourceMax].name, targetParams[i < targetMax ? i : targetMax].name); @@ -16642,7 +17212,12 @@ var ts; sourceType = typeToString(source, undefined, 128); targetType = typeToString(target, undefined, 128); } - reportError(message || ts.Diagnostics.Type_0_is_not_assignable_to_type_1, sourceType, targetType); + 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; + } + reportError(message, sourceType, targetType); } function isRelatedTo(source, target, reportErrors, headMessage) { var result; @@ -16653,20 +17228,24 @@ var ts; } if (isTypeAny(target)) return -1; - if (source === undefinedType) - return -1; - if (source === nullType && target !== undefinedType) - return -1; + if (source.flags & 32) { + if (!strictNullChecks || target.flags & (32 | 16) || source === emptyArrayElementType) + return -1; + } + if (source.flags & 64) { + if (!strictNullChecks || target.flags & 64) + return -1; + } if (source.flags & 128 && target === numberType) return -1; if (source.flags & 128 && target.flags & 128) { - if (result = enumRelatedTo(source, target)) { + if (result = enumRelatedTo(source, target, reportErrors)) { return result; } } if (source.flags & 256 && target === stringType) return -1; - if (relation === assignableRelation) { + if (relation === assignableRelation || relation === comparableRelation) { if (isTypeAny(source)) return -1; if (source === numberType && target.flags & 128) @@ -16688,23 +17267,30 @@ var ts; } var saveErrorInfo = errorInfo; if (source.flags & 16384) { - if (result = eachTypeRelatedToType(source, target, reportErrors)) { + if (relation === comparableRelation) { + result = someTypeRelatedToType(source, target, reportErrors); + } + else { + result = eachTypeRelatedToType(source, target, reportErrors); + } + if (result) { return result; } } else if (target.flags & 32768) { - if (result = typeRelatedToEachType(source, target, reportErrors)) { + result = typeRelatedToEachType(source, target, reportErrors); + if (result) { return result; } } else { if (source.flags & 32768) { - if (result = someTypeRelatedToType(source, target, reportErrors && !(target.flags & 16384))) { + if (result = someTypeRelatedToType(source, target, false)) { return result; } } if (target.flags & 16384) { - if (result = typeRelatedToSomeType(source, target, reportErrors)) { + if (result = typeRelatedToSomeType(source, target, reportErrors && !(source.flags & 16777726))) { return result; } } @@ -16752,8 +17338,8 @@ var ts; } if (source.flags & 16384 && target.flags & 16384 || source.flags & 32768 && target.flags & 32768) { - if (result = eachTypeRelatedToSomeType(source, target)) { - if (result &= eachTypeRelatedToSomeType(target, source)) { + if (result = eachTypeRelatedToSomeType(source, target, false)) { + if (result &= eachTypeRelatedToSomeType(target, source, false)) { return result; } } @@ -16763,7 +17349,8 @@ var ts; function isKnownProperty(type, name) { if (type.flags & 80896) { var resolved = resolveStructuredTypeMembers(type); - if (relation === assignableRelation && (type === globalObjectType || resolved.properties.length === 0) || + if ((relation === assignableRelation || relation === comparableRelation) && + (type === globalObjectType || resolved.properties.length === 0) || resolved.stringIndexInfo || resolved.numberIndexInfo || getPropertyOfType(type, name)) { return true; } @@ -16794,7 +17381,7 @@ var ts; } return false; } - function eachTypeRelatedToSomeType(source, target) { + function eachTypeRelatedToSomeType(source, target, reportErrors) { var result = -1; var sourceTypes = source.types; for (var _i = 0, sourceTypes_1 = sourceTypes; _i < sourceTypes_1.length; _i++) { @@ -16809,7 +17396,15 @@ var ts; } function typeRelatedToSomeType(source, target, reportErrors) { var targetTypes = target.types; - for (var i = 0, len = targetTypes.length; i < len; i++) { + var len = targetTypes.length; + while (len >= 2 && targetTypes[len - 1].flags & 96) { + var related = isRelatedTo(source, targetTypes[len - 1], false); + if (related) { + return related; + } + len--; + } + for (var i = 0; i < len; i++) { var related = isRelatedTo(source, targetTypes[i], reportErrors && i === len - 1); if (related) { return related; @@ -16832,7 +17427,15 @@ var ts; } function someTypeRelatedToType(source, target, reportErrors) { var sourceTypes = source.types; - for (var i = 0, len = sourceTypes.length; i < len; i++) { + var len = sourceTypes.length; + while (len >= 2 && sourceTypes[len - 1].flags & 96) { + var related = isRelatedTo(sourceTypes[len - 1], target, false); + if (related) { + return related; + } + len--; + } + for (var i = 0; i < len; i++) { var related = isRelatedTo(sourceTypes[i], target, reportErrors && i === len - 1); if (related) { return related; @@ -17090,7 +17693,7 @@ var ts; } var result = -1; for (var i = 0, len = sourceSignatures.length; i < len; i++) { - var related = compareSignaturesIdentical(sourceSignatures[i], targetSignatures[i], false, false, isRelatedTo); + var related = compareSignaturesIdentical(sourceSignatures[i], targetSignatures[i], false, false, false, isRelatedTo); if (!related) { return 0; } @@ -17164,7 +17767,7 @@ var ts; } return 0; } - function enumRelatedTo(source, target) { + function enumRelatedTo(source, target, reportErrors) { if (source.symbol.name !== target.symbol.name || source.symbol.flags & 128 || target.symbol.flags & 128) { @@ -17176,7 +17779,9 @@ var ts; if (property.flags & 8) { var targetProperty = getPropertyOfType(targetEnumType, property.name); if (!targetProperty || !(targetProperty.flags & 8)) { - reportError(ts.Diagnostics.Property_0_is_missing_in_type_1, property.name, typeToString(target, undefined, 128)); + if (reportErrors) { + reportError(ts.Diagnostics.Property_0_is_missing_in_type_1, property.name, typeToString(target, undefined, 128)); + } return 0; } } @@ -17270,7 +17875,7 @@ var ts; } return false; } - function compareSignaturesIdentical(source, target, partialMatch, ignoreReturnTypes, compareTypes) { + function compareSignaturesIdentical(source, target, partialMatch, ignoreThisTypes, ignoreReturnTypes, compareTypes) { if (source === target) { return -1; } @@ -17283,10 +17888,17 @@ var ts; source = getErasedSignature(source); target = getErasedSignature(target); var result = -1; + if (!ignoreThisTypes && source.thisType && target.thisType) { + var related = compareTypes(source.thisType, target.thisType); + if (!related) { + return 0; + } + result &= related; + } var targetLen = target.parameters.length; for (var i = 0; i < targetLen; i++) { - var s = isRestParameterIndex(source, i) ? getRestTypeOfSignature(source) : getTypeOfSymbol(source.parameters[i]); - var t = isRestParameterIndex(target, i) ? getRestTypeOfSignature(target) : getTypeOfSymbol(target.parameters[i]); + var s = isRestParameterIndex(source, i) ? getRestTypeOfSignature(source) : getTypeOfParameter(source.parameters[i]); + var t = isRestParameterIndex(target, i) ? getRestTypeOfSignature(target) : getTypeOfParameter(target.parameters[i]); var related = compareTypes(s, t); if (!related) { return 0; @@ -17302,15 +17914,31 @@ var ts; return signature.hasRestParameter && parameterIndex >= signature.parameters.length - 1; } function isSupertypeOfEach(candidate, types) { - for (var _i = 0, types_6 = types; _i < types_6.length; _i++) { - var type = types_6[_i]; - if (candidate !== type && !isTypeSubtypeOf(type, candidate)) + for (var _i = 0, types_5 = types; _i < types_5.length; _i++) { + var t = types_5[_i]; + if (candidate !== t && !isTypeSubtypeOf(t, candidate)) return false; } return true; } + function getCombinedFlagsOfTypes(types) { + var flags = 0; + for (var _i = 0, types_6 = types; _i < types_6.length; _i++) { + var t = types_6[_i]; + flags |= t.flags; + } + return flags; + } function getCommonSupertype(types) { - return ts.forEach(types, function (t) { return isSupertypeOfEach(t, types) ? t : undefined; }); + if (!strictNullChecks) { + return ts.forEach(types, function (t) { return isSupertypeOfEach(t, types) ? t : undefined; }); + } + var primaryTypes = ts.filter(types, function (t) { return !(t.flags & 96); }); + if (!primaryTypes.length) { + return getUnionType(types); + } + var supertype = ts.forEach(primaryTypes, function (t) { return isSupertypeOfEach(t, primaryTypes) ? t : undefined; }); + return supertype && addNullableKind(supertype, getCombinedFlagsOfTypes(types) & 96); } function reportNoCommonSupertypeError(types, errorLocation, errorMessageChainHead) { var bestSupertype; @@ -17344,7 +17972,7 @@ var ts; } function isArrayLikeType(type) { return type.flags & 4096 && (type.target === globalArrayType || type.target === globalReadonlyArrayType) || - !(type.flags & (32 | 64)) && isTypeAssignableTo(type, anyReadonlyArrayType); + !(type.flags & 96) && isTypeAssignableTo(type, anyReadonlyArrayType); } function isTupleLikeType(type) { return !!getPropertyOfType(type, "0"); @@ -17355,6 +17983,60 @@ var ts; function isTupleType(type) { return !!(type.flags & 8192); } + function getNullableKind(type) { + var flags = type.flags; + if (flags & 16384) { + for (var _i = 0, _a = type.types; _i < _a.length; _i++) { + var t = _a[_i]; + flags |= t.flags; + } + } + return flags & 96; + } + function getNullableTypeOfKind(kind) { + return kind & 64 ? kind & 32 ? + getUnionType([nullType, undefinedType]) : nullType : undefinedType; + } + function addNullableKind(type, kind) { + if ((getNullableKind(type) & kind) !== kind) { + var types = [type]; + if (kind & 32) { + types.push(undefinedType); + } + if (kind & 64) { + types.push(nullType); + } + type = getUnionType(types); + } + return type; + } + function removeNullableKind(type, kind) { + if (type.flags & 16384 && getNullableKind(type) & kind) { + var firstType = void 0; + var types = void 0; + for (var _i = 0, _a = type.types; _i < _a.length; _i++) { + var t = _a[_i]; + if (!(t.flags & kind)) { + if (!firstType) { + firstType = t; + } + else { + if (!types) { + types = [firstType]; + } + types.push(t); + } + } + } + if (firstType) { + type = types ? getUnionType(types) : firstType; + } + } + return type; + } + function getNonNullableType(type) { + return strictNullChecks ? removeNullableKind(type, 96) : type; + } function isObjectLiteralType(type) { return type.symbol && (type.symbol.flags & (4096 | 2048)) !== 0 && getSignaturesOfType(type, 0).length === 0 && @@ -17400,16 +18082,19 @@ var ts; var numberIndexInfo = getIndexInfoOfType(type, 1); return createAnonymousType(type.symbol, members, emptyArray, emptyArray, stringIndexInfo && createIndexInfo(getWidenedType(stringIndexInfo.type), stringIndexInfo.isReadonly), numberIndexInfo && createIndexInfo(getWidenedType(numberIndexInfo.type), numberIndexInfo.isReadonly)); } + function getWidenedConstituentType(type) { + return type.flags & 96 ? type : getWidenedType(type); + } function getWidenedType(type) { if (type.flags & 6291456) { - if (type.flags & (32 | 64)) { + if (type.flags & 96) { return anyType; } if (type.flags & 524288) { return getWidenedTypeOfObjectLiteral(type); } if (type.flags & 16384) { - return getUnionType(ts.map(type.types, getWidenedType), true); + return getUnionType(ts.map(type.types, getWidenedConstituentType), true); } if (isArrayType(type)) { return createArrayType(getWidenedType(type.typeArguments[0])); @@ -17459,22 +18144,25 @@ var ts; var typeAsString = typeToString(getWidenedType(type)); var diagnostic; switch (declaration.kind) { + case 144: case 143: - case 142: diagnostic = ts.Diagnostics.Member_0_implicitly_has_an_1_type; break; - case 140: + case 141: diagnostic = declaration.dotDotDotToken ? ts.Diagnostics.Rest_parameter_0_implicitly_has_an_any_type : ts.Diagnostics.Parameter_0_implicitly_has_an_1_type; break; - case 217: + case 168: + diagnostic = ts.Diagnostics.Binding_element_0_implicitly_has_an_1_type; + break; + case 219: + case 146: case 145: - case 144: - case 147: case 148: - case 177: + case 149: case 178: + case 179: if (!declaration.name) { error(declaration, ts.Diagnostics.Function_expression_which_lacks_return_type_annotation_implicitly_has_an_0_return_type, typeAsString); return; @@ -17498,25 +18186,19 @@ var ts; var targetMax = target.parameters.length; var count; if (source.hasRestParameter && target.hasRestParameter) { - count = sourceMax > targetMax ? sourceMax : targetMax; - sourceMax--; - targetMax--; + count = Math.max(sourceMax, targetMax); } else if (source.hasRestParameter) { - sourceMax--; count = targetMax; } else if (target.hasRestParameter) { - targetMax--; count = sourceMax; } else { - count = sourceMax < targetMax ? sourceMax : targetMax; + count = Math.min(sourceMax, targetMax); } for (var i = 0; i < count; i++) { - var s = i < sourceMax ? getTypeOfSymbol(source.parameters[i]) : getRestTypeOfSignature(source); - var t = i < targetMax ? getTypeOfSymbol(target.parameters[i]) : getRestTypeOfSignature(target); - callback(s, t); + callback(getTypeAtPosition(source, i), getTypeAtPosition(target, i)); } } function createInferenceContext(typeParameters, inferUnionTypes) { @@ -17767,20 +18449,31 @@ var ts; } return context.inferredTypes; } + function createTransientIdentifier(symbol, location) { + var result = ts.createNode(69); + result.text = symbol.name; + result.resolvedSymbol = symbol; + result.parent = location; + result.id = -1; + return result; + } function getResolvedSymbol(node) { + if (node.id === -1) { + return node.resolvedSymbol; + } var links = getNodeLinks(node); if (!links.resolvedSymbol) { - links.resolvedSymbol = (!ts.nodeIsMissing(node) && resolveName(node, node.text, 107455 | 1048576, ts.Diagnostics.Cannot_find_name_0, node)) || unknownSymbol; + links.resolvedSymbol = !ts.nodeIsMissing(node) && resolveName(node, node.text, 107455 | 1048576, ts.Diagnostics.Cannot_find_name_0, node) || unknownSymbol; } return links.resolvedSymbol; } function isInTypeQuery(node) { while (node) { switch (node.kind) { - case 156: + case 157: return true; case 69: - case 137: + case 138: node = node.parent; continue; default: @@ -17789,164 +18482,279 @@ var ts; } ts.Debug.fail("should not get here"); } + function getAssignmentKey(node) { + if (node.kind === 69) { + var symbol = getResolvedSymbol(node); + return symbol !== unknownSymbol ? "" + getSymbolId(symbol) : undefined; + } + if (node.kind === 97) { + return "0"; + } + if (node.kind === 171) { + var key = getAssignmentKey(node.expression); + return key && key + "." + node.name.text; + } + return undefined; + } function hasInitializer(node) { return !!(node.initializer || ts.isBindingPattern(node.parent) && hasInitializer(node.parent.parent)); } - function isVariableAssignedWithin(symbol, node) { - var links = getNodeLinks(node); - if (links.assignmentChecks) { - var cachedResult = links.assignmentChecks[symbol.id]; - if (cachedResult !== undefined) { - return cachedResult; - } - } - else { - links.assignmentChecks = {}; - } - return links.assignmentChecks[symbol.id] = isAssignedIn(node); - function isAssignedInBinaryExpression(node) { - if (node.operatorToken.kind >= 56 && node.operatorToken.kind <= 68) { - var n = skipParenthesizedNodes(node.left); - if (n.kind === 69 && getResolvedSymbol(n) === symbol) { - return true; + function getAssignmentMap(node) { + var assignmentMap = {}; + visit(node); + return assignmentMap; + function visitReference(node) { + if (isAssignmentTarget(node) || isCompoundAssignmentTarget(node)) { + var key = getAssignmentKey(node); + if (key) { + assignmentMap[key] = true; } } - return ts.forEachChild(node, isAssignedIn); + ts.forEachChild(node, visit); } - function isAssignedInVariableDeclaration(node) { - if (!ts.isBindingPattern(node.name) && getSymbolOfNode(node) === symbol && hasInitializer(node)) { - return true; + function visitVariableDeclaration(node) { + if (!ts.isBindingPattern(node.name) && hasInitializer(node)) { + assignmentMap[getSymbolId(getSymbolOfNode(node))] = true; } - return ts.forEachChild(node, isAssignedIn); + ts.forEachChild(node, visit); } - function isAssignedIn(node) { + function visit(node) { switch (node.kind) { - case 185: - return isAssignedInBinaryExpression(node); - case 215: - case 167: - return isAssignedInVariableDeclaration(node); - case 165: - case 166: + case 69: + case 171: + visitReference(node); + break; + case 217: case 168: + visitVariableDeclaration(node); + break; + case 186: + case 166: + case 167: case 169: case 170: - case 171: case 172: case 173: - case 175: - case 193: + case 174: case 176: - case 183: - case 179: - case 182: - case 180: - case 181: + case 194: + case 195: + case 177: case 184: - case 188: - case 186: + case 180: + case 183: + case 181: + case 182: + case 185: case 189: - case 196: - case 197: + case 187: + case 190: + case 198: case 199: - case 200: case 201: case 202: case 203: case 204: case 205: - case 208: - case 209: + case 206: + case 207: case 210: - case 245: - case 246: case 211: case 212: - case 213: + case 226: case 248: - case 237: - case 238: + case 249: + case 213: + case 214: + case 215: + case 251: + case 240: + case 241: + case 245: + case 246: case 242: - case 243: - case 239: - case 244: - return ts.forEachChild(node, isAssignedIn); + case 247: + ts.forEachChild(node, visit); + break; } - return false; } } - function getNarrowedTypeOfSymbol(symbol, node) { - var type = getTypeOfSymbol(symbol); - if (node && symbol.flags & 3) { - if (isTypeAny(type) || type.flags & (80896 | 16384 | 512)) { - var declaration = ts.getDeclarationOfKind(symbol, 215); - var top_1 = declaration && getDeclarationContainer(declaration); - var originalType = type; - var nodeStack = []; - loop: while (node.parent) { - var child = node; - node = node.parent; - switch (node.kind) { - case 200: - case 186: - case 185: - nodeStack.push({ node: node, child: child }); - break; - case 252: - case 222: - break loop; - } - if (node === top_1) { - break; - } - } - var nodes = void 0; - while (nodes = nodeStack.pop()) { - var node_1 = nodes.node, child = nodes.child; - switch (node_1.kind) { - case 200: - if (child !== node_1.expression) { - type = narrowType(type, node_1.expression, child === node_1.thenStatement); - } - break; - case 186: - if (child !== node_1.condition) { - type = narrowType(type, node_1.condition, child === node_1.whenTrue); - } - break; - case 185: - if (child === node_1.right) { - if (node_1.operatorToken.kind === 51) { - type = narrowType(type, node_1.left, true); - } - else if (node_1.operatorToken.kind === 52) { - type = narrowType(type, node_1.left, false); - } - } - break; - default: - ts.Debug.fail("Unreachable!"); - } - if (type !== originalType && isVariableAssignedWithin(symbol, node_1)) { - type = originalType; - } - } - if (type === emptyUnionType) { - type = originalType; - } + function isReferenceAssignedWithin(reference, node) { + if (reference.kind !== 97) { + var key = getAssignmentKey(reference); + if (key) { + var links = getNodeLinks(node); + return (links.assignmentMap || (links.assignmentMap = getAssignmentMap(node)))[key]; } } - return type; - function narrowTypeByEquality(type, expr, assumeTrue) { - if (expr.left.kind !== 180 || expr.right.kind !== 9) { + return false; + } + function isAnyPartOfReferenceAssignedWithin(reference, node) { + while (true) { + if (isReferenceAssignedWithin(reference, node)) { + return true; + } + if (reference.kind !== 171) { + return false; + } + reference = reference.expression; + } + } + function isNullOrUndefinedLiteral(node) { + return node.kind === 93 || + node.kind === 69 && getResolvedSymbol(node) === undefinedSymbol; + } + function getLeftmostIdentifierOrThis(node) { + switch (node.kind) { + case 69: + case 97: + return node; + case 171: + return getLeftmostIdentifierOrThis(node.expression); + } + return undefined; + } + function isMatchingReference(source, target) { + if (source.kind === target.kind) { + switch (source.kind) { + case 69: + return getResolvedSymbol(source) === getResolvedSymbol(target); + case 97: + return true; + case 171: + return source.name.text === target.name.text && + isMatchingReference(source.expression, target.expression); + } + } + return false; + } + function getNarrowedTypeOfReference(type, reference) { + if (!(type.flags & (1 | 80896 | 16384 | 512))) { + return type; + } + var leftmostNode = getLeftmostIdentifierOrThis(reference); + if (!leftmostNode) { + return type; + } + var top; + if (leftmostNode.kind === 69) { + var leftmostSymbol = getExportSymbolOfValueSymbolIfExported(getResolvedSymbol(leftmostNode)); + if (!leftmostSymbol) { return type; } + var declaration = leftmostSymbol.valueDeclaration; + if (!declaration || declaration.kind !== 217 && declaration.kind !== 141 && declaration.kind !== 168) { + return type; + } + top = getDeclarationContainer(declaration); + } + var originalType = type; + var nodeStack = []; + var node = reference; + loop: while (node.parent) { + var child = node; + node = node.parent; + switch (node.kind) { + case 202: + case 187: + case 186: + nodeStack.push({ node: node, child: child }); + break; + case 255: + case 224: + break loop; + default: + if (node === top || ts.isFunctionLikeKind(node.kind)) { + break loop; + } + break; + } + } + var nodes; + while (nodes = nodeStack.pop()) { + var node_1 = nodes.node, child = nodes.child; + switch (node_1.kind) { + case 202: + if (child !== node_1.expression) { + type = narrowType(type, node_1.expression, child === node_1.thenStatement); + } + break; + case 187: + if (child !== node_1.condition) { + type = narrowType(type, node_1.condition, child === node_1.whenTrue); + } + break; + case 186: + if (child === node_1.right) { + if (node_1.operatorToken.kind === 51) { + type = narrowType(type, node_1.left, true); + } + else if (node_1.operatorToken.kind === 52) { + type = narrowType(type, node_1.left, false); + } + } + break; + default: + ts.Debug.fail("Unreachable!"); + } + if (type !== originalType && isAnyPartOfReferenceAssignedWithin(reference, node_1)) { + type = originalType; + } + } + if (type === emptyUnionType) { + type = originalType; + } + return type; + function narrowTypeByTruthiness(type, expr, assumeTrue) { + return strictNullChecks && assumeTrue && isMatchingReference(expr, reference) ? getNonNullableType(type) : type; + } + function narrowTypeByBinaryExpression(type, expr, assumeTrue) { + switch (expr.operatorToken.kind) { + case 30: + case 31: + case 32: + case 33: + if (isNullOrUndefinedLiteral(expr.right)) { + return narrowTypeByNullCheck(type, expr, assumeTrue); + } + if (expr.left.kind === 181 && expr.right.kind === 9) { + return narrowTypeByTypeof(type, expr, assumeTrue); + } + break; + case 51: + return narrowTypeByAnd(type, expr, assumeTrue); + case 52: + return narrowTypeByOr(type, expr, assumeTrue); + case 91: + return narrowTypeByInstanceof(type, expr, assumeTrue); + } + return type; + } + function narrowTypeByNullCheck(type, expr, assumeTrue) { + var operator = expr.operatorToken.kind; + if (operator === 31 || operator === 33) { + assumeTrue = !assumeTrue; + } + if (!strictNullChecks || !isMatchingReference(expr.left, reference)) { + return type; + } + var doubleEquals = operator === 30 || operator === 31; + var exprNullableKind = doubleEquals ? 96 : + expr.right.kind === 93 ? 64 : 32; + if (assumeTrue) { + var nullableKind = getNullableKind(type) & exprNullableKind; + return nullableKind ? getNullableTypeOfKind(nullableKind) : type; + } + return removeNullableKind(type, exprNullableKind); + } + function narrowTypeByTypeof(type, expr, assumeTrue) { var left = expr.left; var right = expr.right; - if (left.expression.kind !== 69 || getResolvedSymbol(left.expression) !== symbol) { + if (!isMatchingReference(left.expression, reference)) { return type; } - if (expr.operatorToken.kind === 33) { + if (expr.operatorToken.kind === 31 || + expr.operatorToken.kind === 33) { assumeTrue = !assumeTrue; } var typeInfo = primitiveTypeInfo[right.text]; @@ -17995,7 +18803,7 @@ var ts; } } function narrowTypeByInstanceof(type, expr, assumeTrue) { - if (isTypeAny(type) || expr.left.kind !== 69 || getResolvedSymbol(expr.left) !== symbol) { + if (isTypeAny(type) || !isMatchingReference(expr.left, reference)) { return type; } var rightType = checkExpression(expr.right); @@ -18040,7 +18848,8 @@ var ts; return getUnionType(assignableConstituents); } } - if (isTypeAssignableTo(narrowedTypeCandidate, originalType)) { + var targetType = originalType.flags & 512 ? getApparentType(originalType) : originalType; + if (isTypeAssignableTo(narrowedTypeCandidate, targetType)) { return narrowedTypeCandidate; } return originalType; @@ -18055,57 +18864,36 @@ var ts; return type; } if (ts.isIdentifierTypePredicate(predicate)) { - if (callExpression.arguments[predicate.parameterIndex] && - getSymbolAtTypePredicatePosition(callExpression.arguments[predicate.parameterIndex]) === symbol) { + var predicateArgument = callExpression.arguments[predicate.parameterIndex]; + if (predicateArgument && isMatchingReference(predicateArgument, reference)) { return getNarrowedType(type, predicate.type, assumeTrue); } } else { var invokedExpression = skipParenthesizedNodes(callExpression.expression); - return narrowTypeByThisTypePredicate(type, predicate, invokedExpression, assumeTrue); - } - return type; - } - function narrowTypeByThisTypePredicate(type, predicate, invokedExpression, assumeTrue) { - if (invokedExpression.kind === 171 || invokedExpression.kind === 170) { - var accessExpression = invokedExpression; - var possibleIdentifier = skipParenthesizedNodes(accessExpression.expression); - if (possibleIdentifier.kind === 69 && getSymbolAtTypePredicatePosition(possibleIdentifier) === symbol) { - return getNarrowedType(type, predicate.type, assumeTrue); + if (invokedExpression.kind === 172 || invokedExpression.kind === 171) { + var accessExpression = invokedExpression; + var possibleReference = skipParenthesizedNodes(accessExpression.expression); + if (isMatchingReference(possibleReference, reference)) { + return getNarrowedType(type, predicate.type, assumeTrue); + } } } return type; } - function getSymbolAtTypePredicatePosition(expr) { - expr = skipParenthesizedNodes(expr); - switch (expr.kind) { - case 69: - case 170: - return getSymbolOfEntityNameOrPropertyAccessExpression(expr); - } - } function narrowType(type, expr, assumeTrue) { switch (expr.kind) { - case 172: + case 69: + case 97: + case 171: + return narrowTypeByTruthiness(type, expr, assumeTrue); + case 173: return narrowTypeByTypePredicate(type, expr, assumeTrue); - case 176: + case 177: return narrowType(type, expr.expression, assumeTrue); - case 185: - var operator = expr.operatorToken.kind; - if (operator === 32 || operator === 33) { - return narrowTypeByEquality(type, expr, assumeTrue); - } - else if (operator === 51) { - return narrowTypeByAnd(type, expr, assumeTrue); - } - else if (operator === 52) { - return narrowTypeByOr(type, expr, assumeTrue); - } - else if (operator === 91) { - return narrowTypeByInstanceof(type, expr, assumeTrue); - } - break; - case 183: + case 186: + return narrowTypeByBinaryExpression(type, expr, assumeTrue); + case 184: if (expr.operator === 49) { return narrowType(type, expr.operand, !assumeTrue); } @@ -18114,17 +18902,121 @@ var ts; return type; } } + function getTypeOfSymbolAtLocation(symbol, location) { + var type = getTypeOfSymbol(symbol); + if (location.kind === 69) { + if (ts.isRightSideOfQualifiedNameOrPropertyAccess(location)) { + location = location.parent; + } + if (ts.isExpression(location)) { + checkExpression(location); + if (getNodeLinks(location).resolvedSymbol === symbol) { + return getNarrowedTypeOfReference(type, location); + } + } + } + return getNarrowedTypeOfReference(type, createTransientIdentifier(symbol, location)); + } function skipParenthesizedNodes(expression) { - while (expression.kind === 176) { + while (expression.kind === 177) { expression = expression.expression; } return expression; } + function findFirstAssignment(symbol, container) { + return visit(ts.isFunctionLike(container) ? container.body : container); + function visit(node) { + switch (node.kind) { + case 69: + var assignment = getAssignmentRoot(node); + return assignment && getResolvedSymbol(node) === symbol ? assignment : undefined; + case 186: + case 217: + case 168: + case 166: + case 167: + case 169: + case 170: + case 171: + case 172: + case 173: + case 174: + case 176: + case 194: + case 195: + case 177: + case 184: + case 180: + case 183: + case 181: + case 182: + case 185: + case 189: + case 187: + case 190: + case 199: + case 201: + case 202: + case 203: + case 204: + case 205: + case 206: + case 207: + case 210: + case 211: + case 212: + case 226: + case 248: + case 249: + case 213: + case 214: + case 215: + case 251: + case 240: + case 241: + case 245: + case 246: + case 242: + case 247: + case 198: + case 255: + return ts.forEachChild(node, visit); + } + return undefined; + } + } + function checkVariableAssignedBefore(symbol, reference) { + if (!(symbol.flags & 3)) { + return; + } + var declaration = symbol.valueDeclaration; + if (!declaration || declaration.kind !== 217 || declaration.initializer || ts.isInAmbientContext(declaration)) { + return; + } + var parentParentKind = declaration.parent.parent.kind; + if (parentParentKind === 207 || parentParentKind === 206) { + return; + } + var declarationContainer = ts.getContainingFunction(declaration) || ts.getSourceFileOfNode(declaration); + var referenceContainer = ts.getContainingFunction(reference) || ts.getSourceFileOfNode(reference); + if (declarationContainer !== referenceContainer) { + return; + } + var links = getSymbolLinks(symbol); + if (!links.firstAssignmentChecked) { + links.firstAssignmentChecked = true; + links.firstAssignment = findFirstAssignment(symbol, declarationContainer); + } + if (links.firstAssignment && links.firstAssignment.end <= reference.pos) { + return; + } + error(reference, ts.Diagnostics.Variable_0_is_used_before_being_assigned, symbolToString(symbol)); + } function checkIdentifier(node) { var symbol = getResolvedSymbol(node); if (symbol === argumentsSymbol) { var container = ts.getContainingFunction(node); - if (container.kind === 178) { + if (container.kind === 179) { if (languageVersion < 2) { error(node, ts.Diagnostics.The_arguments_object_cannot_be_referenced_in_an_arrow_function_in_ES3_and_ES5_Consider_using_a_standard_function_expression); } @@ -18139,7 +19031,7 @@ var ts; var localOrExportSymbol = getExportSymbolOfValueSymbolIfExported(symbol); if (languageVersion === 2 && localOrExportSymbol.flags & 32 - && localOrExportSymbol.valueDeclaration.kind === 218 + && localOrExportSymbol.valueDeclaration.kind === 220 && ts.nodeIsDecorated(localOrExportSymbol.valueDeclaration)) { var container = ts.getContainingClass(node); while (container !== undefined) { @@ -18154,7 +19046,11 @@ var ts; checkCollisionWithCapturedSuperVariable(node, node); checkCollisionWithCapturedThisVariable(node, node); checkNestedBlockScopedBinding(node, symbol); - return getNarrowedTypeOfSymbol(localOrExportSymbol, node); + var type = getTypeOfSymbol(localOrExportSymbol); + if (strictNullChecks && !isAssignmentTarget(node) && !(type.flags & 1) && !(getNullableKind(type) & 32)) { + checkVariableAssignedBefore(symbol, node); + } + return getNarrowedTypeOfReference(type, node); } function isInsideFunction(node, threshold) { var current = node; @@ -18169,7 +19065,7 @@ var ts; function checkNestedBlockScopedBinding(node, symbol) { if (languageVersion >= 2 || (symbol.flags & (2 | 32)) === 0 || - symbol.valueDeclaration.parent.kind === 248) { + symbol.valueDeclaration.parent.kind === 251) { return; } var container = ts.getEnclosingBlockScopeContainer(symbol.valueDeclaration); @@ -18187,8 +19083,8 @@ var ts; if (usedInFunction) { getNodeLinks(current).flags |= 65536; } - if (container.kind === 203 && - ts.getAncestor(symbol.valueDeclaration, 216).parent === container && + if (container.kind === 205 && + ts.getAncestor(symbol.valueDeclaration, 218).parent === container && isAssignedInBodyOfForStatement(node, container)) { getNodeLinks(symbol.valueDeclaration).flags |= 2097152; } @@ -18200,14 +19096,14 @@ var ts; } function isAssignedInBodyOfForStatement(node, container) { var current = node; - while (current.parent.kind === 176) { + while (current.parent.kind === 177) { current = current.parent; } var isAssigned = false; - if (current.parent.kind === 185) { - isAssigned = current.parent.left === current && ts.isAssignmentOperator(current.parent.operatorToken.kind); + if (isAssignmentTarget(current)) { + isAssigned = true; } - if ((current.parent.kind === 183 || current.parent.kind === 184)) { + else if ((current.parent.kind === 184 || current.parent.kind === 185)) { var expr = current.parent; isAssigned = expr.operator === 41 || expr.operator === 42; } @@ -18226,7 +19122,7 @@ var ts; } function captureLexicalThis(node, container) { getNodeLinks(node).flags |= 2; - if (container.kind === 143 || container.kind === 146) { + if (container.kind === 144 || container.kind === 147) { var classNode = container.parent; getNodeLinks(classNode).flags |= 4; } @@ -18260,7 +19156,7 @@ var ts; function checkThisExpression(node) { var container = ts.getThisContainer(node, true); var needToCaptureLexicalThis = false; - if (container.kind === 146) { + if (container.kind === 147) { var containingClassDecl = container.parent; var baseTypeNode = ts.getClassExtendsHeritageClauseElement(containingClassDecl); if (baseTypeNode && !classDeclarationExtendsNull(containingClassDecl)) { @@ -18270,45 +19166,62 @@ var ts; } } } - if (container.kind === 178) { + if (container.kind === 179) { container = ts.getThisContainer(container, false); needToCaptureLexicalThis = (languageVersion < 2); } switch (container.kind) { - case 222: + case 224: error(node, ts.Diagnostics.this_cannot_be_referenced_in_a_module_or_namespace_body); break; - case 221: + case 223: error(node, ts.Diagnostics.this_cannot_be_referenced_in_current_location); break; - case 146: + case 147: if (isInConstructorArgumentInitializer(node, container)) { error(node, ts.Diagnostics.this_cannot_be_referenced_in_constructor_arguments); } break; + case 144: case 143: - case 142: if (container.flags & 32) { error(node, ts.Diagnostics.this_cannot_be_referenced_in_a_static_property_initializer); } break; - case 138: + case 139: error(node, ts.Diagnostics.this_cannot_be_referenced_in_a_computed_property_name); break; } if (needToCaptureLexicalThis) { captureLexicalThis(node, container); } + if (ts.isFunctionLike(container)) { + var type = getContextuallyTypedThisType(container); + if (type) { + return type; + } + var signature = getSignatureFromDeclaration(container); + if (signature.thisType) { + return signature.thisType; + } + if (container.parent && container.parent.kind === 170) { + var type_1 = checkExpressionCached(container.parent); + if (type_1) { + return type_1; + } + } + } if (ts.isClassLike(container.parent)) { var symbol = getSymbolOfNode(container.parent); - return container.flags & 32 ? getTypeOfSymbol(symbol) : getDeclaredTypeOfSymbol(symbol).thisType; + var type = container.flags & 32 ? getTypeOfSymbol(symbol) : getDeclaredTypeOfSymbol(symbol).thisType; + return getNarrowedTypeOfReference(type, node); } if (ts.isInJavaScriptFile(node)) { var type = getTypeForThisExpressionFromJSDoc(container); if (type && type !== unknownType) { return type; } - if (container.kind === 177) { + if (container.kind === 178) { if (ts.getSpecialPropertyAssignmentKind(container.parent) === 3) { var className = container.parent .left @@ -18321,31 +19234,34 @@ var ts; } } } + if (compilerOptions.noImplicitThis) { + error(node, ts.Diagnostics.this_implicitly_has_type_any_because_it_does_not_have_a_type_annotation); + } return anyType; } function getTypeForThisExpressionFromJSDoc(node) { var typeTag = ts.getJSDocTypeTag(node); - if (typeTag && typeTag.typeExpression && typeTag.typeExpression.type && typeTag.typeExpression.type.kind === 265) { + if (typeTag && typeTag.typeExpression && typeTag.typeExpression.type && typeTag.typeExpression.type.kind === 268) { var jsDocFunctionType = typeTag.typeExpression.type; - if (jsDocFunctionType.parameters.length > 0 && jsDocFunctionType.parameters[0].type.kind === 268) { + if (jsDocFunctionType.parameters.length > 0 && jsDocFunctionType.parameters[0].type.kind === 271) { return getTypeFromTypeNode(jsDocFunctionType.parameters[0].type); } } } function isInConstructorArgumentInitializer(node, constructorDecl) { for (var n = node; n && n !== constructorDecl; n = n.parent) { - if (n.kind === 140) { + if (n.kind === 141) { return true; } } return false; } function checkSuperExpression(node) { - var isCallExpression = node.parent.kind === 172 && node.parent.expression === node; + var isCallExpression = node.parent.kind === 173 && node.parent.expression === node; var container = ts.getSuperContainer(node, true); var needToCaptureLexicalThis = false; if (!isCallExpression) { - while (container && container.kind === 178) { + while (container && container.kind === 179) { container = ts.getSuperContainer(container, true); needToCaptureLexicalThis = languageVersion < 2; } @@ -18354,16 +19270,16 @@ var ts; var nodeCheckFlag = 0; if (!canUseSuperExpression) { var current = node; - while (current && current !== container && current.kind !== 138) { + while (current && current !== container && current.kind !== 139) { current = current.parent; } - if (current && current.kind === 138) { + if (current && current.kind === 139) { 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 === 169)) { + else if (!container || !container.parent || !(ts.isClassLike(container.parent) || container.parent.kind === 170)) { error(node, ts.Diagnostics.super_can_only_be_referenced_in_members_of_derived_classes_or_object_literal_expressions); } else { @@ -18378,7 +19294,7 @@ var ts; nodeCheckFlag = 256; } getNodeLinks(node).flags |= nodeCheckFlag; - if (container.kind === 145 && container.flags & 256) { + if (container.kind === 146 && container.flags & 256) { if (ts.isSuperPropertyOrElementAccess(node.parent) && isAssignmentTarget(node.parent)) { getNodeLinks(container).flags |= 4096; } @@ -18389,7 +19305,7 @@ var ts; if (needToCaptureLexicalThis) { captureLexicalThis(node.parent, container); } - if (container.parent.kind === 169) { + if (container.parent.kind === 170) { if (languageVersion < 2) { error(node, ts.Diagnostics.super_is_only_allowed_in_members_of_object_literal_expressions_when_option_target_is_ES2015_or_higher); return unknownType; @@ -18407,7 +19323,7 @@ var ts; } return unknownType; } - if (container.kind === 146 && isInConstructorArgumentInitializer(node, container)) { + if (container.kind === 147 && isInConstructorArgumentInitializer(node, container)) { error(node, ts.Diagnostics.super_cannot_be_referenced_in_constructor_arguments); return unknownType; } @@ -18419,30 +19335,41 @@ var ts; return false; } if (isCallExpression) { - return container.kind === 146; + return container.kind === 147; } else { - if (ts.isClassLike(container.parent) || container.parent.kind === 169) { + if (ts.isClassLike(container.parent) || container.parent.kind === 170) { if (container.flags & 32) { - return container.kind === 145 || - container.kind === 144 || - container.kind === 147 || - container.kind === 148; + return container.kind === 146 || + container.kind === 145 || + container.kind === 148 || + container.kind === 149; } else { - return container.kind === 145 || - container.kind === 144 || - container.kind === 147 || + return container.kind === 146 || + container.kind === 145 || container.kind === 148 || + container.kind === 149 || + container.kind === 144 || container.kind === 143 || - container.kind === 142 || - container.kind === 146; + container.kind === 147; } } } return false; } } + function getContextuallyTypedThisType(func) { + if ((isFunctionExpressionOrArrowFunction(func) || ts.isObjectLiteralMethod(func)) && + isContextSensitive(func) && + func.kind !== 179) { + var contextualSignature = getContextualSignature(func); + if (contextualSignature) { + return contextualSignature.thisType; + } + } + return undefined; + } function getContextuallyTypedParameterType(parameter) { var func = parameter.parent; if (isFunctionExpressionOrArrowFunction(func) || ts.isObjectLiteralMethod(func)) { @@ -18471,7 +19398,7 @@ var ts; if (declaration.type) { return getTypeFromTypeNode(declaration.type); } - if (declaration.kind === 140) { + if (declaration.kind === 141) { var type = getContextuallyTypedParameterType(declaration); if (type) { return type; @@ -18480,6 +19407,18 @@ var ts; if (ts.isBindingPattern(declaration.name)) { return getTypeFromBindingPattern(declaration.name, true); } + if (ts.isBindingPattern(declaration.parent)) { + var parentDeclaration = declaration.parent.parent; + var name_11 = declaration.propertyName || declaration.name; + if (ts.isVariableLike(parentDeclaration) && + parentDeclaration.type && + !ts.isBindingPattern(name_11)) { + var text = getTextOfPropertyName(name_11); + if (text) { + return getTypeOfPropertyOfType(getTypeFromTypeNode(parentDeclaration.type), text); + } + } + } } return undefined; } @@ -18504,7 +19443,7 @@ var ts; } function isInParameterInitializerBeforeContainingFunction(node) { while (node.parent && !ts.isFunctionLike(node.parent)) { - if (node.parent.kind === 140 && node.parent.initializer === node) { + if (node.parent.kind === 141 && node.parent.initializer === node) { return true; } node = node.parent; @@ -18513,8 +19452,8 @@ var ts; } function getContextualReturnType(functionDecl) { if (functionDecl.type || - functionDecl.kind === 146 || - functionDecl.kind === 147 && ts.getSetAccessorTypeAnnotationNode(ts.getDeclarationOfKind(functionDecl.symbol, 148))) { + functionDecl.kind === 147 || + functionDecl.kind === 148 && ts.getSetAccessorTypeAnnotationNode(ts.getDeclarationOfKind(functionDecl.symbol, 149))) { return getReturnTypeOfSignature(getSignatureFromDeclaration(functionDecl)); } var signature = getContextualSignatureForFunctionLikeDeclaration(functionDecl); @@ -18533,7 +19472,7 @@ var ts; return undefined; } function getContextualTypeForSubstitutionExpression(template, substitutionExpression) { - if (template.parent.kind === 174) { + if (template.parent.kind === 175) { return getContextualTypeForArgument(template.parent, substitutionExpression); } return undefined; @@ -18641,13 +19580,13 @@ var ts; var kind = attribute.kind; var jsxElement = attribute.parent; var attrsType = getJsxElementAttributesType(jsxElement); - if (attribute.kind === 242) { + if (attribute.kind === 245) { if (!attrsType || isTypeAny(attrsType)) { return undefined; } return getTypeOfPropertyOfType(attrsType, attribute.name.text); } - else if (attribute.kind === 243) { + else if (attribute.kind === 246) { return attrsType; } ts.Debug.fail("Expected JsxAttribute or JsxSpreadAttribute, got ts.SyntaxKind[" + kind + "]"); @@ -18665,40 +19604,40 @@ var ts; } var parent = node.parent; switch (parent.kind) { - case 215: - case 140: + case 217: + case 141: + case 144: case 143: - case 142: - case 167: - return getContextualTypeForInitializerExpression(node); - case 178: - case 208: - return getContextualTypeForReturnExpression(node); - case 188: - return getContextualTypeForYieldOperand(parent); - case 172: - case 173: - return getContextualTypeForArgument(parent, node); - case 175: - case 193: - return getTypeFromTypeNode(parent.type); - case 185: - return getContextualTypeForBinaryOperand(node); - case 249: - return getContextualTypeForObjectLiteralElement(parent); case 168: - return getContextualTypeForElementExpression(node); - case 186: - return getContextualTypeForConditionalOperand(node); - case 194: - ts.Debug.assert(parent.parent.kind === 187); - return getContextualTypeForSubstitutionExpression(parent.parent, node); + return getContextualTypeForInitializerExpression(node); + case 179: + case 210: + return getContextualTypeForReturnExpression(node); + case 189: + return getContextualTypeForYieldOperand(parent); + case 173: + case 174: + return getContextualTypeForArgument(parent, node); case 176: + case 194: + return getTypeFromTypeNode(parent.type); + case 186: + return getContextualTypeForBinaryOperand(node); + case 252: + return getContextualTypeForObjectLiteralElement(parent); + case 169: + return getContextualTypeForElementExpression(node); + case 187: + return getContextualTypeForConditionalOperand(node); + case 196: + ts.Debug.assert(parent.parent.kind === 188); + return getContextualTypeForSubstitutionExpression(parent.parent, node); + case 177: return getContextualType(parent); - case 244: + case 247: return getContextualType(parent); - case 242: - case 243: + case 245: + case 246: return getContextualTypeForJsxAttribute(parent); } return undefined; @@ -18713,7 +19652,7 @@ var ts; } } function isFunctionExpressionOrArrowFunction(node) { - return node.kind === 177 || node.kind === 178; + return node.kind === 178 || node.kind === 179; } function getContextualSignatureForFunctionLikeDeclaration(node) { return isFunctionExpressionOrArrowFunction(node) || ts.isObjectLiteralMethod(node) @@ -18721,7 +19660,7 @@ var ts; : undefined; } function getContextualSignature(node) { - ts.Debug.assert(node.kind !== 145 || ts.isObjectLiteralMethod(node)); + ts.Debug.assert(node.kind !== 146 || ts.isObjectLiteralMethod(node)); var type = ts.isObjectLiteralMethod(node) ? getContextualTypeForObjectLiteralMethod(node) : getApparentTypeOfContextualType(node); @@ -18740,7 +19679,7 @@ var ts; if (!signatureList) { signatureList = [signature]; } - else if (!compareSignaturesIdentical(signatureList[0], signature, false, true, compareTypesIdentical)) { + else if (!compareSignaturesIdentical(signatureList[0], signature, false, true, true, compareTypesIdentical)) { return undefined; } else { @@ -18759,16 +19698,34 @@ var ts; function isInferentialContext(mapper) { return mapper && mapper.context; } - function isAssignmentTarget(node) { + function getAssignmentRoot(node) { + while (node.parent.kind === 177) { + node = node.parent; + } + while (true) { + if (node.parent.kind === 252) { + node = node.parent.parent; + } + else if (node.parent.kind === 169) { + node = node.parent; + } + else { + break; + } + } var parent = node.parent; - if (parent.kind === 185 && parent.operatorToken.kind === 56 && parent.left === node) { - return true; - } - if (parent.kind === 249) { - return isAssignmentTarget(parent.parent); - } - if (parent.kind === 168) { - return isAssignmentTarget(parent); + return parent.kind === 186 && + parent.operatorToken.kind === 56 && + parent.left === node ? parent : undefined; + } + function isAssignmentTarget(node) { + return !!getAssignmentRoot(node); + } + function isCompoundAssignmentTarget(node) { + var parent = node.parent; + if (parent.kind === 186 && parent.left === node) { + var operator = parent.operatorToken.kind; + return operator >= 56 && operator <= 68; } return false; } @@ -18777,8 +19734,8 @@ var ts; return checkIteratedTypeOrElementType(arrayOrIterableType, node.expression, false); } function hasDefaultValue(node) { - return (node.kind === 167 && !!node.initializer) || - (node.kind === 185 && node.operatorToken.kind === 56); + return (node.kind === 168 && !!node.initializer) || + (node.kind === 186 && node.operatorToken.kind === 56); } function checkArrayLiteral(node, contextualMapper) { var elements = node.elements; @@ -18787,7 +19744,7 @@ var ts; var inDestructuringPattern = isAssignmentTarget(node); for (var _i = 0, elements_1 = elements; _i < elements_1.length; _i++) { var e = elements_1[_i]; - if (inDestructuringPattern && e.kind === 189) { + if (inDestructuringPattern && e.kind === 190) { var restArrayType = checkExpression(e.expression, contextualMapper); var restElementType = getIndexTypeOfType(restArrayType, 1) || (languageVersion >= 2 ? getElementTypeOfIterable(restArrayType, undefined) : undefined); @@ -18799,7 +19756,7 @@ var ts; var type = checkExpression(e, contextualMapper); elementTypes.push(type); } - hasSpreadElement = hasSpreadElement || e.kind === 189; + hasSpreadElement = hasSpreadElement || e.kind === 190; } if (!hasSpreadElement) { if (inDestructuringPattern && elementTypes.length) { @@ -18810,7 +19767,7 @@ var ts; var contextualType = getApparentTypeOfContextualType(node); if (contextualType && contextualTypeIsTupleLikeType(contextualType)) { var pattern = contextualType.pattern; - if (pattern && (pattern.kind === 166 || pattern.kind === 168)) { + if (pattern && (pattern.kind === 167 || pattern.kind === 169)) { var patternElements = pattern.elements; for (var i = elementTypes.length; i < patternElements.length; i++) { var patternElement = patternElements[i]; @@ -18818,7 +19775,7 @@ var ts; elementTypes.push(contextualType.elementTypes[i]); } else { - if (patternElement.kind !== 191) { + if (patternElement.kind !== 192) { error(patternElement, ts.Diagnostics.Initializer_provides_no_value_for_this_binding_element_and_the_binding_element_has_no_default_value); } elementTypes.push(unknownType); @@ -18830,10 +19787,10 @@ var ts; } } } - return createArrayType(elementTypes.length ? getUnionType(elementTypes) : undefinedType); + return createArrayType(elementTypes.length ? getUnionType(elementTypes) : emptyArrayElementType); } function isNumericName(name) { - return name.kind === 138 ? isNumericComputedName(name) : isNumericLiteralName(name.text); + return name.kind === 139 ? isNumericComputedName(name) : isNumericLiteralName(name.text); } function isNumericComputedName(name) { return isTypeAnyOrAllConstituentTypesHaveKind(checkComputedPropertyName(name), 132); @@ -18874,7 +19831,7 @@ var ts; var propertiesArray = []; var contextualType = getApparentTypeOfContextualType(node); var contextualTypeHasPattern = contextualType && contextualType.pattern && - (contextualType.pattern.kind === 165 || contextualType.pattern.kind === 169); + (contextualType.pattern.kind === 166 || contextualType.pattern.kind === 170); var typeFlags = 0; var patternWithComputedProperties = false; var hasComputedStringProperty = false; @@ -18882,25 +19839,25 @@ var ts; for (var _i = 0, _a = node.properties; _i < _a.length; _i++) { var memberDecl = _a[_i]; var member = memberDecl.symbol; - if (memberDecl.kind === 249 || - memberDecl.kind === 250 || + if (memberDecl.kind === 252 || + memberDecl.kind === 253 || ts.isObjectLiteralMethod(memberDecl)) { var type = void 0; - if (memberDecl.kind === 249) { + if (memberDecl.kind === 252) { type = checkPropertyAssignment(memberDecl, contextualMapper); } - else if (memberDecl.kind === 145) { + else if (memberDecl.kind === 146) { type = checkObjectLiteralMethod(memberDecl, contextualMapper); } else { - ts.Debug.assert(memberDecl.kind === 250); + ts.Debug.assert(memberDecl.kind === 253); type = checkExpression(memberDecl.name, contextualMapper); } typeFlags |= type.flags; var prop = createSymbol(4 | 67108864 | member.flags, member.name); if (inDestructuringPattern) { - var isOptional = (memberDecl.kind === 249 && hasDefaultValue(memberDecl.initializer)) || - (memberDecl.kind === 250 && memberDecl.objectAssignmentInitializer); + var isOptional = (memberDecl.kind === 252 && hasDefaultValue(memberDecl.initializer)) || + (memberDecl.kind === 253 && memberDecl.objectAssignmentInitializer); if (isOptional) { prop.flags |= 536870912; } @@ -18927,7 +19884,7 @@ var ts; member = prop; } else { - ts.Debug.assert(memberDecl.kind === 147 || memberDecl.kind === 148); + ts.Debug.assert(memberDecl.kind === 148 || memberDecl.kind === 149); checkAccessorDeclaration(memberDecl); } if (ts.hasDynamicName(memberDecl)) { @@ -18971,17 +19928,22 @@ var ts; } function checkJsxElement(node) { checkJsxOpeningLikeElement(node.openingElement); - getJsxTagSymbol(node.closingElement); + if (isJsxIntrinsicIdentifier(node.closingElement.tagName)) { + getIntrinsicTagSymbol(node.closingElement); + } + else { + checkExpression(node.closingElement.tagName); + } for (var _i = 0, _a = node.children; _i < _a.length; _i++) { var child = _a[_i]; switch (child.kind) { - case 244: + case 247: checkJsxExpression(child); break; - case 237: + case 240: checkJsxElement(child); break; - case 238: + case 241: checkJsxSelfClosingElement(child); break; } @@ -18992,7 +19954,7 @@ var ts; return name.indexOf("-") < 0; } function isJsxIntrinsicIdentifier(tagName) { - if (tagName.kind === 137) { + if (tagName.kind === 138) { return false; } else { @@ -19055,14 +20017,6 @@ var ts; } return jsxTypes[name]; } - function getJsxTagSymbol(node) { - if (isJsxIntrinsicIdentifier(node.tagName)) { - return getIntrinsicTagSymbol(node); - } - else { - return checkExpression(node.tagName).symbol; - } - } function getIntrinsicTagSymbol(node) { var links = getNodeLinks(node); if (!links.resolvedSymbol) { @@ -19142,17 +20096,19 @@ var ts; var elemInstanceType = getJsxElementInstanceType(node); var elemClassType = getJsxGlobalElementClassType(); if (!elemClassType || !isTypeAssignableTo(elemInstanceType, elemClassType)) { - var elemType = checkExpression(node.tagName); - var callSignatures = elemType && getSignaturesOfType(elemType, 0); - var callSignature = callSignatures && callSignatures.length > 0 && callSignatures[0]; - var callReturnType = callSignature && getReturnTypeOfSignature(callSignature); - var paramType = callReturnType && (callSignature.parameters.length === 0 ? emptyObjectType : getTypeOfSymbol(callSignature.parameters[0])); - if (callReturnType && isTypeAssignableTo(callReturnType, jsxElementType)) { - var intrinsicAttributes = getJsxType(JsxNames.IntrinsicAttributes); - if (intrinsicAttributes !== unknownType) { - paramType = intersectTypes(intrinsicAttributes, paramType); + if (jsxElementType) { + var elemType = checkExpression(node.tagName); + var callSignatures = elemType && getSignaturesOfType(elemType, 0); + var callSignature = callSignatures && callSignatures.length > 0 && callSignatures[0]; + var callReturnType = callSignature && getReturnTypeOfSignature(callSignature); + var paramType = callReturnType && (callSignature.parameters.length === 0 ? emptyObjectType : getTypeOfSymbol(callSignature.parameters[0])); + if (callReturnType && isTypeAssignableTo(callReturnType, jsxElementType)) { + var intrinsicAttributes = getJsxType(JsxNames.IntrinsicAttributes); + if (intrinsicAttributes !== unknownType) { + paramType = intersectTypes(intrinsicAttributes, paramType); + } + return links.resolvedJsxType = paramType; } - return links.resolvedJsxType = paramType; } } if (elemClassType) { @@ -19244,11 +20200,11 @@ var ts; var nameTable = {}; var sawSpreadedAny = false; for (var i = node.attributes.length - 1; i >= 0; i--) { - if (node.attributes[i].kind === 242) { + if (node.attributes[i].kind === 245) { checkJsxAttribute((node.attributes[i]), targetAttributesType, nameTable); } else { - ts.Debug.assert(node.attributes[i].kind === 243); + ts.Debug.assert(node.attributes[i].kind === 246); var spreadType = checkJsxSpreadAttribute((node.attributes[i]), targetAttributesType, nameTable); if (isTypeAny(spreadType)) { sawSpreadedAny = true; @@ -19274,7 +20230,7 @@ var ts; } } function getDeclarationKindFromSymbol(s) { - return s.valueDeclaration ? s.valueDeclaration.kind : 143; + return s.valueDeclaration ? s.valueDeclaration.kind : 144; } function getDeclarationFlagsFromSymbol(s) { return s.valueDeclaration ? ts.getCombinedNodeFlags(s.valueDeclaration) : s.flags & 134217728 ? 4 | 32 : 0; @@ -19282,11 +20238,11 @@ var ts; function checkClassPropertyAccess(node, left, type, prop) { var flags = getDeclarationFlagsFromSymbol(prop); var declaringClass = getDeclaredTypeOfSymbol(getParentOfSymbol(prop)); + var errorNode = node.kind === 171 || node.kind === 217 ? + node.name : + node.right; if (left.kind === 95) { - var errorNode = node.kind === 170 ? - node.name : - node.right; - if (languageVersion < 2 && getDeclarationKindFromSymbol(prop) !== 145) { + if (languageVersion < 2 && getDeclarationKindFromSymbol(prop) !== 146) { error(errorNode, ts.Diagnostics.Only_public_and_protected_methods_of_the_base_class_are_accessible_via_the_super_keyword); return false; } @@ -19298,11 +20254,10 @@ var ts; if (!(flags & (8 | 16))) { return true; } - var enclosingClassDeclaration = ts.getContainingClass(node); - var enclosingClass = enclosingClassDeclaration ? getDeclaredTypeOfSymbol(getSymbolOfNode(enclosingClassDeclaration)) : undefined; if (flags & 8) { - if (declaringClass !== enclosingClass) { - error(node, ts.Diagnostics.Property_0_is_private_and_only_accessible_within_class_1, symbolToString(prop), typeToString(declaringClass)); + var declaringClassDeclaration = getClassLikeDeclarationOfSymbol(getParentOfSymbol(prop)); + if (!isNodeWithinClass(node, declaringClassDeclaration)) { + error(errorNode, ts.Diagnostics.Property_0_is_private_and_only_accessible_within_class_1, symbolToString(prop), typeToString(declaringClass)); return false; } return true; @@ -19310,8 +20265,12 @@ var ts; if (left.kind === 95) { return true; } - if (!enclosingClass || !hasBaseType(enclosingClass, declaringClass)) { - error(node, ts.Diagnostics.Property_0_is_protected_and_only_accessible_within_class_1_and_its_subclasses, symbolToString(prop), typeToString(declaringClass)); + var enclosingClass = forEachEnclosingClass(node, function (enclosingDeclaration) { + var enclosingClass = getDeclaredTypeOfSymbol(getSymbolOfNode(enclosingDeclaration)); + return hasBaseType(enclosingClass, declaringClass) ? enclosingClass : undefined; + }); + if (!enclosingClass) { + error(errorNode, ts.Diagnostics.Property_0_is_protected_and_only_accessible_within_class_1_and_its_subclasses, symbolToString(prop), typeToString(declaringClass)); return false; } if (flags & 32) { @@ -19321,11 +20280,19 @@ var ts; type = getConstraintOfTypeParameter(type); } if (!(getTargetType(type).flags & (1024 | 2048) && hasBaseType(type, enclosingClass))) { - error(node, ts.Diagnostics.Property_0_is_protected_and_only_accessible_through_an_instance_of_class_1, symbolToString(prop), typeToString(enclosingClass)); + error(errorNode, ts.Diagnostics.Property_0_is_protected_and_only_accessible_through_an_instance_of_class_1, symbolToString(prop), typeToString(enclosingClass)); return false; } return true; } + function checkNonNullExpression(node) { + var type = checkExpression(node); + if (strictNullChecks && getNullableKind(type)) { + error(node, ts.Diagnostics.Object_is_possibly_null_or_undefined); + return getNonNullableType(type); + } + return type; + } function checkPropertyAccessExpression(node) { return checkPropertyAccessExpressionOrQualifiedName(node, node.expression, node.name); } @@ -19333,7 +20300,7 @@ var ts; return checkPropertyAccessExpressionOrQualifiedName(node, node.left, node.right); } function checkPropertyAccessExpressionOrQualifiedName(node, left, right) { - var type = checkExpression(left); + var type = checkNonNullExpression(left); if (isTypeAny(type)) { return type; } @@ -19352,10 +20319,12 @@ var ts; if (prop.parent && prop.parent.flags & 32) { checkClassPropertyAccess(node, left, apparentType, prop); } - return getTypeOfSymbol(prop); + var propType = getTypeOfSymbol(prop); + return node.kind === 171 && prop.flags & 4 ? + getNarrowedTypeOfReference(propType, node) : propType; } function isValidPropertyAccess(node, propertyName) { - var left = node.kind === 170 + var left = node.kind === 171 ? node.expression : node.left; var type = checkExpression(left); @@ -19369,7 +20338,7 @@ var ts; } function getForInVariableSymbol(node) { var initializer = node.initializer; - if (initializer.kind === 216) { + if (initializer.kind === 218) { var variable = initializer.declarations[0]; if (variable && !ts.isBindingPattern(variable.name)) { return getSymbolOfNode(variable); @@ -19391,7 +20360,7 @@ var ts; var child = expr; var node = expr.parent; while (node) { - if (node.kind === 204 && + if (node.kind === 206 && child === node.statement && getForInVariableSymbol(node) === symbol && hasNumericPropertyNames(checkExpression(node.expression))) { @@ -19407,7 +20376,7 @@ var ts; function checkIndexedAccess(node) { if (!node.argumentExpression) { var sourceFile = ts.getSourceFileOfNode(node); - if (node.parent.kind === 173 && node.parent.expression === node) { + if (node.parent.kind === 174 && 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); @@ -19418,7 +20387,7 @@ var ts; grammarErrorAtPos(sourceFile, start, end - start, ts.Diagnostics.Expression_expected); } } - var objectType = getApparentType(checkExpression(node.expression)); + var objectType = getApparentType(checkNonNullExpression(node.expression)); var indexType = node.argumentExpression ? checkExpression(node.argumentExpression) : unknownType; if (objectType === unknownType) { return unknownType; @@ -19430,15 +20399,15 @@ var ts; return unknownType; } if (node.argumentExpression) { - var name_11 = getPropertyNameForIndexedAccess(node.argumentExpression, indexType); - if (name_11 !== undefined) { - var prop = getPropertyOfType(objectType, name_11); + var name_12 = getPropertyNameForIndexedAccess(node.argumentExpression, indexType); + if (name_12 !== undefined) { + var prop = getPropertyOfType(objectType, name_12); 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_11, symbolToString(objectType.symbol)); + error(node.argumentExpression, ts.Diagnostics.Property_0_does_not_exist_on_const_enum_1, name_12, symbolToString(objectType.symbol)); return unknownType; } } @@ -19470,7 +20439,7 @@ var ts; if (indexArgumentExpression.kind === 9 || indexArgumentExpression.kind === 8) { return indexArgumentExpression.text; } - if (indexArgumentExpression.kind === 171 || indexArgumentExpression.kind === 170) { + if (indexArgumentExpression.kind === 172 || indexArgumentExpression.kind === 171) { var value = getConstantValue(indexArgumentExpression); if (value !== undefined) { return value.toString(); @@ -19513,10 +20482,10 @@ var ts; return true; } function resolveUntypedCall(node) { - if (node.kind === 174) { + if (node.kind === 175) { checkExpression(node.template); } - else if (node.kind !== 141) { + else if (node.kind !== 142) { ts.forEach(node.arguments, function (argument) { checkExpression(argument); }); @@ -19538,19 +20507,19 @@ var ts; for (var _i = 0, signatures_2 = signatures; _i < signatures_2.length; _i++) { var signature = signatures_2[_i]; var symbol = signature.declaration && getSymbolOfNode(signature.declaration); - var parent_6 = signature.declaration && signature.declaration.parent; + var parent_7 = signature.declaration && signature.declaration.parent; if (!lastSymbol || symbol === lastSymbol) { - if (lastParent && parent_6 === lastParent) { + if (lastParent && parent_7 === lastParent) { index++; } else { - lastParent = parent_6; + lastParent = parent_7; index = cutoffIndex; } } else { index = cutoffIndex = result.length; - lastParent = parent_6; + lastParent = parent_7; } lastSymbol = symbol; if (signature.hasStringLiterals) { @@ -19567,7 +20536,7 @@ var ts; function getSpreadArgumentIndex(args) { for (var i = 0; i < args.length; i++) { var arg = args[i]; - if (arg && arg.kind === 189) { + if (arg && arg.kind === 190) { return i; } } @@ -19579,11 +20548,11 @@ var ts; var callIsIncomplete; var isDecorator; var spreadArgIndex = -1; - if (node.kind === 174) { + if (node.kind === 175) { var tagExpression = node; adjustedArgCount = args.length; typeArguments = undefined; - if (tagExpression.template.kind === 187) { + if (tagExpression.template.kind === 188) { var templateExpression = tagExpression.template; var lastSpan = ts.lastOrUndefined(templateExpression.templateSpans); ts.Debug.assert(lastSpan !== undefined); @@ -19595,7 +20564,7 @@ var ts; callIsIncomplete = !!templateLiteral.isUnterminated; } } - else if (node.kind === 141) { + else if (node.kind === 142) { isDecorator = true; typeArguments = undefined; adjustedArgCount = getEffectiveArgumentCount(node, undefined, signature); @@ -19603,7 +20572,7 @@ var ts; else { var callExpression = node; if (!callExpression.arguments) { - ts.Debug.assert(callExpression.kind === 173); + ts.Debug.assert(callExpression.kind === 174); return signature.minArgumentCount === 0; } adjustedArgCount = callExpression.arguments.hasTrailingComma ? args.length + 1 : args.length; @@ -19653,10 +20622,15 @@ var ts; if (context.failedTypeParameterIndex !== undefined && !context.inferences[context.failedTypeParameterIndex].isFixed) { context.failedTypeParameterIndex = undefined; } + if (signature.thisType) { + var thisArgumentNode = getThisArgumentOfCall(node); + var thisArgumentType = thisArgumentNode ? checkExpression(thisArgumentNode) : voidType; + inferTypes(context, thisArgumentType, signature.thisType); + } var argCount = getEffectiveArgumentCount(node, args, signature); for (var i = 0; i < argCount; i++) { var arg = getEffectiveArgument(node, args, i); - if (arg === undefined || arg.kind !== 191) { + if (arg === undefined || arg.kind !== 192) { var paramType = getTypeAtPosition(signature, i); var argType = getEffectiveArgumentType(node, i, arg); if (argType === undefined) { @@ -19702,10 +20676,20 @@ var ts; return typeArgumentsAreAssignable; } function checkApplicableSignature(node, args, signature, relation, excludeArgument, reportErrors) { + if (signature.thisType && signature.thisType !== voidType && node.kind !== 174) { + var thisArgumentNode = getThisArgumentOfCall(node); + var thisArgumentType = thisArgumentNode ? checkExpression(thisArgumentNode) : voidType; + var errorNode = reportErrors ? (thisArgumentNode || node) : undefined; + var headMessage_1 = ts.Diagnostics.The_this_context_of_type_0_is_not_assignable_to_method_s_this_of_type_1; + if (!checkTypeRelatedTo(thisArgumentType, signature.thisType, relation, errorNode, headMessage_1)) { + return false; + } + } + var headMessage = ts.Diagnostics.Argument_of_type_0_is_not_assignable_to_parameter_of_type_1; var argCount = getEffectiveArgumentCount(node, args, signature); for (var i = 0; i < argCount; i++) { var arg = getEffectiveArgument(node, args, i); - if (arg === undefined || arg.kind !== 191) { + if (arg === undefined || arg.kind !== 192) { var paramType = getTypeAtPosition(signature, i); var argType = getEffectiveArgumentType(node, i, arg); if (argType === undefined) { @@ -19714,7 +20698,6 @@ var ts; : checkExpressionWithContextualType(arg, paramType, excludeArgument && excludeArgument[i] ? identityMapper : undefined); } var errorNode = reportErrors ? getEffectiveArgumentErrorNode(node, i, arg) : undefined; - var headMessage = ts.Diagnostics.Argument_of_type_0_is_not_assignable_to_parameter_of_type_1; if (!checkTypeRelatedTo(argType, paramType, relation, errorNode, headMessage)) { return false; } @@ -19722,18 +20705,29 @@ var ts; } return true; } + function getThisArgumentOfCall(node) { + if (node.kind === 173) { + var callee = node.expression; + if (callee.kind === 171) { + return callee.expression; + } + else if (callee.kind === 172) { + return callee.expression; + } + } + } function getEffectiveCallArguments(node) { var args; - if (node.kind === 174) { + if (node.kind === 175) { var template = node.template; args = [undefined]; - if (template.kind === 187) { + if (template.kind === 188) { ts.forEach(template.templateSpans, function (span) { args.push(span.expression); }); } } - else if (node.kind === 141) { + else if (node.kind === 142) { return undefined; } else { @@ -19742,21 +20736,21 @@ var ts; return args; } function getEffectiveArgumentCount(node, args, signature) { - if (node.kind === 141) { + if (node.kind === 142) { switch (node.parent.kind) { - case 218: - case 190: + case 220: + case 191: return 1; - case 143: + case 144: return 2; - case 145: - case 147: + case 146: case 148: + case 149: if (languageVersion === 0) { return 2; } return signature.parameters.length >= 3 ? 3 : 2; - case 140: + case 141: return 3; } } @@ -19765,48 +20759,48 @@ var ts; } } function getEffectiveDecoratorFirstArgumentType(node) { - if (node.kind === 218) { + if (node.kind === 220) { var classSymbol = getSymbolOfNode(node); return getTypeOfSymbol(classSymbol); } - if (node.kind === 140) { + if (node.kind === 141) { node = node.parent; - if (node.kind === 146) { + if (node.kind === 147) { var classSymbol = getSymbolOfNode(node); return getTypeOfSymbol(classSymbol); } } - if (node.kind === 143 || - node.kind === 145 || - node.kind === 147 || - node.kind === 148) { + if (node.kind === 144 || + node.kind === 146 || + node.kind === 148 || + node.kind === 149) { return getParentTypeOfClassElement(node); } ts.Debug.fail("Unsupported decorator target."); return unknownType; } function getEffectiveDecoratorSecondArgumentType(node) { - if (node.kind === 218) { + if (node.kind === 220) { ts.Debug.fail("Class decorators should not have a second synthetic argument."); return unknownType; } - if (node.kind === 140) { + if (node.kind === 141) { node = node.parent; - if (node.kind === 146) { + if (node.kind === 147) { return anyType; } } - if (node.kind === 143 || - node.kind === 145 || - node.kind === 147 || - node.kind === 148) { + if (node.kind === 144 || + node.kind === 146 || + node.kind === 148 || + node.kind === 149) { var element = node; switch (element.name.kind) { case 69: case 8: case 9: return getStringLiteralTypeForText(element.name.text); - case 138: + case 139: var nameType = checkComputedPropertyName(element.name); if (isTypeOfKind(nameType, 16777216)) { return nameType; @@ -19823,20 +20817,20 @@ var ts; return unknownType; } function getEffectiveDecoratorThirdArgumentType(node) { - if (node.kind === 218) { + if (node.kind === 220) { ts.Debug.fail("Class decorators should not have a third synthetic argument."); return unknownType; } - if (node.kind === 140) { + if (node.kind === 141) { return numberType; } - if (node.kind === 143) { + if (node.kind === 144) { ts.Debug.fail("Property decorators should not have a third synthetic argument."); return unknownType; } - if (node.kind === 145 || - node.kind === 147 || - node.kind === 148) { + if (node.kind === 146 || + node.kind === 148 || + node.kind === 149) { var propertyType = getTypeOfNode(node); return createTypedPropertyDescriptorType(propertyType); } @@ -19857,26 +20851,26 @@ var ts; return unknownType; } function getEffectiveArgumentType(node, argIndex, arg) { - if (node.kind === 141) { + if (node.kind === 142) { return getEffectiveDecoratorArgumentType(node, argIndex); } - else if (argIndex === 0 && node.kind === 174) { - return globalTemplateStringsArrayType; + else if (argIndex === 0 && node.kind === 175) { + return getGlobalTemplateStringsArrayType(); } return undefined; } function getEffectiveArgument(node, args, argIndex) { - if (node.kind === 141 || - (argIndex === 0 && node.kind === 174)) { + if (node.kind === 142 || + (argIndex === 0 && node.kind === 175)) { return undefined; } return args[argIndex]; } function getEffectiveArgumentErrorNode(node, argIndex, arg) { - if (node.kind === 141) { + if (node.kind === 142) { return node.expression; } - else if (argIndex === 0 && node.kind === 174) { + else if (argIndex === 0 && node.kind === 175) { return node.template; } else { @@ -19884,8 +20878,8 @@ var ts; } } function resolveCall(node, signatures, candidatesOutArray, headMessage) { - var isTaggedTemplate = node.kind === 174; - var isDecorator = node.kind === 141; + var isTaggedTemplate = node.kind === 175; + var isDecorator = node.kind === 142; var typeArguments; if (!isTaggedTemplate && !isDecorator) { typeArguments = node.typeArguments; @@ -20039,7 +21033,7 @@ var ts; } return resolveUntypedCall(node); } - var funcType = checkExpression(node.expression); + var funcType = checkNonNullExpression(node.expression); var apparentType = getApparentType(funcType); if (apparentType === unknownType) { return resolveErrorCall(node); @@ -20070,7 +21064,7 @@ var ts; error(node.arguments[spreadIndex], ts.Diagnostics.Spread_operator_in_new_expressions_is_only_available_when_targeting_ECMAScript_5_and_higher); } } - var expressionType = checkExpression(node.expression); + var expressionType = checkNonNullExpression(node.expression); expressionType = getApparentType(expressionType); if (expressionType === unknownType) { return resolveErrorCall(node); @@ -20099,6 +21093,9 @@ var ts; if (getReturnTypeOfSignature(signature) !== voidType) { error(node, ts.Diagnostics.Only_a_void_function_can_be_called_with_the_new_keyword); } + if (signature.thisType === voidType) { + error(node, ts.Diagnostics.A_function_that_is_called_with_the_new_keyword_cannot_have_a_this_type_that_is_void); + } return signature; } error(node, ts.Diagnostics.Cannot_use_new_with_an_expression_whose_type_lacks_a_call_or_construct_signature); @@ -20144,16 +21141,16 @@ var ts; } function getDiagnosticHeadMessageForDecoratorResolution(node) { switch (node.parent.kind) { - case 218: - case 190: + case 220: + case 191: return ts.Diagnostics.Unable_to_resolve_signature_of_class_decorator_when_called_as_an_expression; - case 140: + case 141: return ts.Diagnostics.Unable_to_resolve_signature_of_parameter_decorator_when_called_as_an_expression; - case 143: + case 144: return ts.Diagnostics.Unable_to_resolve_signature_of_property_decorator_when_called_as_an_expression; - case 145: - case 147: + case 146: case 148: + case 149: return ts.Diagnostics.Unable_to_resolve_signature_of_method_decorator_when_called_as_an_expression; } } @@ -20181,16 +21178,16 @@ var ts; var links = getNodeLinks(node); if (!links.resolvedSignature || candidatesOutArray) { links.resolvedSignature = anySignature; - if (node.kind === 172) { + if (node.kind === 173) { links.resolvedSignature = resolveCallExpression(node, candidatesOutArray); } - else if (node.kind === 173) { + else if (node.kind === 174) { links.resolvedSignature = resolveNewExpression(node, candidatesOutArray); } - else if (node.kind === 174) { + else if (node.kind === 175) { links.resolvedSignature = resolveTaggedTemplateExpression(node, candidatesOutArray); } - else if (node.kind === 141) { + else if (node.kind === 142) { links.resolvedSignature = resolveDecorator(node, candidatesOutArray); } else { @@ -20212,12 +21209,12 @@ var ts; if (node.expression.kind === 95) { return voidType; } - if (node.kind === 173) { + if (node.kind === 174) { var declaration = signature.declaration; if (declaration && - declaration.kind !== 146 && - declaration.kind !== 150 && - declaration.kind !== 155 && + declaration.kind !== 147 && + declaration.kind !== 151 && + declaration.kind !== 156 && !ts.isJSDocConstructSignature(declaration)) { var funcSymbol = checkExpression(node.expression).symbol; if (funcSymbol && funcSymbol.members && (funcSymbol.flags & 16)) { @@ -20242,18 +21239,29 @@ var ts; var targetType = getTypeFromTypeNode(node.type); if (produceDiagnostics && targetType !== unknownType) { var widenedType = getWidenedType(exprType); - var bothAreStringLike = maybeTypeOfKind(targetType, 258) && - maybeTypeOfKind(widenedType, 258); - if (!bothAreStringLike && !(isTypeAssignableTo(targetType, widenedType))) { - checkTypeAssignableTo(exprType, targetType, node, ts.Diagnostics.Neither_type_0_nor_type_1_is_assignable_to_the_other); + if (!isTypeComparableTo(targetType, widenedType)) { + checkTypeComparableTo(exprType, targetType, node, ts.Diagnostics.Type_0_cannot_be_converted_to_type_1); } } return targetType; } + function checkNonNullAssertion(node) { + return getNonNullableType(checkExpression(node.expression)); + } + function getTypeOfParameter(symbol) { + var type = getTypeOfSymbol(symbol); + if (strictNullChecks) { + var declaration = symbol.valueDeclaration; + if (declaration && declaration.initializer) { + return addNullableKind(type, 32); + } + } + return type; + } function getTypeAtPosition(signature, pos) { return signature.hasRestParameter ? - pos < signature.parameters.length - 1 ? getTypeOfSymbol(signature.parameters[pos]) : getRestTypeOfSignature(signature) : - pos < signature.parameters.length ? getTypeOfSymbol(signature.parameters[pos]) : anyType; + pos < signature.parameters.length - 1 ? getTypeOfParameter(signature.parameters[pos]) : getRestTypeOfSignature(signature) : + pos < signature.parameters.length ? getTypeOfParameter(signature.parameters[pos]) : anyType; } function assignContextualParameterTypes(signature, context, mapper) { var len = signature.parameters.length - (signature.hasRestParameter ? 1 : 0); @@ -20272,7 +21280,7 @@ 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 !== 191) { + if (element.kind !== 192) { if (element.name.kind === 69) { getSymbolLinks(getSymbolOfNode(element)).type = getTypeForBindingElement(element); } @@ -20313,7 +21321,7 @@ var ts; } var isAsync = ts.isAsyncFunctionLike(func); var type; - if (func.body.kind !== 196) { + if (func.body.kind !== 198) { type = checkExpressionCached(func.body, contextualMapper); if (isAsync) { type = checkAwaitedType(type, func, ts.Diagnostics.Return_expression_in_async_function_does_not_have_a_valid_callable_then_member); @@ -20333,7 +21341,8 @@ var ts; } } else { - types = checkAndAggregateReturnExpressionTypes(func.body, contextualMapper, isAsync); + var hasImplicitReturn = !!(func.flags & 32768); + types = checkAndAggregateReturnExpressionTypes(func.body, contextualMapper, isAsync, hasImplicitReturn); if (types.length === 0) { if (isAsync) { var promiseType = createPromiseType(voidType); @@ -20395,8 +21404,9 @@ var ts; }); return aggregatedTypes; } - function checkAndAggregateReturnExpressionTypes(body, contextualMapper, isAsync) { + function checkAndAggregateReturnExpressionTypes(body, contextualMapper, isAsync, hasImplicitReturn) { var aggregatedTypes = []; + var hasOmittedExpressions = false; ts.forEachReturnStatement(body, function (returnStatement) { var expr = returnStatement.expression; if (expr) { @@ -20408,7 +21418,15 @@ var ts; aggregatedTypes.push(type); } } + else { + hasOmittedExpressions = true; + } }); + if (strictNullChecks && aggregatedTypes.length && (hasOmittedExpressions || hasImplicitReturn)) { + if (!ts.contains(aggregatedTypes, undefinedType)) { + aggregatedTypes.push(undefinedType); + } + } return aggregatedTypes; } function checkAllCodePathsInNonVoidFunctionReturnOrThrow(func, returnType) { @@ -20418,19 +21436,23 @@ var ts; if (returnType && maybeTypeOfKind(returnType, 1 | 16)) { return; } - if (ts.nodeIsMissing(func.body) || func.body.kind !== 196 || !(func.flags & 32768)) { + if (ts.nodeIsMissing(func.body) || func.body.kind !== 198 || !(func.flags & 32768)) { return; } var hasExplicitReturn = func.flags & 65536; if (returnType && !hasExplicitReturn) { error(func.type, ts.Diagnostics.A_function_whose_declared_type_is_neither_void_nor_any_must_return_a_value); } + else if (returnType && strictNullChecks && !isTypeAssignableTo(undefinedType, returnType)) { + error(func.type, ts.Diagnostics.Function_lacks_ending_return_statement_and_return_type_does_not_include_undefined); + } else if (compilerOptions.noImplicitReturns) { if (!returnType) { - var inferredReturnType = hasExplicitReturn - ? getReturnTypeOfSignature(getSignatureFromDeclaration(func)) - : voidType; - if (inferredReturnType === voidType || isTypeAny(inferredReturnType)) { + if (!hasExplicitReturn) { + return; + } + var inferredReturnType = getReturnTypeOfSignature(getSignatureFromDeclaration(func)); + if (isUnwrappedReturnTypeVoidOrAny(func, inferredReturnType)) { return; } } @@ -20438,12 +21460,13 @@ var ts; } } function checkFunctionExpressionOrObjectLiteralMethod(node, contextualMapper) { - ts.Debug.assert(node.kind !== 145 || ts.isObjectLiteralMethod(node)); + ts.Debug.assert(node.kind !== 146 || ts.isObjectLiteralMethod(node)); var hasGrammarError = checkGrammarFunctionLikeDeclaration(node); - if (!hasGrammarError && node.kind === 177) { + if (!hasGrammarError && node.kind === 178) { checkGrammarForGenerator(node); } if (contextualMapper === identityMapper && isContextSensitive(node)) { + checkNodeDeferred(node); return anyFunctionType; } var links = getNodeLinks(node); @@ -20473,14 +21496,14 @@ var ts; } } } - if (produceDiagnostics && node.kind !== 145 && node.kind !== 144) { + if (produceDiagnostics && node.kind !== 146 && node.kind !== 145) { checkCollisionWithCapturedSuperVariable(node, node.name); checkCollisionWithCapturedThisVariable(node, node.name); } return type; } function checkFunctionExpressionOrObjectLiteralMethodDeferred(node) { - ts.Debug.assert(node.kind !== 145 || ts.isObjectLiteralMethod(node)); + ts.Debug.assert(node.kind !== 146 || ts.isObjectLiteralMethod(node)); var isAsync = ts.isAsyncFunctionLike(node); var returnOrPromisedType = node.type && (isAsync ? checkAsyncFunctionReturnType(node) : getTypeFromTypeNode(node.type)); if (!node.asteriskToken) { @@ -20490,7 +21513,7 @@ var ts; if (!node.type) { getReturnTypeOfSignature(getSignatureFromDeclaration(node)); } - if (node.body.kind === 196) { + if (node.body.kind === 198) { checkSourceElement(node.body); } else { @@ -20523,23 +21546,23 @@ var ts; function isReferenceToReadonlyEntity(expr, symbol) { if (isReadonlySymbol(symbol)) { if (symbol.flags & 4 && - (expr.kind === 170 || expr.kind === 171) && + (expr.kind === 171 || expr.kind === 172) && expr.expression.kind === 97) { var func = ts.getContainingFunction(expr); - return !(func && func.kind === 146 && func.parent === symbol.valueDeclaration.parent); + return !(func && func.kind === 147 && func.parent === symbol.valueDeclaration.parent); } return true; } return false; } function isReferenceThroughNamespaceImport(expr) { - if (expr.kind === 170 || expr.kind === 171) { + if (expr.kind === 171 || expr.kind === 172) { var node = skipParenthesizedNodes(expr.expression); if (node.kind === 69) { var symbol = getNodeLinks(node).resolvedSymbol; if (symbol.flags & 8388608) { var declaration = getDeclarationOfAliasSymbol(symbol); - return declaration && declaration.kind === 228; + return declaration && declaration.kind === 231; } } } @@ -20547,7 +21570,7 @@ var ts; } function checkReferenceExpression(expr, invalidReferenceMessage, constantVariableMessage) { var node = skipParenthesizedNodes(expr); - if (node.kind !== 69 && node.kind !== 170 && node.kind !== 171) { + if (node.kind !== 69 && node.kind !== 171 && node.kind !== 172) { error(expr, invalidReferenceMessage); return false; } @@ -20565,7 +21588,7 @@ var ts; } } } - else if (node.kind === 171) { + else if (node.kind === 172) { if (links.resolvedIndexInfo && links.resolvedIndexInfo.isReadonly) { error(expr, constantVariableMessage); return false; @@ -20611,7 +21634,7 @@ var ts; return booleanType; case 41: case 42: - var ok = checkArithmeticOperandType(node.operand, operandType, ts.Diagnostics.An_arithmetic_operand_must_be_of_type_any_number_or_an_enum_type); + var ok = checkArithmeticOperandType(node.operand, getNonNullableType(operandType), ts.Diagnostics.An_arithmetic_operand_must_be_of_type_any_number_or_an_enum_type); if (ok) { 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); } @@ -20621,7 +21644,7 @@ var ts; } function checkPostfixUnaryExpression(node) { var operandType = checkExpression(node.operand); - var ok = checkArithmeticOperandType(node.operand, operandType, ts.Diagnostics.An_arithmetic_operand_must_be_of_type_any_number_or_an_enum_type); + var ok = checkArithmeticOperandType(node.operand, getNonNullableType(operandType), ts.Diagnostics.An_arithmetic_operand_must_be_of_type_any_number_or_an_enum_type); if (ok) { 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); } @@ -20695,22 +21718,22 @@ var ts; var properties = node.properties; for (var _i = 0, properties_3 = properties; _i < properties_3.length; _i++) { var p = properties_3[_i]; - if (p.kind === 249 || p.kind === 250) { - var name_12 = p.name; - if (name_12.kind === 138) { - checkComputedPropertyName(name_12); + if (p.kind === 252 || p.kind === 253) { + var name_13 = p.name; + if (name_13.kind === 139) { + checkComputedPropertyName(name_13); } - if (isComputedNonLiteralName(name_12)) { + if (isComputedNonLiteralName(name_13)) { continue; } - var text = getTextOfPropertyName(name_12); + var text = getTextOfPropertyName(name_13); var type = isTypeAny(sourceType) ? sourceType : getTypeOfPropertyOfType(sourceType, text) || isNumericLiteralName(text) && getIndexTypeOfType(sourceType, 1) || getIndexTypeOfType(sourceType, 0); if (type) { - if (p.kind === 250) { + if (p.kind === 253) { checkDestructuringAssignment(p, type); } else { @@ -20718,7 +21741,7 @@ var ts; } } else { - error(name_12, ts.Diagnostics.Type_0_has_no_property_1_and_no_string_index_signature, typeToString(sourceType), ts.declarationNameToString(name_12)); + error(name_13, ts.Diagnostics.Type_0_has_no_property_1_and_no_string_index_signature, typeToString(sourceType), ts.declarationNameToString(name_13)); } } else { @@ -20732,8 +21755,8 @@ var ts; var elements = node.elements; for (var i = 0; i < elements.length; i++) { var e = elements[i]; - if (e.kind !== 191) { - if (e.kind !== 189) { + if (e.kind !== 192) { + if (e.kind !== 190) { var propName = "" + i; var type = isTypeAny(sourceType) ? sourceType @@ -20758,7 +21781,7 @@ var ts; } else { var restExpression = e.expression; - if (restExpression.kind === 185 && restExpression.operatorToken.kind === 56) { + if (restExpression.kind === 186 && restExpression.operatorToken.kind === 56) { error(restExpression.operatorToken, ts.Diagnostics.A_rest_element_cannot_have_an_initializer); } else { @@ -20772,7 +21795,7 @@ var ts; } function checkDestructuringAssignment(exprOrAssignment, sourceType, contextualMapper) { var target; - if (exprOrAssignment.kind === 250) { + if (exprOrAssignment.kind === 253) { var prop = exprOrAssignment; if (prop.objectAssignmentInitializer) { checkBinaryLikeExpression(prop.name, prop.equalsToken, prop.objectAssignmentInitializer, contextualMapper); @@ -20782,14 +21805,14 @@ var ts; else { target = exprOrAssignment; } - if (target.kind === 185 && target.operatorToken.kind === 56) { + if (target.kind === 186 && target.operatorToken.kind === 56) { checkBinaryExpression(target, contextualMapper); target = target.left; } - if (target.kind === 169) { + if (target.kind === 170) { return checkObjectLiteralAssignment(target, sourceType, contextualMapper); } - if (target.kind === 168) { + if (target.kind === 169) { return checkArrayLiteralAssignment(target, sourceType, contextualMapper); } return checkReferenceAssignment(target, sourceType, contextualMapper); @@ -20806,7 +21829,7 @@ var ts; } function checkBinaryLikeExpression(left, operatorToken, right, contextualMapper, errorNode) { var operator = operatorToken.kind; - if (operator === 56 && (left.kind === 169 || left.kind === 168)) { + if (operator === 56 && (left.kind === 170 || left.kind === 169)) { return checkDestructuringAssignment(left, checkExpression(right, contextualMapper), contextualMapper); } var leftType = checkExpression(left, contextualMapper); @@ -20834,10 +21857,12 @@ var ts; case 68: case 46: case 66: - if (leftType.flags & (32 | 64)) + if (leftType.flags & 96) leftType = rightType; - if (rightType.flags & (32 | 64)) + if (rightType.flags & 96) rightType = leftType; + leftType = getNonNullableType(leftType); + rightType = getNonNullableType(rightType); var suggestedOperator = void 0; if ((leftType.flags & 8) && (rightType.flags & 8) && @@ -20854,10 +21879,12 @@ var ts; return numberType; case 35: case 57: - if (leftType.flags & (32 | 64)) + if (leftType.flags & 96) leftType = rightType; - if (rightType.flags & (32 | 64)) + if (rightType.flags & 96) rightType = leftType; + leftType = getNonNullableType(leftType); + rightType = getNonNullableType(rightType); var resultType = void 0; if (isTypeOfKind(leftType, 132) && isTypeOfKind(rightType, 132)) { resultType = numberType; @@ -20892,10 +21919,7 @@ var ts; case 31: case 32: case 33: - if (maybeTypeOfKind(leftType, 258) && maybeTypeOfKind(rightType, 258)) { - return booleanType; - } - if (!isTypeAssignableTo(leftType, rightType) && !isTypeAssignableTo(rightType, leftType)) { + if (!isTypeComparableTo(leftType, rightType) && !isTypeComparableTo(rightType, leftType)) { reportOperatorError(); } return booleanType; @@ -20904,9 +21928,9 @@ var ts; case 90: return checkInExpression(left, right, leftType, rightType); case 51: - return rightType; + return addNullableKind(rightType, getNullableKind(leftType)); case 52: - return getUnionType([leftType, rightType]); + return getUnionType([getNonNullableType(leftType), rightType]); case 56: checkAssignmentOperator(rightType); return getRegularTypeOfObjectLiteral(rightType); @@ -21030,14 +22054,14 @@ var ts; return links.resolvedType; } function checkPropertyAssignment(node, contextualMapper) { - if (node.name.kind === 138) { + if (node.name.kind === 139) { checkComputedPropertyName(node.name); } return checkExpression(node.initializer, contextualMapper); } function checkObjectLiteralMethod(node, contextualMapper) { checkGrammarMethod(node); - if (node.name.kind === 138) { + if (node.name.kind === 139) { checkComputedPropertyName(node.name); } var uninstantiatedType = checkFunctionExpressionOrObjectLiteralMethod(node, contextualMapper); @@ -21060,7 +22084,7 @@ var ts; } function checkExpression(node, contextualMapper) { var type; - if (node.kind === 137) { + if (node.kind === 138) { type = checkQualifiedName(node); } else { @@ -21068,9 +22092,9 @@ var ts; type = instantiateTypeWithSingleGenericCallSignature(node, uninstantiatedType, contextualMapper); } if (isConstEnumObjectType(type)) { - var ok = (node.parent.kind === 170 && node.parent.expression === node) || - (node.parent.kind === 171 && node.parent.expression === node) || - ((node.kind === 69 || node.kind === 137) && isInRightSideOfImportOrExportAssignment(node)); + var ok = (node.parent.kind === 171 && node.parent.expression === node) || + (node.parent.kind === 172 && node.parent.expression === node) || + ((node.kind === 69 || node.kind === 138) && 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); } @@ -21096,7 +22120,7 @@ var ts; return booleanType; case 8: return checkNumericLiteral(node); - case 187: + case 188: return checkTemplateExpression(node); case 9: return checkStringLiteralExpression(node); @@ -21104,58 +22128,60 @@ var ts; return stringType; case 10: return globalRegExpType; - case 168: - return checkArrayLiteral(node, contextualMapper); case 169: - return checkObjectLiteral(node, contextualMapper); + return checkArrayLiteral(node, contextualMapper); case 170: - return checkPropertyAccessExpression(node); + return checkObjectLiteral(node, contextualMapper); case 171: - return checkIndexedAccess(node); + return checkPropertyAccessExpression(node); case 172: + return checkIndexedAccess(node); case 173: - return checkCallExpression(node); case 174: - return checkTaggedTemplateExpression(node); - case 176: - return checkExpression(node.expression, contextualMapper); - case 190: - return checkClassExpression(node); - case 177: - case 178: - return checkFunctionExpressionOrObjectLiteralMethod(node, contextualMapper); - case 180: - return checkTypeOfExpression(node); + return checkCallExpression(node); case 175: - case 193: - return checkAssertion(node); - case 179: - return checkDeleteExpression(node); - case 181: - return checkVoidExpression(node); - case 182: - return checkAwaitExpression(node); - case 183: - return checkPrefixUnaryExpression(node); - case 184: - return checkPostfixUnaryExpression(node); - case 185: - return checkBinaryExpression(node, contextualMapper); - case 186: - return checkConditionalExpression(node, contextualMapper); - case 189: - return checkSpreadElementExpression(node, contextualMapper); + return checkTaggedTemplateExpression(node); + case 177: + return checkExpression(node.expression, contextualMapper); case 191: + return checkClassExpression(node); + case 178: + case 179: + return checkFunctionExpressionOrObjectLiteralMethod(node, contextualMapper); + case 181: + return checkTypeOfExpression(node); + case 176: + case 194: + return checkAssertion(node); + case 195: + return checkNonNullAssertion(node); + case 180: + return checkDeleteExpression(node); + case 182: + return checkVoidExpression(node); + case 183: + return checkAwaitExpression(node); + case 184: + return checkPrefixUnaryExpression(node); + case 185: + return checkPostfixUnaryExpression(node); + case 186: + return checkBinaryExpression(node, contextualMapper); + case 187: + return checkConditionalExpression(node, contextualMapper); + case 190: + return checkSpreadElementExpression(node, contextualMapper); + case 192: return undefinedType; - case 188: + case 189: return checkYieldExpression(node); - case 244: + case 247: return checkJsxExpression(node); - case 237: + case 240: return checkJsxElement(node); - case 238: + case 241: return checkJsxSelfClosingElement(node); - case 239: + case 242: ts.Debug.fail("Shouldn't ever directly check a JsxOpeningElement"); } return unknownType; @@ -21176,13 +22202,24 @@ var ts; var func = ts.getContainingFunction(node); if (node.flags & 28) { func = ts.getContainingFunction(node); - if (!(func.kind === 146 && ts.nodeIsPresent(func.body))) { + if (!(func.kind === 147 && ts.nodeIsPresent(func.body))) { error(node, ts.Diagnostics.A_parameter_property_is_only_allowed_in_a_constructor_implementation); } } if (node.questionToken && ts.isBindingPattern(node.name) && func.body) { error(node, ts.Diagnostics.A_binding_pattern_parameter_cannot_be_optional_in_an_implementation_signature); } + if (node.name.text === "this") { + if (ts.indexOf(func.parameters, node) !== 0) { + error(node, ts.Diagnostics.A_this_parameter_must_be_the_first_parameter); + } + if (func.kind === 147 || func.kind === 151 || func.kind === 156) { + error(node, ts.Diagnostics.A_constructor_cannot_have_a_this_parameter); + } + if (func.kind === 149) { + error(node, ts.Diagnostics.A_setter_cannot_have_a_this_parameter); + } + } if (node.dotDotDotToken && !ts.isBindingPattern(node.name) && !isArrayType(getTypeOfSymbol(node.symbol))) { error(node, ts.Diagnostics.A_rest_parameter_must_be_of_an_array_type); } @@ -21191,9 +22228,9 @@ var ts; if (!node.asteriskToken || !node.body) { return false; } - return node.kind === 145 || - node.kind === 217 || - node.kind === 177; + return node.kind === 146 || + node.kind === 219 || + node.kind === 178; } function getTypePredicateParameterIndex(parameterList, parameter) { if (parameterList) { @@ -21227,15 +22264,16 @@ var ts; error(parameterName, ts.Diagnostics.A_type_predicate_cannot_reference_a_rest_parameter); } else { - checkTypeAssignableTo(typePredicate.type, getTypeOfNode(parent.parameters[typePredicate.parameterIndex]), node.type); + 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, undefined, leadingError); } } else if (parameterName) { var hasReportedError = false; for (var _i = 0, _a = parent.parameters; _i < _a.length; _i++) { - var name_13 = _a[_i].name; - if (ts.isBindingPattern(name_13) && - checkIfTypePredicateVariableIsDeclaredInBindingPattern(name_13, parameterName, typePredicate.parameterName)) { + var name_14 = _a[_i].name; + if (ts.isBindingPattern(name_14) && + checkIfTypePredicateVariableIsDeclaredInBindingPattern(name_14, parameterName, typePredicate.parameterName)) { hasReportedError = true; break; } @@ -21248,42 +22286,42 @@ var ts; } function getTypePredicateParent(node) { switch (node.parent.kind) { + case 179: + case 150: + case 219: case 178: - case 149: - case 217: - case 177: - case 154: + case 155: + case 146: case 145: - case 144: - var parent_7 = node.parent; - if (node === parent_7.type) { - return parent_7; + var parent_8 = node.parent; + if (node === parent_8.type) { + return parent_8; } } } function checkIfTypePredicateVariableIsDeclaredInBindingPattern(pattern, predicateVariableNode, predicateVariableName) { for (var _i = 0, _a = pattern.elements; _i < _a.length; _i++) { - var name_14 = _a[_i].name; - if (name_14.kind === 69 && - name_14.text === predicateVariableName) { + var name_15 = _a[_i].name; + if (name_15.kind === 69 && + name_15.text === predicateVariableName) { error(predicateVariableNode, ts.Diagnostics.A_type_predicate_cannot_reference_element_0_in_a_binding_pattern, predicateVariableName); return true; } - else if (name_14.kind === 166 || - name_14.kind === 165) { - if (checkIfTypePredicateVariableIsDeclaredInBindingPattern(name_14, predicateVariableNode, predicateVariableName)) { + else if (name_15.kind === 167 || + name_15.kind === 166) { + if (checkIfTypePredicateVariableIsDeclaredInBindingPattern(name_15, predicateVariableNode, predicateVariableName)) { return true; } } } } function checkSignatureDeclaration(node) { - if (node.kind === 151) { + if (node.kind === 152) { checkGrammarIndexSignature(node); } - else if (node.kind === 154 || node.kind === 217 || node.kind === 155 || - node.kind === 149 || node.kind === 146 || - node.kind === 150) { + else if (node.kind === 155 || node.kind === 219 || node.kind === 156 || + node.kind === 150 || node.kind === 147 || + node.kind === 151) { checkGrammarFunctionLikeDeclaration(node); } checkTypeParameters(node.typeParameters); @@ -21295,10 +22333,10 @@ var ts; checkCollisionWithArgumentsInGeneratedCode(node); if (compilerOptions.noImplicitAny && !node.type) { switch (node.kind) { - case 150: + case 151: error(node, ts.Diagnostics.Construct_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type); break; - case 149: + case 150: error(node, ts.Diagnostics.Call_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type); break; } @@ -21322,7 +22360,7 @@ var ts; } } function checkTypeForDuplicateIndexSignatures(node) { - if (node.kind === 219) { + if (node.kind === 221) { var nodeSymbol = getSymbolOfNode(node); if (nodeSymbol.declarations.length > 0 && nodeSymbol.declarations[0] !== node) { return; @@ -21403,12 +22441,12 @@ var ts; if (n.kind === 97) { error(n, ts.Diagnostics.this_cannot_be_referenced_in_current_location); } - else if (n.kind !== 177 && n.kind !== 217) { + else if (n.kind !== 178 && n.kind !== 219) { ts.forEachChild(n, markThisReferencesAsErrors); } } function isInstancePropertyWithInitializer(n) { - return n.kind === 143 && + return n.kind === 144 && !(n.flags & 32) && !!n.initializer; } @@ -21427,7 +22465,7 @@ var ts; var superCallStatement = void 0; for (var _i = 0, statements_2 = statements; _i < statements_2.length; _i++) { var statement = statements_2[_i]; - if (statement.kind === 199 && ts.isSuperCallExpression(statement.expression)) { + if (statement.kind === 201 && ts.isSuperCallExpression(statement.expression)) { superCallStatement = statement; break; } @@ -21450,7 +22488,7 @@ var ts; checkGrammarFunctionLikeDeclaration(node) || checkGrammarAccessor(node) || checkGrammarComputedPropertyName(node.name); checkDecorators(node); checkSignatureDeclaration(node); - if (node.kind === 147) { + if (node.kind === 148) { if (!ts.isInAmbientContext(node) && ts.nodeIsPresent(node.body) && (node.flags & 32768)) { if (node.flags & 65536) { if (compilerOptions.noImplicitReturns) { @@ -21462,11 +22500,11 @@ var ts; } } } - if (node.name.kind === 138) { + if (node.name.kind === 139) { checkComputedPropertyName(node.name); } if (!ts.hasDynamicName(node)) { - var otherKind = node.kind === 147 ? 148 : 147; + var otherKind = node.kind === 148 ? 149 : 148; var otherAccessor = ts.getDeclarationOfKind(node.symbol, otherKind); if (otherAccessor) { if (((node.flags & 28) !== (otherAccessor.flags & 28))) { @@ -21486,7 +22524,7 @@ var ts; } getTypeOfAccessors(getSymbolOfNode(node)); } - if (node.parent.kind !== 169) { + if (node.parent.kind !== 170) { checkSourceElement(node.body); } else { @@ -21557,9 +22595,9 @@ var ts; } function getEffectiveDeclarationFlags(n, flagsToCheck) { var flags = ts.getCombinedNodeFlags(n); - if (n.parent.kind !== 219 && - n.parent.kind !== 218 && - n.parent.kind !== 190 && + if (n.parent.kind !== 221 && + n.parent.kind !== 220 && + n.parent.kind !== 191 && ts.isInAmbientContext(n)) { if (!(flags & 2)) { flags |= 1; @@ -21636,7 +22674,7 @@ var ts; if (subsequentNode.kind === node.kind) { var errorNode_1 = subsequentNode.name || subsequentNode; if (node.name && subsequentNode.name && node.name.text === subsequentNode.name.text) { - var reportError = (node.kind === 145 || node.kind === 144) && + var reportError = (node.kind === 146 || node.kind === 145) && (node.flags & 32) !== (subsequentNode.flags & 32); if (reportError) { var diagnostic = node.flags & 32 ? ts.Diagnostics.Function_overload_must_be_static : ts.Diagnostics.Function_overload_must_not_be_static; @@ -21670,11 +22708,11 @@ var ts; var current = declarations_4[_i]; var node = current; var inAmbientContext = ts.isInAmbientContext(node); - var inAmbientContextOrInterface = node.parent.kind === 219 || node.parent.kind === 157 || inAmbientContext; + var inAmbientContextOrInterface = node.parent.kind === 221 || node.parent.kind === 158 || inAmbientContext; if (inAmbientContextOrInterface) { previousDeclaration = undefined; } - if (node.kind === 217 || node.kind === 145 || node.kind === 144 || node.kind === 146) { + if (node.kind === 219 || node.kind === 146 || node.kind === 145 || node.kind === 147) { var currentNodeFlags = getEffectiveDeclarationFlags(node, flagsToCheck); someNodeFlags |= currentNodeFlags; allNodeFlags &= currentNodeFlags; @@ -21785,16 +22823,16 @@ var ts; } function getDeclarationSpaces(d) { switch (d.kind) { - case 219: + case 221: return 2097152; - case 222: + case 224: return ts.isAmbientModule(d) || ts.getModuleInstanceState(d) !== 0 ? 4194304 | 1048576 : 4194304; - case 218: - case 221: + case 220: + case 223: return 2097152 | 1048576; - case 225: + case 228: var result_1 = 0; var target = resolveAlias(getSymbolOfNode(d)); ts.forEach(target.declarations, function (d) { result_1 |= getDeclarationSpaces(d); }); @@ -21870,7 +22908,7 @@ var ts; return checkNonThenableType(type, location, message); } else { - if (type.id === promisedType.id || awaitedTypeStack.indexOf(promisedType.id) >= 0) { + if (type.id === promisedType.id || ts.indexOf(awaitedTypeStack, promisedType.id) >= 0) { if (location) { error(location, ts.Diagnostics._0_is_referenced_directly_or_indirectly_in_the_fulfillment_callback_of_its_own_then_method, symbolToString(type.symbol)); } @@ -21941,22 +22979,22 @@ var ts; var headMessage = getDiagnosticHeadMessageForDecoratorResolution(node); var errorInfo; switch (node.parent.kind) { - case 218: + case 220: var classSymbol = getSymbolOfNode(node.parent); var classConstructorType = getTypeOfSymbol(classSymbol); expectedReturnType = getUnionType([classConstructorType, voidType]); break; - case 140: + case 141: expectedReturnType = voidType; errorInfo = ts.chainDiagnosticMessages(errorInfo, ts.Diagnostics.The_return_type_of_a_parameter_decorator_function_must_be_either_void_or_any); break; - case 143: + case 144: expectedReturnType = voidType; errorInfo = ts.chainDiagnosticMessages(errorInfo, ts.Diagnostics.The_return_type_of_a_property_decorator_function_must_be_either_void_or_any); break; - case 145: - case 147: + case 146: case 148: + case 149: var methodType = getTypeOfNode(node.parent); var descriptorType = createTypedPropertyDescriptorType(methodType); expectedReturnType = getUnionType([descriptorType, voidType]); @@ -21965,9 +23003,9 @@ var ts; checkTypeAssignableTo(returnType, expectedReturnType, node, headMessage, errorInfo); } function checkTypeNodeAsExpression(node) { - if (node && node.kind === 153) { + if (node && node.kind === 154) { var root = getFirstIdentifier(node.typeName); - var meaning = root.parent.kind === 153 ? 793056 : 1536; + var meaning = root.parent.kind === 154 ? 793056 : 1536; var rootSymbol = resolveName(root, root.text, meaning | 8388608, undefined, undefined); if (rootSymbol && rootSymbol.flags & 8388608) { var aliasTarget = resolveAlias(rootSymbol); @@ -22001,20 +23039,20 @@ var ts; } if (compilerOptions.emitDecoratorMetadata) { switch (node.kind) { - case 218: + case 220: var constructor = ts.getFirstConstructorWithBody(node); if (constructor) { checkParameterTypeAnnotationsAsExpressions(constructor); } break; - case 145: - case 147: + case 146: case 148: + case 149: checkParameterTypeAnnotationsAsExpressions(node); checkReturnTypeAnnotationAsExpression(node); break; - case 143: - case 140: + case 144: + case 141: checkTypeAnnotationAsExpression(node); break; } @@ -22034,7 +23072,7 @@ var ts; checkDecorators(node); checkSignatureDeclaration(node); var isAsync = ts.isAsyncFunctionLike(node); - if (node.name && node.name.kind === 138) { + if (node.name && node.name.kind === 139) { checkComputedPropertyName(node.name); } if (!ts.hasDynamicName(node)) { @@ -22066,7 +23104,7 @@ var ts; } } function checkBlock(node) { - if (node.kind === 196) { + if (node.kind === 198) { checkGrammarStatementInAmbientContext(node); } ts.forEach(node.statements, checkSourceElement); @@ -22085,19 +23123,19 @@ var ts; if (!(identifier && identifier.text === name)) { return false; } - if (node.kind === 143 || - node.kind === 142 || + if (node.kind === 144 || + node.kind === 143 || + node.kind === 146 || node.kind === 145 || - node.kind === 144 || - node.kind === 147 || - node.kind === 148) { + node.kind === 148 || + node.kind === 149) { return false; } if (ts.isInAmbientContext(node)) { return false; } var root = ts.getRootDeclaration(node); - if (root.kind === 140 && ts.nodeIsMissing(root.parent.body)) { + if (root.kind === 141 && ts.nodeIsMissing(root.parent.body)) { return false; } return true; @@ -22145,11 +23183,11 @@ var ts; if (!needCollisionCheckForIdentifier(node, name, "require") && !needCollisionCheckForIdentifier(node, name, "exports")) { return; } - if (node.kind === 222 && ts.getModuleInstanceState(node) !== 1) { + if (node.kind === 224 && ts.getModuleInstanceState(node) !== 1) { return; } var parent = getDeclarationContainer(node); - if (parent.kind === 252 && ts.isExternalOrCommonJsModule(parent)) { + if (parent.kind === 255 && ts.isExternalOrCommonJsModule(parent)) { error(name, ts.Diagnostics.Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module, ts.declarationNameToString(name), ts.declarationNameToString(name)); } } @@ -22157,11 +23195,11 @@ var ts; if (!needCollisionCheckForIdentifier(node, name, "Promise")) { return; } - if (node.kind === 222 && ts.getModuleInstanceState(node) !== 1) { + if (node.kind === 224 && ts.getModuleInstanceState(node) !== 1) { return; } var parent = getDeclarationContainer(node); - if (parent.kind === 252 && ts.isExternalOrCommonJsModule(parent) && parent.flags & 2097152) { + if (parent.kind === 255 && ts.isExternalOrCommonJsModule(parent) && parent.flags & 2097152) { 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)); } } @@ -22169,7 +23207,7 @@ var ts; if ((ts.getCombinedNodeFlags(node) & 3072) !== 0 || ts.isParameterDeclaration(node)) { return; } - if (node.kind === 215 && !node.initializer) { + if (node.kind === 217 && !node.initializer) { return; } var symbol = getSymbolOfNode(node); @@ -22179,25 +23217,25 @@ var ts; localDeclarationSymbol !== symbol && localDeclarationSymbol.flags & 2) { if (getDeclarationFlagsFromSymbol(localDeclarationSymbol) & 3072) { - var varDeclList = ts.getAncestor(localDeclarationSymbol.valueDeclaration, 216); - var container = varDeclList.parent.kind === 197 && varDeclList.parent.parent + var varDeclList = ts.getAncestor(localDeclarationSymbol.valueDeclaration, 218); + var container = varDeclList.parent.kind === 199 && varDeclList.parent.parent ? varDeclList.parent.parent : undefined; var namesShareScope = container && - (container.kind === 196 && ts.isFunctionLike(container.parent) || - container.kind === 223 || - container.kind === 222 || - container.kind === 252); + (container.kind === 198 && ts.isFunctionLike(container.parent) || + container.kind === 225 || + container.kind === 224 || + container.kind === 255); if (!namesShareScope) { - var name_15 = symbolToString(localDeclarationSymbol); - error(node, ts.Diagnostics.Cannot_initialize_outer_scoped_variable_0_in_the_same_scope_as_block_scoped_declaration_1, name_15, name_15); + var name_16 = symbolToString(localDeclarationSymbol); + error(node, ts.Diagnostics.Cannot_initialize_outer_scoped_variable_0_in_the_same_scope_as_block_scoped_declaration_1, name_16, name_16); } } } } } function checkParameterInitializer(node) { - if (ts.getRootDeclaration(node).kind !== 140) { + if (ts.getRootDeclaration(node).kind !== 141) { return; } var func = ts.getContainingFunction(node); @@ -22206,7 +23244,7 @@ var ts; if (n.kind === 69) { var referencedSymbol = getNodeLinks(n).resolvedSymbol; if (referencedSymbol && referencedSymbol !== unknownSymbol && getSymbol(func.locals, referencedSymbol.name, 107455) === referencedSymbol) { - if (referencedSymbol.valueDeclaration.kind === 140) { + if (referencedSymbol.valueDeclaration.kind === 141) { if (referencedSymbol.valueDeclaration === node) { error(n, ts.Diagnostics.Parameter_0_cannot_be_referenced_in_its_initializer, ts.declarationNameToString(node.name)); return; @@ -22226,26 +23264,33 @@ var ts; function checkVariableLikeDeclaration(node) { checkDecorators(node); checkSourceElement(node.type); - if (node.name.kind === 138) { + if (node.name.kind === 139) { checkComputedPropertyName(node.name); if (node.initializer) { checkExpressionCached(node.initializer); } } - if (node.kind === 167) { - if (node.propertyName && node.propertyName.kind === 138) { + if (node.kind === 168) { + if (node.propertyName && node.propertyName.kind === 139) { checkComputedPropertyName(node.propertyName); } + var parent_9 = node.parent.parent; + var parentType = getTypeForBindingElementParent(parent_9); + var name_17 = node.propertyName || node.name; + var property = getPropertyOfType(parentType, getTextOfPropertyName(name_17)); + if (parent_9.initializer && property && getParentOfSymbol(property)) { + checkClassPropertyAccess(parent_9, parent_9.initializer, parentType, property); + } } if (ts.isBindingPattern(node.name)) { ts.forEach(node.name.elements, checkSourceElement); } - if (node.initializer && ts.getRootDeclaration(node).kind === 140 && ts.nodeIsMissing(ts.getContainingFunction(node).body)) { + if (node.initializer && ts.getRootDeclaration(node).kind === 141 && ts.nodeIsMissing(ts.getContainingFunction(node).body)) { error(node, ts.Diagnostics.A_parameter_initializer_is_only_allowed_in_a_function_or_constructor_implementation); return; } if (ts.isBindingPattern(node.name)) { - if (node.initializer && node.parent.parent.kind !== 204) { + if (node.initializer && node.parent.parent.kind !== 206) { checkTypeAssignableTo(checkExpressionCached(node.initializer), getWidenedTypeForVariableLikeDeclaration(node), node, undefined); checkParameterInitializer(node); } @@ -22254,7 +23299,7 @@ var ts; var symbol = getSymbolOfNode(node); var type = getTypeOfVariableOrParameterOrProperty(symbol); if (node === symbol.valueDeclaration) { - if (node.initializer && node.parent.parent.kind !== 204) { + if (node.initializer && node.parent.parent.kind !== 206) { checkTypeAssignableTo(checkExpressionCached(node.initializer), type, node, undefined); checkParameterInitializer(node); } @@ -22268,9 +23313,9 @@ var ts; checkTypeAssignableTo(checkExpressionCached(node.initializer), declarationType, node, undefined); } } - if (node.kind !== 143 && node.kind !== 142) { + if (node.kind !== 144 && node.kind !== 143) { checkExportsOnMergedDeclarations(node); - if (node.kind === 215 || node.kind === 167) { + if (node.kind === 217 || node.kind === 168) { checkVarDeclaredNamesNotShadowed(node); } checkCollisionWithCapturedSuperVariable(node, node.name); @@ -22292,7 +23337,7 @@ var ts; ts.forEach(node.declarationList.declarations, checkSourceElement); } function checkGrammarDisallowedModifiersOnObjectLiteralExpressionMethod(node) { - if (node.modifiers && node.parent.kind === 169) { + if (node.modifiers && node.parent.kind === 170) { if (ts.isAsyncFunctionLike(node)) { if (node.modifiers.length > 1) { return grammarErrorOnFirstToken(node, ts.Diagnostics.Modifiers_cannot_appear_here); @@ -22311,7 +23356,7 @@ var ts; checkGrammarStatementInAmbientContext(node); checkExpression(node.expression); checkSourceElement(node.thenStatement); - if (node.thenStatement.kind === 198) { + if (node.thenStatement.kind === 200) { error(node.thenStatement, ts.Diagnostics.The_body_of_an_if_statement_cannot_be_the_empty_statement); } checkSourceElement(node.elseStatement); @@ -22328,12 +23373,12 @@ var ts; } function checkForStatement(node) { if (!checkGrammarStatementInAmbientContext(node)) { - if (node.initializer && node.initializer.kind === 216) { + if (node.initializer && node.initializer.kind === 218) { checkGrammarVariableDeclarationList(node.initializer); } } if (node.initializer) { - if (node.initializer.kind === 216) { + if (node.initializer.kind === 218) { ts.forEach(node.initializer.declarations, checkVariableDeclaration); } else { @@ -22348,13 +23393,13 @@ var ts; } function checkForOfStatement(node) { checkGrammarForInOrForOfStatement(node); - if (node.initializer.kind === 216) { + if (node.initializer.kind === 218) { checkForInOrForOfVariableDeclaration(node); } else { var varExpr = node.initializer; var iteratedType = checkRightHandSideOfForOf(node.expression); - if (varExpr.kind === 168 || varExpr.kind === 169) { + if (varExpr.kind === 169 || varExpr.kind === 170) { checkDestructuringAssignment(varExpr, iteratedType || unknownType); } else { @@ -22369,7 +23414,7 @@ var ts; } function checkForInStatement(node) { checkGrammarForInOrForOfStatement(node); - if (node.initializer.kind === 216) { + if (node.initializer.kind === 218) { 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); @@ -22379,7 +23424,7 @@ var ts; else { var varExpr = node.initializer; var leftType = checkExpression(varExpr); - if (varExpr.kind === 168 || varExpr.kind === 169) { + if (varExpr.kind === 169 || varExpr.kind === 170) { error(varExpr, ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern); } else if (!isTypeAnyOrAllConstituentTypesHaveKind(leftType, 258)) { @@ -22389,7 +23434,7 @@ var ts; 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); } } - var rightType = checkExpression(node.expression); + var rightType = checkNonNullExpression(node.expression); if (!isTypeAnyOrAllConstituentTypesHaveKind(rightType, 80896 | 512)) { 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); } @@ -22403,7 +23448,7 @@ var ts; } } function checkRightHandSideOfForOf(rhsExpression) { - var expressionType = getTypeOfExpression(rhsExpression); + var expressionType = checkNonNullExpression(rhsExpression); return checkIteratedTypeOrElementType(expressionType, rhsExpression, true); } function checkIteratedTypeOrElementType(inputType, errorNode, allowStringInput) { @@ -22438,7 +23483,7 @@ var ts; } var typeAsIterable = type; if (!typeAsIterable.iterableElementType) { - if ((type.flags & 4096) && type.target === globalIterableType) { + if ((type.flags & 4096) && type.target === getGlobalIterableType()) { typeAsIterable.iterableElementType = type.typeArguments[0]; } else { @@ -22464,7 +23509,7 @@ var ts; } var typeAsIterator = type; if (!typeAsIterator.iteratorElementType) { - if ((type.flags & 4096) && type.target === globalIteratorType) { + if ((type.flags & 4096) && type.target === getGlobalIteratorType()) { typeAsIterator.iteratorElementType = type.typeArguments[0]; } else { @@ -22499,7 +23544,7 @@ var ts; if (isTypeAny(type)) { return undefined; } - if ((type.flags & 4096) && type.target === globalIterableIteratorType) { + if ((type.flags & 4096) && type.target === getGlobalIterableIteratorType()) { return type.typeArguments[0]; } return getElementTypeOfIterable(type, undefined) || @@ -22547,7 +23592,11 @@ var ts; checkGrammarStatementInAmbientContext(node) || checkGrammarBreakOrContinueStatement(node); } function isGetAccessorWithAnnotatedSetAccessor(node) { - return !!(node.kind === 147 && ts.getSetAccessorTypeAnnotationNode(ts.getDeclarationOfKind(node.symbol, 148))); + return !!(node.kind === 148 && ts.getSetAccessorTypeAnnotationNode(ts.getDeclarationOfKind(node.symbol, 149))); + } + function isUnwrappedReturnTypeVoidOrAny(func, returnType) { + var unwrappedReturnType = ts.isAsyncFunctionLike(func) ? getPromisedType(returnType) : returnType; + return maybeTypeOfKind(unwrappedReturnType, 16 | 1); } function checkReturnStatement(node) { if (!checkGrammarStatementInAmbientContext(node)) { @@ -22556,36 +23605,41 @@ var ts; grammarErrorOnFirstToken(node, ts.Diagnostics.A_return_statement_can_only_be_used_within_a_function_body); } } - if (node.expression) { - var func = ts.getContainingFunction(node); - if (func) { - var signature = getSignatureFromDeclaration(func); - var returnType = getReturnTypeOfSignature(signature); - var exprType = checkExpressionCached(node.expression); + var func = ts.getContainingFunction(node); + if (func) { + var signature = getSignatureFromDeclaration(func); + var returnType = getReturnTypeOfSignature(signature); + if (strictNullChecks || node.expression) { + var exprType = node.expression ? checkExpressionCached(node.expression) : undefinedType; if (func.asteriskToken) { return; } - if (func.kind === 148) { - error(node.expression, ts.Diagnostics.Setters_cannot_return_a_value); + if (func.kind === 149) { + if (node.expression) { + error(node.expression, ts.Diagnostics.Setters_cannot_return_a_value); + } } - else if (func.kind === 146) { - if (!checkTypeAssignableTo(exprType, returnType, node.expression)) { + else if (func.kind === 147) { + 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); } } else if (func.type || isGetAccessorWithAnnotatedSetAccessor(func)) { if (ts.isAsyncFunctionLike(func)) { var promisedType = getPromisedType(returnType); - var awaitedType = checkAwaitedType(exprType, node.expression, ts.Diagnostics.Return_expression_in_async_function_does_not_have_a_valid_callable_then_member); + var awaitedType = checkAwaitedType(exprType, node.expression || node, ts.Diagnostics.Return_expression_in_async_function_does_not_have_a_valid_callable_then_member); if (promisedType) { - checkTypeAssignableTo(awaitedType, promisedType, node.expression); + checkTypeAssignableTo(awaitedType, promisedType, node.expression || node); } } else { - checkTypeAssignableTo(exprType, returnType, node.expression); + checkTypeAssignableTo(exprType, returnType, node.expression || node); } } } + else if (func.kind !== 147 && compilerOptions.noImplicitReturns && !isUnwrappedReturnTypeVoidOrAny(func, returnType)) { + error(node, ts.Diagnostics.Not_all_code_paths_return_a_value); + } } } function checkWithStatement(node) { @@ -22602,9 +23656,8 @@ var ts; var firstDefaultClause; var hasDuplicateDefaultClause = false; var expressionType = checkExpression(node.expression); - var expressionTypeIsStringLike = maybeTypeOfKind(expressionType, 258); ts.forEach(node.caseBlock.clauses, function (clause) { - if (clause.kind === 246 && !hasDuplicateDefaultClause) { + if (clause.kind === 249 && !hasDuplicateDefaultClause) { if (firstDefaultClause === undefined) { firstDefaultClause = clause; } @@ -22616,13 +23669,11 @@ var ts; hasDuplicateDefaultClause = true; } } - if (produceDiagnostics && clause.kind === 245) { + if (produceDiagnostics && clause.kind === 248) { var caseClause = clause; var caseType = checkExpression(caseClause.expression); - var expressionTypeIsAssignableToCaseType = (expressionTypeIsStringLike && maybeTypeOfKind(caseType, 258)) || - isTypeAssignableTo(expressionType, caseType); - if (!expressionTypeIsAssignableToCaseType) { - checkTypeAssignableTo(caseType, expressionType, caseClause.expression, undefined); + if (!isTypeComparableTo(expressionType, caseType)) { + checkTypeComparableTo(caseType, expressionType, caseClause.expression, undefined); } } ts.forEach(clause.statements, checkSourceElement); @@ -22635,7 +23686,7 @@ var ts; if (ts.isFunctionLike(current)) { break; } - if (current.kind === 211 && current.label.text === node.label.text) { + if (current.kind === 213 && 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; @@ -22729,7 +23780,7 @@ var ts; return; } var errorNode; - if (prop.valueDeclaration.name.kind === 138 || prop.parent === containingType.symbol) { + if (prop.valueDeclaration.name.kind === 139 || prop.parent === containingType.symbol) { errorNode = prop.valueDeclaration; } else if (indexDeclaration) { @@ -22780,7 +23831,7 @@ var ts; var firstDecl; for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; - if (declaration.kind === 218 || declaration.kind === 219) { + if (declaration.kind === 220 || declaration.kind === 221) { if (!firstDecl) { firstDecl = declaration; } @@ -22909,7 +23960,7 @@ var ts; if (derived === base) { var derivedClassDecl = getClassLikeDeclarationOfSymbol(type.symbol); if (baseDeclarationFlags & 128 && (!derivedClassDecl || !(derivedClassDecl.flags & 128))) { - if (derivedClassDecl.kind === 190) { + if (derivedClassDecl.kind === 191) { error(derivedClassDecl, ts.Diagnostics.Non_abstract_class_expression_does_not_implement_inherited_abstract_member_0_from_class_1, symbolToString(baseProperty), typeToString(baseType)); } else { @@ -22953,7 +24004,7 @@ var ts; } } function isAccessor(kind) { - return kind === 147 || kind === 148; + return kind === 148 || kind === 149; } function areTypeParametersIdentical(list1, list2) { if (!list1 && !list2) { @@ -23020,7 +24071,7 @@ var ts; checkExportsOnMergedDeclarations(node); var symbol = getSymbolOfNode(node); checkTypeParameterListsIdentical(node, symbol); - var firstInterfaceDecl = ts.getDeclarationOfKind(symbol, 219); + var firstInterfaceDecl = ts.getDeclarationOfKind(symbol, 221); if (node === firstInterfaceDecl) { var type = getDeclaredTypeOfSymbol(symbol); var typeWithThis = getTypeWithThisArgument(type); @@ -23113,7 +24164,7 @@ var ts; return value; function evalConstant(e) { switch (e.kind) { - case 183: + case 184: var value_1 = evalConstant(e.operand); if (value_1 === undefined) { return undefined; @@ -23124,7 +24175,7 @@ var ts; case 50: return ~value_1; } return undefined; - case 185: + case 186: var left = evalConstant(e.left); if (left === undefined) { return undefined; @@ -23149,11 +24200,11 @@ var ts; return undefined; case 8: return +e.text; - case 176: + case 177: return evalConstant(e.expression); case 69: + case 172: case 171: - case 170: var member = initializer.parent; var currentType = getTypeOfSymbol(getSymbolOfNode(member.parent)); var enumType_1; @@ -23164,7 +24215,7 @@ var ts; } else { var expression = void 0; - if (e.kind === 171) { + if (e.kind === 172) { if (e.argumentExpression === undefined || e.argumentExpression.kind !== 9) { return undefined; @@ -23181,7 +24232,7 @@ var ts; if (current.kind === 69) { break; } - else if (current.kind === 170) { + else if (current.kind === 171) { current = current.expression; } else { @@ -23241,7 +24292,7 @@ var ts; } var seenEnumMissingInitialInitializer_1 = false; ts.forEach(enumSymbol.declarations, function (declaration) { - if (declaration.kind !== 221) { + if (declaration.kind !== 223) { return false; } var enumDeclaration = declaration; @@ -23264,8 +24315,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 === 218 || - (declaration.kind === 217 && ts.nodeIsPresent(declaration.body))) && + if ((declaration.kind === 220 || + (declaration.kind === 219 && ts.nodeIsPresent(declaration.body))) && !ts.isInAmbientContext(declaration)) { return declaration; } @@ -23322,7 +24373,7 @@ var ts; error(node.name, ts.Diagnostics.A_namespace_declaration_cannot_be_located_prior_to_a_class_or_function_with_which_it_is_merged); } } - var mergedClass = ts.getDeclarationOfKind(symbol, 218); + var mergedClass = ts.getDeclarationOfKind(symbol, 220); if (mergedClass && inSameLexicalScope(node, mergedClass)) { getNodeLinks(node).flags |= 32768; @@ -23360,40 +24411,40 @@ var ts; } function checkModuleAugmentationElement(node, isGlobalAugmentation) { switch (node.kind) { - case 197: + case 199: for (var _i = 0, _a = node.declarationList.declarations; _i < _a.length; _i++) { var decl = _a[_i]; checkModuleAugmentationElement(decl, isGlobalAugmentation); } break; - case 231: - case 232: + case 234: + case 235: grammarErrorOnFirstToken(node, ts.Diagnostics.Exports_and_export_assignments_are_not_permitted_in_module_augmentations); break; - case 225: + case 228: if (node.moduleReference.kind !== 9) { error(node.name, ts.Diagnostics.Module_augmentation_cannot_introduce_new_names_in_the_top_level_scope); break; } - case 226: + case 229: grammarErrorOnFirstToken(node, ts.Diagnostics.Imports_are_not_permitted_in_module_augmentations_Consider_moving_them_to_the_enclosing_external_module); break; - case 167: - case 215: - var name_16 = node.name; - if (ts.isBindingPattern(name_16)) { - for (var _b = 0, _c = name_16.elements; _b < _c.length; _b++) { + case 168: + case 217: + var name_18 = node.name; + if (ts.isBindingPattern(name_18)) { + for (var _b = 0, _c = name_18.elements; _b < _c.length; _b++) { var el = _c[_b]; checkModuleAugmentationElement(el, isGlobalAugmentation); } break; } - case 218: - case 221: - case 217: - case 219: - case 222: case 220: + case 223: + case 219: + case 221: + case 224: + case 222: var symbol = getSymbolOfNode(node); if (symbol) { var reportError = !(symbol.flags & 33554432); @@ -23402,7 +24453,7 @@ var ts; reportError = symbol.parent !== undefined; } else { - reportError = ts.isExternalModuleAugmentation(symbol.parent.valueDeclaration); + reportError = ts.isExternalModuleAugmentation(symbol.parent.declarations[0]); } } if (reportError) { @@ -23414,10 +24465,10 @@ var ts; } function getFirstIdentifier(node) { while (true) { - if (node.kind === 137) { + if (node.kind === 138) { node = node.left; } - else if (node.kind === 170) { + else if (node.kind === 171) { node = node.expression; } else { @@ -23433,9 +24484,9 @@ var ts; error(moduleName, ts.Diagnostics.String_literal_expected); return false; } - var inAmbientExternalModule = node.parent.kind === 223 && ts.isAmbientModule(node.parent.parent); - if (node.parent.kind !== 252 && !inAmbientExternalModule) { - error(moduleName, node.kind === 232 ? + var inAmbientExternalModule = node.parent.kind === 225 && ts.isAmbientModule(node.parent.parent); + if (node.parent.kind !== 255 && !inAmbientExternalModule) { + error(moduleName, node.kind === 235 ? ts.Diagnostics.Export_declarations_are_not_permitted_in_a_namespace : ts.Diagnostics.Import_declarations_in_a_namespace_cannot_reference_a_module); return false; @@ -23452,11 +24503,11 @@ var ts; var symbol = getSymbolOfNode(node); var target = resolveAlias(symbol); if (target !== unknownSymbol) { - var excludedMeanings = (symbol.flags & 107455 ? 107455 : 0) | + var excludedMeanings = (symbol.flags & (107455 | 1048576) ? 107455 : 0) | (symbol.flags & 793056 ? 793056 : 0) | (symbol.flags & 1536 ? 1536 : 0); if (target.flags & excludedMeanings) { - var message = node.kind === 234 ? + var message = node.kind === 237 ? 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)); @@ -23483,7 +24534,7 @@ var ts; checkImportBinding(importClause); } if (importClause.namedBindings) { - if (importClause.namedBindings.kind === 228) { + if (importClause.namedBindings.kind === 231) { checkImportBinding(importClause.namedBindings); } else { @@ -23534,8 +24585,8 @@ var ts; if (!node.moduleSpecifier || checkExternalImportOrExportDeclaration(node)) { if (node.exportClause) { ts.forEach(node.exportClause.elements, checkExportSpecifier); - var inAmbientExternalModule = node.parent.kind === 223 && ts.isAmbientModule(node.parent.parent); - if (node.parent.kind !== 252 && !inAmbientExternalModule) { + var inAmbientExternalModule = node.parent.kind === 225 && ts.isAmbientModule(node.parent.parent); + if (node.parent.kind !== 255 && !inAmbientExternalModule) { error(node, ts.Diagnostics.Export_declarations_are_not_permitted_in_a_namespace); } } @@ -23548,7 +24599,7 @@ var ts; } } function checkGrammarModuleElementContext(node, errorMessage) { - if (node.parent.kind !== 252 && node.parent.kind !== 223 && node.parent.kind !== 222) { + if (node.parent.kind !== 255 && node.parent.kind !== 225 && node.parent.kind !== 224) { return grammarErrorOnFirstToken(node, errorMessage); } } @@ -23569,8 +24620,8 @@ var ts; if (checkGrammarModuleElementContext(node, ts.Diagnostics.An_export_assignment_can_only_be_used_in_a_module)) { return; } - var container = node.parent.kind === 252 ? node.parent : node.parent.parent; - if (container.kind === 222 && !ts.isAmbientModule(container)) { + var container = node.parent.kind === 255 ? node.parent : node.parent.parent; + if (container.kind === 224 && !ts.isAmbientModule(container)) { error(node, ts.Diagnostics.An_export_assignment_cannot_be_used_in_a_namespace); return; } @@ -23637,7 +24688,7 @@ var ts; links.exportsChecked = true; } function isNotOverload(declaration) { - return declaration.kind !== 217 || !!declaration.body; + return declaration.kind !== 219 || !!declaration.body; } } function checkSourceElement(node) { @@ -23647,118 +24698,118 @@ var ts; var kind = node.kind; if (cancellationToken) { switch (kind) { - case 222: - case 218: + case 224: + case 220: + case 221: case 219: - case 217: cancellationToken.throwIfCancellationRequested(); } } switch (kind) { - case 139: - return checkTypeParameter(node); case 140: + return checkTypeParameter(node); + case 141: return checkParameter(node); + case 144: case 143: - case 142: return checkPropertyDeclaration(node); - case 154: case 155: - case 149: + case 156: case 150: - return checkSignatureDeclaration(node); case 151: return checkSignatureDeclaration(node); - case 145: - case 144: - return checkMethodDeclaration(node); - case 146: - return checkConstructorDeclaration(node); - case 147: - case 148: - return checkAccessorDeclaration(node); - case 153: - return checkTypeReferenceNode(node); case 152: + return checkSignatureDeclaration(node); + case 146: + case 145: + return checkMethodDeclaration(node); + case 147: + return checkConstructorDeclaration(node); + case 148: + case 149: + return checkAccessorDeclaration(node); + case 154: + return checkTypeReferenceNode(node); + case 153: return checkTypePredicate(node); - case 156: - return checkTypeQuery(node); case 157: - return checkTypeLiteral(node); + return checkTypeQuery(node); case 158: - return checkArrayType(node); + return checkTypeLiteral(node); case 159: - return checkTupleType(node); + return checkArrayType(node); case 160: + return checkTupleType(node); case 161: - return checkUnionOrIntersectionType(node); case 162: + return checkUnionOrIntersectionType(node); + case 163: return checkSourceElement(node.type); - case 217: - return checkFunctionDeclaration(node); - case 196: - case 223: - return checkBlock(node); - case 197: - return checkVariableStatement(node); - case 199: - return checkExpressionStatement(node); - case 200: - return checkIfStatement(node); - case 201: - return checkDoStatement(node); - case 202: - return checkWhileStatement(node); - case 203: - return checkForStatement(node); - case 204: - return checkForInStatement(node); - case 205: - return checkForOfStatement(node); - case 206: - case 207: - return checkBreakOrContinueStatement(node); - case 208: - return checkReturnStatement(node); - case 209: - return checkWithStatement(node); - case 210: - return checkSwitchStatement(node); - case 211: - return checkLabeledStatement(node); - case 212: - return checkThrowStatement(node); - case 213: - return checkTryStatement(node); - case 215: - return checkVariableDeclaration(node); - case 167: - return checkBindingElement(node); - case 218: - return checkClassDeclaration(node); case 219: - return checkInterfaceDeclaration(node); - case 220: - return checkTypeAliasDeclaration(node); - case 221: - return checkEnumDeclaration(node); - case 222: - return checkModuleDeclaration(node); - case 226: - return checkImportDeclaration(node); - case 225: - return checkImportEqualsDeclaration(node); - case 232: - return checkExportDeclaration(node); - case 231: - return checkExportAssignment(node); + return checkFunctionDeclaration(node); case 198: - checkGrammarStatementInAmbientContext(node); - return; + case 225: + return checkBlock(node); + case 199: + return checkVariableStatement(node); + case 201: + return checkExpressionStatement(node); + case 202: + return checkIfStatement(node); + case 203: + return checkDoStatement(node); + case 204: + return checkWhileStatement(node); + case 205: + return checkForStatement(node); + case 206: + return checkForInStatement(node); + case 207: + return checkForOfStatement(node); + case 208: + case 209: + return checkBreakOrContinueStatement(node); + case 210: + return checkReturnStatement(node); + case 211: + return checkWithStatement(node); + case 212: + return checkSwitchStatement(node); + case 213: + return checkLabeledStatement(node); case 214: + return checkThrowStatement(node); + case 215: + return checkTryStatement(node); + case 217: + return checkVariableDeclaration(node); + case 168: + return checkBindingElement(node); + case 220: + return checkClassDeclaration(node); + case 221: + return checkInterfaceDeclaration(node); + case 222: + return checkTypeAliasDeclaration(node); + case 223: + return checkEnumDeclaration(node); + case 224: + return checkModuleDeclaration(node); + case 229: + return checkImportDeclaration(node); + case 228: + return checkImportEqualsDeclaration(node); + case 235: + return checkExportDeclaration(node); + case 234: + return checkExportAssignment(node); + case 200: checkGrammarStatementInAmbientContext(node); return; - case 235: + case 216: + checkGrammarStatementInAmbientContext(node); + return; + case 238: return checkMissingDeclaration(node); } } @@ -23771,17 +24822,17 @@ var ts; for (var _i = 0, deferredNodes_1 = deferredNodes; _i < deferredNodes_1.length; _i++) { var node = deferredNodes_1[_i]; switch (node.kind) { - case 177: case 178: + case 179: + case 146: case 145: - case 144: checkFunctionExpressionOrObjectLiteralMethodDeferred(node); break; - case 147: case 148: + case 149: checkAccessorDeferred(node); break; - case 190: + case 191: checkClassExpressionDeferred(node); break; } @@ -23846,7 +24897,7 @@ var ts; function isInsideWithStatementBody(node) { if (node) { while (node.parent) { - if (node.parent.kind === 209 && node.parent.statement === node) { + if (node.parent.kind === 211 && node.parent.statement === node) { return true; } node = node.parent; @@ -23868,28 +24919,28 @@ var ts; copySymbols(location.locals, meaning); } switch (location.kind) { - case 252: + case 255: if (!ts.isExternalOrCommonJsModule(location)) { break; } - case 222: + case 224: copySymbols(getSymbolOfNode(location).exports, meaning & 8914931); break; - case 221: + case 223: copySymbols(getSymbolOfNode(location).exports, meaning & 8); break; - case 190: + case 191: var className = location.name; if (className) { copySymbol(location.symbol, meaning); } - case 218: - case 219: + case 220: + case 221: if (!(memberFlags & 32)) { copySymbols(getSymbolOfNode(location).members, meaning & 793056); } break; - case 177: + case 178: var funcName = location.name; if (funcName) { copySymbol(location.symbol, meaning); @@ -23928,47 +24979,50 @@ var ts; } function isTypeDeclaration(node) { switch (node.kind) { - case 139: - case 218: - case 219: + case 140: case 220: case 221: + case 222: + case 223: return true; } } function isTypeReferenceIdentifier(entityName) { var node = entityName; - while (node.parent && node.parent.kind === 137) { + while (node.parent && node.parent.kind === 138) { node = node.parent; } - return node.parent && node.parent.kind === 153; + return node.parent && node.parent.kind === 154; } function isHeritageClauseElementIdentifier(entityName) { var node = entityName; - while (node.parent && node.parent.kind === 170) { + while (node.parent && node.parent.kind === 171) { node = node.parent; } - return node.parent && node.parent.kind === 192; + return node.parent && node.parent.kind === 193; } - function isNodeWithinClass(node, classDeclaration) { + function forEachEnclosingClass(node, callback) { + var result; while (true) { node = ts.getContainingClass(node); - if (!node) { - return false; - } - if (node === classDeclaration) { - return true; - } + if (!node) + break; + if (result = callback(node)) + break; } + return result; + } + function isNodeWithinClass(node, classDeclaration) { + return !!forEachEnclosingClass(node, function (n) { return n === classDeclaration; }); } function getLeftSideOfImportEqualsOrExportAssignment(nodeOnRightSide) { - while (nodeOnRightSide.parent.kind === 137) { + while (nodeOnRightSide.parent.kind === 138) { nodeOnRightSide = nodeOnRightSide.parent; } - if (nodeOnRightSide.parent.kind === 225) { + if (nodeOnRightSide.parent.kind === 228) { return nodeOnRightSide.parent.moduleReference === nodeOnRightSide && nodeOnRightSide.parent; } - if (nodeOnRightSide.parent.kind === 231) { + if (nodeOnRightSide.parent.kind === 234) { return nodeOnRightSide.parent.expression === nodeOnRightSide && nodeOnRightSide.parent; } return undefined; @@ -23980,7 +25034,7 @@ var ts; if (ts.isDeclarationName(entityName)) { return getSymbolOfNode(entityName.parent); } - if (ts.isInJavaScriptFile(entityName) && entityName.parent.kind === 170) { + if (ts.isInJavaScriptFile(entityName) && entityName.parent.kind === 171) { var specialPropertyAssignmentKind = ts.getSpecialPropertyAssignmentKind(entityName.parent.parent); switch (specialPropertyAssignmentKind) { case 1: @@ -23992,10 +25046,10 @@ var ts; default: } } - if (entityName.parent.kind === 231) { + if (entityName.parent.kind === 234) { return resolveEntityName(entityName, 107455 | 793056 | 1536 | 8388608); } - if (entityName.kind !== 170) { + if (entityName.kind !== 171) { if (isInRightSideOfImportOrExportAssignment(entityName)) { return getSymbolOfPartOfRightHandSideOfImportEquals(entityName); } @@ -24005,7 +25059,7 @@ var ts; } if (isHeritageClauseElementIdentifier(entityName)) { var meaning = 0; - if (entityName.parent.kind === 192) { + if (entityName.parent.kind === 193) { meaning = 793056; if (ts.isExpressionWithTypeArgumentsInClassExtendsClause(entityName.parent)) { meaning |= 107455; @@ -24017,27 +25071,25 @@ var ts; meaning |= 8388608; return resolveEntityName(entityName, meaning); } - else if ((entityName.parent.kind === 239) || - (entityName.parent.kind === 238) || - (entityName.parent.kind === 241)) { - return getJsxTagSymbol(entityName.parent); - } else if (ts.isExpression(entityName)) { if (ts.nodeIsMissing(entityName)) { return undefined; } if (entityName.kind === 69) { + if (ts.isJSXTagName(entityName) && isJsxIntrinsicIdentifier(entityName)) { + return getIntrinsicTagSymbol(entityName.parent); + } var meaning = 107455 | 8388608; return resolveEntityName(entityName, meaning); } - else if (entityName.kind === 170) { + else if (entityName.kind === 171) { var symbol = getNodeLinks(entityName).resolvedSymbol; if (!symbol) { checkPropertyAccessExpression(entityName); } return getNodeLinks(entityName).resolvedSymbol; } - else if (entityName.kind === 137) { + else if (entityName.kind === 138) { var symbol = getNodeLinks(entityName).resolvedSymbol; if (!symbol) { checkQualifiedName(entityName); @@ -24046,14 +25098,14 @@ var ts; } } else if (isTypeReferenceIdentifier(entityName)) { - var meaning = entityName.parent.kind === 153 ? 793056 : 1536; + var meaning = entityName.parent.kind === 154 ? 793056 : 1536; meaning |= 8388608; return resolveEntityName(entityName, meaning); } - else if (entityName.parent.kind === 242) { + else if (entityName.parent.kind === 245) { return getJsxAttributePropertySymbol(entityName.parent); } - if (entityName.parent.kind === 152) { + if (entityName.parent.kind === 153) { return resolveEntityName(entityName, 1); } return undefined; @@ -24067,12 +25119,12 @@ var ts; } if (node.kind === 69) { if (isInRightSideOfImportOrExportAssignment(node)) { - return node.parent.kind === 231 + return node.parent.kind === 234 ? getSymbolOfEntityNameOrPropertyAccessExpression(node) : getSymbolOfPartOfRightHandSideOfImportEquals(node); } - else if (node.parent.kind === 167 && - node.parent.parent.kind === 165 && + else if (node.parent.kind === 168 && + node.parent.parent.kind === 166 && node === node.parent.propertyName) { var typeOfPattern = getTypeOfNode(node.parent.parent); var propertyDeclaration = typeOfPattern && getPropertyOfType(typeOfPattern, node.text); @@ -24083,30 +25135,30 @@ var ts; } switch (node.kind) { case 69: - case 170: - case 137: + case 171: + case 138: return getSymbolOfEntityNameOrPropertyAccessExpression(node); case 97: case 95: var type = ts.isExpression(node) ? checkExpression(node) : getTypeFromTypeNode(node); return type.symbol; - case 163: + case 164: return getTypeFromTypeNode(node).symbol; case 121: var constructorDeclaration = node.parent; - if (constructorDeclaration && constructorDeclaration.kind === 146) { + if (constructorDeclaration && constructorDeclaration.kind === 147) { return constructorDeclaration.parent.symbol; } return undefined; case 9: if ((ts.isExternalModuleImportEqualsDeclaration(node.parent.parent) && ts.getExternalModuleImportEqualsDeclarationExpression(node.parent.parent) === node) || - ((node.parent.kind === 226 || node.parent.kind === 232) && + ((node.parent.kind === 229 || node.parent.kind === 235) && node.parent.moduleSpecifier === node)) { return resolveExternalModuleName(node, node); } case 8: - if (node.parent.kind === 171 && node.parent.argumentExpression === node) { + if (node.parent.kind === 172 && node.parent.argumentExpression === node) { var objectType = checkExpression(node.parent.expression); if (objectType === unknownType) return undefined; @@ -24120,7 +25172,7 @@ var ts; return undefined; } function getShorthandAssignmentValueSymbol(location) { - if (location && location.kind === 250) { + if (location && location.kind === 253) { return resolveEntityName(location.name, 107455 | 8388608); } return undefined; @@ -24196,9 +25248,9 @@ var ts; function getRootSymbols(symbol) { if (symbol.flags & 268435456) { var symbols_3 = []; - var name_17 = symbol.name; + var name_19 = symbol.name; ts.forEach(getSymbolLinks(symbol).containingType.types, function (t) { - var symbol = getPropertyOfType(t, name_17); + var symbol = getPropertyOfType(t, name_19); if (symbol) { symbols_3.push(symbol); } @@ -24247,11 +25299,11 @@ var ts; } var parentSymbol = getParentOfSymbol(symbol); if (parentSymbol) { - if (parentSymbol.flags & 512 && parentSymbol.valueDeclaration.kind === 252) { + if (parentSymbol.flags & 512 && parentSymbol.valueDeclaration.kind === 255) { return parentSymbol.valueDeclaration; } for (var n = node.parent; n; n = n.parent) { - if ((n.kind === 222 || n.kind === 221) && getSymbolOfNode(n) === parentSymbol) { + if ((n.kind === 224 || n.kind === 223) && getSymbolOfNode(n) === parentSymbol) { return n; } } @@ -24275,7 +25327,7 @@ var ts; else if (nodeLinks_1.flags & 131072) { var isDeclaredInLoop = nodeLinks_1.flags & 262144; var inLoopInitializer = ts.isIterationStatement(container, false); - var inLoopBodyBlock = container.kind === 196 && ts.isIterationStatement(container.parent, false); + var inLoopBodyBlock = container.kind === 198 && ts.isIterationStatement(container.parent, false); links.isDeclarationWithCollidingName = !ts.isBlockScopedContainerTopLevel(container) && (!isDeclaredInLoop || (!inLoopInitializer && !inLoopBodyBlock)); } else { @@ -24296,22 +25348,22 @@ var ts; } function isValueAliasDeclaration(node) { switch (node.kind) { - case 225: - case 227: case 228: case 230: - case 234: + case 231: + case 233: + case 237: return isAliasResolvedToValue(getSymbolOfNode(node)); - case 232: + case 235: var exportClause = node.exportClause; return exportClause && ts.forEach(exportClause.elements, isValueAliasDeclaration); - case 231: + case 234: return node.expression && node.expression.kind === 69 ? isAliasResolvedToValue(getSymbolOfNode(node)) : true; } return false; } function isTopLevelValueImportEqualsWithEntityName(node) { - if (node.parent.kind !== 252 || !ts.isInternalModuleImportEqualsDeclaration(node)) { + if (node.parent.kind !== 255 || !ts.isInternalModuleImportEqualsDeclaration(node)) { return false; } var isValue = isAliasResolvedToValue(getSymbolOfNode(node)); @@ -24359,7 +25411,7 @@ var ts; return getNodeLinks(node).enumMemberValue; } function getConstantValue(node) { - if (node.kind === 251) { + if (node.kind === 254) { return getEnumMemberValue(node); } var symbol = getNodeLinks(node).resolvedSymbol; @@ -24430,9 +25482,15 @@ var ts; getSymbolDisplayBuilder().buildTypeDisplay(getReturnTypeOfSignature(signature), writer, enclosingDeclaration, flags); } function writeTypeOfExpression(expr, enclosingDeclaration, flags, writer) { - var type = getTypeOfExpression(expr); + var type = getWidenedType(getTypeOfExpression(expr)); getSymbolDisplayBuilder().buildTypeDisplay(type, writer, enclosingDeclaration, flags); } + function writeBaseConstructorTypeOfClass(node, enclosingDeclaration, flags, writer) { + var classType = getDeclaredTypeOfSymbol(getSymbolOfNode(node)); + resolveBaseTypesOfClass(classType); + var baseType = classType.resolvedBaseTypes.length ? classType.resolvedBaseTypes[0] : unknownType; + getSymbolDisplayBuilder().buildTypeDisplay(baseType, writer, enclosingDeclaration, flags); + } function hasGlobalName(name) { return ts.hasProperty(globals, name); } @@ -24461,6 +25519,7 @@ var ts; writeTypeOfDeclaration: writeTypeOfDeclaration, writeReturnTypeOfSignatureDeclaration: writeReturnTypeOfSignatureDeclaration, writeTypeOfExpression: writeTypeOfExpression, + writeBaseConstructorTypeOfClass: writeBaseConstructorTypeOfClass, isSymbolAccessible: isSymbolAccessible, isEntityNameVisible: isEntityNameVisible, getConstantValue: getConstantValue, @@ -24479,7 +25538,7 @@ var ts; if (!moduleSymbol) { return undefined; } - return ts.getDeclarationOfKind(moduleSymbol, 252); + return ts.getDeclarationOfKind(moduleSymbol, 255); } function initializeTypeChecker() { ts.forEach(host.getSourceFiles(), function (file) { @@ -24493,6 +25552,9 @@ var ts; if (file.moduleAugmentations.length) { (augmentations || (augmentations = [])).push(file.moduleAugmentations); } + if (file.wasReferenced && file.symbol && file.symbol.globalExports) { + mergeSymbolTable(globals, file.symbol.globalExports); + } }); if (augmentations) { for (var _i = 0, augmentations_1 = augmentations; _i < augmentations_1.length; _i++) { @@ -24520,6 +25582,7 @@ var ts; getGlobalMethodDecoratorType = ts.memoize(function () { return getGlobalType("MethodDecorator"); }); getGlobalParameterDecoratorType = ts.memoize(function () { return getGlobalType("ParameterDecorator"); }); getGlobalTypedPropertyDescriptorType = ts.memoize(function () { return getGlobalType("TypedPropertyDescriptor", 1); }); + getGlobalESSymbolConstructorSymbol = ts.memoize(function () { return getGlobalValueSymbol("Symbol"); }); getGlobalPromiseType = ts.memoize(function () { return getGlobalType("Promise", 1); }); tryGetGlobalPromiseType = ts.memoize(function () { return getGlobalSymbol("Promise", 793056, undefined) && getGlobalPromiseType(); }); getGlobalPromiseLikeType = ts.memoize(function () { return getGlobalType("PromiseLike", 1); }); @@ -24527,21 +25590,18 @@ var ts; getGlobalPromiseConstructorSymbol = ts.memoize(function () { return getGlobalValueSymbol("Promise"); }); getGlobalPromiseConstructorLikeType = ts.memoize(function () { return getGlobalType("PromiseConstructorLike"); }); getGlobalThenableType = ts.memoize(createThenableType); + getGlobalTemplateStringsArrayType = ts.memoize(function () { return getGlobalType("TemplateStringsArray"); }); if (languageVersion >= 2) { - globalTemplateStringsArrayType = getGlobalType("TemplateStringsArray"); - globalESSymbolType = getGlobalType("Symbol"); - globalESSymbolConstructorSymbol = getGlobalValueSymbol("Symbol"); - globalIterableType = getGlobalType("Iterable", 1); - globalIteratorType = getGlobalType("Iterator", 1); - globalIterableIteratorType = getGlobalType("IterableIterator", 1); + getGlobalESSymbolType = ts.memoize(function () { return getGlobalType("Symbol"); }); + getGlobalIterableType = ts.memoize(function () { return getGlobalType("Iterable", 1); }); + getGlobalIteratorType = ts.memoize(function () { return getGlobalType("Iterator", 1); }); + getGlobalIterableIteratorType = ts.memoize(function () { return getGlobalType("IterableIterator", 1); }); } else { - globalTemplateStringsArrayType = unknownType; - globalESSymbolType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined); - globalESSymbolConstructorSymbol = undefined; - globalIterableType = emptyGenericType; - globalIteratorType = emptyGenericType; - globalIterableIteratorType = emptyGenericType; + getGlobalESSymbolType = ts.memoize(function () { return emptyObjectType; }); + getGlobalIterableType = ts.memoize(function () { return emptyGenericType; }); + getGlobalIteratorType = ts.memoize(function () { return emptyGenericType; }); + getGlobalIterableIteratorType = ts.memoize(function () { return emptyGenericType; }); } anyArrayType = createArrayType(anyType); var symbol = getGlobalSymbol("ReadonlyArray", 793056, undefined); @@ -24570,14 +25630,14 @@ var ts; return false; } if (!ts.nodeCanBeDecorated(node)) { - if (node.kind === 145 && !ts.nodeIsPresent(node.body)) { + if (node.kind === 146 && !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 === 147 || node.kind === 148) { + else if (node.kind === 148 || node.kind === 149) { 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); @@ -24587,38 +25647,38 @@ var ts; } function checkGrammarModifiers(node) { switch (node.kind) { - case 147: case 148: - case 146: - case 143: - case 142: - case 145: + case 149: + case 147: case 144: - case 151: - case 222: - case 226: - case 225: - case 232: - case 231: - case 140: + case 143: + case 146: + case 145: + case 152: + case 224: + case 229: + case 228: + case 235: + case 234: + case 141: break; - case 217: - if (node.modifiers && (node.modifiers.length > 1 || node.modifiers[0].kind !== 118) && - node.parent.kind !== 223 && node.parent.kind !== 252) { - return grammarErrorOnFirstToken(node, ts.Diagnostics.Modifiers_cannot_appear_here); - } - break; - case 218: case 219: - case 197: - case 220: - if (node.modifiers && node.parent.kind !== 223 && node.parent.kind !== 252) { + if (node.modifiers && (node.modifiers.length > 1 || node.modifiers[0].kind !== 118) && + node.parent.kind !== 225 && node.parent.kind !== 255) { return grammarErrorOnFirstToken(node, ts.Diagnostics.Modifiers_cannot_appear_here); } break; + case 220: case 221: + case 199: + case 222: + if (node.modifiers && node.parent.kind !== 225 && node.parent.kind !== 255) { + return grammarErrorOnFirstToken(node, ts.Diagnostics.Modifiers_cannot_appear_here); + } + break; + case 223: if (node.modifiers && (node.modifiers.length > 1 || node.modifiers[0].kind !== 74) && - node.parent.kind !== 223 && node.parent.kind !== 252) { + node.parent.kind !== 225 && node.parent.kind !== 255) { return grammarErrorOnFirstToken(node, ts.Diagnostics.Modifiers_cannot_appear_here); } break; @@ -24633,16 +25693,16 @@ var ts; for (var _i = 0, _a = node.modifiers; _i < _a.length; _i++) { var modifier = _a[_i]; if (modifier.kind !== 127) { - if (node.kind === 142 || node.kind === 144) { + if (node.kind === 143 || node.kind === 145) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_type_member, ts.tokenToString(modifier.kind)); } - if (node.kind === 151) { + if (node.kind === 152) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_an_index_signature, ts.tokenToString(modifier.kind)); } } switch (modifier.kind) { case 74: - if (node.kind !== 221 && node.parent.kind === 218) { + if (node.kind !== 223 && node.parent.kind === 220) { return grammarErrorOnNode(node, ts.Diagnostics.A_class_member_cannot_have_the_0_keyword, ts.tokenToString(74)); } break; @@ -24668,7 +25728,7 @@ var ts; else if (flags & 256) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, text, "async"); } - else if (node.parent.kind === 223 || node.parent.kind === 252) { + else if (node.parent.kind === 225 || node.parent.kind === 255) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_module_or_namespace_element, text); } else if (flags & 128) { @@ -24691,10 +25751,10 @@ var ts; else if (flags & 256) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "static", "async"); } - else if (node.parent.kind === 223 || node.parent.kind === 252) { + else if (node.parent.kind === 225 || node.parent.kind === 255) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_module_or_namespace_element, "static"); } - else if (node.kind === 140) { + else if (node.kind === 141) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "static"); } else if (flags & 128) { @@ -24707,7 +25767,7 @@ var ts; if (flags & 64) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "readonly"); } - else if (node.kind !== 143 && node.kind !== 142 && node.kind !== 151) { + else if (node.kind !== 144 && node.kind !== 143 && node.kind !== 152) { return grammarErrorOnNode(modifier, ts.Diagnostics.readonly_modifier_can_only_appear_on_a_property_declaration_or_index_signature); } flags |= 64; @@ -24726,10 +25786,10 @@ var ts; else if (flags & 256) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "export", "async"); } - else if (node.parent.kind === 218) { + else if (node.parent.kind === 220) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_class_element, "export"); } - else if (node.kind === 140) { + else if (node.kind === 141) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "export"); } flags |= 1; @@ -24741,13 +25801,13 @@ var ts; else if (flags & 256) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_in_an_ambient_context, "async"); } - else if (node.parent.kind === 218) { + else if (node.parent.kind === 220) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_class_element, "declare"); } - else if (node.kind === 140) { + else if (node.kind === 141) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "declare"); } - else if (ts.isInAmbientContext(node.parent) && node.parent.kind === 223) { + else if (ts.isInAmbientContext(node.parent) && node.parent.kind === 225) { return grammarErrorOnNode(modifier, ts.Diagnostics.A_declare_modifier_cannot_be_used_in_an_already_ambient_context); } flags |= 2; @@ -24757,14 +25817,14 @@ var ts; if (flags & 128) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "abstract"); } - if (node.kind !== 218) { - if (node.kind !== 145 && - node.kind !== 143 && - node.kind !== 147 && - node.kind !== 148) { + if (node.kind !== 220) { + if (node.kind !== 146 && + node.kind !== 144 && + node.kind !== 148 && + node.kind !== 149) { return grammarErrorOnNode(modifier, ts.Diagnostics.abstract_modifier_can_only_appear_on_a_class_method_or_property_declaration); } - if (!(node.parent.kind === 218 && node.parent.flags & 128)) { + if (!(node.parent.kind === 220 && node.parent.flags & 128)) { return grammarErrorOnNode(modifier, ts.Diagnostics.Abstract_methods_can_only_appear_within_an_abstract_class); } if (flags & 32) { @@ -24783,7 +25843,7 @@ var ts; else if (flags & 2 || ts.isInAmbientContext(node.parent)) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_in_an_ambient_context, "async"); } - else if (node.kind === 140) { + else if (node.kind === 141) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "async"); } flags |= 256; @@ -24791,7 +25851,7 @@ var ts; break; } } - if (node.kind === 146) { + if (node.kind === 147) { if (flags & 32) { return grammarErrorOnNode(lastStatic, ts.Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration, "static"); } @@ -24806,10 +25866,10 @@ var ts; } return; } - else if ((node.kind === 226 || node.kind === 225) && flags & 2) { + else if ((node.kind === 229 || node.kind === 228) && flags & 2) { return grammarErrorOnNode(lastDeclare, ts.Diagnostics.A_0_modifier_cannot_be_used_with_an_import_declaration, "declare"); } - else if (node.kind === 140 && (flags & 28) && ts.isBindingPattern(node.name)) { + else if (node.kind === 141 && (flags & 28) && ts.isBindingPattern(node.name)) { return grammarErrorOnNode(node, ts.Diagnostics.A_parameter_property_may_not_be_a_binding_pattern); } if (flags & 256) { @@ -24821,10 +25881,10 @@ var ts; return grammarErrorOnNode(asyncModifier, ts.Diagnostics.Async_functions_are_only_available_when_targeting_ECMAScript_6_and_higher); } switch (node.kind) { - case 145: - case 217: - case 177: + case 146: + case 219: case 178: + case 179: if (!node.asteriskToken) { return false; } @@ -24889,7 +25949,7 @@ var ts; checkGrammarParameterList(node.parameters) || checkGrammarArrowFunction(node, file); } function checkGrammarArrowFunction(node, file) { - if (node.kind === 178) { + if (node.kind === 179) { var arrowFunction = node; var startLine = ts.getLineAndCharacterOfPosition(file, arrowFunction.equalsGreaterThanToken.pos).line; var endLine = ts.getLineAndCharacterOfPosition(file, arrowFunction.equalsGreaterThanToken.end).line; @@ -24951,7 +26011,7 @@ var ts; 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 === 191) { + if (arg.kind === 192) { return grammarErrorAtPos(sourceFile, arg.pos, 0, ts.Diagnostics.Argument_expression_expected); } } @@ -25022,19 +26082,19 @@ var ts; return false; } function checkGrammarComputedPropertyName(node) { - if (node.kind !== 138) { + if (node.kind !== 139) { return false; } var computedPropertyName = node; - if (computedPropertyName.expression.kind === 185 && computedPropertyName.expression.operatorToken.kind === 24) { + if (computedPropertyName.expression.kind === 186 && computedPropertyName.expression.operatorToken.kind === 24) { 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 === 217 || - node.kind === 177 || - node.kind === 145); + ts.Debug.assert(node.kind === 219 || + node.kind === 178 || + node.kind === 146); if (ts.isInAmbientContext(node)) { return grammarErrorOnNode(node.asteriskToken, ts.Diagnostics.Generators_are_not_allowed_in_an_ambient_context); } @@ -25058,58 +26118,58 @@ var ts; var SetAccessor = 4; var GetOrSetAccessor = GetAccessor | SetAccessor; var _loop_1 = function(prop) { - var name_18 = prop.name; - if (prop.kind === 191 || - name_18.kind === 138) { - checkGrammarComputedPropertyName(name_18); + var name_20 = prop.name; + if (prop.kind === 192 || + name_20.kind === 139) { + checkGrammarComputedPropertyName(name_20); return "continue"; } - if (prop.kind === 250 && !inDestructuring && prop.objectAssignmentInitializer) { + if (prop.kind === 253 && !inDestructuring && prop.objectAssignmentInitializer) { return { value: grammarErrorOnNode(prop.equalsToken, ts.Diagnostics.can_only_be_used_in_an_object_literal_property_inside_a_destructuring_assignment) }; } ts.forEach(prop.modifiers, function (mod) { - if (mod.kind !== 118 || prop.kind !== 145) { + if (mod.kind !== 118 || prop.kind !== 146) { grammarErrorOnNode(mod, ts.Diagnostics._0_modifier_cannot_be_used_here, ts.getTextOfNode(mod)); } }); var currentKind = void 0; - if (prop.kind === 249 || prop.kind === 250) { + if (prop.kind === 252 || prop.kind === 253) { checkGrammarForInvalidQuestionMark(prop, prop.questionToken, ts.Diagnostics.An_object_member_cannot_be_declared_optional); - if (name_18.kind === 8) { - checkGrammarNumericLiteral(name_18); + if (name_20.kind === 8) { + checkGrammarNumericLiteral(name_20); } currentKind = Property; } - else if (prop.kind === 145) { + else if (prop.kind === 146) { currentKind = Property; } - else if (prop.kind === 147) { + else if (prop.kind === 148) { currentKind = GetAccessor; } - else if (prop.kind === 148) { + else if (prop.kind === 149) { currentKind = SetAccessor; } else { ts.Debug.fail("Unexpected syntax kind:" + prop.kind); } - if (!ts.hasProperty(seen, name_18.text)) { - seen[name_18.text] = currentKind; + if (!ts.hasProperty(seen, name_20.text)) { + seen[name_20.text] = currentKind; } else { - var existingKind = seen[name_18.text]; + var existingKind = seen[name_20.text]; if (currentKind === Property && existingKind === Property) { return "continue"; } else if ((currentKind & GetOrSetAccessor) && (existingKind & GetOrSetAccessor)) { if (existingKind !== GetOrSetAccessor && currentKind !== existingKind) { - seen[name_18.text] = currentKind | existingKind; + seen[name_20.text] = currentKind | existingKind; } else { - return { value: grammarErrorOnNode(name_18, ts.Diagnostics.An_object_literal_cannot_have_multiple_get_Slashset_accessors_with_the_same_name) }; + return { value: grammarErrorOnNode(name_20, ts.Diagnostics.An_object_literal_cannot_have_multiple_get_Slashset_accessors_with_the_same_name) }; } } else { - return { value: grammarErrorOnNode(name_18, ts.Diagnostics.An_object_literal_cannot_have_property_and_accessor_with_the_same_name) }; + return { value: grammarErrorOnNode(name_20, ts.Diagnostics.An_object_literal_cannot_have_property_and_accessor_with_the_same_name) }; } } }; @@ -25117,26 +26177,25 @@ var ts; var prop = _a[_i]; var state_2 = _loop_1(prop); if (typeof state_2 === "object") return state_2.value; - if (state_2 === "continue") continue; } } function checkGrammarJsxElement(node) { var seen = {}; for (var _i = 0, _a = node.attributes; _i < _a.length; _i++) { var attr = _a[_i]; - if (attr.kind === 243) { + if (attr.kind === 246) { continue; } var jsxAttr = attr; - var name_19 = jsxAttr.name; - if (!ts.hasProperty(seen, name_19.text)) { - seen[name_19.text] = true; + var name_21 = jsxAttr.name; + if (!ts.hasProperty(seen, name_21.text)) { + seen[name_21.text] = true; } else { - return grammarErrorOnNode(name_19, ts.Diagnostics.JSX_elements_cannot_have_multiple_attributes_with_the_same_name); + return grammarErrorOnNode(name_21, ts.Diagnostics.JSX_elements_cannot_have_multiple_attributes_with_the_same_name); } var initializer = jsxAttr.initializer; - if (initializer && initializer.kind === 244 && !initializer.expression) { + if (initializer && initializer.kind === 247 && !initializer.expression) { return grammarErrorOnNode(jsxAttr.initializer, ts.Diagnostics.JSX_attributes_must_only_be_assigned_a_non_empty_expression); } } @@ -25145,7 +26204,7 @@ var ts; if (checkGrammarStatementInAmbientContext(forInOrOfStatement)) { return true; } - if (forInOrOfStatement.initializer.kind === 216) { + if (forInOrOfStatement.initializer.kind === 218) { var variableList = forInOrOfStatement.initializer; if (!checkGrammarVariableDeclarationList(variableList)) { var declarations = variableList.declarations; @@ -25153,20 +26212,20 @@ var ts; return false; } if (declarations.length > 1) { - var diagnostic = forInOrOfStatement.kind === 204 + var diagnostic = forInOrOfStatement.kind === 206 ? 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 === 204 + var diagnostic = forInOrOfStatement.kind === 206 ? 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 === 204 + var diagnostic = forInOrOfStatement.kind === 206 ? 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); @@ -25189,10 +26248,10 @@ var ts; else if (accessor.typeParameters) { return grammarErrorOnNode(accessor.name, ts.Diagnostics.An_accessor_cannot_have_type_parameters); } - else if (kind === 147 && accessor.parameters.length) { + else if (kind === 148 && accessor.parameters.length) { return grammarErrorOnNode(accessor.name, ts.Diagnostics.A_get_accessor_cannot_have_parameters); } - else if (kind === 148) { + else if (kind === 149) { if (accessor.type) { return grammarErrorOnNode(accessor.name, ts.Diagnostics.A_set_accessor_cannot_have_a_return_type_annotation); } @@ -25227,7 +26286,7 @@ var ts; checkGrammarForGenerator(node)) { return true; } - if (node.parent.kind === 169) { + if (node.parent.kind === 170) { if (checkGrammarForInvalidQuestionMark(node, node.questionToken, ts.Diagnostics.A_class_member_cannot_be_declared_optional)) { return true; } @@ -25246,10 +26305,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 === 219) { + else if (node.parent.kind === 221) { 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 === 157) { + else if (node.parent.kind === 158) { return checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_a_type_literal_must_directly_refer_to_a_built_in_symbol); } } @@ -25260,9 +26319,9 @@ var ts; return grammarErrorOnNode(node, ts.Diagnostics.Jump_target_cannot_cross_function_boundary); } switch (current.kind) { - case 211: + case 213: if (node.label && current.label.text === node.label.text) { - var isMisplacedContinueLabel = node.kind === 206 + var isMisplacedContinueLabel = node.kind === 208 && !ts.isIterationStatement(current.statement, true); if (isMisplacedContinueLabel) { return grammarErrorOnNode(node, ts.Diagnostics.A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement); @@ -25270,8 +26329,8 @@ var ts; return false; } break; - case 210: - if (node.kind === 207 && !node.label) { + case 212: + if (node.kind === 209 && !node.label) { return false; } break; @@ -25284,13 +26343,13 @@ var ts; current = current.parent; } if (node.label) { - var message = node.kind === 207 + var message = node.kind === 209 ? 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 === 207 + var message = node.kind === 209 ? 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); @@ -25302,7 +26361,7 @@ var ts; if (node !== ts.lastOrUndefined(elements)) { return grammarErrorOnNode(node, ts.Diagnostics.A_rest_element_must_be_last_in_an_array_destructuring_pattern); } - if (node.name.kind === 166 || node.name.kind === 165) { + if (node.name.kind === 167 || node.name.kind === 166) { return grammarErrorOnNode(node.name, ts.Diagnostics.A_rest_element_cannot_contain_a_binding_pattern); } if (node.initializer) { @@ -25311,7 +26370,7 @@ var ts; } } function checkGrammarVariableDeclaration(node) { - if (node.parent.parent.kind !== 204 && node.parent.parent.kind !== 205) { + if (node.parent.parent.kind !== 206 && node.parent.parent.kind !== 207) { if (ts.isInAmbientContext(node)) { if (node.initializer) { var equalsTokenLength = "=".length; @@ -25340,7 +26399,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 !== 191) { + if (element.kind !== 192) { checkGrammarNameInLetOrConstDeclarations(element.name); } } @@ -25357,15 +26416,15 @@ var ts; } function allowLetAndConstDeclarations(parent) { switch (parent.kind) { - case 200: - case 201: case 202: - case 209: case 203: case 204: - case 205: - return false; case 211: + case 205: + case 206: + case 207: + return false; + case 213: return allowLetAndConstDeclarations(parent.parent); } return true; @@ -25421,7 +26480,7 @@ var ts; return true; } } - else if (node.parent.kind === 219) { + else if (node.parent.kind === 221) { if (checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_an_interface_must_directly_refer_to_a_built_in_symbol)) { return true; } @@ -25429,7 +26488,7 @@ var ts; return grammarErrorOnNode(node.initializer, ts.Diagnostics.An_interface_property_cannot_have_an_initializer); } } - else if (node.parent.kind === 157) { + else if (node.parent.kind === 158) { if (checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_a_type_literal_must_directly_refer_to_a_built_in_symbol)) { return true; } @@ -25442,12 +26501,12 @@ var ts; } } function checkGrammarTopLevelElementForRequiredDeclareModifier(node) { - if (node.kind === 219 || - node.kind === 220 || - node.kind === 226 || - node.kind === 225 || - node.kind === 232 || - node.kind === 231 || + if (node.kind === 221 || + node.kind === 222 || + node.kind === 229 || + node.kind === 228 || + node.kind === 235 || + node.kind === 234 || (node.flags & 2) || (node.flags & (1 | 512))) { return false; @@ -25457,7 +26516,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 === 197) { + if (ts.isDeclaration(decl) || decl.kind === 199) { if (checkGrammarTopLevelElementForRequiredDeclareModifier(decl)) { return true; } @@ -25476,7 +26535,7 @@ var ts; if (!links.hasReportedStatementInAmbientContext && ts.isFunctionLike(node.parent)) { return getNodeLinks(node).hasReportedStatementInAmbientContext = grammarErrorOnFirstToken(node, ts.Diagnostics.An_implementation_cannot_be_declared_in_ambient_contexts); } - if (node.parent.kind === 196 || node.parent.kind === 223 || node.parent.kind === 252) { + if (node.parent.kind === 198 || node.parent.kind === 225 || node.parent.kind === 255) { var links_1 = getNodeLinks(node.parent); if (!links_1.hasReportedStatementInAmbientContext) { return links_1.hasReportedStatementInAmbientContext = grammarErrorOnFirstToken(node, ts.Diagnostics.Statements_are_not_allowed_in_ambient_contexts); @@ -25772,7 +26831,7 @@ var ts; function getDeclarationDiagnostics(host, resolver, targetSourceFile) { var declarationDiagnostics = ts.createDiagnosticCollection(); ts.forEachExpectedEmitFile(host, getDeclarationDiagnosticsFromFile, targetSourceFile); - return declarationDiagnostics.getDiagnostics(targetSourceFile.fileName); + return declarationDiagnostics.getDiagnostics(targetSourceFile ? targetSourceFile.fileName : undefined); function getDeclarationDiagnosticsFromFile(_a, sources, isBundledEmit) { var declarationFilePath = _a.declarationFilePath; emitDeclarations(host, resolver, declarationDiagnostics, declarationFilePath, sources, isBundledEmit); @@ -25840,7 +26899,7 @@ var ts; var oldWriter = writer; ts.forEach(moduleElementDeclarationEmitInfo, function (aliasEmitInfo) { if (aliasEmitInfo.isVisible && !aliasEmitInfo.asynchronousOutput) { - ts.Debug.assert(aliasEmitInfo.node.kind === 226); + ts.Debug.assert(aliasEmitInfo.node.kind === 229); createAndSetNewTextWriterWithSymbolWriter(); ts.Debug.assert(aliasEmitInfo.indent === 0 || (aliasEmitInfo.indent === 1 && isBundledEmit)); for (var i = 0; i < aliasEmitInfo.indent; i++) { @@ -25906,10 +26965,10 @@ var ts; var oldWriter = writer; ts.forEach(nodes, function (declaration) { var nodeToCheck; - if (declaration.kind === 215) { + if (declaration.kind === 217) { nodeToCheck = declaration.parent.parent; } - else if (declaration.kind === 229 || declaration.kind === 230 || declaration.kind === 227) { + else if (declaration.kind === 232 || declaration.kind === 233 || declaration.kind === 230) { ts.Debug.fail("We should be getting ImportDeclaration instead to write"); } else { @@ -25920,7 +26979,7 @@ var ts; moduleElementEmitInfo = ts.forEach(asynchronousSubModuleDeclarationEmitInfo, function (declEmitInfo) { return declEmitInfo.node === nodeToCheck ? declEmitInfo : undefined; }); } if (moduleElementEmitInfo) { - if (moduleElementEmitInfo.node.kind === 226) { + if (moduleElementEmitInfo.node.kind === 229) { moduleElementEmitInfo.isVisible = true; } else { @@ -25928,12 +26987,12 @@ var ts; for (var declarationIndent = moduleElementEmitInfo.indent; declarationIndent; declarationIndent--) { increaseIndent(); } - if (nodeToCheck.kind === 222) { + if (nodeToCheck.kind === 224) { ts.Debug.assert(asynchronousSubModuleDeclarationEmitInfo === undefined); asynchronousSubModuleDeclarationEmitInfo = []; } writeModuleElement(nodeToCheck); - if (nodeToCheck.kind === 222) { + if (nodeToCheck.kind === 224) { moduleElementEmitInfo.subModuleElementDeclarationEmitInfo = asynchronousSubModuleDeclarationEmitInfo; asynchronousSubModuleDeclarationEmitInfo = undefined; } @@ -26036,35 +27095,37 @@ var ts; case 120: case 132: case 103: - case 163: + case 134: + case 93: case 164: + case 165: return writeTextOfNode(currentText, type); - case 192: + case 193: return emitExpressionWithTypeArguments(type); - case 153: - return emitTypeReference(type); - case 156: - return emitTypeQuery(type); - case 158: - return emitArrayType(type); - case 159: - return emitTupleType(type); - case 160: - return emitUnionType(type); - case 161: - return emitIntersectionType(type); - case 162: - return emitParenType(type); case 154: - case 155: - return emitSignatureDeclarationWithJsDocComments(type); + return emitTypeReference(type); case 157: + return emitTypeQuery(type); + case 159: + return emitArrayType(type); + case 160: + return emitTupleType(type); + case 161: + return emitUnionType(type); + case 162: + return emitIntersectionType(type); + case 163: + return emitParenType(type); + case 155: + case 156: + return emitSignatureDeclarationWithJsDocComments(type); + case 158: return emitTypeLiteral(type); case 69: return emitEntityName(type); - case 137: + case 138: return emitEntityName(type); - case 152: + case 153: return emitTypePredicate(type); } function writeEntityName(entityName) { @@ -26072,21 +27133,21 @@ var ts; writeTextOfNode(currentText, entityName); } else { - var left = entityName.kind === 137 ? entityName.left : entityName.expression; - var right = entityName.kind === 137 ? entityName.right : entityName.name; + var left = entityName.kind === 138 ? entityName.left : entityName.expression; + var right = entityName.kind === 138 ? entityName.right : entityName.name; writeEntityName(left); write("."); writeTextOfNode(currentText, right); } } function emitEntityName(entityName) { - var visibilityResult = resolver.isEntityNameVisible(entityName, entityName.parent.kind === 225 ? entityName.parent : enclosingDeclaration); + var visibilityResult = resolver.isEntityNameVisible(entityName, entityName.parent.kind === 228 ? entityName.parent : enclosingDeclaration); handleSymbolAccessibilityError(visibilityResult); writeEntityName(entityName); } function emitExpressionWithTypeArguments(node) { if (ts.isSupportedExpressionWithTypeArguments(node)) { - ts.Debug.assert(node.expression.kind === 69 || node.expression.kind === 170); + ts.Debug.assert(node.expression.kind === 69 || node.expression.kind === 171); emitEntityName(node.expression); if (node.typeArguments) { write("<"); @@ -26160,9 +27221,9 @@ var ts; var count = 0; while (true) { count++; - var name_20 = baseName + "_" + count; - if (!ts.hasProperty(currentIdentifiers, name_20)) { - return name_20; + var name_22 = baseName + "_" + count; + if (!ts.hasProperty(currentIdentifiers, name_22)) { + return name_22; } } } @@ -26173,7 +27234,10 @@ var ts; } else { var tempVarName = getExportDefaultTempVariableName(); - write("declare var "); + if (!noDeclare) { + write("declare "); + } + write("var "); write(tempVarName); write(": "); writer.getSymbolAccessibilityDiagnostic = getDefaultExportAccessibilityDiagnostic; @@ -26203,10 +27267,10 @@ var ts; if (isModuleElementVisible) { writeModuleElement(node); } - else if (node.kind === 225 || - (node.parent.kind === 252 && isCurrentFileExternalModule)) { + else if (node.kind === 228 || + (node.parent.kind === 255 && isCurrentFileExternalModule)) { var isVisible = void 0; - if (asynchronousSubModuleDeclarationEmitInfo && node.parent.kind !== 252) { + if (asynchronousSubModuleDeclarationEmitInfo && node.parent.kind !== 255) { asynchronousSubModuleDeclarationEmitInfo.push({ node: node, outputPos: writer.getTextPos(), @@ -26215,7 +27279,7 @@ var ts; }); } else { - if (node.kind === 226) { + if (node.kind === 229) { var importDeclaration = node; if (importDeclaration.importClause) { isVisible = (importDeclaration.importClause.name && resolver.isDeclarationVisible(importDeclaration.importClause)) || @@ -26233,37 +27297,37 @@ var ts; } function writeModuleElement(node) { switch (node.kind) { - case 217: - return writeFunctionDeclaration(node); - case 197: - return writeVariableStatement(node); case 219: - return writeInterfaceDeclaration(node); - case 218: - return writeClassDeclaration(node); - case 220: - return writeTypeAliasDeclaration(node); + return writeFunctionDeclaration(node); + case 199: + return writeVariableStatement(node); case 221: - return writeEnumDeclaration(node); + return writeInterfaceDeclaration(node); + case 220: + return writeClassDeclaration(node); case 222: + return writeTypeAliasDeclaration(node); + case 223: + return writeEnumDeclaration(node); + case 224: return writeModuleDeclaration(node); - case 225: + case 228: return writeImportEqualsDeclaration(node); - case 226: + case 229: return writeImportDeclaration(node); default: ts.Debug.fail("Unknown symbol kind"); } } function emitModuleElementDeclarationFlags(node) { - if (node.parent.kind === 252) { + if (node.parent.kind === 255) { if (node.flags & 1) { write("export "); } if (node.flags & 512) { write("default "); } - else if (node.kind !== 219 && !noDeclare) { + else if (node.kind !== 221 && !noDeclare) { write("declare "); } } @@ -26313,7 +27377,7 @@ var ts; } function isVisibleNamedBinding(namedBindings) { if (namedBindings) { - if (namedBindings.kind === 228) { + if (namedBindings.kind === 231) { return resolver.isDeclarationVisible(namedBindings); } else { @@ -26336,7 +27400,7 @@ var ts; if (currentWriterPos !== writer.getTextPos()) { write(", "); } - if (node.importClause.namedBindings.kind === 228) { + if (node.importClause.namedBindings.kind === 231) { write("* as "); writeTextOfNode(currentText, node.importClause.namedBindings.name); } @@ -26353,13 +27417,13 @@ var ts; writer.writeLine(); } function emitExternalModuleSpecifier(parent) { - resultHasExternalModuleIndicator = resultHasExternalModuleIndicator || parent.kind !== 222; + resultHasExternalModuleIndicator = resultHasExternalModuleIndicator || parent.kind !== 224; var moduleSpecifier; - if (parent.kind === 225) { + if (parent.kind === 228) { var node = parent; moduleSpecifier = ts.getExternalModuleImportEqualsDeclarationExpression(node); } - else if (parent.kind === 222) { + else if (parent.kind === 224) { moduleSpecifier = parent.name; } else { @@ -26369,9 +27433,9 @@ var ts; if (moduleSpecifier.kind === 9 && isBundledEmit && (compilerOptions.out || compilerOptions.outFile)) { var moduleName = ts.getExternalModuleNameFromDeclaration(host, resolver, parent); if (moduleName) { - write("\""); + write('"'); write(moduleName); - write("\""); + write('"'); return; } } @@ -26427,7 +27491,7 @@ var ts; writeTextOfNode(currentText, node.name); } } - while (node.body.kind !== 223) { + while (node.body.kind !== 225) { node = node.body; write("."); writeTextOfNode(currentText, node.name); @@ -26492,7 +27556,7 @@ var ts; writeLine(); } function isPrivateMethodTypeParameter(node) { - return node.parent.kind === 145 && (node.parent.flags & 8); + return node.parent.kind === 146 && (node.parent.flags & 8); } function emitTypeParameters(typeParameters) { function emitTypeParameter(node) { @@ -26502,15 +27566,15 @@ var ts; writeTextOfNode(currentText, node.name); if (node.constraint && !isPrivateMethodTypeParameter(node)) { write(" extends "); - if (node.parent.kind === 154 || - node.parent.kind === 155 || - (node.parent.parent && node.parent.parent.kind === 157)) { - ts.Debug.assert(node.parent.kind === 145 || - node.parent.kind === 144 || - node.parent.kind === 154 || + if (node.parent.kind === 155 || + node.parent.kind === 156 || + (node.parent.parent && node.parent.parent.kind === 158)) { + ts.Debug.assert(node.parent.kind === 146 || + node.parent.kind === 145 || node.parent.kind === 155 || - node.parent.kind === 149 || - node.parent.kind === 150); + node.parent.kind === 156 || + node.parent.kind === 150 || + node.parent.kind === 151); emitType(node.constraint); } else { @@ -26520,31 +27584,31 @@ var ts; function getTypeParameterConstraintVisibilityError(symbolAccessibilityResult) { var diagnosticMessage; switch (node.parent.kind) { - case 218: + case 220: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_class_has_or_is_using_private_name_1; break; - case 219: + case 221: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1; break; - case 150: + case 151: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1; break; - case 149: + case 150: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1; break; + case 146: case 145: - case 144: if (node.parent.flags & 32) { 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 === 218) { + else if (node.parent.parent.kind === 220) { 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 217: + case 219: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_function_has_or_is_using_private_name_1; break; default: @@ -26575,9 +27639,13 @@ var ts; else if (!isImplementsList && node.expression.kind === 93) { write("null"); } + else { + writer.getSymbolAccessibilityDiagnostic = getHeritageClauseVisibilityError; + resolver.writeBaseConstructorTypeOfClass(enclosingDeclaration, enclosingDeclaration, 2, writer); + } function getHeritageClauseVisibilityError(symbolAccessibilityResult) { var diagnosticMessage; - if (node.parent.parent.kind === 218) { + if (node.parent.parent.kind === 220) { 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; @@ -26657,16 +27725,16 @@ var ts; writeLine(); } function emitVariableDeclaration(node) { - if (node.kind !== 215 || resolver.isDeclarationVisible(node)) { + if (node.kind !== 217 || resolver.isDeclarationVisible(node)) { if (ts.isBindingPattern(node.name)) { emitBindingPattern(node.name); } else { writeTextOfNode(currentText, node.name); - if ((node.kind === 143 || node.kind === 142) && ts.hasQuestionToken(node)) { + if ((node.kind === 144 || node.kind === 143) && ts.hasQuestionToken(node)) { write("?"); } - if ((node.kind === 143 || node.kind === 142) && node.parent.kind === 157) { + if ((node.kind === 144 || node.kind === 143) && node.parent.kind === 158) { emitTypeOfVariableDeclarationFromTypeLiteral(node); } else if (!(node.flags & 8)) { @@ -26675,14 +27743,14 @@ var ts; } } function getVariableDeclarationTypeVisibilityDiagnosticMessage(symbolAccessibilityResult) { - if (node.kind === 215) { + if (node.kind === 217) { return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 ? 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 === 143 || node.kind === 142) { + else if (node.kind === 144 || node.kind === 143) { if (node.flags & 32) { return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 ? @@ -26690,7 +27758,7 @@ var ts; 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 === 218) { + else if (node.parent.kind === 220) { return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 ? ts.Diagnostics.Public_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : @@ -26716,7 +27784,7 @@ var ts; var elements = []; for (var _i = 0, _a = bindingPattern.elements; _i < _a.length; _i++) { var element = _a[_i]; - if (element.kind !== 191) { + if (element.kind !== 192) { elements.push(element); } } @@ -26782,7 +27850,7 @@ var ts; accessorWithTypeAnnotation = node; var type = getTypeAnnotationFromAccessor(node); if (!type) { - var anotherAccessor = node.kind === 147 ? accessors.setAccessor : accessors.getAccessor; + var anotherAccessor = node.kind === 148 ? accessors.setAccessor : accessors.getAccessor; type = getTypeAnnotationFromAccessor(anotherAccessor); if (type) { accessorWithTypeAnnotation = anotherAccessor; @@ -26795,7 +27863,7 @@ var ts; } function getTypeAnnotationFromAccessor(accessor) { if (accessor) { - return accessor.kind === 147 + return accessor.kind === 148 ? accessor.type : accessor.parameters.length > 0 ? accessor.parameters[0].type @@ -26804,7 +27872,7 @@ var ts; } function getAccessorDeclarationTypeVisibilityError(symbolAccessibilityResult) { var diagnosticMessage; - if (accessorWithTypeAnnotation.kind === 148) { + if (accessorWithTypeAnnotation.kind === 149) { if (accessorWithTypeAnnotation.parent.flags & 32) { 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 : @@ -26850,17 +27918,17 @@ var ts; } if (!resolver.isImplementationOfOverload(node)) { emitJsDocComments(node); - if (node.kind === 217) { + if (node.kind === 219) { emitModuleElementDeclarationFlags(node); } - else if (node.kind === 145 || node.kind === 146) { + else if (node.kind === 146 || node.kind === 147) { emitClassMemberDeclarationFlags(node.flags); } - if (node.kind === 217) { + if (node.kind === 219) { write("function "); writeTextOfNode(currentText, node.name); } - else if (node.kind === 146) { + else if (node.kind === 147) { write("constructor"); } else { @@ -26879,32 +27947,32 @@ var ts; function emitSignatureDeclaration(node) { var prevEnclosingDeclaration = enclosingDeclaration; enclosingDeclaration = node; - if (node.kind === 151) { + if (node.kind === 152) { emitClassMemberDeclarationFlags(node.flags); write("["); } else { - if (node.kind === 150 || node.kind === 155) { + if (node.kind === 151 || node.kind === 156) { write("new "); } emitTypeParameters(node.typeParameters); write("("); } emitCommaList(node.parameters, emitParameterDeclaration); - if (node.kind === 151) { + if (node.kind === 152) { write("]"); } else { write(")"); } - var isFunctionTypeOrConstructorType = node.kind === 154 || node.kind === 155; - if (isFunctionTypeOrConstructorType || node.parent.kind === 157) { + var isFunctionTypeOrConstructorType = node.kind === 155 || node.kind === 156; + if (isFunctionTypeOrConstructorType || node.parent.kind === 158) { if (node.type) { write(isFunctionTypeOrConstructorType ? " => " : ": "); emitType(node.type); } } - else if (node.kind !== 146 && !(node.flags & 8)) { + else if (node.kind !== 147 && !(node.flags & 8)) { writeReturnTypeAtSignature(node, getReturnTypeVisibilityError); } enclosingDeclaration = prevEnclosingDeclaration; @@ -26915,23 +27983,23 @@ var ts; function getReturnTypeVisibilityError(symbolAccessibilityResult) { var diagnosticMessage; switch (node.kind) { - case 150: + case 151: 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 149: + case 150: 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 151: + case 152: 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 146: case 145: - case 144: if (node.flags & 32) { diagnosticMessage = symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 ? @@ -26939,7 +28007,7 @@ var ts; 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 === 218) { + else if (node.parent.kind === 220) { diagnosticMessage = symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 ? ts.Diagnostics.Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : @@ -26952,7 +28020,7 @@ var ts; ts.Diagnostics.Return_type_of_method_from_exported_interface_has_or_is_using_private_name_0; } break; - case 217: + case 219: diagnosticMessage = symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 ? ts.Diagnostics.Return_type_of_exported_function_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : @@ -26984,9 +28052,9 @@ var ts; write("?"); } decreaseIndent(); - if (node.parent.kind === 154 || - node.parent.kind === 155 || - node.parent.parent.kind === 157) { + if (node.parent.kind === 155 || + node.parent.kind === 156 || + node.parent.parent.kind === 158) { emitTypeOfVariableDeclarationFromTypeLiteral(node); } else if (!(node.parent.flags & 8)) { @@ -27002,22 +28070,22 @@ var ts; } function getParameterDeclarationTypeVisibilityDiagnosticMessage(symbolAccessibilityResult) { switch (node.parent.kind) { - case 146: + case 147: return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 ? 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 150: + case 151: 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 149: + case 150: 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 146: case 145: - case 144: if (node.parent.flags & 32) { return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 ? @@ -27025,7 +28093,7 @@ var ts; 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 === 218) { + else if (node.parent.parent.kind === 220) { return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 ? ts.Diagnostics.Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : @@ -27037,7 +28105,7 @@ var ts; 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 217: + case 219: return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 ? ts.Diagnostics.Parameter_0_of_exported_function_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : @@ -27048,12 +28116,12 @@ var ts; } } function emitBindingPattern(bindingPattern) { - if (bindingPattern.kind === 165) { + if (bindingPattern.kind === 166) { write("{"); emitCommaList(bindingPattern.elements, emitBindingElement); write("}"); } - else if (bindingPattern.kind === 166) { + else if (bindingPattern.kind === 167) { write("["); var elements = bindingPattern.elements; emitCommaList(elements, emitBindingElement); @@ -27064,10 +28132,10 @@ var ts; } } function emitBindingElement(bindingElement) { - if (bindingElement.kind === 191) { + if (bindingElement.kind === 192) { write(" "); } - else if (bindingElement.kind === 167) { + else if (bindingElement.kind === 168) { if (bindingElement.propertyName) { writeTextOfNode(currentText, bindingElement.propertyName); write(": "); @@ -27089,39 +28157,39 @@ var ts; } function emitNode(node) { switch (node.kind) { - case 217: - case 222: - case 225: case 219: - case 218: - case 220: + case 224: + case 228: case 221: + case 220: + case 222: + case 223: return emitModuleElement(node, isModuleElementVisible(node)); - case 197: + case 199: return emitModuleElement(node, isVariableStatementVisible(node)); - case 226: + case 229: return emitModuleElement(node, !node.importClause); - case 232: + case 235: return emitExportDeclaration(node); + case 147: case 146: case 145: - case 144: return writeFunctionDeclaration(node); - case 150: - case 149: case 151: + case 150: + case 152: return emitSignatureDeclarationWithJsDocComments(node); - case 147: case 148: + case 149: return emitAccessorDeclaration(node); + case 144: case 143: - case 142: return emitPropertyDeclaration(node); - case 251: + case 254: return emitEnumMemberDeclaration(node); - case 231: + case 234: return emitExportAssignment(node); - case 252: + case 255: return emitSourceFile(node); } } @@ -27136,7 +28204,7 @@ var ts; } if (declFileName) { declFileName = ts.getRelativePathToDirectoryOrUrl(ts.getDirectoryPath(ts.normalizeSlashes(declarationFilePath)), declFileName, host.getCurrentDirectory(), host.getCanonicalFileName, false); - referencePathsOutput += "/// " + newLine; + referencePathsOutput += '/// ' + newLine; } return addedBundledEmitReference; function getDeclFileName(emitFileNames, sourceFiles, isBundledEmit) { @@ -27445,6 +28513,7 @@ var ts; }; function emitFiles(resolver, host, targetSourceFile) { var extendsHelper = "\nvar __extends = (this && this.__extends) || function (d, b) {\n for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n};"; + var assignHelper = "\nvar __assign = (this && this.__assign) || Object.assign || function(t) {\n for (var s, i = 1, n = arguments.length; i < n; i++) {\n s = arguments[i];\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))\n t[p] = s[p];\n }\n return t;\n};"; var decorateHelper = "\nvar __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};"; var metadataHelper = "\nvar __metadata = (this && this.__metadata) || function (k, v) {\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(k, v);\n};"; var paramHelper = "\nvar __param = (this && this.__param) || function (paramIndex, decorator) {\n return function (target, key) { decorator(target, key, paramIndex); }\n};"; @@ -27453,6 +28522,7 @@ var ts; 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(); @@ -27461,6 +28531,7 @@ var ts; return { emitSkipped: emitSkipped, diagnostics: emitterDiagnostics.getDiagnostics(), + emittedFiles: emittedFilesList, sourceMaps: sourceMapDataList }; function isUniqueLocalName(name, container) { @@ -27524,6 +28595,7 @@ var ts; var decoratedClassAliases; var convertedLoopState; var extendsEmitted; + var assignEmitted; var decorateEmitted; var paramEmitted; var awaiterEmitted; @@ -27571,7 +28643,7 @@ var ts; if (sourceMappingURL) { write("//# sourceMappingURL=" + sourceMappingURL); } - writeEmittedFiles(writer.getText(), jsFilePath, sourceMapFilePath, compilerOptions.emitBOM); + writeEmittedFiles(writer.getText(), jsFilePath, sourceMapFilePath, compilerOptions.emitBOM, sourceFiles); sourceMap.reset(); writer.reset(); currentSourceFile = undefined; @@ -27588,6 +28660,7 @@ var ts; decorateEmitted = false; paramEmitted = false; awaiterEmitted = false; + assignEmitted = false; tempFlags = 0; tempVariables = undefined; tempParameters = undefined; @@ -27621,19 +28694,19 @@ var ts; } function makeTempVariableName(flags) { if (flags && !(tempFlags & flags)) { - var name_21 = flags === 268435456 ? "_i" : "_n"; - if (isUniqueName(name_21)) { + var name_23 = flags === 268435456 ? "_i" : "_n"; + if (isUniqueName(name_23)) { tempFlags |= flags; - return name_21; + return name_23; } } while (true) { var count = tempFlags & 268435455; tempFlags++; if (count !== 8 && count !== 13) { - var name_22 = count < 26 ? "_" + String.fromCharCode(97 + count) : "_" + (count - 26); - if (isUniqueName(name_22)) { - return name_22; + var name_24 = count < 26 ? "_" + String.fromCharCode(97 + count) : "_" + (count - 26); + if (isUniqueName(name_24)) { + return name_24; } } } @@ -27671,17 +28744,17 @@ var ts; switch (node.kind) { case 69: return makeUniqueName(node.text); - case 222: - case 221: + case 224: + case 223: return generateNameForModuleOrEnum(node); - case 226: - case 232: + case 229: + case 235: return generateNameForImportOrExportDeclaration(node); - case 217: - case 218: - case 231: + case 219: + case 220: + case 234: return generateNameForExportDefault(); - case 190: + case 191: return generateNameForClassExpression(); } } @@ -27689,14 +28762,14 @@ var ts; var id = ts.getNodeId(node); return nodeToGeneratedName[id] || (nodeToGeneratedName[id] = ts.unescapeIdentifier(generateNameForNode(node))); } - function writeEmittedFiles(emitOutput, jsFilePath, sourceMapFilePath, writeByteOrderMark) { + function writeEmittedFiles(emitOutput, jsFilePath, sourceMapFilePath, writeByteOrderMark, sourceFiles) { if (compilerOptions.sourceMap && !compilerOptions.inlineSourceMap) { - ts.writeFile(host, emitterDiagnostics, sourceMapFilePath, sourceMap.getText(), false); + ts.writeFile(host, emitterDiagnostics, sourceMapFilePath, sourceMap.getText(), false, sourceFiles); } if (sourceMapDataList) { sourceMapDataList.push(sourceMap.getSourceMapData()); } - ts.writeFile(host, emitterDiagnostics, jsFilePath, emitOutput, writeByteOrderMark); + ts.writeFile(host, emitterDiagnostics, jsFilePath, emitOutput, writeByteOrderMark, sourceFiles); } function createTempVariable(flags) { var result = ts.createSynthesizedNode(69); @@ -27861,14 +28934,14 @@ var ts; } function getLiteralText(node) { if (languageVersion < 2 && (ts.isTemplateLiteralKind(node.kind) || node.hasExtendedUnicodeEscape)) { - return getQuotedEscapedLiteralText("\"", node.text, "\""); + return getQuotedEscapedLiteralText('"', node.text, '"'); } if (node.parent) { return ts.getTextOfNodeFromSourceText(currentText, node); } switch (node.kind) { case 9: - return getQuotedEscapedLiteralText("\"", node.text, "\""); + return getQuotedEscapedLiteralText('"', node.text, '"'); case 11: return getQuotedEscapedLiteralText("`", node.text, "`"); case 12: @@ -27921,10 +28994,10 @@ var ts; emitParenthesizedIf(node.tag, needsParenthesisForPropertyAccessOrInvocation(node.tag)); write("("); emit(tempVariable); - if (node.template.kind === 187) { + if (node.template.kind === 188) { ts.forEach(node.template.templateSpans, function (templateSpan) { write(", "); - var needsParens = templateSpan.expression.kind === 185 + var needsParens = templateSpan.expression.kind === 186 && templateSpan.expression.operatorToken.kind === 24; emitParenthesizedIf(templateSpan.expression, needsParens); }); @@ -27948,7 +29021,7 @@ var ts; } for (var i = 0, n = node.templateSpans.length; i < n; i++) { var templateSpan = node.templateSpans[i]; - var needsParens = templateSpan.expression.kind !== 176 + var needsParens = templateSpan.expression.kind !== 177 && comparePrecedenceToBinaryPlus(templateSpan.expression) !== 1; if (i > 0 || headEmitted) { write(" + "); @@ -27968,11 +29041,11 @@ var ts; } function templateNeedsParens(template, parent) { switch (parent.kind) { - case 172: case 173: - return parent.expression === template; case 174: - case 176: + return parent.expression === template; + case 175: + case 177: return false; default: return comparePrecedenceToBinaryPlus(parent) !== -1; @@ -27980,7 +29053,7 @@ var ts; } function comparePrecedenceToBinaryPlus(expression) { switch (expression.kind) { - case 185: + case 186: switch (expression.operatorToken.kind) { case 37: case 39: @@ -27992,8 +29065,8 @@ var ts; default: return -1; } - case 188: - case 186: + case 189: + case 187: return -1; default: return 1; @@ -28007,9 +29080,9 @@ var ts; function jsxEmitReact(node) { function emitTagName(name) { if (name.kind === 69 && ts.isIntrinsicJsxName(name.text)) { - write("\""); + write('"'); emit(name); - write("\""); + write('"'); } else { emit(name); @@ -28020,9 +29093,9 @@ var ts; emit(name); } else { - write("\""); + write('"'); emit(name); - write("\""); + write('"'); } } function emitJsxAttribute(node) { @@ -28049,12 +29122,11 @@ var ts; } else { var attrs = openingNode.attributes; - if (ts.forEach(attrs, function (attr) { return attr.kind === 243; })) { - emitExpressionIdentifier(syntheticReactRef); - write(".__spread("); + if (ts.forEach(attrs, function (attr) { return attr.kind === 246; })) { + write("__assign("); var haveOpenedObjectLiteral = false; for (var i = 0; i < attrs.length; i++) { - if (attrs[i].kind === 243) { + if (attrs[i].kind === 246) { if (i === 0) { write("{}, "); } @@ -28068,7 +29140,7 @@ var ts; emit(attrs[i].expression); } else { - ts.Debug.assert(attrs[i].kind === 242); + ts.Debug.assert(attrs[i].kind === 245); if (haveOpenedObjectLiteral) { write(", "); } @@ -28124,7 +29196,7 @@ var ts; decreaseIndent(); } else if (firstChild) { - if (firstChild.kind !== 237 && firstChild.kind !== 238) { + if (firstChild.kind !== 240 && firstChild.kind !== 241) { emit(firstChild); } else { @@ -28139,11 +29211,11 @@ var ts; write(")"); emitTrailingComments(openingNode); } - if (node.kind === 237) { + if (node.kind === 240) { emitJsxElement(node.openingElement, node.children); } else { - ts.Debug.assert(node.kind === 238); + ts.Debug.assert(node.kind === 241); emitJsxElement(node); } } @@ -28165,11 +29237,11 @@ var ts; if (i > 0) { write(" "); } - if (attribs[i].kind === 243) { + if (attribs[i].kind === 246) { emitJsxSpreadAttribute(attribs[i]); } else { - ts.Debug.assert(attribs[i].kind === 242); + ts.Debug.assert(attribs[i].kind === 245); emitJsxAttribute(attribs[i]); } } @@ -28177,11 +29249,11 @@ var ts; function emitJsxOpeningOrSelfClosingElement(node) { write("<"); emit(node.tagName); - if (node.attributes.length > 0 || (node.kind === 238)) { + if (node.attributes.length > 0 || (node.kind === 241)) { write(" "); } emitAttributes(node.attributes); - if (node.kind === 238) { + if (node.kind === 241) { write("/>"); } else { @@ -28200,20 +29272,20 @@ var ts; } emitJsxClosingElement(node.closingElement); } - if (node.kind === 237) { + if (node.kind === 240) { emitJsxElement(node); } else { - ts.Debug.assert(node.kind === 238); + ts.Debug.assert(node.kind === 241); emitJsxOpeningOrSelfClosingElement(node); } } function emitExpressionForPropertyName(node) { - ts.Debug.assert(node.kind !== 167); + ts.Debug.assert(node.kind !== 168); if (node.kind === 9) { emitLiteral(node); } - else if (node.kind === 138) { + else if (node.kind === 139) { if (ts.nodeIsDecorated(node.parent)) { if (!computedPropertyNamesToGeneratedNames) { computedPropertyNamesToGeneratedNames = []; @@ -28231,75 +29303,76 @@ var ts; emit(node.expression); } else { - write("\""); + write('"'); if (node.kind === 8) { write(node.text); } else { writeTextOfNode(currentText, node); } - write("\""); + write('"'); } } function isExpressionIdentifier(node) { var parent = node.parent; switch (parent.kind) { - case 168: - case 193: - case 185: - case 172: - case 245: - case 138: - case 186: - case 141: - case 179: - case 201: - case 171: - case 231: - case 199: - case 192: - case 203: - case 204: - case 205: - case 200: - case 241: - case 238: - case 239: - case 243: - case 244: - case 173: - case 176: - case 184: - case 183: - case 208: - case 250: - case 189: - case 210: - case 174: + case 169: case 194: + case 186: + case 173: + case 248: + case 139: + case 187: + case 142: + case 180: + case 203: + case 172: + case 234: + case 201: + case 193: + case 205: + case 206: + case 207: + case 202: + case 244: + case 241: + case 242: + case 246: + case 247: + case 174: + case 195: + case 177: + case 185: + case 184: + case 210: + case 253: + case 190: case 212: case 175: - case 180: + case 196: + case 214: + case 176: case 181: - case 202: - case 209: - case 188: + case 182: + case 204: + case 211: + case 189: return true; - case 167: - case 251: - case 140: - case 249: - case 143: - case 215: + case 168: + case 254: + case 141: + case 252: + case 144: + case 217: return parent.initializer === node; - case 170: + case 171: return parent.expression === node; + case 179: case 178: - case 177: return parent.body === node; - case 225: + case 228: return parent.moduleReference === node; - case 137: + case 138: return parent.left === node; } return false; @@ -28307,7 +29380,7 @@ var ts; function emitExpressionIdentifier(node) { var container = resolver.getReferencedExportContainer(node); if (container) { - if (container.kind === 252) { + if (container.kind === 255) { if (modulekind !== ts.ModuleKind.ES6 && modulekind !== ts.ModuleKind.System) { write("exports."); } @@ -28321,17 +29394,17 @@ var ts; if (modulekind !== ts.ModuleKind.ES6) { var declaration = resolver.getReferencedImportDeclaration(node); if (declaration) { - if (declaration.kind === 227) { + if (declaration.kind === 230) { write(getGeneratedNameForNode(declaration.parent)); - write(languageVersion === 0 ? "[\"default\"]" : ".default"); + write(languageVersion === 0 ? '["default"]' : ".default"); return; } - else if (declaration.kind === 230) { + else if (declaration.kind === 233) { write(getGeneratedNameForNode(declaration.parent.parent.parent)); - var name_23 = declaration.propertyName || declaration.name; - var identifier = ts.getTextOfNodeFromSourceText(currentText, name_23); + var name_25 = declaration.propertyName || declaration.name; + var identifier = ts.getTextOfNodeFromSourceText(currentText, name_25); if (languageVersion === 0 && identifier === "default") { - write("[\"default\"]"); + write('["default"]'); } else { write("."); @@ -28368,13 +29441,13 @@ var ts; } function isNameOfNestedBlockScopedRedeclarationOrCapturedBinding(node) { if (languageVersion < 2) { - var parent_8 = node.parent; - switch (parent_8.kind) { - case 167: - case 218: - case 221: - case 215: - return parent_8.name === node && resolver.isDeclarationWithCollidingName(parent_8); + var parent_10 = node.parent; + switch (parent_10.kind) { + case 168: + case 220: + case 223: + case 217: + return parent_10.name === node && resolver.isDeclarationWithCollidingName(parent_10); } } return false; @@ -28382,8 +29455,8 @@ var ts; function emitIdentifier(node) { if (convertedLoopState) { if (node.text == "arguments" && resolver.isArgumentsLocalBinding(node)) { - var name_24 = convertedLoopState.argumentsName || (convertedLoopState.argumentsName = makeUniqueName("arguments")); - write(name_24); + var name_26 = convertedLoopState.argumentsName || (convertedLoopState.argumentsName = makeUniqueName("arguments")); + write(name_26); return; } } @@ -28483,10 +29556,10 @@ var ts; } } function needsParenthesisForAwaitExpressionAsYield(node) { - if (node.parent.kind === 185 && !ts.isAssignmentOperator(node.parent.operatorToken.kind)) { + if (node.parent.kind === 186 && !ts.isAssignmentOperator(node.parent.operatorToken.kind)) { return true; } - else if (node.parent.kind === 186 && node.parent.condition === node) { + else if (node.parent.kind === 187 && node.parent.condition === node) { return true; } return false; @@ -28494,11 +29567,11 @@ var ts; function needsParenthesisForPropertyAccessOrInvocation(node) { switch (node.kind) { case 69: - case 168: - case 170: + case 169: case 171: case 172: - case 176: + case 173: + case 177: return false; } return true; @@ -28515,17 +29588,17 @@ var ts; write(", "); } var e = elements[pos]; - if (e.kind === 189) { + if (e.kind === 190) { e = e.expression; emitParenthesizedIf(e, group === 0 && needsParenthesisForPropertyAccessOrInvocation(e)); pos++; - if (pos === length && group === 0 && needsUniqueCopy && e.kind !== 168) { + if (pos === length && group === 0 && needsUniqueCopy && e.kind !== 169) { write(".slice()"); } } else { var i = pos; - while (i < length && elements[i].kind !== 189) { + while (i < length && elements[i].kind !== 190) { i++; } write("["); @@ -28548,7 +29621,7 @@ var ts; } } function isSpreadElementExpression(node) { - return node.kind === 189; + return node.kind === 190; } function emitArrayLiteral(node) { var elements = node.elements; @@ -28609,7 +29682,7 @@ var ts; writeComma(); var property = properties[i]; emitStart(property); - if (property.kind === 147 || property.kind === 148) { + if (property.kind === 148 || property.kind === 149) { var accessors = ts.getAllAccessorDeclarations(node.properties, property); if (property !== accessors.firstAccessor) { continue; @@ -28660,13 +29733,13 @@ var ts; emitMemberAccessForPropertyName(property.name); emitEnd(property.name); write(" = "); - if (property.kind === 249) { + if (property.kind === 252) { emit(property.initializer); } - else if (property.kind === 250) { + else if (property.kind === 253) { emitExpressionIdentifier(property.name); } - else if (property.kind === 145) { + else if (property.kind === 146) { emitFunctionDeclaration(property); } else { @@ -28698,7 +29771,7 @@ var ts; var numProperties = properties.length; var numInitialNonComputedProperties = numProperties; for (var i = 0, n = properties.length; i < n; i++) { - if (properties[i].name.kind === 138) { + if (properties[i].name.kind === 139) { numInitialNonComputedProperties = i; break; } @@ -28712,35 +29785,37 @@ var ts; emitObjectLiteralBody(node, properties.length); } function createBinaryExpression(left, operator, right, startsOnNewLine) { - var result = ts.createSynthesizedNode(185, startsOnNewLine); + var result = ts.createSynthesizedNode(186, startsOnNewLine); result.operatorToken = ts.createSynthesizedNode(operator); result.left = left; result.right = right; return result; } function createPropertyAccessExpression(expression, name) { - var result = ts.createSynthesizedNode(170); + var result = ts.createSynthesizedNode(171); result.expression = parenthesizeForAccess(expression); result.dotToken = ts.createSynthesizedNode(21); result.name = name; return result; } function createElementAccessExpression(expression, argumentExpression) { - var result = ts.createSynthesizedNode(171); + var result = ts.createSynthesizedNode(172); result.expression = parenthesizeForAccess(expression); result.argumentExpression = argumentExpression; return result; } function parenthesizeForAccess(expr) { - while (expr.kind === 175 || expr.kind === 193) { + while (expr.kind === 176 || + expr.kind === 194 || + expr.kind === 195) { expr = expr.expression; } if (ts.isLeftHandSideExpression(expr) && - expr.kind !== 173 && + expr.kind !== 174 && expr.kind !== 8) { return expr; } - var node = ts.createSynthesizedNode(176); + var node = ts.createSynthesizedNode(177); node.expression = expr; return node; } @@ -28767,11 +29842,15 @@ var ts; } function isNamespaceExportReference(node) { var container = resolver.getReferencedExportContainer(node); - return container && container.kind !== 252; + return container && container.kind !== 255; + } + function isImportedReference(node) { + var declaration = resolver.getReferencedImportDeclaration(node); + return declaration && (declaration.kind === 230 || declaration.kind === 233); } function emitShorthandPropertyAssignment(node) { writeTextOfNode(currentText, node.name); - if (modulekind !== ts.ModuleKind.ES6 || isNamespaceExportReference(node.name)) { + if (languageVersion < 2 || (modulekind !== ts.ModuleKind.ES6 && isImportedReference(node.name)) || isNamespaceExportReference(node.name)) { write(": "); emit(node.name); } @@ -28785,7 +29864,7 @@ var ts; if (constantValue !== undefined) { write(constantValue.toString()); if (!compilerOptions.removeComments) { - var propertyName = node.kind === 170 ? ts.declarationNameToString(node.name) : ts.getTextOfNode(node.argumentExpression); + var propertyName = node.kind === 171 ? ts.declarationNameToString(node.name) : ts.getTextOfNode(node.argumentExpression); write(" /* " + propertyName + " */"); } return true; @@ -28796,7 +29875,7 @@ var ts; if (compilerOptions.isolatedModules) { return undefined; } - return node.kind === 170 || node.kind === 171 + return node.kind === 171 || node.kind === 172 ? resolver.getConstantValue(node) : undefined; } @@ -28822,9 +29901,9 @@ var ts; if (languageVersion === 2 && node.expression.kind === 95 && isInAsyncMethodWithSuperInES6(node)) { - var name_25 = ts.createSynthesizedNode(9); - name_25.text = node.name.text; - emitSuperAccessInAsyncMethod(node.expression, name_25); + var name_27 = ts.createSynthesizedNode(9); + name_27.text = node.name.text; + emitSuperAccessInAsyncMethod(node.expression, name_27); return; } emit(node.expression); @@ -28884,7 +29963,7 @@ var ts; } emitExpressionIdentifier(node); break; - case 137: + case 138: emitQualifiedNameAsExpression(node, useFallback); break; default: @@ -28908,10 +29987,13 @@ var ts; write("]"); } function hasSpreadElement(elements) { - return ts.forEach(elements, function (e) { return e.kind === 189; }); + return ts.forEach(elements, function (e) { return e.kind === 190; }); } function skipParentheses(node) { - while (node.kind === 176 || node.kind === 175 || node.kind === 193) { + while (node.kind === 177 || + node.kind === 176 || + node.kind === 194 || + node.kind === 195) { node = node.expression; } return node; @@ -28932,12 +30014,12 @@ var ts; function emitCallWithSpread(node) { var target; var expr = skipParentheses(node.expression); - if (expr.kind === 170) { + if (expr.kind === 171) { target = emitCallTarget(expr.expression); write("."); emit(expr.name); } - else if (expr.kind === 171) { + else if (expr.kind === 172) { target = emitCallTarget(expr.expression); write("["); emit(expr.argumentExpression); @@ -29048,21 +30130,25 @@ var ts; } } function emitParenExpression(node) { - if (!ts.nodeIsSynthesized(node) && node.parent.kind !== 178) { - if (node.expression.kind === 175 || node.expression.kind === 193) { + if (!ts.nodeIsSynthesized(node) && node.parent.kind !== 179) { + if (node.expression.kind === 176 || + node.expression.kind === 194 || + node.expression.kind === 195) { var operand = node.expression.expression; - while (operand.kind === 175 || operand.kind === 193) { + while (operand.kind === 176 || + operand.kind === 194 || + operand.kind === 195) { operand = operand.expression; } - if (operand.kind !== 183 && + if (operand.kind !== 184 && + operand.kind !== 182 && operand.kind !== 181 && operand.kind !== 180 && - operand.kind !== 179 && - operand.kind !== 184 && - operand.kind !== 173 && - !(operand.kind === 172 && node.parent.kind === 173) && - !(operand.kind === 177 && node.parent.kind === 172) && - !(operand.kind === 8 && node.parent.kind === 170)) { + operand.kind !== 185 && + operand.kind !== 174 && + !(operand.kind === 173 && node.parent.kind === 174) && + !(operand.kind === 178 && node.parent.kind === 173) && + !(operand.kind === 8 && node.parent.kind === 171)) { emit(operand); return; } @@ -29091,7 +30177,7 @@ var ts; if (!isCurrentFileSystemExternalModule() || node.kind !== 69 || ts.nodeIsSynthesized(node)) { return false; } - var isVariableDeclarationOrBindingElement = node.parent && (node.parent.kind === 215 || node.parent.kind === 167); + var isVariableDeclarationOrBindingElement = node.parent && (node.parent.kind === 217 || node.parent.kind === 168); var targetDeclaration = isVariableDeclarationOrBindingElement ? node.parent : resolver.getReferencedValueDeclaration(node); @@ -29106,7 +30192,7 @@ var ts; write("\", "); } write(ts.tokenToString(node.operator)); - if (node.operand.kind === 183) { + if (node.operand.kind === 184) { var operand = node.operand; if (node.operator === 35 && (operand.operator === 35 || operand.operator === 41)) { write(" "); @@ -29149,7 +30235,7 @@ var ts; } var current = ts.getRootDeclaration(node).parent; while (current) { - if (current.kind === 252) { + if (current.kind === 255) { return !isExported || ((ts.getCombinedNodeFlags(node) & 1) !== 0); } else if (ts.isDeclaration(current)) { @@ -29168,7 +30254,7 @@ var ts; if (ts.isElementAccessExpression(leftHandSideExpression)) { shouldEmitParentheses = true; write("("); - synthesizedLHS = ts.createSynthesizedNode(171, false); + synthesizedLHS = ts.createSynthesizedNode(172, false); var identifier = emitTempVariableAssignment(leftHandSideExpression.expression, false, false); synthesizedLHS.expression = identifier; if (leftHandSideExpression.argumentExpression.kind !== 8 && @@ -29185,7 +30271,7 @@ var ts; else if (ts.isPropertyAccessExpression(leftHandSideExpression)) { shouldEmitParentheses = true; write("("); - synthesizedLHS = ts.createSynthesizedNode(170, false); + synthesizedLHS = ts.createSynthesizedNode(171, false); var identifier = emitTempVariableAssignment(leftHandSideExpression.expression, false, false); synthesizedLHS.expression = identifier; synthesizedLHS.dotToken = leftHandSideExpression.dotToken; @@ -29213,8 +30299,8 @@ var ts; } function emitBinaryExpression(node) { if (languageVersion < 2 && node.operatorToken.kind === 56 && - (node.left.kind === 169 || node.left.kind === 168)) { - emitDestructuring(node, node.parent.kind === 199); + (node.left.kind === 170 || node.left.kind === 169)) { + emitDestructuring(node, node.parent.kind === 201); } else { var exportChanged = node.operatorToken.kind >= 56 && @@ -29266,7 +30352,7 @@ var ts; } } function isSingleLineEmptyBlock(node) { - if (node && node.kind === 196) { + if (node && node.kind === 198) { var block = node; return block.statements.length === 0 && nodeEndIsOnSameLineAsNodeStart(block, block); } @@ -29280,12 +30366,12 @@ var ts; } emitToken(15, node.pos); increaseIndent(); - if (node.kind === 223) { - ts.Debug.assert(node.parent.kind === 222); + if (node.kind === 225) { + ts.Debug.assert(node.parent.kind === 224); emitCaptureThisForNodeIfNecessary(node.parent); } emitLines(node.statements); - if (node.kind === 223) { + if (node.kind === 225) { emitTempDeclarations(true); } decreaseIndent(); @@ -29293,7 +30379,7 @@ var ts; emitToken(16, node.statements.end); } function emitEmbeddedStatement(node) { - if (node.kind === 196) { + if (node.kind === 198) { write(" "); emit(node); } @@ -29305,7 +30391,7 @@ var ts; } } function emitExpressionStatement(node) { - emitParenthesizedIf(node.expression, node.expression.kind === 178); + emitParenthesizedIf(node.expression, node.expression.kind === 179); write(";"); } function emitIfStatement(node) { @@ -29318,7 +30404,7 @@ var ts; if (node.elseStatement) { writeLine(); emitToken(80, node.thenStatement.end); - if (node.elseStatement.kind === 200) { + if (node.elseStatement.kind === 202) { write(" "); emit(node.elseStatement); } @@ -29338,7 +30424,7 @@ var ts; else { emitNormalLoopBody(node, true); } - if (node.statement.kind === 196) { + if (node.statement.kind === 198) { write(" "); } else { @@ -29418,7 +30504,7 @@ var ts; } else { var loop = convertLoopBody(node); - if (node.parent.kind === 211) { + if (node.parent.kind === 213) { emitLabelAndColon(node.parent); } loopEmitter(node, loop); @@ -29428,11 +30514,11 @@ var ts; var functionName = makeUniqueName("_loop"); var loopInitializer; switch (node.kind) { - case 203: - case 204: case 205: + case 206: + case 207: var initializer = node.initializer; - if (initializer && initializer.kind === 216) { + if (initializer && initializer.kind === 218) { loopInitializer = node.initializer; } break; @@ -29446,7 +30532,7 @@ var ts; processVariableDeclaration(varDeclaration.name); } } - var bodyIsBlock = node.statement.kind === 196; + var bodyIsBlock = node.statement.kind === 198; var paramList = loopParameters ? loopParameters.join(", ") : ""; writeLine(); write("var " + functionName + " = function(" + paramList + ")"); @@ -29562,7 +30648,7 @@ var ts; if (emitAsEmbeddedStatement) { emitEmbeddedStatement(node.statement); } - else if (node.statement.kind === 196) { + else if (node.statement.kind === 198) { emitLines(node.statement.statements); } else { @@ -29601,7 +30687,7 @@ var ts; writeLine(); increaseIndent(); } - var isSimpleLoop = !loop.state.nonLocalJumps && + var isSimpleLoop = !(loop.state.nonLocalJumps & ~4) && !loop.state.labeledNonLocalBreaks && !loop.state.labeledNonLocalContinues; var loopResult = makeUniqueName("state"); @@ -29628,10 +30714,6 @@ var ts; write("if (" + loopResult + " === \"break\") break;"); writeLine(); } - if (loop.state.nonLocalJumps & 4) { - write("if (" + loopResult + " === \"continue\") continue;"); - writeLine(); - } emitDispatchTableForLabeledJumps(loopResult, loop.state, convertedLoopState); } if (emitAsBlock) { @@ -29682,7 +30764,7 @@ var ts; var endPos = emitToken(86, node.pos); write(" "); endPos = emitToken(17, endPos); - if (node.initializer && node.initializer.kind === 216) { + if (node.initializer && node.initializer.kind === 218) { var variableDeclarationList = node.initializer; var startIsEmitted = tryEmitStartOfVariableDeclarationList(variableDeclarationList); if (startIsEmitted) { @@ -29708,7 +30790,7 @@ var ts; } } function emitForInOrForOfStatement(node) { - if (languageVersion < 2 && node.kind === 205) { + if (languageVersion < 2 && node.kind === 207) { emitLoop(node, emitDownLevelForOfStatementWorker); } else { @@ -29719,7 +30801,7 @@ var ts; var endPos = emitToken(86, node.pos); write(" "); endPos = emitToken(17, endPos); - if (node.initializer.kind === 216) { + if (node.initializer.kind === 218) { var variableDeclarationList = node.initializer; if (variableDeclarationList.declarations.length >= 1) { tryEmitStartOfVariableDeclarationList(variableDeclarationList); @@ -29729,7 +30811,7 @@ var ts; else { emit(node.initializer); } - if (node.kind === 204) { + if (node.kind === 206) { write(" in "); } else { @@ -29782,7 +30864,7 @@ var ts; increaseIndent(); var rhsIterationValue = createElementAccessExpression(rhsReference, counter); emitStart(node.initializer); - if (node.initializer.kind === 216) { + if (node.initializer.kind === 218) { write("var "); var variableDeclarationList = node.initializer; if (variableDeclarationList.declarations.length > 0) { @@ -29804,7 +30886,7 @@ var ts; } else { var assignmentExpression = createBinaryExpression(node.initializer, 56, rhsIterationValue, false); - if (node.initializer.kind === 168 || node.initializer.kind === 169) { + if (node.initializer.kind === 169 || node.initializer.kind === 170) { emitDestructuring(assignmentExpression, true, undefined); } else { @@ -29826,14 +30908,14 @@ var ts; } function emitBreakOrContinueStatement(node) { if (convertedLoopState) { - var jump = node.kind === 207 ? 2 : 4; + var jump = node.kind === 209 ? 2 : 4; var canUseBreakOrContinue = (node.label && convertedLoopState.labels && convertedLoopState.labels[node.label.text]) || (!node.label && (convertedLoopState.allowedNonLabeledJumps & jump)); if (!canUseBreakOrContinue) { write("return "); copyLoopOutParameters(convertedLoopState, 1, false); if (!node.label) { - if (node.kind === 207) { + if (node.kind === 209) { convertedLoopState.nonLocalJumps |= 2; write("\"break\";"); } @@ -29844,7 +30926,7 @@ var ts; } else { var labelMarker = void 0; - if (node.kind === 207) { + if (node.kind === 209) { labelMarker = "break-" + node.label.text; setLabeledJump(convertedLoopState, true, node.label.text, labelMarker); } @@ -29857,7 +30939,7 @@ var ts; return; } } - emitToken(node.kind === 207 ? 70 : 75, node.pos); + emitToken(node.kind === 209 ? 70 : 75, node.pos); emitOptional(" ", node.label); write(";"); } @@ -29922,7 +31004,7 @@ var ts; ts.getLineOfLocalPositionFromLineMap(currentLineMap, ts.skipTrivia(currentText, node2.pos)); } function emitCaseOrDefaultClause(node) { - if (node.kind === 245) { + if (node.kind === 248) { write("case "); emit(node.expression); write(":"); @@ -29991,7 +31073,7 @@ var ts; function getContainingModule(node) { do { node = node.parent; - } while (node && node.kind !== 222); + } while (node && node.kind !== 224); return node; } function emitContainingModuleName(node) { @@ -30016,17 +31098,17 @@ var ts; function createVoidZero() { var zero = ts.createSynthesizedNode(8); zero.text = "0"; - var result = ts.createSynthesizedNode(181); + var result = ts.createSynthesizedNode(182); result.expression = zero; return result; } function emitEs6ExportDefaultCompat(node) { - if (node.parent.kind === 252) { - ts.Debug.assert(!!(node.flags & 512) || node.kind === 231); + if (node.parent.kind === 255) { + ts.Debug.assert(!!(node.flags & 512) || node.kind === 234); if (modulekind === ts.ModuleKind.CommonJS || modulekind === ts.ModuleKind.AMD || modulekind === ts.ModuleKind.UMD) { if (!isEs6Module) { if (languageVersion !== 0) { - write("Object.defineProperty(exports, \"__esModule\", { value: true });"); + write('Object.defineProperty(exports, "__esModule", { value: true });'); writeLine(); } else { @@ -30057,7 +31139,7 @@ var ts; if (node.flags & 512) { emitEs6ExportDefaultCompat(node); if (languageVersion === 0) { - write("exports[\"default\"]"); + write('exports["default"]'); } else { write("exports.default"); @@ -30117,7 +31199,7 @@ var ts; emitNodeWithCommentsAndWithoutSourcemap(name); write("\", "); } - var isVariableDeclarationOrBindingElement = name.parent && (name.parent.kind === 215 || name.parent.kind === 167); + var isVariableDeclarationOrBindingElement = name.parent && (name.parent.kind === 217 || name.parent.kind === 168); emitStart(isFirstVariableDeclaration(nodeForSourceMap) ? nodeForSourceMap.parent : nodeForSourceMap); withTemporaryNoSourceMap(function () { if (isVariableDeclarationOrBindingElement) { @@ -30143,22 +31225,22 @@ var ts; return identifier; } function isFirstVariableDeclaration(root) { - return root.kind === 215 && - root.parent.kind === 216 && + return root.kind === 217 && + root.parent.kind === 218 && root.parent.declarations[0] === root; } function emitDestructuring(root, isAssignmentExpressionStatement, value) { var emitCount = 0; var canDefineTempVariablesInPlace = false; - if (root.kind === 215) { + if (root.kind === 217) { var isExported = ts.getCombinedNodeFlags(root) & 1; var isSourceLevelForSystemModuleKind = shouldHoistDeclarationInSystemJsModule(root); canDefineTempVariablesInPlace = !isExported && !isSourceLevelForSystemModuleKind; } - else if (root.kind === 140) { + else if (root.kind === 141) { canDefineTempVariablesInPlace = true; } - if (root.kind === 185) { + if (root.kind === 186) { emitAssignmentExpression(root); } else { @@ -30178,14 +31260,14 @@ var ts; } function createDefaultValueCheck(value, defaultValue, sourceMapNode) { value = ensureIdentifier(value, true, sourceMapNode); - var equals = ts.createSynthesizedNode(185); + var equals = ts.createSynthesizedNode(186); equals.left = value; equals.operatorToken = ts.createSynthesizedNode(32); equals.right = createVoidZero(); return createConditionalExpression(equals, defaultValue, value); } function createConditionalExpression(condition, whenTrue, whenFalse) { - var cond = ts.createSynthesizedNode(186); + var cond = ts.createSynthesizedNode(187); cond.condition = condition; cond.questionToken = ts.createSynthesizedNode(53); cond.whenTrue = whenTrue; @@ -30200,7 +31282,7 @@ var ts; } function createPropertyAccessForDestructuringProperty(object, propName) { var index; - var nameIsComputed = propName.kind === 138; + var nameIsComputed = propName.kind === 139; if (nameIsComputed) { index = ensureIdentifier(propName.expression, false, propName); } @@ -30213,7 +31295,7 @@ var ts; : createElementAccessExpression(object, index); } function createSliceCall(value, sliceIndex) { - var call = ts.createSynthesizedNode(172); + var call = ts.createSynthesizedNode(173); var sliceIdentifier = ts.createSynthesizedNode(69); sliceIdentifier.text = "slice"; call.expression = createPropertyAccessExpression(value, sliceIdentifier); @@ -30228,9 +31310,9 @@ var ts; } for (var _a = 0, properties_5 = properties; _a < properties_5.length; _a++) { var p = properties_5[_a]; - if (p.kind === 249 || p.kind === 250) { + if (p.kind === 252 || p.kind === 253) { var propName = p.name; - var target_1 = p.kind === 250 ? p : p.initializer || propName; + var target_1 = p.kind === 253 ? p : p.initializer || propName; emitDestructuringAssignment(target_1, createPropertyAccessForDestructuringProperty(value, propName), p); } } @@ -30242,8 +31324,8 @@ var ts; } for (var i = 0; i < elements.length; i++) { var e = elements[i]; - if (e.kind !== 191) { - if (e.kind !== 189) { + if (e.kind !== 192) { + if (e.kind !== 190) { emitDestructuringAssignment(e, createElementAccessExpression(value, createNumericLiteral(i)), e); } else if (i === elements.length - 1) { @@ -30253,20 +31335,20 @@ var ts; } } function emitDestructuringAssignment(target, value, sourceMapNode) { - if (target.kind === 250) { + if (target.kind === 253) { if (target.objectAssignmentInitializer) { value = createDefaultValueCheck(value, target.objectAssignmentInitializer, sourceMapNode); } target = target.name; } - else if (target.kind === 185 && target.operatorToken.kind === 56) { + else if (target.kind === 186 && target.operatorToken.kind === 56) { value = createDefaultValueCheck(value, target.right, sourceMapNode); target = target.left; } - if (target.kind === 169) { + if (target.kind === 170) { emitObjectLiteralAssignment(target, value, sourceMapNode); } - else if (target.kind === 168) { + else if (target.kind === 169) { emitArrayLiteralAssignment(target, value, sourceMapNode); } else { @@ -30284,14 +31366,14 @@ var ts; emitDestructuringAssignment(target, value, ts.nodeIsSynthesized(root) ? target : root); } else { - if (root.parent.kind !== 176) { + if (root.parent.kind !== 177) { write("("); } value = ensureIdentifier(value, true, root); emitDestructuringAssignment(target, value, root); write(", "); emit(value); - if (root.parent.kind !== 176) { + if (root.parent.kind !== 177) { write(")"); } } @@ -30312,11 +31394,11 @@ var ts; } for (var i = 0; i < numElements; i++) { var element = elements[i]; - if (pattern.kind === 165) { + if (pattern.kind === 166) { var propName = element.propertyName || element.name; emitBindingElement(element, createPropertyAccessForDestructuringProperty(value, propName)); } - else if (element.kind !== 191) { + else if (element.kind !== 192) { if (!element.dotDotDotToken) { emitBindingElement(element, createElementAccessExpression(value, createNumericLiteral(i))); } @@ -30334,12 +31416,21 @@ var ts; } function emitVariableDeclaration(node) { if (ts.isBindingPattern(node.name)) { - if (languageVersion < 2) { - emitDestructuring(node, false); - } - else { + var isExported = ts.getCombinedNodeFlags(node) & 1; + if (languageVersion >= 2 && (!isExported || modulekind === ts.ModuleKind.ES6)) { + var isTopLevelDeclarationInSystemModule = modulekind === ts.ModuleKind.System && + shouldHoistVariable(node, true); + if (isTopLevelDeclarationInSystemModule) { + write("("); + } emit(node.name); emitOptional(" = ", node.initializer); + if (isTopLevelDeclarationInSystemModule) { + write(")"); + } + } + else { + emitDestructuring(node, false); } } else { @@ -30352,12 +31443,12 @@ var ts; var isCapturedInFunction = flags & 131072; var isDeclaredInLoop = flags & 262144; var emittedAsTopLevel = ts.isBlockScopedContainerTopLevel(container) || - (isCapturedInFunction && isDeclaredInLoop && container.kind === 196 && ts.isIterationStatement(container.parent, false)); + (isCapturedInFunction && isDeclaredInLoop && container.kind === 198 && ts.isIterationStatement(container.parent, false)); var emittedAsNestedLetDeclaration = ts.getCombinedNodeFlags(node) & 1024 && !emittedAsTopLevel; var emitExplicitInitializer = emittedAsNestedLetDeclaration && - container.kind !== 204 && - container.kind !== 205 && + container.kind !== 206 && + container.kind !== 207 && (!resolver.isDeclarationWithCollidingName(node) || (isDeclaredInLoop && !isCapturedInFunction && !ts.isIterationStatement(container, false))); if (emitExplicitInitializer) { @@ -30378,7 +31469,7 @@ var ts; } } function emitExportVariableAssignments(node) { - if (node.kind === 191) { + if (node.kind === 192) { return; } var name = node.name; @@ -30392,7 +31483,7 @@ var ts; function isES6ExportedDeclaration(node) { return !!(node.flags & 1) && modulekind === ts.ModuleKind.ES6 && - node.parent.kind === 252; + node.parent.kind === 255; } function emitVariableStatement(node) { var startIsEmitted = false; @@ -30437,12 +31528,12 @@ var ts; function emitParameter(node) { if (languageVersion < 2) { if (ts.isBindingPattern(node.name)) { - var name_26 = createTempVariable(0); + var name_28 = createTempVariable(0); if (!tempParameters) { tempParameters = []; } - tempParameters.push(name_26); - emit(name_26); + tempParameters.push(name_28); + emit(name_28); } else { emit(node.name); @@ -30541,12 +31632,12 @@ var ts; } } function emitAccessor(node) { - write(node.kind === 147 ? "get " : "set "); + write(node.kind === 148 ? "get " : "set "); emit(node.name); emitSignatureAndBody(node); } function shouldEmitAsArrowFunction(node) { - return node.kind === 178 && languageVersion >= 2; + return node.kind === 179 && languageVersion >= 2; } function emitDeclarationName(node) { if (node.name) { @@ -30557,10 +31648,10 @@ var ts; } } function shouldEmitFunctionName(node) { - if (node.kind === 177) { + if (node.kind === 178) { return !!node.name; } - if (node.kind === 217) { + if (node.kind === 219) { return !!node.name || modulekind !== ts.ModuleKind.ES6; } } @@ -30569,12 +31660,12 @@ var ts; return emitCommentsOnNotEmittedNode(node); } var kind = node.kind, parent = node.parent; - if (kind !== 145 && - kind !== 144 && + if (kind !== 146 && + kind !== 145 && parent && - parent.kind !== 249 && - parent.kind !== 172 && - parent.kind !== 168) { + parent.kind !== 252 && + parent.kind !== 173 && + parent.kind !== 169) { emitLeadingComments(node); } emitStart(node); @@ -30595,11 +31686,13 @@ var ts; emitDeclarationName(node); } emitSignatureAndBody(node); - if (modulekind !== ts.ModuleKind.ES6 && kind === 217 && parent === currentSourceFile && node.name) { + if (modulekind !== ts.ModuleKind.ES6 && kind === 219 && parent === currentSourceFile && node.name) { emitExportMemberAssignments(node.name); } emitEnd(node); - if (kind !== 145 && kind !== 144) { + if (kind !== 146 && + kind !== 145 && + kind !== 179) { emitTrailingComments(node); } } @@ -30616,8 +31709,9 @@ var ts; write("("); if (node) { var parameters = node.parameters; + var skipCount = node.parameters.length && node.parameters[0].name.text === "this" ? 1 : 0; var omitCount = languageVersion < 2 && ts.hasRestParameter(node) ? 1 : 0; - emitList(parameters, 0, parameters.length - omitCount, false, false); + emitList(parameters, skipCount, parameters.length - omitCount - skipCount, false, false); } write(")"); decreaseIndent(); @@ -30631,7 +31725,7 @@ var ts; } function emitAsyncFunctionBodyForES6(node) { var promiseConstructor = ts.getEntityNameFromTypeNode(node.type); - var isArrowFunction = node.kind === 178; + var isArrowFunction = node.kind === 179; var hasLexicalArguments = (resolver.getNodeCheckFlags(node) & 8192) !== 0; if (!isArrowFunction) { write(" {"); @@ -30675,7 +31769,7 @@ var ts; write(" { }"); } else { - if (node.body.kind === 196) { + if (node.body.kind === 198) { emitBlockFunctionBody(node, node.body); } else { @@ -30727,10 +31821,10 @@ var ts; } write(" "); var current = body; - while (current.kind === 175) { + while (current.kind === 176) { current = current.expression; } - emitParenthesizedIf(body, current.kind === 169); + emitParenthesizedIf(body, current.kind === 170); } function emitDownLevelExpressionFunctionBody(node, body) { write(" {"); @@ -30806,7 +31900,7 @@ var ts; return undefined; } var statement = statements[index]; - if (statement.kind === 199) { + if (statement.kind === 201) { return ts.isSuperCallExpression(statement.expression) ? statement : undefined; } } @@ -30832,7 +31926,7 @@ var ts; emitNodeWithCommentsAndWithoutSourcemap(memberName); write("]"); } - else if (memberName.kind === 138) { + else if (memberName.kind === 139) { emitComputedPropertyName(memberName); } else { @@ -30844,7 +31938,7 @@ var ts; var properties = []; for (var _a = 0, _b = node.members; _a < _b.length; _a++) { var member = _b[_a]; - if (member.kind === 143 && isStatic === ((member.flags & 32) !== 0) && member.initializer) { + if (member.kind === 144 && isStatic === ((member.flags & 32) !== 0) && member.initializer) { properties.push(member); } } @@ -30884,11 +31978,11 @@ var ts; } function emitMemberFunctionsForES5AndLower(node) { ts.forEach(node.members, function (member) { - if (member.kind === 195) { + if (member.kind === 197) { writeLine(); write(";"); } - else if (member.kind === 145 || node.kind === 144) { + else if (member.kind === 146 || node.kind === 145) { if (!member.body) { return emitCommentsOnNotEmittedNode(member); } @@ -30905,7 +31999,7 @@ var ts; write(";"); emitTrailingComments(member); } - else if (member.kind === 147 || member.kind === 148) { + else if (member.kind === 148 || member.kind === 149) { var accessors = ts.getAllAccessorDeclarations(node.members, member); if (member === accessors.firstAccessor) { writeLine(); @@ -30955,22 +32049,22 @@ var ts; function emitMemberFunctionsForES6AndHigher(node) { for (var _a = 0, _b = node.members; _a < _b.length; _a++) { var member = _b[_a]; - if ((member.kind === 145 || node.kind === 144) && !member.body) { + if ((member.kind === 146 || node.kind === 145) && !member.body) { emitCommentsOnNotEmittedNode(member); } - else if (member.kind === 145 || - member.kind === 147 || - member.kind === 148) { + else if (member.kind === 146 || + member.kind === 148 || + member.kind === 149) { writeLine(); emitLeadingComments(member); emitStart(member); if (member.flags & 32) { write("static "); } - if (member.kind === 147) { + if (member.kind === 148) { write("get "); } - else if (member.kind === 148) { + else if (member.kind === 149) { write("set "); } if (member.asteriskToken) { @@ -30981,7 +32075,7 @@ var ts; emitEnd(member); emitTrailingComments(member); } - else if (member.kind === 195) { + else if (member.kind === 197) { writeLine(); write(";"); } @@ -31006,10 +32100,10 @@ var ts; function emitConstructorWorker(node, baseTypeElement) { var hasInstancePropertyWithInitializer = false; ts.forEach(node.members, function (member) { - if (member.kind === 146 && !member.body) { + if (member.kind === 147 && !member.body) { emitCommentsOnNotEmittedNode(member); } - if (member.kind === 143 && member.initializer && (member.flags & 32) === 0) { + if (member.kind === 144 && member.initializer && (member.flags & 32) === 0) { hasInstancePropertyWithInitializer = true; } }); @@ -31113,10 +32207,12 @@ var ts; } function emitClassLikeDeclarationForES6AndHigher(node) { var decoratedClassAlias; - var thisNodeIsDecorated = ts.nodeIsDecorated(node); - if (node.kind === 218) { - if (thisNodeIsDecorated) { - if (resolver.getNodeCheckFlags(node) & 524288) { + var isHoistedDeclarationInSystemModule = shouldHoistDeclarationInSystemJsModule(node); + var isDecorated = ts.nodeIsDecorated(node); + var rewriteAsClassExpression = isDecorated || isHoistedDeclarationInSystemModule; + if (node.kind === 220) { + if (rewriteAsClassExpression) { + if (isDecorated && resolver.getNodeCheckFlags(node) & 524288) { decoratedClassAlias = ts.unescapeIdentifier(makeUniqueName(node.name ? node.name.text : "default")); decoratedClassAliases[ts.getNodeId(node)] = decoratedClassAlias; write("let " + decoratedClassAlias + ";"); @@ -31125,7 +32221,9 @@ var ts; if (isES6ExportedDeclaration(node) && !(node.flags & 512)) { write("export "); } - write("let "); + if (!isHoistedDeclarationInSystemModule) { + write("let "); + } emitDeclarationName(node); if (decoratedClassAlias !== undefined) { write(" = " + decoratedClassAlias); @@ -31140,7 +32238,7 @@ var ts; } } var staticProperties = getInitializedProperties(node, true); - var isClassExpressionWithStaticProperties = staticProperties.length > 0 && node.kind === 190; + var isClassExpressionWithStaticProperties = staticProperties.length > 0 && node.kind === 191; var tempVariable; if (isClassExpressionWithStaticProperties) { tempVariable = createAndRecordTempVariable(0); @@ -31150,7 +32248,7 @@ var ts; write(" = "); } write("class"); - if (node.name || (node.flags & 512 && (staticProperties.length > 0 || modulekind !== ts.ModuleKind.ES6) && !thisNodeIsDecorated)) { + if (node.name || (node.flags & 512 && (staticProperties.length > 0 || modulekind !== ts.ModuleKind.ES6) && !rewriteAsClassExpression)) { write(" "); emitDeclarationName(node); } @@ -31167,7 +32265,7 @@ var ts; decreaseIndent(); writeLine(); emitToken(16, node.members.end); - if (thisNodeIsDecorated) { + if (rewriteAsClassExpression) { decoratedClassAliases[ts.getNodeId(node)] = undefined; write(";"); } @@ -31197,14 +32295,14 @@ var ts; } else { if (node.flags & 512) { - if (thisNodeIsDecorated) { + if (isDecorated) { writeLine(); write("export default "); emitDeclarationName(node); write(";"); } } - else if (node.parent.kind !== 252) { + else if (node.parent.kind !== 255) { writeLine(); emitStart(node); emitModuleMemberName(node); @@ -31216,7 +32314,7 @@ var ts; } } function emitClassLikeDeclarationBelowES6(node) { - if (node.kind === 218) { + if (node.kind === 220) { if (!shouldHoistDeclarationInSystemJsModule(node)) { write("var "); } @@ -31276,11 +32374,11 @@ var ts; emit(baseTypeNode.expression); } write("))"); - if (node.kind === 218) { + if (node.kind === 220) { write(";"); } emitEnd(node); - if (node.kind === 218) { + if (node.kind === 220) { emitExportMemberAssignment(node); } } @@ -31350,7 +32448,7 @@ var ts; } else { decorators = member.decorators; - if (member.kind === 145) { + if (member.kind === 146) { functionLikeMember = member; } } @@ -31376,7 +32474,7 @@ var ts; write(", "); emitExpressionForPropertyName(member.name); if (languageVersion > 0) { - if (member.kind !== 143) { + if (member.kind !== 144) { write(", null"); } else { @@ -31411,45 +32509,45 @@ var ts; } function shouldEmitTypeMetadata(node) { switch (node.kind) { - case 145: - case 147: + case 146: case 148: - case 143: + case 149: + case 144: return true; } return false; } function shouldEmitReturnTypeMetadata(node) { switch (node.kind) { - case 145: + case 146: return true; } return false; } function shouldEmitParamTypesMetadata(node) { switch (node.kind) { - case 218: - case 145: - case 148: + case 220: + case 146: + case 149: return true; } return false; } function emitSerializedTypeOfNode(node) { switch (node.kind) { - case 218: + case 220: write("Function"); return; - case 143: + case 144: emitSerializedTypeNode(node.type); return; - case 140: - emitSerializedTypeNode(node.type); - return; - case 147: + case 141: emitSerializedTypeNode(node.type); return; case 148: + emitSerializedTypeNode(node.type); + return; + case 149: emitSerializedTypeNode(ts.getSetAccessorTypeAnnotationNode(node)); return; } @@ -31465,23 +32563,23 @@ var ts; case 103: write("void 0"); return; - case 162: + case 163: emitSerializedTypeNode(node.type); return; - case 154: case 155: + case 156: write("Function"); return; - case 158: case 159: + case 160: write("Array"); return; - case 152: + case 153: case 120: write("Boolean"); return; case 131: - case 164: + case 165: write("String"); return; case 129: @@ -31490,15 +32588,15 @@ var ts; case 132: write("Symbol"); return; - case 153: + case 154: emitSerializedTypeReferenceNode(node); return; - case 156: case 157: - case 160: + case 158: case 161: + case 162: case 117: - case 163: + case 164: break; default: ts.Debug.fail("Cannot serialize unexpected type node."); @@ -31562,7 +32660,7 @@ var ts; function emitSerializedParameterTypesOfNode(node) { if (node) { var valueDeclaration = void 0; - if (node.kind === 218) { + if (node.kind === 220) { valueDeclaration = ts.getFirstConstructorWithBody(node); } else if (ts.isFunctionLike(node) && ts.nodeIsPresent(node.body)) { @@ -31578,10 +32676,10 @@ var ts; } if (parameters[i].dotDotDotToken) { var parameterType = parameters[i].type; - if (parameterType.kind === 158) { + if (parameterType.kind === 159) { parameterType = parameterType.elementType; } - else if (parameterType.kind === 153 && parameterType.typeArguments && parameterType.typeArguments.length === 1) { + else if (parameterType.kind === 154 && parameterType.typeArguments && parameterType.typeArguments.length === 1) { parameterType = parameterType.typeArguments[0]; } else { @@ -31653,7 +32751,7 @@ var ts; } if (!shouldHoistDeclarationInSystemJsModule(node)) { var isES6ExportedEnum = isES6ExportedDeclaration(node); - if (!(node.flags & 1) || (isES6ExportedEnum && isFirstDeclarationOfKind(node, node.symbol && node.symbol.declarations, 221))) { + if (!(node.flags & 1) || (isES6ExportedEnum && isFirstDeclarationOfKind(node, node.symbol && node.symbol.declarations, 223))) { emitStart(node); if (isES6ExportedEnum) { write("export "); @@ -31733,7 +32831,7 @@ var ts; } } function getInnerMostModuleDeclarationFromDottedModule(moduleDeclaration) { - if (moduleDeclaration.body.kind === 222) { + if (moduleDeclaration.body.kind === 224) { var recursiveInnerModule = getInnerMostModuleDeclarationFromDottedModule(moduleDeclaration.body); return recursiveInnerModule || moduleDeclaration.body; } @@ -31756,7 +32854,7 @@ var ts; var emitVarForModule = !hoistedInDeclarationScope && !isModuleMergedWithES6Class(node); if (emitVarForModule) { var isES6ExportedNamespace = isES6ExportedDeclaration(node); - if (!isES6ExportedNamespace || isFirstDeclarationOfKind(node, node.symbol && node.symbol.declarations, 222)) { + if (!isES6ExportedNamespace || isFirstDeclarationOfKind(node, node.symbol && node.symbol.declarations, 224)) { emitStart(node); if (isES6ExportedNamespace) { write("export "); @@ -31774,7 +32872,7 @@ var ts; write(getGeneratedNameForNode(node)); emitEnd(node.name); write(") "); - if (node.body.kind === 223) { + if (node.body.kind === 225) { var saveConvertedLoopState = convertedLoopState; var saveTempFlags = tempFlags; var saveTempVariables = tempVariables; @@ -31845,16 +32943,16 @@ var ts; } } function getNamespaceDeclarationNode(node) { - if (node.kind === 225) { + if (node.kind === 228) { return node; } var importClause = node.importClause; - if (importClause && importClause.namedBindings && importClause.namedBindings.kind === 228) { + if (importClause && importClause.namedBindings && importClause.namedBindings.kind === 231) { return importClause.namedBindings; } } function isDefaultImport(node) { - return node.kind === 226 && node.importClause && !!node.importClause.name; + return node.kind === 229 && node.importClause && !!node.importClause.name; } function emitExportImportAssignments(node) { if (ts.isAliasSymbolDeclaration(node) && resolver.isValueAliasDeclaration(node)) { @@ -31881,7 +32979,7 @@ var ts; if (shouldEmitNamedBindings) { emitLeadingComments(node.importClause.namedBindings); emitStart(node.importClause.namedBindings); - if (node.importClause.namedBindings.kind === 228) { + if (node.importClause.namedBindings.kind === 231) { write("* as "); emit(node.importClause.namedBindings.name); } @@ -31907,7 +33005,7 @@ var ts; } function emitExternalImportDeclaration(node) { if (ts.contains(externalImports, node)) { - var isExportedImport = node.kind === 225 && (node.flags & 1) !== 0; + var isExportedImport = node.kind === 228 && (node.flags & 1) !== 0; var namespaceDeclaration = getNamespaceDeclarationNode(node); var varOrConst = (languageVersion <= 1) ? "var " : "const "; if (modulekind !== ts.ModuleKind.AMD) { @@ -31922,7 +33020,7 @@ var ts; write(" = "); } else { - var isNakedImport = 226 && !node.importClause; + var isNakedImport = 229 && !node.importClause; if (!isNakedImport) { write(varOrConst); write(getGeneratedNameForNode(node)); @@ -32089,8 +33187,8 @@ var ts; write("export default "); var expression = node.expression; emit(expression); - if (expression.kind !== 217 && - expression.kind !== 218) { + if (expression.kind !== 219 && + expression.kind !== 220) { write(";"); } emitEnd(node); @@ -32107,7 +33205,7 @@ var ts; emitEs6ExportDefaultCompat(node); emitContainingModuleName(node); if (languageVersion === 0) { - write("[\"default\"] = "); + write('["default"] = '); } else { write(".default = "); @@ -32127,18 +33225,18 @@ var ts; for (var _a = 0, _b = sourceFile.statements; _a < _b.length; _a++) { var node = _b[_a]; switch (node.kind) { - case 226: + case 229: if (!node.importClause || resolver.isReferencedAliasDeclaration(node.importClause, true)) { externalImports.push(node); } break; - case 225: - if (node.moduleReference.kind === 236 && resolver.isReferencedAliasDeclaration(node)) { + case 228: + if (node.moduleReference.kind === 239 && resolver.isReferencedAliasDeclaration(node)) { externalImports.push(node); } break; - case 232: + case 235: if (node.moduleSpecifier) { if (!node.exportClause) { if (resolver.moduleExportsSomeValue(node.moduleSpecifier)) { @@ -32153,12 +33251,12 @@ var ts; else { for (var _c = 0, _d = node.exportClause.elements; _c < _d.length; _c++) { var specifier = _d[_c]; - var name_27 = (specifier.propertyName || specifier.name).text; - (exportSpecifiers[name_27] || (exportSpecifiers[name_27] = [])).push(specifier); + var name_29 = (specifier.propertyName || specifier.name).text; + (exportSpecifiers[name_29] || (exportSpecifiers[name_29] = [])).push(specifier); } } break; - case 231: + case 234: if (node.isExportEquals && !exportEquals) { exportEquals = node; } @@ -32183,18 +33281,18 @@ var ts; if (namespaceDeclaration && !isDefaultImport(node)) { return ts.getTextOfNodeFromSourceText(currentText, namespaceDeclaration.name); } - if (node.kind === 226 && node.importClause) { + if (node.kind === 229 && node.importClause) { return getGeneratedNameForNode(node); } - if (node.kind === 232 && node.moduleSpecifier) { + if (node.kind === 235 && node.moduleSpecifier) { return getGeneratedNameForNode(node); } } function getExternalModuleNameText(importNode, emitRelativePathAsModuleName) { if (emitRelativePathAsModuleName) { - var name_28 = getExternalModuleNameFromDeclaration(host, resolver, importNode); - if (name_28) { - return "\"" + name_28 + "\""; + var name_30 = getExternalModuleNameFromDeclaration(host, resolver, importNode); + if (name_30) { + return "\"" + name_30 + "\""; } } var moduleName = ts.getExternalModuleName(importNode); @@ -32211,8 +33309,8 @@ var ts; var started = false; for (var _a = 0, externalImports_1 = externalImports; _a < externalImports_1.length; _a++) { var importNode = externalImports_1[_a]; - var skipNode = importNode.kind === 232 || - (importNode.kind === 226 && !importNode.importClause); + var skipNode = importNode.kind === 235 || + (importNode.kind === 229 && !importNode.importClause); if (skipNode) { continue; } @@ -32237,7 +33335,7 @@ var ts; var hasExportDeclarationWithExportClause = false; for (var _a = 0, externalImports_2 = externalImports; _a < externalImports_2.length; _a++) { var externalImport = externalImports_2[_a]; - if (externalImport.kind === 232 && externalImport.exportClause) { + if (externalImport.kind === 235 && externalImport.exportClause) { hasExportDeclarationWithExportClause = true; break; } @@ -32266,7 +33364,7 @@ var ts; } for (var _d = 0, externalImports_3 = externalImports; _d < externalImports_3.length; _d++) { var externalImport = externalImports_3[_d]; - if (externalImport.kind !== 232) { + if (externalImport.kind !== 235) { continue; } var exportDecl = externalImport; @@ -32340,11 +33438,11 @@ var ts; var seen = {}; for (var i = 0; i < hoistedVars.length; i++) { var local = hoistedVars[i]; - var name_29 = local.kind === 69 + var name_31 = local.kind === 69 ? local : local.name; - if (name_29) { - var text = ts.unescapeIdentifier(name_29.text); + if (name_31) { + var text = ts.unescapeIdentifier(name_31.text); if (ts.hasProperty(seen, text)) { continue; } @@ -32355,7 +33453,7 @@ var ts; if (i !== 0) { write(", "); } - if (local.kind === 218 || local.kind === 222 || local.kind === 221) { + if (local.kind === 220 || local.kind === 224 || local.kind === 223) { emitDeclarationName(local); } else { @@ -32389,21 +33487,21 @@ var ts; if (node.flags & 2) { return; } - if (node.kind === 217) { + if (node.kind === 219) { if (!hoistedFunctionDeclarations) { hoistedFunctionDeclarations = []; } hoistedFunctionDeclarations.push(node); return; } - if (node.kind === 218) { + if (node.kind === 220) { if (!hoistedVars) { hoistedVars = []; } hoistedVars.push(node); return; } - if (node.kind === 221) { + if (node.kind === 223) { if (shouldEmitEnumDeclaration(node)) { if (!hoistedVars) { hoistedVars = []; @@ -32412,7 +33510,7 @@ var ts; } return; } - if (node.kind === 222) { + if (node.kind === 224) { if (shouldEmitModuleDeclaration(node)) { if (!hoistedVars) { hoistedVars = []; @@ -32421,17 +33519,17 @@ var ts; } return; } - if (node.kind === 215 || node.kind === 167) { + if (node.kind === 217 || node.kind === 168) { if (shouldHoistVariable(node, false)) { - var name_30 = node.name; - if (name_30.kind === 69) { + var name_32 = node.name; + if (name_32.kind === 69) { if (!hoistedVars) { hoistedVars = []; } - hoistedVars.push(name_30); + hoistedVars.push(name_32); } else { - ts.forEachChild(name_30, visit); + ts.forEachChild(name_32, visit); } } return; @@ -32457,7 +33555,7 @@ var ts; return false; } return (ts.getCombinedNodeFlags(node) & 3072) === 0 || - ts.getEnclosingBlockScopeContainer(node).kind === 252; + ts.getEnclosingBlockScopeContainer(node).kind === 255; } function isCurrentFileSystemExternalModule() { return modulekind === ts.ModuleKind.System && isCurrentFileExternalModule; @@ -32495,17 +33593,17 @@ var ts; var entry = group_1[_a]; var importVariableName = getLocalNameForExternalImport(entry) || ""; switch (entry.kind) { - case 226: + case 229: if (!entry.importClause) { break; } - case 225: + case 228: ts.Debug.assert(importVariableName !== ""); writeLine(); write(importVariableName + " = " + parameterName + ";"); writeLine(); break; - case 232: + case 235: ts.Debug.assert(importVariableName !== ""); if (entry.exportClause) { writeLine(); @@ -32549,10 +33647,10 @@ var ts; for (var i = startIndex; i < node.statements.length; i++) { var statement = node.statements[i]; switch (statement.kind) { - case 217: - case 226: + case 219: + case 229: continue; - case 232: + case 235: if (!statement.moduleSpecifier) { for (var _a = 0, _b = statement.exportClause.elements; _a < _b.length; _a++) { var element = _b[_a]; @@ -32560,7 +33658,7 @@ var ts; } } continue; - case 225: + case 228: if (!ts.isInternalModuleImportEqualsDeclaration(statement)) { continue; } @@ -32631,11 +33729,11 @@ var ts; for (var _a = 0, _b = node.amdDependencies; _a < _b.length; _a++) { var amdDependency = _b[_a]; if (amdDependency.name) { - aliasedModuleNames.push("\"" + amdDependency.path + "\""); + aliasedModuleNames.push('"' + amdDependency.path + '"'); importAliasNames.push(amdDependency.name); } else { - unaliasedModuleNames.push("\"" + amdDependency.path + "\""); + unaliasedModuleNames.push('"' + amdDependency.path + '"'); } } for (var _c = 0, externalImports_4 = externalImports; _c < externalImports_4.length; _c++) { @@ -32660,7 +33758,7 @@ var ts; } function emitAMDDependencyList(_a) { var aliasedModuleNames = _a.aliasedModuleNames, unaliasedModuleNames = _a.unaliasedModuleNames; - write("[\"require\", \"exports\""); + write('["require", "exports"'); if (aliasedModuleNames.length) { write(", "); write(aliasedModuleNames.join(", ")); @@ -32692,8 +33790,8 @@ var ts; emitExportStarHelper(); emitCaptureThisForNodeIfNecessary(node); emitLinesStartingAt(node.statements, startIndex); - emitTempDeclarations(true); emitExportEquals(true); + emitTempDeclarations(true); decreaseIndent(); writeLine(); write("});"); @@ -32705,8 +33803,8 @@ var ts; emitExportStarHelper(); emitCaptureThisForNodeIfNecessary(node); emitLinesStartingAt(node.statements, startIndex); - emitTempDeclarations(true); emitExportEquals(false); + emitTempDeclarations(true); } function emitUMDModule(node) { emitEmitHelpers(node); @@ -32722,8 +33820,8 @@ var ts; emitExportStarHelper(); emitCaptureThisForNodeIfNecessary(node); emitLinesStartingAt(node.statements, startIndex); - emitTempDeclarations(true); emitExportEquals(true); + emitTempDeclarations(true); decreaseIndent(); writeLine(); write("});"); @@ -32789,7 +33887,7 @@ var ts; result = result.replace(/&(\w+);/g, function (s, m) { if (entities[m] !== undefined) { var ch = String.fromCharCode(entities[m]); - return ch === "\"" ? "\\\"" : ch; + return ch === '"' ? "\\\"" : ch; } else { return s; @@ -32799,10 +33897,10 @@ var ts; return result; } function isJsxChildEmittable(child) { - if (child.kind === 244) { + if (child.kind === 247) { return !!child.expression; } - else if (child.kind === 240) { + else if (child.kind === 243) { return !!getTextToEmit(child); } return true; @@ -32826,9 +33924,9 @@ var ts; function emitJsxText(node) { switch (compilerOptions.jsx) { case 2: - write("\""); + write('"'); write(trimReactWhitespaceAndApplyEntities(node)); - write("\""); + write('"'); break; case 1: default: @@ -32852,7 +33950,7 @@ var ts; } } function isUseStrictPrologue(node) { - return !!node.expression.text.match(/use strict/); + return node.expression.text === "use strict"; } function ensureUseStrictPrologue(startWithNewLine, writeUseStrict) { if (writeUseStrict) { @@ -32894,10 +33992,14 @@ var ts; } function emitEmitHelpers(node) { if (!compilerOptions.noEmitHelpers) { - if ((languageVersion < 2) && (!extendsEmitted && node.flags & 262144)) { + if (languageVersion < 2 && !extendsEmitted && node.flags & 262144) { writeLines(extendsHelper); extendsEmitted = true; } + if (compilerOptions.jsx !== 1 && !assignEmitted && (node.flags & 1073741824)) { + writeLines(assignHelper); + assignEmitted = true; + } if (!decorateEmitted && node.flags & 524288) { writeLines(decorateHelper); if (compilerOptions.emitDecoratorMetadata) { @@ -32992,28 +34094,28 @@ var ts; } function isSpecializedCommentHandling(node) { switch (node.kind) { + case 221: case 219: - case 217: - case 226: - case 225: - case 220: - case 231: + case 229: + case 228: + case 222: + case 234: return true; } } function shouldEmitLeadingAndTrailingComments(node) { switch (node.kind) { - case 197: + case 199: return shouldEmitLeadingAndTrailingCommentsForVariableStatement(node); - case 222: + case 224: return shouldEmitModuleDeclaration(node); - case 221: + case 223: return shouldEmitEnumDeclaration(node); } ts.Debug.assert(!isSpecializedCommentHandling(node)); - if (node.kind !== 196 && + if (node.kind !== 198 && node.parent && - node.parent.kind === 178 && + node.parent.kind === 179 && node.parent.body === node && compilerOptions.target <= 1) { return false; @@ -33024,13 +34126,13 @@ var ts; switch (node.kind) { case 69: return emitIdentifier(node); - case 140: + case 141: return emitParameter(node); + case 146: case 145: - case 144: return emitMethod(node); - case 147: case 148: + case 149: return emitAccessor(node); case 97: return emitThis(node); @@ -33050,142 +34152,142 @@ var ts; case 13: case 14: return emitLiteral(node); - case 187: - return emitTemplateExpression(node); - case 194: - return emitTemplateSpan(node); - case 237: - case 238: - return emitJsxElement(node); - case 240: - return emitJsxText(node); - case 244: - return emitJsxExpression(node); - case 137: - return emitQualifiedName(node); - case 165: - return emitObjectBindingPattern(node); - case 166: - return emitArrayBindingPattern(node); - case 167: - return emitBindingElement(node); - case 168: - return emitArrayLiteral(node); - case 169: - return emitObjectLiteral(node); - case 249: - return emitPropertyAssignment(node); - case 250: - return emitShorthandPropertyAssignment(node); - case 138: - return emitComputedPropertyName(node); - case 170: - return emitPropertyAccess(node); - case 171: - return emitIndexedAccess(node); - case 172: - return emitCallExpression(node); - case 173: - return emitNewExpression(node); - case 174: - return emitTaggedTemplateExpression(node); - case 175: - return emit(node.expression); - case 193: - return emit(node.expression); - case 176: - return emitParenExpression(node); - case 217: - case 177: - case 178: - return emitFunctionDeclaration(node); - case 179: - return emitDeleteExpression(node); - case 180: - return emitTypeOfExpression(node); - case 181: - return emitVoidExpression(node); - case 182: - return emitAwaitExpression(node); - case 183: - return emitPrefixUnaryExpression(node); - case 184: - return emitPostfixUnaryExpression(node); - case 185: - return emitBinaryExpression(node); - case 186: - return emitConditionalExpression(node); - case 189: - return emitSpreadElementExpression(node); case 188: - return emitYieldExpression(node); - case 191: - return; + return emitTemplateExpression(node); case 196: - case 223: - return emitBlock(node); - case 197: - return emitVariableStatement(node); - case 198: - return write(";"); - case 199: - return emitExpressionStatement(node); - case 200: - return emitIfStatement(node); - case 201: - return emitDoStatement(node); - case 202: - return emitWhileStatement(node); - case 203: - return emitForStatement(node); - case 205: - case 204: - return emitForInOrForOfStatement(node); - case 206: - case 207: - return emitBreakOrContinueStatement(node); - case 208: - return emitReturnStatement(node); - case 209: - return emitWithStatement(node); - case 210: - return emitSwitchStatement(node); - case 245: - case 246: - return emitCaseOrDefaultClause(node); - case 211: - return emitLabeledStatement(node); - case 212: - return emitThrowStatement(node); - case 213: - return emitTryStatement(node); - case 248: - return emitCatchClause(node); - case 214: - return emitDebuggerStatement(node); - case 215: - return emitVariableDeclaration(node); - case 190: - return emitClassExpression(node); - case 218: - return emitClassDeclaration(node); - case 219: - return emitInterfaceDeclaration(node); - case 221: - return emitEnumDeclaration(node); - case 251: - return emitEnumMember(node); - case 222: - return emitModuleDeclaration(node); - case 226: - return emitImportDeclaration(node); - case 225: - return emitImportEqualsDeclaration(node); - case 232: - return emitExportDeclaration(node); - case 231: - return emitExportAssignment(node); + return emitTemplateSpan(node); + case 240: + case 241: + return emitJsxElement(node); + case 243: + return emitJsxText(node); + case 247: + return emitJsxExpression(node); + case 138: + return emitQualifiedName(node); + case 166: + return emitObjectBindingPattern(node); + case 167: + return emitArrayBindingPattern(node); + case 168: + return emitBindingElement(node); + case 169: + return emitArrayLiteral(node); + case 170: + return emitObjectLiteral(node); case 252: + return emitPropertyAssignment(node); + case 253: + return emitShorthandPropertyAssignment(node); + case 139: + return emitComputedPropertyName(node); + case 171: + return emitPropertyAccess(node); + case 172: + return emitIndexedAccess(node); + case 173: + return emitCallExpression(node); + case 174: + return emitNewExpression(node); + case 175: + return emitTaggedTemplateExpression(node); + case 176: + case 194: + case 195: + return emit(node.expression); + case 177: + return emitParenExpression(node); + case 219: + case 178: + case 179: + return emitFunctionDeclaration(node); + case 180: + return emitDeleteExpression(node); + case 181: + return emitTypeOfExpression(node); + case 182: + return emitVoidExpression(node); + case 183: + return emitAwaitExpression(node); + case 184: + return emitPrefixUnaryExpression(node); + case 185: + return emitPostfixUnaryExpression(node); + case 186: + return emitBinaryExpression(node); + case 187: + return emitConditionalExpression(node); + case 190: + return emitSpreadElementExpression(node); + case 189: + return emitYieldExpression(node); + case 192: + return; + case 198: + case 225: + return emitBlock(node); + case 199: + return emitVariableStatement(node); + case 200: + return write(";"); + case 201: + return emitExpressionStatement(node); + case 202: + return emitIfStatement(node); + case 203: + return emitDoStatement(node); + case 204: + return emitWhileStatement(node); + case 205: + return emitForStatement(node); + case 207: + case 206: + return emitForInOrForOfStatement(node); + case 208: + case 209: + return emitBreakOrContinueStatement(node); + case 210: + return emitReturnStatement(node); + case 211: + return emitWithStatement(node); + case 212: + return emitSwitchStatement(node); + case 248: + case 249: + return emitCaseOrDefaultClause(node); + case 213: + return emitLabeledStatement(node); + case 214: + return emitThrowStatement(node); + case 215: + return emitTryStatement(node); + case 251: + return emitCatchClause(node); + case 216: + return emitDebuggerStatement(node); + case 217: + return emitVariableDeclaration(node); + case 191: + return emitClassExpression(node); + case 220: + return emitClassDeclaration(node); + case 221: + return emitInterfaceDeclaration(node); + case 223: + return emitEnumDeclaration(node); + case 254: + return emitEnumMember(node); + case 224: + return emitModuleDeclaration(node); + case 229: + return emitImportDeclaration(node); + case 228: + return emitImportEqualsDeclaration(node); + case 235: + return emitExportDeclaration(node); + case 234: + return emitExportAssignment(node); + case 255: return emitSourceFileNode(node); } } @@ -33215,7 +34317,7 @@ var ts; } function getLeadingCommentsToEmit(node) { if (node.parent) { - if (node.parent.kind === 252 || node.pos !== node.parent.pos) { + if (node.parent.kind === 255 || node.pos !== node.parent.pos) { if (hasDetachedComments(node.pos)) { return getLeadingCommentsWithoutDetachedComments(); } @@ -33227,7 +34329,7 @@ var ts; } function getTrailingCommentsToEmit(node) { if (node.parent) { - if (node.parent.kind === 252 || node.end !== node.parent.end) { + if (node.parent.kind === 255 || node.end !== node.parent.end) { return ts.getTrailingCommentRanges(currentText, node.end); } } @@ -33318,6 +34420,15 @@ var ts; if (declarationFilePath) { emitSkipped = ts.writeDeclarationFile(declarationFilePath, sourceFiles, isBundledEmit, host, resolver, emitterDiagnostics) || emitSkipped; } + if (!emitSkipped && emittedFilesList) { + emittedFilesList.push(jsFilePath); + if (sourceMapFilePath) { + emittedFilesList.push(sourceMapFilePath); + } + if (declarationFilePath) { + emittedFilesList.push(declarationFilePath); + } + } } } ts.emitFiles = emitFiles; @@ -33329,10 +34440,15 @@ var ts; ts.ioReadTime = 0; ts.ioWriteTime = 0; var emptyArray = []; + var defaultLibrarySearchPaths = [ + "types/", + "node_modules/", + "node_modules/@types/", + ]; ts.version = "1.9.0"; function findConfigFile(searchPath, fileExists) { - var fileName = "tsconfig.json"; while (true) { + var fileName = ts.combinePaths(searchPath, "tsconfig.json"); if (fileExists(fileName)) { return fileName; } @@ -33341,7 +34457,6 @@ var ts; break; } searchPath = parentPath; - fileName = "../" + fileName; } return undefined; } @@ -33352,18 +34467,42 @@ var ts; return ts.normalizePath(referencedFileName); } ts.resolveTripleslashReference = resolveTripleslashReference; + function computeCommonSourceDirectoryOfFilenames(fileNames, currentDirectory, getCanonicalFileName) { + var commonPathComponents; + var failed = ts.forEach(fileNames, function (sourceFile) { + var sourcePathComponents = ts.getNormalizedPathComponents(sourceFile, currentDirectory); + sourcePathComponents.pop(); + if (!commonPathComponents) { + commonPathComponents = sourcePathComponents; + return; + } + for (var i = 0, n = Math.min(commonPathComponents.length, sourcePathComponents.length); i < n; i++) { + if (getCanonicalFileName(commonPathComponents[i]) !== getCanonicalFileName(sourcePathComponents[i])) { + if (i === 0) { + return true; + } + commonPathComponents.length = i; + break; + } + } + if (sourcePathComponents.length < commonPathComponents.length) { + commonPathComponents.length = sourcePathComponents.length; + } + }); + if (failed) { + return ""; + } + if (!commonPathComponents) { + return currentDirectory; + } + return ts.getNormalizedPathFromPathComponents(commonPathComponents); + } + ts.computeCommonSourceDirectoryOfFilenames = computeCommonSourceDirectoryOfFilenames; function trace(host, message) { host.trace(ts.formatMessage.apply(undefined, arguments)); } function isTraceEnabled(compilerOptions, host) { - return compilerOptions.traceModuleResolution && host.trace !== undefined; - } - function startsWith(str, prefix) { - return str.lastIndexOf(prefix, 0) === 0; - } - function endsWith(str, suffix) { - var expectedPos = str.length - suffix.length; - return str.indexOf(suffix, expectedPos) === expectedPos; + return compilerOptions.traceResolution && host.trace !== undefined; } function hasZeroOrOneAsteriskCharacter(str) { var seenAsterisk = false; @@ -33390,6 +34529,139 @@ var ts; var startsWithDotSlashOrDotDotSlash = i === 0 || (i === 1 && moduleName.charCodeAt(0) === 46); return !startsWithDotSlashOrDotDotSlash; } + function tryReadTypesSection(packageJsonPath, baseDirectory, state) { + var jsonContent; + try { + var jsonText = state.host.readFile(packageJsonPath); + jsonContent = jsonText ? JSON.parse(jsonText) : {}; + } + catch (e) { + jsonContent = {}; + } + var typesFile; + var fieldName; + if (jsonContent.typings) { + if (typeof jsonContent.typings === "string") { + fieldName = "typings"; + typesFile = jsonContent.typings; + } + else { + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.Expected_type_of_0_field_in_package_json_to_be_string_got_1, "typings", typeof jsonContent.typings); + } + } + } + if (!typesFile && jsonContent.types) { + if (typeof jsonContent.types === "string") { + fieldName = "types"; + typesFile = jsonContent.types; + } + else { + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.Expected_type_of_0_field_in_package_json_to_be_string_got_1, "types", typeof jsonContent.types); + } + } + } + if (typesFile) { + 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; + } + return undefined; + } + var typeReferenceExtensions = [".d.ts"]; + function resolveTypeReferenceDirective(typeReferenceDirectiveName, containingFile, options, host) { + var traceEnabled = isTraceEnabled(options, host); + var moduleResolutionState = { + compilerOptions: options, + host: host, + skipTsx: true, + traceEnabled: traceEnabled + }; + var rootDir = options.typesRoot || (options.configFilePath ? ts.getDirectoryPath(options.configFilePath) : undefined); + if (traceEnabled) { + if (containingFile === undefined) { + if (rootDir === 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, rootDir); + } + } + else { + if (rootDir === 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, rootDir); + } + } + } + var failedLookupLocations = []; + if (rootDir !== undefined) { + var effectivePrimarySearchPaths = options.typesSearchPaths || defaultLibrarySearchPaths; + for (var _i = 0, effectivePrimarySearchPaths_1 = effectivePrimarySearchPaths; _i < effectivePrimarySearchPaths_1.length; _i++) { + var searchPath = effectivePrimarySearchPaths_1[_i]; + var primaryPath = ts.combinePaths(rootDir, searchPath); + if (traceEnabled) { + trace(host, ts.Diagnostics.Resolving_with_primary_search_path_0, primaryPath); + } + var candidate = ts.combinePaths(primaryPath, 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); + } + else { + initialLocationForSecondaryLookup = rootDir; + } + if (initialLocationForSecondaryLookup !== undefined) { + 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) { @@ -33448,10 +34720,10 @@ var ts; for (var _i = 0, _a = state.compilerOptions.rootDirs; _i < _a.length; _i++) { var rootDir = _a[_i]; var normalizedRoot = ts.normalizePath(rootDir); - if (!endsWith(normalizedRoot, ts.directorySeparator)) { + if (!ts.endsWith(normalizedRoot, ts.directorySeparator)) { normalizedRoot += ts.directorySeparator; } - var isLongestMatchingPrefix = startsWith(candidate, normalizedRoot) && + 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); @@ -33518,8 +34790,8 @@ var ts; var prefix = pattern.substr(0, indexOfStar); var suffix = pattern.substr(indexOfStar + 1); if (moduleName.length >= prefix.length + suffix.length && - startsWith(moduleName, prefix) && - endsWith(moduleName, suffix)) { + ts.startsWith(moduleName, prefix) && + ts.endsWith(moduleName, suffix)) { if (prefix.length > longestMatchPrefixLength) { longestMatchPrefixLength = prefix.length; matchedPattern = pattern; @@ -33597,6 +34869,12 @@ var ts; } ts.directoryProbablyExists = directoryProbablyExists; function loadModuleFromFile(candidate, extensions, failedLookupLocation, onlyRecordFailures, state) { + if (!onlyRecordFailures) { + var directory = ts.getDirectoryPath(candidate); + if (directory) { + onlyRecordFailures = !directoryProbablyExists(directory, state.host); + } + } return ts.forEach(extensions, tryLoad); function tryLoad(ext) { if (ext === ".tsx" && state.skipTsx) { @@ -33605,7 +34883,7 @@ var ts; var fileName = ts.fileExtensionIs(candidate, ext) ? candidate : candidate + ext; if (!onlyRecordFailures && state.host.fileExists(fileName)) { if (state.traceEnabled) { - trace(state.host, ts.Diagnostics.File_0_exist_use_it_as_a_module_resolution_result, fileName); + trace(state.host, ts.Diagnostics.File_0_exist_use_it_as_a_name_resolution_result, fileName); } return fileName; } @@ -33625,32 +34903,16 @@ var ts; if (state.traceEnabled) { trace(state.host, ts.Diagnostics.Found_package_json_at_0, packageJsonPath); } - var jsonContent = void 0; - try { - var jsonText = state.host.readFile(packageJsonPath); - jsonContent = jsonText ? JSON.parse(jsonText) : { typings: undefined }; - } - catch (e) { - jsonContent = { typings: undefined }; - } - if (jsonContent.typings) { - if (typeof jsonContent.typings === "string") { - var typingsFile = ts.normalizePath(ts.combinePaths(candidate, jsonContent.typings)); - if (state.traceEnabled) { - trace(state.host, ts.Diagnostics.package_json_has_typings_field_0_that_references_1, jsonContent.typings, typingsFile); - } - var result = loadModuleFromFile(typingsFile, extensions, failedLookupLocation, !directoryProbablyExists(ts.getDirectoryPath(typingsFile), state.host), state); - if (result) { - return result; - } - } - else if (state.traceEnabled) { - trace(state.host, ts.Diagnostics.Expected_type_of_typings_field_in_package_json_to_be_string_got_0, typeof jsonContent.typings); + var typesFile = tryReadTypesSection(packageJsonPath, candidate, state); + if (typesFile) { + var result = loadModuleFromFile(typesFile, extensions, failedLookupLocation, !directoryProbablyExists(ts.getDirectoryPath(typesFile), state.host), state); + if (result) { + return result; } } else { if (state.traceEnabled) { - trace(state.host, ts.Diagnostics.package_json_does_not_have_typings_field); + trace(state.host, ts.Diagnostics.package_json_does_not_have_types_field); } } } @@ -33662,19 +34924,26 @@ var ts; } return loadModuleFromFile(ts.combinePaths(candidate, "index"), extensions, failedLookupLocation, !directoryExists, state); } + 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 result = loadModuleFromFile(candidate, ts.supportedTypeScriptExtensions, failedLookupLocations, !nodeModulesFolderExists, state); + if (result) { + return result; + } + result = loadNodeModuleFromDirectory(ts.supportedTypeScriptExtensions, 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") { - var nodeModulesFolder = ts.combinePaths(directory, "node_modules"); - var nodeModulesFolderExists = directoryProbablyExists(nodeModulesFolder, state.host); - var candidate = ts.normalizePath(ts.combinePaths(nodeModulesFolder, moduleName)); - var result = loadModuleFromFile(candidate, ts.supportedTypeScriptExtensions, failedLookupLocations, !nodeModulesFolderExists, state); - if (result) { - return result; - } - result = loadNodeModuleFromDirectory(ts.supportedTypeScriptExtensions, candidate, failedLookupLocations, !nodeModulesFolderExists, state); + var result = loadModuleFromNodeModulesFolder(moduleName, directory, failedLookupLocations, state) || + loadModuleFromNodeModulesFolder(ts.combinePaths("@types", moduleName), directory, failedLookupLocations, state); if (result) { return result; } @@ -33767,11 +35036,39 @@ var ts; ts.sys.createDirectory(directoryPath); } } + var outputFingerprints; + function writeFileIfUpdated(fileName, data, writeByteOrderMark) { + if (!outputFingerprints) { + outputFingerprints = {}; + } + var hash = ts.sys.createHash(data); + var mtimeBefore = ts.sys.getModifiedTime(fileName); + if (mtimeBefore && ts.hasProperty(outputFingerprints, fileName)) { + var fingerprint = outputFingerprints[fileName]; + if (fingerprint.byteOrderMark === writeByteOrderMark && + fingerprint.hash === hash && + fingerprint.mtime.getTime() === mtimeBefore.getTime()) { + return; + } + } + ts.sys.writeFile(fileName, data, writeByteOrderMark); + var mtimeAfter = ts.sys.getModifiedTime(fileName); + outputFingerprints[fileName] = { + hash: hash, + byteOrderMark: writeByteOrderMark, + mtime: mtimeAfter + }; + } function writeFile(fileName, data, writeByteOrderMark, onError) { try { var start = new Date().getTime(); ensureDirectoriesExist(ts.getDirectoryPath(ts.normalizePath(fileName))); - ts.sys.writeFile(fileName, data, writeByteOrderMark); + if (ts.isWatchSet(options) && ts.sys.createHash && ts.sys.getModifiedTime) { + writeFileIfUpdated(fileName, data, writeByteOrderMark); + } + else { + ts.sys.writeFile(fileName, data, writeByteOrderMark); + } ts.ioWriteTime += new Date().getTime() - start; } catch (e) { @@ -33780,10 +35077,14 @@ var ts; } } } + function getDefaultLibLocation() { + return ts.getDirectoryPath(ts.normalizePath(ts.sys.getExecutingFilePath())); + } var newLine = ts.getNewLineCharacter(options); return { getSourceFile: getSourceFile, - getDefaultLibFileName: function (options) { return ts.combinePaths(ts.getDirectoryPath(ts.normalizePath(ts.sys.getExecutingFilePath())), ts.getDefaultLibFileName(options)); }, + getDefaultLibLocation: getDefaultLibLocation, + getDefaultLibFileName: function (options) { return ts.combinePaths(getDefaultLibLocation(), ts.getDefaultLibFileName(options)); }, writeFile: writeFile, getCurrentDirectory: ts.memoize(function () { return ts.sys.getCurrentDirectory(); }), useCaseSensitiveFileNames: function () { return ts.sys.useCaseSensitiveFileNames; }, @@ -33827,57 +35128,78 @@ var ts; } } ts.flattenDiagnosticMessageText = flattenDiagnosticMessageText; + function loadWithLocalCache(names, containingFile, loader) { + if (names.length === 0) { + return []; + } + var resolutions = []; + var cache = {}; + for (var _i = 0, names_1 = names; _i < names_1.length; _i++) { + var name_33 = names_1[_i]; + var result = void 0; + if (ts.hasProperty(cache, name_33)) { + result = cache[name_33]; + } + else { + result = loader(name_33, containingFile); + cache[name_33] = result; + } + resolutions.push(result); + } + return resolutions; + } function createProgram(rootNames, options, host, oldProgram) { var program; var files = []; - var fileProcessingDiagnostics = ts.createDiagnosticCollection(); - var programDiagnostics = ts.createDiagnosticCollection(); var commonSourceDirectory; var diagnosticsProducingTypeChecker; var noDiagnosticsTypeChecker; var classifiableNames; - var skipDefaultLib = options.noLib; - var supportedExtensions = ts.getSupportedExtensions(options); + var resolvedTypeReferenceDirectives = {}; + var fileProcessingDiagnostics = ts.createDiagnosticCollection(); var start = new Date().getTime(); host = host || createCompilerHost(options); - var hasEmitBlockingDiagnostics = ts.createFileMap(getCanonicalFileName); + var skipDefaultLib = options.noLib; + var programDiagnostics = ts.createDiagnosticCollection(); var currentDirectory = host.getCurrentDirectory(); - var resolveModuleNamesWorker = host.resolveModuleNames - ? (function (moduleNames, containingFile) { return host.resolveModuleNames(moduleNames, containingFile); }) - : (function (moduleNames, containingFile) { - var resolvedModuleNames = []; - var lookup = {}; - for (var _i = 0, moduleNames_1 = moduleNames; _i < moduleNames_1.length; _i++) { - var moduleName = moduleNames_1[_i]; - var resolvedName = void 0; - if (ts.hasProperty(lookup, moduleName)) { - resolvedName = lookup[moduleName]; - } - else { - resolvedName = resolveModuleName(moduleName, containingFile, options, host).resolvedModule; - lookup[moduleName] = resolvedName; - } - resolvedModuleNames.push(resolvedName); - } - return resolvedModuleNames; - }); + var supportedExtensions = ts.getSupportedExtensions(options); + var hasEmitBlockingDiagnostics = ts.createFileMap(getCanonicalFileName); + var resolveModuleNamesWorker; + if (host.resolveModuleNames) { + resolveModuleNamesWorker = function (moduleNames, containingFile) { return host.resolveModuleNames(moduleNames, containingFile); }; + } + else { + var loader_1 = function (moduleName, containingFile) { return resolveModuleName(moduleName, containingFile, options, host).resolvedModule; }; + resolveModuleNamesWorker = function (moduleNames, containingFile) { return loadWithLocalCache(moduleNames, containingFile, loader_1); }; + } + var resolveTypeReferenceDirectiveNamesWorker; + if (host.resolveTypeReferenceDirectives) { + resolveTypeReferenceDirectiveNamesWorker = function (typeDirectiveNames, containingFile) { return host.resolveTypeReferenceDirectives(typeDirectiveNames, containingFile); }; + } + else { + var loader_2 = function (typesRef, containingFile) { return resolveTypeReferenceDirective(typesRef, containingFile, options, host).resolvedTypeReferenceDirective; }; + resolveTypeReferenceDirectiveNamesWorker = function (typeReferenceDirectiveNames, containingFile) { return loadWithLocalCache(typeReferenceDirectiveNames, containingFile, loader_2); }; + } var filesByName = ts.createFileMap(); var filesByNameIgnoreCase = host.useCaseSensitiveFileNames() ? ts.createFileMap(function (fileName) { return fileName.toLowerCase(); }) : undefined; - if (oldProgram) { - var oldOptions = oldProgram.getCompilerOptions(); - if ((oldOptions.module !== options.module) || - (oldOptions.noResolve !== options.noResolve) || - (oldOptions.target !== options.target) || - (oldOptions.noLib !== options.noLib) || - (oldOptions.jsx !== options.jsx) || - (oldOptions.allowJs !== options.allowJs)) { - oldProgram = undefined; - } - } if (!tryReuseStructureFromOldProgram()) { + if (options.types && options.types.length) { + var resolutions = resolveTypeReferenceDirectiveNamesWorker(options.types, undefined); + for (var i = 0; i < options.types.length; i++) { + processTypeReferenceDirective(options.types[i], resolutions[i]); + } + } ts.forEach(rootNames, function (name) { return processRootFile(name, false); }); if (!skipDefaultLib) { - processRootFile(host.getDefaultLibFileName(options), true); + if (!options.lib) { + processRootFile(host.getDefaultLibFileName(options), true); + } + else { + var libDirectory_1 = host.getDefaultLibLocation ? host.getDefaultLibLocation() : ts.getDirectoryPath(host.getDefaultLibFileName(options)); + ts.forEach(options.lib, function (libFileName) { + processRootFile(ts.combinePaths(libDirectory_1, libFileName), true); + }); + } } } oldProgram = undefined; @@ -33901,7 +35223,8 @@ var ts; getIdentifierCount: function () { return getDiagnosticsProducingTypeChecker().getIdentifierCount(); }, getSymbolCount: function () { return getDiagnosticsProducingTypeChecker().getSymbolCount(); }, getTypeCount: function () { return getDiagnosticsProducingTypeChecker().getTypeCount(); }, - getFileProcessingDiagnostics: function () { return fileProcessingDiagnostics; } + getFileProcessingDiagnostics: function () { return fileProcessingDiagnostics; }, + resolvedTypeReferenceDirectives: resolvedTypeReferenceDirectives }; verifyCompilerOptions(); ts.programTime += new Date().getTime() - start; @@ -33935,11 +35258,26 @@ var ts; if (!oldProgram) { return false; } + var oldOptions = oldProgram.getCompilerOptions(); + if ((oldOptions.module !== options.module) || + (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.typesSearchPaths !== options.typesSearchPaths) || + (oldOptions.configFilePath !== options.configFilePath)) { + return false; + } ts.Debug.assert(!oldProgram.structureIsReused); var oldRootNames = oldProgram.getRootFileNames(); if (!ts.arrayIsEqualTo(oldRootNames, rootNames)) { return false; } + if (!ts.arrayIsEqualTo(options.types, oldOptions.types)) { + return false; + } var newSourceFiles = []; var filePaths = []; var modifiedSourceFiles = []; @@ -33965,23 +35303,28 @@ var ts; if (!ts.arrayIsEqualTo(oldSourceFile.moduleAugmentations, newSourceFile.moduleAugmentations, moduleNameIsEqualTo)) { return false; } + if (!ts.arrayIsEqualTo(oldSourceFile.typeReferenceDirectives, newSourceFile.typeReferenceDirectives, fileReferenceIsEqualTo)) { + 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, ts.getNormalizedAbsolutePath(newSourceFile.fileName, currentDirectory)); - for (var i = 0; i < moduleNames.length; i++) { - var newResolution = resolutions[i]; - var oldResolution = ts.getResolvedModule(oldSourceFile, moduleNames[i]); - var resolutionChanged = oldResolution - ? !newResolution || - oldResolution.resolvedFileName !== newResolution.resolvedFileName || - !!oldResolution.isExternalLibraryImport !== !!newResolution.isExternalLibraryImport - : newResolution; - if (resolutionChanged) { - return false; - } + var resolutions = resolveModuleNamesWorker(moduleNames, newSourceFilePath); + 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); + var resolutionsChanged = ts.hasChangesInResolutions(typesReferenceDirectives, resolutions, oldSourceFile.resolvedTypeReferenceDirectiveNames, ts.typeDirectiveIsEqualTo); + if (resolutionsChanged) { + return false; } } newSourceFile.resolvedModules = oldSourceFile.resolvedModules; + newSourceFile.resolvedTypeReferenceDirectiveNames = oldSourceFile.resolvedTypeReferenceDirectiveNames; modifiedSourceFiles.push(newSourceFile); } else { @@ -33998,6 +35341,7 @@ var ts; var modifiedFile = modifiedSourceFiles_1[_b]; fileProcessingDiagnostics.reattachFileDiagnostics(modifiedFile); } + resolvedTypeReferenceDirectives = oldProgram.resolvedTypeReferenceDirectives; oldProgram.structureIsReused = true; return true; } @@ -34010,7 +35354,7 @@ var ts; getNewLine: function () { return host.getNewLine(); }, getSourceFile: program.getSourceFile, getSourceFiles: program.getSourceFiles, - writeFile: writeFileCallback || (function (fileName, data, writeByteOrderMark, onError) { return host.writeFile(fileName, data, writeByteOrderMark, onError); }), + writeFile: writeFileCallback || (function (fileName, data, writeByteOrderMark, onError, sourceFiles) { return host.writeFile(fileName, data, writeByteOrderMark, onError, sourceFiles); }), isEmitBlocked: isEmitBlocked }; } @@ -34030,7 +35374,7 @@ var ts; function emitWorker(program, sourceFile, writeFileCallback, cancellationToken) { var declarationDiagnostics = []; if (options.noEmit) { - return { diagnostics: declarationDiagnostics, sourceMaps: undefined, emitSkipped: true }; + return { diagnostics: declarationDiagnostics, sourceMaps: undefined, emittedFiles: undefined, emitSkipped: true }; } if (options.noEmitOnError) { var diagnostics = program.getOptionsDiagnostics(cancellationToken).concat(program.getSyntacticDiagnostics(sourceFile, cancellationToken), program.getGlobalDiagnostics(cancellationToken), program.getSemanticDiagnostics(sourceFile, cancellationToken)); @@ -34038,7 +35382,12 @@ var ts; declarationDiagnostics = program.getDeclarationDiagnostics(undefined, cancellationToken); } if (diagnostics.length > 0 || declarationDiagnostics.length > 0) { - return { diagnostics: diagnostics, sourceMaps: undefined, emitSkipped: true }; + return { + diagnostics: ts.concatenate(diagnostics, declarationDiagnostics), + sourceMaps: undefined, + emittedFiles: undefined, + emitSkipped: true + }; } } var emitResolver = getDiagnosticsProducingTypeChecker().getEmitResolver((options.outFile || options.out) ? undefined : sourceFile); @@ -34070,7 +35419,13 @@ var ts; return getDiagnosticsHelper(sourceFile, getSemanticDiagnosticsForFile, cancellationToken); } function getDeclarationDiagnostics(sourceFile, cancellationToken) { - return getDiagnosticsHelper(sourceFile, getDeclarationDiagnosticsForFile, cancellationToken); + var options = program.getCompilerOptions(); + if (!sourceFile || options.out || options.outFile) { + return getDeclarationDiagnosticsWorker(sourceFile, cancellationToken); + } + else { + return getDiagnosticsHelper(sourceFile, getDeclarationDiagnosticsForFile, cancellationToken); + } } function getSyntacticDiagnosticsForFile(sourceFile, cancellationToken) { return sourceFile.parseDiagnostics; @@ -34110,47 +35465,47 @@ var ts; return false; } switch (node.kind) { - case 225: + case 228: diagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.import_can_only_be_used_in_a_ts_file)); return true; - case 231: + case 234: if (node.isExportEquals) { diagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.export_can_only_be_used_in_a_ts_file)); return true; } break; - case 218: + case 220: var classDeclaration = node; if (checkModifiers(classDeclaration.modifiers) || checkTypeParameters(classDeclaration.typeParameters)) { return true; } break; - case 247: + case 250: var heritageClause = node; if (heritageClause.token === 106) { diagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.implements_clauses_can_only_be_used_in_a_ts_file)); return true; } break; - case 219: + case 221: diagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.interface_declarations_can_only_be_used_in_a_ts_file)); return true; - case 222: + case 224: diagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.module_declarations_can_only_be_used_in_a_ts_file)); return true; - case 220: + case 222: diagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.type_aliases_can_only_be_used_in_a_ts_file)); return true; - case 145: - case 144: case 146: + case 145: case 147: case 148: - case 177: - case 217: + case 149: case 178: - case 217: + case 219: + case 179: + case 219: var functionDeclaration = node; if (checkModifiers(functionDeclaration.modifiers) || checkTypeParameters(functionDeclaration.typeParameters) || @@ -34158,20 +35513,20 @@ var ts; return true; } break; - case 197: + case 199: var variableStatement = node; if (checkModifiers(variableStatement.modifiers)) { return true; } break; - case 215: + case 217: var variableDeclaration = node; if (checkTypeAnnotation(variableDeclaration.type)) { return true; } break; - case 172: case 173: + case 174: var expression = node; if (expression.typeArguments && expression.typeArguments.length > 0) { var start_2 = expression.typeArguments.pos; @@ -34179,7 +35534,7 @@ var ts; return true; } break; - case 140: + case 141: var parameter = node; if (parameter.modifiers) { var start_3 = parameter.modifiers.pos; @@ -34195,17 +35550,17 @@ var ts; return true; } break; - case 143: + case 144: diagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.property_declarations_can_only_be_used_in_a_ts_file)); return true; - case 221: + case 223: diagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.enum_declarations_can_only_be_used_in_a_ts_file)); return true; - case 175: + case 176: 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 141: + case 142: 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)); } @@ -34252,15 +35607,16 @@ var ts; } }); } - function getDeclarationDiagnosticsForFile(sourceFile, cancellationToken) { + function getDeclarationDiagnosticsWorker(sourceFile, cancellationToken) { return runWithCancellationToken(function () { - if (!ts.isDeclarationFile(sourceFile)) { - var resolver = getDiagnosticsProducingTypeChecker().getEmitResolver(sourceFile, cancellationToken); - var writeFile_1 = function () { }; - return ts.getDeclarationDiagnostics(getEmitHost(writeFile_1), resolver, sourceFile); - } + var resolver = getDiagnosticsProducingTypeChecker().getEmitResolver(sourceFile, cancellationToken); + var writeFile = function () { }; + return ts.getDeclarationDiagnostics(getEmitHost(writeFile), resolver, sourceFile); }); } + function getDeclarationDiagnosticsForFile(sourceFile, cancellationToken) { + return ts.isDeclarationFile(sourceFile) ? [] : getDeclarationDiagnosticsWorker(sourceFile, cancellationToken); + } function getOptionsDiagnostics() { var allDiagnostics = []; ts.addRange(allDiagnostics, fileProcessingDiagnostics.getGlobalDiagnostics()); @@ -34276,7 +35632,7 @@ var ts; return ts.getBaseFileName(fileName).indexOf(".") >= 0; } function processRootFile(fileName, isDefaultLib) { - processSourceFile(ts.normalizePath(fileName), isDefaultLib); + processSourceFile(ts.normalizePath(fileName), isDefaultLib, true); } function fileReferenceIsEqualTo(a, b) { return a.fileName === b.fileName; @@ -34307,9 +35663,9 @@ var ts; return; function collectModuleReferences(node, inAmbientModule) { switch (node.kind) { - case 226: - case 225: - case 232: + case 229: + case 228: + case 235: var moduleNameExpr = ts.getExternalModuleName(node); if (!moduleNameExpr || moduleNameExpr.kind !== 9) { break; @@ -34321,7 +35677,7 @@ var ts; (imports || (imports = [])).push(moduleNameExpr); } break; - case 222: + case 224: if (ts.isAmbientModule(node) && (inAmbientModule || node.flags & 2 || ts.isDeclarationFile(file))) { var moduleName = node.name; if (isExternalModuleFile || (inAmbientModule && !ts.isExternalModuleNameRelative(moduleName.text))) { @@ -34345,7 +35701,7 @@ var ts; } } } - function processSourceFile(fileName, isDefaultLib, refFile, refPos, refEnd) { + function processSourceFile(fileName, isDefaultLib, isReference, refFile, refPos, refEnd) { var diagnosticArgument; var diagnostic; if (hasExtension(fileName)) { @@ -34353,7 +35709,7 @@ var ts; 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, refFile, refPos, refEnd)) { + else if (!findSourceFile(fileName, ts.toPath(fileName, currentDirectory, getCanonicalFileName), isDefaultLib, isReference, refFile, refPos, refEnd)) { diagnostic = ts.Diagnostics.File_0_not_found; diagnosticArgument = [fileName]; } @@ -34363,13 +35719,13 @@ var ts; } } else { - var nonTsFile = options.allowNonTsExtensions && findSourceFile(fileName, ts.toPath(fileName, currentDirectory, getCanonicalFileName), isDefaultLib, refFile, refPos, refEnd); + var nonTsFile = options.allowNonTsExtensions && findSourceFile(fileName, ts.toPath(fileName, currentDirectory, getCanonicalFileName), isDefaultLib, isReference, 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, refFile, refPos, refEnd); })) { + else if (!ts.forEach(supportedExtensions, function (extension) { return findSourceFile(fileName + extension, ts.toPath(fileName + extension, currentDirectory, getCanonicalFileName), isDefaultLib, isReference, refFile, refPos, refEnd); })) { diagnostic = ts.Diagnostics.File_0_not_found; fileName += ".ts"; diagnosticArgument = [fileName]; @@ -34393,12 +35749,15 @@ var ts; fileProcessingDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.File_name_0_differs_from_already_included_file_name_1_only_in_casing, fileName, existingFileName)); } } - function findSourceFile(fileName, path, isDefaultLib, refFile, refPos, refEnd) { + function findSourceFile(fileName, path, isDefaultLib, isReference, refFile, refPos, refEnd) { if (filesByName.contains(path)) { var file_1 = filesByName.get(path); if (file_1 && options.forceConsistentCasingInFileNames && ts.getNormalizedAbsolutePath(file_1.fileName, currentDirectory) !== ts.getNormalizedAbsolutePath(fileName, currentDirectory)) { reportFileNamesDifferOnlyInCasingError(fileName, file_1.fileName, refFile, refPos, refEnd); } + if (file_1) { + file_1.wasReferenced = file_1.wasReferenced || isReference; + } return file_1; } var file = host.getSourceFile(fileName, options.target, function (hostErrorMessage) { @@ -34411,6 +35770,7 @@ var ts; }); filesByName.set(path, file); if (file) { + file.wasReferenced = file.wasReferenced || isReference; file.path = path; if (host.useCaseSensitiveFileNames()) { var existingFile = filesByNameIgnoreCase.get(path); @@ -34424,7 +35784,8 @@ var ts; skipDefaultLib = skipDefaultLib || file.hasNoDefaultLib; var basePath = ts.getDirectoryPath(fileName); if (!options.noResolve) { - processReferencedFiles(file, basePath); + processReferencedFiles(file, basePath, isDefaultLib); + processTypeReferenceDirectives(file); } processImportedModules(file, basePath); if (isDefaultLib) { @@ -34436,12 +35797,64 @@ var ts; } return file; } - function processReferencedFiles(file, basePath) { + function processReferencedFiles(file, basePath, isDefaultLib) { ts.forEach(file.referencedFiles, function (ref) { var referencedFileName = resolveTripleslashReference(ref.fileName, file.fileName); - processSourceFile(referencedFileName, false, file, ref.pos, ref.end); + processSourceFile(referencedFileName, isDefaultLib, true, file, ref.pos, ref.end); }); } + function processTypeReferenceDirectives(file) { + var typeDirectives = ts.map(file.typeReferenceDirectives, function (l) { return l.fileName; }); + var resolutions = resolveTypeReferenceDirectiveNamesWorker(typeDirectives, file.fileName); + for (var i = 0; i < typeDirectives.length; i++) { + var ref = file.typeReferenceDirectives[i]; + var resolvedTypeReferenceDirective = resolutions[i]; + ts.setResolvedTypeReferenceDirective(file, ref.fileName, resolvedTypeReferenceDirective); + processTypeReferenceDirective(ref.fileName, resolvedTypeReferenceDirective, file, ref.pos, ref.end); + } + } + function processTypeReferenceDirective(typeReferenceDirective, resolvedTypeReferenceDirective, refFile, refPos, refEnd) { + var previousResolution = resolvedTypeReferenceDirectives[typeReferenceDirective]; + if (previousResolution && previousResolution.primary) { + return; + } + var saveResolution = true; + if (resolvedTypeReferenceDirective) { + if (resolvedTypeReferenceDirective.primary) { + processSourceFile(resolvedTypeReferenceDirective.resolvedFileName, false, true, refFile, refPos, refEnd); + } + else { + if (previousResolution) { + var otherFileText = host.readFile(resolvedTypeReferenceDirective.resolvedFileName); + if (otherFileText !== getSourceFile(previousResolution.resolvedFileName).text) { + fileProcessingDiagnostics.add(createDiagnostic(refFile, refPos, refEnd, ts.Diagnostics.Conflicting_library_definitions_for_0_found_at_1_and_2_Copy_the_correct_file_to_the_typings_folder_to_resolve_this_conflict, typeReferenceDirective, resolvedTypeReferenceDirective.resolvedFileName, previousResolution.resolvedFileName)); + } + saveResolution = false; + } + else { + processSourceFile(resolvedTypeReferenceDirective.resolvedFileName, false, true, refFile, refPos, refEnd); + } + } + } + else { + fileProcessingDiagnostics.add(createDiagnostic(refFile, refPos, refEnd, ts.Diagnostics.Cannot_find_name_0, typeReferenceDirective)); + } + if (saveResolution) { + resolvedTypeReferenceDirectives[typeReferenceDirective] = resolvedTypeReferenceDirective; + } + } + function createDiagnostic(refFile, refPos, refEnd, message) { + var args = []; + for (var _i = 4; _i < arguments.length; _i++) { + args[_i - 4] = arguments[_i]; + } + if (refFile === undefined || refPos === undefined || refEnd === undefined) { + return ts.createCompilerDiagnostic.apply(void 0, [message].concat(args)); + } + else { + return ts.createFileDiagnostic.apply(void 0, [refFile, refPos, refEnd - refPos, message].concat(args)); + } + } function getCanonicalFileName(fileName) { return host.getCanonicalFileName(fileName); } @@ -34458,7 +35871,7 @@ var ts; !options.noResolve && i < file.imports.length; if (shouldAddFile) { - var importedFile = findSourceFile(resolution.resolvedFileName, ts.toPath(resolution.resolvedFileName, currentDirectory, getCanonicalFileName), false, file, ts.skipTrivia(file.text, file.imports[i].pos), file.imports[i].end); + var importedFile = findSourceFile(resolution.resolvedFileName, ts.toPath(resolution.resolvedFileName, currentDirectory, getCanonicalFileName), false, false, file, ts.skipTrivia(file.text, file.imports[i].pos), file.imports[i].end); if (importedFile && resolution.isExternalLibraryImport) { if (!ts.isExternalModule(importedFile) && importedFile.statements.length) { var start_5 = ts.getTokenPosOfNode(file.imports[i], file); @@ -34478,44 +35891,21 @@ var ts; return; } function computeCommonSourceDirectory(sourceFiles) { - var commonPathComponents; - var failed = ts.forEach(files, function (sourceFile) { - if (ts.isDeclarationFile(sourceFile)) { - return; + var fileNames = []; + for (var _i = 0, sourceFiles_2 = sourceFiles; _i < sourceFiles_2.length; _i++) { + var file = sourceFiles_2[_i]; + if (!file.isDeclarationFile) { + fileNames.push(file.fileName); } - var sourcePathComponents = ts.getNormalizedPathComponents(sourceFile.fileName, currentDirectory); - sourcePathComponents.pop(); - if (!commonPathComponents) { - commonPathComponents = sourcePathComponents; - return; - } - for (var i = 0, n = Math.min(commonPathComponents.length, sourcePathComponents.length); i < n; i++) { - if (getCanonicalFileName(commonPathComponents[i]) !== getCanonicalFileName(sourcePathComponents[i])) { - if (i === 0) { - return true; - } - commonPathComponents.length = i; - break; - } - } - if (sourcePathComponents.length < commonPathComponents.length) { - commonPathComponents.length = sourcePathComponents.length; - } - }); - if (failed) { - return ""; } - if (!commonPathComponents) { - return currentDirectory; - } - return ts.getNormalizedPathFromPathComponents(commonPathComponents); + return computeCommonSourceDirectoryOfFilenames(fileNames, currentDirectory, getCanonicalFileName); } function checkSourceFilesBelongToPath(sourceFiles, rootDirectory) { var allFilesBelongToPath = true; if (sourceFiles) { var absoluteRootDirectoryPath = host.getCanonicalFileName(ts.getNormalizedAbsolutePath(rootDirectory, currentDirectory)); - for (var _i = 0, sourceFiles_2 = sourceFiles; _i < sourceFiles_2.length; _i++) { - var sourceFile = sourceFiles_2[_i]; + for (var _i = 0, sourceFiles_3 = sourceFiles; _i < sourceFiles_3.length; _i++) { + var sourceFile = sourceFiles_3[_i]; if (!ts.isDeclarationFile(sourceFile)) { var absoluteSourceFilePath = host.getCanonicalFileName(ts.getNormalizedAbsolutePath(sourceFile.fileName, currentDirectory)); if (absoluteSourceFilePath.indexOf(absoluteRootDirectoryPath) !== 0) { @@ -34588,6 +35978,17 @@ var ts; programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "sourceRoot", "sourceMap")); } } + if (options.declarationDir) { + if (!options.declaration) { + programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "declarationDir", "declaration")); + } + if (options.out || options.outFile) { + programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "declarationDir", options.out ? "out" : "outFile")); + } + } + if (options.lib && options.noLib) { + programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "lib", "noLib")); + } var languageVersion = options.target || 0; var outFile = options.outFile || options.out; var firstExternalModuleSourceFile = ts.forEach(files, function (f) { return ts.isExternalModule(f) ? f : undefined; }); @@ -34619,21 +36020,7 @@ var ts; programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Cannot_find_the_common_subdirectory_path_for_the_input_files)); } } - if (options.noEmit) { - if (options.out) { - programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "noEmit", "out")); - } - if (options.outFile) { - programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "noEmit", "outFile")); - } - if (options.outDir) { - programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "noEmit", "outDir")); - } - if (options.declaration) { - programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "noEmit", "declaration")); - } - } - else if (options.allowJs && options.declaration) { + if (!options.noEmit && options.allowJs && options.declaration) { programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "allowJs", "declaration")); } if (options.emitDecoratorMetadata && @@ -34720,89 +36107,89 @@ var ts; function spanInNode(node) { if (node) { switch (node.kind) { - case 197: + case 199: return spanInVariableDeclaration(node.declarationList.declarations[0]); - case 215: - case 143: - case 142: - return spanInVariableDeclaration(node); - case 140: - return spanInParameterDeclaration(node); case 217: - case 145: case 144: - case 147: - case 148: + case 143: + return spanInVariableDeclaration(node); + case 141: + return spanInParameterDeclaration(node); + case 219: case 146: - case 177: + case 145: + case 148: + case 149: + case 147: case 178: + case 179: return spanInFunctionDeclaration(node); - case 196: + case 198: if (ts.isFunctionBlock(node)) { return spanInFunctionBlock(node); } - case 223: + case 225: return spanInBlock(node); - case 248: + case 251: return spanInBlock(node.block); - case 199: - return textSpan(node.expression); - case 208: - return textSpan(node.getChildAt(0), node.expression); - case 202: - return textSpanEndingAtNextToken(node, node.expression); case 201: - return spanInNode(node.statement); - case 214: - return textSpan(node.getChildAt(0)); - case 200: - return textSpanEndingAtNextToken(node, node.expression); - case 211: - return spanInNode(node.statement); - case 207: - case 206: - return textSpan(node.getChildAt(0), node.label); - case 203: - return spanInForStatement(node); + return textSpan(node.expression); + case 210: + return textSpan(node.getChildAt(0), node.expression); case 204: return textSpanEndingAtNextToken(node, node.expression); - case 205: - return spanInInitializerOfForLike(node); - case 210: + case 203: + return spanInNode(node.statement); + case 216: + return textSpan(node.getChildAt(0)); + case 202: return textSpanEndingAtNextToken(node, node.expression); - case 245: - case 246: - return spanInNode(node.statements[0]); case 213: - return spanInBlock(node.tryBlock); + return spanInNode(node.statement); + case 209: + case 208: + return textSpan(node.getChildAt(0), node.label); + case 205: + return spanInForStatement(node); + case 206: + return textSpanEndingAtNextToken(node, node.expression); + case 207: + return spanInInitializerOfForLike(node); case 212: + return textSpanEndingAtNextToken(node, node.expression); + case 248: + case 249: + return spanInNode(node.statements[0]); + case 215: + return spanInBlock(node.tryBlock); + case 214: return textSpan(node, node.expression); - case 231: + case 234: return textSpan(node, node.expression); - case 225: + case 228: return textSpan(node, node.moduleReference); - case 226: + case 229: return textSpan(node, node.moduleSpecifier); - case 232: + case 235: return textSpan(node, node.moduleSpecifier); - case 222: + case 224: if (ts.getModuleInstanceState(node) !== 1) { return undefined; } - case 218: - case 221: - case 251: - case 167: - return textSpan(node); - case 209: - return spanInNode(node.statement); - case 141: - return spanInNodeArray(node.parent.decorators); - case 165: - case 166: - return spanInBindingPattern(node); - case 219: case 220: + case 223: + case 254: + case 168: + return textSpan(node); + case 211: + return spanInNode(node.statement); + case 142: + return spanInNodeArray(node.parent.decorators); + case 166: + case 167: + return spanInBindingPattern(node); + case 221: + case 222: return undefined; case 23: case 1: @@ -34830,20 +36217,20 @@ var ts; case 72: case 85: return spanInNextNode(node); - case 136: + case 137: return spanInOfKeyword(node); default: if (ts.isArrayLiteralOrObjectLiteralDestructuringPattern(node)) { return spanInArrayLiteralOrObjectLiteralDestructuringPattern(node); } if ((node.kind === 69 || - node.kind == 189 || - node.kind === 249 || - node.kind === 250) && + node.kind == 190 || + node.kind === 252 || + node.kind === 253) && ts.isArrayLiteralOrObjectLiteralDestructuringPattern(node.parent)) { return textSpan(node); } - if (node.kind === 185) { + if (node.kind === 186) { var binaryExpression = node; if (ts.isArrayLiteralOrObjectLiteralDestructuringPattern(binaryExpression.left)) { return spanInArrayLiteralOrObjectLiteralDestructuringPattern(binaryExpression.left); @@ -34858,38 +36245,38 @@ var ts; } if (ts.isExpression(node)) { switch (node.parent.kind) { - case 201: - return spanInPreviousNode(node); - case 141: - return spanInNode(node.parent); case 203: + return spanInPreviousNode(node); + case 142: + return spanInNode(node.parent); case 205: + case 207: return textSpan(node); - case 185: + case 186: if (node.parent.operatorToken.kind === 24) { return textSpan(node); } break; - case 178: + case 179: if (node.parent.body === node) { return textSpan(node); } break; } } - if (node.parent.kind === 249 && + if (node.parent.kind === 252 && node.parent.name === node && !ts.isArrayLiteralOrObjectLiteralDestructuringPattern(node.parent.parent)) { return spanInNode(node.parent.initializer); } - if (node.parent.kind === 175 && node.parent.type === node) { + if (node.parent.kind === 176 && node.parent.type === node) { return spanInNextNode(node.parent.type); } if (ts.isFunctionLike(node.parent) && node.parent.type === node) { return spanInPreviousNode(node); } - if ((node.parent.kind === 215 || - node.parent.kind === 140)) { + if ((node.parent.kind === 217 || + node.parent.kind === 141)) { var paramOrVarDecl = node.parent; if (paramOrVarDecl.initializer === node || paramOrVarDecl.type === node || @@ -34897,7 +36284,7 @@ var ts; return spanInPreviousNode(node); } } - if (node.parent.kind === 185) { + if (node.parent.kind === 186) { var binaryExpression = node.parent; if (ts.isArrayLiteralOrObjectLiteralDestructuringPattern(binaryExpression.left) && (binaryExpression.right === node || @@ -34918,7 +36305,7 @@ var ts; } } function spanInVariableDeclaration(variableDeclaration) { - if (variableDeclaration.parent.parent.kind === 204) { + if (variableDeclaration.parent.parent.kind === 206) { return spanInNode(variableDeclaration.parent.parent); } if (ts.isBindingPattern(variableDeclaration.name)) { @@ -34926,7 +36313,7 @@ var ts; } if (variableDeclaration.initializer || (variableDeclaration.flags & 1) || - variableDeclaration.parent.parent.kind === 205) { + variableDeclaration.parent.parent.kind === 207) { return textSpanFromVariableDeclaration(variableDeclaration); } var declarations = variableDeclaration.parent.declarations; @@ -34958,7 +36345,7 @@ var ts; } function canFunctionHaveSpanInWholeDeclaration(functionDeclaration) { return !!(functionDeclaration.flags & 1) || - (functionDeclaration.parent.kind === 218 && functionDeclaration.kind !== 146); + (functionDeclaration.parent.kind === 220 && functionDeclaration.kind !== 147); } function spanInFunctionDeclaration(functionDeclaration) { if (!functionDeclaration.body) { @@ -34978,29 +36365,29 @@ var ts; } function spanInBlock(block) { switch (block.parent.kind) { - case 222: + case 224: if (ts.getModuleInstanceState(block.parent) !== 1) { return undefined; } - case 202: - case 200: case 204: + case 202: + case 206: return spanInNodeIfStartsOnSameLine(block.parent, block.statements[0]); - case 203: case 205: + case 207: return spanInNodeIfStartsOnSameLine(ts.findPrecedingToken(block.pos, sourceFile, block.parent), block.statements[0]); } return spanInNode(block.statements[0]); } - function spanInInitializerOfForLike(forLikeStaement) { - if (forLikeStaement.initializer.kind === 216) { - var variableDeclarationList = forLikeStaement.initializer; + function spanInInitializerOfForLike(forLikeStatement) { + if (forLikeStatement.initializer.kind === 218) { + var variableDeclarationList = forLikeStatement.initializer; if (variableDeclarationList.declarations.length > 0) { return spanInNode(variableDeclarationList.declarations[0]); } } else { - return spanInNode(forLikeStaement.initializer); + return spanInNode(forLikeStatement.initializer); } } function spanInForStatement(forStatement) { @@ -35015,62 +36402,62 @@ var ts; } } function spanInBindingPattern(bindingPattern) { - var firstBindingElement = ts.forEach(bindingPattern.elements, function (element) { return element.kind !== 191 ? element : undefined; }); + var firstBindingElement = ts.forEach(bindingPattern.elements, function (element) { return element.kind !== 192 ? element : undefined; }); if (firstBindingElement) { return spanInNode(firstBindingElement); } - if (bindingPattern.parent.kind === 167) { + if (bindingPattern.parent.kind === 168) { return textSpan(bindingPattern.parent); } return textSpanFromVariableDeclaration(bindingPattern.parent); } function spanInArrayLiteralOrObjectLiteralDestructuringPattern(node) { - ts.Debug.assert(node.kind !== 166 && node.kind !== 165); - var elements = node.kind === 168 ? + ts.Debug.assert(node.kind !== 167 && node.kind !== 166); + var elements = node.kind === 169 ? node.elements : node.properties; - var firstBindingElement = ts.forEach(elements, function (element) { return element.kind !== 191 ? element : undefined; }); + var firstBindingElement = ts.forEach(elements, function (element) { return element.kind !== 192 ? element : undefined; }); if (firstBindingElement) { return spanInNode(firstBindingElement); } - return textSpan(node.parent.kind === 185 ? node.parent : node); + return textSpan(node.parent.kind === 186 ? node.parent : node); } function spanInOpenBraceToken(node) { switch (node.parent.kind) { - case 221: + case 223: var enumDeclaration = node.parent; return spanInNodeIfStartsOnSameLine(ts.findPrecedingToken(node.pos, sourceFile, node.parent), enumDeclaration.members.length ? enumDeclaration.members[0] : enumDeclaration.getLastToken(sourceFile)); - case 218: + case 220: var classDeclaration = node.parent; return spanInNodeIfStartsOnSameLine(ts.findPrecedingToken(node.pos, sourceFile, node.parent), classDeclaration.members.length ? classDeclaration.members[0] : classDeclaration.getLastToken(sourceFile)); - case 224: + case 226: return spanInNodeIfStartsOnSameLine(node.parent.parent, node.parent.clauses[0]); } return spanInNode(node.parent); } function spanInCloseBraceToken(node) { switch (node.parent.kind) { - case 223: + case 225: if (ts.getModuleInstanceState(node.parent.parent) !== 1) { return undefined; } - case 221: - case 218: + case 223: + case 220: return textSpan(node); - case 196: + case 198: if (ts.isFunctionBlock(node.parent)) { return textSpan(node); } - case 248: + case 251: return spanInNode(ts.lastOrUndefined(node.parent.statements)); - case 224: + case 226: var caseBlock = node.parent; var lastClause = ts.lastOrUndefined(caseBlock.clauses); if (lastClause) { return spanInNode(ts.lastOrUndefined(lastClause.statements)); } return undefined; - case 165: + case 166: var bindingPattern = node.parent; return spanInNode(ts.lastOrUndefined(bindingPattern.elements) || bindingPattern); default: @@ -35083,7 +36470,7 @@ var ts; } function spanInCloseBracketToken(node) { switch (node.parent.kind) { - case 166: + case 167: var bindingPattern = node.parent; return textSpan(ts.lastOrUndefined(bindingPattern.elements) || bindingPattern); default: @@ -35095,33 +36482,33 @@ var ts; } } function spanInOpenParenToken(node) { - if (node.parent.kind === 201 || - node.parent.kind === 172 || - node.parent.kind === 173) { + if (node.parent.kind === 203 || + node.parent.kind === 173 || + node.parent.kind === 174) { return spanInPreviousNode(node); } - if (node.parent.kind === 176) { + if (node.parent.kind === 177) { return spanInNextNode(node); } return spanInNode(node.parent); } function spanInCloseParenToken(node) { switch (node.parent.kind) { - case 177: - case 217: case 178: - case 145: - case 144: - case 147: - case 148: + case 219: + case 179: case 146: - case 202: - case 201: + case 145: + case 148: + case 149: + case 147: + case 204: case 203: case 205: - case 172: + case 207: case 173: - case 176: + case 174: + case 177: return spanInPreviousNode(node); default: return spanInNode(node.parent); @@ -35129,26 +36516,26 @@ var ts; } function spanInColonToken(node) { if (ts.isFunctionLike(node.parent) || - node.parent.kind === 249 || - node.parent.kind === 140) { + node.parent.kind === 252 || + node.parent.kind === 141) { return spanInPreviousNode(node); } return spanInNode(node.parent); } function spanInGreaterThanOrLessThanToken(node) { - if (node.parent.kind === 175) { + if (node.parent.kind === 176) { return spanInNextNode(node); } return spanInNode(node.parent); } function spanInWhileKeyword(node) { - if (node.parent.kind === 201) { + if (node.parent.kind === 203) { return textSpanEndingAtNextToken(node, node.parent.expression); } return spanInNode(node.parent); } function spanInOfKeyword(node) { - if (node.parent.kind === 205) { + if (node.parent.kind === 207) { return spanInNextNode(node); } return spanInNode(node.parent); @@ -35226,7 +36613,7 @@ var ts; } } function autoCollapse(node) { - return ts.isFunctionBlock(node) && node.parent.kind !== 178; + return ts.isFunctionBlock(node) && node.parent.kind !== 179; } var depth = 0; var maxDepth = 20; @@ -35238,26 +36625,26 @@ var ts; addOutliningForLeadingCommentsForNode(n); } switch (n.kind) { - case 196: + case 198: if (!ts.isFunctionBlock(n)) { - var parent_9 = n.parent; + var parent_11 = n.parent; var openBrace = ts.findChildOfKind(n, 15, sourceFile); var closeBrace = ts.findChildOfKind(n, 16, sourceFile); - if (parent_9.kind === 201 || - parent_9.kind === 204 || - parent_9.kind === 205 || - parent_9.kind === 203 || - parent_9.kind === 200 || - parent_9.kind === 202 || - parent_9.kind === 209 || - parent_9.kind === 248) { - addOutliningSpan(parent_9, openBrace, closeBrace, autoCollapse(n)); + if (parent_11.kind === 203 || + parent_11.kind === 206 || + parent_11.kind === 207 || + parent_11.kind === 205 || + parent_11.kind === 202 || + parent_11.kind === 204 || + parent_11.kind === 211 || + parent_11.kind === 251) { + addOutliningSpan(parent_11, openBrace, closeBrace, autoCollapse(n)); break; } - if (parent_9.kind === 213) { - var tryStatement = parent_9; + if (parent_11.kind === 215) { + var tryStatement = parent_11; if (tryStatement.tryBlock === n) { - addOutliningSpan(parent_9, openBrace, closeBrace, autoCollapse(n)); + addOutliningSpan(parent_11, openBrace, closeBrace, autoCollapse(n)); break; } else if (tryStatement.finallyBlock === n) { @@ -35277,23 +36664,23 @@ var ts; }); break; } - case 223: { + case 225: { var openBrace = ts.findChildOfKind(n, 15, sourceFile); var closeBrace = ts.findChildOfKind(n, 16, sourceFile); addOutliningSpan(n.parent, openBrace, closeBrace, autoCollapse(n)); break; } - case 218: - case 219: + case 220: case 221: - case 169: - case 224: { + case 223: + case 170: + case 226: { var openBrace = ts.findChildOfKind(n, 15, sourceFile); var closeBrace = ts.findChildOfKind(n, 16, sourceFile); addOutliningSpan(n, openBrace, closeBrace, autoCollapse(n)); break; } - case 168: + case 169: var openBracket = ts.findChildOfKind(n, 19, sourceFile); var closeBracket = ts.findChildOfKind(n, 20, sourceFile); addOutliningSpan(n, openBracket, closeBracket, autoCollapse(n)); @@ -35320,10 +36707,10 @@ var ts; ts.forEach(program.getSourceFiles(), function (sourceFile) { cancellationToken.throwIfCancellationRequested(); var nameToDeclarations = sourceFile.getNamedDeclarations(); - for (var name_31 in nameToDeclarations) { - var declarations = ts.getProperty(nameToDeclarations, name_31); + for (var name_34 in nameToDeclarations) { + var declarations = ts.getProperty(nameToDeclarations, name_34); if (declarations) { - var matches = patternMatcher.getMatchesForLastSegmentOfPattern(name_31); + var matches = patternMatcher.getMatchesForLastSegmentOfPattern(name_34); if (!matches) { continue; } @@ -35334,14 +36721,14 @@ var ts; if (!containers) { return undefined; } - matches = patternMatcher.getMatches(containers, name_31); + matches = patternMatcher.getMatches(containers, name_34); if (!matches) { continue; } } var fileName = sourceFile.fileName; var matchKind = bestMatchKind(matches); - rawItems.push({ name: name_31, fileName: fileName, matchKind: matchKind, isCaseSensitive: allMatchesAreCaseSensitive(matches), declaration: declaration }); + rawItems.push({ name: name_34, fileName: fileName, matchKind: matchKind, isCaseSensitive: allMatchesAreCaseSensitive(matches), declaration: declaration }); } } } @@ -35378,7 +36765,7 @@ var ts; if (text !== undefined) { containers.unshift(text); } - else if (declaration.name.kind === 138) { + else if (declaration.name.kind === 139) { return tryAddComputedPropertyName(declaration.name.expression, containers, true); } else { @@ -35395,7 +36782,7 @@ var ts; } return true; } - if (expression.kind === 170) { + if (expression.kind === 171) { var propertyAccess = expression; if (includeLastPortion) { containers.unshift(propertyAccess.name.text); @@ -35406,7 +36793,7 @@ var ts; } function getContainers(declaration) { var containers = []; - if (declaration.name.kind === 138) { + if (declaration.name.kind === 139) { if (!tryAddComputedPropertyName(declaration.name.expression, containers, false)) { return undefined; } @@ -35461,6 +36848,9 @@ var ts; var NavigationBar; (function (NavigationBar) { function getNavigationBarItems(sourceFile, compilerOptions) { + if (ts.isSourceFileJavaScript(sourceFile)) { + return getJsNavigationBarItems(sourceFile, compilerOptions); + } var hasGlobalNode = false; return getItemsWorker(getTopLevelNodes(sourceFile), createTopLevelItem); function getIndent(node) { @@ -35468,14 +36858,14 @@ var ts; var current = node.parent; while (current) { switch (current.kind) { - case 222: + case 224: do { current = current.parent; - } while (current.kind === 222); - case 218: + } while (current.kind === 224); + case 220: + case 223: case 221: case 219: - case 217: indent++; } current = current.parent; @@ -35486,26 +36876,26 @@ var ts; var childNodes = []; function visit(node) { switch (node.kind) { - case 197: + case 199: ts.forEach(node.declarationList.declarations, visit); break; - case 165: case 166: + case 167: ts.forEach(node.elements, visit); break; - case 232: + case 235: if (node.exportClause) { ts.forEach(node.exportClause.elements, visit); } break; - case 226: + case 229: var importClause = node.importClause; if (importClause) { if (importClause.name) { childNodes.push(importClause); } if (importClause.namedBindings) { - if (importClause.namedBindings.kind === 228) { + if (importClause.namedBindings.kind === 231) { childNodes.push(importClause.namedBindings); } else { @@ -35514,20 +36904,20 @@ var ts; } } break; - case 167: - case 215: + case 168: + case 217: if (ts.isBindingPattern(node.name)) { visit(node.name); break; } - case 218: + case 220: + case 223: case 221: + case 224: case 219: - case 222: - case 217: - case 225: - case 230: - case 234: + case 228: + case 233: + case 237: childNodes.push(node); break; } @@ -35562,17 +36952,30 @@ var ts; for (var _i = 0, nodes_4 = nodes; _i < nodes_4.length; _i++) { var node = nodes_4[_i]; switch (node.kind) { - case 218: + case 220: + topLevelNodes.push(node); + for (var _a = 0, _b = node.members; _a < _b.length; _a++) { + var member = _b[_a]; + if (member.kind === 146 || member.kind === 147) { + if (member.body) { + if (hasNamedFunctionDeclarations(member.body.statements)) { + topLevelNodes.push(member); + } + addTopLevelNodes(member.body.statements, topLevelNodes); + } + } + } + break; + case 223: case 221: - case 219: topLevelNodes.push(node); break; - case 222: + case 224: var moduleDeclaration = node; topLevelNodes.push(node); addTopLevelNodes(getInnermostModule(moduleDeclaration).body.statements, topLevelNodes); break; - case 217: + case 219: var functionDeclaration = node; if (isTopLevelFunctionDeclaration(functionDeclaration)) { topLevelNodes.push(node); @@ -35582,15 +36985,31 @@ var ts; } } } + function hasNamedFunctionDeclarations(nodes) { + for (var _i = 0, nodes_5 = nodes; _i < nodes_5.length; _i++) { + var s = nodes_5[_i]; + if (s.kind === 219 && !isEmpty(s.name.text)) { + return true; + } + } + return false; + } function isTopLevelFunctionDeclaration(functionDeclaration) { - if (functionDeclaration.kind === 217) { - if (functionDeclaration.body && functionDeclaration.body.kind === 196) { - if (ts.forEach(functionDeclaration.body.statements, function (s) { return s.kind === 217 && !isEmpty(s.name.text); })) { + if (functionDeclaration.kind === 219) { + if (functionDeclaration.body && functionDeclaration.body.kind === 198) { + if (hasNamedFunctionDeclarations(functionDeclaration.body.statements)) { return true; } if (!ts.isFunctionBlock(functionDeclaration.parent)) { return true; } + else { + var grandParentKind = functionDeclaration.parent.parent.kind; + if (grandParentKind === 146 || + grandParentKind === 147) { + return true; + } + } } } return false; @@ -35598,8 +37017,8 @@ var ts; function getItemsWorker(nodes, createItem) { var items = []; var keyToItem = {}; - for (var _i = 0, nodes_5 = nodes; _i < nodes_5.length; _i++) { - var child = nodes_5[_i]; + for (var _i = 0, nodes_6 = nodes; _i < nodes_6.length; _i++) { + var child = nodes_6[_i]; var item = createItem(child); if (item !== undefined) { if (item.text.length > 0) { @@ -35638,7 +37057,7 @@ var ts; } function createChildItem(node) { switch (node.kind) { - case 140: + case 141: if (ts.isBindingPattern(node.name)) { break; } @@ -35646,34 +37065,34 @@ var ts; return undefined; } return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.memberVariableElement); + case 146: case 145: - case 144: return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.memberFunctionElement); - case 147: - return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.memberGetAccessorElement); case 148: - return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.memberSetAccessorElement); - case 151: - return createItem(node, "[]", ts.ScriptElementKind.indexSignatureElement); - case 251: - return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.memberVariableElement); + return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.memberGetAccessorElement); case 149: - return createItem(node, "()", ts.ScriptElementKind.callSignatureElement); - case 150: - return createItem(node, "new()", ts.ScriptElementKind.constructSignatureElement); - case 143: - case 142: + return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.memberSetAccessorElement); + case 152: + return createItem(node, "[]", ts.ScriptElementKind.indexSignatureElement); + case 254: return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.memberVariableElement); - case 217: + case 150: + return createItem(node, "()", ts.ScriptElementKind.callSignatureElement); + case 151: + return createItem(node, "new()", ts.ScriptElementKind.constructSignatureElement); + case 144: + case 143: + return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.memberVariableElement); + case 219: return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.functionElement); - case 215: - case 167: + case 217: + case 168: var variableDeclarationNode = void 0; - var name_32; - if (node.kind === 167) { - name_32 = node.name; + var name_35; + if (node.kind === 168) { + name_35 = node.name; variableDeclarationNode = node; - while (variableDeclarationNode && variableDeclarationNode.kind !== 215) { + while (variableDeclarationNode && variableDeclarationNode.kind !== 217) { variableDeclarationNode = variableDeclarationNode.parent; } ts.Debug.assert(variableDeclarationNode !== undefined); @@ -35681,24 +37100,24 @@ var ts; else { ts.Debug.assert(!ts.isBindingPattern(node.name)); variableDeclarationNode = node; - name_32 = node.name; + name_35 = node.name; } if (ts.isConst(variableDeclarationNode)) { - return createItem(node, getTextOfNode(name_32), ts.ScriptElementKind.constElement); + return createItem(node, getTextOfNode(name_35), ts.ScriptElementKind.constElement); } else if (ts.isLet(variableDeclarationNode)) { - return createItem(node, getTextOfNode(name_32), ts.ScriptElementKind.letElement); + return createItem(node, getTextOfNode(name_35), ts.ScriptElementKind.letElement); } else { - return createItem(node, getTextOfNode(name_32), ts.ScriptElementKind.variableElement); + return createItem(node, getTextOfNode(name_35), ts.ScriptElementKind.variableElement); } - case 146: + case 147: return createItem(node, "constructor", ts.ScriptElementKind.constructorImplementationElement); - case 234: - case 230: - case 225: - case 227: + case 237: + case 233: case 228: + case 230: + case 231: return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.alias); } return undefined; @@ -35728,17 +37147,20 @@ var ts; } function createTopLevelItem(node) { switch (node.kind) { - case 252: + case 255: return createSourceFileItem(node); - case 218: + case 220: return createClassItem(node); - case 221: + case 146: + case 147: + return createMemberFunctionLikeItem(node); + case 223: return createEnumItem(node); - case 219: - return createIterfaceItem(node); - case 222: + case 221: + return createInterfaceItem(node); + case 224: return createModuleItem(node); - case 217: + case 219: return createFunctionItem(node); } return undefined; @@ -35748,7 +37170,7 @@ var ts; } var result = []; result.push(moduleDeclaration.name.text); - while (moduleDeclaration.body && moduleDeclaration.body.kind === 222) { + while (moduleDeclaration.body && moduleDeclaration.body.kind === 224) { moduleDeclaration = moduleDeclaration.body; result.push(moduleDeclaration.name.text); } @@ -35760,12 +37182,29 @@ var ts; return getNavigationBarItem(moduleName, ts.ScriptElementKind.moduleElement, ts.getNodeModifiers(node), [getNodeSpan(node)], childItems, getIndent(node)); } function createFunctionItem(node) { - if (node.body && node.body.kind === 196) { + if (node.body && node.body.kind === 198) { var childItems = getItemsWorker(sortNodes(node.body.statements), createChildItem); return getNavigationBarItem(!node.name ? "default" : node.name.text, ts.ScriptElementKind.functionElement, ts.getNodeModifiers(node), [getNodeSpan(node)], childItems, getIndent(node)); } return undefined; } + function createMemberFunctionLikeItem(node) { + if (node.body && node.body.kind === 198) { + var childItems = getItemsWorker(sortNodes(node.body.statements), createChildItem); + var scriptElementKind = void 0; + var memberFunctionName = void 0; + if (node.kind === 146) { + memberFunctionName = ts.getPropertyNameForPropertyNameNode(node.name); + scriptElementKind = ts.ScriptElementKind.memberFunctionElement; + } + else { + memberFunctionName = "constructor"; + scriptElementKind = ts.ScriptElementKind.constructorImplementationElement; + } + return getNavigationBarItem(memberFunctionName, scriptElementKind, ts.getNodeModifiers(node), [getNodeSpan(node)], childItems, getIndent(node)); + } + return undefined; + } function createSourceFileItem(node) { var childItems = getItemsWorker(getChildNodes(node.statements), createChildItem); if (childItems === undefined || childItems.length === 0) { @@ -35781,7 +37220,7 @@ var ts; var childItems; if (node.members) { var constructor = ts.forEach(node.members, function (member) { - return member.kind === 146 && member; + return member.kind === 147 && member; }); var nodes = removeDynamicallyNamedProperties(node); if (constructor) { @@ -35796,25 +37235,25 @@ var ts; var childItems = getItemsWorker(sortNodes(removeComputedProperties(node)), createChildItem); return getNavigationBarItem(node.name.text, ts.ScriptElementKind.enumElement, ts.getNodeModifiers(node), [getNodeSpan(node)], childItems, getIndent(node)); } - function createIterfaceItem(node) { + function createInterfaceItem(node) { var childItems = getItemsWorker(sortNodes(removeDynamicallyNamedProperties(node)), createChildItem); return getNavigationBarItem(node.name.text, ts.ScriptElementKind.interfaceElement, ts.getNodeModifiers(node), [getNodeSpan(node)], childItems, getIndent(node)); } } function removeComputedProperties(node) { - return ts.filter(node.members, function (member) { return member.name === undefined || member.name.kind !== 138; }); + return ts.filter(node.members, function (member) { return member.name === undefined || member.name.kind !== 139; }); } function removeDynamicallyNamedProperties(node) { return ts.filter(node.members, function (member) { return !ts.hasDynamicName(member); }); } function getInnermostModule(node) { - while (node.body.kind === 222) { + while (node.body.kind === 224) { node = node.body; } return node; } function getNodeSpan(node) { - return node.kind === 252 + return node.kind === 255 ? ts.createTextSpanFromBounds(node.getFullStart(), node.getEnd()) : ts.createTextSpanFromBounds(node.getStart(), node.getEnd()); } @@ -35823,6 +37262,171 @@ var ts; } } NavigationBar.getNavigationBarItems = getNavigationBarItems; + function getJsNavigationBarItems(sourceFile, compilerOptions) { + var anonFnText = ""; + var anonClassText = ""; + var indent = 0; + var rootName = ts.isExternalModule(sourceFile) ? + "\"" + ts.escapeString(ts.getBaseFileName(ts.removeFileExtension(ts.normalizePath(sourceFile.fileName)))) + "\"" + : ""; + var sourceFileItem = getNavBarItem(rootName, ts.ScriptElementKind.moduleElement, [getNodeSpan(sourceFile)]); + var topItem = sourceFileItem; + ts.forEachChild(sourceFile, visitNode); + function visitNode(node) { + var newItem = createNavBarItem(node); + if (newItem) { + topItem.childItems.push(newItem); + } + if (newItem && (ts.isFunctionLike(node) || ts.isClassLike(node))) { + var lastTop = topItem; + indent++; + topItem = newItem; + ts.forEachChild(node, visitNode); + topItem = lastTop; + indent--; + if (newItem && newItem.text === anonFnText && newItem.childItems.length === 0) { + topItem.childItems.pop(); + } + } + else { + ts.forEachChild(node, visitNode); + } + } + function createNavBarItem(node) { + switch (node.kind) { + case 217: + if (node.parent.parent + .parent.kind !== 255) { + return undefined; + } + var varDecl = node; + if (varDecl.initializer && (varDecl.initializer.kind === 178 || + varDecl.initializer.kind === 179 || + varDecl.initializer.kind === 191)) { + return undefined; + } + case 219: + case 220: + case 147: + case 148: + case 149: + var name_36 = node.flags && (node.flags & 512) && !node.name ? "default" : + node.kind === 147 ? "constructor" : + ts.declarationNameToString(node.name); + return getNavBarItem(name_36, getScriptKindForElementKind(node.kind), [getNodeSpan(node)]); + case 178: + case 179: + case 191: + return getDefineModuleItem(node) || getFunctionOrClassExpressionItem(node); + case 146: + var methodDecl = node; + return getNavBarItem(ts.declarationNameToString(methodDecl.name), ts.ScriptElementKind.memberFunctionElement, [getNodeSpan(node)]); + case 234: + return getNavBarItem("default", ts.ScriptElementKind.variableElement, [getNodeSpan(node)]); + case 230: + if (!node.name) { + return undefined; + } + case 233: + case 231: + case 237: + if (node.kind === 237) { + if (!node.parent.parent.moduleSpecifier && !node.propertyName) { + return undefined; + } + } + var decl = node; + if (!decl.name) { + return undefined; + } + var declName = ts.declarationNameToString(decl.name); + return getNavBarItem(declName, ts.ScriptElementKind.constElement, [getNodeSpan(node)]); + default: + return undefined; + } + } + function getNavBarItem(text, kind, spans, kindModifiers) { + if (kindModifiers === void 0) { kindModifiers = ts.ScriptElementKindModifier.none; } + return { + text: text, kind: kind, kindModifiers: kindModifiers, spans: spans, childItems: [], indent: indent, bolded: false, grayed: false + }; + } + function getDefineModuleItem(node) { + if (node.kind !== 178 && node.kind !== 179) { + return undefined; + } + if (node.parent.kind !== 173) { + return undefined; + } + var callExpr = node.parent; + if (callExpr.expression.kind !== 69 || callExpr.expression.getText() !== 'define') { + return undefined; + } + var defaultName = node.getSourceFile().fileName; + if (callExpr.arguments[0].kind === 9) { + defaultName = (callExpr.arguments[0]).text; + } + return getNavBarItem(defaultName, ts.ScriptElementKind.moduleElement, [getNodeSpan(node.parent)]); + } + function getFunctionOrClassExpressionItem(node) { + if (node.kind !== 178 && + node.kind !== 179 && + node.kind !== 191) { + return undefined; + } + var fnExpr = node; + var fnName; + if (fnExpr.name && ts.getFullWidth(fnExpr.name) > 0) { + fnName = ts.declarationNameToString(fnExpr.name); + } + else { + if (fnExpr.parent.kind === 217) { + fnName = ts.declarationNameToString(fnExpr.parent.name); + } + else if (fnExpr.parent.kind === 186 && + fnExpr.parent.operatorToken.kind === 56) { + fnName = fnExpr.parent.left.getText(); + if (fnName.length > 20) { + fnName = fnName.substring(0, 17) + "..."; + } + } + else if (fnExpr.parent.kind === 252 && + fnExpr.parent.name) { + fnName = fnExpr.parent.name.getText(); + } + else { + fnName = node.kind === 191 ? anonClassText : anonFnText; + } + } + var scriptKind = node.kind === 191 ? ts.ScriptElementKind.classElement : ts.ScriptElementKind.functionElement; + return getNavBarItem(fnName, scriptKind, [getNodeSpan(node)]); + } + function getNodeSpan(node) { + return node.kind === 255 + ? ts.createTextSpanFromBounds(node.getFullStart(), node.getEnd()) + : ts.createTextSpanFromBounds(node.getStart(), node.getEnd()); + } + function getScriptKindForElementKind(kind) { + switch (kind) { + case 217: + return ts.ScriptElementKind.variableElement; + case 219: + return ts.ScriptElementKind.functionElement; + case 220: + return ts.ScriptElementKind.classElement; + case 147: + return ts.ScriptElementKind.constructorImplementationElement; + case 148: + return ts.ScriptElementKind.memberGetAccessorElement; + case 149: + return ts.ScriptElementKind.memberSetAccessorElement; + default: + return "unknown"; + } + } + return sourceFileItem.childItems; + } + NavigationBar.getJsNavigationBarItems = getJsNavigationBarItems; })(NavigationBar = ts.NavigationBar || (ts.NavigationBar = {})); })(ts || (ts = {})); var ts; @@ -36269,14 +37873,14 @@ var ts; } return createSignatureHelpItems(candidates, resolvedSignature, argumentInfo); function createJavaScriptSignatureHelpItems(argumentInfo) { - if (argumentInfo.invocation.kind !== 172) { + if (argumentInfo.invocation.kind !== 173) { return undefined; } var callExpression = argumentInfo.invocation; var expression = callExpression.expression; var name = expression.kind === 69 ? expression - : expression.kind === 170 + : expression.kind === 171 ? expression.name : undefined; if (!name || !name.text) { @@ -36305,7 +37909,7 @@ var ts; } } function getImmediatelyContainingArgumentInfo(node) { - if (node.parent.kind === 172 || node.parent.kind === 173) { + if (node.parent.kind === 173 || node.parent.kind === 174) { var callExpression = node.parent; if (node.kind === 25 || node.kind === 17) { @@ -36336,23 +37940,23 @@ var ts; }; } } - else if (node.kind === 11 && node.parent.kind === 174) { + else if (node.kind === 11 && node.parent.kind === 175) { if (ts.isInsideTemplateLiteral(node, position)) { return getArgumentListInfoForTemplate(node.parent, 0); } } - else if (node.kind === 12 && node.parent.parent.kind === 174) { + else if (node.kind === 12 && node.parent.parent.kind === 175) { var templateExpression = node.parent; var tagExpression = templateExpression.parent; - ts.Debug.assert(templateExpression.kind === 187); + ts.Debug.assert(templateExpression.kind === 188); var argumentIndex = ts.isInsideTemplateLiteral(node, position) ? 0 : 1; return getArgumentListInfoForTemplate(tagExpression, argumentIndex); } - else if (node.parent.kind === 194 && node.parent.parent.parent.kind === 174) { + else if (node.parent.kind === 196 && node.parent.parent.parent.kind === 175) { var templateSpan = node.parent; var templateExpression = templateSpan.parent; var tagExpression = templateExpression.parent; - ts.Debug.assert(templateExpression.kind === 187); + ts.Debug.assert(templateExpression.kind === 188); if (node.kind === 14 && !ts.isInsideTemplateLiteral(node, position)) { return undefined; } @@ -36416,7 +38020,7 @@ var ts; var template = taggedTemplate.template; var applicableSpanStart = template.getStart(); var applicableSpanEnd = template.getEnd(); - if (template.kind === 187) { + if (template.kind === 188) { var lastSpan = ts.lastOrUndefined(template.templateSpans); if (lastSpan.literal.getFullWidth() === 0) { applicableSpanEnd = ts.skipTrivia(sourceFile.text, applicableSpanEnd, false); @@ -36425,7 +38029,7 @@ var ts; return ts.createTextSpan(applicableSpanStart, applicableSpanEnd - applicableSpanStart); } function getContainingArgumentInfo(node) { - for (var n = node; n.kind !== 252; n = n.parent) { + for (var n = node; n.kind !== 255; n = n.parent) { if (ts.isFunctionBlock(n)) { return undefined; } @@ -36480,7 +38084,7 @@ var ts; signatureHelpParameters = typeParameters && typeParameters.length > 0 ? ts.map(typeParameters, createSignatureHelpParameterForTypeParameter) : emptyArray; suffixDisplayParts.push(ts.punctuationPart(27)); var parameterParts = ts.mapToDisplayParts(function (writer) { - return typeChecker.getSymbolDisplayBuilder().buildDisplayForParametersAndDelimiters(candidateSignature.parameters, writer, invocation); + return typeChecker.getSymbolDisplayBuilder().buildDisplayForParametersAndDelimiters(candidateSignature.thisType, candidateSignature.parameters, writer, invocation); }); ts.addRange(suffixDisplayParts, parameterParts); } @@ -36550,24 +38154,6 @@ var ts; })(ts || (ts = {})); var ts; (function (ts) { - function getEndLinePosition(line, sourceFile) { - ts.Debug.assert(line >= 0); - var lineStarts = sourceFile.getLineStarts(); - var lineIndex = line; - if (lineIndex + 1 === lineStarts.length) { - return sourceFile.text.length - 1; - } - else { - var start = lineStarts[lineIndex]; - var pos = lineStarts[lineIndex + 1] - 1; - ts.Debug.assert(ts.isLineBreak(sourceFile.text.charCodeAt(pos))); - while (start <= pos && ts.isLineBreak(sourceFile.text.charCodeAt(pos))) { - pos--; - } - return pos; - } - } - ts.getEndLinePosition = getEndLinePosition; function getLineStartPositionForPosition(position, sourceFile) { var lineStarts = sourceFile.getLineStarts(); var line = sourceFile.getLineAndCharacterOfPosition(position).line; @@ -36605,39 +38191,39 @@ var ts; return false; } switch (n.kind) { - case 218: - case 219: + case 220: case 221: - case 169: - case 165: - case 157: - case 196: case 223: - case 224: + case 170: + case 166: + case 158: + case 198: + case 225: + case 226: return nodeEndsWith(n, 16, sourceFile); - case 248: + case 251: return isCompletedNode(n.block, sourceFile); - case 173: + case 174: if (!n.arguments) { return true; } - case 172: - case 176: - case 162: + case 173: + case 177: + case 163: return nodeEndsWith(n, 18, sourceFile); - case 154: case 155: + case 156: return isCompletedNode(n.type, sourceFile); - case 146: case 147: case 148: - case 217: - case 177: - case 145: - case 144: - case 150: case 149: + case 219: case 178: + case 146: + case 145: + case 151: + case 150: + case 179: if (n.body) { return isCompletedNode(n.body, sourceFile); } @@ -36645,62 +38231,62 @@ var ts; return isCompletedNode(n.type, sourceFile); } return hasChildOfKind(n, 18, sourceFile); - case 222: + case 224: return n.body && isCompletedNode(n.body, sourceFile); - case 200: + case 202: if (n.elseStatement) { return isCompletedNode(n.elseStatement, sourceFile); } return isCompletedNode(n.thenStatement, sourceFile); - case 199: + case 201: return isCompletedNode(n.expression, sourceFile) || hasChildOfKind(n, 23); - case 168: - case 166: - case 171: - case 138: - case 159: + case 169: + case 167: + case 172: + case 139: + case 160: return nodeEndsWith(n, 20, sourceFile); - case 151: + case 152: if (n.type) { return isCompletedNode(n.type, sourceFile); } return hasChildOfKind(n, 20, sourceFile); - case 245: - case 246: + case 248: + case 249: return false; - case 203: - case 204: case 205: - case 202: + case 206: + case 207: + case 204: return isCompletedNode(n.statement, sourceFile); - case 201: + case 203: var hasWhileKeyword = findChildOfKind(n, 104, sourceFile); if (hasWhileKeyword) { return nodeEndsWith(n, 18, sourceFile); } return isCompletedNode(n.statement, sourceFile); - case 156: + case 157: return isCompletedNode(n.exprName, sourceFile); - case 180: - case 179: case 181: - case 188: + case 180: + case 182: case 189: + case 190: var unaryWordExpression = n; return isCompletedNode(unaryWordExpression.expression, sourceFile); - case 174: + case 175: return isCompletedNode(n.template, sourceFile); - case 187: + case 188: var lastSpan = ts.lastOrUndefined(n.templateSpans); return isCompletedNode(lastSpan, sourceFile); - case 194: + case 196: return ts.nodeIsPresent(n.literal); - case 183: + case 184: return isCompletedNode(n.operand, sourceFile); - case 185: - return isCompletedNode(n.right, sourceFile); case 186: + return isCompletedNode(n.right, sourceFile); + case 187: return isCompletedNode(n.whenFalse, sourceFile); default: return true; @@ -36743,7 +38329,7 @@ var ts; ts.findChildOfKind = findChildOfKind; function findContainingList(node) { var syntaxList = ts.forEach(node.parent.getChildren(), function (c) { - if (c.kind === 275 && c.pos <= node.pos && c.end >= node.end) { + if (c.kind === 278 && c.pos <= node.pos && c.end >= node.end) { return c; } }); @@ -36823,7 +38409,7 @@ var ts; function findPrecedingToken(position, sourceFile, startNode) { return find(startNode || sourceFile); function findRightmostToken(n) { - if (isToken(n) || n.kind === 240) { + if (isToken(n) || n.kind === 243) { return n; } var children = n.getChildren(); @@ -36831,16 +38417,16 @@ var ts; return candidate && findRightmostToken(candidate); } function find(n) { - if (isToken(n) || n.kind === 240) { + if (isToken(n) || n.kind === 243) { return n; } var children = n.getChildren(); for (var i = 0, len = children.length; i < len; i++) { var child = children[i]; - if (position < child.end && (nodeHasTokens(child) || child.kind === 240)) { + if (position < child.end && (nodeHasTokens(child) || child.kind === 243)) { var start = child.getStart(sourceFile); var lookInPreviousChild = (start >= position) || - (child.kind === 240 && start === child.end); + (child.kind === 243 && start === child.end); if (lookInPreviousChild) { var candidate = findRightmostChildNodeWithTokens(children, i); return candidate && findRightmostToken(candidate); @@ -36850,7 +38436,7 @@ var ts; } } } - ts.Debug.assert(startNode !== undefined || n.kind === 252); + ts.Debug.assert(startNode !== undefined || n.kind === 255); if (children.length) { var candidate = findRightmostChildNodeWithTokens(children, children.length); return candidate && findRightmostToken(candidate); @@ -36867,7 +38453,7 @@ var ts; ts.findPrecedingToken = findPrecedingToken; function isInString(sourceFile, position) { var token = getTokenAtPosition(sourceFile, position); - return token && (token.kind === 9 || token.kind === 164) && position > token.getStart(); + return token && (token.kind === 9 || token.kind === 165) && position > token.getStart(); } ts.isInString = isInString; function isInComment(sourceFile, position) { @@ -36950,17 +38536,17 @@ var ts; } ts.getNodeModifiers = getNodeModifiers; function getTypeArgumentOrTypeParameterList(node) { - if (node.kind === 153 || node.kind === 172) { + if (node.kind === 154 || node.kind === 173) { return node.typeArguments; } - if (ts.isFunctionLike(node) || node.kind === 218 || node.kind === 219) { + if (ts.isFunctionLike(node) || node.kind === 220 || node.kind === 221) { return node.typeParameters; } return undefined; } ts.getTypeArgumentOrTypeParameterList = getTypeArgumentOrTypeParameterList; function isToken(n) { - return n.kind >= 0 && n.kind <= 136; + return n.kind >= 0 && n.kind <= 137; } ts.isToken = isToken; function isWord(kind) { @@ -36976,7 +38562,7 @@ var ts; ts.isComment = isComment; function isStringOrRegularExpressionOrTemplateLiteral(kind) { if (kind === 9 - || kind === 164 + || kind === 165 || kind === 10 || ts.isTemplateLiteralKind(kind)) { return true; @@ -37020,18 +38606,18 @@ var ts; } ts.compareDataObjects = compareDataObjects; function isArrayLiteralOrObjectLiteralDestructuringPattern(node) { - if (node.kind === 168 || - node.kind === 169) { - if (node.parent.kind === 185 && + if (node.kind === 169 || + node.kind === 170) { + if (node.parent.kind === 186 && node.parent.left === node && node.parent.operatorToken.kind === 56) { return true; } - if (node.parent.kind === 205 && + if (node.parent.kind === 207 && node.parent.initializer === node) { return true; } - if (isArrayLiteralOrObjectLiteralDestructuringPattern(node.parent.kind === 249 ? node.parent.parent : node.parent)) { + if (isArrayLiteralOrObjectLiteralDestructuringPattern(node.parent.kind === 252 ? node.parent.parent : node.parent)) { return true; } } @@ -37042,7 +38628,7 @@ var ts; var ts; (function (ts) { function isFirstDeclarationOfSymbolParameter(symbol) { - return symbol.declarations && symbol.declarations.length > 0 && symbol.declarations[0].kind === 140; + return symbol.declarations && symbol.declarations.length > 0 && symbol.declarations[0].kind === 141; } ts.isFirstDeclarationOfSymbolParameter = isFirstDeclarationOfSymbolParameter; var displayPartWriter = getDisplayPartWriter(); @@ -37223,7 +38809,7 @@ var ts; ts.getDeclaredName = getDeclaredName; function isImportOrExportSpecifierName(location) { return location.parent && - (location.parent.kind === 230 || location.parent.kind === 234) && + (location.parent.kind === 233 || location.parent.kind === 237) && location.parent.propertyName === location; } ts.isImportOrExportSpecifierName = isImportOrExportSpecifierName; @@ -37238,6 +38824,169 @@ var ts; 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) { + var scriptKind = ts.getScriptKindFromFileName(fileName); + if (scriptKind === 0 && host && host.getScriptKind) { + scriptKind = host.getScriptKind(fileName); + } + return ts.ensureScriptKind(fileName, scriptKind); + } + ts.getScriptKind = getScriptKind; +})(ts || (ts = {})); +var ts; +(function (ts) { + var JsTyping; + (function (JsTyping) { + ; + ; + var safeList; + function discoverTypings(host, fileNames, projectRootPath, safeListPath, packageNameToTypingLocation, typingOptions, compilerOptions) { + var inferredTypings = {}; + if (!typingOptions || !typingOptions.enableAutoDiscovery) { + return { cachedTypingPaths: [], newTypingNames: [], filesToWatch: [] }; + } + fileNames = ts.filter(ts.map(fileNames, ts.normalizePath), function (f) { return ts.scriptKindIs(f, undefined, 1, 2); }); + if (!safeList) { + var result = ts.readConfigFile(safeListPath, function (path) { return host.readFile(path); }); + if (result.config) { + safeList = result.config; + } + else { + safeList = {}; + } + ; + } + var filesToWatch = []; + 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); + for (var name_37 in packageNameToTypingLocation) { + if (ts.hasProperty(inferredTypings, name_37) && !inferredTypings[name_37]) { + inferredTypings[name_37] = packageNameToTypingLocation[name_37]; + } + } + 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 }; + function mergeTypings(typingNames) { + if (!typingNames) { + return; + } + for (var _i = 0, typingNames_1 = typingNames; _i < typingNames_1.length; _i++) { + var typing = typingNames_1[_i]; + if (!ts.hasProperty(inferredTypings, typing)) { + inferredTypings[typing] = undefined; + } + } + } + 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.getKeys(jsonConfig.dependencies)); + } + if (jsonConfig.devDependencies) { + mergeTypings(ts.getKeys(jsonConfig.devDependencies)); + } + if (jsonConfig.optionalDependencies) { + mergeTypings(ts.getKeys(jsonConfig.optionalDependencies)); + } + if (jsonConfig.peerDependencies) { + mergeTypings(ts.getKeys(jsonConfig.peerDependencies)); + } + } + } + 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 ts.hasProperty(safeList, f); })); + } + var hasJsxFile = ts.forEach(fileNames, function (f) { return ts.scriptKindIs(f, undefined, 2); }); + if (hasJsxFile) { + mergeTypings(["react"]); + } + } + function getTypingNamesFromNodeModuleFolder(nodeModulesPath) { + if (!host.directoryExists(nodeModulesPath)) { + return; + } + var typingNames = []; + var fileNames = host.readDirectory(nodeModulesPath, "*.json", undefined, 2); + for (var _i = 0, fileNames_1 = fileNames; _i < fileNames_1.length; _i++) { + var fileName = fileNames_1[_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; + if (packageJson._requiredBy && + ts.filter(packageJson._requiredBy, function (r) { return r[0] === "#" || r === "/"; }).length === 0) { + continue; + } + 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 = {})); var ts; (function (ts) { @@ -37325,10 +39074,10 @@ var ts; function shouldRescanJsxIdentifier(node) { if (node.parent) { switch (node.parent.kind) { + case 245: case 242: - case 239: + case 244: case 241: - case 238: return node.kind === 69; } } @@ -37800,41 +39549,41 @@ var ts; } Rules.prototype.getRuleName = function (rule) { var o = this; - for (var name_33 in o) { - if (o[name_33] === rule) { - return name_33; + for (var name_38 in o) { + if (o[name_38] === rule) { + return name_38; } } throw new Error("Unknown rule"); }; Rules.IsForContext = function (context) { - return context.contextNode.kind === 203; + return context.contextNode.kind === 205; }; Rules.IsNotForContext = function (context) { return !Rules.IsForContext(context); }; Rules.IsBinaryOpContext = function (context) { switch (context.contextNode.kind) { - case 185: case 186: - case 193: - case 152: - case 160: + case 187: + case 194: + case 153: case 161: + case 162: return true; - case 167: - case 220: - case 225: - case 215: - case 140: - case 251: + case 168: + case 222: + case 228: + case 217: + case 141: + case 254: + case 144: case 143: - case 142: return context.currentTokenSpan.kind === 56 || context.nextTokenSpan.kind === 56; - case 204: + case 206: return context.currentTokenSpan.kind === 90 || context.nextTokenSpan.kind === 90; - case 205: - return context.currentTokenSpan.kind === 136 || context.nextTokenSpan.kind === 136; + case 207: + return context.currentTokenSpan.kind === 137 || context.nextTokenSpan.kind === 137; } return false; }; @@ -37842,7 +39591,7 @@ var ts; return !Rules.IsBinaryOpContext(context); }; Rules.IsConditionalOperatorContext = function (context) { - return context.contextNode.kind === 186; + return context.contextNode.kind === 187; }; Rules.IsSameLineTokenOrBeforeMultilineBlockContext = function (context) { return context.TokensAreOnSameLine() || Rules.IsBeforeMultilineBlockContext(context); @@ -37867,86 +39616,86 @@ var ts; return true; } switch (node.kind) { - case 196: - case 224: - case 169: - case 223: + case 198: + case 226: + case 170: + case 225: return true; } return false; }; Rules.IsFunctionDeclContext = function (context) { switch (context.contextNode.kind) { - case 217: + case 219: + case 146: case 145: - case 144: - case 147: case 148: case 149: - case 177: - case 146: + case 150: case 178: - case 219: + case 147: + case 179: + case 221: return true; } return false; }; Rules.IsFunctionDeclarationOrFunctionExpressionContext = function (context) { - return context.contextNode.kind === 217 || context.contextNode.kind === 177; + return context.contextNode.kind === 219 || context.contextNode.kind === 178; }; Rules.IsTypeScriptDeclWithBlockContext = function (context) { return Rules.NodeIsTypeScriptDeclWithBlockContext(context.contextNode); }; Rules.NodeIsTypeScriptDeclWithBlockContext = function (node) { switch (node.kind) { - case 218: - case 190: - case 219: + case 220: + case 191: case 221: - case 157: - case 222: + case 223: + case 158: + case 224: return true; } return false; }; Rules.IsAfterCodeBlockContext = function (context) { switch (context.currentTokenParent.kind) { - case 218: - case 222: - case 221: - case 196: - case 248: + case 220: + case 224: case 223: - case 210: + case 198: + case 251: + case 225: + case 212: return true; } return false; }; Rules.IsControlDeclContext = function (context) { switch (context.contextNode.kind) { - case 200: - case 210: - case 203: - case 204: - case 205: case 202: - case 213: - case 201: - case 209: - case 248: + case 212: + case 205: + case 206: + case 207: + case 204: + case 215: + case 203: + case 211: + case 251: return true; default: return false; } }; Rules.IsObjectContext = function (context) { - return context.contextNode.kind === 169; + return context.contextNode.kind === 170; }; Rules.IsFunctionCallContext = function (context) { - return context.contextNode.kind === 172; + return context.contextNode.kind === 173; }; Rules.IsNewContext = function (context) { - return context.contextNode.kind === 173; + return context.contextNode.kind === 174; }; Rules.IsFunctionCallOrNewContext = function (context) { return Rules.IsFunctionCallContext(context) || Rules.IsNewContext(context); @@ -37958,10 +39707,10 @@ var ts; return context.nextTokenSpan.kind !== 20; }; Rules.IsArrowFunctionContext = function (context) { - return context.contextNode.kind === 178; + return context.contextNode.kind === 179; }; Rules.IsNonJsxSameLineTokenContext = function (context) { - return context.TokensAreOnSameLine() && context.contextNode.kind !== 240; + return context.TokensAreOnSameLine() && context.contextNode.kind !== 243; }; Rules.IsNotBeforeBlockInFunctionDeclarationContext = function (context) { return !Rules.IsFunctionDeclContext(context) && !Rules.IsBeforeBlockContext(context); @@ -37976,41 +39725,41 @@ var ts; while (ts.isExpression(node)) { node = node.parent; } - return node.kind === 141; + return node.kind === 142; }; Rules.IsStartOfVariableDeclarationList = function (context) { - return context.currentTokenParent.kind === 216 && + return context.currentTokenParent.kind === 218 && context.currentTokenParent.getStart(context.sourceFile) === context.currentTokenSpan.pos; }; Rules.IsNotFormatOnEnter = function (context) { return context.formattingRequestKind !== 2; }; Rules.IsModuleDeclContext = function (context) { - return context.contextNode.kind === 222; + return context.contextNode.kind === 224; }; Rules.IsObjectTypeContext = function (context) { - return context.contextNode.kind === 157; + return context.contextNode.kind === 158; }; Rules.IsTypeArgumentOrParameterOrAssertion = function (token, parent) { if (token.kind !== 25 && token.kind !== 27) { return false; } switch (parent.kind) { - case 153: - case 175: - case 218: - case 190: + case 154: + case 176: + case 220: + case 191: + case 221: case 219: - case 217: - case 177: case 178: + case 179: + case 146: case 145: - case 144: - case 149: case 150: - case 172: + case 151: case 173: - case 192: + case 174: + case 193: return true; default: return false; @@ -38021,13 +39770,13 @@ var ts; Rules.IsTypeArgumentOrParameterOrAssertion(context.nextTokenSpan, context.nextTokenParent); }; Rules.IsTypeAssertionContext = function (context) { - return context.contextNode.kind === 175; + return context.contextNode.kind === 176; }; Rules.IsVoidOpContext = function (context) { - return context.currentTokenSpan.kind === 103 && context.currentTokenParent.kind === 181; + return context.currentTokenSpan.kind === 103 && context.currentTokenParent.kind === 182; }; Rules.IsYieldOrYieldStarWithOperand = function (context) { - return context.contextNode.kind === 188 && context.contextNode.expression !== undefined; + return context.contextNode.kind === 189 && context.contextNode.expression !== undefined; }; return Rules; }()); @@ -38049,7 +39798,7 @@ var ts; return result; }; RulesMap.prototype.Initialize = function (rules) { - this.mapRowLength = 136 + 1; + this.mapRowLength = 137 + 1; this.map = new Array(this.mapRowLength * this.mapRowLength); var rulesBucketConstructionStateList = new Array(this.map.length); this.FillRules(rules, rulesBucketConstructionStateList); @@ -38225,7 +39974,7 @@ var ts; } TokenAllAccess.prototype.GetTokens = function () { var result = []; - for (var token = 0; token <= 136; token++) { + for (var token = 0; token <= 137; token++) { result.push(token); } return result; @@ -38267,9 +40016,9 @@ var ts; }; TokenRange.Any = TokenRange.AllTokens(); TokenRange.AnyIncludingMultilineComments = TokenRange.FromTokens(TokenRange.Any.GetTokens().concat([3])); - TokenRange.Keywords = TokenRange.FromRange(70, 136); + TokenRange.Keywords = TokenRange.FromRange(70, 137); TokenRange.BinaryOperators = TokenRange.FromRange(25, 68); - TokenRange.BinaryKeywordOperators = TokenRange.FromTokens([90, 91, 136, 116, 124]); + TokenRange.BinaryKeywordOperators = TokenRange.FromTokens([90, 91, 137, 116, 124]); TokenRange.UnaryPrefixOperators = TokenRange.FromTokens([41, 42, 50, 49]); TokenRange.UnaryPrefixExpressions = TokenRange.FromTokens([8, 69, 17, 19, 15, 97, 92]); TokenRange.UnaryPreincrementExpressions = TokenRange.FromTokens([69, 17, 97, 92]); @@ -38396,9 +40145,13 @@ var ts; if (line === 0) { return []; } + var endOfFormatSpan = ts.getEndLinePosition(line, sourceFile); + while (ts.isWhiteSpace(sourceFile.text.charCodeAt(endOfFormatSpan)) && !ts.isLineBreak(sourceFile.text.charCodeAt(endOfFormatSpan))) { + endOfFormatSpan--; + } var span = { pos: ts.getStartPositionOfLine(line - 1, sourceFile), - end: ts.getEndLinePosition(line, sourceFile) + 1 + end: endOfFormatSpan + 1 }; return formatSpan(span, sourceFile, options, rulesProvider, 2); } @@ -38456,17 +40209,17 @@ var ts; } function isListElement(parent, node) { switch (parent.kind) { - case 218: - case 219: + case 220: + case 221: return ts.rangeContainsRange(parent.members, node); - case 222: + case 224: var body = parent.body; - return body && body.kind === 196 && ts.rangeContainsRange(body.statements, node); - case 252: - case 196: - case 223: + return body && body.kind === 198 && ts.rangeContainsRange(body.statements, node); + case 255: + case 198: + case 225: return ts.rangeContainsRange(parent.statements, node); - case 248: + case 251: return ts.rangeContainsRange(parent.block.statements, node); } return false; @@ -38621,18 +40374,18 @@ var ts; return node.modifiers[0].kind; } switch (node.kind) { - case 218: return 73; - case 219: return 107; - case 217: return 87; - case 221: return 221; - case 147: return 123; - case 148: return 130; - case 145: + case 220: return 73; + case 221: return 107; + case 219: return 87; + case 223: return 223; + case 148: return 123; + case 149: return 130; + case 146: if (node.asteriskToken) { return 37; } - case 143: - case 140: + case 144: + case 141: return node.name.kind; } } @@ -38745,7 +40498,7 @@ var ts; consumeTokenAndAdvanceScanner(tokenInfo, node, parentDynamicIndentation, child); return inheritedIndentation; } - var effectiveParentStartLine = child.kind === 141 ? childStartLine : undecoratedParentStartLine; + var effectiveParentStartLine = child.kind === 142 ? childStartLine : undecoratedParentStartLine; var childIndentation = computeIndentation(child, childStartLine, childIndentationAmount, node, parentDynamicIndentation, effectiveParentStartLine); processNode(child, childContextNode, childStartLine, undecoratedChildStartLine, childIndentation.indentation, childIndentation.delta); childContextNode = node; @@ -38774,8 +40527,8 @@ var ts; } } var inheritedIndentation = -1; - for (var _i = 0, nodes_6 = nodes; _i < nodes_6.length; _i++) { - var child = nodes_6[_i]; + for (var _i = 0, nodes_7 = nodes; _i < nodes_7.length; _i++) { + var child = nodes_7[_i]; inheritedIndentation = processChildNode(child, inheritedIndentation, node, listDynamicIndentation, startLine, startLine, true); } if (listEndToken !== 0) { @@ -39048,20 +40801,20 @@ var ts; } function isSomeBlock(kind) { switch (kind) { - case 196: - case 223: + case 198: + case 225: return true; } return false; } function getOpenTokenForList(node, list) { switch (node.kind) { - case 146: - case 217: - case 177: - case 145: - case 144: + case 147: + case 219: case 178: + case 146: + case 145: + case 179: if (node.typeParameters === list) { return 25; } @@ -39069,8 +40822,8 @@ var ts; return 17; } break; - case 172: case 173: + case 174: if (node.typeArguments === list) { return 25; } @@ -39078,7 +40831,7 @@ var ts; return 17; } break; - case 153: + case 154: if (node.typeArguments === list) { return 25; } @@ -39179,7 +40932,7 @@ var ts; var lineStart = ts.getLineStartPositionForPosition(current_1, sourceFile); return SmartIndenter.findFirstNonWhitespaceColumn(lineStart, current_1, sourceFile, options); } - if (precedingToken.kind === 24 && precedingToken.parent.kind !== 185) { + if (precedingToken.kind === 24 && precedingToken.parent.kind !== 186) { var actualIndentation = getActualIndentationForListItemBeforeComma(precedingToken, sourceFile, options); if (actualIndentation !== -1) { return actualIndentation; @@ -39277,7 +41030,7 @@ var ts; } function getActualIndentationForNode(current, parent, currentLineAndChar, parentAndChildShareLine, sourceFile, options) { var useActualIndentation = (ts.isDeclaration(current) || ts.isStatement(current)) && - (parent.kind === 252 || !parentAndChildShareLine); + (parent.kind === 255 || !parentAndChildShareLine); if (!useActualIndentation) { return -1; } @@ -39301,7 +41054,7 @@ var ts; return sourceFile.getLineAndCharacterOfPosition(n.getStart(sourceFile)); } function childStartsOnTheSameLineWithElseInIfStatement(parent, child, childStartLine, sourceFile) { - if (parent.kind === 200 && parent.elseStatement === child) { + if (parent.kind === 202 && parent.elseStatement === child) { var elseKeyword = ts.findChildOfKind(parent, 80, sourceFile); ts.Debug.assert(elseKeyword !== undefined); var elseKeywordStartLine = getStartLineAndCharacterForNode(elseKeyword, sourceFile).line; @@ -39313,23 +41066,23 @@ var ts; function getContainingList(node, sourceFile) { if (node.parent) { switch (node.parent.kind) { - case 153: + case 154: if (node.parent.typeArguments && ts.rangeContainsStartEnd(node.parent.typeArguments, node.getStart(sourceFile), node.getEnd())) { return node.parent.typeArguments; } break; - case 169: + case 170: return node.parent.properties; - case 168: + case 169: return node.parent.elements; - case 217: - case 177: + case 219: case 178: + case 179: + case 146: case 145: - case 144: - case 149: - case 150: { + case 150: + case 151: { var start = node.getStart(sourceFile); if (node.parent.typeParameters && ts.rangeContainsStartEnd(node.parent.typeParameters, start, node.getEnd())) { @@ -39340,8 +41093,8 @@ var ts; } break; } - case 173: - case 172: { + case 174: + case 173: { var start = node.getStart(sourceFile); if (node.parent.typeArguments && ts.rangeContainsStartEnd(node.parent.typeArguments, start, node.getEnd())) { @@ -39369,8 +41122,8 @@ var ts; if (node.kind === 18) { return -1; } - if (node.parent && (node.parent.kind === 172 || - node.parent.kind === 173) && + if (node.parent && (node.parent.kind === 173 || + node.parent.kind === 174) && node.parent.expression !== node) { var fullCallOrNewExpression = node.parent.expression; var startingExpression = getStartingExpression(fullCallOrNewExpression); @@ -39388,10 +41141,10 @@ var ts; function getStartingExpression(node) { while (true) { switch (node.kind) { - case 172: case 173: - case 170: + case 174: case 171: + case 172: node = node.expression; break; default: @@ -39445,45 +41198,45 @@ var ts; SmartIndenter.findFirstNonWhitespaceColumn = findFirstNonWhitespaceColumn; function nodeContentIsAlwaysIndented(kind) { switch (kind) { - case 199: - case 218: - case 190: - case 219: - case 221: + case 201: case 220: - case 168: - case 196: + case 191: + case 221: case 223: + case 222: case 169: - case 157: - case 159: - case 224: - case 246: - case 245: - case 176: + case 198: + case 225: case 170: - case 172: + case 158: + case 160: + case 226: + case 249: + case 248: + case 177: + case 171: case 173: - case 197: - case 215: - case 231: - case 208: - case 186: - case 166: - case 165: - case 239: - case 238: - case 244: - case 144: - case 149: - case 150: - case 140: - case 154: - case 155: - case 162: case 174: - case 182: - case 229: + case 199: + case 217: + case 234: + case 210: + case 187: + case 167: + case 166: + case 242: + case 241: + case 247: + case 145: + case 150: + case 151: + case 141: + case 155: + case 156: + case 163: + case 175: + case 183: + case 232: return true; } return false; @@ -39491,22 +41244,22 @@ var ts; function nodeWillIndentChild(parent, child, indentByDefault) { var childKind = child ? child.kind : 0; switch (parent.kind) { - case 201: - case 202: - case 204: - case 205: case 203: - case 200: - case 217: - case 177: - case 145: + case 204: + case 206: + case 207: + case 205: + case 202: + case 219: case 178: case 146: + case 179: case 147: case 148: - return childKind !== 196; - case 237: - return childKind !== 241; + case 149: + return childKind !== 198; + case 240: + return childKind !== 244; } return indentByDefault; } @@ -39636,11 +41389,11 @@ var ts; return pos; }; NodeObject.prototype.createSyntaxList = function (nodes) { - var list = createNode(275, nodes.pos, nodes.end, 0, this); + var list = createNode(278, nodes.pos, nodes.end, 0, this); list._children = []; var pos = nodes.pos; - for (var _i = 0, nodes_7 = nodes; _i < nodes_7.length; _i++) { - var node = nodes_7[_i]; + for (var _i = 0, nodes_8 = nodes; _i < nodes_8.length; _i++) { + var node = nodes_8[_i]; if (pos < node.pos) { pos = this.addSyntheticNodes(list._children, pos, node.pos); } @@ -39655,7 +41408,7 @@ var ts; NodeObject.prototype.createChildren = function (sourceFile) { var _this = this; var children; - if (this.kind >= 137) { + if (this.kind >= 138) { scanner.setText((sourceFile || this.getSourceFile()).text); children = []; var pos_3 = this.pos; @@ -39702,7 +41455,7 @@ var ts; return undefined; } var child = children[0]; - return child.kind < 137 ? child : child.getFirstToken(sourceFile); + return child.kind < 138 ? child : child.getFirstToken(sourceFile); }; NodeObject.prototype.getLastToken = function (sourceFile) { var children = this.getChildren(sourceFile); @@ -39710,7 +41463,7 @@ var ts; if (!child) { return undefined; } - return child.kind < 137 ? child : child.getLastToken(sourceFile); + return child.kind < 138 ? child : child.getLastToken(sourceFile); }; return NodeObject; }()); @@ -39752,7 +41505,7 @@ var ts; ts.forEach(declarations, function (declaration, indexOfDeclaration) { if (ts.indexOf(declarations, declaration) === indexOfDeclaration) { var sourceFileOfDeclaration_1 = ts.getSourceFileOfNode(declaration); - if (canUseParsedParamTagComments && declaration.kind === 140) { + if (canUseParsedParamTagComments && declaration.kind === 141) { ts.forEach(getJsDocCommentTextRange(declaration.parent, sourceFileOfDeclaration_1), function (jsDocCommentTextRange) { var cleanedParamJsDocComment = getCleanedParamJsDocComment(jsDocCommentTextRange.pos, jsDocCommentTextRange.end, sourceFileOfDeclaration_1); if (cleanedParamJsDocComment) { @@ -39760,13 +41513,13 @@ var ts; } }); } - if (declaration.kind === 222 && declaration.body.kind === 222) { + if (declaration.kind === 224 && declaration.body.kind === 224) { return; } - while (declaration.kind === 222 && declaration.parent.kind === 222) { + while (declaration.kind === 224 && declaration.parent.kind === 224) { declaration = declaration.parent; } - ts.forEach(getJsDocCommentTextRange(declaration.kind === 215 ? declaration.parent.parent : declaration, sourceFileOfDeclaration_1), function (jsDocCommentTextRange) { + ts.forEach(getJsDocCommentTextRange(declaration.kind === 217 ? declaration.parent.parent : declaration, sourceFileOfDeclaration_1), function (jsDocCommentTextRange) { var cleanedJsDocComment = getCleanedJsDocComment(jsDocCommentTextRange.pos, jsDocCommentTextRange.end, sourceFileOfDeclaration_1); if (cleanedJsDocComment) { ts.addRange(jsDocCommentParts, cleanedJsDocComment); @@ -40077,9 +41830,9 @@ var ts; if (result_2 !== undefined) { return result_2; } - if (declaration.name.kind === 138) { + if (declaration.name.kind === 139) { var expr = declaration.name.expression; - if (expr.kind === 170) { + if (expr.kind === 171) { return expr.name.text; } return getTextOfIdentifierOrLiteral(expr); @@ -40099,9 +41852,9 @@ var ts; } function visit(node) { switch (node.kind) { - case 217: + case 219: + case 146: case 145: - case 144: var functionDeclaration = node; var declarationName = getDeclarationName(functionDeclaration); if (declarationName) { @@ -40118,62 +41871,62 @@ var ts; ts.forEachChild(node, visit); } break; - case 218: - case 219: case 220: case 221: case 222: - case 225: - case 234: - case 230: - case 225: - case 227: - case 228: - case 147: - case 148: - case 157: - addDeclaration(node); - case 146: - case 197: - case 216: - case 165: - case 166: case 223: + case 224: + case 228: + case 237: + case 233: + case 228: + case 230: + case 231: + case 148: + case 149: + case 158: + addDeclaration(node); + case 147: + case 199: + case 218: + case 166: + case 167: + case 225: ts.forEachChild(node, visit); break; - case 196: + case 198: if (ts.isFunctionBlock(node)) { ts.forEachChild(node, visit); } break; - case 140: + case 141: if (!(node.flags & 28)) { break; } - case 215: - case 167: + case 217: + case 168: if (ts.isBindingPattern(node.name)) { ts.forEachChild(node.name, visit); break; } - case 251: + case 254: + case 144: case 143: - case 142: addDeclaration(node); break; - case 232: + case 235: if (node.exportClause) { ts.forEach(node.exportClause.elements, visit); } break; - case 226: + case 229: var importClause = node.importClause; if (importClause) { if (importClause.name) { addDeclaration(importClause); } if (importClause.namedBindings) { - if (importClause.namedBindings.kind === 228) { + if (importClause.namedBindings.kind === 231) { addDeclaration(importClause.namedBindings); } else { @@ -40327,14 +42080,14 @@ var ts; return false; } return ts.forEach(symbol.declarations, function (declaration) { - if (declaration.kind === 177) { + if (declaration.kind === 178) { return true; } - if (declaration.kind !== 215 && declaration.kind !== 217) { + if (declaration.kind !== 217 && declaration.kind !== 219) { return false; } - for (var parent_10 = declaration.parent; !ts.isFunctionBlock(parent_10); parent_10 = parent_10.parent) { - if (parent_10.kind === 252 || parent_10.kind === 223) { + for (var parent_12 = declaration.parent; !ts.isFunctionBlock(parent_12); parent_12 = parent_12.parent) { + if (parent_12.kind === 255 || parent_12.kind === 225) { return false; } } @@ -40366,14 +42119,13 @@ var ts; }; HostCache.prototype.createEntry = function (fileName, path) { var entry; - var scriptKind = this.host.getScriptKind ? this.host.getScriptKind(fileName) : 0; var scriptSnapshot = this.host.getScriptSnapshot(fileName); if (scriptSnapshot) { entry = { hostFileName: fileName, version: this.host.getScriptVersion(fileName), scriptSnapshot: scriptSnapshot, - scriptKind: scriptKind ? scriptKind : ts.getScriptKindFromFileName(fileName) + scriptKind: ts.getScriptKind(fileName, this.host) }; } this.fileNameToEntry.set(path, entry); @@ -40420,7 +42172,7 @@ var ts; if (!scriptSnapshot) { throw new Error("Could not find file: '" + fileName + "'."); } - var scriptKind = this.host.getScriptKind ? this.host.getScriptKind(fileName) : 0; + var scriptKind = ts.getScriptKind(fileName, this.host); var version = this.host.getScriptVersion(fileName); var sourceFile; if (this.currentFileName !== fileName) { @@ -40632,9 +42384,22 @@ var ts; 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; + var externalModule = false; + function nextToken() { + var token = scanner.scan(); + if (token === 15) { + braceNesting++; + } + else if (token === 16) { + braceNesting--; + } + return token; + } function processTripleSlashDirectives() { var commentRanges = ts.getLeadingCommentRanges(sourceText, 0); ts.forEach(commentRanges, function (commentRange) { @@ -40644,32 +42409,44 @@ var ts; isNoDefaultLib = referencePathMatchResult.isNoDefaultLib; var fileReference = referencePathMatchResult.fileReference; if (fileReference) { - referencedFiles.push(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(scanner.getTokenValue()); + ambientExternalModules.push({ ref: getFileReference(), depth: braceNesting }); } function recordModuleName() { - var importPath = scanner.getTokenValue(); - var pos = scanner.getTokenPos(); - importedFiles.push({ - fileName: importPath, - pos: pos, - end: pos + importPath.length - }); + importedFiles.push(getFileReference()); + markAsExternalModuleIfTopLevel(); + } + function markAsExternalModuleIfTopLevel() { + if (braceNesting === 0) { + externalModule = true; + } } function tryConsumeDeclare() { var token = scanner.getToken(); if (token === 122) { - token = scanner.scan(); + token = nextToken(); if (token === 125) { - token = scanner.scan(); + token = nextToken(); if (token === 9) { recordAmbientExternalModule(); } @@ -40681,16 +42458,16 @@ var ts; function tryConsumeImport() { var token = scanner.getToken(); if (token === 89) { - token = scanner.scan(); + token = nextToken(); if (token === 9) { recordModuleName(); return true; } else { if (token === 69 || ts.isKeyword(token)) { - token = scanner.scan(); - if (token === 134) { - token = scanner.scan(); + token = nextToken(); + if (token === 135) { + token = nextToken(); if (token === 9) { recordModuleName(); return true; @@ -40702,21 +42479,21 @@ var ts; } } else if (token === 24) { - token = scanner.scan(); + token = nextToken(); } else { return true; } } if (token === 15) { - token = scanner.scan(); + token = nextToken(); while (token !== 16 && token !== 1) { - token = scanner.scan(); + token = nextToken(); } if (token === 16) { - token = scanner.scan(); - if (token === 134) { - token = scanner.scan(); + token = nextToken(); + if (token === 135) { + token = nextToken(); if (token === 9) { recordModuleName(); } @@ -40724,13 +42501,13 @@ var ts; } } else if (token === 37) { - token = scanner.scan(); + token = nextToken(); if (token === 116) { - token = scanner.scan(); + token = nextToken(); if (token === 69 || ts.isKeyword(token)) { - token = scanner.scan(); - if (token === 134) { - token = scanner.scan(); + token = nextToken(); + if (token === 135) { + token = nextToken(); if (token === 9) { recordModuleName(); } @@ -40746,16 +42523,17 @@ var ts; function tryConsumeExport() { var token = scanner.getToken(); if (token === 82) { - token = scanner.scan(); + markAsExternalModuleIfTopLevel(); + token = nextToken(); if (token === 15) { - token = scanner.scan(); + token = nextToken(); while (token !== 16 && token !== 1) { - token = scanner.scan(); + token = nextToken(); } if (token === 16) { - token = scanner.scan(); - if (token === 134) { - token = scanner.scan(); + token = nextToken(); + if (token === 135) { + token = nextToken(); if (token === 9) { recordModuleName(); } @@ -40763,18 +42541,18 @@ var ts; } } else if (token === 37) { - token = scanner.scan(); - if (token === 134) { - token = scanner.scan(); + token = nextToken(); + if (token === 135) { + token = nextToken(); if (token === 9) { recordModuleName(); } } } else if (token === 89) { - token = scanner.scan(); + token = nextToken(); if (token === 69 || ts.isKeyword(token)) { - token = scanner.scan(); + token = nextToken(); if (token === 56) { if (tryConsumeRequireCall(true)) { return true; @@ -40787,11 +42565,11 @@ var ts; return false; } function tryConsumeRequireCall(skipCurrentToken) { - var token = skipCurrentToken ? scanner.scan() : scanner.getToken(); + var token = skipCurrentToken ? nextToken() : scanner.getToken(); if (token === 128) { - token = scanner.scan(); + token = nextToken(); if (token === 17) { - token = scanner.scan(); + token = nextToken(); if (token === 9) { recordModuleName(); } @@ -40803,15 +42581,15 @@ var ts; function tryConsumeDefine() { var token = scanner.getToken(); if (token === 69 && scanner.getTokenValue() === "define") { - token = scanner.scan(); + token = nextToken(); if (token !== 17) { return true; } - token = scanner.scan(); + token = nextToken(); if (token === 9) { - token = scanner.scan(); + token = nextToken(); if (token === 24) { - token = scanner.scan(); + token = nextToken(); } else { return true; @@ -40820,14 +42598,14 @@ var ts; if (token !== 19) { return true; } - token = scanner.scan(); + token = nextToken(); var i = 0; while (token !== 20 && token !== 1) { if (token === 9) { recordModuleName(); i++; } - token = scanner.scan(); + token = nextToken(); } return true; } @@ -40835,7 +42613,7 @@ var ts; } function processImports() { scanner.setText(sourceText); - scanner.scan(); + nextToken(); while (true) { if (scanner.getToken() === 1) { break; @@ -40847,7 +42625,7 @@ var ts; continue; } else { - scanner.scan(); + nextToken(); } } scanner.setText(undefined); @@ -40856,12 +42634,38 @@ var ts; processImports(); } processTripleSlashDirectives(); - return { referencedFiles: referencedFiles, importedFiles: importedFiles, isLibFile: isNoDefaultLib, ambientExternalModules: ambientExternalModules }; + if (externalModule) { + if (ambientExternalModules) { + 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 { + 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; function getTargetLabel(referenceNode, labelName) { while (referenceNode) { - if (referenceNode.kind === 211 && referenceNode.label.text === labelName) { + if (referenceNode.kind === 213 && referenceNode.label.text === labelName) { return referenceNode.label; } referenceNode = referenceNode.parent; @@ -40870,16 +42674,16 @@ var ts; } function isJumpStatementTarget(node) { return node.kind === 69 && - (node.parent.kind === 207 || node.parent.kind === 206) && + (node.parent.kind === 209 || node.parent.kind === 208) && node.parent.label === node; } function isLabelOfLabeledStatement(node) { return node.kind === 69 && - node.parent.kind === 211 && + node.parent.kind === 213 && node.parent.label === node; } function isLabeledBy(node, labelName) { - for (var owner = node.parent; owner.kind === 211; owner = owner.parent) { + for (var owner = node.parent; owner.kind === 213; owner = owner.parent) { if (owner.label.text === labelName) { return true; } @@ -40890,25 +42694,25 @@ var ts; return isLabelOfLabeledStatement(node) || isJumpStatementTarget(node); } function isRightSideOfQualifiedName(node) { - return node.parent.kind === 137 && node.parent.right === node; + return node.parent.kind === 138 && node.parent.right === node; } function isRightSideOfPropertyAccess(node) { - return node && node.parent && node.parent.kind === 170 && node.parent.name === node; + return node && node.parent && node.parent.kind === 171 && node.parent.name === node; } function isCallExpressionTarget(node) { if (isRightSideOfPropertyAccess(node)) { node = node.parent; } - return node && node.parent && node.parent.kind === 172 && node.parent.expression === node; + return node && node.parent && node.parent.kind === 173 && node.parent.expression === node; } function isNewExpressionTarget(node) { if (isRightSideOfPropertyAccess(node)) { node = node.parent; } - return node && node.parent && node.parent.kind === 173 && node.parent.expression === node; + return node && node.parent && node.parent.kind === 174 && node.parent.expression === node; } function isNameOfModuleDeclaration(node) { - return node.parent.kind === 222 && node.parent.name === node; + return node.parent.kind === 224 && node.parent.name === node; } function isNameOfFunctionDeclaration(node) { return node.kind === 69 && @@ -40916,22 +42720,22 @@ var ts; } function isNameOfPropertyAssignment(node) { return (node.kind === 69 || node.kind === 9 || node.kind === 8) && - (node.parent.kind === 249 || node.parent.kind === 250) && node.parent.name === node; + (node.parent.kind === 252 || node.parent.kind === 253) && node.parent.name === node; } function isLiteralNameOfPropertyDeclarationOrIndexAccess(node) { if (node.kind === 9 || node.kind === 8) { switch (node.parent.kind) { - case 143: - case 142: - case 249: - case 251: - case 145: case 144: - case 147: + case 143: + case 252: + case 254: + case 146: + case 145: case 148: - case 222: + case 149: + case 224: return node.parent.name === node; - case 171: + case 172: return node.parent.argumentExpression === node; } } @@ -40969,7 +42773,7 @@ var ts; } } var keywordCompletions = []; - for (var i = 70; i <= 136; i++) { + for (var i = 70; i <= 137; i++) { keywordCompletions.push({ name: ts.tokenToString(i), kind: ScriptElementKind.keyword, @@ -40984,17 +42788,17 @@ var ts; return undefined; } switch (node.kind) { - case 252: + case 255: + case 146: case 145: - case 144: - case 217: - case 177: - case 147: - case 148: - case 218: case 219: + case 178: + case 148: + case 149: + case 220: case 221: - case 222: + case 223: + case 224: return node; } } @@ -41002,38 +42806,38 @@ var ts; ts.getContainerNode = getContainerNode; function getNodeKind(node) { switch (node.kind) { - case 222: return ScriptElementKind.moduleElement; - case 218: return ScriptElementKind.classElement; - case 219: return ScriptElementKind.interfaceElement; - case 220: return ScriptElementKind.typeElement; - case 221: return ScriptElementKind.enumElement; - case 215: + case 224: return ScriptElementKind.moduleElement; + case 220: return ScriptElementKind.classElement; + case 221: return ScriptElementKind.interfaceElement; + case 222: return ScriptElementKind.typeElement; + case 223: return ScriptElementKind.enumElement; + case 217: return ts.isConst(node) ? ScriptElementKind.constElement : ts.isLet(node) ? ScriptElementKind.letElement : ScriptElementKind.variableElement; - case 217: return ScriptElementKind.functionElement; - case 147: return ScriptElementKind.memberGetAccessorElement; - case 148: return ScriptElementKind.memberSetAccessorElement; + case 219: return ScriptElementKind.functionElement; + case 148: return ScriptElementKind.memberGetAccessorElement; + case 149: return ScriptElementKind.memberSetAccessorElement; + case 146: case 145: - case 144: return ScriptElementKind.memberFunctionElement; + case 144: case 143: - case 142: return ScriptElementKind.memberVariableElement; - case 151: return ScriptElementKind.indexSignatureElement; - case 150: return ScriptElementKind.constructSignatureElement; - case 149: return ScriptElementKind.callSignatureElement; - case 146: return ScriptElementKind.constructorImplementationElement; - case 139: return ScriptElementKind.typeParameterElement; - case 251: return ScriptElementKind.variableElement; - case 140: return (node.flags & 28) ? ScriptElementKind.memberVariableElement : ScriptElementKind.parameterElement; - case 225: - case 230: - case 227: - case 234: + case 152: return ScriptElementKind.indexSignatureElement; + case 151: return ScriptElementKind.constructSignatureElement; + case 150: return ScriptElementKind.callSignatureElement; + case 147: return ScriptElementKind.constructorImplementationElement; + case 140: return ScriptElementKind.typeParameterElement; + case 254: return ScriptElementKind.variableElement; + case 141: return (node.flags & 28) ? ScriptElementKind.memberVariableElement : ScriptElementKind.parameterElement; case 228: + case 233: + case 230: + case 237: + case 231: return ScriptElementKind.alias; } return ScriptElementKind.unknown; @@ -41117,7 +42921,7 @@ var ts; writeFile: function (fileName, data, writeByteOrderMark) { }, getCurrentDirectory: function () { return currentDirectory; }, fileExists: function (fileName) { - ts.Debug.assert(!host.resolveModuleNames); + ts.Debug.assert(!host.resolveModuleNames || !host.resolveTypeReferenceDirectives); return hostCache.getOrCreateEntry(fileName) !== undefined; }, readFile: function (fileName) { @@ -41125,7 +42929,7 @@ var ts; return entry && entry.scriptSnapshot.getText(0, entry.scriptSnapshot.getLength()); }, directoryExists: function (directoryName) { - ts.Debug.assert(!host.resolveModuleNames); + ts.Debug.assert(!host.resolveModuleNames || !host.resolveTypeReferenceDirectives); return ts.directoryProbablyExists(directoryName, host); } }; @@ -41135,6 +42939,11 @@ var ts; if (host.resolveModuleNames) { compilerHost.resolveModuleNames = function (moduleNames, containingFile) { return host.resolveModuleNames(moduleNames, containingFile); }; } + if (host.resolveTypeReferenceDirectives) { + compilerHost.resolveTypeReferenceDirectives = function (typeReferenceDirectiveNames, containingFile) { + return host.resolveTypeReferenceDirectives(typeReferenceDirectiveNames, containingFile); + }; + } var newProgram = ts.createProgram(hostCache.getRootFileNames(), newSettings, compilerHost, program); if (program) { var oldSourceFiles = program.getSourceFiles(); @@ -41266,9 +43075,9 @@ var ts; isJsDocTagName = true; } switch (tag.kind) { - case 273: - case 271: - case 272: + case 276: + case 274: + case 275: var tagWithExpression = tag; if (tagWithExpression.typeExpression) { insideJsDocTagExpression = tagWithExpression.typeExpression.pos < position && position < tagWithExpression.typeExpression.end; @@ -41303,13 +43112,13 @@ var ts; log("Returning an empty list because completion was requested in an invalid position."); return undefined; } - var parent_11 = contextToken.parent, kind = contextToken.kind; + var parent_13 = contextToken.parent, kind = contextToken.kind; if (kind === 21) { - if (parent_11.kind === 170) { + if (parent_13.kind === 171) { node = contextToken.parent.expression; isRightOfDot = true; } - else if (parent_11.kind === 137) { + else if (parent_13.kind === 138) { node = contextToken.parent.left; isRightOfDot = true; } @@ -41322,7 +43131,7 @@ var ts; isRightOfOpenTag = true; location = contextToken; } - else if (kind === 39 && contextToken.parent.kind === 241) { + else if (kind === 39 && contextToken.parent.kind === 244) { isStartingCloseTag = true; location = contextToken; } @@ -41338,7 +43147,7 @@ var ts; else if (isRightOfOpenTag) { var tagSymbols = typeChecker.getJsxIntrinsicTagNames(); if (tryGetGlobalSymbols()) { - symbols = tagSymbols.concat(symbols.filter(function (s) { return !!(s.flags & 107455); })); + symbols = tagSymbols.concat(symbols.filter(function (s) { return !!(s.flags & (107455 | 8388608)); })); } else { symbols = tagSymbols; @@ -41365,7 +43174,7 @@ var ts; function getTypeScriptMemberSymbols() { isMemberCompletion = true; isNewIdentifierLocation = false; - if (node.kind === 69 || node.kind === 137 || node.kind === 170) { + if (node.kind === 69 || node.kind === 138 || node.kind === 171) { var symbol = typeChecker.getSymbolAtLocation(node); if (symbol && symbol.flags & 8388608) { symbol = typeChecker.getAliasedSymbol(symbol); @@ -41411,7 +43220,7 @@ var ts; } if (jsxContainer = tryGetContainingJsxElement(contextToken)) { var attrsType = void 0; - if ((jsxContainer.kind === 238) || (jsxContainer.kind === 239)) { + if ((jsxContainer.kind === 241) || (jsxContainer.kind === 242)) { attrsType = typeChecker.getJsxElementAttributesType(jsxContainer); if (attrsType) { symbols = filterJsxAttributes(typeChecker.getPropertiesOfType(attrsType), jsxContainer.attributes); @@ -41451,15 +43260,15 @@ var ts; return result; } function isInJsxText(contextToken) { - if (contextToken.kind === 240) { + if (contextToken.kind === 243) { return true; } if (contextToken.kind === 27 && contextToken.parent) { - if (contextToken.parent.kind === 239) { + if (contextToken.parent.kind === 242) { return true; } - if (contextToken.parent.kind === 241 || contextToken.parent.kind === 238) { - return contextToken.parent.parent && contextToken.parent.parent.kind === 237; + if (contextToken.parent.kind === 244 || contextToken.parent.kind === 241) { + return contextToken.parent.parent && contextToken.parent.parent.kind === 240; } } return false; @@ -41469,40 +43278,40 @@ var ts; var containingNodeKind = previousToken.parent.kind; switch (previousToken.kind) { case 24: - return containingNodeKind === 172 - || containingNodeKind === 146 - || containingNodeKind === 173 - || containingNodeKind === 168 - || containingNodeKind === 185 - || containingNodeKind === 154; + return containingNodeKind === 173 + || containingNodeKind === 147 + || containingNodeKind === 174 + || containingNodeKind === 169 + || containingNodeKind === 186 + || containingNodeKind === 155; case 17: - return containingNodeKind === 172 - || containingNodeKind === 146 - || containingNodeKind === 173 - || containingNodeKind === 176 - || containingNodeKind === 162; + return containingNodeKind === 173 + || containingNodeKind === 147 + || containingNodeKind === 174 + || containingNodeKind === 177 + || containingNodeKind === 163; case 19: - return containingNodeKind === 168 - || containingNodeKind === 151 - || containingNodeKind === 138; + return containingNodeKind === 169 + || containingNodeKind === 152 + || containingNodeKind === 139; case 125: case 126: return true; case 21: - return containingNodeKind === 222; + return containingNodeKind === 224; case 15: - return containingNodeKind === 218; + return containingNodeKind === 220; case 56: - return containingNodeKind === 215 - || containingNodeKind === 185; + return containingNodeKind === 217 + || containingNodeKind === 186; case 12: - return containingNodeKind === 187; + return containingNodeKind === 188; case 13: - return containingNodeKind === 194; + return containingNodeKind === 196; case 112: case 110: case 111: - return containingNodeKind === 143; + return containingNodeKind === 144; } switch (previousToken.getText()) { case "public": @@ -41515,7 +43324,7 @@ var ts; } function isInStringOrRegularExpressionOrTemplateLiteral(contextToken) { if (contextToken.kind === 9 - || contextToken.kind === 164 + || contextToken.kind === 165 || contextToken.kind === 10 || ts.isTemplateLiteralKind(contextToken.kind)) { var start_7 = contextToken.getStart(); @@ -41534,16 +43343,25 @@ var ts; isMemberCompletion = true; var typeForObject; var existingMembers; - if (objectLikeContainer.kind === 169) { + if (objectLikeContainer.kind === 170) { isNewIdentifierLocation = true; typeForObject = typeChecker.getContextualType(objectLikeContainer); existingMembers = objectLikeContainer.properties; } - else if (objectLikeContainer.kind === 165) { + else if (objectLikeContainer.kind === 166) { isNewIdentifierLocation = false; var rootDeclaration = ts.getRootDeclaration(objectLikeContainer.parent); if (ts.isVariableLike(rootDeclaration)) { - if (rootDeclaration.initializer || rootDeclaration.type) { + var canGetType = !!(rootDeclaration.initializer || rootDeclaration.type); + if (!canGetType && rootDeclaration.kind === 141) { + if (ts.isExpression(rootDeclaration.parent)) { + canGetType = !!typeChecker.getContextualType(rootDeclaration.parent); + } + else if (rootDeclaration.parent.kind === 146 || rootDeclaration.parent.kind === 149) { + canGetType = ts.isExpression(rootDeclaration.parent.parent) && !!typeChecker.getContextualType(rootDeclaration.parent.parent); + } + } + if (canGetType) { typeForObject = typeChecker.getTypeAtLocation(objectLikeContainer); existingMembers = objectLikeContainer.elements; } @@ -41565,9 +43383,9 @@ var ts; return true; } function tryGetImportOrExportClauseCompletionSymbols(namedImportsOrExports) { - var declarationKind = namedImportsOrExports.kind === 229 ? - 226 : - 232; + var declarationKind = namedImportsOrExports.kind === 232 ? + 229 : + 235; var importOrExportDeclaration = ts.getAncestor(namedImportsOrExports, declarationKind); var moduleSpecifier = importOrExportDeclaration.moduleSpecifier; if (!moduleSpecifier) { @@ -41588,9 +43406,9 @@ var ts; switch (contextToken.kind) { case 15: case 24: - var parent_12 = contextToken.parent; - if (parent_12 && (parent_12.kind === 169 || parent_12.kind === 165)) { - return parent_12; + var parent_14 = contextToken.parent; + if (parent_14 && (parent_14.kind === 170 || parent_14.kind === 166)) { + return parent_14; } break; } @@ -41603,8 +43421,8 @@ var ts; case 15: case 24: switch (contextToken.parent.kind) { - case 229: - case 233: + case 232: + case 236: return contextToken.parent; } } @@ -41613,34 +43431,34 @@ var ts; } function tryGetContainingJsxElement(contextToken) { if (contextToken) { - var parent_13 = contextToken.parent; + var parent_15 = contextToken.parent; switch (contextToken.kind) { case 26: case 39: case 69: - case 242: - case 243: - if (parent_13 && (parent_13.kind === 238 || parent_13.kind === 239)) { - return parent_13; + case 245: + case 246: + if (parent_15 && (parent_15.kind === 241 || parent_15.kind === 242)) { + return parent_15; } - else if (parent_13.kind === 242) { - return parent_13.parent; + else if (parent_15.kind === 245) { + return parent_15.parent; } break; case 9: - if (parent_13 && ((parent_13.kind === 242) || (parent_13.kind === 243))) { - return parent_13.parent; + if (parent_15 && ((parent_15.kind === 245) || (parent_15.kind === 246))) { + return parent_15.parent; } break; case 16: - if (parent_13 && - parent_13.kind === 244 && - parent_13.parent && - (parent_13.parent.kind === 242)) { - return parent_13.parent.parent; + if (parent_15 && + parent_15.kind === 247 && + parent_15.parent && + (parent_15.parent.kind === 245)) { + return parent_15.parent.parent; } - if (parent_13 && parent_13.kind === 243) { - return parent_13.parent; + if (parent_15 && parent_15.kind === 246) { + return parent_15.parent; } break; } @@ -41649,16 +43467,16 @@ var ts; } function isFunction(kind) { switch (kind) { - case 177: case 178: - case 217: + case 179: + case 219: + case 146: case 145: - case 144: - case 147: case 148: case 149: case 150: case 151: + case 152: return true; } return false; @@ -41667,54 +43485,54 @@ var ts; var containingNodeKind = contextToken.parent.kind; switch (contextToken.kind) { case 24: - return containingNodeKind === 215 || - containingNodeKind === 216 || - containingNodeKind === 197 || - containingNodeKind === 221 || - isFunction(containingNodeKind) || + return containingNodeKind === 217 || containingNodeKind === 218 || - containingNodeKind === 190 || - containingNodeKind === 219 || - containingNodeKind === 166 || - containingNodeKind === 220; + containingNodeKind === 199 || + containingNodeKind === 223 || + isFunction(containingNodeKind) || + containingNodeKind === 220 || + containingNodeKind === 191 || + containingNodeKind === 221 || + containingNodeKind === 167 || + containingNodeKind === 222; case 21: - return containingNodeKind === 166; - case 54: return containingNodeKind === 167; + case 54: + return containingNodeKind === 168; case 19: - return containingNodeKind === 166; + return containingNodeKind === 167; case 17: - return containingNodeKind === 248 || + return containingNodeKind === 251 || isFunction(containingNodeKind); case 15: - return containingNodeKind === 221 || - containingNodeKind === 219 || - containingNodeKind === 157; + return containingNodeKind === 223 || + containingNodeKind === 221 || + containingNodeKind === 158; case 23: - return containingNodeKind === 142 && + return containingNodeKind === 143 && contextToken.parent && contextToken.parent.parent && - (contextToken.parent.parent.kind === 219 || - contextToken.parent.parent.kind === 157); + (contextToken.parent.parent.kind === 221 || + contextToken.parent.parent.kind === 158); case 25: - return containingNodeKind === 218 || - containingNodeKind === 190 || - containingNodeKind === 219 || - containingNodeKind === 220 || + return containingNodeKind === 220 || + containingNodeKind === 191 || + containingNodeKind === 221 || + containingNodeKind === 222 || isFunction(containingNodeKind); case 113: - return containingNodeKind === 143; + return containingNodeKind === 144; case 22: - return containingNodeKind === 140 || + return containingNodeKind === 141 || (contextToken.parent && contextToken.parent.parent && - contextToken.parent.parent.kind === 166); + contextToken.parent.parent.kind === 167); case 112: case 110: case 111: - return containingNodeKind === 140; + return containingNodeKind === 141; case 116: - return containingNodeKind === 230 || - containingNodeKind === 234 || - containingNodeKind === 228; + return containingNodeKind === 233 || + containingNodeKind === 237 || + containingNodeKind === 231; case 73: case 81: case 107: @@ -41763,8 +43581,8 @@ var ts; if (element.getStart() <= position && position <= element.getEnd()) { continue; } - var name_34 = element.propertyName || element.name; - existingImportsOrExports[name_34.text] = true; + var name_39 = element.propertyName || element.name; + existingImportsOrExports[name_39.text] = true; } if (ts.isEmpty(existingImportsOrExports)) { return exportsOfModule; @@ -41778,17 +43596,17 @@ var ts; var existingMemberNames = {}; for (var _i = 0, existingMembers_1 = existingMembers; _i < existingMembers_1.length; _i++) { var m = existingMembers_1[_i]; - if (m.kind !== 249 && - m.kind !== 250 && - m.kind !== 167 && - m.kind !== 145) { + if (m.kind !== 252 && + m.kind !== 253 && + m.kind !== 168 && + m.kind !== 146) { continue; } if (m.getStart() <= position && position <= m.getEnd()) { continue; } var existingName = void 0; - if (m.kind === 167 && m.propertyName) { + if (m.kind === 168 && m.propertyName) { if (m.propertyName.kind === 69) { existingName = m.propertyName.text; } @@ -41807,7 +43625,7 @@ var ts; if (attr.getStart() <= position && position <= attr.getEnd()) { continue; } - if (attr.kind === 242) { + if (attr.kind === 245) { seenNames[attr.name.text] = true; } } @@ -41833,7 +43651,7 @@ var ts; else { if (!symbols || symbols.length === 0) { if (sourceFile.languageVariant === 1 && - location.parent && location.parent.kind === 241) { + location.parent && location.parent.kind === 244) { var tagName = location.parent.parent.openingElement.tagName; entries.push({ name: tagName.text, @@ -41856,13 +43674,13 @@ var ts; var entries = []; var target = program.getCompilerOptions().target; var nameTable = getNameTable(sourceFile); - for (var name_35 in nameTable) { - if (nameTable[name_35] === position) { + for (var name_40 in nameTable) { + if (nameTable[name_40] === position) { continue; } - if (!uniqueNames[name_35]) { - uniqueNames[name_35] = name_35; - var displayName = getCompletionEntryDisplayName(name_35, target, true); + if (!uniqueNames[name_40]) { + uniqueNames[name_40] = name_40; + var displayName = getCompletionEntryDisplayName(name_40, target, true); if (displayName) { var entry = { name: displayName, @@ -41951,7 +43769,7 @@ var ts; function getSymbolKind(symbol, location) { var flags = symbol.getFlags(); if (flags & 32) - return ts.getDeclarationOfKind(symbol, 190) ? + return ts.getDeclarationOfKind(symbol, 191) ? ScriptElementKind.localClassElement : ScriptElementKind.classElement; if (flags & 384) return ScriptElementKind.enumElement; @@ -41982,6 +43800,9 @@ var ts; if (typeChecker.isArgumentsSymbol(symbol)) { return ScriptElementKind.localVariableElement; } + if (location.kind === 97 && ts.isExpression(location)) { + return ScriptElementKind.parameterElement; + } if (flags & 3) { if (ts.isFirstDeclarationOfSymbolParameter(symbol)) { return ScriptElementKind.parameterElement; @@ -42039,22 +43860,23 @@ var ts; var symbolFlags = symbol.flags; var symbolKind = getSymbolKindOfConstructorPropertyMethodAccessorFunctionOrVar(symbol, symbolFlags, location); var hasAddedSymbolInfo; + var isThisExpression = location.kind === 97 && ts.isExpression(location); var type; if (symbolKind !== ScriptElementKind.unknown || symbolFlags & 32 || symbolFlags & 8388608) { if (symbolKind === ScriptElementKind.memberGetAccessorElement || symbolKind === ScriptElementKind.memberSetAccessorElement) { symbolKind = ScriptElementKind.memberVariableElement; } var signature = void 0; - type = typeChecker.getTypeOfSymbolAtLocation(symbol, location); + type = isThisExpression ? typeChecker.getTypeAtLocation(location) : typeChecker.getTypeOfSymbolAtLocation(symbol, location); if (type) { - if (location.parent && location.parent.kind === 170) { + if (location.parent && location.parent.kind === 171) { var right = location.parent.name; if (right === location || (right && right.getFullWidth() === 0)) { location = location.parent; } } var callExpression = void 0; - if (location.kind === 172 || location.kind === 173) { + if (location.kind === 173 || location.kind === 174) { callExpression = location; } else if (isCallExpressionTarget(location) || isNewExpressionTarget(location)) { @@ -42066,7 +43888,7 @@ var ts; if (!signature && candidateSignatures.length) { signature = candidateSignatures[0]; } - var useConstructSignatures = callExpression.kind === 173 || callExpression.expression.kind === 95; + var useConstructSignatures = callExpression.kind === 174 || callExpression.expression.kind === 95; var allSignatures = useConstructSignatures ? type.getConstructSignatures() : type.getCallSignatures(); if (!ts.contains(allSignatures, signature.target) && !ts.contains(allSignatures, signature)) { signature = allSignatures.length ? allSignatures[0] : undefined; @@ -42114,21 +43936,21 @@ var ts; } } else if ((isNameOfFunctionDeclaration(location) && !(symbol.flags & 98304)) || - (location.kind === 121 && location.parent.kind === 146)) { + (location.kind === 121 && location.parent.kind === 147)) { var functionDeclaration = location.parent; - var allSignatures = functionDeclaration.kind === 146 ? type.getConstructSignatures() : type.getCallSignatures(); + var allSignatures = functionDeclaration.kind === 147 ? type.getConstructSignatures() : type.getCallSignatures(); if (!typeChecker.isImplementationOfOverload(functionDeclaration)) { signature = typeChecker.getSignatureFromDeclaration(functionDeclaration); } else { signature = allSignatures[0]; } - if (functionDeclaration.kind === 146) { + if (functionDeclaration.kind === 147) { symbolKind = ScriptElementKind.constructorImplementationElement; addPrefixForAnyFunctionOrVar(type.symbol, symbolKind); } else { - addPrefixForAnyFunctionOrVar(functionDeclaration.kind === 149 && + addPrefixForAnyFunctionOrVar(functionDeclaration.kind === 150 && !(type.symbol.flags & 2048 || type.symbol.flags & 4096) ? type.symbol : symbol, symbolKind); } addSignatureDisplayParts(signature, allSignatures); @@ -42136,8 +43958,8 @@ var ts; } } } - if (symbolFlags & 32 && !hasAddedSymbolInfo) { - if (ts.getDeclarationOfKind(symbol, 190)) { + if (symbolFlags & 32 && !hasAddedSymbolInfo && !isThisExpression) { + if (ts.getDeclarationOfKind(symbol, 191)) { pushTypePart(ScriptElementKind.localClassElement); } else { @@ -42177,7 +43999,7 @@ var ts; } if (symbolFlags & 1536) { addNewLineIfDisplayPartsExist(); - var declaration = ts.getDeclarationOfKind(symbol, 222); + var declaration = ts.getDeclarationOfKind(symbol, 224); var isNamespace = declaration && declaration.name && declaration.name.kind === 69; displayParts.push(ts.keywordPart(isNamespace ? 126 : 125)); displayParts.push(ts.spacePart()); @@ -42198,17 +44020,17 @@ var ts; writeTypeParametersOfSymbol(symbol.parent, enclosingDeclaration); } else { - var declaration = ts.getDeclarationOfKind(symbol, 139); + var declaration = ts.getDeclarationOfKind(symbol, 140); ts.Debug.assert(declaration !== undefined); declaration = declaration.parent; if (declaration) { if (ts.isFunctionLikeKind(declaration.kind)) { var signature = typeChecker.getSignatureFromDeclaration(declaration); - if (declaration.kind === 150) { + if (declaration.kind === 151) { displayParts.push(ts.keywordPart(92)); displayParts.push(ts.spacePart()); } - else if (declaration.kind !== 149 && declaration.name) { + else if (declaration.kind !== 150 && declaration.name) { addFullSymbolName(declaration.symbol); } ts.addRange(displayParts, ts.signatureToDisplayParts(typeChecker, signature, sourceFile, 32)); @@ -42225,7 +44047,7 @@ var ts; if (symbolFlags & 8) { addPrefixForAnyFunctionOrVar(symbol, "enum member"); var declaration = symbol.declarations[0]; - if (declaration.kind === 251) { + if (declaration.kind === 254) { var constantValue = typeChecker.getConstantValue(declaration); if (constantValue !== undefined) { displayParts.push(ts.spacePart()); @@ -42241,7 +44063,7 @@ var ts; displayParts.push(ts.spacePart()); addFullSymbolName(symbol); ts.forEach(symbol.declarations, function (declaration) { - if (declaration.kind === 225) { + if (declaration.kind === 228) { var importEqualsDeclaration = declaration; if (ts.isExternalModuleImportEqualsDeclaration(importEqualsDeclaration)) { displayParts.push(ts.spacePart()); @@ -42268,10 +44090,17 @@ var ts; if (!hasAddedSymbolInfo) { if (symbolKind !== ScriptElementKind.unknown) { if (type) { - addPrefixForAnyFunctionOrVar(symbol, symbolKind); + if (isThisExpression) { + addNewLineIfDisplayPartsExist(); + displayParts.push(ts.keywordPart(97)); + } + else { + addPrefixForAnyFunctionOrVar(symbol, symbolKind); + } if (symbolKind === ScriptElementKind.memberVariableElement || symbolFlags & 3 || - symbolKind === ScriptElementKind.localVariableElement) { + symbolKind === ScriptElementKind.localVariableElement || + isThisExpression) { displayParts.push(ts.punctuationPart(54)); displayParts.push(ts.spacePart()); if (type.symbol && type.symbol.flags & 262144) { @@ -42371,10 +44200,10 @@ var ts; if (!symbol || typeChecker.isUnknownSymbol(symbol)) { switch (node.kind) { case 69: - case 170: - case 137: + case 171: + case 138: case 97: - case 163: + case 164: case 95: var type = typeChecker.getTypeAtLocation(node); if (type) { @@ -42447,8 +44276,8 @@ var ts; var declarations = []; var definition; ts.forEach(signatureDeclarations, function (d) { - if ((selectConstructors && d.kind === 146) || - (!selectConstructors && (d.kind === 217 || d.kind === 145 || d.kind === 144))) { + if ((selectConstructors && d.kind === 147) || + (!selectConstructors && (d.kind === 219 || d.kind === 146 || d.kind === 145))) { declarations.push(d); if (d.body) definition = d; @@ -42465,6 +44294,25 @@ var ts; 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 + }; + } function getDefinitionAtPosition(fileName, position) { synchronizeHostData(); var sourceFile = getValidSourceFile(fileName); @@ -42477,18 +44325,19 @@ var ts; var label = getTargetLabel(node.parent, node.text); return label ? [createDefinitionInfo(label, ScriptElementKind.label, labelName, undefined)] : undefined; } - var comment = ts.forEach(sourceFile.referencedFiles, function (r) { return (r.pos <= position && position < r.end) ? r : undefined; }); + var comment = findReferenceInPosition(sourceFile.referencedFiles, position); if (comment) { var referenceFile = ts.tryResolveScriptReference(program, sourceFile, comment); if (referenceFile) { - return [{ - fileName: referenceFile.fileName, - textSpan: ts.createTextSpanFromBounds(0, 0), - kind: ScriptElementKind.scriptElement, - name: comment.fileName, - containerName: undefined, - containerKind: undefined - }]; + return [getDefinitionInfoForFileReference(comment.fileName, referenceFile.fileName)]; + } + return undefined; + } + var typeReferenceDirective = findReferenceInPosition(sourceFile.typeReferenceDirectives, position); + if (typeReferenceDirective) { + var referenceFile = ts.lookUp(program.resolvedTypeReferenceDirectives, typeReferenceDirective.fileName); + if (referenceFile && referenceFile.resolvedFileName) { + return [getDefinitionInfoForFileReference(typeReferenceDirective.fileName, referenceFile.resolvedFileName)]; } return undefined; } @@ -42501,11 +44350,11 @@ var ts; var declaration = symbol.declarations[0]; if (node.kind === 69 && (node.parent === declaration || - (declaration.kind === 230 && declaration.parent && declaration.parent.kind === 229))) { + (declaration.kind === 233 && declaration.parent && declaration.parent.kind === 232))) { symbol = typeChecker.getAliasedSymbol(symbol); } } - if (node.parent.kind === 250) { + if (node.parent.kind === 253) { var shorthandSymbol = typeChecker.getShorthandAssignmentValueSymbol(symbol.valueDeclaration); if (!shorthandSymbol) { return []; @@ -42578,7 +44427,7 @@ var ts; function getSemanticDocumentHighlights(node) { if (node.kind === 69 || node.kind === 97 || - node.kind === 163 || + node.kind === 164 || node.kind === 95 || isLiteralNameOfPropertyDeclarationOrIndexAccess(node) || isNameOfExternalModuleImportOrDeclaration(node)) { @@ -42630,75 +44479,75 @@ var ts; switch (node.kind) { case 88: case 80: - if (hasKind(node.parent, 200)) { + if (hasKind(node.parent, 202)) { return getIfElseOccurrences(node.parent); } break; case 94: - if (hasKind(node.parent, 208)) { + if (hasKind(node.parent, 210)) { return getReturnOccurrences(node.parent); } break; case 98: - if (hasKind(node.parent, 212)) { + if (hasKind(node.parent, 214)) { return getThrowOccurrences(node.parent); } break; case 72: - if (hasKind(parent(parent(node)), 213)) { + if (hasKind(parent(parent(node)), 215)) { return getTryCatchFinallyOccurrences(node.parent.parent); } break; case 100: case 85: - if (hasKind(parent(node), 213)) { + if (hasKind(parent(node), 215)) { return getTryCatchFinallyOccurrences(node.parent); } break; case 96: - if (hasKind(node.parent, 210)) { + if (hasKind(node.parent, 212)) { return getSwitchCaseDefaultOccurrences(node.parent); } break; case 71: case 77: - if (hasKind(parent(parent(parent(node))), 210)) { + if (hasKind(parent(parent(parent(node))), 212)) { return getSwitchCaseDefaultOccurrences(node.parent.parent.parent); } break; case 70: case 75: - if (hasKind(node.parent, 207) || hasKind(node.parent, 206)) { + if (hasKind(node.parent, 209) || hasKind(node.parent, 208)) { return getBreakOrContinueStatementOccurrences(node.parent); } break; case 86: - if (hasKind(node.parent, 203) || - hasKind(node.parent, 204) || - hasKind(node.parent, 205)) { + if (hasKind(node.parent, 205) || + hasKind(node.parent, 206) || + hasKind(node.parent, 207)) { return getLoopBreakContinueOccurrences(node.parent); } break; case 104: case 79: - if (hasKind(node.parent, 202) || hasKind(node.parent, 201)) { + if (hasKind(node.parent, 204) || hasKind(node.parent, 203)) { return getLoopBreakContinueOccurrences(node.parent); } break; case 121: - if (hasKind(node.parent, 146)) { + if (hasKind(node.parent, 147)) { return getConstructorOccurrences(node.parent); } break; case 123: case 130: - if (hasKind(node.parent, 147) || hasKind(node.parent, 148)) { + if (hasKind(node.parent, 148) || hasKind(node.parent, 149)) { return getGetAndSetOccurrences(node.parent); } break; default: if (ts.isModifierKind(node.kind) && node.parent && - (ts.isDeclaration(node.parent) || node.parent.kind === 197)) { + (ts.isDeclaration(node.parent) || node.parent.kind === 199)) { return getModifierOccurrences(node.kind, node.parent); } } @@ -42710,10 +44559,10 @@ var ts; aggregate(node); return statementAccumulator; function aggregate(node) { - if (node.kind === 212) { + if (node.kind === 214) { statementAccumulator.push(node); } - else if (node.kind === 213) { + else if (node.kind === 215) { var tryStatement = node; if (tryStatement.catchClause) { aggregate(tryStatement.catchClause); @@ -42733,17 +44582,17 @@ var ts; function getThrowStatementOwner(throwStatement) { var child = throwStatement; while (child.parent) { - var parent_14 = child.parent; - if (ts.isFunctionBlock(parent_14) || parent_14.kind === 252) { - return parent_14; + var parent_16 = child.parent; + if (ts.isFunctionBlock(parent_16) || parent_16.kind === 255) { + return parent_16; } - if (parent_14.kind === 213) { - var tryStatement = parent_14; + if (parent_16.kind === 215) { + var tryStatement = parent_16; if (tryStatement.tryBlock === child && tryStatement.catchClause) { return child; } } - child = parent_14; + child = parent_16; } return undefined; } @@ -42752,7 +44601,7 @@ var ts; aggregate(node); return statementAccumulator; function aggregate(node) { - if (node.kind === 207 || node.kind === 206) { + if (node.kind === 209 || node.kind === 208) { statementAccumulator.push(node); } else if (!ts.isFunctionLike(node)) { @@ -42767,15 +44616,15 @@ var ts; function getBreakOrContinueOwner(statement) { for (var node_2 = statement.parent; node_2; node_2 = node_2.parent) { switch (node_2.kind) { - case 210: - if (statement.kind === 206) { + case 212: + if (statement.kind === 208) { continue; } - case 203: - case 204: case 205: - case 202: - case 201: + case 206: + case 207: + case 204: + case 203: if (!statement.label || isLabeledBy(node_2, statement.label.text)) { return node_2; } @@ -42792,24 +44641,24 @@ var ts; function getModifierOccurrences(modifier, declaration) { var container = declaration.parent; if (ts.isAccessibilityModifier(modifier)) { - if (!(container.kind === 218 || - container.kind === 190 || - (declaration.kind === 140 && hasKind(container, 146)))) { + if (!(container.kind === 220 || + container.kind === 191 || + (declaration.kind === 141 && hasKind(container, 147)))) { return undefined; } } else if (modifier === 113) { - if (!(container.kind === 218 || container.kind === 190)) { + if (!(container.kind === 220 || container.kind === 191)) { return undefined; } } else if (modifier === 82 || modifier === 122) { - if (!(container.kind === 223 || container.kind === 252)) { + if (!(container.kind === 225 || container.kind === 255)) { return undefined; } } else if (modifier === 115) { - if (!(container.kind === 218 || declaration.kind === 218)) { + if (!(container.kind === 220 || declaration.kind === 220)) { return undefined; } } @@ -42820,8 +44669,8 @@ var ts; var modifierFlag = getFlagFromModifier(modifier); var nodes; switch (container.kind) { - case 223: - case 252: + case 225: + case 255: if (modifierFlag & 128) { nodes = declaration.members.concat(declaration); } @@ -42829,15 +44678,15 @@ var ts; nodes = container.statements; } break; - case 146: + case 147: nodes = container.parameters.concat(container.parent.members); break; - case 218: - case 190: + case 220: + case 191: nodes = container.members; if (modifierFlag & 28) { var constructor = ts.forEach(container.members, function (member) { - return member.kind === 146 && member; + return member.kind === 147 && member; }); if (constructor) { nodes = nodes.concat(constructor.parameters); @@ -42890,8 +44739,8 @@ var ts; } function getGetAndSetOccurrences(accessorDeclaration) { var keywords = []; - tryPushAccessorKeyword(accessorDeclaration.symbol, 147); tryPushAccessorKeyword(accessorDeclaration.symbol, 148); + tryPushAccessorKeyword(accessorDeclaration.symbol, 149); return ts.map(keywords, getHighlightSpanForNode); function tryPushAccessorKeyword(accessorSymbol, accessorKind) { var accessor = ts.getDeclarationOfKind(accessorSymbol, accessorKind); @@ -42913,7 +44762,7 @@ var ts; function getLoopBreakContinueOccurrences(loopNode) { var keywords = []; if (pushKeywordIf(keywords, loopNode.getFirstToken(), 86, 104, 79)) { - if (loopNode.kind === 201) { + if (loopNode.kind === 203) { var loopTokens = loopNode.getChildren(); for (var i = loopTokens.length - 1; i >= 0; i--) { if (pushKeywordIf(keywords, loopTokens[i], 104)) { @@ -42934,13 +44783,13 @@ var ts; var owner = getBreakOrContinueOwner(breakOrContinueStatement); if (owner) { switch (owner.kind) { + case 205: + case 206: + case 207: case 203: case 204: - case 205: - case 201: - case 202: return getLoopBreakContinueOccurrences(owner); - case 210: + case 212: return getSwitchCaseDefaultOccurrences(owner); } } @@ -42990,7 +44839,7 @@ var ts; } function getReturnOccurrences(returnStatement) { var func = ts.getContainingFunction(returnStatement); - if (!(func && hasKind(func.body, 196))) { + if (!(func && hasKind(func.body, 198))) { return undefined; } var keywords = []; @@ -43004,7 +44853,7 @@ var ts; } function getIfElseOccurrences(ifStatement) { var keywords = []; - while (hasKind(ifStatement.parent, 200) && ifStatement.parent.elseStatement === ifStatement) { + while (hasKind(ifStatement.parent, 202) && ifStatement.parent.elseStatement === ifStatement) { ifStatement = ifStatement.parent; } while (ifStatement) { @@ -43015,7 +44864,7 @@ var ts; break; } } - if (!hasKind(ifStatement.elseStatement, 200)) { + if (!hasKind(ifStatement.elseStatement, 202)) { break; } ifStatement = ifStatement.elseStatement; @@ -43119,7 +44968,7 @@ var ts; return getLabelReferencesInNode(node.parent, node); } } - if (node.kind === 97 || node.kind === 163) { + if (node.kind === 97 || node.kind === 164) { return getReferencesForThisKeyword(node, sourceFiles); } if (node.kind === 95) { @@ -43144,8 +44993,8 @@ var ts; } else { var internedName = getInternedName(symbol, node, declarations); - for (var _i = 0, sourceFiles_3 = sourceFiles; _i < sourceFiles_3.length; _i++) { - var sourceFile = sourceFiles_3[_i]; + for (var _i = 0, sourceFiles_4 = sourceFiles; _i < sourceFiles_4.length; _i++) { + var sourceFile = sourceFiles_4[_i]; cancellationToken.throwIfCancellationRequested(); var nameTable = getNameTable(sourceFile); if (ts.lookUp(nameTable, internedName) !== undefined) { @@ -43172,7 +45021,7 @@ var ts; }; } function isImportSpecifierSymbol(symbol) { - return (symbol.flags & 8388608) && !!ts.getDeclarationOfKind(symbol, 230); + return (symbol.flags & 8388608) && !!ts.getDeclarationOfKind(symbol, 233); } function getInternedName(symbol, location, declarations) { if (ts.isImportOrExportSpecifierName(location)) { @@ -43184,13 +45033,13 @@ var ts; } function getSymbolScope(symbol) { var valueDeclaration = symbol.valueDeclaration; - if (valueDeclaration && (valueDeclaration.kind === 177 || valueDeclaration.kind === 190)) { + if (valueDeclaration && (valueDeclaration.kind === 178 || valueDeclaration.kind === 191)) { return valueDeclaration; } if (symbol.flags & (4 | 8192)) { var privateDeclaration = ts.forEach(symbol.getDeclarations(), function (d) { return (d.flags & 8) ? d : undefined; }); if (privateDeclaration) { - return ts.getAncestor(privateDeclaration, 218); + return ts.getAncestor(privateDeclaration, 220); } } if (symbol.flags & 8388608) { @@ -43211,7 +45060,7 @@ var ts; if (scope && scope !== container) { return undefined; } - if (container.kind === 252 && !ts.isExternalModule(container)) { + if (container.kind === 255 && !ts.isExternalModule(container)) { return undefined; } scope = container; @@ -43358,13 +45207,13 @@ var ts; } var staticFlag = 32; switch (searchSpaceNode.kind) { - case 143: - case 142: - case 145: case 144: + case 143: case 146: + case 145: case 147: case 148: + case 149: staticFlag &= searchSpaceNode.flags; searchSpaceNode = searchSpaceNode.parent; break; @@ -43392,32 +45241,32 @@ var ts; var searchSpaceNode = ts.getThisContainer(thisOrSuperKeyword, false); var staticFlag = 32; switch (searchSpaceNode.kind) { + case 146: case 145: - case 144: if (ts.isObjectLiteralMethod(searchSpaceNode)) { break; } + case 144: case 143: - case 142: - case 146: case 147: case 148: + case 149: staticFlag &= searchSpaceNode.flags; searchSpaceNode = searchSpaceNode.parent; break; - case 252: + case 255: if (ts.isExternalModule(searchSpaceNode)) { return undefined; } - case 217: - case 177: + case 219: + case 178: break; default: return undefined; } var references = []; var possiblePositions; - if (searchSpaceNode.kind === 252) { + if (searchSpaceNode.kind === 255) { ts.forEach(sourceFiles, function (sourceFile) { possiblePositions = getPossibleSymbolReferencePositions(sourceFile, "this", sourceFile.getStart(), sourceFile.getEnd()); getThisReferencesInFile(sourceFile, sourceFile, possiblePositions, references); @@ -43443,31 +45292,31 @@ var ts; ts.forEach(possiblePositions, function (position) { cancellationToken.throwIfCancellationRequested(); var node = ts.getTouchingWord(sourceFile, position); - if (!node || (node.kind !== 97 && node.kind !== 163)) { + if (!node || (node.kind !== 97 && node.kind !== 164)) { return; } var container = ts.getThisContainer(node, false); switch (searchSpaceNode.kind) { - case 177: - case 217: + case 178: + case 219: if (searchSpaceNode.symbol === container.symbol) { result.push(getReferenceEntryFromNode(node)); } break; + case 146: case 145: - case 144: if (ts.isObjectLiteralMethod(searchSpaceNode) && searchSpaceNode.symbol === container.symbol) { result.push(getReferenceEntryFromNode(node)); } break; - case 190: - case 218: + case 191: + case 220: if (container.parent && searchSpaceNode.symbol === container.parent.symbol && (container.flags & 32) === staticFlag) { result.push(getReferenceEntryFromNode(node)); } break; - case 252: - if (container.kind === 252 && !ts.isExternalModule(container)) { + case 255: + if (container.kind === 255 && !ts.isExternalModule(container)) { result.push(getReferenceEntryFromNode(node)); } break; @@ -43480,7 +45329,7 @@ var ts; if (isImportSpecifierSymbol(symbol)) { result.push(typeChecker.getAliasedSymbol(symbol)); } - if (location.parent.kind === 234) { + if (location.parent.kind === 237) { result.push(typeChecker.getExportSpecifierLocalTargetSymbol(location.parent)); } if (isNameOfPropertyAssignment(location)) { @@ -43492,7 +45341,7 @@ var ts; result.push(shorthandValueSymbol); } } - if (symbol.valueDeclaration && symbol.valueDeclaration.kind === 140 && + if (symbol.valueDeclaration && symbol.valueDeclaration.kind === 141 && ts.isParameterPropertyDeclaration(symbol.valueDeclaration)) { result = result.concat(typeChecker.getSymbolsOfParameterPropertyDeclaration(symbol.valueDeclaration, symbol.name)); } @@ -43515,11 +45364,11 @@ var ts; } if (symbol.flags & (32 | 64)) { ts.forEach(symbol.getDeclarations(), function (declaration) { - if (declaration.kind === 218) { + if (declaration.kind === 220) { getPropertySymbolFromTypeReference(ts.getClassExtendsHeritageClauseElement(declaration)); ts.forEach(ts.getClassImplementsHeritageClauseElements(declaration), getPropertySymbolFromTypeReference); } - else if (declaration.kind === 219) { + else if (declaration.kind === 221) { ts.forEach(ts.getInterfaceBaseTypeNodes(declaration), getPropertySymbolFromTypeReference); } }); @@ -43549,7 +45398,7 @@ var ts; return aliasedSymbol; } } - if (referenceLocation.parent.kind === 234) { + if (referenceLocation.parent.kind === 237) { var aliasedSymbol = typeChecker.getExportSpecifierLocalTargetSymbol(referenceLocation.parent); if (searchSymbols.indexOf(aliasedSymbol) >= 0) { return aliasedSymbol; @@ -43576,17 +45425,17 @@ var ts; if (isNameOfPropertyAssignment(node)) { var objectLiteral = node.parent.parent; var contextualType = typeChecker.getContextualType(objectLiteral); - var name_36 = node.text; + var name_41 = node.text; if (contextualType) { if (contextualType.flags & 16384) { - var unionProperty = contextualType.getProperty(name_36); + var unionProperty = contextualType.getProperty(name_41); if (unionProperty) { return [unionProperty]; } else { var result_5 = []; ts.forEach(contextualType.types, function (t) { - var symbol = t.getProperty(name_36); + var symbol = t.getProperty(name_41); if (symbol) { result_5.push(symbol); } @@ -43595,7 +45444,7 @@ var ts; } } else { - var symbol_1 = contextualType.getProperty(name_36); + var symbol_1 = contextualType.getProperty(name_41); if (symbol_1) { return [symbol_1]; } @@ -43640,10 +45489,10 @@ var ts; } var parent = node.parent; if (parent) { - if (parent.kind === 184 || parent.kind === 183) { + if (parent.kind === 185 || parent.kind === 184) { return true; } - else if (parent.kind === 185 && parent.left === node) { + else if (parent.kind === 186 && parent.left === node) { var operator = parent.operatorToken.kind; return 56 <= operator && operator <= 68; } @@ -43673,33 +45522,33 @@ var ts; } function getMeaningFromDeclaration(node) { switch (node.kind) { - case 140: - case 215: - case 167: - case 143: - case 142: - case 249: - case 250: - case 251: - case 145: + case 141: + case 217: + case 168: case 144: + case 143: + case 252: + case 253: + case 254: case 146: + case 145: case 147: case 148: - case 217: - case 177: - case 178: - case 248: - return 1; - case 139: + case 149: case 219: - case 220: - case 157: - return 2; - case 218: + case 178: + case 179: + case 251: + return 1; + case 140: case 221: - return 1 | 2; case 222: + case 158: + return 2; + case 220: + case 223: + return 1 | 2; + case 224: if (ts.isAmbientModule(node)) { return 4 | 1; } @@ -43709,14 +45558,14 @@ var ts; else { return 4; } - case 229: - case 230: - case 225: - case 226: - case 231: case 232: + case 233: + case 228: + case 229: + case 234: + case 235: return 1 | 2 | 4; - case 252: + case 255: return 4 | 1; } return 1 | 2 | 4; @@ -43725,10 +45574,10 @@ var ts; if (ts.isRightSideOfQualifiedNameOrPropertyAccess(node)) { node = node.parent; } - return node.parent.kind === 153 || - (node.parent.kind === 192 && !ts.isExpressionWithTypeArgumentsInClassExtendsClause(node.parent)) || + return node.parent.kind === 154 || + (node.parent.kind === 193 && !ts.isExpressionWithTypeArgumentsInClassExtendsClause(node.parent)) || (node.kind === 97 && !ts.isExpression(node)) || - node.kind === 163; + node.kind === 164; } function isNamespaceReference(node) { return isQualifiedNameNamespaceReference(node) || isPropertyAccessNamespaceReference(node); @@ -43736,47 +45585,47 @@ var ts; function isPropertyAccessNamespaceReference(node) { var root = node; var isLastClause = true; - if (root.parent.kind === 170) { - while (root.parent && root.parent.kind === 170) { + if (root.parent.kind === 171) { + while (root.parent && root.parent.kind === 171) { root = root.parent; } isLastClause = root.name === node; } - if (!isLastClause && root.parent.kind === 192 && root.parent.parent.kind === 247) { + if (!isLastClause && root.parent.kind === 193 && root.parent.parent.kind === 250) { var decl = root.parent.parent.parent; - return (decl.kind === 218 && root.parent.parent.token === 106) || - (decl.kind === 219 && root.parent.parent.token === 83); + return (decl.kind === 220 && root.parent.parent.token === 106) || + (decl.kind === 221 && root.parent.parent.token === 83); } return false; } function isQualifiedNameNamespaceReference(node) { var root = node; var isLastClause = true; - if (root.parent.kind === 137) { - while (root.parent && root.parent.kind === 137) { + if (root.parent.kind === 138) { + while (root.parent && root.parent.kind === 138) { root = root.parent; } isLastClause = root.right === node; } - return root.parent.kind === 153 && !isLastClause; + return root.parent.kind === 154 && !isLastClause; } function isInRightSideOfImport(node) { - while (node.parent.kind === 137) { + while (node.parent.kind === 138) { node = node.parent; } return ts.isInternalModuleImportEqualsDeclaration(node.parent) && node.parent.moduleReference === node; } function getMeaningFromRightHandSideOfImportEquals(node) { ts.Debug.assert(node.kind === 69); - if (node.parent.kind === 137 && + if (node.parent.kind === 138 && node.parent.right === node && - node.parent.parent.kind === 225) { + node.parent.parent.kind === 228) { return 1 | 2 | 4; } return 4; } function getMeaningFromLocation(node) { - if (node.parent.kind === 231) { + if (node.parent.kind === 234) { return 1 | 2 | 4; } else if (isInRightSideOfImport(node)) { @@ -43800,7 +45649,7 @@ var ts; var sourceFile = getValidSourceFile(fileName); return ts.SignatureHelp.getSignatureHelpItems(program, sourceFile, position, cancellationToken); } - function getSourceFile(fileName) { + function getNonBoundSourceFile(fileName) { return syntaxTreeCache.getCurrentSourceFile(fileName); } function getNameOrDottedNameSpan(fileName, startPos, endPos) { @@ -43810,16 +45659,16 @@ var ts; return; } switch (node.kind) { - case 170: - case 137: + case 171: + case 138: case 9: - case 164: + case 165: case 84: case 99: case 93: case 95: case 97: - case 163: + case 164: case 69: break; default: @@ -43831,7 +45680,7 @@ var ts; nodeForStartPos = nodeForStartPos.parent; } else if (isNameOfModuleDeclaration(nodeForStartPos)) { - if (nodeForStartPos.parent.parent.kind === 222 && + if (nodeForStartPos.parent.parent.kind === 224 && nodeForStartPos.parent.parent.body === nodeForStartPos.parent) { nodeForStartPos = nodeForStartPos.parent.parent.name; } @@ -43858,10 +45707,10 @@ var ts; } function checkForClassificationCancellation(kind) { switch (kind) { - case 222: - case 218: + case 224: + case 220: + case 221: case 219: - case 217: cancellationToken.throwIfCancellationRequested(); } } @@ -43909,7 +45758,7 @@ var ts; return undefined; function hasValueSideModule(symbol) { return ts.forEach(symbol.declarations, function (declaration) { - return declaration.kind === 222 && + return declaration.kind === 224 && ts.getModuleInstanceState(declaration) === 1; }); } @@ -44048,16 +45897,16 @@ var ts; pushClassification(tag.tagName.pos, tag.tagName.end - tag.tagName.pos, 18); pos = tag.tagName.end; switch (tag.kind) { - case 271: + case 274: processJSDocParameterTag(tag); break; - case 274: + case 277: processJSDocTemplateTag(tag); break; - case 273: + case 276: processElement(tag.typeExpression); break; - case 272: + case 275: processElement(tag.typeExpression); break; } @@ -44118,10 +45967,10 @@ var ts; return true; } var classifiedElementName = tryClassifyJsxElementName(node); - if (!ts.isToken(node) && node.kind !== 240 && classifiedElementName === undefined) { + if (!ts.isToken(node) && node.kind !== 243 && classifiedElementName === undefined) { return false; } - var tokenStart = node.kind === 240 ? node.pos : classifyLeadingTriviaAndGetTokenStart(node); + var tokenStart = node.kind === 243 ? node.pos : classifyLeadingTriviaAndGetTokenStart(node); var tokenWidth = node.end - tokenStart; ts.Debug.assert(tokenWidth >= 0); if (tokenWidth > 0) { @@ -44134,22 +45983,22 @@ var ts; } function tryClassifyJsxElementName(token) { switch (token.parent && token.parent.kind) { - case 239: + case 242: if (token.parent.tagName === token) { return 19; } break; - case 241: + case 244: if (token.parent.tagName === token) { return 20; } break; - case 238: + case 241: if (token.parent.tagName === token) { return 21; } break; - case 242: + case 245: if (token.parent.name === token) { return 22; } @@ -44169,17 +46018,17 @@ var ts; if (ts.isPunctuation(tokenKind)) { if (token) { if (tokenKind === 56) { - if (token.parent.kind === 215 || - token.parent.kind === 143 || - token.parent.kind === 140 || - token.parent.kind === 242) { + if (token.parent.kind === 217 || + token.parent.kind === 144 || + token.parent.kind === 141 || + token.parent.kind === 245) { return 5; } } - if (token.parent.kind === 185 || - token.parent.kind === 183 || + if (token.parent.kind === 186 || token.parent.kind === 184 || - token.parent.kind === 186) { + token.parent.kind === 185 || + token.parent.kind === 187) { return 5; } } @@ -44188,8 +46037,8 @@ var ts; else if (tokenKind === 8) { return 4; } - else if (tokenKind === 9 || tokenKind === 164) { - return token.parent.kind === 242 ? 24 : 6; + else if (tokenKind === 9 || tokenKind === 165) { + return token.parent.kind === 245 ? 24 : 6; } else if (tokenKind === 10) { return 6; @@ -44197,38 +46046,38 @@ var ts; else if (ts.isTemplateLiteralKind(tokenKind)) { return 6; } - else if (tokenKind === 240) { + else if (tokenKind === 243) { return 23; } else if (tokenKind === 69) { if (token) { switch (token.parent.kind) { - case 218: + case 220: if (token.parent.name === token) { return 11; } return; - case 139: + case 140: if (token.parent.name === token) { return 15; } return; - case 219: + case 221: if (token.parent.name === token) { return 13; } return; - case 221: + case 223: if (token.parent.name === token) { return 12; } return; - case 222: + case 224: if (token.parent.name === token) { return 14; } return; - case 140: + case 141: if (token.parent.name === token) { return 17; } @@ -44341,16 +46190,16 @@ var ts; var commentOwner; findOwner: for (commentOwner = tokenAtPos; commentOwner; commentOwner = commentOwner.parent) { switch (commentOwner.kind) { - case 217: - case 145: + case 219: case 146: - case 218: - case 197: + case 147: + case 220: + case 199: break findOwner; - case 252: + case 255: return undefined; - case 222: - if (commentOwner.parent.kind === 222) { + case 224: + if (commentOwner.parent.kind === 224) { return undefined; } break findOwner; @@ -44384,7 +46233,7 @@ var ts; if (ts.isFunctionLike(commentOwner)) { return commentOwner.parameters; } - if (commentOwner.kind === 197) { + if (commentOwner.kind === 199) { var varStatement = commentOwner; var varDeclarations = varStatement.declarationList.declarations; if (varDeclarations.length === 1 && varDeclarations[0].initializer) { @@ -44394,17 +46243,17 @@ var ts; return emptyArray; } function getParametersFromRightHandSideOfAssignment(rightHandSide) { - while (rightHandSide.kind === 176) { + while (rightHandSide.kind === 177) { rightHandSide = rightHandSide.expression; } switch (rightHandSide.kind) { - case 177: case 178: + case 179: return rightHandSide.parameters; - case 190: + case 191: for (var _i = 0, _a = rightHandSide.members; _i < _a.length; _i++) { var member = _a[_i]; - if (member.kind === 146) { + if (member.kind === 147) { return member.parameters; } } @@ -44560,7 +46409,7 @@ var ts; getFormattingEditsAfterKeystroke: getFormattingEditsAfterKeystroke, getDocCommentTemplateAtPosition: getDocCommentTemplateAtPosition, getEmitOutput: getEmitOutput, - getSourceFile: getSourceFile, + getNonBoundSourceFile: getNonBoundSourceFile, getProgram: getProgram }; } @@ -44584,7 +46433,7 @@ var ts; case 9: case 8: if (ts.isDeclarationName(node) || - node.parent.kind === 236 || + node.parent.kind === 239 || isArgumentOfElementAccessExpression(node)) { nameTable[node.text] = nameTable[node.text] === undefined ? node.pos : -1; } @@ -44597,7 +46446,7 @@ var ts; function isArgumentOfElementAccessExpression(node) { return node && node.parent && - node.parent.kind === 171 && + node.parent.kind === 172 && node.parent.argumentExpression === node; } function createClassifier() { @@ -44779,7 +46628,7 @@ var ts; var end = scanner.getTextPos(); addResult(start, end, classFromKind(token)); if (end >= text.length) { - if (token === 9 || token === 164) { + if (token === 9 || token === 165) { var tokenText = scanner.getTokenText(); if (scanner.isUnterminated()) { var lastCharIndex = tokenText.length - 1; @@ -44893,7 +46742,7 @@ var ts; } } function isKeyword(token) { - return token >= 70 && token <= 136; + return token >= 70 && token <= 137; } function classFromKind(token) { if (isKeyword(token)) { @@ -44909,7 +46758,7 @@ var ts; case 8: return 4; case 9: - case 164: + case 165: return 6; case 10: return 7; @@ -45997,6 +47846,7 @@ var ts; this.roots = []; this.getCanonicalFileName = ts.createGetCanonicalFileName(host.useCaseSensitiveFileNames); this.resolvedModuleNames = ts.createFileMap(); + this.resolvedTypeReferenceDirectives = ts.createFileMap(); this.filenameToScript = ts.createFileMap(); this.moduleResolutionHost = { fileExists: function (fileName) { return _this.fileExists(fileName); }, @@ -46004,41 +47854,47 @@ var ts; directoryExists: function (directoryName) { return _this.host.directoryExists(directoryName); } }; } - LSHost.prototype.resolveModuleNames = function (moduleNames, containingFile) { + LSHost.prototype.resolveNamesWithLocalCache = function (names, containingFile, cache, loader, getResult) { var path = ts.toPath(containingFile, this.host.getCurrentDirectory(), this.getCanonicalFileName); - var currentResolutionsInFile = this.resolvedModuleNames.get(path); + var currentResolutionsInFile = cache.get(path); var newResolutions = {}; var resolvedModules = []; var compilerOptions = this.getCompilationSettings(); - for (var _i = 0, moduleNames_2 = moduleNames; _i < moduleNames_2.length; _i++) { - var moduleName = moduleNames_2[_i]; - var resolution = ts.lookUp(newResolutions, moduleName); + for (var _i = 0, names_2 = names; _i < names_2.length; _i++) { + var name_42 = names_2[_i]; + var resolution = ts.lookUp(newResolutions, name_42); if (!resolution) { - var existingResolution = currentResolutionsInFile && ts.lookUp(currentResolutionsInFile, moduleName); + var existingResolution = currentResolutionsInFile && ts.lookUp(currentResolutionsInFile, name_42); if (moduleResolutionIsValid(existingResolution)) { resolution = existingResolution; } else { - resolution = ts.resolveModuleName(moduleName, containingFile, compilerOptions, this.moduleResolutionHost); + resolution = loader(name_42, containingFile, compilerOptions, this.moduleResolutionHost); resolution.lastCheckTime = Date.now(); - newResolutions[moduleName] = resolution; + newResolutions[name_42] = resolution; } } ts.Debug.assert(resolution !== undefined); - resolvedModules.push(resolution.resolvedModule); + resolvedModules.push(getResult(resolution)); } - this.resolvedModuleNames.set(path, newResolutions); + cache.set(path, newResolutions); return resolvedModules; function moduleResolutionIsValid(resolution) { if (!resolution) { return false; } - if (resolution.resolvedModule) { + if (getResult(resolution)) { return true; } return resolution.failedLookupLocations.length === 0; } }; + LSHost.prototype.resolveTypeReferenceDirectives = function (typeDirectiveNames, containingFile) { + return this.resolveNamesWithLocalCache(typeDirectiveNames, containingFile, this.resolvedTypeReferenceDirectives, ts.resolveTypeReferenceDirective, function (m) { return m.resolvedTypeReferenceDirective; }); + }; + LSHost.prototype.resolveModuleNames = function (moduleNames, containingFile) { + return this.resolveNamesWithLocalCache(moduleNames, containingFile, this.resolvedModuleNames, ts.resolveModuleName, function (m) { return m.resolvedModule; }); + }; LSHost.prototype.getDefaultLibFileName = function () { var nodeModuleBinDir = ts.getDirectoryPath(ts.normalizePath(this.host.getExecutingFilePath())); return ts.combinePaths(nodeModuleBinDir, ts.getDefaultLibFileName(this.compilationSettings)); @@ -46052,6 +47908,7 @@ var ts; LSHost.prototype.setCompilationSettings = function (opt) { this.compilationSettings = opt; this.resolvedModuleNames.clear(); + this.resolvedTypeReferenceDirectives.clear(); }; LSHost.prototype.lineAffectsRefs = function (filename, line) { var info = this.getScriptInfo(filename); @@ -46083,6 +47940,7 @@ var ts; if (!info.isOpen) { this.filenameToScript.remove(info.path); this.resolvedModuleNames.remove(info.path); + this.resolvedTypeReferenceDirectives.remove(info.path); } }; LSHost.prototype.getScriptInfo = function (filename) { @@ -46107,6 +47965,7 @@ var ts; this.filenameToScript.remove(info.path); this.roots = copyListRemovingItem(info, this.roots); this.resolvedModuleNames.remove(info.path); + this.resolvedTypeReferenceDirectives.remove(info.path); } }; LSHost.prototype.saveTo = function (filename, tmpfilename) { @@ -46475,8 +48334,8 @@ var ts; this.inferredProjects = copyListRemovingItem(project, this.inferredProjects); } var fileNames = project.getFileNames(); - for (var _b = 0, fileNames_1 = fileNames; _b < fileNames_1.length; _b++) { - var fileName = fileNames_1[_b]; + for (var _b = 0, fileNames_2 = fileNames; _b < fileNames_2.length; _b++) { + var fileName = fileNames_2[_b]; var info = this.getScriptInfo(fileName); if (info.defaultProject == project) { info.defaultProject = undefined; @@ -46685,7 +48544,7 @@ var ts; info.setFormatOptions(this.getFormatCodeOptions()); this.filenameToScriptInfo[fileName] = info; if (!info.isOpen) { - info.fileWatcher = this.host.watchFile(ts.toPath(fileName, fileName, ts.createGetCanonicalFileName(ts.sys.useCaseSensitiveFileNames)), function (_) { _this.watchedFileChanged(fileName); }); + info.fileWatcher = this.host.watchFile(fileName, function (_) { _this.watchedFileChanged(fileName); }); } } } @@ -46871,7 +48730,7 @@ var ts; } } project_1.finishGraph(); - project_1.projectFileWatcher = this.host.watchFile(ts.toPath(configFilename, configFilename, ts.createGetCanonicalFileName(ts.sys.useCaseSensitiveFileNames)), function (_) { return _this.watchedProjectConfigFileChanged(project_1); }); + project_1.projectFileWatcher = this.host.watchFile(configFilename, function (_) { return _this.watchedProjectConfigFileChanged(project_1); }); this.log("Add recursive watcher for: " + ts.getDirectoryPath(configFilename)); project_1.directoryWatcher = this.host.watchDirectory(ts.getDirectoryPath(configFilename), function (path) { return _this.directoryWatchedForSourceFilesChanged(project_1, path); }, true); return { success: true, project: project_1 }; @@ -46946,6 +48805,7 @@ var ts; else { var defaultOpts = ts.getDefaultCompilerOptions(); defaultOpts.allowNonTsExtensions = true; + defaultOpts.allowJs = true; this.setCompilerOptions(defaultOpts); } this.languageService = ts.createLanguageService(this.host, this.documentRegistry); @@ -46956,7 +48816,7 @@ var ts; this.host.setCompilationSettings(opt); }; CompilerService.prototype.isExternalModule = function (filename) { - var sourceFile = this.languageService.getSourceFile(filename); + var sourceFile = this.languageService.getNonBoundSourceFile(filename); return ts.isExternalModule(sourceFile); }; CompilerService.defaultFormatCodeOptions = { @@ -48029,6 +49889,12 @@ var ts; if ("directoryExists" in this.shimHost) { this.directoryExists = function (directoryName) { return _this.shimHost.directoryExists(directoryName); }; } + if ("getTypeReferenceDirectiveResolutionsForFile" in this.shimHost) { + this.resolveTypeReferenceDirectives = function (typeDirectiveNames, containingFile) { + var typeDirectivesForFile = JSON.parse(_this.shimHost.getTypeReferenceDirectiveResolutionsForFile(containingFile)); + return ts.map(typeDirectiveNames, function (name) { return ts.lookUp(typeDirectivesForFile, name); }); + }; + } } LanguageServiceShimHostAdapter.prototype.log = function (s) { if (this.loggingEnabled) { @@ -48128,8 +49994,14 @@ var ts; this.directoryExists = function (directoryName) { return _this.shimHost.directoryExists(directoryName); }; } } - CoreServicesShimHostAdapter.prototype.readDirectory = function (rootDir, extension, exclude) { - var encoded = this.shimHost.readDirectory(rootDir, extension, JSON.stringify(exclude)); + CoreServicesShimHostAdapter.prototype.readDirectory = function (rootDir, extension, exclude, depth) { + var encoded; + try { + encoded = this.shimHost.readDirectory(rootDir, extension, JSON.stringify(exclude), depth); + } + catch (e) { + encoded = this.shimHost.readDirectory(rootDir, extension, JSON.stringify(exclude)); + } return JSON.parse(encoded); }; CoreServicesShimHostAdapter.prototype.fileExists = function (fileName) { @@ -48440,32 +50312,46 @@ var ts; }; }); }; + CoreServicesShimObject.prototype.resolveTypeReferenceDirective = function (fileName, typeReferenceDirective, compilerOptionsJson) { + var _this = this; + return this.forwardJSONCall("resolveTypeReferenceDirective(" + fileName + ")", function () { + var compilerOptions = JSON.parse(compilerOptionsJson); + var result = ts.resolveTypeReferenceDirective(typeReferenceDirective, ts.normalizeSlashes(fileName), compilerOptions, _this.host); + return { + resolvedFileName: result.resolvedTypeReferenceDirective ? result.resolvedTypeReferenceDirective.resolvedFileName : undefined, + primary: result.resolvedTypeReferenceDirective ? result.resolvedTypeReferenceDirective.primary : true, + failedLookupLocations: result.failedLookupLocations + }; + }); + }; CoreServicesShimObject.prototype.getPreProcessedFileInfo = function (fileName, sourceTextSnapshot) { + var _this = this; return this.forwardJSONCall("getPreProcessedFileInfo('" + fileName + "')", function () { var result = ts.preProcessFile(sourceTextSnapshot.getText(0, sourceTextSnapshot.getLength()), true, true); - var convertResult = { - referencedFiles: [], - importedFiles: [], + return { + referencedFiles: _this.convertFileReferences(result.referencedFiles), + importedFiles: _this.convertFileReferences(result.importedFiles), ambientExternalModules: result.ambientExternalModules, - isLibFile: result.isLibFile + isLibFile: result.isLibFile, + typeReferenceDirectives: _this.convertFileReferences(result.typeReferenceDirectives) }; - ts.forEach(result.referencedFiles, function (refFile) { - convertResult.referencedFiles.push({ - path: ts.normalizePath(refFile.fileName), - position: refFile.pos, - length: refFile.end - refFile.pos - }); - }); - ts.forEach(result.importedFiles, function (importedFile) { - convertResult.importedFiles.push({ - path: ts.normalizeSlashes(importedFile.fileName), - position: importedFile.pos, - length: importedFile.end - importedFile.pos - }); - }); - return convertResult; }); }; + CoreServicesShimObject.prototype.convertFileReferences = function (refs) { + if (!refs) { + return undefined; + } + var result = []; + for (var _i = 0, refs_2 = refs; _i < refs_2.length; _i++) { + var ref = refs_2[_i]; + result.push({ + path: ts.normalizeSlashes(ref.fileName), + position: ref.pos, + length: ref.end - ref.pos + }); + } + return result; + }; CoreServicesShimObject.prototype.getTSConfigFileInfo = function (fileName, sourceTextSnapshot) { var _this = this; return this.forwardJSONCall("getTSConfigFileInfo('" + fileName + "')", function () { @@ -48474,6 +50360,7 @@ var ts; if (result.error) { return { options: {}, + typingOptions: {}, files: [], errors: [realizeDiagnostic(result.error, "\r\n")] }; @@ -48482,6 +50369,7 @@ var ts; var configFile = ts.parseJsonConfigFileContent(result.config, _this.host, ts.getDirectoryPath(normalizedFileName), {}, normalizedFileName); return { options: configFile.options, + typingOptions: configFile.typingOptions, files: configFile.fileNames, errors: realizeDiagnostics(configFile.errors, "\r\n") }; @@ -48490,6 +50378,14 @@ var ts; CoreServicesShimObject.prototype.getDefaultCompilationSettings = function () { return this.forwardJSONCall("getDefaultCompilationSettings()", function () { return ts.getDefaultCompilerOptions(); }); }; + CoreServicesShimObject.prototype.discoverTypings = function (discoverTypingsJson) { + var _this = this; + var getCanonicalFileName = ts.createGetCanonicalFileName(false); + return this.forwardJSONCall("discoverTypings()", function () { + var info = JSON.parse(discoverTypingsJson); + return ts.JsTyping.discoverTypings(_this.host, info.fileNames, ts.toPath(info.projectRootPath, info.projectRootPath, getCanonicalFileName), ts.toPath(info.safeListPath, info.safeListPath, getCanonicalFileName), info.packageNameToTypingLocation, info.typingOptions, info.compilerOptions); + }); + }; return CoreServicesShimObject; }(ShimBase)); var TypeScriptServicesFactory = (function () { diff --git a/lib/typescript.d.ts b/lib/typescript.d.ts index 1ad5a4bc28d..e9917c7cc6b 100644 --- a/lib/typescript.d.ts +++ b/lib/typescript.d.ts @@ -167,163 +167,166 @@ declare namespace ts { StringKeyword = 131, SymbolKeyword = 132, TypeKeyword = 133, - FromKeyword = 134, - GlobalKeyword = 135, - OfKeyword = 136, - QualifiedName = 137, - ComputedPropertyName = 138, - TypeParameter = 139, - Parameter = 140, - Decorator = 141, - PropertySignature = 142, - PropertyDeclaration = 143, - MethodSignature = 144, - MethodDeclaration = 145, - Constructor = 146, - GetAccessor = 147, - SetAccessor = 148, - CallSignature = 149, - ConstructSignature = 150, - IndexSignature = 151, - TypePredicate = 152, - TypeReference = 153, - FunctionType = 154, - ConstructorType = 155, - TypeQuery = 156, - TypeLiteral = 157, - ArrayType = 158, - TupleType = 159, - UnionType = 160, - IntersectionType = 161, - ParenthesizedType = 162, - ThisType = 163, - StringLiteralType = 164, - ObjectBindingPattern = 165, - ArrayBindingPattern = 166, - BindingElement = 167, - ArrayLiteralExpression = 168, - ObjectLiteralExpression = 169, - PropertyAccessExpression = 170, - ElementAccessExpression = 171, - CallExpression = 172, - NewExpression = 173, - TaggedTemplateExpression = 174, - TypeAssertionExpression = 175, - ParenthesizedExpression = 176, - FunctionExpression = 177, - ArrowFunction = 178, - DeleteExpression = 179, - TypeOfExpression = 180, - VoidExpression = 181, - AwaitExpression = 182, - PrefixUnaryExpression = 183, - PostfixUnaryExpression = 184, - BinaryExpression = 185, - ConditionalExpression = 186, - TemplateExpression = 187, - YieldExpression = 188, - SpreadElementExpression = 189, - ClassExpression = 190, - OmittedExpression = 191, - ExpressionWithTypeArguments = 192, - AsExpression = 193, - TemplateSpan = 194, - SemicolonClassElement = 195, - Block = 196, - VariableStatement = 197, - EmptyStatement = 198, - ExpressionStatement = 199, - IfStatement = 200, - DoStatement = 201, - WhileStatement = 202, - ForStatement = 203, - ForInStatement = 204, - ForOfStatement = 205, - ContinueStatement = 206, - BreakStatement = 207, - ReturnStatement = 208, - WithStatement = 209, - SwitchStatement = 210, - LabeledStatement = 211, - ThrowStatement = 212, - TryStatement = 213, - DebuggerStatement = 214, - VariableDeclaration = 215, - VariableDeclarationList = 216, - FunctionDeclaration = 217, - ClassDeclaration = 218, - InterfaceDeclaration = 219, - TypeAliasDeclaration = 220, - EnumDeclaration = 221, - ModuleDeclaration = 222, - ModuleBlock = 223, - CaseBlock = 224, - ImportEqualsDeclaration = 225, - ImportDeclaration = 226, - ImportClause = 227, - NamespaceImport = 228, - NamedImports = 229, - ImportSpecifier = 230, - ExportAssignment = 231, - ExportDeclaration = 232, - NamedExports = 233, - ExportSpecifier = 234, - MissingDeclaration = 235, - ExternalModuleReference = 236, - JsxElement = 237, - JsxSelfClosingElement = 238, - JsxOpeningElement = 239, - JsxText = 240, - JsxClosingElement = 241, - JsxAttribute = 242, - JsxSpreadAttribute = 243, - JsxExpression = 244, - CaseClause = 245, - DefaultClause = 246, - HeritageClause = 247, - CatchClause = 248, - PropertyAssignment = 249, - ShorthandPropertyAssignment = 250, - EnumMember = 251, - SourceFile = 252, - JSDocTypeExpression = 253, - JSDocAllType = 254, - JSDocUnknownType = 255, - JSDocArrayType = 256, - JSDocUnionType = 257, - JSDocTupleType = 258, - JSDocNullableType = 259, - JSDocNonNullableType = 260, - JSDocRecordType = 261, - JSDocRecordMember = 262, - JSDocTypeReference = 263, - JSDocOptionalType = 264, - JSDocFunctionType = 265, - JSDocVariadicType = 266, - JSDocConstructorType = 267, - JSDocThisType = 268, - JSDocComment = 269, - JSDocTag = 270, - JSDocParameterTag = 271, - JSDocReturnTag = 272, - JSDocTypeTag = 273, - JSDocTemplateTag = 274, - SyntaxList = 275, - Count = 276, + UndefinedKeyword = 134, + FromKeyword = 135, + GlobalKeyword = 136, + OfKeyword = 137, + QualifiedName = 138, + ComputedPropertyName = 139, + TypeParameter = 140, + Parameter = 141, + Decorator = 142, + PropertySignature = 143, + PropertyDeclaration = 144, + MethodSignature = 145, + MethodDeclaration = 146, + Constructor = 147, + GetAccessor = 148, + SetAccessor = 149, + CallSignature = 150, + ConstructSignature = 151, + IndexSignature = 152, + TypePredicate = 153, + TypeReference = 154, + FunctionType = 155, + ConstructorType = 156, + TypeQuery = 157, + TypeLiteral = 158, + ArrayType = 159, + TupleType = 160, + UnionType = 161, + IntersectionType = 162, + ParenthesizedType = 163, + ThisType = 164, + StringLiteralType = 165, + ObjectBindingPattern = 166, + ArrayBindingPattern = 167, + BindingElement = 168, + ArrayLiteralExpression = 169, + ObjectLiteralExpression = 170, + PropertyAccessExpression = 171, + ElementAccessExpression = 172, + CallExpression = 173, + NewExpression = 174, + TaggedTemplateExpression = 175, + TypeAssertionExpression = 176, + ParenthesizedExpression = 177, + FunctionExpression = 178, + ArrowFunction = 179, + DeleteExpression = 180, + TypeOfExpression = 181, + VoidExpression = 182, + AwaitExpression = 183, + PrefixUnaryExpression = 184, + PostfixUnaryExpression = 185, + BinaryExpression = 186, + ConditionalExpression = 187, + TemplateExpression = 188, + YieldExpression = 189, + SpreadElementExpression = 190, + ClassExpression = 191, + OmittedExpression = 192, + ExpressionWithTypeArguments = 193, + AsExpression = 194, + NonNullExpression = 195, + TemplateSpan = 196, + SemicolonClassElement = 197, + Block = 198, + VariableStatement = 199, + EmptyStatement = 200, + ExpressionStatement = 201, + IfStatement = 202, + DoStatement = 203, + WhileStatement = 204, + ForStatement = 205, + ForInStatement = 206, + ForOfStatement = 207, + ContinueStatement = 208, + BreakStatement = 209, + ReturnStatement = 210, + WithStatement = 211, + SwitchStatement = 212, + LabeledStatement = 213, + ThrowStatement = 214, + TryStatement = 215, + DebuggerStatement = 216, + VariableDeclaration = 217, + VariableDeclarationList = 218, + FunctionDeclaration = 219, + ClassDeclaration = 220, + InterfaceDeclaration = 221, + TypeAliasDeclaration = 222, + EnumDeclaration = 223, + ModuleDeclaration = 224, + ModuleBlock = 225, + CaseBlock = 226, + GlobalModuleExportDeclaration = 227, + ImportEqualsDeclaration = 228, + ImportDeclaration = 229, + ImportClause = 230, + NamespaceImport = 231, + NamedImports = 232, + ImportSpecifier = 233, + ExportAssignment = 234, + ExportDeclaration = 235, + NamedExports = 236, + ExportSpecifier = 237, + MissingDeclaration = 238, + ExternalModuleReference = 239, + JsxElement = 240, + JsxSelfClosingElement = 241, + JsxOpeningElement = 242, + JsxText = 243, + JsxClosingElement = 244, + JsxAttribute = 245, + JsxSpreadAttribute = 246, + JsxExpression = 247, + CaseClause = 248, + DefaultClause = 249, + HeritageClause = 250, + CatchClause = 251, + PropertyAssignment = 252, + ShorthandPropertyAssignment = 253, + EnumMember = 254, + SourceFile = 255, + JSDocTypeExpression = 256, + JSDocAllType = 257, + JSDocUnknownType = 258, + JSDocArrayType = 259, + JSDocUnionType = 260, + JSDocTupleType = 261, + JSDocNullableType = 262, + JSDocNonNullableType = 263, + JSDocRecordType = 264, + JSDocRecordMember = 265, + JSDocTypeReference = 266, + JSDocOptionalType = 267, + JSDocFunctionType = 268, + JSDocVariadicType = 269, + JSDocConstructorType = 270, + JSDocThisType = 271, + JSDocComment = 272, + JSDocTag = 273, + JSDocParameterTag = 274, + JSDocReturnTag = 275, + JSDocTypeTag = 276, + JSDocTemplateTag = 277, + SyntaxList = 278, + Count = 279, FirstAssignment = 56, LastAssignment = 68, FirstReservedWord = 70, LastReservedWord = 105, FirstKeyword = 70, - LastKeyword = 136, + LastKeyword = 137, FirstFutureReservedWord = 106, LastFutureReservedWord = 114, - FirstTypeNode = 152, - LastTypeNode = 164, + FirstTypeNode = 153, + LastTypeNode = 165, FirstPunctuation = 15, LastPunctuation = 68, FirstToken = 0, - LastToken = 136, + LastToken = 137, FirstTriviaToken = 2, LastTriviaToken = 7, FirstLiteralToken = 8, @@ -332,7 +335,7 @@ declare namespace ts { LastTemplateToken = 14, FirstBinaryOperator = 25, LastBinaryOperator = 68, - FirstNode = 137, + FirstNode = 138, } enum NodeFlags { None = 0, @@ -366,12 +369,13 @@ declare namespace ts { JavaScriptFile = 134217728, ThisNodeOrAnySubNodesHasError = 268435456, HasAggregatedChildData = 536870912, + HasJsxSpreadAttribute = 1073741824, Modifier = 959, AccessibilityModifier = 28, BlockScoped = 3072, ReachabilityCheckFlags = 98304, EmitHelperFlags = 3932160, - ContextFlags = 62914560, + ContextFlags = 197132288, TypeExcludesFlags = 41943040, } enum JsxFlags { @@ -401,6 +405,9 @@ declare namespace ts { text: string; originalKeywordKind?: SyntaxKind; } + interface TransientIdentifier extends Identifier { + resolvedSymbol: Symbol; + } interface QualifiedName extends Node { left: EntityName; right: Identifier; @@ -702,6 +709,7 @@ declare namespace ts { dotToken: Node; name: Identifier; } + type IdentifierOrPropertyAccess = Identifier | PropertyAccessExpression; interface ElementAccessExpression extends MemberExpression { expression: LeftHandSideExpression; argumentExpression?: Expression; @@ -731,6 +739,9 @@ declare namespace ts { expression: UnaryExpression; } type AssertionExpression = TypeAssertion | AsExpression; + interface NonNullExpression extends LeftHandSideExpression { + expression: Expression; + } interface JsxElement extends PrimaryExpression { openingElement: JsxOpeningElement; children: NodeArray; @@ -854,6 +865,7 @@ declare namespace ts { variableDeclaration: VariableDeclaration; block: Block; } + type DeclarationWithTypeParameters = SignatureDeclaration | ClassLikeDeclaration | InterfaceDeclaration | TypeAliasDeclaration; interface ClassLikeDeclaration extends Declaration { name?: Identifier; typeParameters?: NodeArray; @@ -923,6 +935,10 @@ declare namespace ts { interface NamespaceImport extends Declaration { name: Identifier; } + interface GlobalModuleExportDeclaration extends DeclarationStatement { + name: Identifier; + moduleReference: LiteralLikeNode; + } interface ExportDeclaration extends DeclarationStatement { exportClause?: NamedExports; moduleSpecifier?: Expression; @@ -1044,6 +1060,7 @@ declare namespace ts { amdDependencies: AmdDependency[]; moduleName: string; referencedFiles: FileReference[]; + typeReferenceDirectives: FileReference[]; languageVariant: LanguageVariant; isDeclarationFile: boolean; /** @@ -1066,7 +1083,7 @@ declare namespace ts { readDirectory(rootDir: string, extension: string, exclude: string[]): string[]; } interface WriteFileCallback { - (fileName: string, data: string, writeByteOrderMark: boolean, onError?: (message: string) => void): void; + (fileName: string, data: string, writeByteOrderMark: boolean, onError?: (message: string) => void, sourceFiles?: SourceFile[]): void; } class OperationCanceledException { } @@ -1141,6 +1158,7 @@ declare namespace ts { emitSkipped: boolean; /** Contains declaration emit diagnostics */ diagnostics: Diagnostic[]; + emittedFiles: string[]; } interface TypeChecker { getTypeOfSymbolAtLocation(symbol: Symbol, node: Node): Type; @@ -1186,7 +1204,7 @@ declare namespace ts { buildTypeParameterDisplay(tp: TypeParameter, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void; buildTypePredicateDisplay(predicate: TypePredicate, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void; buildTypeParameterDisplayFromSymbol(symbol: Symbol, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void; - buildDisplayForParametersAndDelimiters(parameters: Symbol[], writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void; + buildDisplayForParametersAndDelimiters(thisType: Type, parameters: Symbol[], writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void; buildDisplayForTypeParametersAndDelimiters(typeParameters: TypeParameter[], writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void; buildReturnTypeDisplay(signature: Signature, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void; } @@ -1310,6 +1328,7 @@ declare namespace ts { valueDeclaration?: Declaration; members?: SymbolTable; exports?: SymbolTable; + globalExports?: SymbolTable; } interface SymbolTable { [index: string]: Symbol; @@ -1394,6 +1413,7 @@ declare namespace ts { declaration: SignatureDeclaration; typeParameters: TypeParameter[]; parameters: Symbol[]; + thisType?: Type; } enum IndexKind { String = 0, @@ -1442,10 +1462,12 @@ declare namespace ts { type RootPaths = string[]; type PathSubstitutions = Map; type TsConfigOnlyOptions = RootPaths | PathSubstitutions; + type CompilerOptionsValue = string | number | boolean | (string | number)[] | TsConfigOnlyOptions; interface CompilerOptions { allowNonTsExtensions?: boolean; charset?: string; declaration?: boolean; + declarationDir?: string; diagnostics?: boolean; emitBOM?: boolean; help?: boolean; @@ -1455,6 +1477,7 @@ declare namespace ts { jsx?: JsxEmit; reactNamespace?: string; listFiles?: boolean; + typesSearchPaths?: string[]; locale?: string; mapRoot?: string; module?: ModuleKind; @@ -1464,6 +1487,7 @@ declare namespace ts { noEmitOnError?: boolean; noErrorTruncation?: boolean; noImplicitAny?: boolean; + noImplicitThis?: boolean; noLib?: boolean; noResolve?: boolean; out?: string; @@ -1492,11 +1516,30 @@ declare namespace ts { baseUrl?: string; paths?: PathSubstitutions; rootDirs?: RootPaths; - traceModuleResolution?: boolean; + traceResolution?: boolean; allowSyntheticDefaultImports?: boolean; allowJs?: boolean; noImplicitUseStrict?: boolean; - [option: string]: string | number | boolean | TsConfigOnlyOptions; + strictNullChecks?: boolean; + listEmittedFiles?: boolean; + lib?: string[]; + types?: string[]; + list?: string[]; + [option: string]: CompilerOptionsValue; + } + interface TypingOptions { + enableAutoDiscovery?: boolean; + include?: string[]; + exclude?: string[]; + [option: string]: string[] | boolean; + } + interface DiscoverTypingsInfo { + fileNames: string[]; + projectRootPath: string; + safeListPath: string; + packageNameToTypingLocation: Map; + typingOptions: TypingOptions; + compilerOptions: CompilerOptions; } enum ModuleKind { None = 0, @@ -1540,6 +1583,7 @@ declare namespace ts { } interface ParsedCommandLine { options: CompilerOptions; + typingOptions?: TypingOptions; fileNames: string[]; errors: Diagnostic[]; } @@ -1557,16 +1601,29 @@ declare namespace ts { resolvedModule: ResolvedModule; failedLookupLocations: string[]; } + interface ResolvedTypeReferenceDirective { + primary: boolean; + resolvedFileName?: string; + } + interface ResolvedTypeReferenceDirectiveWithFailedLookupLocations { + resolvedTypeReferenceDirective: ResolvedTypeReferenceDirective; + failedLookupLocations: string[]; + } interface CompilerHost extends ModuleResolutionHost { getSourceFile(fileName: string, languageVersion: ScriptTarget, onError?: (message: string) => void): SourceFile; getCancellationToken?(): CancellationToken; getDefaultLibFileName(options: CompilerOptions): string; + getDefaultLibLocation?(): string; writeFile: WriteFileCallback; getCurrentDirectory(): string; getCanonicalFileName(fileName: string): string; useCaseSensitiveFileNames(): boolean; getNewLine(): string; resolveModuleNames?(moduleNames: string[], containingFile: string): ResolvedModule[]; + /** + * 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[]; } interface TextSpan { start: number; @@ -1578,8 +1635,8 @@ declare namespace ts { } } declare namespace ts { - type FileWatcherCallback = (path: string, removed?: boolean) => void; - type DirectoryWatcherCallback = (path: string) => void; + type FileWatcherCallback = (fileName: string, removed?: boolean) => void; + type DirectoryWatcherCallback = (directoryName: string) => void; interface System { args: string[]; newLine: string; @@ -1587,7 +1644,7 @@ declare namespace ts { write(s: string): void; readFile(path: string, encoding?: string): string; writeFile(path: string, data: string, writeByteOrderMark?: boolean): void; - watchFile?(path: Path, callback: FileWatcherCallback): FileWatcher; + watchFile?(path: string, callback: FileWatcherCallback): FileWatcher; watchDirectory?(path: string, callback: DirectoryWatcherCallback, recursive?: boolean): FileWatcher; resolvePath(path: string): string; fileExists(path: string): boolean; @@ -1596,6 +1653,8 @@ declare namespace ts { getExecutingFilePath(): string; getCurrentDirectory(): string; readDirectory(path: string, extension?: string, exclude?: string[]): string[]; + getModifiedTime?(path: string): Date; + createHash?(data: string): string; getMemoryUsage?(): number; exit(exitCode?: number): void; } @@ -1603,7 +1662,7 @@ declare namespace ts { close(): void; } interface DirectoryWatcher extends FileWatcher { - directoryPath: Path; + directoryName: string; referenceCount: number; } var sys: System; @@ -1685,17 +1744,26 @@ declare namespace ts { function collapseTextChangeRangesAcrossMultipleVersions(changes: TextChangeRange[]): TextChangeRange; function getTypeParameterOwner(d: Declaration): Declaration; function isParameterPropertyDeclaration(node: ParameterDeclaration): boolean; + function startsWith(str: string, prefix: string): boolean; + function endsWith(str: string, suffix: string): boolean; } 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 isExternalModule(file: SourceFile): boolean; function updateSourceFile(sourceFile: SourceFile, newText: string, textChangeRange: TextChangeRange, aggressiveChecks?: boolean): SourceFile; } declare namespace ts { const version: string; function findConfigFile(searchPath: string, fileExists: (fileName: string) => boolean): string; function resolveTripleslashReference(moduleName: string, containingFile: string): string; + /** + * @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; @@ -1705,7 +1773,6 @@ declare namespace ts { 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 @@ -1735,6 +1802,10 @@ declare namespace ts { options: CompilerOptions; errors: Diagnostic[]; }; + function convertTypingOptionsFromJson(jsonOptions: any, basePath: string, configFileName?: string): { + options: CompilerOptions; + errors: Diagnostic[]; + }; } declare namespace ts { /** The version of the language service API */ @@ -1812,6 +1883,7 @@ declare namespace ts { } interface PreProcessedFileInfo { referencedFiles: FileReference[]; + typeReferenceDirectives: FileReference[]; importedFiles: FileReference[]; ambientExternalModules: string[]; isLibFile: boolean; @@ -1836,6 +1908,7 @@ declare namespace ts { error?(s: string): void; useCaseSensitiveFileNames?(): boolean; resolveModuleNames?(moduleNames: string[], containingFile: string): ResolvedModule[]; + resolveTypeReferenceDirectives?(typeDirectiveNames: string[], containingFile: string): ResolvedTypeReferenceDirective[]; directoryExists?(directoryName: string): boolean; } interface LanguageService { @@ -1880,7 +1953,6 @@ declare namespace ts { getDocCommentTemplateAtPosition(fileName: string, position: number): TextInsertion; getEmitOutput(fileName: string): EmitOutput; getProgram(): Program; - getSourceFile(fileName: string): SourceFile; dispose(): void; } interface Classifications { diff --git a/lib/typescript.js b/lib/typescript.js index 8dafad54257..f8b128defd8 100644 --- a/lib/typescript.js +++ b/lib/typescript.js @@ -168,184 +168,187 @@ var ts; SyntaxKind[SyntaxKind["StringKeyword"] = 131] = "StringKeyword"; SyntaxKind[SyntaxKind["SymbolKeyword"] = 132] = "SymbolKeyword"; SyntaxKind[SyntaxKind["TypeKeyword"] = 133] = "TypeKeyword"; - SyntaxKind[SyntaxKind["FromKeyword"] = 134] = "FromKeyword"; - SyntaxKind[SyntaxKind["GlobalKeyword"] = 135] = "GlobalKeyword"; - SyntaxKind[SyntaxKind["OfKeyword"] = 136] = "OfKeyword"; + SyntaxKind[SyntaxKind["UndefinedKeyword"] = 134] = "UndefinedKeyword"; + SyntaxKind[SyntaxKind["FromKeyword"] = 135] = "FromKeyword"; + SyntaxKind[SyntaxKind["GlobalKeyword"] = 136] = "GlobalKeyword"; + SyntaxKind[SyntaxKind["OfKeyword"] = 137] = "OfKeyword"; // Parse tree nodes // Names - SyntaxKind[SyntaxKind["QualifiedName"] = 137] = "QualifiedName"; - SyntaxKind[SyntaxKind["ComputedPropertyName"] = 138] = "ComputedPropertyName"; + SyntaxKind[SyntaxKind["QualifiedName"] = 138] = "QualifiedName"; + SyntaxKind[SyntaxKind["ComputedPropertyName"] = 139] = "ComputedPropertyName"; // Signature elements - SyntaxKind[SyntaxKind["TypeParameter"] = 139] = "TypeParameter"; - SyntaxKind[SyntaxKind["Parameter"] = 140] = "Parameter"; - SyntaxKind[SyntaxKind["Decorator"] = 141] = "Decorator"; + SyntaxKind[SyntaxKind["TypeParameter"] = 140] = "TypeParameter"; + SyntaxKind[SyntaxKind["Parameter"] = 141] = "Parameter"; + SyntaxKind[SyntaxKind["Decorator"] = 142] = "Decorator"; // TypeMember - SyntaxKind[SyntaxKind["PropertySignature"] = 142] = "PropertySignature"; - SyntaxKind[SyntaxKind["PropertyDeclaration"] = 143] = "PropertyDeclaration"; - SyntaxKind[SyntaxKind["MethodSignature"] = 144] = "MethodSignature"; - SyntaxKind[SyntaxKind["MethodDeclaration"] = 145] = "MethodDeclaration"; - SyntaxKind[SyntaxKind["Constructor"] = 146] = "Constructor"; - SyntaxKind[SyntaxKind["GetAccessor"] = 147] = "GetAccessor"; - SyntaxKind[SyntaxKind["SetAccessor"] = 148] = "SetAccessor"; - SyntaxKind[SyntaxKind["CallSignature"] = 149] = "CallSignature"; - SyntaxKind[SyntaxKind["ConstructSignature"] = 150] = "ConstructSignature"; - SyntaxKind[SyntaxKind["IndexSignature"] = 151] = "IndexSignature"; + SyntaxKind[SyntaxKind["PropertySignature"] = 143] = "PropertySignature"; + SyntaxKind[SyntaxKind["PropertyDeclaration"] = 144] = "PropertyDeclaration"; + SyntaxKind[SyntaxKind["MethodSignature"] = 145] = "MethodSignature"; + SyntaxKind[SyntaxKind["MethodDeclaration"] = 146] = "MethodDeclaration"; + SyntaxKind[SyntaxKind["Constructor"] = 147] = "Constructor"; + SyntaxKind[SyntaxKind["GetAccessor"] = 148] = "GetAccessor"; + SyntaxKind[SyntaxKind["SetAccessor"] = 149] = "SetAccessor"; + SyntaxKind[SyntaxKind["CallSignature"] = 150] = "CallSignature"; + SyntaxKind[SyntaxKind["ConstructSignature"] = 151] = "ConstructSignature"; + SyntaxKind[SyntaxKind["IndexSignature"] = 152] = "IndexSignature"; // Type - SyntaxKind[SyntaxKind["TypePredicate"] = 152] = "TypePredicate"; - SyntaxKind[SyntaxKind["TypeReference"] = 153] = "TypeReference"; - SyntaxKind[SyntaxKind["FunctionType"] = 154] = "FunctionType"; - SyntaxKind[SyntaxKind["ConstructorType"] = 155] = "ConstructorType"; - SyntaxKind[SyntaxKind["TypeQuery"] = 156] = "TypeQuery"; - SyntaxKind[SyntaxKind["TypeLiteral"] = 157] = "TypeLiteral"; - SyntaxKind[SyntaxKind["ArrayType"] = 158] = "ArrayType"; - SyntaxKind[SyntaxKind["TupleType"] = 159] = "TupleType"; - SyntaxKind[SyntaxKind["UnionType"] = 160] = "UnionType"; - SyntaxKind[SyntaxKind["IntersectionType"] = 161] = "IntersectionType"; - SyntaxKind[SyntaxKind["ParenthesizedType"] = 162] = "ParenthesizedType"; - SyntaxKind[SyntaxKind["ThisType"] = 163] = "ThisType"; - SyntaxKind[SyntaxKind["StringLiteralType"] = 164] = "StringLiteralType"; + SyntaxKind[SyntaxKind["TypePredicate"] = 153] = "TypePredicate"; + SyntaxKind[SyntaxKind["TypeReference"] = 154] = "TypeReference"; + SyntaxKind[SyntaxKind["FunctionType"] = 155] = "FunctionType"; + SyntaxKind[SyntaxKind["ConstructorType"] = 156] = "ConstructorType"; + SyntaxKind[SyntaxKind["TypeQuery"] = 157] = "TypeQuery"; + SyntaxKind[SyntaxKind["TypeLiteral"] = 158] = "TypeLiteral"; + SyntaxKind[SyntaxKind["ArrayType"] = 159] = "ArrayType"; + SyntaxKind[SyntaxKind["TupleType"] = 160] = "TupleType"; + SyntaxKind[SyntaxKind["UnionType"] = 161] = "UnionType"; + SyntaxKind[SyntaxKind["IntersectionType"] = 162] = "IntersectionType"; + SyntaxKind[SyntaxKind["ParenthesizedType"] = 163] = "ParenthesizedType"; + SyntaxKind[SyntaxKind["ThisType"] = 164] = "ThisType"; + SyntaxKind[SyntaxKind["StringLiteralType"] = 165] = "StringLiteralType"; // Binding patterns - SyntaxKind[SyntaxKind["ObjectBindingPattern"] = 165] = "ObjectBindingPattern"; - SyntaxKind[SyntaxKind["ArrayBindingPattern"] = 166] = "ArrayBindingPattern"; - SyntaxKind[SyntaxKind["BindingElement"] = 167] = "BindingElement"; + SyntaxKind[SyntaxKind["ObjectBindingPattern"] = 166] = "ObjectBindingPattern"; + SyntaxKind[SyntaxKind["ArrayBindingPattern"] = 167] = "ArrayBindingPattern"; + SyntaxKind[SyntaxKind["BindingElement"] = 168] = "BindingElement"; // Expression - SyntaxKind[SyntaxKind["ArrayLiteralExpression"] = 168] = "ArrayLiteralExpression"; - SyntaxKind[SyntaxKind["ObjectLiteralExpression"] = 169] = "ObjectLiteralExpression"; - SyntaxKind[SyntaxKind["PropertyAccessExpression"] = 170] = "PropertyAccessExpression"; - SyntaxKind[SyntaxKind["ElementAccessExpression"] = 171] = "ElementAccessExpression"; - SyntaxKind[SyntaxKind["CallExpression"] = 172] = "CallExpression"; - SyntaxKind[SyntaxKind["NewExpression"] = 173] = "NewExpression"; - SyntaxKind[SyntaxKind["TaggedTemplateExpression"] = 174] = "TaggedTemplateExpression"; - SyntaxKind[SyntaxKind["TypeAssertionExpression"] = 175] = "TypeAssertionExpression"; - SyntaxKind[SyntaxKind["ParenthesizedExpression"] = 176] = "ParenthesizedExpression"; - SyntaxKind[SyntaxKind["FunctionExpression"] = 177] = "FunctionExpression"; - SyntaxKind[SyntaxKind["ArrowFunction"] = 178] = "ArrowFunction"; - SyntaxKind[SyntaxKind["DeleteExpression"] = 179] = "DeleteExpression"; - SyntaxKind[SyntaxKind["TypeOfExpression"] = 180] = "TypeOfExpression"; - SyntaxKind[SyntaxKind["VoidExpression"] = 181] = "VoidExpression"; - SyntaxKind[SyntaxKind["AwaitExpression"] = 182] = "AwaitExpression"; - SyntaxKind[SyntaxKind["PrefixUnaryExpression"] = 183] = "PrefixUnaryExpression"; - SyntaxKind[SyntaxKind["PostfixUnaryExpression"] = 184] = "PostfixUnaryExpression"; - SyntaxKind[SyntaxKind["BinaryExpression"] = 185] = "BinaryExpression"; - SyntaxKind[SyntaxKind["ConditionalExpression"] = 186] = "ConditionalExpression"; - SyntaxKind[SyntaxKind["TemplateExpression"] = 187] = "TemplateExpression"; - SyntaxKind[SyntaxKind["YieldExpression"] = 188] = "YieldExpression"; - SyntaxKind[SyntaxKind["SpreadElementExpression"] = 189] = "SpreadElementExpression"; - SyntaxKind[SyntaxKind["ClassExpression"] = 190] = "ClassExpression"; - SyntaxKind[SyntaxKind["OmittedExpression"] = 191] = "OmittedExpression"; - SyntaxKind[SyntaxKind["ExpressionWithTypeArguments"] = 192] = "ExpressionWithTypeArguments"; - SyntaxKind[SyntaxKind["AsExpression"] = 193] = "AsExpression"; + SyntaxKind[SyntaxKind["ArrayLiteralExpression"] = 169] = "ArrayLiteralExpression"; + SyntaxKind[SyntaxKind["ObjectLiteralExpression"] = 170] = "ObjectLiteralExpression"; + SyntaxKind[SyntaxKind["PropertyAccessExpression"] = 171] = "PropertyAccessExpression"; + SyntaxKind[SyntaxKind["ElementAccessExpression"] = 172] = "ElementAccessExpression"; + SyntaxKind[SyntaxKind["CallExpression"] = 173] = "CallExpression"; + SyntaxKind[SyntaxKind["NewExpression"] = 174] = "NewExpression"; + SyntaxKind[SyntaxKind["TaggedTemplateExpression"] = 175] = "TaggedTemplateExpression"; + SyntaxKind[SyntaxKind["TypeAssertionExpression"] = 176] = "TypeAssertionExpression"; + SyntaxKind[SyntaxKind["ParenthesizedExpression"] = 177] = "ParenthesizedExpression"; + SyntaxKind[SyntaxKind["FunctionExpression"] = 178] = "FunctionExpression"; + SyntaxKind[SyntaxKind["ArrowFunction"] = 179] = "ArrowFunction"; + SyntaxKind[SyntaxKind["DeleteExpression"] = 180] = "DeleteExpression"; + SyntaxKind[SyntaxKind["TypeOfExpression"] = 181] = "TypeOfExpression"; + SyntaxKind[SyntaxKind["VoidExpression"] = 182] = "VoidExpression"; + SyntaxKind[SyntaxKind["AwaitExpression"] = 183] = "AwaitExpression"; + SyntaxKind[SyntaxKind["PrefixUnaryExpression"] = 184] = "PrefixUnaryExpression"; + SyntaxKind[SyntaxKind["PostfixUnaryExpression"] = 185] = "PostfixUnaryExpression"; + SyntaxKind[SyntaxKind["BinaryExpression"] = 186] = "BinaryExpression"; + SyntaxKind[SyntaxKind["ConditionalExpression"] = 187] = "ConditionalExpression"; + SyntaxKind[SyntaxKind["TemplateExpression"] = 188] = "TemplateExpression"; + SyntaxKind[SyntaxKind["YieldExpression"] = 189] = "YieldExpression"; + SyntaxKind[SyntaxKind["SpreadElementExpression"] = 190] = "SpreadElementExpression"; + SyntaxKind[SyntaxKind["ClassExpression"] = 191] = "ClassExpression"; + SyntaxKind[SyntaxKind["OmittedExpression"] = 192] = "OmittedExpression"; + SyntaxKind[SyntaxKind["ExpressionWithTypeArguments"] = 193] = "ExpressionWithTypeArguments"; + SyntaxKind[SyntaxKind["AsExpression"] = 194] = "AsExpression"; + SyntaxKind[SyntaxKind["NonNullExpression"] = 195] = "NonNullExpression"; // Misc - SyntaxKind[SyntaxKind["TemplateSpan"] = 194] = "TemplateSpan"; - SyntaxKind[SyntaxKind["SemicolonClassElement"] = 195] = "SemicolonClassElement"; + SyntaxKind[SyntaxKind["TemplateSpan"] = 196] = "TemplateSpan"; + SyntaxKind[SyntaxKind["SemicolonClassElement"] = 197] = "SemicolonClassElement"; // Element - SyntaxKind[SyntaxKind["Block"] = 196] = "Block"; - SyntaxKind[SyntaxKind["VariableStatement"] = 197] = "VariableStatement"; - SyntaxKind[SyntaxKind["EmptyStatement"] = 198] = "EmptyStatement"; - SyntaxKind[SyntaxKind["ExpressionStatement"] = 199] = "ExpressionStatement"; - SyntaxKind[SyntaxKind["IfStatement"] = 200] = "IfStatement"; - SyntaxKind[SyntaxKind["DoStatement"] = 201] = "DoStatement"; - SyntaxKind[SyntaxKind["WhileStatement"] = 202] = "WhileStatement"; - SyntaxKind[SyntaxKind["ForStatement"] = 203] = "ForStatement"; - SyntaxKind[SyntaxKind["ForInStatement"] = 204] = "ForInStatement"; - SyntaxKind[SyntaxKind["ForOfStatement"] = 205] = "ForOfStatement"; - SyntaxKind[SyntaxKind["ContinueStatement"] = 206] = "ContinueStatement"; - SyntaxKind[SyntaxKind["BreakStatement"] = 207] = "BreakStatement"; - SyntaxKind[SyntaxKind["ReturnStatement"] = 208] = "ReturnStatement"; - SyntaxKind[SyntaxKind["WithStatement"] = 209] = "WithStatement"; - SyntaxKind[SyntaxKind["SwitchStatement"] = 210] = "SwitchStatement"; - SyntaxKind[SyntaxKind["LabeledStatement"] = 211] = "LabeledStatement"; - SyntaxKind[SyntaxKind["ThrowStatement"] = 212] = "ThrowStatement"; - SyntaxKind[SyntaxKind["TryStatement"] = 213] = "TryStatement"; - SyntaxKind[SyntaxKind["DebuggerStatement"] = 214] = "DebuggerStatement"; - SyntaxKind[SyntaxKind["VariableDeclaration"] = 215] = "VariableDeclaration"; - SyntaxKind[SyntaxKind["VariableDeclarationList"] = 216] = "VariableDeclarationList"; - SyntaxKind[SyntaxKind["FunctionDeclaration"] = 217] = "FunctionDeclaration"; - SyntaxKind[SyntaxKind["ClassDeclaration"] = 218] = "ClassDeclaration"; - SyntaxKind[SyntaxKind["InterfaceDeclaration"] = 219] = "InterfaceDeclaration"; - SyntaxKind[SyntaxKind["TypeAliasDeclaration"] = 220] = "TypeAliasDeclaration"; - SyntaxKind[SyntaxKind["EnumDeclaration"] = 221] = "EnumDeclaration"; - SyntaxKind[SyntaxKind["ModuleDeclaration"] = 222] = "ModuleDeclaration"; - SyntaxKind[SyntaxKind["ModuleBlock"] = 223] = "ModuleBlock"; - SyntaxKind[SyntaxKind["CaseBlock"] = 224] = "CaseBlock"; - SyntaxKind[SyntaxKind["ImportEqualsDeclaration"] = 225] = "ImportEqualsDeclaration"; - SyntaxKind[SyntaxKind["ImportDeclaration"] = 226] = "ImportDeclaration"; - SyntaxKind[SyntaxKind["ImportClause"] = 227] = "ImportClause"; - SyntaxKind[SyntaxKind["NamespaceImport"] = 228] = "NamespaceImport"; - SyntaxKind[SyntaxKind["NamedImports"] = 229] = "NamedImports"; - SyntaxKind[SyntaxKind["ImportSpecifier"] = 230] = "ImportSpecifier"; - SyntaxKind[SyntaxKind["ExportAssignment"] = 231] = "ExportAssignment"; - SyntaxKind[SyntaxKind["ExportDeclaration"] = 232] = "ExportDeclaration"; - SyntaxKind[SyntaxKind["NamedExports"] = 233] = "NamedExports"; - SyntaxKind[SyntaxKind["ExportSpecifier"] = 234] = "ExportSpecifier"; - SyntaxKind[SyntaxKind["MissingDeclaration"] = 235] = "MissingDeclaration"; + SyntaxKind[SyntaxKind["Block"] = 198] = "Block"; + SyntaxKind[SyntaxKind["VariableStatement"] = 199] = "VariableStatement"; + SyntaxKind[SyntaxKind["EmptyStatement"] = 200] = "EmptyStatement"; + SyntaxKind[SyntaxKind["ExpressionStatement"] = 201] = "ExpressionStatement"; + SyntaxKind[SyntaxKind["IfStatement"] = 202] = "IfStatement"; + SyntaxKind[SyntaxKind["DoStatement"] = 203] = "DoStatement"; + SyntaxKind[SyntaxKind["WhileStatement"] = 204] = "WhileStatement"; + SyntaxKind[SyntaxKind["ForStatement"] = 205] = "ForStatement"; + SyntaxKind[SyntaxKind["ForInStatement"] = 206] = "ForInStatement"; + SyntaxKind[SyntaxKind["ForOfStatement"] = 207] = "ForOfStatement"; + SyntaxKind[SyntaxKind["ContinueStatement"] = 208] = "ContinueStatement"; + SyntaxKind[SyntaxKind["BreakStatement"] = 209] = "BreakStatement"; + SyntaxKind[SyntaxKind["ReturnStatement"] = 210] = "ReturnStatement"; + SyntaxKind[SyntaxKind["WithStatement"] = 211] = "WithStatement"; + SyntaxKind[SyntaxKind["SwitchStatement"] = 212] = "SwitchStatement"; + SyntaxKind[SyntaxKind["LabeledStatement"] = 213] = "LabeledStatement"; + SyntaxKind[SyntaxKind["ThrowStatement"] = 214] = "ThrowStatement"; + SyntaxKind[SyntaxKind["TryStatement"] = 215] = "TryStatement"; + SyntaxKind[SyntaxKind["DebuggerStatement"] = 216] = "DebuggerStatement"; + SyntaxKind[SyntaxKind["VariableDeclaration"] = 217] = "VariableDeclaration"; + SyntaxKind[SyntaxKind["VariableDeclarationList"] = 218] = "VariableDeclarationList"; + SyntaxKind[SyntaxKind["FunctionDeclaration"] = 219] = "FunctionDeclaration"; + SyntaxKind[SyntaxKind["ClassDeclaration"] = 220] = "ClassDeclaration"; + SyntaxKind[SyntaxKind["InterfaceDeclaration"] = 221] = "InterfaceDeclaration"; + SyntaxKind[SyntaxKind["TypeAliasDeclaration"] = 222] = "TypeAliasDeclaration"; + SyntaxKind[SyntaxKind["EnumDeclaration"] = 223] = "EnumDeclaration"; + SyntaxKind[SyntaxKind["ModuleDeclaration"] = 224] = "ModuleDeclaration"; + SyntaxKind[SyntaxKind["ModuleBlock"] = 225] = "ModuleBlock"; + SyntaxKind[SyntaxKind["CaseBlock"] = 226] = "CaseBlock"; + SyntaxKind[SyntaxKind["GlobalModuleExportDeclaration"] = 227] = "GlobalModuleExportDeclaration"; + SyntaxKind[SyntaxKind["ImportEqualsDeclaration"] = 228] = "ImportEqualsDeclaration"; + SyntaxKind[SyntaxKind["ImportDeclaration"] = 229] = "ImportDeclaration"; + SyntaxKind[SyntaxKind["ImportClause"] = 230] = "ImportClause"; + SyntaxKind[SyntaxKind["NamespaceImport"] = 231] = "NamespaceImport"; + SyntaxKind[SyntaxKind["NamedImports"] = 232] = "NamedImports"; + SyntaxKind[SyntaxKind["ImportSpecifier"] = 233] = "ImportSpecifier"; + SyntaxKind[SyntaxKind["ExportAssignment"] = 234] = "ExportAssignment"; + SyntaxKind[SyntaxKind["ExportDeclaration"] = 235] = "ExportDeclaration"; + SyntaxKind[SyntaxKind["NamedExports"] = 236] = "NamedExports"; + SyntaxKind[SyntaxKind["ExportSpecifier"] = 237] = "ExportSpecifier"; + SyntaxKind[SyntaxKind["MissingDeclaration"] = 238] = "MissingDeclaration"; // Module references - SyntaxKind[SyntaxKind["ExternalModuleReference"] = 236] = "ExternalModuleReference"; + SyntaxKind[SyntaxKind["ExternalModuleReference"] = 239] = "ExternalModuleReference"; // JSX - SyntaxKind[SyntaxKind["JsxElement"] = 237] = "JsxElement"; - SyntaxKind[SyntaxKind["JsxSelfClosingElement"] = 238] = "JsxSelfClosingElement"; - SyntaxKind[SyntaxKind["JsxOpeningElement"] = 239] = "JsxOpeningElement"; - SyntaxKind[SyntaxKind["JsxText"] = 240] = "JsxText"; - SyntaxKind[SyntaxKind["JsxClosingElement"] = 241] = "JsxClosingElement"; - SyntaxKind[SyntaxKind["JsxAttribute"] = 242] = "JsxAttribute"; - SyntaxKind[SyntaxKind["JsxSpreadAttribute"] = 243] = "JsxSpreadAttribute"; - SyntaxKind[SyntaxKind["JsxExpression"] = 244] = "JsxExpression"; + SyntaxKind[SyntaxKind["JsxElement"] = 240] = "JsxElement"; + SyntaxKind[SyntaxKind["JsxSelfClosingElement"] = 241] = "JsxSelfClosingElement"; + SyntaxKind[SyntaxKind["JsxOpeningElement"] = 242] = "JsxOpeningElement"; + SyntaxKind[SyntaxKind["JsxText"] = 243] = "JsxText"; + SyntaxKind[SyntaxKind["JsxClosingElement"] = 244] = "JsxClosingElement"; + SyntaxKind[SyntaxKind["JsxAttribute"] = 245] = "JsxAttribute"; + SyntaxKind[SyntaxKind["JsxSpreadAttribute"] = 246] = "JsxSpreadAttribute"; + SyntaxKind[SyntaxKind["JsxExpression"] = 247] = "JsxExpression"; // Clauses - SyntaxKind[SyntaxKind["CaseClause"] = 245] = "CaseClause"; - SyntaxKind[SyntaxKind["DefaultClause"] = 246] = "DefaultClause"; - SyntaxKind[SyntaxKind["HeritageClause"] = 247] = "HeritageClause"; - SyntaxKind[SyntaxKind["CatchClause"] = 248] = "CatchClause"; + SyntaxKind[SyntaxKind["CaseClause"] = 248] = "CaseClause"; + SyntaxKind[SyntaxKind["DefaultClause"] = 249] = "DefaultClause"; + SyntaxKind[SyntaxKind["HeritageClause"] = 250] = "HeritageClause"; + SyntaxKind[SyntaxKind["CatchClause"] = 251] = "CatchClause"; // Property assignments - SyntaxKind[SyntaxKind["PropertyAssignment"] = 249] = "PropertyAssignment"; - SyntaxKind[SyntaxKind["ShorthandPropertyAssignment"] = 250] = "ShorthandPropertyAssignment"; + SyntaxKind[SyntaxKind["PropertyAssignment"] = 252] = "PropertyAssignment"; + SyntaxKind[SyntaxKind["ShorthandPropertyAssignment"] = 253] = "ShorthandPropertyAssignment"; // Enum - SyntaxKind[SyntaxKind["EnumMember"] = 251] = "EnumMember"; + SyntaxKind[SyntaxKind["EnumMember"] = 254] = "EnumMember"; // Top-level nodes - SyntaxKind[SyntaxKind["SourceFile"] = 252] = "SourceFile"; + SyntaxKind[SyntaxKind["SourceFile"] = 255] = "SourceFile"; // JSDoc nodes - SyntaxKind[SyntaxKind["JSDocTypeExpression"] = 253] = "JSDocTypeExpression"; + SyntaxKind[SyntaxKind["JSDocTypeExpression"] = 256] = "JSDocTypeExpression"; // The * type - SyntaxKind[SyntaxKind["JSDocAllType"] = 254] = "JSDocAllType"; + SyntaxKind[SyntaxKind["JSDocAllType"] = 257] = "JSDocAllType"; // The ? type - SyntaxKind[SyntaxKind["JSDocUnknownType"] = 255] = "JSDocUnknownType"; - SyntaxKind[SyntaxKind["JSDocArrayType"] = 256] = "JSDocArrayType"; - SyntaxKind[SyntaxKind["JSDocUnionType"] = 257] = "JSDocUnionType"; - SyntaxKind[SyntaxKind["JSDocTupleType"] = 258] = "JSDocTupleType"; - SyntaxKind[SyntaxKind["JSDocNullableType"] = 259] = "JSDocNullableType"; - SyntaxKind[SyntaxKind["JSDocNonNullableType"] = 260] = "JSDocNonNullableType"; - SyntaxKind[SyntaxKind["JSDocRecordType"] = 261] = "JSDocRecordType"; - SyntaxKind[SyntaxKind["JSDocRecordMember"] = 262] = "JSDocRecordMember"; - SyntaxKind[SyntaxKind["JSDocTypeReference"] = 263] = "JSDocTypeReference"; - SyntaxKind[SyntaxKind["JSDocOptionalType"] = 264] = "JSDocOptionalType"; - SyntaxKind[SyntaxKind["JSDocFunctionType"] = 265] = "JSDocFunctionType"; - SyntaxKind[SyntaxKind["JSDocVariadicType"] = 266] = "JSDocVariadicType"; - SyntaxKind[SyntaxKind["JSDocConstructorType"] = 267] = "JSDocConstructorType"; - SyntaxKind[SyntaxKind["JSDocThisType"] = 268] = "JSDocThisType"; - SyntaxKind[SyntaxKind["JSDocComment"] = 269] = "JSDocComment"; - SyntaxKind[SyntaxKind["JSDocTag"] = 270] = "JSDocTag"; - SyntaxKind[SyntaxKind["JSDocParameterTag"] = 271] = "JSDocParameterTag"; - SyntaxKind[SyntaxKind["JSDocReturnTag"] = 272] = "JSDocReturnTag"; - SyntaxKind[SyntaxKind["JSDocTypeTag"] = 273] = "JSDocTypeTag"; - SyntaxKind[SyntaxKind["JSDocTemplateTag"] = 274] = "JSDocTemplateTag"; + SyntaxKind[SyntaxKind["JSDocUnknownType"] = 258] = "JSDocUnknownType"; + SyntaxKind[SyntaxKind["JSDocArrayType"] = 259] = "JSDocArrayType"; + SyntaxKind[SyntaxKind["JSDocUnionType"] = 260] = "JSDocUnionType"; + SyntaxKind[SyntaxKind["JSDocTupleType"] = 261] = "JSDocTupleType"; + SyntaxKind[SyntaxKind["JSDocNullableType"] = 262] = "JSDocNullableType"; + SyntaxKind[SyntaxKind["JSDocNonNullableType"] = 263] = "JSDocNonNullableType"; + SyntaxKind[SyntaxKind["JSDocRecordType"] = 264] = "JSDocRecordType"; + SyntaxKind[SyntaxKind["JSDocRecordMember"] = 265] = "JSDocRecordMember"; + SyntaxKind[SyntaxKind["JSDocTypeReference"] = 266] = "JSDocTypeReference"; + SyntaxKind[SyntaxKind["JSDocOptionalType"] = 267] = "JSDocOptionalType"; + SyntaxKind[SyntaxKind["JSDocFunctionType"] = 268] = "JSDocFunctionType"; + SyntaxKind[SyntaxKind["JSDocVariadicType"] = 269] = "JSDocVariadicType"; + SyntaxKind[SyntaxKind["JSDocConstructorType"] = 270] = "JSDocConstructorType"; + SyntaxKind[SyntaxKind["JSDocThisType"] = 271] = "JSDocThisType"; + SyntaxKind[SyntaxKind["JSDocComment"] = 272] = "JSDocComment"; + SyntaxKind[SyntaxKind["JSDocTag"] = 273] = "JSDocTag"; + SyntaxKind[SyntaxKind["JSDocParameterTag"] = 274] = "JSDocParameterTag"; + SyntaxKind[SyntaxKind["JSDocReturnTag"] = 275] = "JSDocReturnTag"; + SyntaxKind[SyntaxKind["JSDocTypeTag"] = 276] = "JSDocTypeTag"; + SyntaxKind[SyntaxKind["JSDocTemplateTag"] = 277] = "JSDocTemplateTag"; // Synthesized list - SyntaxKind[SyntaxKind["SyntaxList"] = 275] = "SyntaxList"; + SyntaxKind[SyntaxKind["SyntaxList"] = 278] = "SyntaxList"; // Enum value count - SyntaxKind[SyntaxKind["Count"] = 276] = "Count"; + SyntaxKind[SyntaxKind["Count"] = 279] = "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"] = 136] = "LastKeyword"; + SyntaxKind[SyntaxKind["LastKeyword"] = 137] = "LastKeyword"; SyntaxKind[SyntaxKind["FirstFutureReservedWord"] = 106] = "FirstFutureReservedWord"; SyntaxKind[SyntaxKind["LastFutureReservedWord"] = 114] = "LastFutureReservedWord"; - SyntaxKind[SyntaxKind["FirstTypeNode"] = 152] = "FirstTypeNode"; - SyntaxKind[SyntaxKind["LastTypeNode"] = 164] = "LastTypeNode"; + SyntaxKind[SyntaxKind["FirstTypeNode"] = 153] = "FirstTypeNode"; + SyntaxKind[SyntaxKind["LastTypeNode"] = 165] = "LastTypeNode"; SyntaxKind[SyntaxKind["FirstPunctuation"] = 15] = "FirstPunctuation"; SyntaxKind[SyntaxKind["LastPunctuation"] = 68] = "LastPunctuation"; SyntaxKind[SyntaxKind["FirstToken"] = 0] = "FirstToken"; - SyntaxKind[SyntaxKind["LastToken"] = 136] = "LastToken"; + SyntaxKind[SyntaxKind["LastToken"] = 137] = "LastToken"; SyntaxKind[SyntaxKind["FirstTriviaToken"] = 2] = "FirstTriviaToken"; SyntaxKind[SyntaxKind["LastTriviaToken"] = 7] = "LastTriviaToken"; SyntaxKind[SyntaxKind["FirstLiteralToken"] = 8] = "FirstLiteralToken"; @@ -354,7 +357,7 @@ var ts; SyntaxKind[SyntaxKind["LastTemplateToken"] = 14] = "LastTemplateToken"; SyntaxKind[SyntaxKind["FirstBinaryOperator"] = 25] = "FirstBinaryOperator"; SyntaxKind[SyntaxKind["LastBinaryOperator"] = 68] = "LastBinaryOperator"; - SyntaxKind[SyntaxKind["FirstNode"] = 137] = "FirstNode"; + SyntaxKind[SyntaxKind["FirstNode"] = 138] = "FirstNode"; })(ts.SyntaxKind || (ts.SyntaxKind = {})); var SyntaxKind = ts.SyntaxKind; (function (NodeFlags) { @@ -389,13 +392,14 @@ var ts; NodeFlags[NodeFlags["JavaScriptFile"] = 134217728] = "JavaScriptFile"; NodeFlags[NodeFlags["ThisNodeOrAnySubNodesHasError"] = 268435456] = "ThisNodeOrAnySubNodesHasError"; NodeFlags[NodeFlags["HasAggregatedChildData"] = 536870912] = "HasAggregatedChildData"; + NodeFlags[NodeFlags["HasJsxSpreadAttribute"] = 1073741824] = "HasJsxSpreadAttribute"; NodeFlags[NodeFlags["Modifier"] = 959] = "Modifier"; NodeFlags[NodeFlags["AccessibilityModifier"] = 28] = "AccessibilityModifier"; NodeFlags[NodeFlags["BlockScoped"] = 3072] = "BlockScoped"; NodeFlags[NodeFlags["ReachabilityCheckFlags"] = 98304] = "ReachabilityCheckFlags"; NodeFlags[NodeFlags["EmitHelperFlags"] = 3932160] = "EmitHelperFlags"; // Parsing context flags - NodeFlags[NodeFlags["ContextFlags"] = 62914560] = "ContextFlags"; + NodeFlags[NodeFlags["ContextFlags"] = 197132288] = "ContextFlags"; // Exclude these flags when parsing a Type NodeFlags[NodeFlags["TypeExcludesFlags"] = 41943040] = "TypeExcludesFlags"; })(ts.NodeFlags || (ts.NodeFlags = {})); @@ -622,6 +626,8 @@ var ts; TypeFlags[TypeFlags["ThisType"] = 33554432] = "ThisType"; TypeFlags[TypeFlags["ObjectLiteralPatternWithComputedProperties"] = 67108864] = "ObjectLiteralPatternWithComputedProperties"; /* @internal */ + TypeFlags[TypeFlags["Nullable"] = 96] = "Nullable"; + /* @internal */ TypeFlags[TypeFlags["Intrinsic"] = 16777343] = "Intrinsic"; /* @internal */ TypeFlags[TypeFlags["Primitive"] = 16777726] = "Primitive"; @@ -1087,8 +1093,14 @@ var ts; var count = array.length; if (count > 0) { var pos = 0; - var result = arguments.length <= 2 ? array[pos] : initial; - pos++; + var result = void 0; + if (arguments.length <= 2) { + result = array[pos]; + pos++; + } + else { + result = initial; + } while (pos < count) { result = f(result, array[pos]); pos++; @@ -1103,8 +1115,14 @@ var ts; if (array) { var pos = array.length - 1; if (pos >= 0) { - var result = arguments.length <= 2 ? array[pos] : initial; - pos--; + var result = void 0; + if (arguments.length <= 2) { + result = array[pos]; + pos--; + } + else { + result = initial; + } while (pos >= 0) { result = f(result, array[pos]); pos--; @@ -1120,6 +1138,14 @@ var ts; return hasOwnProperty.call(map, key); } ts.hasProperty = hasProperty; + function getKeys(map) { + var keys = []; + for (var key in map) { + keys.push(key); + } + return keys; + } + ts.getKeys = getKeys; function getProperty(map, key) { return hasOwnProperty.call(map, key) ? map[key] : undefined; } @@ -1586,6 +1612,32 @@ var ts; return pathLen > extLen && path.substr(pathLen - extLen, extLen) === extension; } ts.fileExtensionIs = fileExtensionIs; + function ensureScriptKind(fileName, scriptKind) { + // Using scriptKind as a condition handles both: + // - 'scriptKind' is unspecified and thus it is `undefined` + // - 'scriptKind' is set and it is `Unknown` (0) + // If the 'scriptKind' is 'undefined' or 'Unknown' then we attempt + // to get the ScriptKind from the file name. If it cannot be resolved + // from the file name then the default 'TS' script kind is returned. + return (scriptKind || getScriptKindFromFileName(fileName)) || 3 /* TS */; + } + ts.ensureScriptKind = ensureScriptKind; + function getScriptKindFromFileName(fileName) { + var ext = fileName.substr(fileName.lastIndexOf(".")); + switch (ext.toLowerCase()) { + case ".js": + return 1 /* JS */; + case ".jsx": + return 2 /* JSX */; + case ".ts": + return 3 /* TS */; + case ".tsx": + return 4 /* TSX */; + default: + return 0 /* Unknown */; + } + } + ts.getScriptKindFromFileName = getScriptKindFromFileName; /** * List of supported extensions in order of file resolution precedence. */ @@ -1837,6 +1889,7 @@ var ts; var _fs = require("fs"); var _path = require("path"); var _os = require("os"); + var _crypto = require("crypto"); // average async stat takes about 30 microseconds // set chunk size to do 30 files in < 1 millisecond function createPollingWatchedFileSet(interval, chunkSize) { @@ -1853,13 +1906,13 @@ var ts; if (!watchedFile) { return; } - _fs.stat(watchedFile.filePath, function (err, stats) { + _fs.stat(watchedFile.fileName, function (err, stats) { if (err) { - watchedFile.callback(watchedFile.filePath); + watchedFile.callback(watchedFile.fileName); } else if (watchedFile.mtime.getTime() !== stats.mtime.getTime()) { - watchedFile.mtime = getModifiedTime(watchedFile.filePath); - watchedFile.callback(watchedFile.filePath, watchedFile.mtime.getTime() === 0); + watchedFile.mtime = getModifiedTime(watchedFile.fileName); + watchedFile.callback(watchedFile.fileName, watchedFile.mtime.getTime() === 0); } }); } @@ -1885,11 +1938,11 @@ var ts; nextFileToCheck = nextToCheck; }, interval); } - function addFile(filePath, callback) { + function addFile(fileName, callback) { var file = { - filePath: filePath, + fileName: fileName, callback: callback, - mtime: getModifiedTime(filePath) + mtime: getModifiedTime(fileName) }; watchedFiles.push(file); if (watchedFiles.length === 1) { @@ -1909,70 +1962,70 @@ var ts; }; } function createWatchedFileSet() { - var dirWatchers = ts.createFileMap(); + var dirWatchers = {}; // One file can have multiple watchers - var fileWatcherCallbacks = ts.createFileMap(); + var fileWatcherCallbacks = {}; return { addFile: addFile, removeFile: removeFile }; - function reduceDirWatcherRefCountForFile(filePath) { - var dirPath = ts.getDirectoryPath(filePath); - if (dirWatchers.contains(dirPath)) { - var watcher = dirWatchers.get(dirPath); + function reduceDirWatcherRefCountForFile(fileName) { + var dirName = ts.getDirectoryPath(fileName); + if (ts.hasProperty(dirWatchers, dirName)) { + var watcher = dirWatchers[dirName]; watcher.referenceCount -= 1; if (watcher.referenceCount <= 0) { watcher.close(); - dirWatchers.remove(dirPath); + delete dirWatchers[dirName]; } } } function addDirWatcher(dirPath) { - if (dirWatchers.contains(dirPath)) { - var watcher_1 = dirWatchers.get(dirPath); + if (ts.hasProperty(dirWatchers, dirPath)) { + var watcher_1 = dirWatchers[dirPath]; watcher_1.referenceCount += 1; return; } var watcher = _fs.watch(dirPath, { persistent: true }, function (eventName, relativeFileName) { return fileEventHandler(eventName, relativeFileName, dirPath); }); watcher.referenceCount = 1; - dirWatchers.set(dirPath, watcher); + dirWatchers[dirPath] = watcher; return; } function addFileWatcherCallback(filePath, callback) { - if (fileWatcherCallbacks.contains(filePath)) { - fileWatcherCallbacks.get(filePath).push(callback); + if (ts.hasProperty(fileWatcherCallbacks, filePath)) { + fileWatcherCallbacks[filePath].push(callback); } else { - fileWatcherCallbacks.set(filePath, [callback]); + fileWatcherCallbacks[filePath] = [callback]; } } - function addFile(filePath, callback) { - addFileWatcherCallback(filePath, callback); - addDirWatcher(ts.getDirectoryPath(filePath)); - return { filePath: filePath, callback: callback }; + function addFile(fileName, callback) { + addFileWatcherCallback(fileName, callback); + addDirWatcher(ts.getDirectoryPath(fileName)); + return { fileName: fileName, callback: callback }; } function removeFile(watchedFile) { - removeFileWatcherCallback(watchedFile.filePath, watchedFile.callback); - reduceDirWatcherRefCountForFile(watchedFile.filePath); + removeFileWatcherCallback(watchedFile.fileName, watchedFile.callback); + reduceDirWatcherRefCountForFile(watchedFile.fileName); } function removeFileWatcherCallback(filePath, callback) { - if (fileWatcherCallbacks.contains(filePath)) { - var newCallbacks = ts.copyListRemovingItem(callback, fileWatcherCallbacks.get(filePath)); + if (ts.hasProperty(fileWatcherCallbacks, filePath)) { + var newCallbacks = ts.copyListRemovingItem(callback, fileWatcherCallbacks[filePath]); if (newCallbacks.length === 0) { - fileWatcherCallbacks.remove(filePath); + delete fileWatcherCallbacks[filePath]; } else { - fileWatcherCallbacks.set(filePath, newCallbacks); + fileWatcherCallbacks[filePath] = newCallbacks; } } } function fileEventHandler(eventName, relativeFileName, baseDirPath) { // When files are deleted from disk, the triggered "rename" event would have a relativefileName of "undefined" - var filePath = typeof relativeFileName !== "string" + var fileName = typeof relativeFileName !== "string" ? undefined - : ts.toPath(relativeFileName, baseDirPath, ts.createGetCanonicalFileName(ts.sys.useCaseSensitiveFileNames)); + : ts.getNormalizedAbsolutePath(relativeFileName, baseDirPath); // Some applications save a working file via rename operations - if ((eventName === "change" || eventName === "rename") && fileWatcherCallbacks.contains(filePath)) { - for (var _i = 0, _a = fileWatcherCallbacks.get(filePath); _i < _a.length; _i++) { + if ((eventName === "change" || eventName === "rename") && ts.hasProperty(fileWatcherCallbacks, fileName)) { + for (var _i = 0, _a = fileWatcherCallbacks[fileName]; _i < _a.length; _i++) { var fileCallback = _a[_i]; - fileCallback(filePath); + fileCallback(fileName); } } } @@ -2078,6 +2131,11 @@ var ts; var directories = []; for (var _i = 0, files_2 = files; _i < files_2.length; _i++) { var current = files_2[_i]; + // This is necessary because on some file system node fails to exclude + // "." and "..". See https://github.com/nodejs/node/issues/4002 + if (current === "." || current === "..") { + continue; + } var name_3 = ts.combinePaths(path, current); if (!ts.contains(exclude, getCanonicalPath(name_3))) { var stat = _fs.statSync(name_3); @@ -2106,18 +2164,18 @@ var ts; }, readFile: readFile, writeFile: writeFile, - watchFile: function (filePath, callback) { + watchFile: function (fileName, callback) { // Node 4.0 stabilized the `fs.watch` function on Windows which avoids polling // and is more efficient than `fs.watchFile` (ref: https://github.com/nodejs/node/pull/2649 // and https://github.com/Microsoft/TypeScript/issues/4643), therefore // if the current node.js version is newer than 4, use `fs.watch` instead. var watchSet = isNode4OrLater() ? watchedFileSet : pollingWatchedFileSet; - var watchedFile = watchSet.addFile(filePath, callback); + var watchedFile = watchSet.addFile(fileName, callback); return { close: function () { return watchSet.removeFile(watchedFile); } }; }, - watchDirectory: function (path, callback, recursive) { + watchDirectory: function (directoryName, callback, recursive) { // 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; @@ -2127,13 +2185,13 @@ var ts; else { options = { persistent: true }; } - return _fs.watch(path, options, function (eventName, relativeFileName) { + return _fs.watch(directoryName, options, function (eventName, relativeFileName) { // In watchDirectory we only care about adding and removing files (when event name is // "rename"); changes made within files are handled by corresponding fileWatchers (when // event name is "change") if (eventName === "rename") { // When deleting a file, the passed baseFileName is null - callback(!relativeFileName ? relativeFileName : ts.normalizePath(ts.combinePaths(path, relativeFileName))); + callback(!relativeFileName ? relativeFileName : ts.normalizePath(ts.combinePaths(directoryName, relativeFileName))); } ; }); @@ -2155,6 +2213,19 @@ var ts; return process.cwd(); }, readDirectory: readDirectory, + getModifiedTime: function (path) { + try { + return _fs.statSync(path).mtime; + } + catch (e) { + return undefined; + } + }, + createHash: function (data) { + var hash = _crypto.createHash("md5"); + hash.update(data); + return hash.digest("hex"); + }, getMemoryUsage: function () { if (global.gc) { global.gc(); @@ -2423,6 +2494,9 @@ var ts; Async_functions_are_only_available_when_targeting_ECMAScript_6_and_higher: { code: 1311, category: ts.DiagnosticCategory.Error, key: "Async_functions_are_only_available_when_targeting_ECMAScript_6_and_higher_1311", message: "Async functions are only available when targeting ECMAScript 6 and 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." }, 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." }, @@ -2474,7 +2548,7 @@ var ts; 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." }, 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." }, - Neither_type_0_nor_type_1_is_assignable_to_the_other: { code: 2352, category: ts.DiagnosticCategory.Error, key: "Neither_type_0_nor_type_1_is_assignable_to_the_other_2352", message: "Neither type '{0}' nor type '{1}' is assignable to the other." }, + 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." }, 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." }, @@ -2488,6 +2562,7 @@ var ts; 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." }, 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}'" }, A_parameter_property_is_only_allowed_in_a_constructor_implementation: { code: 2369, category: ts.DiagnosticCategory.Error, key: "A_parameter_property_is_only_allowed_in_a_constructor_implementation_2369", message: "A parameter property is only allowed in a constructor implementation." }, A_rest_parameter_must_be_of_an_array_type: { code: 2370, category: ts.DiagnosticCategory.Error, key: "A_rest_parameter_must_be_of_an_array_type_2370", message: "A rest parameter must be of an array type." }, @@ -2568,6 +2643,7 @@ var ts; 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." }, + Variable_0_is_used_before_being_assigned: { code: 2454, category: ts.DiagnosticCategory.Error, key: "Variable_0_is_used_before_being_assigned_2454", message: "Variable '{0}' is used before being assigned." }, Type_argument_candidate_1_is_not_a_valid_type_argument_because_it_is_not_a_supertype_of_candidate_0: { code: 2455, category: ts.DiagnosticCategory.Error, key: "Type_argument_candidate_1_is_not_a_valid_type_argument_because_it_is_not_a_supertype_of_candidate_0_2455", message: "Type argument candidate '{1}' is not a valid type argument because it is not a supertype of candidate '{0}'." }, Type_alias_0_circularly_references_itself: { code: 2456, category: ts.DiagnosticCategory.Error, key: "Type_alias_0_circularly_references_itself_2456", message: "Type alias '{0}' circularly references itself." }, Type_alias_name_cannot_be_0: { code: 2457, category: ts.DiagnosticCategory.Error, key: "Type_alias_name_cannot_be_0_2457", message: "Type alias name cannot be '{0}'" }, @@ -2642,6 +2718,7 @@ var ts; A_module_cannot_have_multiple_default_exports: { code: 2528, category: ts.DiagnosticCategory.Error, key: "A_module_cannot_have_multiple_default_exports_2528", message: "A module cannot have multiple default exports." }, Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module_containing_async_functions: { code: 2529, category: ts.DiagnosticCategory.Error, key: "Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module_containing_async_func_2529", message: "Duplicate identifier '{0}'. Compiler reserves name '{1}' in top level scope of a module containing async functions." }, Property_0_is_incompatible_with_index_signature: { code: 2530, category: ts.DiagnosticCategory.Error, key: "Property_0_is_incompatible_with_index_signature_2530", message: "Property '{0}' is incompatible with index signature." }, + Object_is_possibly_null_or_undefined: { code: 2531, category: ts.DiagnosticCategory.Error, key: "Object_is_possibly_null_or_undefined_2531", message: "Object is possibly 'null' or 'undefined'." }, 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." }, @@ -2677,6 +2754,15 @@ var ts; Constructor_of_class_0_is_protected_and_only_accessible_within_the_class_declaration: { code: 2674, category: ts.DiagnosticCategory.Error, key: "Constructor_of_class_0_is_protected_and_only_accessible_within_the_class_declaration_2674", message: "Constructor of class '{0}' is protected and only accessible within the class declaration." }, Cannot_extend_a_class_0_Class_constructor_is_marked_as_private: { code: 2675, category: ts.DiagnosticCategory.Error, key: "Cannot_extend_a_class_0_Class_constructor_is_marked_as_private_2675", message: "Cannot extend a class '{0}'. Class constructor is marked as private." }, Accessors_must_both_be_abstract_or_non_abstract: { code: 2676, category: ts.DiagnosticCategory.Error, key: "Accessors_must_both_be_abstract_or_non_abstract_2676", message: "Accessors must both be abstract or non-abstract." }, + A_type_predicate_s_type_must_be_assignable_to_its_parameter_s_type: { code: 2677, category: ts.DiagnosticCategory.Error, key: "A_type_predicate_s_type_must_be_assignable_to_its_parameter_s_type_2677", message: "A type predicate's type must be assignable to its parameter's type." }, + Type_0_is_not_comparable_to_type_1: { code: 2678, category: ts.DiagnosticCategory.Error, key: "Type_0_is_not_comparable_to_type_1_2678", message: "Type '{0}' is not comparable to type '{1}'." }, + A_function_that_is_called_with_the_new_keyword_cannot_have_a_this_type_that_is_void: { code: 2679, category: ts.DiagnosticCategory.Error, key: "A_function_that_is_called_with_the_new_keyword_cannot_have_a_this_type_that_is_void_2679", message: "A function that is called with the 'new' keyword cannot have a 'this' type that is 'void'." }, + A_this_parameter_must_be_the_first_parameter: { code: 2680, category: ts.DiagnosticCategory.Error, key: "A_this_parameter_must_be_the_first_parameter_2680", message: "A 'this' parameter must be the first parameter." }, + A_constructor_cannot_have_a_this_parameter: { code: 2681, category: ts.DiagnosticCategory.Error, key: "A_constructor_cannot_have_a_this_parameter_2681", message: "A constructor cannot have a 'this' parameter." }, + A_setter_cannot_have_a_this_parameter: { code: 2682, category: ts.DiagnosticCategory.Error, key: "A_setter_cannot_have_a_this_parameter_2682", message: "A setter cannot have a 'this' parameter." }, + 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." }, 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}'." }, @@ -2747,6 +2833,7 @@ var ts; Parameter_0_of_exported_function_has_or_is_using_private_name_1: { code: 4078, category: ts.DiagnosticCategory.Error, key: "Parameter_0_of_exported_function_has_or_is_using_private_name_1_4078", message: "Parameter '{0}' of exported function has or is using private name '{1}'." }, Exported_type_alias_0_has_or_is_using_private_name_1: { code: 4081, category: ts.DiagnosticCategory.Error, key: "Exported_type_alias_0_has_or_is_using_private_name_1_4081", message: "Exported type alias '{0}' has or is using private name '{1}'." }, Default_export_of_the_module_has_or_is_using_private_name_0: { code: 4082, category: ts.DiagnosticCategory.Error, key: "Default_export_of_the_module_has_or_is_using_private_name_0_4082", message: "Default export of the module has or is using private name '{0}'." }, + Conflicting_library_definitions_for_0_found_at_1_and_2_Copy_the_correct_file_to_the_typings_folder_to_resolve_this_conflict: { code: 4090, category: ts.DiagnosticCategory.Message, key: "Conflicting_library_definitions_for_0_found_at_1_and_2_Copy_the_correct_file_to_the_typings_folder_t_4090", message: "Conflicting library definitions for '{0}' found at '{1}' and '{2}'. Copy the correct file to the 'typings' folder to resolve this conflict." }, The_current_host_does_not_support_the_0_option: { code: 5001, category: ts.DiagnosticCategory.Error, key: "The_current_host_does_not_support_the_0_option_5001", message: "The current host does not support the '{0}' option." }, Cannot_find_the_common_subdirectory_path_for_the_input_files: { code: 5009, category: ts.DiagnosticCategory.Error, key: "Cannot_find_the_common_subdirectory_path_for_the_input_files_5009", message: "Cannot find the common subdirectory path for the input files." }, Cannot_read_file_0_Colon_1: { code: 5012, category: ts.DiagnosticCategory.Error, key: "Cannot_read_file_0_Colon_1_5012", message: "Cannot read file '{0}': {1}" }, @@ -2771,8 +2858,8 @@ var ts; Substitution_0_in_pattern_1_in_can_have_at_most_one_Asterisk_character: { code: 5062, category: ts.DiagnosticCategory.Error, key: "Substitution_0_in_pattern_1_in_can_have_at_most_one_Asterisk_character_5062", message: "Substitution '{0}' in pattern '{1}' in can have at most one '*' character" }, 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." }, - Specifies_the_location_where_debugger_should_locate_map_files_instead_of_generated_locations: { code: 6003, category: ts.DiagnosticCategory.Message, key: "Specifies_the_location_where_debugger_should_locate_map_files_instead_of_generated_locations_6003", message: "Specifies the location where debugger should locate map files instead of generated locations." }, - Specifies_the_location_where_debugger_should_locate_TypeScript_files_instead_of_source_locations: { code: 6004, category: ts.DiagnosticCategory.Message, key: "Specifies_the_location_where_debugger_should_locate_TypeScript_files_instead_of_source_locations_6004", message: "Specifies the location where debugger should locate TypeScript files instead of source locations." }, + 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." }, + Specify_the_location_where_debugger_should_locate_TypeScript_files_instead_of_source_locations: { code: 6004, category: ts.DiagnosticCategory.Message, key: "Specify_the_location_where_debugger_should_locate_TypeScript_files_instead_of_source_locations_6004", message: "Specify the location where debugger should locate TypeScript files instead of source locations." }, Watch_input_files: { code: 6005, category: ts.DiagnosticCategory.Message, key: "Watch_input_files_6005", message: "Watch input files." }, Redirect_output_structure_to_the_directory: { code: 6006, category: ts.DiagnosticCategory.Message, key: "Redirect_output_structure_to_the_directory_6006", message: "Redirect output structure to the directory." }, Do_not_erase_const_enum_declarations_in_generated_code: { code: 6007, category: ts.DiagnosticCategory.Message, key: "Do_not_erase_const_enum_declarations_in_generated_code_6007", message: "Do not erase const enum declarations in generated code." }, @@ -2780,7 +2867,7 @@ var ts; Do_not_emit_comments_to_output: { code: 6009, category: ts.DiagnosticCategory.Message, key: "Do_not_emit_comments_to_output_6009", message: "Do not emit comments to output." }, 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." }, - Specify_ECMAScript_target_version_Colon_ES3_default_ES5_or_ES2015_experimental: { code: 6015, category: ts.DiagnosticCategory.Message, key: "Specify_ECMAScript_target_version_Colon_ES3_default_ES5_or_ES2015_experimental_6015", message: "Specify ECMAScript target version: 'ES3' (default), 'ES5', or 'ES2015' (experimental)" }, + 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_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." }, @@ -2802,8 +2889,7 @@ var ts; 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." }, Unterminated_quoted_string_in_response_file_0: { code: 6045, category: ts.DiagnosticCategory.Error, key: "Unterminated_quoted_string_in_response_file_0_6045", message: "Unterminated quoted string in response file '{0}'." }, - Argument_for_module_option_must_be_commonjs_amd_system_umd_es2015_or_none: { code: 6046, category: ts.DiagnosticCategory.Error, key: "Argument_for_module_option_must_be_commonjs_amd_system_umd_es2015_or_none_6046", message: "Argument for '--module' option must be 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'none'." }, - Argument_for_target_option_must_be_ES3_ES5_or_ES2015: { code: 6047, category: ts.DiagnosticCategory.Error, key: "Argument_for_target_option_must_be_ES3_ES5_or_ES2015_6047", message: "Argument for '--target' option must be 'ES3', 'ES5', or 'ES2015'." }, + Argument_for_0_option_must_be_Colon_1: { code: 6046, category: ts.DiagnosticCategory.Error, key: "Argument_for_0_option_must_be_Colon_1_6046", message: "Argument for '{0}' option must be: {1}" }, Locale_must_be_of_the_form_language_or_language_territory_For_example_0_or_1: { code: 6048, category: ts.DiagnosticCategory.Error, key: "Locale_must_be_of_the_form_language_or_language_territory_For_example_0_or_1_6048", message: "Locale must be of the form or -. For example '{0}' or '{1}'." }, Unsupported_locale_0: { code: 6049, category: ts.DiagnosticCategory.Error, key: "Unsupported_locale_0_6049", message: "Unsupported locale '{0}'." }, Unable_to_open_file_0: { code: 6050, category: ts.DiagnosticCategory.Error, key: "Unable_to_open_file_0_6050", message: "Unable to open file '{0}'." }, @@ -2813,17 +2899,15 @@ var ts; File_0_has_unsupported_extension_The_only_supported_extensions_are_1: { code: 6054, category: ts.DiagnosticCategory.Error, key: "File_0_has_unsupported_extension_The_only_supported_extensions_are_1_6054", message: "File '{0}' has unsupported extension. The only supported extensions are {1}." }, Suppress_noImplicitAny_errors_for_indexing_objects_lacking_index_signatures: { code: 6055, category: ts.DiagnosticCategory.Message, key: "Suppress_noImplicitAny_errors_for_indexing_objects_lacking_index_signatures_6055", message: "Suppress noImplicitAny errors for indexing objects lacking index signatures." }, Do_not_emit_declarations_for_code_that_has_an_internal_annotation: { code: 6056, category: ts.DiagnosticCategory.Message, key: "Do_not_emit_declarations_for_code_that_has_an_internal_annotation_6056", message: "Do not emit declarations for code that has an '@internal' annotation." }, - Specifies_the_root_directory_of_input_files_Use_to_control_the_output_directory_structure_with_outDir: { code: 6058, category: ts.DiagnosticCategory.Message, key: "Specifies_the_root_directory_of_input_files_Use_to_control_the_output_directory_structure_with_outDi_6058", message: "Specifies the root directory of input files. Use to control the output directory structure with --outDir." }, + Specify_the_root_directory_of_input_files_Use_to_control_the_output_directory_structure_with_outDir: { code: 6058, category: ts.DiagnosticCategory.Message, key: "Specify_the_root_directory_of_input_files_Use_to_control_the_output_directory_structure_with_outDir_6058", message: "Specify the root directory of input files. Use to control the output directory structure with --outDir." }, File_0_is_not_under_rootDir_1_rootDir_is_expected_to_contain_all_source_files: { code: 6059, category: ts.DiagnosticCategory.Error, key: "File_0_is_not_under_rootDir_1_rootDir_is_expected_to_contain_all_source_files_6059", message: "File '{0}' is not under 'rootDir' '{1}'. 'rootDir' is expected to contain all source files." }, - Specifies_the_end_of_line_sequence_to_be_used_when_emitting_files_Colon_CRLF_dos_or_LF_unix: { code: 6060, category: ts.DiagnosticCategory.Message, key: "Specifies_the_end_of_line_sequence_to_be_used_when_emitting_files_Colon_CRLF_dos_or_LF_unix_6060", message: "Specifies the end of line sequence to be used when emitting files: 'CRLF' (dos) or 'LF' (unix)." }, + Specify_the_end_of_line_sequence_to_be_used_when_emitting_files_Colon_CRLF_dos_or_LF_unix: { code: 6060, category: ts.DiagnosticCategory.Message, key: "Specify_the_end_of_line_sequence_to_be_used_when_emitting_files_Colon_CRLF_dos_or_LF_unix_6060", message: "Specify the end of line sequence to be used when emitting files: 'CRLF' (dos) or 'LF' (unix)." }, NEWLINE: { code: 6061, category: ts.DiagnosticCategory.Message, key: "NEWLINE_6061", message: "NEWLINE" }, - Argument_for_newLine_option_must_be_CRLF_or_LF: { code: 6062, category: ts.DiagnosticCategory.Error, key: "Argument_for_newLine_option_must_be_CRLF_or_LF_6062", message: "Argument for '--newLine' option must be 'CRLF' or 'LF'." }, - Argument_for_moduleResolution_option_must_be_node_or_classic: { code: 6063, category: ts.DiagnosticCategory.Error, key: "Argument_for_moduleResolution_option_must_be_node_or_classic_6063", message: "Argument for '--moduleResolution' option must be 'node' or 'classic'." }, Option_0_can_only_be_specified_in_tsconfig_json_file: { code: 6064, category: ts.DiagnosticCategory.Error, key: "Option_0_can_only_be_specified_in_tsconfig_json_file_6064", message: "Option '{0}' can only be specified in 'tsconfig.json' file." }, Enables_experimental_support_for_ES7_decorators: { code: 6065, category: ts.DiagnosticCategory.Message, key: "Enables_experimental_support_for_ES7_decorators_6065", message: "Enables experimental support for ES7 decorators." }, Enables_experimental_support_for_emitting_type_metadata_for_decorators: { code: 6066, category: ts.DiagnosticCategory.Message, key: "Enables_experimental_support_for_emitting_type_metadata_for_decorators_6066", message: "Enables experimental support for emitting type metadata for decorators." }, Enables_experimental_support_for_ES7_async_functions: { code: 6068, category: ts.DiagnosticCategory.Message, key: "Enables_experimental_support_for_ES7_async_functions_6068", message: "Enables experimental support for ES7 async functions." }, - Specifies_module_resolution_strategy_Colon_node_Node_js_or_classic_TypeScript_pre_1_6: { code: 6069, category: ts.DiagnosticCategory.Message, key: "Specifies_module_resolution_strategy_Colon_node_Node_js_or_classic_TypeScript_pre_1_6_6069", message: "Specifies module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6)." }, + Specify_module_resolution_strategy_Colon_node_Node_js_or_classic_TypeScript_pre_1_6: { code: 6069, category: ts.DiagnosticCategory.Message, key: "Specify_module_resolution_strategy_Colon_node_Node_js_or_classic_TypeScript_pre_1_6_6069", message: "Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6)." }, Initializes_a_TypeScript_project_and_creates_a_tsconfig_json_file: { code: 6070, category: ts.DiagnosticCategory.Message, key: "Initializes_a_TypeScript_project_and_creates_a_tsconfig_json_file_6070", message: "Initializes a TypeScript project and creates a tsconfig.json file." }, Successfully_created_a_tsconfig_json_file: { code: 6071, category: ts.DiagnosticCategory.Message, key: "Successfully_created_a_tsconfig_json_file_6071", message: "Successfully created a tsconfig.json file." }, Suppress_excess_property_checks_for_object_literals: { code: 6072, category: ts.DiagnosticCategory.Message, key: "Suppress_excess_property_checks_for_object_literals_6072", message: "Suppress excess property checks for object literals." }, @@ -2833,12 +2917,12 @@ var ts; Report_errors_for_fallthrough_cases_in_switch_statement: { code: 6076, category: ts.DiagnosticCategory.Message, key: "Report_errors_for_fallthrough_cases_in_switch_statement_6076", message: "Report errors for fallthrough cases in switch statement." }, Do_not_report_errors_on_unreachable_code: { code: 6077, category: ts.DiagnosticCategory.Message, key: "Do_not_report_errors_on_unreachable_code_6077", message: "Do not report errors on unreachable code." }, 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'" }, - Argument_for_jsx_must_be_preserve_or_react: { code: 6081, category: ts.DiagnosticCategory.Message, key: "Argument_for_jsx_must_be_preserve_or_react_6081", message: "Argument for '--jsx' must be 'preserve' or 'react'." }, 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." }, - Specifies_the_object_invoked_for_createElement_and_spread_when_targeting_react_JSX_emit: { code: 6084, category: ts.DiagnosticCategory.Message, key: "Specifies_the_object_invoked_for_createElement_and_spread_when_targeting_react_JSX_emit_6084", message: "Specifies the object invoked for createElement and __spread when targeting 'react' JSX emit" }, - Enable_tracing_of_the_module_resolution_process: { code: 6085, category: ts.DiagnosticCategory.Message, key: "Enable_tracing_of_the_module_resolution_process_6085", message: "Enable tracing of the module resolution process." }, + 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" }, + Enable_tracing_of_the_name_resolution_process: { code: 6085, category: ts.DiagnosticCategory.Message, key: "Enable_tracing_of_the_name_resolution_process_6085", message: "Enable tracing of the name resolution process." }, Resolving_module_0_from_1: { code: 6086, category: ts.DiagnosticCategory.Message, key: "Resolving_module_0_from_1_6086", message: "======== Resolving module '{0}' from '{1}'. ========" }, Explicitly_specified_module_resolution_kind_Colon_0: { code: 6087, category: ts.DiagnosticCategory.Message, key: "Explicitly_specified_module_resolution_kind_Colon_0_6087", message: "Explicitly specified module resolution kind: '{0}'." }, Module_resolution_kind_is_not_specified_using_0: { code: 6088, category: ts.DiagnosticCategory.Message, key: "Module_resolution_kind_is_not_specified_using_0_6088", message: "Module resolution kind is not specified, using '{0}'." }, @@ -2850,15 +2934,15 @@ var ts; Resolving_module_name_0_relative_to_base_url_1_2: { code: 6094, category: ts.DiagnosticCategory.Message, key: "Resolving_module_name_0_relative_to_base_url_1_2_6094", message: "Resolving module name '{0}' relative to base url '{1}' - '{2}'." }, Loading_module_as_file_Slash_folder_candidate_module_location_0: { code: 6095, category: ts.DiagnosticCategory.Message, key: "Loading_module_as_file_Slash_folder_candidate_module_location_0_6095", message: "Loading module as file / folder, candidate module location '{0}'." }, File_0_does_not_exist: { code: 6096, category: ts.DiagnosticCategory.Message, key: "File_0_does_not_exist_6096", message: "File '{0}' does not exist." }, - File_0_exist_use_it_as_a_module_resolution_result: { code: 6097, category: ts.DiagnosticCategory.Message, key: "File_0_exist_use_it_as_a_module_resolution_result_6097", message: "File '{0}' exist - use it as a module resolution result." }, + 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_typings_field: { code: 6100, category: ts.DiagnosticCategory.Message, key: "package_json_does_not_have_typings_field_6100", message: "'package.json' does not have 'typings' field." }, - package_json_has_typings_field_0_that_references_1: { code: 6101, category: ts.DiagnosticCategory.Message, key: "package_json_has_typings_field_0_that_references_1_6101", message: "'package.json' has 'typings' field '{0}' that references '{1}'." }, + 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_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." }, Checking_if_0_is_the_longest_matching_prefix_for_1_2: { code: 6104, category: ts.DiagnosticCategory.Message, key: "Checking_if_0_is_the_longest_matching_prefix_for_1_2_6104", message: "Checking if '{0}' is the longest matching prefix for '{1}' - '{2}'." }, - Expected_type_of_typings_field_in_package_json_to_be_string_got_0: { code: 6105, category: ts.DiagnosticCategory.Message, key: "Expected_type_of_typings_field_in_package_json_to_be_string_got_0_6105", message: "Expected type of 'typings' field in 'package.json' to be 'string', got '{0}'." }, + Expected_type_of_0_field_in_package_json_to_be_string_got_1: { code: 6105, category: ts.DiagnosticCategory.Message, key: "Expected_type_of_0_field_in_package_json_to_be_string_got_1_6105", message: "Expected type of '{0}' field in 'package.json' to be 'string', got '{1}'." }, baseUrl_option_is_set_to_0_using_this_value_to_resolve_non_relative_module_name_1: { code: 6106, category: ts.DiagnosticCategory.Message, key: "baseUrl_option_is_set_to_0_using_this_value_to_resolve_non_relative_module_name_1_6106", message: "'baseUrl' option is set to '{0}', using this value to resolve non-relative module name '{1}'" }, rootDirs_option_is_set_using_it_to_resolve_relative_module_name_0: { code: 6107, category: ts.DiagnosticCategory.Message, key: "rootDirs_option_is_set_using_it_to_resolve_relative_module_name_0_6107", message: "'rootDirs' option is set, using it to resolve relative module name '{0}'" }, Longest_matching_prefix_for_0_is_1: { code: 6108, category: ts.DiagnosticCategory.Message, key: "Longest_matching_prefix_for_0_is_1_6108", message: "Longest matching prefix for '{0}' is '{1}'" }, @@ -2866,6 +2950,22 @@ var ts; Trying_other_entries_in_rootDirs: { code: 6110, category: ts.DiagnosticCategory.Message, key: "Trying_other_entries_in_rootDirs_6110", message: "Trying other entries in 'rootDirs'" }, Module_resolution_using_rootDirs_has_failed: { code: 6111, category: ts.DiagnosticCategory.Message, key: "Module_resolution_using_rootDirs_has_failed_6111", message: "Module resolution using 'rootDirs' has failed" }, Do_not_emit_use_strict_directives_in_module_output: { code: 6112, category: ts.DiagnosticCategory.Message, key: "Do_not_emit_use_strict_directives_in_module_output_6112", message: "Do not emit 'use strict' directives in module output." }, + Enable_strict_null_checks: { code: 6113, category: ts.DiagnosticCategory.Message, key: "Enable_strict_null_checks_6113", message: "Enable strict null checks." }, + Unknown_option_excludes_Did_you_mean_exclude: { code: 6114, category: ts.DiagnosticCategory.Error, key: "Unknown_option_excludes_Did_you_mean_exclude_6114", message: "Unknown option 'excludes'. Did you mean 'exclude'?" }, + Raise_error_on_this_expressions_with_an_implied_any_type: { code: 6115, category: ts.DiagnosticCategory.Message, key: "Raise_error_on_this_expressions_with_an_implied_any_type_6115", message: "Raise error on 'this' expressions with an implied 'any' type." }, + Resolving_type_reference_directive_0_containing_file_1_root_directory_2: { code: 6116, category: ts.DiagnosticCategory.Message, key: "Resolving_type_reference_directive_0_containing_file_1_root_directory_2_6116", message: "======== Resolving type reference directive '{0}', containing file '{1}', root directory '{2}'. ========" }, + Resolving_using_primary_search_paths: { code: 6117, category: ts.DiagnosticCategory.Message, key: "Resolving_using_primary_search_paths_6117", message: "Resolving using primary search paths..." }, + Resolving_from_node_modules_folder: { code: 6118, category: ts.DiagnosticCategory.Message, key: "Resolving_from_node_modules_folder_6118", message: "Resolving from node_modules folder..." }, + Type_reference_directive_0_was_successfully_resolved_to_1_primary_Colon_2: { code: 6119, category: ts.DiagnosticCategory.Message, key: "Type_reference_directive_0_was_successfully_resolved_to_1_primary_Colon_2_6119", message: "======== Type reference directive '{0}' was successfully resolved to '{1}', primary: {2}. ========" }, + Type_reference_directive_0_was_not_resolved: { code: 6120, category: ts.DiagnosticCategory.Message, key: "Type_reference_directive_0_was_not_resolved_6120", message: "======== Type reference directive '{0}' was not resolved. ========" }, + Resolving_with_primary_search_path_0: { code: 6121, category: ts.DiagnosticCategory.Message, key: "Resolving_with_primary_search_path_0_6121", message: "Resolving with primary search path '{0}'" }, + Root_directory_cannot_be_determined_skipping_primary_search_paths: { code: 6122, category: ts.DiagnosticCategory.Message, key: "Root_directory_cannot_be_determined_skipping_primary_search_paths_6122", message: "Root directory cannot be determined, skipping primary search paths." }, + Resolving_type_reference_directive_0_containing_file_1_root_directory_not_set: { code: 6123, category: ts.DiagnosticCategory.Message, key: "Resolving_type_reference_directive_0_containing_file_1_root_directory_not_set_6123", message: "======== Resolving type reference directive '{0}', containing file '{1}', root directory not set. ========" }, + Type_declaration_files_to_be_included_in_compilation: { code: 6124, category: ts.DiagnosticCategory.Message, key: "Type_declaration_files_to_be_included_in_compilation_6124", message: "Type declaration files to be included in compilation." }, + Looking_up_in_node_modules_folder_initial_location_0: { code: 6125, category: ts.DiagnosticCategory.Message, key: "Looking_up_in_node_modules_folder_initial_location_0_6125", message: "Looking up in 'node_modules' folder, initial location '{0}'" }, + Containing_file_is_not_specified_and_root_directory_cannot_be_determined_skipping_lookup_in_node_modules_folder: { code: 6126, category: ts.DiagnosticCategory.Message, key: "Containing_file_is_not_specified_and_root_directory_cannot_be_determined_skipping_lookup_in_node_mod_6126", message: "Containing file is not specified and root directory cannot be determined, skipping lookup in 'node_modules' folder." }, + Resolving_type_reference_directive_0_containing_file_not_set_root_directory_1: { code: 6127, category: ts.DiagnosticCategory.Message, key: "Resolving_type_reference_directive_0_containing_file_not_set_root_directory_1_6127", message: "======== Resolving type reference directive '{0}', containing file not set, root directory '{1}'. ========" }, + Resolving_type_reference_directive_0_containing_file_not_set_root_directory_not_set: { code: 6128, category: ts.DiagnosticCategory.Message, key: "Resolving_type_reference_directive_0_containing_file_not_set_root_directory_not_set_6128", message: "======== Resolving type reference directive '{0}', containing file not set, root directory not set. ========" }, 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." }, @@ -2888,6 +2988,7 @@ var ts; Unused_label: { code: 7028, category: ts.DiagnosticCategory.Error, key: "Unused_label_7028", message: "Unused label." }, 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." }, 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." }, @@ -2915,7 +3016,8 @@ var ts; An_unary_expression_with_the_0_operator_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_expression_Consider_enclosing_the_expression_in_parentheses: { code: 17006, category: ts.DiagnosticCategory.Error, key: "An_unary_expression_with_the_0_operator_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_ex_17006", message: "An unary expression with the '{0}' operator is not allowed in the left-hand side of an exponentiation expression. Consider enclosing the expression in parentheses." }, 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." } + 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}'." } }; })(ts || (ts = {})); /// @@ -2951,7 +3053,7 @@ var ts; "false": 84 /* FalseKeyword */, "finally": 85 /* FinallyKeyword */, "for": 86 /* ForKeyword */, - "from": 134 /* FromKeyword */, + "from": 135 /* FromKeyword */, "function": 87 /* FunctionKeyword */, "get": 123 /* GetKeyword */, "if": 88 /* IfKeyword */, @@ -2973,7 +3075,7 @@ var ts; "public": 112 /* PublicKeyword */, "readonly": 127 /* ReadonlyKeyword */, "require": 128 /* RequireKeyword */, - "global": 135 /* GlobalKeyword */, + "global": 136 /* GlobalKeyword */, "return": 94 /* ReturnKeyword */, "set": 130 /* SetKeyword */, "static": 113 /* StaticKeyword */, @@ -2987,6 +3089,7 @@ var ts; "try": 100 /* TryKeyword */, "type": 133 /* TypeKeyword */, "typeof": 101 /* TypeOfKeyword */, + "undefined": 134 /* UndefinedKeyword */, "var": 102 /* VarKeyword */, "void": 103 /* VoidKeyword */, "while": 104 /* WhileKeyword */, @@ -2994,7 +3097,7 @@ var ts; "yield": 114 /* YieldKeyword */, "async": 118 /* AsyncKeyword */, "await": 119 /* AwaitKeyword */, - "of": 136 /* OfKeyword */, + "of": 137 /* OfKeyword */, "{": 15 /* OpenBraceToken */, "}": 16 /* CloseBraceToken */, "(": 17 /* OpenParenToken */, @@ -4412,7 +4515,7 @@ var ts; break; } } - return token = 240 /* JsxText */; + return token = 243 /* JsxText */; } // Scans a JSX identifier; these differ from normal identifiers in that // they allow dashes @@ -4643,6 +4746,41 @@ var ts; sourceFile.resolvedModules[moduleNameText] = resolvedModule; } ts.setResolvedModule = setResolvedModule; + function setResolvedTypeReferenceDirective(sourceFile, typeReferenceDirectiveName, resolvedTypeReferenceDirective) { + if (!sourceFile.resolvedTypeReferenceDirectiveNames) { + sourceFile.resolvedTypeReferenceDirectiveNames = {}; + } + sourceFile.resolvedTypeReferenceDirectiveNames[typeReferenceDirectiveName] = resolvedTypeReferenceDirective; + } + ts.setResolvedTypeReferenceDirective = setResolvedTypeReferenceDirective; + /* @internal */ + function moduleResolutionIsEqualTo(oldResolution, newResolution) { + return oldResolution.resolvedFileName === newResolution.resolvedFileName && oldResolution.isExternalLibraryImport === newResolution.isExternalLibraryImport; + } + ts.moduleResolutionIsEqualTo = moduleResolutionIsEqualTo; + /* @internal */ + function typeDirectiveIsEqualTo(oldResolution, newResolution) { + return oldResolution.resolvedFileName === newResolution.resolvedFileName && oldResolution.primary === newResolution.primary; + } + ts.typeDirectiveIsEqualTo = typeDirectiveIsEqualTo; + /* @internal */ + function hasChangesInResolutions(names, newResolutions, oldResolutions, comparer) { + if (names.length !== newResolutions.length) { + return false; + } + for (var i = 0; i < names.length; i++) { + var newResolution = newResolutions[i]; + var oldResolution = oldResolutions && ts.hasProperty(oldResolutions, names[i]) ? oldResolutions[names[i]] : undefined; + var changed = oldResolution + ? !newResolution || !comparer(oldResolution, newResolution) + : newResolution; + if (changed) { + return true; + } + } + return false; + } + ts.hasChangesInResolutions = hasChangesInResolutions; // Returns true if this node contains a parse error anywhere underneath it. function containsParseError(node) { aggregateChildData(node); @@ -4667,7 +4805,7 @@ var ts; } } function getSourceFileOfNode(node) { - while (node && node.kind !== 252 /* SourceFile */) { + while (node && node.kind !== 255 /* SourceFile */) { node = node.parent; } return node; @@ -4675,11 +4813,11 @@ var ts; ts.getSourceFileOfNode = getSourceFileOfNode; function isStatementWithLocals(node) { switch (node.kind) { - case 196 /* Block */: - case 224 /* CaseBlock */: - case 203 /* ForStatement */: - case 204 /* ForInStatement */: - case 205 /* ForOfStatement */: + case 198 /* Block */: + case 226 /* CaseBlock */: + case 205 /* ForStatement */: + case 206 /* ForInStatement */: + case 207 /* ForOfStatement */: return true; } return false; @@ -4701,6 +4839,32 @@ var ts; return node.pos; } ts.getStartPosOfNode = getStartPosOfNode; + function getEndLinePosition(line, sourceFile) { + ts.Debug.assert(line >= 0); + var lineStarts = ts.getLineStarts(sourceFile); + var lineIndex = line; + var sourceText = sourceFile.text; + if (lineIndex + 1 === lineStarts.length) { + // last line - return EOF + return sourceText.length - 1; + } + else { + // current line start + var start = lineStarts[lineIndex]; + // take the start position of the next line - 1 = it should be some line break + var pos = lineStarts[lineIndex + 1] - 1; + ts.Debug.assert(ts.isLineBreak(sourceText.charCodeAt(pos))); + // walk backwards skipping line breaks, stop the the beginning of current line. + // i.e: + // + // $ <- end of line for this position should match the start position + while (start <= pos && ts.isLineBreak(sourceText.charCodeAt(pos))) { + pos--; + } + return pos; + } + } + ts.getEndLinePosition = getEndLinePosition; // Returns true if this node is missing from the actual source code. A 'missing' node is different // from 'undefined/defined'. When a node is undefined (which can happen for optional nodes // in the tree), it is definitely missing. However, a node may be defined, but still be @@ -4783,13 +4947,13 @@ var ts; } ts.isBlockOrCatchScoped = isBlockOrCatchScoped; function isAmbientModule(node) { - return node && node.kind === 222 /* ModuleDeclaration */ && + return node && node.kind === 224 /* ModuleDeclaration */ && (node.name.kind === 9 /* StringLiteral */ || isGlobalScopeAugmentation(node)); } ts.isAmbientModule = isAmbientModule; function isBlockScopedContainerTopLevel(node) { - return node.kind === 252 /* SourceFile */ || - node.kind === 222 /* ModuleDeclaration */ || + return node.kind === 255 /* SourceFile */ || + node.kind === 224 /* ModuleDeclaration */ || isFunctionLike(node) || isFunctionBlock(node); } @@ -4806,10 +4970,10 @@ var ts; return false; } switch (node.parent.kind) { - case 252 /* SourceFile */: - return isExternalModule(node.parent); - case 223 /* ModuleBlock */: - return isAmbientModule(node.parent.parent) && !isExternalModule(node.parent.parent.parent); + case 255 /* SourceFile */: + return ts.isExternalModule(node.parent); + case 225 /* ModuleBlock */: + return isAmbientModule(node.parent.parent) && !ts.isExternalModule(node.parent.parent.parent); } return false; } @@ -4823,15 +4987,15 @@ var ts; return current; } switch (current.kind) { - case 252 /* SourceFile */: - case 224 /* CaseBlock */: - case 248 /* CatchClause */: - case 222 /* ModuleDeclaration */: - case 203 /* ForStatement */: - case 204 /* ForInStatement */: - case 205 /* ForOfStatement */: + case 255 /* SourceFile */: + case 226 /* CaseBlock */: + case 251 /* CatchClause */: + case 224 /* ModuleDeclaration */: + case 205 /* ForStatement */: + case 206 /* ForInStatement */: + case 207 /* ForOfStatement */: return current; - case 196 /* Block */: + case 198 /* Block */: // function block is not considered block-scope container // see comment in binder.ts: bind(...), case for SyntaxKind.Block if (!isFunctionLike(current.parent)) { @@ -4844,9 +5008,9 @@ var ts; ts.getEnclosingBlockScopeContainer = getEnclosingBlockScopeContainer; function isCatchClauseVariableDeclaration(declaration) { return declaration && - declaration.kind === 215 /* VariableDeclaration */ && + declaration.kind === 217 /* VariableDeclaration */ && declaration.parent && - declaration.parent.kind === 248 /* CatchClause */; + declaration.parent.kind === 251 /* CatchClause */; } ts.isCatchClauseVariableDeclaration = isCatchClauseVariableDeclaration; // Return display name of an identifier @@ -4882,10 +5046,23 @@ var ts; return ts.createTextSpanFromBounds(start, scanner.getTextPos()); } ts.getSpanOfTokenAtPosition = getSpanOfTokenAtPosition; + function getErrorSpanForArrowFunction(sourceFile, node) { + var pos = ts.skipTrivia(sourceFile.text, node.pos); + if (node.body && node.body.kind === 198 /* Block */) { + var startLine = ts.getLineAndCharacterOfPosition(sourceFile, node.body.pos).line; + var endLine = ts.getLineAndCharacterOfPosition(sourceFile, node.body.end).line; + if (startLine < endLine) { + // The arrow function spans multiple lines, + // make the error span be the first line, inclusive. + return ts.createTextSpan(pos, getEndLinePosition(startLine, sourceFile) - pos + 1); + } + } + return ts.createTextSpanFromBounds(pos, node.end); + } function getErrorSpanForNode(sourceFile, node) { var errorNode = node; switch (node.kind) { - case 252 /* SourceFile */: + case 255 /* 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 @@ -4894,22 +5071,24 @@ var ts; return getSpanOfTokenAtPosition(sourceFile, pos_1); // This list is a work in progress. Add missing node kinds to improve their error // spans. - case 215 /* VariableDeclaration */: - case 167 /* BindingElement */: - case 218 /* ClassDeclaration */: - case 190 /* ClassExpression */: - case 219 /* InterfaceDeclaration */: - case 222 /* ModuleDeclaration */: - case 221 /* EnumDeclaration */: - case 251 /* EnumMember */: - case 217 /* FunctionDeclaration */: - case 177 /* FunctionExpression */: - case 145 /* MethodDeclaration */: - case 147 /* GetAccessor */: - case 148 /* SetAccessor */: - case 220 /* TypeAliasDeclaration */: + case 217 /* VariableDeclaration */: + case 168 /* BindingElement */: + case 220 /* ClassDeclaration */: + case 191 /* ClassExpression */: + case 221 /* InterfaceDeclaration */: + case 224 /* ModuleDeclaration */: + case 223 /* EnumDeclaration */: + case 254 /* EnumMember */: + case 219 /* FunctionDeclaration */: + case 178 /* FunctionExpression */: + case 146 /* MethodDeclaration */: + case 148 /* GetAccessor */: + case 149 /* SetAccessor */: + case 222 /* TypeAliasDeclaration */: errorNode = node.name; break; + case 179 /* ArrowFunction */: + return getErrorSpanForArrowFunction(sourceFile, node); } if (errorNode === undefined) { // If we don't have a better node, then just set the error on the first token of @@ -4922,10 +5101,6 @@ var ts; return ts.createTextSpanFromBounds(pos, errorNode.end); } ts.getErrorSpanForNode = getErrorSpanForNode; - function isExternalModule(file) { - return file.externalModuleIndicator !== undefined; - } - ts.isExternalModule = isExternalModule; function isExternalOrCommonJsModule(file) { return (file.externalModuleIndicator || file.commonJsModuleIndicator) !== undefined; } @@ -4935,11 +5110,11 @@ var ts; } ts.isDeclarationFile = isDeclarationFile; function isConstEnumDeclaration(node) { - return node.kind === 221 /* EnumDeclaration */ && isConst(node); + return node.kind === 223 /* EnumDeclaration */ && isConst(node); } ts.isConstEnumDeclaration = isConstEnumDeclaration; function walkUpBindingElementsAndPatterns(node) { - while (node && (node.kind === 167 /* BindingElement */ || isBindingPattern(node))) { + while (node && (node.kind === 168 /* BindingElement */ || isBindingPattern(node))) { node = node.parent; } return node; @@ -4954,14 +5129,14 @@ var ts; function getCombinedNodeFlags(node) { node = walkUpBindingElementsAndPatterns(node); var flags = node.flags; - if (node.kind === 215 /* VariableDeclaration */) { + if (node.kind === 217 /* VariableDeclaration */) { node = node.parent; } - if (node && node.kind === 216 /* VariableDeclarationList */) { + if (node && node.kind === 218 /* VariableDeclarationList */) { flags |= node.flags; node = node.parent; } - if (node && node.kind === 197 /* VariableStatement */) { + if (node && node.kind === 199 /* VariableStatement */) { flags |= node.flags; } return flags; @@ -4976,11 +5151,11 @@ var ts; } ts.isLet = isLet; function isSuperCallExpression(n) { - return n.kind === 172 /* CallExpression */ && n.expression.kind === 95 /* SuperKeyword */; + return n.kind === 173 /* CallExpression */ && n.expression.kind === 95 /* SuperKeyword */; } ts.isSuperCallExpression = isSuperCallExpression; function isPrologueDirective(node) { - return node.kind === 199 /* ExpressionStatement */ && node.expression.kind === 9 /* StringLiteral */; + return node.kind === 201 /* ExpressionStatement */ && node.expression.kind === 9 /* StringLiteral */; } ts.isPrologueDirective = isPrologueDirective; function getLeadingCommentRangesOfNode(node, sourceFileOfNode) { @@ -4996,7 +5171,7 @@ var ts; } ts.getJsDocComments = getJsDocComments; function getJsDocCommentsFromText(node, text) { - var commentRanges = (node.kind === 140 /* Parameter */ || node.kind === 139 /* TypeParameter */) ? + var commentRanges = (node.kind === 141 /* Parameter */ || node.kind === 140 /* TypeParameter */) ? ts.concatenate(ts.getTrailingCommentRanges(text, node.pos), ts.getLeadingCommentRanges(text, node.pos)) : getLeadingCommentRangesOfNodeFromText(node, text); return ts.filter(commentRanges, isJsDocComment); @@ -5009,9 +5184,10 @@ var ts; } ts.getJsDocCommentsFromText = getJsDocCommentsFromText; ts.fullTripleSlashReferencePathRegEx = /^(\/\/\/\s*/; + ts.fullTripleSlashReferenceTypeReferenceDirectiveRegEx = /^(\/\/\/\s*/; ts.fullTripleSlashAMDReferencePathRegEx = /^(\/\/\/\s*/; function isTypeNode(node) { - if (152 /* FirstTypeNode */ <= node.kind && node.kind <= 164 /* LastTypeNode */) { + if (153 /* FirstTypeNode */ <= node.kind && node.kind <= 165 /* LastTypeNode */) { return true; } switch (node.kind) { @@ -5020,28 +5196,29 @@ var ts; case 131 /* StringKeyword */: case 120 /* BooleanKeyword */: case 132 /* SymbolKeyword */: + case 134 /* UndefinedKeyword */: return true; case 103 /* VoidKeyword */: - return node.parent.kind !== 181 /* VoidExpression */; - case 192 /* ExpressionWithTypeArguments */: + return node.parent.kind !== 182 /* VoidExpression */; + case 193 /* 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 */: // If the identifier is the RHS of a qualified name, then it's a type iff its parent is. - if (node.parent.kind === 137 /* QualifiedName */ && node.parent.right === node) { + if (node.parent.kind === 138 /* QualifiedName */ && node.parent.right === node) { node = node.parent; } - else if (node.parent.kind === 170 /* PropertyAccessExpression */ && node.parent.name === node) { + else if (node.parent.kind === 171 /* 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 === 137 /* QualifiedName */ || node.kind === 170 /* PropertyAccessExpression */, "'node' was expected to be a qualified name, identifier or property access in 'isTypeNode'."); - case 137 /* QualifiedName */: - case 170 /* PropertyAccessExpression */: + ts.Debug.assert(node.kind === 69 /* Identifier */ || node.kind === 138 /* QualifiedName */ || node.kind === 171 /* PropertyAccessExpression */, "'node' was expected to be a qualified name, identifier or property access in 'isTypeNode'."); + case 138 /* QualifiedName */: + case 171 /* PropertyAccessExpression */: case 97 /* ThisKeyword */: var parent_1 = node.parent; - if (parent_1.kind === 156 /* TypeQuery */) { + if (parent_1.kind === 157 /* TypeQuery */) { return false; } // Do not recursively call isTypeNode on the parent. In the example: @@ -5050,38 +5227,38 @@ var ts; // // Calling isTypeNode would consider the qualified name A.B a type node. Only C or // A.B.C is a type node. - if (152 /* FirstTypeNode */ <= parent_1.kind && parent_1.kind <= 164 /* LastTypeNode */) { + if (153 /* FirstTypeNode */ <= parent_1.kind && parent_1.kind <= 165 /* LastTypeNode */) { return true; } switch (parent_1.kind) { - case 192 /* ExpressionWithTypeArguments */: + case 193 /* ExpressionWithTypeArguments */: return !isExpressionWithTypeArgumentsInClassExtendsClause(parent_1); - case 139 /* TypeParameter */: + case 140 /* TypeParameter */: return node === parent_1.constraint; - case 143 /* PropertyDeclaration */: - case 142 /* PropertySignature */: - case 140 /* Parameter */: - case 215 /* VariableDeclaration */: + case 144 /* PropertyDeclaration */: + case 143 /* PropertySignature */: + case 141 /* Parameter */: + case 217 /* VariableDeclaration */: return node === parent_1.type; - case 217 /* FunctionDeclaration */: - case 177 /* FunctionExpression */: - case 178 /* ArrowFunction */: - case 146 /* Constructor */: - case 145 /* MethodDeclaration */: - case 144 /* MethodSignature */: - case 147 /* GetAccessor */: - case 148 /* SetAccessor */: + case 219 /* FunctionDeclaration */: + case 178 /* FunctionExpression */: + case 179 /* ArrowFunction */: + case 147 /* Constructor */: + case 146 /* MethodDeclaration */: + case 145 /* MethodSignature */: + case 148 /* GetAccessor */: + case 149 /* SetAccessor */: return node === parent_1.type; - case 149 /* CallSignature */: - case 150 /* ConstructSignature */: - case 151 /* IndexSignature */: + case 150 /* CallSignature */: + case 151 /* ConstructSignature */: + case 152 /* IndexSignature */: return node === parent_1.type; - case 175 /* TypeAssertionExpression */: + case 176 /* TypeAssertionExpression */: return node === parent_1.type; - case 172 /* CallExpression */: - case 173 /* NewExpression */: + case 173 /* CallExpression */: + case 174 /* NewExpression */: return parent_1.typeArguments && ts.indexOf(parent_1.typeArguments, node) >= 0; - case 174 /* TaggedTemplateExpression */: + case 175 /* TaggedTemplateExpression */: // TODO (drosen): TaggedTemplateExpressions may eventually support type arguments. return false; } @@ -5095,23 +5272,23 @@ var ts; return traverse(body); function traverse(node) { switch (node.kind) { - case 208 /* ReturnStatement */: + case 210 /* ReturnStatement */: return visitor(node); - case 224 /* CaseBlock */: - case 196 /* Block */: - case 200 /* IfStatement */: - case 201 /* DoStatement */: - case 202 /* WhileStatement */: - case 203 /* ForStatement */: - case 204 /* ForInStatement */: - case 205 /* ForOfStatement */: - case 209 /* WithStatement */: - case 210 /* SwitchStatement */: - case 245 /* CaseClause */: - case 246 /* DefaultClause */: - case 211 /* LabeledStatement */: - case 213 /* TryStatement */: - case 248 /* CatchClause */: + case 226 /* CaseBlock */: + case 198 /* Block */: + case 202 /* IfStatement */: + case 203 /* DoStatement */: + case 204 /* WhileStatement */: + case 205 /* ForStatement */: + case 206 /* ForInStatement */: + case 207 /* ForOfStatement */: + case 211 /* WithStatement */: + case 212 /* SwitchStatement */: + case 248 /* CaseClause */: + case 249 /* DefaultClause */: + case 213 /* LabeledStatement */: + case 215 /* TryStatement */: + case 251 /* CatchClause */: return ts.forEachChild(node, traverse); } } @@ -5121,18 +5298,18 @@ var ts; return traverse(body); function traverse(node) { switch (node.kind) { - case 188 /* YieldExpression */: + case 189 /* YieldExpression */: visitor(node); var operand = node.expression; if (operand) { traverse(operand); } - case 221 /* EnumDeclaration */: - case 219 /* InterfaceDeclaration */: - case 222 /* ModuleDeclaration */: - case 220 /* TypeAliasDeclaration */: - case 218 /* ClassDeclaration */: - case 190 /* ClassExpression */: + case 223 /* EnumDeclaration */: + case 221 /* InterfaceDeclaration */: + case 224 /* ModuleDeclaration */: + case 222 /* TypeAliasDeclaration */: + case 220 /* ClassDeclaration */: + case 191 /* 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. @@ -5140,7 +5317,7 @@ var ts; default: if (isFunctionLike(node)) { var name_5 = node.name; - if (name_5 && name_5.kind === 138 /* ComputedPropertyName */) { + if (name_5 && name_5.kind === 139 /* 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); @@ -5159,14 +5336,14 @@ var ts; function isVariableLike(node) { if (node) { switch (node.kind) { - case 167 /* BindingElement */: - case 251 /* EnumMember */: - case 140 /* Parameter */: - case 249 /* PropertyAssignment */: - case 143 /* PropertyDeclaration */: - case 142 /* PropertySignature */: - case 250 /* ShorthandPropertyAssignment */: - case 215 /* VariableDeclaration */: + case 168 /* BindingElement */: + case 254 /* EnumMember */: + case 141 /* Parameter */: + case 252 /* PropertyAssignment */: + case 144 /* PropertyDeclaration */: + case 143 /* PropertySignature */: + case 253 /* ShorthandPropertyAssignment */: + case 217 /* VariableDeclaration */: return true; } } @@ -5174,11 +5351,11 @@ var ts; } ts.isVariableLike = isVariableLike; function isAccessor(node) { - return node && (node.kind === 147 /* GetAccessor */ || node.kind === 148 /* SetAccessor */); + return node && (node.kind === 148 /* GetAccessor */ || node.kind === 149 /* SetAccessor */); } ts.isAccessor = isAccessor; function isClassLike(node) { - return node && (node.kind === 218 /* ClassDeclaration */ || node.kind === 190 /* ClassExpression */); + return node && (node.kind === 220 /* ClassDeclaration */ || node.kind === 191 /* ClassExpression */); } ts.isClassLike = isClassLike; function isFunctionLike(node) { @@ -5187,32 +5364,32 @@ var ts; ts.isFunctionLike = isFunctionLike; function isFunctionLikeKind(kind) { switch (kind) { - case 146 /* Constructor */: - case 177 /* FunctionExpression */: - case 217 /* FunctionDeclaration */: - case 178 /* ArrowFunction */: - case 145 /* MethodDeclaration */: - case 144 /* MethodSignature */: - case 147 /* GetAccessor */: - case 148 /* SetAccessor */: - case 149 /* CallSignature */: - case 150 /* ConstructSignature */: - case 151 /* IndexSignature */: - case 154 /* FunctionType */: - case 155 /* ConstructorType */: + case 147 /* Constructor */: + case 178 /* FunctionExpression */: + case 219 /* FunctionDeclaration */: + case 179 /* ArrowFunction */: + case 146 /* MethodDeclaration */: + case 145 /* MethodSignature */: + case 148 /* GetAccessor */: + case 149 /* SetAccessor */: + case 150 /* CallSignature */: + case 151 /* ConstructSignature */: + case 152 /* IndexSignature */: + case 155 /* FunctionType */: + case 156 /* ConstructorType */: return true; } } ts.isFunctionLikeKind = isFunctionLikeKind; function introducesArgumentsExoticObject(node) { switch (node.kind) { - case 145 /* MethodDeclaration */: - case 144 /* MethodSignature */: - case 146 /* Constructor */: - case 147 /* GetAccessor */: - case 148 /* SetAccessor */: - case 217 /* FunctionDeclaration */: - case 177 /* FunctionExpression */: + case 146 /* MethodDeclaration */: + case 145 /* MethodSignature */: + case 147 /* Constructor */: + case 148 /* GetAccessor */: + case 149 /* SetAccessor */: + case 219 /* FunctionDeclaration */: + case 178 /* FunctionExpression */: return true; } return false; @@ -5220,24 +5397,24 @@ var ts; ts.introducesArgumentsExoticObject = introducesArgumentsExoticObject; function isIterationStatement(node, lookInLabeledStatements) { switch (node.kind) { - case 203 /* ForStatement */: - case 204 /* ForInStatement */: - case 205 /* ForOfStatement */: - case 201 /* DoStatement */: - case 202 /* WhileStatement */: + case 205 /* ForStatement */: + case 206 /* ForInStatement */: + case 207 /* ForOfStatement */: + case 203 /* DoStatement */: + case 204 /* WhileStatement */: return true; - case 211 /* LabeledStatement */: + case 213 /* LabeledStatement */: return lookInLabeledStatements && isIterationStatement(node.statement, lookInLabeledStatements); } return false; } ts.isIterationStatement = isIterationStatement; function isFunctionBlock(node) { - return node && node.kind === 196 /* Block */ && isFunctionLike(node.parent); + return node && node.kind === 198 /* Block */ && isFunctionLike(node.parent); } ts.isFunctionBlock = isFunctionBlock; function isObjectLiteralMethod(node) { - return node && node.kind === 145 /* MethodDeclaration */ && node.parent.kind === 169 /* ObjectLiteralExpression */; + return node && node.kind === 146 /* MethodDeclaration */ && node.parent.kind === 170 /* ObjectLiteralExpression */; } ts.isObjectLiteralMethod = isObjectLiteralMethod; function isIdentifierTypePredicate(predicate) { @@ -5273,7 +5450,7 @@ var ts; return undefined; } switch (node.kind) { - case 138 /* ComputedPropertyName */: + case 139 /* 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 @@ -5288,9 +5465,9 @@ var ts; // the *body* of the container. node = node.parent; break; - case 141 /* Decorator */: + case 142 /* Decorator */: // Decorators are always applied outside of the body of a class or method. - if (node.parent.kind === 140 /* Parameter */ && isClassElement(node.parent.parent)) { + if (node.parent.kind === 141 /* 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; @@ -5301,26 +5478,26 @@ var ts; node = node.parent; } break; - case 178 /* ArrowFunction */: + case 179 /* ArrowFunction */: if (!includeArrowFunctions) { continue; } // Fall through - case 217 /* FunctionDeclaration */: - case 177 /* FunctionExpression */: - case 222 /* ModuleDeclaration */: - case 143 /* PropertyDeclaration */: - case 142 /* PropertySignature */: - case 145 /* MethodDeclaration */: - case 144 /* MethodSignature */: - case 146 /* Constructor */: - case 147 /* GetAccessor */: - case 148 /* SetAccessor */: - case 149 /* CallSignature */: - case 150 /* ConstructSignature */: - case 151 /* IndexSignature */: - case 221 /* EnumDeclaration */: - case 252 /* SourceFile */: + case 219 /* FunctionDeclaration */: + case 178 /* FunctionExpression */: + case 224 /* ModuleDeclaration */: + case 144 /* PropertyDeclaration */: + case 143 /* PropertySignature */: + case 146 /* MethodDeclaration */: + case 145 /* MethodSignature */: + case 147 /* Constructor */: + case 148 /* GetAccessor */: + case 149 /* SetAccessor */: + case 150 /* CallSignature */: + case 151 /* ConstructSignature */: + case 152 /* IndexSignature */: + case 223 /* EnumDeclaration */: + case 255 /* SourceFile */: return node; } } @@ -5341,26 +5518,26 @@ var ts; return node; } switch (node.kind) { - case 138 /* ComputedPropertyName */: + case 139 /* ComputedPropertyName */: node = node.parent; break; - case 217 /* FunctionDeclaration */: - case 177 /* FunctionExpression */: - case 178 /* ArrowFunction */: + case 219 /* FunctionDeclaration */: + case 178 /* FunctionExpression */: + case 179 /* ArrowFunction */: if (!stopOnFunctions) { continue; } - case 143 /* PropertyDeclaration */: - case 142 /* PropertySignature */: - case 145 /* MethodDeclaration */: - case 144 /* MethodSignature */: - case 146 /* Constructor */: - case 147 /* GetAccessor */: - case 148 /* SetAccessor */: + case 144 /* PropertyDeclaration */: + case 143 /* PropertySignature */: + case 146 /* MethodDeclaration */: + case 145 /* MethodSignature */: + case 147 /* Constructor */: + case 148 /* GetAccessor */: + case 149 /* SetAccessor */: return node; - case 141 /* Decorator */: + case 142 /* Decorator */: // Decorators are always applied outside of the body of a class or method. - if (node.parent.kind === 140 /* Parameter */ && isClassElement(node.parent.parent)) { + if (node.parent.kind === 141 /* 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; @@ -5379,20 +5556,20 @@ var ts; * Determines whether a node is a property or element access expression for super. */ function isSuperPropertyOrElementAccess(node) { - return (node.kind === 170 /* PropertyAccessExpression */ - || node.kind === 171 /* ElementAccessExpression */) + return (node.kind === 171 /* PropertyAccessExpression */ + || node.kind === 172 /* ElementAccessExpression */) && node.expression.kind === 95 /* SuperKeyword */; } ts.isSuperPropertyOrElementAccess = isSuperPropertyOrElementAccess; function getEntityNameFromTypeNode(node) { if (node) { switch (node.kind) { - case 153 /* TypeReference */: + case 154 /* TypeReference */: return node.typeName; - case 192 /* ExpressionWithTypeArguments */: + case 193 /* ExpressionWithTypeArguments */: return node.expression; case 69 /* Identifier */: - case 137 /* QualifiedName */: + case 138 /* QualifiedName */: return node; } } @@ -5400,7 +5577,7 @@ var ts; } ts.getEntityNameFromTypeNode = getEntityNameFromTypeNode; function getInvokedExpression(node) { - if (node.kind === 174 /* TaggedTemplateExpression */) { + if (node.kind === 175 /* TaggedTemplateExpression */) { return node.tag; } // Will either be a CallExpression, NewExpression, or Decorator. @@ -5409,25 +5586,25 @@ var ts; ts.getInvokedExpression = getInvokedExpression; function nodeCanBeDecorated(node) { switch (node.kind) { - case 218 /* ClassDeclaration */: + case 220 /* ClassDeclaration */: // classes are valid targets return true; - case 143 /* PropertyDeclaration */: + case 144 /* PropertyDeclaration */: // property declarations are valid if their parent is a class declaration. - return node.parent.kind === 218 /* ClassDeclaration */; - case 147 /* GetAccessor */: - case 148 /* SetAccessor */: - case 145 /* MethodDeclaration */: + return node.parent.kind === 220 /* ClassDeclaration */; + case 148 /* GetAccessor */: + case 149 /* SetAccessor */: + case 146 /* 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 === 218 /* ClassDeclaration */; - case 140 /* Parameter */: + && node.parent.kind === 220 /* ClassDeclaration */; + case 141 /* 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 === 146 /* Constructor */ - || node.parent.kind === 145 /* MethodDeclaration */ - || node.parent.kind === 148 /* SetAccessor */) - && node.parent.parent.kind === 218 /* ClassDeclaration */; + && (node.parent.kind === 147 /* Constructor */ + || node.parent.kind === 146 /* MethodDeclaration */ + || node.parent.kind === 149 /* SetAccessor */) + && node.parent.parent.kind === 220 /* ClassDeclaration */; } return false; } @@ -5438,13 +5615,23 @@ var ts; } ts.nodeIsDecorated = nodeIsDecorated; function isPropertyAccessExpression(node) { - return node.kind === 170 /* PropertyAccessExpression */; + return node.kind === 171 /* PropertyAccessExpression */; } ts.isPropertyAccessExpression = isPropertyAccessExpression; function isElementAccessExpression(node) { - return node.kind === 171 /* ElementAccessExpression */; + return node.kind === 172 /* ElementAccessExpression */; } ts.isElementAccessExpression = isElementAccessExpression; + function isJSXTagName(node) { + var parent = node.parent; + if (parent.kind === 242 /* JsxOpeningElement */ || + parent.kind === 241 /* JsxSelfClosingElement */ || + parent.kind === 244 /* JsxClosingElement */) { + return parent.tagName === node; + } + return false; + } + ts.isJSXTagName = isJSXTagName; function isExpression(node) { switch (node.kind) { case 95 /* SuperKeyword */: @@ -5452,42 +5639,43 @@ var ts; case 99 /* TrueKeyword */: case 84 /* FalseKeyword */: case 10 /* RegularExpressionLiteral */: - case 168 /* ArrayLiteralExpression */: - case 169 /* ObjectLiteralExpression */: - case 170 /* PropertyAccessExpression */: - case 171 /* ElementAccessExpression */: - case 172 /* CallExpression */: - case 173 /* NewExpression */: - case 174 /* TaggedTemplateExpression */: - case 193 /* AsExpression */: - case 175 /* TypeAssertionExpression */: - case 176 /* ParenthesizedExpression */: - case 177 /* FunctionExpression */: - case 190 /* ClassExpression */: - case 178 /* ArrowFunction */: - case 181 /* VoidExpression */: - case 179 /* DeleteExpression */: - case 180 /* TypeOfExpression */: - case 183 /* PrefixUnaryExpression */: - case 184 /* PostfixUnaryExpression */: - case 185 /* BinaryExpression */: - case 186 /* ConditionalExpression */: - case 189 /* SpreadElementExpression */: - case 187 /* TemplateExpression */: + case 169 /* ArrayLiteralExpression */: + case 170 /* ObjectLiteralExpression */: + case 171 /* PropertyAccessExpression */: + case 172 /* ElementAccessExpression */: + case 173 /* CallExpression */: + case 174 /* NewExpression */: + case 175 /* TaggedTemplateExpression */: + case 194 /* AsExpression */: + case 176 /* TypeAssertionExpression */: + case 195 /* NonNullExpression */: + case 177 /* ParenthesizedExpression */: + case 178 /* FunctionExpression */: + case 191 /* ClassExpression */: + case 179 /* ArrowFunction */: + case 182 /* VoidExpression */: + case 180 /* DeleteExpression */: + case 181 /* TypeOfExpression */: + case 184 /* PrefixUnaryExpression */: + case 185 /* PostfixUnaryExpression */: + case 186 /* BinaryExpression */: + case 187 /* ConditionalExpression */: + case 190 /* SpreadElementExpression */: + case 188 /* TemplateExpression */: case 11 /* NoSubstitutionTemplateLiteral */: - case 191 /* OmittedExpression */: - case 237 /* JsxElement */: - case 238 /* JsxSelfClosingElement */: - case 188 /* YieldExpression */: - case 182 /* AwaitExpression */: + case 192 /* OmittedExpression */: + case 240 /* JsxElement */: + case 241 /* JsxSelfClosingElement */: + case 189 /* YieldExpression */: + case 183 /* AwaitExpression */: return true; - case 137 /* QualifiedName */: - while (node.parent.kind === 137 /* QualifiedName */) { + case 138 /* QualifiedName */: + while (node.parent.kind === 138 /* QualifiedName */) { node = node.parent; } - return node.parent.kind === 156 /* TypeQuery */; + return node.parent.kind === 157 /* TypeQuery */ || isJSXTagName(node); case 69 /* Identifier */: - if (node.parent.kind === 156 /* TypeQuery */) { + if (node.parent.kind === 157 /* TypeQuery */ || isJSXTagName(node)) { return true; } // fall through @@ -5496,47 +5684,47 @@ var ts; case 97 /* ThisKeyword */: var parent_2 = node.parent; switch (parent_2.kind) { - case 215 /* VariableDeclaration */: - case 140 /* Parameter */: - case 143 /* PropertyDeclaration */: - case 142 /* PropertySignature */: - case 251 /* EnumMember */: - case 249 /* PropertyAssignment */: - case 167 /* BindingElement */: + case 217 /* VariableDeclaration */: + case 141 /* Parameter */: + case 144 /* PropertyDeclaration */: + case 143 /* PropertySignature */: + case 254 /* EnumMember */: + case 252 /* PropertyAssignment */: + case 168 /* BindingElement */: return parent_2.initializer === node; - case 199 /* ExpressionStatement */: - case 200 /* IfStatement */: - case 201 /* DoStatement */: - case 202 /* WhileStatement */: - case 208 /* ReturnStatement */: - case 209 /* WithStatement */: - case 210 /* SwitchStatement */: - case 245 /* CaseClause */: - case 212 /* ThrowStatement */: - case 210 /* SwitchStatement */: + case 201 /* ExpressionStatement */: + case 202 /* IfStatement */: + case 203 /* DoStatement */: + case 204 /* WhileStatement */: + case 210 /* ReturnStatement */: + case 211 /* WithStatement */: + case 212 /* SwitchStatement */: + case 248 /* CaseClause */: + case 214 /* ThrowStatement */: + case 212 /* SwitchStatement */: return parent_2.expression === node; - case 203 /* ForStatement */: + case 205 /* ForStatement */: var forStatement = parent_2; - return (forStatement.initializer === node && forStatement.initializer.kind !== 216 /* VariableDeclarationList */) || + return (forStatement.initializer === node && forStatement.initializer.kind !== 218 /* VariableDeclarationList */) || forStatement.condition === node || forStatement.incrementor === node; - case 204 /* ForInStatement */: - case 205 /* ForOfStatement */: + case 206 /* ForInStatement */: + case 207 /* ForOfStatement */: var forInStatement = parent_2; - return (forInStatement.initializer === node && forInStatement.initializer.kind !== 216 /* VariableDeclarationList */) || + return (forInStatement.initializer === node && forInStatement.initializer.kind !== 218 /* VariableDeclarationList */) || forInStatement.expression === node; - case 175 /* TypeAssertionExpression */: - case 193 /* AsExpression */: + case 176 /* TypeAssertionExpression */: + case 194 /* AsExpression */: return node === parent_2.expression; - case 194 /* TemplateSpan */: + case 196 /* TemplateSpan */: return node === parent_2.expression; - case 138 /* ComputedPropertyName */: + case 139 /* ComputedPropertyName */: return node === parent_2.expression; - case 141 /* Decorator */: - case 244 /* JsxExpression */: - case 243 /* JsxSpreadAttribute */: + case 142 /* Decorator */: + case 247 /* JsxExpression */: + case 246 /* JsxSpreadAttribute */: return true; - case 192 /* ExpressionWithTypeArguments */: + case 193 /* ExpressionWithTypeArguments */: return parent_2.expression === node && isExpressionWithTypeArgumentsInClassExtendsClause(parent_2); default: if (isExpression(parent_2)) { @@ -5560,7 +5748,7 @@ var ts; } ts.isInstantiatedModule = isInstantiatedModule; function isExternalModuleImportEqualsDeclaration(node) { - return node.kind === 225 /* ImportEqualsDeclaration */ && node.moduleReference.kind === 236 /* ExternalModuleReference */; + return node.kind === 228 /* ImportEqualsDeclaration */ && node.moduleReference.kind === 239 /* ExternalModuleReference */; } ts.isExternalModuleImportEqualsDeclaration = isExternalModuleImportEqualsDeclaration; function getExternalModuleImportEqualsDeclarationExpression(node) { @@ -5569,7 +5757,7 @@ var ts; } ts.getExternalModuleImportEqualsDeclarationExpression = getExternalModuleImportEqualsDeclarationExpression; function isInternalModuleImportEqualsDeclaration(node) { - return node.kind === 225 /* ImportEqualsDeclaration */ && node.moduleReference.kind !== 236 /* ExternalModuleReference */; + return node.kind === 228 /* ImportEqualsDeclaration */ && node.moduleReference.kind !== 239 /* ExternalModuleReference */; } ts.isInternalModuleImportEqualsDeclaration = isInternalModuleImportEqualsDeclaration; function isSourceFileJavaScript(file) { @@ -5587,7 +5775,7 @@ var ts; */ function isRequireCall(expression, checkArgumentIsStringLiteral) { // of the form 'require("name")' - var isRequire = expression.kind === 172 /* CallExpression */ && + var isRequire = expression.kind === 173 /* CallExpression */ && expression.expression.kind === 69 /* Identifier */ && expression.expression.text === "require" && expression.arguments.length === 1; @@ -5597,11 +5785,14 @@ var ts; /// Given a BinaryExpression, returns SpecialPropertyAssignmentKind for the various kinds of property /// assignments we treat as special in the binder function getSpecialPropertyAssignmentKind(expression) { - if (expression.kind !== 185 /* BinaryExpression */) { + if (!isInJavaScriptFile(expression)) { + return 0 /* None */; + } + if (expression.kind !== 186 /* BinaryExpression */) { return 0 /* None */; } var expr = expression; - if (expr.operatorToken.kind !== 56 /* EqualsToken */ || expr.left.kind !== 170 /* PropertyAccessExpression */) { + if (expr.operatorToken.kind !== 56 /* EqualsToken */ || expr.left.kind !== 171 /* PropertyAccessExpression */) { return 0 /* None */; } var lhs = expr.left; @@ -5619,7 +5810,7 @@ var ts; else if (lhs.expression.kind === 97 /* ThisKeyword */) { return 4 /* ThisProperty */; } - else if (lhs.expression.kind === 170 /* PropertyAccessExpression */) { + else if (lhs.expression.kind === 171 /* 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 */ && innerPropertyAccess.name.text === "prototype") { @@ -5630,19 +5821,19 @@ var ts; } ts.getSpecialPropertyAssignmentKind = getSpecialPropertyAssignmentKind; function getExternalModuleName(node) { - if (node.kind === 226 /* ImportDeclaration */) { + if (node.kind === 229 /* ImportDeclaration */) { return node.moduleSpecifier; } - if (node.kind === 225 /* ImportEqualsDeclaration */) { + if (node.kind === 228 /* ImportEqualsDeclaration */) { var reference = node.moduleReference; - if (reference.kind === 236 /* ExternalModuleReference */) { + if (reference.kind === 239 /* ExternalModuleReference */) { return reference.expression; } } - if (node.kind === 232 /* ExportDeclaration */) { + if (node.kind === 235 /* ExportDeclaration */) { return node.moduleSpecifier; } - if (node.kind === 222 /* ModuleDeclaration */ && node.name.kind === 9 /* StringLiteral */) { + if (node.kind === 224 /* ModuleDeclaration */ && node.name.kind === 9 /* StringLiteral */) { return node.name; } } @@ -5650,13 +5841,13 @@ var ts; function hasQuestionToken(node) { if (node) { switch (node.kind) { - case 140 /* Parameter */: - case 145 /* MethodDeclaration */: - case 144 /* MethodSignature */: - case 250 /* ShorthandPropertyAssignment */: - case 249 /* PropertyAssignment */: - case 143 /* PropertyDeclaration */: - case 142 /* PropertySignature */: + case 141 /* Parameter */: + case 146 /* MethodDeclaration */: + case 145 /* MethodSignature */: + case 253 /* ShorthandPropertyAssignment */: + case 252 /* PropertyAssignment */: + case 144 /* PropertyDeclaration */: + case 143 /* PropertySignature */: return node.questionToken !== undefined; } } @@ -5664,9 +5855,9 @@ var ts; } ts.hasQuestionToken = hasQuestionToken; function isJSDocConstructSignature(node) { - return node.kind === 265 /* JSDocFunctionType */ && + return node.kind === 268 /* JSDocFunctionType */ && node.parameters.length > 0 && - node.parameters[0].type.kind === 267 /* JSDocConstructorType */; + node.parameters[0].type.kind === 270 /* JSDocConstructorType */; } ts.isJSDocConstructSignature = isJSDocConstructSignature; function getJSDocTag(node, kind, checkParentVariableStatement) { @@ -5695,9 +5886,9 @@ var ts; // */ // var x = function(name) { return name.length; } if (checkParentVariableStatement) { - var isInitializerOfVariableDeclarationInStatement = node.parent.kind === 215 /* VariableDeclaration */ && + var isInitializerOfVariableDeclarationInStatement = node.parent.kind === 217 /* VariableDeclaration */ && node.parent.initializer === node && - node.parent.parent.parent.kind === 197 /* VariableStatement */; + node.parent.parent.parent.kind === 199 /* VariableStatement */; var variableStatementNode = isInitializerOfVariableDeclarationInStatement ? node.parent.parent.parent : undefined; if (variableStatementNode) { return variableStatementNode.jsDocComment; @@ -5705,13 +5896,13 @@ var ts; // Also recognize when the node is the RHS of an assignment expression var parent_3 = node.parent; var isSourceOfAssignmentExpressionStatement = parent_3 && parent_3.parent && - parent_3.kind === 185 /* BinaryExpression */ && + parent_3.kind === 186 /* BinaryExpression */ && parent_3.operatorToken.kind === 56 /* EqualsToken */ && - parent_3.parent.kind === 199 /* ExpressionStatement */; + parent_3.parent.kind === 201 /* ExpressionStatement */; if (isSourceOfAssignmentExpressionStatement) { return parent_3.parent.jsDocComment; } - var isPropertyAssignmentExpression = parent_3 && parent_3.kind === 249 /* PropertyAssignment */; + var isPropertyAssignmentExpression = parent_3 && parent_3.kind === 252 /* PropertyAssignment */; if (isPropertyAssignmentExpression) { return parent_3.jsDocComment; } @@ -5719,15 +5910,15 @@ var ts; return undefined; } function getJSDocTypeTag(node) { - return getJSDocTag(node, 273 /* JSDocTypeTag */, /*checkParentVariableStatement*/ false); + return getJSDocTag(node, 276 /* JSDocTypeTag */, /*checkParentVariableStatement*/ false); } ts.getJSDocTypeTag = getJSDocTypeTag; function getJSDocReturnTag(node) { - return getJSDocTag(node, 272 /* JSDocReturnTag */, /*checkParentVariableStatement*/ true); + return getJSDocTag(node, 275 /* JSDocReturnTag */, /*checkParentVariableStatement*/ true); } ts.getJSDocReturnTag = getJSDocReturnTag; function getJSDocTemplateTag(node) { - return getJSDocTag(node, 274 /* JSDocTemplateTag */, /*checkParentVariableStatement*/ false); + return getJSDocTag(node, 277 /* JSDocTemplateTag */, /*checkParentVariableStatement*/ false); } ts.getJSDocTemplateTag = getJSDocTemplateTag; function getCorrespondingJSDocParameterTag(parameter) { @@ -5739,7 +5930,7 @@ var ts; if (jsDocComment) { for (var _i = 0, _a = jsDocComment.tags; _i < _a.length; _i++) { var tag = _a[_i]; - if (tag.kind === 271 /* JSDocParameterTag */) { + if (tag.kind === 274 /* JSDocParameterTag */) { var parameterTag = tag; var name_6 = parameterTag.preParameterName || parameterTag.postParameterName; if (name_6.text === parameterName) { @@ -5759,12 +5950,12 @@ var ts; function isRestParameter(node) { if (node) { if (node.flags & 134217728 /* JavaScriptFile */) { - if (node.type && node.type.kind === 266 /* JSDocVariadicType */) { + if (node.type && node.type.kind === 269 /* JSDocVariadicType */) { return true; } var paramTag = getCorrespondingJSDocParameterTag(node); if (paramTag && paramTag.typeExpression) { - return paramTag.typeExpression.type.kind === 266 /* JSDocVariadicType */; + return paramTag.typeExpression.type.kind === 269 /* JSDocVariadicType */; } } return node.dotDotDotToken !== undefined; @@ -5785,7 +5976,7 @@ var ts; } ts.isTemplateLiteralKind = isTemplateLiteralKind; function isBindingPattern(node) { - return !!node && (node.kind === 166 /* ArrayBindingPattern */ || node.kind === 165 /* ObjectBindingPattern */); + return !!node && (node.kind === 167 /* ArrayBindingPattern */ || node.kind === 166 /* ObjectBindingPattern */); } ts.isBindingPattern = isBindingPattern; function isNodeDescendentOf(node, ancestor) { @@ -5799,7 +5990,7 @@ var ts; ts.isNodeDescendentOf = isNodeDescendentOf; function isInAmbientContext(node) { while (node) { - if (node.flags & 2 /* Ambient */ || (node.kind === 252 /* SourceFile */ && node.isDeclarationFile)) { + if (node.flags & 2 /* Ambient */ || (node.kind === 255 /* SourceFile */ && node.isDeclarationFile)) { return true; } node = node.parent; @@ -5809,34 +6000,34 @@ var ts; ts.isInAmbientContext = isInAmbientContext; function isDeclaration(node) { switch (node.kind) { - case 178 /* ArrowFunction */: - case 167 /* BindingElement */: - case 218 /* ClassDeclaration */: - case 190 /* ClassExpression */: - case 146 /* Constructor */: - case 221 /* EnumDeclaration */: - case 251 /* EnumMember */: - case 234 /* ExportSpecifier */: - case 217 /* FunctionDeclaration */: - case 177 /* FunctionExpression */: - case 147 /* GetAccessor */: - case 227 /* ImportClause */: - case 225 /* ImportEqualsDeclaration */: - case 230 /* ImportSpecifier */: - case 219 /* InterfaceDeclaration */: - case 145 /* MethodDeclaration */: - case 144 /* MethodSignature */: - case 222 /* ModuleDeclaration */: - case 228 /* NamespaceImport */: - case 140 /* Parameter */: - case 249 /* PropertyAssignment */: - case 143 /* PropertyDeclaration */: - case 142 /* PropertySignature */: - case 148 /* SetAccessor */: - case 250 /* ShorthandPropertyAssignment */: - case 220 /* TypeAliasDeclaration */: - case 139 /* TypeParameter */: - case 215 /* VariableDeclaration */: + case 179 /* ArrowFunction */: + case 168 /* BindingElement */: + case 220 /* ClassDeclaration */: + case 191 /* ClassExpression */: + case 147 /* Constructor */: + case 223 /* EnumDeclaration */: + case 254 /* EnumMember */: + case 237 /* ExportSpecifier */: + case 219 /* FunctionDeclaration */: + case 178 /* FunctionExpression */: + case 148 /* GetAccessor */: + case 230 /* ImportClause */: + case 228 /* ImportEqualsDeclaration */: + case 233 /* ImportSpecifier */: + case 221 /* InterfaceDeclaration */: + case 146 /* MethodDeclaration */: + case 145 /* MethodSignature */: + case 224 /* ModuleDeclaration */: + case 231 /* NamespaceImport */: + case 141 /* Parameter */: + case 252 /* PropertyAssignment */: + case 144 /* PropertyDeclaration */: + case 143 /* PropertySignature */: + case 149 /* SetAccessor */: + case 253 /* ShorthandPropertyAssignment */: + case 222 /* TypeAliasDeclaration */: + case 140 /* TypeParameter */: + case 217 /* VariableDeclaration */: return true; } return false; @@ -5844,25 +6035,25 @@ var ts; ts.isDeclaration = isDeclaration; function isStatement(n) { switch (n.kind) { - case 207 /* BreakStatement */: - case 206 /* ContinueStatement */: - case 214 /* DebuggerStatement */: - case 201 /* DoStatement */: - case 199 /* ExpressionStatement */: - case 198 /* EmptyStatement */: - case 204 /* ForInStatement */: - case 205 /* ForOfStatement */: - case 203 /* ForStatement */: - case 200 /* IfStatement */: - case 211 /* LabeledStatement */: - case 208 /* ReturnStatement */: - case 210 /* SwitchStatement */: - case 212 /* ThrowStatement */: - case 213 /* TryStatement */: - case 197 /* VariableStatement */: - case 202 /* WhileStatement */: - case 209 /* WithStatement */: - case 231 /* ExportAssignment */: + case 209 /* BreakStatement */: + case 208 /* ContinueStatement */: + case 216 /* DebuggerStatement */: + case 203 /* DoStatement */: + case 201 /* ExpressionStatement */: + case 200 /* EmptyStatement */: + case 206 /* ForInStatement */: + case 207 /* ForOfStatement */: + case 205 /* ForStatement */: + case 202 /* IfStatement */: + case 213 /* LabeledStatement */: + case 210 /* ReturnStatement */: + case 212 /* SwitchStatement */: + case 214 /* ThrowStatement */: + case 215 /* TryStatement */: + case 199 /* VariableStatement */: + case 204 /* WhileStatement */: + case 211 /* WithStatement */: + case 234 /* ExportAssignment */: return true; default: return false; @@ -5871,13 +6062,13 @@ var ts; ts.isStatement = isStatement; function isClassElement(n) { switch (n.kind) { - case 146 /* Constructor */: - case 143 /* PropertyDeclaration */: - case 145 /* MethodDeclaration */: - case 147 /* GetAccessor */: - case 148 /* SetAccessor */: - case 144 /* MethodSignature */: - case 151 /* IndexSignature */: + case 147 /* Constructor */: + case 144 /* PropertyDeclaration */: + case 146 /* MethodDeclaration */: + case 148 /* GetAccessor */: + case 149 /* SetAccessor */: + case 145 /* MethodSignature */: + case 152 /* IndexSignature */: return true; default: return false; @@ -5890,7 +6081,7 @@ var ts; return false; } var parent = name.parent; - if (parent.kind === 230 /* ImportSpecifier */ || parent.kind === 234 /* ExportSpecifier */) { + if (parent.kind === 233 /* ImportSpecifier */ || parent.kind === 237 /* ExportSpecifier */) { if (parent.propertyName) { return true; } @@ -5905,31 +6096,31 @@ var ts; function isIdentifierName(node) { var parent = node.parent; switch (parent.kind) { - case 143 /* PropertyDeclaration */: - case 142 /* PropertySignature */: - case 145 /* MethodDeclaration */: - case 144 /* MethodSignature */: - case 147 /* GetAccessor */: - case 148 /* SetAccessor */: - case 251 /* EnumMember */: - case 249 /* PropertyAssignment */: - case 170 /* PropertyAccessExpression */: + case 144 /* PropertyDeclaration */: + case 143 /* PropertySignature */: + case 146 /* MethodDeclaration */: + case 145 /* MethodSignature */: + case 148 /* GetAccessor */: + case 149 /* SetAccessor */: + case 254 /* EnumMember */: + case 252 /* PropertyAssignment */: + case 171 /* PropertyAccessExpression */: // Name in member declaration or property name in property access return parent.name === node; - case 137 /* QualifiedName */: + case 138 /* QualifiedName */: // Name on right hand side of dot in a type query if (parent.right === node) { - while (parent.kind === 137 /* QualifiedName */) { + while (parent.kind === 138 /* QualifiedName */) { parent = parent.parent; } - return parent.kind === 156 /* TypeQuery */; + return parent.kind === 157 /* TypeQuery */; } return false; - case 167 /* BindingElement */: - case 230 /* ImportSpecifier */: + case 168 /* BindingElement */: + case 233 /* ImportSpecifier */: // Property name in binding element or import specifier return parent.propertyName === node; - case 234 /* ExportSpecifier */: + case 237 /* ExportSpecifier */: // Any name in an export specifier return true; } @@ -5945,12 +6136,13 @@ var ts; // export = ... // export default ... function isAliasSymbolDeclaration(node) { - return node.kind === 225 /* ImportEqualsDeclaration */ || - node.kind === 227 /* ImportClause */ && !!node.name || - node.kind === 228 /* NamespaceImport */ || - node.kind === 230 /* ImportSpecifier */ || - node.kind === 234 /* ExportSpecifier */ || - node.kind === 231 /* ExportAssignment */ && node.expression.kind === 69 /* Identifier */; + return node.kind === 228 /* ImportEqualsDeclaration */ || + node.kind === 227 /* GlobalModuleExportDeclaration */ || + node.kind === 230 /* ImportClause */ && !!node.name || + node.kind === 231 /* NamespaceImport */ || + node.kind === 233 /* ImportSpecifier */ || + node.kind === 237 /* ExportSpecifier */ || + node.kind === 234 /* ExportAssignment */ && node.expression.kind === 69 /* Identifier */; } ts.isAliasSymbolDeclaration = isAliasSymbolDeclaration; function getClassExtendsHeritageClauseElement(node) { @@ -6007,32 +6199,32 @@ var ts; }; } else { - var matchResult = ts.fullTripleSlashReferencePathRegEx.exec(comment); - if (matchResult) { + var refMatchResult = ts.fullTripleSlashReferencePathRegEx.exec(comment); + var refLibResult = !refMatchResult && ts.fullTripleSlashReferenceTypeReferenceDirectiveRegEx.exec(comment); + if (refMatchResult || refLibResult) { var start = commentRange.pos; var end = commentRange.end; return { fileReference: { pos: start, end: end, - fileName: matchResult[3] + fileName: (refMatchResult || refLibResult)[3] }, - isNoDefaultLib: false - }; - } - else { - return { - diagnosticMessage: ts.Diagnostics.Invalid_reference_directive_syntax, - isNoDefaultLib: false + isNoDefaultLib: false, + isTypeReferenceDirective: !!refLibResult }; } + return { + diagnosticMessage: ts.Diagnostics.Invalid_reference_directive_syntax, + isNoDefaultLib: false + }; } } return undefined; } ts.getFileReferenceFromReferencePath = getFileReferenceFromReferencePath; function isKeyword(token) { - return 70 /* FirstKeyword */ <= token && token <= 136 /* LastKeyword */; + return 70 /* FirstKeyword */ <= token && token <= 137 /* LastKeyword */; } ts.isKeyword = isKeyword; function isTrivia(token) { @@ -6059,7 +6251,7 @@ var ts; } ts.hasDynamicName = hasDynamicName; function isDynamicName(name) { - return name.kind === 138 /* ComputedPropertyName */ && + return name.kind === 139 /* ComputedPropertyName */ && !isStringOrNumericLiteral(name.expression.kind) && !isWellKnownSymbolSyntactically(name.expression); } @@ -6077,7 +6269,7 @@ var ts; if (name.kind === 69 /* Identifier */ || name.kind === 9 /* StringLiteral */ || name.kind === 8 /* NumericLiteral */) { return name.text; } - if (name.kind === 138 /* ComputedPropertyName */) { + if (name.kind === 139 /* ComputedPropertyName */) { var nameExpression = name.expression; if (isWellKnownSymbolSyntactically(nameExpression)) { var rightHandSideName = nameExpression.name.text; @@ -6118,18 +6310,18 @@ var ts; ts.isModifierKind = isModifierKind; function isParameterDeclaration(node) { var root = getRootDeclaration(node); - return root.kind === 140 /* Parameter */; + return root.kind === 141 /* Parameter */; } ts.isParameterDeclaration = isParameterDeclaration; function getRootDeclaration(node) { - while (node.kind === 167 /* BindingElement */) { + while (node.kind === 168 /* BindingElement */) { node = node.parent.parent; } return node; } ts.getRootDeclaration = getRootDeclaration; function nodeStartsNewLexicalEnvironment(n) { - return isFunctionLike(n) || n.kind === 222 /* ModuleDeclaration */ || n.kind === 252 /* SourceFile */; + return isFunctionLike(n) || n.kind === 224 /* ModuleDeclaration */ || n.kind === 255 /* SourceFile */; } ts.nodeStartsNewLexicalEnvironment = nodeStartsNewLexicalEnvironment; /** @@ -6179,7 +6371,7 @@ var ts; } ts.cloneEntityName = cloneEntityName; function isQualifiedName(node) { - return node.kind === 137 /* QualifiedName */; + return node.kind === 138 /* QualifiedName */; } ts.isQualifiedName = isQualifiedName; function nodeIsSynthesized(node) { @@ -6430,6 +6622,17 @@ var ts; return emitOutputFilePathWithoutExtension + extension; } ts.getOwnEmitOutputFilePath = getOwnEmitOutputFilePath; + 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"; + } + } + ts.getDeclarationEmitOutputFilePath = getDeclarationEmitOutputFilePath; function getEmitScriptTarget(compilerOptions) { return compilerOptions.target || 0 /* ES3 */; } @@ -6475,21 +6678,22 @@ var ts; var emitFileNames = { jsFilePath: jsFilePath, sourceMapFilePath: getSourceMapFilePath(jsFilePath, options), - declarationFilePath: !isSourceFileJavaScript(sourceFile) ? getDeclarationEmitFilePath(jsFilePath, options) : undefined + declarationFilePath: !isSourceFileJavaScript(sourceFile) ? getDeclarationEmitOutputFilePath(sourceFile, host) : undefined }; action(emitFileNames, [sourceFile], /*isBundledEmit*/ false); } 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 - var bundledSources = ts.filter(host.getSourceFiles(), function (sourceFile) { return !isDeclarationFile(sourceFile) && - (!isExternalModule(sourceFile) || - (getEmitModuleKind(options) && isExternalModule(sourceFile))); }); // module that can emit - note falsy value from getEmitModuleKind means the module kind that shouldn't be emitted + var bundledSources = ts.filter(host.getSourceFiles(), function (sourceFile) { + return !isDeclarationFile(sourceFile) // Not a declaration file + && (!ts.isExternalModule(sourceFile) || !!getEmitModuleKind(options)); + }); // and not a module, unless module emit enabled if (bundledSources.length) { var jsFilePath = options.outFile || options.out; var emitFileNames = { jsFilePath: jsFilePath, sourceMapFilePath: getSourceMapFilePath(jsFilePath, options), - declarationFilePath: getDeclarationEmitFilePath(jsFilePath, options) + declarationFilePath: options.declaration ? ts.removeFileExtension(jsFilePath) + ".d.ts" : undefined }; action(emitFileNames, bundledSources, /*isBundledEmit*/ true); } @@ -6497,9 +6701,6 @@ var ts; function getSourceMapFilePath(jsFilePath, options) { return options.sourceMap ? jsFilePath + ".map" : undefined; } - function getDeclarationEmitFilePath(jsFilePath, options) { - return options.declaration ? ts.removeFileExtension(jsFilePath) + ".d.ts" : undefined; - } } ts.forEachExpectedEmitFile = forEachExpectedEmitFile; function getSourceFilePathInNewDir(sourceFile, host, newDirPath) { @@ -6508,10 +6709,10 @@ var ts; return ts.combinePaths(newDirPath, sourceFilePath); } ts.getSourceFilePathInNewDir = getSourceFilePathInNewDir; - function writeFile(host, diagnostics, fileName, data, writeByteOrderMark) { + function writeFile(host, diagnostics, fileName, data, writeByteOrderMark, sourceFiles) { host.writeFile(fileName, data, writeByteOrderMark, function (hostErrorMessage) { diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Could_not_write_file_0_Colon_1, fileName, hostErrorMessage)); - }); + }, sourceFiles); } ts.writeFile = writeFile; function getLineOfLocalPosition(currentSourceFile, pos) { @@ -6524,7 +6725,7 @@ var ts; ts.getLineOfLocalPositionFromLineMap = getLineOfLocalPositionFromLineMap; function getFirstConstructorWithBody(node) { return ts.forEach(node.members, function (member) { - if (member.kind === 146 /* Constructor */ && nodeIsPresent(member.body)) { + if (member.kind === 147 /* Constructor */ && nodeIsPresent(member.body)) { return member; } }); @@ -6541,10 +6742,10 @@ var ts; var setAccessor; if (hasDynamicName(accessor)) { firstAccessor = accessor; - if (accessor.kind === 147 /* GetAccessor */) { + if (accessor.kind === 148 /* GetAccessor */) { getAccessor = accessor; } - else if (accessor.kind === 148 /* SetAccessor */) { + else if (accessor.kind === 149 /* SetAccessor */) { setAccessor = accessor; } else { @@ -6553,7 +6754,7 @@ var ts; } else { ts.forEach(declarations, function (member) { - if ((member.kind === 147 /* GetAccessor */ || member.kind === 148 /* SetAccessor */) + if ((member.kind === 148 /* GetAccessor */ || member.kind === 149 /* SetAccessor */) && (member.flags & 32 /* Static */) === (accessor.flags & 32 /* Static */)) { var memberName = getPropertyNameForPropertyNameNode(member.name); var accessorName = getPropertyNameForPropertyNameNode(accessor.name); @@ -6564,10 +6765,10 @@ var ts; else if (!secondAccessor) { secondAccessor = member; } - if (member.kind === 147 /* GetAccessor */ && !getAccessor) { + if (member.kind === 148 /* GetAccessor */ && !getAccessor) { getAccessor = member; } - if (member.kind === 148 /* SetAccessor */ && !setAccessor) { + if (member.kind === 149 /* SetAccessor */ && !setAccessor) { setAccessor = member; } } @@ -6778,24 +6979,25 @@ var ts; function isLeftHandSideExpression(expr) { if (expr) { switch (expr.kind) { - case 170 /* PropertyAccessExpression */: - case 171 /* ElementAccessExpression */: - case 173 /* NewExpression */: - case 172 /* CallExpression */: - case 237 /* JsxElement */: - case 238 /* JsxSelfClosingElement */: - case 174 /* TaggedTemplateExpression */: - case 168 /* ArrayLiteralExpression */: - case 176 /* ParenthesizedExpression */: - case 169 /* ObjectLiteralExpression */: - case 190 /* ClassExpression */: - case 177 /* FunctionExpression */: + case 171 /* PropertyAccessExpression */: + case 172 /* ElementAccessExpression */: + case 174 /* NewExpression */: + case 173 /* CallExpression */: + case 195 /* NonNullExpression */: + case 240 /* JsxElement */: + case 241 /* JsxSelfClosingElement */: + case 175 /* TaggedTemplateExpression */: + case 169 /* ArrayLiteralExpression */: + case 177 /* ParenthesizedExpression */: + case 170 /* ObjectLiteralExpression */: + case 191 /* ClassExpression */: + case 178 /* FunctionExpression */: case 69 /* Identifier */: case 10 /* RegularExpressionLiteral */: case 8 /* NumericLiteral */: case 9 /* StringLiteral */: case 11 /* NoSubstitutionTemplateLiteral */: - case 187 /* TemplateExpression */: + case 188 /* TemplateExpression */: case 84 /* FalseKeyword */: case 93 /* NullKeyword */: case 97 /* ThisKeyword */: @@ -6812,7 +7014,7 @@ var ts; } ts.isAssignmentOperator = isAssignmentOperator; function isExpressionWithTypeArgumentsInClassExtendsClause(node) { - return node.kind === 192 /* ExpressionWithTypeArguments */ && + return node.kind === 193 /* ExpressionWithTypeArguments */ && node.parent.token === 83 /* ExtendsKeyword */ && isClassLike(node.parent.parent); } @@ -6835,16 +7037,16 @@ var ts; } } function isRightSideOfQualifiedNameOrPropertyAccess(node) { - return (node.parent.kind === 137 /* QualifiedName */ && node.parent.right === node) || - (node.parent.kind === 170 /* PropertyAccessExpression */ && node.parent.name === node); + return (node.parent.kind === 138 /* QualifiedName */ && node.parent.right === node) || + (node.parent.kind === 171 /* PropertyAccessExpression */ && node.parent.name === node); } ts.isRightSideOfQualifiedNameOrPropertyAccess = isRightSideOfQualifiedNameOrPropertyAccess; function isEmptyObjectLiteralOrArrayLiteral(expression) { var kind = expression.kind; - if (kind === 169 /* ObjectLiteralExpression */) { + if (kind === 170 /* ObjectLiteralExpression */) { return expression.properties.length === 0; } - if (kind === 168 /* ArrayLiteralExpression */) { + if (kind === 169 /* ArrayLiteralExpression */) { return expression.elements.length === 0; } return false; @@ -6986,6 +7188,11 @@ var ts; return carriageReturnLineFeed; } ts.getNewLineCharacter = getNewLineCharacter; + function isWatchSet(options) { + // Firefox has Object.prototype.watch + return options.watch && options.hasOwnProperty("watch"); + } + ts.isWatchSet = isWatchSet; })(ts || (ts = {})); var ts; (function (ts) { @@ -7199,9 +7406,9 @@ var ts; } ts.collapseTextChangeRangesAcrossMultipleVersions = collapseTextChangeRangesAcrossMultipleVersions; function getTypeParameterOwner(d) { - if (d && d.kind === 139 /* TypeParameter */) { + if (d && d.kind === 140 /* TypeParameter */) { for (var current = d; current; current = current.parent) { - if (ts.isFunctionLike(current) || ts.isClassLike(current) || current.kind === 219 /* InterfaceDeclaration */) { + if (ts.isFunctionLike(current) || ts.isClassLike(current) || current.kind === 221 /* InterfaceDeclaration */) { return current; } } @@ -7209,9 +7416,18 @@ var ts; } ts.getTypeParameterOwner = getTypeParameterOwner; function isParameterPropertyDeclaration(node) { - return node.flags & 28 /* AccessibilityModifier */ && node.parent.kind === 146 /* Constructor */ && ts.isClassLike(node.parent.parent); + return node.flags & 28 /* AccessibilityModifier */ && node.parent.kind === 147 /* Constructor */ && ts.isClassLike(node.parent.parent); } ts.isParameterPropertyDeclaration = isParameterPropertyDeclaration; + function startsWith(str, prefix) { + return str.lastIndexOf(prefix, 0) === 0; + } + ts.startsWith = startsWith; + function endsWith(str, suffix) { + var expectedPos = str.length - suffix.length; + return str.indexOf(suffix, expectedPos) === expectedPos; + } + ts.endsWith = endsWith; })(ts || (ts = {})); /// /// @@ -7221,7 +7437,7 @@ var ts; var NodeConstructor; var SourceFileConstructor; function createNode(kind, pos, end) { - if (kind === 252 /* SourceFile */) { + if (kind === 255 /* SourceFile */) { return new (SourceFileConstructor || (SourceFileConstructor = ts.objectAllocator.getSourceFileConstructor()))(kind, pos, end); } else { @@ -7264,26 +7480,26 @@ var ts; var visitNodes = cbNodeArray ? visitNodeArray : visitEachNode; var cbNodes = cbNodeArray || cbNode; switch (node.kind) { - case 137 /* QualifiedName */: + case 138 /* QualifiedName */: return visitNode(cbNode, node.left) || visitNode(cbNode, node.right); - case 139 /* TypeParameter */: + case 140 /* TypeParameter */: return visitNode(cbNode, node.name) || visitNode(cbNode, node.constraint) || visitNode(cbNode, node.expression); - case 250 /* ShorthandPropertyAssignment */: + case 253 /* 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 140 /* Parameter */: - case 143 /* PropertyDeclaration */: - case 142 /* PropertySignature */: - case 249 /* PropertyAssignment */: - case 215 /* VariableDeclaration */: - case 167 /* BindingElement */: + case 141 /* Parameter */: + case 144 /* PropertyDeclaration */: + case 143 /* PropertySignature */: + case 252 /* PropertyAssignment */: + case 217 /* VariableDeclaration */: + case 168 /* BindingElement */: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.propertyName) || @@ -7292,24 +7508,24 @@ var ts; visitNode(cbNode, node.questionToken) || visitNode(cbNode, node.type) || visitNode(cbNode, node.initializer); - case 154 /* FunctionType */: - case 155 /* ConstructorType */: - case 149 /* CallSignature */: - case 150 /* ConstructSignature */: - case 151 /* IndexSignature */: + case 155 /* FunctionType */: + case 156 /* ConstructorType */: + case 150 /* CallSignature */: + case 151 /* ConstructSignature */: + case 152 /* IndexSignature */: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNodes(cbNodes, node.typeParameters) || visitNodes(cbNodes, node.parameters) || visitNode(cbNode, node.type); - case 145 /* MethodDeclaration */: - case 144 /* MethodSignature */: - case 146 /* Constructor */: - case 147 /* GetAccessor */: - case 148 /* SetAccessor */: - case 177 /* FunctionExpression */: - case 217 /* FunctionDeclaration */: - case 178 /* ArrowFunction */: + case 146 /* MethodDeclaration */: + case 145 /* MethodSignature */: + case 147 /* Constructor */: + case 148 /* GetAccessor */: + case 149 /* SetAccessor */: + case 178 /* FunctionExpression */: + case 219 /* FunctionDeclaration */: + case 179 /* ArrowFunction */: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.asteriskToken) || @@ -7320,290 +7536,294 @@ var ts; visitNode(cbNode, node.type) || visitNode(cbNode, node.equalsGreaterThanToken) || visitNode(cbNode, node.body); - case 153 /* TypeReference */: + case 154 /* TypeReference */: return visitNode(cbNode, node.typeName) || visitNodes(cbNodes, node.typeArguments); - case 152 /* TypePredicate */: + case 153 /* TypePredicate */: return visitNode(cbNode, node.parameterName) || visitNode(cbNode, node.type); - case 156 /* TypeQuery */: + case 157 /* TypeQuery */: return visitNode(cbNode, node.exprName); - case 157 /* TypeLiteral */: + case 158 /* TypeLiteral */: return visitNodes(cbNodes, node.members); - case 158 /* ArrayType */: + case 159 /* ArrayType */: return visitNode(cbNode, node.elementType); - case 159 /* TupleType */: + case 160 /* TupleType */: return visitNodes(cbNodes, node.elementTypes); - case 160 /* UnionType */: - case 161 /* IntersectionType */: + case 161 /* UnionType */: + case 162 /* IntersectionType */: return visitNodes(cbNodes, node.types); - case 162 /* ParenthesizedType */: + case 163 /* ParenthesizedType */: return visitNode(cbNode, node.type); - case 165 /* ObjectBindingPattern */: - case 166 /* ArrayBindingPattern */: + case 166 /* ObjectBindingPattern */: + case 167 /* ArrayBindingPattern */: return visitNodes(cbNodes, node.elements); - case 168 /* ArrayLiteralExpression */: + case 169 /* ArrayLiteralExpression */: return visitNodes(cbNodes, node.elements); - case 169 /* ObjectLiteralExpression */: + case 170 /* ObjectLiteralExpression */: return visitNodes(cbNodes, node.properties); - case 170 /* PropertyAccessExpression */: + case 171 /* PropertyAccessExpression */: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.dotToken) || visitNode(cbNode, node.name); - case 171 /* ElementAccessExpression */: + case 172 /* ElementAccessExpression */: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.argumentExpression); - case 172 /* CallExpression */: - case 173 /* NewExpression */: + case 173 /* CallExpression */: + case 174 /* NewExpression */: return visitNode(cbNode, node.expression) || visitNodes(cbNodes, node.typeArguments) || visitNodes(cbNodes, node.arguments); - case 174 /* TaggedTemplateExpression */: + case 175 /* TaggedTemplateExpression */: return visitNode(cbNode, node.tag) || visitNode(cbNode, node.template); - case 175 /* TypeAssertionExpression */: + case 176 /* TypeAssertionExpression */: return visitNode(cbNode, node.type) || visitNode(cbNode, node.expression); - case 176 /* ParenthesizedExpression */: + case 177 /* ParenthesizedExpression */: return visitNode(cbNode, node.expression); - case 179 /* DeleteExpression */: + case 180 /* DeleteExpression */: return visitNode(cbNode, node.expression); - case 180 /* TypeOfExpression */: + case 181 /* TypeOfExpression */: return visitNode(cbNode, node.expression); - case 181 /* VoidExpression */: + case 182 /* VoidExpression */: return visitNode(cbNode, node.expression); - case 183 /* PrefixUnaryExpression */: + case 184 /* PrefixUnaryExpression */: return visitNode(cbNode, node.operand); - case 188 /* YieldExpression */: + case 189 /* YieldExpression */: return visitNode(cbNode, node.asteriskToken) || visitNode(cbNode, node.expression); - case 182 /* AwaitExpression */: + case 183 /* AwaitExpression */: return visitNode(cbNode, node.expression); - case 184 /* PostfixUnaryExpression */: + case 185 /* PostfixUnaryExpression */: return visitNode(cbNode, node.operand); - case 185 /* BinaryExpression */: + case 186 /* BinaryExpression */: return visitNode(cbNode, node.left) || visitNode(cbNode, node.operatorToken) || visitNode(cbNode, node.right); - case 193 /* AsExpression */: + case 194 /* AsExpression */: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.type); - case 186 /* ConditionalExpression */: + case 195 /* NonNullExpression */: + return visitNode(cbNode, node.expression); + case 187 /* ConditionalExpression */: return visitNode(cbNode, node.condition) || visitNode(cbNode, node.questionToken) || visitNode(cbNode, node.whenTrue) || visitNode(cbNode, node.colonToken) || visitNode(cbNode, node.whenFalse); - case 189 /* SpreadElementExpression */: + case 190 /* SpreadElementExpression */: return visitNode(cbNode, node.expression); - case 196 /* Block */: - case 223 /* ModuleBlock */: + case 198 /* Block */: + case 225 /* ModuleBlock */: return visitNodes(cbNodes, node.statements); - case 252 /* SourceFile */: + case 255 /* SourceFile */: return visitNodes(cbNodes, node.statements) || visitNode(cbNode, node.endOfFileToken); - case 197 /* VariableStatement */: + case 199 /* VariableStatement */: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.declarationList); - case 216 /* VariableDeclarationList */: + case 218 /* VariableDeclarationList */: return visitNodes(cbNodes, node.declarations); - case 199 /* ExpressionStatement */: + case 201 /* ExpressionStatement */: return visitNode(cbNode, node.expression); - case 200 /* IfStatement */: + case 202 /* IfStatement */: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.thenStatement) || visitNode(cbNode, node.elseStatement); - case 201 /* DoStatement */: + case 203 /* DoStatement */: return visitNode(cbNode, node.statement) || visitNode(cbNode, node.expression); - case 202 /* WhileStatement */: + case 204 /* WhileStatement */: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.statement); - case 203 /* ForStatement */: + case 205 /* ForStatement */: return visitNode(cbNode, node.initializer) || visitNode(cbNode, node.condition) || visitNode(cbNode, node.incrementor) || visitNode(cbNode, node.statement); - case 204 /* ForInStatement */: + case 206 /* ForInStatement */: return visitNode(cbNode, node.initializer) || visitNode(cbNode, node.expression) || visitNode(cbNode, node.statement); - case 205 /* ForOfStatement */: + case 207 /* ForOfStatement */: return visitNode(cbNode, node.initializer) || visitNode(cbNode, node.expression) || visitNode(cbNode, node.statement); - case 206 /* ContinueStatement */: - case 207 /* BreakStatement */: + case 208 /* ContinueStatement */: + case 209 /* BreakStatement */: return visitNode(cbNode, node.label); - case 208 /* ReturnStatement */: + case 210 /* ReturnStatement */: return visitNode(cbNode, node.expression); - case 209 /* WithStatement */: + case 211 /* WithStatement */: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.statement); - case 210 /* SwitchStatement */: + case 212 /* SwitchStatement */: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.caseBlock); - case 224 /* CaseBlock */: + case 226 /* CaseBlock */: return visitNodes(cbNodes, node.clauses); - case 245 /* CaseClause */: + case 248 /* CaseClause */: return visitNode(cbNode, node.expression) || visitNodes(cbNodes, node.statements); - case 246 /* DefaultClause */: + case 249 /* DefaultClause */: return visitNodes(cbNodes, node.statements); - case 211 /* LabeledStatement */: + case 213 /* LabeledStatement */: return visitNode(cbNode, node.label) || visitNode(cbNode, node.statement); - case 212 /* ThrowStatement */: + case 214 /* ThrowStatement */: return visitNode(cbNode, node.expression); - case 213 /* TryStatement */: + case 215 /* TryStatement */: return visitNode(cbNode, node.tryBlock) || visitNode(cbNode, node.catchClause) || visitNode(cbNode, node.finallyBlock); - case 248 /* CatchClause */: + case 251 /* CatchClause */: return visitNode(cbNode, node.variableDeclaration) || visitNode(cbNode, node.block); - case 141 /* Decorator */: + case 142 /* Decorator */: return visitNode(cbNode, node.expression); - case 218 /* ClassDeclaration */: - case 190 /* ClassExpression */: + case 220 /* ClassDeclaration */: + case 191 /* 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 219 /* InterfaceDeclaration */: + case 221 /* 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 220 /* TypeAliasDeclaration */: + case 222 /* TypeAliasDeclaration */: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNodes(cbNodes, node.typeParameters) || visitNode(cbNode, node.type); - case 221 /* EnumDeclaration */: + case 223 /* EnumDeclaration */: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNodes(cbNodes, node.members); - case 251 /* EnumMember */: + case 254 /* EnumMember */: return visitNode(cbNode, node.name) || visitNode(cbNode, node.initializer); - case 222 /* ModuleDeclaration */: + case 224 /* ModuleDeclaration */: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNode(cbNode, node.body); - case 225 /* ImportEqualsDeclaration */: + case 228 /* ImportEqualsDeclaration */: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNode(cbNode, node.moduleReference); - case 226 /* ImportDeclaration */: + case 229 /* ImportDeclaration */: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.importClause) || visitNode(cbNode, node.moduleSpecifier); - case 227 /* ImportClause */: + case 230 /* ImportClause */: return visitNode(cbNode, node.name) || visitNode(cbNode, node.namedBindings); - case 228 /* NamespaceImport */: + case 227 /* GlobalModuleExportDeclaration */: return visitNode(cbNode, node.name); - case 229 /* NamedImports */: - case 233 /* NamedExports */: + case 231 /* NamespaceImport */: + return visitNode(cbNode, node.name); + case 232 /* NamedImports */: + case 236 /* NamedExports */: return visitNodes(cbNodes, node.elements); - case 232 /* ExportDeclaration */: + case 235 /* ExportDeclaration */: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.exportClause) || visitNode(cbNode, node.moduleSpecifier); - case 230 /* ImportSpecifier */: - case 234 /* ExportSpecifier */: + case 233 /* ImportSpecifier */: + case 237 /* ExportSpecifier */: return visitNode(cbNode, node.propertyName) || visitNode(cbNode, node.name); - case 231 /* ExportAssignment */: + case 234 /* ExportAssignment */: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.expression); - case 187 /* TemplateExpression */: + case 188 /* TemplateExpression */: return visitNode(cbNode, node.head) || visitNodes(cbNodes, node.templateSpans); - case 194 /* TemplateSpan */: + case 196 /* TemplateSpan */: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.literal); - case 138 /* ComputedPropertyName */: + case 139 /* ComputedPropertyName */: return visitNode(cbNode, node.expression); - case 247 /* HeritageClause */: + case 250 /* HeritageClause */: return visitNodes(cbNodes, node.types); - case 192 /* ExpressionWithTypeArguments */: + case 193 /* ExpressionWithTypeArguments */: return visitNode(cbNode, node.expression) || visitNodes(cbNodes, node.typeArguments); - case 236 /* ExternalModuleReference */: + case 239 /* ExternalModuleReference */: return visitNode(cbNode, node.expression); - case 235 /* MissingDeclaration */: + case 238 /* MissingDeclaration */: return visitNodes(cbNodes, node.decorators); - case 237 /* JsxElement */: + case 240 /* JsxElement */: return visitNode(cbNode, node.openingElement) || visitNodes(cbNodes, node.children) || visitNode(cbNode, node.closingElement); - case 238 /* JsxSelfClosingElement */: - case 239 /* JsxOpeningElement */: + case 241 /* JsxSelfClosingElement */: + case 242 /* JsxOpeningElement */: return visitNode(cbNode, node.tagName) || visitNodes(cbNodes, node.attributes); - case 242 /* JsxAttribute */: + case 245 /* JsxAttribute */: return visitNode(cbNode, node.name) || visitNode(cbNode, node.initializer); - case 243 /* JsxSpreadAttribute */: + case 246 /* JsxSpreadAttribute */: return visitNode(cbNode, node.expression); - case 244 /* JsxExpression */: + case 247 /* JsxExpression */: return visitNode(cbNode, node.expression); - case 241 /* JsxClosingElement */: + case 244 /* JsxClosingElement */: return visitNode(cbNode, node.tagName); - case 253 /* JSDocTypeExpression */: + case 256 /* JSDocTypeExpression */: return visitNode(cbNode, node.type); - case 257 /* JSDocUnionType */: + case 260 /* JSDocUnionType */: return visitNodes(cbNodes, node.types); - case 258 /* JSDocTupleType */: + case 261 /* JSDocTupleType */: return visitNodes(cbNodes, node.types); - case 256 /* JSDocArrayType */: + case 259 /* JSDocArrayType */: return visitNode(cbNode, node.elementType); - case 260 /* JSDocNonNullableType */: + case 263 /* JSDocNonNullableType */: return visitNode(cbNode, node.type); - case 259 /* JSDocNullableType */: + case 262 /* JSDocNullableType */: return visitNode(cbNode, node.type); - case 261 /* JSDocRecordType */: + case 264 /* JSDocRecordType */: return visitNodes(cbNodes, node.members); - case 263 /* JSDocTypeReference */: + case 266 /* JSDocTypeReference */: return visitNode(cbNode, node.name) || visitNodes(cbNodes, node.typeArguments); - case 264 /* JSDocOptionalType */: + case 267 /* JSDocOptionalType */: return visitNode(cbNode, node.type); - case 265 /* JSDocFunctionType */: + case 268 /* JSDocFunctionType */: return visitNodes(cbNodes, node.parameters) || visitNode(cbNode, node.type); - case 266 /* JSDocVariadicType */: + case 269 /* JSDocVariadicType */: return visitNode(cbNode, node.type); - case 267 /* JSDocConstructorType */: + case 270 /* JSDocConstructorType */: return visitNode(cbNode, node.type); - case 268 /* JSDocThisType */: + case 271 /* JSDocThisType */: return visitNode(cbNode, node.type); - case 262 /* JSDocRecordMember */: + case 265 /* JSDocRecordMember */: return visitNode(cbNode, node.name) || visitNode(cbNode, node.type); - case 269 /* JSDocComment */: + case 272 /* JSDocComment */: return visitNodes(cbNodes, node.tags); - case 271 /* JSDocParameterTag */: + case 274 /* JSDocParameterTag */: return visitNode(cbNode, node.preParameterName) || visitNode(cbNode, node.typeExpression) || visitNode(cbNode, node.postParameterName); - case 272 /* JSDocReturnTag */: + case 275 /* JSDocReturnTag */: return visitNode(cbNode, node.typeExpression); - case 273 /* JSDocTypeTag */: + case 276 /* JSDocTypeTag */: return visitNode(cbNode, node.typeExpression); - case 274 /* JSDocTemplateTag */: + case 277 /* JSDocTemplateTag */: return visitNodes(cbNodes, node.typeParameters); } } @@ -7616,23 +7836,10 @@ var ts; return result; } ts.createSourceFile = createSourceFile; - /* @internal */ - function getScriptKindFromFileName(fileName) { - var ext = fileName.substr(fileName.lastIndexOf(".")); - switch (ext.toLowerCase()) { - case ".js": - return 1 /* JS */; - case ".jsx": - return 2 /* JSX */; - case ".ts": - return 3 /* TS */; - case ".tsx": - return 4 /* TSX */; - default: - return 3 /* TS */; - } + function isExternalModule(file) { + return file.externalModuleIndicator !== undefined; } - ts.getScriptKindFromFileName = getScriptKindFromFileName; + ts.isExternalModule = isExternalModule; // Produces a new SourceFile for the 'newText' provided. The 'textChangeRange' parameter // indicates what changed between the 'text' that this SourceFile has and the 'newText'. // The SourceFile will be created with the compiler attempting to reuse as many nodes from @@ -7754,12 +7961,7 @@ var ts; // attached to the EOF token. var parseErrorBeforeNextFinishedNode = false; function parseSourceFile(fileName, _sourceText, languageVersion, _syntaxCursor, setParentNodes, scriptKind) { - // Using scriptKind as a condition handles both: - // - 'scriptKind' is unspecified and thus it is `undefined` - // - 'scriptKind' is set and it is `Unknown` (0) - // If the 'scriptKind' is 'undefined' or 'Unknown' then attempt - // to get the ScriptKind from the file name. - scriptKind = scriptKind ? scriptKind : getScriptKindFromFileName(fileName); + scriptKind = ts.ensureScriptKind(fileName, scriptKind); initializeState(fileName, _sourceText, languageVersion, _syntaxCursor, scriptKind); var result = parseSourceFileWorker(fileName, languageVersion, setParentNodes, scriptKind); clearState(); @@ -7858,7 +8060,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(252 /* SourceFile */, /*pos*/ 0, /* end */ sourceText.length); + var sourceFile = new SourceFileConstructor(255 /* SourceFile */, /*pos*/ 0, /* end */ sourceText.length); nodeCount++; sourceFile.text = sourceText; sourceFile.bindDiagnostics = []; @@ -8211,7 +8413,7 @@ var ts; // PropertyName [Yield]: // LiteralPropertyName // ComputedPropertyName[?Yield] - var node = createNode(138 /* ComputedPropertyName */); + var node = createNode(139 /* ComputedPropertyName */); parseExpected(19 /* OpenBracketToken */); // We parse any expression (including a comma expression). But the grammar // says that only an assignment expression is allowed, so the grammar checker @@ -8240,7 +8442,7 @@ var ts; if (token === 77 /* DefaultKeyword */) { return lookAhead(nextTokenIsClassOrFunction); } - return token !== 37 /* AsteriskToken */ && token !== 15 /* OpenBraceToken */ && canFollowModifier(); + return token !== 37 /* AsteriskToken */ && token !== 116 /* AsKeyword */ && token !== 15 /* OpenBraceToken */ && canFollowModifier(); } if (token === 77 /* DefaultKeyword */) { return nextTokenIsClassOrFunction(); @@ -8532,7 +8734,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 & 62914560 /* ContextFlags */; + var nodeContextFlags = node.flags & 197132288 /* ContextFlags */; if (nodeContextFlags !== contextFlags) { return undefined; } @@ -8612,14 +8814,14 @@ var ts; function isReusableClassMember(node) { if (node) { switch (node.kind) { - case 146 /* Constructor */: - case 151 /* IndexSignature */: - case 147 /* GetAccessor */: - case 148 /* SetAccessor */: - case 143 /* PropertyDeclaration */: - case 195 /* SemicolonClassElement */: + case 147 /* Constructor */: + case 152 /* IndexSignature */: + case 148 /* GetAccessor */: + case 149 /* SetAccessor */: + case 144 /* PropertyDeclaration */: + case 197 /* SemicolonClassElement */: return true; - case 145 /* MethodDeclaration */: + case 146 /* 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. @@ -8634,8 +8836,8 @@ var ts; function isReusableSwitchClause(node) { if (node) { switch (node.kind) { - case 245 /* CaseClause */: - case 246 /* DefaultClause */: + case 248 /* CaseClause */: + case 249 /* DefaultClause */: return true; } } @@ -8644,58 +8846,58 @@ var ts; function isReusableStatement(node) { if (node) { switch (node.kind) { - case 217 /* FunctionDeclaration */: - case 197 /* VariableStatement */: - case 196 /* Block */: - case 200 /* IfStatement */: - case 199 /* ExpressionStatement */: - case 212 /* ThrowStatement */: - case 208 /* ReturnStatement */: - case 210 /* SwitchStatement */: - case 207 /* BreakStatement */: - case 206 /* ContinueStatement */: - case 204 /* ForInStatement */: - case 205 /* ForOfStatement */: - case 203 /* ForStatement */: - case 202 /* WhileStatement */: - case 209 /* WithStatement */: - case 198 /* EmptyStatement */: - case 213 /* TryStatement */: - case 211 /* LabeledStatement */: - case 201 /* DoStatement */: - case 214 /* DebuggerStatement */: - case 226 /* ImportDeclaration */: - case 225 /* ImportEqualsDeclaration */: - case 232 /* ExportDeclaration */: - case 231 /* ExportAssignment */: - case 222 /* ModuleDeclaration */: - case 218 /* ClassDeclaration */: - case 219 /* InterfaceDeclaration */: - case 221 /* EnumDeclaration */: - case 220 /* TypeAliasDeclaration */: + case 219 /* FunctionDeclaration */: + case 199 /* VariableStatement */: + case 198 /* Block */: + case 202 /* IfStatement */: + case 201 /* ExpressionStatement */: + case 214 /* ThrowStatement */: + case 210 /* ReturnStatement */: + case 212 /* SwitchStatement */: + case 209 /* BreakStatement */: + case 208 /* ContinueStatement */: + case 206 /* ForInStatement */: + case 207 /* ForOfStatement */: + case 205 /* ForStatement */: + case 204 /* WhileStatement */: + case 211 /* WithStatement */: + case 200 /* EmptyStatement */: + case 215 /* TryStatement */: + case 213 /* LabeledStatement */: + case 203 /* DoStatement */: + case 216 /* DebuggerStatement */: + case 229 /* ImportDeclaration */: + case 228 /* ImportEqualsDeclaration */: + case 235 /* ExportDeclaration */: + case 234 /* ExportAssignment */: + case 224 /* ModuleDeclaration */: + case 220 /* ClassDeclaration */: + case 221 /* InterfaceDeclaration */: + case 223 /* EnumDeclaration */: + case 222 /* TypeAliasDeclaration */: return true; } } return false; } function isReusableEnumMember(node) { - return node.kind === 251 /* EnumMember */; + return node.kind === 254 /* EnumMember */; } function isReusableTypeMember(node) { if (node) { switch (node.kind) { - case 150 /* ConstructSignature */: - case 144 /* MethodSignature */: - case 151 /* IndexSignature */: - case 142 /* PropertySignature */: - case 149 /* CallSignature */: + case 151 /* ConstructSignature */: + case 145 /* MethodSignature */: + case 152 /* IndexSignature */: + case 143 /* PropertySignature */: + case 150 /* CallSignature */: return true; } } return false; } function isReusableVariableDeclaration(node) { - if (node.kind !== 215 /* VariableDeclaration */) { + if (node.kind !== 217 /* VariableDeclaration */) { return false; } // Very subtle incremental parsing bug. Consider the following code: @@ -8716,7 +8918,7 @@ var ts; return variableDeclarator.initializer === undefined; } function isReusableParameter(node) { - if (node.kind !== 140 /* Parameter */) { + if (node.kind !== 141 /* Parameter */) { return false; } // See the comment in isReusableVariableDeclaration for why we do this. @@ -8833,7 +9035,7 @@ var ts; function parseEntityName(allowReservedWords, diagnosticMessage) { var entity = parseIdentifier(diagnosticMessage); while (parseOptional(21 /* DotToken */)) { - var node = createNode(137 /* QualifiedName */, entity.pos); + var node = createNode(138 /* QualifiedName */, entity.pos); node.left = entity; node.right = parseRightSideOfDot(allowReservedWords); entity = finishNode(node); @@ -8872,7 +9074,7 @@ var ts; return allowIdentifierNames ? parseIdentifierName() : parseIdentifier(); } function parseTemplateExpression() { - var template = createNode(187 /* TemplateExpression */); + var template = createNode(188 /* TemplateExpression */); template.head = parseTemplateLiteralFragment(); ts.Debug.assert(template.head.kind === 12 /* TemplateHead */, "Template head has wrong token kind"); var templateSpans = []; @@ -8885,7 +9087,7 @@ var ts; return finishNode(template); } function parseTemplateSpan() { - var span = createNode(194 /* TemplateSpan */); + var span = createNode(196 /* TemplateSpan */); span.expression = allowInAnd(parseExpression); var literal; if (token === 16 /* CloseBraceToken */) { @@ -8899,7 +9101,7 @@ var ts; return finishNode(span); } function parseStringLiteralTypeNode() { - return parseLiteralLikeNode(164 /* StringLiteralType */, /*internName*/ true); + return parseLiteralLikeNode(165 /* StringLiteralType */, /*internName*/ true); } function parseLiteralNode(internName) { return parseLiteralLikeNode(token, internName); @@ -8936,7 +9138,7 @@ var ts; // TYPES function parseTypeReference() { var typeName = parseEntityName(/*allowReservedWords*/ false, ts.Diagnostics.Type_expected); - var node = createNode(153 /* TypeReference */, typeName.pos); + var node = createNode(154 /* TypeReference */, typeName.pos); node.typeName = typeName; if (!scanner.hasPrecedingLineBreak() && token === 25 /* LessThanToken */) { node.typeArguments = parseBracketedList(18 /* TypeArguments */, parseType, 25 /* LessThanToken */, 27 /* GreaterThanToken */); @@ -8945,24 +9147,24 @@ var ts; } function parseThisTypePredicate(lhs) { nextToken(); - var node = createNode(152 /* TypePredicate */, lhs.pos); + var node = createNode(153 /* TypePredicate */, lhs.pos); node.parameterName = lhs; node.type = parseType(); return finishNode(node); } function parseThisTypeNode() { - var node = createNode(163 /* ThisType */); + var node = createNode(164 /* ThisType */); nextToken(); return finishNode(node); } function parseTypeQuery() { - var node = createNode(156 /* TypeQuery */); + var node = createNode(157 /* TypeQuery */); parseExpected(101 /* TypeOfKeyword */); node.exprName = parseEntityName(/*allowReservedWords*/ true); return finishNode(node); } function parseTypeParameter() { - var node = createNode(139 /* TypeParameter */); + var node = createNode(140 /* TypeParameter */); node.name = parseIdentifier(); if (parseOptional(83 /* ExtendsKeyword */)) { // It's not uncommon for people to write improper constraints to a generic. If the @@ -8997,7 +9199,7 @@ var ts; return undefined; } function isStartOfParameter() { - return token === 22 /* DotDotDotToken */ || isIdentifierOrPattern() || ts.isModifierKind(token) || token === 55 /* AtToken */; + return token === 22 /* DotDotDotToken */ || isIdentifierOrPattern() || ts.isModifierKind(token) || token === 55 /* AtToken */ || token === 97 /* ThisKeyword */; } function setModifiers(node, modifiers) { if (modifiers) { @@ -9006,7 +9208,12 @@ var ts; } } function parseParameter() { - var node = createNode(140 /* Parameter */); + var node = createNode(141 /* Parameter */); + if (token === 97 /* ThisKeyword */) { + node.name = createIdentifier(/*isIdentifier*/ true, undefined); + node.type = parseParameterType(); + return finishNode(node); + } node.decorators = parseDecorators(); setModifiers(node, parseModifiers()); node.dotDotDotToken = parseOptionalToken(22 /* DotDotDotToken */); @@ -9100,7 +9307,7 @@ var ts; } function parseSignatureMember(kind) { var node = createNode(kind); - if (kind === 150 /* ConstructSignature */) { + if (kind === 151 /* ConstructSignature */) { parseExpected(92 /* NewKeyword */); } fillSignature(54 /* ColonToken */, /*yieldContext*/ false, /*awaitContext*/ false, /*requireCompleteParameterList*/ false, node); @@ -9164,7 +9371,7 @@ var ts; return token === 54 /* ColonToken */ || token === 24 /* CommaToken */ || token === 20 /* CloseBracketToken */; } function parseIndexSignatureDeclaration(fullStart, decorators, modifiers) { - var node = createNode(151 /* IndexSignature */, fullStart); + var node = createNode(152 /* IndexSignature */, fullStart); node.decorators = decorators; setModifiers(node, modifiers); node.parameters = parseBracketedList(16 /* Parameters */, parseParameter, 19 /* OpenBracketToken */, 20 /* CloseBracketToken */); @@ -9176,7 +9383,7 @@ var ts; var name = parsePropertyName(); var questionToken = parseOptionalToken(53 /* QuestionToken */); if (token === 17 /* OpenParenToken */ || token === 25 /* LessThanToken */) { - var method = createNode(144 /* MethodSignature */, fullStart); + var method = createNode(145 /* MethodSignature */, fullStart); setModifiers(method, modifiers); method.name = name; method.questionToken = questionToken; @@ -9187,7 +9394,7 @@ var ts; return finishNode(method); } else { - var property = createNode(142 /* PropertySignature */, fullStart); + var property = createNode(143 /* PropertySignature */, fullStart); setModifiers(property, modifiers); property.name = name; property.questionToken = questionToken; @@ -9235,10 +9442,10 @@ var ts; } function parseTypeMember() { if (token === 17 /* OpenParenToken */ || token === 25 /* LessThanToken */) { - return parseSignatureMember(149 /* CallSignature */); + return parseSignatureMember(150 /* CallSignature */); } if (token === 92 /* NewKeyword */ && lookAhead(isStartOfConstructSignature)) { - return parseSignatureMember(150 /* ConstructSignature */); + return parseSignatureMember(151 /* ConstructSignature */); } var fullStart = getNodePos(); var modifiers = parseModifiers(); @@ -9252,7 +9459,7 @@ var ts; return token === 17 /* OpenParenToken */ || token === 25 /* LessThanToken */; } function parseTypeLiteral() { - var node = createNode(157 /* TypeLiteral */); + var node = createNode(158 /* TypeLiteral */); node.members = parseObjectTypeMembers(); return finishNode(node); } @@ -9268,12 +9475,12 @@ var ts; return members; } function parseTupleType() { - var node = createNode(159 /* TupleType */); + var node = createNode(160 /* TupleType */); node.elementTypes = parseBracketedList(19 /* TupleElementTypes */, parseType, 19 /* OpenBracketToken */, 20 /* CloseBracketToken */); return finishNode(node); } function parseParenthesizedType() { - var node = createNode(162 /* ParenthesizedType */); + var node = createNode(163 /* ParenthesizedType */); parseExpected(17 /* OpenParenToken */); node.type = parseType(); parseExpected(18 /* CloseParenToken */); @@ -9281,7 +9488,7 @@ var ts; } function parseFunctionOrConstructorType(kind) { var node = createNode(kind); - if (kind === 155 /* ConstructorType */) { + if (kind === 156 /* ConstructorType */) { parseExpected(92 /* NewKeyword */); } fillSignature(34 /* EqualsGreaterThanToken */, /*yieldContext*/ false, /*awaitContext*/ false, /*requireCompleteParameterList*/ false, node); @@ -9298,12 +9505,14 @@ var ts; case 129 /* NumberKeyword */: case 120 /* BooleanKeyword */: case 132 /* SymbolKeyword */: + case 134 /* UndefinedKeyword */: // 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 */: return parseStringLiteralTypeNode(); case 103 /* VoidKeyword */: + case 93 /* NullKeyword */: return parseTokenNode(); case 97 /* ThisKeyword */: { var thisKeyword = parseThisTypeNode(); @@ -9334,6 +9543,8 @@ var ts; case 120 /* BooleanKeyword */: case 132 /* SymbolKeyword */: case 103 /* VoidKeyword */: + case 134 /* UndefinedKeyword */: + case 93 /* NullKeyword */: case 97 /* ThisKeyword */: case 101 /* TypeOfKeyword */: case 15 /* OpenBraceToken */: @@ -9358,7 +9569,7 @@ var ts; var type = parseNonArrayType(); while (!scanner.hasPrecedingLineBreak() && parseOptional(19 /* OpenBracketToken */)) { parseExpected(20 /* CloseBracketToken */); - var node = createNode(158 /* ArrayType */, type.pos); + var node = createNode(159 /* ArrayType */, type.pos); node.elementType = type; type = finishNode(node); } @@ -9380,10 +9591,10 @@ var ts; return type; } function parseIntersectionTypeOrHigher() { - return parseUnionOrIntersectionType(161 /* IntersectionType */, parseArrayTypeOrHigher, 46 /* AmpersandToken */); + return parseUnionOrIntersectionType(162 /* IntersectionType */, parseArrayTypeOrHigher, 46 /* AmpersandToken */); } function parseUnionTypeOrHigher() { - return parseUnionOrIntersectionType(160 /* UnionType */, parseIntersectionTypeOrHigher, 47 /* BarToken */); + return parseUnionOrIntersectionType(161 /* UnionType */, parseIntersectionTypeOrHigher, 47 /* BarToken */); } function isStartOfFunctionType() { if (token === 25 /* LessThanToken */) { @@ -9396,7 +9607,7 @@ var ts; // Skip modifiers parseModifiers(); } - if (isIdentifier()) { + if (isIdentifier() || token === 97 /* ThisKeyword */) { nextToken(); return true; } @@ -9440,7 +9651,7 @@ var ts; var typePredicateVariable = isIdentifier() && tryParse(parseTypePredicatePrefix); var type = parseType(); if (typePredicateVariable) { - var node = createNode(152 /* TypePredicate */, typePredicateVariable.pos); + var node = createNode(153 /* TypePredicate */, typePredicateVariable.pos); node.parameterName = typePredicateVariable; node.type = type; return finishNode(node); @@ -9463,10 +9674,10 @@ var ts; } function parseTypeWorker() { if (isStartOfFunctionType()) { - return parseFunctionOrConstructorType(154 /* FunctionType */); + return parseFunctionOrConstructorType(155 /* FunctionType */); } if (token === 92 /* NewKeyword */) { - return parseFunctionOrConstructorType(155 /* ConstructorType */); + return parseFunctionOrConstructorType(156 /* ConstructorType */); } return parseUnionTypeOrHigher(); } @@ -9659,7 +9870,7 @@ var ts; return !scanner.hasPrecedingLineBreak() && isIdentifier(); } function parseYieldExpression() { - var node = createNode(188 /* YieldExpression */); + var node = createNode(189 /* YieldExpression */); // YieldExpression[In] : // yield // yield [no LineTerminator here] [Lexical goal InputElementRegExp]AssignmentExpression[?In, Yield] @@ -9679,8 +9890,8 @@ var ts; } function parseSimpleArrowFunctionExpression(identifier) { ts.Debug.assert(token === 34 /* EqualsGreaterThanToken */, "parseSimpleArrowFunctionExpression should only have been called if we had a =>"); - var node = createNode(178 /* ArrowFunction */, identifier.pos); - var parameter = createNode(140 /* Parameter */, identifier.pos); + var node = createNode(179 /* ArrowFunction */, identifier.pos); + var parameter = createNode(141 /* Parameter */, identifier.pos); parameter.name = identifier; finishNode(parameter); node.parameters = [parameter]; @@ -9832,7 +10043,7 @@ var ts; return parseParenthesizedArrowFunctionExpressionHead(/*allowAmbiguity*/ false); } function parseParenthesizedArrowFunctionExpressionHead(allowAmbiguity) { - var node = createNode(178 /* ArrowFunction */); + var node = createNode(179 /* ArrowFunction */); setModifiers(node, parseModifiersForArrowFunction()); var isAsync = !!(node.flags & 256 /* Async */); // Arrow functions are never generators. @@ -9898,7 +10109,7 @@ var ts; } // Note: we explicitly 'allowIn' in the whenTrue part of the condition expression, and // we do not that for the 'whenFalse' part. - var node = createNode(186 /* ConditionalExpression */, leftOperand.pos); + var node = createNode(187 /* ConditionalExpression */, leftOperand.pos); node.condition = leftOperand; node.questionToken = questionToken; node.whenTrue = doOutsideOfContext(disallowInAndDecoratorContext, parseAssignmentExpressionOrHigher); @@ -9911,7 +10122,7 @@ var ts; return parseBinaryExpressionRest(precedence, leftOperand); } function isInOrOfKeyword(t) { - return t === 90 /* InKeyword */ || t === 136 /* OfKeyword */; + return t === 90 /* InKeyword */ || t === 137 /* OfKeyword */; } function parseBinaryExpressionRest(precedence, leftOperand) { while (true) { @@ -10019,39 +10230,39 @@ var ts; return -1; } function makeBinaryExpression(left, operatorToken, right) { - var node = createNode(185 /* BinaryExpression */, left.pos); + var node = createNode(186 /* BinaryExpression */, left.pos); node.left = left; node.operatorToken = operatorToken; node.right = right; return finishNode(node); } function makeAsExpression(left, right) { - var node = createNode(193 /* AsExpression */, left.pos); + var node = createNode(194 /* AsExpression */, left.pos); node.expression = left; node.type = right; return finishNode(node); } function parsePrefixUnaryExpression() { - var node = createNode(183 /* PrefixUnaryExpression */); + var node = createNode(184 /* PrefixUnaryExpression */); node.operator = token; nextToken(); node.operand = parseSimpleUnaryExpression(); return finishNode(node); } function parseDeleteExpression() { - var node = createNode(179 /* DeleteExpression */); + var node = createNode(180 /* DeleteExpression */); nextToken(); node.expression = parseSimpleUnaryExpression(); return finishNode(node); } function parseTypeOfExpression() { - var node = createNode(180 /* TypeOfExpression */); + var node = createNode(181 /* TypeOfExpression */); nextToken(); node.expression = parseSimpleUnaryExpression(); return finishNode(node); } function parseVoidExpression() { - var node = createNode(181 /* VoidExpression */); + var node = createNode(182 /* VoidExpression */); nextToken(); node.expression = parseSimpleUnaryExpression(); return finishNode(node); @@ -10067,7 +10278,7 @@ var ts; return false; } function parseAwaitExpression() { - var node = createNode(182 /* AwaitExpression */); + var node = createNode(183 /* AwaitExpression */); nextToken(); node.expression = parseSimpleUnaryExpression(); return finishNode(node); @@ -10093,7 +10304,7 @@ var ts; var simpleUnaryExpression = parseSimpleUnaryExpression(); if (token === 38 /* AsteriskAsteriskToken */) { var start = ts.skipTrivia(sourceText, simpleUnaryExpression.pos); - if (simpleUnaryExpression.kind === 175 /* TypeAssertionExpression */) { + if (simpleUnaryExpression.kind === 176 /* 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 { @@ -10183,7 +10394,7 @@ var ts; */ function parseIncrementExpression() { if (token === 41 /* PlusPlusToken */ || token === 42 /* MinusMinusToken */) { - var node = createNode(183 /* PrefixUnaryExpression */); + var node = createNode(184 /* PrefixUnaryExpression */); node.operator = token; nextToken(); node.operand = parseLeftHandSideExpressionOrHigher(); @@ -10196,7 +10407,7 @@ var ts; var expression = parseLeftHandSideExpressionOrHigher(); ts.Debug.assert(ts.isLeftHandSideExpression(expression)); if ((token === 41 /* PlusPlusToken */ || token === 42 /* MinusMinusToken */) && !scanner.hasPrecedingLineBreak()) { - var node = createNode(184 /* PostfixUnaryExpression */, expression.pos); + var node = createNode(185 /* PostfixUnaryExpression */, expression.pos); node.operand = expression; node.operator = token; nextToken(); @@ -10300,7 +10511,7 @@ var ts; } // 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(170 /* PropertyAccessExpression */, expression.pos); + var node = createNode(171 /* PropertyAccessExpression */, expression.pos); node.expression = expression; node.dotToken = parseExpectedToken(21 /* DotToken */, /*reportAtCurrentPosition*/ false, ts.Diagnostics.super_must_be_followed_by_an_argument_list_or_member_access); node.name = parseRightSideOfDot(/*allowIdentifierNames*/ true); @@ -10319,8 +10530,8 @@ var ts; function parseJsxElementOrSelfClosingElement(inExpressionContext) { var opening = parseJsxOpeningOrSelfClosingElement(inExpressionContext); var result; - if (opening.kind === 239 /* JsxOpeningElement */) { - var node = createNode(237 /* JsxElement */, opening.pos); + if (opening.kind === 242 /* JsxOpeningElement */) { + var node = createNode(240 /* JsxElement */, opening.pos); node.openingElement = opening; node.children = parseJsxChildren(node.openingElement.tagName); node.closingElement = parseJsxClosingElement(inExpressionContext); @@ -10330,7 +10541,7 @@ var ts; result = finishNode(node); } else { - ts.Debug.assert(opening.kind === 238 /* JsxSelfClosingElement */); + ts.Debug.assert(opening.kind === 241 /* JsxSelfClosingElement */); // Nothing else to do for self-closing elements result = opening; } @@ -10345,7 +10556,7 @@ var ts; var invalidElement = tryParse(function () { return parseJsxElementOrSelfClosingElement(/*inExpressionContext*/ true); }); if (invalidElement) { parseErrorAtCurrentToken(ts.Diagnostics.JSX_expressions_must_have_one_parent_element); - var badNode = createNode(185 /* BinaryExpression */, result.pos); + var badNode = createNode(186 /* BinaryExpression */, result.pos); badNode.end = invalidElement.end; badNode.left = result; badNode.right = invalidElement; @@ -10357,13 +10568,13 @@ var ts; return result; } function parseJsxText() { - var node = createNode(240 /* JsxText */, scanner.getStartPos()); + var node = createNode(243 /* JsxText */, scanner.getStartPos()); token = scanner.scanJsxToken(); return finishNode(node); } function parseJsxChild() { switch (token) { - case 240 /* JsxText */: + case 243 /* JsxText */: return parseJsxText(); case 15 /* OpenBraceToken */: return parseJsxExpression(/*inExpressionContext*/ false); @@ -10405,7 +10616,7 @@ var ts; // 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(239 /* JsxOpeningElement */, fullStart); + node = createNode(242 /* JsxOpeningElement */, fullStart); scanJsxText(); } else { @@ -10417,7 +10628,7 @@ var ts; parseExpected(27 /* GreaterThanToken */, /*diagnostic*/ undefined, /*shouldAdvance*/ false); scanJsxText(); } - node = createNode(238 /* JsxSelfClosingElement */, fullStart); + node = createNode(241 /* JsxSelfClosingElement */, fullStart); } node.tagName = tagName; node.attributes = attributes; @@ -10428,7 +10639,7 @@ var ts; var elementName = parseIdentifierName(); while (parseOptional(21 /* DotToken */)) { scanJsxIdentifier(); - var node = createNode(137 /* QualifiedName */, elementName.pos); + var node = createNode(138 /* QualifiedName */, elementName.pos); node.left = elementName; node.right = parseIdentifierName(); elementName = finishNode(node); @@ -10436,7 +10647,7 @@ var ts; return elementName; } function parseJsxExpression(inExpressionContext) { - var node = createNode(244 /* JsxExpression */); + var node = createNode(247 /* JsxExpression */); parseExpected(15 /* OpenBraceToken */); if (token !== 16 /* CloseBraceToken */) { node.expression = parseAssignmentExpressionOrHigher(); @@ -10455,7 +10666,7 @@ var ts; return parseJsxSpreadAttribute(); } scanJsxIdentifier(); - var node = createNode(242 /* JsxAttribute */); + var node = createNode(245 /* JsxAttribute */); node.name = parseIdentifierName(); if (parseOptional(56 /* EqualsToken */)) { switch (token) { @@ -10470,7 +10681,7 @@ var ts; return finishNode(node); } function parseJsxSpreadAttribute() { - var node = createNode(243 /* JsxSpreadAttribute */); + var node = createNode(246 /* JsxSpreadAttribute */); parseExpected(15 /* OpenBraceToken */); parseExpected(22 /* DotDotDotToken */); node.expression = parseExpression(); @@ -10478,7 +10689,7 @@ var ts; return finishNode(node); } function parseJsxClosingElement(inExpressionContext) { - var node = createNode(241 /* JsxClosingElement */); + var node = createNode(244 /* JsxClosingElement */); parseExpected(26 /* LessThanSlashToken */); node.tagName = parseJsxElementName(); if (inExpressionContext) { @@ -10491,7 +10702,7 @@ var ts; return finishNode(node); } function parseTypeAssertion() { - var node = createNode(175 /* TypeAssertionExpression */); + var node = createNode(176 /* TypeAssertionExpression */); parseExpected(25 /* LessThanToken */); node.type = parseType(); parseExpected(27 /* GreaterThanToken */); @@ -10502,16 +10713,23 @@ var ts; while (true) { var dotToken = parseOptionalToken(21 /* DotToken */); if (dotToken) { - var propertyAccess = createNode(170 /* PropertyAccessExpression */, expression.pos); + var propertyAccess = createNode(171 /* PropertyAccessExpression */, expression.pos); propertyAccess.expression = expression; propertyAccess.dotToken = dotToken; propertyAccess.name = parseRightSideOfDot(/*allowIdentifierNames*/ true); expression = finishNode(propertyAccess); continue; } + if (token === 49 /* ExclamationToken */ && !scanner.hasPrecedingLineBreak()) { + nextToken(); + var nonNullExpression = createNode(195 /* 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(171 /* ElementAccessExpression */, expression.pos); + var indexedAccess = createNode(172 /* 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. @@ -10527,7 +10745,7 @@ var ts; continue; } if (token === 11 /* NoSubstitutionTemplateLiteral */ || token === 12 /* TemplateHead */) { - var tagExpression = createNode(174 /* TaggedTemplateExpression */, expression.pos); + var tagExpression = createNode(175 /* TaggedTemplateExpression */, expression.pos); tagExpression.tag = expression; tagExpression.template = token === 11 /* NoSubstitutionTemplateLiteral */ ? parseLiteralNode() @@ -10550,7 +10768,7 @@ var ts; if (!typeArguments) { return expression; } - var callExpr = createNode(172 /* CallExpression */, expression.pos); + var callExpr = createNode(173 /* CallExpression */, expression.pos); callExpr.expression = expression; callExpr.typeArguments = typeArguments; callExpr.arguments = parseArgumentList(); @@ -10558,7 +10776,7 @@ var ts; continue; } else if (token === 17 /* OpenParenToken */) { - var callExpr = createNode(172 /* CallExpression */, expression.pos); + var callExpr = createNode(173 /* CallExpression */, expression.pos); callExpr.expression = expression; callExpr.arguments = parseArgumentList(); expression = finishNode(callExpr); @@ -10668,28 +10886,28 @@ var ts; return parseIdentifier(ts.Diagnostics.Expression_expected); } function parseParenthesizedExpression() { - var node = createNode(176 /* ParenthesizedExpression */); + var node = createNode(177 /* ParenthesizedExpression */); parseExpected(17 /* OpenParenToken */); node.expression = allowInAnd(parseExpression); parseExpected(18 /* CloseParenToken */); return finishNode(node); } function parseSpreadElement() { - var node = createNode(189 /* SpreadElementExpression */); + var node = createNode(190 /* SpreadElementExpression */); parseExpected(22 /* DotDotDotToken */); node.expression = parseAssignmentExpressionOrHigher(); return finishNode(node); } function parseArgumentOrArrayLiteralElement() { return token === 22 /* DotDotDotToken */ ? parseSpreadElement() : - token === 24 /* CommaToken */ ? createNode(191 /* OmittedExpression */) : + token === 24 /* CommaToken */ ? createNode(192 /* OmittedExpression */) : parseAssignmentExpressionOrHigher(); } function parseArgumentExpression() { return doOutsideOfContext(disallowInAndDecoratorContext, parseArgumentOrArrayLiteralElement); } function parseArrayLiteralExpression() { - var node = createNode(168 /* ArrayLiteralExpression */); + var node = createNode(169 /* ArrayLiteralExpression */); parseExpected(19 /* OpenBracketToken */); if (scanner.hasPrecedingLineBreak()) { node.multiLine = true; @@ -10700,10 +10918,10 @@ var ts; } function tryParseAccessorDeclaration(fullStart, decorators, modifiers) { if (parseContextualModifier(123 /* GetKeyword */)) { - return parseAccessorDeclaration(147 /* GetAccessor */, fullStart, decorators, modifiers); + return addJSDocComment(parseAccessorDeclaration(148 /* GetAccessor */, fullStart, decorators, modifiers)); } else if (parseContextualModifier(130 /* SetKeyword */)) { - return parseAccessorDeclaration(148 /* SetAccessor */, fullStart, decorators, modifiers); + return parseAccessorDeclaration(149 /* SetAccessor */, fullStart, decorators, modifiers); } return undefined; } @@ -10730,7 +10948,7 @@ var ts; // 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 */); if (isShorthandPropertyAssignment) { - var shorthandDeclaration = createNode(250 /* ShorthandPropertyAssignment */, fullStart); + var shorthandDeclaration = createNode(253 /* ShorthandPropertyAssignment */, fullStart); shorthandDeclaration.name = propertyName; shorthandDeclaration.questionToken = questionToken; var equalsToken = parseOptionalToken(56 /* EqualsToken */); @@ -10741,7 +10959,7 @@ var ts; return addJSDocComment(finishNode(shorthandDeclaration)); } else { - var propertyAssignment = createNode(249 /* PropertyAssignment */, fullStart); + var propertyAssignment = createNode(252 /* PropertyAssignment */, fullStart); propertyAssignment.modifiers = modifiers; propertyAssignment.name = propertyName; propertyAssignment.questionToken = questionToken; @@ -10751,7 +10969,7 @@ var ts; } } function parseObjectLiteralExpression() { - var node = createNode(169 /* ObjectLiteralExpression */); + var node = createNode(170 /* ObjectLiteralExpression */); parseExpected(15 /* OpenBraceToken */); if (scanner.hasPrecedingLineBreak()) { node.multiLine = true; @@ -10770,7 +10988,7 @@ var ts; if (saveDecoratorContext) { setDecoratorContext(/*val*/ false); } - var node = createNode(177 /* FunctionExpression */); + var node = createNode(178 /* FunctionExpression */); setModifiers(node, parseModifiers()); parseExpected(87 /* FunctionKeyword */); node.asteriskToken = parseOptionalToken(37 /* AsteriskToken */); @@ -10792,7 +11010,7 @@ var ts; return isIdentifier() ? parseIdentifier() : undefined; } function parseNewExpression() { - var node = createNode(173 /* NewExpression */); + var node = createNode(174 /* NewExpression */); parseExpected(92 /* NewKeyword */); node.expression = parseMemberExpressionOrHigher(); node.typeArguments = tryParse(parseTypeArgumentsInExpression); @@ -10803,7 +11021,7 @@ var ts; } // STATEMENTS function parseBlock(ignoreMissingOpenBrace, diagnosticMessage) { - var node = createNode(196 /* Block */); + var node = createNode(198 /* Block */); if (parseExpected(15 /* OpenBraceToken */, diagnosticMessage) || ignoreMissingOpenBrace) { node.statements = parseList(1 /* BlockStatements */, parseStatement); parseExpected(16 /* CloseBraceToken */); @@ -10833,12 +11051,12 @@ var ts; return block; } function parseEmptyStatement() { - var node = createNode(198 /* EmptyStatement */); + var node = createNode(200 /* EmptyStatement */); parseExpected(23 /* SemicolonToken */); return finishNode(node); } function parseIfStatement() { - var node = createNode(200 /* IfStatement */); + var node = createNode(202 /* IfStatement */); parseExpected(88 /* IfKeyword */); parseExpected(17 /* OpenParenToken */); node.expression = allowInAnd(parseExpression); @@ -10848,7 +11066,7 @@ var ts; return finishNode(node); } function parseDoStatement() { - var node = createNode(201 /* DoStatement */); + var node = createNode(203 /* DoStatement */); parseExpected(79 /* DoKeyword */); node.statement = parseStatement(); parseExpected(104 /* WhileKeyword */); @@ -10863,7 +11081,7 @@ var ts; return finishNode(node); } function parseWhileStatement() { - var node = createNode(202 /* WhileStatement */); + var node = createNode(204 /* WhileStatement */); parseExpected(104 /* WhileKeyword */); parseExpected(17 /* OpenParenToken */); node.expression = allowInAnd(parseExpression); @@ -10886,21 +11104,21 @@ var ts; } var forOrForInOrForOfStatement; if (parseOptional(90 /* InKeyword */)) { - var forInStatement = createNode(204 /* ForInStatement */, pos); + var forInStatement = createNode(206 /* ForInStatement */, pos); forInStatement.initializer = initializer; forInStatement.expression = allowInAnd(parseExpression); parseExpected(18 /* CloseParenToken */); forOrForInOrForOfStatement = forInStatement; } - else if (parseOptional(136 /* OfKeyword */)) { - var forOfStatement = createNode(205 /* ForOfStatement */, pos); + else if (parseOptional(137 /* OfKeyword */)) { + var forOfStatement = createNode(207 /* ForOfStatement */, pos); forOfStatement.initializer = initializer; forOfStatement.expression = allowInAnd(parseAssignmentExpressionOrHigher); parseExpected(18 /* CloseParenToken */); forOrForInOrForOfStatement = forOfStatement; } else { - var forStatement = createNode(203 /* ForStatement */, pos); + var forStatement = createNode(205 /* ForStatement */, pos); forStatement.initializer = initializer; parseExpected(23 /* SemicolonToken */); if (token !== 23 /* SemicolonToken */ && token !== 18 /* CloseParenToken */) { @@ -10918,7 +11136,7 @@ var ts; } function parseBreakOrContinueStatement(kind) { var node = createNode(kind); - parseExpected(kind === 207 /* BreakStatement */ ? 70 /* BreakKeyword */ : 75 /* ContinueKeyword */); + parseExpected(kind === 209 /* BreakStatement */ ? 70 /* BreakKeyword */ : 75 /* ContinueKeyword */); if (!canParseSemicolon()) { node.label = parseIdentifier(); } @@ -10926,7 +11144,7 @@ var ts; return finishNode(node); } function parseReturnStatement() { - var node = createNode(208 /* ReturnStatement */); + var node = createNode(210 /* ReturnStatement */); parseExpected(94 /* ReturnKeyword */); if (!canParseSemicolon()) { node.expression = allowInAnd(parseExpression); @@ -10935,7 +11153,7 @@ var ts; return finishNode(node); } function parseWithStatement() { - var node = createNode(209 /* WithStatement */); + var node = createNode(211 /* WithStatement */); parseExpected(105 /* WithKeyword */); parseExpected(17 /* OpenParenToken */); node.expression = allowInAnd(parseExpression); @@ -10944,7 +11162,7 @@ var ts; return finishNode(node); } function parseCaseClause() { - var node = createNode(245 /* CaseClause */); + var node = createNode(248 /* CaseClause */); parseExpected(71 /* CaseKeyword */); node.expression = allowInAnd(parseExpression); parseExpected(54 /* ColonToken */); @@ -10952,7 +11170,7 @@ var ts; return finishNode(node); } function parseDefaultClause() { - var node = createNode(246 /* DefaultClause */); + var node = createNode(249 /* DefaultClause */); parseExpected(77 /* DefaultKeyword */); parseExpected(54 /* ColonToken */); node.statements = parseList(3 /* SwitchClauseStatements */, parseStatement); @@ -10962,12 +11180,12 @@ var ts; return token === 71 /* CaseKeyword */ ? parseCaseClause() : parseDefaultClause(); } function parseSwitchStatement() { - var node = createNode(210 /* SwitchStatement */); + var node = createNode(212 /* SwitchStatement */); parseExpected(96 /* SwitchKeyword */); parseExpected(17 /* OpenParenToken */); node.expression = allowInAnd(parseExpression); parseExpected(18 /* CloseParenToken */); - var caseBlock = createNode(224 /* CaseBlock */, scanner.getStartPos()); + var caseBlock = createNode(226 /* CaseBlock */, scanner.getStartPos()); parseExpected(15 /* OpenBraceToken */); caseBlock.clauses = parseList(2 /* SwitchClauses */, parseCaseOrDefaultClause); parseExpected(16 /* CloseBraceToken */); @@ -10982,7 +11200,7 @@ 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(212 /* ThrowStatement */); + var node = createNode(214 /* ThrowStatement */); parseExpected(98 /* ThrowKeyword */); node.expression = scanner.hasPrecedingLineBreak() ? undefined : allowInAnd(parseExpression); parseSemicolon(); @@ -10990,7 +11208,7 @@ var ts; } // TODO: Review for error recovery function parseTryStatement() { - var node = createNode(213 /* TryStatement */); + var node = createNode(215 /* TryStatement */); parseExpected(100 /* TryKeyword */); node.tryBlock = parseBlock(/*ignoreMissingOpenBrace*/ false); node.catchClause = token === 72 /* CatchKeyword */ ? parseCatchClause() : undefined; @@ -11003,7 +11221,7 @@ var ts; return finishNode(node); } function parseCatchClause() { - var result = createNode(248 /* CatchClause */); + var result = createNode(251 /* CatchClause */); parseExpected(72 /* CatchKeyword */); if (parseExpected(17 /* OpenParenToken */)) { result.variableDeclaration = parseVariableDeclaration(); @@ -11013,7 +11231,7 @@ var ts; return finishNode(result); } function parseDebuggerStatement() { - var node = createNode(214 /* DebuggerStatement */); + var node = createNode(216 /* DebuggerStatement */); parseExpected(76 /* DebuggerKeyword */); parseSemicolon(); return finishNode(node); @@ -11025,13 +11243,13 @@ var ts; var fullStart = scanner.getStartPos(); var expression = allowInAnd(parseExpression); if (expression.kind === 69 /* Identifier */ && parseOptional(54 /* ColonToken */)) { - var labeledStatement = createNode(211 /* LabeledStatement */, fullStart); + var labeledStatement = createNode(213 /* LabeledStatement */, fullStart); labeledStatement.label = expression; labeledStatement.statement = parseStatement(); return addJSDocComment(finishNode(labeledStatement)); } else { - var expressionStatement = createNode(199 /* ExpressionStatement */, fullStart); + var expressionStatement = createNode(201 /* ExpressionStatement */, fullStart); expressionStatement.expression = expression; parseSemicolon(); return addJSDocComment(finishNode(expressionStatement)); @@ -11099,8 +11317,9 @@ var ts; return false; } continue; - case 135 /* GlobalKeyword */: - return nextToken() === 15 /* OpenBraceToken */; + case 136 /* GlobalKeyword */: + nextToken(); + return token === 15 /* OpenBraceToken */ || token === 69 /* Identifier */ || token === 82 /* ExportKeyword */; case 89 /* ImportKeyword */: nextToken(); return token === 9 /* StringLiteral */ || token === 37 /* AsteriskToken */ || @@ -11108,7 +11327,8 @@ var ts; case 82 /* ExportKeyword */: nextToken(); if (token === 56 /* EqualsToken */ || token === 37 /* AsteriskToken */ || - token === 15 /* OpenBraceToken */ || token === 77 /* DefaultKeyword */) { + token === 15 /* OpenBraceToken */ || token === 77 /* DefaultKeyword */ || + token === 116 /* AsKeyword */) { return true; } continue; @@ -11160,7 +11380,7 @@ var ts; case 125 /* ModuleKeyword */: case 126 /* NamespaceKeyword */: case 133 /* TypeKeyword */: - case 135 /* GlobalKeyword */: + case 136 /* GlobalKeyword */: // When these don't start a declaration, they're an identifier in an expression statement return true; case 112 /* PublicKeyword */: @@ -11210,9 +11430,9 @@ var ts; case 86 /* ForKeyword */: return parseForOrForInOrForOfStatement(); case 75 /* ContinueKeyword */: - return parseBreakOrContinueStatement(206 /* ContinueStatement */); + return parseBreakOrContinueStatement(208 /* ContinueStatement */); case 70 /* BreakKeyword */: - return parseBreakOrContinueStatement(207 /* BreakStatement */); + return parseBreakOrContinueStatement(209 /* BreakStatement */); case 94 /* ReturnKeyword */: return parseReturnStatement(); case 105 /* WithKeyword */: @@ -11246,7 +11466,7 @@ var ts; case 115 /* AbstractKeyword */: case 113 /* StaticKeyword */: case 127 /* ReadonlyKeyword */: - case 135 /* GlobalKeyword */: + case 136 /* GlobalKeyword */: if (isStartOfDeclaration()) { return parseDeclaration(); } @@ -11273,7 +11493,7 @@ var ts; return parseTypeAliasDeclaration(fullStart, decorators, modifiers); case 81 /* EnumKeyword */: return parseEnumDeclaration(fullStart, decorators, modifiers); - case 135 /* GlobalKeyword */: + case 136 /* GlobalKeyword */: case 125 /* ModuleKeyword */: case 126 /* NamespaceKeyword */: return parseModuleDeclaration(fullStart, decorators, modifiers); @@ -11281,14 +11501,20 @@ var ts; return parseImportDeclarationOrImportEqualsDeclaration(fullStart, decorators, modifiers); case 82 /* ExportKeyword */: nextToken(); - return token === 77 /* DefaultKeyword */ || token === 56 /* EqualsToken */ ? - parseExportAssignment(fullStart, decorators, modifiers) : - parseExportDeclaration(fullStart, decorators, modifiers); + switch (token) { + case 77 /* DefaultKeyword */: + case 56 /* EqualsToken */: + return parseExportAssignment(fullStart, decorators, modifiers); + case 116 /* AsKeyword */: + return parseGlobalModuleExportDeclaration(fullStart, decorators, modifiers); + default: + return parseExportDeclaration(fullStart, decorators, modifiers); + } default: 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(235 /* MissingDeclaration */, /*reportAtCurrentPosition*/ true, ts.Diagnostics.Declaration_expected); + var node = createMissingNode(238 /* MissingDeclaration */, /*reportAtCurrentPosition*/ true, ts.Diagnostics.Declaration_expected); node.pos = fullStart; node.decorators = decorators; setModifiers(node, modifiers); @@ -11310,16 +11536,16 @@ var ts; // DECLARATIONS function parseArrayBindingElement() { if (token === 24 /* CommaToken */) { - return createNode(191 /* OmittedExpression */); + return createNode(192 /* OmittedExpression */); } - var node = createNode(167 /* BindingElement */); + var node = createNode(168 /* BindingElement */); node.dotDotDotToken = parseOptionalToken(22 /* DotDotDotToken */); node.name = parseIdentifierOrPattern(); node.initializer = parseBindingElementInitializer(/*inParameter*/ false); return finishNode(node); } function parseObjectBindingElement() { - var node = createNode(167 /* BindingElement */); + var node = createNode(168 /* BindingElement */); var tokenIsIdentifier = isIdentifier(); var propertyName = parsePropertyName(); if (tokenIsIdentifier && token !== 54 /* ColonToken */) { @@ -11334,14 +11560,14 @@ var ts; return finishNode(node); } function parseObjectBindingPattern() { - var node = createNode(165 /* ObjectBindingPattern */); + var node = createNode(166 /* ObjectBindingPattern */); parseExpected(15 /* OpenBraceToken */); node.elements = parseDelimitedList(9 /* ObjectBindingElements */, parseObjectBindingElement); parseExpected(16 /* CloseBraceToken */); return finishNode(node); } function parseArrayBindingPattern() { - var node = createNode(166 /* ArrayBindingPattern */); + var node = createNode(167 /* ArrayBindingPattern */); parseExpected(19 /* OpenBracketToken */); node.elements = parseDelimitedList(10 /* ArrayBindingElements */, parseArrayBindingElement); parseExpected(20 /* CloseBracketToken */); @@ -11360,7 +11586,7 @@ var ts; return parseIdentifier(); } function parseVariableDeclaration() { - var node = createNode(215 /* VariableDeclaration */); + var node = createNode(217 /* VariableDeclaration */); node.name = parseIdentifierOrPattern(); node.type = parseTypeAnnotation(); if (!isInOrOfKeyword(token)) { @@ -11369,7 +11595,7 @@ var ts; return finishNode(node); } function parseVariableDeclarationList(inForStatementInitializer) { - var node = createNode(216 /* VariableDeclarationList */); + var node = createNode(218 /* VariableDeclarationList */); switch (token) { case 102 /* VarKeyword */: break; @@ -11392,7 +11618,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 === 136 /* OfKeyword */ && lookAhead(canFollowContextualOfKeyword)) { + if (token === 137 /* OfKeyword */ && lookAhead(canFollowContextualOfKeyword)) { node.declarations = createMissingList(); } else { @@ -11407,7 +11633,7 @@ var ts; return nextTokenIsIdentifier() && nextToken() === 18 /* CloseParenToken */; } function parseVariableStatement(fullStart, decorators, modifiers) { - var node = createNode(197 /* VariableStatement */, fullStart); + var node = createNode(199 /* VariableStatement */, fullStart); node.decorators = decorators; setModifiers(node, modifiers); node.declarationList = parseVariableDeclarationList(/*inForStatementInitializer*/ false); @@ -11415,7 +11641,7 @@ var ts; return addJSDocComment(finishNode(node)); } function parseFunctionDeclaration(fullStart, decorators, modifiers) { - var node = createNode(217 /* FunctionDeclaration */, fullStart); + var node = createNode(219 /* FunctionDeclaration */, fullStart); node.decorators = decorators; setModifiers(node, modifiers); parseExpected(87 /* FunctionKeyword */); @@ -11428,7 +11654,7 @@ var ts; return addJSDocComment(finishNode(node)); } function parseConstructorDeclaration(pos, decorators, modifiers) { - var node = createNode(146 /* Constructor */, pos); + var node = createNode(147 /* Constructor */, pos); node.decorators = decorators; setModifiers(node, modifiers); parseExpected(121 /* ConstructorKeyword */); @@ -11437,7 +11663,7 @@ var ts; return addJSDocComment(finishNode(node)); } function parseMethodDeclaration(fullStart, decorators, modifiers, asteriskToken, name, questionToken, diagnosticMessage) { - var method = createNode(145 /* MethodDeclaration */, fullStart); + var method = createNode(146 /* MethodDeclaration */, fullStart); method.decorators = decorators; setModifiers(method, modifiers); method.asteriskToken = asteriskToken; @@ -11450,7 +11676,7 @@ var ts; return addJSDocComment(finishNode(method)); } function parsePropertyDeclaration(fullStart, decorators, modifiers, name, questionToken) { - var property = createNode(143 /* PropertyDeclaration */, fullStart); + var property = createNode(144 /* PropertyDeclaration */, fullStart); property.decorators = decorators; setModifiers(property, modifiers); property.name = name; @@ -11577,7 +11803,7 @@ var ts; decorators = []; decorators.pos = decoratorStart; } - var decorator = createNode(141 /* Decorator */, decoratorStart); + var decorator = createNode(142 /* Decorator */, decoratorStart); decorator.expression = doInDecoratorContext(parseLeftHandSideExpressionOrHigher); decorators.push(finishNode(decorator)); } @@ -11642,7 +11868,7 @@ var ts; } function parseClassElement() { if (token === 23 /* SemicolonToken */) { - var result = createNode(195 /* SemicolonClassElement */); + var result = createNode(197 /* SemicolonClassElement */); nextToken(); return finishNode(result); } @@ -11680,10 +11906,10 @@ var ts; return parseClassDeclarationOrExpression( /*fullStart*/ scanner.getStartPos(), /*decorators*/ undefined, - /*modifiers*/ undefined, 190 /* ClassExpression */); + /*modifiers*/ undefined, 191 /* ClassExpression */); } function parseClassDeclaration(fullStart, decorators, modifiers) { - return parseClassDeclarationOrExpression(fullStart, decorators, modifiers, 218 /* ClassDeclaration */); + return parseClassDeclarationOrExpression(fullStart, decorators, modifiers, 220 /* ClassDeclaration */); } function parseClassDeclarationOrExpression(fullStart, decorators, modifiers, kind) { var node = createNode(kind, fullStart); @@ -11727,7 +11953,7 @@ var ts; } function parseHeritageClause() { if (token === 83 /* ExtendsKeyword */ || token === 106 /* ImplementsKeyword */) { - var node = createNode(247 /* HeritageClause */); + var node = createNode(250 /* HeritageClause */); node.token = token; nextToken(); node.types = parseDelimitedList(7 /* HeritageClauseElement */, parseExpressionWithTypeArguments); @@ -11736,7 +11962,7 @@ var ts; return undefined; } function parseExpressionWithTypeArguments() { - var node = createNode(192 /* ExpressionWithTypeArguments */); + var node = createNode(193 /* ExpressionWithTypeArguments */); node.expression = parseLeftHandSideExpressionOrHigher(); if (token === 25 /* LessThanToken */) { node.typeArguments = parseBracketedList(18 /* TypeArguments */, parseType, 25 /* LessThanToken */, 27 /* GreaterThanToken */); @@ -11750,7 +11976,7 @@ var ts; return parseList(5 /* ClassMembers */, parseClassElement); } function parseInterfaceDeclaration(fullStart, decorators, modifiers) { - var node = createNode(219 /* InterfaceDeclaration */, fullStart); + var node = createNode(221 /* InterfaceDeclaration */, fullStart); node.decorators = decorators; setModifiers(node, modifiers); parseExpected(107 /* InterfaceKeyword */); @@ -11761,7 +11987,7 @@ var ts; return finishNode(node); } function parseTypeAliasDeclaration(fullStart, decorators, modifiers) { - var node = createNode(220 /* TypeAliasDeclaration */, fullStart); + var node = createNode(222 /* TypeAliasDeclaration */, fullStart); node.decorators = decorators; setModifiers(node, modifiers); parseExpected(133 /* TypeKeyword */); @@ -11777,13 +12003,13 @@ var ts; // ConstantEnumMemberSection, which starts at the beginning of an enum declaration // or any time an integer literal initializer is encountered. function parseEnumMember() { - var node = createNode(251 /* EnumMember */, scanner.getStartPos()); + var node = createNode(254 /* EnumMember */, scanner.getStartPos()); node.name = parsePropertyName(); node.initializer = allowInAnd(parseNonParameterInitializer); return finishNode(node); } function parseEnumDeclaration(fullStart, decorators, modifiers) { - var node = createNode(221 /* EnumDeclaration */, fullStart); + var node = createNode(223 /* EnumDeclaration */, fullStart); node.decorators = decorators; setModifiers(node, modifiers); parseExpected(81 /* EnumKeyword */); @@ -11798,7 +12024,7 @@ var ts; return finishNode(node); } function parseModuleBlock() { - var node = createNode(223 /* ModuleBlock */, scanner.getStartPos()); + var node = createNode(225 /* ModuleBlock */, scanner.getStartPos()); if (parseExpected(15 /* OpenBraceToken */)) { node.statements = parseList(1 /* BlockStatements */, parseStatement); parseExpected(16 /* CloseBraceToken */); @@ -11809,7 +12035,7 @@ var ts; return finishNode(node); } function parseModuleOrNamespaceDeclaration(fullStart, decorators, modifiers, flags) { - var node = createNode(222 /* ModuleDeclaration */, fullStart); + var node = createNode(224 /* 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 */; @@ -11823,10 +12049,10 @@ var ts; return finishNode(node); } function parseAmbientExternalModuleDeclaration(fullStart, decorators, modifiers) { - var node = createNode(222 /* ModuleDeclaration */, fullStart); + var node = createNode(224 /* ModuleDeclaration */, fullStart); node.decorators = decorators; setModifiers(node, modifiers); - if (token === 135 /* GlobalKeyword */) { + if (token === 136 /* GlobalKeyword */) { // parse 'global' as name of global scope augmentation node.name = parseIdentifier(); node.flags |= 131072 /* GlobalAugmentation */; @@ -11839,7 +12065,7 @@ var ts; } function parseModuleDeclaration(fullStart, decorators, modifiers) { var flags = modifiers ? modifiers.flags : 0; - if (token === 135 /* GlobalKeyword */) { + if (token === 136 /* GlobalKeyword */) { // global augmentation return parseAmbientExternalModuleDeclaration(fullStart, decorators, modifiers); } @@ -11864,17 +12090,27 @@ var ts; function nextTokenIsSlash() { return nextToken() === 39 /* SlashToken */; } + function parseGlobalModuleExportDeclaration(fullStart, decorators, modifiers) { + var exportDeclaration = createNode(227 /* GlobalModuleExportDeclaration */, fullStart); + exportDeclaration.decorators = decorators; + exportDeclaration.modifiers = modifiers; + parseExpected(116 /* AsKeyword */); + parseExpected(126 /* NamespaceKeyword */); + exportDeclaration.name = parseIdentifier(); + parseExpected(23 /* SemicolonToken */); + return finishNode(exportDeclaration); + } function parseImportDeclarationOrImportEqualsDeclaration(fullStart, decorators, modifiers) { parseExpected(89 /* ImportKeyword */); var afterImportPos = scanner.getStartPos(); var identifier; if (isIdentifier()) { identifier = parseIdentifier(); - if (token !== 24 /* CommaToken */ && token !== 134 /* FromKeyword */) { + if (token !== 24 /* CommaToken */ && token !== 135 /* FromKeyword */) { // ImportEquals declaration of type: // import x = require("mod"); or // import x = M.x; - var importEqualsDeclaration = createNode(225 /* ImportEqualsDeclaration */, fullStart); + var importEqualsDeclaration = createNode(228 /* ImportEqualsDeclaration */, fullStart); importEqualsDeclaration.decorators = decorators; setModifiers(importEqualsDeclaration, modifiers); importEqualsDeclaration.name = identifier; @@ -11885,7 +12121,7 @@ var ts; } } // Import statement - var importDeclaration = createNode(226 /* ImportDeclaration */, fullStart); + var importDeclaration = createNode(229 /* ImportDeclaration */, fullStart); importDeclaration.decorators = decorators; setModifiers(importDeclaration, modifiers); // ImportDeclaration: @@ -11895,7 +12131,7 @@ var ts; token === 37 /* AsteriskToken */ || token === 15 /* OpenBraceToken */) { importDeclaration.importClause = parseImportClause(identifier, afterImportPos); - parseExpected(134 /* FromKeyword */); + parseExpected(135 /* FromKeyword */); } importDeclaration.moduleSpecifier = parseModuleSpecifier(); parseSemicolon(); @@ -11908,7 +12144,7 @@ var ts; // NamedImports // ImportedDefaultBinding, NameSpaceImport // ImportedDefaultBinding, NamedImports - var importClause = createNode(227 /* ImportClause */, fullStart); + var importClause = createNode(230 /* ImportClause */, fullStart); if (identifier) { // ImportedDefaultBinding: // ImportedBinding @@ -11918,7 +12154,7 @@ var ts; // parse namespace or named imports if (!importClause.name || parseOptional(24 /* CommaToken */)) { - importClause.namedBindings = token === 37 /* AsteriskToken */ ? parseNamespaceImport() : parseNamedImportsOrExports(229 /* NamedImports */); + importClause.namedBindings = token === 37 /* AsteriskToken */ ? parseNamespaceImport() : parseNamedImportsOrExports(232 /* NamedImports */); } return finishNode(importClause); } @@ -11928,7 +12164,7 @@ var ts; : parseEntityName(/*allowReservedWords*/ false); } function parseExternalModuleReference() { - var node = createNode(236 /* ExternalModuleReference */); + var node = createNode(239 /* ExternalModuleReference */); parseExpected(128 /* RequireKeyword */); parseExpected(17 /* OpenParenToken */); node.expression = parseModuleSpecifier(); @@ -11951,7 +12187,7 @@ var ts; function parseNamespaceImport() { // NameSpaceImport: // * as ImportedBinding - var namespaceImport = createNode(228 /* NamespaceImport */); + var namespaceImport = createNode(231 /* NamespaceImport */); parseExpected(37 /* AsteriskToken */); parseExpected(116 /* AsKeyword */); namespaceImport.name = parseIdentifier(); @@ -11966,14 +12202,14 @@ var ts; // ImportsList: // ImportSpecifier // ImportsList, ImportSpecifier - node.elements = parseBracketedList(21 /* ImportOrExportSpecifiers */, kind === 229 /* NamedImports */ ? parseImportSpecifier : parseExportSpecifier, 15 /* OpenBraceToken */, 16 /* CloseBraceToken */); + node.elements = parseBracketedList(21 /* ImportOrExportSpecifiers */, kind === 232 /* NamedImports */ ? parseImportSpecifier : parseExportSpecifier, 15 /* OpenBraceToken */, 16 /* CloseBraceToken */); return finishNode(node); } function parseExportSpecifier() { - return parseImportOrExportSpecifier(234 /* ExportSpecifier */); + return parseImportOrExportSpecifier(237 /* ExportSpecifier */); } function parseImportSpecifier() { - return parseImportOrExportSpecifier(230 /* ImportSpecifier */); + return parseImportOrExportSpecifier(233 /* ImportSpecifier */); } function parseImportOrExportSpecifier(kind) { var node = createNode(kind); @@ -11998,27 +12234,27 @@ var ts; else { node.name = identifierName; } - if (kind === 230 /* ImportSpecifier */ && checkIdentifierIsKeyword) { + if (kind === 233 /* 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(232 /* ExportDeclaration */, fullStart); + var node = createNode(235 /* ExportDeclaration */, fullStart); node.decorators = decorators; setModifiers(node, modifiers); if (parseOptional(37 /* AsteriskToken */)) { - parseExpected(134 /* FromKeyword */); + parseExpected(135 /* FromKeyword */); node.moduleSpecifier = parseModuleSpecifier(); } else { - node.exportClause = parseNamedImportsOrExports(233 /* NamedExports */); + node.exportClause = parseNamedImportsOrExports(236 /* 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 === 134 /* FromKeyword */ || (token === 9 /* StringLiteral */ && !scanner.hasPrecedingLineBreak())) { - parseExpected(134 /* FromKeyword */); + if (token === 135 /* FromKeyword */ || (token === 9 /* StringLiteral */ && !scanner.hasPrecedingLineBreak())) { + parseExpected(135 /* FromKeyword */); node.moduleSpecifier = parseModuleSpecifier(); } } @@ -12026,7 +12262,7 @@ var ts; return finishNode(node); } function parseExportAssignment(fullStart, decorators, modifiers) { - var node = createNode(231 /* ExportAssignment */, fullStart); + var node = createNode(234 /* ExportAssignment */, fullStart); node.decorators = decorators; setModifiers(node, modifiers); if (parseOptional(56 /* EqualsToken */)) { @@ -12042,6 +12278,7 @@ var ts; function processReferenceComments(sourceFile) { var triviaScanner = ts.createScanner(sourceFile.languageVersion, /*skipTrivia*/ false, 0 /* Standard */, sourceText); var referencedFiles = []; + var typeReferenceDirectives = []; var amdDependencies = []; var amdModuleName; // Keep scanning all the leading trivia in the file until we get to something that @@ -12065,7 +12302,12 @@ var ts; sourceFile.hasNoDefaultLib = referencePathMatchResult.isNoDefaultLib; var diagnosticMessage = referencePathMatchResult.diagnosticMessage; if (fileReference) { - referencedFiles.push(fileReference); + if (referencePathMatchResult.isTypeReferenceDirective) { + typeReferenceDirectives.push(fileReference); + } + else { + referencedFiles.push(fileReference); + } } if (diagnosticMessage) { parseDiagnostics.push(ts.createFileDiagnostic(sourceFile, range.pos, range.end - range.pos, diagnosticMessage)); @@ -12095,16 +12337,17 @@ var ts; } } sourceFile.referencedFiles = referencedFiles; + sourceFile.typeReferenceDirectives = typeReferenceDirectives; sourceFile.amdDependencies = amdDependencies; sourceFile.moduleName = amdModuleName; } function setExternalModuleIndicator(sourceFile) { sourceFile.externalModuleIndicator = ts.forEach(sourceFile.statements, function (node) { return node.flags & 1 /* Export */ - || node.kind === 225 /* ImportEqualsDeclaration */ && node.moduleReference.kind === 236 /* ExternalModuleReference */ - || node.kind === 226 /* ImportDeclaration */ - || node.kind === 231 /* ExportAssignment */ - || node.kind === 232 /* ExportDeclaration */ + || node.kind === 228 /* ImportEqualsDeclaration */ && node.moduleReference.kind === 239 /* ExternalModuleReference */ + || node.kind === 229 /* ImportDeclaration */ + || node.kind === 234 /* ExportAssignment */ + || node.kind === 235 /* ExportDeclaration */ ? node : undefined; }); @@ -12177,7 +12420,7 @@ var ts; // Parses out a JSDoc type expression. /* @internal */ function parseJSDocTypeExpression() { - var result = createNode(253 /* JSDocTypeExpression */, scanner.getTokenPos()); + var result = createNode(256 /* JSDocTypeExpression */, scanner.getTokenPos()); parseExpected(15 /* OpenBraceToken */); result.type = parseJSDocTopLevelType(); parseExpected(16 /* CloseBraceToken */); @@ -12188,12 +12431,12 @@ var ts; function parseJSDocTopLevelType() { var type = parseJSDocType(); if (token === 47 /* BarToken */) { - var unionType = createNode(257 /* JSDocUnionType */, type.pos); + var unionType = createNode(260 /* JSDocUnionType */, type.pos); unionType.types = parseJSDocTypeList(type); type = finishNode(unionType); } if (token === 56 /* EqualsToken */) { - var optionalType = createNode(264 /* JSDocOptionalType */, type.pos); + var optionalType = createNode(267 /* JSDocOptionalType */, type.pos); nextToken(); optionalType.type = type; type = finishNode(optionalType); @@ -12204,20 +12447,20 @@ var ts; var type = parseBasicTypeExpression(); while (true) { if (token === 19 /* OpenBracketToken */) { - var arrayType = createNode(256 /* JSDocArrayType */, type.pos); + var arrayType = createNode(259 /* JSDocArrayType */, type.pos); arrayType.elementType = type; nextToken(); parseExpected(20 /* CloseBracketToken */); type = finishNode(arrayType); } else if (token === 53 /* QuestionToken */) { - var nullableType = createNode(259 /* JSDocNullableType */, type.pos); + var nullableType = createNode(262 /* JSDocNullableType */, type.pos); nullableType.type = type; nextToken(); type = finishNode(nullableType); } else if (token === 49 /* ExclamationToken */) { - var nonNullableType = createNode(260 /* JSDocNonNullableType */, type.pos); + var nonNullableType = createNode(263 /* JSDocNonNullableType */, type.pos); nonNullableType.type = type; nextToken(); type = finishNode(nonNullableType); @@ -12262,27 +12505,27 @@ var ts; return parseJSDocTypeReference(); } function parseJSDocThisType() { - var result = createNode(268 /* JSDocThisType */); + var result = createNode(271 /* JSDocThisType */); nextToken(); parseExpected(54 /* ColonToken */); result.type = parseJSDocType(); return finishNode(result); } function parseJSDocConstructorType() { - var result = createNode(267 /* JSDocConstructorType */); + var result = createNode(270 /* JSDocConstructorType */); nextToken(); parseExpected(54 /* ColonToken */); result.type = parseJSDocType(); return finishNode(result); } function parseJSDocVariadicType() { - var result = createNode(266 /* JSDocVariadicType */); + var result = createNode(269 /* JSDocVariadicType */); nextToken(); result.type = parseJSDocType(); return finishNode(result); } function parseJSDocFunctionType() { - var result = createNode(265 /* JSDocFunctionType */); + var result = createNode(268 /* JSDocFunctionType */); nextToken(); parseExpected(17 /* OpenParenToken */); result.parameters = parseDelimitedList(22 /* JSDocFunctionParameters */, parseJSDocParameter); @@ -12295,7 +12538,7 @@ var ts; return finishNode(result); } function parseJSDocParameter() { - var parameter = createNode(140 /* Parameter */); + var parameter = createNode(141 /* Parameter */); parameter.type = parseJSDocType(); if (parseOptional(56 /* EqualsToken */)) { parameter.questionToken = createNode(56 /* EqualsToken */); @@ -12303,7 +12546,7 @@ var ts; return finishNode(parameter); } function parseJSDocTypeReference() { - var result = createNode(263 /* JSDocTypeReference */); + var result = createNode(266 /* JSDocTypeReference */); result.name = parseSimplePropertyName(); if (token === 25 /* LessThanToken */) { result.typeArguments = parseTypeArguments(); @@ -12338,13 +12581,13 @@ var ts; } } function parseQualifiedName(left) { - var result = createNode(137 /* QualifiedName */, left.pos); + var result = createNode(138 /* QualifiedName */, left.pos); result.left = left; result.right = parseIdentifierName(); return finishNode(result); } function parseJSDocRecordType() { - var result = createNode(261 /* JSDocRecordType */); + var result = createNode(264 /* JSDocRecordType */); nextToken(); result.members = parseDelimitedList(24 /* JSDocRecordMembers */, parseJSDocRecordMember); checkForTrailingComma(result.members); @@ -12352,7 +12595,7 @@ var ts; return finishNode(result); } function parseJSDocRecordMember() { - var result = createNode(262 /* JSDocRecordMember */); + var result = createNode(265 /* JSDocRecordMember */); result.name = parseSimplePropertyName(); if (token === 54 /* ColonToken */) { nextToken(); @@ -12361,13 +12604,13 @@ var ts; return finishNode(result); } function parseJSDocNonNullableType() { - var result = createNode(260 /* JSDocNonNullableType */); + var result = createNode(263 /* JSDocNonNullableType */); nextToken(); result.type = parseJSDocType(); return finishNode(result); } function parseJSDocTupleType() { - var result = createNode(258 /* JSDocTupleType */); + var result = createNode(261 /* JSDocTupleType */); nextToken(); result.types = parseDelimitedList(25 /* JSDocTupleTypes */, parseJSDocType); checkForTrailingComma(result.types); @@ -12381,7 +12624,7 @@ var ts; } } function parseJSDocUnionType() { - var result = createNode(257 /* JSDocUnionType */); + var result = createNode(260 /* JSDocUnionType */); nextToken(); result.types = parseJSDocTypeList(parseJSDocType()); parseExpected(18 /* CloseParenToken */); @@ -12399,7 +12642,7 @@ var ts; return types; } function parseJSDocAllType() { - var result = createNode(254 /* JSDocAllType */); + var result = createNode(257 /* JSDocAllType */); nextToken(); return finishNode(result); } @@ -12422,11 +12665,11 @@ var ts; token === 27 /* GreaterThanToken */ || token === 56 /* EqualsToken */ || token === 47 /* BarToken */) { - var result = createNode(255 /* JSDocUnknownType */, pos); + var result = createNode(258 /* JSDocUnknownType */, pos); return finishNode(result); } else { - var result = createNode(259 /* JSDocNullableType */, pos); + var result = createNode(262 /* JSDocNullableType */, pos); result.type = parseJSDocType(); return finishNode(result); } @@ -12517,7 +12760,7 @@ var ts; if (!tags) { return undefined; } - var result = createNode(269 /* JSDocComment */, start); + var result = createNode(272 /* JSDocComment */, start); result.tags = tags; return finishNode(result, end); } @@ -12555,7 +12798,7 @@ var ts; return undefined; } function handleUnknownTag(atToken, tagName) { - var result = createNode(270 /* JSDocTag */, atToken.pos); + var result = createNode(273 /* JSDocTag */, atToken.pos); result.atToken = atToken; result.tagName = tagName; return finishNode(result); @@ -12609,7 +12852,7 @@ var ts; if (!typeExpression) { typeExpression = tryParseTypeExpression(); } - var result = createNode(271 /* JSDocParameterTag */, atToken.pos); + var result = createNode(274 /* JSDocParameterTag */, atToken.pos); result.atToken = atToken; result.tagName = tagName; result.preParameterName = preName; @@ -12619,27 +12862,27 @@ var ts; return finishNode(result); } function handleReturnTag(atToken, tagName) { - if (ts.forEach(tags, function (t) { return t.kind === 272 /* JSDocReturnTag */; })) { + if (ts.forEach(tags, function (t) { return t.kind === 275 /* JSDocReturnTag */; })) { parseErrorAtPosition(tagName.pos, scanner.getTokenPos() - tagName.pos, ts.Diagnostics._0_tag_already_specified, tagName.text); } - var result = createNode(272 /* JSDocReturnTag */, atToken.pos); + var result = createNode(275 /* 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 === 273 /* JSDocTypeTag */; })) { + if (ts.forEach(tags, function (t) { return t.kind === 276 /* JSDocTypeTag */; })) { parseErrorAtPosition(tagName.pos, scanner.getTokenPos() - tagName.pos, ts.Diagnostics._0_tag_already_specified, tagName.text); } - var result = createNode(273 /* JSDocTypeTag */, atToken.pos); + var result = createNode(276 /* JSDocTypeTag */, atToken.pos); result.atToken = atToken; result.tagName = tagName; result.typeExpression = tryParseTypeExpression(); return finishNode(result); } function handleTemplateTag(atToken, tagName) { - if (ts.forEach(tags, function (t) { return t.kind === 274 /* JSDocTemplateTag */; })) { + if (ts.forEach(tags, function (t) { return t.kind === 277 /* 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' @@ -12651,7 +12894,7 @@ var ts; parseErrorAtPosition(scanner.getStartPos(), 0, ts.Diagnostics.Identifier_expected); return undefined; } - var typeParameter = createNode(139 /* TypeParameter */, name_8.pos); + var typeParameter = createNode(140 /* TypeParameter */, name_8.pos); typeParameter.name = name_8; finishNode(typeParameter); typeParameters.push(typeParameter); @@ -12662,7 +12905,7 @@ var ts; break; } } - var result = createNode(274 /* JSDocTemplateTag */, atToken.pos); + var result = createNode(277 /* JSDocTemplateTag */, atToken.pos); result.atToken = atToken; result.tagName = tagName; result.typeParameters = typeParameters; @@ -13191,16 +13434,16 @@ var ts; function getModuleInstanceState(node) { // A module is uninstantiated if it contains only // 1. interface declarations, type alias declarations - if (node.kind === 219 /* InterfaceDeclaration */ || node.kind === 220 /* TypeAliasDeclaration */) { + if (node.kind === 221 /* InterfaceDeclaration */ || node.kind === 222 /* TypeAliasDeclaration */) { return 0 /* NonInstantiated */; } else if (ts.isConstEnumDeclaration(node)) { return 2 /* ConstEnumOnly */; } - else if ((node.kind === 226 /* ImportDeclaration */ || node.kind === 225 /* ImportEqualsDeclaration */) && !(node.flags & 1 /* Export */)) { + else if ((node.kind === 229 /* ImportDeclaration */ || node.kind === 228 /* ImportEqualsDeclaration */) && !(node.flags & 1 /* Export */)) { return 0 /* NonInstantiated */; } - else if (node.kind === 223 /* ModuleBlock */) { + else if (node.kind === 225 /* ModuleBlock */) { var state_1 = 0 /* NonInstantiated */; ts.forEachChild(node, function (n) { switch (getModuleInstanceState(n)) { @@ -13219,7 +13462,7 @@ var ts; }); return state_1; } - else if (node.kind === 222 /* ModuleDeclaration */) { + else if (node.kind === 224 /* ModuleDeclaration */) { return getModuleInstanceState(node.body); } else { @@ -13274,6 +13517,7 @@ var ts; var hasAsyncFunctions; var hasDecorators; var hasParameterDecorators; + var hasJsxSpreadAttribute; // 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). @@ -13307,6 +13551,7 @@ var ts; hasAsyncFunctions = false; hasDecorators = false; hasParameterDecorators = false; + hasJsxSpreadAttribute = false; } return bindSourceFile; function createSymbol(flags, name) { @@ -13329,7 +13574,7 @@ var ts; if (symbolFlags & 107455 /* Value */) { var valueDeclaration = symbol.valueDeclaration; if (!valueDeclaration || - (valueDeclaration.kind !== node.kind && valueDeclaration.kind === 222 /* ModuleDeclaration */)) { + (valueDeclaration.kind !== node.kind && valueDeclaration.kind === 224 /* ModuleDeclaration */)) { // other kinds of value declarations take precedence over modules symbol.valueDeclaration = node; } @@ -13342,7 +13587,7 @@ var ts; if (ts.isAmbientModule(node)) { return ts.isGlobalScopeAugmentation(node) ? "__global" : "\"" + node.name.text + "\""; } - if (node.name.kind === 138 /* ComputedPropertyName */) { + if (node.name.kind === 139 /* 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)) { @@ -13354,21 +13599,21 @@ var ts; return node.name.text; } switch (node.kind) { - case 146 /* Constructor */: + case 147 /* Constructor */: return "__constructor"; - case 154 /* FunctionType */: - case 149 /* CallSignature */: + case 155 /* FunctionType */: + case 150 /* CallSignature */: return "__call"; - case 155 /* ConstructorType */: - case 150 /* ConstructSignature */: + case 156 /* ConstructorType */: + case 151 /* ConstructSignature */: return "__new"; - case 151 /* IndexSignature */: + case 152 /* IndexSignature */: return "__index"; - case 232 /* ExportDeclaration */: + case 235 /* ExportDeclaration */: return "__export"; - case 231 /* ExportAssignment */: + case 234 /* ExportAssignment */: return node.isExportEquals ? "export=" : "default"; - case 185 /* BinaryExpression */: + case 186 /* BinaryExpression */: switch (ts.getSpecialPropertyAssignmentKind(node)) { case 2 /* ModuleExports */: // module.exports = ... @@ -13383,15 +13628,15 @@ var ts; } ts.Debug.fail("Unknown binary declaration kind"); break; - case 217 /* FunctionDeclaration */: - case 218 /* ClassDeclaration */: + case 219 /* FunctionDeclaration */: + case 220 /* ClassDeclaration */: return node.flags & 512 /* Default */ ? "default" : undefined; - case 265 /* JSDocFunctionType */: + case 268 /* JSDocFunctionType */: return ts.isJSDocConstructSignature(node) ? "__new" : "__call"; - case 140 /* Parameter */: + case 141 /* 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 === 265 /* JSDocFunctionType */); + ts.Debug.assert(node.parent.kind === 268 /* JSDocFunctionType */); var functionType = node.parent; var index = ts.indexOf(functionType.parameters, node); return "p" + index; @@ -13470,7 +13715,7 @@ var ts; function declareModuleMember(node, symbolFlags, symbolExcludes) { var hasExportModifier = ts.getCombinedNodeFlags(node) & 1 /* Export */; if (symbolFlags & 8388608 /* Alias */) { - if (node.kind === 234 /* ExportSpecifier */ || (node.kind === 225 /* ImportEqualsDeclaration */ && hasExportModifier)) { + if (node.kind === 237 /* ExportSpecifier */ || (node.kind === 228 /* ImportEqualsDeclaration */ && hasExportModifier)) { return declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes); } else { @@ -13559,10 +13804,10 @@ var ts; flags &= ~98304 /* ReachabilityCheckFlags */; // reset all emit helper flags on node (for incremental scenarios) flags &= ~3932160 /* EmitHelperFlags */; - if (kind === 219 /* InterfaceDeclaration */) { + if (kind === 221 /* InterfaceDeclaration */) { seenThisKeyword = false; } - var saveState = kind === 252 /* SourceFile */ || kind === 223 /* ModuleBlock */ || ts.isFunctionLikeKind(kind); + var saveState = kind === 255 /* SourceFile */ || kind === 225 /* ModuleBlock */ || ts.isFunctionLikeKind(kind); if (saveState) { savedReachabilityState = currentReachabilityState; savedLabelStack = labelStack; @@ -13583,10 +13828,10 @@ var ts; flags |= 65536 /* HasExplicitReturn */; } } - if (kind === 219 /* InterfaceDeclaration */) { + if (kind === 221 /* InterfaceDeclaration */) { flags = seenThisKeyword ? flags | 16384 /* ContainsThis */ : flags & ~16384 /* ContainsThis */; } - if (kind === 252 /* SourceFile */) { + if (kind === 255 /* SourceFile */) { if (hasClassExtends) { flags |= 262144 /* HasClassExtends */; } @@ -13599,6 +13844,9 @@ var ts; if (hasAsyncFunctions) { flags |= 2097152 /* HasAsyncFunctions */; } + if (hasJsxSpreadAttribute) { + flags |= 1073741824 /* HasJsxSpreadAttribute */; + } } node.flags = flags; if (saveState) { @@ -13622,40 +13870,40 @@ var ts; return; } switch (node.kind) { - case 202 /* WhileStatement */: + case 204 /* WhileStatement */: bindWhileStatement(node); break; - case 201 /* DoStatement */: + case 203 /* DoStatement */: bindDoStatement(node); break; - case 203 /* ForStatement */: + case 205 /* ForStatement */: bindForStatement(node); break; - case 204 /* ForInStatement */: - case 205 /* ForOfStatement */: + case 206 /* ForInStatement */: + case 207 /* ForOfStatement */: bindForInOrForOfStatement(node); break; - case 200 /* IfStatement */: + case 202 /* IfStatement */: bindIfStatement(node); break; - case 208 /* ReturnStatement */: - case 212 /* ThrowStatement */: + case 210 /* ReturnStatement */: + case 214 /* ThrowStatement */: bindReturnOrThrow(node); break; - case 207 /* BreakStatement */: - case 206 /* ContinueStatement */: + case 209 /* BreakStatement */: + case 208 /* ContinueStatement */: bindBreakOrContinueStatement(node); break; - case 213 /* TryStatement */: + case 215 /* TryStatement */: bindTryStatement(node); break; - case 210 /* SwitchStatement */: + case 212 /* SwitchStatement */: bindSwitchStatement(node); break; - case 224 /* CaseBlock */: + case 226 /* CaseBlock */: bindCaseBlock(node); break; - case 211 /* LabeledStatement */: + case 213 /* LabeledStatement */: bindLabeledStatement(node); break; default: @@ -13730,7 +13978,7 @@ var ts; function bindReturnOrThrow(n) { // bind expression (don't affect reachability) bind(n.expression); - if (n.kind === 208 /* ReturnStatement */) { + if (n.kind === 210 /* ReturnStatement */) { hasExplicitReturn = true; } currentReachabilityState = 4 /* Unreachable */; @@ -13739,7 +13987,7 @@ var ts; // call bind on label (don't affect reachability) bind(n.label); // for continue case touch label so it will be marked a used - var isValidJump = jumpToLabel(n.label, n.kind === 207 /* BreakStatement */ ? currentReachabilityState : 4 /* Unreachable */); + var isValidJump = jumpToLabel(n.label, n.kind === 209 /* BreakStatement */ ? currentReachabilityState : 4 /* Unreachable */); if (isValidJump) { currentReachabilityState = 4 /* Unreachable */; } @@ -13757,7 +14005,7 @@ var ts; // post catch/finally state is reachable if // - post try state is reachable - control flow can fall out of try block // - post catch state is reachable - control flow can fall out of catch block - currentReachabilityState = or(postTryState, postCatchState); + currentReachabilityState = n.catchClause ? or(postTryState, postCatchState) : postTryState; } function bindSwitchStatement(n) { var preSwitchState = currentReachabilityState; @@ -13765,18 +14013,21 @@ var ts; // bind expression (don't affect reachability) bind(n.expression); bind(n.caseBlock); - var hasDefault = ts.forEach(n.caseBlock.clauses, function (c) { return c.kind === 246 /* DefaultClause */; }); + var hasDefault = ts.forEach(n.caseBlock.clauses, function (c) { return c.kind === 249 /* DefaultClause */; }); // post switch state is unreachable if switch is exhaustive (has a default case ) and does not have fallthrough from the last case var postSwitchState = hasDefault && currentReachabilityState !== 2 /* Reachable */ ? 4 /* Unreachable */ : preSwitchState; popImplicitLabel(postSwitchLabel, postSwitchState); } function bindCaseBlock(n) { var startState = currentReachabilityState; - for (var _i = 0, _a = n.clauses; _i < _a.length; _i++) { - var clause = _a[_i]; + for (var i = 0; i < n.clauses.length; i++) { + var clause = n.clauses[i]; currentReachabilityState = startState; bind(clause); - if (clause.statements.length && currentReachabilityState === 2 /* Reachable */ && options.noFallthroughCasesInSwitch) { + if (clause.statements.length && + i !== n.clauses.length - 1 && + currentReachabilityState === 2 /* Reachable */ && + options.noFallthroughCasesInSwitch) { errorOnFirstToken(clause, ts.Diagnostics.Fallthrough_case_in_switch); } } @@ -13792,38 +14043,39 @@ var ts; } function getContainerFlags(node) { switch (node.kind) { - case 190 /* ClassExpression */: - case 218 /* ClassDeclaration */: - case 219 /* InterfaceDeclaration */: - case 221 /* EnumDeclaration */: - case 169 /* ObjectLiteralExpression */: - case 157 /* TypeLiteral */: - case 261 /* JSDocRecordType */: + case 191 /* ClassExpression */: + case 220 /* ClassDeclaration */: + case 221 /* InterfaceDeclaration */: + case 223 /* EnumDeclaration */: + case 170 /* ObjectLiteralExpression */: + case 158 /* TypeLiteral */: + case 264 /* JSDocRecordType */: return 1 /* IsContainer */; - case 149 /* CallSignature */: - case 150 /* ConstructSignature */: - case 151 /* IndexSignature */: - case 145 /* MethodDeclaration */: - case 144 /* MethodSignature */: - case 217 /* FunctionDeclaration */: - case 146 /* Constructor */: - case 147 /* GetAccessor */: - case 148 /* SetAccessor */: - case 154 /* FunctionType */: - case 155 /* ConstructorType */: - case 177 /* FunctionExpression */: - case 178 /* ArrowFunction */: - case 222 /* ModuleDeclaration */: - case 252 /* SourceFile */: - case 220 /* TypeAliasDeclaration */: + case 150 /* CallSignature */: + case 151 /* ConstructSignature */: + case 152 /* IndexSignature */: + case 146 /* MethodDeclaration */: + case 145 /* MethodSignature */: + case 219 /* FunctionDeclaration */: + case 147 /* Constructor */: + case 148 /* GetAccessor */: + case 149 /* SetAccessor */: + case 155 /* FunctionType */: + case 268 /* JSDocFunctionType */: + case 156 /* ConstructorType */: + case 178 /* FunctionExpression */: + case 179 /* ArrowFunction */: + case 224 /* ModuleDeclaration */: + case 255 /* SourceFile */: + case 222 /* TypeAliasDeclaration */: return 5 /* IsContainerWithLocals */; - case 248 /* CatchClause */: - case 203 /* ForStatement */: - case 204 /* ForInStatement */: - case 205 /* ForOfStatement */: - case 224 /* CaseBlock */: + case 251 /* CatchClause */: + case 205 /* ForStatement */: + case 206 /* ForInStatement */: + case 207 /* ForOfStatement */: + case 226 /* CaseBlock */: return 2 /* IsBlockScopedContainer */; - case 196 /* Block */: + case 198 /* 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 @@ -13860,40 +14112,40 @@ 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 222 /* ModuleDeclaration */: + case 224 /* ModuleDeclaration */: return declareModuleMember(node, symbolFlags, symbolExcludes); - case 252 /* SourceFile */: + case 255 /* SourceFile */: return declareSourceFileMember(node, symbolFlags, symbolExcludes); - case 190 /* ClassExpression */: - case 218 /* ClassDeclaration */: + case 191 /* ClassExpression */: + case 220 /* ClassDeclaration */: return declareClassMember(node, symbolFlags, symbolExcludes); - case 221 /* EnumDeclaration */: + case 223 /* EnumDeclaration */: return declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes); - case 157 /* TypeLiteral */: - case 169 /* ObjectLiteralExpression */: - case 219 /* InterfaceDeclaration */: - case 261 /* JSDocRecordType */: + case 158 /* TypeLiteral */: + case 170 /* ObjectLiteralExpression */: + case 221 /* InterfaceDeclaration */: + case 264 /* JSDocRecordType */: // 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 154 /* FunctionType */: - case 155 /* ConstructorType */: - case 149 /* CallSignature */: - case 150 /* ConstructSignature */: - case 151 /* IndexSignature */: - case 145 /* MethodDeclaration */: - case 144 /* MethodSignature */: - case 146 /* Constructor */: - case 147 /* GetAccessor */: - case 148 /* SetAccessor */: - case 217 /* FunctionDeclaration */: - case 177 /* FunctionExpression */: - case 178 /* ArrowFunction */: - case 265 /* JSDocFunctionType */: - case 220 /* TypeAliasDeclaration */: + case 155 /* FunctionType */: + case 156 /* ConstructorType */: + case 150 /* CallSignature */: + case 151 /* ConstructSignature */: + case 152 /* IndexSignature */: + case 146 /* MethodDeclaration */: + case 145 /* MethodSignature */: + case 147 /* Constructor */: + case 148 /* GetAccessor */: + case 149 /* SetAccessor */: + case 219 /* FunctionDeclaration */: + case 178 /* FunctionExpression */: + case 179 /* ArrowFunction */: + case 268 /* JSDocFunctionType */: + case 222 /* TypeAliasDeclaration */: // 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 @@ -13914,11 +14166,11 @@ var ts; : declareSymbol(file.locals, undefined, node, symbolFlags, symbolExcludes); } function hasExportDeclarations(node) { - var body = node.kind === 252 /* SourceFile */ ? node : node.body; - if (body.kind === 252 /* SourceFile */ || body.kind === 223 /* ModuleBlock */) { + var body = node.kind === 255 /* SourceFile */ ? node : node.body; + if (body.kind === 255 /* SourceFile */ || body.kind === 225 /* ModuleBlock */) { for (var _i = 0, _a = body.statements; _i < _a.length; _i++) { var stat = _a[_i]; - if (stat.kind === 232 /* ExportDeclaration */ || stat.kind === 231 /* ExportAssignment */) { + if (stat.kind === 235 /* ExportDeclaration */ || stat.kind === 234 /* ExportAssignment */) { return true; } } @@ -13941,7 +14193,12 @@ var ts; if (node.flags & 1 /* Export */) { errorOnFirstToken(node, ts.Diagnostics.export_modifier_cannot_be_applied_to_ambient_modules_and_module_augmentations_since_they_are_always_visible); } - declareSymbolAndAddToSymbolTable(node, 512 /* ValueModule */, 106639 /* ValueModuleExcludes */); + if (ts.isExternalModuleAugmentation(node)) { + declareSymbolAndAddToSymbolTable(node, 1024 /* NamespaceModule */, 0 /* NamespaceModuleExcludes */); + } + else { + declareSymbolAndAddToSymbolTable(node, 512 /* ValueModule */, 106639 /* ValueModuleExcludes */); + } } else { var state = getModuleInstanceState(node); @@ -14005,7 +14262,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 === 249 /* PropertyAssignment */ || prop.kind === 250 /* ShorthandPropertyAssignment */ || prop.kind === 145 /* MethodDeclaration */ + var currentKind = prop.kind === 252 /* PropertyAssignment */ || prop.kind === 253 /* ShorthandPropertyAssignment */ || prop.kind === 146 /* MethodDeclaration */ ? 1 /* Property */ : 2 /* Accessor */; var existingKind = seen[identifier.text]; @@ -14027,10 +14284,10 @@ var ts; } function bindBlockScopedDeclaration(node, symbolFlags, symbolExcludes) { switch (blockScopeContainer.kind) { - case 222 /* ModuleDeclaration */: + case 224 /* ModuleDeclaration */: declareModuleMember(node, symbolFlags, symbolExcludes); break; - case 252 /* SourceFile */: + case 255 /* SourceFile */: if (ts.isExternalModule(container)) { declareModuleMember(node, symbolFlags, symbolExcludes); break; @@ -14190,17 +14447,17 @@ var ts; } function updateStrictMode(node) { switch (node.kind) { - case 252 /* SourceFile */: - case 223 /* ModuleBlock */: + case 255 /* SourceFile */: + case 225 /* ModuleBlock */: updateStrictModeStatementList(node.statements); return; - case 196 /* Block */: + case 198 /* Block */: if (ts.isFunctionLike(node.parent)) { updateStrictModeStatementList(node.statements); } return; - case 218 /* ClassDeclaration */: - case 190 /* ClassExpression */: + case 220 /* ClassDeclaration */: + case 191 /* ClassExpression */: // All classes are automatically in strict mode in ES6. inStrictMode = true; return; @@ -14223,14 +14480,14 @@ var ts; var nodeText = ts.getTextOfNodeFromSourceText(file.text, node.expression); // Note: the node text must be exactly "use strict" or 'use strict'. It is not ok for the // string to contain unicode escapes (as per ES5). - return nodeText === "\"use strict\"" || nodeText === "'use strict'"; + return nodeText === '"use strict"' || nodeText === "'use strict'"; } function bindWorker(node) { switch (node.kind) { /* Strict mode checks */ case 69 /* Identifier */: return checkStrictModeIdentifier(node); - case 185 /* BinaryExpression */: + case 186 /* BinaryExpression */: if (ts.isInJavaScriptFile(node)) { var specialKind = ts.getSpecialPropertyAssignmentKind(node); switch (specialKind) { @@ -14254,100 +14511,105 @@ var ts; } } return checkStrictModeBinaryExpression(node); - case 248 /* CatchClause */: + case 251 /* CatchClause */: return checkStrictModeCatchClause(node); - case 179 /* DeleteExpression */: + case 180 /* DeleteExpression */: return checkStrictModeDeleteExpression(node); case 8 /* NumericLiteral */: return checkStrictModeNumericLiteral(node); - case 184 /* PostfixUnaryExpression */: + case 185 /* PostfixUnaryExpression */: return checkStrictModePostfixUnaryExpression(node); - case 183 /* PrefixUnaryExpression */: + case 184 /* PrefixUnaryExpression */: return checkStrictModePrefixUnaryExpression(node); - case 209 /* WithStatement */: + case 211 /* WithStatement */: return checkStrictModeWithStatement(node); - case 163 /* ThisType */: + case 164 /* ThisType */: seenThisKeyword = true; return; - case 152 /* TypePredicate */: + case 153 /* TypePredicate */: return checkTypePredicate(node); - case 139 /* TypeParameter */: + case 140 /* TypeParameter */: return declareSymbolAndAddToSymbolTable(node, 262144 /* TypeParameter */, 530912 /* TypeParameterExcludes */); - case 140 /* Parameter */: + case 141 /* Parameter */: return bindParameter(node); - case 215 /* VariableDeclaration */: - case 167 /* BindingElement */: + case 217 /* VariableDeclaration */: + case 168 /* BindingElement */: return bindVariableDeclarationOrBindingElement(node); - case 143 /* PropertyDeclaration */: - case 142 /* PropertySignature */: - case 262 /* JSDocRecordMember */: + case 144 /* PropertyDeclaration */: + case 143 /* PropertySignature */: + case 265 /* JSDocRecordMember */: return bindPropertyOrMethodOrAccessor(node, 4 /* Property */ | (node.questionToken ? 536870912 /* Optional */ : 0 /* None */), 107455 /* PropertyExcludes */); - case 249 /* PropertyAssignment */: - case 250 /* ShorthandPropertyAssignment */: + case 252 /* PropertyAssignment */: + case 253 /* ShorthandPropertyAssignment */: return bindPropertyOrMethodOrAccessor(node, 4 /* Property */, 107455 /* PropertyExcludes */); - case 251 /* EnumMember */: + case 254 /* EnumMember */: return bindPropertyOrMethodOrAccessor(node, 8 /* EnumMember */, 107455 /* EnumMemberExcludes */); - case 149 /* CallSignature */: - case 150 /* ConstructSignature */: - case 151 /* IndexSignature */: + case 246 /* JsxSpreadAttribute */: + hasJsxSpreadAttribute = true; + return; + case 150 /* CallSignature */: + case 151 /* ConstructSignature */: + case 152 /* IndexSignature */: return declareSymbolAndAddToSymbolTable(node, 131072 /* Signature */, 0 /* None */); - case 145 /* MethodDeclaration */: - case 144 /* MethodSignature */: + case 146 /* MethodDeclaration */: + case 145 /* 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) ? 107455 /* PropertyExcludes */ : 99263 /* MethodExcludes */); - case 217 /* FunctionDeclaration */: + case 219 /* FunctionDeclaration */: return bindFunctionDeclaration(node); - case 146 /* Constructor */: + case 147 /* Constructor */: return declareSymbolAndAddToSymbolTable(node, 16384 /* Constructor */, /*symbolExcludes:*/ 0 /* None */); - case 147 /* GetAccessor */: + case 148 /* GetAccessor */: return bindPropertyOrMethodOrAccessor(node, 32768 /* GetAccessor */, 41919 /* GetAccessorExcludes */); - case 148 /* SetAccessor */: + case 149 /* SetAccessor */: return bindPropertyOrMethodOrAccessor(node, 65536 /* SetAccessor */, 74687 /* SetAccessorExcludes */); - case 154 /* FunctionType */: - case 155 /* ConstructorType */: - case 265 /* JSDocFunctionType */: + case 155 /* FunctionType */: + case 156 /* ConstructorType */: + case 268 /* JSDocFunctionType */: return bindFunctionOrConstructorType(node); - case 157 /* TypeLiteral */: - case 261 /* JSDocRecordType */: + case 158 /* TypeLiteral */: + case 264 /* JSDocRecordType */: return bindAnonymousDeclaration(node, 2048 /* TypeLiteral */, "__type"); - case 169 /* ObjectLiteralExpression */: + case 170 /* ObjectLiteralExpression */: return bindObjectLiteralExpression(node); - case 177 /* FunctionExpression */: - case 178 /* ArrowFunction */: + case 178 /* FunctionExpression */: + case 179 /* ArrowFunction */: return bindFunctionExpression(node); - case 172 /* CallExpression */: + case 173 /* CallExpression */: if (ts.isInJavaScriptFile(node)) { bindCallExpression(node); } break; // Members of classes, interfaces, and modules - case 190 /* ClassExpression */: - case 218 /* ClassDeclaration */: + case 191 /* ClassExpression */: + case 220 /* ClassDeclaration */: return bindClassLikeDeclaration(node); - case 219 /* InterfaceDeclaration */: + case 221 /* InterfaceDeclaration */: return bindBlockScopedDeclaration(node, 64 /* Interface */, 792960 /* InterfaceExcludes */); - case 220 /* TypeAliasDeclaration */: + case 222 /* TypeAliasDeclaration */: return bindBlockScopedDeclaration(node, 524288 /* TypeAlias */, 793056 /* TypeAliasExcludes */); - case 221 /* EnumDeclaration */: + case 223 /* EnumDeclaration */: return bindEnumDeclaration(node); - case 222 /* ModuleDeclaration */: + case 224 /* ModuleDeclaration */: return bindModuleDeclaration(node); // Imports and exports - case 225 /* ImportEqualsDeclaration */: - case 228 /* NamespaceImport */: - case 230 /* ImportSpecifier */: - case 234 /* ExportSpecifier */: + case 228 /* ImportEqualsDeclaration */: + case 231 /* NamespaceImport */: + case 233 /* ImportSpecifier */: + case 237 /* ExportSpecifier */: return declareSymbolAndAddToSymbolTable(node, 8388608 /* Alias */, 8388608 /* AliasExcludes */); - case 227 /* ImportClause */: + case 227 /* GlobalModuleExportDeclaration */: + return bindGlobalModuleExportDeclaration(node); + case 230 /* ImportClause */: return bindImportClause(node); - case 232 /* ExportDeclaration */: + case 235 /* ExportDeclaration */: return bindExportDeclaration(node); - case 231 /* ExportAssignment */: + case 234 /* ExportAssignment */: return bindExportAssignment(node); - case 252 /* SourceFile */: + case 255 /* SourceFile */: return bindSourceFileIfExternalModule(); } } @@ -14356,7 +14618,7 @@ var ts; if (parameterName && parameterName.kind === 69 /* Identifier */) { checkStrictModeIdentifier(parameterName); } - if (parameterName && parameterName.kind === 163 /* ThisType */) { + if (parameterName && parameterName.kind === 164 /* ThisType */) { seenThisKeyword = true; } bind(type); @@ -14371,12 +14633,12 @@ var ts; bindAnonymousDeclaration(file, 512 /* ValueModule */, "\"" + ts.removeFileExtension(file.fileName) + "\""); } function bindExportAssignment(node) { - var boundExpression = node.kind === 231 /* ExportAssignment */ ? node.expression : node.right; + var boundExpression = node.kind === 234 /* ExportAssignment */ ? node.expression : node.right; if (!container.symbol || !container.symbol.exports) { // Export assignment in some sort of block construct bindAnonymousDeclaration(node, 8388608 /* Alias */, getDeclarationName(node)); } - else if (boundExpression.kind === 69 /* Identifier */ && node.kind === 231 /* ExportAssignment */) { + else if (boundExpression.kind === 69 /* Identifier */ && node.kind === 234 /* ExportAssignment */) { // An export default clause with an identifier exports all meanings of that identifier declareSymbol(container.symbol.exports, container.symbol, node, 8388608 /* Alias */, 107455 /* PropertyExcludes */ | 8388608 /* AliasExcludes */); } @@ -14385,6 +14647,28 @@ var ts; declareSymbol(container.symbol.exports, container.symbol, node, 4 /* Property */, 107455 /* PropertyExcludes */ | 8388608 /* AliasExcludes */); } } + function bindGlobalModuleExportDeclaration(node) { + if (node.modifiers && node.modifiers.length) { + file.bindDiagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.Modifiers_cannot_appear_here)); + } + if (node.parent.kind !== 255 /* SourceFile */) { + file.bindDiagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.Global_module_exports_may_only_appear_at_top_level)); + return; + } + else { + 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_4.isDeclarationFile) { + file.bindDiagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.Global_module_exports_may_only_appear_in_declaration_files)); + return; + } + } + file.symbol.globalExports = file.symbol.globalExports || {}; + declareSymbol(file.symbol.globalExports, file.symbol, node, 8388608 /* Alias */, 8388608 /* AliasExcludes */); + } function bindExportDeclaration(node) { if (!container.symbol || !container.symbol.exports) { // Export * in some sort of block construct @@ -14415,11 +14699,11 @@ var ts; function bindModuleExportsAssignment(node) { // 'module.exports = expr' assignment setCommonJsModuleIndicator(node); - bindExportAssignment(node); + declareSymbol(file.symbol.exports, file.symbol, node, 4 /* Property */ | 7340032 /* Export */ | 512 /* ValueModule */, 0 /* None */); } function bindThisPropertyAssignment(node) { // Declare a 'member' in case it turns out the container was an ES5 class - if (container.kind === 177 /* FunctionExpression */ || container.kind === 217 /* FunctionDeclaration */) { + if (container.kind === 178 /* FunctionExpression */ || container.kind === 219 /* FunctionDeclaration */) { container.symbol.members = container.symbol.members || {}; // It's acceptable for multiple 'this' assignments of the same identifier to occur declareSymbol(container.symbol.members, container.symbol, node, 4 /* Property */, 107455 /* PropertyExcludes */ & ~4 /* Property */); @@ -14463,7 +14747,7 @@ var ts; hasDecorators = true; } } - if (node.kind === 218 /* ClassDeclaration */) { + if (node.kind === 220 /* ClassDeclaration */) { bindBlockScopedDeclaration(node, 32 /* Class */, 899519 /* ClassExcludes */); } else { @@ -14641,13 +14925,13 @@ var ts; case 4 /* Unreachable */: var reportError = // report error on all statements except empty ones - (ts.isStatement(node) && node.kind !== 198 /* EmptyStatement */) || + (ts.isStatement(node) && node.kind !== 200 /* EmptyStatement */) || // report error on class declarations - node.kind === 218 /* ClassDeclaration */ || + node.kind === 220 /* ClassDeclaration */ || // report error on instantiated modules or const-enums only modules if preserveConstEnums is set - (node.kind === 222 /* ModuleDeclaration */ && shouldReportErrorOnModuleDeclaration(node)) || + (node.kind === 224 /* ModuleDeclaration */ && shouldReportErrorOnModuleDeclaration(node)) || // report error on regular enums and const enums if preserveConstEnums is set - (node.kind === 221 /* EnumDeclaration */ && (!ts.isConstEnumDeclaration(node) || options.preserveConstEnums)); + (node.kind === 223 /* EnumDeclaration */ && (!ts.isConstEnumDeclaration(node) || options.preserveConstEnums)); if (reportError) { currentReachabilityState = 8 /* ReportedUnreachable */; // unreachable code is reported if @@ -14661,7 +14945,7 @@ 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 !== 197 /* VariableStatement */ || + (node.kind !== 199 /* VariableStatement */ || ts.getCombinedNodeFlags(node.declarationList) & 3072 /* BlockScoped */ || ts.forEach(node.declarationList.declarations, function (d) { return d.initializer; })); if (reportUnreachableCode) { @@ -14735,6 +15019,7 @@ var ts; var languageVersion = compilerOptions.target || 0 /* ES3 */; var modulekind = ts.getEmitModuleKind(compilerOptions); var allowSyntheticDefaultImports = typeof compilerOptions.allowSyntheticDefaultImports !== "undefined" ? compilerOptions.allowSyntheticDefaultImports : modulekind === ts.ModuleKind.System; + var strictNullChecks = compilerOptions.strictNullChecks; var emitResolver = createResolver(); var undefinedSymbol = createSymbol(4 /* Property */ | 67108864 /* Transient */, "undefined"); undefinedSymbol.declarations = []; @@ -14749,9 +15034,7 @@ var ts; isUnknownSymbol: function (symbol) { return symbol === unknownSymbol; }, getDiagnostics: getDiagnostics, getGlobalDiagnostics: getGlobalDiagnostics, - // The language service will always care about the narrowed type of a symbol, because that is - // the type the language says the symbol should have. - getTypeOfSymbolAtLocation: getNarrowedTypeOfSymbol, + getTypeOfSymbolAtLocation: getTypeOfSymbolAtLocation, getSymbolsOfParameterPropertyDeclaration: getSymbolsOfParameterPropertyDeclaration, getDeclaredTypeOfSymbol: getDeclaredTypeOfSymbol, getPropertiesOfType: getPropertiesOfType, @@ -14786,14 +15069,16 @@ var ts; }; var unknownSymbol = createSymbol(4 /* Property */ | 67108864 /* Transient */, "unknown"); var resolvingSymbol = createSymbol(67108864 /* Transient */, "__resolving__"); + var nullableWideningFlags = strictNullChecks ? 0 : 2097152 /* ContainsUndefinedOrNull */; var anyType = createIntrinsicType(1 /* Any */, "any"); var stringType = createIntrinsicType(2 /* String */, "string"); var numberType = createIntrinsicType(4 /* Number */, "number"); var booleanType = createIntrinsicType(8 /* Boolean */, "boolean"); var esSymbolType = createIntrinsicType(16777216 /* ESSymbol */, "symbol"); var voidType = createIntrinsicType(16 /* Void */, "void"); - var undefinedType = createIntrinsicType(32 /* Undefined */ | 2097152 /* ContainsUndefinedOrNull */, "undefined"); - var nullType = createIntrinsicType(64 /* Null */ | 2097152 /* ContainsUndefinedOrNull */, "null"); + var undefinedType = createIntrinsicType(32 /* Undefined */ | nullableWideningFlags, "undefined"); + var nullType = createIntrinsicType(64 /* Null */ | nullableWideningFlags, "null"); + var emptyArrayElementType = createIntrinsicType(32 /* Undefined */ | 2097152 /* ContainsUndefinedOrNull */, "undefined"); var unknownType = createIntrinsicType(1 /* Any */, "unknown"); var emptyObjectType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined); var emptyUnionType = emptyObjectType; @@ -14804,11 +15089,11 @@ var ts; // in getPropagatingFlagsOfTypes, and it is checked in inferFromTypes. anyFunctionType.flags |= 8388608 /* ContainsAnyFunctionType */; var noConstraintType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined); - var anySignature = createSignature(undefined, undefined, emptyArray, anyType, /*typePredicate*/ undefined, 0, /*hasRestParameter*/ false, /*hasStringLiterals*/ false); - var unknownSignature = createSignature(undefined, undefined, emptyArray, unknownType, /*typePredicate*/ undefined, 0, /*hasRestParameter*/ false, /*hasStringLiterals*/ false); + var anySignature = createSignature(undefined, undefined, undefined, emptyArray, anyType, /*typePredicate*/ undefined, 0, /*hasRestParameter*/ false, /*hasStringLiterals*/ false); + var unknownSignature = createSignature(undefined, undefined, undefined, emptyArray, unknownType, /*typePredicate*/ undefined, 0, /*hasRestParameter*/ false, /*hasStringLiterals*/ false); var enumNumberIndexInfo = createIndexInfo(stringType, /*isReadonly*/ true); var globals = {}; - var globalESSymbolConstructorSymbol; + var getGlobalESSymbolConstructorSymbol; var getGlobalPromiseConstructorSymbol; var globalObjectType; var globalFunctionType; @@ -14818,13 +15103,16 @@ var ts; var globalNumberType; var globalBooleanType; var globalRegExpType; - var globalTemplateStringsArrayType; - var globalESSymbolType; - var globalIterableType; - var globalIteratorType; - var globalIterableIteratorType; var anyArrayType; 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 + // and they will not get an error from not having unrelated library files + var getGlobalTemplateStringsArrayType; + var getGlobalESSymbolType; + var getGlobalIterableType; + var getGlobalIteratorType; + var getGlobalIterableIteratorType; var getGlobalClassDecoratorType; var getGlobalParameterDecoratorType; var getGlobalPropertyDecoratorType; @@ -14887,6 +15175,7 @@ var ts; }; var subtypeRelation = {}; var assignableRelation = {}; + var comparableRelation = {}; var identityRelation = {}; // This is for caching the result of getSymbolDisplayBuilder. Do not access directly. var _displayBuilder; @@ -14986,7 +15275,7 @@ var ts; target.flags |= source.flags; if (source.valueDeclaration && (!target.valueDeclaration || - (target.valueDeclaration.kind === 222 /* ModuleDeclaration */ && source.valueDeclaration.kind !== 222 /* ModuleDeclaration */))) { + (target.valueDeclaration.kind === 224 /* ModuleDeclaration */ && source.valueDeclaration.kind !== 224 /* ModuleDeclaration */))) { // other kinds of value declarations take precedence over modules target.valueDeclaration = source.valueDeclaration; } @@ -15043,7 +15332,7 @@ var ts; } function mergeModuleAugmentation(moduleName) { var moduleAugmentation = moduleName.parent; - if (moduleAugmentation.symbol.valueDeclaration !== moduleAugmentation) { + if (moduleAugmentation.symbol.declarations[0] !== moduleAugmentation) { // this is a combined symbol for multiple augmentations within the same file. // its symbol already has accumulated information for all declarations // so we need to add it just once - do the work only for first declaration @@ -15099,7 +15388,7 @@ var ts; return nodeLinks[nodeId] || (nodeLinks[nodeId] = {}); } function isGlobalSourceFile(node) { - return node.kind === 252 /* SourceFile */ && !ts.isExternalOrCommonJsModule(node); + return node.kind === 255 /* SourceFile */ && !ts.isExternalOrCommonJsModule(node); } function getSymbol(symbols, name, meaning) { if (meaning && ts.hasProperty(symbols, name)) { @@ -15148,7 +15437,7 @@ var ts; 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 !== 215 /* VariableDeclaration */ || + return declaration.kind !== 217 /* VariableDeclaration */ || !isImmediatelyUsedInInitializerOfBlockScopedVariable(declaration, usage); } // declaration is after usage @@ -15156,14 +15445,14 @@ var ts; return isUsedInFunctionOrNonStaticProperty(declaration, usage); function isImmediatelyUsedInInitializerOfBlockScopedVariable(declaration, usage) { var container = ts.getEnclosingBlockScopeContainer(declaration); - if (declaration.parent.parent.kind === 197 /* VariableStatement */ || - declaration.parent.parent.kind === 203 /* ForStatement */) { + if (declaration.parent.parent.kind === 199 /* VariableStatement */ || + declaration.parent.parent.kind === 205 /* ForStatement */) { // variable statement/for statement case, // use site should not be inside variable declaration (initializer of declaration or binding element) return isSameScopeDescendentOf(usage, declaration, container); } - else if (declaration.parent.parent.kind === 205 /* ForOfStatement */ || - declaration.parent.parent.kind === 204 /* ForInStatement */) { + else if (declaration.parent.parent.kind === 207 /* ForOfStatement */ || + declaration.parent.parent.kind === 206 /* ForInStatement */) { // ForIn/ForOf case - use site should not be used in expression part var expression = declaration.parent.parent.expression; return isSameScopeDescendentOf(usage, expression, container); @@ -15180,7 +15469,7 @@ var ts; return true; } var initializerOfNonStaticProperty = current.parent && - current.parent.kind === 143 /* PropertyDeclaration */ && + current.parent.kind === 144 /* PropertyDeclaration */ && (current.parent.flags & 32 /* Static */) === 0 && current.parent.initializer === current; if (initializerOfNonStaticProperty) { @@ -15212,11 +15501,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 & 793056 /* Type */ && lastLocation.kind !== 269 /* JSDocComment */) { + if (meaning & result.flags & 793056 /* Type */ && lastLocation.kind !== 272 /* JSDocComment */) { useResult = result.flags & 262144 /* TypeParameter */ ? lastLocation === location.type || - lastLocation.kind === 140 /* Parameter */ || - lastLocation.kind === 139 /* TypeParameter */ + lastLocation.kind === 141 /* Parameter */ || + lastLocation.kind === 140 /* TypeParameter */ : false; } if (meaning & 107455 /* Value */ && result.flags & 1 /* FunctionScopedVariable */) { @@ -15225,9 +15514,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 === 140 /* Parameter */ || + lastLocation.kind === 141 /* Parameter */ || (lastLocation === location.type && - result.valueDeclaration.kind === 140 /* Parameter */); + result.valueDeclaration.kind === 141 /* Parameter */); } } if (useResult) { @@ -15239,12 +15528,12 @@ var ts; } } switch (location.kind) { - case 252 /* SourceFile */: + case 255 /* SourceFile */: if (!ts.isExternalOrCommonJsModule(location)) break; - case 222 /* ModuleDeclaration */: + case 224 /* ModuleDeclaration */: var moduleExports = getSymbolOfNode(location).exports; - if (location.kind === 252 /* SourceFile */ || ts.isAmbientModule(location)) { + if (location.kind === 255 /* 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"]) { @@ -15267,7 +15556,7 @@ var ts; // which is not the desired behavior. if (ts.hasProperty(moduleExports, name) && moduleExports[name].flags === 8388608 /* Alias */ && - ts.getDeclarationOfKind(moduleExports[name], 234 /* ExportSpecifier */)) { + ts.getDeclarationOfKind(moduleExports[name], 237 /* ExportSpecifier */)) { break; } } @@ -15275,13 +15564,13 @@ var ts; break loop; } break; - case 221 /* EnumDeclaration */: + case 223 /* EnumDeclaration */: if (result = getSymbol(getSymbolOfNode(location).exports, name, meaning & 8 /* EnumMember */)) { break loop; } break; - case 143 /* PropertyDeclaration */: - case 142 /* PropertySignature */: + case 144 /* PropertyDeclaration */: + case 143 /* 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 @@ -15298,9 +15587,9 @@ var ts; } } break; - case 218 /* ClassDeclaration */: - case 190 /* ClassExpression */: - case 219 /* InterfaceDeclaration */: + case 220 /* ClassDeclaration */: + case 191 /* ClassExpression */: + case 221 /* InterfaceDeclaration */: if (result = getSymbol(getSymbolOfNode(location).members, name, meaning & 793056 /* Type */)) { if (lastLocation && lastLocation.flags & 32 /* Static */) { // TypeScript 1.0 spec (April 2014): 3.4.1 @@ -15311,7 +15600,7 @@ var ts; } break loop; } - if (location.kind === 190 /* ClassExpression */ && meaning & 32 /* Class */) { + if (location.kind === 191 /* ClassExpression */ && meaning & 32 /* Class */) { var className = location.name; if (className && name === className.text) { result = location.symbol; @@ -15327,9 +15616,9 @@ var ts; // [foo()]() { } // <-- Reference to T from class's own computed property // } // - case 138 /* ComputedPropertyName */: + case 139 /* ComputedPropertyName */: grandparent = location.parent.parent; - if (ts.isClassLike(grandparent) || grandparent.kind === 219 /* InterfaceDeclaration */) { + if (ts.isClassLike(grandparent) || grandparent.kind === 221 /* InterfaceDeclaration */) { // A reference to this grandparent's type parameters would be an error if (result = getSymbol(getSymbolOfNode(grandparent).members, name, meaning & 793056 /* Type */)) { error(errorLocation, ts.Diagnostics.A_computed_property_name_cannot_reference_a_type_parameter_from_its_containing_type); @@ -15337,19 +15626,19 @@ var ts; } } break; - case 145 /* MethodDeclaration */: - case 144 /* MethodSignature */: - case 146 /* Constructor */: - case 147 /* GetAccessor */: - case 148 /* SetAccessor */: - case 217 /* FunctionDeclaration */: - case 178 /* ArrowFunction */: + case 146 /* MethodDeclaration */: + case 145 /* MethodSignature */: + case 147 /* Constructor */: + case 148 /* GetAccessor */: + case 149 /* SetAccessor */: + case 219 /* FunctionDeclaration */: + case 179 /* ArrowFunction */: if (meaning & 3 /* Variable */ && name === "arguments") { result = argumentsSymbol; break loop; } break; - case 177 /* FunctionExpression */: + case 178 /* FunctionExpression */: if (meaning & 3 /* Variable */ && name === "arguments") { result = argumentsSymbol; break loop; @@ -15362,7 +15651,7 @@ var ts; } } break; - case 141 /* Decorator */: + case 142 /* Decorator */: // Decorators are resolved at the class declaration. Resolving at the parameter // or member would result in looking up locals in the method. // @@ -15371,7 +15660,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 === 140 /* Parameter */) { + if (location.parent && location.parent.kind === 141 /* Parameter */) { location = location.parent; } // @@ -15465,7 +15754,7 @@ var ts; // 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 (!isBlockScopedNameDeclaredBeforeUse(ts.getAncestor(declaration, 215 /* VariableDeclaration */), errorLocation)) { + if (!isBlockScopedNameDeclaredBeforeUse(ts.getAncestor(declaration, 217 /* VariableDeclaration */), errorLocation)) { error(errorLocation, ts.Diagnostics.Block_scoped_variable_0_used_before_its_declaration, ts.declarationNameToString(declaration.name)); } } @@ -15486,10 +15775,10 @@ var ts; } function getAnyImportSyntax(node) { if (ts.isAliasSymbolDeclaration(node)) { - if (node.kind === 225 /* ImportEqualsDeclaration */) { + if (node.kind === 228 /* ImportEqualsDeclaration */) { return node; } - while (node && node.kind !== 226 /* ImportDeclaration */) { + while (node && node.kind !== 229 /* ImportDeclaration */) { node = node.parent; } return node; @@ -15499,7 +15788,7 @@ var ts; return ts.forEach(symbol.declarations, function (d) { return ts.isAliasSymbolDeclaration(d) ? d : undefined; }); } function getTargetOfImportEqualsDeclaration(node) { - if (node.moduleReference.kind === 236 /* ExternalModuleReference */) { + if (node.moduleReference.kind === 239 /* ExternalModuleReference */) { return resolveExternalModuleSymbol(resolveExternalModuleName(node, ts.getExternalModuleImportEqualsDeclarationExpression(node))); } return getSymbolOfPartOfRightHandSideOfImportEquals(node.moduleReference, node); @@ -15507,7 +15796,9 @@ var ts; function getTargetOfImportClause(node) { var moduleSymbol = resolveExternalModuleName(node, node.parent.moduleSpecifier); if (moduleSymbol) { - var exportDefaultSymbol = resolveSymbol(moduleSymbol.exports["default"]); + var exportDefaultSymbol = moduleSymbol.exports["export="] ? + getPropertyOfType(getTypeOfSymbol(moduleSymbol.exports["export="]), "default") : + resolveSymbol(moduleSymbol.exports["default"]); if (!exportDefaultSymbol && !allowSyntheticDefaultImports) { error(node.name, ts.Diagnostics.Module_0_has_no_default_export, symbolToString(moduleSymbol)); } @@ -15576,8 +15867,15 @@ var ts; if (targetSymbol) { var name_9 = specifier.propertyName || specifier.name; if (name_9.text) { + 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_9.text); + } + else { + symbolFromVariable = getPropertyOfVariable(targetSymbol, name_9.text); + } var symbolFromModule = getExportOfModule(targetSymbol, name_9.text); - var symbolFromVariable = getPropertyOfVariable(targetSymbol, name_9.text); var symbol = symbolFromModule && symbolFromVariable ? combineValueAndTypeSymbols(symbolFromVariable, symbolFromModule) : symbolFromModule || symbolFromVariable; @@ -15591,6 +15889,9 @@ var ts; function getTargetOfImportSpecifier(node) { return getExternalModuleMember(node.parent.parent.parent, node); } + function getTargetOfGlobalModuleExportDeclaration(node) { + return resolveExternalModuleSymbol(node.parent.symbol); + } function getTargetOfExportSpecifier(node) { return node.parent.parent.moduleSpecifier ? getExternalModuleMember(node.parent.parent, node) : @@ -15601,18 +15902,20 @@ var ts; } function getTargetOfAliasDeclaration(node) { switch (node.kind) { - case 225 /* ImportEqualsDeclaration */: + case 228 /* ImportEqualsDeclaration */: return getTargetOfImportEqualsDeclaration(node); - case 227 /* ImportClause */: + case 230 /* ImportClause */: return getTargetOfImportClause(node); - case 228 /* NamespaceImport */: + case 231 /* NamespaceImport */: return getTargetOfNamespaceImport(node); - case 230 /* ImportSpecifier */: + case 233 /* ImportSpecifier */: return getTargetOfImportSpecifier(node); - case 234 /* ExportSpecifier */: + case 237 /* ExportSpecifier */: return getTargetOfExportSpecifier(node); - case 231 /* ExportAssignment */: + case 234 /* ExportAssignment */: return getTargetOfExportAssignment(node); + case 227 /* GlobalModuleExportDeclaration */: + return getTargetOfGlobalModuleExportDeclaration(node); } } function resolveSymbol(symbol) { @@ -15656,11 +15959,11 @@ var ts; if (!links.referenced) { links.referenced = true; var node = getDeclarationOfAliasSymbol(symbol); - if (node.kind === 231 /* ExportAssignment */) { + if (node.kind === 234 /* ExportAssignment */) { // export default checkExpressionCached(node.expression); } - else if (node.kind === 234 /* ExportSpecifier */) { + else if (node.kind === 237 /* ExportSpecifier */) { // export { } or export { as foo } checkExpressionCached(node.propertyName || node.name); } @@ -15673,7 +15976,7 @@ var ts; // This function is only for imports with entity names function getSymbolOfPartOfRightHandSideOfImportEquals(entityName, importDeclaration) { if (!importDeclaration) { - importDeclaration = ts.getAncestor(entityName, 225 /* ImportEqualsDeclaration */); + importDeclaration = ts.getAncestor(entityName, 228 /* ImportEqualsDeclaration */); ts.Debug.assert(importDeclaration !== undefined); } // There are three things we might try to look for. In the following examples, @@ -15686,13 +15989,13 @@ var ts; entityName = entityName.parent; } // Check for case 1 and 3 in the above example - if (entityName.kind === 69 /* Identifier */ || entityName.parent.kind === 137 /* QualifiedName */) { + if (entityName.kind === 69 /* Identifier */ || entityName.parent.kind === 138 /* QualifiedName */) { return resolveEntityName(entityName, 1536 /* Namespace */); } else { // Case 2 in above example // entityName.kind could be a QualifiedName or a Missing identifier - ts.Debug.assert(entityName.parent.kind === 225 /* ImportEqualsDeclaration */); + ts.Debug.assert(entityName.parent.kind === 228 /* ImportEqualsDeclaration */); return resolveEntityName(entityName, 107455 /* Value */ | 793056 /* Type */ | 1536 /* Namespace */); } } @@ -15712,9 +16015,9 @@ var ts; return undefined; } } - else if (name.kind === 137 /* QualifiedName */ || name.kind === 170 /* PropertyAccessExpression */) { - var left = name.kind === 137 /* QualifiedName */ ? name.left : name.expression; - var right = name.kind === 137 /* QualifiedName */ ? name.right : name.name; + else if (name.kind === 138 /* QualifiedName */ || name.kind === 171 /* PropertyAccessExpression */) { + var left = name.kind === 138 /* QualifiedName */ ? name.left : name.expression; + var right = name.kind === 138 /* QualifiedName */ ? name.right : name.name; var namespace = resolveEntityName(left, 1536 /* Namespace */, ignoreErrors); if (!namespace || namespace === unknownSymbol || ts.nodeIsMissing(right)) { return undefined; @@ -15749,7 +16052,7 @@ var ts; } var isRelative = ts.isExternalModuleNameRelative(moduleName); if (!isRelative) { - var symbol = getSymbol(globals, "\"" + moduleName + "\"", 512 /* ValueModule */); + var symbol = getSymbol(globals, '"' + moduleName + '"', 512 /* ValueModule */); if (symbol) { // merged symbol is module declaration symbol combined with all augmentations return getMergedSymbol(symbol); @@ -15900,7 +16203,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 === 146 /* Constructor */ && ts.nodeIsPresent(member.body)) { + if (member.kind === 147 /* Constructor */ && ts.nodeIsPresent(member.body)) { return member; } } @@ -15971,21 +16274,15 @@ var ts; } } switch (location_1.kind) { - case 252 /* SourceFile */: + case 255 /* SourceFile */: if (!ts.isExternalOrCommonJsModule(location_1)) { break; } - case 222 /* ModuleDeclaration */: + case 224 /* ModuleDeclaration */: if (result = callback(getSymbolOfNode(location_1).exports)) { return result; } break; - case 218 /* ClassDeclaration */: - case 219 /* InterfaceDeclaration */: - if (result = callback(getSymbolOfNode(location_1).members)) { - return result; - } - break; } } return callback(globals); @@ -16022,7 +16319,7 @@ var ts; return ts.forEachValue(symbols, function (symbolFromSymbolTable) { if (symbolFromSymbolTable.flags & 8388608 /* Alias */ && symbolFromSymbolTable.name !== "export=" - && !ts.getDeclarationOfKind(symbolFromSymbolTable, 234 /* ExportSpecifier */)) { + && !ts.getDeclarationOfKind(symbolFromSymbolTable, 237 /* ExportSpecifier */)) { if (!useOnlyExternalAliasing || // Is this external alias, then use it to name ts.forEach(symbolFromSymbolTable.declarations, ts.isExternalModuleImportEqualsDeclaration)) { @@ -16041,7 +16338,9 @@ var ts; }); } if (symbol) { - return forEachSymbolTableInScope(enclosingDeclaration, getAccessibleSymbolChainFromSymbolTable); + if (!(isPropertyOrMethodDeclarationSymbol(symbol))) { + return forEachSymbolTableInScope(enclosingDeclaration, getAccessibleSymbolChainFromSymbolTable); + } } } function needsQualification(symbol, enclosingDeclaration, meaning) { @@ -16059,7 +16358,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, 234 /* ExportSpecifier */)) ? resolveAlias(symbolFromSymbolTable) : symbolFromSymbolTable; + symbolFromSymbolTable = (symbolFromSymbolTable.flags & 8388608 /* Alias */ && !ts.getDeclarationOfKind(symbolFromSymbolTable, 237 /* ExportSpecifier */)) ? resolveAlias(symbolFromSymbolTable) : symbolFromSymbolTable; if (symbolFromSymbolTable.flags & meaning) { qualify = true; return true; @@ -16069,6 +16368,24 @@ var ts; }); return qualify; } + function isPropertyOrMethodDeclarationSymbol(symbol) { + if (symbol.declarations && symbol.declarations.length) { + for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { + var declaration = _a[_i]; + switch (declaration.kind) { + case 144 /* PropertyDeclaration */: + case 146 /* MethodDeclaration */: + case 148 /* GetAccessor */: + case 149 /* SetAccessor */: + continue; + default: + return false; + } + } + return true; + } + return false; + } function isSymbolAccessible(symbol, enclosingDeclaration, meaning) { if (symbol && enclosingDeclaration && !(symbol.flags & 262144 /* TypeParameter */)) { var initialSymbol = symbol; @@ -16132,7 +16449,7 @@ var ts; } } function hasExternalModuleSymbol(declaration) { - return ts.isAmbientModule(declaration) || (declaration.kind === 252 /* SourceFile */ && ts.isExternalOrCommonJsModule(declaration)); + return ts.isAmbientModule(declaration) || (declaration.kind === 255 /* SourceFile */ && ts.isExternalOrCommonJsModule(declaration)); } function hasVisibleDeclarations(symbol) { var aliasesToMakeVisible; @@ -16168,12 +16485,12 @@ var ts; function isEntityNameVisible(entityName, enclosingDeclaration) { // get symbol of the first identifier of the entityName var meaning; - if (entityName.parent.kind === 156 /* TypeQuery */) { + if (entityName.parent.kind === 157 /* TypeQuery */ || ts.isExpressionWithTypeArgumentsInClassExtendsClause(entityName.parent)) { // Typeof value meaning = 107455 /* Value */ | 1048576 /* ExportValue */; } - else if (entityName.kind === 137 /* QualifiedName */ || entityName.kind === 170 /* PropertyAccessExpression */ || - entityName.parent.kind === 225 /* ImportEqualsDeclaration */) { + else if (entityName.kind === 138 /* QualifiedName */ || entityName.kind === 171 /* PropertyAccessExpression */ || + entityName.parent.kind === 228 /* ImportEqualsDeclaration */) { // Left identifier from type reference or TypeAlias // Entity name of the import declaration meaning = 1536 /* Namespace */; @@ -16244,10 +16561,10 @@ var ts; function getTypeAliasForTypeLiteral(type) { if (type.symbol && type.symbol.flags & 2048 /* TypeLiteral */) { var node = type.symbol.declarations[0].parent; - while (node.kind === 162 /* ParenthesizedType */) { + while (node.kind === 163 /* ParenthesizedType */) { node = node.parent; } - if (node.kind === 220 /* TypeAliasDeclaration */) { + if (node.kind === 222 /* TypeAliasDeclaration */) { return getSymbolOfNode(node); } } @@ -16255,7 +16572,7 @@ var ts; } function isTopLevelInExternalModuleAugmentation(node) { return node && node.parent && - node.parent.kind === 223 /* ModuleBlock */ && + node.parent.kind === 225 /* ModuleBlock */ && ts.isExternalModuleAugmentation(node.parent.parent); } function getSymbolDisplayBuilder() { @@ -16266,10 +16583,10 @@ var ts; return ts.declarationNameToString(declaration.name); } switch (declaration.kind) { - case 190 /* ClassExpression */: + case 191 /* ClassExpression */: return "(Anonymous class)"; - case 177 /* FunctionExpression */: - case 178 /* ArrowFunction */: + case 178 /* FunctionExpression */: + case 179 /* ArrowFunction */: return "(Anonymous function)"; } } @@ -16445,14 +16762,14 @@ var ts; while (i < length_1) { // Find group of type arguments for type parameters with the same declaring container. var start = i; - var parent_4 = getParentSymbolOfTypeParameter(outerTypeParameters[i]); + var parent_5 = getParentSymbolOfTypeParameter(outerTypeParameters[i]); do { i++; - } while (i < length_1 && getParentSymbolOfTypeParameter(outerTypeParameters[i]) === parent_4); + } while (i < length_1 && getParentSymbolOfTypeParameter(outerTypeParameters[i]) === parent_5); // When type parameters are their own type arguments for the whole group (i.e. we have // the default outer type arguments), we don't show the group. if (!ts.rangeEquals(outerTypeParameters, typeArguments, start, i)) { - writeSymbolTypeReference(parent_4, typeArguments, start, i, flags); + writeSymbolTypeReference(parent_5, typeArguments, start, i, flags); writePunctuation(writer, 21 /* DotToken */); } } @@ -16518,7 +16835,7 @@ var ts; var isNonLocalFunctionSymbol = !!(symbol.flags & 16 /* Function */) && (symbol.parent || ts.forEach(symbol.declarations, function (declaration) { - return declaration.parent.kind === 252 /* SourceFile */ || declaration.parent.kind === 223 /* ModuleBlock */; + return declaration.parent.kind === 255 /* SourceFile */ || declaration.parent.kind === 225 /* ModuleBlock */; })); if (isStaticMethodSymbol || isNonLocalFunctionSymbol) { // typeof is allowed only for static/non local functions @@ -16659,7 +16976,12 @@ var ts; if (ts.isRestParameter(parameterNode)) { writePunctuation(writer, 22 /* DotDotDotToken */); } - appendSymbolNameOnly(p, writer); + if (ts.isBindingPattern(parameterNode.name)) { + buildBindingPatternDisplay(parameterNode.name, writer, enclosingDeclaration, flags, symbolStack); + } + else { + appendSymbolNameOnly(p, writer); + } if (isOptionalParameter(parameterNode)) { writePunctuation(writer, 53 /* QuestionToken */); } @@ -16667,19 +16989,59 @@ var ts; 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 === 166 /* ObjectBindingPattern */) { + writePunctuation(writer, 15 /* OpenBraceToken */); + buildDisplayForCommaSeparatedList(bindingPattern.elements, writer, function (e) { return buildBindingElementDisplay(e, writer, enclosingDeclaration, flags, symbolStack); }); + writePunctuation(writer, 16 /* CloseBraceToken */); + } + else if (bindingPattern.kind === 167 /* ArrayBindingPattern */) { + writePunctuation(writer, 19 /* 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, 20 /* CloseBracketToken */); + } + } + function buildBindingElementDisplay(bindingElement, writer, enclosingDeclaration, flags, symbolStack) { + if (bindingElement.kind === 192 /* OmittedExpression */) { + return; + } + ts.Debug.assert(bindingElement.kind === 168 /* BindingElement */); + if (bindingElement.propertyName) { + writer.writeSymbol(ts.getTextOfNode(bindingElement.propertyName), bindingElement.symbol); + writePunctuation(writer, 54 /* ColonToken */); + writeSpace(writer); + } + if (ts.isBindingPattern(bindingElement.name)) { + buildBindingPatternDisplay(bindingElement.name, writer, enclosingDeclaration, flags, symbolStack); + } + else { + if (bindingElement.dotDotDotToken) { + writePunctuation(writer, 22 /* DotDotDotToken */); + } + appendSymbolNameOnly(bindingElement.symbol, writer); + } + } function buildDisplayForTypeParametersAndDelimiters(typeParameters, writer, enclosingDeclaration, flags, symbolStack) { if (typeParameters && typeParameters.length) { writePunctuation(writer, 25 /* LessThanToken */); - for (var i = 0; i < typeParameters.length; i++) { - if (i > 0) { - writePunctuation(writer, 24 /* CommaToken */); - writeSpace(writer); - } - buildTypeParameterDisplay(typeParameters[i], writer, enclosingDeclaration, flags, symbolStack); - } + buildDisplayForCommaSeparatedList(typeParameters, writer, function (p) { return buildTypeParameterDisplay(p, writer, enclosingDeclaration, flags, symbolStack); }); writePunctuation(writer, 27 /* GreaterThanToken */); } } + function buildDisplayForCommaSeparatedList(list, writer, action) { + for (var i = 0; i < list.length; i++) { + if (i > 0) { + writePunctuation(writer, 24 /* CommaToken */); + writeSpace(writer); + } + action(list[i]); + } + } function buildDisplayForTypeArgumentsAndDelimiters(typeParameters, mapper, writer, enclosingDeclaration, flags, symbolStack) { if (typeParameters && typeParameters.length) { writePunctuation(writer, 25 /* LessThanToken */); @@ -16693,10 +17055,16 @@ var ts; writePunctuation(writer, 27 /* GreaterThanToken */); } } - function buildDisplayForParametersAndDelimiters(parameters, writer, enclosingDeclaration, flags, symbolStack) { + function buildDisplayForParametersAndDelimiters(thisType, parameters, writer, enclosingDeclaration, flags, symbolStack) { writePunctuation(writer, 17 /* OpenParenToken */); + if (thisType) { + writeKeyword(writer, 97 /* ThisKeyword */); + writePunctuation(writer, 54 /* ColonToken */); + writeSpace(writer); + buildTypeDisplay(thisType, writer, enclosingDeclaration, flags, symbolStack); + } for (var i = 0; i < parameters.length; i++) { - if (i > 0) { + if (i > 0 || thisType) { writePunctuation(writer, 24 /* CommaToken */); writeSpace(writer); } @@ -16746,7 +17114,7 @@ var ts; else { buildDisplayForTypeParametersAndDelimiters(signature.typeParameters, writer, enclosingDeclaration, flags, symbolStack); } - buildDisplayForParametersAndDelimiters(signature.parameters, writer, enclosingDeclaration, flags, symbolStack); + buildDisplayForParametersAndDelimiters(signature.thisType, signature.parameters, writer, enclosingDeclaration, flags, symbolStack); buildReturnTypeDisplay(signature, writer, enclosingDeclaration, flags, symbolStack); } return _displayBuilder || (_displayBuilder = { @@ -16773,86 +17141,86 @@ var ts; return false; function determineIfDeclarationIsVisible() { switch (node.kind) { - case 167 /* BindingElement */: + case 168 /* BindingElement */: return isDeclarationVisible(node.parent.parent); - case 215 /* VariableDeclaration */: + case 217 /* 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 222 /* ModuleDeclaration */: - case 218 /* ClassDeclaration */: - case 219 /* InterfaceDeclaration */: - case 220 /* TypeAliasDeclaration */: - case 217 /* FunctionDeclaration */: - case 221 /* EnumDeclaration */: - case 225 /* ImportEqualsDeclaration */: + case 224 /* ModuleDeclaration */: + case 220 /* ClassDeclaration */: + case 221 /* InterfaceDeclaration */: + case 222 /* TypeAliasDeclaration */: + case 219 /* FunctionDeclaration */: + case 223 /* EnumDeclaration */: + case 228 /* ImportEqualsDeclaration */: // external module augmentation is always visible if (ts.isExternalModuleAugmentation(node)) { return true; } - var parent_5 = getDeclarationContainer(node); + var parent_6 = 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 !== 225 /* ImportEqualsDeclaration */ && parent_5.kind !== 252 /* SourceFile */ && ts.isInAmbientContext(parent_5))) { - return isGlobalSourceFile(parent_5); + !(node.kind !== 228 /* ImportEqualsDeclaration */ && parent_6.kind !== 255 /* SourceFile */ && ts.isInAmbientContext(parent_6))) { + return isGlobalSourceFile(parent_6); } // Exported members/ambient module elements (exception import declaration) are visible if parent is visible - return isDeclarationVisible(parent_5); - case 143 /* PropertyDeclaration */: - case 142 /* PropertySignature */: - case 147 /* GetAccessor */: - case 148 /* SetAccessor */: - case 145 /* MethodDeclaration */: - case 144 /* MethodSignature */: + return isDeclarationVisible(parent_6); + case 144 /* PropertyDeclaration */: + case 143 /* PropertySignature */: + case 148 /* GetAccessor */: + case 149 /* SetAccessor */: + case 146 /* MethodDeclaration */: + case 145 /* MethodSignature */: if (node.flags & (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 146 /* Constructor */: - case 150 /* ConstructSignature */: - case 149 /* CallSignature */: - case 151 /* IndexSignature */: - case 140 /* Parameter */: - case 223 /* ModuleBlock */: - case 154 /* FunctionType */: - case 155 /* ConstructorType */: - case 157 /* TypeLiteral */: - case 153 /* TypeReference */: - case 158 /* ArrayType */: - case 159 /* TupleType */: - case 160 /* UnionType */: - case 161 /* IntersectionType */: - case 162 /* ParenthesizedType */: + case 147 /* Constructor */: + case 151 /* ConstructSignature */: + case 150 /* CallSignature */: + case 152 /* IndexSignature */: + case 141 /* Parameter */: + case 225 /* ModuleBlock */: + case 155 /* FunctionType */: + case 156 /* ConstructorType */: + case 158 /* TypeLiteral */: + case 154 /* TypeReference */: + case 159 /* ArrayType */: + case 160 /* TupleType */: + case 161 /* UnionType */: + case 162 /* IntersectionType */: + case 163 /* 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 227 /* ImportClause */: - case 228 /* NamespaceImport */: - case 230 /* ImportSpecifier */: + case 230 /* ImportClause */: + case 231 /* NamespaceImport */: + case 233 /* ImportSpecifier */: return false; // Type parameters are always visible - case 139 /* TypeParameter */: + case 140 /* TypeParameter */: // Source file is always visible - case 252 /* SourceFile */: + case 255 /* SourceFile */: return true; // Export assignments do not create name bindings outside the module - case 231 /* ExportAssignment */: + case 234 /* ExportAssignment */: return false; default: - ts.Debug.fail("isDeclarationVisible unknown: SyntaxKind: " + node.kind); + return false; } } } function collectLinkedAliases(node) { var exportSymbol; - if (node.parent && node.parent.kind === 231 /* ExportAssignment */) { + if (node.parent && node.parent.kind === 234 /* ExportAssignment */) { exportSymbol = resolveName(node.parent, node.text, 107455 /* Value */ | 793056 /* Type */ | 1536 /* Namespace */ | 8388608 /* Alias */, ts.Diagnostics.Cannot_find_name_0, node); } - else if (node.parent.kind === 234 /* ExportSpecifier */) { + else if (node.parent.kind === 237 /* ExportSpecifier */) { var exportSpecifier = node.parent; exportSymbol = exportSpecifier.parent.parent.moduleSpecifier ? getExternalModuleMember(exportSpecifier.parent.parent, exportSpecifier) : @@ -16946,12 +17314,12 @@ var ts; node = ts.getRootDeclaration(node); while (node) { switch (node.kind) { - case 215 /* VariableDeclaration */: - case 216 /* VariableDeclarationList */: - case 230 /* ImportSpecifier */: - case 229 /* NamedImports */: - case 228 /* NamespaceImport */: - case 227 /* ImportClause */: + case 217 /* VariableDeclaration */: + case 218 /* VariableDeclarationList */: + case 233 /* ImportSpecifier */: + case 232 /* NamedImports */: + case 231 /* NamespaceImport */: + case 230 /* ImportClause */: node = node.parent; break; default: @@ -16988,7 +17356,7 @@ var ts; case 9 /* StringLiteral */: case 8 /* NumericLiteral */: return name.text; - case 138 /* ComputedPropertyName */: + case 139 /* ComputedPropertyName */: if (ts.isStringOrNumericLiteral(name.expression.kind)) { return name.expression.text; } @@ -16996,9 +17364,9 @@ var ts; return undefined; } function isComputedNonLiteralName(name) { - return name.kind === 138 /* ComputedPropertyName */ && !ts.isStringOrNumericLiteral(name.expression.kind); + return name.kind === 139 /* ComputedPropertyName */ && !ts.isStringOrNumericLiteral(name.expression.kind); } - // Return the inferred type for a binding element + /** Return the inferred type for a binding element */ function getTypeForBindingElement(declaration) { var pattern = declaration.parent; var parentType = getTypeForBindingElementParent(pattern.parent); @@ -17016,13 +17384,16 @@ var ts; return parentType; } var type; - if (pattern.kind === 165 /* ObjectBindingPattern */) { + if (pattern.kind === 166 /* ObjectBindingPattern */) { // Use explicitly specified property name ({ p: xxx } form), or otherwise the implied name ({ p } form) var name_10 = declaration.propertyName || declaration.name; if (isComputedNonLiteralName(name_10)) { // 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 = getTextOfPropertyName(name_10); @@ -17060,6 +17431,11 @@ var ts; 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. + if (strictNullChecks && declaration.initializer && !(getNullableKind(checkExpressionCached(declaration.initializer)) & 32 /* Undefined */)) { + type = removeNullableKind(type, 32 /* Undefined */); + } return type; } function getTypeForVariableLikeDeclarationFromJSDocComment(declaration) { @@ -17074,16 +17450,16 @@ var ts; if (typeTag && typeTag.typeExpression) { return typeTag.typeExpression.type; } - if (declaration.kind === 215 /* VariableDeclaration */ && - declaration.parent.kind === 216 /* VariableDeclarationList */ && - declaration.parent.parent.kind === 197 /* VariableStatement */) { + if (declaration.kind === 217 /* VariableDeclaration */ && + declaration.parent.kind === 218 /* VariableDeclarationList */ && + declaration.parent.parent.kind === 199 /* 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 === 140 /* Parameter */) { + else if (declaration.kind === 141 /* Parameter */) { // If it's a parameter, see if the parent has a jsdoc comment with an @param // annotation. var paramTag = ts.getCorrespondingJSDocParameterTag(declaration); @@ -17105,10 +17481,10 @@ var ts; } } // A variable declared in a for..in statement is always of type string - if (declaration.parent.parent.kind === 204 /* ForInStatement */) { + if (declaration.parent.parent.kind === 206 /* ForInStatement */) { return stringType; } - if (declaration.parent.parent.kind === 205 /* ForOfStatement */) { + if (declaration.parent.parent.kind === 207 /* 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, @@ -17120,21 +17496,24 @@ var ts; } // Use type from type annotation if one is present if (declaration.type) { - return getTypeFromTypeNode(declaration.type); + var type = getTypeFromTypeNode(declaration.type); + return strictNullChecks && declaration.questionToken ? addNullableKind(type, 32 /* Undefined */) : type; } - if (declaration.kind === 140 /* Parameter */) { + if (declaration.kind === 141 /* 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 === 148 /* SetAccessor */ && !ts.hasDynamicName(func)) { - var getter = ts.getDeclarationOfKind(declaration.parent.symbol, 147 /* GetAccessor */); + if (func.kind === 149 /* SetAccessor */ && !ts.hasDynamicName(func)) { + var getter = ts.getDeclarationOfKind(declaration.parent.symbol, 148 /* GetAccessor */); if (getter) { return getReturnTypeOfSignature(getSignatureFromDeclaration(getter)); } } // Use contextual parameter type if one is available - var type = getContextuallyTypedParameterType(declaration); + var type = declaration.symbol.name === "this" + ? getContextuallyTypedThisType(func) + : getContextuallyTypedParameterType(declaration); if (type) { - return type; + return strictNullChecks && declaration.questionToken ? addNullableKind(type, 32 /* Undefined */) : type; } } // Use the type of the initializer expression if one is present @@ -17142,7 +17521,7 @@ var ts; return checkExpressionCached(declaration.initializer); } // If it is a short-hand property assignment, use the type of the identifier - if (declaration.kind === 250 /* ShorthandPropertyAssignment */) { + if (declaration.kind === 253 /* ShorthandPropertyAssignment */) { return checkIdentifier(declaration.name); } // If the declaration specifies a binding pattern, use the type implied by the binding pattern @@ -17157,11 +17536,16 @@ var ts; // pattern. Otherwise, it is the type any. function getTypeFromBindingElement(element, includePatternInType) { if (element.initializer) { - return getWidenedType(checkExpressionCached(element.initializer)); + var type = checkExpressionCached(element.initializer); + reportErrorsFromWidening(element, type); + return getWidenedType(type); } if (ts.isBindingPattern(element.name)) { return getTypeFromBindingPattern(element.name, includePatternInType); } + if (compilerOptions.noImplicitAny) { + reportImplicitAnyError(element, anyType); + } return anyType; } // Return the type implied by an object binding pattern @@ -17198,7 +17582,7 @@ var ts; return languageVersion >= 2 /* ES6 */ ? 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 === 191 /* OmittedExpression */ ? anyType : getTypeFromBindingElement(e, includePatternInType); }); + var elementTypes = ts.map(elements, function (e) { return e.kind === 192 /* OmittedExpression */ ? anyType : getTypeFromBindingElement(e, includePatternInType); }); if (includePatternInType) { var result = createNewTupleType(elementTypes); result.pattern = pattern; @@ -17214,7 +17598,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) { - return pattern.kind === 165 /* ObjectBindingPattern */ + return pattern.kind === 166 /* ObjectBindingPattern */ ? getTypeFromObjectBindingPattern(pattern, includePatternInType) : getTypeFromArrayBindingPattern(pattern, includePatternInType); } @@ -17236,7 +17620,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 === 249 /* PropertyAssignment */) { + if (declaration.kind === 252 /* PropertyAssignment */) { return type; } return getWidenedType(type); @@ -17246,7 +17630,7 @@ var ts; // Report implicit any errors unless this is a private property within an ambient declaration if (reportErrors && compilerOptions.noImplicitAny) { var root = ts.getRootDeclaration(declaration); - if (!isPrivateWithinAmbient(root) && !(root.kind === 140 /* Parameter */ && isPrivateWithinAmbient(root.parent))) { + if (!isPrivateWithinAmbient(root) && !(root.kind === 141 /* Parameter */ && isPrivateWithinAmbient(root.parent))) { reportImplicitAnyError(declaration, type); } } @@ -17261,21 +17645,21 @@ var ts; } // Handle catch clause variables var declaration = symbol.valueDeclaration; - if (declaration.parent.kind === 248 /* CatchClause */) { + if (declaration.parent.kind === 251 /* CatchClause */) { return links.type = anyType; } // Handle export default expressions - if (declaration.kind === 231 /* ExportAssignment */) { + if (declaration.kind === 234 /* ExportAssignment */) { return links.type = checkExpression(declaration.expression); } // Handle module.exports = expr - if (declaration.kind === 185 /* BinaryExpression */) { + if (declaration.kind === 186 /* BinaryExpression */) { return links.type = getUnionType(ts.map(symbol.declarations, function (decl) { return checkExpressionCached(decl.right); })); } - if (declaration.kind === 170 /* PropertyAccessExpression */) { + if (declaration.kind === 171 /* PropertyAccessExpression */) { // Declarations only exist for property access expressions for certain // special assignment kinds - if (declaration.parent.kind === 185 /* BinaryExpression */) { + if (declaration.parent.kind === 186 /* BinaryExpression */) { // Handle exports.p = expr or this.p = expr or className.prototype.method = expr return links.type = checkExpressionCached(declaration.parent.right); } @@ -17305,7 +17689,7 @@ var ts; } function getAnnotatedAccessorType(accessor) { if (accessor) { - if (accessor.kind === 147 /* GetAccessor */) { + if (accessor.kind === 148 /* GetAccessor */) { return accessor.type && getTypeFromTypeNode(accessor.type); } else { @@ -17318,11 +17702,17 @@ var ts; function getTypeOfAccessors(symbol) { var links = getSymbolLinks(symbol); if (!links.type) { + var getter = ts.getDeclarationOfKind(symbol, 148 /* GetAccessor */); + var setter = ts.getDeclarationOfKind(symbol, 149 /* SetAccessor */); + if (getter && getter.flags & 134217728 /* JavaScriptFile */) { + var jsDocType = getTypeForVariableLikeDeclarationFromJSDocComment(getter); + if (jsDocType) { + return links.type = jsDocType; + } + } if (!pushTypeResolution(symbol, 0 /* Type */)) { return unknownType; } - var getter = ts.getDeclarationOfKind(symbol, 147 /* GetAccessor */); - var setter = ts.getDeclarationOfKind(symbol, 148 /* SetAccessor */); var type = void 0; // First try to see if the user specified a return type on the get-accessor. var getterReturnType = getAnnotatedAccessorType(getter); @@ -17351,7 +17741,7 @@ var ts; if (!popTypeResolution()) { type = anyType; if (compilerOptions.noImplicitAny) { - var getter_1 = ts.getDeclarationOfKind(symbol, 147 /* GetAccessor */); + var getter_1 = ts.getDeclarationOfKind(symbol, 148 /* 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)); } } @@ -17451,9 +17841,9 @@ var ts; if (!node) { return typeParameters; } - if (node.kind === 218 /* ClassDeclaration */ || node.kind === 190 /* ClassExpression */ || - node.kind === 217 /* FunctionDeclaration */ || node.kind === 177 /* FunctionExpression */ || - node.kind === 145 /* MethodDeclaration */ || node.kind === 178 /* ArrowFunction */) { + if (node.kind === 220 /* ClassDeclaration */ || node.kind === 191 /* ClassExpression */ || + node.kind === 219 /* FunctionDeclaration */ || node.kind === 178 /* FunctionExpression */ || + node.kind === 146 /* MethodDeclaration */ || node.kind === 179 /* ArrowFunction */) { var declarations = node.typeParameters; if (declarations) { return appendTypeParameters(appendOuterTypeParameters(typeParameters, node), declarations); @@ -17463,7 +17853,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, 219 /* InterfaceDeclaration */); + var declaration = symbol.flags & 32 /* Class */ ? symbol.valueDeclaration : ts.getDeclarationOfKind(symbol, 221 /* InterfaceDeclaration */); return appendOuterTypeParameters(undefined, declaration); } // The local type parameters are the combined set of type parameters from all declarations of the class, @@ -17472,8 +17862,8 @@ var ts; var result; for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var node = _a[_i]; - if (node.kind === 219 /* InterfaceDeclaration */ || node.kind === 218 /* ClassDeclaration */ || - node.kind === 190 /* ClassExpression */ || node.kind === 220 /* TypeAliasDeclaration */) { + if (node.kind === 221 /* InterfaceDeclaration */ || node.kind === 220 /* ClassDeclaration */ || + node.kind === 191 /* ClassExpression */ || node.kind === 222 /* TypeAliasDeclaration */) { var declaration = node; if (declaration.typeParameters) { result = appendTypeParameters(result, declaration.typeParameters); @@ -17613,7 +18003,7 @@ 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 === 219 /* InterfaceDeclaration */ && ts.getInterfaceBaseTypeNodes(declaration)) { + if (declaration.kind === 221 /* InterfaceDeclaration */ && ts.getInterfaceBaseTypeNodes(declaration)) { for (var _b = 0, _c = ts.getInterfaceBaseTypeNodes(declaration); _b < _c.length; _b++) { var node = _c[_b]; var baseType = getTypeFromTypeNode(node); @@ -17645,7 +18035,7 @@ var ts; function isIndependentInterface(symbol) { for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; - if (declaration.kind === 219 /* InterfaceDeclaration */) { + if (declaration.kind === 221 /* InterfaceDeclaration */) { if (declaration.flags & 16384 /* ContainsThis */) { return false; } @@ -17701,7 +18091,7 @@ var ts; if (!pushTypeResolution(symbol, 2 /* DeclaredType */)) { return unknownType; } - var declaration = ts.getDeclarationOfKind(symbol, 220 /* TypeAliasDeclaration */); + var declaration = ts.getDeclarationOfKind(symbol, 222 /* TypeAliasDeclaration */); var type = getTypeFromTypeNode(declaration.type); if (popTypeResolution()) { links.typeParameters = getLocalTypeParametersOfClassOrInterfaceOrTypeAlias(symbol); @@ -17734,7 +18124,7 @@ var ts; if (!links.declaredType) { var type = createType(512 /* TypeParameter */); type.symbol = symbol; - if (!ts.getDeclarationOfKind(symbol, 139 /* TypeParameter */).constraint) { + if (!ts.getDeclarationOfKind(symbol, 140 /* TypeParameter */).constraint) { type.constraint = noConstraintType; } links.declaredType = type; @@ -17790,11 +18180,13 @@ var ts; case 120 /* BooleanKeyword */: case 132 /* SymbolKeyword */: case 103 /* VoidKeyword */: - case 164 /* StringLiteralType */: + case 134 /* UndefinedKeyword */: + case 93 /* NullKeyword */: + case 165 /* StringLiteralType */: return true; - case 158 /* ArrayType */: + case 159 /* ArrayType */: return isIndependentType(node.elementType); - case 153 /* TypeReference */: + case 154 /* TypeReference */: return isIndependentTypeReference(node); } return false; @@ -17807,7 +18199,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 !== 146 /* Constructor */ && (!node.type || !isIndependentType(node.type))) { + if (node.kind !== 147 /* Constructor */ && (!node.type || !isIndependentType(node.type))) { return false; } for (var _i = 0, _a = node.parameters; _i < _a.length; _i++) { @@ -17828,12 +18220,12 @@ var ts; var declaration = symbol.declarations[0]; if (declaration) { switch (declaration.kind) { - case 143 /* PropertyDeclaration */: - case 142 /* PropertySignature */: + case 144 /* PropertyDeclaration */: + case 143 /* PropertySignature */: return isIndependentVariableLikeDeclaration(declaration); - case 145 /* MethodDeclaration */: - case 144 /* MethodSignature */: - case 146 /* Constructor */: + case 146 /* MethodDeclaration */: + case 145 /* MethodSignature */: + case 147 /* Constructor */: return isIndependentFunctionLikeDeclaration(declaration); } } @@ -17926,11 +18318,12 @@ var ts; type.typeArguments : ts.concatenate(type.typeArguments, [type]); resolveObjectTypeMembers(type, source, typeParameters, typeArguments); } - function createSignature(declaration, typeParameters, parameters, resolvedReturnType, typePredicate, minArgumentCount, hasRestParameter, hasStringLiterals) { + function createSignature(declaration, typeParameters, thisType, parameters, resolvedReturnType, typePredicate, minArgumentCount, hasRestParameter, hasStringLiterals) { var sig = new Signature(checker); sig.declaration = declaration; sig.typeParameters = typeParameters; sig.parameters = parameters; + sig.thisType = thisType; sig.resolvedReturnType = resolvedReturnType; sig.typePredicate = typePredicate; sig.minArgumentCount = minArgumentCount; @@ -17939,13 +18332,13 @@ var ts; return sig; } function cloneSignature(sig) { - return createSignature(sig.declaration, sig.typeParameters, sig.parameters, sig.resolvedReturnType, sig.typePredicate, sig.minArgumentCount, sig.hasRestParameter, sig.hasStringLiterals); + return createSignature(sig.declaration, sig.typeParameters, sig.thisType, sig.parameters, sig.resolvedReturnType, sig.typePredicate, sig.minArgumentCount, sig.hasRestParameter, sig.hasStringLiterals); } function getDefaultConstructSignatures(classType) { var baseConstructorType = getBaseConstructorTypeOfClass(classType); var baseSignatures = getSignaturesOfType(baseConstructorType, 1 /* Construct */); if (baseSignatures.length === 0) { - return [createSignature(undefined, classType.localTypeParameters, emptyArray, classType, /*typePredicate*/ undefined, 0, /*hasRestParameter*/ false, /*hasStringLiterals*/ false)]; + return [createSignature(undefined, classType.localTypeParameters, undefined, emptyArray, classType, /*typePredicate*/ undefined, 0, /*hasRestParameter*/ false, /*hasStringLiterals*/ false)]; } var baseTypeNode = getBaseTypeNodeOfClass(classType); var typeArguments = ts.map(baseTypeNode.typeArguments, getTypeFromTypeNode); @@ -17980,10 +18373,10 @@ var ts; addInheritedMembers(members, arrayType.properties); setObjectTypeMembers(type, members, arrayType.callSignatures, arrayType.constructSignatures, arrayType.stringIndexInfo, arrayType.numberIndexInfo); } - function findMatchingSignature(signatureList, signature, partialMatch, ignoreReturnTypes) { + function findMatchingSignature(signatureList, signature, partialMatch, ignoreThisTypes, ignoreReturnTypes) { for (var _i = 0, signatureList_1 = signatureList; _i < signatureList_1.length; _i++) { var s = signatureList_1[_i]; - if (compareSignaturesIdentical(s, signature, partialMatch, ignoreReturnTypes, compareTypesIdentical)) { + if (compareSignaturesIdentical(s, signature, partialMatch, ignoreThisTypes, ignoreReturnTypes, compareTypesIdentical)) { return s; } } @@ -17996,7 +18389,7 @@ var ts; return undefined; } for (var i = 1; i < signatureLists.length; i++) { - if (!findMatchingSignature(signatureLists[i], signature, /*partialMatch*/ false, /*ignoreReturnTypes*/ false)) { + if (!findMatchingSignature(signatureLists[i], signature, /*partialMatch*/ false, /*ignoreThisTypes*/ false, /*ignoreReturnTypes*/ false)) { return undefined; } } @@ -18005,7 +18398,7 @@ var ts; var result = undefined; for (var i = 0; i < signatureLists.length; i++) { // Allow matching non-generic signatures to have excess parameters and different return types - var match = i === listIndex ? signature : findMatchingSignature(signatureLists[i], signature, /*partialMatch*/ true, /*ignoreReturnTypes*/ true); + var match = i === listIndex ? signature : findMatchingSignature(signatureLists[i], signature, /*partialMatch*/ true, /*ignoreThisTypes*/ true, /*ignoreReturnTypes*/ true); if (!match) { return undefined; } @@ -18026,13 +18419,16 @@ var ts; for (var _i = 0, _a = signatureLists[i]; _i < _a.length; _i++) { var signature = _a[_i]; // Only process signatures with parameter lists that aren't already in the result list - if (!result || !findMatchingSignature(result, signature, /*partialMatch*/ false, /*ignoreReturnTypes*/ true)) { + if (!result || !findMatchingSignature(result, signature, /*partialMatch*/ false, /*ignoreThisTypes*/ true, /*ignoreReturnTypes*/ true)) { var unionSignatures = findMatchingSignatures(signatureLists, signature, i); if (unionSignatures) { var s = signature; // Union the result types when more than one signature matches if (unionSignatures.length > 1) { s = cloneSignature(signature); + if (ts.forEach(unionSignatures, function (sig) { return sig.thisType; })) { + s.thisType = getUnionType(ts.map(unionSignatures, function (sig) { return sig.thisType || anyType; })); + } // Clear resolved return type we possibly got from cloneSignature s.resolvedReturnType = undefined; s.unionSignatures = unionSignatures; @@ -18232,7 +18628,7 @@ var ts; type = globalBooleanType; } else if (type.flags & 16777216 /* ESSymbol */) { - type = globalESSymbolType; + type = getGlobalESSymbolType(); } return type; } @@ -18401,7 +18797,7 @@ var ts; } function isOptionalParameter(node) { if (node.flags & 134217728 /* JavaScriptFile */) { - if (node.type && node.type.kind === 264 /* JSDocOptionalType */) { + if (node.type && node.type.kind === 267 /* JSDocOptionalType */) { return true; } var paramTag = ts.getCorrespondingJSDocParameterTag(node); @@ -18410,7 +18806,7 @@ var ts; return true; } if (paramTag.typeExpression) { - return paramTag.typeExpression.type.kind === 264 /* JSDocOptionalType */; + return paramTag.typeExpression.type.kind === 267 /* JSDocOptionalType */; } } } @@ -18446,7 +18842,7 @@ var ts; function getSignatureFromDeclaration(declaration) { var links = getNodeLinks(declaration); if (!links.resolvedSignature) { - var classType = declaration.kind === 146 /* Constructor */ ? + var classType = declaration.kind === 147 /* Constructor */ ? getDeclaredTypeOfClassOrInterface(getMergedSymbol(declaration.parent.symbol)) : undefined; var typeParameters = classType ? classType.localTypeParameters : @@ -18455,6 +18851,8 @@ var ts; var parameters = []; var hasStringLiterals = false; var minArgumentCount = -1; + var thisType = undefined; + var hasThisParameter = void 0; var isJSConstructSignature = ts.isJSDocConstructSignature(declaration); var returnType = undefined; var typePredicate = undefined; @@ -18469,13 +18867,19 @@ var ts; var resolvedSymbol = resolveName(param, paramSymbol.name, 107455 /* Value */, undefined, undefined); paramSymbol = resolvedSymbol; } - parameters.push(paramSymbol); - if (param.type && param.type.kind === 164 /* StringLiteralType */) { + if (i === 0 && paramSymbol.name === "this") { + hasThisParameter = true; + thisType = param.type ? getTypeFromTypeNode(param.type) : unknownType; + } + else { + parameters.push(paramSymbol); + } + if (param.type && param.type.kind === 165 /* StringLiteralType */) { hasStringLiterals = true; } if (param.initializer || param.questionToken || param.dotDotDotToken) { if (minArgumentCount < 0) { - minArgumentCount = i; + minArgumentCount = i - (hasThisParameter ? 1 : 0); } } else { @@ -18484,7 +18888,7 @@ var ts; } } if (minArgumentCount < 0) { - minArgumentCount = declaration.parameters.length; + minArgumentCount = declaration.parameters.length - (hasThisParameter ? 1 : 0); } if (isJSConstructSignature) { minArgumentCount--; @@ -18495,7 +18899,7 @@ var ts; } else if (declaration.type) { returnType = getTypeFromTypeNode(declaration.type); - if (declaration.type.kind === 152 /* TypePredicate */) { + if (declaration.type.kind === 153 /* TypePredicate */) { typePredicate = createTypePredicateFromTypePredicateNode(declaration.type); } } @@ -18508,15 +18912,15 @@ 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 === 147 /* GetAccessor */ && !ts.hasDynamicName(declaration)) { - var setter = ts.getDeclarationOfKind(declaration.symbol, 148 /* SetAccessor */); + if (declaration.kind === 148 /* GetAccessor */ && !ts.hasDynamicName(declaration)) { + var setter = ts.getDeclarationOfKind(declaration.symbol, 149 /* SetAccessor */); returnType = getAnnotatedAccessorType(setter); } if (!returnType && ts.nodeIsMissing(declaration.body)) { returnType = anyType; } } - links.resolvedSignature = createSignature(declaration, typeParameters, parameters, returnType, typePredicate, minArgumentCount, ts.hasRestParameter(declaration), hasStringLiterals); + links.resolvedSignature = createSignature(declaration, typeParameters, thisType, parameters, returnType, typePredicate, minArgumentCount, ts.hasRestParameter(declaration), hasStringLiterals); } return links.resolvedSignature; } @@ -18527,20 +18931,20 @@ var ts; for (var i = 0, len = symbol.declarations.length; i < len; i++) { var node = symbol.declarations[i]; switch (node.kind) { - case 154 /* FunctionType */: - case 155 /* ConstructorType */: - case 217 /* FunctionDeclaration */: - case 145 /* MethodDeclaration */: - case 144 /* MethodSignature */: - case 146 /* Constructor */: - case 149 /* CallSignature */: - case 150 /* ConstructSignature */: - case 151 /* IndexSignature */: - case 147 /* GetAccessor */: - case 148 /* SetAccessor */: - case 177 /* FunctionExpression */: - case 178 /* ArrowFunction */: - case 265 /* JSDocFunctionType */: + case 155 /* FunctionType */: + case 156 /* ConstructorType */: + case 219 /* FunctionDeclaration */: + case 146 /* MethodDeclaration */: + case 145 /* MethodSignature */: + case 147 /* Constructor */: + case 150 /* CallSignature */: + case 151 /* ConstructSignature */: + case 152 /* IndexSignature */: + case 148 /* GetAccessor */: + case 149 /* SetAccessor */: + case 178 /* FunctionExpression */: + case 179 /* ArrowFunction */: + case 268 /* 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). @@ -18627,7 +19031,7 @@ 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 === 146 /* Constructor */ || signature.declaration.kind === 150 /* ConstructSignature */; + var isConstructor = signature.declaration.kind === 147 /* Constructor */ || signature.declaration.kind === 151 /* ConstructSignature */; var type = createObjectType(65536 /* Anonymous */ | 262144 /* FromSignature */); type.members = emptySymbols; type.properties = emptyArray; @@ -18668,7 +19072,7 @@ var ts; return undefined; } function getConstraintDeclaration(type) { - return ts.getDeclarationOfKind(type.symbol, 139 /* TypeParameter */).constraint; + return ts.getDeclarationOfKind(type.symbol, 140 /* TypeParameter */).constraint; } function hasConstraintReferenceTo(type, target) { var checked; @@ -18701,7 +19105,7 @@ var ts; return typeParameter.constraint === noConstraintType ? undefined : typeParameter.constraint; } function getParentSymbolOfTypeParameter(typeParameter) { - return getSymbolOfNode(ts.getDeclarationOfKind(typeParameter.symbol, 139 /* TypeParameter */).parent); + return getSymbolOfNode(ts.getDeclarationOfKind(typeParameter.symbol, 140 /* TypeParameter */).parent); } function getTypeListId(types) { if (types) { @@ -18727,11 +19131,13 @@ var ts; // It is only necessary to do so if a constituent type might be the undefined type, the null type, the type // of an object literal or the anyFunctionType. This is because there are operations in the type checker // that care about the presence of such types at arbitrary depth in a containing type. - function getPropagatingFlagsOfTypes(types) { + function getPropagatingFlagsOfTypes(types, excludeKinds) { var result = 0; for (var _i = 0, types_3 = types; _i < types_3.length; _i++) { var type = types_3[_i]; - result |= type.flags; + if (!(type.flags & excludeKinds)) { + result |= type.flags; + } } return result & 14680064 /* PropagatingFlags */; } @@ -18739,7 +19145,8 @@ var ts; var id = getTypeListId(typeArguments); var type = target.instantiations[id]; if (!type) { - var flags = 4096 /* Reference */ | (typeArguments ? getPropagatingFlagsOfTypes(typeArguments) : 0); + var propagatedFlags = typeArguments ? getPropagatingFlagsOfTypes(typeArguments, /*excludeKinds*/ 0) : 0; + var flags = 4096 /* Reference */ | propagatedFlags; type = target.instantiations[id] = createObjectType(flags, target.symbol); type.target = target; type.typeArguments = typeArguments; @@ -18748,7 +19155,7 @@ var ts; } // Get type from reference to class or interface function getTypeFromClassOrInterfaceReference(node, symbol) { - var type = getDeclaredTypeOfSymbol(symbol); + var type = getDeclaredTypeOfSymbol(getMergedSymbol(symbol)); var typeParameters = type.localTypeParameters; if (typeParameters) { if (!node.typeArguments || node.typeArguments.length !== typeParameters.length) { @@ -18798,11 +19205,11 @@ var ts; } function getTypeReferenceName(node) { switch (node.kind) { - case 153 /* TypeReference */: + case 154 /* TypeReference */: return node.typeName; - case 263 /* JSDocTypeReference */: + case 266 /* JSDocTypeReference */: return node.name; - case 192 /* ExpressionWithTypeArguments */: + case 193 /* ExpressionWithTypeArguments */: // We only support expressions that are simple qualified names. For other // expressions this produces undefined. if (ts.isSupportedExpressionWithTypeArguments(node)) { @@ -18827,7 +19234,7 @@ var ts; if (symbol.flags & 524288 /* TypeAlias */) { return getTypeFromTypeAliasReference(node, symbol); } - if (symbol.flags & 107455 /* Value */ && node.kind === 263 /* JSDocTypeReference */) { + if (symbol.flags & 107455 /* Value */ && node.kind === 266 /* 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. @@ -18840,7 +19247,7 @@ var ts; if (!links.resolvedType) { var symbol = void 0; var type = void 0; - if (node.kind === 263 /* JSDocTypeReference */) { + if (node.kind === 266 /* JSDocTypeReference */) { var typeReferenceName = getTypeReferenceName(node); symbol = resolveTypeReferenceName(node, typeReferenceName); type = getTypeReferenceType(node, symbol); @@ -18849,7 +19256,7 @@ var ts; } else { // We only support expressions that are simple qualified names. For other expressions this produces undefined. - var typeNameOrExpression = node.kind === 153 /* TypeReference */ ? node.typeName : + var typeNameOrExpression = node.kind === 154 /* TypeReference */ ? node.typeName : ts.isSupportedExpressionWithTypeArguments(node) ? node.expression : undefined; symbol = typeNameOrExpression && resolveEntityName(typeNameOrExpression, 793056 /* Type */) || unknownSymbol; @@ -18882,9 +19289,9 @@ var ts; for (var _i = 0, declarations_3 = declarations; _i < declarations_3.length; _i++) { var declaration = declarations_3[_i]; switch (declaration.kind) { - case 218 /* ClassDeclaration */: - case 219 /* InterfaceDeclaration */: - case 221 /* EnumDeclaration */: + case 220 /* ClassDeclaration */: + case 221 /* InterfaceDeclaration */: + case 223 /* EnumDeclaration */: return declaration; } } @@ -18925,9 +19332,6 @@ var ts; var typeSymbol = namespaceSymbol && getSymbol(namespaceSymbol.exports, name, 793056 /* Type */); return typeSymbol && getDeclaredTypeOfSymbol(typeSymbol); } - function getGlobalESSymbolConstructorSymbol() { - return globalESSymbolConstructorSymbol || (globalESSymbolConstructorSymbol = getGlobalValueSymbol("Symbol")); - } /** * Creates a TypeReference for a generic `TypedPropertyDescriptor`. */ @@ -18944,10 +19348,10 @@ var ts; return genericGlobalType !== emptyGenericType ? createTypeReference(genericGlobalType, typeArguments) : emptyObjectType; } function createIterableType(elementType) { - return createTypeFromGenericGlobalType(globalIterableType, [elementType]); + return createTypeFromGenericGlobalType(getGlobalIterableType(), [elementType]); } function createIterableIteratorType(elementType) { - return createTypeFromGenericGlobalType(globalIterableIteratorType, [elementType]); + return createTypeFromGenericGlobalType(getGlobalIterableIteratorType(), [elementType]); } function createArrayType(elementType) { return createTypeFromGenericGlobalType(globalArrayType, [elementType]); @@ -18964,7 +19368,8 @@ var ts; return tupleTypes[id] || (tupleTypes[id] = createNewTupleType(elementTypes)); } function createNewTupleType(elementTypes) { - var type = createObjectType(8192 /* Tuple */ | getPropagatingFlagsOfTypes(elementTypes)); + var propagatedFlags = getPropagatingFlagsOfTypes(elementTypes, /*excludeKinds*/ 0); + var type = createObjectType(8192 /* Tuple */ | propagatedFlags); type.elementTypes = elementTypes; return type; } @@ -18979,6 +19384,14 @@ var ts; if (type.flags & typeSetKind) { addTypesToSet(typeSet, type.types, typeSetKind); } + else if (type.flags & (1 /* Any */ | 32 /* Undefined */ | 64 /* Null */)) { + if (type.flags & 1 /* Any */) + typeSet.containsAny = true; + if (type.flags & 32 /* Undefined */) + typeSet.containsUndefined = true; + if (type.flags & 64 /* Null */) + typeSet.containsNull = true; + } else if (!ts.contains(typeSet, type)) { typeSet.push(type); } @@ -19008,24 +19421,6 @@ var ts; } } } - function containsTypeAny(types) { - for (var _i = 0, types_5 = types; _i < types_5.length; _i++) { - var type = types_5[_i]; - if (isTypeAny(type)) { - return true; - } - } - return false; - } - function removeAllButLast(types, typeToRemove) { - var i = types.length; - while (i > 0 && types.length > 1) { - i--; - if (types[i] === typeToRemove) { - types.splice(i, 1); - } - } - } // We reduce the constituent type set to only include types that aren't subtypes of other types, unless // the noSubtypeReduction flag is specified, in which case we perform a simple deduplication based on // object identity. Subtype reduction is possible only when union types are known not to circularly @@ -19039,23 +19434,29 @@ var ts; } var typeSet = []; addTypesToSet(typeSet, types, 16384 /* Union */); - if (containsTypeAny(typeSet)) { + if (typeSet.containsAny) { return anyType; } - if (noSubtypeReduction) { - removeAllButLast(typeSet, undefinedType); - removeAllButLast(typeSet, nullType); + if (strictNullChecks) { + if (typeSet.containsNull) + typeSet.push(nullType); + if (typeSet.containsUndefined) + typeSet.push(undefinedType); } - else { + if (!noSubtypeReduction) { removeSubtypes(typeSet); } - if (typeSet.length === 1) { + if (typeSet.length === 0) { + return typeSet.containsNull ? nullType : undefinedType; + } + else if (typeSet.length === 1) { return typeSet[0]; } var id = getTypeListId(typeSet); var type = unionTypes[id]; if (!type) { - type = unionTypes[id] = createObjectType(16384 /* Union */ | getPropagatingFlagsOfTypes(typeSet)); + var propagatedFlags = getPropagatingFlagsOfTypes(typeSet, /*excludeKinds*/ 96 /* Nullable */); + type = unionTypes[id] = createObjectType(16384 /* Union */ | propagatedFlags); type.types = typeSet; } return type; @@ -19078,16 +19479,23 @@ var ts; } var typeSet = []; addTypesToSet(typeSet, types, 32768 /* Intersection */); - if (containsTypeAny(typeSet)) { + if (typeSet.containsAny) { return anyType; } + if (strictNullChecks) { + if (typeSet.containsNull) + typeSet.push(nullType); + if (typeSet.containsUndefined) + typeSet.push(undefinedType); + } if (typeSet.length === 1) { return typeSet[0]; } var id = getTypeListId(typeSet); var type = intersectionTypes[id]; if (!type) { - type = intersectionTypes[id] = createObjectType(32768 /* Intersection */ | getPropagatingFlagsOfTypes(typeSet)); + var propagatedFlags = getPropagatingFlagsOfTypes(typeSet, /*excludeKinds*/ 96 /* Nullable */); + type = intersectionTypes[id] = createObjectType(32768 /* Intersection */ | propagatedFlags); type.types = typeSet; } return type; @@ -19141,9 +19549,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 === 219 /* InterfaceDeclaration */)) { + if (parent && (ts.isClassLike(parent) || parent.kind === 221 /* InterfaceDeclaration */)) { if (!(container.flags & 32 /* Static */) && - (container.kind !== 146 /* Constructor */ || ts.isNodeDescendentOf(node, container.body))) { + (container.kind !== 147 /* Constructor */ || ts.isNodeDescendentOf(node, container.body))) { return getDeclaredTypeOfClassOrInterface(getSymbolOfNode(parent)).thisType; } } @@ -19160,8 +19568,8 @@ var ts; function getTypeFromTypeNode(node) { switch (node.kind) { case 117 /* AnyKeyword */: - case 254 /* JSDocAllType */: - case 255 /* JSDocUnknownType */: + case 257 /* JSDocAllType */: + case 258 /* JSDocUnknownType */: return anyType; case 131 /* StringKeyword */: return stringType; @@ -19173,51 +19581,55 @@ var ts; return esSymbolType; case 103 /* VoidKeyword */: return voidType; - case 163 /* ThisType */: + case 134 /* UndefinedKeyword */: + return undefinedType; + case 93 /* NullKeyword */: + return nullType; + case 164 /* ThisType */: return getTypeFromThisTypeNode(node); - case 164 /* StringLiteralType */: + case 165 /* StringLiteralType */: return getTypeFromStringLiteralTypeNode(node); - case 153 /* TypeReference */: - case 263 /* JSDocTypeReference */: + case 154 /* TypeReference */: + case 266 /* JSDocTypeReference */: return getTypeFromTypeReference(node); - case 152 /* TypePredicate */: + case 153 /* TypePredicate */: return booleanType; - case 192 /* ExpressionWithTypeArguments */: + case 193 /* ExpressionWithTypeArguments */: return getTypeFromTypeReference(node); - case 156 /* TypeQuery */: + case 157 /* TypeQuery */: return getTypeFromTypeQueryNode(node); - case 158 /* ArrayType */: - case 256 /* JSDocArrayType */: + case 159 /* ArrayType */: + case 259 /* JSDocArrayType */: return getTypeFromArrayTypeNode(node); - case 159 /* TupleType */: + case 160 /* TupleType */: return getTypeFromTupleTypeNode(node); - case 160 /* UnionType */: - case 257 /* JSDocUnionType */: + case 161 /* UnionType */: + case 260 /* JSDocUnionType */: return getTypeFromUnionTypeNode(node); - case 161 /* IntersectionType */: + case 162 /* IntersectionType */: return getTypeFromIntersectionTypeNode(node); - case 162 /* ParenthesizedType */: - case 259 /* JSDocNullableType */: - case 260 /* JSDocNonNullableType */: - case 267 /* JSDocConstructorType */: - case 268 /* JSDocThisType */: - case 264 /* JSDocOptionalType */: + case 163 /* ParenthesizedType */: + case 262 /* JSDocNullableType */: + case 263 /* JSDocNonNullableType */: + case 270 /* JSDocConstructorType */: + case 271 /* JSDocThisType */: + case 267 /* JSDocOptionalType */: return getTypeFromTypeNode(node.type); - case 154 /* FunctionType */: - case 155 /* ConstructorType */: - case 157 /* TypeLiteral */: - case 265 /* JSDocFunctionType */: - case 261 /* JSDocRecordType */: + case 155 /* FunctionType */: + case 156 /* ConstructorType */: + case 158 /* TypeLiteral */: + case 268 /* JSDocFunctionType */: + case 264 /* JSDocRecordType */: return getTypeFromTypeLiteralOrFunctionOrConstructorTypeNode(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 137 /* QualifiedName */: + case 138 /* QualifiedName */: var symbol = getSymbolAtLocation(node); return symbol && getDeclaredTypeOfSymbol(symbol); - case 258 /* JSDocTupleType */: + case 261 /* JSDocTupleType */: return getTypeFromJSDocTupleType(node); - case 266 /* JSDocVariadicType */: + case 269 /* JSDocVariadicType */: return getTypeFromJSDocVariadicType(node); default: return unknownType; @@ -19240,40 +19652,26 @@ var ts; function createBinaryTypeMapper(source1, target1, source2, target2) { return function (t) { return t === source1 ? target1 : t === source2 ? target2 : t; }; } - function createTypeMapper(sources, targets) { - switch (sources.length) { - case 1: return createUnaryTypeMapper(sources[0], targets[0]); - case 2: return createBinaryTypeMapper(sources[0], targets[0], sources[1], targets[1]); - } + function createArrayTypeMapper(sources, targets) { return function (t) { for (var i = 0; i < sources.length; i++) { if (t === sources[i]) { - return targets[i]; + return targets ? targets[i] : anyType; } } return t; }; } - function createUnaryTypeEraser(source) { - return function (t) { return t === source ? anyType : t; }; - } - function createBinaryTypeEraser(source1, source2) { - return function (t) { return t === source1 || t === source2 ? anyType : t; }; + function createTypeMapper(sources, targets) { + var count = sources.length; + var mapper = count == 1 ? createUnaryTypeMapper(sources[0], targets ? targets[0] : anyType) : + count == 2 ? createBinaryTypeMapper(sources[0], targets ? targets[0] : anyType, sources[1], targets ? targets[1] : anyType) : + createArrayTypeMapper(sources, targets); + mapper.mappedTypes = sources; + return mapper; } function createTypeEraser(sources) { - switch (sources.length) { - case 1: return createUnaryTypeEraser(sources[0]); - case 2: return createBinaryTypeEraser(sources[0], sources[1]); - } - return function (t) { - for (var _i = 0, sources_1 = sources; _i < sources_1.length; _i++) { - var source = sources_1[_i]; - if (t === source) { - return anyType; - } - } - return t; - }; + return createTypeMapper(sources, undefined); } function getInferenceMapper(context) { if (!context.mapper) { @@ -19287,6 +19685,7 @@ var ts; } return t; }; + mapper.mappedTypes = context.typeParameters; mapper.context = context; context.mapper = mapper; } @@ -19296,7 +19695,9 @@ var ts; return type; } function combineTypeMappers(mapper1, mapper2) { - return function (t) { return instantiateType(mapper1(t), mapper2); }; + var mapper = function (t) { return instantiateType(mapper1(t), mapper2); }; + mapper.mappedTypes = mapper1.mappedTypes; + return mapper; } function cloneTypeParameter(typeParameter) { var result = createType(512 /* TypeParameter */); @@ -19337,7 +19738,7 @@ var ts; if (signature.typePredicate) { freshTypePredicate = cloneTypePredicate(signature.typePredicate, mapper); } - var result = createSignature(signature.declaration, freshTypeParameters, instantiateList(signature.parameters, mapper, instantiateSymbol), instantiateType(signature.resolvedReturnType, mapper), freshTypePredicate, signature.minArgumentCount, signature.hasRestParameter, signature.hasStringLiterals); + var result = createSignature(signature.declaration, freshTypeParameters, signature.thisType && instantiateType(signature.thisType, mapper), instantiateList(signature.parameters, mapper, instantiateSymbol), instantiateType(signature.resolvedReturnType, mapper), freshTypePredicate, signature.minArgumentCount, signature.hasRestParameter, signature.hasStringLiterals); result.target = signature; result.mapper = mapper; return result; @@ -19380,13 +19781,70 @@ var ts; mapper.instantiations[type.id] = result; return result; } + function isSymbolInScopeOfMappedTypeParameter(symbol, mapper) { + 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; + while (node) { + switch (node.kind) { + case 155 /* FunctionType */: + case 156 /* ConstructorType */: + case 219 /* FunctionDeclaration */: + case 146 /* MethodDeclaration */: + case 145 /* MethodSignature */: + case 147 /* Constructor */: + case 150 /* CallSignature */: + case 151 /* ConstructSignature */: + case 152 /* IndexSignature */: + case 148 /* GetAccessor */: + case 149 /* SetAccessor */: + case 178 /* FunctionExpression */: + case 179 /* ArrowFunction */: + case 220 /* ClassDeclaration */: + case 191 /* ClassExpression */: + case 221 /* InterfaceDeclaration */: + case 222 /* TypeAliasDeclaration */: + var declaration = node; + if (declaration.typeParameters) { + for (var _i = 0, _a = declaration.typeParameters; _i < _a.length; _i++) { + var d = _a[_i]; + if (ts.contains(mappedTypes, getDeclaredTypeOfTypeParameter(d.symbol))) { + return true; + } + } + } + if (ts.isClassLike(node) || node.kind === 221 /* InterfaceDeclaration */) { + var thisType = getDeclaredTypeOfClassOrInterface(getSymbolOfNode(node)).thisType; + if (thisType && ts.contains(mappedTypes, thisType)) { + return true; + } + } + break; + case 224 /* ModuleDeclaration */: + case 255 /* SourceFile */: + return false; + } + node = node.parent; + } + return false; + } function instantiateType(type, mapper) { if (type && mapper !== identityMapper) { if (type.flags & 512 /* TypeParameter */) { return mapper(type); } if (type.flags & 65536 /* Anonymous */) { - return type.symbol && type.symbol.flags & (16 /* Function */ | 8192 /* Method */ | 32 /* Class */ | 2048 /* TypeLiteral */ | 4096 /* ObjectLiteral */) ? + // 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 + // if none of the type parameters that are in scope in the type's declaration are mapped by + // the given mapper, however we can only do that analysis if the type isn't itself an + // instantiation. + return type.symbol && + type.symbol.flags & (16 /* Function */ | 8192 /* Method */ | 32 /* Class */ | 2048 /* TypeLiteral */ | 4096 /* ObjectLiteral */) && + (type.flags & 131072 /* Instantiated */ || isSymbolInScopeOfMappedTypeParameter(type.symbol, mapper)) ? instantiateAnonymousType(type, mapper) : type; } if (type.flags & 4096 /* Reference */) { @@ -19410,33 +19868,35 @@ 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 !== 145 /* MethodDeclaration */ || ts.isObjectLiteralMethod(node)); + ts.Debug.assert(node.kind !== 146 /* MethodDeclaration */ || ts.isObjectLiteralMethod(node)); switch (node.kind) { - case 177 /* FunctionExpression */: - case 178 /* ArrowFunction */: + case 178 /* FunctionExpression */: + case 179 /* ArrowFunction */: return isContextSensitiveFunctionLikeDeclaration(node); - case 169 /* ObjectLiteralExpression */: + case 170 /* ObjectLiteralExpression */: return ts.forEach(node.properties, isContextSensitive); - case 168 /* ArrayLiteralExpression */: + case 169 /* ArrayLiteralExpression */: return ts.forEach(node.elements, isContextSensitive); - case 186 /* ConditionalExpression */: + case 187 /* ConditionalExpression */: return isContextSensitive(node.whenTrue) || isContextSensitive(node.whenFalse); - case 185 /* BinaryExpression */: + case 186 /* BinaryExpression */: return node.operatorToken.kind === 52 /* BarBarToken */ && (isContextSensitive(node.left) || isContextSensitive(node.right)); - case 249 /* PropertyAssignment */: + case 252 /* PropertyAssignment */: return isContextSensitive(node.initializer); - case 145 /* MethodDeclaration */: - case 144 /* MethodSignature */: + case 146 /* MethodDeclaration */: + case 145 /* MethodSignature */: return isContextSensitiveFunctionLikeDeclaration(node); - case 176 /* ParenthesizedExpression */: + case 177 /* ParenthesizedExpression */: return isContextSensitive(node.expression); } return false; } function isContextSensitiveFunctionLikeDeclaration(node) { - return !node.typeParameters && node.parameters.length && !ts.forEach(node.parameters, function (p) { return p.type; }); + var areAllParametersUntyped = !ts.forEach(node.parameters, function (p) { return p.type; }); + var isNullaryArrow = node.kind === 179 /* ArrowFunction */ && !node.parameters.length; + return !node.typeParameters && areAllParametersUntyped && !isNullaryArrow; } function getTypeWithoutSignatures(type) { if (type.flags & 80896 /* ObjectType */) { @@ -19468,12 +19928,26 @@ var ts; function isTypeAssignableTo(source, target) { return checkTypeAssignableTo(source, target, /*errorNode*/ undefined); } + /** + * This is *not* a bi-directional relationship. + * If one needs to check both directions for comparability, use a second call to this function or 'checkTypeComparableTo'. + */ + function isTypeComparableTo(source, target) { + return checkTypeComparableTo(source, target, /*errorNode*/ undefined); + } function checkTypeSubtypeOf(source, target, errorNode, headMessage, containingMessageChain) { return checkTypeRelatedTo(source, target, subtypeRelation, errorNode, headMessage, containingMessageChain); } function checkTypeAssignableTo(source, target, errorNode, headMessage, containingMessageChain) { return checkTypeRelatedTo(source, target, assignableRelation, errorNode, headMessage, containingMessageChain); } + /** + * This is *not* a bi-directional relationship. + * If one needs to check both directions for comparability, use a second call to this function or 'isTypeComparableTo'. + */ + function checkTypeComparableTo(source, target, errorNode, headMessage, containingMessageChain) { + return checkTypeRelatedTo(source, target, comparableRelation, errorNode, headMessage, containingMessageChain); + } function isSignatureAssignableTo(source, target, ignoreReturnTypes) { return compareSignaturesRelated(source, target, ignoreReturnTypes, /*reportErrors*/ false, /*errorReporter*/ undefined, compareTypesAssignable) !== 0 /* False */; } @@ -19493,15 +19967,27 @@ var ts; source = getErasedSignature(source); target = getErasedSignature(target); var result = -1 /* True */; + if (source.thisType && target.thisType && source.thisType !== voidType) { + // void sources are assignable to anything. + var related = compareTypes(source.thisType, target.thisType, /*reportErrors*/ false) + || compareTypes(target.thisType, source.thisType, reportErrors); + if (!related) { + if (reportErrors) { + errorReporter(ts.Diagnostics.The_this_types_of_each_signature_are_incompatible); + } + return 0 /* False */; + } + result &= related; + } var sourceMax = getNumNonRestParameters(source); var targetMax = getNumNonRestParameters(target); var checkCount = getNumParametersToCheckForSignatureRelatability(source, sourceMax, target, targetMax); var sourceParams = source.parameters; var targetParams = target.parameters; for (var i = 0; i < checkCount; i++) { - var s = i < sourceMax ? getTypeOfSymbol(sourceParams[i]) : getRestTypeOfSignature(source); - var t = i < targetMax ? getTypeOfSymbol(targetParams[i]) : getRestTypeOfSignature(target); - var related = compareTypes(t, s, /*reportErrors*/ false) || compareTypes(s, t, reportErrors); + var s = i < sourceMax ? getTypeOfParameter(sourceParams[i]) : getRestTypeOfSignature(source); + var t = i < targetMax ? getTypeOfParameter(targetParams[i]) : getRestTypeOfSignature(target); + var related = compareTypes(s, t, /*reportErrors*/ false) || compareTypes(t, s, reportErrors); if (!related) { if (reportErrors) { errorReporter(ts.Diagnostics.Types_of_parameters_0_and_1_are_incompatible, sourceParams[i < sourceMax ? i : sourceMax].name, targetParams[i < targetMax ? i : targetMax].name); @@ -19600,7 +20086,7 @@ var ts; * Checks if 'source' is related to 'target' (e.g.: is a assignable to). * @param source The left-hand-side of the relation. * @param target The right-hand-side of the relation. - * @param relation The relation considered. One of 'identityRelation', 'assignableRelation', or 'subTypeRelation'. + * @param relation The relation considered. One of 'identityRelation', 'subtypeRelation', 'assignableRelation', or 'comparableRelation'. * Used as both to determine which checks are performed and as a cache of previously computed results. * @param errorNode The suggested node upon which all errors will be reported, if defined. This may or may not be the actual node used. * @param headMessage If the error chain should be prepended by a head message, then headMessage will be used. @@ -19637,7 +20123,12 @@ var ts; sourceType = typeToString(source, /*enclosingDeclaration*/ undefined, 128 /* UseFullyQualifiedType */); targetType = typeToString(target, /*enclosingDeclaration*/ undefined, 128 /* UseFullyQualifiedType */); } - reportError(message || ts.Diagnostics.Type_0_is_not_assignable_to_type_1, sourceType, targetType); + 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; + } + reportError(message, sourceType, targetType); } // Compare two types and return // Ternary.True if they are related with no assumptions, @@ -19653,20 +20144,24 @@ var ts; } if (isTypeAny(target)) return -1 /* True */; - if (source === undefinedType) - return -1 /* True */; - if (source === nullType && target !== undefinedType) - return -1 /* True */; + if (source.flags & 32 /* Undefined */) { + if (!strictNullChecks || target.flags & (32 /* Undefined */ | 16 /* Void */) || source === emptyArrayElementType) + return -1 /* True */; + } + if (source.flags & 64 /* Null */) { + if (!strictNullChecks || target.flags & 64 /* Null */) + return -1 /* True */; + } if (source.flags & 128 /* Enum */ && target === numberType) return -1 /* True */; if (source.flags & 128 /* Enum */ && target.flags & 128 /* Enum */) { - if (result = enumRelatedTo(source, target)) { + if (result = enumRelatedTo(source, target, reportErrors)) { return result; } } if (source.flags & 256 /* StringLiteral */ && target === stringType) return -1 /* True */; - if (relation === assignableRelation) { + if (relation === assignableRelation || relation === comparableRelation) { if (isTypeAny(source)) return -1 /* True */; if (source === numberType && target.flags & 128 /* Enum */) @@ -19691,29 +20186,48 @@ var ts; } } var saveErrorInfo = errorInfo; - // Note that the "each" checks must precede the "some" checks to produce the correct results + // Note that these checks are specifically ordered to produce correct results. if (source.flags & 16384 /* Union */) { - if (result = eachTypeRelatedToType(source, target, reportErrors)) { + if (relation === comparableRelation) { + result = someTypeRelatedToType(source, target, reportErrors); + } + else { + result = eachTypeRelatedToType(source, target, reportErrors); + } + if (result) { return result; } } else if (target.flags & 32768 /* Intersection */) { - if (result = typeRelatedToEachType(source, target, reportErrors)) { + result = typeRelatedToEachType(source, target, reportErrors); + if (result) { return result; } } else { - // It is necessary to try "some" checks on both sides because there may be nested "each" checks + // 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 & 32768 /* Intersection */) { - // If target is a union type the following check will report errors so we suppress them here - if (result = someTypeRelatedToType(source, target, reportErrors && !(target.flags & 16384 /* Union */))) { + // 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; } } if (target.flags & 16384 /* Union */) { - if (result = typeRelatedToSomeType(source, target, reportErrors)) { + if (result = typeRelatedToSomeType(source, target, reportErrors && !(source.flags & 16777726 /* Primitive */))) { return result; } } @@ -19770,8 +20284,8 @@ var ts; } if (source.flags & 16384 /* Union */ && target.flags & 16384 /* Union */ || source.flags & 32768 /* Intersection */ && target.flags & 32768 /* Intersection */) { - if (result = eachTypeRelatedToSomeType(source, target)) { - if (result &= eachTypeRelatedToSomeType(target, source)) { + if (result = eachTypeRelatedToSomeType(source, target, /*reportErrors*/ false)) { + if (result &= eachTypeRelatedToSomeType(target, source, /*reportErrors*/ false)) { return result; } } @@ -19785,7 +20299,8 @@ var ts; function isKnownProperty(type, name) { if (type.flags & 80896 /* ObjectType */) { var resolved = resolveStructuredTypeMembers(type); - if (relation === assignableRelation && (type === globalObjectType || resolved.properties.length === 0) || + if ((relation === assignableRelation || relation === comparableRelation) && + (type === globalObjectType || resolved.properties.length === 0) || resolved.stringIndexInfo || resolved.numberIndexInfo || getPropertyOfType(type, name)) { return true; } @@ -19819,7 +20334,7 @@ var ts; } return false; } - function eachTypeRelatedToSomeType(source, target) { + function eachTypeRelatedToSomeType(source, target, reportErrors) { var result = -1 /* True */; var sourceTypes = source.types; for (var _i = 0, sourceTypes_1 = sourceTypes; _i < sourceTypes_1.length; _i++) { @@ -19834,7 +20349,19 @@ var ts; } function typeRelatedToSomeType(source, target, reportErrors) { var targetTypes = target.types; - for (var i = 0, len = targetTypes.length; i < len; i++) { + var len = targetTypes.length; + // The null and undefined types are guaranteed to be at the end of the constituent type list. In order + // to produce the best possible errors we first check the nullable types, such that the last type we + // check and report errors from is a non-nullable type if one is present. + while (len >= 2 && targetTypes[len - 1].flags & 96 /* Nullable */) { + var related = isRelatedTo(source, targetTypes[len - 1], /*reportErrors*/ false); + if (related) { + return related; + } + len--; + } + // Now check the non-nullable types and report errors on the last one. + for (var i = 0; i < len; i++) { var related = isRelatedTo(source, targetTypes[i], reportErrors && i === len - 1); if (related) { return related; @@ -19857,7 +20384,19 @@ var ts; } function someTypeRelatedToType(source, target, reportErrors) { var sourceTypes = source.types; - for (var i = 0, len = sourceTypes.length; i < len; i++) { + var len = sourceTypes.length; + // The null and undefined types are guaranteed to be at the end of the constituent type list. In order + // to produce the best possible errors we first check the nullable types, such that the last type we + // check and report errors from is a non-nullable type if one is present. + while (len >= 2 && sourceTypes[len - 1].flags & 96 /* Nullable */) { + var related = isRelatedTo(sourceTypes[len - 1], target, /*reportErrors*/ false); + if (related) { + return related; + } + len--; + } + // Now check the non-nullable types and report errors on the last one. + for (var i = 0; i < len; i++) { var related = isRelatedTo(sourceTypes[i], target, reportErrors && i === len - 1); if (related) { return related; @@ -20141,7 +20680,7 @@ var ts; } var result = -1 /* True */; for (var i = 0, len = sourceSignatures.length; i < len; i++) { - var related = compareSignaturesIdentical(sourceSignatures[i], targetSignatures[i], /*partialMatch*/ false, /*ignoreReturnTypes*/ false, isRelatedTo); + var related = compareSignaturesIdentical(sourceSignatures[i], targetSignatures[i], /*partialMatch*/ false, /*ignoreThisTypes*/ false, /*ignoreReturnTypes*/ false, isRelatedTo); if (!related) { return 0 /* False */; } @@ -20216,7 +20755,7 @@ var ts; } return 0 /* False */; } - function enumRelatedTo(source, target) { + function enumRelatedTo(source, target, reportErrors) { if (source.symbol.name !== target.symbol.name || source.symbol.flags & 128 /* ConstEnum */ || target.symbol.flags & 128 /* ConstEnum */) { @@ -20228,7 +20767,9 @@ var ts; if (property.flags & 8 /* EnumMember */) { var targetProperty = getPropertyOfType(targetEnumType, property.name); if (!targetProperty || !(targetProperty.flags & 8 /* EnumMember */)) { - reportError(ts.Diagnostics.Property_0_is_missing_in_type_1, property.name, typeToString(target, /*enclosingDeclaration*/ undefined, 128 /* UseFullyQualifiedType */)); + if (reportErrors) { + reportError(ts.Diagnostics.Property_0_is_missing_in_type_1, property.name, typeToString(target, /*enclosingDeclaration*/ undefined, 128 /* UseFullyQualifiedType */)); + } return 0 /* False */; } } @@ -20343,7 +20884,7 @@ var ts; /** * See signatureRelatedTo, compareSignaturesIdentical */ - function compareSignaturesIdentical(source, target, partialMatch, ignoreReturnTypes, compareTypes) { + function compareSignaturesIdentical(source, target, partialMatch, ignoreThisTypes, ignoreReturnTypes, compareTypes) { // TODO (drosen): De-duplicate code between related functions. if (source === target) { return -1 /* True */; @@ -20364,10 +20905,17 @@ var ts; source = getErasedSignature(source); target = getErasedSignature(target); var result = -1 /* True */; + if (!ignoreThisTypes && source.thisType && target.thisType) { + var related = compareTypes(source.thisType, target.thisType); + if (!related) { + return 0 /* False */; + } + result &= related; + } var targetLen = target.parameters.length; for (var i = 0; i < targetLen; i++) { - var s = isRestParameterIndex(source, i) ? getRestTypeOfSignature(source) : getTypeOfSymbol(source.parameters[i]); - var t = isRestParameterIndex(target, i) ? getRestTypeOfSignature(target) : getTypeOfSymbol(target.parameters[i]); + var s = isRestParameterIndex(source, i) ? getRestTypeOfSignature(source) : getTypeOfParameter(source.parameters[i]); + var t = isRestParameterIndex(target, i) ? getRestTypeOfSignature(target) : getTypeOfParameter(target.parameters[i]); var related = compareTypes(s, t); if (!related) { return 0 /* False */; @@ -20383,15 +20931,31 @@ var ts; return signature.hasRestParameter && parameterIndex >= signature.parameters.length - 1; } function isSupertypeOfEach(candidate, types) { - for (var _i = 0, types_6 = types; _i < types_6.length; _i++) { - var type = types_6[_i]; - if (candidate !== type && !isTypeSubtypeOf(type, candidate)) + for (var _i = 0, types_5 = types; _i < types_5.length; _i++) { + var t = types_5[_i]; + if (candidate !== t && !isTypeSubtypeOf(t, candidate)) return false; } return true; } + function getCombinedFlagsOfTypes(types) { + var flags = 0; + for (var _i = 0, types_6 = types; _i < types_6.length; _i++) { + var t = types_6[_i]; + flags |= t.flags; + } + return flags; + } function getCommonSupertype(types) { - return ts.forEach(types, function (t) { return isSupertypeOfEach(t, types) ? t : undefined; }); + if (!strictNullChecks) { + return ts.forEach(types, function (t) { return isSupertypeOfEach(t, types) ? t : undefined; }); + } + var primaryTypes = ts.filter(types, function (t) { return !(t.flags & 96 /* Nullable */); }); + if (!primaryTypes.length) { + return getUnionType(types); + } + var supertype = ts.forEach(primaryTypes, function (t) { return isSupertypeOfEach(t, primaryTypes) ? t : undefined; }); + return supertype && addNullableKind(supertype, getCombinedFlagsOfTypes(types) & 96 /* Nullable */); } function reportNoCommonSupertypeError(types, errorLocation, errorMessageChainHead) { // The downfallType/bestSupertypeDownfallType is the first type that caused a particular candidate @@ -20433,7 +20997,7 @@ var ts; // 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 & 4096 /* Reference */ && (type.target === globalArrayType || type.target === globalReadonlyArrayType) || - !(type.flags & (32 /* Undefined */ | 64 /* Null */)) && isTypeAssignableTo(type, anyReadonlyArrayType); + !(type.flags & 96 /* Nullable */) && isTypeAssignableTo(type, anyReadonlyArrayType); } function isTupleLikeType(type) { return !!getPropertyOfType(type, "0"); @@ -20448,6 +21012,60 @@ var ts; function isTupleType(type) { return !!(type.flags & 8192 /* Tuple */); } + function getNullableKind(type) { + var flags = type.flags; + if (flags & 16384 /* Union */) { + for (var _i = 0, _a = type.types; _i < _a.length; _i++) { + var t = _a[_i]; + flags |= t.flags; + } + } + return flags & 96 /* Nullable */; + } + function getNullableTypeOfKind(kind) { + return kind & 64 /* Null */ ? kind & 32 /* Undefined */ ? + getUnionType([nullType, undefinedType]) : nullType : undefinedType; + } + function addNullableKind(type, kind) { + if ((getNullableKind(type) & kind) !== kind) { + var types = [type]; + if (kind & 32 /* Undefined */) { + types.push(undefinedType); + } + if (kind & 64 /* Null */) { + types.push(nullType); + } + type = getUnionType(types); + } + return type; + } + function removeNullableKind(type, kind) { + if (type.flags & 16384 /* Union */ && getNullableKind(type) & kind) { + var firstType = void 0; + var types = void 0; + for (var _i = 0, _a = type.types; _i < _a.length; _i++) { + var t = _a[_i]; + if (!(t.flags & kind)) { + if (!firstType) { + firstType = t; + } + else { + if (!types) { + types = [firstType]; + } + types.push(t); + } + } + } + if (firstType) { + type = types ? getUnionType(types) : firstType; + } + } + return type; + } + function getNonNullableType(type) { + return strictNullChecks ? removeNullableKind(type, 96 /* Nullable */) : type; + } /** * Return true if type was inferred from an object literal or written as an object type literal * with no call or construct signatures. @@ -20497,16 +21115,19 @@ var ts; var numberIndexInfo = getIndexInfoOfType(type, 1 /* Number */); return createAnonymousType(type.symbol, members, emptyArray, emptyArray, stringIndexInfo && createIndexInfo(getWidenedType(stringIndexInfo.type), stringIndexInfo.isReadonly), numberIndexInfo && createIndexInfo(getWidenedType(numberIndexInfo.type), numberIndexInfo.isReadonly)); } + function getWidenedConstituentType(type) { + return type.flags & 96 /* Nullable */ ? type : getWidenedType(type); + } function getWidenedType(type) { if (type.flags & 6291456 /* RequiresWidening */) { - if (type.flags & (32 /* Undefined */ | 64 /* Null */)) { + if (type.flags & 96 /* Nullable */) { return anyType; } if (type.flags & 524288 /* ObjectLiteral */) { return getWidenedTypeOfObjectLiteral(type); } if (type.flags & 16384 /* Union */) { - return getUnionType(ts.map(type.types, getWidenedType), /*noSubtypeReduction*/ true); + return getUnionType(ts.map(type.types, getWidenedConstituentType), /*noSubtypeReduction*/ true); } if (isArrayType(type)) { return createArrayType(getWidenedType(type.typeArguments[0])); @@ -20567,22 +21188,25 @@ var ts; var typeAsString = typeToString(getWidenedType(type)); var diagnostic; switch (declaration.kind) { - case 143 /* PropertyDeclaration */: - case 142 /* PropertySignature */: + case 144 /* PropertyDeclaration */: + case 143 /* PropertySignature */: diagnostic = ts.Diagnostics.Member_0_implicitly_has_an_1_type; break; - case 140 /* Parameter */: + case 141 /* 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 217 /* FunctionDeclaration */: - case 145 /* MethodDeclaration */: - case 144 /* MethodSignature */: - case 147 /* GetAccessor */: - case 148 /* SetAccessor */: - case 177 /* FunctionExpression */: - case 178 /* ArrowFunction */: + case 168 /* BindingElement */: + diagnostic = ts.Diagnostics.Binding_element_0_implicitly_has_an_1_type; + break; + case 219 /* FunctionDeclaration */: + case 146 /* MethodDeclaration */: + case 145 /* MethodSignature */: + case 148 /* GetAccessor */: + case 149 /* SetAccessor */: + case 178 /* FunctionExpression */: + case 179 /* ArrowFunction */: if (!declaration.name) { error(declaration, ts.Diagnostics.Function_expression_which_lacks_return_type_annotation_implicitly_has_an_0_return_type, typeAsString); return; @@ -20607,25 +21231,19 @@ var ts; var targetMax = target.parameters.length; var count; if (source.hasRestParameter && target.hasRestParameter) { - count = sourceMax > targetMax ? sourceMax : targetMax; - sourceMax--; - targetMax--; + count = Math.max(sourceMax, targetMax); } else if (source.hasRestParameter) { - sourceMax--; count = targetMax; } else if (target.hasRestParameter) { - targetMax--; count = sourceMax; } else { - count = sourceMax < targetMax ? sourceMax : targetMax; + count = Math.min(sourceMax, targetMax); } for (var i = 0; i < count; i++) { - var s = i < sourceMax ? getTypeOfSymbol(source.parameters[i]) : getRestTypeOfSignature(source); - var t = i < targetMax ? getTypeOfSymbol(target.parameters[i]) : getRestTypeOfSignature(target); - callback(s, t); + callback(getTypeAtPosition(source, i), getTypeAtPosition(target, i)); } } function createInferenceContext(typeParameters, inferUnionTypes) { @@ -20920,10 +21538,21 @@ var ts; return context.inferredTypes; } // EXPRESSION TYPE CHECKING + function createTransientIdentifier(symbol, location) { + var result = ts.createNode(69 /* Identifier */); + result.text = symbol.name; + result.resolvedSymbol = symbol; + result.parent = location; + result.id = -1; + return result; + } function getResolvedSymbol(node) { + if (node.id === -1) { + return node.resolvedSymbol; + } var links = getNodeLinks(node); if (!links.resolvedSymbol) { - links.resolvedSymbol = (!ts.nodeIsMissing(node) && resolveName(node, node.text, 107455 /* Value */ | 1048576 /* ExportValue */, ts.Diagnostics.Cannot_find_name_0, node)) || unknownSymbol; + links.resolvedSymbol = !ts.nodeIsMissing(node) && resolveName(node, node.text, 107455 /* Value */ | 1048576 /* ExportValue */, ts.Diagnostics.Cannot_find_name_0, node) || unknownSymbol; } return links.resolvedSymbol; } @@ -20933,10 +21562,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 156 /* TypeQuery */: + case 157 /* TypeQuery */: return true; case 69 /* Identifier */: - case 137 /* QualifiedName */: + case 138 /* QualifiedName */: node = node.parent; continue; default: @@ -20945,174 +21574,294 @@ var ts; } ts.Debug.fail("should not get here"); } + // Return the assignment key for a "dotted name" (i.e. a sequence of identifiers + // separated by dots). The key consists of the id of the symbol referenced by the + // 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 getAssignmentKey(node) { + if (node.kind === 69 /* Identifier */) { + var symbol = getResolvedSymbol(node); + return symbol !== unknownSymbol ? "" + getSymbolId(symbol) : undefined; + } + if (node.kind === 97 /* ThisKeyword */) { + return "0"; + } + if (node.kind === 171 /* PropertyAccessExpression */) { + var key = getAssignmentKey(node.expression); + return key && key + "." + node.name.text; + } + return undefined; + } function hasInitializer(node) { return !!(node.initializer || ts.isBindingPattern(node.parent) && hasInitializer(node.parent.parent)); } - // Check if a given variable is assigned within a given syntax node - function isVariableAssignedWithin(symbol, node) { - var links = getNodeLinks(node); - if (links.assignmentChecks) { - var cachedResult = links.assignmentChecks[symbol.id]; - if (cachedResult !== undefined) { - return cachedResult; - } - } - else { - links.assignmentChecks = {}; - } - return links.assignmentChecks[symbol.id] = isAssignedIn(node); - function isAssignedInBinaryExpression(node) { - if (node.operatorToken.kind >= 56 /* FirstAssignment */ && node.operatorToken.kind <= 68 /* LastAssignment */) { - var n = skipParenthesizedNodes(node.left); - if (n.kind === 69 /* Identifier */ && getResolvedSymbol(n) === symbol) { - return true; + // For a given node compute a map of which dotted names are assigned within + // the node. + function getAssignmentMap(node) { + var assignmentMap = {}; + visit(node); + return assignmentMap; + function visitReference(node) { + if (isAssignmentTarget(node) || isCompoundAssignmentTarget(node)) { + var key = getAssignmentKey(node); + if (key) { + assignmentMap[key] = true; } } - return ts.forEachChild(node, isAssignedIn); + ts.forEachChild(node, visit); } - function isAssignedInVariableDeclaration(node) { - if (!ts.isBindingPattern(node.name) && getSymbolOfNode(node) === symbol && hasInitializer(node)) { - return true; + function visitVariableDeclaration(node) { + if (!ts.isBindingPattern(node.name) && hasInitializer(node)) { + assignmentMap[getSymbolId(getSymbolOfNode(node))] = true; } - return ts.forEachChild(node, isAssignedIn); + ts.forEachChild(node, visit); } - function isAssignedIn(node) { + function visit(node) { switch (node.kind) { - case 185 /* BinaryExpression */: - return isAssignedInBinaryExpression(node); - case 215 /* VariableDeclaration */: - case 167 /* BindingElement */: - return isAssignedInVariableDeclaration(node); - case 165 /* ObjectBindingPattern */: - case 166 /* ArrayBindingPattern */: - case 168 /* ArrayLiteralExpression */: - case 169 /* ObjectLiteralExpression */: - case 170 /* PropertyAccessExpression */: - case 171 /* ElementAccessExpression */: - case 172 /* CallExpression */: - case 173 /* NewExpression */: - case 175 /* TypeAssertionExpression */: - case 193 /* AsExpression */: - case 176 /* ParenthesizedExpression */: - case 183 /* PrefixUnaryExpression */: - case 179 /* DeleteExpression */: - case 182 /* AwaitExpression */: - case 180 /* TypeOfExpression */: - case 181 /* VoidExpression */: - case 184 /* PostfixUnaryExpression */: - case 188 /* YieldExpression */: - case 186 /* ConditionalExpression */: - case 189 /* SpreadElementExpression */: - case 196 /* Block */: - case 197 /* VariableStatement */: - case 199 /* ExpressionStatement */: - case 200 /* IfStatement */: - case 201 /* DoStatement */: - case 202 /* WhileStatement */: - case 203 /* ForStatement */: - case 204 /* ForInStatement */: - case 205 /* ForOfStatement */: - case 208 /* ReturnStatement */: - case 209 /* WithStatement */: - case 210 /* SwitchStatement */: - case 245 /* CaseClause */: - case 246 /* DefaultClause */: - case 211 /* LabeledStatement */: - case 212 /* ThrowStatement */: - case 213 /* TryStatement */: - case 248 /* CatchClause */: - case 237 /* JsxElement */: - case 238 /* JsxSelfClosingElement */: - case 242 /* JsxAttribute */: - case 243 /* JsxSpreadAttribute */: - case 239 /* JsxOpeningElement */: - case 244 /* JsxExpression */: - return ts.forEachChild(node, isAssignedIn); + case 69 /* Identifier */: + case 171 /* PropertyAccessExpression */: + visitReference(node); + break; + case 217 /* VariableDeclaration */: + case 168 /* BindingElement */: + visitVariableDeclaration(node); + break; + case 186 /* BinaryExpression */: + case 166 /* ObjectBindingPattern */: + case 167 /* ArrayBindingPattern */: + case 169 /* ArrayLiteralExpression */: + case 170 /* ObjectLiteralExpression */: + case 172 /* ElementAccessExpression */: + case 173 /* CallExpression */: + case 174 /* NewExpression */: + case 176 /* TypeAssertionExpression */: + case 194 /* AsExpression */: + case 195 /* NonNullExpression */: + case 177 /* ParenthesizedExpression */: + case 184 /* PrefixUnaryExpression */: + case 180 /* DeleteExpression */: + case 183 /* AwaitExpression */: + case 181 /* TypeOfExpression */: + case 182 /* VoidExpression */: + case 185 /* PostfixUnaryExpression */: + case 189 /* YieldExpression */: + case 187 /* ConditionalExpression */: + case 190 /* SpreadElementExpression */: + case 198 /* Block */: + case 199 /* VariableStatement */: + case 201 /* ExpressionStatement */: + case 202 /* IfStatement */: + case 203 /* DoStatement */: + case 204 /* WhileStatement */: + case 205 /* ForStatement */: + case 206 /* ForInStatement */: + case 207 /* ForOfStatement */: + case 210 /* ReturnStatement */: + case 211 /* WithStatement */: + case 212 /* SwitchStatement */: + case 226 /* CaseBlock */: + case 248 /* CaseClause */: + case 249 /* DefaultClause */: + case 213 /* LabeledStatement */: + case 214 /* ThrowStatement */: + case 215 /* TryStatement */: + case 251 /* CatchClause */: + case 240 /* JsxElement */: + case 241 /* JsxSelfClosingElement */: + case 245 /* JsxAttribute */: + case 246 /* JsxSpreadAttribute */: + case 242 /* JsxOpeningElement */: + case 247 /* JsxExpression */: + ts.forEachChild(node, visit); + break; } - return false; } } - // Get the narrowed type of a given symbol at a given location - function getNarrowedTypeOfSymbol(symbol, node) { - var type = getTypeOfSymbol(symbol); - // Only narrow when symbol is variable of type any or an object, union, or type parameter type - if (node && symbol.flags & 3 /* Variable */) { - if (isTypeAny(type) || type.flags & (80896 /* ObjectType */ | 16384 /* Union */ | 512 /* TypeParameter */)) { - var declaration = ts.getDeclarationOfKind(symbol, 215 /* VariableDeclaration */); - var top_1 = declaration && getDeclarationContainer(declaration); - var originalType = type; - var nodeStack = []; - loop: while (node.parent) { - var child = node; - node = node.parent; - switch (node.kind) { - case 200 /* IfStatement */: - case 186 /* ConditionalExpression */: - case 185 /* BinaryExpression */: - nodeStack.push({ node: node, child: child }); - break; - case 252 /* SourceFile */: - case 222 /* ModuleDeclaration */: - // Stop at the first containing file or module declaration - break loop; - } - if (node === top_1) { - break; - } - } - var nodes = void 0; - while (nodes = nodeStack.pop()) { - var node_1 = nodes.node, child = nodes.child; - switch (node_1.kind) { - case 200 /* IfStatement */: - // In a branch of an if statement, narrow based on controlling expression - if (child !== node_1.expression) { - type = narrowType(type, node_1.expression, /*assumeTrue*/ child === node_1.thenStatement); - } - break; - case 186 /* ConditionalExpression */: - // In a branch of a conditional expression, narrow based on controlling condition - if (child !== node_1.condition) { - type = narrowType(type, node_1.condition, /*assumeTrue*/ child === node_1.whenTrue); - } - break; - case 185 /* BinaryExpression */: - // In the right operand of an && or ||, narrow based on left operand - if (child === node_1.right) { - if (node_1.operatorToken.kind === 51 /* AmpersandAmpersandToken */) { - type = narrowType(type, node_1.left, /*assumeTrue*/ true); - } - else if (node_1.operatorToken.kind === 52 /* BarBarToken */) { - type = narrowType(type, node_1.left, /*assumeTrue*/ false); - } - } - break; - default: - ts.Debug.fail("Unreachable!"); - } - // Use original type if construct contains assignments to variable - if (type !== originalType && isVariableAssignedWithin(symbol, node_1)) { - type = originalType; - } - } - // Preserve old top-level behavior - if the branch is really an empty set, revert to prior type - if (type === emptyUnionType) { - type = originalType; - } + function isReferenceAssignedWithin(reference, node) { + if (reference.kind !== 97 /* ThisKeyword */) { + var key = getAssignmentKey(reference); + if (key) { + var links = getNodeLinks(node); + return (links.assignmentMap || (links.assignmentMap = getAssignmentMap(node)))[key]; } } - return type; - function narrowTypeByEquality(type, expr, assumeTrue) { - // Check that we have 'typeof ' on the left and string literal on the right - if (expr.left.kind !== 180 /* TypeOfExpression */ || expr.right.kind !== 9 /* StringLiteral */) { + return false; + } + function isAnyPartOfReferenceAssignedWithin(reference, node) { + while (true) { + if (isReferenceAssignedWithin(reference, node)) { + return true; + } + if (reference.kind !== 171 /* PropertyAccessExpression */) { + return false; + } + reference = reference.expression; + } + } + function isNullOrUndefinedLiteral(node) { + return node.kind === 93 /* NullKeyword */ || + node.kind === 69 /* Identifier */ && getResolvedSymbol(node) === undefinedSymbol; + } + function getLeftmostIdentifierOrThis(node) { + switch (node.kind) { + case 69 /* Identifier */: + case 97 /* ThisKeyword */: + return node; + case 171 /* PropertyAccessExpression */: + return getLeftmostIdentifierOrThis(node.expression); + } + return undefined; + } + function isMatchingReference(source, target) { + if (source.kind === target.kind) { + switch (source.kind) { + case 69 /* Identifier */: + return getResolvedSymbol(source) === getResolvedSymbol(target); + case 97 /* ThisKeyword */: + return true; + case 171 /* PropertyAccessExpression */: + return source.name.text === target.name.text && + isMatchingReference(source.expression, target.expression); + } + } + return false; + } + // Get the narrowed type of a given symbol at a given location + function getNarrowedTypeOfReference(type, reference) { + if (!(type.flags & (1 /* Any */ | 80896 /* ObjectType */ | 16384 /* Union */ | 512 /* TypeParameter */))) { + return type; + } + var leftmostNode = getLeftmostIdentifierOrThis(reference); + if (!leftmostNode) { + return type; + } + var top; + if (leftmostNode.kind === 69 /* Identifier */) { + var leftmostSymbol = getExportSymbolOfValueSymbolIfExported(getResolvedSymbol(leftmostNode)); + if (!leftmostSymbol) { return type; } + var declaration = leftmostSymbol.valueDeclaration; + if (!declaration || declaration.kind !== 217 /* VariableDeclaration */ && declaration.kind !== 141 /* Parameter */ && declaration.kind !== 168 /* BindingElement */) { + return type; + } + top = getDeclarationContainer(declaration); + } + var originalType = type; + var nodeStack = []; + var node = reference; + loop: while (node.parent) { + var child = node; + node = node.parent; + switch (node.kind) { + case 202 /* IfStatement */: + case 187 /* ConditionalExpression */: + case 186 /* BinaryExpression */: + nodeStack.push({ node: node, child: child }); + break; + case 255 /* SourceFile */: + case 224 /* ModuleDeclaration */: + break loop; + default: + if (node === top || ts.isFunctionLikeKind(node.kind)) { + break loop; + } + break; + } + } + var nodes; + while (nodes = nodeStack.pop()) { + var node_1 = nodes.node, child = nodes.child; + switch (node_1.kind) { + case 202 /* IfStatement */: + // In a branch of an if statement, narrow based on controlling expression + if (child !== node_1.expression) { + type = narrowType(type, node_1.expression, /*assumeTrue*/ child === node_1.thenStatement); + } + break; + case 187 /* ConditionalExpression */: + // In a branch of a conditional expression, narrow based on controlling condition + if (child !== node_1.condition) { + type = narrowType(type, node_1.condition, /*assumeTrue*/ child === node_1.whenTrue); + } + break; + case 186 /* BinaryExpression */: + // In the right operand of an && or ||, narrow based on left operand + if (child === node_1.right) { + if (node_1.operatorToken.kind === 51 /* AmpersandAmpersandToken */) { + type = narrowType(type, node_1.left, /*assumeTrue*/ true); + } + else if (node_1.operatorToken.kind === 52 /* BarBarToken */) { + type = narrowType(type, node_1.left, /*assumeTrue*/ false); + } + } + break; + default: + ts.Debug.fail("Unreachable!"); + } + // Use original type if construct contains assignments to variable + if (type !== originalType && isAnyPartOfReferenceAssignedWithin(reference, node_1)) { + type = originalType; + } + } + // Preserve old top-level behavior - if the branch is really an empty set, revert to prior type + if (type === emptyUnionType) { + type = originalType; + } + return type; + function narrowTypeByTruthiness(type, expr, assumeTrue) { + return strictNullChecks && assumeTrue && isMatchingReference(expr, reference) ? getNonNullableType(type) : type; + } + function narrowTypeByBinaryExpression(type, expr, assumeTrue) { + switch (expr.operatorToken.kind) { + case 30 /* EqualsEqualsToken */: + case 31 /* ExclamationEqualsToken */: + case 32 /* EqualsEqualsEqualsToken */: + case 33 /* ExclamationEqualsEqualsToken */: + if (isNullOrUndefinedLiteral(expr.right)) { + return narrowTypeByNullCheck(type, expr, assumeTrue); + } + if (expr.left.kind === 181 /* TypeOfExpression */ && expr.right.kind === 9 /* StringLiteral */) { + return narrowTypeByTypeof(type, expr, assumeTrue); + } + break; + case 51 /* AmpersandAmpersandToken */: + return narrowTypeByAnd(type, expr, assumeTrue); + case 52 /* BarBarToken */: + return narrowTypeByOr(type, expr, assumeTrue); + case 91 /* InstanceOfKeyword */: + return narrowTypeByInstanceof(type, expr, assumeTrue); + } + return type; + } + function narrowTypeByNullCheck(type, expr, assumeTrue) { + // We have '==', '!=', '===', or '!==' operator with 'null' or 'undefined' on the right + var operator = expr.operatorToken.kind; + if (operator === 31 /* ExclamationEqualsToken */ || operator === 33 /* ExclamationEqualsEqualsToken */) { + assumeTrue = !assumeTrue; + } + if (!strictNullChecks || !isMatchingReference(expr.left, reference)) { + return type; + } + var doubleEquals = operator === 30 /* EqualsEqualsToken */ || operator === 31 /* ExclamationEqualsToken */; + var exprNullableKind = doubleEquals ? 96 /* Nullable */ : + expr.right.kind === 93 /* NullKeyword */ ? 64 /* Null */ : 32 /* Undefined */; + if (assumeTrue) { + var nullableKind = getNullableKind(type) & exprNullableKind; + return nullableKind ? getNullableTypeOfKind(nullableKind) : type; + } + return removeNullableKind(type, exprNullableKind); + } + function narrowTypeByTypeof(type, expr, assumeTrue) { + // We have '==', '!=', '====', or !==' operator with 'typeof xxx' on the left + // and string literal on the right var left = expr.left; var right = expr.right; - if (left.expression.kind !== 69 /* Identifier */ || getResolvedSymbol(left.expression) !== symbol) { + if (!isMatchingReference(left.expression, reference)) { return type; } - if (expr.operatorToken.kind === 33 /* ExclamationEqualsEqualsToken */) { + if (expr.operatorToken.kind === 31 /* ExclamationEqualsToken */ || + expr.operatorToken.kind === 33 /* ExclamationEqualsEqualsToken */) { assumeTrue = !assumeTrue; } var typeInfo = primitiveTypeInfo[right.text]; @@ -21172,7 +21921,7 @@ var ts; } function narrowTypeByInstanceof(type, expr, assumeTrue) { // Check that type is not any, assumed result is true, and we have variable symbol on the left - if (isTypeAny(type) || expr.left.kind !== 69 /* Identifier */ || getResolvedSymbol(expr.left) !== symbol) { + if (isTypeAny(type) || !isMatchingReference(expr.left, reference)) { return type; } // Check that right operand is a function type with a prototype property @@ -21222,7 +21971,8 @@ var ts; return getUnionType(assignableConstituents); } } - if (isTypeAssignableTo(narrowedTypeCandidate, originalType)) { + var targetType = originalType.flags & 512 /* TypeParameter */ ? getApparentType(originalType) : originalType; + if (isTypeAssignableTo(narrowedTypeCandidate, targetType)) { // Narrow to the target type if it's assignable to the current type return narrowedTypeCandidate; } @@ -21238,59 +21988,38 @@ var ts; return type; } if (ts.isIdentifierTypePredicate(predicate)) { - if (callExpression.arguments[predicate.parameterIndex] && - getSymbolAtTypePredicatePosition(callExpression.arguments[predicate.parameterIndex]) === symbol) { + var predicateArgument = callExpression.arguments[predicate.parameterIndex]; + if (predicateArgument && isMatchingReference(predicateArgument, reference)) { return getNarrowedType(type, predicate.type, assumeTrue); } } else { var invokedExpression = skipParenthesizedNodes(callExpression.expression); - return narrowTypeByThisTypePredicate(type, predicate, invokedExpression, assumeTrue); - } - return type; - } - function narrowTypeByThisTypePredicate(type, predicate, invokedExpression, assumeTrue) { - if (invokedExpression.kind === 171 /* ElementAccessExpression */ || invokedExpression.kind === 170 /* PropertyAccessExpression */) { - var accessExpression = invokedExpression; - var possibleIdentifier = skipParenthesizedNodes(accessExpression.expression); - if (possibleIdentifier.kind === 69 /* Identifier */ && getSymbolAtTypePredicatePosition(possibleIdentifier) === symbol) { - return getNarrowedType(type, predicate.type, assumeTrue); + if (invokedExpression.kind === 172 /* ElementAccessExpression */ || invokedExpression.kind === 171 /* PropertyAccessExpression */) { + var accessExpression = invokedExpression; + var possibleReference = skipParenthesizedNodes(accessExpression.expression); + if (isMatchingReference(possibleReference, reference)) { + return getNarrowedType(type, predicate.type, assumeTrue); + } } } return type; } - function getSymbolAtTypePredicatePosition(expr) { - expr = skipParenthesizedNodes(expr); - switch (expr.kind) { - case 69 /* Identifier */: - case 170 /* PropertyAccessExpression */: - return getSymbolOfEntityNameOrPropertyAccessExpression(expr); - } - } // Narrow the given type based on the given expression having the assumed boolean value. The returned type // will be a subtype or the same type as the argument. function narrowType(type, expr, assumeTrue) { switch (expr.kind) { - case 172 /* CallExpression */: + case 69 /* Identifier */: + case 97 /* ThisKeyword */: + case 171 /* PropertyAccessExpression */: + return narrowTypeByTruthiness(type, expr, assumeTrue); + case 173 /* CallExpression */: return narrowTypeByTypePredicate(type, expr, assumeTrue); - case 176 /* ParenthesizedExpression */: + case 177 /* ParenthesizedExpression */: return narrowType(type, expr.expression, assumeTrue); - case 185 /* BinaryExpression */: - var operator = expr.operatorToken.kind; - if (operator === 32 /* EqualsEqualsEqualsToken */ || operator === 33 /* ExclamationEqualsEqualsToken */) { - return narrowTypeByEquality(type, expr, assumeTrue); - } - else if (operator === 51 /* AmpersandAmpersandToken */) { - return narrowTypeByAnd(type, expr, assumeTrue); - } - else if (operator === 52 /* BarBarToken */) { - return narrowTypeByOr(type, expr, assumeTrue); - } - else if (operator === 91 /* InstanceOfKeyword */) { - return narrowTypeByInstanceof(type, expr, assumeTrue); - } - break; - case 183 /* PrefixUnaryExpression */: + case 186 /* BinaryExpression */: + return narrowTypeByBinaryExpression(type, expr, assumeTrue); + case 184 /* PrefixUnaryExpression */: if (expr.operator === 49 /* ExclamationToken */) { return narrowType(type, expr.operand, !assumeTrue); } @@ -21299,12 +22028,124 @@ var ts; return type; } } + function getTypeOfSymbolAtLocation(symbol, location) { + // The language service will always care about the narrowed type of a symbol, because that is + // the type the language says the symbol should have. + var type = getTypeOfSymbol(symbol); + if (location.kind === 69 /* Identifier */) { + if (ts.isRightSideOfQualifiedNameOrPropertyAccess(location)) { + location = location.parent; + } + // If location is an identifier or property access that references the given + // symbol, use the location as the reference with respect to which we narrow. + if (ts.isExpression(location)) { + checkExpression(location); + if (getNodeLinks(location).resolvedSymbol === symbol) { + return getNarrowedTypeOfReference(type, location); + } + } + } + // 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. To answer that question we manufacture a transient + // identifier at the location and narrow with respect to that identifier. + return getNarrowedTypeOfReference(type, createTransientIdentifier(symbol, location)); + } function skipParenthesizedNodes(expression) { - while (expression.kind === 176 /* ParenthesizedExpression */) { + while (expression.kind === 177 /* ParenthesizedExpression */) { expression = expression.expression; } return expression; } + function findFirstAssignment(symbol, container) { + return visit(ts.isFunctionLike(container) ? container.body : container); + function visit(node) { + switch (node.kind) { + case 69 /* Identifier */: + var assignment = getAssignmentRoot(node); + return assignment && getResolvedSymbol(node) === symbol ? assignment : undefined; + case 186 /* BinaryExpression */: + case 217 /* VariableDeclaration */: + case 168 /* BindingElement */: + case 166 /* ObjectBindingPattern */: + case 167 /* ArrayBindingPattern */: + case 169 /* ArrayLiteralExpression */: + case 170 /* ObjectLiteralExpression */: + case 171 /* PropertyAccessExpression */: + case 172 /* ElementAccessExpression */: + case 173 /* CallExpression */: + case 174 /* NewExpression */: + case 176 /* TypeAssertionExpression */: + case 194 /* AsExpression */: + case 195 /* NonNullExpression */: + case 177 /* ParenthesizedExpression */: + case 184 /* PrefixUnaryExpression */: + case 180 /* DeleteExpression */: + case 183 /* AwaitExpression */: + case 181 /* TypeOfExpression */: + case 182 /* VoidExpression */: + case 185 /* PostfixUnaryExpression */: + case 189 /* YieldExpression */: + case 187 /* ConditionalExpression */: + case 190 /* SpreadElementExpression */: + case 199 /* VariableStatement */: + case 201 /* ExpressionStatement */: + case 202 /* IfStatement */: + case 203 /* DoStatement */: + case 204 /* WhileStatement */: + case 205 /* ForStatement */: + case 206 /* ForInStatement */: + case 207 /* ForOfStatement */: + case 210 /* ReturnStatement */: + case 211 /* WithStatement */: + case 212 /* SwitchStatement */: + case 226 /* CaseBlock */: + case 248 /* CaseClause */: + case 249 /* DefaultClause */: + case 213 /* LabeledStatement */: + case 214 /* ThrowStatement */: + case 215 /* TryStatement */: + case 251 /* CatchClause */: + case 240 /* JsxElement */: + case 241 /* JsxSelfClosingElement */: + case 245 /* JsxAttribute */: + case 246 /* JsxSpreadAttribute */: + case 242 /* JsxOpeningElement */: + case 247 /* JsxExpression */: + case 198 /* Block */: + case 255 /* SourceFile */: + return ts.forEachChild(node, visit); + } + return undefined; + } + } + function checkVariableAssignedBefore(symbol, reference) { + if (!(symbol.flags & 3 /* Variable */)) { + return; + } + var declaration = symbol.valueDeclaration; + if (!declaration || declaration.kind !== 217 /* VariableDeclaration */ || declaration.initializer || ts.isInAmbientContext(declaration)) { + return; + } + var parentParentKind = declaration.parent.parent.kind; + if (parentParentKind === 207 /* ForOfStatement */ || parentParentKind === 206 /* ForInStatement */) { + return; + } + var declarationContainer = ts.getContainingFunction(declaration) || ts.getSourceFileOfNode(declaration); + var referenceContainer = ts.getContainingFunction(reference) || ts.getSourceFileOfNode(reference); + if (declarationContainer !== referenceContainer) { + return; + } + var links = getSymbolLinks(symbol); + if (!links.firstAssignmentChecked) { + links.firstAssignmentChecked = true; + links.firstAssignment = findFirstAssignment(symbol, declarationContainer); + } + if (links.firstAssignment && links.firstAssignment.end <= reference.pos) { + return; + } + error(reference, ts.Diagnostics.Variable_0_is_used_before_being_assigned, symbolToString(symbol)); + } function checkIdentifier(node) { var symbol = getResolvedSymbol(node); // As noted in ECMAScript 6 language spec, arrow functions never have an arguments objects. @@ -21315,7 +22156,7 @@ var ts; // can explicitly bound arguments objects if (symbol === argumentsSymbol) { var container = ts.getContainingFunction(node); - if (container.kind === 178 /* ArrowFunction */) { + if (container.kind === 179 /* ArrowFunction */) { if (languageVersion < 2 /* ES6 */) { error(node, ts.Diagnostics.The_arguments_object_cannot_be_referenced_in_an_arrow_function_in_ES3_and_ES5_Consider_using_a_standard_function_expression); } @@ -21333,7 +22174,7 @@ var ts; // behavior of class names in ES6. if (languageVersion === 2 /* ES6 */ && localOrExportSymbol.flags & 32 /* Class */ - && localOrExportSymbol.valueDeclaration.kind === 218 /* ClassDeclaration */ + && localOrExportSymbol.valueDeclaration.kind === 220 /* ClassDeclaration */ && ts.nodeIsDecorated(localOrExportSymbol.valueDeclaration)) { var container = ts.getContainingClass(node); while (container !== undefined) { @@ -21348,7 +22189,11 @@ var ts; checkCollisionWithCapturedSuperVariable(node, node); checkCollisionWithCapturedThisVariable(node, node); checkNestedBlockScopedBinding(node, symbol); - return getNarrowedTypeOfSymbol(localOrExportSymbol, node); + var type = getTypeOfSymbol(localOrExportSymbol); + if (strictNullChecks && !isAssignmentTarget(node) && !(type.flags & 1 /* Any */) && !(getNullableKind(type) & 32 /* Undefined */)) { + checkVariableAssignedBefore(symbol, node); + } + return getNarrowedTypeOfReference(type, node); } function isInsideFunction(node, threshold) { var current = node; @@ -21363,7 +22208,7 @@ var ts; function checkNestedBlockScopedBinding(node, symbol) { if (languageVersion >= 2 /* ES6 */ || (symbol.flags & (2 /* BlockScopedVariable */ | 32 /* Class */)) === 0 || - symbol.valueDeclaration.parent.kind === 248 /* CatchClause */) { + symbol.valueDeclaration.parent.kind === 251 /* CatchClause */) { return; } // 1. walk from the use site up to the declaration and check @@ -21388,8 +22233,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 === 203 /* ForStatement */ && - ts.getAncestor(symbol.valueDeclaration, 216 /* VariableDeclarationList */).parent === container && + if (container.kind === 205 /* ForStatement */ && + ts.getAncestor(symbol.valueDeclaration, 218 /* VariableDeclarationList */).parent === container && isAssignedInBodyOfForStatement(node, container)) { getNodeLinks(symbol.valueDeclaration).flags |= 2097152 /* NeedsLoopOutParameter */; } @@ -21403,15 +22248,15 @@ var ts; function isAssignedInBodyOfForStatement(node, container) { var current = node; // skip parenthesized nodes - while (current.parent.kind === 176 /* ParenthesizedExpression */) { + while (current.parent.kind === 177 /* ParenthesizedExpression */) { current = current.parent; } // check if node is used as LHS in some assignment expression var isAssigned = false; - if (current.parent.kind === 185 /* BinaryExpression */) { - isAssigned = current.parent.left === current && ts.isAssignmentOperator(current.parent.operatorToken.kind); + if (isAssignmentTarget(current)) { + isAssigned = true; } - if ((current.parent.kind === 183 /* PrefixUnaryExpression */ || current.parent.kind === 184 /* PostfixUnaryExpression */)) { + else if ((current.parent.kind === 184 /* PrefixUnaryExpression */ || current.parent.kind === 185 /* PostfixUnaryExpression */)) { var expr = current.parent; isAssigned = expr.operator === 41 /* PlusPlusToken */ || expr.operator === 42 /* MinusMinusToken */; } @@ -21432,7 +22277,7 @@ var ts; } function captureLexicalThis(node, container) { getNodeLinks(node).flags |= 2 /* LexicalThis */; - if (container.kind === 143 /* PropertyDeclaration */ || container.kind === 146 /* Constructor */) { + if (container.kind === 144 /* PropertyDeclaration */ || container.kind === 147 /* Constructor */) { var classNode = container.parent; getNodeLinks(classNode).flags |= 4 /* CaptureThis */; } @@ -21480,7 +22325,7 @@ var ts; // tell whether 'this' needs to be captured. var container = ts.getThisContainer(node, /* includeArrowFunctions */ true); var needToCaptureLexicalThis = false; - if (container.kind === 146 /* Constructor */) { + if (container.kind === 147 /* Constructor */) { var containingClassDecl = container.parent; var baseTypeNode = ts.getClassExtendsHeritageClauseElement(containingClassDecl); // If a containing class does not have extends clause or the class extends null @@ -21501,41 +22346,60 @@ var ts; } } // Now skip arrow functions to get the "real" owner of 'this'. - if (container.kind === 178 /* ArrowFunction */) { + if (container.kind === 179 /* 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 */); } switch (container.kind) { - case 222 /* ModuleDeclaration */: + case 224 /* 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 221 /* EnumDeclaration */: + case 223 /* 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 146 /* Constructor */: + case 147 /* Constructor */: if (isInConstructorArgumentInitializer(node, container)) { error(node, ts.Diagnostics.this_cannot_be_referenced_in_constructor_arguments); } break; - case 143 /* PropertyDeclaration */: - case 142 /* PropertySignature */: + case 144 /* PropertyDeclaration */: + case 143 /* PropertySignature */: if (container.flags & 32 /* Static */) { error(node, ts.Diagnostics.this_cannot_be_referenced_in_a_static_property_initializer); } break; - case 138 /* ComputedPropertyName */: + case 139 /* ComputedPropertyName */: error(node, ts.Diagnostics.this_cannot_be_referenced_in_a_computed_property_name); break; } if (needToCaptureLexicalThis) { captureLexicalThis(node, container); } + if (ts.isFunctionLike(container)) { + var type = getContextuallyTypedThisType(container); + if (type) { + return type; + } + var signature = getSignatureFromDeclaration(container); + if (signature.thisType) { + return signature.thisType; + } + if (container.parent && container.parent.kind === 170 /* ObjectLiteralExpression */) { + // Note: this works because object literal methods are deferred, + // which means that the type of the containing object literal is already known. + var type_1 = checkExpressionCached(container.parent); + if (type_1) { + return type_1; + } + } + } if (ts.isClassLike(container.parent)) { var symbol = getSymbolOfNode(container.parent); - return container.flags & 32 /* Static */ ? getTypeOfSymbol(symbol) : getDeclaredTypeOfSymbol(symbol).thisType; + var type = container.flags & 32 /* Static */ ? getTypeOfSymbol(symbol) : getDeclaredTypeOfSymbol(symbol).thisType; + return getNarrowedTypeOfReference(type, node); } if (ts.isInJavaScriptFile(node)) { var type = getTypeForThisExpressionFromJSDoc(container); @@ -21544,7 +22408,7 @@ var ts; } // 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 === 177 /* FunctionExpression */) { + if (container.kind === 178 /* FunctionExpression */) { if (ts.getSpecialPropertyAssignmentKind(container.parent) === 3 /* PrototypeProperty */) { // Get the 'x' of 'x.prototype.y = f' (here, 'f' is 'container') var className = container.parent // x.prototype.y = f @@ -21558,32 +22422,36 @@ var ts; } } } + if (compilerOptions.noImplicitThis) { + // With noImplicitThis, functions may not reference 'this' if it has type 'any' + error(node, ts.Diagnostics.this_implicitly_has_type_any_because_it_does_not_have_a_type_annotation); + } return anyType; } function getTypeForThisExpressionFromJSDoc(node) { var typeTag = ts.getJSDocTypeTag(node); - if (typeTag && typeTag.typeExpression && typeTag.typeExpression.type && typeTag.typeExpression.type.kind === 265 /* JSDocFunctionType */) { + if (typeTag && typeTag.typeExpression && typeTag.typeExpression.type && typeTag.typeExpression.type.kind === 268 /* JSDocFunctionType */) { var jsDocFunctionType = typeTag.typeExpression.type; - if (jsDocFunctionType.parameters.length > 0 && jsDocFunctionType.parameters[0].type.kind === 268 /* JSDocThisType */) { + if (jsDocFunctionType.parameters.length > 0 && jsDocFunctionType.parameters[0].type.kind === 271 /* JSDocThisType */) { return getTypeFromTypeNode(jsDocFunctionType.parameters[0].type); } } } function isInConstructorArgumentInitializer(node, constructorDecl) { for (var n = node; n && n !== constructorDecl; n = n.parent) { - if (n.kind === 140 /* Parameter */) { + if (n.kind === 141 /* Parameter */) { return true; } } return false; } function checkSuperExpression(node) { - var isCallExpression = node.parent.kind === 172 /* CallExpression */ && node.parent.expression === node; + var isCallExpression = node.parent.kind === 173 /* CallExpression */ && node.parent.expression === node; var container = ts.getSuperContainer(node, /*stopOnFunctions*/ true); var needToCaptureLexicalThis = false; if (!isCallExpression) { // adjust the container reference in case if super is used inside arrow functions with arbitrary deep nesting - while (container && container.kind === 178 /* ArrowFunction */) { + while (container && container.kind === 179 /* ArrowFunction */) { container = ts.getSuperContainer(container, /*stopOnFunctions*/ true); needToCaptureLexicalThis = languageVersion < 2 /* ES6 */; } @@ -21597,16 +22465,16 @@ var ts; // [super.foo()]() {} // } var current = node; - while (current && current !== container && current.kind !== 138 /* ComputedPropertyName */) { + while (current && current !== container && current.kind !== 139 /* ComputedPropertyName */) { current = current.parent; } - if (current && current.kind === 138 /* ComputedPropertyName */) { + if (current && current.kind === 139 /* 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 === 169 /* ObjectLiteralExpression */)) { + else if (!container || !container.parent || !(ts.isClassLike(container.parent) || container.parent.kind === 170 /* ObjectLiteralExpression */)) { error(node, ts.Diagnostics.super_can_only_be_referenced_in_members_of_derived_classes_or_object_literal_expressions); } else { @@ -21677,7 +22545,7 @@ 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 === 145 /* MethodDeclaration */ && container.flags & 256 /* Async */) { + if (container.kind === 146 /* MethodDeclaration */ && container.flags & 256 /* Async */) { if (ts.isSuperPropertyOrElementAccess(node.parent) && isAssignmentTarget(node.parent)) { getNodeLinks(container).flags |= 4096 /* AsyncMethodWithSuperBinding */; } @@ -21691,7 +22559,7 @@ var ts; // in this case they should also use correct lexical this captureLexicalThis(node.parent, container); } - if (container.parent.kind === 169 /* ObjectLiteralExpression */) { + if (container.parent.kind === 170 /* ObjectLiteralExpression */) { if (languageVersion < 2 /* ES6 */) { error(node, ts.Diagnostics.super_is_only_allowed_in_members_of_object_literal_expressions_when_option_target_is_ES2015_or_higher); return unknownType; @@ -21711,7 +22579,7 @@ var ts; } return unknownType; } - if (container.kind === 146 /* Constructor */ && isInConstructorArgumentInitializer(node, container)) { + if (container.kind === 147 /* 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; @@ -21726,7 +22594,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 === 146 /* Constructor */; + return container.kind === 147 /* Constructor */; } else { // TS 1.0 SPEC (April 2014) @@ -21734,27 +22602,38 @@ 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 === 169 /* ObjectLiteralExpression */) { + if (ts.isClassLike(container.parent) || container.parent.kind === 170 /* ObjectLiteralExpression */) { if (container.flags & 32 /* Static */) { - return container.kind === 145 /* MethodDeclaration */ || - container.kind === 144 /* MethodSignature */ || - container.kind === 147 /* GetAccessor */ || - container.kind === 148 /* SetAccessor */; + return container.kind === 146 /* MethodDeclaration */ || + container.kind === 145 /* MethodSignature */ || + container.kind === 148 /* GetAccessor */ || + container.kind === 149 /* SetAccessor */; } else { - return container.kind === 145 /* MethodDeclaration */ || - container.kind === 144 /* MethodSignature */ || - container.kind === 147 /* GetAccessor */ || - container.kind === 148 /* SetAccessor */ || - container.kind === 143 /* PropertyDeclaration */ || - container.kind === 142 /* PropertySignature */ || - container.kind === 146 /* Constructor */; + return container.kind === 146 /* MethodDeclaration */ || + container.kind === 145 /* MethodSignature */ || + container.kind === 148 /* GetAccessor */ || + container.kind === 149 /* SetAccessor */ || + container.kind === 144 /* PropertyDeclaration */ || + container.kind === 143 /* PropertySignature */ || + container.kind === 147 /* Constructor */; } } } return false; } } + function getContextuallyTypedThisType(func) { + if ((isFunctionExpressionOrArrowFunction(func) || ts.isObjectLiteralMethod(func)) && + isContextSensitive(func) && + func.kind !== 179 /* ArrowFunction */) { + var contextualSignature = getContextualSignature(func); + if (contextualSignature) { + return contextualSignature.thisType; + } + } + return undefined; + } // Return contextual type of parameter or undefined if no contextual type is available function getContextuallyTypedParameterType(parameter) { var func = parameter.parent; @@ -21779,18 +22658,21 @@ var ts; } return undefined; } - // In a variable, parameter or property declaration with a type annotation, the contextual type of an initializer - // expression is the type of the variable, parameter or property. Otherwise, in a parameter declaration of a - // contextually typed function expression, the contextual type of an initializer expression is the contextual type - // of the parameter. Otherwise, in a variable or parameter declaration with a binding pattern name, the contextual - // type of an initializer expression is the type implied by the binding pattern. + // In a variable, parameter or property declaration with a type annotation, + // the contextual type of an initializer expression is the type of the variable, parameter or property. + // Otherwise, in a parameter declaration of a contextually typed function expression, + // the contextual type of an initializer expression is the contextual type of the parameter. + // Otherwise, in a variable or parameter declaration with a binding pattern name, + // the contextual type of an initializer expression is the type implied by the binding pattern. + // Otherwise, in a binding pattern inside a variable or parameter declaration, + // the contextual type of an initializer expression is the type annotation of the containing declaration, if present. function getContextualTypeForInitializerExpression(node) { var declaration = node.parent; if (node === declaration.initializer) { if (declaration.type) { return getTypeFromTypeNode(declaration.type); } - if (declaration.kind === 140 /* Parameter */) { + if (declaration.kind === 141 /* Parameter */) { var type = getContextuallyTypedParameterType(declaration); if (type) { return type; @@ -21799,6 +22681,18 @@ var ts; if (ts.isBindingPattern(declaration.name)) { return getTypeFromBindingPattern(declaration.name, /*includePatternInType*/ true); } + if (ts.isBindingPattern(declaration.parent)) { + var parentDeclaration = declaration.parent.parent; + var name_11 = declaration.propertyName || declaration.name; + if (ts.isVariableLike(parentDeclaration) && + parentDeclaration.type && + !ts.isBindingPattern(name_11)) { + var text = getTextOfPropertyName(name_11); + if (text) { + return getTypeOfPropertyOfType(getTypeFromTypeNode(parentDeclaration.type), text); + } + } + } } return undefined; } @@ -21823,7 +22717,7 @@ var ts; } function isInParameterInitializerBeforeContainingFunction(node) { while (node.parent && !ts.isFunctionLike(node.parent)) { - if (node.parent.kind === 140 /* Parameter */ && node.parent.initializer === node) { + if (node.parent.kind === 141 /* Parameter */ && node.parent.initializer === node) { return true; } node = node.parent; @@ -21834,8 +22728,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 === 146 /* Constructor */ || - functionDecl.kind === 147 /* GetAccessor */ && ts.getSetAccessorTypeAnnotationNode(ts.getDeclarationOfKind(functionDecl.symbol, 148 /* SetAccessor */))) { + functionDecl.kind === 147 /* Constructor */ || + functionDecl.kind === 148 /* GetAccessor */ && ts.getSetAccessorTypeAnnotationNode(ts.getDeclarationOfKind(functionDecl.symbol, 149 /* SetAccessor */))) { return getReturnTypeOfSignature(getSignatureFromDeclaration(functionDecl)); } // Otherwise, if the containing function is contextually typed by a function type with exactly one call signature @@ -21857,7 +22751,7 @@ var ts; return undefined; } function getContextualTypeForSubstitutionExpression(template, substitutionExpression) { - if (template.parent.kind === 174 /* TaggedTemplateExpression */) { + if (template.parent.kind === 175 /* TaggedTemplateExpression */) { return getContextualTypeForArgument(template.parent, substitutionExpression); } return undefined; @@ -21984,13 +22878,13 @@ var ts; var kind = attribute.kind; var jsxElement = attribute.parent; var attrsType = getJsxElementAttributesType(jsxElement); - if (attribute.kind === 242 /* JsxAttribute */) { + if (attribute.kind === 245 /* JsxAttribute */) { if (!attrsType || isTypeAny(attrsType)) { return undefined; } return getTypeOfPropertyOfType(attrsType, attribute.name.text); } - else if (attribute.kind === 243 /* JsxSpreadAttribute */) { + else if (attribute.kind === 246 /* JsxSpreadAttribute */) { return attrsType; } ts.Debug.fail("Expected JsxAttribute or JsxSpreadAttribute, got ts.SyntaxKind[" + kind + "]"); @@ -22028,40 +22922,40 @@ var ts; } var parent = node.parent; switch (parent.kind) { - case 215 /* VariableDeclaration */: - case 140 /* Parameter */: - case 143 /* PropertyDeclaration */: - case 142 /* PropertySignature */: - case 167 /* BindingElement */: + case 217 /* VariableDeclaration */: + case 141 /* Parameter */: + case 144 /* PropertyDeclaration */: + case 143 /* PropertySignature */: + case 168 /* BindingElement */: return getContextualTypeForInitializerExpression(node); - case 178 /* ArrowFunction */: - case 208 /* ReturnStatement */: + case 179 /* ArrowFunction */: + case 210 /* ReturnStatement */: return getContextualTypeForReturnExpression(node); - case 188 /* YieldExpression */: + case 189 /* YieldExpression */: return getContextualTypeForYieldOperand(parent); - case 172 /* CallExpression */: - case 173 /* NewExpression */: + case 173 /* CallExpression */: + case 174 /* NewExpression */: return getContextualTypeForArgument(parent, node); - case 175 /* TypeAssertionExpression */: - case 193 /* AsExpression */: + case 176 /* TypeAssertionExpression */: + case 194 /* AsExpression */: return getTypeFromTypeNode(parent.type); - case 185 /* BinaryExpression */: + case 186 /* BinaryExpression */: return getContextualTypeForBinaryOperand(node); - case 249 /* PropertyAssignment */: + case 252 /* PropertyAssignment */: return getContextualTypeForObjectLiteralElement(parent); - case 168 /* ArrayLiteralExpression */: + case 169 /* ArrayLiteralExpression */: return getContextualTypeForElementExpression(node); - case 186 /* ConditionalExpression */: + case 187 /* ConditionalExpression */: return getContextualTypeForConditionalOperand(node); - case 194 /* TemplateSpan */: - ts.Debug.assert(parent.parent.kind === 187 /* TemplateExpression */); + case 196 /* TemplateSpan */: + ts.Debug.assert(parent.parent.kind === 188 /* TemplateExpression */); return getContextualTypeForSubstitutionExpression(parent.parent, node); - case 176 /* ParenthesizedExpression */: + case 177 /* ParenthesizedExpression */: return getContextualType(parent); - case 244 /* JsxExpression */: + case 247 /* JsxExpression */: return getContextualType(parent); - case 242 /* JsxAttribute */: - case 243 /* JsxSpreadAttribute */: + case 245 /* JsxAttribute */: + case 246 /* JsxSpreadAttribute */: return getContextualTypeForJsxAttribute(parent); } return undefined; @@ -22078,7 +22972,7 @@ var ts; } } function isFunctionExpressionOrArrowFunction(node) { - return node.kind === 177 /* FunctionExpression */ || node.kind === 178 /* ArrowFunction */; + return node.kind === 178 /* FunctionExpression */ || node.kind === 179 /* ArrowFunction */; } function getContextualSignatureForFunctionLikeDeclaration(node) { // Only function expressions, arrow functions, and object literal methods are contextually typed. @@ -22092,7 +22986,7 @@ 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 !== 145 /* MethodDeclaration */ || ts.isObjectLiteralMethod(node)); + ts.Debug.assert(node.kind !== 146 /* MethodDeclaration */ || ts.isObjectLiteralMethod(node)); var type = ts.isObjectLiteralMethod(node) ? getContextualTypeForObjectLiteralMethod(node) : getApparentTypeOfContextualType(node); @@ -22112,7 +23006,7 @@ var ts; // This signature will contribute to contextual union signature signatureList = [signature]; } - else if (!compareSignaturesIdentical(signatureList[0], signature, /*partialMatch*/ false, /*ignoreReturnTypes*/ true, compareTypesIdentical)) { + else if (!compareSignaturesIdentical(signatureList[0], signature, /*partialMatch*/ false, /*ignoreThisTypes*/ true, /*ignoreReturnTypes*/ true, compareTypesIdentical)) { // Signatures aren't identical, do not use return undefined; } @@ -22150,19 +23044,38 @@ var ts; function isInferentialContext(mapper) { return mapper && mapper.context; } + // Return the root assignment node of an assignment target + function getAssignmentRoot(node) { + while (node.parent.kind === 177 /* ParenthesizedExpression */) { + node = node.parent; + } + while (true) { + if (node.parent.kind === 252 /* PropertyAssignment */) { + node = node.parent.parent; + } + else if (node.parent.kind === 169 /* ArrayLiteralExpression */) { + node = node.parent; + } + else { + break; + } + } + var parent = node.parent; + return parent.kind === 186 /* BinaryExpression */ && + parent.operatorToken.kind === 56 /* EqualsToken */ && + parent.left === node ? parent : undefined; + } // 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) { + return !!getAssignmentRoot(node); + } + function isCompoundAssignmentTarget(node) { var parent = node.parent; - if (parent.kind === 185 /* BinaryExpression */ && parent.operatorToken.kind === 56 /* EqualsToken */ && parent.left === node) { - return true; - } - if (parent.kind === 249 /* PropertyAssignment */) { - return isAssignmentTarget(parent.parent); - } - if (parent.kind === 168 /* ArrayLiteralExpression */) { - return isAssignmentTarget(parent); + if (parent.kind === 186 /* BinaryExpression */ && parent.left === node) { + var operator = parent.operatorToken.kind; + return operator >= 56 /* FirstAssignment */ && operator <= 68 /* LastAssignment */; } return false; } @@ -22177,8 +23090,8 @@ var ts; return checkIteratedTypeOrElementType(arrayOrIterableType, node.expression, /*allowStringInput*/ false); } function hasDefaultValue(node) { - return (node.kind === 167 /* BindingElement */ && !!node.initializer) || - (node.kind === 185 /* BinaryExpression */ && node.operatorToken.kind === 56 /* EqualsToken */); + return (node.kind === 168 /* BindingElement */ && !!node.initializer) || + (node.kind === 186 /* BinaryExpression */ && node.operatorToken.kind === 56 /* EqualsToken */); } function checkArrayLiteral(node, contextualMapper) { var elements = node.elements; @@ -22187,7 +23100,7 @@ var ts; var inDestructuringPattern = isAssignmentTarget(node); for (var _i = 0, elements_1 = elements; _i < elements_1.length; _i++) { var e = elements_1[_i]; - if (inDestructuringPattern && e.kind === 189 /* SpreadElementExpression */) { + if (inDestructuringPattern && e.kind === 190 /* SpreadElementExpression */) { // Given the following situation: // var c: {}; // [...c] = ["", 0]; @@ -22211,7 +23124,7 @@ var ts; var type = checkExpression(e, contextualMapper); elementTypes.push(type); } - hasSpreadElement = hasSpreadElement || e.kind === 189 /* SpreadElementExpression */; + hasSpreadElement = hasSpreadElement || e.kind === 190 /* SpreadElementExpression */; } if (!hasSpreadElement) { // If array literal is actually a destructuring pattern, mark it as an implied type. We do this such @@ -22226,7 +23139,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 === 166 /* ArrayBindingPattern */ || pattern.kind === 168 /* ArrayLiteralExpression */)) { + if (pattern && (pattern.kind === 167 /* ArrayBindingPattern */ || pattern.kind === 169 /* ArrayLiteralExpression */)) { var patternElements = pattern.elements; for (var i = elementTypes.length; i < patternElements.length; i++) { var patternElement = patternElements[i]; @@ -22234,7 +23147,7 @@ var ts; elementTypes.push(contextualType.elementTypes[i]); } else { - if (patternElement.kind !== 191 /* OmittedExpression */) { + if (patternElement.kind !== 192 /* OmittedExpression */) { error(patternElement, ts.Diagnostics.Initializer_provides_no_value_for_this_binding_element_and_the_binding_element_has_no_default_value); } elementTypes.push(unknownType); @@ -22246,10 +23159,10 @@ var ts; } } } - return createArrayType(elementTypes.length ? getUnionType(elementTypes) : undefinedType); + return createArrayType(elementTypes.length ? getUnionType(elementTypes) : emptyArrayElementType); } function isNumericName(name) { - return name.kind === 138 /* ComputedPropertyName */ ? isNumericComputedName(name) : isNumericLiteralName(name.text); + return name.kind === 139 /* 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, @@ -22316,7 +23229,7 @@ var ts; var propertiesArray = []; var contextualType = getApparentTypeOfContextualType(node); var contextualTypeHasPattern = contextualType && contextualType.pattern && - (contextualType.pattern.kind === 165 /* ObjectBindingPattern */ || contextualType.pattern.kind === 169 /* ObjectLiteralExpression */); + (contextualType.pattern.kind === 166 /* ObjectBindingPattern */ || contextualType.pattern.kind === 170 /* ObjectLiteralExpression */); var typeFlags = 0; var patternWithComputedProperties = false; var hasComputedStringProperty = false; @@ -22324,18 +23237,18 @@ var ts; for (var _i = 0, _a = node.properties; _i < _a.length; _i++) { var memberDecl = _a[_i]; var member = memberDecl.symbol; - if (memberDecl.kind === 249 /* PropertyAssignment */ || - memberDecl.kind === 250 /* ShorthandPropertyAssignment */ || + if (memberDecl.kind === 252 /* PropertyAssignment */ || + memberDecl.kind === 253 /* ShorthandPropertyAssignment */ || ts.isObjectLiteralMethod(memberDecl)) { var type = void 0; - if (memberDecl.kind === 249 /* PropertyAssignment */) { + if (memberDecl.kind === 252 /* PropertyAssignment */) { type = checkPropertyAssignment(memberDecl, contextualMapper); } - else if (memberDecl.kind === 145 /* MethodDeclaration */) { + else if (memberDecl.kind === 146 /* MethodDeclaration */) { type = checkObjectLiteralMethod(memberDecl, contextualMapper); } else { - ts.Debug.assert(memberDecl.kind === 250 /* ShorthandPropertyAssignment */); + ts.Debug.assert(memberDecl.kind === 253 /* ShorthandPropertyAssignment */); type = checkExpression(memberDecl.name, contextualMapper); } typeFlags |= type.flags; @@ -22343,8 +23256,8 @@ var ts; 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 === 249 /* PropertyAssignment */ && hasDefaultValue(memberDecl.initializer)) || - (memberDecl.kind === 250 /* ShorthandPropertyAssignment */ && memberDecl.objectAssignmentInitializer); + var isOptional = (memberDecl.kind === 252 /* PropertyAssignment */ && hasDefaultValue(memberDecl.initializer)) || + (memberDecl.kind === 253 /* ShorthandPropertyAssignment */ && memberDecl.objectAssignmentInitializer); if (isOptional) { prop.flags |= 536870912 /* Optional */; } @@ -22378,7 +23291,7 @@ var ts; // 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 === 147 /* GetAccessor */ || memberDecl.kind === 148 /* SetAccessor */); + ts.Debug.assert(memberDecl.kind === 148 /* GetAccessor */ || memberDecl.kind === 149 /* SetAccessor */); checkAccessorDeclaration(memberDecl); } if (ts.hasDynamicName(memberDecl)) { @@ -22426,18 +23339,23 @@ var ts; // Check attributes checkJsxOpeningLikeElement(node.openingElement); // Perform resolution on the closing tag so that rename/go to definition/etc work - getJsxTagSymbol(node.closingElement); + if (isJsxIntrinsicIdentifier(node.closingElement.tagName)) { + getIntrinsicTagSymbol(node.closingElement); + } + else { + checkExpression(node.closingElement.tagName); + } // Check children for (var _i = 0, _a = node.children; _i < _a.length; _i++) { var child = _a[_i]; switch (child.kind) { - case 244 /* JsxExpression */: + case 247 /* JsxExpression */: checkJsxExpression(child); break; - case 237 /* JsxElement */: + case 240 /* JsxElement */: checkJsxElement(child); break; - case 238 /* JsxSelfClosingElement */: + case 241 /* JsxSelfClosingElement */: checkJsxSelfClosingElement(child); break; } @@ -22455,7 +23373,7 @@ var ts; * Returns true iff React would emit this tag name as a string rather than an identifier or qualified name */ function isJsxIntrinsicIdentifier(tagName) { - if (tagName.kind === 137 /* QualifiedName */) { + if (tagName.kind === 138 /* QualifiedName */) { return false; } else { @@ -22525,14 +23443,6 @@ var ts; } return jsxTypes[name]; } - function getJsxTagSymbol(node) { - if (isJsxIntrinsicIdentifier(node.tagName)) { - return getIntrinsicTagSymbol(node); - } - else { - return checkExpression(node.tagName).symbol; - } - } /** * Looks up an intrinsic tag name and returns a symbol that either points to an intrinsic * property (in which case nodeLinks.jsxFlags will be IntrinsicNamedElement) or an intrinsic @@ -22648,18 +23558,20 @@ var ts; if (!elemClassType || !isTypeAssignableTo(elemInstanceType, elemClassType)) { // Is this is a stateless function component? See if its single signature's return type is // assignable to the JSX Element Type - var elemType = checkExpression(node.tagName); - var callSignatures = elemType && getSignaturesOfType(elemType, 0 /* Call */); - var callSignature = callSignatures && callSignatures.length > 0 && callSignatures[0]; - var callReturnType = callSignature && getReturnTypeOfSignature(callSignature); - var paramType = callReturnType && (callSignature.parameters.length === 0 ? emptyObjectType : getTypeOfSymbol(callSignature.parameters[0])); - if (callReturnType && isTypeAssignableTo(callReturnType, jsxElementType)) { - // Intersect in JSX.IntrinsicAttributes if it exists - var intrinsicAttributes = getJsxType(JsxNames.IntrinsicAttributes); - if (intrinsicAttributes !== unknownType) { - paramType = intersectTypes(intrinsicAttributes, paramType); + if (jsxElementType) { + var elemType = checkExpression(node.tagName); + var callSignatures = elemType && getSignaturesOfType(elemType, 0 /* Call */); + var callSignature = callSignatures && callSignatures.length > 0 && callSignatures[0]; + var callReturnType = callSignature && getReturnTypeOfSignature(callSignature); + var paramType = callReturnType && (callSignature.parameters.length === 0 ? emptyObjectType : getTypeOfSymbol(callSignature.parameters[0])); + if (callReturnType && isTypeAssignableTo(callReturnType, jsxElementType)) { + // Intersect in JSX.IntrinsicAttributes if it exists + var intrinsicAttributes = getJsxType(JsxNames.IntrinsicAttributes); + if (intrinsicAttributes !== unknownType) { + paramType = intersectTypes(intrinsicAttributes, paramType); + } + return links.resolvedJsxType = paramType; } - return links.resolvedJsxType = paramType; } } // Issue an error if this return type isn't assignable to JSX.ElementClass @@ -22770,11 +23682,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 === 242 /* JsxAttribute */) { + if (node.attributes[i].kind === 245 /* JsxAttribute */) { checkJsxAttribute((node.attributes[i]), targetAttributesType, nameTable); } else { - ts.Debug.assert(node.attributes[i].kind === 243 /* JsxSpreadAttribute */); + ts.Debug.assert(node.attributes[i].kind === 246 /* JsxSpreadAttribute */); var spreadType = checkJsxSpreadAttribute((node.attributes[i]), targetAttributesType, nameTable); if (isTypeAny(spreadType)) { sawSpreadedAny = true; @@ -22804,7 +23716,7 @@ 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 : 143 /* PropertyDeclaration */; + return s.valueDeclaration ? s.valueDeclaration.kind : 144 /* PropertyDeclaration */; } function getDeclarationFlagsFromSymbol(s) { return s.valueDeclaration ? ts.getCombinedNodeFlags(s.valueDeclaration) : s.flags & 134217728 /* Prototype */ ? 4 /* Public */ | 32 /* Static */ : 0; @@ -22820,10 +23732,10 @@ var ts; function checkClassPropertyAccess(node, left, type, prop) { var flags = getDeclarationFlagsFromSymbol(prop); var declaringClass = getDeclaredTypeOfSymbol(getParentOfSymbol(prop)); + var errorNode = node.kind === 171 /* PropertyAccessExpression */ || node.kind === 217 /* VariableDeclaration */ ? + node.name : + node.right; if (left.kind === 95 /* SuperKeyword */) { - var errorNode = node.kind === 170 /* PropertyAccessExpression */ ? - node.name : - node.right; // 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, @@ -22831,7 +23743,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) !== 145 /* MethodDeclaration */) { + if (languageVersion < 2 /* ES6 */ && getDeclarationKindFromSymbol(prop) !== 146 /* 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); @@ -22851,13 +23763,11 @@ var ts; return true; } // Property is known to be private or protected at this point - // Get the declaring and enclosing class instance types - var enclosingClassDeclaration = ts.getContainingClass(node); - var enclosingClass = enclosingClassDeclaration ? getDeclaredTypeOfSymbol(getSymbolOfNode(enclosingClassDeclaration)) : undefined; - // Private property is accessible if declaring and enclosing class are the same + // Private property is accessible if the property is within the declaring class if (flags & 8 /* Private */) { - if (declaringClass !== enclosingClass) { - error(node, ts.Diagnostics.Property_0_is_private_and_only_accessible_within_class_1, symbolToString(prop), typeToString(declaringClass)); + var declaringClassDeclaration = getClassLikeDeclarationOfSymbol(getParentOfSymbol(prop)); + if (!isNodeWithinClass(node, declaringClassDeclaration)) { + error(errorNode, ts.Diagnostics.Property_0_is_private_and_only_accessible_within_class_1, symbolToString(prop), typeToString(declaringClass)); return false; } return true; @@ -22867,9 +23777,14 @@ var ts; if (left.kind === 95 /* SuperKeyword */) { return true; } - // A protected property is accessible in the declaring class and classes derived from it - if (!enclosingClass || !hasBaseType(enclosingClass, declaringClass)) { - error(node, ts.Diagnostics.Property_0_is_protected_and_only_accessible_within_class_1_and_its_subclasses, symbolToString(prop), typeToString(declaringClass)); + // Get the enclosing class that has the declaring class as its base type + var enclosingClass = forEachEnclosingClass(node, function (enclosingDeclaration) { + var enclosingClass = getDeclaredTypeOfSymbol(getSymbolOfNode(enclosingDeclaration)); + return hasBaseType(enclosingClass, declaringClass) ? enclosingClass : undefined; + }); + // A protected property is accessible if the property is within the declaring class or classes derived from it + if (!enclosingClass) { + error(errorNode, ts.Diagnostics.Property_0_is_protected_and_only_accessible_within_class_1_and_its_subclasses, symbolToString(prop), typeToString(declaringClass)); return false; } // No further restrictions for static properties @@ -22883,11 +23798,19 @@ var ts; } // TODO: why is the first part of this check here? if (!(getTargetType(type).flags & (1024 /* Class */ | 2048 /* Interface */) && hasBaseType(type, enclosingClass))) { - error(node, ts.Diagnostics.Property_0_is_protected_and_only_accessible_through_an_instance_of_class_1, symbolToString(prop), typeToString(enclosingClass)); + error(errorNode, ts.Diagnostics.Property_0_is_protected_and_only_accessible_through_an_instance_of_class_1, symbolToString(prop), typeToString(enclosingClass)); return false; } return true; } + function checkNonNullExpression(node) { + var type = checkExpression(node); + if (strictNullChecks && getNullableKind(type)) { + error(node, ts.Diagnostics.Object_is_possibly_null_or_undefined); + return getNonNullableType(type); + } + return type; + } function checkPropertyAccessExpression(node) { return checkPropertyAccessExpressionOrQualifiedName(node, node.expression, node.name); } @@ -22895,7 +23818,7 @@ var ts; return checkPropertyAccessExpressionOrQualifiedName(node, node.left, node.right); } function checkPropertyAccessExpressionOrQualifiedName(node, left, right) { - var type = checkExpression(left); + var type = checkNonNullExpression(left); if (isTypeAny(type)) { return type; } @@ -22915,10 +23838,12 @@ var ts; if (prop.parent && prop.parent.flags & 32 /* Class */) { checkClassPropertyAccess(node, left, apparentType, prop); } - return getTypeOfSymbol(prop); + var propType = getTypeOfSymbol(prop); + return node.kind === 171 /* PropertyAccessExpression */ && prop.flags & 4 /* Property */ ? + getNarrowedTypeOfReference(propType, node) : propType; } function isValidPropertyAccess(node, propertyName) { - var left = node.kind === 170 /* PropertyAccessExpression */ + var left = node.kind === 171 /* PropertyAccessExpression */ ? node.expression : node.left; var type = checkExpression(left); @@ -22935,7 +23860,7 @@ var ts; */ function getForInVariableSymbol(node) { var initializer = node.initializer; - if (initializer.kind === 216 /* VariableDeclarationList */) { + if (initializer.kind === 218 /* VariableDeclarationList */) { var variable = initializer.declarations[0]; if (variable && !ts.isBindingPattern(variable.name)) { return getSymbolOfNode(variable); @@ -22964,7 +23889,7 @@ var ts; var child = expr; var node = expr.parent; while (node) { - if (node.kind === 204 /* ForInStatement */ && + if (node.kind === 206 /* ForInStatement */ && child === node.statement && getForInVariableSymbol(node) === symbol && hasNumericPropertyNames(checkExpression(node.expression))) { @@ -22981,7 +23906,7 @@ var ts; // Grammar checking if (!node.argumentExpression) { var sourceFile = ts.getSourceFileOfNode(node); - if (node.parent.kind === 173 /* NewExpression */ && node.parent.expression === node) { + if (node.parent.kind === 174 /* 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); @@ -22993,7 +23918,7 @@ var ts; } } // Obtain base constraint such that we can bail out if the constraint is an unknown type - var objectType = getApparentType(checkExpression(node.expression)); + var objectType = getApparentType(checkNonNullExpression(node.expression)); var indexType = node.argumentExpression ? checkExpression(node.argumentExpression) : unknownType; if (objectType === unknownType) { return unknownType; @@ -23014,15 +23939,15 @@ var ts; // - 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_11 = getPropertyNameForIndexedAccess(node.argumentExpression, indexType); - if (name_11 !== undefined) { - var prop = getPropertyOfType(objectType, name_11); + var name_12 = getPropertyNameForIndexedAccess(node.argumentExpression, indexType); + if (name_12 !== undefined) { + var prop = getPropertyOfType(objectType, name_12); 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_11, symbolToString(objectType.symbol)); + error(node.argumentExpression, ts.Diagnostics.Property_0_does_not_exist_on_const_enum_1, name_12, symbolToString(objectType.symbol)); return unknownType; } } @@ -23066,7 +23991,7 @@ var ts; if (indexArgumentExpression.kind === 9 /* StringLiteral */ || indexArgumentExpression.kind === 8 /* NumericLiteral */) { return indexArgumentExpression.text; } - if (indexArgumentExpression.kind === 171 /* ElementAccessExpression */ || indexArgumentExpression.kind === 170 /* PropertyAccessExpression */) { + if (indexArgumentExpression.kind === 172 /* ElementAccessExpression */ || indexArgumentExpression.kind === 171 /* PropertyAccessExpression */) { var value = getConstantValue(indexArgumentExpression); if (value !== undefined) { return value.toString(); @@ -23121,10 +24046,10 @@ var ts; return true; } function resolveUntypedCall(node) { - if (node.kind === 174 /* TaggedTemplateExpression */) { + if (node.kind === 175 /* TaggedTemplateExpression */) { checkExpression(node.template); } - else if (node.kind !== 141 /* Decorator */) { + else if (node.kind !== 142 /* Decorator */) { ts.forEach(node.arguments, function (argument) { checkExpression(argument); }); @@ -23154,13 +24079,13 @@ var ts; for (var _i = 0, signatures_2 = signatures; _i < signatures_2.length; _i++) { var signature = signatures_2[_i]; var symbol = signature.declaration && getSymbolOfNode(signature.declaration); - var parent_6 = signature.declaration && signature.declaration.parent; + var parent_7 = signature.declaration && signature.declaration.parent; if (!lastSymbol || symbol === lastSymbol) { - if (lastParent && parent_6 === lastParent) { + if (lastParent && parent_7 === lastParent) { index++; } else { - lastParent = parent_6; + lastParent = parent_7; index = cutoffIndex; } } @@ -23168,7 +24093,7 @@ var ts; // current declaration belongs to a different symbol // set cutoffIndex so re-orderings in the future won't change result set from 0 to cutoffIndex index = cutoffIndex = result.length; - lastParent = parent_6; + lastParent = parent_7; } lastSymbol = symbol; // specialized signatures always need to be placed before non-specialized signatures regardless @@ -23190,7 +24115,7 @@ var ts; function getSpreadArgumentIndex(args) { for (var i = 0; i < args.length; i++) { var arg = args[i]; - if (arg && arg.kind === 189 /* SpreadElementExpression */) { + if (arg && arg.kind === 190 /* SpreadElementExpression */) { return i; } } @@ -23202,13 +24127,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 === 174 /* TaggedTemplateExpression */) { + if (node.kind === 175 /* 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 adjustedArgCount = args.length; typeArguments = undefined; - if (tagExpression.template.kind === 187 /* TemplateExpression */) { + if (tagExpression.template.kind === 188 /* 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; @@ -23225,7 +24150,7 @@ var ts; callIsIncomplete = !!templateLiteral.isUnterminated; } } - else if (node.kind === 141 /* Decorator */) { + else if (node.kind === 142 /* Decorator */) { isDecorator = true; typeArguments = undefined; adjustedArgCount = getEffectiveArgumentCount(node, /*args*/ undefined, signature); @@ -23234,7 +24159,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 === 173 /* NewExpression */); + ts.Debug.assert(callExpression.kind === 174 /* NewExpression */); return signature.minArgumentCount === 0; } // For IDE scenarios we may have an incomplete call, so a trailing comma is tantamount to adding another argument. @@ -23307,13 +24232,18 @@ var ts; if (context.failedTypeParameterIndex !== undefined && !context.inferences[context.failedTypeParameterIndex].isFixed) { context.failedTypeParameterIndex = undefined; } + if (signature.thisType) { + var thisArgumentNode = getThisArgumentOfCall(node); + var thisArgumentType = thisArgumentNode ? checkExpression(thisArgumentNode) : voidType; + inferTypes(context, thisArgumentType, signature.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. var argCount = getEffectiveArgumentCount(node, args, signature); 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 !== 191 /* OmittedExpression */) { + if (arg === undefined || arg.kind !== 192 /* OmittedExpression */) { var paramType = getTypeAtPosition(signature, i); var argType = getEffectiveArgumentType(node, i, arg); // If the effective argument type is 'undefined', there is no synthetic type @@ -23369,11 +24299,24 @@ var ts; return typeArgumentsAreAssignable; } function checkApplicableSignature(node, args, signature, relation, excludeArgument, reportErrors) { + if (signature.thisType && signature.thisType !== voidType && node.kind !== 174 /* 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. + var thisArgumentNode = getThisArgumentOfCall(node); + var thisArgumentType = thisArgumentNode ? checkExpression(thisArgumentNode) : voidType; + var errorNode = reportErrors ? (thisArgumentNode || node) : undefined; + var headMessage_1 = ts.Diagnostics.The_this_context_of_type_0_is_not_assignable_to_method_s_this_of_type_1; + if (!checkTypeRelatedTo(thisArgumentType, signature.thisType, relation, errorNode, headMessage_1)) { + return false; + } + } + var headMessage = ts.Diagnostics.Argument_of_type_0_is_not_assignable_to_parameter_of_type_1; var argCount = getEffectiveArgumentCount(node, args, signature); 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 !== 191 /* OmittedExpression */) { + if (arg === undefined || arg.kind !== 192 /* 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); @@ -23386,7 +24329,6 @@ var ts; } // Use argument expression as error location when reporting errors var errorNode = reportErrors ? getEffectiveArgumentErrorNode(node, i, arg) : undefined; - var headMessage = ts.Diagnostics.Argument_of_type_0_is_not_assignable_to_parameter_of_type_1; if (!checkTypeRelatedTo(argType, paramType, relation, errorNode, headMessage)) { return false; } @@ -23394,6 +24336,20 @@ var ts; } return true; } + /** + * Returns the this argument in calls like x.f(...) and x[f](...). Undefined otherwise. + */ + function getThisArgumentOfCall(node) { + if (node.kind === 173 /* CallExpression */) { + var callee = node.expression; + if (callee.kind === 171 /* PropertyAccessExpression */) { + return callee.expression; + } + else if (callee.kind === 172 /* ElementAccessExpression */) { + return callee.expression; + } + } + } /** * Returns the effective arguments for an expression that works like a function invocation. * @@ -23405,16 +24361,16 @@ var ts; */ function getEffectiveCallArguments(node) { var args; - if (node.kind === 174 /* TaggedTemplateExpression */) { + if (node.kind === 175 /* TaggedTemplateExpression */) { var template = node.template; args = [undefined]; - if (template.kind === 187 /* TemplateExpression */) { + if (template.kind === 188 /* TemplateExpression */) { ts.forEach(template.templateSpans, function (span) { args.push(span.expression); }); } } - else if (node.kind === 141 /* Decorator */) { + else if (node.kind === 142 /* 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. @@ -23439,19 +24395,19 @@ var ts; * Otherwise, the argument count is the length of the 'args' array. */ function getEffectiveArgumentCount(node, args, signature) { - if (node.kind === 141 /* Decorator */) { + if (node.kind === 142 /* Decorator */) { switch (node.parent.kind) { - case 218 /* ClassDeclaration */: - case 190 /* ClassExpression */: + case 220 /* ClassDeclaration */: + case 191 /* ClassExpression */: // A class decorator will have one argument (see `ClassDecorator` in core.d.ts) return 1; - case 143 /* PropertyDeclaration */: + case 144 /* PropertyDeclaration */: // A property declaration decorator will have two arguments (see // `PropertyDecorator` in core.d.ts) return 2; - case 145 /* MethodDeclaration */: - case 147 /* GetAccessor */: - case 148 /* SetAccessor */: + case 146 /* MethodDeclaration */: + case 148 /* GetAccessor */: + case 149 /* 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. @@ -23461,7 +24417,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 140 /* Parameter */: + case 141 /* Parameter */: // A parameter declaration decorator will have three arguments (see // `ParameterDecorator` in core.d.ts) return 3; @@ -23485,25 +24441,25 @@ var ts; */ function getEffectiveDecoratorFirstArgumentType(node) { // The first argument to a decorator is its `target`. - if (node.kind === 218 /* ClassDeclaration */) { + if (node.kind === 220 /* 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 === 140 /* Parameter */) { + if (node.kind === 141 /* Parameter */) { // For a parameter decorator, the `target` is the parent type of the // parameter's containing method. node = node.parent; - if (node.kind === 146 /* Constructor */) { + if (node.kind === 147 /* Constructor */) { var classSymbol = getSymbolOfNode(node); return getTypeOfSymbol(classSymbol); } } - if (node.kind === 143 /* PropertyDeclaration */ || - node.kind === 145 /* MethodDeclaration */ || - node.kind === 147 /* GetAccessor */ || - node.kind === 148 /* SetAccessor */) { + if (node.kind === 144 /* PropertyDeclaration */ || + node.kind === 146 /* MethodDeclaration */ || + node.kind === 148 /* GetAccessor */ || + node.kind === 149 /* 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 @@ -23530,21 +24486,21 @@ var ts; */ function getEffectiveDecoratorSecondArgumentType(node) { // The second argument to a decorator is its `propertyKey` - if (node.kind === 218 /* ClassDeclaration */) { + if (node.kind === 220 /* ClassDeclaration */) { ts.Debug.fail("Class decorators should not have a second synthetic argument."); return unknownType; } - if (node.kind === 140 /* Parameter */) { + if (node.kind === 141 /* Parameter */) { node = node.parent; - if (node.kind === 146 /* Constructor */) { + if (node.kind === 147 /* Constructor */) { // For a constructor parameter decorator, the `propertyKey` will be `undefined`. return anyType; } } - if (node.kind === 143 /* PropertyDeclaration */ || - node.kind === 145 /* MethodDeclaration */ || - node.kind === 147 /* GetAccessor */ || - node.kind === 148 /* SetAccessor */) { + if (node.kind === 144 /* PropertyDeclaration */ || + node.kind === 146 /* MethodDeclaration */ || + node.kind === 148 /* GetAccessor */ || + node.kind === 149 /* 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 @@ -23555,7 +24511,7 @@ var ts; case 8 /* NumericLiteral */: case 9 /* StringLiteral */: return getStringLiteralTypeForText(element.name.text); - case 138 /* ComputedPropertyName */: + case 139 /* ComputedPropertyName */: var nameType = checkComputedPropertyName(element.name); if (isTypeOfKind(nameType, 16777216 /* ESSymbol */)) { return nameType; @@ -23581,21 +24537,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 === 218 /* ClassDeclaration */) { + if (node.kind === 220 /* ClassDeclaration */) { ts.Debug.fail("Class decorators should not have a third synthetic argument."); return unknownType; } - if (node.kind === 140 /* Parameter */) { + if (node.kind === 141 /* Parameter */) { // The `parameterIndex` for a parameter decorator is always a number return numberType; } - if (node.kind === 143 /* PropertyDeclaration */) { + if (node.kind === 144 /* PropertyDeclaration */) { ts.Debug.fail("Property decorators should not have a third synthetic argument."); return unknownType; } - if (node.kind === 145 /* MethodDeclaration */ || - node.kind === 147 /* GetAccessor */ || - node.kind === 148 /* SetAccessor */) { + if (node.kind === 146 /* MethodDeclaration */ || + node.kind === 148 /* GetAccessor */ || + node.kind === 149 /* SetAccessor */) { // The `descriptor` for a method decorator will be a `TypedPropertyDescriptor` // for the type of the member. var propertyType = getTypeOfNode(node); @@ -23627,11 +24583,11 @@ var ts; // 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 === 141 /* Decorator */) { + if (node.kind === 142 /* Decorator */) { return getEffectiveDecoratorArgumentType(node, argIndex); } - else if (argIndex === 0 && node.kind === 174 /* TaggedTemplateExpression */) { - return globalTemplateStringsArrayType; + else if (argIndex === 0 && node.kind === 175 /* TaggedTemplateExpression */) { + return getGlobalTemplateStringsArrayType(); } // This is not a synthetic argument, so we return 'undefined' // to signal that the caller needs to check the argument. @@ -23642,8 +24598,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 === 141 /* Decorator */ || - (argIndex === 0 && node.kind === 174 /* TaggedTemplateExpression */)) { + if (node.kind === 142 /* Decorator */ || + (argIndex === 0 && node.kind === 175 /* TaggedTemplateExpression */)) { return undefined; } return args[argIndex]; @@ -23652,11 +24608,11 @@ var ts; * Gets the error node to use when reporting errors for an effective argument. */ function getEffectiveArgumentErrorNode(node, argIndex, arg) { - if (node.kind === 141 /* Decorator */) { + if (node.kind === 142 /* Decorator */) { // For a decorator, we use the expression of the decorator for error reporting. return node.expression; } - else if (argIndex === 0 && node.kind === 174 /* TaggedTemplateExpression */) { + else if (argIndex === 0 && node.kind === 175 /* TaggedTemplateExpression */) { // For a the first argument of a tagged template expression, we use the template of the tag for error reporting. return node.template; } @@ -23665,8 +24621,8 @@ var ts; } } function resolveCall(node, signatures, candidatesOutArray, headMessage) { - var isTaggedTemplate = node.kind === 174 /* TaggedTemplateExpression */; - var isDecorator = node.kind === 141 /* Decorator */; + var isTaggedTemplate = node.kind === 175 /* TaggedTemplateExpression */; + var isDecorator = node.kind === 142 /* Decorator */; var typeArguments; if (!isTaggedTemplate && !isDecorator) { typeArguments = node.typeArguments; @@ -23892,7 +24848,7 @@ var ts; } return resolveUntypedCall(node); } - var funcType = checkExpression(node.expression); + var funcType = checkNonNullExpression(node.expression); var apparentType = getApparentType(funcType); if (apparentType === unknownType) { // Another error has already been reported @@ -23940,7 +24896,7 @@ var ts; error(node.arguments[spreadIndex], ts.Diagnostics.Spread_operator_in_new_expressions_is_only_available_when_targeting_ECMAScript_5_and_higher); } } - var expressionType = checkExpression(node.expression); + var expressionType = checkNonNullExpression(node.expression); // 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 @@ -23983,13 +24939,16 @@ var ts; // If expressionType's apparent type is an object type with no construct signatures but // one or more call signatures, the expression is processed as a function call. A compile-time // error occurs if the result of the function call is not Void. The type of the result of the - // operation is Any. + // operation is Any. It is an error to have a Void this type. var callSignatures = getSignaturesOfType(expressionType, 0 /* Call */); if (callSignatures.length) { var signature = resolveCall(node, callSignatures, candidatesOutArray); if (getReturnTypeOfSignature(signature) !== voidType) { error(node, ts.Diagnostics.Only_a_void_function_can_be_called_with_the_new_keyword); } + if (signature.thisType === voidType) { + error(node, ts.Diagnostics.A_function_that_is_called_with_the_new_keyword_cannot_have_a_this_type_that_is_void); + } return signature; } error(node, ts.Diagnostics.Cannot_use_new_with_an_expression_whose_type_lacks_a_call_or_construct_signature); @@ -24041,16 +25000,16 @@ var ts; */ function getDiagnosticHeadMessageForDecoratorResolution(node) { switch (node.parent.kind) { - case 218 /* ClassDeclaration */: - case 190 /* ClassExpression */: + case 220 /* ClassDeclaration */: + case 191 /* ClassExpression */: return ts.Diagnostics.Unable_to_resolve_signature_of_class_decorator_when_called_as_an_expression; - case 140 /* Parameter */: + case 141 /* Parameter */: return ts.Diagnostics.Unable_to_resolve_signature_of_parameter_decorator_when_called_as_an_expression; - case 143 /* PropertyDeclaration */: + case 144 /* PropertyDeclaration */: return ts.Diagnostics.Unable_to_resolve_signature_of_property_decorator_when_called_as_an_expression; - case 145 /* MethodDeclaration */: - case 147 /* GetAccessor */: - case 148 /* SetAccessor */: + case 146 /* MethodDeclaration */: + case 148 /* GetAccessor */: + case 149 /* SetAccessor */: return ts.Diagnostics.Unable_to_resolve_signature_of_method_decorator_when_called_as_an_expression; } } @@ -24087,16 +25046,16 @@ var ts; // to correctly fill the candidatesOutArray. if (!links.resolvedSignature || candidatesOutArray) { links.resolvedSignature = anySignature; - if (node.kind === 172 /* CallExpression */) { + if (node.kind === 173 /* CallExpression */) { links.resolvedSignature = resolveCallExpression(node, candidatesOutArray); } - else if (node.kind === 173 /* NewExpression */) { + else if (node.kind === 174 /* NewExpression */) { links.resolvedSignature = resolveNewExpression(node, candidatesOutArray); } - else if (node.kind === 174 /* TaggedTemplateExpression */) { + else if (node.kind === 175 /* TaggedTemplateExpression */) { links.resolvedSignature = resolveTaggedTemplateExpression(node, candidatesOutArray); } - else if (node.kind === 141 /* Decorator */) { + else if (node.kind === 142 /* Decorator */) { links.resolvedSignature = resolveDecorator(node, candidatesOutArray); } else { @@ -24124,12 +25083,12 @@ var ts; if (node.expression.kind === 95 /* SuperKeyword */) { return voidType; } - if (node.kind === 173 /* NewExpression */) { + if (node.kind === 174 /* NewExpression */) { var declaration = signature.declaration; if (declaration && - declaration.kind !== 146 /* Constructor */ && - declaration.kind !== 150 /* ConstructSignature */ && - declaration.kind !== 155 /* ConstructorType */ && + declaration.kind !== 147 /* Constructor */ && + declaration.kind !== 151 /* ConstructSignature */ && + declaration.kind !== 156 /* 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 @@ -24158,19 +25117,29 @@ var ts; var targetType = getTypeFromTypeNode(node.type); if (produceDiagnostics && targetType !== unknownType) { var widenedType = getWidenedType(exprType); - // Permit 'number[] | "foo"' to be asserted to 'string'. - var bothAreStringLike = maybeTypeOfKind(targetType, 258 /* StringLike */) && - maybeTypeOfKind(widenedType, 258 /* StringLike */); - if (!bothAreStringLike && !(isTypeAssignableTo(targetType, widenedType))) { - checkTypeAssignableTo(exprType, targetType, node, ts.Diagnostics.Neither_type_0_nor_type_1_is_assignable_to_the_other); + if (!isTypeComparableTo(targetType, widenedType)) { + checkTypeComparableTo(exprType, targetType, node, ts.Diagnostics.Type_0_cannot_be_converted_to_type_1); } } return targetType; } + function checkNonNullAssertion(node) { + return getNonNullableType(checkExpression(node.expression)); + } + function getTypeOfParameter(symbol) { + var type = getTypeOfSymbol(symbol); + if (strictNullChecks) { + var declaration = symbol.valueDeclaration; + if (declaration && declaration.initializer) { + return addNullableKind(type, 32 /* Undefined */); + } + } + return type; + } function getTypeAtPosition(signature, pos) { return signature.hasRestParameter ? - pos < signature.parameters.length - 1 ? getTypeOfSymbol(signature.parameters[pos]) : getRestTypeOfSignature(signature) : - pos < signature.parameters.length ? getTypeOfSymbol(signature.parameters[pos]) : anyType; + pos < signature.parameters.length - 1 ? getTypeOfParameter(signature.parameters[pos]) : getRestTypeOfSignature(signature) : + pos < signature.parameters.length ? getTypeOfParameter(signature.parameters[pos]) : anyType; } function assignContextualParameterTypes(signature, context, mapper) { var len = signature.parameters.length - (signature.hasRestParameter ? 1 : 0); @@ -24191,7 +25160,7 @@ 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 !== 191 /* OmittedExpression */) { + if (element.kind !== 192 /* OmittedExpression */) { if (element.name.kind === 69 /* Identifier */) { getSymbolLinks(getSymbolOfNode(element)).type = getTypeForBindingElement(element); } @@ -24263,7 +25232,7 @@ var ts; } var isAsync = ts.isAsyncFunctionLike(func); var type; - if (func.body.kind !== 196 /* Block */) { + if (func.body.kind !== 198 /* 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 @@ -24287,7 +25256,8 @@ var ts; } } else { - types = checkAndAggregateReturnExpressionTypes(func.body, contextualMapper, isAsync); + var hasImplicitReturn = !!(func.flags & 32768 /* HasImplicitReturn */); + types = checkAndAggregateReturnExpressionTypes(func.body, contextualMapper, isAsync, hasImplicitReturn); if (types.length === 0) { if (isAsync) { // For an async function, the return type will not be void, but rather a Promise for void. @@ -24357,8 +25327,9 @@ var ts; }); return aggregatedTypes; } - function checkAndAggregateReturnExpressionTypes(body, contextualMapper, isAsync) { + function checkAndAggregateReturnExpressionTypes(body, contextualMapper, isAsync, hasImplicitReturn) { var aggregatedTypes = []; + var hasOmittedExpressions = false; ts.forEachReturnStatement(body, function (returnStatement) { var expr = returnStatement.expression; if (expr) { @@ -24374,7 +25345,15 @@ var ts; aggregatedTypes.push(type); } } + else { + hasOmittedExpressions = true; + } }); + if (strictNullChecks && aggregatedTypes.length && (hasOmittedExpressions || hasImplicitReturn)) { + if (!ts.contains(aggregatedTypes, undefinedType)) { + aggregatedTypes.push(undefinedType); + } + } return aggregatedTypes; } /** @@ -24396,7 +25375,7 @@ 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 !== 196 /* Block */ || !(func.flags & 32768 /* HasImplicitReturn */)) { + if (ts.nodeIsMissing(func.body) || func.body.kind !== 198 /* Block */ || !(func.flags & 32768 /* HasImplicitReturn */)) { return; } var hasExplicitReturn = func.flags & 65536 /* HasExplicitReturn */; @@ -24406,15 +25385,19 @@ var ts; // NOTE: having returnType !== undefined is a precondition for entering this branch so func.type will always be present error(func.type, ts.Diagnostics.A_function_whose_declared_type_is_neither_void_nor_any_must_return_a_value); } + else if (returnType && strictNullChecks && !isTypeAssignableTo(undefinedType, returnType)) { + error(func.type, ts.Diagnostics.Function_lacks_ending_return_statement_and_return_type_does_not_include_undefined); + } else if (compilerOptions.noImplicitReturns) { if (!returnType) { // If return type annotation is omitted check if function has any explicit return statements. // If it does not have any - its inferred return type is void - don't do any checks. // Otherwise get inferred return type from function body and report error only if it is not void / anytype - var inferredReturnType = hasExplicitReturn - ? getReturnTypeOfSignature(getSignatureFromDeclaration(func)) - : voidType; - if (inferredReturnType === voidType || isTypeAny(inferredReturnType)) { + if (!hasExplicitReturn) { + return; + } + var inferredReturnType = getReturnTypeOfSignature(getSignatureFromDeclaration(func)); + if (isUnwrappedReturnTypeVoidOrAny(func, inferredReturnType)) { return; } } @@ -24422,14 +25405,15 @@ var ts; } } function checkFunctionExpressionOrObjectLiteralMethod(node, contextualMapper) { - ts.Debug.assert(node.kind !== 145 /* MethodDeclaration */ || ts.isObjectLiteralMethod(node)); + ts.Debug.assert(node.kind !== 146 /* MethodDeclaration */ || ts.isObjectLiteralMethod(node)); // Grammar checking var hasGrammarError = checkGrammarFunctionLikeDeclaration(node); - if (!hasGrammarError && node.kind === 177 /* FunctionExpression */) { + if (!hasGrammarError && node.kind === 178 /* FunctionExpression */) { checkGrammarForGenerator(node); } // The identityMapper object is used to indicate that function expressions are wildcards if (contextualMapper === identityMapper && isContextSensitive(node)) { + checkNodeDeferred(node); return anyFunctionType; } var links = getNodeLinks(node); @@ -24465,14 +25449,14 @@ var ts; } } } - if (produceDiagnostics && node.kind !== 145 /* MethodDeclaration */ && node.kind !== 144 /* MethodSignature */) { + if (produceDiagnostics && node.kind !== 146 /* MethodDeclaration */ && node.kind !== 145 /* MethodSignature */) { checkCollisionWithCapturedSuperVariable(node, node.name); checkCollisionWithCapturedThisVariable(node, node.name); } return type; } function checkFunctionExpressionOrObjectLiteralMethodDeferred(node) { - ts.Debug.assert(node.kind !== 145 /* MethodDeclaration */ || ts.isObjectLiteralMethod(node)); + ts.Debug.assert(node.kind !== 146 /* MethodDeclaration */ || ts.isObjectLiteralMethod(node)); var isAsync = ts.isAsyncFunctionLike(node); var returnOrPromisedType = node.type && (isAsync ? checkAsyncFunctionReturnType(node) : getTypeFromTypeNode(node.type)); if (!node.asteriskToken) { @@ -24488,7 +25472,7 @@ var ts; // checkFunctionExpressionBodies). So it must be done now. getReturnTypeOfSignature(getSignatureFromDeclaration(node)); } - if (node.body.kind === 196 /* Block */) { + if (node.body.kind === 198 /* Block */) { checkSourceElement(node.body); } else { @@ -24532,23 +25516,23 @@ var ts; if (isReadonlySymbol(symbol)) { // Allow assignments to readonly properties within constructors of the same class declaration. if (symbol.flags & 4 /* Property */ && - (expr.kind === 170 /* PropertyAccessExpression */ || expr.kind === 171 /* ElementAccessExpression */) && + (expr.kind === 171 /* PropertyAccessExpression */ || expr.kind === 172 /* ElementAccessExpression */) && expr.expression.kind === 97 /* ThisKeyword */) { var func = ts.getContainingFunction(expr); - return !(func && func.kind === 146 /* Constructor */ && func.parent === symbol.valueDeclaration.parent); + return !(func && func.kind === 147 /* Constructor */ && func.parent === symbol.valueDeclaration.parent); } return true; } return false; } function isReferenceThroughNamespaceImport(expr) { - if (expr.kind === 170 /* PropertyAccessExpression */ || expr.kind === 171 /* ElementAccessExpression */) { + if (expr.kind === 171 /* PropertyAccessExpression */ || expr.kind === 172 /* ElementAccessExpression */) { var node = skipParenthesizedNodes(expr.expression); if (node.kind === 69 /* Identifier */) { var symbol = getNodeLinks(node).resolvedSymbol; if (symbol.flags & 8388608 /* Alias */) { var declaration = getDeclarationOfAliasSymbol(symbol); - return declaration && declaration.kind === 228 /* NamespaceImport */; + return declaration && declaration.kind === 231 /* NamespaceImport */; } } } @@ -24557,7 +25541,7 @@ var ts; function checkReferenceExpression(expr, invalidReferenceMessage, constantVariableMessage) { // References are combinations of identifiers, parentheses, and property accesses. var node = skipParenthesizedNodes(expr); - if (node.kind !== 69 /* Identifier */ && node.kind !== 170 /* PropertyAccessExpression */ && node.kind !== 171 /* ElementAccessExpression */) { + if (node.kind !== 69 /* Identifier */ && node.kind !== 171 /* PropertyAccessExpression */ && node.kind !== 172 /* ElementAccessExpression */) { error(expr, invalidReferenceMessage); return false; } @@ -24580,7 +25564,7 @@ var ts; } } } - else if (node.kind === 171 /* ElementAccessExpression */) { + else if (node.kind === 172 /* ElementAccessExpression */) { if (links.resolvedIndexInfo && links.resolvedIndexInfo.isReadonly) { error(expr, constantVariableMessage); return false; @@ -24627,7 +25611,7 @@ var ts; return booleanType; case 41 /* PlusPlusToken */: case 42 /* MinusMinusToken */: - var ok = checkArithmeticOperandType(node.operand, operandType, ts.Diagnostics.An_arithmetic_operand_must_be_of_type_any_number_or_an_enum_type); + 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); @@ -24638,7 +25622,7 @@ var ts; } function checkPostfixUnaryExpression(node) { var operandType = checkExpression(node.operand); - var ok = checkArithmeticOperandType(node.operand, operandType, ts.Diagnostics.An_arithmetic_operand_must_be_of_type_any_number_or_an_enum_type); + 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); @@ -24728,22 +25712,22 @@ var ts; var properties = node.properties; for (var _i = 0, properties_3 = properties; _i < properties_3.length; _i++) { var p = properties_3[_i]; - if (p.kind === 249 /* PropertyAssignment */ || p.kind === 250 /* ShorthandPropertyAssignment */) { - var name_12 = p.name; - if (name_12.kind === 138 /* ComputedPropertyName */) { - checkComputedPropertyName(name_12); + if (p.kind === 252 /* PropertyAssignment */ || p.kind === 253 /* ShorthandPropertyAssignment */) { + var name_13 = p.name; + if (name_13.kind === 139 /* ComputedPropertyName */) { + checkComputedPropertyName(name_13); } - if (isComputedNonLiteralName(name_12)) { + if (isComputedNonLiteralName(name_13)) { continue; } - var text = getTextOfPropertyName(name_12); + var text = getTextOfPropertyName(name_13); var type = isTypeAny(sourceType) ? sourceType : getTypeOfPropertyOfType(sourceType, text) || isNumericLiteralName(text) && getIndexTypeOfType(sourceType, 1 /* Number */) || getIndexTypeOfType(sourceType, 0 /* String */); if (type) { - if (p.kind === 250 /* ShorthandPropertyAssignment */) { + if (p.kind === 253 /* ShorthandPropertyAssignment */) { checkDestructuringAssignment(p, type); } else { @@ -24752,7 +25736,7 @@ var ts; } } else { - error(name_12, ts.Diagnostics.Type_0_has_no_property_1_and_no_string_index_signature, typeToString(sourceType), ts.declarationNameToString(name_12)); + error(name_13, ts.Diagnostics.Type_0_has_no_property_1_and_no_string_index_signature, typeToString(sourceType), ts.declarationNameToString(name_13)); } } else { @@ -24769,8 +25753,8 @@ var ts; var elements = node.elements; for (var i = 0; i < elements.length; i++) { var e = elements[i]; - if (e.kind !== 191 /* OmittedExpression */) { - if (e.kind !== 189 /* SpreadElementExpression */) { + if (e.kind !== 192 /* OmittedExpression */) { + if (e.kind !== 190 /* SpreadElementExpression */) { var propName = "" + i; var type = isTypeAny(sourceType) ? sourceType @@ -24795,7 +25779,7 @@ var ts; } else { var restExpression = e.expression; - if (restExpression.kind === 185 /* BinaryExpression */ && restExpression.operatorToken.kind === 56 /* EqualsToken */) { + if (restExpression.kind === 186 /* BinaryExpression */ && restExpression.operatorToken.kind === 56 /* EqualsToken */) { error(restExpression.operatorToken, ts.Diagnostics.A_rest_element_cannot_have_an_initializer); } else { @@ -24809,7 +25793,7 @@ var ts; } function checkDestructuringAssignment(exprOrAssignment, sourceType, contextualMapper) { var target; - if (exprOrAssignment.kind === 250 /* ShorthandPropertyAssignment */) { + if (exprOrAssignment.kind === 253 /* ShorthandPropertyAssignment */) { var prop = exprOrAssignment; if (prop.objectAssignmentInitializer) { checkBinaryLikeExpression(prop.name, prop.equalsToken, prop.objectAssignmentInitializer, contextualMapper); @@ -24819,14 +25803,14 @@ var ts; else { target = exprOrAssignment; } - if (target.kind === 185 /* BinaryExpression */ && target.operatorToken.kind === 56 /* EqualsToken */) { + if (target.kind === 186 /* BinaryExpression */ && target.operatorToken.kind === 56 /* EqualsToken */) { checkBinaryExpression(target, contextualMapper); target = target.left; } - if (target.kind === 169 /* ObjectLiteralExpression */) { + if (target.kind === 170 /* ObjectLiteralExpression */) { return checkObjectLiteralAssignment(target, sourceType, contextualMapper); } - if (target.kind === 168 /* ArrayLiteralExpression */) { + if (target.kind === 169 /* ArrayLiteralExpression */) { return checkArrayLiteralAssignment(target, sourceType, contextualMapper); } return checkReferenceAssignment(target, sourceType, contextualMapper); @@ -24843,7 +25827,7 @@ var ts; } function checkBinaryLikeExpression(left, operatorToken, right, contextualMapper, errorNode) { var operator = operatorToken.kind; - if (operator === 56 /* EqualsToken */ && (left.kind === 169 /* ObjectLiteralExpression */ || left.kind === 168 /* ArrayLiteralExpression */)) { + if (operator === 56 /* EqualsToken */ && (left.kind === 170 /* ObjectLiteralExpression */ || left.kind === 169 /* ArrayLiteralExpression */)) { return checkDestructuringAssignment(left, checkExpression(right, contextualMapper), contextualMapper); } var leftType = checkExpression(left, contextualMapper); @@ -24877,10 +25861,12 @@ var ts; // as having the primitive type Number. If one operand is the null or undefined value, // it is treated as having the type of the other operand. // The result is always of the Number primitive type. - if (leftType.flags & (32 /* Undefined */ | 64 /* Null */)) + if (leftType.flags & 96 /* Nullable */) leftType = rightType; - if (rightType.flags & (32 /* Undefined */ | 64 /* Null */)) + if (rightType.flags & 96 /* Nullable */) rightType = leftType; + leftType = getNonNullableType(leftType); + rightType = getNonNullableType(rightType); var suggestedOperator = void 0; // if a user tries to apply a bitwise operator to 2 boolean operands // try and return them a helpful suggestion @@ -24904,10 +25890,12 @@ var ts; // 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. // If one operand is the null or undefined value, it is treated as having the type of the other operand. - if (leftType.flags & (32 /* Undefined */ | 64 /* Null */)) + if (leftType.flags & 96 /* Nullable */) leftType = rightType; - if (rightType.flags & (32 /* Undefined */ | 64 /* Null */)) + if (rightType.flags & 96 /* Nullable */) rightType = leftType; + leftType = getNonNullableType(leftType); + rightType = getNonNullableType(rightType); var resultType = void 0; if (isTypeOfKind(leftType, 132 /* NumberLike */) && isTypeOfKind(rightType, 132 /* NumberLike */)) { // Operands of an enum type are treated as having the primitive type Number. @@ -24949,11 +25937,7 @@ var ts; case 31 /* ExclamationEqualsToken */: case 32 /* EqualsEqualsEqualsToken */: case 33 /* ExclamationEqualsEqualsToken */: - // Permit 'number[] | "foo"' to be asserted to 'string'. - if (maybeTypeOfKind(leftType, 258 /* StringLike */) && maybeTypeOfKind(rightType, 258 /* StringLike */)) { - return booleanType; - } - if (!isTypeAssignableTo(leftType, rightType) && !isTypeAssignableTo(rightType, leftType)) { + if (!isTypeComparableTo(leftType, rightType) && !isTypeComparableTo(rightType, leftType)) { reportOperatorError(); } return booleanType; @@ -24962,9 +25946,9 @@ var ts; case 90 /* InKeyword */: return checkInExpression(left, right, leftType, rightType); case 51 /* AmpersandAmpersandToken */: - return rightType; + return addNullableKind(rightType, getNullableKind(leftType)); case 52 /* BarBarToken */: - return getUnionType([leftType, rightType]); + return getUnionType([getNonNullableType(leftType), rightType]); case 56 /* EqualsToken */: checkAssignmentOperator(rightType); return getRegularTypeOfObjectLiteral(rightType); @@ -25112,7 +26096,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 === 138 /* ComputedPropertyName */) { + if (node.name.kind === 139 /* ComputedPropertyName */) { checkComputedPropertyName(node.name); } return checkExpression(node.initializer, contextualMapper); @@ -25123,7 +26107,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 === 138 /* ComputedPropertyName */) { + if (node.name.kind === 139 /* ComputedPropertyName */) { checkComputedPropertyName(node.name); } var uninstantiatedType = checkFunctionExpressionOrObjectLiteralMethod(node, contextualMapper); @@ -25153,7 +26137,7 @@ var ts; // contextually typed function and arrow expressions in the initial phase. function checkExpression(node, contextualMapper) { var type; - if (node.kind === 137 /* QualifiedName */) { + if (node.kind === 138 /* QualifiedName */) { type = checkQualifiedName(node); } else { @@ -25165,9 +26149,9 @@ var ts; // - 'left' in property access // - 'object' in indexed access // - target in rhs of import statement - var ok = (node.parent.kind === 170 /* PropertyAccessExpression */ && node.parent.expression === node) || - (node.parent.kind === 171 /* ElementAccessExpression */ && node.parent.expression === node) || - ((node.kind === 69 /* Identifier */ || node.kind === 137 /* QualifiedName */) && isInRightSideOfImportOrExportAssignment(node)); + var ok = (node.parent.kind === 171 /* PropertyAccessExpression */ && node.parent.expression === node) || + (node.parent.kind === 172 /* ElementAccessExpression */ && node.parent.expression === node) || + ((node.kind === 69 /* Identifier */ || node.kind === 138 /* 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); } @@ -25194,7 +26178,7 @@ var ts; return booleanType; case 8 /* NumericLiteral */: return checkNumericLiteral(node); - case 187 /* TemplateExpression */: + case 188 /* TemplateExpression */: return checkTemplateExpression(node); case 9 /* StringLiteral */: return checkStringLiteralExpression(node); @@ -25202,58 +26186,60 @@ var ts; return stringType; case 10 /* RegularExpressionLiteral */: return globalRegExpType; - case 168 /* ArrayLiteralExpression */: + case 169 /* ArrayLiteralExpression */: return checkArrayLiteral(node, contextualMapper); - case 169 /* ObjectLiteralExpression */: + case 170 /* ObjectLiteralExpression */: return checkObjectLiteral(node, contextualMapper); - case 170 /* PropertyAccessExpression */: + case 171 /* PropertyAccessExpression */: return checkPropertyAccessExpression(node); - case 171 /* ElementAccessExpression */: + case 172 /* ElementAccessExpression */: return checkIndexedAccess(node); - case 172 /* CallExpression */: - case 173 /* NewExpression */: + case 173 /* CallExpression */: + case 174 /* NewExpression */: return checkCallExpression(node); - case 174 /* TaggedTemplateExpression */: + case 175 /* TaggedTemplateExpression */: return checkTaggedTemplateExpression(node); - case 176 /* ParenthesizedExpression */: + case 177 /* ParenthesizedExpression */: return checkExpression(node.expression, contextualMapper); - case 190 /* ClassExpression */: + case 191 /* ClassExpression */: return checkClassExpression(node); - case 177 /* FunctionExpression */: - case 178 /* ArrowFunction */: + case 178 /* FunctionExpression */: + case 179 /* ArrowFunction */: return checkFunctionExpressionOrObjectLiteralMethod(node, contextualMapper); - case 180 /* TypeOfExpression */: + case 181 /* TypeOfExpression */: return checkTypeOfExpression(node); - case 175 /* TypeAssertionExpression */: - case 193 /* AsExpression */: + case 176 /* TypeAssertionExpression */: + case 194 /* AsExpression */: return checkAssertion(node); - case 179 /* DeleteExpression */: + case 195 /* NonNullExpression */: + return checkNonNullAssertion(node); + case 180 /* DeleteExpression */: return checkDeleteExpression(node); - case 181 /* VoidExpression */: + case 182 /* VoidExpression */: return checkVoidExpression(node); - case 182 /* AwaitExpression */: + case 183 /* AwaitExpression */: return checkAwaitExpression(node); - case 183 /* PrefixUnaryExpression */: + case 184 /* PrefixUnaryExpression */: return checkPrefixUnaryExpression(node); - case 184 /* PostfixUnaryExpression */: + case 185 /* PostfixUnaryExpression */: return checkPostfixUnaryExpression(node); - case 185 /* BinaryExpression */: + case 186 /* BinaryExpression */: return checkBinaryExpression(node, contextualMapper); - case 186 /* ConditionalExpression */: + case 187 /* ConditionalExpression */: return checkConditionalExpression(node, contextualMapper); - case 189 /* SpreadElementExpression */: + case 190 /* SpreadElementExpression */: return checkSpreadElementExpression(node, contextualMapper); - case 191 /* OmittedExpression */: + case 192 /* OmittedExpression */: return undefinedType; - case 188 /* YieldExpression */: + case 189 /* YieldExpression */: return checkYieldExpression(node); - case 244 /* JsxExpression */: + case 247 /* JsxExpression */: return checkJsxExpression(node); - case 237 /* JsxElement */: + case 240 /* JsxElement */: return checkJsxElement(node); - case 238 /* JsxSelfClosingElement */: + case 241 /* JsxSelfClosingElement */: return checkJsxSelfClosingElement(node); - case 239 /* JsxOpeningElement */: + case 242 /* JsxOpeningElement */: ts.Debug.fail("Shouldn't ever directly check a JsxOpeningElement"); } return unknownType; @@ -25281,13 +26267,24 @@ var ts; var func = ts.getContainingFunction(node); if (node.flags & 28 /* AccessibilityModifier */) { func = ts.getContainingFunction(node); - if (!(func.kind === 146 /* Constructor */ && ts.nodeIsPresent(func.body))) { + if (!(func.kind === 147 /* Constructor */ && ts.nodeIsPresent(func.body))) { error(node, ts.Diagnostics.A_parameter_property_is_only_allowed_in_a_constructor_implementation); } } if (node.questionToken && ts.isBindingPattern(node.name) && func.body) { error(node, ts.Diagnostics.A_binding_pattern_parameter_cannot_be_optional_in_an_implementation_signature); } + if (node.name.text === "this") { + if (ts.indexOf(func.parameters, node) !== 0) { + error(node, ts.Diagnostics.A_this_parameter_must_be_the_first_parameter); + } + if (func.kind === 147 /* Constructor */ || func.kind === 151 /* ConstructSignature */ || func.kind === 156 /* ConstructorType */) { + error(node, ts.Diagnostics.A_constructor_cannot_have_a_this_parameter); + } + if (func.kind === 149 /* SetAccessor */) { + error(node, ts.Diagnostics.A_setter_cannot_have_a_this_parameter); + } + } // Only check rest parameter type if it's not a binding pattern. Since binding patterns are // not allowed in a rest parameter, we already have an error from checkGrammarParameterList. if (node.dotDotDotToken && !ts.isBindingPattern(node.name) && !isArrayType(getTypeOfSymbol(node.symbol))) { @@ -25298,9 +26295,9 @@ var ts; if (!node.asteriskToken || !node.body) { return false; } - return node.kind === 145 /* MethodDeclaration */ || - node.kind === 217 /* FunctionDeclaration */ || - node.kind === 177 /* FunctionExpression */; + return node.kind === 146 /* MethodDeclaration */ || + node.kind === 219 /* FunctionDeclaration */ || + node.kind === 178 /* FunctionExpression */; } function getTypePredicateParameterIndex(parameterList, parameter) { if (parameterList) { @@ -25335,15 +26332,17 @@ var ts; error(parameterName, ts.Diagnostics.A_type_predicate_cannot_reference_a_rest_parameter); } else { - checkTypeAssignableTo(typePredicate.type, getTypeOfNode(parent.parameters[typePredicate.parameterIndex]), node.type); + 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, + /*headMessage*/ undefined, leadingError); } } else if (parameterName) { var hasReportedError = false; for (var _i = 0, _a = parent.parameters; _i < _a.length; _i++) { - var name_13 = _a[_i].name; - if (ts.isBindingPattern(name_13) && - checkIfTypePredicateVariableIsDeclaredInBindingPattern(name_13, parameterName, typePredicate.parameterName)) { + var name_14 = _a[_i].name; + if (ts.isBindingPattern(name_14) && + checkIfTypePredicateVariableIsDeclaredInBindingPattern(name_14, parameterName, typePredicate.parameterName)) { hasReportedError = true; break; } @@ -25356,30 +26355,30 @@ var ts; } function getTypePredicateParent(node) { switch (node.parent.kind) { - case 178 /* ArrowFunction */: - case 149 /* CallSignature */: - case 217 /* FunctionDeclaration */: - case 177 /* FunctionExpression */: - case 154 /* FunctionType */: - case 145 /* MethodDeclaration */: - case 144 /* MethodSignature */: - var parent_7 = node.parent; - if (node === parent_7.type) { - return parent_7; + case 179 /* ArrowFunction */: + case 150 /* CallSignature */: + case 219 /* FunctionDeclaration */: + case 178 /* FunctionExpression */: + case 155 /* FunctionType */: + case 146 /* MethodDeclaration */: + case 145 /* MethodSignature */: + var parent_8 = node.parent; + if (node === parent_8.type) { + return parent_8; } } } function checkIfTypePredicateVariableIsDeclaredInBindingPattern(pattern, predicateVariableNode, predicateVariableName) { for (var _i = 0, _a = pattern.elements; _i < _a.length; _i++) { - var name_14 = _a[_i].name; - if (name_14.kind === 69 /* Identifier */ && - name_14.text === predicateVariableName) { + var name_15 = _a[_i].name; + if (name_15.kind === 69 /* Identifier */ && + name_15.text === predicateVariableName) { error(predicateVariableNode, ts.Diagnostics.A_type_predicate_cannot_reference_element_0_in_a_binding_pattern, predicateVariableName); return true; } - else if (name_14.kind === 166 /* ArrayBindingPattern */ || - name_14.kind === 165 /* ObjectBindingPattern */) { - if (checkIfTypePredicateVariableIsDeclaredInBindingPattern(name_14, predicateVariableNode, predicateVariableName)) { + else if (name_15.kind === 167 /* ArrayBindingPattern */ || + name_15.kind === 166 /* ObjectBindingPattern */) { + if (checkIfTypePredicateVariableIsDeclaredInBindingPattern(name_15, predicateVariableNode, predicateVariableName)) { return true; } } @@ -25387,12 +26386,12 @@ var ts; } function checkSignatureDeclaration(node) { // Grammar checking - if (node.kind === 151 /* IndexSignature */) { + if (node.kind === 152 /* IndexSignature */) { checkGrammarIndexSignature(node); } - else if (node.kind === 154 /* FunctionType */ || node.kind === 217 /* FunctionDeclaration */ || node.kind === 155 /* ConstructorType */ || - node.kind === 149 /* CallSignature */ || node.kind === 146 /* Constructor */ || - node.kind === 150 /* ConstructSignature */) { + else if (node.kind === 155 /* FunctionType */ || node.kind === 219 /* FunctionDeclaration */ || node.kind === 156 /* ConstructorType */ || + node.kind === 150 /* CallSignature */ || node.kind === 147 /* Constructor */ || + node.kind === 151 /* ConstructSignature */) { checkGrammarFunctionLikeDeclaration(node); } checkTypeParameters(node.typeParameters); @@ -25404,10 +26403,10 @@ var ts; checkCollisionWithArgumentsInGeneratedCode(node); if (compilerOptions.noImplicitAny && !node.type) { switch (node.kind) { - case 150 /* ConstructSignature */: + case 151 /* ConstructSignature */: error(node, ts.Diagnostics.Construct_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type); break; - case 149 /* CallSignature */: + case 150 /* CallSignature */: error(node, ts.Diagnostics.Call_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type); break; } @@ -25437,7 +26436,7 @@ var ts; } } function checkTypeForDuplicateIndexSignatures(node) { - if (node.kind === 219 /* InterfaceDeclaration */) { + if (node.kind === 221 /* 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 @@ -25532,12 +26531,12 @@ var ts; if (n.kind === 97 /* ThisKeyword */) { error(n, ts.Diagnostics.this_cannot_be_referenced_in_current_location); } - else if (n.kind !== 177 /* FunctionExpression */ && n.kind !== 217 /* FunctionDeclaration */) { + else if (n.kind !== 178 /* FunctionExpression */ && n.kind !== 219 /* FunctionDeclaration */) { ts.forEachChild(n, markThisReferencesAsErrors); } } function isInstancePropertyWithInitializer(n) { - return n.kind === 143 /* PropertyDeclaration */ && + return n.kind === 144 /* PropertyDeclaration */ && !(n.flags & 32 /* Static */) && !!n.initializer; } @@ -25566,7 +26565,7 @@ var ts; var superCallStatement = void 0; for (var _i = 0, statements_2 = statements; _i < statements_2.length; _i++) { var statement = statements_2[_i]; - if (statement.kind === 199 /* ExpressionStatement */ && ts.isSuperCallExpression(statement.expression)) { + if (statement.kind === 201 /* ExpressionStatement */ && ts.isSuperCallExpression(statement.expression)) { superCallStatement = statement; break; } @@ -25590,7 +26589,7 @@ var ts; checkGrammarFunctionLikeDeclaration(node) || checkGrammarAccessor(node) || checkGrammarComputedPropertyName(node.name); checkDecorators(node); checkSignatureDeclaration(node); - if (node.kind === 147 /* GetAccessor */) { + if (node.kind === 148 /* GetAccessor */) { if (!ts.isInAmbientContext(node) && ts.nodeIsPresent(node.body) && (node.flags & 32768 /* HasImplicitReturn */)) { if (node.flags & 65536 /* HasExplicitReturn */) { if (compilerOptions.noImplicitReturns) { @@ -25605,13 +26604,13 @@ 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 === 138 /* ComputedPropertyName */) { + if (node.name.kind === 139 /* 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 === 147 /* GetAccessor */ ? 148 /* SetAccessor */ : 147 /* GetAccessor */; + var otherKind = node.kind === 148 /* GetAccessor */ ? 149 /* SetAccessor */ : 148 /* GetAccessor */; var otherAccessor = ts.getDeclarationOfKind(node.symbol, otherKind); if (otherAccessor) { if (((node.flags & 28 /* AccessibilityModifier */) !== (otherAccessor.flags & 28 /* AccessibilityModifier */))) { @@ -25633,7 +26632,7 @@ var ts; } getTypeOfAccessors(getSymbolOfNode(node)); } - if (node.parent.kind !== 169 /* ObjectLiteralExpression */) { + if (node.parent.kind !== 170 /* ObjectLiteralExpression */) { checkSourceElement(node.body); } else { @@ -25708,9 +26707,9 @@ var ts; var flags = ts.getCombinedNodeFlags(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 !== 219 /* InterfaceDeclaration */ && - n.parent.kind !== 218 /* ClassDeclaration */ && - n.parent.kind !== 190 /* ClassExpression */ && + if (n.parent.kind !== 221 /* InterfaceDeclaration */ && + n.parent.kind !== 220 /* ClassDeclaration */ && + n.parent.kind !== 191 /* ClassExpression */ && ts.isInAmbientContext(n)) { if (!(flags & 2 /* Ambient */)) { // It is nested in an ambient context, which means it is automatically exported @@ -25798,7 +26797,7 @@ 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 === 145 /* MethodDeclaration */ || node.kind === 144 /* MethodSignature */) && + var reportError = (node.kind === 146 /* MethodDeclaration */ || node.kind === 145 /* MethodSignature */) && (node.flags & 32 /* Static */) !== (subsequentNode.flags & 32 /* Static */); // we can get here in two cases // 1. mixed static and instance class members @@ -25840,7 +26839,7 @@ var ts; var current = declarations_4[_i]; var node = current; var inAmbientContext = ts.isInAmbientContext(node); - var inAmbientContextOrInterface = node.parent.kind === 219 /* InterfaceDeclaration */ || node.parent.kind === 157 /* TypeLiteral */ || inAmbientContext; + var inAmbientContextOrInterface = node.parent.kind === 221 /* InterfaceDeclaration */ || node.parent.kind === 158 /* TypeLiteral */ || inAmbientContext; if (inAmbientContextOrInterface) { // check if declarations are consecutive only if they are non-ambient // 1. ambient declarations can be interleaved @@ -25851,7 +26850,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 === 217 /* FunctionDeclaration */ || node.kind === 145 /* MethodDeclaration */ || node.kind === 144 /* MethodSignature */ || node.kind === 146 /* Constructor */) { + if (node.kind === 219 /* FunctionDeclaration */ || node.kind === 146 /* MethodDeclaration */ || node.kind === 145 /* MethodSignature */ || node.kind === 147 /* Constructor */) { var currentNodeFlags = getEffectiveDeclarationFlags(node, flagsToCheck); someNodeFlags |= currentNodeFlags; allNodeFlags &= currentNodeFlags; @@ -25973,16 +26972,16 @@ var ts; } function getDeclarationSpaces(d) { switch (d.kind) { - case 219 /* InterfaceDeclaration */: + case 221 /* InterfaceDeclaration */: return 2097152 /* ExportType */; - case 222 /* ModuleDeclaration */: + case 224 /* ModuleDeclaration */: return ts.isAmbientModule(d) || ts.getModuleInstanceState(d) !== 0 /* NonInstantiated */ ? 4194304 /* ExportNamespace */ | 1048576 /* ExportValue */ : 4194304 /* ExportNamespace */; - case 218 /* ClassDeclaration */: - case 221 /* EnumDeclaration */: + case 220 /* ClassDeclaration */: + case 223 /* EnumDeclaration */: return 2097152 /* ExportType */ | 1048576 /* ExportValue */; - case 225 /* ImportEqualsDeclaration */: + case 228 /* ImportEqualsDeclaration */: var result_1 = 0; var target = resolveAlias(getSymbolOfNode(d)); ts.forEach(target.declarations, function (d) { result_1 |= getDeclarationSpaces(d); }); @@ -26094,7 +27093,7 @@ var ts; return checkNonThenableType(type, location, message); } else { - if (type.id === promisedType.id || awaitedTypeStack.indexOf(promisedType.id) >= 0) { + if (type.id === promisedType.id || ts.indexOf(awaitedTypeStack, promisedType.id) >= 0) { // We have a bad actor in the form of a promise whose promised type is // the same promise type, or a mutually recursive promise. Return the // unknown type as we cannot guess the shape. If this were the actual @@ -26263,22 +27262,22 @@ var ts; var headMessage = getDiagnosticHeadMessageForDecoratorResolution(node); var errorInfo; switch (node.parent.kind) { - case 218 /* ClassDeclaration */: + case 220 /* ClassDeclaration */: var classSymbol = getSymbolOfNode(node.parent); var classConstructorType = getTypeOfSymbol(classSymbol); expectedReturnType = getUnionType([classConstructorType, voidType]); break; - case 140 /* Parameter */: + case 141 /* 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 143 /* PropertyDeclaration */: + case 144 /* 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 145 /* MethodDeclaration */: - case 147 /* GetAccessor */: - case 148 /* SetAccessor */: + case 146 /* MethodDeclaration */: + case 148 /* GetAccessor */: + case 149 /* SetAccessor */: var methodType = getTypeOfNode(node.parent); var descriptorType = createTypedPropertyDescriptorType(methodType); expectedReturnType = getUnionType([descriptorType, voidType]); @@ -26291,9 +27290,9 @@ var ts; // 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 === 153 /* TypeReference */) { + if (node && node.kind === 154 /* TypeReference */) { var root = getFirstIdentifier(node.typeName); - var meaning = root.parent.kind === 153 /* TypeReference */ ? 793056 /* Type */ : 1536 /* Namespace */; + var meaning = root.parent.kind === 154 /* TypeReference */ ? 793056 /* Type */ : 1536 /* 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 @@ -26340,20 +27339,20 @@ var ts; if (compilerOptions.emitDecoratorMetadata) { // we only need to perform these checks if we are emitting serialized type metadata for the target of a decorator. switch (node.kind) { - case 218 /* ClassDeclaration */: + case 220 /* ClassDeclaration */: var constructor = ts.getFirstConstructorWithBody(node); if (constructor) { checkParameterTypeAnnotationsAsExpressions(constructor); } break; - case 145 /* MethodDeclaration */: - case 147 /* GetAccessor */: - case 148 /* SetAccessor */: + case 146 /* MethodDeclaration */: + case 148 /* GetAccessor */: + case 149 /* SetAccessor */: checkParameterTypeAnnotationsAsExpressions(node); checkReturnTypeAnnotationAsExpression(node); break; - case 143 /* PropertyDeclaration */: - case 140 /* Parameter */: + case 144 /* PropertyDeclaration */: + case 141 /* Parameter */: checkTypeAnnotationAsExpression(node); break; } @@ -26376,7 +27375,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 === 138 /* ComputedPropertyName */) { + if (node.name && node.name.kind === 139 /* ComputedPropertyName */) { // This check will account for methods in class/interface declarations, // as well as accessors in classes/object literals checkComputedPropertyName(node.name); @@ -26427,7 +27426,7 @@ var ts; } function checkBlock(node) { // Grammar checking for SyntaxKind.Block - if (node.kind === 196 /* Block */) { + if (node.kind === 198 /* Block */) { checkGrammarStatementInAmbientContext(node); } ts.forEach(node.statements, checkSourceElement); @@ -26447,12 +27446,12 @@ var ts; if (!(identifier && identifier.text === name)) { return false; } - if (node.kind === 143 /* PropertyDeclaration */ || - node.kind === 142 /* PropertySignature */ || - node.kind === 145 /* MethodDeclaration */ || - node.kind === 144 /* MethodSignature */ || - node.kind === 147 /* GetAccessor */ || - node.kind === 148 /* SetAccessor */) { + if (node.kind === 144 /* PropertyDeclaration */ || + node.kind === 143 /* PropertySignature */ || + node.kind === 146 /* MethodDeclaration */ || + node.kind === 145 /* MethodSignature */ || + node.kind === 148 /* GetAccessor */ || + node.kind === 149 /* SetAccessor */) { // it is ok to have member named '_super' or '_this' - member access is always qualified return false; } @@ -26461,7 +27460,7 @@ var ts; return false; } var root = ts.getRootDeclaration(node); - if (root.kind === 140 /* Parameter */ && ts.nodeIsMissing(root.parent.body)) { + if (root.kind === 141 /* Parameter */ && ts.nodeIsMissing(root.parent.body)) { // just an overload - no codegen impact return false; } @@ -26514,12 +27513,12 @@ var ts; return; } // Uninstantiated modules shouldnt do this check - if (node.kind === 222 /* ModuleDeclaration */ && ts.getModuleInstanceState(node) !== 1 /* Instantiated */) { + if (node.kind === 224 /* 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 === 252 /* SourceFile */ && ts.isExternalOrCommonJsModule(parent)) { + if (parent.kind === 255 /* 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)); } @@ -26529,12 +27528,12 @@ var ts; return; } // Uninstantiated modules shouldnt do this check - if (node.kind === 222 /* ModuleDeclaration */ && ts.getModuleInstanceState(node) !== 1 /* Instantiated */) { + if (node.kind === 224 /* 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 === 252 /* SourceFile */ && ts.isExternalOrCommonJsModule(parent) && parent.flags & 2097152 /* HasAsyncFunctions */) { + if (parent.kind === 255 /* SourceFile */ && ts.isExternalOrCommonJsModule(parent) && parent.flags & 2097152 /* 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)); } @@ -26569,7 +27568,7 @@ var ts; // 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 === 215 /* VariableDeclaration */ && !node.initializer) { + if (node.kind === 217 /* VariableDeclaration */ && !node.initializer) { return; } var symbol = getSymbolOfNode(node); @@ -26579,24 +27578,24 @@ var ts; localDeclarationSymbol !== symbol && localDeclarationSymbol.flags & 2 /* BlockScopedVariable */) { if (getDeclarationFlagsFromSymbol(localDeclarationSymbol) & 3072 /* BlockScoped */) { - var varDeclList = ts.getAncestor(localDeclarationSymbol.valueDeclaration, 216 /* VariableDeclarationList */); - var container = varDeclList.parent.kind === 197 /* VariableStatement */ && varDeclList.parent.parent + var varDeclList = ts.getAncestor(localDeclarationSymbol.valueDeclaration, 218 /* VariableDeclarationList */); + var container = varDeclList.parent.kind === 199 /* 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 === 196 /* Block */ && ts.isFunctionLike(container.parent) || - container.kind === 223 /* ModuleBlock */ || - container.kind === 222 /* ModuleDeclaration */ || - container.kind === 252 /* SourceFile */); + (container.kind === 198 /* Block */ && ts.isFunctionLike(container.parent) || + container.kind === 225 /* ModuleBlock */ || + container.kind === 224 /* ModuleDeclaration */ || + container.kind === 255 /* 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_15 = symbolToString(localDeclarationSymbol); - error(node, ts.Diagnostics.Cannot_initialize_outer_scoped_variable_0_in_the_same_scope_as_block_scoped_declaration_1, name_15, name_15); + var name_16 = symbolToString(localDeclarationSymbol); + error(node, ts.Diagnostics.Cannot_initialize_outer_scoped_variable_0_in_the_same_scope_as_block_scoped_declaration_1, name_16, name_16); } } } @@ -26604,7 +27603,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 !== 140 /* Parameter */) { + if (ts.getRootDeclaration(node).kind !== 141 /* Parameter */) { return; } var func = ts.getContainingFunction(node); @@ -26615,7 +27614,7 @@ var ts; // check FunctionLikeDeclaration.locals (stores parameters\function local variable) // if it contains entry with a specified name and if this entry matches the resolved symbol if (referencedSymbol && referencedSymbol !== unknownSymbol && getSymbol(func.locals, referencedSymbol.name, 107455 /* Value */) === referencedSymbol) { - if (referencedSymbol.valueDeclaration.kind === 140 /* Parameter */) { + if (referencedSymbol.valueDeclaration.kind === 141 /* Parameter */) { if (referencedSymbol.valueDeclaration === node) { error(n, ts.Diagnostics.Parameter_0_cannot_be_referenced_in_its_initializer, ts.declarationNameToString(node.name)); return; @@ -26641,31 +27640,39 @@ 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 === 138 /* ComputedPropertyName */) { + if (node.name.kind === 139 /* ComputedPropertyName */) { checkComputedPropertyName(node.name); if (node.initializer) { checkExpressionCached(node.initializer); } } - if (node.kind === 167 /* BindingElement */) { + if (node.kind === 168 /* BindingElement */) { // check computed properties inside property names of binding elements - if (node.propertyName && node.propertyName.kind === 138 /* ComputedPropertyName */) { + if (node.propertyName && node.propertyName.kind === 139 /* ComputedPropertyName */) { checkComputedPropertyName(node.propertyName); } + // check private/protected variable access + var parent_9 = node.parent.parent; + var parentType = getTypeForBindingElementParent(parent_9); + var name_17 = node.propertyName || node.name; + var property = getPropertyOfType(parentType, getTextOfPropertyName(name_17)); + if (parent_9.initializer && property && getParentOfSymbol(property)) { + checkClassPropertyAccess(parent_9, parent_9.initializer, parentType, property); + } } // For a binding pattern, check contained binding elements if (ts.isBindingPattern(node.name)) { 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 === 140 /* Parameter */ && ts.nodeIsMissing(ts.getContainingFunction(node).body)) { + if (node.initializer && ts.getRootDeclaration(node).kind === 141 /* 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 !== 204 /* ForInStatement */) { + if (node.initializer && node.parent.parent.kind !== 206 /* ForInStatement */) { checkTypeAssignableTo(checkExpressionCached(node.initializer), getWidenedTypeForVariableLikeDeclaration(node), node, /*headMessage*/ undefined); checkParameterInitializer(node); } @@ -26676,7 +27683,7 @@ var ts; 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 !== 204 /* ForInStatement */) { + if (node.initializer && node.parent.parent.kind !== 206 /* ForInStatement */) { checkTypeAssignableTo(checkExpressionCached(node.initializer), type, node, /*headMessage*/ undefined); checkParameterInitializer(node); } @@ -26692,10 +27699,10 @@ var ts; checkTypeAssignableTo(checkExpressionCached(node.initializer), declarationType, node, /*headMessage*/ undefined); } } - if (node.kind !== 143 /* PropertyDeclaration */ && node.kind !== 142 /* PropertySignature */) { + if (node.kind !== 144 /* PropertyDeclaration */ && node.kind !== 143 /* PropertySignature */) { // We know we don't have a binding pattern or computed name here checkExportsOnMergedDeclarations(node); - if (node.kind === 215 /* VariableDeclaration */ || node.kind === 167 /* BindingElement */) { + if (node.kind === 217 /* VariableDeclaration */ || node.kind === 168 /* BindingElement */) { checkVarDeclaredNamesNotShadowed(node); } checkCollisionWithCapturedSuperVariable(node, node.name); @@ -26719,7 +27726,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 === 169 /* ObjectLiteralExpression */) { + if (node.modifiers && node.parent.kind === 170 /* ObjectLiteralExpression */) { if (ts.isAsyncFunctionLike(node)) { if (node.modifiers.length > 1) { return grammarErrorOnFirstToken(node, ts.Diagnostics.Modifiers_cannot_appear_here); @@ -26740,7 +27747,7 @@ var ts; checkGrammarStatementInAmbientContext(node); checkExpression(node.expression); checkSourceElement(node.thenStatement); - if (node.thenStatement.kind === 198 /* EmptyStatement */) { + if (node.thenStatement.kind === 200 /* EmptyStatement */) { error(node.thenStatement, ts.Diagnostics.The_body_of_an_if_statement_cannot_be_the_empty_statement); } checkSourceElement(node.elseStatement); @@ -26760,12 +27767,12 @@ var ts; function checkForStatement(node) { // Grammar checking if (!checkGrammarStatementInAmbientContext(node)) { - if (node.initializer && node.initializer.kind === 216 /* VariableDeclarationList */) { + if (node.initializer && node.initializer.kind === 218 /* VariableDeclarationList */) { checkGrammarVariableDeclarationList(node.initializer); } } if (node.initializer) { - if (node.initializer.kind === 216 /* VariableDeclarationList */) { + if (node.initializer.kind === 218 /* VariableDeclarationList */) { ts.forEach(node.initializer.declarations, checkVariableDeclaration); } else { @@ -26785,14 +27792,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 === 216 /* VariableDeclarationList */) { + if (node.initializer.kind === 218 /* 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 === 168 /* ArrayLiteralExpression */ || varExpr.kind === 169 /* ObjectLiteralExpression */) { + if (varExpr.kind === 169 /* ArrayLiteralExpression */ || varExpr.kind === 170 /* 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. @@ -26821,7 +27828,7 @@ var ts; // 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 === 216 /* VariableDeclarationList */) { + if (node.initializer.kind === 218 /* 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); @@ -26835,7 +27842,7 @@ 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 === 168 /* ArrayLiteralExpression */ || varExpr.kind === 169 /* ObjectLiteralExpression */) { + if (varExpr.kind === 169 /* ArrayLiteralExpression */ || varExpr.kind === 170 /* ObjectLiteralExpression */) { error(varExpr, ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern); } else if (!isTypeAnyOrAllConstituentTypesHaveKind(leftType, 258 /* StringLike */)) { @@ -26846,7 +27853,7 @@ var ts; 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); } } - var rightType = checkExpression(node.expression); + 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, 80896 /* ObjectType */ | 512 /* TypeParameter */)) { @@ -26863,7 +27870,7 @@ var ts; } } function checkRightHandSideOfForOf(rhsExpression) { - var expressionType = getTypeOfExpression(rhsExpression); + var expressionType = checkNonNullExpression(rhsExpression); return checkIteratedTypeOrElementType(expressionType, rhsExpression, /*allowStringInput*/ true); } function checkIteratedTypeOrElementType(inputType, errorNode, allowStringInput) { @@ -26926,7 +27933,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 & 4096 /* Reference */) && type.target === globalIterableType) { + if ((type.flags & 4096 /* Reference */) && type.target === getGlobalIterableType()) { typeAsIterable.iterableElementType = type.typeArguments[0]; } else { @@ -26967,7 +27974,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 & 4096 /* Reference */) && type.target === globalIteratorType) { + if ((type.flags & 4096 /* Reference */) && type.target === getGlobalIteratorType()) { typeAsIterator.iteratorElementType = type.typeArguments[0]; } else { @@ -27004,7 +28011,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 & 4096 /* Reference */) && type.target === globalIterableIteratorType) { + if ((type.flags & 4096 /* Reference */) && type.target === getGlobalIterableIteratorType()) { return type.typeArguments[0]; } return getElementTypeOfIterable(type, /*errorNode*/ undefined) || @@ -27080,7 +28087,11 @@ var ts; // TODO: Check that target label is valid } function isGetAccessorWithAnnotatedSetAccessor(node) { - return !!(node.kind === 147 /* GetAccessor */ && ts.getSetAccessorTypeAnnotationNode(ts.getDeclarationOfKind(node.symbol, 148 /* SetAccessor */))); + return !!(node.kind === 148 /* GetAccessor */ && ts.getSetAccessorTypeAnnotationNode(ts.getDeclarationOfKind(node.symbol, 149 /* SetAccessor */))); + } + function isUnwrappedReturnTypeVoidOrAny(func, returnType) { + var unwrappedReturnType = ts.isAsyncFunctionLike(func) ? getPromisedType(returnType) : returnType; + return maybeTypeOfKind(unwrappedReturnType, 16 /* Void */ | 1 /* Any */); } function checkReturnStatement(node) { // Grammar checking @@ -27090,12 +28101,12 @@ var ts; grammarErrorOnFirstToken(node, ts.Diagnostics.A_return_statement_can_only_be_used_within_a_function_body); } } - if (node.expression) { - var func = ts.getContainingFunction(node); - if (func) { - var signature = getSignatureFromDeclaration(func); - var returnType = getReturnTypeOfSignature(signature); - var exprType = checkExpressionCached(node.expression); + var func = ts.getContainingFunction(node); + if (func) { + var signature = getSignatureFromDeclaration(func); + var returnType = getReturnTypeOfSignature(signature); + if (strictNullChecks || node.expression) { + var exprType = node.expression ? checkExpressionCached(node.expression) : undefinedType; if (func.asteriskToken) { // A generator does not need its return expressions checked against its return type. // Instead, the yield expressions are checked against the element type. @@ -27103,30 +28114,36 @@ var ts; // for generators. return; } - if (func.kind === 148 /* SetAccessor */) { - error(node.expression, ts.Diagnostics.Setters_cannot_return_a_value); + if (func.kind === 149 /* SetAccessor */) { + if (node.expression) { + error(node.expression, ts.Diagnostics.Setters_cannot_return_a_value); + } } - else if (func.kind === 146 /* Constructor */) { - if (!checkTypeAssignableTo(exprType, returnType, node.expression)) { + else if (func.kind === 147 /* 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); } } else if (func.type || isGetAccessorWithAnnotatedSetAccessor(func)) { if (ts.isAsyncFunctionLike(func)) { var promisedType = getPromisedType(returnType); - var awaitedType = checkAwaitedType(exprType, node.expression, ts.Diagnostics.Return_expression_in_async_function_does_not_have_a_valid_callable_then_member); + var awaitedType = checkAwaitedType(exprType, node.expression || node, ts.Diagnostics.Return_expression_in_async_function_does_not_have_a_valid_callable_then_member); if (promisedType) { // If the function has a return type, but promisedType is // undefined, an error will be reported in checkAsyncFunctionReturnType // so we don't need to report one here. - checkTypeAssignableTo(awaitedType, promisedType, node.expression); + checkTypeAssignableTo(awaitedType, promisedType, node.expression || node); } } else { - checkTypeAssignableTo(exprType, returnType, node.expression); + checkTypeAssignableTo(exprType, returnType, node.expression || node); } } } + else if (func.kind !== 147 /* 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); + } } } function checkWithStatement(node) { @@ -27145,10 +28162,9 @@ var ts; var firstDefaultClause; var hasDuplicateDefaultClause = false; var expressionType = checkExpression(node.expression); - var expressionTypeIsStringLike = maybeTypeOfKind(expressionType, 258 /* StringLike */); ts.forEach(node.caseBlock.clauses, function (clause) { // Grammar check for duplicate default clauses, skip if we already report duplicate default clause - if (clause.kind === 246 /* DefaultClause */ && !hasDuplicateDefaultClause) { + if (clause.kind === 249 /* DefaultClause */ && !hasDuplicateDefaultClause) { if (firstDefaultClause === undefined) { firstDefaultClause = clause; } @@ -27160,18 +28176,15 @@ var ts; hasDuplicateDefaultClause = true; } } - if (produceDiagnostics && clause.kind === 245 /* CaseClause */) { + if (produceDiagnostics && clause.kind === 248 /* 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 assignable to or from the type of the 'switch' expression. + // 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); - var expressionTypeIsAssignableToCaseType = - // Permit 'number[] | "foo"' to be asserted to 'string'. - (expressionTypeIsStringLike && maybeTypeOfKind(caseType, 258 /* StringLike */)) || - isTypeAssignableTo(expressionType, caseType); - if (!expressionTypeIsAssignableToCaseType) { - // 'expressionType is not assignable to caseType', try the reversed check and report errors if it fails - checkTypeAssignableTo(caseType, expressionType, caseClause.expression, /*headMessage*/ undefined); + if (!isTypeComparableTo(expressionType, caseType)) { + // expressionType is not comparable to caseType, try the reversed check and report errors if it fails + checkTypeComparableTo(caseType, expressionType, caseClause.expression, /*headMessage*/ undefined); } } ts.forEach(clause.statements, checkSourceElement); @@ -27185,7 +28198,7 @@ var ts; if (ts.isFunctionLike(current)) { break; } - if (current.kind === 211 /* LabeledStatement */ && current.label.text === node.label.text) { + if (current.kind === 213 /* 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; @@ -27290,7 +28303,7 @@ 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 === 138 /* ComputedPropertyName */ || prop.parent === containingType.symbol) { + if (prop.valueDeclaration.name.kind === 139 /* ComputedPropertyName */ || prop.parent === containingType.symbol) { errorNode = prop.valueDeclaration; } else if (indexDeclaration) { @@ -27348,7 +28361,7 @@ var ts; var firstDecl; for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; - if (declaration.kind === 218 /* ClassDeclaration */ || declaration.kind === 219 /* InterfaceDeclaration */) { + if (declaration.kind === 220 /* ClassDeclaration */ || declaration.kind === 221 /* InterfaceDeclaration */) { if (!firstDecl) { firstDecl = declaration; } @@ -27504,7 +28517,7 @@ var ts; // 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 === 190 /* ClassExpression */) { + if (derivedClassDecl.kind === 191 /* ClassExpression */) { error(derivedClassDecl, ts.Diagnostics.Non_abstract_class_expression_does_not_implement_inherited_abstract_member_0_from_class_1, symbolToString(baseProperty), typeToString(baseType)); } else { @@ -27552,7 +28565,7 @@ var ts; } } function isAccessor(kind) { - return kind === 147 /* GetAccessor */ || kind === 148 /* SetAccessor */; + return kind === 148 /* GetAccessor */ || kind === 149 /* SetAccessor */; } function areTypeParametersIdentical(list1, list2) { if (!list1 && !list2) { @@ -27624,7 +28637,7 @@ var ts; var symbol = getSymbolOfNode(node); checkTypeParameterListsIdentical(node, symbol); // Only check this symbol once - var firstInterfaceDecl = ts.getDeclarationOfKind(symbol, 219 /* InterfaceDeclaration */); + var firstInterfaceDecl = ts.getDeclarationOfKind(symbol, 221 /* InterfaceDeclaration */); if (node === firstInterfaceDecl) { var type = getDeclaredTypeOfSymbol(symbol); var typeWithThis = getTypeWithThisArgument(type); @@ -27728,7 +28741,7 @@ var ts; return value; function evalConstant(e) { switch (e.kind) { - case 183 /* PrefixUnaryExpression */: + case 184 /* PrefixUnaryExpression */: var value_1 = evalConstant(e.operand); if (value_1 === undefined) { return undefined; @@ -27739,7 +28752,7 @@ var ts; case 50 /* TildeToken */: return ~value_1; } return undefined; - case 185 /* BinaryExpression */: + case 186 /* BinaryExpression */: var left = evalConstant(e.left); if (left === undefined) { return undefined; @@ -27764,11 +28777,11 @@ var ts; return undefined; case 8 /* NumericLiteral */: return +e.text; - case 176 /* ParenthesizedExpression */: + case 177 /* ParenthesizedExpression */: return evalConstant(e.expression); case 69 /* Identifier */: - case 171 /* ElementAccessExpression */: - case 170 /* PropertyAccessExpression */: + case 172 /* ElementAccessExpression */: + case 171 /* PropertyAccessExpression */: var member = initializer.parent; var currentType = getTypeOfSymbol(getSymbolOfNode(member.parent)); var enumType_1; @@ -27781,7 +28794,7 @@ var ts; } else { var expression = void 0; - if (e.kind === 171 /* ElementAccessExpression */) { + if (e.kind === 172 /* ElementAccessExpression */) { if (e.argumentExpression === undefined || e.argumentExpression.kind !== 9 /* StringLiteral */) { return undefined; @@ -27799,7 +28812,7 @@ var ts; if (current.kind === 69 /* Identifier */) { break; } - else if (current.kind === 170 /* PropertyAccessExpression */) { + else if (current.kind === 171 /* PropertyAccessExpression */) { current = current.expression; } else { @@ -27871,7 +28884,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 !== 221 /* EnumDeclaration */) { + if (declaration.kind !== 223 /* EnumDeclaration */) { return false; } var enumDeclaration = declaration; @@ -27894,8 +28907,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 === 218 /* ClassDeclaration */ || - (declaration.kind === 217 /* FunctionDeclaration */ && ts.nodeIsPresent(declaration.body))) && + if ((declaration.kind === 220 /* ClassDeclaration */ || + (declaration.kind === 219 /* FunctionDeclaration */ && ts.nodeIsPresent(declaration.body))) && !ts.isInAmbientContext(declaration)) { return declaration; } @@ -27957,7 +28970,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, 218 /* ClassDeclaration */); + var mergedClass = ts.getDeclarationOfKind(symbol, 220 /* ClassDeclaration */); if (mergedClass && inSameLexicalScope(node, mergedClass)) { getNodeLinks(node).flags |= 32768 /* LexicalModuleMergesWithClass */; @@ -28003,31 +29016,31 @@ var ts; } function checkModuleAugmentationElement(node, isGlobalAugmentation) { switch (node.kind) { - case 197 /* VariableStatement */: + case 199 /* 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 231 /* ExportAssignment */: - case 232 /* ExportDeclaration */: + case 234 /* ExportAssignment */: + case 235 /* ExportDeclaration */: grammarErrorOnFirstToken(node, ts.Diagnostics.Exports_and_export_assignments_are_not_permitted_in_module_augmentations); break; - case 225 /* ImportEqualsDeclaration */: + case 228 /* ImportEqualsDeclaration */: if (node.moduleReference.kind !== 9 /* StringLiteral */) { error(node.name, ts.Diagnostics.Module_augmentation_cannot_introduce_new_names_in_the_top_level_scope); break; } // fallthrough - case 226 /* ImportDeclaration */: + case 229 /* ImportDeclaration */: grammarErrorOnFirstToken(node, ts.Diagnostics.Imports_are_not_permitted_in_module_augmentations_Consider_moving_them_to_the_enclosing_external_module); break; - case 167 /* BindingElement */: - case 215 /* VariableDeclaration */: - var name_16 = node.name; - if (ts.isBindingPattern(name_16)) { - for (var _b = 0, _c = name_16.elements; _b < _c.length; _b++) { + case 168 /* BindingElement */: + case 217 /* VariableDeclaration */: + var name_18 = node.name; + if (ts.isBindingPattern(name_18)) { + for (var _b = 0, _c = name_18.elements; _b < _c.length; _b++) { var el = _c[_b]; // mark individual names in binding pattern checkModuleAugmentationElement(el, isGlobalAugmentation); @@ -28035,12 +29048,12 @@ var ts; break; } // fallthrough - case 218 /* ClassDeclaration */: - case 221 /* EnumDeclaration */: - case 217 /* FunctionDeclaration */: - case 219 /* InterfaceDeclaration */: - case 222 /* ModuleDeclaration */: - case 220 /* TypeAliasDeclaration */: + case 220 /* ClassDeclaration */: + case 223 /* EnumDeclaration */: + case 219 /* FunctionDeclaration */: + case 221 /* InterfaceDeclaration */: + case 224 /* ModuleDeclaration */: + case 222 /* TypeAliasDeclaration */: var symbol = getSymbolOfNode(node); if (symbol) { // module augmentations cannot introduce new names on the top level scope of the module @@ -28055,7 +29068,7 @@ var ts; } else { // symbol should not originate in augmentation - reportError = ts.isExternalModuleAugmentation(symbol.parent.valueDeclaration); + reportError = ts.isExternalModuleAugmentation(symbol.parent.declarations[0]); } } if (reportError) { @@ -28067,10 +29080,10 @@ var ts; } function getFirstIdentifier(node) { while (true) { - if (node.kind === 137 /* QualifiedName */) { + if (node.kind === 138 /* QualifiedName */) { node = node.left; } - else if (node.kind === 170 /* PropertyAccessExpression */) { + else if (node.kind === 171 /* PropertyAccessExpression */) { node = node.expression; } else { @@ -28086,9 +29099,9 @@ var ts; error(moduleName, ts.Diagnostics.String_literal_expected); return false; } - var inAmbientExternalModule = node.parent.kind === 223 /* ModuleBlock */ && ts.isAmbientModule(node.parent.parent); - if (node.parent.kind !== 252 /* SourceFile */ && !inAmbientExternalModule) { - error(moduleName, node.kind === 232 /* ExportDeclaration */ ? + var inAmbientExternalModule = node.parent.kind === 225 /* ModuleBlock */ && ts.isAmbientModule(node.parent.parent); + if (node.parent.kind !== 255 /* SourceFile */ && !inAmbientExternalModule) { + error(moduleName, node.kind === 235 /* ExportDeclaration */ ? ts.Diagnostics.Export_declarations_are_not_permitted_in_a_namespace : ts.Diagnostics.Import_declarations_in_a_namespace_cannot_reference_a_module); return false; @@ -28111,11 +29124,17 @@ var ts; var symbol = getSymbolOfNode(node); var target = resolveAlias(symbol); if (target !== unknownSymbol) { - var excludedMeanings = (symbol.flags & 107455 /* Value */ ? 107455 /* Value */ : 0) | + // For external modules symbol represent local symbol for an alias. + // This local symbol will merge any other local declarations (excluding other aliases) + // and symbol.flags will contains combined representation for all merged declaration. + // Based on symbol.flags we can compute a set of excluded meanings (meaning that resolved alias should not have, + // otherwise it will conflict with some local declaration). Note that in addition to normal flags we include matching SymbolFlags.Export* + // in order to prevent collisions with declarations that were exported from the current module (they still contribute to local names). + var excludedMeanings = (symbol.flags & (107455 /* Value */ | 1048576 /* ExportValue */) ? 107455 /* Value */ : 0) | (symbol.flags & 793056 /* Type */ ? 793056 /* Type */ : 0) | (symbol.flags & 1536 /* Namespace */ ? 1536 /* Namespace */ : 0); if (target.flags & excludedMeanings) { - var message = node.kind === 234 /* ExportSpecifier */ ? + var message = node.kind === 237 /* 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)); @@ -28143,7 +29162,7 @@ var ts; checkImportBinding(importClause); } if (importClause.namedBindings) { - if (importClause.namedBindings.kind === 228 /* NamespaceImport */) { + if (importClause.namedBindings.kind === 231 /* NamespaceImport */) { checkImportBinding(importClause.namedBindings); } else { @@ -28200,8 +29219,8 @@ var ts; // export { x, y } // export { x, y } from "foo" ts.forEach(node.exportClause.elements, checkExportSpecifier); - var inAmbientExternalModule = node.parent.kind === 223 /* ModuleBlock */ && ts.isAmbientModule(node.parent.parent); - if (node.parent.kind !== 252 /* SourceFile */ && !inAmbientExternalModule) { + var inAmbientExternalModule = node.parent.kind === 225 /* ModuleBlock */ && ts.isAmbientModule(node.parent.parent); + if (node.parent.kind !== 255 /* SourceFile */ && !inAmbientExternalModule) { error(node, ts.Diagnostics.Export_declarations_are_not_permitted_in_a_namespace); } } @@ -28215,7 +29234,7 @@ var ts; } } function checkGrammarModuleElementContext(node, errorMessage) { - if (node.parent.kind !== 252 /* SourceFile */ && node.parent.kind !== 223 /* ModuleBlock */ && node.parent.kind !== 222 /* ModuleDeclaration */) { + if (node.parent.kind !== 255 /* SourceFile */ && node.parent.kind !== 225 /* ModuleBlock */ && node.parent.kind !== 224 /* ModuleDeclaration */) { return grammarErrorOnFirstToken(node, errorMessage); } } @@ -28239,8 +29258,8 @@ 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 === 252 /* SourceFile */ ? node.parent : node.parent.parent; - if (container.kind === 222 /* ModuleDeclaration */ && !ts.isAmbientModule(container)) { + var container = node.parent.kind === 255 /* SourceFile */ ? node.parent : node.parent.parent; + if (container.kind === 224 /* ModuleDeclaration */ && !ts.isAmbientModule(container)) { error(node, ts.Diagnostics.An_export_assignment_cannot_be_used_in_a_namespace); return; } @@ -28315,7 +29334,7 @@ var ts; links.exportsChecked = true; } function isNotOverload(declaration) { - return declaration.kind !== 217 /* FunctionDeclaration */ || !!declaration.body; + return declaration.kind !== 219 /* FunctionDeclaration */ || !!declaration.body; } } function checkSourceElement(node) { @@ -28327,118 +29346,118 @@ 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 222 /* ModuleDeclaration */: - case 218 /* ClassDeclaration */: - case 219 /* InterfaceDeclaration */: - case 217 /* FunctionDeclaration */: + case 224 /* ModuleDeclaration */: + case 220 /* ClassDeclaration */: + case 221 /* InterfaceDeclaration */: + case 219 /* FunctionDeclaration */: cancellationToken.throwIfCancellationRequested(); } } switch (kind) { - case 139 /* TypeParameter */: + case 140 /* TypeParameter */: return checkTypeParameter(node); - case 140 /* Parameter */: + case 141 /* Parameter */: return checkParameter(node); - case 143 /* PropertyDeclaration */: - case 142 /* PropertySignature */: + case 144 /* PropertyDeclaration */: + case 143 /* PropertySignature */: return checkPropertyDeclaration(node); - case 154 /* FunctionType */: - case 155 /* ConstructorType */: - case 149 /* CallSignature */: - case 150 /* ConstructSignature */: + case 155 /* FunctionType */: + case 156 /* ConstructorType */: + case 150 /* CallSignature */: + case 151 /* ConstructSignature */: return checkSignatureDeclaration(node); - case 151 /* IndexSignature */: + case 152 /* IndexSignature */: return checkSignatureDeclaration(node); - case 145 /* MethodDeclaration */: - case 144 /* MethodSignature */: + case 146 /* MethodDeclaration */: + case 145 /* MethodSignature */: return checkMethodDeclaration(node); - case 146 /* Constructor */: + case 147 /* Constructor */: return checkConstructorDeclaration(node); - case 147 /* GetAccessor */: - case 148 /* SetAccessor */: + case 148 /* GetAccessor */: + case 149 /* SetAccessor */: return checkAccessorDeclaration(node); - case 153 /* TypeReference */: + case 154 /* TypeReference */: return checkTypeReferenceNode(node); - case 152 /* TypePredicate */: + case 153 /* TypePredicate */: return checkTypePredicate(node); - case 156 /* TypeQuery */: + case 157 /* TypeQuery */: return checkTypeQuery(node); - case 157 /* TypeLiteral */: + case 158 /* TypeLiteral */: return checkTypeLiteral(node); - case 158 /* ArrayType */: + case 159 /* ArrayType */: return checkArrayType(node); - case 159 /* TupleType */: + case 160 /* TupleType */: return checkTupleType(node); - case 160 /* UnionType */: - case 161 /* IntersectionType */: + case 161 /* UnionType */: + case 162 /* IntersectionType */: return checkUnionOrIntersectionType(node); - case 162 /* ParenthesizedType */: + case 163 /* ParenthesizedType */: return checkSourceElement(node.type); - case 217 /* FunctionDeclaration */: + case 219 /* FunctionDeclaration */: return checkFunctionDeclaration(node); - case 196 /* Block */: - case 223 /* ModuleBlock */: + case 198 /* Block */: + case 225 /* ModuleBlock */: return checkBlock(node); - case 197 /* VariableStatement */: + case 199 /* VariableStatement */: return checkVariableStatement(node); - case 199 /* ExpressionStatement */: + case 201 /* ExpressionStatement */: return checkExpressionStatement(node); - case 200 /* IfStatement */: + case 202 /* IfStatement */: return checkIfStatement(node); - case 201 /* DoStatement */: + case 203 /* DoStatement */: return checkDoStatement(node); - case 202 /* WhileStatement */: + case 204 /* WhileStatement */: return checkWhileStatement(node); - case 203 /* ForStatement */: + case 205 /* ForStatement */: return checkForStatement(node); - case 204 /* ForInStatement */: + case 206 /* ForInStatement */: return checkForInStatement(node); - case 205 /* ForOfStatement */: + case 207 /* ForOfStatement */: return checkForOfStatement(node); - case 206 /* ContinueStatement */: - case 207 /* BreakStatement */: + case 208 /* ContinueStatement */: + case 209 /* BreakStatement */: return checkBreakOrContinueStatement(node); - case 208 /* ReturnStatement */: + case 210 /* ReturnStatement */: return checkReturnStatement(node); - case 209 /* WithStatement */: + case 211 /* WithStatement */: return checkWithStatement(node); - case 210 /* SwitchStatement */: + case 212 /* SwitchStatement */: return checkSwitchStatement(node); - case 211 /* LabeledStatement */: + case 213 /* LabeledStatement */: return checkLabeledStatement(node); - case 212 /* ThrowStatement */: + case 214 /* ThrowStatement */: return checkThrowStatement(node); - case 213 /* TryStatement */: + case 215 /* TryStatement */: return checkTryStatement(node); - case 215 /* VariableDeclaration */: + case 217 /* VariableDeclaration */: return checkVariableDeclaration(node); - case 167 /* BindingElement */: + case 168 /* BindingElement */: return checkBindingElement(node); - case 218 /* ClassDeclaration */: + case 220 /* ClassDeclaration */: return checkClassDeclaration(node); - case 219 /* InterfaceDeclaration */: + case 221 /* InterfaceDeclaration */: return checkInterfaceDeclaration(node); - case 220 /* TypeAliasDeclaration */: + case 222 /* TypeAliasDeclaration */: return checkTypeAliasDeclaration(node); - case 221 /* EnumDeclaration */: + case 223 /* EnumDeclaration */: return checkEnumDeclaration(node); - case 222 /* ModuleDeclaration */: + case 224 /* ModuleDeclaration */: return checkModuleDeclaration(node); - case 226 /* ImportDeclaration */: + case 229 /* ImportDeclaration */: return checkImportDeclaration(node); - case 225 /* ImportEqualsDeclaration */: + case 228 /* ImportEqualsDeclaration */: return checkImportEqualsDeclaration(node); - case 232 /* ExportDeclaration */: + case 235 /* ExportDeclaration */: return checkExportDeclaration(node); - case 231 /* ExportAssignment */: + case 234 /* ExportAssignment */: return checkExportAssignment(node); - case 198 /* EmptyStatement */: + case 200 /* EmptyStatement */: checkGrammarStatementInAmbientContext(node); return; - case 214 /* DebuggerStatement */: + case 216 /* DebuggerStatement */: checkGrammarStatementInAmbientContext(node); return; - case 235 /* MissingDeclaration */: + case 238 /* MissingDeclaration */: return checkMissingDeclaration(node); } } @@ -28460,17 +29479,17 @@ var ts; for (var _i = 0, deferredNodes_1 = deferredNodes; _i < deferredNodes_1.length; _i++) { var node = deferredNodes_1[_i]; switch (node.kind) { - case 177 /* FunctionExpression */: - case 178 /* ArrowFunction */: - case 145 /* MethodDeclaration */: - case 144 /* MethodSignature */: + case 178 /* FunctionExpression */: + case 179 /* ArrowFunction */: + case 146 /* MethodDeclaration */: + case 145 /* MethodSignature */: checkFunctionExpressionOrObjectLiteralMethodDeferred(node); break; - case 147 /* GetAccessor */: - case 148 /* SetAccessor */: + case 148 /* GetAccessor */: + case 149 /* SetAccessor */: checkAccessorDeferred(node); break; - case 190 /* ClassExpression */: + case 191 /* ClassExpression */: checkClassExpressionDeferred(node); break; } @@ -28545,7 +29564,7 @@ var ts; function isInsideWithStatementBody(node) { if (node) { while (node.parent) { - if (node.parent.kind === 209 /* WithStatement */ && node.parent.statement === node) { + if (node.parent.kind === 211 /* WithStatement */ && node.parent.statement === node) { return true; } node = node.parent; @@ -28568,25 +29587,25 @@ var ts; copySymbols(location.locals, meaning); } switch (location.kind) { - case 252 /* SourceFile */: + case 255 /* SourceFile */: if (!ts.isExternalOrCommonJsModule(location)) { break; } - case 222 /* ModuleDeclaration */: + case 224 /* ModuleDeclaration */: copySymbols(getSymbolOfNode(location).exports, meaning & 8914931 /* ModuleMember */); break; - case 221 /* EnumDeclaration */: + case 223 /* EnumDeclaration */: copySymbols(getSymbolOfNode(location).exports, meaning & 8 /* EnumMember */); break; - case 190 /* ClassExpression */: + case 191 /* 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 218 /* ClassDeclaration */: - case 219 /* InterfaceDeclaration */: + case 220 /* ClassDeclaration */: + case 221 /* 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. @@ -28595,7 +29614,7 @@ var ts; copySymbols(getSymbolOfNode(location).members, meaning & 793056 /* Type */); } break; - case 177 /* FunctionExpression */: + case 178 /* FunctionExpression */: var funcName = location.name; if (funcName) { copySymbol(location.symbol, meaning); @@ -28644,48 +29663,51 @@ var ts; } function isTypeDeclaration(node) { switch (node.kind) { - case 139 /* TypeParameter */: - case 218 /* ClassDeclaration */: - case 219 /* InterfaceDeclaration */: - case 220 /* TypeAliasDeclaration */: - case 221 /* EnumDeclaration */: + case 140 /* TypeParameter */: + case 220 /* ClassDeclaration */: + case 221 /* InterfaceDeclaration */: + case 222 /* TypeAliasDeclaration */: + case 223 /* 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 === 137 /* QualifiedName */) { + while (node.parent && node.parent.kind === 138 /* QualifiedName */) { node = node.parent; } - return node.parent && node.parent.kind === 153 /* TypeReference */; + return node.parent && node.parent.kind === 154 /* TypeReference */; } function isHeritageClauseElementIdentifier(entityName) { var node = entityName; - while (node.parent && node.parent.kind === 170 /* PropertyAccessExpression */) { + while (node.parent && node.parent.kind === 171 /* PropertyAccessExpression */) { node = node.parent; } - return node.parent && node.parent.kind === 192 /* ExpressionWithTypeArguments */; + return node.parent && node.parent.kind === 193 /* ExpressionWithTypeArguments */; } - function isNodeWithinClass(node, classDeclaration) { + function forEachEnclosingClass(node, callback) { + var result; while (true) { node = ts.getContainingClass(node); - if (!node) { - return false; - } - if (node === classDeclaration) { - return true; - } + if (!node) + break; + if (result = callback(node)) + break; } + return result; + } + function isNodeWithinClass(node, classDeclaration) { + return !!forEachEnclosingClass(node, function (n) { return n === classDeclaration; }); } function getLeftSideOfImportEqualsOrExportAssignment(nodeOnRightSide) { - while (nodeOnRightSide.parent.kind === 137 /* QualifiedName */) { + while (nodeOnRightSide.parent.kind === 138 /* QualifiedName */) { nodeOnRightSide = nodeOnRightSide.parent; } - if (nodeOnRightSide.parent.kind === 225 /* ImportEqualsDeclaration */) { + if (nodeOnRightSide.parent.kind === 228 /* ImportEqualsDeclaration */) { return nodeOnRightSide.parent.moduleReference === nodeOnRightSide && nodeOnRightSide.parent; } - if (nodeOnRightSide.parent.kind === 231 /* ExportAssignment */) { + if (nodeOnRightSide.parent.kind === 234 /* ExportAssignment */) { return nodeOnRightSide.parent.expression === nodeOnRightSide && nodeOnRightSide.parent; } return undefined; @@ -28697,7 +29719,7 @@ var ts; if (ts.isDeclarationName(entityName)) { return getSymbolOfNode(entityName.parent); } - if (ts.isInJavaScriptFile(entityName) && entityName.parent.kind === 170 /* PropertyAccessExpression */) { + if (ts.isInJavaScriptFile(entityName) && entityName.parent.kind === 171 /* PropertyAccessExpression */) { var specialPropertyAssignmentKind = ts.getSpecialPropertyAssignmentKind(entityName.parent.parent); switch (specialPropertyAssignmentKind) { case 1 /* ExportsProperty */: @@ -28709,11 +29731,11 @@ var ts; default: } } - if (entityName.parent.kind === 231 /* ExportAssignment */) { + if (entityName.parent.kind === 234 /* ExportAssignment */) { return resolveEntityName(entityName, /*all meanings*/ 107455 /* Value */ | 793056 /* Type */ | 1536 /* Namespace */ | 8388608 /* Alias */); } - if (entityName.kind !== 170 /* PropertyAccessExpression */) { + if (entityName.kind !== 171 /* PropertyAccessExpression */) { if (isInRightSideOfImportOrExportAssignment(entityName)) { // Since we already checked for ExportAssignment, this really could only be an Import return getSymbolOfPartOfRightHandSideOfImportEquals(entityName); @@ -28725,7 +29747,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 === 192 /* ExpressionWithTypeArguments */) { + if (entityName.parent.kind === 193 /* ExpressionWithTypeArguments */) { meaning = 793056 /* Type */; // In a class 'extends' clause we are also looking for a value. if (ts.isExpressionWithTypeArgumentsInClassExtendsClause(entityName.parent)) { @@ -28738,30 +29760,28 @@ var ts; meaning |= 8388608 /* Alias */; return resolveEntityName(entityName, meaning); } - else if ((entityName.parent.kind === 239 /* JsxOpeningElement */) || - (entityName.parent.kind === 238 /* JsxSelfClosingElement */) || - (entityName.parent.kind === 241 /* JsxClosingElement */)) { - return getJsxTagSymbol(entityName.parent); - } else if (ts.isExpression(entityName)) { if (ts.nodeIsMissing(entityName)) { // Missing entity name. return undefined; } if (entityName.kind === 69 /* Identifier */) { + if (ts.isJSXTagName(entityName) && isJsxIntrinsicIdentifier(entityName)) { + return getIntrinsicTagSymbol(entityName.parent); + } // Include aliases in the meaning, this ensures that we do not follow aliases to where they point and instead // return the alias symbol. var meaning = 107455 /* Value */ | 8388608 /* Alias */; return resolveEntityName(entityName, meaning); } - else if (entityName.kind === 170 /* PropertyAccessExpression */) { + else if (entityName.kind === 171 /* PropertyAccessExpression */) { var symbol = getNodeLinks(entityName).resolvedSymbol; if (!symbol) { checkPropertyAccessExpression(entityName); } return getNodeLinks(entityName).resolvedSymbol; } - else if (entityName.kind === 137 /* QualifiedName */) { + else if (entityName.kind === 138 /* QualifiedName */) { var symbol = getNodeLinks(entityName).resolvedSymbol; if (!symbol) { checkQualifiedName(entityName); @@ -28770,16 +29790,16 @@ var ts; } } else if (isTypeReferenceIdentifier(entityName)) { - var meaning = entityName.parent.kind === 153 /* TypeReference */ ? 793056 /* Type */ : 1536 /* Namespace */; + var meaning = entityName.parent.kind === 154 /* TypeReference */ ? 793056 /* Type */ : 1536 /* Namespace */; // Include aliases in the meaning, this ensures that we do not follow aliases to where they point and instead // return the alias symbol. meaning |= 8388608 /* Alias */; return resolveEntityName(entityName, meaning); } - else if (entityName.parent.kind === 242 /* JsxAttribute */) { + else if (entityName.parent.kind === 245 /* JsxAttribute */) { return getJsxAttributePropertySymbol(entityName.parent); } - if (entityName.parent.kind === 152 /* TypePredicate */) { + if (entityName.parent.kind === 153 /* TypePredicate */) { return resolveEntityName(entityName, /*meaning*/ 1 /* FunctionScopedVariable */); } // Do we want to return undefined here? @@ -28796,12 +29816,12 @@ var ts; } if (node.kind === 69 /* Identifier */) { if (isInRightSideOfImportOrExportAssignment(node)) { - return node.parent.kind === 231 /* ExportAssignment */ + return node.parent.kind === 234 /* ExportAssignment */ ? getSymbolOfEntityNameOrPropertyAccessExpression(node) : getSymbolOfPartOfRightHandSideOfImportEquals(node); } - else if (node.parent.kind === 167 /* BindingElement */ && - node.parent.parent.kind === 165 /* ObjectBindingPattern */ && + else if (node.parent.kind === 168 /* BindingElement */ && + node.parent.parent.kind === 166 /* ObjectBindingPattern */ && node === node.parent.propertyName) { var typeOfPattern = getTypeOfNode(node.parent.parent); var propertyDeclaration = typeOfPattern && getPropertyOfType(typeOfPattern, node.text); @@ -28812,19 +29832,19 @@ var ts; } switch (node.kind) { case 69 /* Identifier */: - case 170 /* PropertyAccessExpression */: - case 137 /* QualifiedName */: + case 171 /* PropertyAccessExpression */: + case 138 /* QualifiedName */: return getSymbolOfEntityNameOrPropertyAccessExpression(node); case 97 /* ThisKeyword */: case 95 /* SuperKeyword */: var type = ts.isExpression(node) ? checkExpression(node) : getTypeFromTypeNode(node); return type.symbol; - case 163 /* ThisType */: + case 164 /* ThisType */: return getTypeFromTypeNode(node).symbol; case 121 /* ConstructorKeyword */: // constructor keyword for an overload, should take us to the definition if it exist var constructorDeclaration = node.parent; - if (constructorDeclaration && constructorDeclaration.kind === 146 /* Constructor */) { + if (constructorDeclaration && constructorDeclaration.kind === 147 /* Constructor */) { return constructorDeclaration.parent.symbol; } return undefined; @@ -28832,14 +29852,14 @@ var ts; // External module name in an import declaration if ((ts.isExternalModuleImportEqualsDeclaration(node.parent.parent) && ts.getExternalModuleImportEqualsDeclarationExpression(node.parent.parent) === node) || - ((node.parent.kind === 226 /* ImportDeclaration */ || node.parent.kind === 232 /* ExportDeclaration */) && + ((node.parent.kind === 229 /* ImportDeclaration */ || node.parent.kind === 235 /* ExportDeclaration */) && node.parent.moduleSpecifier === node)) { return resolveExternalModuleName(node, node); } // Fall through case 8 /* NumericLiteral */: // index access - if (node.parent.kind === 171 /* ElementAccessExpression */ && node.parent.argumentExpression === node) { + if (node.parent.kind === 172 /* ElementAccessExpression */ && node.parent.argumentExpression === node) { var objectType = checkExpression(node.parent.expression); if (objectType === unknownType) return undefined; @@ -28856,7 +29876,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 === 250 /* ShorthandPropertyAssignment */) { + if (location && location.kind === 253 /* ShorthandPropertyAssignment */) { return resolveEntityName(location.name, 107455 /* Value */ | 8388608 /* Alias */); } return undefined; @@ -28944,9 +29964,9 @@ var ts; function getRootSymbols(symbol) { if (symbol.flags & 268435456 /* SyntheticProperty */) { var symbols_3 = []; - var name_17 = symbol.name; + var name_19 = symbol.name; ts.forEach(getSymbolLinks(symbol).containingType.types, function (t) { - var symbol = getPropertyOfType(t, name_17); + var symbol = getPropertyOfType(t, name_19); if (symbol) { symbols_3.push(symbol); } @@ -29006,11 +30026,11 @@ var ts; } var parentSymbol = getParentOfSymbol(symbol); if (parentSymbol) { - if (parentSymbol.flags & 512 /* ValueModule */ && parentSymbol.valueDeclaration.kind === 252 /* SourceFile */) { + if (parentSymbol.flags & 512 /* ValueModule */ && parentSymbol.valueDeclaration.kind === 255 /* SourceFile */) { return parentSymbol.valueDeclaration; } for (var n = node.parent; n; n = n.parent) { - if ((n.kind === 222 /* ModuleDeclaration */ || n.kind === 221 /* EnumDeclaration */) && getSymbolOfNode(n) === parentSymbol) { + if ((n.kind === 224 /* ModuleDeclaration */ || n.kind === 223 /* EnumDeclaration */) && getSymbolOfNode(n) === parentSymbol) { return n; } } @@ -29052,7 +30072,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 === 196 /* Block */ && ts.isIterationStatement(container.parent, /*lookInLabeledStatements*/ false); + var inLoopBodyBlock = container.kind === 198 /* Block */ && ts.isIterationStatement(container.parent, /*lookInLabeledStatements*/ false); links.isDeclarationWithCollidingName = !ts.isBlockScopedContainerTopLevel(container) && (!isDeclaredInLoop || (!inLoopInitializer && !inLoopBodyBlock)); } else { @@ -29078,22 +30098,22 @@ var ts; } function isValueAliasDeclaration(node) { switch (node.kind) { - case 225 /* ImportEqualsDeclaration */: - case 227 /* ImportClause */: - case 228 /* NamespaceImport */: - case 230 /* ImportSpecifier */: - case 234 /* ExportSpecifier */: + case 228 /* ImportEqualsDeclaration */: + case 230 /* ImportClause */: + case 231 /* NamespaceImport */: + case 233 /* ImportSpecifier */: + case 237 /* ExportSpecifier */: return isAliasResolvedToValue(getSymbolOfNode(node)); - case 232 /* ExportDeclaration */: + case 235 /* ExportDeclaration */: var exportClause = node.exportClause; return exportClause && ts.forEach(exportClause.elements, isValueAliasDeclaration); - case 231 /* ExportAssignment */: + case 234 /* ExportAssignment */: return node.expression && node.expression.kind === 69 /* Identifier */ ? isAliasResolvedToValue(getSymbolOfNode(node)) : true; } return false; } function isTopLevelValueImportEqualsWithEntityName(node) { - if (node.parent.kind !== 252 /* SourceFile */ || !ts.isInternalModuleImportEqualsDeclaration(node)) { + if (node.parent.kind !== 255 /* SourceFile */ || !ts.isInternalModuleImportEqualsDeclaration(node)) { // parent is not source file or it is not reference to internal module return false; } @@ -29155,7 +30175,7 @@ var ts; return getNodeLinks(node).enumMemberValue; } function getConstantValue(node) { - if (node.kind === 251 /* EnumMember */) { + if (node.kind === 254 /* EnumMember */) { return getEnumMemberValue(node); } var symbol = getNodeLinks(node).resolvedSymbol; @@ -29231,9 +30251,15 @@ var ts; getSymbolDisplayBuilder().buildTypeDisplay(getReturnTypeOfSignature(signature), writer, enclosingDeclaration, flags); } function writeTypeOfExpression(expr, enclosingDeclaration, flags, writer) { - var type = getTypeOfExpression(expr); + var type = getWidenedType(getTypeOfExpression(expr)); getSymbolDisplayBuilder().buildTypeDisplay(type, writer, enclosingDeclaration, flags); } + function writeBaseConstructorTypeOfClass(node, enclosingDeclaration, flags, writer) { + var classType = getDeclaredTypeOfSymbol(getSymbolOfNode(node)); + resolveBaseTypesOfClass(classType); + var baseType = classType.resolvedBaseTypes.length ? classType.resolvedBaseTypes[0] : unknownType; + getSymbolDisplayBuilder().buildTypeDisplay(baseType, writer, enclosingDeclaration, flags); + } function hasGlobalName(name) { return ts.hasProperty(globals, name); } @@ -29263,6 +30289,7 @@ var ts; writeTypeOfDeclaration: writeTypeOfDeclaration, writeReturnTypeOfSignatureDeclaration: writeReturnTypeOfSignatureDeclaration, writeTypeOfExpression: writeTypeOfExpression, + writeBaseConstructorTypeOfClass: writeBaseConstructorTypeOfClass, isSymbolAccessible: isSymbolAccessible, isEntityNameVisible: isEntityNameVisible, getConstantValue: getConstantValue, @@ -29281,7 +30308,7 @@ var ts; if (!moduleSymbol) { return undefined; } - return ts.getDeclarationOfKind(moduleSymbol, 252 /* SourceFile */); + return ts.getDeclarationOfKind(moduleSymbol, 255 /* SourceFile */); } function initializeTypeChecker() { // Bind all source files and propagate errors @@ -29297,6 +30324,9 @@ var ts; if (file.moduleAugmentations.length) { (augmentations || (augmentations = [])).push(file.moduleAugmentations); } + if (file.wasReferenced && file.symbol && file.symbol.globalExports) { + mergeSymbolTable(globals, file.symbol.globalExports); + } }); if (augmentations) { // merge module augmentations. @@ -29328,6 +30358,7 @@ var ts; getGlobalMethodDecoratorType = ts.memoize(function () { return getGlobalType("MethodDecorator"); }); getGlobalParameterDecoratorType = ts.memoize(function () { return getGlobalType("ParameterDecorator"); }); getGlobalTypedPropertyDescriptorType = ts.memoize(function () { return getGlobalType("TypedPropertyDescriptor", /*arity*/ 1); }); + getGlobalESSymbolConstructorSymbol = ts.memoize(function () { return getGlobalValueSymbol("Symbol"); }); getGlobalPromiseType = ts.memoize(function () { return getGlobalType("Promise", /*arity*/ 1); }); tryGetGlobalPromiseType = ts.memoize(function () { return getGlobalSymbol("Promise", 793056 /* Type */, /*diagnostic*/ undefined) && getGlobalPromiseType(); }); getGlobalPromiseLikeType = ts.memoize(function () { return getGlobalType("PromiseLike", /*arity*/ 1); }); @@ -29335,26 +30366,18 @@ var ts; getGlobalPromiseConstructorSymbol = ts.memoize(function () { return getGlobalValueSymbol("Promise"); }); getGlobalPromiseConstructorLikeType = ts.memoize(function () { return getGlobalType("PromiseConstructorLike"); }); getGlobalThenableType = ts.memoize(createThenableType); - // If we're in ES6 mode, load the TemplateStringsArray. - // Otherwise, default to 'unknown' for the purposes of type checking in LS scenarios. + getGlobalTemplateStringsArrayType = ts.memoize(function () { return getGlobalType("TemplateStringsArray"); }); if (languageVersion >= 2 /* ES6 */) { - globalTemplateStringsArrayType = getGlobalType("TemplateStringsArray"); - globalESSymbolType = getGlobalType("Symbol"); - globalESSymbolConstructorSymbol = getGlobalValueSymbol("Symbol"); - globalIterableType = getGlobalType("Iterable", /*arity*/ 1); - globalIteratorType = getGlobalType("Iterator", /*arity*/ 1); - globalIterableIteratorType = getGlobalType("IterableIterator", /*arity*/ 1); + 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); }); + getGlobalIterableIteratorType = ts.memoize(function () { return getGlobalType("IterableIterator", /*arity*/ 1); }); } else { - globalTemplateStringsArrayType = unknownType; - // Consider putting Symbol interface in lib.d.ts. On the plus side, putting it in lib.d.ts would make it - // extensible for Polyfilling Symbols. But putting it into lib.d.ts could also break users that have - // a global Symbol already, particularly if it is a class. - globalESSymbolType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined); - globalESSymbolConstructorSymbol = undefined; - globalIterableType = emptyGenericType; - globalIteratorType = emptyGenericType; - globalIterableIteratorType = emptyGenericType; + getGlobalESSymbolType = ts.memoize(function () { return emptyObjectType; }); + getGlobalIterableType = ts.memoize(function () { return emptyGenericType; }); + getGlobalIteratorType = ts.memoize(function () { return emptyGenericType; }); + getGlobalIterableIteratorType = ts.memoize(function () { return emptyGenericType; }); } anyArrayType = createArrayType(anyType); var symbol = getGlobalSymbol("ReadonlyArray", 793056 /* Type */, /*diagnostic*/ undefined); @@ -29385,14 +30408,14 @@ var ts; return false; } if (!ts.nodeCanBeDecorated(node)) { - if (node.kind === 145 /* MethodDeclaration */ && !ts.nodeIsPresent(node.body)) { + if (node.kind === 146 /* 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 === 147 /* GetAccessor */ || node.kind === 148 /* SetAccessor */) { + else if (node.kind === 148 /* GetAccessor */ || node.kind === 149 /* 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); @@ -29402,38 +30425,38 @@ var ts; } function checkGrammarModifiers(node) { switch (node.kind) { - case 147 /* GetAccessor */: - case 148 /* SetAccessor */: - case 146 /* Constructor */: - case 143 /* PropertyDeclaration */: - case 142 /* PropertySignature */: - case 145 /* MethodDeclaration */: - case 144 /* MethodSignature */: - case 151 /* IndexSignature */: - case 222 /* ModuleDeclaration */: - case 226 /* ImportDeclaration */: - case 225 /* ImportEqualsDeclaration */: - case 232 /* ExportDeclaration */: - case 231 /* ExportAssignment */: - case 140 /* Parameter */: + case 148 /* GetAccessor */: + case 149 /* SetAccessor */: + case 147 /* Constructor */: + case 144 /* PropertyDeclaration */: + case 143 /* PropertySignature */: + case 146 /* MethodDeclaration */: + case 145 /* MethodSignature */: + case 152 /* IndexSignature */: + case 224 /* ModuleDeclaration */: + case 229 /* ImportDeclaration */: + case 228 /* ImportEqualsDeclaration */: + case 235 /* ExportDeclaration */: + case 234 /* ExportAssignment */: + case 141 /* Parameter */: break; - case 217 /* FunctionDeclaration */: + case 219 /* FunctionDeclaration */: if (node.modifiers && (node.modifiers.length > 1 || node.modifiers[0].kind !== 118 /* AsyncKeyword */) && - node.parent.kind !== 223 /* ModuleBlock */ && node.parent.kind !== 252 /* SourceFile */) { + node.parent.kind !== 225 /* ModuleBlock */ && node.parent.kind !== 255 /* SourceFile */) { return grammarErrorOnFirstToken(node, ts.Diagnostics.Modifiers_cannot_appear_here); } break; - case 218 /* ClassDeclaration */: - case 219 /* InterfaceDeclaration */: - case 197 /* VariableStatement */: - case 220 /* TypeAliasDeclaration */: - if (node.modifiers && node.parent.kind !== 223 /* ModuleBlock */ && node.parent.kind !== 252 /* SourceFile */) { + case 220 /* ClassDeclaration */: + case 221 /* InterfaceDeclaration */: + case 199 /* VariableStatement */: + case 222 /* TypeAliasDeclaration */: + if (node.modifiers && node.parent.kind !== 225 /* ModuleBlock */ && node.parent.kind !== 255 /* SourceFile */) { return grammarErrorOnFirstToken(node, ts.Diagnostics.Modifiers_cannot_appear_here); } break; - case 221 /* EnumDeclaration */: + case 223 /* EnumDeclaration */: if (node.modifiers && (node.modifiers.length > 1 || node.modifiers[0].kind !== 74 /* ConstKeyword */) && - node.parent.kind !== 223 /* ModuleBlock */ && node.parent.kind !== 252 /* SourceFile */) { + node.parent.kind !== 225 /* ModuleBlock */ && node.parent.kind !== 255 /* SourceFile */) { return grammarErrorOnFirstToken(node, ts.Diagnostics.Modifiers_cannot_appear_here); } break; @@ -29448,16 +30471,16 @@ var ts; for (var _i = 0, _a = node.modifiers; _i < _a.length; _i++) { var modifier = _a[_i]; if (modifier.kind !== 127 /* ReadonlyKeyword */) { - if (node.kind === 142 /* PropertySignature */ || node.kind === 144 /* MethodSignature */) { + if (node.kind === 143 /* PropertySignature */ || node.kind === 145 /* MethodSignature */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_type_member, ts.tokenToString(modifier.kind)); } - if (node.kind === 151 /* IndexSignature */) { + if (node.kind === 152 /* 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 !== 221 /* EnumDeclaration */ && node.parent.kind === 218 /* ClassDeclaration */) { + if (node.kind !== 223 /* EnumDeclaration */ && node.parent.kind === 220 /* ClassDeclaration */) { return grammarErrorOnNode(node, ts.Diagnostics.A_class_member_cannot_have_the_0_keyword, ts.tokenToString(74 /* ConstKeyword */)); } break; @@ -29483,7 +30506,7 @@ 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 === 223 /* ModuleBlock */ || node.parent.kind === 252 /* SourceFile */) { + else if (node.parent.kind === 225 /* ModuleBlock */ || node.parent.kind === 255 /* SourceFile */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_module_or_namespace_element, text); } else if (flags & 128 /* Abstract */) { @@ -29506,10 +30529,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 === 223 /* ModuleBlock */ || node.parent.kind === 252 /* SourceFile */) { + else if (node.parent.kind === 225 /* ModuleBlock */ || node.parent.kind === 255 /* SourceFile */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_module_or_namespace_element, "static"); } - else if (node.kind === 140 /* Parameter */) { + else if (node.kind === 141 /* Parameter */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "static"); } else if (flags & 128 /* Abstract */) { @@ -29522,7 +30545,7 @@ var ts; if (flags & 64 /* Readonly */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "readonly"); } - else if (node.kind !== 143 /* PropertyDeclaration */ && node.kind !== 142 /* PropertySignature */ && node.kind !== 151 /* IndexSignature */) { + else if (node.kind !== 144 /* PropertyDeclaration */ && node.kind !== 143 /* PropertySignature */ && node.kind !== 152 /* IndexSignature */) { return grammarErrorOnNode(modifier, ts.Diagnostics.readonly_modifier_can_only_appear_on_a_property_declaration_or_index_signature); } flags |= 64 /* Readonly */; @@ -29541,10 +30564,10 @@ 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 === 218 /* ClassDeclaration */) { + else if (node.parent.kind === 220 /* ClassDeclaration */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_class_element, "export"); } - else if (node.kind === 140 /* Parameter */) { + else if (node.kind === 141 /* Parameter */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "export"); } flags |= 1 /* Export */; @@ -29556,13 +30579,13 @@ var ts; 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 === 218 /* ClassDeclaration */) { + else if (node.parent.kind === 220 /* ClassDeclaration */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_class_element, "declare"); } - else if (node.kind === 140 /* Parameter */) { + else if (node.kind === 141 /* Parameter */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "declare"); } - else if (ts.isInAmbientContext(node.parent) && node.parent.kind === 223 /* ModuleBlock */) { + else if (ts.isInAmbientContext(node.parent) && node.parent.kind === 225 /* ModuleBlock */) { return grammarErrorOnNode(modifier, ts.Diagnostics.A_declare_modifier_cannot_be_used_in_an_already_ambient_context); } flags |= 2 /* Ambient */; @@ -29572,14 +30595,14 @@ var ts; if (flags & 128 /* Abstract */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "abstract"); } - if (node.kind !== 218 /* ClassDeclaration */) { - if (node.kind !== 145 /* MethodDeclaration */ && - node.kind !== 143 /* PropertyDeclaration */ && - node.kind !== 147 /* GetAccessor */ && - node.kind !== 148 /* SetAccessor */) { + if (node.kind !== 220 /* ClassDeclaration */) { + if (node.kind !== 146 /* MethodDeclaration */ && + node.kind !== 144 /* PropertyDeclaration */ && + node.kind !== 148 /* GetAccessor */ && + node.kind !== 149 /* SetAccessor */) { return grammarErrorOnNode(modifier, ts.Diagnostics.abstract_modifier_can_only_appear_on_a_class_method_or_property_declaration); } - if (!(node.parent.kind === 218 /* ClassDeclaration */ && node.parent.flags & 128 /* Abstract */)) { + if (!(node.parent.kind === 220 /* ClassDeclaration */ && node.parent.flags & 128 /* Abstract */)) { return grammarErrorOnNode(modifier, ts.Diagnostics.Abstract_methods_can_only_appear_within_an_abstract_class); } if (flags & 32 /* Static */) { @@ -29598,7 +30621,7 @@ var ts; 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 === 140 /* Parameter */) { + else if (node.kind === 141 /* Parameter */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "async"); } flags |= 256 /* Async */; @@ -29606,7 +30629,7 @@ var ts; break; } } - if (node.kind === 146 /* Constructor */) { + if (node.kind === 147 /* Constructor */) { if (flags & 32 /* Static */) { return grammarErrorOnNode(lastStatic, ts.Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration, "static"); } @@ -29621,10 +30644,10 @@ var ts; } return; } - else if ((node.kind === 226 /* ImportDeclaration */ || node.kind === 225 /* ImportEqualsDeclaration */) && flags & 2 /* Ambient */) { + else if ((node.kind === 229 /* ImportDeclaration */ || node.kind === 228 /* ImportEqualsDeclaration */) && flags & 2 /* Ambient */) { return grammarErrorOnNode(lastDeclare, ts.Diagnostics.A_0_modifier_cannot_be_used_with_an_import_declaration, "declare"); } - else if (node.kind === 140 /* Parameter */ && (flags & 28 /* AccessibilityModifier */) && ts.isBindingPattern(node.name)) { + else if (node.kind === 141 /* Parameter */ && (flags & 28 /* AccessibilityModifier */) && ts.isBindingPattern(node.name)) { return grammarErrorOnNode(node, ts.Diagnostics.A_parameter_property_may_not_be_a_binding_pattern); } if (flags & 256 /* Async */) { @@ -29636,10 +30659,10 @@ var ts; return grammarErrorOnNode(asyncModifier, ts.Diagnostics.Async_functions_are_only_available_when_targeting_ECMAScript_6_and_higher); } switch (node.kind) { - case 145 /* MethodDeclaration */: - case 217 /* FunctionDeclaration */: - case 177 /* FunctionExpression */: - case 178 /* ArrowFunction */: + case 146 /* MethodDeclaration */: + case 219 /* FunctionDeclaration */: + case 178 /* FunctionExpression */: + case 179 /* ArrowFunction */: if (!node.asteriskToken) { return false; } @@ -29705,7 +30728,7 @@ var ts; checkGrammarParameterList(node.parameters) || checkGrammarArrowFunction(node, file); } function checkGrammarArrowFunction(node, file) { - if (node.kind === 178 /* ArrowFunction */) { + if (node.kind === 179 /* ArrowFunction */) { var arrowFunction = node; var startLine = ts.getLineAndCharacterOfPosition(file, arrowFunction.equalsGreaterThanToken.pos).line; var endLine = ts.getLineAndCharacterOfPosition(file, arrowFunction.equalsGreaterThanToken.end).line; @@ -29768,7 +30791,7 @@ var ts; 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 === 191 /* OmittedExpression */) { + if (arg.kind === 192 /* OmittedExpression */) { return grammarErrorAtPos(sourceFile, arg.pos, 0, ts.Diagnostics.Argument_expression_expected); } } @@ -29842,19 +30865,19 @@ var ts; } function checkGrammarComputedPropertyName(node) { // If node is not a computedPropertyName, just skip the grammar checking - if (node.kind !== 138 /* ComputedPropertyName */) { + if (node.kind !== 139 /* ComputedPropertyName */) { return false; } var computedPropertyName = node; - if (computedPropertyName.expression.kind === 185 /* BinaryExpression */ && computedPropertyName.expression.operatorToken.kind === 24 /* CommaToken */) { + if (computedPropertyName.expression.kind === 186 /* BinaryExpression */ && computedPropertyName.expression.operatorToken.kind === 24 /* 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 === 217 /* FunctionDeclaration */ || - node.kind === 177 /* FunctionExpression */ || - node.kind === 145 /* MethodDeclaration */); + ts.Debug.assert(node.kind === 219 /* FunctionDeclaration */ || + node.kind === 178 /* FunctionExpression */ || + node.kind === 146 /* MethodDeclaration */); if (ts.isInAmbientContext(node)) { return grammarErrorOnNode(node.asteriskToken, ts.Diagnostics.Generators_are_not_allowed_in_an_ambient_context); } @@ -29878,21 +30901,21 @@ var ts; var SetAccessor = 4; var GetOrSetAccessor = GetAccessor | SetAccessor; var _loop_1 = function(prop) { - var name_18 = prop.name; - if (prop.kind === 191 /* OmittedExpression */ || - name_18.kind === 138 /* ComputedPropertyName */) { + var name_20 = prop.name; + if (prop.kind === 192 /* OmittedExpression */ || + name_20.kind === 139 /* ComputedPropertyName */) { // If the name is not a ComputedPropertyName, the grammar checking will skip it - checkGrammarComputedPropertyName(name_18); + checkGrammarComputedPropertyName(name_20); return "continue"; } - if (prop.kind === 250 /* ShorthandPropertyAssignment */ && !inDestructuring && prop.objectAssignmentInitializer) { + if (prop.kind === 253 /* 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) }; } // 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 !== 145 /* MethodDeclaration */) { + if (mod.kind !== 118 /* AsyncKeyword */ || prop.kind !== 146 /* MethodDeclaration */) { grammarErrorOnNode(mod, ts.Diagnostics._0_modifier_cannot_be_used_here, ts.getTextOfNode(mod)); } }); @@ -29905,44 +30928,44 @@ 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 === 249 /* PropertyAssignment */ || prop.kind === 250 /* ShorthandPropertyAssignment */) { + if (prop.kind === 252 /* PropertyAssignment */ || prop.kind === 253 /* ShorthandPropertyAssignment */) { // Grammar checking for computedPropertyName and shorthandPropertyAssignment checkGrammarForInvalidQuestionMark(prop, prop.questionToken, ts.Diagnostics.An_object_member_cannot_be_declared_optional); - if (name_18.kind === 8 /* NumericLiteral */) { - checkGrammarNumericLiteral(name_18); + if (name_20.kind === 8 /* NumericLiteral */) { + checkGrammarNumericLiteral(name_20); } currentKind = Property; } - else if (prop.kind === 145 /* MethodDeclaration */) { + else if (prop.kind === 146 /* MethodDeclaration */) { currentKind = Property; } - else if (prop.kind === 147 /* GetAccessor */) { + else if (prop.kind === 148 /* GetAccessor */) { currentKind = GetAccessor; } - else if (prop.kind === 148 /* SetAccessor */) { + else if (prop.kind === 149 /* SetAccessor */) { currentKind = SetAccessor; } else { ts.Debug.fail("Unexpected syntax kind:" + prop.kind); } - if (!ts.hasProperty(seen, name_18.text)) { - seen[name_18.text] = currentKind; + if (!ts.hasProperty(seen, name_20.text)) { + seen[name_20.text] = currentKind; } else { - var existingKind = seen[name_18.text]; + var existingKind = seen[name_20.text]; if (currentKind === Property && existingKind === Property) { return "continue"; } else if ((currentKind & GetOrSetAccessor) && (existingKind & GetOrSetAccessor)) { if (existingKind !== GetOrSetAccessor && currentKind !== existingKind) { - seen[name_18.text] = currentKind | existingKind; + seen[name_20.text] = currentKind | existingKind; } else { - return { value: grammarErrorOnNode(name_18, ts.Diagnostics.An_object_literal_cannot_have_multiple_get_Slashset_accessors_with_the_same_name) }; + return { value: grammarErrorOnNode(name_20, ts.Diagnostics.An_object_literal_cannot_have_multiple_get_Slashset_accessors_with_the_same_name) }; } } else { - return { value: grammarErrorOnNode(name_18, ts.Diagnostics.An_object_literal_cannot_have_property_and_accessor_with_the_same_name) }; + return { value: grammarErrorOnNode(name_20, ts.Diagnostics.An_object_literal_cannot_have_property_and_accessor_with_the_same_name) }; } } }; @@ -29950,26 +30973,25 @@ var ts; var prop = _a[_i]; var state_2 = _loop_1(prop); if (typeof state_2 === "object") return state_2.value; - if (state_2 === "continue") continue; } } function checkGrammarJsxElement(node) { var seen = {}; for (var _i = 0, _a = node.attributes; _i < _a.length; _i++) { var attr = _a[_i]; - if (attr.kind === 243 /* JsxSpreadAttribute */) { + if (attr.kind === 246 /* JsxSpreadAttribute */) { continue; } var jsxAttr = attr; - var name_19 = jsxAttr.name; - if (!ts.hasProperty(seen, name_19.text)) { - seen[name_19.text] = true; + var name_21 = jsxAttr.name; + if (!ts.hasProperty(seen, name_21.text)) { + seen[name_21.text] = true; } else { - return grammarErrorOnNode(name_19, ts.Diagnostics.JSX_elements_cannot_have_multiple_attributes_with_the_same_name); + return grammarErrorOnNode(name_21, ts.Diagnostics.JSX_elements_cannot_have_multiple_attributes_with_the_same_name); } var initializer = jsxAttr.initializer; - if (initializer && initializer.kind === 244 /* JsxExpression */ && !initializer.expression) { + if (initializer && initializer.kind === 247 /* JsxExpression */ && !initializer.expression) { return grammarErrorOnNode(jsxAttr.initializer, ts.Diagnostics.JSX_attributes_must_only_be_assigned_a_non_empty_expression); } } @@ -29978,7 +31000,7 @@ var ts; if (checkGrammarStatementInAmbientContext(forInOrOfStatement)) { return true; } - if (forInOrOfStatement.initializer.kind === 216 /* VariableDeclarationList */) { + if (forInOrOfStatement.initializer.kind === 218 /* VariableDeclarationList */) { var variableList = forInOrOfStatement.initializer; if (!checkGrammarVariableDeclarationList(variableList)) { var declarations = variableList.declarations; @@ -29993,20 +31015,20 @@ var ts; return false; } if (declarations.length > 1) { - var diagnostic = forInOrOfStatement.kind === 204 /* ForInStatement */ + var diagnostic = forInOrOfStatement.kind === 206 /* 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 === 204 /* ForInStatement */ + var diagnostic = forInOrOfStatement.kind === 206 /* 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 === 204 /* ForInStatement */ + var diagnostic = forInOrOfStatement.kind === 206 /* 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); @@ -30029,10 +31051,10 @@ var ts; else if (accessor.typeParameters) { return grammarErrorOnNode(accessor.name, ts.Diagnostics.An_accessor_cannot_have_type_parameters); } - else if (kind === 147 /* GetAccessor */ && accessor.parameters.length) { + else if (kind === 148 /* GetAccessor */ && accessor.parameters.length) { return grammarErrorOnNode(accessor.name, ts.Diagnostics.A_get_accessor_cannot_have_parameters); } - else if (kind === 148 /* SetAccessor */) { + else if (kind === 149 /* SetAccessor */) { if (accessor.type) { return grammarErrorOnNode(accessor.name, ts.Diagnostics.A_set_accessor_cannot_have_a_return_type_annotation); } @@ -30067,7 +31089,7 @@ var ts; checkGrammarForGenerator(node)) { return true; } - if (node.parent.kind === 169 /* ObjectLiteralExpression */) { + if (node.parent.kind === 170 /* ObjectLiteralExpression */) { if (checkGrammarForInvalidQuestionMark(node, node.questionToken, ts.Diagnostics.A_class_member_cannot_be_declared_optional)) { return true; } @@ -30091,10 +31113,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 === 219 /* InterfaceDeclaration */) { + else if (node.parent.kind === 221 /* 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 === 157 /* TypeLiteral */) { + else if (node.parent.kind === 158 /* TypeLiteral */) { return checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_a_type_literal_must_directly_refer_to_a_built_in_symbol); } } @@ -30105,11 +31127,11 @@ var ts; return grammarErrorOnNode(node, ts.Diagnostics.Jump_target_cannot_cross_function_boundary); } switch (current.kind) { - case 211 /* LabeledStatement */: + case 213 /* 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 === 206 /* ContinueStatement */ + var isMisplacedContinueLabel = node.kind === 208 /* 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); @@ -30117,8 +31139,8 @@ var ts; return false; } break; - case 210 /* SwitchStatement */: - if (node.kind === 207 /* BreakStatement */ && !node.label) { + case 212 /* SwitchStatement */: + if (node.kind === 209 /* BreakStatement */ && !node.label) { // unlabeled break within switch statement - ok return false; } @@ -30133,13 +31155,13 @@ var ts; current = current.parent; } if (node.label) { - var message = node.kind === 207 /* BreakStatement */ + var message = node.kind === 209 /* 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 === 207 /* BreakStatement */ + var message = node.kind === 209 /* 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); @@ -30151,7 +31173,7 @@ var ts; if (node !== ts.lastOrUndefined(elements)) { return grammarErrorOnNode(node, ts.Diagnostics.A_rest_element_must_be_last_in_an_array_destructuring_pattern); } - if (node.name.kind === 166 /* ArrayBindingPattern */ || node.name.kind === 165 /* ObjectBindingPattern */) { + if (node.name.kind === 167 /* ArrayBindingPattern */ || node.name.kind === 166 /* ObjectBindingPattern */) { return grammarErrorOnNode(node.name, ts.Diagnostics.A_rest_element_cannot_contain_a_binding_pattern); } if (node.initializer) { @@ -30161,7 +31183,7 @@ var ts; } } function checkGrammarVariableDeclaration(node) { - if (node.parent.parent.kind !== 204 /* ForInStatement */ && node.parent.parent.kind !== 205 /* ForOfStatement */) { + if (node.parent.parent.kind !== 206 /* ForInStatement */ && node.parent.parent.kind !== 207 /* ForOfStatement */) { if (ts.isInAmbientContext(node)) { if (node.initializer) { // Error on equals token which immediate precedes the initializer @@ -30197,7 +31219,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 !== 191 /* OmittedExpression */) { + if (element.kind !== 192 /* OmittedExpression */) { checkGrammarNameInLetOrConstDeclarations(element.name); } } @@ -30214,15 +31236,15 @@ var ts; } function allowLetAndConstDeclarations(parent) { switch (parent.kind) { - case 200 /* IfStatement */: - case 201 /* DoStatement */: - case 202 /* WhileStatement */: - case 209 /* WithStatement */: - case 203 /* ForStatement */: - case 204 /* ForInStatement */: - case 205 /* ForOfStatement */: + case 202 /* IfStatement */: + case 203 /* DoStatement */: + case 204 /* WhileStatement */: + case 211 /* WithStatement */: + case 205 /* ForStatement */: + case 206 /* ForInStatement */: + case 207 /* ForOfStatement */: return false; - case 211 /* LabeledStatement */: + case 213 /* LabeledStatement */: return allowLetAndConstDeclarations(parent.parent); } return true; @@ -30278,7 +31300,7 @@ var ts; return true; } } - else if (node.parent.kind === 219 /* InterfaceDeclaration */) { + else if (node.parent.kind === 221 /* InterfaceDeclaration */) { if (checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_an_interface_must_directly_refer_to_a_built_in_symbol)) { return true; } @@ -30286,7 +31308,7 @@ var ts; return grammarErrorOnNode(node.initializer, ts.Diagnostics.An_interface_property_cannot_have_an_initializer); } } - else if (node.parent.kind === 157 /* TypeLiteral */) { + else if (node.parent.kind === 158 /* 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; } @@ -30311,12 +31333,12 @@ var ts; // export_opt AmbientDeclaration // // TODO: The spec needs to be amended to reflect this grammar. - if (node.kind === 219 /* InterfaceDeclaration */ || - node.kind === 220 /* TypeAliasDeclaration */ || - node.kind === 226 /* ImportDeclaration */ || - node.kind === 225 /* ImportEqualsDeclaration */ || - node.kind === 232 /* ExportDeclaration */ || - node.kind === 231 /* ExportAssignment */ || + if (node.kind === 221 /* InterfaceDeclaration */ || + node.kind === 222 /* TypeAliasDeclaration */ || + node.kind === 229 /* ImportDeclaration */ || + node.kind === 228 /* ImportEqualsDeclaration */ || + node.kind === 235 /* ExportDeclaration */ || + node.kind === 234 /* ExportAssignment */ || (node.flags & 2 /* Ambient */) || (node.flags & (1 /* Export */ | 512 /* Default */))) { return false; @@ -30326,7 +31348,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 === 197 /* VariableStatement */) { + if (ts.isDeclaration(decl) || decl.kind === 199 /* VariableStatement */) { if (checkGrammarTopLevelElementForRequiredDeclareModifier(decl)) { return true; } @@ -30352,7 +31374,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 === 196 /* Block */ || node.parent.kind === 223 /* ModuleBlock */ || node.parent.kind === 252 /* SourceFile */) { + if (node.parent.kind === 198 /* Block */ || node.parent.kind === 225 /* ModuleBlock */ || node.parent.kind === 255 /* SourceFile */) { var links_1 = getNodeLinks(node.parent); // Check if the containing block ever report this error if (!links_1.hasReportedStatementInAmbientContext) { @@ -30708,7 +31730,7 @@ var ts; function getDeclarationDiagnostics(host, resolver, targetSourceFile) { var declarationDiagnostics = ts.createDiagnosticCollection(); ts.forEachExpectedEmitFile(host, getDeclarationDiagnosticsFromFile, targetSourceFile); - return declarationDiagnostics.getDiagnostics(targetSourceFile.fileName); + return declarationDiagnostics.getDiagnostics(targetSourceFile ? targetSourceFile.fileName : undefined); function getDeclarationDiagnosticsFromFile(_a, sources, isBundledEmit) { var declarationFilePath = _a.declarationFilePath; emitDeclarations(host, resolver, declarationDiagnostics, declarationFilePath, sources, isBundledEmit); @@ -30788,7 +31810,7 @@ var ts; var oldWriter = writer; ts.forEach(moduleElementDeclarationEmitInfo, function (aliasEmitInfo) { if (aliasEmitInfo.isVisible && !aliasEmitInfo.asynchronousOutput) { - ts.Debug.assert(aliasEmitInfo.node.kind === 226 /* ImportDeclaration */); + ts.Debug.assert(aliasEmitInfo.node.kind === 229 /* ImportDeclaration */); createAndSetNewTextWriterWithSymbolWriter(); ts.Debug.assert(aliasEmitInfo.indent === 0 || (aliasEmitInfo.indent === 1 && isBundledEmit)); for (var i = 0; i < aliasEmitInfo.indent; i++) { @@ -30857,10 +31879,10 @@ var ts; var oldWriter = writer; ts.forEach(nodes, function (declaration) { var nodeToCheck; - if (declaration.kind === 215 /* VariableDeclaration */) { + if (declaration.kind === 217 /* VariableDeclaration */) { nodeToCheck = declaration.parent.parent; } - else if (declaration.kind === 229 /* NamedImports */ || declaration.kind === 230 /* ImportSpecifier */ || declaration.kind === 227 /* ImportClause */) { + else if (declaration.kind === 232 /* NamedImports */ || declaration.kind === 233 /* ImportSpecifier */ || declaration.kind === 230 /* ImportClause */) { ts.Debug.fail("We should be getting ImportDeclaration instead to write"); } else { @@ -30878,7 +31900,7 @@ var ts; // 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 === 226 /* ImportDeclaration */) { + if (moduleElementEmitInfo.node.kind === 229 /* 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; @@ -30888,12 +31910,12 @@ var ts; for (var declarationIndent = moduleElementEmitInfo.indent; declarationIndent; declarationIndent--) { increaseIndent(); } - if (nodeToCheck.kind === 222 /* ModuleDeclaration */) { + if (nodeToCheck.kind === 224 /* ModuleDeclaration */) { ts.Debug.assert(asynchronousSubModuleDeclarationEmitInfo === undefined); asynchronousSubModuleDeclarationEmitInfo = []; } writeModuleElement(nodeToCheck); - if (nodeToCheck.kind === 222 /* ModuleDeclaration */) { + if (nodeToCheck.kind === 224 /* ModuleDeclaration */) { moduleElementEmitInfo.subModuleElementDeclarationEmitInfo = asynchronousSubModuleDeclarationEmitInfo; asynchronousSubModuleDeclarationEmitInfo = undefined; } @@ -31001,35 +32023,37 @@ var ts; case 120 /* BooleanKeyword */: case 132 /* SymbolKeyword */: case 103 /* VoidKeyword */: - case 163 /* ThisType */: - case 164 /* StringLiteralType */: + case 134 /* UndefinedKeyword */: + case 93 /* NullKeyword */: + case 164 /* ThisType */: + case 165 /* StringLiteralType */: return writeTextOfNode(currentText, type); - case 192 /* ExpressionWithTypeArguments */: + case 193 /* ExpressionWithTypeArguments */: return emitExpressionWithTypeArguments(type); - case 153 /* TypeReference */: + case 154 /* TypeReference */: return emitTypeReference(type); - case 156 /* TypeQuery */: + case 157 /* TypeQuery */: return emitTypeQuery(type); - case 158 /* ArrayType */: + case 159 /* ArrayType */: return emitArrayType(type); - case 159 /* TupleType */: + case 160 /* TupleType */: return emitTupleType(type); - case 160 /* UnionType */: + case 161 /* UnionType */: return emitUnionType(type); - case 161 /* IntersectionType */: + case 162 /* IntersectionType */: return emitIntersectionType(type); - case 162 /* ParenthesizedType */: + case 163 /* ParenthesizedType */: return emitParenType(type); - case 154 /* FunctionType */: - case 155 /* ConstructorType */: + case 155 /* FunctionType */: + case 156 /* ConstructorType */: return emitSignatureDeclarationWithJsDocComments(type); - case 157 /* TypeLiteral */: + case 158 /* TypeLiteral */: return emitTypeLiteral(type); case 69 /* Identifier */: return emitEntityName(type); - case 137 /* QualifiedName */: + case 138 /* QualifiedName */: return emitEntityName(type); - case 152 /* TypePredicate */: + case 153 /* TypePredicate */: return emitTypePredicate(type); } function writeEntityName(entityName) { @@ -31037,8 +32061,8 @@ var ts; writeTextOfNode(currentText, entityName); } else { - var left = entityName.kind === 137 /* QualifiedName */ ? entityName.left : entityName.expression; - var right = entityName.kind === 137 /* QualifiedName */ ? entityName.right : entityName.name; + var left = entityName.kind === 138 /* QualifiedName */ ? entityName.left : entityName.expression; + var right = entityName.kind === 138 /* QualifiedName */ ? entityName.right : entityName.name; writeEntityName(left); write("."); writeTextOfNode(currentText, right); @@ -31047,13 +32071,13 @@ var ts; function emitEntityName(entityName) { var visibilityResult = resolver.isEntityNameVisible(entityName, // Aliases can be written asynchronously so use correct enclosing declaration - entityName.parent.kind === 225 /* ImportEqualsDeclaration */ ? entityName.parent : enclosingDeclaration); + entityName.parent.kind === 228 /* ImportEqualsDeclaration */ ? entityName.parent : enclosingDeclaration); handleSymbolAccessibilityError(visibilityResult); writeEntityName(entityName); } function emitExpressionWithTypeArguments(node) { if (ts.isSupportedExpressionWithTypeArguments(node)) { - ts.Debug.assert(node.expression.kind === 69 /* Identifier */ || node.expression.kind === 170 /* PropertyAccessExpression */); + ts.Debug.assert(node.expression.kind === 69 /* Identifier */ || node.expression.kind === 171 /* PropertyAccessExpression */); emitEntityName(node.expression); if (node.typeArguments) { write("<"); @@ -31132,9 +32156,9 @@ var ts; var count = 0; while (true) { count++; - var name_20 = baseName + "_" + count; - if (!ts.hasProperty(currentIdentifiers, name_20)) { - return name_20; + var name_22 = baseName + "_" + count; + if (!ts.hasProperty(currentIdentifiers, name_22)) { + return name_22; } } } @@ -31146,7 +32170,10 @@ var ts; else { // Expression var tempVarName = getExportDefaultTempVariableName(); - write("declare var "); + if (!noDeclare) { + write("declare "); + } + write("var "); write(tempVarName); write(": "); writer.getSymbolAccessibilityDiagnostic = getDefaultExportAccessibilityDiagnostic; @@ -31178,10 +32205,10 @@ var ts; if (isModuleElementVisible) { writeModuleElement(node); } - else if (node.kind === 225 /* ImportEqualsDeclaration */ || - (node.parent.kind === 252 /* SourceFile */ && isCurrentFileExternalModule)) { + else if (node.kind === 228 /* ImportEqualsDeclaration */ || + (node.parent.kind === 255 /* SourceFile */ && isCurrentFileExternalModule)) { var isVisible = void 0; - if (asynchronousSubModuleDeclarationEmitInfo && node.parent.kind !== 252 /* SourceFile */) { + if (asynchronousSubModuleDeclarationEmitInfo && node.parent.kind !== 255 /* SourceFile */) { // Import declaration of another module that is visited async so lets put it in right spot asynchronousSubModuleDeclarationEmitInfo.push({ node: node, @@ -31191,7 +32218,7 @@ var ts; }); } else { - if (node.kind === 226 /* ImportDeclaration */) { + if (node.kind === 229 /* ImportDeclaration */) { var importDeclaration = node; if (importDeclaration.importClause) { isVisible = (importDeclaration.importClause.name && resolver.isDeclarationVisible(importDeclaration.importClause)) || @@ -31209,23 +32236,23 @@ var ts; } function writeModuleElement(node) { switch (node.kind) { - case 217 /* FunctionDeclaration */: + case 219 /* FunctionDeclaration */: return writeFunctionDeclaration(node); - case 197 /* VariableStatement */: + case 199 /* VariableStatement */: return writeVariableStatement(node); - case 219 /* InterfaceDeclaration */: + case 221 /* InterfaceDeclaration */: return writeInterfaceDeclaration(node); - case 218 /* ClassDeclaration */: + case 220 /* ClassDeclaration */: return writeClassDeclaration(node); - case 220 /* TypeAliasDeclaration */: + case 222 /* TypeAliasDeclaration */: return writeTypeAliasDeclaration(node); - case 221 /* EnumDeclaration */: + case 223 /* EnumDeclaration */: return writeEnumDeclaration(node); - case 222 /* ModuleDeclaration */: + case 224 /* ModuleDeclaration */: return writeModuleDeclaration(node); - case 225 /* ImportEqualsDeclaration */: + case 228 /* ImportEqualsDeclaration */: return writeImportEqualsDeclaration(node); - case 226 /* ImportDeclaration */: + case 229 /* ImportDeclaration */: return writeImportDeclaration(node); default: ts.Debug.fail("Unknown symbol kind"); @@ -31233,7 +32260,7 @@ var ts; } 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 === 252 /* SourceFile */) { + if (node.parent.kind === 255 /* SourceFile */) { // If the node is exported if (node.flags & 1 /* Export */) { write("export "); @@ -31241,7 +32268,7 @@ var ts; if (node.flags & 512 /* Default */) { write("default "); } - else if (node.kind !== 219 /* InterfaceDeclaration */ && !noDeclare) { + else if (node.kind !== 221 /* InterfaceDeclaration */ && !noDeclare) { write("declare "); } } @@ -31293,7 +32320,7 @@ var ts; } function isVisibleNamedBinding(namedBindings) { if (namedBindings) { - if (namedBindings.kind === 228 /* NamespaceImport */) { + if (namedBindings.kind === 231 /* NamespaceImport */) { return resolver.isDeclarationVisible(namedBindings); } else { @@ -31317,7 +32344,7 @@ var ts; // If the default binding was emitted, write the separated write(", "); } - if (node.importClause.namedBindings.kind === 228 /* NamespaceImport */) { + if (node.importClause.namedBindings.kind === 231 /* NamespaceImport */) { write("* as "); writeTextOfNode(currentText, node.importClause.namedBindings.name); } @@ -31338,13 +32365,13 @@ var ts; // 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 !== 222 /* ModuleDeclaration */; + resultHasExternalModuleIndicator = resultHasExternalModuleIndicator || parent.kind !== 224 /* ModuleDeclaration */; var moduleSpecifier; - if (parent.kind === 225 /* ImportEqualsDeclaration */) { + if (parent.kind === 228 /* ImportEqualsDeclaration */) { var node = parent; moduleSpecifier = ts.getExternalModuleImportEqualsDeclarationExpression(node); } - else if (parent.kind === 222 /* ModuleDeclaration */) { + else if (parent.kind === 224 /* ModuleDeclaration */) { moduleSpecifier = parent.name; } else { @@ -31354,9 +32381,9 @@ var ts; if (moduleSpecifier.kind === 9 /* StringLiteral */ && isBundledEmit && (compilerOptions.out || compilerOptions.outFile)) { var moduleName = ts.getExternalModuleNameFromDeclaration(host, resolver, parent); if (moduleName) { - write("\""); + write('"'); write(moduleName); - write("\""); + write('"'); return; } } @@ -31414,7 +32441,7 @@ var ts; writeTextOfNode(currentText, node.name); } } - while (node.body.kind !== 223 /* ModuleBlock */) { + while (node.body.kind !== 225 /* ModuleBlock */) { node = node.body; write("."); writeTextOfNode(currentText, node.name); @@ -31479,7 +32506,7 @@ var ts; writeLine(); } function isPrivateMethodTypeParameter(node) { - return node.parent.kind === 145 /* MethodDeclaration */ && (node.parent.flags & 8 /* Private */); + return node.parent.kind === 146 /* MethodDeclaration */ && (node.parent.flags & 8 /* Private */); } function emitTypeParameters(typeParameters) { function emitTypeParameter(node) { @@ -31490,15 +32517,15 @@ var ts; // 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 === 154 /* FunctionType */ || - node.parent.kind === 155 /* ConstructorType */ || - (node.parent.parent && node.parent.parent.kind === 157 /* TypeLiteral */)) { - ts.Debug.assert(node.parent.kind === 145 /* MethodDeclaration */ || - node.parent.kind === 144 /* MethodSignature */ || - node.parent.kind === 154 /* FunctionType */ || - node.parent.kind === 155 /* ConstructorType */ || - node.parent.kind === 149 /* CallSignature */ || - node.parent.kind === 150 /* ConstructSignature */); + if (node.parent.kind === 155 /* FunctionType */ || + node.parent.kind === 156 /* ConstructorType */ || + (node.parent.parent && node.parent.parent.kind === 158 /* TypeLiteral */)) { + ts.Debug.assert(node.parent.kind === 146 /* MethodDeclaration */ || + node.parent.kind === 145 /* MethodSignature */ || + node.parent.kind === 155 /* FunctionType */ || + node.parent.kind === 156 /* ConstructorType */ || + node.parent.kind === 150 /* CallSignature */ || + node.parent.kind === 151 /* ConstructSignature */); emitType(node.constraint); } else { @@ -31509,31 +32536,31 @@ var ts; // Type parameter constraints are named by user so we should always be able to name it var diagnosticMessage; switch (node.parent.kind) { - case 218 /* ClassDeclaration */: + case 220 /* ClassDeclaration */: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_class_has_or_is_using_private_name_1; break; - case 219 /* InterfaceDeclaration */: + case 221 /* InterfaceDeclaration */: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1; break; - case 150 /* ConstructSignature */: + case 151 /* ConstructSignature */: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1; break; - case 149 /* CallSignature */: + case 150 /* CallSignature */: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1; break; - case 145 /* MethodDeclaration */: - case 144 /* MethodSignature */: + case 146 /* MethodDeclaration */: + case 145 /* 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 === 218 /* ClassDeclaration */) { + else if (node.parent.parent.kind === 220 /* 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 217 /* FunctionDeclaration */: + case 219 /* FunctionDeclaration */: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_function_has_or_is_using_private_name_1; break; default: @@ -31564,10 +32591,14 @@ var ts; else if (!isImplementsList && node.expression.kind === 93 /* NullKeyword */) { write("null"); } + else { + writer.getSymbolAccessibilityDiagnostic = getHeritageClauseVisibilityError; + resolver.writeBaseConstructorTypeOfClass(enclosingDeclaration, enclosingDeclaration, 2 /* UseTypeOfFunction */, writer); + } function getHeritageClauseVisibilityError(symbolAccessibilityResult) { var diagnosticMessage; // Heritage clause is written by user so it can always be named - if (node.parent.parent.kind === 218 /* ClassDeclaration */) { + if (node.parent.parent.kind === 220 /* 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 : @@ -31651,7 +32682,7 @@ var ts; 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 !== 215 /* VariableDeclaration */ || resolver.isDeclarationVisible(node)) { + if (node.kind !== 217 /* VariableDeclaration */ || resolver.isDeclarationVisible(node)) { if (ts.isBindingPattern(node.name)) { emitBindingPattern(node.name); } @@ -31661,10 +32692,10 @@ var ts; // what we want, namely the name expression enclosed in brackets. writeTextOfNode(currentText, node.name); // If optional property emit ? - if ((node.kind === 143 /* PropertyDeclaration */ || node.kind === 142 /* PropertySignature */) && ts.hasQuestionToken(node)) { + if ((node.kind === 144 /* PropertyDeclaration */ || node.kind === 143 /* PropertySignature */) && ts.hasQuestionToken(node)) { write("?"); } - if ((node.kind === 143 /* PropertyDeclaration */ || node.kind === 142 /* PropertySignature */) && node.parent.kind === 157 /* TypeLiteral */) { + if ((node.kind === 144 /* PropertyDeclaration */ || node.kind === 143 /* PropertySignature */) && node.parent.kind === 158 /* TypeLiteral */) { emitTypeOfVariableDeclarationFromTypeLiteral(node); } else if (!(node.flags & 8 /* Private */)) { @@ -31673,14 +32704,14 @@ var ts; } } function getVariableDeclarationTypeVisibilityDiagnosticMessage(symbolAccessibilityResult) { - if (node.kind === 215 /* VariableDeclaration */) { + if (node.kind === 217 /* 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 === 143 /* PropertyDeclaration */ || node.kind === 142 /* PropertySignature */) { + else if (node.kind === 144 /* PropertyDeclaration */ || node.kind === 143 /* PropertySignature */) { // TODO(jfreeman): Deal with computed properties in error reporting. if (node.flags & 32 /* Static */) { return symbolAccessibilityResult.errorModuleName ? @@ -31689,7 +32720,7 @@ var ts; 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 === 218 /* ClassDeclaration */) { + else if (node.parent.kind === 220 /* 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 : @@ -31721,7 +32752,7 @@ var ts; var elements = []; for (var _i = 0, _a = bindingPattern.elements; _i < _a.length; _i++) { var element = _a[_i]; - if (element.kind !== 191 /* OmittedExpression */) { + if (element.kind !== 192 /* OmittedExpression */) { elements.push(element); } } @@ -31791,7 +32822,7 @@ var ts; var type = getTypeAnnotationFromAccessor(node); if (!type) { // couldn't get type for the first accessor, try the another one - var anotherAccessor = node.kind === 147 /* GetAccessor */ ? accessors.setAccessor : accessors.getAccessor; + var anotherAccessor = node.kind === 148 /* GetAccessor */ ? accessors.setAccessor : accessors.getAccessor; type = getTypeAnnotationFromAccessor(anotherAccessor); if (type) { accessorWithTypeAnnotation = anotherAccessor; @@ -31804,7 +32835,7 @@ var ts; } function getTypeAnnotationFromAccessor(accessor) { if (accessor) { - return accessor.kind === 147 /* GetAccessor */ + return accessor.kind === 148 /* GetAccessor */ ? accessor.type // Getter - return type : accessor.parameters.length > 0 ? accessor.parameters[0].type // Setter parameter type @@ -31813,7 +32844,7 @@ var ts; } function getAccessorDeclarationTypeVisibilityError(symbolAccessibilityResult) { var diagnosticMessage; - if (accessorWithTypeAnnotation.kind === 148 /* SetAccessor */) { + if (accessorWithTypeAnnotation.kind === 149 /* 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 ? @@ -31863,17 +32894,17 @@ var ts; // so no need to verify if the declaration is visible if (!resolver.isImplementationOfOverload(node)) { emitJsDocComments(node); - if (node.kind === 217 /* FunctionDeclaration */) { + if (node.kind === 219 /* FunctionDeclaration */) { emitModuleElementDeclarationFlags(node); } - else if (node.kind === 145 /* MethodDeclaration */ || node.kind === 146 /* Constructor */) { + else if (node.kind === 146 /* MethodDeclaration */ || node.kind === 147 /* Constructor */) { emitClassMemberDeclarationFlags(node.flags); } - if (node.kind === 217 /* FunctionDeclaration */) { + if (node.kind === 219 /* FunctionDeclaration */) { write("function "); writeTextOfNode(currentText, node.name); } - else if (node.kind === 146 /* Constructor */) { + else if (node.kind === 147 /* Constructor */) { write("constructor"); } else { @@ -31892,14 +32923,14 @@ var ts; function emitSignatureDeclaration(node) { var prevEnclosingDeclaration = enclosingDeclaration; enclosingDeclaration = node; - if (node.kind === 151 /* IndexSignature */) { + if (node.kind === 152 /* IndexSignature */) { // Index signature can have readonly modifier emitClassMemberDeclarationFlags(node.flags); write("["); } else { // Construct signature or constructor type write new Signature - if (node.kind === 150 /* ConstructSignature */ || node.kind === 155 /* ConstructorType */) { + if (node.kind === 151 /* ConstructSignature */ || node.kind === 156 /* ConstructorType */) { write("new "); } emitTypeParameters(node.typeParameters); @@ -31907,22 +32938,22 @@ var ts; } // Parameters emitCommaList(node.parameters, emitParameterDeclaration); - if (node.kind === 151 /* IndexSignature */) { + if (node.kind === 152 /* IndexSignature */) { write("]"); } else { write(")"); } // If this is not a constructor and is not private, emit the return type - var isFunctionTypeOrConstructorType = node.kind === 154 /* FunctionType */ || node.kind === 155 /* ConstructorType */; - if (isFunctionTypeOrConstructorType || node.parent.kind === 157 /* TypeLiteral */) { + var isFunctionTypeOrConstructorType = node.kind === 155 /* FunctionType */ || node.kind === 156 /* ConstructorType */; + if (isFunctionTypeOrConstructorType || node.parent.kind === 158 /* TypeLiteral */) { // Emit type literal signature return type only if specified if (node.type) { write(isFunctionTypeOrConstructorType ? " => " : ": "); emitType(node.type); } } - else if (node.kind !== 146 /* Constructor */ && !(node.flags & 8 /* Private */)) { + else if (node.kind !== 147 /* Constructor */ && !(node.flags & 8 /* Private */)) { writeReturnTypeAtSignature(node, getReturnTypeVisibilityError); } enclosingDeclaration = prevEnclosingDeclaration; @@ -31933,26 +32964,26 @@ var ts; function getReturnTypeVisibilityError(symbolAccessibilityResult) { var diagnosticMessage; switch (node.kind) { - case 150 /* ConstructSignature */: + case 151 /* 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 149 /* CallSignature */: + case 150 /* 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 151 /* IndexSignature */: + case 152 /* 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 145 /* MethodDeclaration */: - case 144 /* MethodSignature */: + case 146 /* MethodDeclaration */: + case 145 /* MethodSignature */: if (node.flags & 32 /* Static */) { diagnosticMessage = symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* CannotBeNamed */ ? @@ -31960,7 +32991,7 @@ var ts; 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 === 218 /* ClassDeclaration */) { + else if (node.parent.kind === 220 /* 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 : @@ -31974,7 +33005,7 @@ var ts; ts.Diagnostics.Return_type_of_method_from_exported_interface_has_or_is_using_private_name_0; } break; - case 217 /* FunctionDeclaration */: + case 219 /* 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 : @@ -32009,9 +33040,9 @@ var ts; write("?"); } decreaseIndent(); - if (node.parent.kind === 154 /* FunctionType */ || - node.parent.kind === 155 /* ConstructorType */ || - node.parent.parent.kind === 157 /* TypeLiteral */) { + if (node.parent.kind === 155 /* FunctionType */ || + node.parent.kind === 156 /* ConstructorType */ || + node.parent.parent.kind === 158 /* TypeLiteral */) { emitTypeOfVariableDeclarationFromTypeLiteral(node); } else if (!(node.parent.flags & 8 /* Private */)) { @@ -32027,24 +33058,24 @@ var ts; } function getParameterDeclarationTypeVisibilityDiagnosticMessage(symbolAccessibilityResult) { switch (node.parent.kind) { - case 146 /* Constructor */: + case 147 /* 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 150 /* ConstructSignature */: + case 151 /* 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 149 /* CallSignature */: + case 150 /* 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 145 /* MethodDeclaration */: - case 144 /* MethodSignature */: + case 146 /* MethodDeclaration */: + case 145 /* MethodSignature */: if (node.parent.flags & 32 /* Static */) { return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* CannotBeNamed */ ? @@ -32052,7 +33083,7 @@ var ts; 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 === 218 /* ClassDeclaration */) { + else if (node.parent.parent.kind === 220 /* 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 : @@ -32065,7 +33096,7 @@ var ts; 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 217 /* FunctionDeclaration */: + case 219 /* 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 : @@ -32077,12 +33108,12 @@ var ts; } function emitBindingPattern(bindingPattern) { // We have to explicitly emit square bracket and bracket because these tokens are not store inside the node. - if (bindingPattern.kind === 165 /* ObjectBindingPattern */) { + if (bindingPattern.kind === 166 /* ObjectBindingPattern */) { write("{"); emitCommaList(bindingPattern.elements, emitBindingElement); write("}"); } - else if (bindingPattern.kind === 166 /* ArrayBindingPattern */) { + else if (bindingPattern.kind === 167 /* ArrayBindingPattern */) { write("["); var elements = bindingPattern.elements; emitCommaList(elements, emitBindingElement); @@ -32093,7 +33124,7 @@ var ts; } } function emitBindingElement(bindingElement) { - if (bindingElement.kind === 191 /* OmittedExpression */) { + if (bindingElement.kind === 192 /* 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) @@ -32102,7 +33133,7 @@ var ts; // emit : function foo([ , x, , ]) {} write(" "); } - else if (bindingElement.kind === 167 /* BindingElement */) { + else if (bindingElement.kind === 168 /* 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" @@ -32141,40 +33172,40 @@ var ts; } function emitNode(node) { switch (node.kind) { - case 217 /* FunctionDeclaration */: - case 222 /* ModuleDeclaration */: - case 225 /* ImportEqualsDeclaration */: - case 219 /* InterfaceDeclaration */: - case 218 /* ClassDeclaration */: - case 220 /* TypeAliasDeclaration */: - case 221 /* EnumDeclaration */: + case 219 /* FunctionDeclaration */: + case 224 /* ModuleDeclaration */: + case 228 /* ImportEqualsDeclaration */: + case 221 /* InterfaceDeclaration */: + case 220 /* ClassDeclaration */: + case 222 /* TypeAliasDeclaration */: + case 223 /* EnumDeclaration */: return emitModuleElement(node, isModuleElementVisible(node)); - case 197 /* VariableStatement */: + case 199 /* VariableStatement */: return emitModuleElement(node, isVariableStatementVisible(node)); - case 226 /* ImportDeclaration */: + case 229 /* ImportDeclaration */: // Import declaration without import clause is visible, otherwise it is not visible return emitModuleElement(node, /*isModuleElementVisible*/ !node.importClause); - case 232 /* ExportDeclaration */: + case 235 /* ExportDeclaration */: return emitExportDeclaration(node); - case 146 /* Constructor */: - case 145 /* MethodDeclaration */: - case 144 /* MethodSignature */: + case 147 /* Constructor */: + case 146 /* MethodDeclaration */: + case 145 /* MethodSignature */: return writeFunctionDeclaration(node); - case 150 /* ConstructSignature */: - case 149 /* CallSignature */: - case 151 /* IndexSignature */: + case 151 /* ConstructSignature */: + case 150 /* CallSignature */: + case 152 /* IndexSignature */: return emitSignatureDeclarationWithJsDocComments(node); - case 147 /* GetAccessor */: - case 148 /* SetAccessor */: + case 148 /* GetAccessor */: + case 149 /* SetAccessor */: return emitAccessorDeclaration(node); - case 143 /* PropertyDeclaration */: - case 142 /* PropertySignature */: + case 144 /* PropertyDeclaration */: + case 143 /* PropertySignature */: return emitPropertyDeclaration(node); - case 251 /* EnumMember */: + case 254 /* EnumMember */: return emitEnumMemberDeclaration(node); - case 231 /* ExportAssignment */: + case 234 /* ExportAssignment */: return emitExportAssignment(node); - case 252 /* SourceFile */: + case 255 /* SourceFile */: return emitSourceFile(node); } } @@ -32197,7 +33228,7 @@ var ts; if (declFileName) { declFileName = ts.getRelativePathToDirectoryOrUrl(ts.getDirectoryPath(ts.normalizeSlashes(declarationFilePath)), declFileName, host.getCurrentDirectory(), host.getCanonicalFileName, /*isAbsolutePathAnUrl*/ false); - referencePathsOutput += "/// " + newLine; + referencePathsOutput += '/// ' + newLine; } return addedBundledEmitReference; function getDeclFileName(emitFileNames, sourceFiles, isBundledEmit) { @@ -32533,6 +33564,7 @@ var ts; 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 @@ -32544,6 +33576,7 @@ var ts; 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(); @@ -32552,6 +33585,7 @@ var ts; return { emitSkipped: emitSkipped, diagnostics: emitterDiagnostics.getDiagnostics(), + emittedFiles: emittedFilesList, sourceMaps: sourceMapDataList }; function isUniqueLocalName(name, container) { @@ -32622,6 +33656,7 @@ var ts; var decoratedClassAliases; var convertedLoopState; var extendsEmitted; + var assignEmitted; var decorateEmitted; var paramEmitted; var awaiterEmitted; @@ -32674,7 +33709,7 @@ var ts; if (sourceMappingURL) { write("//# sourceMappingURL=" + sourceMappingURL); } - writeEmittedFiles(writer.getText(), jsFilePath, sourceMapFilePath, /*writeByteOrderMark*/ compilerOptions.emitBOM); + writeEmittedFiles(writer.getText(), jsFilePath, sourceMapFilePath, /*writeByteOrderMark*/ compilerOptions.emitBOM, sourceFiles); // reset the state sourceMap.reset(); writer.reset(); @@ -32692,6 +33727,7 @@ var ts; decorateEmitted = false; paramEmitted = false; awaiterEmitted = false; + assignEmitted = false; tempFlags = 0; tempVariables = undefined; tempParameters = undefined; @@ -32728,10 +33764,10 @@ var ts; // Note that names generated by makeTempVariableName and makeUniqueName will never conflict. function makeTempVariableName(flags) { if (flags && !(tempFlags & flags)) { - var name_21 = flags === 268435456 /* _i */ ? "_i" : "_n"; - if (isUniqueName(name_21)) { + var name_23 = flags === 268435456 /* _i */ ? "_i" : "_n"; + if (isUniqueName(name_23)) { tempFlags |= flags; - return name_21; + return name_23; } } while (true) { @@ -32739,9 +33775,9 @@ var ts; tempFlags++; // Skip over 'i' and 'n' if (count !== 8 && count !== 13) { - var name_22 = count < 26 ? "_" + String.fromCharCode(97 /* a */ + count) : "_" + (count - 26); - if (isUniqueName(name_22)) { - return name_22; + var name_24 = count < 26 ? "_" + String.fromCharCode(97 /* a */ + count) : "_" + (count - 26); + if (isUniqueName(name_24)) { + return name_24; } } } @@ -32785,17 +33821,17 @@ var ts; switch (node.kind) { case 69 /* Identifier */: return makeUniqueName(node.text); - case 222 /* ModuleDeclaration */: - case 221 /* EnumDeclaration */: + case 224 /* ModuleDeclaration */: + case 223 /* EnumDeclaration */: return generateNameForModuleOrEnum(node); - case 226 /* ImportDeclaration */: - case 232 /* ExportDeclaration */: + case 229 /* ImportDeclaration */: + case 235 /* ExportDeclaration */: return generateNameForImportOrExportDeclaration(node); - case 217 /* FunctionDeclaration */: - case 218 /* ClassDeclaration */: - case 231 /* ExportAssignment */: + case 219 /* FunctionDeclaration */: + case 220 /* ClassDeclaration */: + case 234 /* ExportAssignment */: return generateNameForExportDefault(); - case 190 /* ClassExpression */: + case 191 /* ClassExpression */: return generateNameForClassExpression(); } } @@ -32804,14 +33840,14 @@ var ts; return nodeToGeneratedName[id] || (nodeToGeneratedName[id] = ts.unescapeIdentifier(generateNameForNode(node))); } /** Write emitted output to disk */ - function writeEmittedFiles(emitOutput, jsFilePath, sourceMapFilePath, writeByteOrderMark) { + function writeEmittedFiles(emitOutput, jsFilePath, sourceMapFilePath, writeByteOrderMark, sourceFiles) { if (compilerOptions.sourceMap && !compilerOptions.inlineSourceMap) { - ts.writeFile(host, emitterDiagnostics, sourceMapFilePath, sourceMap.getText(), /*writeByteOrderMark*/ false); + ts.writeFile(host, emitterDiagnostics, sourceMapFilePath, sourceMap.getText(), /*writeByteOrderMark*/ false, sourceFiles); } if (sourceMapDataList) { sourceMapDataList.push(sourceMap.getSourceMapData()); } - ts.writeFile(host, emitterDiagnostics, jsFilePath, emitOutput, writeByteOrderMark); + ts.writeFile(host, emitterDiagnostics, jsFilePath, emitOutput, writeByteOrderMark, sourceFiles); } // Create a temporary variable with a unique unused name. function createTempVariable(flags) { @@ -32990,7 +34026,7 @@ var ts; // 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, "\""); + 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. @@ -33001,7 +34037,7 @@ var ts; // or an escaped quoted form of the original text if it's string-like. switch (node.kind) { case 9 /* StringLiteral */: - return getQuotedEscapedLiteralText("\"", node.text, "\""); + return getQuotedEscapedLiteralText('"', node.text, '"'); case 11 /* NoSubstitutionTemplateLiteral */: return getQuotedEscapedLiteralText("`", node.text, "`"); case 12 /* TemplateHead */: @@ -33065,10 +34101,10 @@ var ts; write("("); emit(tempVariable); // Now we emit the expressions - if (node.template.kind === 187 /* TemplateExpression */) { + if (node.template.kind === 188 /* TemplateExpression */) { ts.forEach(node.template.templateSpans, function (templateSpan) { write(", "); - var needsParens = templateSpan.expression.kind === 185 /* BinaryExpression */ + var needsParens = templateSpan.expression.kind === 186 /* BinaryExpression */ && templateSpan.expression.operatorToken.kind === 24 /* CommaToken */; emitParenthesizedIf(templateSpan.expression, needsParens); }); @@ -33103,7 +34139,7 @@ var ts; // ("abc" + 1) << (2 + "") // rather than // "abc" + (1 << 2) + "" - var needsParens = templateSpan.expression.kind !== 176 /* ParenthesizedExpression */ + var needsParens = templateSpan.expression.kind !== 177 /* 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 @@ -33145,11 +34181,11 @@ var ts; } function templateNeedsParens(template, parent) { switch (parent.kind) { - case 172 /* CallExpression */: - case 173 /* NewExpression */: + case 173 /* CallExpression */: + case 174 /* NewExpression */: return parent.expression === template; - case 174 /* TaggedTemplateExpression */: - case 176 /* ParenthesizedExpression */: + case 175 /* TaggedTemplateExpression */: + case 177 /* ParenthesizedExpression */: return false; default: return comparePrecedenceToBinaryPlus(parent) !== -1 /* LessThan */; @@ -33170,7 +34206,7 @@ var ts; // 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 185 /* BinaryExpression */: + case 186 /* BinaryExpression */: switch (expression.operatorToken.kind) { case 37 /* AsteriskToken */: case 39 /* SlashToken */: @@ -33182,8 +34218,8 @@ var ts; default: return -1 /* LessThan */; } - case 188 /* YieldExpression */: - case 186 /* ConditionalExpression */: + case 189 /* YieldExpression */: + case 187 /* ConditionalExpression */: return -1 /* LessThan */; default: return 1 /* GreaterThan */; @@ -33199,9 +34235,9 @@ var ts; /// 'Div' for upper-cased or dotted names function emitTagName(name) { if (name.kind === 69 /* Identifier */ && ts.isIntrinsicJsxName(name.text)) { - write("\""); + write('"'); emit(name); - write("\""); + write('"'); } else { emit(name); @@ -33215,9 +34251,9 @@ var ts; emit(name); } else { - write("\""); + write('"'); emit(name); - write("\""); + write('"'); } } /// Emit an name/value pair for an attribute (e.g. "x: 3") @@ -33248,14 +34284,13 @@ var ts; } else { // Either emit one big object literal (no spread attribs), or - // a call to React.__spread + // a call to the __assign helper var attrs = openingNode.attributes; - if (ts.forEach(attrs, function (attr) { return attr.kind === 243 /* JsxSpreadAttribute */; })) { - emitExpressionIdentifier(syntheticReactRef); - write(".__spread("); + if (ts.forEach(attrs, function (attr) { return attr.kind === 246 /* JsxSpreadAttribute */; })) { + write("__assign("); var haveOpenedObjectLiteral = false; for (var i = 0; i < attrs.length; i++) { - if (attrs[i].kind === 243 /* JsxSpreadAttribute */) { + if (attrs[i].kind === 246 /* JsxSpreadAttribute */) { // If this is the first argument, we need to emit a {} as the first argument if (i === 0) { write("{}, "); @@ -33270,7 +34305,7 @@ var ts; emit(attrs[i].expression); } else { - ts.Debug.assert(attrs[i].kind === 242 /* JsxAttribute */); + ts.Debug.assert(attrs[i].kind === 245 /* JsxAttribute */); if (haveOpenedObjectLiteral) { write(", "); } @@ -33331,7 +34366,7 @@ var ts; decreaseIndent(); } else if (firstChild) { - if (firstChild.kind !== 237 /* JsxElement */ && firstChild.kind !== 238 /* JsxSelfClosingElement */) { + if (firstChild.kind !== 240 /* JsxElement */ && firstChild.kind !== 241 /* JsxSelfClosingElement */) { emit(firstChild); } else { @@ -33348,11 +34383,11 @@ var ts; write(")"); // closes "React.createElement(" emitTrailingComments(openingNode); } - if (node.kind === 237 /* JsxElement */) { + if (node.kind === 240 /* JsxElement */) { emitJsxElement(node.openingElement, node.children); } else { - ts.Debug.assert(node.kind === 238 /* JsxSelfClosingElement */); + ts.Debug.assert(node.kind === 241 /* JsxSelfClosingElement */); emitJsxElement(node); } } @@ -33374,11 +34409,11 @@ var ts; if (i > 0) { write(" "); } - if (attribs[i].kind === 243 /* JsxSpreadAttribute */) { + if (attribs[i].kind === 246 /* JsxSpreadAttribute */) { emitJsxSpreadAttribute(attribs[i]); } else { - ts.Debug.assert(attribs[i].kind === 242 /* JsxAttribute */); + ts.Debug.assert(attribs[i].kind === 245 /* JsxAttribute */); emitJsxAttribute(attribs[i]); } } @@ -33386,11 +34421,11 @@ var ts; function emitJsxOpeningOrSelfClosingElement(node) { write("<"); emit(node.tagName); - if (node.attributes.length > 0 || (node.kind === 238 /* JsxSelfClosingElement */)) { + if (node.attributes.length > 0 || (node.kind === 241 /* JsxSelfClosingElement */)) { write(" "); } emitAttributes(node.attributes); - if (node.kind === 238 /* JsxSelfClosingElement */) { + if (node.kind === 241 /* JsxSelfClosingElement */) { write("/>"); } else { @@ -33409,11 +34444,11 @@ var ts; } emitJsxClosingElement(node.closingElement); } - if (node.kind === 237 /* JsxElement */) { + if (node.kind === 240 /* JsxElement */) { emitJsxElement(node); } else { - ts.Debug.assert(node.kind === 238 /* JsxSelfClosingElement */); + ts.Debug.assert(node.kind === 241 /* JsxSelfClosingElement */); emitJsxOpeningOrSelfClosingElement(node); } } @@ -33421,11 +34456,11 @@ var ts; // 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 !== 167 /* BindingElement */); + ts.Debug.assert(node.kind !== 168 /* BindingElement */); if (node.kind === 9 /* StringLiteral */) { emitLiteral(node); } - else if (node.kind === 138 /* ComputedPropertyName */) { + else if (node.kind === 139 /* 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: @@ -33456,75 +34491,76 @@ var ts; emit(node.expression); } else { - write("\""); + write('"'); if (node.kind === 8 /* NumericLiteral */) { write(node.text); } else { writeTextOfNode(currentText, node); } - write("\""); + write('"'); } } function isExpressionIdentifier(node) { var parent = node.parent; switch (parent.kind) { - case 168 /* ArrayLiteralExpression */: - case 193 /* AsExpression */: - case 185 /* BinaryExpression */: - case 172 /* CallExpression */: - case 245 /* CaseClause */: - case 138 /* ComputedPropertyName */: - case 186 /* ConditionalExpression */: - case 141 /* Decorator */: - case 179 /* DeleteExpression */: - case 201 /* DoStatement */: - case 171 /* ElementAccessExpression */: - case 231 /* ExportAssignment */: - case 199 /* ExpressionStatement */: - case 192 /* ExpressionWithTypeArguments */: - case 203 /* ForStatement */: - case 204 /* ForInStatement */: - case 205 /* ForOfStatement */: - case 200 /* IfStatement */: - case 241 /* JsxClosingElement */: - case 238 /* JsxSelfClosingElement */: - case 239 /* JsxOpeningElement */: - case 243 /* JsxSpreadAttribute */: - case 244 /* JsxExpression */: - case 173 /* NewExpression */: - case 176 /* ParenthesizedExpression */: - case 184 /* PostfixUnaryExpression */: - case 183 /* PrefixUnaryExpression */: - case 208 /* ReturnStatement */: - case 250 /* ShorthandPropertyAssignment */: - case 189 /* SpreadElementExpression */: - case 210 /* SwitchStatement */: - case 174 /* TaggedTemplateExpression */: - case 194 /* TemplateSpan */: - case 212 /* ThrowStatement */: - case 175 /* TypeAssertionExpression */: - case 180 /* TypeOfExpression */: - case 181 /* VoidExpression */: - case 202 /* WhileStatement */: - case 209 /* WithStatement */: - case 188 /* YieldExpression */: + case 169 /* ArrayLiteralExpression */: + case 194 /* AsExpression */: + case 186 /* BinaryExpression */: + case 173 /* CallExpression */: + case 248 /* CaseClause */: + case 139 /* ComputedPropertyName */: + case 187 /* ConditionalExpression */: + case 142 /* Decorator */: + case 180 /* DeleteExpression */: + case 203 /* DoStatement */: + case 172 /* ElementAccessExpression */: + case 234 /* ExportAssignment */: + case 201 /* ExpressionStatement */: + case 193 /* ExpressionWithTypeArguments */: + case 205 /* ForStatement */: + case 206 /* ForInStatement */: + case 207 /* ForOfStatement */: + case 202 /* IfStatement */: + case 244 /* JsxClosingElement */: + case 241 /* JsxSelfClosingElement */: + case 242 /* JsxOpeningElement */: + case 246 /* JsxSpreadAttribute */: + case 247 /* JsxExpression */: + case 174 /* NewExpression */: + case 195 /* NonNullExpression */: + case 177 /* ParenthesizedExpression */: + case 185 /* PostfixUnaryExpression */: + case 184 /* PrefixUnaryExpression */: + case 210 /* ReturnStatement */: + case 253 /* ShorthandPropertyAssignment */: + case 190 /* SpreadElementExpression */: + case 212 /* SwitchStatement */: + case 175 /* TaggedTemplateExpression */: + case 196 /* TemplateSpan */: + case 214 /* ThrowStatement */: + case 176 /* TypeAssertionExpression */: + case 181 /* TypeOfExpression */: + case 182 /* VoidExpression */: + case 204 /* WhileStatement */: + case 211 /* WithStatement */: + case 189 /* YieldExpression */: return true; - case 167 /* BindingElement */: - case 251 /* EnumMember */: - case 140 /* Parameter */: - case 249 /* PropertyAssignment */: - case 143 /* PropertyDeclaration */: - case 215 /* VariableDeclaration */: + case 168 /* BindingElement */: + case 254 /* EnumMember */: + case 141 /* Parameter */: + case 252 /* PropertyAssignment */: + case 144 /* PropertyDeclaration */: + case 217 /* VariableDeclaration */: return parent.initializer === node; - case 170 /* PropertyAccessExpression */: + case 171 /* PropertyAccessExpression */: return parent.expression === node; - case 178 /* ArrowFunction */: - case 177 /* FunctionExpression */: + case 179 /* ArrowFunction */: + case 178 /* FunctionExpression */: return parent.body === node; - case 225 /* ImportEqualsDeclaration */: + case 228 /* ImportEqualsDeclaration */: return parent.moduleReference === node; - case 137 /* QualifiedName */: + case 138 /* QualifiedName */: return parent.left === node; } return false; @@ -33532,7 +34568,7 @@ var ts; function emitExpressionIdentifier(node) { var container = resolver.getReferencedExportContainer(node); if (container) { - if (container.kind === 252 /* SourceFile */) { + if (container.kind === 255 /* SourceFile */) { // Identifier references module export if (modulekind !== ts.ModuleKind.ES6 && modulekind !== ts.ModuleKind.System) { write("exports."); @@ -33548,19 +34584,19 @@ var ts; if (modulekind !== ts.ModuleKind.ES6) { var declaration = resolver.getReferencedImportDeclaration(node); if (declaration) { - if (declaration.kind === 227 /* ImportClause */) { + if (declaration.kind === 230 /* ImportClause */) { // Identifier references default import write(getGeneratedNameForNode(declaration.parent)); - write(languageVersion === 0 /* ES3 */ ? "[\"default\"]" : ".default"); + write(languageVersion === 0 /* ES3 */ ? '["default"]' : ".default"); return; } - else if (declaration.kind === 230 /* ImportSpecifier */) { + else if (declaration.kind === 233 /* ImportSpecifier */) { // Identifier references named import write(getGeneratedNameForNode(declaration.parent.parent.parent)); - var name_23 = declaration.propertyName || declaration.name; - var identifier = ts.getTextOfNodeFromSourceText(currentText, name_23); + var name_25 = declaration.propertyName || declaration.name; + var identifier = ts.getTextOfNodeFromSourceText(currentText, name_25); if (languageVersion === 0 /* ES3 */ && identifier === "default") { - write("[\"default\"]"); + write('["default"]'); } else { write("."); @@ -33600,13 +34636,13 @@ var ts; } function isNameOfNestedBlockScopedRedeclarationOrCapturedBinding(node) { if (languageVersion < 2 /* ES6 */) { - var parent_8 = node.parent; - switch (parent_8.kind) { - case 167 /* BindingElement */: - case 218 /* ClassDeclaration */: - case 221 /* EnumDeclaration */: - case 215 /* VariableDeclaration */: - return parent_8.name === node && resolver.isDeclarationWithCollidingName(parent_8); + var parent_10 = node.parent; + switch (parent_10.kind) { + case 168 /* BindingElement */: + case 220 /* ClassDeclaration */: + case 223 /* EnumDeclaration */: + case 217 /* VariableDeclaration */: + return parent_10.name === node && resolver.isDeclarationWithCollidingName(parent_10); } } return false; @@ -33615,8 +34651,8 @@ var ts; if (convertedLoopState) { if (node.text == "arguments" && resolver.isArgumentsLocalBinding(node)) { // in converted loop body arguments cannot be used directly. - var name_24 = convertedLoopState.argumentsName || (convertedLoopState.argumentsName = makeUniqueName("arguments")); - write(name_24); + var name_26 = convertedLoopState.argumentsName || (convertedLoopState.argumentsName = makeUniqueName("arguments")); + write(name_26); return; } } @@ -33716,10 +34752,10 @@ var ts; } } function needsParenthesisForAwaitExpressionAsYield(node) { - if (node.parent.kind === 185 /* BinaryExpression */ && !ts.isAssignmentOperator(node.parent.operatorToken.kind)) { + if (node.parent.kind === 186 /* BinaryExpression */ && !ts.isAssignmentOperator(node.parent.operatorToken.kind)) { return true; } - else if (node.parent.kind === 186 /* ConditionalExpression */ && node.parent.condition === node) { + else if (node.parent.kind === 187 /* ConditionalExpression */ && node.parent.condition === node) { return true; } return false; @@ -33727,11 +34763,11 @@ var ts; function needsParenthesisForPropertyAccessOrInvocation(node) { switch (node.kind) { case 69 /* Identifier */: - case 168 /* ArrayLiteralExpression */: - case 170 /* PropertyAccessExpression */: - case 171 /* ElementAccessExpression */: - case 172 /* CallExpression */: - case 176 /* ParenthesizedExpression */: + case 169 /* ArrayLiteralExpression */: + case 171 /* PropertyAccessExpression */: + case 172 /* ElementAccessExpression */: + case 173 /* CallExpression */: + case 177 /* 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; @@ -33751,17 +34787,17 @@ var ts; write(", "); } var e = elements[pos]; - if (e.kind === 189 /* SpreadElementExpression */) { + if (e.kind === 190 /* SpreadElementExpression */) { e = e.expression; emitParenthesizedIf(e, /*parenthesized*/ group === 0 && needsParenthesisForPropertyAccessOrInvocation(e)); pos++; - if (pos === length && group === 0 && needsUniqueCopy && e.kind !== 168 /* ArrayLiteralExpression */) { + if (pos === length && group === 0 && needsUniqueCopy && e.kind !== 169 /* ArrayLiteralExpression */) { write(".slice()"); } } else { var i = pos; - while (i < length && elements[i].kind !== 189 /* SpreadElementExpression */) { + while (i < length && elements[i].kind !== 190 /* SpreadElementExpression */) { i++; } write("["); @@ -33784,7 +34820,7 @@ var ts; } } function isSpreadElementExpression(node) { - return node.kind === 189 /* SpreadElementExpression */; + return node.kind === 190 /* SpreadElementExpression */; } function emitArrayLiteral(node) { var elements = node.elements; @@ -33854,7 +34890,7 @@ var ts; writeComma(); var property = properties[i]; emitStart(property); - if (property.kind === 147 /* GetAccessor */ || property.kind === 148 /* SetAccessor */) { + if (property.kind === 148 /* GetAccessor */ || property.kind === 149 /* SetAccessor */) { // TODO (drosen): Reconcile with 'emitMemberFunctions'. var accessors = ts.getAllAccessorDeclarations(node.properties, property); if (property !== accessors.firstAccessor) { @@ -33906,13 +34942,13 @@ var ts; emitMemberAccessForPropertyName(property.name); emitEnd(property.name); write(" = "); - if (property.kind === 249 /* PropertyAssignment */) { + if (property.kind === 252 /* PropertyAssignment */) { emit(property.initializer); } - else if (property.kind === 250 /* ShorthandPropertyAssignment */) { + else if (property.kind === 253 /* ShorthandPropertyAssignment */) { emitExpressionIdentifier(property.name); } - else if (property.kind === 145 /* MethodDeclaration */) { + else if (property.kind === 146 /* MethodDeclaration */) { emitFunctionDeclaration(property); } else { @@ -33946,7 +34982,7 @@ var ts; // 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 === 138 /* ComputedPropertyName */) { + if (properties[i].name.kind === 139 /* ComputedPropertyName */) { numInitialNonComputedProperties = i; break; } @@ -33962,21 +34998,21 @@ var ts; emitObjectLiteralBody(node, properties.length); } function createBinaryExpression(left, operator, right, startsOnNewLine) { - var result = ts.createSynthesizedNode(185 /* BinaryExpression */, startsOnNewLine); + var result = ts.createSynthesizedNode(186 /* BinaryExpression */, startsOnNewLine); result.operatorToken = ts.createSynthesizedNode(operator); result.left = left; result.right = right; return result; } function createPropertyAccessExpression(expression, name) { - var result = ts.createSynthesizedNode(170 /* PropertyAccessExpression */); + var result = ts.createSynthesizedNode(171 /* PropertyAccessExpression */); result.expression = parenthesizeForAccess(expression); result.dotToken = ts.createSynthesizedNode(21 /* DotToken */); result.name = name; return result; } function createElementAccessExpression(expression, argumentExpression) { - var result = ts.createSynthesizedNode(171 /* ElementAccessExpression */); + var result = ts.createSynthesizedNode(172 /* ElementAccessExpression */); result.expression = parenthesizeForAccess(expression); result.argumentExpression = argumentExpression; return result; @@ -33984,7 +35020,9 @@ var ts; 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 === 175 /* TypeAssertionExpression */ || expr.kind === 193 /* AsExpression */) { + while (expr.kind === 176 /* TypeAssertionExpression */ || + expr.kind === 194 /* AsExpression */ || + expr.kind === 195 /* NonNullExpression */) { expr = expr.expression; } // isLeftHandSideExpression is almost the correct criterion for when it is not necessary @@ -33996,11 +35034,11 @@ var ts; // 1.x -> not the same as (1).x // if (ts.isLeftHandSideExpression(expr) && - expr.kind !== 173 /* NewExpression */ && + expr.kind !== 174 /* NewExpression */ && expr.kind !== 8 /* NumericLiteral */) { return expr; } - var node = ts.createSynthesizedNode(176 /* ParenthesizedExpression */); + var node = ts.createSynthesizedNode(177 /* ParenthesizedExpression */); node.expression = expr; return node; } @@ -34035,7 +35073,12 @@ var ts; // Return true if identifier resolves to an exported member of a namespace function isNamespaceExportReference(node) { var container = resolver.getReferencedExportContainer(node); - return container && container.kind !== 252 /* SourceFile */; + return container && container.kind !== 255 /* SourceFile */; + } + // Return true if identifier resolves to an imported identifier + function isImportedReference(node) { + var declaration = resolver.getReferencedImportDeclaration(node); + return declaration && (declaration.kind === 230 /* ImportClause */ || declaration.kind === 233 /* ImportSpecifier */); } function emitShorthandPropertyAssignment(node) { // The name property of a short-hand property assignment is considered an expression position, so here @@ -34050,7 +35093,18 @@ var ts; // let obj = { y }; // } // Here we need to emit obj = { y : m.y } regardless of the output target. - if (modulekind !== ts.ModuleKind.ES6 || isNamespaceExportReference(node.name)) { + // 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)) || isNamespaceExportReference(node.name)) { // Emit identifier as an identifier write(": "); emit(node.name); @@ -34065,7 +35119,7 @@ var ts; if (constantValue !== undefined) { write(constantValue.toString()); if (!compilerOptions.removeComments) { - var propertyName = node.kind === 170 /* PropertyAccessExpression */ ? ts.declarationNameToString(node.name) : ts.getTextOfNode(node.argumentExpression); + var propertyName = node.kind === 171 /* PropertyAccessExpression */ ? ts.declarationNameToString(node.name) : ts.getTextOfNode(node.argumentExpression); write(" /* " + propertyName + " */"); } return true; @@ -34076,7 +35130,7 @@ var ts; if (compilerOptions.isolatedModules) { return undefined; } - return node.kind === 170 /* PropertyAccessExpression */ || node.kind === 171 /* ElementAccessExpression */ + return node.kind === 171 /* PropertyAccessExpression */ || node.kind === 172 /* ElementAccessExpression */ ? resolver.getConstantValue(node) : undefined; } @@ -34106,9 +35160,9 @@ var ts; if (languageVersion === 2 /* ES6 */ && node.expression.kind === 95 /* SuperKeyword */ && isInAsyncMethodWithSuperInES6(node)) { - var name_25 = ts.createSynthesizedNode(9 /* StringLiteral */); - name_25.text = node.name.text; - emitSuperAccessInAsyncMethod(node.expression, name_25); + var name_27 = ts.createSynthesizedNode(9 /* StringLiteral */); + name_27.text = node.name.text; + emitSuperAccessInAsyncMethod(node.expression, name_27); return; } emit(node.expression); @@ -34173,7 +35227,7 @@ var ts; } emitExpressionIdentifier(node); break; - case 137 /* QualifiedName */: + case 138 /* QualifiedName */: emitQualifiedNameAsExpression(node, useFallback); break; default: @@ -34197,10 +35251,13 @@ var ts; write("]"); } function hasSpreadElement(elements) { - return ts.forEach(elements, function (e) { return e.kind === 189 /* SpreadElementExpression */; }); + return ts.forEach(elements, function (e) { return e.kind === 190 /* SpreadElementExpression */; }); } function skipParentheses(node) { - while (node.kind === 176 /* ParenthesizedExpression */ || node.kind === 175 /* TypeAssertionExpression */ || node.kind === 193 /* AsExpression */) { + while (node.kind === 177 /* ParenthesizedExpression */ || + node.kind === 176 /* TypeAssertionExpression */ || + node.kind === 194 /* AsExpression */ || + node.kind === 195 /* NonNullExpression */) { node = node.expression; } return node; @@ -34221,13 +35278,13 @@ var ts; function emitCallWithSpread(node) { var target; var expr = skipParentheses(node.expression); - if (expr.kind === 170 /* PropertyAccessExpression */) { + if (expr.kind === 171 /* PropertyAccessExpression */) { // Target will be emitted as "this" argument target = emitCallTarget(expr.expression); write("."); emit(expr.name); } - else if (expr.kind === 171 /* ElementAccessExpression */) { + else if (expr.kind === 172 /* ElementAccessExpression */) { // Target will be emitted as "this" argument target = emitCallTarget(expr.expression); write("["); @@ -34360,12 +35417,16 @@ var ts; // 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 !== 178 /* ArrowFunction */) { - if (node.expression.kind === 175 /* TypeAssertionExpression */ || node.expression.kind === 193 /* AsExpression */) { + if (!ts.nodeIsSynthesized(node) && node.parent.kind !== 179 /* ArrowFunction */) { + if (node.expression.kind === 176 /* TypeAssertionExpression */ || + node.expression.kind === 194 /* AsExpression */ || + node.expression.kind === 195 /* NonNullExpression */) { var operand = node.expression.expression; // Make sure we consider all nested cast expressions, e.g.: // (-A).x; - while (operand.kind === 175 /* TypeAssertionExpression */ || operand.kind === 193 /* AsExpression */) { + while (operand.kind === 176 /* TypeAssertionExpression */ || + operand.kind === 194 /* AsExpression */ || + operand.kind === 195 /* NonNullExpression */) { operand = operand.expression; } // We have an expression of the form: (SubExpr) @@ -34376,15 +35437,15 @@ var ts; // (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 !== 183 /* PrefixUnaryExpression */ && - operand.kind !== 181 /* VoidExpression */ && - operand.kind !== 180 /* TypeOfExpression */ && - operand.kind !== 179 /* DeleteExpression */ && - operand.kind !== 184 /* PostfixUnaryExpression */ && - operand.kind !== 173 /* NewExpression */ && - !(operand.kind === 172 /* CallExpression */ && node.parent.kind === 173 /* NewExpression */) && - !(operand.kind === 177 /* FunctionExpression */ && node.parent.kind === 172 /* CallExpression */) && - !(operand.kind === 8 /* NumericLiteral */ && node.parent.kind === 170 /* PropertyAccessExpression */)) { + if (operand.kind !== 184 /* PrefixUnaryExpression */ && + operand.kind !== 182 /* VoidExpression */ && + operand.kind !== 181 /* TypeOfExpression */ && + operand.kind !== 180 /* DeleteExpression */ && + operand.kind !== 185 /* PostfixUnaryExpression */ && + operand.kind !== 174 /* NewExpression */ && + !(operand.kind === 173 /* CallExpression */ && node.parent.kind === 174 /* NewExpression */) && + !(operand.kind === 178 /* FunctionExpression */ && node.parent.kind === 173 /* CallExpression */) && + !(operand.kind === 8 /* NumericLiteral */ && node.parent.kind === 171 /* PropertyAccessExpression */)) { emit(operand); return; } @@ -34413,7 +35474,7 @@ var ts; if (!isCurrentFileSystemExternalModule() || node.kind !== 69 /* Identifier */ || ts.nodeIsSynthesized(node)) { return false; } - var isVariableDeclarationOrBindingElement = node.parent && (node.parent.kind === 215 /* VariableDeclaration */ || node.parent.kind === 167 /* BindingElement */); + var isVariableDeclarationOrBindingElement = node.parent && (node.parent.kind === 217 /* VariableDeclaration */ || node.parent.kind === 168 /* BindingElement */); var targetDeclaration = isVariableDeclarationOrBindingElement ? node.parent : resolver.getReferencedValueDeclaration(node); @@ -34444,7 +35505,7 @@ var ts; // 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 === 183 /* PrefixUnaryExpression */) { + if (node.operand.kind === 184 /* PrefixUnaryExpression */) { var operand = node.operand; if (node.operator === 35 /* PlusToken */ && (operand.operator === 35 /* PlusToken */ || operand.operator === 41 /* PlusPlusToken */)) { write(" "); @@ -34500,7 +35561,7 @@ var ts; } var current = ts.getRootDeclaration(node).parent; while (current) { - if (current.kind === 252 /* SourceFile */) { + if (current.kind === 255 /* SourceFile */) { return !isExported || ((ts.getCombinedNodeFlags(node) & 1 /* Export */) !== 0); } else if (ts.isDeclaration(current)) { @@ -34523,7 +35584,7 @@ var ts; if (ts.isElementAccessExpression(leftHandSideExpression)) { shouldEmitParentheses = true; write("("); - synthesizedLHS = ts.createSynthesizedNode(171 /* ElementAccessExpression */, /*startsOnNewLine*/ false); + synthesizedLHS = ts.createSynthesizedNode(172 /* ElementAccessExpression */, /*startsOnNewLine*/ false); var identifier = emitTempVariableAssignment(leftHandSideExpression.expression, /*canDefineTempVariablesInPlace*/ false, /*shouldEmitCommaBeforeAssignment*/ false); synthesizedLHS.expression = identifier; if (leftHandSideExpression.argumentExpression.kind !== 8 /* NumericLiteral */ && @@ -34540,7 +35601,7 @@ var ts; else if (ts.isPropertyAccessExpression(leftHandSideExpression)) { shouldEmitParentheses = true; write("("); - synthesizedLHS = ts.createSynthesizedNode(170 /* PropertyAccessExpression */, /*startsOnNewLine*/ false); + synthesizedLHS = ts.createSynthesizedNode(171 /* PropertyAccessExpression */, /*startsOnNewLine*/ false); var identifier = emitTempVariableAssignment(leftHandSideExpression.expression, /*canDefineTempVariablesInPlace*/ false, /*shouldEmitCommaBeforeAssignment*/ false); synthesizedLHS.expression = identifier; synthesizedLHS.dotToken = leftHandSideExpression.dotToken; @@ -34568,8 +35629,8 @@ var ts; } function emitBinaryExpression(node) { if (languageVersion < 2 /* ES6 */ && node.operatorToken.kind === 56 /* EqualsToken */ && - (node.left.kind === 169 /* ObjectLiteralExpression */ || node.left.kind === 168 /* ArrayLiteralExpression */)) { - emitDestructuring(node, node.parent.kind === 199 /* ExpressionStatement */); + (node.left.kind === 170 /* ObjectLiteralExpression */ || node.left.kind === 169 /* ArrayLiteralExpression */)) { + emitDestructuring(node, node.parent.kind === 201 /* ExpressionStatement */); } else { var exportChanged = node.operatorToken.kind >= 56 /* FirstAssignment */ && @@ -34634,7 +35695,7 @@ var ts; } } function isSingleLineEmptyBlock(node) { - if (node && node.kind === 196 /* Block */) { + if (node && node.kind === 198 /* Block */) { var block = node; return block.statements.length === 0 && nodeEndIsOnSameLineAsNodeStart(block, block); } @@ -34648,12 +35709,12 @@ var ts; } emitToken(15 /* OpenBraceToken */, node.pos); increaseIndent(); - if (node.kind === 223 /* ModuleBlock */) { - ts.Debug.assert(node.parent.kind === 222 /* ModuleDeclaration */); + if (node.kind === 225 /* ModuleBlock */) { + ts.Debug.assert(node.parent.kind === 224 /* ModuleDeclaration */); emitCaptureThisForNodeIfNecessary(node.parent); } emitLines(node.statements); - if (node.kind === 223 /* ModuleBlock */) { + if (node.kind === 225 /* ModuleBlock */) { emitTempDeclarations(/*newLine*/ true); } decreaseIndent(); @@ -34661,7 +35722,7 @@ var ts; emitToken(16 /* CloseBraceToken */, node.statements.end); } function emitEmbeddedStatement(node) { - if (node.kind === 196 /* Block */) { + if (node.kind === 198 /* Block */) { write(" "); emit(node); } @@ -34673,7 +35734,7 @@ var ts; } } function emitExpressionStatement(node) { - emitParenthesizedIf(node.expression, /*parenthesized*/ node.expression.kind === 178 /* ArrowFunction */); + emitParenthesizedIf(node.expression, /*parenthesized*/ node.expression.kind === 179 /* ArrowFunction */); write(";"); } function emitIfStatement(node) { @@ -34686,7 +35747,7 @@ var ts; if (node.elseStatement) { writeLine(); emitToken(80 /* ElseKeyword */, node.thenStatement.end); - if (node.elseStatement.kind === 200 /* IfStatement */) { + if (node.elseStatement.kind === 202 /* IfStatement */) { write(" "); emit(node.elseStatement); } @@ -34706,7 +35767,7 @@ var ts; else { emitNormalLoopBody(node, /*emitAsEmbeddedStatement*/ true); } - if (node.statement.kind === 196 /* Block */) { + if (node.statement.kind === 198 /* Block */) { write(" "); } else { @@ -34796,7 +35857,7 @@ var ts; } else { var loop = convertLoopBody(node); - if (node.parent.kind === 211 /* LabeledStatement */) { + if (node.parent.kind === 213 /* LabeledStatement */) { // if parent of the loop was labeled statement - attach the label to loop skipping converted loop body emitLabelAndColon(node.parent); } @@ -34807,11 +35868,11 @@ var ts; var functionName = makeUniqueName("_loop"); var loopInitializer; switch (node.kind) { - case 203 /* ForStatement */: - case 204 /* ForInStatement */: - case 205 /* ForOfStatement */: + case 205 /* ForStatement */: + case 206 /* ForInStatement */: + case 207 /* ForOfStatement */: var initializer = node.initializer; - if (initializer && initializer.kind === 216 /* VariableDeclarationList */) { + if (initializer && initializer.kind === 218 /* VariableDeclarationList */) { loopInitializer = node.initializer; } break; @@ -34826,7 +35887,7 @@ var ts; processVariableDeclaration(varDeclaration.name); } } - var bodyIsBlock = node.statement.kind === 196 /* Block */; + var bodyIsBlock = node.statement.kind === 198 /* Block */; var paramList = loopParameters ? loopParameters.join(", ") : ""; writeLine(); write("var " + functionName + " = function(" + paramList + ")"); @@ -34861,7 +35922,7 @@ var ts; emit(node.statement); } writeLine(); - // end of loop body -> copy out parameter + // end of loop body -> copy out parameter copyLoopOutParameters(convertedLoopState, 1 /* ToOutParameter */, /*emitAsStatements*/ true); decreaseIndent(); writeLine(); @@ -34968,7 +36029,7 @@ var ts; if (emitAsEmbeddedStatement) { emitEmbeddedStatement(node.statement); } - else if (node.statement.kind === 196 /* Block */) { + else if (node.statement.kind === 198 /* Block */) { emitLines(node.statement.statements); } else { @@ -35009,7 +36070,8 @@ var ts; } // 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()'; - var isSimpleLoop = !loop.state.nonLocalJumps && + // 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"); @@ -35044,10 +36106,6 @@ var ts; write("if (" + loopResult + " === \"break\") break;"); writeLine(); } - if (loop.state.nonLocalJumps & 4 /* Continue */) { - write("if (" + loopResult + " === \"continue\") continue;"); - 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); } @@ -35102,7 +36160,7 @@ var ts; var endPos = emitToken(86 /* ForKeyword */, node.pos); write(" "); endPos = emitToken(17 /* OpenParenToken */, endPos); - if (node.initializer && node.initializer.kind === 216 /* VariableDeclarationList */) { + if (node.initializer && node.initializer.kind === 218 /* VariableDeclarationList */) { var variableDeclarationList = node.initializer; var startIsEmitted = tryEmitStartOfVariableDeclarationList(variableDeclarationList); if (startIsEmitted) { @@ -35128,7 +36186,7 @@ var ts; } } function emitForInOrForOfStatement(node) { - if (languageVersion < 2 /* ES6 */ && node.kind === 205 /* ForOfStatement */) { + if (languageVersion < 2 /* ES6 */ && node.kind === 207 /* ForOfStatement */) { emitLoop(node, emitDownLevelForOfStatementWorker); } else { @@ -35139,7 +36197,7 @@ var ts; var endPos = emitToken(86 /* ForKeyword */, node.pos); write(" "); endPos = emitToken(17 /* OpenParenToken */, endPos); - if (node.initializer.kind === 216 /* VariableDeclarationList */) { + if (node.initializer.kind === 218 /* VariableDeclarationList */) { var variableDeclarationList = node.initializer; if (variableDeclarationList.declarations.length >= 1) { tryEmitStartOfVariableDeclarationList(variableDeclarationList); @@ -35149,7 +36207,7 @@ var ts; else { emit(node.initializer); } - if (node.kind === 204 /* ForInStatement */) { + if (node.kind === 206 /* ForInStatement */) { write(" in "); } else { @@ -35239,7 +36297,7 @@ var ts; // let v = _a[_i]; var rhsIterationValue = createElementAccessExpression(rhsReference, counter); emitStart(node.initializer); - if (node.initializer.kind === 216 /* VariableDeclarationList */) { + if (node.initializer.kind === 218 /* VariableDeclarationList */) { write("var "); var variableDeclarationList = node.initializer; if (variableDeclarationList.declarations.length > 0) { @@ -35269,7 +36327,7 @@ var ts; // 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 === 168 /* ArrayLiteralExpression */ || node.initializer.kind === 169 /* ObjectLiteralExpression */) { + if (node.initializer.kind === 169 /* ArrayLiteralExpression */ || node.initializer.kind === 170 /* 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); @@ -35297,7 +36355,7 @@ var ts; // 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 === 207 /* BreakStatement */ ? 2 /* Break */ : 4 /* Continue */; + var jump = node.kind === 209 /* BreakStatement */ ? 2 /* Break */ : 4 /* Continue */; var canUseBreakOrContinue = (node.label && convertedLoopState.labels && convertedLoopState.labels[node.label.text]) || (!node.label && (convertedLoopState.allowedNonLabeledJumps & jump)); if (!canUseBreakOrContinue) { @@ -35305,18 +36363,19 @@ var ts; // explicit exit from loop -> copy out parameters copyLoopOutParameters(convertedLoopState, 1 /* ToOutParameter */, /*emitAsStatements*/ false); if (!node.label) { - if (node.kind === 207 /* BreakStatement */) { + if (node.kind === 209 /* 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 === 207 /* BreakStatement */) { + if (node.kind === 209 /* BreakStatement */) { labelMarker = "break-" + node.label.text; setLabeledJump(convertedLoopState, /*isBreak*/ true, node.label.text, labelMarker); } @@ -35329,7 +36388,7 @@ var ts; return; } } - emitToken(node.kind === 207 /* BreakStatement */ ? 70 /* BreakKeyword */ : 75 /* ContinueKeyword */, node.pos); + emitToken(node.kind === 209 /* BreakStatement */ ? 70 /* BreakKeyword */ : 75 /* ContinueKeyword */, node.pos); emitOptional(" ", node.label); write(";"); } @@ -35395,7 +36454,7 @@ var ts; ts.getLineOfLocalPositionFromLineMap(currentLineMap, ts.skipTrivia(currentText, node2.pos)); } function emitCaseOrDefaultClause(node) { - if (node.kind === 245 /* CaseClause */) { + if (node.kind === 248 /* CaseClause */) { write("case "); emit(node.expression); write(":"); @@ -35464,7 +36523,7 @@ var ts; function getContainingModule(node) { do { node = node.parent; - } while (node && node.kind !== 222 /* ModuleDeclaration */); + } while (node && node.kind !== 224 /* ModuleDeclaration */); return node; } function emitContainingModuleName(node) { @@ -35489,19 +36548,19 @@ var ts; function createVoidZero() { var zero = ts.createSynthesizedNode(8 /* NumericLiteral */); zero.text = "0"; - var result = ts.createSynthesizedNode(181 /* VoidExpression */); + var result = ts.createSynthesizedNode(182 /* VoidExpression */); result.expression = zero; return result; } function emitEs6ExportDefaultCompat(node) { - if (node.parent.kind === 252 /* SourceFile */) { - ts.Debug.assert(!!(node.flags & 512 /* Default */) || node.kind === 231 /* ExportAssignment */); + if (node.parent.kind === 255 /* SourceFile */) { + ts.Debug.assert(!!(node.flags & 512 /* Default */) || node.kind === 234 /* 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 });"); + write('Object.defineProperty(exports, "__esModule", { value: true });'); writeLine(); } else { @@ -35535,7 +36594,7 @@ var ts; if (node.flags & 512 /* Default */) { emitEs6ExportDefaultCompat(node); if (languageVersion === 0 /* ES3 */) { - write("exports[\"default\"]"); + write('exports["default"]'); } else { write("exports.default"); @@ -35601,7 +36660,7 @@ var ts; emitNodeWithCommentsAndWithoutSourcemap(name); write("\", "); } - var isVariableDeclarationOrBindingElement = name.parent && (name.parent.kind === 215 /* VariableDeclaration */ || name.parent.kind === 167 /* BindingElement */); + var isVariableDeclarationOrBindingElement = name.parent && (name.parent.kind === 217 /* VariableDeclaration */ || name.parent.kind === 168 /* 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); @@ -35635,8 +36694,8 @@ var ts; return identifier; } function isFirstVariableDeclaration(root) { - return root.kind === 215 /* VariableDeclaration */ && - root.parent.kind === 216 /* VariableDeclarationList */ && + return root.kind === 217 /* VariableDeclaration */ && + root.parent.kind === 218 /* VariableDeclarationList */ && root.parent.declarations[0] === root; } function emitDestructuring(root, isAssignmentExpressionStatement, value) { @@ -35646,15 +36705,15 @@ var ts; // 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 === 215 /* VariableDeclaration */) { + if (root.kind === 217 /* VariableDeclaration */) { var isExported = ts.getCombinedNodeFlags(root) & 1 /* Export */; var isSourceLevelForSystemModuleKind = shouldHoistDeclarationInSystemJsModule(root); canDefineTempVariablesInPlace = !isExported && !isSourceLevelForSystemModuleKind; } - else if (root.kind === 140 /* Parameter */) { + else if (root.kind === 141 /* Parameter */) { canDefineTempVariablesInPlace = true; } - if (root.kind === 185 /* BinaryExpression */) { + if (root.kind === 186 /* BinaryExpression */) { emitAssignmentExpression(root); } else { @@ -35689,14 +36748,14 @@ var ts; // 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(185 /* BinaryExpression */); + var equals = ts.createSynthesizedNode(186 /* 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(186 /* ConditionalExpression */); + var cond = ts.createSynthesizedNode(187 /* ConditionalExpression */); cond.condition = condition; cond.questionToken = ts.createSynthesizedNode(53 /* QuestionToken */); cond.whenTrue = whenTrue; @@ -35711,7 +36770,7 @@ var ts; } function createPropertyAccessForDestructuringProperty(object, propName) { var index; - var nameIsComputed = propName.kind === 138 /* ComputedPropertyName */; + var nameIsComputed = propName.kind === 139 /* 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); @@ -35731,7 +36790,7 @@ var ts; : createElementAccessExpression(object, index); } function createSliceCall(value, sliceIndex) { - var call = ts.createSynthesizedNode(172 /* CallExpression */); + var call = ts.createSynthesizedNode(173 /* CallExpression */); var sliceIdentifier = ts.createSynthesizedNode(69 /* Identifier */); sliceIdentifier.text = "slice"; call.expression = createPropertyAccessExpression(value, sliceIdentifier); @@ -35749,9 +36808,9 @@ var ts; } for (var _a = 0, properties_5 = properties; _a < properties_5.length; _a++) { var p = properties_5[_a]; - if (p.kind === 249 /* PropertyAssignment */ || p.kind === 250 /* ShorthandPropertyAssignment */) { + if (p.kind === 252 /* PropertyAssignment */ || p.kind === 253 /* ShorthandPropertyAssignment */) { var propName = p.name; - var target_1 = p.kind === 250 /* ShorthandPropertyAssignment */ ? p : p.initializer || propName; + var target_1 = p.kind === 253 /* 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); } @@ -35767,9 +36826,9 @@ var ts; } for (var i = 0; i < elements.length; i++) { var e = elements[i]; - if (e.kind !== 191 /* OmittedExpression */) { + if (e.kind !== 192 /* OmittedExpression */) { // Assignment for target = value.propName should highlight whole property, hence use e as source map node - if (e.kind !== 189 /* SpreadElementExpression */) { + if (e.kind !== 190 /* SpreadElementExpression */) { emitDestructuringAssignment(e, createElementAccessExpression(value, createNumericLiteral(i)), e); } else if (i === elements.length - 1) { @@ -35780,20 +36839,20 @@ var ts; } 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 === 250 /* ShorthandPropertyAssignment */) { + if (target.kind === 253 /* ShorthandPropertyAssignment */) { if (target.objectAssignmentInitializer) { value = createDefaultValueCheck(value, target.objectAssignmentInitializer, sourceMapNode); } target = target.name; } - else if (target.kind === 185 /* BinaryExpression */ && target.operatorToken.kind === 56 /* EqualsToken */) { + else if (target.kind === 186 /* BinaryExpression */ && target.operatorToken.kind === 56 /* EqualsToken */) { value = createDefaultValueCheck(value, target.right, sourceMapNode); target = target.left; } - if (target.kind === 169 /* ObjectLiteralExpression */) { + if (target.kind === 170 /* ObjectLiteralExpression */) { emitObjectLiteralAssignment(target, value, sourceMapNode); } - else if (target.kind === 168 /* ArrayLiteralExpression */) { + else if (target.kind === 169 /* ArrayLiteralExpression */) { emitArrayLiteralAssignment(target, value, sourceMapNode); } else { @@ -35815,7 +36874,7 @@ var ts; emitDestructuringAssignment(target, value, ts.nodeIsSynthesized(root) ? target : root); } else { - if (root.parent.kind !== 176 /* ParenthesizedExpression */) { + if (root.parent.kind !== 177 /* ParenthesizedExpression */) { write("("); } // Temporary assignment needed to emit root should highlight whole binary expression @@ -35824,7 +36883,7 @@ var ts; emitDestructuringAssignment(target, value, root); write(", "); emit(value); - if (root.parent.kind !== 176 /* ParenthesizedExpression */) { + if (root.parent.kind !== 177 /* ParenthesizedExpression */) { write(")"); } } @@ -35852,12 +36911,12 @@ var ts; } for (var i = 0; i < numElements; i++) { var element = elements[i]; - if (pattern.kind === 165 /* ObjectBindingPattern */) { + if (pattern.kind === 166 /* 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 !== 191 /* OmittedExpression */) { + else if (element.kind !== 192 /* OmittedExpression */) { if (!element.dotDotDotToken) { // Rewrite element to a declaration that accesses array element at index i emitBindingElement(element, createElementAccessExpression(value, createNumericLiteral(i))); @@ -35876,12 +36935,26 @@ var ts; } function emitVariableDeclaration(node) { if (ts.isBindingPattern(node.name)) { - if (languageVersion < 2 /* ES6 */) { - emitDestructuring(node, /*isAssignmentExpressionStatement*/ false); - } - else { + 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 { @@ -35917,12 +36990,12 @@ var ts; var isCapturedInFunction = flags & 131072 /* CapturedBlockScopedBinding */; var isDeclaredInLoop = flags & 262144 /* BlockScopedBindingInLoop */; var emittedAsTopLevel = ts.isBlockScopedContainerTopLevel(container) || - (isCapturedInFunction && isDeclaredInLoop && container.kind === 196 /* Block */ && ts.isIterationStatement(container.parent, /*lookInLabeledStatements*/ false)); + (isCapturedInFunction && isDeclaredInLoop && container.kind === 198 /* Block */ && ts.isIterationStatement(container.parent, /*lookInLabeledStatements*/ false)); var emittedAsNestedLetDeclaration = ts.getCombinedNodeFlags(node) & 1024 /* Let */ && !emittedAsTopLevel; var emitExplicitInitializer = emittedAsNestedLetDeclaration && - container.kind !== 204 /* ForInStatement */ && - container.kind !== 205 /* ForOfStatement */ && + container.kind !== 206 /* ForInStatement */ && + container.kind !== 207 /* ForOfStatement */ && (!resolver.isDeclarationWithCollidingName(node) || (isDeclaredInLoop && !isCapturedInFunction && !ts.isIterationStatement(container, /*lookInLabeledStatements*/ false))); if (emitExplicitInitializer) { @@ -35943,7 +37016,7 @@ var ts; } } function emitExportVariableAssignments(node) { - if (node.kind === 191 /* OmittedExpression */) { + if (node.kind === 192 /* OmittedExpression */) { return; } var name = node.name; @@ -35957,7 +37030,7 @@ var ts; function isES6ExportedDeclaration(node) { return !!(node.flags & 1 /* Export */) && modulekind === ts.ModuleKind.ES6 && - node.parent.kind === 252 /* SourceFile */; + node.parent.kind === 255 /* SourceFile */; } function emitVariableStatement(node) { var startIsEmitted = false; @@ -36008,12 +37081,12 @@ var ts; function emitParameter(node) { if (languageVersion < 2 /* ES6 */) { if (ts.isBindingPattern(node.name)) { - var name_26 = createTempVariable(0 /* Auto */); + var name_28 = createTempVariable(0 /* Auto */); if (!tempParameters) { tempParameters = []; } - tempParameters.push(name_26); - emit(name_26); + tempParameters.push(name_28); + emit(name_28); } else { emit(node.name); @@ -36118,12 +37191,12 @@ var ts; } } function emitAccessor(node) { - write(node.kind === 147 /* GetAccessor */ ? "get " : "set "); + write(node.kind === 148 /* GetAccessor */ ? "get " : "set "); emit(node.name); emitSignatureAndBody(node); } function shouldEmitAsArrowFunction(node) { - return node.kind === 178 /* ArrowFunction */ && languageVersion >= 2 /* ES6 */; + return node.kind === 179 /* ArrowFunction */ && languageVersion >= 2 /* ES6 */; } function emitDeclarationName(node) { if (node.name) { @@ -36134,11 +37207,11 @@ var ts; } } function shouldEmitFunctionName(node) { - if (node.kind === 177 /* FunctionExpression */) { + if (node.kind === 178 /* FunctionExpression */) { // Emit name if one is present return !!node.name; } - if (node.kind === 217 /* FunctionDeclaration */) { + if (node.kind === 219 /* 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; } @@ -36150,12 +37223,12 @@ var ts; // 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 !== 145 /* MethodDeclaration */ && - kind !== 144 /* MethodSignature */ && + if (kind !== 146 /* MethodDeclaration */ && + kind !== 145 /* MethodSignature */ && parent && - parent.kind !== 249 /* PropertyAssignment */ && - parent.kind !== 172 /* CallExpression */ && - parent.kind !== 168 /* ArrayLiteralExpression */) { + parent.kind !== 252 /* PropertyAssignment */ && + parent.kind !== 173 /* CallExpression */ && + parent.kind !== 169 /* ArrayLiteralExpression */) { // 1. Methods will emit comments at their assignment declaration sites. // // 2. If the function is a property of object literal, emitting leading-comments @@ -36194,11 +37267,13 @@ var ts; emitDeclarationName(node); } emitSignatureAndBody(node); - if (modulekind !== ts.ModuleKind.ES6 && kind === 217 /* FunctionDeclaration */ && parent === currentSourceFile && node.name) { + if (modulekind !== ts.ModuleKind.ES6 && kind === 219 /* FunctionDeclaration */ && parent === currentSourceFile && node.name) { emitExportMemberAssignments(node.name); } emitEnd(node); - if (kind !== 145 /* MethodDeclaration */ && kind !== 144 /* MethodSignature */) { + if (kind !== 146 /* MethodDeclaration */ && + kind !== 145 /* MethodSignature */ && + kind !== 179 /* ArrowFunction */) { emitTrailingComments(node); } } @@ -36215,8 +37290,9 @@ var ts; write("("); if (node) { var parameters = node.parameters; + var skipCount = node.parameters.length && node.parameters[0].name.text === "this" ? 1 : 0; var omitCount = languageVersion < 2 /* ES6 */ && ts.hasRestParameter(node) ? 1 : 0; - emitList(parameters, 0, parameters.length - omitCount, /*multiLine*/ false, /*trailingComma*/ false); + emitList(parameters, skipCount, parameters.length - omitCount - skipCount, /*multiLine*/ false, /*trailingComma*/ false); } write(")"); decreaseIndent(); @@ -36231,7 +37307,7 @@ var ts; } function emitAsyncFunctionBodyForES6(node) { var promiseConstructor = ts.getEntityNameFromTypeNode(node.type); - var isArrowFunction = node.kind === 178 /* ArrowFunction */; + var isArrowFunction = node.kind === 179 /* 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 @@ -36353,7 +37429,7 @@ var ts; write(" { }"); } else { - if (node.body.kind === 196 /* Block */) { + if (node.body.kind === 198 /* Block */) { emitBlockFunctionBody(node, node.body); } else { @@ -36412,10 +37488,10 @@ var ts; write(" "); // Unwrap all type assertions. var current = body; - while (current.kind === 175 /* TypeAssertionExpression */) { + while (current.kind === 176 /* TypeAssertionExpression */) { current = current.expression; } - emitParenthesizedIf(body, current.kind === 169 /* ObjectLiteralExpression */); + emitParenthesizedIf(body, current.kind === 170 /* ObjectLiteralExpression */); } function emitDownLevelExpressionFunctionBody(node, body) { write(" {"); @@ -36500,7 +37576,7 @@ var ts; return undefined; } var statement = statements[index]; - if (statement.kind === 199 /* ExpressionStatement */) { + if (statement.kind === 201 /* ExpressionStatement */) { return ts.isSuperCallExpression(statement.expression) ? statement : undefined; } } @@ -36529,7 +37605,7 @@ var ts; emitNodeWithCommentsAndWithoutSourcemap(memberName); write("]"); } - else if (memberName.kind === 138 /* ComputedPropertyName */) { + else if (memberName.kind === 139 /* ComputedPropertyName */) { emitComputedPropertyName(memberName); } else { @@ -36541,7 +37617,7 @@ var ts; var properties = []; for (var _a = 0, _b = node.members; _a < _b.length; _a++) { var member = _b[_a]; - if (member.kind === 143 /* PropertyDeclaration */ && isStatic === ((member.flags & 32 /* Static */) !== 0) && member.initializer) { + if (member.kind === 144 /* PropertyDeclaration */ && isStatic === ((member.flags & 32 /* Static */) !== 0) && member.initializer) { properties.push(member); } } @@ -36581,11 +37657,11 @@ var ts; } function emitMemberFunctionsForES5AndLower(node) { ts.forEach(node.members, function (member) { - if (member.kind === 195 /* SemicolonClassElement */) { + if (member.kind === 197 /* SemicolonClassElement */) { writeLine(); write(";"); } - else if (member.kind === 145 /* MethodDeclaration */ || node.kind === 144 /* MethodSignature */) { + else if (member.kind === 146 /* MethodDeclaration */ || node.kind === 145 /* MethodSignature */) { if (!member.body) { return emitCommentsOnNotEmittedNode(member); } @@ -36602,7 +37678,7 @@ var ts; write(";"); emitTrailingComments(member); } - else if (member.kind === 147 /* GetAccessor */ || member.kind === 148 /* SetAccessor */) { + else if (member.kind === 148 /* GetAccessor */ || member.kind === 149 /* SetAccessor */) { var accessors = ts.getAllAccessorDeclarations(node.members, member); if (member === accessors.firstAccessor) { writeLine(); @@ -36652,22 +37728,22 @@ var ts; function emitMemberFunctionsForES6AndHigher(node) { for (var _a = 0, _b = node.members; _a < _b.length; _a++) { var member = _b[_a]; - if ((member.kind === 145 /* MethodDeclaration */ || node.kind === 144 /* MethodSignature */) && !member.body) { + if ((member.kind === 146 /* MethodDeclaration */ || node.kind === 145 /* MethodSignature */) && !member.body) { emitCommentsOnNotEmittedNode(member); } - else if (member.kind === 145 /* MethodDeclaration */ || - member.kind === 147 /* GetAccessor */ || - member.kind === 148 /* SetAccessor */) { + else if (member.kind === 146 /* MethodDeclaration */ || + member.kind === 148 /* GetAccessor */ || + member.kind === 149 /* SetAccessor */) { writeLine(); emitLeadingComments(member); emitStart(member); if (member.flags & 32 /* Static */) { write("static "); } - if (member.kind === 147 /* GetAccessor */) { + if (member.kind === 148 /* GetAccessor */) { write("get "); } - else if (member.kind === 148 /* SetAccessor */) { + else if (member.kind === 149 /* SetAccessor */) { write("set "); } if (member.asteriskToken) { @@ -36678,7 +37754,7 @@ var ts; emitEnd(member); emitTrailingComments(member); } - else if (member.kind === 195 /* SemicolonClassElement */) { + else if (member.kind === 197 /* SemicolonClassElement */) { writeLine(); write(";"); } @@ -36707,11 +37783,11 @@ var ts; var hasInstancePropertyWithInitializer = false; // Emit the constructor overload pinned comments ts.forEach(node.members, function (member) { - if (member.kind === 146 /* Constructor */ && !member.body) { + if (member.kind === 147 /* Constructor */ && !member.body) { emitCommentsOnNotEmittedNode(member); } // Check if there is any non-static property assignment - if (member.kind === 143 /* PropertyDeclaration */ && member.initializer && (member.flags & 32 /* Static */) === 0) { + if (member.kind === 144 /* PropertyDeclaration */ && member.initializer && (member.flags & 32 /* Static */) === 0) { hasInstancePropertyWithInitializer = true; } }); @@ -36825,9 +37901,11 @@ var ts; } function emitClassLikeDeclarationForES6AndHigher(node) { var decoratedClassAlias; - var thisNodeIsDecorated = ts.nodeIsDecorated(node); - if (node.kind === 218 /* ClassDeclaration */) { - if (thisNodeIsDecorated) { + var isHoistedDeclarationInSystemModule = shouldHoistDeclarationInSystemJsModule(node); + var isDecorated = ts.nodeIsDecorated(node); + var rewriteAsClassExpression = isDecorated || isHoistedDeclarationInSystemModule; + if (node.kind === 220 /* ClassDeclaration */) { + if (rewriteAsClassExpression) { // When we emit an ES6 class that has a class decorator, we must tailor the // emit to certain specific cases. // @@ -36907,7 +37985,10 @@ var ts; // --------------------------------------------------------------------- // [Example 4] // - if (resolver.getNodeCheckFlags(node) & 524288 /* ClassWithBodyScopedClassBinding */) { + // 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; write("let " + decoratedClassAlias + ";"); @@ -36916,7 +37997,9 @@ var ts; if (isES6ExportedDeclaration(node) && !(node.flags & 512 /* Default */)) { write("export "); } - write("let "); + if (!isHoistedDeclarationInSystemModule) { + write("let "); + } emitDeclarationName(node); if (decoratedClassAlias !== undefined) { write(" = " + decoratedClassAlias); @@ -36942,7 +38025,7 @@ var ts; // 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 === 190 /* ClassExpression */; + var isClassExpressionWithStaticProperties = staticProperties.length > 0 && node.kind === 191 /* ClassExpression */; var tempVariable; if (isClassExpressionWithStaticProperties) { tempVariable = createAndRecordTempVariable(0 /* Auto */); @@ -36955,7 +38038,7 @@ var ts; // 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) && !thisNodeIsDecorated)) { + if (node.name || (node.flags & 512 /* Default */ && (staticProperties.length > 0 || modulekind !== ts.ModuleKind.ES6) && !rewriteAsClassExpression)) { write(" "); emitDeclarationName(node); } @@ -36972,7 +38055,7 @@ var ts; decreaseIndent(); writeLine(); emitToken(16 /* CloseBraceToken */, node.members.end); - if (thisNodeIsDecorated) { + if (rewriteAsClassExpression) { decoratedClassAliases[ts.getNodeId(node)] = undefined; write(";"); } @@ -37010,14 +38093,14 @@ var ts; // 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 (thisNodeIsDecorated) { + if (isDecorated) { writeLine(); write("export default "); emitDeclarationName(node); write(";"); } } - else if (node.parent.kind !== 252 /* SourceFile */) { + else if (node.parent.kind !== 255 /* SourceFile */) { writeLine(); emitStart(node); emitModuleMemberName(node); @@ -37029,7 +38112,7 @@ var ts; } } function emitClassLikeDeclarationBelowES6(node) { - if (node.kind === 218 /* ClassDeclaration */) { + if (node.kind === 220 /* ClassDeclaration */) { // source file level classes in system modules are hoisted so 'var's for them are already defined if (!shouldHoistDeclarationInSystemJsModule(node)) { write("var "); @@ -37090,11 +38173,11 @@ var ts; emit(baseTypeNode.expression); } write("))"); - if (node.kind === 218 /* ClassDeclaration */) { + if (node.kind === 220 /* ClassDeclaration */) { write(";"); } emitEnd(node); - if (node.kind === 218 /* ClassDeclaration */) { + if (node.kind === 220 /* ClassDeclaration */) { emitExportMemberAssignment(node); } } @@ -37181,7 +38264,7 @@ var ts; else { decorators = member.decorators; // we only decorate the parameters here if this is a method - if (member.kind === 145 /* MethodDeclaration */) { + if (member.kind === 146 /* MethodDeclaration */) { functionLikeMember = member; } } @@ -37238,7 +38321,7 @@ var ts; write(", "); emitExpressionForPropertyName(member.name); if (languageVersion > 0 /* ES3 */) { - if (member.kind !== 143 /* PropertyDeclaration */) { + if (member.kind !== 144 /* 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"); @@ -37280,10 +38363,10 @@ var ts; // The caller should have already tested whether the node has decorators and whether the emitDecoratorMetadata // compiler option is set. switch (node.kind) { - case 145 /* MethodDeclaration */: - case 147 /* GetAccessor */: - case 148 /* SetAccessor */: - case 143 /* PropertyDeclaration */: + case 146 /* MethodDeclaration */: + case 148 /* GetAccessor */: + case 149 /* SetAccessor */: + case 144 /* PropertyDeclaration */: return true; } return false; @@ -37293,7 +38376,7 @@ var ts; // The caller should have already tested whether the node has decorators and whether the emitDecoratorMetadata // compiler option is set. switch (node.kind) { - case 145 /* MethodDeclaration */: + case 146 /* MethodDeclaration */: return true; } return false; @@ -37303,9 +38386,9 @@ var ts; // The caller should have already tested whether the node has decorators and whether the emitDecoratorMetadata // compiler option is set. switch (node.kind) { - case 218 /* ClassDeclaration */: - case 145 /* MethodDeclaration */: - case 148 /* SetAccessor */: + case 220 /* ClassDeclaration */: + case 146 /* MethodDeclaration */: + case 149 /* SetAccessor */: return true; } return false; @@ -37323,19 +38406,19 @@ var ts; // // For rules on serializing type annotations, see `serializeTypeNode`. switch (node.kind) { - case 218 /* ClassDeclaration */: + case 220 /* ClassDeclaration */: write("Function"); return; - case 143 /* PropertyDeclaration */: + case 144 /* PropertyDeclaration */: emitSerializedTypeNode(node.type); return; - case 140 /* Parameter */: + case 141 /* Parameter */: emitSerializedTypeNode(node.type); return; - case 147 /* GetAccessor */: + case 148 /* GetAccessor */: emitSerializedTypeNode(node.type); return; - case 148 /* SetAccessor */: + case 149 /* SetAccessor */: emitSerializedTypeNode(ts.getSetAccessorTypeAnnotationNode(node)); return; } @@ -37351,23 +38434,23 @@ var ts; case 103 /* VoidKeyword */: write("void 0"); return; - case 162 /* ParenthesizedType */: + case 163 /* ParenthesizedType */: emitSerializedTypeNode(node.type); return; - case 154 /* FunctionType */: - case 155 /* ConstructorType */: + case 155 /* FunctionType */: + case 156 /* ConstructorType */: write("Function"); return; - case 158 /* ArrayType */: - case 159 /* TupleType */: + case 159 /* ArrayType */: + case 160 /* TupleType */: write("Array"); return; - case 152 /* TypePredicate */: + case 153 /* TypePredicate */: case 120 /* BooleanKeyword */: write("Boolean"); return; case 131 /* StringKeyword */: - case 164 /* StringLiteralType */: + case 165 /* StringLiteralType */: write("String"); return; case 129 /* NumberKeyword */: @@ -37376,15 +38459,15 @@ var ts; case 132 /* SymbolKeyword */: write("Symbol"); return; - case 153 /* TypeReference */: + case 154 /* TypeReference */: emitSerializedTypeReferenceNode(node); return; - case 156 /* TypeQuery */: - case 157 /* TypeLiteral */: - case 160 /* UnionType */: - case 161 /* IntersectionType */: + case 157 /* TypeQuery */: + case 158 /* TypeLiteral */: + case 161 /* UnionType */: + case 162 /* IntersectionType */: case 117 /* AnyKeyword */: - case 163 /* ThisType */: + case 164 /* ThisType */: break; default: ts.Debug.fail("Cannot serialize unexpected type node."); @@ -37457,7 +38540,7 @@ var ts; // For the rules on serializing the type of each parameter declaration, see `serializeTypeOfDeclaration`. if (node) { var valueDeclaration = void 0; - if (node.kind === 218 /* ClassDeclaration */) { + if (node.kind === 220 /* ClassDeclaration */) { valueDeclaration = ts.getFirstConstructorWithBody(node); } else if (ts.isFunctionLike(node) && ts.nodeIsPresent(node.body)) { @@ -37473,10 +38556,10 @@ var ts; } if (parameters[i].dotDotDotToken) { var parameterType = parameters[i].type; - if (parameterType.kind === 158 /* ArrayType */) { + if (parameterType.kind === 159 /* ArrayType */) { parameterType = parameterType.elementType; } - else if (parameterType.kind === 153 /* TypeReference */ && parameterType.typeArguments && parameterType.typeArguments.length === 1) { + else if (parameterType.kind === 154 /* TypeReference */ && parameterType.typeArguments && parameterType.typeArguments.length === 1) { parameterType = parameterType.typeArguments[0]; } else { @@ -37553,7 +38636,7 @@ var ts; 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, 221 /* EnumDeclaration */))) { + if (!(node.flags & 1 /* Export */) || (isES6ExportedEnum && isFirstDeclarationOfKind(node, node.symbol && node.symbol.declarations, 223 /* EnumDeclaration */))) { emitStart(node); if (isES6ExportedEnum) { write("export "); @@ -37635,7 +38718,7 @@ var ts; } } function getInnerMostModuleDeclarationFromDottedModule(moduleDeclaration) { - if (moduleDeclaration.body.kind === 222 /* ModuleDeclaration */) { + if (moduleDeclaration.body.kind === 224 /* ModuleDeclaration */) { var recursiveInnerModule = getInnerMostModuleDeclarationFromDottedModule(moduleDeclaration.body); return recursiveInnerModule || moduleDeclaration.body; } @@ -37659,7 +38742,7 @@ var ts; var emitVarForModule = !hoistedInDeclarationScope && !isModuleMergedWithES6Class(node); if (emitVarForModule) { var isES6ExportedNamespace = isES6ExportedDeclaration(node); - if (!isES6ExportedNamespace || isFirstDeclarationOfKind(node, node.symbol && node.symbol.declarations, 222 /* ModuleDeclaration */)) { + if (!isES6ExportedNamespace || isFirstDeclarationOfKind(node, node.symbol && node.symbol.declarations, 224 /* ModuleDeclaration */)) { emitStart(node); if (isES6ExportedNamespace) { write("export "); @@ -37677,7 +38760,7 @@ var ts; write(getGeneratedNameForNode(node)); emitEnd(node.name); write(") "); - if (node.body.kind === 223 /* ModuleBlock */) { + if (node.body.kind === 225 /* ModuleBlock */) { var saveConvertedLoopState = convertedLoopState; var saveTempFlags = tempFlags; var saveTempVariables = tempVariables; @@ -37753,16 +38836,16 @@ var ts; } } function getNamespaceDeclarationNode(node) { - if (node.kind === 225 /* ImportEqualsDeclaration */) { + if (node.kind === 228 /* ImportEqualsDeclaration */) { return node; } var importClause = node.importClause; - if (importClause && importClause.namedBindings && importClause.namedBindings.kind === 228 /* NamespaceImport */) { + if (importClause && importClause.namedBindings && importClause.namedBindings.kind === 231 /* NamespaceImport */) { return importClause.namedBindings; } } function isDefaultImport(node) { - return node.kind === 226 /* ImportDeclaration */ && node.importClause && !!node.importClause.name; + return node.kind === 229 /* ImportDeclaration */ && node.importClause && !!node.importClause.name; } function emitExportImportAssignments(node) { if (ts.isAliasSymbolDeclaration(node) && resolver.isValueAliasDeclaration(node)) { @@ -37790,7 +38873,7 @@ var ts; if (shouldEmitNamedBindings) { emitLeadingComments(node.importClause.namedBindings); emitStart(node.importClause.namedBindings); - if (node.importClause.namedBindings.kind === 228 /* NamespaceImport */) { + if (node.importClause.namedBindings.kind === 231 /* NamespaceImport */) { write("* as "); emit(node.importClause.namedBindings.name); } @@ -37816,7 +38899,7 @@ var ts; } function emitExternalImportDeclaration(node) { if (ts.contains(externalImports, node)) { - var isExportedImport = node.kind === 225 /* ImportEqualsDeclaration */ && (node.flags & 1 /* Export */) !== 0; + var isExportedImport = node.kind === 228 /* ImportEqualsDeclaration */ && (node.flags & 1 /* Export */) !== 0; var namespaceDeclaration = getNamespaceDeclarationNode(node); var varOrConst = (languageVersion <= 1 /* ES5 */) ? "var " : "const "; if (modulekind !== ts.ModuleKind.AMD) { @@ -37838,7 +38921,7 @@ var ts; // import { x, y } from "foo" // import d, * as x from "foo" // import d, { x, y } from "foo" - var isNakedImport = 226 /* ImportDeclaration */ && !node.importClause; + var isNakedImport = 229 /* ImportDeclaration */ && !node.importClause; if (!isNakedImport) { write(varOrConst); write(getGeneratedNameForNode(node)); @@ -38017,8 +39100,8 @@ var ts; write("export default "); var expression = node.expression; emit(expression); - if (expression.kind !== 217 /* FunctionDeclaration */ && - expression.kind !== 218 /* ClassDeclaration */) { + if (expression.kind !== 219 /* FunctionDeclaration */ && + expression.kind !== 220 /* ClassDeclaration */) { write(";"); } emitEnd(node); @@ -38035,7 +39118,7 @@ var ts; emitEs6ExportDefaultCompat(node); emitContainingModuleName(node); if (languageVersion === 0 /* ES3 */) { - write("[\"default\"] = "); + write('["default"] = '); } else { write(".default = "); @@ -38055,7 +39138,7 @@ var ts; for (var _a = 0, _b = sourceFile.statements; _a < _b.length; _a++) { var node = _b[_a]; switch (node.kind) { - case 226 /* ImportDeclaration */: + case 229 /* ImportDeclaration */: if (!node.importClause || resolver.isReferencedAliasDeclaration(node.importClause, /*checkChildren*/ true)) { // import "mod" @@ -38065,13 +39148,13 @@ var ts; externalImports.push(node); } break; - case 225 /* ImportEqualsDeclaration */: - if (node.moduleReference.kind === 236 /* ExternalModuleReference */ && resolver.isReferencedAliasDeclaration(node)) { + case 228 /* ImportEqualsDeclaration */: + if (node.moduleReference.kind === 239 /* ExternalModuleReference */ && resolver.isReferencedAliasDeclaration(node)) { // import x = require("mod") where x is referenced externalImports.push(node); } break; - case 232 /* ExportDeclaration */: + case 235 /* ExportDeclaration */: if (node.moduleSpecifier) { if (!node.exportClause) { // export * from "mod" @@ -38089,12 +39172,12 @@ var ts; // export { x, y } for (var _c = 0, _d = node.exportClause.elements; _c < _d.length; _c++) { var specifier = _d[_c]; - var name_27 = (specifier.propertyName || specifier.name).text; - (exportSpecifiers[name_27] || (exportSpecifiers[name_27] = [])).push(specifier); + var name_29 = (specifier.propertyName || specifier.name).text; + (exportSpecifiers[name_29] || (exportSpecifiers[name_29] = [])).push(specifier); } } break; - case 231 /* ExportAssignment */: + case 234 /* ExportAssignment */: if (node.isExportEquals && !exportEquals) { // export = x exportEquals = node; @@ -38120,18 +39203,18 @@ var ts; if (namespaceDeclaration && !isDefaultImport(node)) { return ts.getTextOfNodeFromSourceText(currentText, namespaceDeclaration.name); } - if (node.kind === 226 /* ImportDeclaration */ && node.importClause) { + if (node.kind === 229 /* ImportDeclaration */ && node.importClause) { return getGeneratedNameForNode(node); } - if (node.kind === 232 /* ExportDeclaration */ && node.moduleSpecifier) { + if (node.kind === 235 /* ExportDeclaration */ && node.moduleSpecifier) { return getGeneratedNameForNode(node); } } function getExternalModuleNameText(importNode, emitRelativePathAsModuleName) { if (emitRelativePathAsModuleName) { - var name_28 = getExternalModuleNameFromDeclaration(host, resolver, importNode); - if (name_28) { - return "\"" + name_28 + "\""; + var name_30 = getExternalModuleNameFromDeclaration(host, resolver, importNode); + if (name_30) { + return "\"" + name_30 + "\""; } } var moduleName = ts.getExternalModuleName(importNode); @@ -38149,8 +39232,8 @@ var ts; 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 === 232 /* ExportDeclaration */ || - (importNode.kind === 226 /* ImportDeclaration */ && !importNode.importClause); + var skipNode = importNode.kind === 235 /* ExportDeclaration */ || + (importNode.kind === 229 /* ImportDeclaration */ && !importNode.importClause); if (skipNode) { continue; } @@ -38183,7 +39266,7 @@ var ts; var hasExportDeclarationWithExportClause = false; for (var _a = 0, externalImports_2 = externalImports; _a < externalImports_2.length; _a++) { var externalImport = externalImports_2[_a]; - if (externalImport.kind === 232 /* ExportDeclaration */ && externalImport.exportClause) { + if (externalImport.kind === 235 /* ExportDeclaration */ && externalImport.exportClause) { hasExportDeclarationWithExportClause = true; break; } @@ -38215,7 +39298,7 @@ var ts; } for (var _d = 0, externalImports_3 = externalImports; _d < externalImports_3.length; _d++) { var externalImport = externalImports_3[_d]; - if (externalImport.kind !== 232 /* ExportDeclaration */) { + if (externalImport.kind !== 235 /* ExportDeclaration */) { continue; } var exportDecl = externalImport; @@ -38303,12 +39386,12 @@ var ts; var seen = {}; for (var i = 0; i < hoistedVars.length; i++) { var local = hoistedVars[i]; - var name_29 = local.kind === 69 /* Identifier */ + var name_31 = local.kind === 69 /* Identifier */ ? local : local.name; - if (name_29) { + if (name_31) { // do not emit duplicate entries (in case of declaration merging) in the list of hoisted variables - var text = ts.unescapeIdentifier(name_29.text); + var text = ts.unescapeIdentifier(name_31.text); if (ts.hasProperty(seen, text)) { continue; } @@ -38319,7 +39402,7 @@ var ts; if (i !== 0) { write(", "); } - if (local.kind === 218 /* ClassDeclaration */ || local.kind === 222 /* ModuleDeclaration */ || local.kind === 221 /* EnumDeclaration */) { + if (local.kind === 220 /* ClassDeclaration */ || local.kind === 224 /* ModuleDeclaration */ || local.kind === 223 /* EnumDeclaration */) { emitDeclarationName(local); } else { @@ -38353,21 +39436,21 @@ var ts; if (node.flags & 2 /* Ambient */) { return; } - if (node.kind === 217 /* FunctionDeclaration */) { + if (node.kind === 219 /* FunctionDeclaration */) { if (!hoistedFunctionDeclarations) { hoistedFunctionDeclarations = []; } hoistedFunctionDeclarations.push(node); return; } - if (node.kind === 218 /* ClassDeclaration */) { + if (node.kind === 220 /* ClassDeclaration */) { if (!hoistedVars) { hoistedVars = []; } hoistedVars.push(node); return; } - if (node.kind === 221 /* EnumDeclaration */) { + if (node.kind === 223 /* EnumDeclaration */) { if (shouldEmitEnumDeclaration(node)) { if (!hoistedVars) { hoistedVars = []; @@ -38376,7 +39459,7 @@ var ts; } return; } - if (node.kind === 222 /* ModuleDeclaration */) { + if (node.kind === 224 /* ModuleDeclaration */) { if (shouldEmitModuleDeclaration(node)) { if (!hoistedVars) { hoistedVars = []; @@ -38385,17 +39468,17 @@ var ts; } return; } - if (node.kind === 215 /* VariableDeclaration */ || node.kind === 167 /* BindingElement */) { + if (node.kind === 217 /* VariableDeclaration */ || node.kind === 168 /* BindingElement */) { if (shouldHoistVariable(node, /*checkIfSourceFileLevelDecl*/ false)) { - var name_30 = node.name; - if (name_30.kind === 69 /* Identifier */) { + var name_32 = node.name; + if (name_32.kind === 69 /* Identifier */) { if (!hoistedVars) { hoistedVars = []; } - hoistedVars.push(name_30); + hoistedVars.push(name_32); } else { - ts.forEachChild(name_30, visit); + ts.forEachChild(name_32, visit); } } return; @@ -38426,7 +39509,7 @@ var ts; // 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 === 252 /* SourceFile */; + ts.getEnclosingBlockScopeContainer(node).kind === 255 /* SourceFile */; } function isCurrentFileSystemExternalModule() { return modulekind === ts.ModuleKind.System && isCurrentFileExternalModule; @@ -38501,21 +39584,21 @@ var ts; var entry = group_1[_a]; var importVariableName = getLocalNameForExternalImport(entry) || ""; switch (entry.kind) { - case 226 /* ImportDeclaration */: + case 229 /* ImportDeclaration */: if (!entry.importClause) { // 'import "..."' case // module is imported only for side-effects, no emit required break; } // fall-through - case 225 /* ImportEqualsDeclaration */: + case 228 /* ImportEqualsDeclaration */: ts.Debug.assert(importVariableName !== ""); writeLine(); // save import into the local write(importVariableName + " = " + parameterName + ";"); writeLine(); break; - case 232 /* ExportDeclaration */: + case 235 /* ExportDeclaration */: ts.Debug.assert(importVariableName !== ""); if (entry.exportClause) { // export {a, b as c} from 'foo' @@ -38574,10 +39657,10 @@ var ts; // - 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 217 /* FunctionDeclaration */: - case 226 /* ImportDeclaration */: + case 219 /* FunctionDeclaration */: + case 229 /* ImportDeclaration */: continue; - case 232 /* ExportDeclaration */: + case 235 /* ExportDeclaration */: if (!statement.moduleSpecifier) { for (var _a = 0, _b = statement.exportClause.elements; _a < _b.length; _a++) { var element = _b[_a]; @@ -38586,7 +39669,7 @@ var ts; } } continue; - case 225 /* ImportEqualsDeclaration */: + case 228 /* ImportEqualsDeclaration */: if (!ts.isInternalModuleImportEqualsDeclaration(statement)) { // - import equals declarations that import external modules are not emitted continue; @@ -38633,7 +39716,7 @@ var ts; 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 + // 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 (ts.hasProperty(groupIndices, key)) { // deduplicate/group entries in dependency list by the dependency name @@ -38676,11 +39759,11 @@ var ts; for (var _a = 0, _b = node.amdDependencies; _a < _b.length; _a++) { var amdDependency = _b[_a]; if (amdDependency.name) { - aliasedModuleNames.push("\"" + amdDependency.path + "\""); + aliasedModuleNames.push('"' + amdDependency.path + '"'); importAliasNames.push(amdDependency.name); } else { - unaliasedModuleNames.push("\"" + amdDependency.path + "\""); + unaliasedModuleNames.push('"' + amdDependency.path + '"'); } } for (var _c = 0, externalImports_4 = externalImports; _c < externalImports_4.length; _c++) { @@ -38718,7 +39801,7 @@ var ts; } function emitAMDDependencyList(_a) { var aliasedModuleNames = _a.aliasedModuleNames, unaliasedModuleNames = _a.unaliasedModuleNames; - write("[\"require\", \"exports\""); + write('["require", "exports"'); if (aliasedModuleNames.length) { write(", "); write(aliasedModuleNames.join(", ")); @@ -38750,8 +39833,8 @@ var ts; emitExportStarHelper(); emitCaptureThisForNodeIfNecessary(node); emitLinesStartingAt(node.statements, startIndex); - emitTempDeclarations(/*newLine*/ true); emitExportEquals(/*emitAsReturn*/ true); + emitTempDeclarations(/*newLine*/ true); decreaseIndent(); writeLine(); write("});"); @@ -38763,8 +39846,8 @@ var ts; emitExportStarHelper(); emitCaptureThisForNodeIfNecessary(node); emitLinesStartingAt(node.statements, startIndex); - emitTempDeclarations(/*newLine*/ true); emitExportEquals(/*emitAsReturn*/ false); + emitTempDeclarations(/*newLine*/ true); } function emitUMDModule(node) { emitEmitHelpers(node); @@ -38781,8 +39864,8 @@ var ts; emitExportStarHelper(); emitCaptureThisForNodeIfNecessary(node); emitLinesStartingAt(node.statements, startIndex); - emitTempDeclarations(/*newLine*/ true); emitExportEquals(/*emitAsReturn*/ true); + emitTempDeclarations(/*newLine*/ true); decreaseIndent(); writeLine(); write("});"); @@ -38856,7 +39939,7 @@ var ts; if (entities[m] !== undefined) { var ch = String.fromCharCode(entities[m]); // " needs to be escaped - return ch === "\"" ? "\\\"" : ch; + return ch === '"' ? "\\\"" : ch; } else { return s; @@ -38866,11 +39949,11 @@ var ts; return result; } function isJsxChildEmittable(child) { - if (child.kind === 244 /* JsxExpression */) { + if (child.kind === 247 /* JsxExpression */) { // Don't emit empty expressions return !!child.expression; } - else if (child.kind === 240 /* JsxText */) { + else if (child.kind === 243 /* JsxText */) { // Don't emit empty strings return !!getTextToEmit(child); } @@ -38895,9 +39978,9 @@ var ts; function emitJsxText(node) { switch (compilerOptions.jsx) { case 2 /* React */: - write("\""); + write('"'); write(trimReactWhitespaceAndApplyEntities(node)); - write("\""); + write('"'); break; case 1 /* Preserve */: default: @@ -38921,7 +40004,7 @@ var ts; } } function isUseStrictPrologue(node) { - return !!node.expression.text.match(/use strict/); + return node.expression.text === "use strict"; } function ensureUseStrictPrologue(startWithNewLine, writeUseStrict) { if (writeUseStrict) { @@ -38967,10 +40050,14 @@ var ts; 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 */)) { + 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) { @@ -39070,24 +40157,24 @@ var ts; 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 219 /* InterfaceDeclaration */: - case 217 /* FunctionDeclaration */: - case 226 /* ImportDeclaration */: - case 225 /* ImportEqualsDeclaration */: - case 220 /* TypeAliasDeclaration */: - case 231 /* ExportAssignment */: + case 221 /* InterfaceDeclaration */: + case 219 /* FunctionDeclaration */: + case 229 /* ImportDeclaration */: + case 228 /* ImportEqualsDeclaration */: + case 222 /* TypeAliasDeclaration */: + case 234 /* ExportAssignment */: return true; } } function shouldEmitLeadingAndTrailingComments(node) { switch (node.kind) { - case 197 /* VariableStatement */: + case 199 /* VariableStatement */: return shouldEmitLeadingAndTrailingCommentsForVariableStatement(node); - case 222 /* ModuleDeclaration */: + case 224 /* ModuleDeclaration */: // Only emit the leading/trailing comments for a module if we're actually // emitting the module as well. return shouldEmitModuleDeclaration(node); - case 221 /* EnumDeclaration */: + case 223 /* EnumDeclaration */: // Only emit the leading/trailing comments for an enum if we're actually // emitting the module as well. return shouldEmitEnumDeclaration(node); @@ -39099,9 +40186,9 @@ var ts; // 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 !== 196 /* Block */ && + if (node.kind !== 198 /* Block */ && node.parent && - node.parent.kind === 178 /* ArrowFunction */ && + node.parent.kind === 179 /* ArrowFunction */ && node.parent.body === node && compilerOptions.target <= 1 /* ES5 */) { return false; @@ -39114,13 +40201,13 @@ var ts; switch (node.kind) { case 69 /* Identifier */: return emitIdentifier(node); - case 140 /* Parameter */: + case 141 /* Parameter */: return emitParameter(node); - case 145 /* MethodDeclaration */: - case 144 /* MethodSignature */: + case 146 /* MethodDeclaration */: + case 145 /* MethodSignature */: return emitMethod(node); - case 147 /* GetAccessor */: - case 148 /* SetAccessor */: + case 148 /* GetAccessor */: + case 149 /* SetAccessor */: return emitAccessor(node); case 97 /* ThisKeyword */: return emitThis(node); @@ -39140,142 +40227,142 @@ var ts; case 13 /* TemplateMiddle */: case 14 /* TemplateTail */: return emitLiteral(node); - case 187 /* TemplateExpression */: + case 188 /* TemplateExpression */: return emitTemplateExpression(node); - case 194 /* TemplateSpan */: + case 196 /* TemplateSpan */: return emitTemplateSpan(node); - case 237 /* JsxElement */: - case 238 /* JsxSelfClosingElement */: + case 240 /* JsxElement */: + case 241 /* JsxSelfClosingElement */: return emitJsxElement(node); - case 240 /* JsxText */: + case 243 /* JsxText */: return emitJsxText(node); - case 244 /* JsxExpression */: + case 247 /* JsxExpression */: return emitJsxExpression(node); - case 137 /* QualifiedName */: + case 138 /* QualifiedName */: return emitQualifiedName(node); - case 165 /* ObjectBindingPattern */: + case 166 /* ObjectBindingPattern */: return emitObjectBindingPattern(node); - case 166 /* ArrayBindingPattern */: + case 167 /* ArrayBindingPattern */: return emitArrayBindingPattern(node); - case 167 /* BindingElement */: + case 168 /* BindingElement */: return emitBindingElement(node); - case 168 /* ArrayLiteralExpression */: + case 169 /* ArrayLiteralExpression */: return emitArrayLiteral(node); - case 169 /* ObjectLiteralExpression */: + case 170 /* ObjectLiteralExpression */: return emitObjectLiteral(node); - case 249 /* PropertyAssignment */: + case 252 /* PropertyAssignment */: return emitPropertyAssignment(node); - case 250 /* ShorthandPropertyAssignment */: + case 253 /* ShorthandPropertyAssignment */: return emitShorthandPropertyAssignment(node); - case 138 /* ComputedPropertyName */: + case 139 /* ComputedPropertyName */: return emitComputedPropertyName(node); - case 170 /* PropertyAccessExpression */: + case 171 /* PropertyAccessExpression */: return emitPropertyAccess(node); - case 171 /* ElementAccessExpression */: + case 172 /* ElementAccessExpression */: return emitIndexedAccess(node); - case 172 /* CallExpression */: + case 173 /* CallExpression */: return emitCallExpression(node); - case 173 /* NewExpression */: + case 174 /* NewExpression */: return emitNewExpression(node); - case 174 /* TaggedTemplateExpression */: + case 175 /* TaggedTemplateExpression */: return emitTaggedTemplateExpression(node); - case 175 /* TypeAssertionExpression */: + case 176 /* TypeAssertionExpression */: + case 194 /* AsExpression */: + case 195 /* NonNullExpression */: return emit(node.expression); - case 193 /* AsExpression */: - return emit(node.expression); - case 176 /* ParenthesizedExpression */: + case 177 /* ParenthesizedExpression */: return emitParenExpression(node); - case 217 /* FunctionDeclaration */: - case 177 /* FunctionExpression */: - case 178 /* ArrowFunction */: + case 219 /* FunctionDeclaration */: + case 178 /* FunctionExpression */: + case 179 /* ArrowFunction */: return emitFunctionDeclaration(node); - case 179 /* DeleteExpression */: + case 180 /* DeleteExpression */: return emitDeleteExpression(node); - case 180 /* TypeOfExpression */: + case 181 /* TypeOfExpression */: return emitTypeOfExpression(node); - case 181 /* VoidExpression */: + case 182 /* VoidExpression */: return emitVoidExpression(node); - case 182 /* AwaitExpression */: + case 183 /* AwaitExpression */: return emitAwaitExpression(node); - case 183 /* PrefixUnaryExpression */: + case 184 /* PrefixUnaryExpression */: return emitPrefixUnaryExpression(node); - case 184 /* PostfixUnaryExpression */: + case 185 /* PostfixUnaryExpression */: return emitPostfixUnaryExpression(node); - case 185 /* BinaryExpression */: + case 186 /* BinaryExpression */: return emitBinaryExpression(node); - case 186 /* ConditionalExpression */: + case 187 /* ConditionalExpression */: return emitConditionalExpression(node); - case 189 /* SpreadElementExpression */: + case 190 /* SpreadElementExpression */: return emitSpreadElementExpression(node); - case 188 /* YieldExpression */: + case 189 /* YieldExpression */: return emitYieldExpression(node); - case 191 /* OmittedExpression */: + case 192 /* OmittedExpression */: return; - case 196 /* Block */: - case 223 /* ModuleBlock */: + case 198 /* Block */: + case 225 /* ModuleBlock */: return emitBlock(node); - case 197 /* VariableStatement */: + case 199 /* VariableStatement */: return emitVariableStatement(node); - case 198 /* EmptyStatement */: + case 200 /* EmptyStatement */: return write(";"); - case 199 /* ExpressionStatement */: + case 201 /* ExpressionStatement */: return emitExpressionStatement(node); - case 200 /* IfStatement */: + case 202 /* IfStatement */: return emitIfStatement(node); - case 201 /* DoStatement */: + case 203 /* DoStatement */: return emitDoStatement(node); - case 202 /* WhileStatement */: + case 204 /* WhileStatement */: return emitWhileStatement(node); - case 203 /* ForStatement */: + case 205 /* ForStatement */: return emitForStatement(node); - case 205 /* ForOfStatement */: - case 204 /* ForInStatement */: + case 207 /* ForOfStatement */: + case 206 /* ForInStatement */: return emitForInOrForOfStatement(node); - case 206 /* ContinueStatement */: - case 207 /* BreakStatement */: + case 208 /* ContinueStatement */: + case 209 /* BreakStatement */: return emitBreakOrContinueStatement(node); - case 208 /* ReturnStatement */: + case 210 /* ReturnStatement */: return emitReturnStatement(node); - case 209 /* WithStatement */: + case 211 /* WithStatement */: return emitWithStatement(node); - case 210 /* SwitchStatement */: + case 212 /* SwitchStatement */: return emitSwitchStatement(node); - case 245 /* CaseClause */: - case 246 /* DefaultClause */: + case 248 /* CaseClause */: + case 249 /* DefaultClause */: return emitCaseOrDefaultClause(node); - case 211 /* LabeledStatement */: + case 213 /* LabeledStatement */: return emitLabeledStatement(node); - case 212 /* ThrowStatement */: + case 214 /* ThrowStatement */: return emitThrowStatement(node); - case 213 /* TryStatement */: + case 215 /* TryStatement */: return emitTryStatement(node); - case 248 /* CatchClause */: + case 251 /* CatchClause */: return emitCatchClause(node); - case 214 /* DebuggerStatement */: + case 216 /* DebuggerStatement */: return emitDebuggerStatement(node); - case 215 /* VariableDeclaration */: + case 217 /* VariableDeclaration */: return emitVariableDeclaration(node); - case 190 /* ClassExpression */: + case 191 /* ClassExpression */: return emitClassExpression(node); - case 218 /* ClassDeclaration */: + case 220 /* ClassDeclaration */: return emitClassDeclaration(node); - case 219 /* InterfaceDeclaration */: + case 221 /* InterfaceDeclaration */: return emitInterfaceDeclaration(node); - case 221 /* EnumDeclaration */: + case 223 /* EnumDeclaration */: return emitEnumDeclaration(node); - case 251 /* EnumMember */: + case 254 /* EnumMember */: return emitEnumMember(node); - case 222 /* ModuleDeclaration */: + case 224 /* ModuleDeclaration */: return emitModuleDeclaration(node); - case 226 /* ImportDeclaration */: + case 229 /* ImportDeclaration */: return emitImportDeclaration(node); - case 225 /* ImportEqualsDeclaration */: + case 228 /* ImportEqualsDeclaration */: return emitImportEqualsDeclaration(node); - case 232 /* ExportDeclaration */: + case 235 /* ExportDeclaration */: return emitExportDeclaration(node); - case 231 /* ExportAssignment */: + case 234 /* ExportAssignment */: return emitExportAssignment(node); - case 252 /* SourceFile */: + case 255 /* SourceFile */: return emitSourceFileNode(node); } } @@ -39314,7 +40401,7 @@ var ts; 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 === 252 /* SourceFile */ || node.pos !== node.parent.pos) { + if (node.parent.kind === 255 /* SourceFile */ || node.pos !== node.parent.pos) { if (hasDetachedComments(node.pos)) { // get comments without detached comments return getLeadingCommentsWithoutDetachedComments(); @@ -39329,7 +40416,7 @@ var ts; 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 === 252 /* SourceFile */ || node.end !== node.parent.end) { + if (node.parent.kind === 255 /* SourceFile */ || node.end !== node.parent.end) { return ts.getTrailingCommentRanges(currentText, node.end); } } @@ -39444,6 +40531,15 @@ var ts; if (declarationFilePath) { emitSkipped = ts.writeDeclarationFile(declarationFilePath, sourceFiles, isBundledEmit, host, resolver, emitterDiagnostics) || emitSkipped; } + if (!emitSkipped && emittedFilesList) { + emittedFilesList.push(jsFilePath); + if (sourceMapFilePath) { + emittedFilesList.push(sourceMapFilePath); + } + if (declarationFilePath) { + emittedFilesList.push(declarationFilePath); + } + } } } ts.emitFiles = emitFiles; @@ -39459,10 +40555,15 @@ var ts; /* @internal */ ts.ioWriteTime = 0; /** The version of the TypeScript compiler release */ var emptyArray = []; + var defaultLibrarySearchPaths = [ + "types/", + "node_modules/", + "node_modules/@types/", + ]; ts.version = "1.9.0"; function findConfigFile(searchPath, fileExists) { - var fileName = "tsconfig.json"; while (true) { + var fileName = ts.combinePaths(searchPath, "tsconfig.json"); if (fileExists(fileName)) { return fileName; } @@ -39471,7 +40572,6 @@ var ts; break; } searchPath = parentPath; - fileName = "../" + fileName; } return undefined; } @@ -39482,18 +40582,49 @@ var ts; return ts.normalizePath(referencedFileName); } ts.resolveTripleslashReference = resolveTripleslashReference; + /* @internal */ + function computeCommonSourceDirectoryOfFilenames(fileNames, currentDirectory, getCanonicalFileName) { + var commonPathComponents; + var failed = ts.forEach(fileNames, function (sourceFile) { + // Each file contributes into common source file path + var sourcePathComponents = ts.getNormalizedPathComponents(sourceFile, currentDirectory); + sourcePathComponents.pop(); // The base file name is not part of the common directory path + if (!commonPathComponents) { + // first file + commonPathComponents = sourcePathComponents; + return; + } + for (var i = 0, n = Math.min(commonPathComponents.length, sourcePathComponents.length); i < n; i++) { + if (getCanonicalFileName(commonPathComponents[i]) !== getCanonicalFileName(sourcePathComponents[i])) { + if (i === 0) { + // Failed to find any common path component + return true; + } + // New common path found that is 0 -> i-1 + commonPathComponents.length = i; + break; + } + } + // If the sourcePathComponents was shorter than the commonPathComponents, truncate to the sourcePathComponents + if (sourcePathComponents.length < commonPathComponents.length) { + commonPathComponents.length = sourcePathComponents.length; + } + }); + // A common path can not be found when paths span multiple drives on windows, for example + if (failed) { + return ""; + } + if (!commonPathComponents) { + return currentDirectory; + } + return ts.getNormalizedPathFromPathComponents(commonPathComponents); + } + ts.computeCommonSourceDirectoryOfFilenames = computeCommonSourceDirectoryOfFilenames; function trace(host, message) { host.trace(ts.formatMessage.apply(undefined, arguments)); } function isTraceEnabled(compilerOptions, host) { - return compilerOptions.traceModuleResolution && host.trace !== undefined; - } - function startsWith(str, prefix) { - return str.lastIndexOf(prefix, 0) === 0; - } - function endsWith(str, suffix) { - var expectedPos = str.length - suffix.length; - return str.indexOf(suffix, expectedPos) === expectedPos; + return compilerOptions.traceResolution && host.trace !== undefined; } function hasZeroOrOneAsteriskCharacter(str) { var seenAsterisk = false; @@ -39521,6 +40652,150 @@ var ts; var startsWithDotSlashOrDotDotSlash = i === 0 || (i === 1 && moduleName.charCodeAt(0) === 46 /* dot */); return !startsWithDotSlashOrDotDotSlash; } + function tryReadTypesSection(packageJsonPath, baseDirectory, state) { + var jsonContent; + try { + var jsonText = state.host.readFile(packageJsonPath); + jsonContent = jsonText ? JSON.parse(jsonText) : {}; + } + catch (e) { + // gracefully handle if readFile fails or returns not JSON + jsonContent = {}; + } + var typesFile; + var fieldName; + // first try to read content of 'typings' section (backward compatibility) + if (jsonContent.typings) { + if (typeof jsonContent.typings === "string") { + fieldName = "typings"; + typesFile = jsonContent.typings; + } + else { + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.Expected_type_of_0_field_in_package_json_to_be_string_got_1, "typings", typeof jsonContent.typings); + } + } + } + // then read 'types' + if (!typesFile && jsonContent.types) { + if (typeof jsonContent.types === "string") { + fieldName = "types"; + typesFile = jsonContent.types; + } + else { + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.Expected_type_of_0_field_in_package_json_to_be_string_got_1, "types", typeof jsonContent.types); + } + } + } + if (typesFile) { + 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; + } + return undefined; + } + var typeReferenceExtensions = [".d.ts"]; + /** + * @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 + }; + // use typesRoot and fallback to directory that contains tsconfig if typesRoot is not set + var rootDir = options.typesRoot || (options.configFilePath ? ts.getDirectoryPath(options.configFilePath) : undefined); + if (traceEnabled) { + if (containingFile === undefined) { + if (rootDir === 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, rootDir); + } + } + else { + if (rootDir === 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, rootDir); + } + } + } + var failedLookupLocations = []; + // Check primary library paths + if (rootDir !== undefined) { + var effectivePrimarySearchPaths = options.typesSearchPaths || defaultLibrarySearchPaths; + for (var _i = 0, effectivePrimarySearchPaths_1 = effectivePrimarySearchPaths; _i < effectivePrimarySearchPaths_1.length; _i++) { + var searchPath = effectivePrimarySearchPaths_1[_i]; + var primaryPath = ts.combinePaths(rootDir, searchPath); + if (traceEnabled) { + trace(host, ts.Diagnostics.Resolving_with_primary_search_path_0, primaryPath); + } + var candidate = ts.combinePaths(primaryPath, 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); + } + else { + initialLocationForSecondaryLookup = rootDir; + } + 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) { @@ -39642,10 +40917,10 @@ var ts; // 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 (!endsWith(normalizedRoot, ts.directorySeparator)) { + if (!ts.endsWith(normalizedRoot, ts.directorySeparator)) { normalizedRoot += ts.directorySeparator; } - var isLongestMatchingPrefix = startsWith(candidate, normalizedRoot) && + 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); @@ -39715,8 +40990,8 @@ var ts; var prefix = pattern.substr(0, indexOfStar); var suffix = pattern.substr(indexOfStar + 1); if (moduleName.length >= prefix.length + suffix.length && - startsWith(moduleName, prefix) && - endsWith(moduleName, suffix)) { + ts.startsWith(moduleName, prefix) && + ts.endsWith(moduleName, suffix)) { // use length of prefix as betterness criteria if (prefix.length > longestMatchPrefixLength) { longestMatchPrefixLength = prefix.length; @@ -39802,6 +41077,13 @@ var ts; * 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) { + if (!onlyRecordFailures) { + // check if containig 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, tryLoad); function tryLoad(ext) { if (ext === ".tsx" && state.skipTsx) { @@ -39810,7 +41092,7 @@ var ts; var fileName = ts.fileExtensionIs(candidate, ext) ? candidate : candidate + ext; if (!onlyRecordFailures && state.host.fileExists(fileName)) { if (state.traceEnabled) { - trace(state.host, ts.Diagnostics.File_0_exist_use_it_as_a_module_resolution_result, fileName); + trace(state.host, ts.Diagnostics.File_0_exist_use_it_as_a_name_resolution_result, fileName); } return fileName; } @@ -39830,33 +41112,16 @@ var ts; if (state.traceEnabled) { trace(state.host, ts.Diagnostics.Found_package_json_at_0, packageJsonPath); } - var jsonContent = void 0; - try { - var jsonText = state.host.readFile(packageJsonPath); - jsonContent = jsonText ? JSON.parse(jsonText) : { typings: undefined }; - } - catch (e) { - // gracefully handle if readFile fails or returns not JSON - jsonContent = { typings: undefined }; - } - if (jsonContent.typings) { - if (typeof jsonContent.typings === "string") { - var typingsFile = ts.normalizePath(ts.combinePaths(candidate, jsonContent.typings)); - if (state.traceEnabled) { - trace(state.host, ts.Diagnostics.package_json_has_typings_field_0_that_references_1, jsonContent.typings, typingsFile); - } - var result = loadModuleFromFile(typingsFile, extensions, failedLookupLocation, !directoryProbablyExists(ts.getDirectoryPath(typingsFile), state.host), state); - if (result) { - return result; - } - } - else if (state.traceEnabled) { - trace(state.host, ts.Diagnostics.Expected_type_of_typings_field_in_package_json_to_be_string_got_0, typeof jsonContent.typings); + var typesFile = tryReadTypesSection(packageJsonPath, candidate, state); + if (typesFile) { + var result = loadModuleFromFile(typesFile, extensions, failedLookupLocation, !directoryProbablyExists(ts.getDirectoryPath(typesFile), state.host), state); + if (result) { + return result; } } else { if (state.traceEnabled) { - trace(state.host, ts.Diagnostics.package_json_does_not_have_typings_field); + trace(state.host, ts.Diagnostics.package_json_does_not_have_types_field); } } } @@ -39869,20 +41134,30 @@ var ts; } return loadModuleFromFile(ts.combinePaths(candidate, "index"), extensions, failedLookupLocation, !directoryExists, state); } + 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)); + // Load only typescript files irrespective of allowJs option if loading from node modules + var result = loadModuleFromFile(candidate, ts.supportedTypeScriptExtensions, failedLookupLocations, !nodeModulesFolderExists, state); + if (result) { + return result; + } + result = loadNodeModuleFromDirectory(ts.supportedTypeScriptExtensions, 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") { - var nodeModulesFolder = ts.combinePaths(directory, "node_modules"); - var nodeModulesFolderExists = directoryProbablyExists(nodeModulesFolder, state.host); - var candidate = ts.normalizePath(ts.combinePaths(nodeModulesFolder, moduleName)); - // Load only typescript files irrespective of allowJs option if loading from node modules - var result = loadModuleFromFile(candidate, ts.supportedTypeScriptExtensions, failedLookupLocations, !nodeModulesFolderExists, state); - if (result) { - return result; - } - result = loadNodeModuleFromDirectory(ts.supportedTypeScriptExtensions, candidate, failedLookupLocations, !nodeModulesFolderExists, state); + var result = + // first: try to load module as-is + loadModuleFromNodeModulesFolder(moduleName, directory, failedLookupLocations, state) || + // second: try to load module from the scope '@types' + loadModuleFromNodeModulesFolder(ts.combinePaths("@types", moduleName), directory, failedLookupLocations, state); if (result) { return result; } @@ -39979,11 +41254,40 @@ var ts; ts.sys.createDirectory(directoryPath); } } + var outputFingerprints; + function writeFileIfUpdated(fileName, data, writeByteOrderMark) { + if (!outputFingerprints) { + outputFingerprints = {}; + } + var hash = ts.sys.createHash(data); + var mtimeBefore = ts.sys.getModifiedTime(fileName); + if (mtimeBefore && ts.hasProperty(outputFingerprints, fileName)) { + var fingerprint = outputFingerprints[fileName]; + // If output has not been changed, and the file has no external modification + if (fingerprint.byteOrderMark === writeByteOrderMark && + fingerprint.hash === hash && + fingerprint.mtime.getTime() === mtimeBefore.getTime()) { + return; + } + } + ts.sys.writeFile(fileName, data, writeByteOrderMark); + var mtimeAfter = ts.sys.getModifiedTime(fileName); + outputFingerprints[fileName] = { + hash: hash, + byteOrderMark: writeByteOrderMark, + mtime: mtimeAfter + }; + } function writeFile(fileName, data, writeByteOrderMark, onError) { try { var start = new Date().getTime(); ensureDirectoriesExist(ts.getDirectoryPath(ts.normalizePath(fileName))); - ts.sys.writeFile(fileName, data, writeByteOrderMark); + if (ts.isWatchSet(options) && ts.sys.createHash && ts.sys.getModifiedTime) { + writeFileIfUpdated(fileName, data, writeByteOrderMark); + } + else { + ts.sys.writeFile(fileName, data, writeByteOrderMark); + } ts.ioWriteTime += new Date().getTime() - start; } catch (e) { @@ -39992,10 +41296,14 @@ var ts; } } } + function getDefaultLibLocation() { + return ts.getDirectoryPath(ts.normalizePath(ts.sys.getExecutingFilePath())); + } var newLine = ts.getNewLineCharacter(options); return { getSourceFile: getSourceFile, - getDefaultLibFileName: function (options) { return ts.combinePaths(ts.getDirectoryPath(ts.normalizePath(ts.sys.getExecutingFilePath())), ts.getDefaultLibFileName(options)); }, + getDefaultLibLocation: getDefaultLibLocation, + getDefaultLibFileName: function (options) { return ts.combinePaths(getDefaultLibLocation(), ts.getDefaultLibFileName(options)); }, writeFile: writeFile, getCurrentDirectory: ts.memoize(function () { return ts.sys.getCurrentDirectory(); }), useCaseSensitiveFileNames: function () { return ts.sys.useCaseSensitiveFileNames; }, @@ -40039,68 +41347,88 @@ var ts; } } ts.flattenDiagnosticMessageText = flattenDiagnosticMessageText; + function loadWithLocalCache(names, containingFile, loader) { + if (names.length === 0) { + return []; + } + var resolutions = []; + var cache = {}; + for (var _i = 0, names_1 = names; _i < names_1.length; _i++) { + var name_33 = names_1[_i]; + var result = void 0; + if (ts.hasProperty(cache, name_33)) { + result = cache[name_33]; + } + else { + result = loader(name_33, containingFile); + cache[name_33] = result; + } + resolutions.push(result); + } + return resolutions; + } function createProgram(rootNames, options, host, oldProgram) { var program; var files = []; - var fileProcessingDiagnostics = ts.createDiagnosticCollection(); - var programDiagnostics = ts.createDiagnosticCollection(); var commonSourceDirectory; var diagnosticsProducingTypeChecker; var noDiagnosticsTypeChecker; var classifiableNames; - var skipDefaultLib = options.noLib; - var supportedExtensions = ts.getSupportedExtensions(options); + var resolvedTypeReferenceDirectives = {}; + var fileProcessingDiagnostics = ts.createDiagnosticCollection(); var start = new Date().getTime(); host = host || createCompilerHost(options); + var skipDefaultLib = options.noLib; + var programDiagnostics = ts.createDiagnosticCollection(); + var currentDirectory = host.getCurrentDirectory(); + var supportedExtensions = ts.getSupportedExtensions(options); // Map storing if there is emit blocking diagnostics for given input var hasEmitBlockingDiagnostics = ts.createFileMap(getCanonicalFileName); - var currentDirectory = host.getCurrentDirectory(); - var resolveModuleNamesWorker = host.resolveModuleNames - ? (function (moduleNames, containingFile) { return host.resolveModuleNames(moduleNames, containingFile); }) - : (function (moduleNames, containingFile) { - var resolvedModuleNames = []; - // resolveModuleName does not store any results between calls. - // lookup is a local cache to avoid resolving the same module name several times - var lookup = {}; - for (var _i = 0, moduleNames_1 = moduleNames; _i < moduleNames_1.length; _i++) { - var moduleName = moduleNames_1[_i]; - var resolvedName = void 0; - if (ts.hasProperty(lookup, moduleName)) { - resolvedName = lookup[moduleName]; - } - else { - resolvedName = resolveModuleName(moduleName, containingFile, options, host).resolvedModule; - lookup[moduleName] = resolvedName; - } - resolvedModuleNames.push(resolvedName); - } - return resolvedModuleNames; - }); + var resolveModuleNamesWorker; + if (host.resolveModuleNames) { + resolveModuleNamesWorker = function (moduleNames, containingFile) { return host.resolveModuleNames(moduleNames, containingFile); }; + } + else { + var loader_1 = function (moduleName, containingFile) { return resolveModuleName(moduleName, containingFile, options, host).resolvedModule; }; + resolveModuleNamesWorker = function (moduleNames, containingFile) { return loadWithLocalCache(moduleNames, containingFile, loader_1); }; + } + var resolveTypeReferenceDirectiveNamesWorker; + if (host.resolveTypeReferenceDirectives) { + resolveTypeReferenceDirectiveNamesWorker = function (typeDirectiveNames, containingFile) { return host.resolveTypeReferenceDirectives(typeDirectiveNames, containingFile); }; + } + else { + var loader_2 = function (typesRef, containingFile) { return resolveTypeReferenceDirective(typesRef, containingFile, options, host).resolvedTypeReferenceDirective; }; + resolveTypeReferenceDirectiveNamesWorker = function (typeReferenceDirectiveNames, containingFile) { return loadWithLocalCache(typeReferenceDirectiveNames, containingFile, loader_2); }; + } var filesByName = ts.createFileMap(); // stores 'filename -> file association' ignoring case // used to track cases when two file names differ only in casing var filesByNameIgnoreCase = host.useCaseSensitiveFileNames() ? ts.createFileMap(function (fileName) { return fileName.toLowerCase(); }) : undefined; - if (oldProgram) { - // 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.noResolve !== options.noResolve) || - (oldOptions.target !== options.target) || - (oldOptions.noLib !== options.noLib) || - (oldOptions.jsx !== options.jsx) || - (oldOptions.allowJs !== options.allowJs)) { - oldProgram = undefined; - } - } if (!tryReuseStructureFromOldProgram()) { + // load type declarations specified via 'types' argument + if (options.types && options.types.length) { + var resolutions = resolveTypeReferenceDirectiveNamesWorker(options.types, /*containingFile*/ undefined); + for (var i = 0; i < options.types.length; i++) { + processTypeReferenceDirective(options.types[i], resolutions[i]); + } + } ts.forEach(rootNames, function (name) { return processRootFile(name, /*isDefaultLib*/ false); }); // Do not process the default library if: // - The '--noLib' flag is used. // - A 'no-default-lib' reference comment is encountered in // processing the root files. if (!skipDefaultLib) { - processRootFile(host.getDefaultLibFileName(options), /*isDefaultLib*/ true); + // If '--lib' is not specified, include default library file according to '--target' + // otherwise, using options specified in '--lib' instead of '--target' default library file + if (!options.lib) { + processRootFile(host.getDefaultLibFileName(options), /*isDefaultLib*/ true); + } + else { + var libDirectory_1 = host.getDefaultLibLocation ? host.getDefaultLibLocation() : ts.getDirectoryPath(host.getDefaultLibFileName(options)); + ts.forEach(options.lib, function (libFileName) { + processRootFile(ts.combinePaths(libDirectory_1, libFileName), /*isDefaultLib*/ true); + }); + } } } // unconditionally set oldProgram to undefined to prevent it from being captured in closure @@ -40125,7 +41453,8 @@ var ts; getIdentifierCount: function () { return getDiagnosticsProducingTypeChecker().getIdentifierCount(); }, getSymbolCount: function () { return getDiagnosticsProducingTypeChecker().getSymbolCount(); }, getTypeCount: function () { return getDiagnosticsProducingTypeChecker().getTypeCount(); }, - getFileProcessingDiagnostics: function () { return fileProcessingDiagnostics; } + getFileProcessingDiagnostics: function () { return fileProcessingDiagnostics; }, + resolvedTypeReferenceDirectives: resolvedTypeReferenceDirectives }; verifyCompilerOptions(); ts.programTime += new Date().getTime() - start; @@ -40164,12 +41493,29 @@ var ts; if (!oldProgram) { return false; } + // 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.noResolve !== options.noResolve) || + (oldOptions.target !== options.target) || + (oldOptions.noLib !== options.noLib) || + (oldOptions.jsx !== options.jsx) || + (oldOptions.allowJs !== options.allowJs) || + (oldOptions.rootDir !== options.rootDir) || + (oldOptions.typesSearchPaths !== options.typesSearchPaths) || + (oldOptions.configFilePath !== options.configFilePath)) { + return false; + } ts.Debug.assert(!oldProgram.structureIsReused); // there is an old program, check if we can reuse its structure var oldRootNames = oldProgram.getRootFileNames(); if (!ts.arrayIsEqualTo(oldRootNames, rootNames)) { return false; } + if (!ts.arrayIsEqualTo(options.types, oldOptions.types)) { + return false; + } // check if program source files has changed in the way that can affect structure of the program var newSourceFiles = []; var filePaths = []; @@ -40203,25 +41549,32 @@ var ts; // moduleAugmentations has changed return false; } + if (!ts.arrayIsEqualTo(oldSourceFile.typeReferenceDirectives, newSourceFile.typeReferenceDirectives, fileReferenceIsEqualTo)) { + // '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, ts.getNormalizedAbsolutePath(newSourceFile.fileName, currentDirectory)); + var resolutions = resolveModuleNamesWorker(moduleNames, newSourceFilePath); // ensure that module resolution results are still correct - for (var i = 0; i < moduleNames.length; i++) { - var newResolution = resolutions[i]; - var oldResolution = ts.getResolvedModule(oldSourceFile, moduleNames[i]); - var resolutionChanged = oldResolution - ? !newResolution || - oldResolution.resolvedFileName !== newResolution.resolvedFileName || - !!oldResolution.isExternalLibraryImport !== !!newResolution.isExternalLibraryImport - : newResolution; - if (resolutionChanged) { - return false; - } + var resolutionsChanged = ts.hasChangesInResolutions(moduleNames, resolutions, oldSourceFile.resolvedModules, ts.moduleResolutionIsEqualTo); + if (resolutionsChanged) { + return false; } } - // pass the cache of module resolutions from the old source file + 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); } else { @@ -40241,6 +41594,7 @@ var ts; var modifiedFile = modifiedSourceFiles_1[_b]; fileProcessingDiagnostics.reattachFileDiagnostics(modifiedFile); } + resolvedTypeReferenceDirectives = oldProgram.resolvedTypeReferenceDirectives; oldProgram.structureIsReused = true; return true; } @@ -40253,7 +41607,7 @@ var ts; getNewLine: function () { return host.getNewLine(); }, getSourceFile: program.getSourceFile, getSourceFiles: program.getSourceFiles, - writeFile: writeFileCallback || (function (fileName, data, writeByteOrderMark, onError) { return host.writeFile(fileName, data, writeByteOrderMark, onError); }), + writeFile: writeFileCallback || (function (fileName, data, writeByteOrderMark, onError, sourceFiles) { return host.writeFile(fileName, data, writeByteOrderMark, onError, sourceFiles); }), isEmitBlocked: isEmitBlocked }; } @@ -40273,7 +41627,7 @@ var ts; function emitWorker(program, sourceFile, writeFileCallback, cancellationToken) { var declarationDiagnostics = []; if (options.noEmit) { - return { diagnostics: declarationDiagnostics, sourceMaps: undefined, emitSkipped: true }; + return { diagnostics: declarationDiagnostics, sourceMaps: undefined, emittedFiles: undefined, emitSkipped: true }; } // If the noEmitOnError flag is set, then check if we have any errors so far. If so, // immediately bail out. Note that we pass 'undefined' for 'sourceFile' so that we @@ -40284,7 +41638,12 @@ var ts; declarationDiagnostics = program.getDeclarationDiagnostics(/*sourceFile*/ undefined, cancellationToken); } if (diagnostics.length > 0 || declarationDiagnostics.length > 0) { - return { diagnostics: diagnostics, sourceMaps: undefined, emitSkipped: true }; + return { + diagnostics: ts.concatenate(diagnostics, declarationDiagnostics), + sourceMaps: undefined, + emittedFiles: undefined, + emitSkipped: true + }; } } // Create the emit resolver outside of the "emitTime" tracking code below. That way @@ -40324,7 +41683,14 @@ var ts; return getDiagnosticsHelper(sourceFile, getSemanticDiagnosticsForFile, cancellationToken); } function getDeclarationDiagnostics(sourceFile, cancellationToken) { - return getDiagnosticsHelper(sourceFile, getDeclarationDiagnosticsForFile, cancellationToken); + var options = program.getCompilerOptions(); + // collect diagnostics from the program only once if either no source file was specified or out/outFile is set (bundled emit) + if (!sourceFile || options.out || options.outFile) { + return getDeclarationDiagnosticsWorker(sourceFile, cancellationToken); + } + else { + return getDiagnosticsHelper(sourceFile, getDeclarationDiagnosticsForFile, cancellationToken); + } } function getSyntacticDiagnosticsForFile(sourceFile, cancellationToken) { return sourceFile.parseDiagnostics; @@ -40376,47 +41742,47 @@ var ts; return false; } switch (node.kind) { - case 225 /* ImportEqualsDeclaration */: + case 228 /* ImportEqualsDeclaration */: diagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.import_can_only_be_used_in_a_ts_file)); return true; - case 231 /* ExportAssignment */: + case 234 /* ExportAssignment */: if (node.isExportEquals) { diagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.export_can_only_be_used_in_a_ts_file)); return true; } break; - case 218 /* ClassDeclaration */: + case 220 /* ClassDeclaration */: var classDeclaration = node; if (checkModifiers(classDeclaration.modifiers) || checkTypeParameters(classDeclaration.typeParameters)) { return true; } break; - case 247 /* HeritageClause */: + case 250 /* 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; } break; - case 219 /* InterfaceDeclaration */: + case 221 /* InterfaceDeclaration */: diagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.interface_declarations_can_only_be_used_in_a_ts_file)); return true; - case 222 /* ModuleDeclaration */: + case 224 /* ModuleDeclaration */: diagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.module_declarations_can_only_be_used_in_a_ts_file)); return true; - case 220 /* TypeAliasDeclaration */: + case 222 /* TypeAliasDeclaration */: diagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.type_aliases_can_only_be_used_in_a_ts_file)); return true; - case 145 /* MethodDeclaration */: - case 144 /* MethodSignature */: - case 146 /* Constructor */: - case 147 /* GetAccessor */: - case 148 /* SetAccessor */: - case 177 /* FunctionExpression */: - case 217 /* FunctionDeclaration */: - case 178 /* ArrowFunction */: - case 217 /* FunctionDeclaration */: + case 146 /* MethodDeclaration */: + case 145 /* MethodSignature */: + case 147 /* Constructor */: + case 148 /* GetAccessor */: + case 149 /* SetAccessor */: + case 178 /* FunctionExpression */: + case 219 /* FunctionDeclaration */: + case 179 /* ArrowFunction */: + case 219 /* FunctionDeclaration */: var functionDeclaration = node; if (checkModifiers(functionDeclaration.modifiers) || checkTypeParameters(functionDeclaration.typeParameters) || @@ -40424,20 +41790,20 @@ var ts; return true; } break; - case 197 /* VariableStatement */: + case 199 /* VariableStatement */: var variableStatement = node; if (checkModifiers(variableStatement.modifiers)) { return true; } break; - case 215 /* VariableDeclaration */: + case 217 /* VariableDeclaration */: var variableDeclaration = node; if (checkTypeAnnotation(variableDeclaration.type)) { return true; } break; - case 172 /* CallExpression */: - case 173 /* NewExpression */: + case 173 /* CallExpression */: + case 174 /* NewExpression */: var expression = node; if (expression.typeArguments && expression.typeArguments.length > 0) { var start_2 = expression.typeArguments.pos; @@ -40445,7 +41811,7 @@ var ts; return true; } break; - case 140 /* Parameter */: + case 141 /* Parameter */: var parameter = node; if (parameter.modifiers) { var start_3 = parameter.modifiers.pos; @@ -40461,17 +41827,17 @@ var ts; return true; } break; - case 143 /* PropertyDeclaration */: + case 144 /* PropertyDeclaration */: diagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.property_declarations_can_only_be_used_in_a_ts_file)); return true; - case 221 /* EnumDeclaration */: + case 223 /* EnumDeclaration */: diagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.enum_declarations_can_only_be_used_in_a_ts_file)); return true; - case 175 /* TypeAssertionExpression */: + case 176 /* 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 141 /* Decorator */: + case 142 /* 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)); } @@ -40519,16 +41885,17 @@ var ts; } }); } - function getDeclarationDiagnosticsForFile(sourceFile, cancellationToken) { + function getDeclarationDiagnosticsWorker(sourceFile, cancellationToken) { return runWithCancellationToken(function () { - if (!ts.isDeclarationFile(sourceFile)) { - var resolver = getDiagnosticsProducingTypeChecker().getEmitResolver(sourceFile, cancellationToken); - // Don't actually write any files since we're just getting diagnostics. - var writeFile_1 = function () { }; - return ts.getDeclarationDiagnostics(getEmitHost(writeFile_1), resolver, sourceFile); - } + 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); }); } + function getDeclarationDiagnosticsForFile(sourceFile, cancellationToken) { + return ts.isDeclarationFile(sourceFile) ? [] : getDeclarationDiagnosticsWorker(sourceFile, cancellationToken); + } function getOptionsDiagnostics() { var allDiagnostics = []; ts.addRange(allDiagnostics, fileProcessingDiagnostics.getGlobalDiagnostics()); @@ -40544,7 +41911,7 @@ var ts; return ts.getBaseFileName(fileName).indexOf(".") >= 0; } function processRootFile(fileName, isDefaultLib) { - processSourceFile(ts.normalizePath(fileName), isDefaultLib); + processSourceFile(ts.normalizePath(fileName), isDefaultLib, /*isReference*/ true); } function fileReferenceIsEqualTo(a, b) { return a.fileName === b.fileName; @@ -40575,9 +41942,9 @@ var ts; return; function collectModuleReferences(node, inAmbientModule) { switch (node.kind) { - case 226 /* ImportDeclaration */: - case 225 /* ImportEqualsDeclaration */: - case 232 /* ExportDeclaration */: + case 229 /* ImportDeclaration */: + case 228 /* ImportEqualsDeclaration */: + case 235 /* ExportDeclaration */: var moduleNameExpr = ts.getExternalModuleName(node); if (!moduleNameExpr || moduleNameExpr.kind !== 9 /* StringLiteral */) { break; @@ -40592,7 +41959,7 @@ var ts; (imports || (imports = [])).push(moduleNameExpr); } break; - case 222 /* ModuleDeclaration */: + case 224 /* ModuleDeclaration */: if (ts.isAmbientModule(node) && (inAmbientModule || node.flags & 2 /* Ambient */ || ts.isDeclarationFile(file))) { var moduleName = node.name; // Ambient module declarations can be interpreted as augmentations for some existing external modules. @@ -40626,7 +41993,10 @@ var ts; } } } - function processSourceFile(fileName, isDefaultLib, refFile, refPos, refEnd) { + /** + * '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) { var diagnosticArgument; var diagnostic; if (hasExtension(fileName)) { @@ -40634,7 +42004,7 @@ var ts; 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, refFile, refPos, refEnd)) { + else if (!findSourceFile(fileName, ts.toPath(fileName, currentDirectory, getCanonicalFileName), isDefaultLib, isReference, refFile, refPos, refEnd)) { diagnostic = ts.Diagnostics.File_0_not_found; diagnosticArgument = [fileName]; } @@ -40644,13 +42014,13 @@ var ts; } } else { - var nonTsFile = options.allowNonTsExtensions && findSourceFile(fileName, ts.toPath(fileName, currentDirectory, getCanonicalFileName), isDefaultLib, refFile, refPos, refEnd); + var nonTsFile = options.allowNonTsExtensions && findSourceFile(fileName, ts.toPath(fileName, currentDirectory, getCanonicalFileName), isDefaultLib, isReference, 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, refFile, refPos, refEnd); })) { + else if (!ts.forEach(supportedExtensions, function (extension) { return findSourceFile(fileName + extension, ts.toPath(fileName + extension, currentDirectory, getCanonicalFileName), isDefaultLib, isReference, refFile, refPos, refEnd); })) { diagnostic = ts.Diagnostics.File_0_not_found; fileName += ".ts"; diagnosticArgument = [fileName]; @@ -40675,7 +42045,7 @@ var ts; } } // Get source file from normalized fileName - function findSourceFile(fileName, path, isDefaultLib, refFile, refPos, refEnd) { + function findSourceFile(fileName, path, isDefaultLib, isReference, 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 @@ -40683,6 +42053,9 @@ var ts; if (file_1 && options.forceConsistentCasingInFileNames && ts.getNormalizedAbsolutePath(file_1.fileName, currentDirectory) !== ts.getNormalizedAbsolutePath(fileName, currentDirectory)) { reportFileNamesDifferOnlyInCasingError(fileName, file_1.fileName, refFile, refPos, refEnd); } + if (file_1) { + file_1.wasReferenced = file_1.wasReferenced || isReference; + } return file_1; } // We haven't looked for this file, do so now and cache result @@ -40696,6 +42069,7 @@ var ts; }); filesByName.set(path, file); if (file) { + file.wasReferenced = file.wasReferenced || isReference; file.path = path; if (host.useCaseSensitiveFileNames()) { // for case-sensitive file systems check if we've already seen some file with similar filename ignoring case @@ -40710,7 +42084,8 @@ var ts; skipDefaultLib = skipDefaultLib || file.hasNoDefaultLib; var basePath = ts.getDirectoryPath(fileName); if (!options.noResolve) { - processReferencedFiles(file, basePath); + processReferencedFiles(file, basePath, isDefaultLib); + processTypeReferenceDirectives(file); } // always process imported modules to record module name resolutions processImportedModules(file, basePath); @@ -40723,12 +42098,71 @@ var ts; } return file; } - function processReferencedFiles(file, basePath) { + function processReferencedFiles(file, basePath, isDefaultLib) { ts.forEach(file.referencedFiles, function (ref) { var referencedFileName = resolveTripleslashReference(ref.fileName, file.fileName); - processSourceFile(referencedFileName, /*isDefaultLib*/ false, file, ref.pos, ref.end); + processSourceFile(referencedFileName, isDefaultLib, /*isReference*/ true, file, ref.pos, ref.end); }); } + function processTypeReferenceDirectives(file) { + var typeDirectives = ts.map(file.typeReferenceDirectives, function (l) { return l.fileName; }); + var resolutions = resolveTypeReferenceDirectiveNamesWorker(typeDirectives, file.fileName); + for (var i = 0; i < typeDirectives.length; i++) { + var ref = file.typeReferenceDirectives[i]; + var resolvedTypeReferenceDirective = resolutions[i]; + // store resolved type directive on the file + ts.setResolvedTypeReferenceDirective(file, ref.fileName, resolvedTypeReferenceDirective); + processTypeReferenceDirective(ref.fileName, resolvedTypeReferenceDirective, file, ref.pos, ref.end); + } + } + function processTypeReferenceDirective(typeReferenceDirective, resolvedTypeReferenceDirective, refFile, refPos, refEnd) { + // If we already found this library as a primary reference - nothing to do + var previousResolution = resolvedTypeReferenceDirectives[typeReferenceDirective]; + if (previousResolution && previousResolution.primary) { + return; + } + var saveResolution = true; + if (resolvedTypeReferenceDirective) { + if (resolvedTypeReferenceDirective.primary) { + // resolved from the primary path + processSourceFile(resolvedTypeReferenceDirective.resolvedFileName, /*isDefaultLib*/ false, /*isReference*/ true, 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_library_definitions_for_0_found_at_1_and_2_Copy_the_correct_file_to_the_typings_folder_to_resolve_this_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); + } + } + } + else { + fileProcessingDiagnostics.add(createDiagnostic(refFile, refPos, refEnd, ts.Diagnostics.Cannot_find_name_0, typeReferenceDirective)); + } + if (saveResolution) { + resolvedTypeReferenceDirectives[typeReferenceDirective] = resolvedTypeReferenceDirective; + } + } + function createDiagnostic(refFile, refPos, refEnd, message) { + var args = []; + for (var _i = 4; _i < arguments.length; _i++) { + args[_i - 4] = arguments[_i]; + } + if (refFile === undefined || refPos === undefined || refEnd === undefined) { + return ts.createCompilerDiagnostic.apply(void 0, [message].concat(args)); + } + else { + return ts.createFileDiagnostic.apply(void 0, [refFile, refPos, refEnd - refPos, message].concat(args)); + } + } function getCanonicalFileName(fileName) { return host.getCanonicalFileName(fileName); } @@ -40749,7 +42183,7 @@ var ts; !options.noResolve && i < file.imports.length; if (shouldAddFile) { - var importedFile = findSourceFile(resolution.resolvedFileName, ts.toPath(resolution.resolvedFileName, currentDirectory, getCanonicalFileName), /*isDefaultLib*/ false, file, ts.skipTrivia(file.text, file.imports[i].pos), file.imports[i].end); + var importedFile = findSourceFile(resolution.resolvedFileName, ts.toPath(resolution.resolvedFileName, currentDirectory, getCanonicalFileName), /*isDefaultLib*/ false, /*isReference*/ false, file, ts.skipTrivia(file.text, file.imports[i].pos), file.imports[i].end); if (importedFile && resolution.isExternalLibraryImport) { // Since currently irrespective of allowJs, we only look for supportedTypeScript extension external module files, // this check is ok. Otherwise this would be never true for javascript file @@ -40772,50 +42206,21 @@ var ts; return; } function computeCommonSourceDirectory(sourceFiles) { - var commonPathComponents; - var failed = ts.forEach(files, function (sourceFile) { - // Each file contributes into common source file path - if (ts.isDeclarationFile(sourceFile)) { - return; + var fileNames = []; + for (var _i = 0, sourceFiles_2 = sourceFiles; _i < sourceFiles_2.length; _i++) { + var file = sourceFiles_2[_i]; + if (!file.isDeclarationFile) { + fileNames.push(file.fileName); } - var sourcePathComponents = ts.getNormalizedPathComponents(sourceFile.fileName, currentDirectory); - sourcePathComponents.pop(); // The base file name is not part of the common directory path - if (!commonPathComponents) { - // first file - commonPathComponents = sourcePathComponents; - return; - } - for (var i = 0, n = Math.min(commonPathComponents.length, sourcePathComponents.length); i < n; i++) { - if (getCanonicalFileName(commonPathComponents[i]) !== getCanonicalFileName(sourcePathComponents[i])) { - if (i === 0) { - // Failed to find any common path component - return true; - } - // New common path found that is 0 -> i-1 - commonPathComponents.length = i; - break; - } - } - // If the sourcePathComponents was shorter than the commonPathComponents, truncate to the sourcePathComponents - if (sourcePathComponents.length < commonPathComponents.length) { - commonPathComponents.length = sourcePathComponents.length; - } - }); - // A common path can not be found when paths span multiple drives on windows, for example - if (failed) { - return ""; } - if (!commonPathComponents) { - return currentDirectory; - } - return ts.getNormalizedPathFromPathComponents(commonPathComponents); + return computeCommonSourceDirectoryOfFilenames(fileNames, currentDirectory, getCanonicalFileName); } function checkSourceFilesBelongToPath(sourceFiles, rootDirectory) { var allFilesBelongToPath = true; if (sourceFiles) { var absoluteRootDirectoryPath = host.getCanonicalFileName(ts.getNormalizedAbsolutePath(rootDirectory, currentDirectory)); - for (var _i = 0, sourceFiles_2 = sourceFiles; _i < sourceFiles_2.length; _i++) { - var sourceFile = sourceFiles_2[_i]; + for (var _i = 0, sourceFiles_3 = sourceFiles; _i < sourceFiles_3.length; _i++) { + var sourceFile = sourceFiles_3[_i]; if (!ts.isDeclarationFile(sourceFile)) { var absoluteSourceFilePath = host.getCanonicalFileName(ts.getNormalizedAbsolutePath(sourceFile.fileName, currentDirectory)); if (absoluteSourceFilePath.indexOf(absoluteRootDirectoryPath) !== 0) { @@ -40889,6 +42294,17 @@ var ts; programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "sourceRoot", "sourceMap")); } } + if (options.declarationDir) { + if (!options.declaration) { + programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "declarationDir", "declaration")); + } + if (options.out || options.outFile) { + programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "declarationDir", options.out ? "out" : "outFile")); + } + } + if (options.lib && options.noLib) { + programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "lib", "noLib")); + } var languageVersion = options.target || 0 /* ES3 */; var outFile = options.outFile || options.out; var firstExternalModuleSourceFile = ts.forEach(files, function (f) { return ts.isExternalModule(f) ? f : undefined; }); @@ -40927,21 +42343,7 @@ var ts; programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Cannot_find_the_common_subdirectory_path_for_the_input_files)); } } - if (options.noEmit) { - if (options.out) { - programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "noEmit", "out")); - } - if (options.outFile) { - programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "noEmit", "outFile")); - } - if (options.outDir) { - programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "noEmit", "outDir")); - } - if (options.declaration) { - programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "noEmit", "declaration")); - } - } - else if (options.allowJs && options.declaration) { + if (!options.noEmit && options.allowJs && options.declaration) { programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "allowJs", "declaration")); } if (options.emitDecoratorMetadata && @@ -41005,6 +42407,12 @@ var ts; type: "boolean", description: ts.Diagnostics.Generates_corresponding_d_ts_file }, + { + name: "declarationDir", + type: "string", + isFilePath: true, + paramType: ts.Diagnostics.DIRECTORY + }, { name: "diagnostics", type: "boolean" @@ -41039,13 +42447,12 @@ var ts; "react": 2 /* React */ }, paramType: ts.Diagnostics.KIND, - description: ts.Diagnostics.Specify_JSX_code_generation_Colon_preserve_or_react, - error: ts.Diagnostics.Argument_for_jsx_must_be_preserve_or_react + description: ts.Diagnostics.Specify_JSX_code_generation_Colon_preserve_or_react }, { name: "reactNamespace", type: "string", - description: ts.Diagnostics.Specifies_the_object_invoked_for_createElement_and_spread_when_targeting_react_JSX_emit + description: ts.Diagnostics.Specify_the_object_invoked_for_createElement_and_spread_when_targeting_react_JSX_emit }, { name: "listFiles", @@ -41059,7 +42466,7 @@ var ts; name: "mapRoot", type: "string", isFilePath: true, - description: ts.Diagnostics.Specifies_the_location_where_debugger_should_locate_map_files_instead_of_generated_locations, + description: ts.Diagnostics.Specify_the_location_where_debugger_should_locate_map_files_instead_of_generated_locations, paramType: ts.Diagnostics.LOCATION }, { @@ -41075,8 +42482,7 @@ var ts; "es2015": ts.ModuleKind.ES2015 }, description: ts.Diagnostics.Specify_module_code_generation_Colon_commonjs_amd_system_umd_or_es2015, - paramType: ts.Diagnostics.KIND, - error: ts.Diagnostics.Argument_for_module_option_must_be_commonjs_amd_system_umd_es2015_or_none + paramType: ts.Diagnostics.KIND }, { name: "newLine", @@ -41084,9 +42490,8 @@ var ts; "crlf": 0 /* CarriageReturnLineFeed */, "lf": 1 /* LineFeed */ }, - description: ts.Diagnostics.Specifies_the_end_of_line_sequence_to_be_used_when_emitting_files_Colon_CRLF_dos_or_LF_unix, - paramType: ts.Diagnostics.NEWLINE, - error: ts.Diagnostics.Argument_for_newLine_option_must_be_CRLF_or_LF + 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 }, { name: "noEmit", @@ -41107,6 +42512,11 @@ var ts; type: "boolean", 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 + }, { name: "noLib", type: "boolean" @@ -41147,7 +42557,6 @@ var ts; }, { name: "pretty", - paramType: ts.Diagnostics.KIND, description: ts.Diagnostics.Stylize_errors_and_messages_using_color_and_context_experimental, type: "boolean" }, @@ -41168,8 +42577,8 @@ var ts; name: "rootDir", type: "string", isFilePath: true, - description: ts.Diagnostics.Specifies_the_root_directory_of_input_files_Use_to_control_the_output_directory_structure_with_outDir, - paramType: ts.Diagnostics.LOCATION + paramType: ts.Diagnostics.LOCATION, + description: ts.Diagnostics.Specify_the_root_directory_of_input_files_Use_to_control_the_output_directory_structure_with_outDir }, { name: "isolatedModules", @@ -41184,7 +42593,7 @@ var ts; name: "sourceRoot", type: "string", isFilePath: true, - description: ts.Diagnostics.Specifies_the_location_where_debugger_should_locate_TypeScript_files_instead_of_source_locations, + description: ts.Diagnostics.Specify_the_location_where_debugger_should_locate_TypeScript_files_instead_of_source_locations, paramType: ts.Diagnostics.LOCATION }, { @@ -41213,9 +42622,8 @@ var ts; "es6": 2 /* ES6 */, "es2015": 2 /* ES2015 */ }, - description: ts.Diagnostics.Specify_ECMAScript_target_version_Colon_ES3_default_ES5_or_ES2015_experimental, - paramType: ts.Diagnostics.VERSION, - error: ts.Diagnostics.Argument_for_target_option_must_be_ES3_ES5_or_ES2015 + description: ts.Diagnostics.Specify_ECMAScript_target_version_Colon_ES3_default_ES5_or_ES2015, + paramType: ts.Diagnostics.VERSION }, { name: "version", @@ -41246,8 +42654,7 @@ var ts; "node": ts.ModuleResolutionKind.NodeJs, "classic": ts.ModuleResolutionKind.Classic }, - description: ts.Diagnostics.Specifies_module_resolution_strategy_Colon_node_Node_js_or_classic_TypeScript_pre_1_6, - error: ts.Diagnostics.Argument_for_moduleResolution_option_must_be_node_or_classic + description: ts.Diagnostics.Specify_module_resolution_strategy_Colon_node_Node_js_or_classic_TypeScript_pre_1_6 }, { name: "allowUnusedLabels", @@ -41291,14 +42698,41 @@ var ts; // this option can only be specified in tsconfig.json // use type = object to copy the value as-is name: "rootDirs", - type: "object", + type: "list", isTSConfigOnly: true, - isFilePath: true + element: { + name: "rootDirs", + type: "string", + isFilePath: true + } }, { - name: "traceModuleResolution", + name: "typesSearchPaths", + type: "list", + isTSConfigOnly: true, + element: { + name: "typesSearchPaths", + type: "string", + isFilePath: true + } + }, + { + name: "typesRoot", + type: "string" + }, + { + name: "types", + type: "list", + element: { + name: "types", + type: "string" + }, + description: ts.Diagnostics.Type_declaration_files_to_be_included_in_compilation + }, + { + name: "traceResolution", type: "boolean", - description: ts.Diagnostics.Enable_tracing_of_the_module_resolution_process + description: ts.Diagnostics.Enable_tracing_of_the_name_resolution_process }, { name: "allowJs", @@ -41314,6 +42748,69 @@ var ts; name: "noImplicitUseStrict", type: "boolean", description: ts.Diagnostics.Do_not_emit_use_strict_directives_in_module_output + }, + { + name: "listEmittedFiles", + type: "boolean" + }, + { + name: "lib", + type: "list", + element: { + name: "lib", + type: { + // JavaScript only + "es5": "lib.es5.d.ts", + "es6": "lib.es2015.d.ts", + "es2015": "lib.es2015.d.ts", + "es7": "lib.es2016.d.ts", + "es2016": "lib.es2016.d.ts", + // Host only + "dom": "lib.dom.d.ts", + "webworker": "lib.webworker.d.ts", + "scripthost": "lib.scripthost.d.ts", + // ES2015 Or ESNext By-feature options + "es2015.core": "lib.es2015.core.d.ts", + "es2015.collection": "lib.es2015.collection.d.ts", + "es2015.generator": "lib.es2015.generator.d.ts", + "es2015.iterable": "lib.es2015.iterable.d.ts", + "es2015.promise": "lib.es2015.promise.d.ts", + "es2015.proxy": "lib.es2015.proxy.d.ts", + "es2015.reflect": "lib.es2015.reflect.d.ts", + "es2015.symbol": "lib.es2015.symbol.d.ts", + "es2015.symbol.wellknown": "lib.es2015.symbol.wellknown.d.ts", + "es2016.array.include": "lib.es2016.array.include.d.ts" + } + }, + description: ts.Diagnostics.Specify_library_files_to_be_included_in_the_compilation_Colon + }, + { + name: "strictNullChecks", + type: "boolean", + description: ts.Diagnostics.Enable_strict_null_checks + } + ]; + /* @internal */ + ts.typingOptionDeclarations = [ + { + name: "enableAutoDiscovery", + type: "boolean" + }, + { + name: "include", + type: "list", + element: { + name: "include", + type: "string" + } + }, + { + name: "exclude", + type: "list", + element: { + name: "exclude", + type: "string" + } } ]; var optionNameMapCache; @@ -41334,6 +42831,41 @@ var ts; return optionNameMapCache; } ts.getOptionNameMap = getOptionNameMap; + /* @internal */ + function createCompilerDiagnosticForInvalidCustomType(opt) { + var namesOfType = []; + ts.forEachKey(opt.type, function (key) { + namesOfType.push(" '" + key + "'"); + }); + 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 = (value || "").trim().toLowerCase(); + var map = opt.type; + if (ts.hasProperty(map, key)) { + return map[key]; + } + else { + errors.push(createCompilerDiagnosticForInvalidCustomType(opt)); + } + } + ts.parseCustomTypeOption = parseCustomTypeOption; + /* @internal */ + function parseListTypeOption(opt, value, errors) { + var values = (value || "").trim().split(","); + switch (opt.element.type) { + case "number": + return ts.map(values, parseInt); + case "string": + return ts.map(values, function (v) { return v || ""; }); + default: + return ts.filter(ts.map(values, function (v) { return parseCustomTypeOption(opt.element, v, errors); }), function (v) { return !!v; }); + } + } + ts.parseListTypeOption = parseListTypeOption; + /* @internal */ function parseCommandLine(commandLine, readFile) { var options = {}; var fileNames = []; @@ -41381,17 +42913,15 @@ var ts; options[opt.name] = args[i] || ""; i++; break; + case "list": + options[opt.name] = parseListTypeOption(opt, args[i], errors); + i++; + break; // If not a primitive, the possible types are specified in what is effectively a map of options. default: - var map_1 = opt.type; - var key = (args[i] || "").toLowerCase(); + options[opt.name] = parseCustomTypeOption(opt, args[i], errors); i++; - if (ts.hasProperty(map_1, key)) { - options[opt.name] = map_1[key]; - } - else { - errors.push(ts.createCompilerDiagnostic(opt.error)); - } + break; } } } @@ -41503,17 +43033,22 @@ var ts; */ function parseJsonConfigFileContent(json, host, basePath, existingOptions, configFileName) { if (existingOptions === void 0) { existingOptions = {}; } - var _a = convertCompilerOptionsFromJson(json["compilerOptions"], basePath, configFileName), optionsFromJsonConfigFile = _a.options, errors = _a.errors; - var options = ts.extend(existingOptions, optionsFromJsonConfigFile); + var errors = []; + var compilerOptions = convertCompilerOptionsFromJsonWorker(json["compilerOptions"], basePath, errors, configFileName); + var options = ts.extend(existingOptions, compilerOptions); + var typingOptions = convertTypingOptionsFromJsonWorker(json["typingOptions"], basePath, errors, configFileName); + options.configFilePath = configFileName; + var fileNames = getFileNames(errors); return { options: options, - fileNames: getFileNames(), + fileNames: fileNames, + typingOptions: typingOptions, errors: errors }; - function getFileNames() { + function getFileNames(errors) { var fileNames = []; if (ts.hasProperty(json, "files")) { - if (json["files"] instanceof Array) { + if (ts.isArray(json["files"])) { fileNames = ts.map(json["files"], function (s) { return ts.combinePaths(basePath, s); }); } else { @@ -41523,7 +43058,7 @@ var ts; else { var filesSeen = {}; var exclude = []; - if (json["exclude"] instanceof Array) { + if (ts.isArray(json["exclude"])) { exclude = json["exclude"]; } else { @@ -41565,86 +43100,88 @@ var ts; } } } + if (ts.hasProperty(json, "excludes") && !ts.hasProperty(json, "exclude")) { + errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Unknown_option_excludes_Did_you_mean_exclude)); + } return fileNames; } } ts.parseJsonConfigFileContent = parseJsonConfigFileContent; function convertCompilerOptionsFromJson(jsonOptions, basePath, configFileName) { - var options = {}; var errors = []; - if (configFileName && ts.getBaseFileName(configFileName) === "jsconfig.json") { - options.allowJs = true; - } - if (!jsonOptions) { - return { options: options, errors: errors }; - } - var optionNameMap = ts.arrayToMap(ts.optionDeclarations, function (opt) { return opt.name; }); - for (var id in jsonOptions) { - if (ts.hasProperty(optionNameMap, id)) { - var opt = optionNameMap[id]; - var optType = opt.type; - var value = jsonOptions[id]; - var expectedType = typeof optType === "string" ? optType : "string"; - if (typeof value === expectedType) { - if (typeof optType !== "string") { - var key = value.toLowerCase(); - if (ts.hasProperty(optType, key)) { - value = optType[key]; - } - else { - errors.push(ts.createCompilerDiagnostic(opt.error)); - value = 0; - } - } - if (opt.isFilePath) { - switch (typeof value) { - case "string": - value = ts.normalizePath(ts.combinePaths(basePath, value)); - break; - case "object": - // "object" options with 'isFilePath' = true expected to be string arrays - var paths = []; - var invalidOptionType = false; - if (!ts.isArray(value)) { - invalidOptionType = true; - } - else { - for (var _i = 0, _a = value; _i < _a.length; _i++) { - var element = _a[_i]; - if (typeof element === "string") { - paths.push(ts.normalizePath(ts.combinePaths(basePath, element))); - } - else { - invalidOptionType = true; - break; - } - } - } - if (invalidOptionType) { - errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_should_have_array_of_strings_as_a_value, opt.name)); - } - else { - value = paths; - } - break; - } - if (value === "") { - value = "."; - } - } - options[opt.name] = value; - } - else { - errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Compiler_option_0_requires_a_value_of_type_1, id, expectedType)); - } - } - else { - errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Unknown_compiler_option_0, id)); - } - } + var options = convertCompilerOptionsFromJsonWorker(jsonOptions, basePath, errors, configFileName); return { options: options, errors: errors }; } ts.convertCompilerOptionsFromJson = convertCompilerOptionsFromJson; + function convertTypingOptionsFromJson(jsonOptions, basePath, configFileName) { + var errors = []; + var options = convertTypingOptionsFromJsonWorker(jsonOptions, basePath, errors, configFileName); + return { options: options, errors: errors }; + } + ts.convertTypingOptionsFromJson = convertTypingOptionsFromJson; + function convertCompilerOptionsFromJsonWorker(jsonOptions, basePath, errors, configFileName) { + var options = ts.getBaseFileName(configFileName) === "jsconfig.json" ? { allowJs: 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); + return options; + } + function convertOptionsFromJson(optionDeclarations, jsonOptions, basePath, defaultOptions, diagnosticMessage, errors) { + if (!jsonOptions) { + return; + } + var optionNameMap = ts.arrayToMap(optionDeclarations, function (opt) { return opt.name; }); + for (var id in jsonOptions) { + if (ts.hasProperty(optionNameMap, id)) { + var opt = optionNameMap[id]; + defaultOptions[opt.name] = convertJsonOption(opt, jsonOptions[id], basePath, errors); + } + else { + errors.push(ts.createCompilerDiagnostic(diagnosticMessage, id)); + } + } + } + function convertJsonOption(opt, value, basePath, errors) { + var optType = opt.type; + var expectedType = typeof optType === "string" ? optType : "string"; + if (optType === "list" && ts.isArray(value)) { + return convertJsonOptionOfListType(opt, value, basePath, errors); + } + else if (typeof value === expectedType) { + if (typeof optType !== "string") { + return convertJsonOptionOfCustomType(opt, value, errors); + } + else { + if (opt.isFilePath) { + value = ts.normalizePath(ts.combinePaths(basePath, value)); + if (value === "") { + value = "."; + } + } + } + return value; + } + else { + errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Compiler_option_0_requires_a_value_of_type_1, opt.name, expectedType)); + } + } + function convertJsonOptionOfCustomType(opt, value, errors) { + var key = value.toLowerCase(); + if (ts.hasProperty(opt.type, key)) { + return opt.type[key]; + } + else { + errors.push(createCompilerDiagnosticForInvalidCustomType(opt)); + } + } + function convertJsonOptionOfListType(option, values, basePath, errors) { + return ts.filter(ts.map(values, function (v) { return convertJsonOption(option.element, v, basePath, errors); }), function (v) { return !!v; }); + } })(ts || (ts = {})); /* @internal */ var ts; @@ -41718,7 +43255,7 @@ var ts; } } function autoCollapse(node) { - return ts.isFunctionBlock(node) && node.parent.kind !== 178 /* ArrowFunction */; + return ts.isFunctionBlock(node) && node.parent.kind !== 179 /* ArrowFunction */; } var depth = 0; var maxDepth = 20; @@ -41730,30 +43267,30 @@ var ts; addOutliningForLeadingCommentsForNode(n); } switch (n.kind) { - case 196 /* Block */: + case 198 /* Block */: if (!ts.isFunctionBlock(n)) { - var parent_9 = n.parent; + var parent_11 = 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 collaps the block, but consider its hint span + // If the latter, we want to collapse the block, but consider its hint span // to be the entire span of the parent. - if (parent_9.kind === 201 /* DoStatement */ || - parent_9.kind === 204 /* ForInStatement */ || - parent_9.kind === 205 /* ForOfStatement */ || - parent_9.kind === 203 /* ForStatement */ || - parent_9.kind === 200 /* IfStatement */ || - parent_9.kind === 202 /* WhileStatement */ || - parent_9.kind === 209 /* WithStatement */ || - parent_9.kind === 248 /* CatchClause */) { - addOutliningSpan(parent_9, openBrace, closeBrace, autoCollapse(n)); + if (parent_11.kind === 203 /* DoStatement */ || + parent_11.kind === 206 /* ForInStatement */ || + parent_11.kind === 207 /* ForOfStatement */ || + parent_11.kind === 205 /* ForStatement */ || + parent_11.kind === 202 /* IfStatement */ || + parent_11.kind === 204 /* WhileStatement */ || + parent_11.kind === 211 /* WithStatement */ || + parent_11.kind === 251 /* CatchClause */) { + addOutliningSpan(parent_11, openBrace, closeBrace, autoCollapse(n)); break; } - if (parent_9.kind === 213 /* TryStatement */) { + if (parent_11.kind === 215 /* TryStatement */) { // Could be the try-block, or the finally-block. - var tryStatement = parent_9; + var tryStatement = parent_11; if (tryStatement.tryBlock === n) { - addOutliningSpan(parent_9, openBrace, closeBrace, autoCollapse(n)); + addOutliningSpan(parent_11, openBrace, closeBrace, autoCollapse(n)); break; } else if (tryStatement.finallyBlock === n) { @@ -41776,23 +43313,23 @@ var ts; break; } // Fallthrough. - case 223 /* ModuleBlock */: { + case 225 /* ModuleBlock */: { var openBrace = ts.findChildOfKind(n, 15 /* OpenBraceToken */, sourceFile); var closeBrace = ts.findChildOfKind(n, 16 /* CloseBraceToken */, sourceFile); addOutliningSpan(n.parent, openBrace, closeBrace, autoCollapse(n)); break; } - case 218 /* ClassDeclaration */: - case 219 /* InterfaceDeclaration */: - case 221 /* EnumDeclaration */: - case 169 /* ObjectLiteralExpression */: - case 224 /* CaseBlock */: { + case 220 /* ClassDeclaration */: + case 221 /* InterfaceDeclaration */: + case 223 /* EnumDeclaration */: + case 170 /* ObjectLiteralExpression */: + case 226 /* 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 168 /* ArrayLiteralExpression */: + case 169 /* ArrayLiteralExpression */: var openBracket = ts.findChildOfKind(n, 19 /* OpenBracketToken */, sourceFile); var closeBracket = ts.findChildOfKind(n, 20 /* CloseBracketToken */, sourceFile); addOutliningSpan(n, openBracket, closeBracket, autoCollapse(n)); @@ -41822,12 +43359,12 @@ var ts; ts.forEach(program.getSourceFiles(), function (sourceFile) { cancellationToken.throwIfCancellationRequested(); var nameToDeclarations = sourceFile.getNamedDeclarations(); - for (var name_31 in nameToDeclarations) { - var declarations = ts.getProperty(nameToDeclarations, name_31); + for (var name_34 in nameToDeclarations) { + var declarations = ts.getProperty(nameToDeclarations, name_34); 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_31); + var matches = patternMatcher.getMatchesForLastSegmentOfPattern(name_34); if (!matches) { continue; } @@ -41840,14 +43377,14 @@ var ts; if (!containers) { return undefined; } - matches = patternMatcher.getMatches(containers, name_31); + matches = patternMatcher.getMatches(containers, name_34); if (!matches) { continue; } } var fileName = sourceFile.fileName; var matchKind = bestMatchKind(matches); - rawItems.push({ name: name_31, fileName: fileName, matchKind: matchKind, isCaseSensitive: allMatchesAreCaseSensitive(matches), declaration: declaration }); + rawItems.push({ name: name_34, fileName: fileName, matchKind: matchKind, isCaseSensitive: allMatchesAreCaseSensitive(matches), declaration: declaration }); } } } @@ -41885,7 +43422,7 @@ var ts; if (text !== undefined) { containers.unshift(text); } - else if (declaration.name.kind === 138 /* ComputedPropertyName */) { + else if (declaration.name.kind === 139 /* ComputedPropertyName */) { return tryAddComputedPropertyName(declaration.name.expression, containers, /*includeLastPortion*/ true); } else { @@ -41906,7 +43443,7 @@ var ts; } return true; } - if (expression.kind === 170 /* PropertyAccessExpression */) { + if (expression.kind === 171 /* PropertyAccessExpression */) { var propertyAccess = expression; if (includeLastPortion) { containers.unshift(propertyAccess.name.text); @@ -41919,7 +43456,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 === 138 /* ComputedPropertyName */) { + if (declaration.name.kind === 139 /* ComputedPropertyName */) { if (!tryAddComputedPropertyName(declaration.name.expression, containers, /*includeLastPortion*/ false)) { return undefined; } @@ -41982,6 +43519,11 @@ var ts; var NavigationBar; (function (NavigationBar) { function getNavigationBarItems(sourceFile, compilerOptions) { + // TODO: Handle JS files differently in 'navbar' calls for now, but ideally we should unify + // the 'navbar' and 'navto' logic for TypeScript and JavaScript. + if (ts.isSourceFileJavaScript(sourceFile)) { + return getJsNavigationBarItems(sourceFile, compilerOptions); + } // If the source file has any child items, then it included in the tree // and takes lexical ownership of all other top-level items. var hasGlobalNode = false; @@ -41993,17 +43535,17 @@ var ts; var current = node.parent; while (current) { switch (current.kind) { - case 222 /* ModuleDeclaration */: + case 224 /* ModuleDeclaration */: // If we have a module declared as A.B.C, it is more "intuitive" // to say it only has a single layer of depth do { current = current.parent; - } while (current.kind === 222 /* ModuleDeclaration */); + } while (current.kind === 224 /* ModuleDeclaration */); // fall through - case 218 /* ClassDeclaration */: - case 221 /* EnumDeclaration */: - case 219 /* InterfaceDeclaration */: - case 217 /* FunctionDeclaration */: + case 220 /* ClassDeclaration */: + case 223 /* EnumDeclaration */: + case 221 /* InterfaceDeclaration */: + case 219 /* FunctionDeclaration */: indent++; } current = current.parent; @@ -42014,21 +43556,21 @@ var ts; var childNodes = []; function visit(node) { switch (node.kind) { - case 197 /* VariableStatement */: + case 199 /* VariableStatement */: ts.forEach(node.declarationList.declarations, visit); break; - case 165 /* ObjectBindingPattern */: - case 166 /* ArrayBindingPattern */: + case 166 /* ObjectBindingPattern */: + case 167 /* ArrayBindingPattern */: ts.forEach(node.elements, visit); break; - case 232 /* ExportDeclaration */: + case 235 /* 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 226 /* ImportDeclaration */: + case 229 /* ImportDeclaration */: var importClause = node.importClause; if (importClause) { // Handle default import case e.g.: @@ -42040,7 +43582,7 @@ var ts; // import * as NS from "mod"; // import {a, b as B} from "mod"; if (importClause.namedBindings) { - if (importClause.namedBindings.kind === 228 /* NamespaceImport */) { + if (importClause.namedBindings.kind === 231 /* NamespaceImport */) { childNodes.push(importClause.namedBindings); } else { @@ -42049,21 +43591,21 @@ var ts; } } break; - case 167 /* BindingElement */: - case 215 /* VariableDeclaration */: + case 168 /* BindingElement */: + case 217 /* VariableDeclaration */: if (ts.isBindingPattern(node.name)) { visit(node.name); break; } // Fall through - case 218 /* ClassDeclaration */: - case 221 /* EnumDeclaration */: - case 219 /* InterfaceDeclaration */: - case 222 /* ModuleDeclaration */: - case 217 /* FunctionDeclaration */: - case 225 /* ImportEqualsDeclaration */: - case 230 /* ImportSpecifier */: - case 234 /* ExportSpecifier */: + case 220 /* ClassDeclaration */: + case 223 /* EnumDeclaration */: + case 221 /* InterfaceDeclaration */: + case 224 /* ModuleDeclaration */: + case 219 /* FunctionDeclaration */: + case 228 /* ImportEqualsDeclaration */: + case 233 /* ImportSpecifier */: + case 237 /* ExportSpecifier */: childNodes.push(node); break; } @@ -42111,17 +43653,31 @@ var ts; for (var _i = 0, nodes_4 = nodes; _i < nodes_4.length; _i++) { var node = nodes_4[_i]; switch (node.kind) { - case 218 /* ClassDeclaration */: - case 221 /* EnumDeclaration */: - case 219 /* InterfaceDeclaration */: + case 220 /* ClassDeclaration */: + topLevelNodes.push(node); + for (var _a = 0, _b = node.members; _a < _b.length; _a++) { + var member = _b[_a]; + if (member.kind === 146 /* MethodDeclaration */ || member.kind === 147 /* Constructor */) { + if (member.body) { + // We do not include methods that does not have child functions in it, because of duplications. + if (hasNamedFunctionDeclarations(member.body.statements)) { + topLevelNodes.push(member); + } + addTopLevelNodes(member.body.statements, topLevelNodes); + } + } + } + break; + case 223 /* EnumDeclaration */: + case 221 /* InterfaceDeclaration */: topLevelNodes.push(node); break; - case 222 /* ModuleDeclaration */: + case 224 /* ModuleDeclaration */: var moduleDeclaration = node; topLevelNodes.push(node); addTopLevelNodes(getInnermostModule(moduleDeclaration).body.statements, topLevelNodes); break; - case 217 /* FunctionDeclaration */: + case 219 /* FunctionDeclaration */: var functionDeclaration = node; if (isTopLevelFunctionDeclaration(functionDeclaration)) { topLevelNodes.push(node); @@ -42131,20 +43687,36 @@ var ts; } } } + function hasNamedFunctionDeclarations(nodes) { + for (var _i = 0, nodes_5 = nodes; _i < nodes_5.length; _i++) { + var s = nodes_5[_i]; + if (s.kind === 219 /* FunctionDeclaration */ && !isEmpty(s.name.text)) { + return true; + } + } + return false; + } function isTopLevelFunctionDeclaration(functionDeclaration) { - if (functionDeclaration.kind === 217 /* FunctionDeclaration */) { - // A function declaration is 'top level' if it contains any function declarations - // within it. - if (functionDeclaration.body && functionDeclaration.body.kind === 196 /* Block */) { + if (functionDeclaration.kind === 219 /* FunctionDeclaration */) { + // A function declaration is 'top level' if it contains any function declarations + // within it. + if (functionDeclaration.body && functionDeclaration.body.kind === 198 /* Block */) { // Proper function declarations can only have identifier names - if (ts.forEach(functionDeclaration.body.statements, function (s) { return s.kind === 217 /* FunctionDeclaration */ && !isEmpty(s.name.text); })) { + if (hasNamedFunctionDeclarations(functionDeclaration.body.statements)) { return true; } - // Or if it is not parented by another function. i.e all functions - // at module scope are 'top level'. + // Or if it is not parented by another function. I.e all functions at module scope are 'top level'. if (!ts.isFunctionBlock(functionDeclaration.parent)) { return true; } + else { + // We have made sure that a grand parent node exists with 'isFunctionBlock()' above. + var grandParentKind = functionDeclaration.parent.parent.kind; + if (grandParentKind === 146 /* MethodDeclaration */ || + grandParentKind === 147 /* Constructor */) { + return true; + } + } } } return false; @@ -42152,8 +43724,8 @@ var ts; function getItemsWorker(nodes, createItem) { var items = []; var keyToItem = {}; - for (var _i = 0, nodes_5 = nodes; _i < nodes_5.length; _i++) { - var child = nodes_5[_i]; + for (var _i = 0, nodes_6 = nodes; _i < nodes_6.length; _i++) { + var child = nodes_6[_i]; var item = createItem(child); if (item !== undefined) { if (item.text.length > 0) { @@ -42197,7 +43769,7 @@ var ts; } function createChildItem(node) { switch (node.kind) { - case 140 /* Parameter */: + case 141 /* Parameter */: if (ts.isBindingPattern(node.name)) { break; } @@ -42205,36 +43777,36 @@ var ts; return undefined; } return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.memberVariableElement); - case 145 /* MethodDeclaration */: - case 144 /* MethodSignature */: + case 146 /* MethodDeclaration */: + case 145 /* MethodSignature */: return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.memberFunctionElement); - case 147 /* GetAccessor */: + case 148 /* GetAccessor */: return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.memberGetAccessorElement); - case 148 /* SetAccessor */: + case 149 /* SetAccessor */: return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.memberSetAccessorElement); - case 151 /* IndexSignature */: + case 152 /* IndexSignature */: return createItem(node, "[]", ts.ScriptElementKind.indexSignatureElement); - case 251 /* EnumMember */: + case 254 /* EnumMember */: return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.memberVariableElement); - case 149 /* CallSignature */: + case 150 /* CallSignature */: return createItem(node, "()", ts.ScriptElementKind.callSignatureElement); - case 150 /* ConstructSignature */: + case 151 /* ConstructSignature */: return createItem(node, "new()", ts.ScriptElementKind.constructSignatureElement); - case 143 /* PropertyDeclaration */: - case 142 /* PropertySignature */: + case 144 /* PropertyDeclaration */: + case 143 /* PropertySignature */: return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.memberVariableElement); - case 217 /* FunctionDeclaration */: + case 219 /* FunctionDeclaration */: return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.functionElement); - case 215 /* VariableDeclaration */: - case 167 /* BindingElement */: + case 217 /* VariableDeclaration */: + case 168 /* BindingElement */: var variableDeclarationNode = void 0; - var name_32; - if (node.kind === 167 /* BindingElement */) { - name_32 = node.name; + var name_35; + if (node.kind === 168 /* BindingElement */) { + name_35 = node.name; variableDeclarationNode = node; // binding elements are added only for variable declarations // bubble up to the containing variable declaration - while (variableDeclarationNode && variableDeclarationNode.kind !== 215 /* VariableDeclaration */) { + while (variableDeclarationNode && variableDeclarationNode.kind !== 217 /* VariableDeclaration */) { variableDeclarationNode = variableDeclarationNode.parent; } ts.Debug.assert(variableDeclarationNode !== undefined); @@ -42242,24 +43814,24 @@ var ts; else { ts.Debug.assert(!ts.isBindingPattern(node.name)); variableDeclarationNode = node; - name_32 = node.name; + name_35 = node.name; } if (ts.isConst(variableDeclarationNode)) { - return createItem(node, getTextOfNode(name_32), ts.ScriptElementKind.constElement); + return createItem(node, getTextOfNode(name_35), ts.ScriptElementKind.constElement); } else if (ts.isLet(variableDeclarationNode)) { - return createItem(node, getTextOfNode(name_32), ts.ScriptElementKind.letElement); + return createItem(node, getTextOfNode(name_35), ts.ScriptElementKind.letElement); } else { - return createItem(node, getTextOfNode(name_32), ts.ScriptElementKind.variableElement); + return createItem(node, getTextOfNode(name_35), ts.ScriptElementKind.variableElement); } - case 146 /* Constructor */: + case 147 /* Constructor */: return createItem(node, "constructor", ts.ScriptElementKind.constructorImplementationElement); - case 234 /* ExportSpecifier */: - case 230 /* ImportSpecifier */: - case 225 /* ImportEqualsDeclaration */: - case 227 /* ImportClause */: - case 228 /* NamespaceImport */: + case 237 /* ExportSpecifier */: + case 233 /* ImportSpecifier */: + case 228 /* ImportEqualsDeclaration */: + case 230 /* ImportClause */: + case 231 /* NamespaceImport */: return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.alias); } return undefined; @@ -42289,17 +43861,20 @@ var ts; } function createTopLevelItem(node) { switch (node.kind) { - case 252 /* SourceFile */: + case 255 /* SourceFile */: return createSourceFileItem(node); - case 218 /* ClassDeclaration */: + case 220 /* ClassDeclaration */: return createClassItem(node); - case 221 /* EnumDeclaration */: + case 146 /* MethodDeclaration */: + case 147 /* Constructor */: + return createMemberFunctionLikeItem(node); + case 223 /* EnumDeclaration */: return createEnumItem(node); - case 219 /* InterfaceDeclaration */: - return createIterfaceItem(node); - case 222 /* ModuleDeclaration */: + case 221 /* InterfaceDeclaration */: + return createInterfaceItem(node); + case 224 /* ModuleDeclaration */: return createModuleItem(node); - case 217 /* FunctionDeclaration */: + case 219 /* FunctionDeclaration */: return createFunctionItem(node); } return undefined; @@ -42311,7 +43886,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 === 222 /* ModuleDeclaration */) { + while (moduleDeclaration.body && moduleDeclaration.body.kind === 224 /* ModuleDeclaration */) { moduleDeclaration = moduleDeclaration.body; result.push(moduleDeclaration.name.text); } @@ -42323,12 +43898,29 @@ var ts; return getNavigationBarItem(moduleName, ts.ScriptElementKind.moduleElement, ts.getNodeModifiers(node), [getNodeSpan(node)], childItems, getIndent(node)); } function createFunctionItem(node) { - if (node.body && node.body.kind === 196 /* Block */) { + if (node.body && node.body.kind === 198 /* Block */) { var childItems = getItemsWorker(sortNodes(node.body.statements), createChildItem); return getNavigationBarItem(!node.name ? "default" : node.name.text, ts.ScriptElementKind.functionElement, ts.getNodeModifiers(node), [getNodeSpan(node)], childItems, getIndent(node)); } return undefined; } + function createMemberFunctionLikeItem(node) { + if (node.body && node.body.kind === 198 /* Block */) { + var childItems = getItemsWorker(sortNodes(node.body.statements), createChildItem); + var scriptElementKind = void 0; + var memberFunctionName = void 0; + if (node.kind === 146 /* MethodDeclaration */) { + memberFunctionName = ts.getPropertyNameForPropertyNameNode(node.name); + scriptElementKind = ts.ScriptElementKind.memberFunctionElement; + } + else { + memberFunctionName = "constructor"; + scriptElementKind = ts.ScriptElementKind.constructorImplementationElement; + } + return getNavigationBarItem(memberFunctionName, scriptElementKind, ts.getNodeModifiers(node), [getNodeSpan(node)], childItems, getIndent(node)); + } + return undefined; + } function createSourceFileItem(node) { var childItems = getItemsWorker(getChildNodes(node.statements), createChildItem); if (childItems === undefined || childItems.length === 0) { @@ -42344,7 +43936,7 @@ var ts; var childItems; if (node.members) { var constructor = ts.forEach(node.members, function (member) { - return member.kind === 146 /* Constructor */ && member; + return member.kind === 147 /* Constructor */ && member; }); // Add the constructor parameters in as children of the class (for property parameters). // Note that *all non-binding pattern named* parameters will be added to the nodes array, but parameters that @@ -42362,13 +43954,13 @@ var ts; var childItems = getItemsWorker(sortNodes(removeComputedProperties(node)), createChildItem); return getNavigationBarItem(node.name.text, ts.ScriptElementKind.enumElement, ts.getNodeModifiers(node), [getNodeSpan(node)], childItems, getIndent(node)); } - function createIterfaceItem(node) { + function createInterfaceItem(node) { var childItems = getItemsWorker(sortNodes(removeDynamicallyNamedProperties(node)), createChildItem); return getNavigationBarItem(node.name.text, ts.ScriptElementKind.interfaceElement, ts.getNodeModifiers(node), [getNodeSpan(node)], childItems, getIndent(node)); } } function removeComputedProperties(node) { - return ts.filter(node.members, function (member) { return member.name === undefined || member.name.kind !== 138 /* ComputedPropertyName */; }); + return ts.filter(node.members, function (member) { return member.name === undefined || member.name.kind !== 139 /* ComputedPropertyName */; }); } /** * Like removeComputedProperties, but retains the properties with well known symbol names @@ -42377,13 +43969,13 @@ var ts; return ts.filter(node.members, function (member) { return !ts.hasDynamicName(member); }); } function getInnermostModule(node) { - while (node.body.kind === 222 /* ModuleDeclaration */) { + while (node.body.kind === 224 /* ModuleDeclaration */) { node = node.body; } return node; } function getNodeSpan(node) { - return node.kind === 252 /* SourceFile */ + return node.kind === 255 /* SourceFile */ ? ts.createTextSpanFromBounds(node.getFullStart(), node.getEnd()) : ts.createTextSpanFromBounds(node.getStart(), node.getEnd()); } @@ -42392,6 +43984,188 @@ var ts; } } NavigationBar.getNavigationBarItems = getNavigationBarItems; + function getJsNavigationBarItems(sourceFile, compilerOptions) { + var anonFnText = ""; + var anonClassText = ""; + var indent = 0; + var rootName = ts.isExternalModule(sourceFile) ? + "\"" + ts.escapeString(ts.getBaseFileName(ts.removeFileExtension(ts.normalizePath(sourceFile.fileName)))) + "\"" + : ""; + var sourceFileItem = getNavBarItem(rootName, ts.ScriptElementKind.moduleElement, [getNodeSpan(sourceFile)]); + var topItem = sourceFileItem; + // Walk the whole file, because we want to also find function expressions - which may be in variable initializer, + // call arguments, expressions, etc... + ts.forEachChild(sourceFile, visitNode); + function visitNode(node) { + var newItem = createNavBarItem(node); + if (newItem) { + topItem.childItems.push(newItem); + } + // Add a level if traversing into a container + if (newItem && (ts.isFunctionLike(node) || ts.isClassLike(node))) { + var lastTop = topItem; + indent++; + topItem = newItem; + ts.forEachChild(node, visitNode); + topItem = lastTop; + indent--; + // If the last item added was an anonymous function expression, and it had no children, discard it. + if (newItem && newItem.text === anonFnText && newItem.childItems.length === 0) { + topItem.childItems.pop(); + } + } + else { + ts.forEachChild(node, visitNode); + } + } + function createNavBarItem(node) { + switch (node.kind) { + case 217 /* VariableDeclaration */: + // Only add to the navbar if at the top-level of the file + // Note: "const" and "let" are also SyntaxKind.VariableDeclarations + if (node.parent /*VariableDeclarationList*/.parent /*VariableStatement*/ + .parent /*SourceFile*/.kind !== 255 /* SourceFile */) { + return undefined; + } + // If it is initialized with a function expression, handle it when we reach the function expression node + var varDecl = node; + if (varDecl.initializer && (varDecl.initializer.kind === 178 /* FunctionExpression */ || + varDecl.initializer.kind === 179 /* ArrowFunction */ || + varDecl.initializer.kind === 191 /* ClassExpression */)) { + return undefined; + } + // Fall through + case 219 /* FunctionDeclaration */: + case 220 /* ClassDeclaration */: + case 147 /* Constructor */: + case 148 /* GetAccessor */: + case 149 /* SetAccessor */: + // "export default function().." looks just like a regular function/class declaration, except with the 'default' flag + var name_36 = node.flags && (node.flags & 512 /* Default */) && !node.name ? "default" : + node.kind === 147 /* Constructor */ ? "constructor" : + ts.declarationNameToString(node.name); + return getNavBarItem(name_36, getScriptKindForElementKind(node.kind), [getNodeSpan(node)]); + case 178 /* FunctionExpression */: + case 179 /* ArrowFunction */: + case 191 /* ClassExpression */: + return getDefineModuleItem(node) || getFunctionOrClassExpressionItem(node); + case 146 /* MethodDeclaration */: + var methodDecl = node; + return getNavBarItem(ts.declarationNameToString(methodDecl.name), ts.ScriptElementKind.memberFunctionElement, [getNodeSpan(node)]); + case 234 /* ExportAssignment */: + // e.g. "export default " + return getNavBarItem("default", ts.ScriptElementKind.variableElement, [getNodeSpan(node)]); + case 230 /* ImportClause */: + if (!node.name) { + // No default import (this node is still a parent of named & namespace imports, which are handled below) + return undefined; + } + // fall through + case 233 /* ImportSpecifier */: // e.g. 'id' in: import {id} from 'mod' (in NamedImports, in ImportClause) + case 231 /* NamespaceImport */: // e.g. '* as ns' in: import * as ns from 'mod' (in ImportClause) + case 237 /* ExportSpecifier */: + // Export specifiers are only interesting if they are reexports from another module, or renamed, else they are already globals + if (node.kind === 237 /* ExportSpecifier */) { + if (!node.parent.parent.moduleSpecifier && !node.propertyName) { + return undefined; + } + } + var decl = node; + if (!decl.name) { + return undefined; + } + var declName = ts.declarationNameToString(decl.name); + return getNavBarItem(declName, ts.ScriptElementKind.constElement, [getNodeSpan(node)]); + default: + return undefined; + } + } + function getNavBarItem(text, kind, spans, kindModifiers) { + if (kindModifiers === void 0) { kindModifiers = ts.ScriptElementKindModifier.none; } + return { + text: text, kind: kind, kindModifiers: kindModifiers, spans: spans, childItems: [], indent: indent, bolded: false, grayed: false + }; + } + function getDefineModuleItem(node) { + if (node.kind !== 178 /* FunctionExpression */ && node.kind !== 179 /* ArrowFunction */) { + return undefined; + } + // No match if this is not a call expression to an identifier named 'define' + if (node.parent.kind !== 173 /* CallExpression */) { + return undefined; + } + var callExpr = node.parent; + if (callExpr.expression.kind !== 69 /* Identifier */ || callExpr.expression.getText() !== 'define') { + return undefined; + } + // Return a module of either the given text in the first argument, or of the source file path + var defaultName = node.getSourceFile().fileName; + if (callExpr.arguments[0].kind === 9 /* StringLiteral */) { + defaultName = (callExpr.arguments[0]).text; + } + return getNavBarItem(defaultName, ts.ScriptElementKind.moduleElement, [getNodeSpan(node.parent)]); + } + function getFunctionOrClassExpressionItem(node) { + if (node.kind !== 178 /* FunctionExpression */ && + node.kind !== 179 /* ArrowFunction */ && + node.kind !== 191 /* ClassExpression */) { + return undefined; + } + var fnExpr = node; + var fnName; + if (fnExpr.name && ts.getFullWidth(fnExpr.name) > 0) { + // The expression has an identifier, so use that as the name + fnName = ts.declarationNameToString(fnExpr.name); + } + else { + // See if it is a var initializer. If so, use the var name. + if (fnExpr.parent.kind === 217 /* VariableDeclaration */) { + fnName = ts.declarationNameToString(fnExpr.parent.name); + } + else if (fnExpr.parent.kind === 186 /* BinaryExpression */ && + fnExpr.parent.operatorToken.kind === 56 /* EqualsToken */) { + fnName = fnExpr.parent.left.getText(); + if (fnName.length > 20) { + fnName = fnName.substring(0, 17) + "..."; + } + } + else if (fnExpr.parent.kind === 252 /* PropertyAssignment */ && + fnExpr.parent.name) { + fnName = fnExpr.parent.name.getText(); + } + else { + fnName = node.kind === 191 /* ClassExpression */ ? anonClassText : anonFnText; + } + } + var scriptKind = node.kind === 191 /* ClassExpression */ ? ts.ScriptElementKind.classElement : ts.ScriptElementKind.functionElement; + return getNavBarItem(fnName, scriptKind, [getNodeSpan(node)]); + } + function getNodeSpan(node) { + return node.kind === 255 /* SourceFile */ + ? ts.createTextSpanFromBounds(node.getFullStart(), node.getEnd()) + : ts.createTextSpanFromBounds(node.getStart(), node.getEnd()); + } + function getScriptKindForElementKind(kind) { + switch (kind) { + case 217 /* VariableDeclaration */: + return ts.ScriptElementKind.variableElement; + case 219 /* FunctionDeclaration */: + return ts.ScriptElementKind.functionElement; + case 220 /* ClassDeclaration */: + return ts.ScriptElementKind.classElement; + case 147 /* Constructor */: + return ts.ScriptElementKind.constructorImplementationElement; + case 148 /* GetAccessor */: + return ts.ScriptElementKind.memberGetAccessorElement; + case 149 /* SetAccessor */: + return ts.ScriptElementKind.memberSetAccessorElement; + default: + return "unknown"; + } + } + return sourceFileItem.childItems; + } + NavigationBar.getJsNavigationBarItems = getJsNavigationBarItems; })(NavigationBar = ts.NavigationBar || (ts.NavigationBar = {})); })(ts || (ts = {})); /* @internal */ @@ -43008,7 +44782,7 @@ var ts; // break; // case TypeScript.SyntaxKind.GreaterThanGreaterThanGreaterThanToken: // stack++; - // // Intentaion fall through + // // Intentional fall through // case TypeScript.SyntaxKind.GreaterThanToken: // stack++; // break; @@ -43028,7 +44802,7 @@ var ts; // } // break; // case TypeScript.SyntaxKind.EqualsGreaterThanToken: - // // This can be a function type or a constructor type. In either case, we want to skip the function defintion + // // This can be a function type or a constructor type. In either case, we want to skip the function definition // token = previousToken(token, /*includeSkippedTokens*/ true); // if (token && token.kind() === TypeScript.SyntaxKind.CloseParenToken) { // // Skip untill the matching open paren token @@ -43047,7 +44821,7 @@ var ts; // } // } // else { - // // This is not a funtion type. exit the main loop + // // This is not a function type. exit the main loop // break whileLoop; // } // break; @@ -43134,7 +44908,7 @@ var ts; } return createSignatureHelpItems(candidates, resolvedSignature, argumentInfo); function createJavaScriptSignatureHelpItems(argumentInfo) { - if (argumentInfo.invocation.kind !== 172 /* CallExpression */) { + if (argumentInfo.invocation.kind !== 173 /* CallExpression */) { return undefined; } // See if we can find some symbol with the call expression name that has call signatures. @@ -43142,7 +44916,7 @@ var ts; var expression = callExpression.expression; var name = expression.kind === 69 /* Identifier */ ? expression - : expression.kind === 170 /* PropertyAccessExpression */ + : expression.kind === 171 /* PropertyAccessExpression */ ? expression.name : undefined; if (!name || !name.text) { @@ -43175,7 +44949,7 @@ var ts; * in the argument of an invocation; returns undefined otherwise. */ function getImmediatelyContainingArgumentInfo(node) { - if (node.parent.kind === 172 /* CallExpression */ || node.parent.kind === 173 /* NewExpression */) { + if (node.parent.kind === 173 /* CallExpression */ || node.parent.kind === 174 /* NewExpression */) { var callExpression = node.parent; // There are 3 cases to handle: // 1. The token introduces a list, and should begin a sig help session @@ -43228,25 +45002,25 @@ var ts; }; } } - else if (node.kind === 11 /* NoSubstitutionTemplateLiteral */ && node.parent.kind === 174 /* TaggedTemplateExpression */) { + else if (node.kind === 11 /* NoSubstitutionTemplateLiteral */ && node.parent.kind === 175 /* 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); } } - else if (node.kind === 12 /* TemplateHead */ && node.parent.parent.kind === 174 /* TaggedTemplateExpression */) { + else if (node.kind === 12 /* TemplateHead */ && node.parent.parent.kind === 175 /* TaggedTemplateExpression */) { var templateExpression = node.parent; var tagExpression = templateExpression.parent; - ts.Debug.assert(templateExpression.kind === 187 /* TemplateExpression */); + ts.Debug.assert(templateExpression.kind === 188 /* TemplateExpression */); var argumentIndex = ts.isInsideTemplateLiteral(node, position) ? 0 : 1; return getArgumentListInfoForTemplate(tagExpression, argumentIndex); } - else if (node.parent.kind === 194 /* TemplateSpan */ && node.parent.parent.parent.kind === 174 /* TaggedTemplateExpression */) { + else if (node.parent.kind === 196 /* TemplateSpan */ && node.parent.parent.parent.kind === 175 /* TaggedTemplateExpression */) { var templateSpan = node.parent; var templateExpression = templateSpan.parent; var tagExpression = templateExpression.parent; - ts.Debug.assert(templateExpression.kind === 187 /* TemplateExpression */); + ts.Debug.assert(templateExpression.kind === 188 /* TemplateExpression */); // If we're just after a template tail, don't show signature help. if (node.kind === 14 /* TemplateTail */ && !ts.isInsideTemplateLiteral(node, position)) { return undefined; @@ -43364,7 +45138,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 === 187 /* TemplateExpression */) { + if (template.kind === 188 /* TemplateExpression */) { var lastSpan = ts.lastOrUndefined(template.templateSpans); if (lastSpan.literal.getFullWidth() === 0) { applicableSpanEnd = ts.skipTrivia(sourceFile.text, applicableSpanEnd, /*stopAfterLineBreak*/ false); @@ -43373,7 +45147,7 @@ var ts; return ts.createTextSpan(applicableSpanStart, applicableSpanEnd - applicableSpanStart); } function getContainingArgumentInfo(node) { - for (var n = node; n.kind !== 252 /* SourceFile */; n = n.parent) { + for (var n = node; n.kind !== 255 /* SourceFile */; n = n.parent) { if (ts.isFunctionBlock(n)) { return undefined; } @@ -43438,7 +45212,7 @@ var ts; signatureHelpParameters = typeParameters && typeParameters.length > 0 ? ts.map(typeParameters, createSignatureHelpParameterForTypeParameter) : emptyArray; suffixDisplayParts.push(ts.punctuationPart(27 /* GreaterThanToken */)); var parameterParts = ts.mapToDisplayParts(function (writer) { - return typeChecker.getSymbolDisplayBuilder().buildDisplayForParametersAndDelimiters(candidateSignature.parameters, writer, invocation); + return typeChecker.getSymbolDisplayBuilder().buildDisplayForParametersAndDelimiters(candidateSignature.thisType, candidateSignature.parameters, writer, invocation); }); ts.addRange(suffixDisplayParts, parameterParts); } @@ -43511,31 +45285,6 @@ var ts; /* @internal */ var ts; (function (ts) { - function getEndLinePosition(line, sourceFile) { - ts.Debug.assert(line >= 0); - var lineStarts = sourceFile.getLineStarts(); - var lineIndex = line; - if (lineIndex + 1 === lineStarts.length) { - // last line - return EOF - return sourceFile.text.length - 1; - } - else { - // current line start - var start = lineStarts[lineIndex]; - // take the start position of the next line -1 = it should be some line break - var pos = lineStarts[lineIndex + 1] - 1; - ts.Debug.assert(ts.isLineBreak(sourceFile.text.charCodeAt(pos))); - // walk backwards skipping line breaks, stop the the beginning of current line. - // i.e: - // - // $ <- end of line for this position should match the start position - while (start <= pos && ts.isLineBreak(sourceFile.text.charCodeAt(pos))) { - pos--; - } - return pos; - } - } - ts.getEndLinePosition = getEndLinePosition; function getLineStartPositionForPosition(position, sourceFile) { var lineStarts = sourceFile.getLineStarts(); var line = sourceFile.getLineAndCharacterOfPosition(position).line; @@ -43573,40 +45322,40 @@ var ts; return false; } switch (n.kind) { - case 218 /* ClassDeclaration */: - case 219 /* InterfaceDeclaration */: - case 221 /* EnumDeclaration */: - case 169 /* ObjectLiteralExpression */: - case 165 /* ObjectBindingPattern */: - case 157 /* TypeLiteral */: - case 196 /* Block */: - case 223 /* ModuleBlock */: - case 224 /* CaseBlock */: + case 220 /* ClassDeclaration */: + case 221 /* InterfaceDeclaration */: + case 223 /* EnumDeclaration */: + case 170 /* ObjectLiteralExpression */: + case 166 /* ObjectBindingPattern */: + case 158 /* TypeLiteral */: + case 198 /* Block */: + case 225 /* ModuleBlock */: + case 226 /* CaseBlock */: return nodeEndsWith(n, 16 /* CloseBraceToken */, sourceFile); - case 248 /* CatchClause */: + case 251 /* CatchClause */: return isCompletedNode(n.block, sourceFile); - case 173 /* NewExpression */: + case 174 /* NewExpression */: if (!n.arguments) { return true; } // fall through - case 172 /* CallExpression */: - case 176 /* ParenthesizedExpression */: - case 162 /* ParenthesizedType */: + case 173 /* CallExpression */: + case 177 /* ParenthesizedExpression */: + case 163 /* ParenthesizedType */: return nodeEndsWith(n, 18 /* CloseParenToken */, sourceFile); - case 154 /* FunctionType */: - case 155 /* ConstructorType */: + case 155 /* FunctionType */: + case 156 /* ConstructorType */: return isCompletedNode(n.type, sourceFile); - case 146 /* Constructor */: - case 147 /* GetAccessor */: - case 148 /* SetAccessor */: - case 217 /* FunctionDeclaration */: - case 177 /* FunctionExpression */: - case 145 /* MethodDeclaration */: - case 144 /* MethodSignature */: - case 150 /* ConstructSignature */: - case 149 /* CallSignature */: - case 178 /* ArrowFunction */: + case 147 /* Constructor */: + case 148 /* GetAccessor */: + case 149 /* SetAccessor */: + case 219 /* FunctionDeclaration */: + case 178 /* FunctionExpression */: + case 146 /* MethodDeclaration */: + case 145 /* MethodSignature */: + case 151 /* ConstructSignature */: + case 150 /* CallSignature */: + case 179 /* ArrowFunction */: if (n.body) { return isCompletedNode(n.body, sourceFile); } @@ -43616,64 +45365,64 @@ var ts; // 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 222 /* ModuleDeclaration */: + case 224 /* ModuleDeclaration */: return n.body && isCompletedNode(n.body, sourceFile); - case 200 /* IfStatement */: + case 202 /* IfStatement */: if (n.elseStatement) { return isCompletedNode(n.elseStatement, sourceFile); } return isCompletedNode(n.thenStatement, sourceFile); - case 199 /* ExpressionStatement */: + case 201 /* ExpressionStatement */: return isCompletedNode(n.expression, sourceFile) || hasChildOfKind(n, 23 /* SemicolonToken */); - case 168 /* ArrayLiteralExpression */: - case 166 /* ArrayBindingPattern */: - case 171 /* ElementAccessExpression */: - case 138 /* ComputedPropertyName */: - case 159 /* TupleType */: + case 169 /* ArrayLiteralExpression */: + case 167 /* ArrayBindingPattern */: + case 172 /* ElementAccessExpression */: + case 139 /* ComputedPropertyName */: + case 160 /* TupleType */: return nodeEndsWith(n, 20 /* CloseBracketToken */, sourceFile); - case 151 /* IndexSignature */: + case 152 /* IndexSignature */: if (n.type) { return isCompletedNode(n.type, sourceFile); } return hasChildOfKind(n, 20 /* CloseBracketToken */, sourceFile); - case 245 /* CaseClause */: - case 246 /* DefaultClause */: - // there is no such thing as terminator token for CaseClause/DefaultClause so for simplicitly always consider them non-completed + case 248 /* CaseClause */: + case 249 /* DefaultClause */: + // there is no such thing as terminator token for CaseClause/DefaultClause so for simplicity always consider them non-completed return false; - case 203 /* ForStatement */: - case 204 /* ForInStatement */: - case 205 /* ForOfStatement */: - case 202 /* WhileStatement */: + case 205 /* ForStatement */: + case 206 /* ForInStatement */: + case 207 /* ForOfStatement */: + case 204 /* WhileStatement */: return isCompletedNode(n.statement, sourceFile); - case 201 /* DoStatement */: + case 203 /* 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 156 /* TypeQuery */: + case 157 /* TypeQuery */: return isCompletedNode(n.exprName, sourceFile); - case 180 /* TypeOfExpression */: - case 179 /* DeleteExpression */: - case 181 /* VoidExpression */: - case 188 /* YieldExpression */: - case 189 /* SpreadElementExpression */: + case 181 /* TypeOfExpression */: + case 180 /* DeleteExpression */: + case 182 /* VoidExpression */: + case 189 /* YieldExpression */: + case 190 /* SpreadElementExpression */: var unaryWordExpression = n; return isCompletedNode(unaryWordExpression.expression, sourceFile); - case 174 /* TaggedTemplateExpression */: + case 175 /* TaggedTemplateExpression */: return isCompletedNode(n.template, sourceFile); - case 187 /* TemplateExpression */: + case 188 /* TemplateExpression */: var lastSpan = ts.lastOrUndefined(n.templateSpans); return isCompletedNode(lastSpan, sourceFile); - case 194 /* TemplateSpan */: + case 196 /* TemplateSpan */: return ts.nodeIsPresent(n.literal); - case 183 /* PrefixUnaryExpression */: + case 184 /* PrefixUnaryExpression */: return isCompletedNode(n.operand, sourceFile); - case 185 /* BinaryExpression */: + case 186 /* BinaryExpression */: return isCompletedNode(n.right, sourceFile); - case 186 /* ConditionalExpression */: + case 187 /* ConditionalExpression */: return isCompletedNode(n.whenFalse, sourceFile); default: return true; @@ -43729,7 +45478,7 @@ var ts; // for the position of the relevant node (or comma). var syntaxList = ts.forEach(node.parent.getChildren(), function (c) { // find syntax list that covers the span of the node - if (c.kind === 275 /* SyntaxList */ && c.pos <= node.pos && c.end >= node.end) { + if (c.kind === 278 /* SyntaxList */ && c.pos <= node.pos && c.end >= node.end) { return c; } }); @@ -43746,7 +45495,7 @@ var ts; } 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 litera)) + * and (position < end or (position === end && token is keyword or identifier or numeric/string literal)) */ function getTouchingPropertyName(sourceFile, position) { return getTouchingToken(sourceFile, position, function (n) { return isPropertyName(n.kind); }); @@ -43835,7 +45584,7 @@ var ts; function findPrecedingToken(position, sourceFile, startNode) { return find(startNode || sourceFile); function findRightmostToken(n) { - if (isToken(n) || n.kind === 240 /* JsxText */) { + if (isToken(n) || n.kind === 243 /* JsxText */) { return n; } var children = n.getChildren(); @@ -43843,7 +45592,7 @@ var ts; return candidate && findRightmostToken(candidate); } function find(n) { - if (isToken(n) || n.kind === 240 /* JsxText */) { + if (isToken(n) || n.kind === 243 /* JsxText */) { return n; } var children = n.getChildren(); @@ -43857,10 +45606,10 @@ var ts; // 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 === 240 /* JsxText */)) { + if (position < child.end && (nodeHasTokens(child) || child.kind === 243 /* JsxText */)) { var start = child.getStart(sourceFile); var lookInPreviousChild = (start >= position) || - (child.kind === 240 /* JsxText */ && start === child.end); // whitespace only JsxText + (child.kind === 243 /* 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); @@ -43872,7 +45621,7 @@ var ts; } } } - ts.Debug.assert(startNode !== undefined || n.kind === 252 /* SourceFile */); + ts.Debug.assert(startNode !== undefined || n.kind === 255 /* 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. @@ -43894,7 +45643,7 @@ var ts; ts.findPrecedingToken = findPrecedingToken; function isInString(sourceFile, position) { var token = getTokenAtPosition(sourceFile, position); - return token && (token.kind === 9 /* StringLiteral */ || token.kind === 164 /* StringLiteralType */) && position > token.getStart(); + return token && (token.kind === 9 /* StringLiteral */ || token.kind === 165 /* StringLiteralType */) && position > token.getStart(); } ts.isInString = isInString; function isInComment(sourceFile, position) { @@ -43998,17 +45747,17 @@ var ts; } ts.getNodeModifiers = getNodeModifiers; function getTypeArgumentOrTypeParameterList(node) { - if (node.kind === 153 /* TypeReference */ || node.kind === 172 /* CallExpression */) { + if (node.kind === 154 /* TypeReference */ || node.kind === 173 /* CallExpression */) { return node.typeArguments; } - if (ts.isFunctionLike(node) || node.kind === 218 /* ClassDeclaration */ || node.kind === 219 /* InterfaceDeclaration */) { + if (ts.isFunctionLike(node) || node.kind === 220 /* ClassDeclaration */ || node.kind === 221 /* InterfaceDeclaration */) { return node.typeParameters; } return undefined; } ts.getTypeArgumentOrTypeParameterList = getTypeArgumentOrTypeParameterList; function isToken(n) { - return n.kind >= 0 /* FirstToken */ && n.kind <= 136 /* LastToken */; + return n.kind >= 0 /* FirstToken */ && n.kind <= 137 /* LastToken */; } ts.isToken = isToken; function isWord(kind) { @@ -44024,7 +45773,7 @@ var ts; ts.isComment = isComment; function isStringOrRegularExpressionOrTemplateLiteral(kind) { if (kind === 9 /* StringLiteral */ - || kind === 164 /* StringLiteralType */ + || kind === 165 /* StringLiteralType */ || kind === 10 /* RegularExpressionLiteral */ || ts.isTemplateLiteralKind(kind)) { return true; @@ -44068,18 +45817,18 @@ var ts; } ts.compareDataObjects = compareDataObjects; function isArrayLiteralOrObjectLiteralDestructuringPattern(node) { - if (node.kind === 168 /* ArrayLiteralExpression */ || - node.kind === 169 /* ObjectLiteralExpression */) { + if (node.kind === 169 /* ArrayLiteralExpression */ || + node.kind === 170 /* ObjectLiteralExpression */) { // [a,b,c] from: // [a, b, c] = someExpression; - if (node.parent.kind === 185 /* BinaryExpression */ && + if (node.parent.kind === 186 /* 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 === 205 /* ForOfStatement */ && + if (node.parent.kind === 207 /* ForOfStatement */ && node.parent.initializer === node) { return true; } @@ -44087,7 +45836,7 @@ var ts; // [x, [a, b, c] ] = someExpression // or // {x, a: {a, b, c} } = someExpression - if (isArrayLiteralOrObjectLiteralDestructuringPattern(node.parent.kind === 249 /* PropertyAssignment */ ? node.parent.parent : node.parent)) { + if (isArrayLiteralOrObjectLiteralDestructuringPattern(node.parent.kind === 252 /* PropertyAssignment */ ? node.parent.parent : node.parent)) { return true; } } @@ -44100,7 +45849,7 @@ var ts; var ts; (function (ts) { function isFirstDeclarationOfSymbolParameter(symbol) { - return symbol.declarations && symbol.declarations.length > 0 && symbol.declarations[0].kind === 140 /* Parameter */; + return symbol.declarations && symbol.declarations.length > 0 && symbol.declarations[0].kind === 141 /* Parameter */; } ts.isFirstDeclarationOfSymbolParameter = isFirstDeclarationOfSymbolParameter; var displayPartWriter = getDisplayPartWriter(); @@ -44288,7 +46037,7 @@ var ts; ts.getDeclaredName = getDeclaredName; function isImportOrExportSpecifierName(location) { return location.parent && - (location.parent.kind === 230 /* ImportSpecifier */ || location.parent.kind === 234 /* ExportSpecifier */) && + (location.parent.kind === 233 /* ImportSpecifier */ || location.parent.kind === 237 /* ExportSpecifier */) && location.parent.propertyName === location; } ts.isImportOrExportSpecifierName = isImportOrExportSpecifierName; @@ -44308,6 +46057,213 @@ var ts; 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 can be determined from the file name + var scriptKind = ts.getScriptKindFromFileName(fileName); + if (scriptKind === 0 /* Unknown */ && host && host.getScriptKind) { + // Next check to see if the host can resolve the script kind + scriptKind = host.getScriptKind(fileName); + } + return ts.ensureScriptKind(fileName, scriptKind); + } + ts.getScriptKind = getScriptKind; +})(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 = {}; + if (!typingOptions || !typingOptions.enableAutoDiscovery) { + return { cachedTypingPaths: [], newTypingNames: [], filesToWatch: [] }; + } + // 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); }); + if (result.config) { + safeList = result.config; + } + else { + safeList = {}; + } + ; + } + 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_37 in packageNameToTypingLocation) { + if (ts.hasProperty(inferredTypings, name_37) && !inferredTypings[name_37]) { + inferredTypings[name_37] = packageNameToTypingLocation[name_37]; + } + } + // 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 (!ts.hasProperty(inferredTypings, typing)) { + 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.getKeys(jsonConfig.dependencies)); + } + if (jsonConfig.devDependencies) { + mergeTypings(ts.getKeys(jsonConfig.devDependencies)); + } + if (jsonConfig.optionalDependencies) { + mergeTypings(ts.getKeys(jsonConfig.optionalDependencies)); + } + if (jsonConfig.peerDependencies) { + mergeTypings(ts.getKeys(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 ts.hasProperty(safeList, f); })); + } + 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", /*exclude*/ undefined, /*depth*/ 2); + for (var _i = 0, fileNames_1 = fileNames; _i < fileNames_1.length; _i++) { + var fileName = fileNames_1[_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 = {})); /// /// @@ -44411,10 +46367,10 @@ var ts; function shouldRescanJsxIdentifier(node) { if (node.parent) { switch (node.parent.kind) { - case 242 /* JsxAttribute */: - case 239 /* JsxOpeningElement */: - case 241 /* JsxClosingElement */: - case 238 /* JsxSelfClosingElement */: + case 245 /* JsxAttribute */: + case 242 /* JsxOpeningElement */: + case 244 /* JsxClosingElement */: + case 241 /* JsxSelfClosingElement */: return node.kind === 69 /* Identifier */; } } @@ -44455,7 +46411,7 @@ var ts; // readTokenInfo was called before with the same expected scan action. // No need to re-scan text, return existing 'lastTokenInfo' // it is ok to call fixTokenKind here since it does not affect - // what portion of text is consumed. In opposize rescanning can change it, + // what portion of text is consumed. In contrast rescanning can change it, // i.e. for '>=' when originally scanner eats just one character // and rescanning forces it to consume more. return fixTokenKind(lastTokenInfo, n); @@ -45018,9 +46974,9 @@ var ts; } Rules.prototype.getRuleName = function (rule) { var o = this; - for (var name_33 in o) { - if (o[name_33] === rule) { - return name_33; + for (var name_38 in o) { + if (o[name_38] === rule) { + return name_38; } } throw new Error("Unknown rule"); @@ -45029,40 +46985,40 @@ var ts; /// Contexts /// Rules.IsForContext = function (context) { - return context.contextNode.kind === 203 /* ForStatement */; + return context.contextNode.kind === 205 /* ForStatement */; }; Rules.IsNotForContext = function (context) { return !Rules.IsForContext(context); }; Rules.IsBinaryOpContext = function (context) { switch (context.contextNode.kind) { - case 185 /* BinaryExpression */: - case 186 /* ConditionalExpression */: - case 193 /* AsExpression */: - case 152 /* TypePredicate */: - case 160 /* UnionType */: - case 161 /* IntersectionType */: + case 186 /* BinaryExpression */: + case 187 /* ConditionalExpression */: + case 194 /* AsExpression */: + case 153 /* TypePredicate */: + case 161 /* UnionType */: + case 162 /* IntersectionType */: return true; // equals in binding elements: function foo([[x, y] = [1, 2]]) - case 167 /* BindingElement */: + case 168 /* BindingElement */: // equals in type X = ... - case 220 /* TypeAliasDeclaration */: + case 222 /* TypeAliasDeclaration */: // equal in import a = module('a'); - case 225 /* ImportEqualsDeclaration */: + case 228 /* ImportEqualsDeclaration */: // equal in let a = 0; - case 215 /* VariableDeclaration */: + case 217 /* VariableDeclaration */: // equal in p = 0; - case 140 /* Parameter */: - case 251 /* EnumMember */: - case 143 /* PropertyDeclaration */: - case 142 /* PropertySignature */: + case 141 /* Parameter */: + case 254 /* EnumMember */: + case 144 /* PropertyDeclaration */: + case 143 /* PropertySignature */: return context.currentTokenSpan.kind === 56 /* EqualsToken */ || context.nextTokenSpan.kind === 56 /* EqualsToken */; // "in" keyword in for (let x in []) { } - case 204 /* ForInStatement */: + case 206 /* ForInStatement */: return context.currentTokenSpan.kind === 90 /* InKeyword */ || context.nextTokenSpan.kind === 90 /* InKeyword */; // Technically, "of" is not a binary operator, but format it the same way as "in" - case 205 /* ForOfStatement */: - return context.currentTokenSpan.kind === 136 /* OfKeyword */ || context.nextTokenSpan.kind === 136 /* OfKeyword */; + case 207 /* ForOfStatement */: + return context.currentTokenSpan.kind === 137 /* OfKeyword */ || context.nextTokenSpan.kind === 137 /* OfKeyword */; } return false; }; @@ -45070,7 +47026,7 @@ var ts; return !Rules.IsBinaryOpContext(context); }; Rules.IsConditionalOperatorContext = function (context) { - return context.contextNode.kind === 186 /* ConditionalExpression */; + return context.contextNode.kind === 187 /* ConditionalExpression */; }; Rules.IsSameLineTokenOrBeforeMultilineBlockContext = function (context) { //// This check is mainly used inside SpaceBeforeOpenBraceInControl and SpaceBeforeOpenBraceInFunction. @@ -45082,13 +47038,13 @@ var ts; //// Ex: //// if (1) //// { ... } - //// * ) and { are on differnet lines. We only need to format if the block is multiline context. So in this case we don't format. + //// * ) and { are on different lines. We only need to format if the block is multiline context. So in this case we don't format. //// //// Ex: //// if (1) //// { ... //// } - //// * ) and { are on differnet lines. We only need to format if the block is multiline context. So in this case we format. + //// * ) and { are on different lines. We only need to format if the block is multiline context. So in this case we format. return context.TokensAreOnSameLine() || Rules.IsBeforeMultilineBlockContext(context); }; // This check is done before an open brace in a control construct, a function, or a typescript block declaration @@ -45114,93 +47070,93 @@ var ts; return true; } switch (node.kind) { - case 196 /* Block */: - case 224 /* CaseBlock */: - case 169 /* ObjectLiteralExpression */: - case 223 /* ModuleBlock */: + case 198 /* Block */: + case 226 /* CaseBlock */: + case 170 /* ObjectLiteralExpression */: + case 225 /* ModuleBlock */: return true; } return false; }; Rules.IsFunctionDeclContext = function (context) { switch (context.contextNode.kind) { - case 217 /* FunctionDeclaration */: - case 145 /* MethodDeclaration */: - case 144 /* MethodSignature */: + case 219 /* FunctionDeclaration */: + case 146 /* MethodDeclaration */: + case 145 /* MethodSignature */: //case SyntaxKind.MemberFunctionDeclaration: - case 147 /* GetAccessor */: - case 148 /* SetAccessor */: + case 148 /* GetAccessor */: + case 149 /* SetAccessor */: ///case SyntaxKind.MethodSignature: - case 149 /* CallSignature */: - case 177 /* FunctionExpression */: - case 146 /* Constructor */: - case 178 /* ArrowFunction */: + case 150 /* CallSignature */: + case 178 /* FunctionExpression */: + case 147 /* Constructor */: + case 179 /* ArrowFunction */: //case SyntaxKind.ConstructorDeclaration: //case SyntaxKind.SimpleArrowFunctionExpression: //case SyntaxKind.ParenthesizedArrowFunctionExpression: - case 219 /* InterfaceDeclaration */: + case 221 /* InterfaceDeclaration */: return true; } return false; }; Rules.IsFunctionDeclarationOrFunctionExpressionContext = function (context) { - return context.contextNode.kind === 217 /* FunctionDeclaration */ || context.contextNode.kind === 177 /* FunctionExpression */; + return context.contextNode.kind === 219 /* FunctionDeclaration */ || context.contextNode.kind === 178 /* FunctionExpression */; }; Rules.IsTypeScriptDeclWithBlockContext = function (context) { return Rules.NodeIsTypeScriptDeclWithBlockContext(context.contextNode); }; Rules.NodeIsTypeScriptDeclWithBlockContext = function (node) { switch (node.kind) { - case 218 /* ClassDeclaration */: - case 190 /* ClassExpression */: - case 219 /* InterfaceDeclaration */: - case 221 /* EnumDeclaration */: - case 157 /* TypeLiteral */: - case 222 /* ModuleDeclaration */: + case 220 /* ClassDeclaration */: + case 191 /* ClassExpression */: + case 221 /* InterfaceDeclaration */: + case 223 /* EnumDeclaration */: + case 158 /* TypeLiteral */: + case 224 /* ModuleDeclaration */: return true; } return false; }; Rules.IsAfterCodeBlockContext = function (context) { switch (context.currentTokenParent.kind) { - case 218 /* ClassDeclaration */: - case 222 /* ModuleDeclaration */: - case 221 /* EnumDeclaration */: - case 196 /* Block */: - case 248 /* CatchClause */: - case 223 /* ModuleBlock */: - case 210 /* SwitchStatement */: + case 220 /* ClassDeclaration */: + case 224 /* ModuleDeclaration */: + case 223 /* EnumDeclaration */: + case 198 /* Block */: + case 251 /* CatchClause */: + case 225 /* ModuleBlock */: + case 212 /* SwitchStatement */: return true; } return false; }; Rules.IsControlDeclContext = function (context) { switch (context.contextNode.kind) { - case 200 /* IfStatement */: - case 210 /* SwitchStatement */: - case 203 /* ForStatement */: - case 204 /* ForInStatement */: - case 205 /* ForOfStatement */: - case 202 /* WhileStatement */: - case 213 /* TryStatement */: - case 201 /* DoStatement */: - case 209 /* WithStatement */: + case 202 /* IfStatement */: + case 212 /* SwitchStatement */: + case 205 /* ForStatement */: + case 206 /* ForInStatement */: + case 207 /* ForOfStatement */: + case 204 /* WhileStatement */: + case 215 /* TryStatement */: + case 203 /* DoStatement */: + case 211 /* WithStatement */: // TODO // case SyntaxKind.ElseClause: - case 248 /* CatchClause */: + case 251 /* CatchClause */: return true; default: return false; } }; Rules.IsObjectContext = function (context) { - return context.contextNode.kind === 169 /* ObjectLiteralExpression */; + return context.contextNode.kind === 170 /* ObjectLiteralExpression */; }; Rules.IsFunctionCallContext = function (context) { - return context.contextNode.kind === 172 /* CallExpression */; + return context.contextNode.kind === 173 /* CallExpression */; }; Rules.IsNewContext = function (context) { - return context.contextNode.kind === 173 /* NewExpression */; + return context.contextNode.kind === 174 /* NewExpression */; }; Rules.IsFunctionCallOrNewContext = function (context) { return Rules.IsFunctionCallContext(context) || Rules.IsNewContext(context); @@ -45212,10 +47168,10 @@ var ts; return context.nextTokenSpan.kind !== 20 /* CloseBracketToken */; }; Rules.IsArrowFunctionContext = function (context) { - return context.contextNode.kind === 178 /* ArrowFunction */; + return context.contextNode.kind === 179 /* ArrowFunction */; }; Rules.IsNonJsxSameLineTokenContext = function (context) { - return context.TokensAreOnSameLine() && context.contextNode.kind !== 240 /* JsxText */; + return context.TokensAreOnSameLine() && context.contextNode.kind !== 243 /* JsxText */; }; Rules.IsNotBeforeBlockInFunctionDeclarationContext = function (context) { return !Rules.IsFunctionDeclContext(context) && !Rules.IsBeforeBlockContext(context); @@ -45230,41 +47186,41 @@ var ts; while (ts.isExpression(node)) { node = node.parent; } - return node.kind === 141 /* Decorator */; + return node.kind === 142 /* Decorator */; }; Rules.IsStartOfVariableDeclarationList = function (context) { - return context.currentTokenParent.kind === 216 /* VariableDeclarationList */ && + return context.currentTokenParent.kind === 218 /* 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 === 222 /* ModuleDeclaration */; + return context.contextNode.kind === 224 /* ModuleDeclaration */; }; Rules.IsObjectTypeContext = function (context) { - return context.contextNode.kind === 157 /* TypeLiteral */; // && context.contextNode.parent.kind !== SyntaxKind.InterfaceDeclaration; + return context.contextNode.kind === 158 /* TypeLiteral */; // && context.contextNode.parent.kind !== SyntaxKind.InterfaceDeclaration; }; Rules.IsTypeArgumentOrParameterOrAssertion = function (token, parent) { if (token.kind !== 25 /* LessThanToken */ && token.kind !== 27 /* GreaterThanToken */) { return false; } switch (parent.kind) { - case 153 /* TypeReference */: - case 175 /* TypeAssertionExpression */: - case 218 /* ClassDeclaration */: - case 190 /* ClassExpression */: - case 219 /* InterfaceDeclaration */: - case 217 /* FunctionDeclaration */: - case 177 /* FunctionExpression */: - case 178 /* ArrowFunction */: - case 145 /* MethodDeclaration */: - case 144 /* MethodSignature */: - case 149 /* CallSignature */: - case 150 /* ConstructSignature */: - case 172 /* CallExpression */: - case 173 /* NewExpression */: - case 192 /* ExpressionWithTypeArguments */: + case 154 /* TypeReference */: + case 176 /* TypeAssertionExpression */: + case 220 /* ClassDeclaration */: + case 191 /* ClassExpression */: + case 221 /* InterfaceDeclaration */: + case 219 /* FunctionDeclaration */: + case 178 /* FunctionExpression */: + case 179 /* ArrowFunction */: + case 146 /* MethodDeclaration */: + case 145 /* MethodSignature */: + case 150 /* CallSignature */: + case 151 /* ConstructSignature */: + case 173 /* CallExpression */: + case 174 /* NewExpression */: + case 193 /* ExpressionWithTypeArguments */: return true; default: return false; @@ -45275,13 +47231,13 @@ var ts; Rules.IsTypeArgumentOrParameterOrAssertion(context.nextTokenSpan, context.nextTokenParent); }; Rules.IsTypeAssertionContext = function (context) { - return context.contextNode.kind === 175 /* TypeAssertionExpression */; + return context.contextNode.kind === 176 /* TypeAssertionExpression */; }; Rules.IsVoidOpContext = function (context) { - return context.currentTokenSpan.kind === 103 /* VoidKeyword */ && context.currentTokenParent.kind === 181 /* VoidExpression */; + return context.currentTokenSpan.kind === 103 /* VoidKeyword */ && context.currentTokenParent.kind === 182 /* VoidExpression */; }; Rules.IsYieldOrYieldStarWithOperand = function (context) { - return context.contextNode.kind === 188 /* YieldExpression */ && context.contextNode.expression !== undefined; + return context.contextNode.kind === 189 /* YieldExpression */ && context.contextNode.expression !== undefined; }; return Rules; }()); @@ -45305,7 +47261,7 @@ var ts; return result; }; RulesMap.prototype.Initialize = function (rules) { - this.mapRowLength = 136 /* LastToken */ + 1; + this.mapRowLength = 137 /* 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); @@ -45500,7 +47456,7 @@ var ts; } TokenAllAccess.prototype.GetTokens = function () { var result = []; - for (var token = 0 /* FirstToken */; token <= 136 /* LastToken */; token++) { + for (var token = 0 /* FirstToken */; token <= 137 /* LastToken */; token++) { result.push(token); } return result; @@ -45542,9 +47498,9 @@ var ts; }; TokenRange.Any = TokenRange.AllTokens(); TokenRange.AnyIncludingMultilineComments = TokenRange.FromTokens(TokenRange.Any.GetTokens().concat([3 /* MultiLineCommentTrivia */])); - TokenRange.Keywords = TokenRange.FromRange(70 /* FirstKeyword */, 136 /* LastKeyword */); + TokenRange.Keywords = TokenRange.FromRange(70 /* FirstKeyword */, 137 /* LastKeyword */); TokenRange.BinaryOperators = TokenRange.FromRange(25 /* FirstBinaryOperator */, 68 /* LastBinaryOperator */); - TokenRange.BinaryKeywordOperators = TokenRange.FromTokens([90 /* InKeyword */, 91 /* InstanceOfKeyword */, 136 /* OfKeyword */, 116 /* AsKeyword */, 124 /* IsKeyword */]); + TokenRange.BinaryKeywordOperators = TokenRange.FromTokens([90 /* InKeyword */, 91 /* InstanceOfKeyword */, 137 /* 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 */]); @@ -45695,12 +47651,20 @@ var ts; if (line === 0) { return []; } - // get the span for the previous\current line + // After the enter key, the cursor is now at a new line. The new line may or may not contain non-whitespace characters. + // If the new line has only whitespaces, we won't want to format this line, because that would remove the indentation as + // trailing whitespaces. So the end of the formatting span should be the later one between: + // 1. the end of the previous line + // 2. the last non-whitespace character in the current line + var endOfFormatSpan = ts.getEndLinePosition(line, sourceFile); + while (ts.isWhiteSpace(sourceFile.text.charCodeAt(endOfFormatSpan)) && !ts.isLineBreak(sourceFile.text.charCodeAt(endOfFormatSpan))) { + endOfFormatSpan--; + } var span = { // get start position for the previous line pos: ts.getStartPositionOfLine(line - 1, sourceFile), - // get end position for the current line (end value is exclusive so add 1 to the result) - end: ts.getEndLinePosition(line, sourceFile) + 1 + // end value is exclusive so add 1 to the result + end: endOfFormatSpan + 1 }; return formatSpan(span, sourceFile, options, rulesProvider, 2 /* FormatOnEnter */); } @@ -45774,17 +47738,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 218 /* ClassDeclaration */: - case 219 /* InterfaceDeclaration */: + case 220 /* ClassDeclaration */: + case 221 /* InterfaceDeclaration */: return ts.rangeContainsRange(parent.members, node); - case 222 /* ModuleDeclaration */: + case 224 /* ModuleDeclaration */: var body = parent.body; - return body && body.kind === 196 /* Block */ && ts.rangeContainsRange(body.statements, node); - case 252 /* SourceFile */: - case 196 /* Block */: - case 223 /* ModuleBlock */: + return body && body.kind === 198 /* Block */ && ts.rangeContainsRange(body.statements, node); + case 255 /* SourceFile */: + case 198 /* Block */: + case 225 /* ModuleBlock */: return ts.rangeContainsRange(parent.statements, node); - case 248 /* CatchClause */: + case 251 /* CatchClause */: return ts.rangeContainsRange(parent.block.statements, node); } return false; @@ -45858,7 +47822,7 @@ var ts; // no preceding token found - start from the beginning of enclosing node return enclosingNode.pos; } - // preceding token ends after the start of original range (i.e when originaRange.pos falls in the middle of literal) + // preceding token ends after the start of original range (i.e when originalRange.pos falls in the middle of literal) // start from the beginning of enclosingNode to handle the entire 'originalRange' if (precedingToken.end >= originalRange.pos) { return enclosingNode.pos; @@ -45986,19 +47950,19 @@ var ts; return node.modifiers[0].kind; } switch (node.kind) { - case 218 /* ClassDeclaration */: return 73 /* ClassKeyword */; - case 219 /* InterfaceDeclaration */: return 107 /* InterfaceKeyword */; - case 217 /* FunctionDeclaration */: return 87 /* FunctionKeyword */; - case 221 /* EnumDeclaration */: return 221 /* EnumDeclaration */; - case 147 /* GetAccessor */: return 123 /* GetKeyword */; - case 148 /* SetAccessor */: return 130 /* SetKeyword */; - case 145 /* MethodDeclaration */: + case 220 /* ClassDeclaration */: return 73 /* ClassKeyword */; + case 221 /* InterfaceDeclaration */: return 107 /* InterfaceKeyword */; + case 219 /* FunctionDeclaration */: return 87 /* FunctionKeyword */; + case 223 /* EnumDeclaration */: return 223 /* EnumDeclaration */; + case 148 /* GetAccessor */: return 123 /* GetKeyword */; + case 149 /* SetAccessor */: return 130 /* SetKeyword */; + case 146 /* MethodDeclaration */: if (node.asteriskToken) { return 37 /* AsteriskToken */; } // fall-through - case 143 /* PropertyDeclaration */: - case 140 /* Parameter */: + case 144 /* PropertyDeclaration */: + case 141 /* Parameter */: return node.name.kind; } } @@ -46138,7 +48102,7 @@ var ts; consumeTokenAndAdvanceScanner(tokenInfo, node, parentDynamicIndentation, child); return inheritedIndentation; } - var effectiveParentStartLine = child.kind === 141 /* Decorator */ ? childStartLine : undecoratedParentStartLine; + var effectiveParentStartLine = child.kind === 142 /* Decorator */ ? childStartLine : undecoratedParentStartLine; var childIndentation = computeIndentation(child, childStartLine, childIndentationAmount, node, parentDynamicIndentation, effectiveParentStartLine); processNode(child, childContextNode, childStartLine, undecoratedChildStartLine, childIndentation.indentation, childIndentation.delta); childContextNode = node; @@ -46171,8 +48135,8 @@ var ts; } } var inheritedIndentation = -1 /* Unknown */; - for (var _i = 0, nodes_6 = nodes; _i < nodes_6.length; _i++) { - var child = nodes_6[_i]; + for (var _i = 0, nodes_7 = nodes; _i < nodes_7.length; _i++) { + var child = nodes_7[_i]; inheritedIndentation = processChildNode(child, inheritedIndentation, node, listDynamicIndentation, startLine, startLine, /*isListElement*/ true); } if (listEndToken !== 0 /* Unknown */) { @@ -46482,20 +48446,20 @@ var ts; } function isSomeBlock(kind) { switch (kind) { - case 196 /* Block */: - case 223 /* ModuleBlock */: + case 198 /* Block */: + case 225 /* ModuleBlock */: return true; } return false; } function getOpenTokenForList(node, list) { switch (node.kind) { - case 146 /* Constructor */: - case 217 /* FunctionDeclaration */: - case 177 /* FunctionExpression */: - case 145 /* MethodDeclaration */: - case 144 /* MethodSignature */: - case 178 /* ArrowFunction */: + case 147 /* Constructor */: + case 219 /* FunctionDeclaration */: + case 178 /* FunctionExpression */: + case 146 /* MethodDeclaration */: + case 145 /* MethodSignature */: + case 179 /* ArrowFunction */: if (node.typeParameters === list) { return 25 /* LessThanToken */; } @@ -46503,8 +48467,8 @@ var ts; return 17 /* OpenParenToken */; } break; - case 172 /* CallExpression */: - case 173 /* NewExpression */: + case 173 /* CallExpression */: + case 174 /* NewExpression */: if (node.typeArguments === list) { return 25 /* LessThanToken */; } @@ -46512,7 +48476,7 @@ var ts; return 17 /* OpenParenToken */; } break; - case 153 /* TypeReference */: + case 154 /* TypeReference */: if (node.typeArguments === list) { return 25 /* LessThanToken */; } @@ -46628,7 +48592,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 !== 185 /* BinaryExpression */) { + if (precedingToken.kind === 24 /* CommaToken */ && precedingToken.parent.kind !== 186 /* 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 */) { @@ -46747,7 +48711,7 @@ var ts; // - 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 === 252 /* SourceFile */ || !parentAndChildShareLine); + (parent.kind === 255 /* SourceFile */ || !parentAndChildShareLine); if (!useActualIndentation) { return -1 /* Unknown */; } @@ -46780,7 +48744,7 @@ var ts; return sourceFile.getLineAndCharacterOfPosition(n.getStart(sourceFile)); } function childStartsOnTheSameLineWithElseInIfStatement(parent, child, childStartLine, sourceFile) { - if (parent.kind === 200 /* IfStatement */ && parent.elseStatement === child) { + if (parent.kind === 202 /* IfStatement */ && parent.elseStatement === child) { var elseKeyword = ts.findChildOfKind(parent, 80 /* ElseKeyword */, sourceFile); ts.Debug.assert(elseKeyword !== undefined); var elseKeywordStartLine = getStartLineAndCharacterForNode(elseKeyword, sourceFile).line; @@ -46792,23 +48756,23 @@ var ts; function getContainingList(node, sourceFile) { if (node.parent) { switch (node.parent.kind) { - case 153 /* TypeReference */: + case 154 /* TypeReference */: if (node.parent.typeArguments && ts.rangeContainsStartEnd(node.parent.typeArguments, node.getStart(sourceFile), node.getEnd())) { return node.parent.typeArguments; } break; - case 169 /* ObjectLiteralExpression */: + case 170 /* ObjectLiteralExpression */: return node.parent.properties; - case 168 /* ArrayLiteralExpression */: + case 169 /* ArrayLiteralExpression */: return node.parent.elements; - case 217 /* FunctionDeclaration */: - case 177 /* FunctionExpression */: - case 178 /* ArrowFunction */: - case 145 /* MethodDeclaration */: - case 144 /* MethodSignature */: - case 149 /* CallSignature */: - case 150 /* ConstructSignature */: { + case 219 /* FunctionDeclaration */: + case 178 /* FunctionExpression */: + case 179 /* ArrowFunction */: + case 146 /* MethodDeclaration */: + case 145 /* MethodSignature */: + case 150 /* CallSignature */: + case 151 /* ConstructSignature */: { var start = node.getStart(sourceFile); if (node.parent.typeParameters && ts.rangeContainsStartEnd(node.parent.typeParameters, start, node.getEnd())) { @@ -46819,8 +48783,8 @@ var ts; } break; } - case 173 /* NewExpression */: - case 172 /* CallExpression */: { + case 174 /* NewExpression */: + case 173 /* CallExpression */: { var start = node.getStart(sourceFile); if (node.parent.typeArguments && ts.rangeContainsStartEnd(node.parent.typeArguments, start, node.getEnd())) { @@ -46850,8 +48814,8 @@ var ts; if (node.kind === 18 /* CloseParenToken */) { return -1 /* Unknown */; } - if (node.parent && (node.parent.kind === 172 /* CallExpression */ || - node.parent.kind === 173 /* NewExpression */) && + if (node.parent && (node.parent.kind === 173 /* CallExpression */ || + node.parent.kind === 174 /* NewExpression */) && node.parent.expression !== node) { var fullCallOrNewExpression = node.parent.expression; var startingExpression = getStartingExpression(fullCallOrNewExpression); @@ -46869,10 +48833,10 @@ var ts; function getStartingExpression(node) { while (true) { switch (node.kind) { - case 172 /* CallExpression */: - case 173 /* NewExpression */: - case 170 /* PropertyAccessExpression */: - case 171 /* ElementAccessExpression */: + case 173 /* CallExpression */: + case 174 /* NewExpression */: + case 171 /* PropertyAccessExpression */: + case 172 /* ElementAccessExpression */: node = node.expression; break; default: @@ -46936,45 +48900,45 @@ var ts; SmartIndenter.findFirstNonWhitespaceColumn = findFirstNonWhitespaceColumn; function nodeContentIsAlwaysIndented(kind) { switch (kind) { - case 199 /* ExpressionStatement */: - case 218 /* ClassDeclaration */: - case 190 /* ClassExpression */: - case 219 /* InterfaceDeclaration */: - case 221 /* EnumDeclaration */: - case 220 /* TypeAliasDeclaration */: - case 168 /* ArrayLiteralExpression */: - case 196 /* Block */: - case 223 /* ModuleBlock */: - case 169 /* ObjectLiteralExpression */: - case 157 /* TypeLiteral */: - case 159 /* TupleType */: - case 224 /* CaseBlock */: - case 246 /* DefaultClause */: - case 245 /* CaseClause */: - case 176 /* ParenthesizedExpression */: - case 170 /* PropertyAccessExpression */: - case 172 /* CallExpression */: - case 173 /* NewExpression */: - case 197 /* VariableStatement */: - case 215 /* VariableDeclaration */: - case 231 /* ExportAssignment */: - case 208 /* ReturnStatement */: - case 186 /* ConditionalExpression */: - case 166 /* ArrayBindingPattern */: - case 165 /* ObjectBindingPattern */: - case 239 /* JsxOpeningElement */: - case 238 /* JsxSelfClosingElement */: - case 244 /* JsxExpression */: - case 144 /* MethodSignature */: - case 149 /* CallSignature */: - case 150 /* ConstructSignature */: - case 140 /* Parameter */: - case 154 /* FunctionType */: - case 155 /* ConstructorType */: - case 162 /* ParenthesizedType */: - case 174 /* TaggedTemplateExpression */: - case 182 /* AwaitExpression */: - case 229 /* NamedImports */: + case 201 /* ExpressionStatement */: + case 220 /* ClassDeclaration */: + case 191 /* ClassExpression */: + case 221 /* InterfaceDeclaration */: + case 223 /* EnumDeclaration */: + case 222 /* TypeAliasDeclaration */: + case 169 /* ArrayLiteralExpression */: + case 198 /* Block */: + case 225 /* ModuleBlock */: + case 170 /* ObjectLiteralExpression */: + case 158 /* TypeLiteral */: + case 160 /* TupleType */: + case 226 /* CaseBlock */: + case 249 /* DefaultClause */: + case 248 /* CaseClause */: + case 177 /* ParenthesizedExpression */: + case 171 /* PropertyAccessExpression */: + case 173 /* CallExpression */: + case 174 /* NewExpression */: + case 199 /* VariableStatement */: + case 217 /* VariableDeclaration */: + case 234 /* ExportAssignment */: + case 210 /* ReturnStatement */: + case 187 /* ConditionalExpression */: + case 167 /* ArrayBindingPattern */: + case 166 /* ObjectBindingPattern */: + case 242 /* JsxOpeningElement */: + case 241 /* JsxSelfClosingElement */: + case 247 /* JsxExpression */: + case 145 /* MethodSignature */: + case 150 /* CallSignature */: + case 151 /* ConstructSignature */: + case 141 /* Parameter */: + case 155 /* FunctionType */: + case 156 /* ConstructorType */: + case 163 /* ParenthesizedType */: + case 175 /* TaggedTemplateExpression */: + case 183 /* AwaitExpression */: + case 232 /* NamedImports */: return true; } return false; @@ -46983,22 +48947,22 @@ var ts; function nodeWillIndentChild(parent, child, indentByDefault) { var childKind = child ? child.kind : 0 /* Unknown */; switch (parent.kind) { - case 201 /* DoStatement */: - case 202 /* WhileStatement */: - case 204 /* ForInStatement */: - case 205 /* ForOfStatement */: - case 203 /* ForStatement */: - case 200 /* IfStatement */: - case 217 /* FunctionDeclaration */: - case 177 /* FunctionExpression */: - case 145 /* MethodDeclaration */: - case 178 /* ArrowFunction */: - case 146 /* Constructor */: - case 147 /* GetAccessor */: - case 148 /* SetAccessor */: - return childKind !== 196 /* Block */; - case 237 /* JsxElement */: - return childKind !== 241 /* JsxClosingElement */; + case 203 /* DoStatement */: + case 204 /* WhileStatement */: + case 206 /* ForInStatement */: + case 207 /* ForOfStatement */: + case 205 /* ForStatement */: + case 202 /* IfStatement */: + case 219 /* FunctionDeclaration */: + case 178 /* FunctionExpression */: + case 146 /* MethodDeclaration */: + case 179 /* ArrowFunction */: + case 147 /* Constructor */: + case 148 /* GetAccessor */: + case 149 /* SetAccessor */: + return childKind !== 198 /* Block */; + case 240 /* JsxElement */: + return childKind !== 244 /* JsxClosingElement */; } // No explicit rule for given nodes so the result will follow the default value argument return indentByDefault; @@ -47022,6 +48986,7 @@ var ts; /// /// /// +/// /// /// var ts; @@ -47145,11 +49110,11 @@ var ts; return pos; }; NodeObject.prototype.createSyntaxList = function (nodes) { - var list = createNode(275 /* SyntaxList */, nodes.pos, nodes.end, 0, this); + var list = createNode(278 /* SyntaxList */, nodes.pos, nodes.end, 0, this); list._children = []; var pos = nodes.pos; - for (var _i = 0, nodes_7 = nodes; _i < nodes_7.length; _i++) { - var node = nodes_7[_i]; + for (var _i = 0, nodes_8 = nodes; _i < nodes_8.length; _i++) { + var node = nodes_8[_i]; if (pos < node.pos) { pos = this.addSyntheticNodes(list._children, pos, node.pos); } @@ -47164,7 +49129,7 @@ var ts; NodeObject.prototype.createChildren = function (sourceFile) { var _this = this; var children; - if (this.kind >= 137 /* FirstNode */) { + if (this.kind >= 138 /* FirstNode */) { scanner.setText((sourceFile || this.getSourceFile()).text); children = []; var pos_3 = this.pos; @@ -47211,7 +49176,7 @@ var ts; return undefined; } var child = children[0]; - return child.kind < 137 /* FirstNode */ ? child : child.getFirstToken(sourceFile); + return child.kind < 138 /* FirstNode */ ? child : child.getFirstToken(sourceFile); }; NodeObject.prototype.getLastToken = function (sourceFile) { var children = this.getChildren(sourceFile); @@ -47219,7 +49184,7 @@ var ts; if (!child) { return undefined; } - return child.kind < 137 /* FirstNode */ ? child : child.getLastToken(sourceFile); + return child.kind < 138 /* FirstNode */ ? child : child.getLastToken(sourceFile); }; return NodeObject; }()); @@ -47268,7 +49233,7 @@ var ts; if (ts.indexOf(declarations, declaration) === indexOfDeclaration) { var sourceFileOfDeclaration_1 = 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 === 140 /* Parameter */) { + if (canUseParsedParamTagComments && declaration.kind === 141 /* Parameter */) { ts.forEach(getJsDocCommentTextRange(declaration.parent, sourceFileOfDeclaration_1), function (jsDocCommentTextRange) { var cleanedParamJsDocComment = getCleanedParamJsDocComment(jsDocCommentTextRange.pos, jsDocCommentTextRange.end, sourceFileOfDeclaration_1); if (cleanedParamJsDocComment) { @@ -47277,15 +49242,15 @@ var ts; }); } // If this is left side of dotted module declaration, there is no doc comments associated with this node - if (declaration.kind === 222 /* ModuleDeclaration */ && declaration.body.kind === 222 /* ModuleDeclaration */) { + if (declaration.kind === 224 /* ModuleDeclaration */ && declaration.body.kind === 224 /* ModuleDeclaration */) { return; } // If this is dotted module name, get the doc comments from the parent - while (declaration.kind === 222 /* ModuleDeclaration */ && declaration.parent.kind === 222 /* ModuleDeclaration */) { + while (declaration.kind === 224 /* ModuleDeclaration */ && declaration.parent.kind === 224 /* ModuleDeclaration */) { declaration = declaration.parent; } // Get the cleaned js doc comment text from the declaration - ts.forEach(getJsDocCommentTextRange(declaration.kind === 215 /* VariableDeclaration */ ? declaration.parent.parent : declaration, sourceFileOfDeclaration_1), function (jsDocCommentTextRange) { + ts.forEach(getJsDocCommentTextRange(declaration.kind === 217 /* VariableDeclaration */ ? declaration.parent.parent : declaration, sourceFileOfDeclaration_1), function (jsDocCommentTextRange) { var cleanedJsDocComment = getCleanedJsDocComment(jsDocCommentTextRange.pos, jsDocCommentTextRange.end, sourceFileOfDeclaration_1); if (cleanedJsDocComment) { ts.addRange(jsDocCommentParts, cleanedJsDocComment); @@ -47630,9 +49595,9 @@ var ts; if (result_2 !== undefined) { return result_2; } - if (declaration.name.kind === 138 /* ComputedPropertyName */) { + if (declaration.name.kind === 139 /* ComputedPropertyName */) { var expr = declaration.name.expression; - if (expr.kind === 170 /* PropertyAccessExpression */) { + if (expr.kind === 171 /* PropertyAccessExpression */) { return expr.name.text; } return getTextOfIdentifierOrLiteral(expr); @@ -47652,9 +49617,9 @@ var ts; } function visit(node) { switch (node.kind) { - case 217 /* FunctionDeclaration */: - case 145 /* MethodDeclaration */: - case 144 /* MethodSignature */: + case 219 /* FunctionDeclaration */: + case 146 /* MethodDeclaration */: + case 145 /* MethodSignature */: var functionDeclaration = node; var declarationName = getDeclarationName(functionDeclaration); if (declarationName) { @@ -47674,60 +49639,60 @@ var ts; ts.forEachChild(node, visit); } break; - case 218 /* ClassDeclaration */: - case 219 /* InterfaceDeclaration */: - case 220 /* TypeAliasDeclaration */: - case 221 /* EnumDeclaration */: - case 222 /* ModuleDeclaration */: - case 225 /* ImportEqualsDeclaration */: - case 234 /* ExportSpecifier */: - case 230 /* ImportSpecifier */: - case 225 /* ImportEqualsDeclaration */: - case 227 /* ImportClause */: - case 228 /* NamespaceImport */: - case 147 /* GetAccessor */: - case 148 /* SetAccessor */: - case 157 /* TypeLiteral */: + case 220 /* ClassDeclaration */: + case 221 /* InterfaceDeclaration */: + case 222 /* TypeAliasDeclaration */: + case 223 /* EnumDeclaration */: + case 224 /* ModuleDeclaration */: + case 228 /* ImportEqualsDeclaration */: + case 237 /* ExportSpecifier */: + case 233 /* ImportSpecifier */: + case 228 /* ImportEqualsDeclaration */: + case 230 /* ImportClause */: + case 231 /* NamespaceImport */: + case 148 /* GetAccessor */: + case 149 /* SetAccessor */: + case 158 /* TypeLiteral */: addDeclaration(node); // fall through - case 146 /* Constructor */: - case 197 /* VariableStatement */: - case 216 /* VariableDeclarationList */: - case 165 /* ObjectBindingPattern */: - case 166 /* ArrayBindingPattern */: - case 223 /* ModuleBlock */: + case 147 /* Constructor */: + case 199 /* VariableStatement */: + case 218 /* VariableDeclarationList */: + case 166 /* ObjectBindingPattern */: + case 167 /* ArrayBindingPattern */: + case 225 /* ModuleBlock */: ts.forEachChild(node, visit); break; - case 196 /* Block */: + case 198 /* Block */: if (ts.isFunctionBlock(node)) { ts.forEachChild(node, visit); } break; - case 140 /* Parameter */: + case 141 /* Parameter */: // Only consider properties defined as constructor parameters if (!(node.flags & 28 /* AccessibilityModifier */)) { break; } // fall through - case 215 /* VariableDeclaration */: - case 167 /* BindingElement */: + case 217 /* VariableDeclaration */: + case 168 /* BindingElement */: if (ts.isBindingPattern(node.name)) { ts.forEachChild(node.name, visit); break; } - case 251 /* EnumMember */: - case 143 /* PropertyDeclaration */: - case 142 /* PropertySignature */: + case 254 /* EnumMember */: + case 144 /* PropertyDeclaration */: + case 143 /* PropertySignature */: addDeclaration(node); break; - case 232 /* ExportDeclaration */: + case 235 /* 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 226 /* ImportDeclaration */: + case 229 /* ImportDeclaration */: var importClause = node.importClause; if (importClause) { // Handle default import case e.g.: @@ -47739,7 +49704,7 @@ var ts; // import * as NS from "mod"; // import {a, b as B} from "mod"; if (importClause.namedBindings) { - if (importClause.namedBindings.kind === 228 /* NamespaceImport */) { + if (importClause.namedBindings.kind === 231 /* NamespaceImport */) { addDeclaration(importClause.namedBindings); } else { @@ -47961,16 +49926,16 @@ var ts; } return ts.forEach(symbol.declarations, function (declaration) { // Function expressions are local - if (declaration.kind === 177 /* FunctionExpression */) { + if (declaration.kind === 178 /* FunctionExpression */) { return true; } - if (declaration.kind !== 215 /* VariableDeclaration */ && declaration.kind !== 217 /* FunctionDeclaration */) { + if (declaration.kind !== 217 /* VariableDeclaration */ && declaration.kind !== 219 /* FunctionDeclaration */) { return false; } // If the parent is not sourceFile or module block it is local variable - for (var parent_10 = declaration.parent; !ts.isFunctionBlock(parent_10); parent_10 = parent_10.parent) { + for (var parent_12 = declaration.parent; !ts.isFunctionBlock(parent_12); parent_12 = parent_12.parent) { // Reached source file or module block - if (parent_10.kind === 252 /* SourceFile */ || parent_10.kind === 223 /* ModuleBlock */) { + if (parent_12.kind === 255 /* SourceFile */ || parent_12.kind === 225 /* ModuleBlock */) { return false; } } @@ -48010,14 +49975,13 @@ var ts; }; HostCache.prototype.createEntry = function (fileName, path) { var entry; - var scriptKind = this.host.getScriptKind ? this.host.getScriptKind(fileName) : 0 /* Unknown */; var scriptSnapshot = this.host.getScriptSnapshot(fileName); if (scriptSnapshot) { entry = { hostFileName: fileName, version: this.host.getScriptVersion(fileName), scriptSnapshot: scriptSnapshot, - scriptKind: scriptKind ? scriptKind : ts.getScriptKindFromFileName(fileName) + scriptKind: ts.getScriptKind(fileName, this.host) }; } this.fileNameToEntry.set(path, entry); @@ -48065,7 +50029,7 @@ var ts; // The host does not know about this file. throw new Error("Could not find file: '" + fileName + "'."); } - var scriptKind = this.host.getScriptKind ? this.host.getScriptKind(fileName) : 0 /* Unknown */; + var scriptKind = ts.getScriptKind(fileName, this.host); var version = this.host.getScriptVersion(fileName); var sourceFile; if (this.currentFileName !== fileName) { @@ -48326,9 +50290,24 @@ var ts; 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) { @@ -48338,25 +50317,37 @@ var ts; isNoDefaultLib = referencePathMatchResult.isNoDefaultLib; var fileReference = referencePathMatchResult.fileReference; if (fileReference) { - referencedFiles.push(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(scanner.getTokenValue()); + ambientExternalModules.push({ ref: getFileReference(), depth: braceNesting }); } function recordModuleName() { - var importPath = scanner.getTokenValue(); - var pos = scanner.getTokenPos(); - importedFiles.push({ - fileName: importPath, - pos: pos, - end: pos + importPath.length - }); + importedFiles.push(getFileReference()); + markAsExternalModuleIfTopLevel(); + } + function markAsExternalModuleIfTopLevel() { + if (braceNesting === 0) { + externalModule = true; + } } /** * Returns true if at least one token was consumed from the stream @@ -48365,9 +50356,9 @@ var ts; var token = scanner.getToken(); if (token === 122 /* DeclareKeyword */) { // declare module "mod" - token = scanner.scan(); + token = nextToken(); if (token === 125 /* ModuleKeyword */) { - token = scanner.scan(); + token = nextToken(); if (token === 9 /* StringLiteral */) { recordAmbientExternalModule(); } @@ -48382,7 +50373,7 @@ var ts; function tryConsumeImport() { var token = scanner.getToken(); if (token === 89 /* ImportKeyword */) { - token = scanner.scan(); + token = nextToken(); if (token === 9 /* StringLiteral */) { // import "mod"; recordModuleName(); @@ -48390,9 +50381,9 @@ var ts; } else { if (token === 69 /* Identifier */ || ts.isKeyword(token)) { - token = scanner.scan(); - if (token === 134 /* FromKeyword */) { - token = scanner.scan(); + token = nextToken(); + if (token === 135 /* FromKeyword */) { + token = nextToken(); if (token === 9 /* StringLiteral */) { // import d from "mod"; recordModuleName(); @@ -48406,7 +50397,7 @@ var ts; } else if (token === 24 /* CommaToken */) { // consume comma and keep going - token = scanner.scan(); + token = nextToken(); } else { // unknown syntax @@ -48414,16 +50405,16 @@ var ts; } } if (token === 15 /* OpenBraceToken */) { - token = scanner.scan(); + 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 = scanner.scan(); + token = nextToken(); } if (token === 16 /* CloseBraceToken */) { - token = scanner.scan(); - if (token === 134 /* FromKeyword */) { - token = scanner.scan(); + token = nextToken(); + if (token === 135 /* FromKeyword */) { + token = nextToken(); if (token === 9 /* StringLiteral */) { // import {a as A} from "mod"; // import d, {a, b as B} from "mod" @@ -48433,13 +50424,13 @@ var ts; } } else if (token === 37 /* AsteriskToken */) { - token = scanner.scan(); + token = nextToken(); if (token === 116 /* AsKeyword */) { - token = scanner.scan(); + token = nextToken(); if (token === 69 /* Identifier */ || ts.isKeyword(token)) { - token = scanner.scan(); - if (token === 134 /* FromKeyword */) { - token = scanner.scan(); + token = nextToken(); + if (token === 135 /* FromKeyword */) { + token = nextToken(); if (token === 9 /* StringLiteral */) { // import * as NS from "mod" // import d, * as NS from "mod" @@ -48457,18 +50448,19 @@ var ts; function tryConsumeExport() { var token = scanner.getToken(); if (token === 82 /* ExportKeyword */) { - token = scanner.scan(); + markAsExternalModuleIfTopLevel(); + token = nextToken(); if (token === 15 /* OpenBraceToken */) { - token = scanner.scan(); + 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 = scanner.scan(); + token = nextToken(); } if (token === 16 /* CloseBraceToken */) { - token = scanner.scan(); - if (token === 134 /* FromKeyword */) { - token = scanner.scan(); + token = nextToken(); + if (token === 135 /* FromKeyword */) { + token = nextToken(); if (token === 9 /* StringLiteral */) { // export {a as A} from "mod"; // export {a, b as B} from "mod" @@ -48478,9 +50470,9 @@ var ts; } } else if (token === 37 /* AsteriskToken */) { - token = scanner.scan(); - if (token === 134 /* FromKeyword */) { - token = scanner.scan(); + token = nextToken(); + if (token === 135 /* FromKeyword */) { + token = nextToken(); if (token === 9 /* StringLiteral */) { // export * from "mod" recordModuleName(); @@ -48488,9 +50480,9 @@ var ts; } } else if (token === 89 /* ImportKeyword */) { - token = scanner.scan(); + token = nextToken(); if (token === 69 /* Identifier */ || ts.isKeyword(token)) { - token = scanner.scan(); + token = nextToken(); if (token === 56 /* EqualsToken */) { if (tryConsumeRequireCall(/*skipCurrentToken*/ true)) { return true; @@ -48503,11 +50495,11 @@ var ts; return false; } function tryConsumeRequireCall(skipCurrentToken) { - var token = skipCurrentToken ? scanner.scan() : scanner.getToken(); + var token = skipCurrentToken ? nextToken() : scanner.getToken(); if (token === 128 /* RequireKeyword */) { - token = scanner.scan(); + token = nextToken(); if (token === 17 /* OpenParenToken */) { - token = scanner.scan(); + token = nextToken(); if (token === 9 /* StringLiteral */) { // require("mod"); recordModuleName(); @@ -48520,16 +50512,16 @@ var ts; function tryConsumeDefine() { var token = scanner.getToken(); if (token === 69 /* Identifier */ && scanner.getTokenValue() === "define") { - token = scanner.scan(); + token = nextToken(); if (token !== 17 /* OpenParenToken */) { return true; } - token = scanner.scan(); + token = nextToken(); if (token === 9 /* StringLiteral */) { // looks like define ("modname", ... - skip string literal and comma - token = scanner.scan(); + token = nextToken(); if (token === 24 /* CommaToken */) { - token = scanner.scan(); + token = nextToken(); } else { // unexpected token @@ -48541,7 +50533,7 @@ var ts; return true; } // skip open bracket - token = scanner.scan(); + token = nextToken(); var i = 0; // scan until ']' or EOF while (token !== 20 /* CloseBracketToken */ && token !== 1 /* EndOfFileToken */) { @@ -48550,7 +50542,7 @@ var ts; recordModuleName(); i++; } - token = scanner.scan(); + token = nextToken(); } return true; } @@ -48558,7 +50550,7 @@ var ts; } function processImports() { scanner.setText(sourceText); - scanner.scan(); + nextToken(); // Look for: // import "mod"; // import d from "mod" @@ -48583,7 +50575,7 @@ var ts; continue; } else { - scanner.scan(); + nextToken(); } } scanner.setText(undefined); @@ -48592,13 +50584,42 @@ var ts; processImports(); } processTripleSlashDirectives(); - return { referencedFiles: referencedFiles, importedFiles: importedFiles, isLibFile: isNoDefaultLib, ambientExternalModules: ambientExternalModules }; + 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 === 211 /* LabeledStatement */ && referenceNode.label.text === labelName) { + if (referenceNode.kind === 213 /* LabeledStatement */ && referenceNode.label.text === labelName) { return referenceNode.label; } referenceNode = referenceNode.parent; @@ -48607,12 +50628,12 @@ var ts; } function isJumpStatementTarget(node) { return node.kind === 69 /* Identifier */ && - (node.parent.kind === 207 /* BreakStatement */ || node.parent.kind === 206 /* ContinueStatement */) && + (node.parent.kind === 209 /* BreakStatement */ || node.parent.kind === 208 /* ContinueStatement */) && node.parent.label === node; } function isLabelOfLabeledStatement(node) { return node.kind === 69 /* Identifier */ && - node.parent.kind === 211 /* LabeledStatement */ && + node.parent.kind === 213 /* LabeledStatement */ && node.parent.label === node; } /** @@ -48620,7 +50641,7 @@ var ts; * Note: 'node' cannot be a SourceFile. */ function isLabeledBy(node, labelName) { - for (var owner = node.parent; owner.kind === 211 /* LabeledStatement */; owner = owner.parent) { + for (var owner = node.parent; owner.kind === 213 /* LabeledStatement */; owner = owner.parent) { if (owner.label.text === labelName) { return true; } @@ -48631,25 +50652,25 @@ var ts; return isLabelOfLabeledStatement(node) || isJumpStatementTarget(node); } function isRightSideOfQualifiedName(node) { - return node.parent.kind === 137 /* QualifiedName */ && node.parent.right === node; + return node.parent.kind === 138 /* QualifiedName */ && node.parent.right === node; } function isRightSideOfPropertyAccess(node) { - return node && node.parent && node.parent.kind === 170 /* PropertyAccessExpression */ && node.parent.name === node; + return node && node.parent && node.parent.kind === 171 /* PropertyAccessExpression */ && node.parent.name === node; } function isCallExpressionTarget(node) { if (isRightSideOfPropertyAccess(node)) { node = node.parent; } - return node && node.parent && node.parent.kind === 172 /* CallExpression */ && node.parent.expression === node; + return node && node.parent && node.parent.kind === 173 /* CallExpression */ && node.parent.expression === node; } function isNewExpressionTarget(node) { if (isRightSideOfPropertyAccess(node)) { node = node.parent; } - return node && node.parent && node.parent.kind === 173 /* NewExpression */ && node.parent.expression === node; + return node && node.parent && node.parent.kind === 174 /* NewExpression */ && node.parent.expression === node; } function isNameOfModuleDeclaration(node) { - return node.parent.kind === 222 /* ModuleDeclaration */ && node.parent.name === node; + return node.parent.kind === 224 /* ModuleDeclaration */ && node.parent.name === node; } function isNameOfFunctionDeclaration(node) { return node.kind === 69 /* Identifier */ && @@ -48658,22 +50679,22 @@ var ts; /** Returns true if node is a name of an object literal property, e.g. "a" in x = { "a": 1 } */ function isNameOfPropertyAssignment(node) { return (node.kind === 69 /* Identifier */ || node.kind === 9 /* StringLiteral */ || node.kind === 8 /* NumericLiteral */) && - (node.parent.kind === 249 /* PropertyAssignment */ || node.parent.kind === 250 /* ShorthandPropertyAssignment */) && node.parent.name === node; + (node.parent.kind === 252 /* PropertyAssignment */ || node.parent.kind === 253 /* ShorthandPropertyAssignment */) && node.parent.name === node; } function isLiteralNameOfPropertyDeclarationOrIndexAccess(node) { if (node.kind === 9 /* StringLiteral */ || node.kind === 8 /* NumericLiteral */) { switch (node.parent.kind) { - case 143 /* PropertyDeclaration */: - case 142 /* PropertySignature */: - case 249 /* PropertyAssignment */: - case 251 /* EnumMember */: - case 145 /* MethodDeclaration */: - case 144 /* MethodSignature */: - case 147 /* GetAccessor */: - case 148 /* SetAccessor */: - case 222 /* ModuleDeclaration */: + case 144 /* PropertyDeclaration */: + case 143 /* PropertySignature */: + case 252 /* PropertyAssignment */: + case 254 /* EnumMember */: + case 146 /* MethodDeclaration */: + case 145 /* MethodSignature */: + case 148 /* GetAccessor */: + case 149 /* SetAccessor */: + case 224 /* ModuleDeclaration */: return node.parent.name === node; - case 171 /* ElementAccessExpression */: + case 172 /* ElementAccessExpression */: return node.parent.argumentExpression === node; } } @@ -48732,7 +50753,7 @@ var ts; })(BreakContinueSearchType || (BreakContinueSearchType = {})); // A cache of completion entries for keywords, these do not change between sessions var keywordCompletions = []; - for (var i = 70 /* FirstKeyword */; i <= 136 /* LastKeyword */; i++) { + for (var i = 70 /* FirstKeyword */; i <= 137 /* LastKeyword */; i++) { keywordCompletions.push({ name: ts.tokenToString(i), kind: ScriptElementKind.keyword, @@ -48747,17 +50768,17 @@ var ts; return undefined; } switch (node.kind) { - case 252 /* SourceFile */: - case 145 /* MethodDeclaration */: - case 144 /* MethodSignature */: - case 217 /* FunctionDeclaration */: - case 177 /* FunctionExpression */: - case 147 /* GetAccessor */: - case 148 /* SetAccessor */: - case 218 /* ClassDeclaration */: - case 219 /* InterfaceDeclaration */: - case 221 /* EnumDeclaration */: - case 222 /* ModuleDeclaration */: + case 255 /* SourceFile */: + case 146 /* MethodDeclaration */: + case 145 /* MethodSignature */: + case 219 /* FunctionDeclaration */: + case 178 /* FunctionExpression */: + case 148 /* GetAccessor */: + case 149 /* SetAccessor */: + case 220 /* ClassDeclaration */: + case 221 /* InterfaceDeclaration */: + case 223 /* EnumDeclaration */: + case 224 /* ModuleDeclaration */: return node; } } @@ -48765,38 +50786,38 @@ var ts; ts.getContainerNode = getContainerNode; /* @internal */ function getNodeKind(node) { switch (node.kind) { - case 222 /* ModuleDeclaration */: return ScriptElementKind.moduleElement; - case 218 /* ClassDeclaration */: return ScriptElementKind.classElement; - case 219 /* InterfaceDeclaration */: return ScriptElementKind.interfaceElement; - case 220 /* TypeAliasDeclaration */: return ScriptElementKind.typeElement; - case 221 /* EnumDeclaration */: return ScriptElementKind.enumElement; - case 215 /* VariableDeclaration */: + case 224 /* ModuleDeclaration */: return ScriptElementKind.moduleElement; + case 220 /* ClassDeclaration */: return ScriptElementKind.classElement; + case 221 /* InterfaceDeclaration */: return ScriptElementKind.interfaceElement; + case 222 /* TypeAliasDeclaration */: return ScriptElementKind.typeElement; + case 223 /* EnumDeclaration */: return ScriptElementKind.enumElement; + case 217 /* VariableDeclaration */: return ts.isConst(node) ? ScriptElementKind.constElement : ts.isLet(node) ? ScriptElementKind.letElement : ScriptElementKind.variableElement; - case 217 /* FunctionDeclaration */: return ScriptElementKind.functionElement; - case 147 /* GetAccessor */: return ScriptElementKind.memberGetAccessorElement; - case 148 /* SetAccessor */: return ScriptElementKind.memberSetAccessorElement; - case 145 /* MethodDeclaration */: - case 144 /* MethodSignature */: + case 219 /* FunctionDeclaration */: return ScriptElementKind.functionElement; + case 148 /* GetAccessor */: return ScriptElementKind.memberGetAccessorElement; + case 149 /* SetAccessor */: return ScriptElementKind.memberSetAccessorElement; + case 146 /* MethodDeclaration */: + case 145 /* MethodSignature */: return ScriptElementKind.memberFunctionElement; - case 143 /* PropertyDeclaration */: - case 142 /* PropertySignature */: + case 144 /* PropertyDeclaration */: + case 143 /* PropertySignature */: return ScriptElementKind.memberVariableElement; - case 151 /* IndexSignature */: return ScriptElementKind.indexSignatureElement; - case 150 /* ConstructSignature */: return ScriptElementKind.constructSignatureElement; - case 149 /* CallSignature */: return ScriptElementKind.callSignatureElement; - case 146 /* Constructor */: return ScriptElementKind.constructorImplementationElement; - case 139 /* TypeParameter */: return ScriptElementKind.typeParameterElement; - case 251 /* EnumMember */: return ScriptElementKind.variableElement; - case 140 /* Parameter */: return (node.flags & 28 /* AccessibilityModifier */) ? ScriptElementKind.memberVariableElement : ScriptElementKind.parameterElement; - case 225 /* ImportEqualsDeclaration */: - case 230 /* ImportSpecifier */: - case 227 /* ImportClause */: - case 234 /* ExportSpecifier */: - case 228 /* NamespaceImport */: + case 152 /* IndexSignature */: return ScriptElementKind.indexSignatureElement; + case 151 /* ConstructSignature */: return ScriptElementKind.constructSignatureElement; + case 150 /* CallSignature */: return ScriptElementKind.callSignatureElement; + case 147 /* Constructor */: return ScriptElementKind.constructorImplementationElement; + case 140 /* TypeParameter */: return ScriptElementKind.typeParameterElement; + case 254 /* EnumMember */: return ScriptElementKind.variableElement; + case 141 /* Parameter */: return (node.flags & 28 /* AccessibilityModifier */) ? ScriptElementKind.memberVariableElement : ScriptElementKind.parameterElement; + case 228 /* ImportEqualsDeclaration */: + case 233 /* ImportSpecifier */: + case 230 /* ImportClause */: + case 237 /* ExportSpecifier */: + case 231 /* NamespaceImport */: return ScriptElementKind.alias; } return ScriptElementKind.unknown; @@ -48892,7 +50913,7 @@ var ts; getCurrentDirectory: function () { return currentDirectory; }, fileExists: function (fileName) { // stub missing host functionality - ts.Debug.assert(!host.resolveModuleNames); + ts.Debug.assert(!host.resolveModuleNames || !host.resolveTypeReferenceDirectives); return hostCache.getOrCreateEntry(fileName) !== undefined; }, readFile: function (fileName) { @@ -48901,7 +50922,7 @@ var ts; return entry && entry.scriptSnapshot.getText(0, entry.scriptSnapshot.getLength()); }, directoryExists: function (directoryName) { - ts.Debug.assert(!host.resolveModuleNames); + ts.Debug.assert(!host.resolveModuleNames || !host.resolveTypeReferenceDirectives); return ts.directoryProbablyExists(directoryName, host); } }; @@ -48911,6 +50932,11 @@ var ts; if (host.resolveModuleNames) { compilerHost.resolveModuleNames = function (moduleNames, containingFile) { return host.resolveModuleNames(moduleNames, containingFile); }; } + if (host.resolveTypeReferenceDirectives) { + compilerHost.resolveTypeReferenceDirectives = function (typeReferenceDirectiveNames, containingFile) { + return host.resolveTypeReferenceDirectives(typeReferenceDirectiveNames, containingFile); + }; + } var newProgram = ts.createProgram(hostCache.getRootFileNames(), newSettings, compilerHost, program); // Release any files we have acquired in the old program but are // not part of the new program. @@ -49115,9 +51141,9 @@ var ts; isJsDocTagName = true; } switch (tag.kind) { - case 273 /* JSDocTypeTag */: - case 271 /* JSDocParameterTag */: - case 272 /* JSDocReturnTag */: + case 276 /* JSDocTypeTag */: + case 274 /* JSDocParameterTag */: + case 275 /* JSDocReturnTag */: var tagWithExpression = tag; if (tagWithExpression.typeExpression) { insideJsDocTagExpression = tagWithExpression.typeExpression.pos < position && position < tagWithExpression.typeExpression.end; @@ -49162,13 +51188,13 @@ var ts; log("Returning an empty list because completion was requested in an invalid position."); return undefined; } - var parent_11 = contextToken.parent, kind = contextToken.kind; + var parent_13 = contextToken.parent, kind = contextToken.kind; if (kind === 21 /* DotToken */) { - if (parent_11.kind === 170 /* PropertyAccessExpression */) { + if (parent_13.kind === 171 /* PropertyAccessExpression */) { node = contextToken.parent.expression; isRightOfDot = true; } - else if (parent_11.kind === 137 /* QualifiedName */) { + else if (parent_13.kind === 138 /* QualifiedName */) { node = contextToken.parent.left; isRightOfDot = true; } @@ -49183,7 +51209,7 @@ var ts; isRightOfOpenTag = true; location = contextToken; } - else if (kind === 39 /* SlashToken */ && contextToken.parent.kind === 241 /* JsxClosingElement */) { + else if (kind === 39 /* SlashToken */ && contextToken.parent.kind === 244 /* JsxClosingElement */) { isStartingCloseTag = true; location = contextToken; } @@ -49199,7 +51225,7 @@ var ts; else if (isRightOfOpenTag) { var tagSymbols = typeChecker.getJsxIntrinsicTagNames(); if (tryGetGlobalSymbols()) { - symbols = tagSymbols.concat(symbols.filter(function (s) { return !!(s.flags & 107455 /* Value */); })); + symbols = tagSymbols.concat(symbols.filter(function (s) { return !!(s.flags & (107455 /* Value */ | 8388608 /* Alias */)); })); } else { symbols = tagSymbols; @@ -49230,7 +51256,7 @@ var ts; // Right of dot member completion list isMemberCompletion = true; isNewIdentifierLocation = false; - if (node.kind === 69 /* Identifier */ || node.kind === 137 /* QualifiedName */ || node.kind === 170 /* PropertyAccessExpression */) { + if (node.kind === 69 /* Identifier */ || node.kind === 138 /* QualifiedName */ || node.kind === 171 /* PropertyAccessExpression */) { var symbol = typeChecker.getSymbolAtLocation(node); // This is an alias, follow what it aliases if (symbol && symbol.flags & 8388608 /* Alias */) { @@ -49286,7 +51312,7 @@ var ts; } if (jsxContainer = tryGetContainingJsxElement(contextToken)) { var attrsType = void 0; - if ((jsxContainer.kind === 238 /* JsxSelfClosingElement */) || (jsxContainer.kind === 239 /* JsxOpeningElement */)) { + if ((jsxContainer.kind === 241 /* JsxSelfClosingElement */) || (jsxContainer.kind === 242 /* JsxOpeningElement */)) { // Cursor is inside a JSX self-closing element or opening element attrsType = typeChecker.getJsxElementAttributesType(jsxContainer); if (attrsType) { @@ -49358,15 +51384,15 @@ var ts; return result; } function isInJsxText(contextToken) { - if (contextToken.kind === 240 /* JsxText */) { + if (contextToken.kind === 243 /* JsxText */) { return true; } if (contextToken.kind === 27 /* GreaterThanToken */ && contextToken.parent) { - if (contextToken.parent.kind === 239 /* JsxOpeningElement */) { + if (contextToken.parent.kind === 242 /* JsxOpeningElement */) { return true; } - if (contextToken.parent.kind === 241 /* JsxClosingElement */ || contextToken.parent.kind === 238 /* JsxSelfClosingElement */) { - return contextToken.parent.parent && contextToken.parent.parent.kind === 237 /* JsxElement */; + if (contextToken.parent.kind === 244 /* JsxClosingElement */ || contextToken.parent.kind === 241 /* JsxSelfClosingElement */) { + return contextToken.parent.parent && contextToken.parent.parent.kind === 240 /* JsxElement */; } } return false; @@ -49376,40 +51402,40 @@ var ts; var containingNodeKind = previousToken.parent.kind; switch (previousToken.kind) { case 24 /* CommaToken */: - return containingNodeKind === 172 /* CallExpression */ // func( a, | - || containingNodeKind === 146 /* Constructor */ // constructor( a, | /* public, protected, private keywords are allowed here, so show completion */ - || containingNodeKind === 173 /* NewExpression */ // new C(a, | - || containingNodeKind === 168 /* ArrayLiteralExpression */ // [a, | - || containingNodeKind === 185 /* BinaryExpression */ // const x = (a, | - || containingNodeKind === 154 /* FunctionType */; // var x: (s: string, list| + return containingNodeKind === 173 /* CallExpression */ // func( a, | + || containingNodeKind === 147 /* Constructor */ // constructor( a, | /* public, protected, private keywords are allowed here, so show completion */ + || containingNodeKind === 174 /* NewExpression */ // new C(a, | + || containingNodeKind === 169 /* ArrayLiteralExpression */ // [a, | + || containingNodeKind === 186 /* BinaryExpression */ // const x = (a, | + || containingNodeKind === 155 /* FunctionType */; // var x: (s: string, list| case 17 /* OpenParenToken */: - return containingNodeKind === 172 /* CallExpression */ // func( | - || containingNodeKind === 146 /* Constructor */ // constructor( | - || containingNodeKind === 173 /* NewExpression */ // new C(a| - || containingNodeKind === 176 /* ParenthesizedExpression */ // const x = (a| - || containingNodeKind === 162 /* ParenthesizedType */; // function F(pred: (a| /* this can become an arrow function, where 'a' is the argument */ + return containingNodeKind === 173 /* CallExpression */ // func( | + || containingNodeKind === 147 /* Constructor */ // constructor( | + || containingNodeKind === 174 /* NewExpression */ // new C(a| + || containingNodeKind === 177 /* ParenthesizedExpression */ // const x = (a| + || containingNodeKind === 163 /* ParenthesizedType */; // function F(pred: (a| /* this can become an arrow function, where 'a' is the argument */ case 19 /* OpenBracketToken */: - return containingNodeKind === 168 /* ArrayLiteralExpression */ // [ | - || containingNodeKind === 151 /* IndexSignature */ // [ | : string ] - || containingNodeKind === 138 /* ComputedPropertyName */; // [ | /* this can become an index signature */ + return containingNodeKind === 169 /* ArrayLiteralExpression */ // [ | + || containingNodeKind === 152 /* IndexSignature */ // [ | : string ] + || containingNodeKind === 139 /* ComputedPropertyName */; // [ | /* this can become an index signature */ case 125 /* ModuleKeyword */: // module | case 126 /* NamespaceKeyword */: return true; case 21 /* DotToken */: - return containingNodeKind === 222 /* ModuleDeclaration */; // module A.| + return containingNodeKind === 224 /* ModuleDeclaration */; // module A.| case 15 /* OpenBraceToken */: - return containingNodeKind === 218 /* ClassDeclaration */; // class A{ | + return containingNodeKind === 220 /* ClassDeclaration */; // class A{ | case 56 /* EqualsToken */: - return containingNodeKind === 215 /* VariableDeclaration */ // const x = a| - || containingNodeKind === 185 /* BinaryExpression */; // x = a| + return containingNodeKind === 217 /* VariableDeclaration */ // const x = a| + || containingNodeKind === 186 /* BinaryExpression */; // x = a| case 12 /* TemplateHead */: - return containingNodeKind === 187 /* TemplateExpression */; // `aa ${| + return containingNodeKind === 188 /* TemplateExpression */; // `aa ${| case 13 /* TemplateMiddle */: - return containingNodeKind === 194 /* TemplateSpan */; // `aa ${10} dd ${| + return containingNodeKind === 196 /* TemplateSpan */; // `aa ${10} dd ${| case 112 /* PublicKeyword */: case 110 /* PrivateKeyword */: case 111 /* ProtectedKeyword */: - return containingNodeKind === 143 /* PropertyDeclaration */; // class A{ public | + return containingNodeKind === 144 /* PropertyDeclaration */; // class A{ public | } // Previous token may have been a keyword that was converted to an identifier. switch (previousToken.getText()) { @@ -49423,7 +51449,7 @@ var ts; } function isInStringOrRegularExpressionOrTemplateLiteral(contextToken) { if (contextToken.kind === 9 /* StringLiteral */ - || contextToken.kind === 164 /* StringLiteralType */ + || contextToken.kind === 165 /* StringLiteralType */ || contextToken.kind === 10 /* RegularExpressionLiteral */ || ts.isTemplateLiteralKind(contextToken.kind)) { var start_7 = contextToken.getStart(); @@ -49453,14 +51479,14 @@ var ts; isMemberCompletion = true; var typeForObject; var existingMembers; - if (objectLikeContainer.kind === 169 /* ObjectLiteralExpression */) { + if (objectLikeContainer.kind === 170 /* ObjectLiteralExpression */) { // We are completing on contextual types, but may also include properties // other than those within the declared type. isNewIdentifierLocation = true; typeForObject = typeChecker.getContextualType(objectLikeContainer); existingMembers = objectLikeContainer.properties; } - else if (objectLikeContainer.kind === 165 /* ObjectBindingPattern */) { + else if (objectLikeContainer.kind === 166 /* ObjectBindingPattern */) { // We are *only* completing on properties from the type being destructured. isNewIdentifierLocation = false; var rootDeclaration = ts.getRootDeclaration(objectLikeContainer.parent); @@ -49468,7 +51494,18 @@ var ts; // 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. - if (rootDeclaration.initializer || rootDeclaration.type) { + // Also proceed if rootDeclaration is 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 === 141 /* Parameter */) { + if (ts.isExpression(rootDeclaration.parent)) { + canGetType = !!typeChecker.getContextualType(rootDeclaration.parent); + } + else if (rootDeclaration.parent.kind === 146 /* MethodDeclaration */ || rootDeclaration.parent.kind === 149 /* SetAccessor */) { + canGetType = ts.isExpression(rootDeclaration.parent.parent) && !!typeChecker.getContextualType(rootDeclaration.parent.parent); + } + } + if (canGetType) { typeForObject = typeChecker.getTypeAtLocation(objectLikeContainer); existingMembers = objectLikeContainer.elements; } @@ -49506,9 +51543,9 @@ var ts; * @returns true if 'symbols' was successfully populated; false otherwise. */ function tryGetImportOrExportClauseCompletionSymbols(namedImportsOrExports) { - var declarationKind = namedImportsOrExports.kind === 229 /* NamedImports */ ? - 226 /* ImportDeclaration */ : - 232 /* ExportDeclaration */; + var declarationKind = namedImportsOrExports.kind === 232 /* NamedImports */ ? + 229 /* ImportDeclaration */ : + 235 /* ExportDeclaration */; var importOrExportDeclaration = ts.getAncestor(namedImportsOrExports, declarationKind); var moduleSpecifier = importOrExportDeclaration.moduleSpecifier; if (!moduleSpecifier) { @@ -49533,9 +51570,9 @@ var ts; switch (contextToken.kind) { case 15 /* OpenBraceToken */: // const x = { | case 24 /* CommaToken */: - var parent_12 = contextToken.parent; - if (parent_12 && (parent_12.kind === 169 /* ObjectLiteralExpression */ || parent_12.kind === 165 /* ObjectBindingPattern */)) { - return parent_12; + var parent_14 = contextToken.parent; + if (parent_14 && (parent_14.kind === 170 /* ObjectLiteralExpression */ || parent_14.kind === 166 /* ObjectBindingPattern */)) { + return parent_14; } break; } @@ -49552,8 +51589,8 @@ var ts; case 15 /* OpenBraceToken */: // import { | case 24 /* CommaToken */: switch (contextToken.parent.kind) { - case 229 /* NamedImports */: - case 233 /* NamedExports */: + case 232 /* NamedImports */: + case 236 /* NamedExports */: return contextToken.parent; } } @@ -49562,37 +51599,37 @@ var ts; } function tryGetContainingJsxElement(contextToken) { if (contextToken) { - var parent_13 = contextToken.parent; + var parent_15 = contextToken.parent; switch (contextToken.kind) { case 26 /* LessThanSlashToken */: case 39 /* SlashToken */: case 69 /* Identifier */: - case 242 /* JsxAttribute */: - case 243 /* JsxSpreadAttribute */: - if (parent_13 && (parent_13.kind === 238 /* JsxSelfClosingElement */ || parent_13.kind === 239 /* JsxOpeningElement */)) { - return parent_13; + case 245 /* JsxAttribute */: + case 246 /* JsxSpreadAttribute */: + if (parent_15 && (parent_15.kind === 241 /* JsxSelfClosingElement */ || parent_15.kind === 242 /* JsxOpeningElement */)) { + return parent_15; } - else if (parent_13.kind === 242 /* JsxAttribute */) { - return parent_13.parent; + else if (parent_15.kind === 245 /* JsxAttribute */) { + return parent_15.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_13 && ((parent_13.kind === 242 /* JsxAttribute */) || (parent_13.kind === 243 /* JsxSpreadAttribute */))) { - return parent_13.parent; + if (parent_15 && ((parent_15.kind === 245 /* JsxAttribute */) || (parent_15.kind === 246 /* JsxSpreadAttribute */))) { + return parent_15.parent; } break; case 16 /* CloseBraceToken */: - if (parent_13 && - parent_13.kind === 244 /* JsxExpression */ && - parent_13.parent && - (parent_13.parent.kind === 242 /* JsxAttribute */)) { - return parent_13.parent.parent; + if (parent_15 && + parent_15.kind === 247 /* JsxExpression */ && + parent_15.parent && + (parent_15.parent.kind === 245 /* JsxAttribute */)) { + return parent_15.parent.parent; } - if (parent_13 && parent_13.kind === 243 /* JsxSpreadAttribute */) { - return parent_13.parent; + if (parent_15 && parent_15.kind === 246 /* JsxSpreadAttribute */) { + return parent_15.parent; } break; } @@ -49601,16 +51638,16 @@ var ts; } function isFunction(kind) { switch (kind) { - case 177 /* FunctionExpression */: - case 178 /* ArrowFunction */: - case 217 /* FunctionDeclaration */: - case 145 /* MethodDeclaration */: - case 144 /* MethodSignature */: - case 147 /* GetAccessor */: - case 148 /* SetAccessor */: - case 149 /* CallSignature */: - case 150 /* ConstructSignature */: - case 151 /* IndexSignature */: + case 178 /* FunctionExpression */: + case 179 /* ArrowFunction */: + case 219 /* FunctionDeclaration */: + case 146 /* MethodDeclaration */: + case 145 /* MethodSignature */: + case 148 /* GetAccessor */: + case 149 /* SetAccessor */: + case 150 /* CallSignature */: + case 151 /* ConstructSignature */: + case 152 /* IndexSignature */: return true; } return false; @@ -49622,54 +51659,54 @@ var ts; var containingNodeKind = contextToken.parent.kind; switch (contextToken.kind) { case 24 /* CommaToken */: - return containingNodeKind === 215 /* VariableDeclaration */ || - containingNodeKind === 216 /* VariableDeclarationList */ || - containingNodeKind === 197 /* VariableStatement */ || - containingNodeKind === 221 /* EnumDeclaration */ || + return containingNodeKind === 217 /* VariableDeclaration */ || + containingNodeKind === 218 /* VariableDeclarationList */ || + containingNodeKind === 199 /* VariableStatement */ || + containingNodeKind === 223 /* EnumDeclaration */ || isFunction(containingNodeKind) || - containingNodeKind === 218 /* ClassDeclaration */ || - containingNodeKind === 190 /* ClassExpression */ || - containingNodeKind === 219 /* InterfaceDeclaration */ || - containingNodeKind === 166 /* ArrayBindingPattern */ || - containingNodeKind === 220 /* TypeAliasDeclaration */; // type Map, K, | + containingNodeKind === 220 /* ClassDeclaration */ || + containingNodeKind === 191 /* ClassExpression */ || + containingNodeKind === 221 /* InterfaceDeclaration */ || + containingNodeKind === 167 /* ArrayBindingPattern */ || + containingNodeKind === 222 /* TypeAliasDeclaration */; // type Map, K, | case 21 /* DotToken */: - return containingNodeKind === 166 /* ArrayBindingPattern */; // var [.| + return containingNodeKind === 167 /* ArrayBindingPattern */; // var [.| case 54 /* ColonToken */: - return containingNodeKind === 167 /* BindingElement */; // var {x :html| + return containingNodeKind === 168 /* BindingElement */; // var {x :html| case 19 /* OpenBracketToken */: - return containingNodeKind === 166 /* ArrayBindingPattern */; // var [x| + return containingNodeKind === 167 /* ArrayBindingPattern */; // var [x| case 17 /* OpenParenToken */: - return containingNodeKind === 248 /* CatchClause */ || + return containingNodeKind === 251 /* CatchClause */ || isFunction(containingNodeKind); case 15 /* OpenBraceToken */: - return containingNodeKind === 221 /* EnumDeclaration */ || - containingNodeKind === 219 /* InterfaceDeclaration */ || - containingNodeKind === 157 /* TypeLiteral */; // const x : { | + return containingNodeKind === 223 /* EnumDeclaration */ || + containingNodeKind === 221 /* InterfaceDeclaration */ || + containingNodeKind === 158 /* TypeLiteral */; // const x : { | case 23 /* SemicolonToken */: - return containingNodeKind === 142 /* PropertySignature */ && + return containingNodeKind === 143 /* PropertySignature */ && contextToken.parent && contextToken.parent.parent && - (contextToken.parent.parent.kind === 219 /* InterfaceDeclaration */ || - contextToken.parent.parent.kind === 157 /* TypeLiteral */); // const x : { a; | + (contextToken.parent.parent.kind === 221 /* InterfaceDeclaration */ || + contextToken.parent.parent.kind === 158 /* TypeLiteral */); // const x : { a; | case 25 /* LessThanToken */: - return containingNodeKind === 218 /* ClassDeclaration */ || - containingNodeKind === 190 /* ClassExpression */ || - containingNodeKind === 219 /* InterfaceDeclaration */ || - containingNodeKind === 220 /* TypeAliasDeclaration */ || + return containingNodeKind === 220 /* ClassDeclaration */ || + containingNodeKind === 191 /* ClassExpression */ || + containingNodeKind === 221 /* InterfaceDeclaration */ || + containingNodeKind === 222 /* TypeAliasDeclaration */ || isFunction(containingNodeKind); case 113 /* StaticKeyword */: - return containingNodeKind === 143 /* PropertyDeclaration */; + return containingNodeKind === 144 /* PropertyDeclaration */; case 22 /* DotDotDotToken */: - return containingNodeKind === 140 /* Parameter */ || + return containingNodeKind === 141 /* Parameter */ || (contextToken.parent && contextToken.parent.parent && - contextToken.parent.parent.kind === 166 /* ArrayBindingPattern */); // var [...z| + contextToken.parent.parent.kind === 167 /* ArrayBindingPattern */); // var [...z| case 112 /* PublicKeyword */: case 110 /* PrivateKeyword */: case 111 /* ProtectedKeyword */: - return containingNodeKind === 140 /* Parameter */; + return containingNodeKind === 141 /* Parameter */; case 116 /* AsKeyword */: - return containingNodeKind === 230 /* ImportSpecifier */ || - containingNodeKind === 234 /* ExportSpecifier */ || - containingNodeKind === 228 /* NamespaceImport */; + return containingNodeKind === 233 /* ImportSpecifier */ || + containingNodeKind === 237 /* ExportSpecifier */ || + containingNodeKind === 231 /* NamespaceImport */; case 73 /* ClassKeyword */: case 81 /* EnumKeyword */: case 107 /* InterfaceKeyword */: @@ -49729,8 +51766,8 @@ var ts; if (element.getStart() <= position && position <= element.getEnd()) { continue; } - var name_34 = element.propertyName || element.name; - existingImportsOrExports[name_34.text] = true; + var name_39 = element.propertyName || element.name; + existingImportsOrExports[name_39.text] = true; } if (ts.isEmpty(existingImportsOrExports)) { return exportsOfModule; @@ -49751,10 +51788,10 @@ var ts; 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 !== 249 /* PropertyAssignment */ && - m.kind !== 250 /* ShorthandPropertyAssignment */ && - m.kind !== 167 /* BindingElement */ && - m.kind !== 145 /* MethodDeclaration */) { + if (m.kind !== 252 /* PropertyAssignment */ && + m.kind !== 253 /* ShorthandPropertyAssignment */ && + m.kind !== 168 /* BindingElement */ && + m.kind !== 146 /* MethodDeclaration */) { continue; } // If this is the current item we are editing right now, do not filter it out @@ -49762,7 +51799,7 @@ var ts; continue; } var existingName = void 0; - if (m.kind === 167 /* BindingElement */ && m.propertyName) { + if (m.kind === 168 /* BindingElement */ && m.propertyName) { // include only identifiers in completion list if (m.propertyName.kind === 69 /* Identifier */) { existingName = m.propertyName.text; @@ -49792,7 +51829,7 @@ var ts; if (attr.getStart() <= position && position <= attr.getEnd()) { continue; } - if (attr.kind === 242 /* JsxAttribute */) { + if (attr.kind === 245 /* JsxAttribute */) { seenNames[attr.name.text] = true; } } @@ -49819,7 +51856,7 @@ var ts; else { if (!symbols || symbols.length === 0) { if (sourceFile.languageVariant === 1 /* JSX */ && - location.parent && location.parent.kind === 241 /* JsxClosingElement */) { + location.parent && location.parent.kind === 244 /* 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: @@ -49847,14 +51884,14 @@ var ts; var entries = []; var target = program.getCompilerOptions().target; var nameTable = getNameTable(sourceFile); - for (var name_35 in nameTable) { + for (var name_40 in nameTable) { // Skip identifiers produced only from the current location - if (nameTable[name_35] === position) { + if (nameTable[name_40] === position) { continue; } - if (!uniqueNames[name_35]) { - uniqueNames[name_35] = name_35; - var displayName = getCompletionEntryDisplayName(name_35, target, /*performCharacterChecks*/ true); + if (!uniqueNames[name_40]) { + uniqueNames[name_40] = name_40; + var displayName = getCompletionEntryDisplayName(name_40, target, /*performCharacterChecks*/ true); if (displayName) { var entry = { name: displayName, @@ -49960,7 +51997,7 @@ var ts; function getSymbolKind(symbol, location) { var flags = symbol.getFlags(); if (flags & 32 /* Class */) - return ts.getDeclarationOfKind(symbol, 190 /* ClassExpression */) ? + return ts.getDeclarationOfKind(symbol, 191 /* ClassExpression */) ? ScriptElementKind.localClassElement : ScriptElementKind.classElement; if (flags & 384 /* Enum */) return ScriptElementKind.enumElement; @@ -49991,6 +52028,9 @@ var ts; 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; @@ -50052,6 +52092,7 @@ var ts; 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 */) { @@ -50060,9 +52101,9 @@ var ts; symbolKind = ScriptElementKind.memberVariableElement; } var signature = void 0; - type = typeChecker.getTypeOfSymbolAtLocation(symbol, location); + type = isThisExpression ? typeChecker.getTypeAtLocation(location) : typeChecker.getTypeOfSymbolAtLocation(symbol, location); if (type) { - if (location.parent && location.parent.kind === 170 /* PropertyAccessExpression */) { + if (location.parent && location.parent.kind === 171 /* 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)) { @@ -50071,7 +52112,7 @@ var ts; } // try get the call/construct signature from the type if it matches var callExpression = void 0; - if (location.kind === 172 /* CallExpression */ || location.kind === 173 /* NewExpression */) { + if (location.kind === 173 /* CallExpression */ || location.kind === 174 /* NewExpression */) { callExpression = location; } else if (isCallExpressionTarget(location) || isNewExpressionTarget(location)) { @@ -50084,7 +52125,7 @@ var ts; // Use the first candidate: signature = candidateSignatures[0]; } - var useConstructSignatures = callExpression.kind === 173 /* NewExpression */ || callExpression.expression.kind === 95 /* SuperKeyword */; + var useConstructSignatures = callExpression.kind === 174 /* 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 @@ -50137,24 +52178,24 @@ var ts; } } else if ((isNameOfFunctionDeclaration(location) && !(symbol.flags & 98304 /* Accessor */)) || - (location.kind === 121 /* ConstructorKeyword */ && location.parent.kind === 146 /* Constructor */)) { + (location.kind === 121 /* ConstructorKeyword */ && location.parent.kind === 147 /* Constructor */)) { // get the signature from the declaration and write it var functionDeclaration = location.parent; - var allSignatures = functionDeclaration.kind === 146 /* Constructor */ ? type.getConstructSignatures() : type.getCallSignatures(); + var allSignatures = functionDeclaration.kind === 147 /* Constructor */ ? type.getConstructSignatures() : type.getCallSignatures(); if (!typeChecker.isImplementationOfOverload(functionDeclaration)) { signature = typeChecker.getSignatureFromDeclaration(functionDeclaration); } else { signature = allSignatures[0]; } - if (functionDeclaration.kind === 146 /* Constructor */) { + if (functionDeclaration.kind === 147 /* Constructor */) { // show (constructor) Type(...) signature symbolKind = ScriptElementKind.constructorImplementationElement; addPrefixForAnyFunctionOrVar(type.symbol, symbolKind); } else { // (function/method) symbol(..signature) - addPrefixForAnyFunctionOrVar(functionDeclaration.kind === 149 /* CallSignature */ && + addPrefixForAnyFunctionOrVar(functionDeclaration.kind === 150 /* CallSignature */ && !(type.symbol.flags & 2048 /* TypeLiteral */ || type.symbol.flags & 4096 /* ObjectLiteral */) ? type.symbol : symbol, symbolKind); } addSignatureDisplayParts(signature, allSignatures); @@ -50162,8 +52203,8 @@ var ts; } } } - if (symbolFlags & 32 /* Class */ && !hasAddedSymbolInfo) { - if (ts.getDeclarationOfKind(symbol, 190 /* ClassExpression */)) { + if (symbolFlags & 32 /* Class */ && !hasAddedSymbolInfo && !isThisExpression) { + if (ts.getDeclarationOfKind(symbol, 191 /* 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 @@ -50207,7 +52248,7 @@ var ts; } if (symbolFlags & 1536 /* Module */) { addNewLineIfDisplayPartsExist(); - var declaration = ts.getDeclarationOfKind(symbol, 222 /* ModuleDeclaration */); + var declaration = ts.getDeclarationOfKind(symbol, 224 /* ModuleDeclaration */); var isNamespace = declaration && declaration.name && declaration.name.kind === 69 /* Identifier */; displayParts.push(ts.keywordPart(isNamespace ? 126 /* NamespaceKeyword */ : 125 /* ModuleKeyword */)); displayParts.push(ts.spacePart()); @@ -50230,17 +52271,17 @@ var ts; } else { // Method/function type parameter - var declaration = ts.getDeclarationOfKind(symbol, 139 /* TypeParameter */); + var declaration = ts.getDeclarationOfKind(symbol, 140 /* TypeParameter */); ts.Debug.assert(declaration !== undefined); declaration = declaration.parent; if (declaration) { if (ts.isFunctionLikeKind(declaration.kind)) { var signature = typeChecker.getSignatureFromDeclaration(declaration); - if (declaration.kind === 150 /* ConstructSignature */) { + if (declaration.kind === 151 /* ConstructSignature */) { displayParts.push(ts.keywordPart(92 /* NewKeyword */)); displayParts.push(ts.spacePart()); } - else if (declaration.kind !== 149 /* CallSignature */ && declaration.name) { + else if (declaration.kind !== 150 /* CallSignature */ && declaration.name) { addFullSymbolName(declaration.symbol); } ts.addRange(displayParts, ts.signatureToDisplayParts(typeChecker, signature, sourceFile, 32 /* WriteTypeArgumentsOfSignature */)); @@ -50260,7 +52301,7 @@ var ts; if (symbolFlags & 8 /* EnumMember */) { addPrefixForAnyFunctionOrVar(symbol, "enum member"); var declaration = symbol.declarations[0]; - if (declaration.kind === 251 /* EnumMember */) { + if (declaration.kind === 254 /* EnumMember */) { var constantValue = typeChecker.getConstantValue(declaration); if (constantValue !== undefined) { displayParts.push(ts.spacePart()); @@ -50276,7 +52317,7 @@ var ts; displayParts.push(ts.spacePart()); addFullSymbolName(symbol); ts.forEach(symbol.declarations, function (declaration) { - if (declaration.kind === 225 /* ImportEqualsDeclaration */) { + if (declaration.kind === 228 /* ImportEqualsDeclaration */) { var importEqualsDeclaration = declaration; if (ts.isExternalModuleImportEqualsDeclaration(importEqualsDeclaration)) { displayParts.push(ts.spacePart()); @@ -50303,11 +52344,18 @@ var ts; if (!hasAddedSymbolInfo) { if (symbolKind !== ScriptElementKind.unknown) { if (type) { - addPrefixForAnyFunctionOrVar(symbol, symbolKind); + 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) { + symbolKind === ScriptElementKind.localVariableElement || + isThisExpression) { displayParts.push(ts.punctuationPart(54 /* ColonToken */)); displayParts.push(ts.spacePart()); // If the type is type parameter, format it specially @@ -50409,10 +52457,10 @@ var ts; // Try getting just type at this position and show switch (node.kind) { case 69 /* Identifier */: - case 170 /* PropertyAccessExpression */: - case 137 /* QualifiedName */: + case 171 /* PropertyAccessExpression */: + case 138 /* QualifiedName */: case 97 /* ThisKeyword */: - case 163 /* ThisType */: + case 164 /* ThisType */: case 95 /* SuperKeyword */: // For the identifiers/this/super etc get the type at position var type = typeChecker.getTypeAtLocation(node); @@ -50491,8 +52539,8 @@ var ts; var declarations = []; var definition; ts.forEach(signatureDeclarations, function (d) { - if ((selectConstructors && d.kind === 146 /* Constructor */) || - (!selectConstructors && (d.kind === 217 /* FunctionDeclaration */ || d.kind === 145 /* MethodDeclaration */ || d.kind === 144 /* MethodSignature */))) { + if ((selectConstructors && d.kind === 147 /* Constructor */) || + (!selectConstructors && (d.kind === 219 /* FunctionDeclaration */ || d.kind === 146 /* MethodDeclaration */ || d.kind === 145 /* MethodSignature */))) { declarations.push(d); if (d.body) definition = d; @@ -50509,6 +52557,25 @@ var ts; 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 + }; + } /// Goto definition function getDefinitionAtPosition(fileName, position) { synchronizeHostData(); @@ -50524,18 +52591,20 @@ var ts; return label ? [createDefinitionInfo(label, ScriptElementKind.label, labelName, /*containerName*/ undefined)] : undefined; } /// Triple slash reference comments - var comment = ts.forEach(sourceFile.referencedFiles, function (r) { return (r.pos <= position && position < r.end) ? r : undefined; }); + var comment = findReferenceInPosition(sourceFile.referencedFiles, position); if (comment) { var referenceFile = ts.tryResolveScriptReference(program, sourceFile, comment); if (referenceFile) { - return [{ - fileName: referenceFile.fileName, - textSpan: ts.createTextSpanFromBounds(0, 0), - kind: ScriptElementKind.scriptElement, - name: comment.fileName, - containerName: undefined, - containerKind: undefined - }]; + return [getDefinitionInfoForFileReference(comment.fileName, referenceFile.fileName)]; + } + return undefined; + } + // Type reference directives + var typeReferenceDirective = findReferenceInPosition(sourceFile.typeReferenceDirectives, position); + if (typeReferenceDirective) { + var referenceFile = ts.lookUp(program.resolvedTypeReferenceDirectives, typeReferenceDirective.fileName); + if (referenceFile && referenceFile.resolvedFileName) { + return [getDefinitionInfoForFileReference(typeReferenceDirective.fileName, referenceFile.resolvedFileName)]; } return undefined; } @@ -50559,7 +52628,7 @@ var ts; // if (node.kind === 69 /* Identifier */ && (node.parent === declaration || - (declaration.kind === 230 /* ImportSpecifier */ && declaration.parent && declaration.parent.kind === 229 /* NamedImports */))) { + (declaration.kind === 233 /* ImportSpecifier */ && declaration.parent && declaration.parent.kind === 232 /* NamedImports */))) { symbol = typeChecker.getAliasedSymbol(symbol); } } @@ -50568,7 +52637,7 @@ var ts; // 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 === 250 /* ShorthandPropertyAssignment */) { + if (node.parent.kind === 253 /* ShorthandPropertyAssignment */) { var shorthandSymbol = typeChecker.getShorthandAssignmentValueSymbol(symbol.valueDeclaration); if (!shorthandSymbol) { return []; @@ -50644,7 +52713,7 @@ var ts; function getSemanticDocumentHighlights(node) { if (node.kind === 69 /* Identifier */ || node.kind === 97 /* ThisKeyword */ || - node.kind === 163 /* ThisType */ || + node.kind === 164 /* ThisType */ || node.kind === 95 /* SuperKeyword */ || isLiteralNameOfPropertyDeclarationOrIndexAccess(node) || isNameOfExternalModuleImportOrDeclaration(node)) { @@ -50698,75 +52767,75 @@ var ts; switch (node.kind) { case 88 /* IfKeyword */: case 80 /* ElseKeyword */: - if (hasKind(node.parent, 200 /* IfStatement */)) { + if (hasKind(node.parent, 202 /* IfStatement */)) { return getIfElseOccurrences(node.parent); } break; case 94 /* ReturnKeyword */: - if (hasKind(node.parent, 208 /* ReturnStatement */)) { + if (hasKind(node.parent, 210 /* ReturnStatement */)) { return getReturnOccurrences(node.parent); } break; case 98 /* ThrowKeyword */: - if (hasKind(node.parent, 212 /* ThrowStatement */)) { + if (hasKind(node.parent, 214 /* ThrowStatement */)) { return getThrowOccurrences(node.parent); } break; case 72 /* CatchKeyword */: - if (hasKind(parent(parent(node)), 213 /* TryStatement */)) { + if (hasKind(parent(parent(node)), 215 /* TryStatement */)) { return getTryCatchFinallyOccurrences(node.parent.parent); } break; case 100 /* TryKeyword */: case 85 /* FinallyKeyword */: - if (hasKind(parent(node), 213 /* TryStatement */)) { + if (hasKind(parent(node), 215 /* TryStatement */)) { return getTryCatchFinallyOccurrences(node.parent); } break; case 96 /* SwitchKeyword */: - if (hasKind(node.parent, 210 /* SwitchStatement */)) { + if (hasKind(node.parent, 212 /* SwitchStatement */)) { return getSwitchCaseDefaultOccurrences(node.parent); } break; case 71 /* CaseKeyword */: case 77 /* DefaultKeyword */: - if (hasKind(parent(parent(parent(node))), 210 /* SwitchStatement */)) { + if (hasKind(parent(parent(parent(node))), 212 /* SwitchStatement */)) { return getSwitchCaseDefaultOccurrences(node.parent.parent.parent); } break; case 70 /* BreakKeyword */: case 75 /* ContinueKeyword */: - if (hasKind(node.parent, 207 /* BreakStatement */) || hasKind(node.parent, 206 /* ContinueStatement */)) { + if (hasKind(node.parent, 209 /* BreakStatement */) || hasKind(node.parent, 208 /* ContinueStatement */)) { return getBreakOrContinueStatementOccurrences(node.parent); } break; case 86 /* ForKeyword */: - if (hasKind(node.parent, 203 /* ForStatement */) || - hasKind(node.parent, 204 /* ForInStatement */) || - hasKind(node.parent, 205 /* ForOfStatement */)) { + if (hasKind(node.parent, 205 /* ForStatement */) || + hasKind(node.parent, 206 /* ForInStatement */) || + hasKind(node.parent, 207 /* ForOfStatement */)) { return getLoopBreakContinueOccurrences(node.parent); } break; case 104 /* WhileKeyword */: case 79 /* DoKeyword */: - if (hasKind(node.parent, 202 /* WhileStatement */) || hasKind(node.parent, 201 /* DoStatement */)) { + if (hasKind(node.parent, 204 /* WhileStatement */) || hasKind(node.parent, 203 /* DoStatement */)) { return getLoopBreakContinueOccurrences(node.parent); } break; case 121 /* ConstructorKeyword */: - if (hasKind(node.parent, 146 /* Constructor */)) { + if (hasKind(node.parent, 147 /* Constructor */)) { return getConstructorOccurrences(node.parent); } break; case 123 /* GetKeyword */: case 130 /* SetKeyword */: - if (hasKind(node.parent, 147 /* GetAccessor */) || hasKind(node.parent, 148 /* SetAccessor */)) { + if (hasKind(node.parent, 148 /* GetAccessor */) || hasKind(node.parent, 149 /* SetAccessor */)) { return getGetAndSetOccurrences(node.parent); } break; default: if (ts.isModifierKind(node.kind) && node.parent && - (ts.isDeclaration(node.parent) || node.parent.kind === 197 /* VariableStatement */)) { + (ts.isDeclaration(node.parent) || node.parent.kind === 199 /* VariableStatement */)) { return getModifierOccurrences(node.kind, node.parent); } } @@ -50782,10 +52851,10 @@ var ts; aggregate(node); return statementAccumulator; function aggregate(node) { - if (node.kind === 212 /* ThrowStatement */) { + if (node.kind === 214 /* ThrowStatement */) { statementAccumulator.push(node); } - else if (node.kind === 213 /* TryStatement */) { + else if (node.kind === 215 /* TryStatement */) { var tryStatement = node; if (tryStatement.catchClause) { aggregate(tryStatement.catchClause); @@ -50812,19 +52881,19 @@ var ts; function getThrowStatementOwner(throwStatement) { var child = throwStatement; while (child.parent) { - var parent_14 = child.parent; - if (ts.isFunctionBlock(parent_14) || parent_14.kind === 252 /* SourceFile */) { - return parent_14; + var parent_16 = child.parent; + if (ts.isFunctionBlock(parent_16) || parent_16.kind === 255 /* SourceFile */) { + return parent_16; } // 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_14.kind === 213 /* TryStatement */) { - var tryStatement = parent_14; + if (parent_16.kind === 215 /* TryStatement */) { + var tryStatement = parent_16; if (tryStatement.tryBlock === child && tryStatement.catchClause) { return child; } } - child = parent_14; + child = parent_16; } return undefined; } @@ -50833,7 +52902,7 @@ var ts; aggregate(node); return statementAccumulator; function aggregate(node) { - if (node.kind === 207 /* BreakStatement */ || node.kind === 206 /* ContinueStatement */) { + if (node.kind === 209 /* BreakStatement */ || node.kind === 208 /* ContinueStatement */) { statementAccumulator.push(node); } else if (!ts.isFunctionLike(node)) { @@ -50848,16 +52917,16 @@ var ts; function getBreakOrContinueOwner(statement) { for (var node_2 = statement.parent; node_2; node_2 = node_2.parent) { switch (node_2.kind) { - case 210 /* SwitchStatement */: - if (statement.kind === 206 /* ContinueStatement */) { + case 212 /* SwitchStatement */: + if (statement.kind === 208 /* ContinueStatement */) { continue; } // Fall through. - case 203 /* ForStatement */: - case 204 /* ForInStatement */: - case 205 /* ForOfStatement */: - case 202 /* WhileStatement */: - case 201 /* DoStatement */: + case 205 /* ForStatement */: + case 206 /* ForInStatement */: + case 207 /* ForOfStatement */: + case 204 /* WhileStatement */: + case 203 /* DoStatement */: if (!statement.label || isLabeledBy(node_2, statement.label.text)) { return node_2; } @@ -50876,24 +52945,24 @@ var ts; 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 === 218 /* ClassDeclaration */ || - container.kind === 190 /* ClassExpression */ || - (declaration.kind === 140 /* Parameter */ && hasKind(container, 146 /* Constructor */)))) { + if (!(container.kind === 220 /* ClassDeclaration */ || + container.kind === 191 /* ClassExpression */ || + (declaration.kind === 141 /* Parameter */ && hasKind(container, 147 /* Constructor */)))) { return undefined; } } else if (modifier === 113 /* StaticKeyword */) { - if (!(container.kind === 218 /* ClassDeclaration */ || container.kind === 190 /* ClassExpression */)) { + if (!(container.kind === 220 /* ClassDeclaration */ || container.kind === 191 /* ClassExpression */)) { return undefined; } } else if (modifier === 82 /* ExportKeyword */ || modifier === 122 /* DeclareKeyword */) { - if (!(container.kind === 223 /* ModuleBlock */ || container.kind === 252 /* SourceFile */)) { + if (!(container.kind === 225 /* ModuleBlock */ || container.kind === 255 /* SourceFile */)) { return undefined; } } else if (modifier === 115 /* AbstractKeyword */) { - if (!(container.kind === 218 /* ClassDeclaration */ || declaration.kind === 218 /* ClassDeclaration */)) { + if (!(container.kind === 220 /* ClassDeclaration */ || declaration.kind === 220 /* ClassDeclaration */)) { return undefined; } } @@ -50905,8 +52974,8 @@ var ts; var modifierFlag = getFlagFromModifier(modifier); var nodes; switch (container.kind) { - case 223 /* ModuleBlock */: - case 252 /* SourceFile */: + case 225 /* ModuleBlock */: + case 255 /* SourceFile */: // Container is either a class declaration or the declaration is a classDeclaration if (modifierFlag & 128 /* Abstract */) { nodes = declaration.members.concat(declaration); @@ -50915,17 +52984,17 @@ var ts; nodes = container.statements; } break; - case 146 /* Constructor */: + case 147 /* Constructor */: nodes = container.parameters.concat(container.parent.members); break; - case 218 /* ClassDeclaration */: - case 190 /* ClassExpression */: + case 220 /* ClassDeclaration */: + case 191 /* 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 === 146 /* Constructor */ && member; + return member.kind === 147 /* Constructor */ && member; }); if (constructor) { nodes = nodes.concat(constructor.parameters); @@ -50978,8 +53047,8 @@ var ts; } function getGetAndSetOccurrences(accessorDeclaration) { var keywords = []; - tryPushAccessorKeyword(accessorDeclaration.symbol, 147 /* GetAccessor */); - tryPushAccessorKeyword(accessorDeclaration.symbol, 148 /* SetAccessor */); + tryPushAccessorKeyword(accessorDeclaration.symbol, 148 /* GetAccessor */); + tryPushAccessorKeyword(accessorDeclaration.symbol, 149 /* SetAccessor */); return ts.map(keywords, getHighlightSpanForNode); function tryPushAccessorKeyword(accessorSymbol, accessorKind) { var accessor = ts.getDeclarationOfKind(accessorSymbol, accessorKind); @@ -51002,7 +53071,7 @@ var ts; 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 === 201 /* DoStatement */) { + if (loopNode.kind === 203 /* DoStatement */) { var loopTokens = loopNode.getChildren(); for (var i = loopTokens.length - 1; i >= 0; i--) { if (pushKeywordIf(keywords, loopTokens[i], 104 /* WhileKeyword */)) { @@ -51023,13 +53092,13 @@ var ts; var owner = getBreakOrContinueOwner(breakOrContinueStatement); if (owner) { switch (owner.kind) { - case 203 /* ForStatement */: - case 204 /* ForInStatement */: - case 205 /* ForOfStatement */: - case 201 /* DoStatement */: - case 202 /* WhileStatement */: + case 205 /* ForStatement */: + case 206 /* ForInStatement */: + case 207 /* ForOfStatement */: + case 203 /* DoStatement */: + case 204 /* WhileStatement */: return getLoopBreakContinueOccurrences(owner); - case 210 /* SwitchStatement */: + case 212 /* SwitchStatement */: return getSwitchCaseDefaultOccurrences(owner); } } @@ -51083,7 +53152,7 @@ var ts; 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, 196 /* Block */))) { + if (!(func && hasKind(func.body, 198 /* Block */))) { return undefined; } var keywords = []; @@ -51099,7 +53168,7 @@ var ts; function getIfElseOccurrences(ifStatement) { var keywords = []; // Traverse upwards through all parent if-statements linked by their else-branches. - while (hasKind(ifStatement.parent, 200 /* IfStatement */) && ifStatement.parent.elseStatement === ifStatement) { + while (hasKind(ifStatement.parent, 202 /* IfStatement */) && ifStatement.parent.elseStatement === ifStatement) { ifStatement = ifStatement.parent; } // Now traverse back down through the else branches, aggregating if/else keywords of if-statements. @@ -51112,7 +53181,7 @@ var ts; break; } } - if (!hasKind(ifStatement.elseStatement, 200 /* IfStatement */)) { + if (!hasKind(ifStatement.elseStatement, 202 /* IfStatement */)) { break; } ifStatement = ifStatement.elseStatement; @@ -51229,7 +53298,7 @@ var ts; return getLabelReferencesInNode(node.parent, node); } } - if (node.kind === 97 /* ThisKeyword */ || node.kind === 163 /* ThisType */) { + if (node.kind === 97 /* ThisKeyword */ || node.kind === 164 /* ThisType */) { return getReferencesForThisKeyword(node, sourceFiles); } if (node.kind === 95 /* SuperKeyword */) { @@ -51263,8 +53332,8 @@ var ts; } else { var internedName = getInternedName(symbol, node, declarations); - for (var _i = 0, sourceFiles_3 = sourceFiles; _i < sourceFiles_3.length; _i++) { - var sourceFile = sourceFiles_3[_i]; + for (var _i = 0, sourceFiles_4 = sourceFiles; _i < sourceFiles_4.length; _i++) { + var sourceFile = sourceFiles_4[_i]; cancellationToken.throwIfCancellationRequested(); var nameTable = getNameTable(sourceFile); if (ts.lookUp(nameTable, internedName) !== undefined) { @@ -51291,7 +53360,7 @@ var ts; }; } function isImportSpecifierSymbol(symbol) { - return (symbol.flags & 8388608 /* Alias */) && !!ts.getDeclarationOfKind(symbol, 230 /* ImportSpecifier */); + return (symbol.flags & 8388608 /* Alias */) && !!ts.getDeclarationOfKind(symbol, 233 /* ImportSpecifier */); } function getInternedName(symbol, location, declarations) { // If this is an export or import specifier it could have been renamed using the 'as' syntax. @@ -51317,14 +53386,14 @@ var ts; // 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 === 177 /* FunctionExpression */ || valueDeclaration.kind === 190 /* ClassExpression */)) { + if (valueDeclaration && (valueDeclaration.kind === 178 /* FunctionExpression */ || valueDeclaration.kind === 191 /* 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, 218 /* ClassDeclaration */); + return ts.getAncestor(privateDeclaration, 220 /* ClassDeclaration */); } } // If the symbol is an import we would like to find it if we are looking for what it imports. @@ -51350,7 +53419,7 @@ var ts; // Different declarations have different containers, bail out return undefined; } - if (container.kind === 252 /* SourceFile */ && !ts.isExternalModule(container)) { + if (container.kind === 255 /* 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; @@ -51523,13 +53592,13 @@ var ts; // Whether 'super' occurs in a static context within a class. var staticFlag = 32 /* Static */; switch (searchSpaceNode.kind) { - case 143 /* PropertyDeclaration */: - case 142 /* PropertySignature */: - case 145 /* MethodDeclaration */: - case 144 /* MethodSignature */: - case 146 /* Constructor */: - case 147 /* GetAccessor */: - case 148 /* SetAccessor */: + case 144 /* PropertyDeclaration */: + case 143 /* PropertySignature */: + case 146 /* MethodDeclaration */: + case 145 /* MethodSignature */: + case 147 /* Constructor */: + case 148 /* GetAccessor */: + case 149 /* SetAccessor */: staticFlag &= searchSpaceNode.flags; searchSpaceNode = searchSpaceNode.parent; // re-assign to be the owning class break; @@ -51561,27 +53630,27 @@ var ts; // Whether 'this' occurs in a static context within a class. var staticFlag = 32 /* Static */; switch (searchSpaceNode.kind) { - case 145 /* MethodDeclaration */: - case 144 /* MethodSignature */: + case 146 /* MethodDeclaration */: + case 145 /* MethodSignature */: if (ts.isObjectLiteralMethod(searchSpaceNode)) { break; } // fall through - case 143 /* PropertyDeclaration */: - case 142 /* PropertySignature */: - case 146 /* Constructor */: - case 147 /* GetAccessor */: - case 148 /* SetAccessor */: + case 144 /* PropertyDeclaration */: + case 143 /* PropertySignature */: + case 147 /* Constructor */: + case 148 /* GetAccessor */: + case 149 /* SetAccessor */: staticFlag &= searchSpaceNode.flags; searchSpaceNode = searchSpaceNode.parent; // re-assign to be the owning class break; - case 252 /* SourceFile */: + case 255 /* SourceFile */: if (ts.isExternalModule(searchSpaceNode)) { return undefined; } // Fall through - case 217 /* FunctionDeclaration */: - case 177 /* FunctionExpression */: + case 219 /* FunctionDeclaration */: + case 178 /* 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. @@ -51590,7 +53659,7 @@ var ts; } var references = []; var possiblePositions; - if (searchSpaceNode.kind === 252 /* SourceFile */) { + if (searchSpaceNode.kind === 255 /* SourceFile */) { ts.forEach(sourceFiles, function (sourceFile) { possiblePositions = getPossibleSymbolReferencePositions(sourceFile, "this", sourceFile.getStart(), sourceFile.getEnd()); getThisReferencesInFile(sourceFile, sourceFile, possiblePositions, references); @@ -51616,33 +53685,33 @@ var ts; ts.forEach(possiblePositions, function (position) { cancellationToken.throwIfCancellationRequested(); var node = ts.getTouchingWord(sourceFile, position); - if (!node || (node.kind !== 97 /* ThisKeyword */ && node.kind !== 163 /* ThisType */)) { + if (!node || (node.kind !== 97 /* ThisKeyword */ && node.kind !== 164 /* ThisType */)) { return; } var container = ts.getThisContainer(node, /* includeArrowFunctions */ false); switch (searchSpaceNode.kind) { - case 177 /* FunctionExpression */: - case 217 /* FunctionDeclaration */: + case 178 /* FunctionExpression */: + case 219 /* FunctionDeclaration */: if (searchSpaceNode.symbol === container.symbol) { result.push(getReferenceEntryFromNode(node)); } break; - case 145 /* MethodDeclaration */: - case 144 /* MethodSignature */: + case 146 /* MethodDeclaration */: + case 145 /* MethodSignature */: if (ts.isObjectLiteralMethod(searchSpaceNode) && searchSpaceNode.symbol === container.symbol) { result.push(getReferenceEntryFromNode(node)); } break; - case 190 /* ClassExpression */: - case 218 /* ClassDeclaration */: + case 191 /* ClassExpression */: + case 220 /* 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 252 /* SourceFile */: - if (container.kind === 252 /* SourceFile */ && !ts.isExternalModule(container)) { + case 255 /* SourceFile */: + if (container.kind === 255 /* SourceFile */ && !ts.isExternalModule(container)) { result.push(getReferenceEntryFromNode(node)); } break; @@ -51662,7 +53731,7 @@ var ts; // export {a as somethingElse} // We want the *local* declaration of 'a' as declared in the import, // *not* as declared within "mod" (or farther) - if (location.parent.kind === 234 /* ExportSpecifier */) { + if (location.parent.kind === 237 /* ExportSpecifier */) { result.push(typeChecker.getExportSpecifierLocalTargetSymbol(location.parent)); } // If the location is in a context sensitive location (i.e. in an object literal) try @@ -51692,7 +53761,7 @@ var ts; // 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 === 140 /* Parameter */ && + if (symbol.valueDeclaration && symbol.valueDeclaration.kind === 141 /* Parameter */ && ts.isParameterPropertyDeclaration(symbol.valueDeclaration)) { result = result.concat(typeChecker.getSymbolsOfParameterPropertyDeclaration(symbol.valueDeclaration, symbol.name)); } @@ -51737,11 +53806,11 @@ var ts; } if (symbol.flags & (32 /* Class */ | 64 /* Interface */)) { ts.forEach(symbol.getDeclarations(), function (declaration) { - if (declaration.kind === 218 /* ClassDeclaration */) { + if (declaration.kind === 220 /* ClassDeclaration */) { getPropertySymbolFromTypeReference(ts.getClassExtendsHeritageClauseElement(declaration)); ts.forEach(ts.getClassImplementsHeritageClauseElements(declaration), getPropertySymbolFromTypeReference); } - else if (declaration.kind === 219 /* InterfaceDeclaration */) { + else if (declaration.kind === 221 /* InterfaceDeclaration */) { ts.forEach(ts.getInterfaceBaseTypeNodes(declaration), getPropertySymbolFromTypeReference); } }); @@ -51778,7 +53847,7 @@ var ts; // import {a} from "mod"; // export {a as somethingElse} // We want the local target of the export (i.e. the import symbol) and not the final target (i.e. "mod".a) - if (referenceLocation.parent.kind === 234 /* ExportSpecifier */) { + if (referenceLocation.parent.kind === 237 /* ExportSpecifier */) { var aliasedSymbol = typeChecker.getExportSpecifierLocalTargetSymbol(referenceLocation.parent); if (searchSymbols.indexOf(aliasedSymbol) >= 0) { return aliasedSymbol; @@ -51813,19 +53882,19 @@ var ts; if (isNameOfPropertyAssignment(node)) { var objectLiteral = node.parent.parent; var contextualType = typeChecker.getContextualType(objectLiteral); - var name_36 = node.text; + var name_41 = node.text; if (contextualType) { if (contextualType.flags & 16384 /* Union */) { // This is a union type, first see if the property we are looking for is a union property (i.e. exists in all types) // if not, search the constituent types for the property - var unionProperty = contextualType.getProperty(name_36); + var unionProperty = contextualType.getProperty(name_41); if (unionProperty) { return [unionProperty]; } else { var result_5 = []; ts.forEach(contextualType.types, function (t) { - var symbol = t.getProperty(name_36); + var symbol = t.getProperty(name_41); if (symbol) { result_5.push(symbol); } @@ -51834,7 +53903,7 @@ var ts; } } else { - var symbol_1 = contextualType.getProperty(name_36); + var symbol_1 = contextualType.getProperty(name_41); if (symbol_1) { return [symbol_1]; } @@ -51892,10 +53961,10 @@ var ts; } var parent = node.parent; if (parent) { - if (parent.kind === 184 /* PostfixUnaryExpression */ || parent.kind === 183 /* PrefixUnaryExpression */) { + if (parent.kind === 185 /* PostfixUnaryExpression */ || parent.kind === 184 /* PrefixUnaryExpression */) { return true; } - else if (parent.kind === 185 /* BinaryExpression */ && parent.left === node) { + else if (parent.kind === 186 /* BinaryExpression */ && parent.left === node) { var operator = parent.operatorToken.kind; return 56 /* FirstAssignment */ <= operator && operator <= 68 /* LastAssignment */; } @@ -51926,33 +53995,33 @@ var ts; } function getMeaningFromDeclaration(node) { switch (node.kind) { - case 140 /* Parameter */: - case 215 /* VariableDeclaration */: - case 167 /* BindingElement */: - case 143 /* PropertyDeclaration */: - case 142 /* PropertySignature */: - case 249 /* PropertyAssignment */: - case 250 /* ShorthandPropertyAssignment */: - case 251 /* EnumMember */: - case 145 /* MethodDeclaration */: - case 144 /* MethodSignature */: - case 146 /* Constructor */: - case 147 /* GetAccessor */: - case 148 /* SetAccessor */: - case 217 /* FunctionDeclaration */: - case 177 /* FunctionExpression */: - case 178 /* ArrowFunction */: - case 248 /* CatchClause */: + case 141 /* Parameter */: + case 217 /* VariableDeclaration */: + case 168 /* BindingElement */: + case 144 /* PropertyDeclaration */: + case 143 /* PropertySignature */: + case 252 /* PropertyAssignment */: + case 253 /* ShorthandPropertyAssignment */: + case 254 /* EnumMember */: + case 146 /* MethodDeclaration */: + case 145 /* MethodSignature */: + case 147 /* Constructor */: + case 148 /* GetAccessor */: + case 149 /* SetAccessor */: + case 219 /* FunctionDeclaration */: + case 178 /* FunctionExpression */: + case 179 /* ArrowFunction */: + case 251 /* CatchClause */: return 1 /* Value */; - case 139 /* TypeParameter */: - case 219 /* InterfaceDeclaration */: - case 220 /* TypeAliasDeclaration */: - case 157 /* TypeLiteral */: + case 140 /* TypeParameter */: + case 221 /* InterfaceDeclaration */: + case 222 /* TypeAliasDeclaration */: + case 158 /* TypeLiteral */: return 2 /* Type */; - case 218 /* ClassDeclaration */: - case 221 /* EnumDeclaration */: + case 220 /* ClassDeclaration */: + case 223 /* EnumDeclaration */: return 1 /* Value */ | 2 /* Type */; - case 222 /* ModuleDeclaration */: + case 224 /* ModuleDeclaration */: if (ts.isAmbientModule(node)) { return 4 /* Namespace */ | 1 /* Value */; } @@ -51962,15 +54031,15 @@ var ts; else { return 4 /* Namespace */; } - case 229 /* NamedImports */: - case 230 /* ImportSpecifier */: - case 225 /* ImportEqualsDeclaration */: - case 226 /* ImportDeclaration */: - case 231 /* ExportAssignment */: - case 232 /* ExportDeclaration */: + case 232 /* NamedImports */: + case 233 /* ImportSpecifier */: + case 228 /* ImportEqualsDeclaration */: + case 229 /* ImportDeclaration */: + case 234 /* ExportAssignment */: + case 235 /* ExportDeclaration */: return 1 /* Value */ | 2 /* Type */ | 4 /* Namespace */; // An external module can be a Value - case 252 /* SourceFile */: + case 255 /* SourceFile */: return 4 /* Namespace */ | 1 /* Value */; } return 1 /* Value */ | 2 /* Type */ | 4 /* Namespace */; @@ -51979,10 +54048,10 @@ var ts; if (ts.isRightSideOfQualifiedNameOrPropertyAccess(node)) { node = node.parent; } - return node.parent.kind === 153 /* TypeReference */ || - (node.parent.kind === 192 /* ExpressionWithTypeArguments */ && !ts.isExpressionWithTypeArgumentsInClassExtendsClause(node.parent)) || + return node.parent.kind === 154 /* TypeReference */ || + (node.parent.kind === 193 /* ExpressionWithTypeArguments */ && !ts.isExpressionWithTypeArgumentsInClassExtendsClause(node.parent)) || (node.kind === 97 /* ThisKeyword */ && !ts.isExpression(node)) || - node.kind === 163 /* ThisType */; + node.kind === 164 /* ThisType */; } function isNamespaceReference(node) { return isQualifiedNameNamespaceReference(node) || isPropertyAccessNamespaceReference(node); @@ -51990,32 +54059,32 @@ var ts; function isPropertyAccessNamespaceReference(node) { var root = node; var isLastClause = true; - if (root.parent.kind === 170 /* PropertyAccessExpression */) { - while (root.parent && root.parent.kind === 170 /* PropertyAccessExpression */) { + if (root.parent.kind === 171 /* PropertyAccessExpression */) { + while (root.parent && root.parent.kind === 171 /* PropertyAccessExpression */) { root = root.parent; } isLastClause = root.name === node; } - if (!isLastClause && root.parent.kind === 192 /* ExpressionWithTypeArguments */ && root.parent.parent.kind === 247 /* HeritageClause */) { + if (!isLastClause && root.parent.kind === 193 /* ExpressionWithTypeArguments */ && root.parent.parent.kind === 250 /* HeritageClause */) { var decl = root.parent.parent.parent; - return (decl.kind === 218 /* ClassDeclaration */ && root.parent.parent.token === 106 /* ImplementsKeyword */) || - (decl.kind === 219 /* InterfaceDeclaration */ && root.parent.parent.token === 83 /* ExtendsKeyword */); + return (decl.kind === 220 /* ClassDeclaration */ && root.parent.parent.token === 106 /* ImplementsKeyword */) || + (decl.kind === 221 /* InterfaceDeclaration */ && root.parent.parent.token === 83 /* ExtendsKeyword */); } return false; } function isQualifiedNameNamespaceReference(node) { var root = node; var isLastClause = true; - if (root.parent.kind === 137 /* QualifiedName */) { - while (root.parent && root.parent.kind === 137 /* QualifiedName */) { + if (root.parent.kind === 138 /* QualifiedName */) { + while (root.parent && root.parent.kind === 138 /* QualifiedName */) { root = root.parent; } isLastClause = root.right === node; } - return root.parent.kind === 153 /* TypeReference */ && !isLastClause; + return root.parent.kind === 154 /* TypeReference */ && !isLastClause; } function isInRightSideOfImport(node) { - while (node.parent.kind === 137 /* QualifiedName */) { + while (node.parent.kind === 138 /* QualifiedName */) { node = node.parent; } return ts.isInternalModuleImportEqualsDeclaration(node.parent) && node.parent.moduleReference === node; @@ -52025,15 +54094,15 @@ var ts; // import a = |b|; // Namespace // import a = |b.c|; // Value, type, namespace // import a = |b.c|.d; // Namespace - if (node.parent.kind === 137 /* QualifiedName */ && + if (node.parent.kind === 138 /* QualifiedName */ && node.parent.right === node && - node.parent.parent.kind === 225 /* ImportEqualsDeclaration */) { + node.parent.parent.kind === 228 /* ImportEqualsDeclaration */) { return 1 /* Value */ | 2 /* Type */ | 4 /* Namespace */; } return 4 /* Namespace */; } function getMeaningFromLocation(node) { - if (node.parent.kind === 231 /* ExportAssignment */) { + if (node.parent.kind === 234 /* ExportAssignment */) { return 1 /* Value */ | 2 /* Type */ | 4 /* Namespace */; } else if (isInRightSideOfImport(node)) { @@ -52062,7 +54131,7 @@ var ts; return ts.SignatureHelp.getSignatureHelpItems(program, sourceFile, position, cancellationToken); } /// Syntactic features - function getSourceFile(fileName) { + function getNonBoundSourceFile(fileName) { return syntaxTreeCache.getCurrentSourceFile(fileName); } function getNameOrDottedNameSpan(fileName, startPos, endPos) { @@ -52073,16 +54142,16 @@ var ts; return; } switch (node.kind) { - case 170 /* PropertyAccessExpression */: - case 137 /* QualifiedName */: + case 171 /* PropertyAccessExpression */: + case 138 /* QualifiedName */: case 9 /* StringLiteral */: - case 164 /* StringLiteralType */: + case 165 /* StringLiteralType */: case 84 /* FalseKeyword */: case 99 /* TrueKeyword */: case 93 /* NullKeyword */: case 95 /* SuperKeyword */: case 97 /* ThisKeyword */: - case 163 /* ThisType */: + case 164 /* ThisType */: case 69 /* Identifier */: break; // Cant create the text span @@ -52099,7 +54168,7 @@ var ts; // 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 === 222 /* ModuleDeclaration */ && + if (nodeForStartPos.parent.parent.kind === 224 /* ModuleDeclaration */ && nodeForStartPos.parent.parent.body === nodeForStartPos.parent) { // Use parent module declarations name for start pos nodeForStartPos = nodeForStartPos.parent.parent.name; @@ -52140,10 +54209,10 @@ var ts; // 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 222 /* ModuleDeclaration */: - case 218 /* ClassDeclaration */: - case 219 /* InterfaceDeclaration */: - case 217 /* FunctionDeclaration */: + case 224 /* ModuleDeclaration */: + case 220 /* ClassDeclaration */: + case 221 /* InterfaceDeclaration */: + case 219 /* FunctionDeclaration */: cancellationToken.throwIfCancellationRequested(); } } @@ -52197,7 +54266,7 @@ var ts; */ function hasValueSideModule(symbol) { return ts.forEach(symbol.declarations, function (declaration) { - return declaration.kind === 222 /* ModuleDeclaration */ && + return declaration.kind === 224 /* ModuleDeclaration */ && ts.getModuleInstanceState(declaration) === 1 /* Instantiated */; }); } @@ -52358,16 +54427,16 @@ var ts; pushClassification(tag.tagName.pos, tag.tagName.end - tag.tagName.pos, 18 /* docCommentTagName */); pos = tag.tagName.end; switch (tag.kind) { - case 271 /* JSDocParameterTag */: + case 274 /* JSDocParameterTag */: processJSDocParameterTag(tag); break; - case 274 /* JSDocTemplateTag */: + case 277 /* JSDocTemplateTag */: processJSDocTemplateTag(tag); break; - case 273 /* JSDocTypeTag */: + case 276 /* JSDocTypeTag */: processElement(tag.typeExpression); break; - case 272 /* JSDocReturnTag */: + case 275 /* JSDocReturnTag */: processElement(tag.typeExpression); break; } @@ -52434,10 +54503,10 @@ var ts; return true; } var classifiedElementName = tryClassifyJsxElementName(node); - if (!ts.isToken(node) && node.kind !== 240 /* JsxText */ && classifiedElementName === undefined) { + if (!ts.isToken(node) && node.kind !== 243 /* JsxText */ && classifiedElementName === undefined) { return false; } - var tokenStart = node.kind === 240 /* JsxText */ ? node.pos : classifyLeadingTriviaAndGetTokenStart(node); + var tokenStart = node.kind === 243 /* JsxText */ ? node.pos : classifyLeadingTriviaAndGetTokenStart(node); var tokenWidth = node.end - tokenStart; ts.Debug.assert(tokenWidth >= 0); if (tokenWidth > 0) { @@ -52450,22 +54519,22 @@ var ts; } function tryClassifyJsxElementName(token) { switch (token.parent && token.parent.kind) { - case 239 /* JsxOpeningElement */: + case 242 /* JsxOpeningElement */: if (token.parent.tagName === token) { return 19 /* jsxOpenTagName */; } break; - case 241 /* JsxClosingElement */: + case 244 /* JsxClosingElement */: if (token.parent.tagName === token) { return 20 /* jsxCloseTagName */; } break; - case 238 /* JsxSelfClosingElement */: + case 241 /* JsxSelfClosingElement */: if (token.parent.tagName === token) { return 21 /* jsxSelfClosingTagName */; } break; - case 242 /* JsxAttribute */: + case 245 /* JsxAttribute */: if (token.parent.name === token) { return 22 /* jsxAttribute */; } @@ -52493,17 +54562,17 @@ var ts; if (token) { if (tokenKind === 56 /* EqualsToken */) { // the '=' in a variable declaration is special cased here. - if (token.parent.kind === 215 /* VariableDeclaration */ || - token.parent.kind === 143 /* PropertyDeclaration */ || - token.parent.kind === 140 /* Parameter */ || - token.parent.kind === 242 /* JsxAttribute */) { + if (token.parent.kind === 217 /* VariableDeclaration */ || + token.parent.kind === 144 /* PropertyDeclaration */ || + token.parent.kind === 141 /* Parameter */ || + token.parent.kind === 245 /* JsxAttribute */) { return 5 /* operator */; } } - if (token.parent.kind === 185 /* BinaryExpression */ || - token.parent.kind === 183 /* PrefixUnaryExpression */ || - token.parent.kind === 184 /* PostfixUnaryExpression */ || - token.parent.kind === 186 /* ConditionalExpression */) { + if (token.parent.kind === 186 /* BinaryExpression */ || + token.parent.kind === 184 /* PrefixUnaryExpression */ || + token.parent.kind === 185 /* PostfixUnaryExpression */ || + token.parent.kind === 187 /* ConditionalExpression */) { return 5 /* operator */; } } @@ -52512,8 +54581,8 @@ var ts; else if (tokenKind === 8 /* NumericLiteral */) { return 4 /* numericLiteral */; } - else if (tokenKind === 9 /* StringLiteral */ || tokenKind === 164 /* StringLiteralType */) { - return token.parent.kind === 242 /* JsxAttribute */ ? 24 /* jsxAttributeStringLiteralValue */ : 6 /* stringLiteral */; + else if (tokenKind === 9 /* StringLiteral */ || tokenKind === 165 /* StringLiteralType */) { + return token.parent.kind === 245 /* JsxAttribute */ ? 24 /* jsxAttributeStringLiteralValue */ : 6 /* stringLiteral */; } else if (tokenKind === 10 /* RegularExpressionLiteral */) { // TODO: we should get another classification type for these literals. @@ -52523,38 +54592,38 @@ var ts; // TODO (drosen): we should *also* get another classification type for these literals. return 6 /* stringLiteral */; } - else if (tokenKind === 240 /* JsxText */) { + else if (tokenKind === 243 /* JsxText */) { return 23 /* jsxText */; } else if (tokenKind === 69 /* Identifier */) { if (token) { switch (token.parent.kind) { - case 218 /* ClassDeclaration */: + case 220 /* ClassDeclaration */: if (token.parent.name === token) { return 11 /* className */; } return; - case 139 /* TypeParameter */: + case 140 /* TypeParameter */: if (token.parent.name === token) { return 15 /* typeParameterName */; } return; - case 219 /* InterfaceDeclaration */: + case 221 /* InterfaceDeclaration */: if (token.parent.name === token) { return 13 /* interfaceName */; } return; - case 221 /* EnumDeclaration */: + case 223 /* EnumDeclaration */: if (token.parent.name === token) { return 12 /* enumName */; } return; - case 222 /* ModuleDeclaration */: + case 224 /* ModuleDeclaration */: if (token.parent.name === token) { return 14 /* moduleName */; } return; - case 140 /* Parameter */: + case 141 /* Parameter */: if (token.parent.name === token) { return 17 /* parameterName */; } @@ -52698,19 +54767,19 @@ var ts; var commentOwner; findOwner: for (commentOwner = tokenAtPos; commentOwner; commentOwner = commentOwner.parent) { switch (commentOwner.kind) { - case 217 /* FunctionDeclaration */: - case 145 /* MethodDeclaration */: - case 146 /* Constructor */: - case 218 /* ClassDeclaration */: - case 197 /* VariableStatement */: + case 219 /* FunctionDeclaration */: + case 146 /* MethodDeclaration */: + case 147 /* Constructor */: + case 220 /* ClassDeclaration */: + case 199 /* VariableStatement */: break findOwner; - case 252 /* SourceFile */: + case 255 /* SourceFile */: return undefined; - case 222 /* ModuleDeclaration */: + case 224 /* 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 === 222 /* ModuleDeclaration */) { + if (commentOwner.parent.kind === 224 /* ModuleDeclaration */) { return undefined; } break findOwner; @@ -52751,7 +54820,7 @@ var ts; if (ts.isFunctionLike(commentOwner)) { return commentOwner.parameters; } - if (commentOwner.kind === 197 /* VariableStatement */) { + if (commentOwner.kind === 199 /* VariableStatement */) { var varStatement = commentOwner; var varDeclarations = varStatement.declarationList.declarations; if (varDeclarations.length === 1 && varDeclarations[0].initializer) { @@ -52769,17 +54838,17 @@ var ts; * @returns the parameters of a signature found on the RHS if one exists; otherwise 'emptyArray'. */ function getParametersFromRightHandSideOfAssignment(rightHandSide) { - while (rightHandSide.kind === 176 /* ParenthesizedExpression */) { + while (rightHandSide.kind === 177 /* ParenthesizedExpression */) { rightHandSide = rightHandSide.expression; } switch (rightHandSide.kind) { - case 177 /* FunctionExpression */: - case 178 /* ArrowFunction */: + case 178 /* FunctionExpression */: + case 179 /* ArrowFunction */: return rightHandSide.parameters; - case 190 /* ClassExpression */: + case 191 /* ClassExpression */: for (var _i = 0, _a = rightHandSide.members; _i < _a.length; _i++) { var member = _a[_i]; - if (member.kind === 146 /* Constructor */) { + if (member.kind === 147 /* Constructor */) { return member.parameters; } } @@ -53004,7 +55073,7 @@ var ts; getFormattingEditsAfterKeystroke: getFormattingEditsAfterKeystroke, getDocCommentTemplateAtPosition: getDocCommentTemplateAtPosition, getEmitOutput: getEmitOutput, - getSourceFile: getSourceFile, + getNonBoundSourceFile: getNonBoundSourceFile, getProgram: getProgram }; } @@ -53033,7 +55102,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 === 236 /* ExternalModuleReference */ || + node.parent.kind === 239 /* ExternalModuleReference */ || isArgumentOfElementAccessExpression(node)) { nameTable[node.text] = nameTable[node.text] === undefined ? node.pos : -1; } @@ -53046,7 +55115,7 @@ var ts; function isArgumentOfElementAccessExpression(node) { return node && node.parent && - node.parent.kind === 171 /* ElementAccessExpression */ && + node.parent.kind === 172 /* ElementAccessExpression */ && node.parent.argumentExpression === node; } /// Classifier @@ -53305,7 +55374,7 @@ var ts; var end = scanner.getTextPos(); addResult(start, end, classFromKind(token)); if (end >= text.length) { - if (token === 9 /* StringLiteral */ || token === 164 /* StringLiteralType */) { + if (token === 9 /* StringLiteral */ || token === 165 /* StringLiteralType */) { // Check to see if we finished up on a multiline string literal. var tokenText = scanner.getTokenText(); if (scanner.isUnterminated()) { @@ -53428,7 +55497,7 @@ var ts; } } function isKeyword(token) { - return token >= 70 /* FirstKeyword */ && token <= 136 /* LastKeyword */; + return token >= 70 /* FirstKeyword */ && token <= 137 /* LastKeyword */; } function classFromKind(token) { if (isKeyword(token)) { @@ -53444,7 +55513,7 @@ var ts; case 8 /* NumericLiteral */: return 4 /* numericLiteral */; case 9 /* StringLiteral */: - case 164 /* StringLiteralType */: + case 165 /* StringLiteralType */: return 6 /* stringLiteral */; case 10 /* RegularExpressionLiteral */: return 7 /* regularExpressionLiteral */; @@ -53556,113 +55625,113 @@ var ts; function spanInNode(node) { if (node) { switch (node.kind) { - case 197 /* VariableStatement */: + case 199 /* VariableStatement */: // Span on first variable declaration return spanInVariableDeclaration(node.declarationList.declarations[0]); - case 215 /* VariableDeclaration */: - case 143 /* PropertyDeclaration */: - case 142 /* PropertySignature */: + case 217 /* VariableDeclaration */: + case 144 /* PropertyDeclaration */: + case 143 /* PropertySignature */: return spanInVariableDeclaration(node); - case 140 /* Parameter */: + case 141 /* Parameter */: return spanInParameterDeclaration(node); - case 217 /* FunctionDeclaration */: - case 145 /* MethodDeclaration */: - case 144 /* MethodSignature */: - case 147 /* GetAccessor */: - case 148 /* SetAccessor */: - case 146 /* Constructor */: - case 177 /* FunctionExpression */: - case 178 /* ArrowFunction */: + case 219 /* FunctionDeclaration */: + case 146 /* MethodDeclaration */: + case 145 /* MethodSignature */: + case 148 /* GetAccessor */: + case 149 /* SetAccessor */: + case 147 /* Constructor */: + case 178 /* FunctionExpression */: + case 179 /* ArrowFunction */: return spanInFunctionDeclaration(node); - case 196 /* Block */: + case 198 /* Block */: if (ts.isFunctionBlock(node)) { return spanInFunctionBlock(node); } // Fall through - case 223 /* ModuleBlock */: + case 225 /* ModuleBlock */: return spanInBlock(node); - case 248 /* CatchClause */: + case 251 /* CatchClause */: return spanInBlock(node.block); - case 199 /* ExpressionStatement */: + case 201 /* ExpressionStatement */: // span on the expression return textSpan(node.expression); - case 208 /* ReturnStatement */: + case 210 /* ReturnStatement */: // span on return keyword and expression if present return textSpan(node.getChildAt(0), node.expression); - case 202 /* WhileStatement */: + case 204 /* WhileStatement */: // Span on while(...) return textSpanEndingAtNextToken(node, node.expression); - case 201 /* DoStatement */: + case 203 /* DoStatement */: // span in statement of the do statement return spanInNode(node.statement); - case 214 /* DebuggerStatement */: + case 216 /* DebuggerStatement */: // span on debugger keyword return textSpan(node.getChildAt(0)); - case 200 /* IfStatement */: + case 202 /* IfStatement */: // set on if(..) span return textSpanEndingAtNextToken(node, node.expression); - case 211 /* LabeledStatement */: + case 213 /* LabeledStatement */: // span in statement return spanInNode(node.statement); - case 207 /* BreakStatement */: - case 206 /* ContinueStatement */: + case 209 /* BreakStatement */: + case 208 /* ContinueStatement */: // On break or continue keyword and label if present return textSpan(node.getChildAt(0), node.label); - case 203 /* ForStatement */: + case 205 /* ForStatement */: return spanInForStatement(node); - case 204 /* ForInStatement */: + case 206 /* ForInStatement */: // span of for (a in ...) return textSpanEndingAtNextToken(node, node.expression); - case 205 /* ForOfStatement */: + case 207 /* ForOfStatement */: // span in initializer return spanInInitializerOfForLike(node); - case 210 /* SwitchStatement */: + case 212 /* SwitchStatement */: // span on switch(...) return textSpanEndingAtNextToken(node, node.expression); - case 245 /* CaseClause */: - case 246 /* DefaultClause */: + case 248 /* CaseClause */: + case 249 /* DefaultClause */: // span in first statement of the clause return spanInNode(node.statements[0]); - case 213 /* TryStatement */: + case 215 /* TryStatement */: // span in try block return spanInBlock(node.tryBlock); - case 212 /* ThrowStatement */: + case 214 /* ThrowStatement */: // span in throw ... return textSpan(node, node.expression); - case 231 /* ExportAssignment */: + case 234 /* ExportAssignment */: // span on export = id return textSpan(node, node.expression); - case 225 /* ImportEqualsDeclaration */: + case 228 /* ImportEqualsDeclaration */: // import statement without including semicolon return textSpan(node, node.moduleReference); - case 226 /* ImportDeclaration */: + case 229 /* ImportDeclaration */: // import statement without including semicolon return textSpan(node, node.moduleSpecifier); - case 232 /* ExportDeclaration */: + case 235 /* ExportDeclaration */: // import statement without including semicolon return textSpan(node, node.moduleSpecifier); - case 222 /* ModuleDeclaration */: + case 224 /* ModuleDeclaration */: // span on complete module if it is instantiated if (ts.getModuleInstanceState(node) !== 1 /* Instantiated */) { return undefined; } - case 218 /* ClassDeclaration */: - case 221 /* EnumDeclaration */: - case 251 /* EnumMember */: - case 167 /* BindingElement */: + case 220 /* ClassDeclaration */: + case 223 /* EnumDeclaration */: + case 254 /* EnumMember */: + case 168 /* BindingElement */: // span on complete node return textSpan(node); - case 209 /* WithStatement */: + case 211 /* WithStatement */: // span in statement return spanInNode(node.statement); - case 141 /* Decorator */: + case 142 /* Decorator */: return spanInNodeArray(node.parent.decorators); - case 165 /* ObjectBindingPattern */: - case 166 /* ArrayBindingPattern */: + case 166 /* ObjectBindingPattern */: + case 167 /* ArrayBindingPattern */: return spanInBindingPattern(node); // No breakpoint in interface, type alias - case 219 /* InterfaceDeclaration */: - case 220 /* TypeAliasDeclaration */: + case 221 /* InterfaceDeclaration */: + case 222 /* TypeAliasDeclaration */: return undefined; // Tokens: case 23 /* SemicolonToken */: @@ -53692,7 +55761,7 @@ var ts; case 72 /* CatchKeyword */: case 85 /* FinallyKeyword */: return spanInNextNode(node); - case 136 /* OfKeyword */: + case 137 /* OfKeyword */: return spanInOfKeyword(node); default: // Destructuring pattern in destructuring assignment @@ -53705,13 +55774,13 @@ var ts; // 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 == 189 /* SpreadElementExpression */ || - node.kind === 249 /* PropertyAssignment */ || - node.kind === 250 /* ShorthandPropertyAssignment */) && + node.kind == 190 /* SpreadElementExpression */ || + node.kind === 252 /* PropertyAssignment */ || + node.kind === 253 /* ShorthandPropertyAssignment */) && ts.isArrayLiteralOrObjectLiteralDestructuringPattern(node.parent)) { return textSpan(node); } - if (node.kind === 185 /* BinaryExpression */) { + if (node.kind === 186 /* BinaryExpression */) { var binaryExpression = node; // Set breakpoint in destructuring pattern if its destructuring assignment // [a, b, c] or {a, b, c} of @@ -53734,22 +55803,22 @@ var ts; } if (ts.isExpression(node)) { switch (node.parent.kind) { - case 201 /* DoStatement */: + case 203 /* DoStatement */: // Set span as if on while keyword return spanInPreviousNode(node); - case 141 /* Decorator */: + case 142 /* Decorator */: // Set breakpoint on the decorator emit return spanInNode(node.parent); - case 203 /* ForStatement */: - case 205 /* ForOfStatement */: + case 205 /* ForStatement */: + case 207 /* ForOfStatement */: return textSpan(node); - case 185 /* BinaryExpression */: + case 186 /* BinaryExpression */: if (node.parent.operatorToken.kind === 24 /* CommaToken */) { // if this is comma expression, the breakpoint is possible in this expression return textSpan(node); } break; - case 178 /* ArrowFunction */: + case 179 /* ArrowFunction */: if (node.parent.body === node) { // If this is body of arrow function, it is allowed to have the breakpoint return textSpan(node); @@ -53758,13 +55827,13 @@ var ts; } } // If this is name of property assignment, set breakpoint in the initializer - if (node.parent.kind === 249 /* PropertyAssignment */ && + if (node.parent.kind === 252 /* 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 === 175 /* TypeAssertionExpression */ && node.parent.type === node) { + if (node.parent.kind === 176 /* TypeAssertionExpression */ && node.parent.type === node) { return spanInNextNode(node.parent.type); } // return type of function go to previous token @@ -53772,8 +55841,8 @@ var ts; return spanInPreviousNode(node); } // initializer of variable/parameter declaration go to previous node - if ((node.parent.kind === 215 /* VariableDeclaration */ || - node.parent.kind === 140 /* Parameter */)) { + if ((node.parent.kind === 217 /* VariableDeclaration */ || + node.parent.kind === 141 /* Parameter */)) { var paramOrVarDecl = node.parent; if (paramOrVarDecl.initializer === node || paramOrVarDecl.type === node || @@ -53781,7 +55850,7 @@ var ts; return spanInPreviousNode(node); } } - if (node.parent.kind === 185 /* BinaryExpression */) { + if (node.parent.kind === 186 /* BinaryExpression */) { var binaryExpression = node.parent; if (ts.isArrayLiteralOrObjectLiteralDestructuringPattern(binaryExpression.left) && (binaryExpression.right === node || @@ -53807,7 +55876,7 @@ var ts; } function spanInVariableDeclaration(variableDeclaration) { // If declaration of for in statement, just set the span in parent - if (variableDeclaration.parent.parent.kind === 204 /* ForInStatement */) { + if (variableDeclaration.parent.parent.kind === 206 /* ForInStatement */) { return spanInNode(variableDeclaration.parent.parent); } // If this is a destructuring pattern set breakpoint in binding pattern @@ -53818,7 +55887,7 @@ var ts; // or its declaration from 'for of' if (variableDeclaration.initializer || (variableDeclaration.flags & 1 /* Export */) || - variableDeclaration.parent.parent.kind === 205 /* ForOfStatement */) { + variableDeclaration.parent.parent.kind === 207 /* ForOfStatement */) { return textSpanFromVariableDeclaration(variableDeclaration); } var declarations = variableDeclaration.parent.declarations; @@ -53858,7 +55927,7 @@ var ts; } function canFunctionHaveSpanInWholeDeclaration(functionDeclaration) { return !!(functionDeclaration.flags & 1 /* Export */) || - (functionDeclaration.parent.kind === 218 /* ClassDeclaration */ && functionDeclaration.kind !== 146 /* Constructor */); + (functionDeclaration.parent.kind === 220 /* ClassDeclaration */ && functionDeclaration.kind !== 147 /* Constructor */); } function spanInFunctionDeclaration(functionDeclaration) { // No breakpoints in the function signature @@ -53881,34 +55950,34 @@ var ts; } function spanInBlock(block) { switch (block.parent.kind) { - case 222 /* ModuleDeclaration */: + case 224 /* ModuleDeclaration */: if (ts.getModuleInstanceState(block.parent) !== 1 /* Instantiated */) { return undefined; } // Set on parent if on same line otherwise on first statement - case 202 /* WhileStatement */: - case 200 /* IfStatement */: - case 204 /* ForInStatement */: + case 204 /* WhileStatement */: + case 202 /* IfStatement */: + case 206 /* 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 203 /* ForStatement */: - case 205 /* ForOfStatement */: + case 205 /* ForStatement */: + case 207 /* 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(forLikeStaement) { - if (forLikeStaement.initializer.kind === 216 /* VariableDeclarationList */) { + function spanInInitializerOfForLike(forLikeStatement) { + if (forLikeStatement.initializer.kind === 218 /* VariableDeclarationList */) { // declaration list, set breakpoint in first declaration - var variableDeclarationList = forLikeStaement.initializer; + var variableDeclarationList = forLikeStatement.initializer; if (variableDeclarationList.declarations.length > 0) { return spanInNode(variableDeclarationList.declarations[0]); } } else { // Expression - set breakpoint in it - return spanInNode(forLikeStaement.initializer); + return spanInNode(forLikeStatement.initializer); } } function spanInForStatement(forStatement) { @@ -53924,23 +55993,23 @@ var ts; } function spanInBindingPattern(bindingPattern) { // Set breakpoint in first binding element - var firstBindingElement = ts.forEach(bindingPattern.elements, function (element) { return element.kind !== 191 /* OmittedExpression */ ? element : undefined; }); + var firstBindingElement = ts.forEach(bindingPattern.elements, function (element) { return element.kind !== 192 /* OmittedExpression */ ? element : undefined; }); if (firstBindingElement) { return spanInNode(firstBindingElement); } // Empty binding pattern of binding element, set breakpoint on binding element - if (bindingPattern.parent.kind === 167 /* BindingElement */) { + if (bindingPattern.parent.kind === 168 /* BindingElement */) { return textSpan(bindingPattern.parent); } // Variable declaration is used as the span return textSpanFromVariableDeclaration(bindingPattern.parent); } function spanInArrayLiteralOrObjectLiteralDestructuringPattern(node) { - ts.Debug.assert(node.kind !== 166 /* ArrayBindingPattern */ && node.kind !== 165 /* ObjectBindingPattern */); - var elements = node.kind === 168 /* ArrayLiteralExpression */ ? + ts.Debug.assert(node.kind !== 167 /* ArrayBindingPattern */ && node.kind !== 166 /* ObjectBindingPattern */); + var elements = node.kind === 169 /* ArrayLiteralExpression */ ? node.elements : node.properties; - var firstBindingElement = ts.forEach(elements, function (element) { return element.kind !== 191 /* OmittedExpression */ ? element : undefined; }); + var firstBindingElement = ts.forEach(elements, function (element) { return element.kind !== 192 /* OmittedExpression */ ? element : undefined; }); if (firstBindingElement) { return spanInNode(firstBindingElement); } @@ -53948,18 +56017,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 === 185 /* BinaryExpression */ ? node.parent : node); + return textSpan(node.parent.kind === 186 /* BinaryExpression */ ? node.parent : node); } // Tokens: function spanInOpenBraceToken(node) { switch (node.parent.kind) { - case 221 /* EnumDeclaration */: + case 223 /* EnumDeclaration */: var enumDeclaration = node.parent; return spanInNodeIfStartsOnSameLine(ts.findPrecedingToken(node.pos, sourceFile, node.parent), enumDeclaration.members.length ? enumDeclaration.members[0] : enumDeclaration.getLastToken(sourceFile)); - case 218 /* ClassDeclaration */: + case 220 /* ClassDeclaration */: var classDeclaration = node.parent; return spanInNodeIfStartsOnSameLine(ts.findPrecedingToken(node.pos, sourceFile, node.parent), classDeclaration.members.length ? classDeclaration.members[0] : classDeclaration.getLastToken(sourceFile)); - case 224 /* CaseBlock */: + case 226 /* CaseBlock */: return spanInNodeIfStartsOnSameLine(node.parent.parent, node.parent.clauses[0]); } // Default to parent node @@ -53967,24 +56036,24 @@ var ts; } function spanInCloseBraceToken(node) { switch (node.parent.kind) { - case 223 /* ModuleBlock */: + case 225 /* ModuleBlock */: // If this is not instantiated module block no bp span if (ts.getModuleInstanceState(node.parent.parent) !== 1 /* Instantiated */) { return undefined; } - case 221 /* EnumDeclaration */: - case 218 /* ClassDeclaration */: + case 223 /* EnumDeclaration */: + case 220 /* ClassDeclaration */: // Span on close brace token return textSpan(node); - case 196 /* Block */: + case 198 /* Block */: if (ts.isFunctionBlock(node.parent)) { // Span on close brace token return textSpan(node); } // fall through. - case 248 /* CatchClause */: + case 251 /* CatchClause */: return spanInNode(ts.lastOrUndefined(node.parent.statements)); - case 224 /* CaseBlock */: + case 226 /* CaseBlock */: // breakpoint in last statement of the last clause var caseBlock = node.parent; var lastClause = ts.lastOrUndefined(caseBlock.clauses); @@ -53992,7 +56061,7 @@ var ts; return spanInNode(ts.lastOrUndefined(lastClause.statements)); } return undefined; - case 165 /* ObjectBindingPattern */: + case 166 /* 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); @@ -54008,7 +56077,7 @@ var ts; } function spanInCloseBracketToken(node) { switch (node.parent.kind) { - case 166 /* ArrayBindingPattern */: + case 167 /* 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); @@ -54023,12 +56092,12 @@ var ts; } } function spanInOpenParenToken(node) { - if (node.parent.kind === 201 /* DoStatement */ || - node.parent.kind === 172 /* CallExpression */ || - node.parent.kind === 173 /* NewExpression */) { + if (node.parent.kind === 203 /* DoStatement */ || + node.parent.kind === 173 /* CallExpression */ || + node.parent.kind === 174 /* NewExpression */) { return spanInPreviousNode(node); } - if (node.parent.kind === 176 /* ParenthesizedExpression */) { + if (node.parent.kind === 177 /* ParenthesizedExpression */) { return spanInNextNode(node); } // Default to parent node @@ -54037,21 +56106,21 @@ var ts; function spanInCloseParenToken(node) { // Is this close paren token of parameter list, set span in previous token switch (node.parent.kind) { - case 177 /* FunctionExpression */: - case 217 /* FunctionDeclaration */: - case 178 /* ArrowFunction */: - case 145 /* MethodDeclaration */: - case 144 /* MethodSignature */: - case 147 /* GetAccessor */: - case 148 /* SetAccessor */: - case 146 /* Constructor */: - case 202 /* WhileStatement */: - case 201 /* DoStatement */: - case 203 /* ForStatement */: - case 205 /* ForOfStatement */: - case 172 /* CallExpression */: - case 173 /* NewExpression */: - case 176 /* ParenthesizedExpression */: + case 178 /* FunctionExpression */: + case 219 /* FunctionDeclaration */: + case 179 /* ArrowFunction */: + case 146 /* MethodDeclaration */: + case 145 /* MethodSignature */: + case 148 /* GetAccessor */: + case 149 /* SetAccessor */: + case 147 /* Constructor */: + case 204 /* WhileStatement */: + case 203 /* DoStatement */: + case 205 /* ForStatement */: + case 207 /* ForOfStatement */: + case 173 /* CallExpression */: + case 174 /* NewExpression */: + case 177 /* ParenthesizedExpression */: return spanInPreviousNode(node); // Default to parent node default: @@ -54061,20 +56130,20 @@ var ts; function spanInColonToken(node) { // Is this : specifying return annotation of the function declaration if (ts.isFunctionLike(node.parent) || - node.parent.kind === 249 /* PropertyAssignment */ || - node.parent.kind === 140 /* Parameter */) { + node.parent.kind === 252 /* PropertyAssignment */ || + node.parent.kind === 141 /* Parameter */) { return spanInPreviousNode(node); } return spanInNode(node.parent); } function spanInGreaterThanOrLessThanToken(node) { - if (node.parent.kind === 175 /* TypeAssertionExpression */) { + if (node.parent.kind === 176 /* TypeAssertionExpression */) { return spanInNextNode(node); } return spanInNode(node.parent); } function spanInWhileKeyword(node) { - if (node.parent.kind === 201 /* DoStatement */) { + if (node.parent.kind === 203 /* DoStatement */) { // Set span on while expression return textSpanEndingAtNextToken(node, node.parent.expression); } @@ -54082,7 +56151,7 @@ var ts; return spanInNode(node.parent); } function spanInOfKeyword(node) { - if (node.parent.kind === 205 /* ForOfStatement */) { + if (node.parent.kind === 207 /* ForOfStatement */) { // set using next token return spanInNextNode(node); } @@ -54171,6 +56240,12 @@ var ts; if ("directoryExists" in this.shimHost) { this.directoryExists = function (directoryName) { return _this.shimHost.directoryExists(directoryName); }; } + if ("getTypeReferenceDirectiveResolutionsForFile" in this.shimHost) { + this.resolveTypeReferenceDirectives = function (typeDirectiveNames, containingFile) { + var typeDirectivesForFile = JSON.parse(_this.shimHost.getTypeReferenceDirectiveResolutionsForFile(containingFile)); + return ts.map(typeDirectiveNames, function (name) { return ts.lookUp(typeDirectivesForFile, name); }); + }; + } } LanguageServiceShimHostAdapter.prototype.log = function (s) { if (this.loggingEnabled) { @@ -54277,8 +56352,16 @@ var ts; this.directoryExists = function (directoryName) { return _this.shimHost.directoryExists(directoryName); }; } } - CoreServicesShimHostAdapter.prototype.readDirectory = function (rootDir, extension, exclude) { - var encoded = this.shimHost.readDirectory(rootDir, extension, JSON.stringify(exclude)); + CoreServicesShimHostAdapter.prototype.readDirectory = function (rootDir, extension, exclude, depth) { + // Wrap the API changes for 2.0 release. This try/catch + // should be removed once TypeScript 2.0 has shipped. + var encoded; + try { + encoded = this.shimHost.readDirectory(rootDir, extension, JSON.stringify(exclude), depth); + } + catch (e) { + encoded = this.shimHost.readDirectory(rootDir, extension, JSON.stringify(exclude)); + } return JSON.parse(encoded); }; CoreServicesShimHostAdapter.prototype.fileExists = function (fileName) { @@ -54525,7 +56608,7 @@ var ts; var _this = this; return this.forwardJSONCall("getDocumentHighlights('" + fileName + "', " + position + ")", function () { var results = _this.languageService.getDocumentHighlights(fileName, position, JSON.parse(filesToSearch)); - // workaround for VS document higlighting issue - keep only items from the initial file + // workaround for VS document highlighting issue - keep only items from the initial file var normalizedName = ts.normalizeSlashes(fileName).toLowerCase(); return ts.filter(results, function (r) { return ts.normalizeSlashes(r.fileName).toLowerCase() === normalizedName; }); }); @@ -54646,33 +56729,47 @@ var ts; }; }); }; + CoreServicesShimObject.prototype.resolveTypeReferenceDirective = function (fileName, typeReferenceDirective, compilerOptionsJson) { + var _this = this; + return this.forwardJSONCall("resolveTypeReferenceDirective(" + fileName + ")", function () { + var compilerOptions = JSON.parse(compilerOptionsJson); + var result = ts.resolveTypeReferenceDirective(typeReferenceDirective, ts.normalizeSlashes(fileName), compilerOptions, _this.host); + return { + resolvedFileName: result.resolvedTypeReferenceDirective ? result.resolvedTypeReferenceDirective.resolvedFileName : undefined, + primary: result.resolvedTypeReferenceDirective ? result.resolvedTypeReferenceDirective.primary : true, + failedLookupLocations: result.failedLookupLocations + }; + }); + }; CoreServicesShimObject.prototype.getPreProcessedFileInfo = function (fileName, sourceTextSnapshot) { + var _this = this; return this.forwardJSONCall("getPreProcessedFileInfo('" + fileName + "')", function () { // for now treat files as JavaScript var result = ts.preProcessFile(sourceTextSnapshot.getText(0, sourceTextSnapshot.getLength()), /* readImportFiles */ true, /* detectJavaScriptImports */ true); - var convertResult = { - referencedFiles: [], - importedFiles: [], + return { + referencedFiles: _this.convertFileReferences(result.referencedFiles), + importedFiles: _this.convertFileReferences(result.importedFiles), ambientExternalModules: result.ambientExternalModules, - isLibFile: result.isLibFile + isLibFile: result.isLibFile, + typeReferenceDirectives: _this.convertFileReferences(result.typeReferenceDirectives) }; - ts.forEach(result.referencedFiles, function (refFile) { - convertResult.referencedFiles.push({ - path: ts.normalizePath(refFile.fileName), - position: refFile.pos, - length: refFile.end - refFile.pos - }); - }); - ts.forEach(result.importedFiles, function (importedFile) { - convertResult.importedFiles.push({ - path: ts.normalizeSlashes(importedFile.fileName), - position: importedFile.pos, - length: importedFile.end - importedFile.pos - }); - }); - return convertResult; }); }; + CoreServicesShimObject.prototype.convertFileReferences = function (refs) { + if (!refs) { + return undefined; + } + var result = []; + for (var _i = 0, refs_2 = refs; _i < refs_2.length; _i++) { + var ref = refs_2[_i]; + result.push({ + path: ts.normalizeSlashes(ref.fileName), + position: ref.pos, + length: ref.end - ref.pos + }); + } + return result; + }; CoreServicesShimObject.prototype.getTSConfigFileInfo = function (fileName, sourceTextSnapshot) { var _this = this; return this.forwardJSONCall("getTSConfigFileInfo('" + fileName + "')", function () { @@ -54681,6 +56778,7 @@ var ts; if (result.error) { return { options: {}, + typingOptions: {}, files: [], errors: [realizeDiagnostic(result.error, "\r\n")] }; @@ -54689,6 +56787,7 @@ var ts; var configFile = ts.parseJsonConfigFileContent(result.config, _this.host, ts.getDirectoryPath(normalizedFileName), /*existingOptions*/ {}, normalizedFileName); return { options: configFile.options, + typingOptions: configFile.typingOptions, files: configFile.fileNames, errors: realizeDiagnostics(configFile.errors, "\r\n") }; @@ -54697,6 +56796,14 @@ var ts; CoreServicesShimObject.prototype.getDefaultCompilationSettings = function () { return this.forwardJSONCall("getDefaultCompilationSettings()", function () { return ts.getDefaultCompilerOptions(); }); }; + CoreServicesShimObject.prototype.discoverTypings = function (discoverTypingsJson) { + var _this = this; + 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 CoreServicesShimObject; }(ShimBase)); var TypeScriptServicesFactory = (function () { diff --git a/lib/typescriptServices.d.ts b/lib/typescriptServices.d.ts index 2824742c63b..c5e72bdbbbf 100644 --- a/lib/typescriptServices.d.ts +++ b/lib/typescriptServices.d.ts @@ -167,163 +167,166 @@ declare namespace ts { StringKeyword = 131, SymbolKeyword = 132, TypeKeyword = 133, - FromKeyword = 134, - GlobalKeyword = 135, - OfKeyword = 136, - QualifiedName = 137, - ComputedPropertyName = 138, - TypeParameter = 139, - Parameter = 140, - Decorator = 141, - PropertySignature = 142, - PropertyDeclaration = 143, - MethodSignature = 144, - MethodDeclaration = 145, - Constructor = 146, - GetAccessor = 147, - SetAccessor = 148, - CallSignature = 149, - ConstructSignature = 150, - IndexSignature = 151, - TypePredicate = 152, - TypeReference = 153, - FunctionType = 154, - ConstructorType = 155, - TypeQuery = 156, - TypeLiteral = 157, - ArrayType = 158, - TupleType = 159, - UnionType = 160, - IntersectionType = 161, - ParenthesizedType = 162, - ThisType = 163, - StringLiteralType = 164, - ObjectBindingPattern = 165, - ArrayBindingPattern = 166, - BindingElement = 167, - ArrayLiteralExpression = 168, - ObjectLiteralExpression = 169, - PropertyAccessExpression = 170, - ElementAccessExpression = 171, - CallExpression = 172, - NewExpression = 173, - TaggedTemplateExpression = 174, - TypeAssertionExpression = 175, - ParenthesizedExpression = 176, - FunctionExpression = 177, - ArrowFunction = 178, - DeleteExpression = 179, - TypeOfExpression = 180, - VoidExpression = 181, - AwaitExpression = 182, - PrefixUnaryExpression = 183, - PostfixUnaryExpression = 184, - BinaryExpression = 185, - ConditionalExpression = 186, - TemplateExpression = 187, - YieldExpression = 188, - SpreadElementExpression = 189, - ClassExpression = 190, - OmittedExpression = 191, - ExpressionWithTypeArguments = 192, - AsExpression = 193, - TemplateSpan = 194, - SemicolonClassElement = 195, - Block = 196, - VariableStatement = 197, - EmptyStatement = 198, - ExpressionStatement = 199, - IfStatement = 200, - DoStatement = 201, - WhileStatement = 202, - ForStatement = 203, - ForInStatement = 204, - ForOfStatement = 205, - ContinueStatement = 206, - BreakStatement = 207, - ReturnStatement = 208, - WithStatement = 209, - SwitchStatement = 210, - LabeledStatement = 211, - ThrowStatement = 212, - TryStatement = 213, - DebuggerStatement = 214, - VariableDeclaration = 215, - VariableDeclarationList = 216, - FunctionDeclaration = 217, - ClassDeclaration = 218, - InterfaceDeclaration = 219, - TypeAliasDeclaration = 220, - EnumDeclaration = 221, - ModuleDeclaration = 222, - ModuleBlock = 223, - CaseBlock = 224, - ImportEqualsDeclaration = 225, - ImportDeclaration = 226, - ImportClause = 227, - NamespaceImport = 228, - NamedImports = 229, - ImportSpecifier = 230, - ExportAssignment = 231, - ExportDeclaration = 232, - NamedExports = 233, - ExportSpecifier = 234, - MissingDeclaration = 235, - ExternalModuleReference = 236, - JsxElement = 237, - JsxSelfClosingElement = 238, - JsxOpeningElement = 239, - JsxText = 240, - JsxClosingElement = 241, - JsxAttribute = 242, - JsxSpreadAttribute = 243, - JsxExpression = 244, - CaseClause = 245, - DefaultClause = 246, - HeritageClause = 247, - CatchClause = 248, - PropertyAssignment = 249, - ShorthandPropertyAssignment = 250, - EnumMember = 251, - SourceFile = 252, - JSDocTypeExpression = 253, - JSDocAllType = 254, - JSDocUnknownType = 255, - JSDocArrayType = 256, - JSDocUnionType = 257, - JSDocTupleType = 258, - JSDocNullableType = 259, - JSDocNonNullableType = 260, - JSDocRecordType = 261, - JSDocRecordMember = 262, - JSDocTypeReference = 263, - JSDocOptionalType = 264, - JSDocFunctionType = 265, - JSDocVariadicType = 266, - JSDocConstructorType = 267, - JSDocThisType = 268, - JSDocComment = 269, - JSDocTag = 270, - JSDocParameterTag = 271, - JSDocReturnTag = 272, - JSDocTypeTag = 273, - JSDocTemplateTag = 274, - SyntaxList = 275, - Count = 276, + UndefinedKeyword = 134, + FromKeyword = 135, + GlobalKeyword = 136, + OfKeyword = 137, + QualifiedName = 138, + ComputedPropertyName = 139, + TypeParameter = 140, + Parameter = 141, + Decorator = 142, + PropertySignature = 143, + PropertyDeclaration = 144, + MethodSignature = 145, + MethodDeclaration = 146, + Constructor = 147, + GetAccessor = 148, + SetAccessor = 149, + CallSignature = 150, + ConstructSignature = 151, + IndexSignature = 152, + TypePredicate = 153, + TypeReference = 154, + FunctionType = 155, + ConstructorType = 156, + TypeQuery = 157, + TypeLiteral = 158, + ArrayType = 159, + TupleType = 160, + UnionType = 161, + IntersectionType = 162, + ParenthesizedType = 163, + ThisType = 164, + StringLiteralType = 165, + ObjectBindingPattern = 166, + ArrayBindingPattern = 167, + BindingElement = 168, + ArrayLiteralExpression = 169, + ObjectLiteralExpression = 170, + PropertyAccessExpression = 171, + ElementAccessExpression = 172, + CallExpression = 173, + NewExpression = 174, + TaggedTemplateExpression = 175, + TypeAssertionExpression = 176, + ParenthesizedExpression = 177, + FunctionExpression = 178, + ArrowFunction = 179, + DeleteExpression = 180, + TypeOfExpression = 181, + VoidExpression = 182, + AwaitExpression = 183, + PrefixUnaryExpression = 184, + PostfixUnaryExpression = 185, + BinaryExpression = 186, + ConditionalExpression = 187, + TemplateExpression = 188, + YieldExpression = 189, + SpreadElementExpression = 190, + ClassExpression = 191, + OmittedExpression = 192, + ExpressionWithTypeArguments = 193, + AsExpression = 194, + NonNullExpression = 195, + TemplateSpan = 196, + SemicolonClassElement = 197, + Block = 198, + VariableStatement = 199, + EmptyStatement = 200, + ExpressionStatement = 201, + IfStatement = 202, + DoStatement = 203, + WhileStatement = 204, + ForStatement = 205, + ForInStatement = 206, + ForOfStatement = 207, + ContinueStatement = 208, + BreakStatement = 209, + ReturnStatement = 210, + WithStatement = 211, + SwitchStatement = 212, + LabeledStatement = 213, + ThrowStatement = 214, + TryStatement = 215, + DebuggerStatement = 216, + VariableDeclaration = 217, + VariableDeclarationList = 218, + FunctionDeclaration = 219, + ClassDeclaration = 220, + InterfaceDeclaration = 221, + TypeAliasDeclaration = 222, + EnumDeclaration = 223, + ModuleDeclaration = 224, + ModuleBlock = 225, + CaseBlock = 226, + GlobalModuleExportDeclaration = 227, + ImportEqualsDeclaration = 228, + ImportDeclaration = 229, + ImportClause = 230, + NamespaceImport = 231, + NamedImports = 232, + ImportSpecifier = 233, + ExportAssignment = 234, + ExportDeclaration = 235, + NamedExports = 236, + ExportSpecifier = 237, + MissingDeclaration = 238, + ExternalModuleReference = 239, + JsxElement = 240, + JsxSelfClosingElement = 241, + JsxOpeningElement = 242, + JsxText = 243, + JsxClosingElement = 244, + JsxAttribute = 245, + JsxSpreadAttribute = 246, + JsxExpression = 247, + CaseClause = 248, + DefaultClause = 249, + HeritageClause = 250, + CatchClause = 251, + PropertyAssignment = 252, + ShorthandPropertyAssignment = 253, + EnumMember = 254, + SourceFile = 255, + JSDocTypeExpression = 256, + JSDocAllType = 257, + JSDocUnknownType = 258, + JSDocArrayType = 259, + JSDocUnionType = 260, + JSDocTupleType = 261, + JSDocNullableType = 262, + JSDocNonNullableType = 263, + JSDocRecordType = 264, + JSDocRecordMember = 265, + JSDocTypeReference = 266, + JSDocOptionalType = 267, + JSDocFunctionType = 268, + JSDocVariadicType = 269, + JSDocConstructorType = 270, + JSDocThisType = 271, + JSDocComment = 272, + JSDocTag = 273, + JSDocParameterTag = 274, + JSDocReturnTag = 275, + JSDocTypeTag = 276, + JSDocTemplateTag = 277, + SyntaxList = 278, + Count = 279, FirstAssignment = 56, LastAssignment = 68, FirstReservedWord = 70, LastReservedWord = 105, FirstKeyword = 70, - LastKeyword = 136, + LastKeyword = 137, FirstFutureReservedWord = 106, LastFutureReservedWord = 114, - FirstTypeNode = 152, - LastTypeNode = 164, + FirstTypeNode = 153, + LastTypeNode = 165, FirstPunctuation = 15, LastPunctuation = 68, FirstToken = 0, - LastToken = 136, + LastToken = 137, FirstTriviaToken = 2, LastTriviaToken = 7, FirstLiteralToken = 8, @@ -332,7 +335,7 @@ declare namespace ts { LastTemplateToken = 14, FirstBinaryOperator = 25, LastBinaryOperator = 68, - FirstNode = 137, + FirstNode = 138, } enum NodeFlags { None = 0, @@ -366,12 +369,13 @@ declare namespace ts { JavaScriptFile = 134217728, ThisNodeOrAnySubNodesHasError = 268435456, HasAggregatedChildData = 536870912, + HasJsxSpreadAttribute = 1073741824, Modifier = 959, AccessibilityModifier = 28, BlockScoped = 3072, ReachabilityCheckFlags = 98304, EmitHelperFlags = 3932160, - ContextFlags = 62914560, + ContextFlags = 197132288, TypeExcludesFlags = 41943040, } enum JsxFlags { @@ -401,6 +405,9 @@ declare namespace ts { text: string; originalKeywordKind?: SyntaxKind; } + interface TransientIdentifier extends Identifier { + resolvedSymbol: Symbol; + } interface QualifiedName extends Node { left: EntityName; right: Identifier; @@ -702,6 +709,7 @@ declare namespace ts { dotToken: Node; name: Identifier; } + type IdentifierOrPropertyAccess = Identifier | PropertyAccessExpression; interface ElementAccessExpression extends MemberExpression { expression: LeftHandSideExpression; argumentExpression?: Expression; @@ -731,6 +739,9 @@ declare namespace ts { expression: UnaryExpression; } type AssertionExpression = TypeAssertion | AsExpression; + interface NonNullExpression extends LeftHandSideExpression { + expression: Expression; + } interface JsxElement extends PrimaryExpression { openingElement: JsxOpeningElement; children: NodeArray; @@ -854,6 +865,7 @@ declare namespace ts { variableDeclaration: VariableDeclaration; block: Block; } + type DeclarationWithTypeParameters = SignatureDeclaration | ClassLikeDeclaration | InterfaceDeclaration | TypeAliasDeclaration; interface ClassLikeDeclaration extends Declaration { name?: Identifier; typeParameters?: NodeArray; @@ -923,6 +935,10 @@ declare namespace ts { interface NamespaceImport extends Declaration { name: Identifier; } + interface GlobalModuleExportDeclaration extends DeclarationStatement { + name: Identifier; + moduleReference: LiteralLikeNode; + } interface ExportDeclaration extends DeclarationStatement { exportClause?: NamedExports; moduleSpecifier?: Expression; @@ -1044,6 +1060,7 @@ declare namespace ts { amdDependencies: AmdDependency[]; moduleName: string; referencedFiles: FileReference[]; + typeReferenceDirectives: FileReference[]; languageVariant: LanguageVariant; isDeclarationFile: boolean; /** @@ -1066,7 +1083,7 @@ declare namespace ts { readDirectory(rootDir: string, extension: string, exclude: string[]): string[]; } interface WriteFileCallback { - (fileName: string, data: string, writeByteOrderMark: boolean, onError?: (message: string) => void): void; + (fileName: string, data: string, writeByteOrderMark: boolean, onError?: (message: string) => void, sourceFiles?: SourceFile[]): void; } class OperationCanceledException { } @@ -1141,6 +1158,7 @@ declare namespace ts { emitSkipped: boolean; /** Contains declaration emit diagnostics */ diagnostics: Diagnostic[]; + emittedFiles: string[]; } interface TypeChecker { getTypeOfSymbolAtLocation(symbol: Symbol, node: Node): Type; @@ -1186,7 +1204,7 @@ declare namespace ts { buildTypeParameterDisplay(tp: TypeParameter, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void; buildTypePredicateDisplay(predicate: TypePredicate, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void; buildTypeParameterDisplayFromSymbol(symbol: Symbol, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void; - buildDisplayForParametersAndDelimiters(parameters: Symbol[], writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void; + buildDisplayForParametersAndDelimiters(thisType: Type, parameters: Symbol[], writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void; buildDisplayForTypeParametersAndDelimiters(typeParameters: TypeParameter[], writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void; buildReturnTypeDisplay(signature: Signature, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void; } @@ -1310,6 +1328,7 @@ declare namespace ts { valueDeclaration?: Declaration; members?: SymbolTable; exports?: SymbolTable; + globalExports?: SymbolTable; } interface SymbolTable { [index: string]: Symbol; @@ -1394,6 +1413,7 @@ declare namespace ts { declaration: SignatureDeclaration; typeParameters: TypeParameter[]; parameters: Symbol[]; + thisType?: Type; } enum IndexKind { String = 0, @@ -1442,10 +1462,12 @@ declare namespace ts { type RootPaths = string[]; type PathSubstitutions = Map; type TsConfigOnlyOptions = RootPaths | PathSubstitutions; + type CompilerOptionsValue = string | number | boolean | (string | number)[] | TsConfigOnlyOptions; interface CompilerOptions { allowNonTsExtensions?: boolean; charset?: string; declaration?: boolean; + declarationDir?: string; diagnostics?: boolean; emitBOM?: boolean; help?: boolean; @@ -1455,6 +1477,7 @@ declare namespace ts { jsx?: JsxEmit; reactNamespace?: string; listFiles?: boolean; + typesSearchPaths?: string[]; locale?: string; mapRoot?: string; module?: ModuleKind; @@ -1464,6 +1487,7 @@ declare namespace ts { noEmitOnError?: boolean; noErrorTruncation?: boolean; noImplicitAny?: boolean; + noImplicitThis?: boolean; noLib?: boolean; noResolve?: boolean; out?: string; @@ -1492,11 +1516,30 @@ declare namespace ts { baseUrl?: string; paths?: PathSubstitutions; rootDirs?: RootPaths; - traceModuleResolution?: boolean; + traceResolution?: boolean; allowSyntheticDefaultImports?: boolean; allowJs?: boolean; noImplicitUseStrict?: boolean; - [option: string]: string | number | boolean | TsConfigOnlyOptions; + strictNullChecks?: boolean; + listEmittedFiles?: boolean; + lib?: string[]; + types?: string[]; + list?: string[]; + [option: string]: CompilerOptionsValue; + } + interface TypingOptions { + enableAutoDiscovery?: boolean; + include?: string[]; + exclude?: string[]; + [option: string]: string[] | boolean; + } + interface DiscoverTypingsInfo { + fileNames: string[]; + projectRootPath: string; + safeListPath: string; + packageNameToTypingLocation: Map; + typingOptions: TypingOptions; + compilerOptions: CompilerOptions; } enum ModuleKind { None = 0, @@ -1540,6 +1583,7 @@ declare namespace ts { } interface ParsedCommandLine { options: CompilerOptions; + typingOptions?: TypingOptions; fileNames: string[]; errors: Diagnostic[]; } @@ -1557,16 +1601,29 @@ declare namespace ts { resolvedModule: ResolvedModule; failedLookupLocations: string[]; } + interface ResolvedTypeReferenceDirective { + primary: boolean; + resolvedFileName?: string; + } + interface ResolvedTypeReferenceDirectiveWithFailedLookupLocations { + resolvedTypeReferenceDirective: ResolvedTypeReferenceDirective; + failedLookupLocations: string[]; + } interface CompilerHost extends ModuleResolutionHost { getSourceFile(fileName: string, languageVersion: ScriptTarget, onError?: (message: string) => void): SourceFile; getCancellationToken?(): CancellationToken; getDefaultLibFileName(options: CompilerOptions): string; + getDefaultLibLocation?(): string; writeFile: WriteFileCallback; getCurrentDirectory(): string; getCanonicalFileName(fileName: string): string; useCaseSensitiveFileNames(): boolean; getNewLine(): string; resolveModuleNames?(moduleNames: string[], containingFile: string): ResolvedModule[]; + /** + * 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[]; } interface TextSpan { start: number; @@ -1578,8 +1635,8 @@ declare namespace ts { } } declare namespace ts { - type FileWatcherCallback = (path: string, removed?: boolean) => void; - type DirectoryWatcherCallback = (path: string) => void; + type FileWatcherCallback = (fileName: string, removed?: boolean) => void; + type DirectoryWatcherCallback = (directoryName: string) => void; interface System { args: string[]; newLine: string; @@ -1587,7 +1644,7 @@ declare namespace ts { write(s: string): void; readFile(path: string, encoding?: string): string; writeFile(path: string, data: string, writeByteOrderMark?: boolean): void; - watchFile?(path: Path, callback: FileWatcherCallback): FileWatcher; + watchFile?(path: string, callback: FileWatcherCallback): FileWatcher; watchDirectory?(path: string, callback: DirectoryWatcherCallback, recursive?: boolean): FileWatcher; resolvePath(path: string): string; fileExists(path: string): boolean; @@ -1596,6 +1653,8 @@ declare namespace ts { getExecutingFilePath(): string; getCurrentDirectory(): string; readDirectory(path: string, extension?: string, exclude?: string[]): string[]; + getModifiedTime?(path: string): Date; + createHash?(data: string): string; getMemoryUsage?(): number; exit(exitCode?: number): void; } @@ -1603,7 +1662,7 @@ declare namespace ts { close(): void; } interface DirectoryWatcher extends FileWatcher { - directoryPath: Path; + directoryName: string; referenceCount: number; } var sys: System; @@ -1685,17 +1744,26 @@ declare namespace ts { function collapseTextChangeRangesAcrossMultipleVersions(changes: TextChangeRange[]): TextChangeRange; function getTypeParameterOwner(d: Declaration): Declaration; function isParameterPropertyDeclaration(node: ParameterDeclaration): boolean; + function startsWith(str: string, prefix: string): boolean; + function endsWith(str: string, suffix: string): boolean; } 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 isExternalModule(file: SourceFile): boolean; function updateSourceFile(sourceFile: SourceFile, newText: string, textChangeRange: TextChangeRange, aggressiveChecks?: boolean): SourceFile; } declare namespace ts { const version: string; function findConfigFile(searchPath: string, fileExists: (fileName: string) => boolean): string; function resolveTripleslashReference(moduleName: string, containingFile: string): string; + /** + * @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; @@ -1705,7 +1773,6 @@ declare namespace ts { 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 @@ -1735,6 +1802,10 @@ declare namespace ts { options: CompilerOptions; errors: Diagnostic[]; }; + function convertTypingOptionsFromJson(jsonOptions: any, basePath: string, configFileName?: string): { + options: CompilerOptions; + errors: Diagnostic[]; + }; } declare namespace ts { /** The version of the language service API */ @@ -1812,6 +1883,7 @@ declare namespace ts { } interface PreProcessedFileInfo { referencedFiles: FileReference[]; + typeReferenceDirectives: FileReference[]; importedFiles: FileReference[]; ambientExternalModules: string[]; isLibFile: boolean; @@ -1836,6 +1908,7 @@ declare namespace ts { error?(s: string): void; useCaseSensitiveFileNames?(): boolean; resolveModuleNames?(moduleNames: string[], containingFile: string): ResolvedModule[]; + resolveTypeReferenceDirectives?(typeDirectiveNames: string[], containingFile: string): ResolvedTypeReferenceDirective[]; directoryExists?(directoryName: string): boolean; } interface LanguageService { @@ -1880,7 +1953,6 @@ declare namespace ts { getDocCommentTemplateAtPosition(fileName: string, position: number): TextInsertion; getEmitOutput(fileName: string): EmitOutput; getProgram(): Program; - getSourceFile(fileName: string): SourceFile; dispose(): void; } interface Classifications { diff --git a/lib/typescriptServices.js b/lib/typescriptServices.js index 8dafad54257..f8b128defd8 100644 --- a/lib/typescriptServices.js +++ b/lib/typescriptServices.js @@ -168,184 +168,187 @@ var ts; SyntaxKind[SyntaxKind["StringKeyword"] = 131] = "StringKeyword"; SyntaxKind[SyntaxKind["SymbolKeyword"] = 132] = "SymbolKeyword"; SyntaxKind[SyntaxKind["TypeKeyword"] = 133] = "TypeKeyword"; - SyntaxKind[SyntaxKind["FromKeyword"] = 134] = "FromKeyword"; - SyntaxKind[SyntaxKind["GlobalKeyword"] = 135] = "GlobalKeyword"; - SyntaxKind[SyntaxKind["OfKeyword"] = 136] = "OfKeyword"; + SyntaxKind[SyntaxKind["UndefinedKeyword"] = 134] = "UndefinedKeyword"; + SyntaxKind[SyntaxKind["FromKeyword"] = 135] = "FromKeyword"; + SyntaxKind[SyntaxKind["GlobalKeyword"] = 136] = "GlobalKeyword"; + SyntaxKind[SyntaxKind["OfKeyword"] = 137] = "OfKeyword"; // Parse tree nodes // Names - SyntaxKind[SyntaxKind["QualifiedName"] = 137] = "QualifiedName"; - SyntaxKind[SyntaxKind["ComputedPropertyName"] = 138] = "ComputedPropertyName"; + SyntaxKind[SyntaxKind["QualifiedName"] = 138] = "QualifiedName"; + SyntaxKind[SyntaxKind["ComputedPropertyName"] = 139] = "ComputedPropertyName"; // Signature elements - SyntaxKind[SyntaxKind["TypeParameter"] = 139] = "TypeParameter"; - SyntaxKind[SyntaxKind["Parameter"] = 140] = "Parameter"; - SyntaxKind[SyntaxKind["Decorator"] = 141] = "Decorator"; + SyntaxKind[SyntaxKind["TypeParameter"] = 140] = "TypeParameter"; + SyntaxKind[SyntaxKind["Parameter"] = 141] = "Parameter"; + SyntaxKind[SyntaxKind["Decorator"] = 142] = "Decorator"; // TypeMember - SyntaxKind[SyntaxKind["PropertySignature"] = 142] = "PropertySignature"; - SyntaxKind[SyntaxKind["PropertyDeclaration"] = 143] = "PropertyDeclaration"; - SyntaxKind[SyntaxKind["MethodSignature"] = 144] = "MethodSignature"; - SyntaxKind[SyntaxKind["MethodDeclaration"] = 145] = "MethodDeclaration"; - SyntaxKind[SyntaxKind["Constructor"] = 146] = "Constructor"; - SyntaxKind[SyntaxKind["GetAccessor"] = 147] = "GetAccessor"; - SyntaxKind[SyntaxKind["SetAccessor"] = 148] = "SetAccessor"; - SyntaxKind[SyntaxKind["CallSignature"] = 149] = "CallSignature"; - SyntaxKind[SyntaxKind["ConstructSignature"] = 150] = "ConstructSignature"; - SyntaxKind[SyntaxKind["IndexSignature"] = 151] = "IndexSignature"; + SyntaxKind[SyntaxKind["PropertySignature"] = 143] = "PropertySignature"; + SyntaxKind[SyntaxKind["PropertyDeclaration"] = 144] = "PropertyDeclaration"; + SyntaxKind[SyntaxKind["MethodSignature"] = 145] = "MethodSignature"; + SyntaxKind[SyntaxKind["MethodDeclaration"] = 146] = "MethodDeclaration"; + SyntaxKind[SyntaxKind["Constructor"] = 147] = "Constructor"; + SyntaxKind[SyntaxKind["GetAccessor"] = 148] = "GetAccessor"; + SyntaxKind[SyntaxKind["SetAccessor"] = 149] = "SetAccessor"; + SyntaxKind[SyntaxKind["CallSignature"] = 150] = "CallSignature"; + SyntaxKind[SyntaxKind["ConstructSignature"] = 151] = "ConstructSignature"; + SyntaxKind[SyntaxKind["IndexSignature"] = 152] = "IndexSignature"; // Type - SyntaxKind[SyntaxKind["TypePredicate"] = 152] = "TypePredicate"; - SyntaxKind[SyntaxKind["TypeReference"] = 153] = "TypeReference"; - SyntaxKind[SyntaxKind["FunctionType"] = 154] = "FunctionType"; - SyntaxKind[SyntaxKind["ConstructorType"] = 155] = "ConstructorType"; - SyntaxKind[SyntaxKind["TypeQuery"] = 156] = "TypeQuery"; - SyntaxKind[SyntaxKind["TypeLiteral"] = 157] = "TypeLiteral"; - SyntaxKind[SyntaxKind["ArrayType"] = 158] = "ArrayType"; - SyntaxKind[SyntaxKind["TupleType"] = 159] = "TupleType"; - SyntaxKind[SyntaxKind["UnionType"] = 160] = "UnionType"; - SyntaxKind[SyntaxKind["IntersectionType"] = 161] = "IntersectionType"; - SyntaxKind[SyntaxKind["ParenthesizedType"] = 162] = "ParenthesizedType"; - SyntaxKind[SyntaxKind["ThisType"] = 163] = "ThisType"; - SyntaxKind[SyntaxKind["StringLiteralType"] = 164] = "StringLiteralType"; + SyntaxKind[SyntaxKind["TypePredicate"] = 153] = "TypePredicate"; + SyntaxKind[SyntaxKind["TypeReference"] = 154] = "TypeReference"; + SyntaxKind[SyntaxKind["FunctionType"] = 155] = "FunctionType"; + SyntaxKind[SyntaxKind["ConstructorType"] = 156] = "ConstructorType"; + SyntaxKind[SyntaxKind["TypeQuery"] = 157] = "TypeQuery"; + SyntaxKind[SyntaxKind["TypeLiteral"] = 158] = "TypeLiteral"; + SyntaxKind[SyntaxKind["ArrayType"] = 159] = "ArrayType"; + SyntaxKind[SyntaxKind["TupleType"] = 160] = "TupleType"; + SyntaxKind[SyntaxKind["UnionType"] = 161] = "UnionType"; + SyntaxKind[SyntaxKind["IntersectionType"] = 162] = "IntersectionType"; + SyntaxKind[SyntaxKind["ParenthesizedType"] = 163] = "ParenthesizedType"; + SyntaxKind[SyntaxKind["ThisType"] = 164] = "ThisType"; + SyntaxKind[SyntaxKind["StringLiteralType"] = 165] = "StringLiteralType"; // Binding patterns - SyntaxKind[SyntaxKind["ObjectBindingPattern"] = 165] = "ObjectBindingPattern"; - SyntaxKind[SyntaxKind["ArrayBindingPattern"] = 166] = "ArrayBindingPattern"; - SyntaxKind[SyntaxKind["BindingElement"] = 167] = "BindingElement"; + SyntaxKind[SyntaxKind["ObjectBindingPattern"] = 166] = "ObjectBindingPattern"; + SyntaxKind[SyntaxKind["ArrayBindingPattern"] = 167] = "ArrayBindingPattern"; + SyntaxKind[SyntaxKind["BindingElement"] = 168] = "BindingElement"; // Expression - SyntaxKind[SyntaxKind["ArrayLiteralExpression"] = 168] = "ArrayLiteralExpression"; - SyntaxKind[SyntaxKind["ObjectLiteralExpression"] = 169] = "ObjectLiteralExpression"; - SyntaxKind[SyntaxKind["PropertyAccessExpression"] = 170] = "PropertyAccessExpression"; - SyntaxKind[SyntaxKind["ElementAccessExpression"] = 171] = "ElementAccessExpression"; - SyntaxKind[SyntaxKind["CallExpression"] = 172] = "CallExpression"; - SyntaxKind[SyntaxKind["NewExpression"] = 173] = "NewExpression"; - SyntaxKind[SyntaxKind["TaggedTemplateExpression"] = 174] = "TaggedTemplateExpression"; - SyntaxKind[SyntaxKind["TypeAssertionExpression"] = 175] = "TypeAssertionExpression"; - SyntaxKind[SyntaxKind["ParenthesizedExpression"] = 176] = "ParenthesizedExpression"; - SyntaxKind[SyntaxKind["FunctionExpression"] = 177] = "FunctionExpression"; - SyntaxKind[SyntaxKind["ArrowFunction"] = 178] = "ArrowFunction"; - SyntaxKind[SyntaxKind["DeleteExpression"] = 179] = "DeleteExpression"; - SyntaxKind[SyntaxKind["TypeOfExpression"] = 180] = "TypeOfExpression"; - SyntaxKind[SyntaxKind["VoidExpression"] = 181] = "VoidExpression"; - SyntaxKind[SyntaxKind["AwaitExpression"] = 182] = "AwaitExpression"; - SyntaxKind[SyntaxKind["PrefixUnaryExpression"] = 183] = "PrefixUnaryExpression"; - SyntaxKind[SyntaxKind["PostfixUnaryExpression"] = 184] = "PostfixUnaryExpression"; - SyntaxKind[SyntaxKind["BinaryExpression"] = 185] = "BinaryExpression"; - SyntaxKind[SyntaxKind["ConditionalExpression"] = 186] = "ConditionalExpression"; - SyntaxKind[SyntaxKind["TemplateExpression"] = 187] = "TemplateExpression"; - SyntaxKind[SyntaxKind["YieldExpression"] = 188] = "YieldExpression"; - SyntaxKind[SyntaxKind["SpreadElementExpression"] = 189] = "SpreadElementExpression"; - SyntaxKind[SyntaxKind["ClassExpression"] = 190] = "ClassExpression"; - SyntaxKind[SyntaxKind["OmittedExpression"] = 191] = "OmittedExpression"; - SyntaxKind[SyntaxKind["ExpressionWithTypeArguments"] = 192] = "ExpressionWithTypeArguments"; - SyntaxKind[SyntaxKind["AsExpression"] = 193] = "AsExpression"; + SyntaxKind[SyntaxKind["ArrayLiteralExpression"] = 169] = "ArrayLiteralExpression"; + SyntaxKind[SyntaxKind["ObjectLiteralExpression"] = 170] = "ObjectLiteralExpression"; + SyntaxKind[SyntaxKind["PropertyAccessExpression"] = 171] = "PropertyAccessExpression"; + SyntaxKind[SyntaxKind["ElementAccessExpression"] = 172] = "ElementAccessExpression"; + SyntaxKind[SyntaxKind["CallExpression"] = 173] = "CallExpression"; + SyntaxKind[SyntaxKind["NewExpression"] = 174] = "NewExpression"; + SyntaxKind[SyntaxKind["TaggedTemplateExpression"] = 175] = "TaggedTemplateExpression"; + SyntaxKind[SyntaxKind["TypeAssertionExpression"] = 176] = "TypeAssertionExpression"; + SyntaxKind[SyntaxKind["ParenthesizedExpression"] = 177] = "ParenthesizedExpression"; + SyntaxKind[SyntaxKind["FunctionExpression"] = 178] = "FunctionExpression"; + SyntaxKind[SyntaxKind["ArrowFunction"] = 179] = "ArrowFunction"; + SyntaxKind[SyntaxKind["DeleteExpression"] = 180] = "DeleteExpression"; + SyntaxKind[SyntaxKind["TypeOfExpression"] = 181] = "TypeOfExpression"; + SyntaxKind[SyntaxKind["VoidExpression"] = 182] = "VoidExpression"; + SyntaxKind[SyntaxKind["AwaitExpression"] = 183] = "AwaitExpression"; + SyntaxKind[SyntaxKind["PrefixUnaryExpression"] = 184] = "PrefixUnaryExpression"; + SyntaxKind[SyntaxKind["PostfixUnaryExpression"] = 185] = "PostfixUnaryExpression"; + SyntaxKind[SyntaxKind["BinaryExpression"] = 186] = "BinaryExpression"; + SyntaxKind[SyntaxKind["ConditionalExpression"] = 187] = "ConditionalExpression"; + SyntaxKind[SyntaxKind["TemplateExpression"] = 188] = "TemplateExpression"; + SyntaxKind[SyntaxKind["YieldExpression"] = 189] = "YieldExpression"; + SyntaxKind[SyntaxKind["SpreadElementExpression"] = 190] = "SpreadElementExpression"; + SyntaxKind[SyntaxKind["ClassExpression"] = 191] = "ClassExpression"; + SyntaxKind[SyntaxKind["OmittedExpression"] = 192] = "OmittedExpression"; + SyntaxKind[SyntaxKind["ExpressionWithTypeArguments"] = 193] = "ExpressionWithTypeArguments"; + SyntaxKind[SyntaxKind["AsExpression"] = 194] = "AsExpression"; + SyntaxKind[SyntaxKind["NonNullExpression"] = 195] = "NonNullExpression"; // Misc - SyntaxKind[SyntaxKind["TemplateSpan"] = 194] = "TemplateSpan"; - SyntaxKind[SyntaxKind["SemicolonClassElement"] = 195] = "SemicolonClassElement"; + SyntaxKind[SyntaxKind["TemplateSpan"] = 196] = "TemplateSpan"; + SyntaxKind[SyntaxKind["SemicolonClassElement"] = 197] = "SemicolonClassElement"; // Element - SyntaxKind[SyntaxKind["Block"] = 196] = "Block"; - SyntaxKind[SyntaxKind["VariableStatement"] = 197] = "VariableStatement"; - SyntaxKind[SyntaxKind["EmptyStatement"] = 198] = "EmptyStatement"; - SyntaxKind[SyntaxKind["ExpressionStatement"] = 199] = "ExpressionStatement"; - SyntaxKind[SyntaxKind["IfStatement"] = 200] = "IfStatement"; - SyntaxKind[SyntaxKind["DoStatement"] = 201] = "DoStatement"; - SyntaxKind[SyntaxKind["WhileStatement"] = 202] = "WhileStatement"; - SyntaxKind[SyntaxKind["ForStatement"] = 203] = "ForStatement"; - SyntaxKind[SyntaxKind["ForInStatement"] = 204] = "ForInStatement"; - SyntaxKind[SyntaxKind["ForOfStatement"] = 205] = "ForOfStatement"; - SyntaxKind[SyntaxKind["ContinueStatement"] = 206] = "ContinueStatement"; - SyntaxKind[SyntaxKind["BreakStatement"] = 207] = "BreakStatement"; - SyntaxKind[SyntaxKind["ReturnStatement"] = 208] = "ReturnStatement"; - SyntaxKind[SyntaxKind["WithStatement"] = 209] = "WithStatement"; - SyntaxKind[SyntaxKind["SwitchStatement"] = 210] = "SwitchStatement"; - SyntaxKind[SyntaxKind["LabeledStatement"] = 211] = "LabeledStatement"; - SyntaxKind[SyntaxKind["ThrowStatement"] = 212] = "ThrowStatement"; - SyntaxKind[SyntaxKind["TryStatement"] = 213] = "TryStatement"; - SyntaxKind[SyntaxKind["DebuggerStatement"] = 214] = "DebuggerStatement"; - SyntaxKind[SyntaxKind["VariableDeclaration"] = 215] = "VariableDeclaration"; - SyntaxKind[SyntaxKind["VariableDeclarationList"] = 216] = "VariableDeclarationList"; - SyntaxKind[SyntaxKind["FunctionDeclaration"] = 217] = "FunctionDeclaration"; - SyntaxKind[SyntaxKind["ClassDeclaration"] = 218] = "ClassDeclaration"; - SyntaxKind[SyntaxKind["InterfaceDeclaration"] = 219] = "InterfaceDeclaration"; - SyntaxKind[SyntaxKind["TypeAliasDeclaration"] = 220] = "TypeAliasDeclaration"; - SyntaxKind[SyntaxKind["EnumDeclaration"] = 221] = "EnumDeclaration"; - SyntaxKind[SyntaxKind["ModuleDeclaration"] = 222] = "ModuleDeclaration"; - SyntaxKind[SyntaxKind["ModuleBlock"] = 223] = "ModuleBlock"; - SyntaxKind[SyntaxKind["CaseBlock"] = 224] = "CaseBlock"; - SyntaxKind[SyntaxKind["ImportEqualsDeclaration"] = 225] = "ImportEqualsDeclaration"; - SyntaxKind[SyntaxKind["ImportDeclaration"] = 226] = "ImportDeclaration"; - SyntaxKind[SyntaxKind["ImportClause"] = 227] = "ImportClause"; - SyntaxKind[SyntaxKind["NamespaceImport"] = 228] = "NamespaceImport"; - SyntaxKind[SyntaxKind["NamedImports"] = 229] = "NamedImports"; - SyntaxKind[SyntaxKind["ImportSpecifier"] = 230] = "ImportSpecifier"; - SyntaxKind[SyntaxKind["ExportAssignment"] = 231] = "ExportAssignment"; - SyntaxKind[SyntaxKind["ExportDeclaration"] = 232] = "ExportDeclaration"; - SyntaxKind[SyntaxKind["NamedExports"] = 233] = "NamedExports"; - SyntaxKind[SyntaxKind["ExportSpecifier"] = 234] = "ExportSpecifier"; - SyntaxKind[SyntaxKind["MissingDeclaration"] = 235] = "MissingDeclaration"; + SyntaxKind[SyntaxKind["Block"] = 198] = "Block"; + SyntaxKind[SyntaxKind["VariableStatement"] = 199] = "VariableStatement"; + SyntaxKind[SyntaxKind["EmptyStatement"] = 200] = "EmptyStatement"; + SyntaxKind[SyntaxKind["ExpressionStatement"] = 201] = "ExpressionStatement"; + SyntaxKind[SyntaxKind["IfStatement"] = 202] = "IfStatement"; + SyntaxKind[SyntaxKind["DoStatement"] = 203] = "DoStatement"; + SyntaxKind[SyntaxKind["WhileStatement"] = 204] = "WhileStatement"; + SyntaxKind[SyntaxKind["ForStatement"] = 205] = "ForStatement"; + SyntaxKind[SyntaxKind["ForInStatement"] = 206] = "ForInStatement"; + SyntaxKind[SyntaxKind["ForOfStatement"] = 207] = "ForOfStatement"; + SyntaxKind[SyntaxKind["ContinueStatement"] = 208] = "ContinueStatement"; + SyntaxKind[SyntaxKind["BreakStatement"] = 209] = "BreakStatement"; + SyntaxKind[SyntaxKind["ReturnStatement"] = 210] = "ReturnStatement"; + SyntaxKind[SyntaxKind["WithStatement"] = 211] = "WithStatement"; + SyntaxKind[SyntaxKind["SwitchStatement"] = 212] = "SwitchStatement"; + SyntaxKind[SyntaxKind["LabeledStatement"] = 213] = "LabeledStatement"; + SyntaxKind[SyntaxKind["ThrowStatement"] = 214] = "ThrowStatement"; + SyntaxKind[SyntaxKind["TryStatement"] = 215] = "TryStatement"; + SyntaxKind[SyntaxKind["DebuggerStatement"] = 216] = "DebuggerStatement"; + SyntaxKind[SyntaxKind["VariableDeclaration"] = 217] = "VariableDeclaration"; + SyntaxKind[SyntaxKind["VariableDeclarationList"] = 218] = "VariableDeclarationList"; + SyntaxKind[SyntaxKind["FunctionDeclaration"] = 219] = "FunctionDeclaration"; + SyntaxKind[SyntaxKind["ClassDeclaration"] = 220] = "ClassDeclaration"; + SyntaxKind[SyntaxKind["InterfaceDeclaration"] = 221] = "InterfaceDeclaration"; + SyntaxKind[SyntaxKind["TypeAliasDeclaration"] = 222] = "TypeAliasDeclaration"; + SyntaxKind[SyntaxKind["EnumDeclaration"] = 223] = "EnumDeclaration"; + SyntaxKind[SyntaxKind["ModuleDeclaration"] = 224] = "ModuleDeclaration"; + SyntaxKind[SyntaxKind["ModuleBlock"] = 225] = "ModuleBlock"; + SyntaxKind[SyntaxKind["CaseBlock"] = 226] = "CaseBlock"; + SyntaxKind[SyntaxKind["GlobalModuleExportDeclaration"] = 227] = "GlobalModuleExportDeclaration"; + SyntaxKind[SyntaxKind["ImportEqualsDeclaration"] = 228] = "ImportEqualsDeclaration"; + SyntaxKind[SyntaxKind["ImportDeclaration"] = 229] = "ImportDeclaration"; + SyntaxKind[SyntaxKind["ImportClause"] = 230] = "ImportClause"; + SyntaxKind[SyntaxKind["NamespaceImport"] = 231] = "NamespaceImport"; + SyntaxKind[SyntaxKind["NamedImports"] = 232] = "NamedImports"; + SyntaxKind[SyntaxKind["ImportSpecifier"] = 233] = "ImportSpecifier"; + SyntaxKind[SyntaxKind["ExportAssignment"] = 234] = "ExportAssignment"; + SyntaxKind[SyntaxKind["ExportDeclaration"] = 235] = "ExportDeclaration"; + SyntaxKind[SyntaxKind["NamedExports"] = 236] = "NamedExports"; + SyntaxKind[SyntaxKind["ExportSpecifier"] = 237] = "ExportSpecifier"; + SyntaxKind[SyntaxKind["MissingDeclaration"] = 238] = "MissingDeclaration"; // Module references - SyntaxKind[SyntaxKind["ExternalModuleReference"] = 236] = "ExternalModuleReference"; + SyntaxKind[SyntaxKind["ExternalModuleReference"] = 239] = "ExternalModuleReference"; // JSX - SyntaxKind[SyntaxKind["JsxElement"] = 237] = "JsxElement"; - SyntaxKind[SyntaxKind["JsxSelfClosingElement"] = 238] = "JsxSelfClosingElement"; - SyntaxKind[SyntaxKind["JsxOpeningElement"] = 239] = "JsxOpeningElement"; - SyntaxKind[SyntaxKind["JsxText"] = 240] = "JsxText"; - SyntaxKind[SyntaxKind["JsxClosingElement"] = 241] = "JsxClosingElement"; - SyntaxKind[SyntaxKind["JsxAttribute"] = 242] = "JsxAttribute"; - SyntaxKind[SyntaxKind["JsxSpreadAttribute"] = 243] = "JsxSpreadAttribute"; - SyntaxKind[SyntaxKind["JsxExpression"] = 244] = "JsxExpression"; + SyntaxKind[SyntaxKind["JsxElement"] = 240] = "JsxElement"; + SyntaxKind[SyntaxKind["JsxSelfClosingElement"] = 241] = "JsxSelfClosingElement"; + SyntaxKind[SyntaxKind["JsxOpeningElement"] = 242] = "JsxOpeningElement"; + SyntaxKind[SyntaxKind["JsxText"] = 243] = "JsxText"; + SyntaxKind[SyntaxKind["JsxClosingElement"] = 244] = "JsxClosingElement"; + SyntaxKind[SyntaxKind["JsxAttribute"] = 245] = "JsxAttribute"; + SyntaxKind[SyntaxKind["JsxSpreadAttribute"] = 246] = "JsxSpreadAttribute"; + SyntaxKind[SyntaxKind["JsxExpression"] = 247] = "JsxExpression"; // Clauses - SyntaxKind[SyntaxKind["CaseClause"] = 245] = "CaseClause"; - SyntaxKind[SyntaxKind["DefaultClause"] = 246] = "DefaultClause"; - SyntaxKind[SyntaxKind["HeritageClause"] = 247] = "HeritageClause"; - SyntaxKind[SyntaxKind["CatchClause"] = 248] = "CatchClause"; + SyntaxKind[SyntaxKind["CaseClause"] = 248] = "CaseClause"; + SyntaxKind[SyntaxKind["DefaultClause"] = 249] = "DefaultClause"; + SyntaxKind[SyntaxKind["HeritageClause"] = 250] = "HeritageClause"; + SyntaxKind[SyntaxKind["CatchClause"] = 251] = "CatchClause"; // Property assignments - SyntaxKind[SyntaxKind["PropertyAssignment"] = 249] = "PropertyAssignment"; - SyntaxKind[SyntaxKind["ShorthandPropertyAssignment"] = 250] = "ShorthandPropertyAssignment"; + SyntaxKind[SyntaxKind["PropertyAssignment"] = 252] = "PropertyAssignment"; + SyntaxKind[SyntaxKind["ShorthandPropertyAssignment"] = 253] = "ShorthandPropertyAssignment"; // Enum - SyntaxKind[SyntaxKind["EnumMember"] = 251] = "EnumMember"; + SyntaxKind[SyntaxKind["EnumMember"] = 254] = "EnumMember"; // Top-level nodes - SyntaxKind[SyntaxKind["SourceFile"] = 252] = "SourceFile"; + SyntaxKind[SyntaxKind["SourceFile"] = 255] = "SourceFile"; // JSDoc nodes - SyntaxKind[SyntaxKind["JSDocTypeExpression"] = 253] = "JSDocTypeExpression"; + SyntaxKind[SyntaxKind["JSDocTypeExpression"] = 256] = "JSDocTypeExpression"; // The * type - SyntaxKind[SyntaxKind["JSDocAllType"] = 254] = "JSDocAllType"; + SyntaxKind[SyntaxKind["JSDocAllType"] = 257] = "JSDocAllType"; // The ? type - SyntaxKind[SyntaxKind["JSDocUnknownType"] = 255] = "JSDocUnknownType"; - SyntaxKind[SyntaxKind["JSDocArrayType"] = 256] = "JSDocArrayType"; - SyntaxKind[SyntaxKind["JSDocUnionType"] = 257] = "JSDocUnionType"; - SyntaxKind[SyntaxKind["JSDocTupleType"] = 258] = "JSDocTupleType"; - SyntaxKind[SyntaxKind["JSDocNullableType"] = 259] = "JSDocNullableType"; - SyntaxKind[SyntaxKind["JSDocNonNullableType"] = 260] = "JSDocNonNullableType"; - SyntaxKind[SyntaxKind["JSDocRecordType"] = 261] = "JSDocRecordType"; - SyntaxKind[SyntaxKind["JSDocRecordMember"] = 262] = "JSDocRecordMember"; - SyntaxKind[SyntaxKind["JSDocTypeReference"] = 263] = "JSDocTypeReference"; - SyntaxKind[SyntaxKind["JSDocOptionalType"] = 264] = "JSDocOptionalType"; - SyntaxKind[SyntaxKind["JSDocFunctionType"] = 265] = "JSDocFunctionType"; - SyntaxKind[SyntaxKind["JSDocVariadicType"] = 266] = "JSDocVariadicType"; - SyntaxKind[SyntaxKind["JSDocConstructorType"] = 267] = "JSDocConstructorType"; - SyntaxKind[SyntaxKind["JSDocThisType"] = 268] = "JSDocThisType"; - SyntaxKind[SyntaxKind["JSDocComment"] = 269] = "JSDocComment"; - SyntaxKind[SyntaxKind["JSDocTag"] = 270] = "JSDocTag"; - SyntaxKind[SyntaxKind["JSDocParameterTag"] = 271] = "JSDocParameterTag"; - SyntaxKind[SyntaxKind["JSDocReturnTag"] = 272] = "JSDocReturnTag"; - SyntaxKind[SyntaxKind["JSDocTypeTag"] = 273] = "JSDocTypeTag"; - SyntaxKind[SyntaxKind["JSDocTemplateTag"] = 274] = "JSDocTemplateTag"; + SyntaxKind[SyntaxKind["JSDocUnknownType"] = 258] = "JSDocUnknownType"; + SyntaxKind[SyntaxKind["JSDocArrayType"] = 259] = "JSDocArrayType"; + SyntaxKind[SyntaxKind["JSDocUnionType"] = 260] = "JSDocUnionType"; + SyntaxKind[SyntaxKind["JSDocTupleType"] = 261] = "JSDocTupleType"; + SyntaxKind[SyntaxKind["JSDocNullableType"] = 262] = "JSDocNullableType"; + SyntaxKind[SyntaxKind["JSDocNonNullableType"] = 263] = "JSDocNonNullableType"; + SyntaxKind[SyntaxKind["JSDocRecordType"] = 264] = "JSDocRecordType"; + SyntaxKind[SyntaxKind["JSDocRecordMember"] = 265] = "JSDocRecordMember"; + SyntaxKind[SyntaxKind["JSDocTypeReference"] = 266] = "JSDocTypeReference"; + SyntaxKind[SyntaxKind["JSDocOptionalType"] = 267] = "JSDocOptionalType"; + SyntaxKind[SyntaxKind["JSDocFunctionType"] = 268] = "JSDocFunctionType"; + SyntaxKind[SyntaxKind["JSDocVariadicType"] = 269] = "JSDocVariadicType"; + SyntaxKind[SyntaxKind["JSDocConstructorType"] = 270] = "JSDocConstructorType"; + SyntaxKind[SyntaxKind["JSDocThisType"] = 271] = "JSDocThisType"; + SyntaxKind[SyntaxKind["JSDocComment"] = 272] = "JSDocComment"; + SyntaxKind[SyntaxKind["JSDocTag"] = 273] = "JSDocTag"; + SyntaxKind[SyntaxKind["JSDocParameterTag"] = 274] = "JSDocParameterTag"; + SyntaxKind[SyntaxKind["JSDocReturnTag"] = 275] = "JSDocReturnTag"; + SyntaxKind[SyntaxKind["JSDocTypeTag"] = 276] = "JSDocTypeTag"; + SyntaxKind[SyntaxKind["JSDocTemplateTag"] = 277] = "JSDocTemplateTag"; // Synthesized list - SyntaxKind[SyntaxKind["SyntaxList"] = 275] = "SyntaxList"; + SyntaxKind[SyntaxKind["SyntaxList"] = 278] = "SyntaxList"; // Enum value count - SyntaxKind[SyntaxKind["Count"] = 276] = "Count"; + SyntaxKind[SyntaxKind["Count"] = 279] = "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"] = 136] = "LastKeyword"; + SyntaxKind[SyntaxKind["LastKeyword"] = 137] = "LastKeyword"; SyntaxKind[SyntaxKind["FirstFutureReservedWord"] = 106] = "FirstFutureReservedWord"; SyntaxKind[SyntaxKind["LastFutureReservedWord"] = 114] = "LastFutureReservedWord"; - SyntaxKind[SyntaxKind["FirstTypeNode"] = 152] = "FirstTypeNode"; - SyntaxKind[SyntaxKind["LastTypeNode"] = 164] = "LastTypeNode"; + SyntaxKind[SyntaxKind["FirstTypeNode"] = 153] = "FirstTypeNode"; + SyntaxKind[SyntaxKind["LastTypeNode"] = 165] = "LastTypeNode"; SyntaxKind[SyntaxKind["FirstPunctuation"] = 15] = "FirstPunctuation"; SyntaxKind[SyntaxKind["LastPunctuation"] = 68] = "LastPunctuation"; SyntaxKind[SyntaxKind["FirstToken"] = 0] = "FirstToken"; - SyntaxKind[SyntaxKind["LastToken"] = 136] = "LastToken"; + SyntaxKind[SyntaxKind["LastToken"] = 137] = "LastToken"; SyntaxKind[SyntaxKind["FirstTriviaToken"] = 2] = "FirstTriviaToken"; SyntaxKind[SyntaxKind["LastTriviaToken"] = 7] = "LastTriviaToken"; SyntaxKind[SyntaxKind["FirstLiteralToken"] = 8] = "FirstLiteralToken"; @@ -354,7 +357,7 @@ var ts; SyntaxKind[SyntaxKind["LastTemplateToken"] = 14] = "LastTemplateToken"; SyntaxKind[SyntaxKind["FirstBinaryOperator"] = 25] = "FirstBinaryOperator"; SyntaxKind[SyntaxKind["LastBinaryOperator"] = 68] = "LastBinaryOperator"; - SyntaxKind[SyntaxKind["FirstNode"] = 137] = "FirstNode"; + SyntaxKind[SyntaxKind["FirstNode"] = 138] = "FirstNode"; })(ts.SyntaxKind || (ts.SyntaxKind = {})); var SyntaxKind = ts.SyntaxKind; (function (NodeFlags) { @@ -389,13 +392,14 @@ var ts; NodeFlags[NodeFlags["JavaScriptFile"] = 134217728] = "JavaScriptFile"; NodeFlags[NodeFlags["ThisNodeOrAnySubNodesHasError"] = 268435456] = "ThisNodeOrAnySubNodesHasError"; NodeFlags[NodeFlags["HasAggregatedChildData"] = 536870912] = "HasAggregatedChildData"; + NodeFlags[NodeFlags["HasJsxSpreadAttribute"] = 1073741824] = "HasJsxSpreadAttribute"; NodeFlags[NodeFlags["Modifier"] = 959] = "Modifier"; NodeFlags[NodeFlags["AccessibilityModifier"] = 28] = "AccessibilityModifier"; NodeFlags[NodeFlags["BlockScoped"] = 3072] = "BlockScoped"; NodeFlags[NodeFlags["ReachabilityCheckFlags"] = 98304] = "ReachabilityCheckFlags"; NodeFlags[NodeFlags["EmitHelperFlags"] = 3932160] = "EmitHelperFlags"; // Parsing context flags - NodeFlags[NodeFlags["ContextFlags"] = 62914560] = "ContextFlags"; + NodeFlags[NodeFlags["ContextFlags"] = 197132288] = "ContextFlags"; // Exclude these flags when parsing a Type NodeFlags[NodeFlags["TypeExcludesFlags"] = 41943040] = "TypeExcludesFlags"; })(ts.NodeFlags || (ts.NodeFlags = {})); @@ -622,6 +626,8 @@ var ts; TypeFlags[TypeFlags["ThisType"] = 33554432] = "ThisType"; TypeFlags[TypeFlags["ObjectLiteralPatternWithComputedProperties"] = 67108864] = "ObjectLiteralPatternWithComputedProperties"; /* @internal */ + TypeFlags[TypeFlags["Nullable"] = 96] = "Nullable"; + /* @internal */ TypeFlags[TypeFlags["Intrinsic"] = 16777343] = "Intrinsic"; /* @internal */ TypeFlags[TypeFlags["Primitive"] = 16777726] = "Primitive"; @@ -1087,8 +1093,14 @@ var ts; var count = array.length; if (count > 0) { var pos = 0; - var result = arguments.length <= 2 ? array[pos] : initial; - pos++; + var result = void 0; + if (arguments.length <= 2) { + result = array[pos]; + pos++; + } + else { + result = initial; + } while (pos < count) { result = f(result, array[pos]); pos++; @@ -1103,8 +1115,14 @@ var ts; if (array) { var pos = array.length - 1; if (pos >= 0) { - var result = arguments.length <= 2 ? array[pos] : initial; - pos--; + var result = void 0; + if (arguments.length <= 2) { + result = array[pos]; + pos--; + } + else { + result = initial; + } while (pos >= 0) { result = f(result, array[pos]); pos--; @@ -1120,6 +1138,14 @@ var ts; return hasOwnProperty.call(map, key); } ts.hasProperty = hasProperty; + function getKeys(map) { + var keys = []; + for (var key in map) { + keys.push(key); + } + return keys; + } + ts.getKeys = getKeys; function getProperty(map, key) { return hasOwnProperty.call(map, key) ? map[key] : undefined; } @@ -1586,6 +1612,32 @@ var ts; return pathLen > extLen && path.substr(pathLen - extLen, extLen) === extension; } ts.fileExtensionIs = fileExtensionIs; + function ensureScriptKind(fileName, scriptKind) { + // Using scriptKind as a condition handles both: + // - 'scriptKind' is unspecified and thus it is `undefined` + // - 'scriptKind' is set and it is `Unknown` (0) + // If the 'scriptKind' is 'undefined' or 'Unknown' then we attempt + // to get the ScriptKind from the file name. If it cannot be resolved + // from the file name then the default 'TS' script kind is returned. + return (scriptKind || getScriptKindFromFileName(fileName)) || 3 /* TS */; + } + ts.ensureScriptKind = ensureScriptKind; + function getScriptKindFromFileName(fileName) { + var ext = fileName.substr(fileName.lastIndexOf(".")); + switch (ext.toLowerCase()) { + case ".js": + return 1 /* JS */; + case ".jsx": + return 2 /* JSX */; + case ".ts": + return 3 /* TS */; + case ".tsx": + return 4 /* TSX */; + default: + return 0 /* Unknown */; + } + } + ts.getScriptKindFromFileName = getScriptKindFromFileName; /** * List of supported extensions in order of file resolution precedence. */ @@ -1837,6 +1889,7 @@ var ts; var _fs = require("fs"); var _path = require("path"); var _os = require("os"); + var _crypto = require("crypto"); // average async stat takes about 30 microseconds // set chunk size to do 30 files in < 1 millisecond function createPollingWatchedFileSet(interval, chunkSize) { @@ -1853,13 +1906,13 @@ var ts; if (!watchedFile) { return; } - _fs.stat(watchedFile.filePath, function (err, stats) { + _fs.stat(watchedFile.fileName, function (err, stats) { if (err) { - watchedFile.callback(watchedFile.filePath); + watchedFile.callback(watchedFile.fileName); } else if (watchedFile.mtime.getTime() !== stats.mtime.getTime()) { - watchedFile.mtime = getModifiedTime(watchedFile.filePath); - watchedFile.callback(watchedFile.filePath, watchedFile.mtime.getTime() === 0); + watchedFile.mtime = getModifiedTime(watchedFile.fileName); + watchedFile.callback(watchedFile.fileName, watchedFile.mtime.getTime() === 0); } }); } @@ -1885,11 +1938,11 @@ var ts; nextFileToCheck = nextToCheck; }, interval); } - function addFile(filePath, callback) { + function addFile(fileName, callback) { var file = { - filePath: filePath, + fileName: fileName, callback: callback, - mtime: getModifiedTime(filePath) + mtime: getModifiedTime(fileName) }; watchedFiles.push(file); if (watchedFiles.length === 1) { @@ -1909,70 +1962,70 @@ var ts; }; } function createWatchedFileSet() { - var dirWatchers = ts.createFileMap(); + var dirWatchers = {}; // One file can have multiple watchers - var fileWatcherCallbacks = ts.createFileMap(); + var fileWatcherCallbacks = {}; return { addFile: addFile, removeFile: removeFile }; - function reduceDirWatcherRefCountForFile(filePath) { - var dirPath = ts.getDirectoryPath(filePath); - if (dirWatchers.contains(dirPath)) { - var watcher = dirWatchers.get(dirPath); + function reduceDirWatcherRefCountForFile(fileName) { + var dirName = ts.getDirectoryPath(fileName); + if (ts.hasProperty(dirWatchers, dirName)) { + var watcher = dirWatchers[dirName]; watcher.referenceCount -= 1; if (watcher.referenceCount <= 0) { watcher.close(); - dirWatchers.remove(dirPath); + delete dirWatchers[dirName]; } } } function addDirWatcher(dirPath) { - if (dirWatchers.contains(dirPath)) { - var watcher_1 = dirWatchers.get(dirPath); + if (ts.hasProperty(dirWatchers, dirPath)) { + var watcher_1 = dirWatchers[dirPath]; watcher_1.referenceCount += 1; return; } var watcher = _fs.watch(dirPath, { persistent: true }, function (eventName, relativeFileName) { return fileEventHandler(eventName, relativeFileName, dirPath); }); watcher.referenceCount = 1; - dirWatchers.set(dirPath, watcher); + dirWatchers[dirPath] = watcher; return; } function addFileWatcherCallback(filePath, callback) { - if (fileWatcherCallbacks.contains(filePath)) { - fileWatcherCallbacks.get(filePath).push(callback); + if (ts.hasProperty(fileWatcherCallbacks, filePath)) { + fileWatcherCallbacks[filePath].push(callback); } else { - fileWatcherCallbacks.set(filePath, [callback]); + fileWatcherCallbacks[filePath] = [callback]; } } - function addFile(filePath, callback) { - addFileWatcherCallback(filePath, callback); - addDirWatcher(ts.getDirectoryPath(filePath)); - return { filePath: filePath, callback: callback }; + function addFile(fileName, callback) { + addFileWatcherCallback(fileName, callback); + addDirWatcher(ts.getDirectoryPath(fileName)); + return { fileName: fileName, callback: callback }; } function removeFile(watchedFile) { - removeFileWatcherCallback(watchedFile.filePath, watchedFile.callback); - reduceDirWatcherRefCountForFile(watchedFile.filePath); + removeFileWatcherCallback(watchedFile.fileName, watchedFile.callback); + reduceDirWatcherRefCountForFile(watchedFile.fileName); } function removeFileWatcherCallback(filePath, callback) { - if (fileWatcherCallbacks.contains(filePath)) { - var newCallbacks = ts.copyListRemovingItem(callback, fileWatcherCallbacks.get(filePath)); + if (ts.hasProperty(fileWatcherCallbacks, filePath)) { + var newCallbacks = ts.copyListRemovingItem(callback, fileWatcherCallbacks[filePath]); if (newCallbacks.length === 0) { - fileWatcherCallbacks.remove(filePath); + delete fileWatcherCallbacks[filePath]; } else { - fileWatcherCallbacks.set(filePath, newCallbacks); + fileWatcherCallbacks[filePath] = newCallbacks; } } } function fileEventHandler(eventName, relativeFileName, baseDirPath) { // When files are deleted from disk, the triggered "rename" event would have a relativefileName of "undefined" - var filePath = typeof relativeFileName !== "string" + var fileName = typeof relativeFileName !== "string" ? undefined - : ts.toPath(relativeFileName, baseDirPath, ts.createGetCanonicalFileName(ts.sys.useCaseSensitiveFileNames)); + : ts.getNormalizedAbsolutePath(relativeFileName, baseDirPath); // Some applications save a working file via rename operations - if ((eventName === "change" || eventName === "rename") && fileWatcherCallbacks.contains(filePath)) { - for (var _i = 0, _a = fileWatcherCallbacks.get(filePath); _i < _a.length; _i++) { + if ((eventName === "change" || eventName === "rename") && ts.hasProperty(fileWatcherCallbacks, fileName)) { + for (var _i = 0, _a = fileWatcherCallbacks[fileName]; _i < _a.length; _i++) { var fileCallback = _a[_i]; - fileCallback(filePath); + fileCallback(fileName); } } } @@ -2078,6 +2131,11 @@ var ts; var directories = []; for (var _i = 0, files_2 = files; _i < files_2.length; _i++) { var current = files_2[_i]; + // This is necessary because on some file system node fails to exclude + // "." and "..". See https://github.com/nodejs/node/issues/4002 + if (current === "." || current === "..") { + continue; + } var name_3 = ts.combinePaths(path, current); if (!ts.contains(exclude, getCanonicalPath(name_3))) { var stat = _fs.statSync(name_3); @@ -2106,18 +2164,18 @@ var ts; }, readFile: readFile, writeFile: writeFile, - watchFile: function (filePath, callback) { + watchFile: function (fileName, callback) { // Node 4.0 stabilized the `fs.watch` function on Windows which avoids polling // and is more efficient than `fs.watchFile` (ref: https://github.com/nodejs/node/pull/2649 // and https://github.com/Microsoft/TypeScript/issues/4643), therefore // if the current node.js version is newer than 4, use `fs.watch` instead. var watchSet = isNode4OrLater() ? watchedFileSet : pollingWatchedFileSet; - var watchedFile = watchSet.addFile(filePath, callback); + var watchedFile = watchSet.addFile(fileName, callback); return { close: function () { return watchSet.removeFile(watchedFile); } }; }, - watchDirectory: function (path, callback, recursive) { + watchDirectory: function (directoryName, callback, recursive) { // 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; @@ -2127,13 +2185,13 @@ var ts; else { options = { persistent: true }; } - return _fs.watch(path, options, function (eventName, relativeFileName) { + return _fs.watch(directoryName, options, function (eventName, relativeFileName) { // In watchDirectory we only care about adding and removing files (when event name is // "rename"); changes made within files are handled by corresponding fileWatchers (when // event name is "change") if (eventName === "rename") { // When deleting a file, the passed baseFileName is null - callback(!relativeFileName ? relativeFileName : ts.normalizePath(ts.combinePaths(path, relativeFileName))); + callback(!relativeFileName ? relativeFileName : ts.normalizePath(ts.combinePaths(directoryName, relativeFileName))); } ; }); @@ -2155,6 +2213,19 @@ var ts; return process.cwd(); }, readDirectory: readDirectory, + getModifiedTime: function (path) { + try { + return _fs.statSync(path).mtime; + } + catch (e) { + return undefined; + } + }, + createHash: function (data) { + var hash = _crypto.createHash("md5"); + hash.update(data); + return hash.digest("hex"); + }, getMemoryUsage: function () { if (global.gc) { global.gc(); @@ -2423,6 +2494,9 @@ var ts; Async_functions_are_only_available_when_targeting_ECMAScript_6_and_higher: { code: 1311, category: ts.DiagnosticCategory.Error, key: "Async_functions_are_only_available_when_targeting_ECMAScript_6_and_higher_1311", message: "Async functions are only available when targeting ECMAScript 6 and 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." }, 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." }, @@ -2474,7 +2548,7 @@ var ts; 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." }, 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." }, - Neither_type_0_nor_type_1_is_assignable_to_the_other: { code: 2352, category: ts.DiagnosticCategory.Error, key: "Neither_type_0_nor_type_1_is_assignable_to_the_other_2352", message: "Neither type '{0}' nor type '{1}' is assignable to the other." }, + 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." }, 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." }, @@ -2488,6 +2562,7 @@ var ts; 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." }, 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}'" }, A_parameter_property_is_only_allowed_in_a_constructor_implementation: { code: 2369, category: ts.DiagnosticCategory.Error, key: "A_parameter_property_is_only_allowed_in_a_constructor_implementation_2369", message: "A parameter property is only allowed in a constructor implementation." }, A_rest_parameter_must_be_of_an_array_type: { code: 2370, category: ts.DiagnosticCategory.Error, key: "A_rest_parameter_must_be_of_an_array_type_2370", message: "A rest parameter must be of an array type." }, @@ -2568,6 +2643,7 @@ var ts; 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." }, + Variable_0_is_used_before_being_assigned: { code: 2454, category: ts.DiagnosticCategory.Error, key: "Variable_0_is_used_before_being_assigned_2454", message: "Variable '{0}' is used before being assigned." }, Type_argument_candidate_1_is_not_a_valid_type_argument_because_it_is_not_a_supertype_of_candidate_0: { code: 2455, category: ts.DiagnosticCategory.Error, key: "Type_argument_candidate_1_is_not_a_valid_type_argument_because_it_is_not_a_supertype_of_candidate_0_2455", message: "Type argument candidate '{1}' is not a valid type argument because it is not a supertype of candidate '{0}'." }, Type_alias_0_circularly_references_itself: { code: 2456, category: ts.DiagnosticCategory.Error, key: "Type_alias_0_circularly_references_itself_2456", message: "Type alias '{0}' circularly references itself." }, Type_alias_name_cannot_be_0: { code: 2457, category: ts.DiagnosticCategory.Error, key: "Type_alias_name_cannot_be_0_2457", message: "Type alias name cannot be '{0}'" }, @@ -2642,6 +2718,7 @@ var ts; A_module_cannot_have_multiple_default_exports: { code: 2528, category: ts.DiagnosticCategory.Error, key: "A_module_cannot_have_multiple_default_exports_2528", message: "A module cannot have multiple default exports." }, Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module_containing_async_functions: { code: 2529, category: ts.DiagnosticCategory.Error, key: "Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module_containing_async_func_2529", message: "Duplicate identifier '{0}'. Compiler reserves name '{1}' in top level scope of a module containing async functions." }, Property_0_is_incompatible_with_index_signature: { code: 2530, category: ts.DiagnosticCategory.Error, key: "Property_0_is_incompatible_with_index_signature_2530", message: "Property '{0}' is incompatible with index signature." }, + Object_is_possibly_null_or_undefined: { code: 2531, category: ts.DiagnosticCategory.Error, key: "Object_is_possibly_null_or_undefined_2531", message: "Object is possibly 'null' or 'undefined'." }, 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." }, @@ -2677,6 +2754,15 @@ var ts; Constructor_of_class_0_is_protected_and_only_accessible_within_the_class_declaration: { code: 2674, category: ts.DiagnosticCategory.Error, key: "Constructor_of_class_0_is_protected_and_only_accessible_within_the_class_declaration_2674", message: "Constructor of class '{0}' is protected and only accessible within the class declaration." }, Cannot_extend_a_class_0_Class_constructor_is_marked_as_private: { code: 2675, category: ts.DiagnosticCategory.Error, key: "Cannot_extend_a_class_0_Class_constructor_is_marked_as_private_2675", message: "Cannot extend a class '{0}'. Class constructor is marked as private." }, Accessors_must_both_be_abstract_or_non_abstract: { code: 2676, category: ts.DiagnosticCategory.Error, key: "Accessors_must_both_be_abstract_or_non_abstract_2676", message: "Accessors must both be abstract or non-abstract." }, + A_type_predicate_s_type_must_be_assignable_to_its_parameter_s_type: { code: 2677, category: ts.DiagnosticCategory.Error, key: "A_type_predicate_s_type_must_be_assignable_to_its_parameter_s_type_2677", message: "A type predicate's type must be assignable to its parameter's type." }, + Type_0_is_not_comparable_to_type_1: { code: 2678, category: ts.DiagnosticCategory.Error, key: "Type_0_is_not_comparable_to_type_1_2678", message: "Type '{0}' is not comparable to type '{1}'." }, + A_function_that_is_called_with_the_new_keyword_cannot_have_a_this_type_that_is_void: { code: 2679, category: ts.DiagnosticCategory.Error, key: "A_function_that_is_called_with_the_new_keyword_cannot_have_a_this_type_that_is_void_2679", message: "A function that is called with the 'new' keyword cannot have a 'this' type that is 'void'." }, + A_this_parameter_must_be_the_first_parameter: { code: 2680, category: ts.DiagnosticCategory.Error, key: "A_this_parameter_must_be_the_first_parameter_2680", message: "A 'this' parameter must be the first parameter." }, + A_constructor_cannot_have_a_this_parameter: { code: 2681, category: ts.DiagnosticCategory.Error, key: "A_constructor_cannot_have_a_this_parameter_2681", message: "A constructor cannot have a 'this' parameter." }, + A_setter_cannot_have_a_this_parameter: { code: 2682, category: ts.DiagnosticCategory.Error, key: "A_setter_cannot_have_a_this_parameter_2682", message: "A setter cannot have a 'this' parameter." }, + 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." }, 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}'." }, @@ -2747,6 +2833,7 @@ var ts; Parameter_0_of_exported_function_has_or_is_using_private_name_1: { code: 4078, category: ts.DiagnosticCategory.Error, key: "Parameter_0_of_exported_function_has_or_is_using_private_name_1_4078", message: "Parameter '{0}' of exported function has or is using private name '{1}'." }, Exported_type_alias_0_has_or_is_using_private_name_1: { code: 4081, category: ts.DiagnosticCategory.Error, key: "Exported_type_alias_0_has_or_is_using_private_name_1_4081", message: "Exported type alias '{0}' has or is using private name '{1}'." }, Default_export_of_the_module_has_or_is_using_private_name_0: { code: 4082, category: ts.DiagnosticCategory.Error, key: "Default_export_of_the_module_has_or_is_using_private_name_0_4082", message: "Default export of the module has or is using private name '{0}'." }, + Conflicting_library_definitions_for_0_found_at_1_and_2_Copy_the_correct_file_to_the_typings_folder_to_resolve_this_conflict: { code: 4090, category: ts.DiagnosticCategory.Message, key: "Conflicting_library_definitions_for_0_found_at_1_and_2_Copy_the_correct_file_to_the_typings_folder_t_4090", message: "Conflicting library definitions for '{0}' found at '{1}' and '{2}'. Copy the correct file to the 'typings' folder to resolve this conflict." }, The_current_host_does_not_support_the_0_option: { code: 5001, category: ts.DiagnosticCategory.Error, key: "The_current_host_does_not_support_the_0_option_5001", message: "The current host does not support the '{0}' option." }, Cannot_find_the_common_subdirectory_path_for_the_input_files: { code: 5009, category: ts.DiagnosticCategory.Error, key: "Cannot_find_the_common_subdirectory_path_for_the_input_files_5009", message: "Cannot find the common subdirectory path for the input files." }, Cannot_read_file_0_Colon_1: { code: 5012, category: ts.DiagnosticCategory.Error, key: "Cannot_read_file_0_Colon_1_5012", message: "Cannot read file '{0}': {1}" }, @@ -2771,8 +2858,8 @@ var ts; Substitution_0_in_pattern_1_in_can_have_at_most_one_Asterisk_character: { code: 5062, category: ts.DiagnosticCategory.Error, key: "Substitution_0_in_pattern_1_in_can_have_at_most_one_Asterisk_character_5062", message: "Substitution '{0}' in pattern '{1}' in can have at most one '*' character" }, 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." }, - Specifies_the_location_where_debugger_should_locate_map_files_instead_of_generated_locations: { code: 6003, category: ts.DiagnosticCategory.Message, key: "Specifies_the_location_where_debugger_should_locate_map_files_instead_of_generated_locations_6003", message: "Specifies the location where debugger should locate map files instead of generated locations." }, - Specifies_the_location_where_debugger_should_locate_TypeScript_files_instead_of_source_locations: { code: 6004, category: ts.DiagnosticCategory.Message, key: "Specifies_the_location_where_debugger_should_locate_TypeScript_files_instead_of_source_locations_6004", message: "Specifies the location where debugger should locate TypeScript files instead of source locations." }, + 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." }, + Specify_the_location_where_debugger_should_locate_TypeScript_files_instead_of_source_locations: { code: 6004, category: ts.DiagnosticCategory.Message, key: "Specify_the_location_where_debugger_should_locate_TypeScript_files_instead_of_source_locations_6004", message: "Specify the location where debugger should locate TypeScript files instead of source locations." }, Watch_input_files: { code: 6005, category: ts.DiagnosticCategory.Message, key: "Watch_input_files_6005", message: "Watch input files." }, Redirect_output_structure_to_the_directory: { code: 6006, category: ts.DiagnosticCategory.Message, key: "Redirect_output_structure_to_the_directory_6006", message: "Redirect output structure to the directory." }, Do_not_erase_const_enum_declarations_in_generated_code: { code: 6007, category: ts.DiagnosticCategory.Message, key: "Do_not_erase_const_enum_declarations_in_generated_code_6007", message: "Do not erase const enum declarations in generated code." }, @@ -2780,7 +2867,7 @@ var ts; Do_not_emit_comments_to_output: { code: 6009, category: ts.DiagnosticCategory.Message, key: "Do_not_emit_comments_to_output_6009", message: "Do not emit comments to output." }, 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." }, - Specify_ECMAScript_target_version_Colon_ES3_default_ES5_or_ES2015_experimental: { code: 6015, category: ts.DiagnosticCategory.Message, key: "Specify_ECMAScript_target_version_Colon_ES3_default_ES5_or_ES2015_experimental_6015", message: "Specify ECMAScript target version: 'ES3' (default), 'ES5', or 'ES2015' (experimental)" }, + 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_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." }, @@ -2802,8 +2889,7 @@ var ts; 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." }, Unterminated_quoted_string_in_response_file_0: { code: 6045, category: ts.DiagnosticCategory.Error, key: "Unterminated_quoted_string_in_response_file_0_6045", message: "Unterminated quoted string in response file '{0}'." }, - Argument_for_module_option_must_be_commonjs_amd_system_umd_es2015_or_none: { code: 6046, category: ts.DiagnosticCategory.Error, key: "Argument_for_module_option_must_be_commonjs_amd_system_umd_es2015_or_none_6046", message: "Argument for '--module' option must be 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'none'." }, - Argument_for_target_option_must_be_ES3_ES5_or_ES2015: { code: 6047, category: ts.DiagnosticCategory.Error, key: "Argument_for_target_option_must_be_ES3_ES5_or_ES2015_6047", message: "Argument for '--target' option must be 'ES3', 'ES5', or 'ES2015'." }, + Argument_for_0_option_must_be_Colon_1: { code: 6046, category: ts.DiagnosticCategory.Error, key: "Argument_for_0_option_must_be_Colon_1_6046", message: "Argument for '{0}' option must be: {1}" }, Locale_must_be_of_the_form_language_or_language_territory_For_example_0_or_1: { code: 6048, category: ts.DiagnosticCategory.Error, key: "Locale_must_be_of_the_form_language_or_language_territory_For_example_0_or_1_6048", message: "Locale must be of the form or -. For example '{0}' or '{1}'." }, Unsupported_locale_0: { code: 6049, category: ts.DiagnosticCategory.Error, key: "Unsupported_locale_0_6049", message: "Unsupported locale '{0}'." }, Unable_to_open_file_0: { code: 6050, category: ts.DiagnosticCategory.Error, key: "Unable_to_open_file_0_6050", message: "Unable to open file '{0}'." }, @@ -2813,17 +2899,15 @@ var ts; File_0_has_unsupported_extension_The_only_supported_extensions_are_1: { code: 6054, category: ts.DiagnosticCategory.Error, key: "File_0_has_unsupported_extension_The_only_supported_extensions_are_1_6054", message: "File '{0}' has unsupported extension. The only supported extensions are {1}." }, Suppress_noImplicitAny_errors_for_indexing_objects_lacking_index_signatures: { code: 6055, category: ts.DiagnosticCategory.Message, key: "Suppress_noImplicitAny_errors_for_indexing_objects_lacking_index_signatures_6055", message: "Suppress noImplicitAny errors for indexing objects lacking index signatures." }, Do_not_emit_declarations_for_code_that_has_an_internal_annotation: { code: 6056, category: ts.DiagnosticCategory.Message, key: "Do_not_emit_declarations_for_code_that_has_an_internal_annotation_6056", message: "Do not emit declarations for code that has an '@internal' annotation." }, - Specifies_the_root_directory_of_input_files_Use_to_control_the_output_directory_structure_with_outDir: { code: 6058, category: ts.DiagnosticCategory.Message, key: "Specifies_the_root_directory_of_input_files_Use_to_control_the_output_directory_structure_with_outDi_6058", message: "Specifies the root directory of input files. Use to control the output directory structure with --outDir." }, + Specify_the_root_directory_of_input_files_Use_to_control_the_output_directory_structure_with_outDir: { code: 6058, category: ts.DiagnosticCategory.Message, key: "Specify_the_root_directory_of_input_files_Use_to_control_the_output_directory_structure_with_outDir_6058", message: "Specify the root directory of input files. Use to control the output directory structure with --outDir." }, File_0_is_not_under_rootDir_1_rootDir_is_expected_to_contain_all_source_files: { code: 6059, category: ts.DiagnosticCategory.Error, key: "File_0_is_not_under_rootDir_1_rootDir_is_expected_to_contain_all_source_files_6059", message: "File '{0}' is not under 'rootDir' '{1}'. 'rootDir' is expected to contain all source files." }, - Specifies_the_end_of_line_sequence_to_be_used_when_emitting_files_Colon_CRLF_dos_or_LF_unix: { code: 6060, category: ts.DiagnosticCategory.Message, key: "Specifies_the_end_of_line_sequence_to_be_used_when_emitting_files_Colon_CRLF_dos_or_LF_unix_6060", message: "Specifies the end of line sequence to be used when emitting files: 'CRLF' (dos) or 'LF' (unix)." }, + Specify_the_end_of_line_sequence_to_be_used_when_emitting_files_Colon_CRLF_dos_or_LF_unix: { code: 6060, category: ts.DiagnosticCategory.Message, key: "Specify_the_end_of_line_sequence_to_be_used_when_emitting_files_Colon_CRLF_dos_or_LF_unix_6060", message: "Specify the end of line sequence to be used when emitting files: 'CRLF' (dos) or 'LF' (unix)." }, NEWLINE: { code: 6061, category: ts.DiagnosticCategory.Message, key: "NEWLINE_6061", message: "NEWLINE" }, - Argument_for_newLine_option_must_be_CRLF_or_LF: { code: 6062, category: ts.DiagnosticCategory.Error, key: "Argument_for_newLine_option_must_be_CRLF_or_LF_6062", message: "Argument for '--newLine' option must be 'CRLF' or 'LF'." }, - Argument_for_moduleResolution_option_must_be_node_or_classic: { code: 6063, category: ts.DiagnosticCategory.Error, key: "Argument_for_moduleResolution_option_must_be_node_or_classic_6063", message: "Argument for '--moduleResolution' option must be 'node' or 'classic'." }, Option_0_can_only_be_specified_in_tsconfig_json_file: { code: 6064, category: ts.DiagnosticCategory.Error, key: "Option_0_can_only_be_specified_in_tsconfig_json_file_6064", message: "Option '{0}' can only be specified in 'tsconfig.json' file." }, Enables_experimental_support_for_ES7_decorators: { code: 6065, category: ts.DiagnosticCategory.Message, key: "Enables_experimental_support_for_ES7_decorators_6065", message: "Enables experimental support for ES7 decorators." }, Enables_experimental_support_for_emitting_type_metadata_for_decorators: { code: 6066, category: ts.DiagnosticCategory.Message, key: "Enables_experimental_support_for_emitting_type_metadata_for_decorators_6066", message: "Enables experimental support for emitting type metadata for decorators." }, Enables_experimental_support_for_ES7_async_functions: { code: 6068, category: ts.DiagnosticCategory.Message, key: "Enables_experimental_support_for_ES7_async_functions_6068", message: "Enables experimental support for ES7 async functions." }, - Specifies_module_resolution_strategy_Colon_node_Node_js_or_classic_TypeScript_pre_1_6: { code: 6069, category: ts.DiagnosticCategory.Message, key: "Specifies_module_resolution_strategy_Colon_node_Node_js_or_classic_TypeScript_pre_1_6_6069", message: "Specifies module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6)." }, + Specify_module_resolution_strategy_Colon_node_Node_js_or_classic_TypeScript_pre_1_6: { code: 6069, category: ts.DiagnosticCategory.Message, key: "Specify_module_resolution_strategy_Colon_node_Node_js_or_classic_TypeScript_pre_1_6_6069", message: "Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6)." }, Initializes_a_TypeScript_project_and_creates_a_tsconfig_json_file: { code: 6070, category: ts.DiagnosticCategory.Message, key: "Initializes_a_TypeScript_project_and_creates_a_tsconfig_json_file_6070", message: "Initializes a TypeScript project and creates a tsconfig.json file." }, Successfully_created_a_tsconfig_json_file: { code: 6071, category: ts.DiagnosticCategory.Message, key: "Successfully_created_a_tsconfig_json_file_6071", message: "Successfully created a tsconfig.json file." }, Suppress_excess_property_checks_for_object_literals: { code: 6072, category: ts.DiagnosticCategory.Message, key: "Suppress_excess_property_checks_for_object_literals_6072", message: "Suppress excess property checks for object literals." }, @@ -2833,12 +2917,12 @@ var ts; Report_errors_for_fallthrough_cases_in_switch_statement: { code: 6076, category: ts.DiagnosticCategory.Message, key: "Report_errors_for_fallthrough_cases_in_switch_statement_6076", message: "Report errors for fallthrough cases in switch statement." }, Do_not_report_errors_on_unreachable_code: { code: 6077, category: ts.DiagnosticCategory.Message, key: "Do_not_report_errors_on_unreachable_code_6077", message: "Do not report errors on unreachable code." }, 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'" }, - Argument_for_jsx_must_be_preserve_or_react: { code: 6081, category: ts.DiagnosticCategory.Message, key: "Argument_for_jsx_must_be_preserve_or_react_6081", message: "Argument for '--jsx' must be 'preserve' or 'react'." }, 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." }, - Specifies_the_object_invoked_for_createElement_and_spread_when_targeting_react_JSX_emit: { code: 6084, category: ts.DiagnosticCategory.Message, key: "Specifies_the_object_invoked_for_createElement_and_spread_when_targeting_react_JSX_emit_6084", message: "Specifies the object invoked for createElement and __spread when targeting 'react' JSX emit" }, - Enable_tracing_of_the_module_resolution_process: { code: 6085, category: ts.DiagnosticCategory.Message, key: "Enable_tracing_of_the_module_resolution_process_6085", message: "Enable tracing of the module resolution process." }, + 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" }, + Enable_tracing_of_the_name_resolution_process: { code: 6085, category: ts.DiagnosticCategory.Message, key: "Enable_tracing_of_the_name_resolution_process_6085", message: "Enable tracing of the name resolution process." }, Resolving_module_0_from_1: { code: 6086, category: ts.DiagnosticCategory.Message, key: "Resolving_module_0_from_1_6086", message: "======== Resolving module '{0}' from '{1}'. ========" }, Explicitly_specified_module_resolution_kind_Colon_0: { code: 6087, category: ts.DiagnosticCategory.Message, key: "Explicitly_specified_module_resolution_kind_Colon_0_6087", message: "Explicitly specified module resolution kind: '{0}'." }, Module_resolution_kind_is_not_specified_using_0: { code: 6088, category: ts.DiagnosticCategory.Message, key: "Module_resolution_kind_is_not_specified_using_0_6088", message: "Module resolution kind is not specified, using '{0}'." }, @@ -2850,15 +2934,15 @@ var ts; Resolving_module_name_0_relative_to_base_url_1_2: { code: 6094, category: ts.DiagnosticCategory.Message, key: "Resolving_module_name_0_relative_to_base_url_1_2_6094", message: "Resolving module name '{0}' relative to base url '{1}' - '{2}'." }, Loading_module_as_file_Slash_folder_candidate_module_location_0: { code: 6095, category: ts.DiagnosticCategory.Message, key: "Loading_module_as_file_Slash_folder_candidate_module_location_0_6095", message: "Loading module as file / folder, candidate module location '{0}'." }, File_0_does_not_exist: { code: 6096, category: ts.DiagnosticCategory.Message, key: "File_0_does_not_exist_6096", message: "File '{0}' does not exist." }, - File_0_exist_use_it_as_a_module_resolution_result: { code: 6097, category: ts.DiagnosticCategory.Message, key: "File_0_exist_use_it_as_a_module_resolution_result_6097", message: "File '{0}' exist - use it as a module resolution result." }, + 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_typings_field: { code: 6100, category: ts.DiagnosticCategory.Message, key: "package_json_does_not_have_typings_field_6100", message: "'package.json' does not have 'typings' field." }, - package_json_has_typings_field_0_that_references_1: { code: 6101, category: ts.DiagnosticCategory.Message, key: "package_json_has_typings_field_0_that_references_1_6101", message: "'package.json' has 'typings' field '{0}' that references '{1}'." }, + 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_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." }, Checking_if_0_is_the_longest_matching_prefix_for_1_2: { code: 6104, category: ts.DiagnosticCategory.Message, key: "Checking_if_0_is_the_longest_matching_prefix_for_1_2_6104", message: "Checking if '{0}' is the longest matching prefix for '{1}' - '{2}'." }, - Expected_type_of_typings_field_in_package_json_to_be_string_got_0: { code: 6105, category: ts.DiagnosticCategory.Message, key: "Expected_type_of_typings_field_in_package_json_to_be_string_got_0_6105", message: "Expected type of 'typings' field in 'package.json' to be 'string', got '{0}'." }, + Expected_type_of_0_field_in_package_json_to_be_string_got_1: { code: 6105, category: ts.DiagnosticCategory.Message, key: "Expected_type_of_0_field_in_package_json_to_be_string_got_1_6105", message: "Expected type of '{0}' field in 'package.json' to be 'string', got '{1}'." }, baseUrl_option_is_set_to_0_using_this_value_to_resolve_non_relative_module_name_1: { code: 6106, category: ts.DiagnosticCategory.Message, key: "baseUrl_option_is_set_to_0_using_this_value_to_resolve_non_relative_module_name_1_6106", message: "'baseUrl' option is set to '{0}', using this value to resolve non-relative module name '{1}'" }, rootDirs_option_is_set_using_it_to_resolve_relative_module_name_0: { code: 6107, category: ts.DiagnosticCategory.Message, key: "rootDirs_option_is_set_using_it_to_resolve_relative_module_name_0_6107", message: "'rootDirs' option is set, using it to resolve relative module name '{0}'" }, Longest_matching_prefix_for_0_is_1: { code: 6108, category: ts.DiagnosticCategory.Message, key: "Longest_matching_prefix_for_0_is_1_6108", message: "Longest matching prefix for '{0}' is '{1}'" }, @@ -2866,6 +2950,22 @@ var ts; Trying_other_entries_in_rootDirs: { code: 6110, category: ts.DiagnosticCategory.Message, key: "Trying_other_entries_in_rootDirs_6110", message: "Trying other entries in 'rootDirs'" }, Module_resolution_using_rootDirs_has_failed: { code: 6111, category: ts.DiagnosticCategory.Message, key: "Module_resolution_using_rootDirs_has_failed_6111", message: "Module resolution using 'rootDirs' has failed" }, Do_not_emit_use_strict_directives_in_module_output: { code: 6112, category: ts.DiagnosticCategory.Message, key: "Do_not_emit_use_strict_directives_in_module_output_6112", message: "Do not emit 'use strict' directives in module output." }, + Enable_strict_null_checks: { code: 6113, category: ts.DiagnosticCategory.Message, key: "Enable_strict_null_checks_6113", message: "Enable strict null checks." }, + Unknown_option_excludes_Did_you_mean_exclude: { code: 6114, category: ts.DiagnosticCategory.Error, key: "Unknown_option_excludes_Did_you_mean_exclude_6114", message: "Unknown option 'excludes'. Did you mean 'exclude'?" }, + Raise_error_on_this_expressions_with_an_implied_any_type: { code: 6115, category: ts.DiagnosticCategory.Message, key: "Raise_error_on_this_expressions_with_an_implied_any_type_6115", message: "Raise error on 'this' expressions with an implied 'any' type." }, + Resolving_type_reference_directive_0_containing_file_1_root_directory_2: { code: 6116, category: ts.DiagnosticCategory.Message, key: "Resolving_type_reference_directive_0_containing_file_1_root_directory_2_6116", message: "======== Resolving type reference directive '{0}', containing file '{1}', root directory '{2}'. ========" }, + Resolving_using_primary_search_paths: { code: 6117, category: ts.DiagnosticCategory.Message, key: "Resolving_using_primary_search_paths_6117", message: "Resolving using primary search paths..." }, + Resolving_from_node_modules_folder: { code: 6118, category: ts.DiagnosticCategory.Message, key: "Resolving_from_node_modules_folder_6118", message: "Resolving from node_modules folder..." }, + Type_reference_directive_0_was_successfully_resolved_to_1_primary_Colon_2: { code: 6119, category: ts.DiagnosticCategory.Message, key: "Type_reference_directive_0_was_successfully_resolved_to_1_primary_Colon_2_6119", message: "======== Type reference directive '{0}' was successfully resolved to '{1}', primary: {2}. ========" }, + Type_reference_directive_0_was_not_resolved: { code: 6120, category: ts.DiagnosticCategory.Message, key: "Type_reference_directive_0_was_not_resolved_6120", message: "======== Type reference directive '{0}' was not resolved. ========" }, + Resolving_with_primary_search_path_0: { code: 6121, category: ts.DiagnosticCategory.Message, key: "Resolving_with_primary_search_path_0_6121", message: "Resolving with primary search path '{0}'" }, + Root_directory_cannot_be_determined_skipping_primary_search_paths: { code: 6122, category: ts.DiagnosticCategory.Message, key: "Root_directory_cannot_be_determined_skipping_primary_search_paths_6122", message: "Root directory cannot be determined, skipping primary search paths." }, + Resolving_type_reference_directive_0_containing_file_1_root_directory_not_set: { code: 6123, category: ts.DiagnosticCategory.Message, key: "Resolving_type_reference_directive_0_containing_file_1_root_directory_not_set_6123", message: "======== Resolving type reference directive '{0}', containing file '{1}', root directory not set. ========" }, + Type_declaration_files_to_be_included_in_compilation: { code: 6124, category: ts.DiagnosticCategory.Message, key: "Type_declaration_files_to_be_included_in_compilation_6124", message: "Type declaration files to be included in compilation." }, + Looking_up_in_node_modules_folder_initial_location_0: { code: 6125, category: ts.DiagnosticCategory.Message, key: "Looking_up_in_node_modules_folder_initial_location_0_6125", message: "Looking up in 'node_modules' folder, initial location '{0}'" }, + Containing_file_is_not_specified_and_root_directory_cannot_be_determined_skipping_lookup_in_node_modules_folder: { code: 6126, category: ts.DiagnosticCategory.Message, key: "Containing_file_is_not_specified_and_root_directory_cannot_be_determined_skipping_lookup_in_node_mod_6126", message: "Containing file is not specified and root directory cannot be determined, skipping lookup in 'node_modules' folder." }, + Resolving_type_reference_directive_0_containing_file_not_set_root_directory_1: { code: 6127, category: ts.DiagnosticCategory.Message, key: "Resolving_type_reference_directive_0_containing_file_not_set_root_directory_1_6127", message: "======== Resolving type reference directive '{0}', containing file not set, root directory '{1}'. ========" }, + Resolving_type_reference_directive_0_containing_file_not_set_root_directory_not_set: { code: 6128, category: ts.DiagnosticCategory.Message, key: "Resolving_type_reference_directive_0_containing_file_not_set_root_directory_not_set_6128", message: "======== Resolving type reference directive '{0}', containing file not set, root directory not set. ========" }, 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." }, @@ -2888,6 +2988,7 @@ var ts; Unused_label: { code: 7028, category: ts.DiagnosticCategory.Error, key: "Unused_label_7028", message: "Unused label." }, 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." }, 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." }, @@ -2915,7 +3016,8 @@ var ts; An_unary_expression_with_the_0_operator_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_expression_Consider_enclosing_the_expression_in_parentheses: { code: 17006, category: ts.DiagnosticCategory.Error, key: "An_unary_expression_with_the_0_operator_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_ex_17006", message: "An unary expression with the '{0}' operator is not allowed in the left-hand side of an exponentiation expression. Consider enclosing the expression in parentheses." }, 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." } + 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}'." } }; })(ts || (ts = {})); /// @@ -2951,7 +3053,7 @@ var ts; "false": 84 /* FalseKeyword */, "finally": 85 /* FinallyKeyword */, "for": 86 /* ForKeyword */, - "from": 134 /* FromKeyword */, + "from": 135 /* FromKeyword */, "function": 87 /* FunctionKeyword */, "get": 123 /* GetKeyword */, "if": 88 /* IfKeyword */, @@ -2973,7 +3075,7 @@ var ts; "public": 112 /* PublicKeyword */, "readonly": 127 /* ReadonlyKeyword */, "require": 128 /* RequireKeyword */, - "global": 135 /* GlobalKeyword */, + "global": 136 /* GlobalKeyword */, "return": 94 /* ReturnKeyword */, "set": 130 /* SetKeyword */, "static": 113 /* StaticKeyword */, @@ -2987,6 +3089,7 @@ var ts; "try": 100 /* TryKeyword */, "type": 133 /* TypeKeyword */, "typeof": 101 /* TypeOfKeyword */, + "undefined": 134 /* UndefinedKeyword */, "var": 102 /* VarKeyword */, "void": 103 /* VoidKeyword */, "while": 104 /* WhileKeyword */, @@ -2994,7 +3097,7 @@ var ts; "yield": 114 /* YieldKeyword */, "async": 118 /* AsyncKeyword */, "await": 119 /* AwaitKeyword */, - "of": 136 /* OfKeyword */, + "of": 137 /* OfKeyword */, "{": 15 /* OpenBraceToken */, "}": 16 /* CloseBraceToken */, "(": 17 /* OpenParenToken */, @@ -4412,7 +4515,7 @@ var ts; break; } } - return token = 240 /* JsxText */; + return token = 243 /* JsxText */; } // Scans a JSX identifier; these differ from normal identifiers in that // they allow dashes @@ -4643,6 +4746,41 @@ var ts; sourceFile.resolvedModules[moduleNameText] = resolvedModule; } ts.setResolvedModule = setResolvedModule; + function setResolvedTypeReferenceDirective(sourceFile, typeReferenceDirectiveName, resolvedTypeReferenceDirective) { + if (!sourceFile.resolvedTypeReferenceDirectiveNames) { + sourceFile.resolvedTypeReferenceDirectiveNames = {}; + } + sourceFile.resolvedTypeReferenceDirectiveNames[typeReferenceDirectiveName] = resolvedTypeReferenceDirective; + } + ts.setResolvedTypeReferenceDirective = setResolvedTypeReferenceDirective; + /* @internal */ + function moduleResolutionIsEqualTo(oldResolution, newResolution) { + return oldResolution.resolvedFileName === newResolution.resolvedFileName && oldResolution.isExternalLibraryImport === newResolution.isExternalLibraryImport; + } + ts.moduleResolutionIsEqualTo = moduleResolutionIsEqualTo; + /* @internal */ + function typeDirectiveIsEqualTo(oldResolution, newResolution) { + return oldResolution.resolvedFileName === newResolution.resolvedFileName && oldResolution.primary === newResolution.primary; + } + ts.typeDirectiveIsEqualTo = typeDirectiveIsEqualTo; + /* @internal */ + function hasChangesInResolutions(names, newResolutions, oldResolutions, comparer) { + if (names.length !== newResolutions.length) { + return false; + } + for (var i = 0; i < names.length; i++) { + var newResolution = newResolutions[i]; + var oldResolution = oldResolutions && ts.hasProperty(oldResolutions, names[i]) ? oldResolutions[names[i]] : undefined; + var changed = oldResolution + ? !newResolution || !comparer(oldResolution, newResolution) + : newResolution; + if (changed) { + return true; + } + } + return false; + } + ts.hasChangesInResolutions = hasChangesInResolutions; // Returns true if this node contains a parse error anywhere underneath it. function containsParseError(node) { aggregateChildData(node); @@ -4667,7 +4805,7 @@ var ts; } } function getSourceFileOfNode(node) { - while (node && node.kind !== 252 /* SourceFile */) { + while (node && node.kind !== 255 /* SourceFile */) { node = node.parent; } return node; @@ -4675,11 +4813,11 @@ var ts; ts.getSourceFileOfNode = getSourceFileOfNode; function isStatementWithLocals(node) { switch (node.kind) { - case 196 /* Block */: - case 224 /* CaseBlock */: - case 203 /* ForStatement */: - case 204 /* ForInStatement */: - case 205 /* ForOfStatement */: + case 198 /* Block */: + case 226 /* CaseBlock */: + case 205 /* ForStatement */: + case 206 /* ForInStatement */: + case 207 /* ForOfStatement */: return true; } return false; @@ -4701,6 +4839,32 @@ var ts; return node.pos; } ts.getStartPosOfNode = getStartPosOfNode; + function getEndLinePosition(line, sourceFile) { + ts.Debug.assert(line >= 0); + var lineStarts = ts.getLineStarts(sourceFile); + var lineIndex = line; + var sourceText = sourceFile.text; + if (lineIndex + 1 === lineStarts.length) { + // last line - return EOF + return sourceText.length - 1; + } + else { + // current line start + var start = lineStarts[lineIndex]; + // take the start position of the next line - 1 = it should be some line break + var pos = lineStarts[lineIndex + 1] - 1; + ts.Debug.assert(ts.isLineBreak(sourceText.charCodeAt(pos))); + // walk backwards skipping line breaks, stop the the beginning of current line. + // i.e: + // + // $ <- end of line for this position should match the start position + while (start <= pos && ts.isLineBreak(sourceText.charCodeAt(pos))) { + pos--; + } + return pos; + } + } + ts.getEndLinePosition = getEndLinePosition; // Returns true if this node is missing from the actual source code. A 'missing' node is different // from 'undefined/defined'. When a node is undefined (which can happen for optional nodes // in the tree), it is definitely missing. However, a node may be defined, but still be @@ -4783,13 +4947,13 @@ var ts; } ts.isBlockOrCatchScoped = isBlockOrCatchScoped; function isAmbientModule(node) { - return node && node.kind === 222 /* ModuleDeclaration */ && + return node && node.kind === 224 /* ModuleDeclaration */ && (node.name.kind === 9 /* StringLiteral */ || isGlobalScopeAugmentation(node)); } ts.isAmbientModule = isAmbientModule; function isBlockScopedContainerTopLevel(node) { - return node.kind === 252 /* SourceFile */ || - node.kind === 222 /* ModuleDeclaration */ || + return node.kind === 255 /* SourceFile */ || + node.kind === 224 /* ModuleDeclaration */ || isFunctionLike(node) || isFunctionBlock(node); } @@ -4806,10 +4970,10 @@ var ts; return false; } switch (node.parent.kind) { - case 252 /* SourceFile */: - return isExternalModule(node.parent); - case 223 /* ModuleBlock */: - return isAmbientModule(node.parent.parent) && !isExternalModule(node.parent.parent.parent); + case 255 /* SourceFile */: + return ts.isExternalModule(node.parent); + case 225 /* ModuleBlock */: + return isAmbientModule(node.parent.parent) && !ts.isExternalModule(node.parent.parent.parent); } return false; } @@ -4823,15 +4987,15 @@ var ts; return current; } switch (current.kind) { - case 252 /* SourceFile */: - case 224 /* CaseBlock */: - case 248 /* CatchClause */: - case 222 /* ModuleDeclaration */: - case 203 /* ForStatement */: - case 204 /* ForInStatement */: - case 205 /* ForOfStatement */: + case 255 /* SourceFile */: + case 226 /* CaseBlock */: + case 251 /* CatchClause */: + case 224 /* ModuleDeclaration */: + case 205 /* ForStatement */: + case 206 /* ForInStatement */: + case 207 /* ForOfStatement */: return current; - case 196 /* Block */: + case 198 /* Block */: // function block is not considered block-scope container // see comment in binder.ts: bind(...), case for SyntaxKind.Block if (!isFunctionLike(current.parent)) { @@ -4844,9 +5008,9 @@ var ts; ts.getEnclosingBlockScopeContainer = getEnclosingBlockScopeContainer; function isCatchClauseVariableDeclaration(declaration) { return declaration && - declaration.kind === 215 /* VariableDeclaration */ && + declaration.kind === 217 /* VariableDeclaration */ && declaration.parent && - declaration.parent.kind === 248 /* CatchClause */; + declaration.parent.kind === 251 /* CatchClause */; } ts.isCatchClauseVariableDeclaration = isCatchClauseVariableDeclaration; // Return display name of an identifier @@ -4882,10 +5046,23 @@ var ts; return ts.createTextSpanFromBounds(start, scanner.getTextPos()); } ts.getSpanOfTokenAtPosition = getSpanOfTokenAtPosition; + function getErrorSpanForArrowFunction(sourceFile, node) { + var pos = ts.skipTrivia(sourceFile.text, node.pos); + if (node.body && node.body.kind === 198 /* Block */) { + var startLine = ts.getLineAndCharacterOfPosition(sourceFile, node.body.pos).line; + var endLine = ts.getLineAndCharacterOfPosition(sourceFile, node.body.end).line; + if (startLine < endLine) { + // The arrow function spans multiple lines, + // make the error span be the first line, inclusive. + return ts.createTextSpan(pos, getEndLinePosition(startLine, sourceFile) - pos + 1); + } + } + return ts.createTextSpanFromBounds(pos, node.end); + } function getErrorSpanForNode(sourceFile, node) { var errorNode = node; switch (node.kind) { - case 252 /* SourceFile */: + case 255 /* 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 @@ -4894,22 +5071,24 @@ var ts; return getSpanOfTokenAtPosition(sourceFile, pos_1); // This list is a work in progress. Add missing node kinds to improve their error // spans. - case 215 /* VariableDeclaration */: - case 167 /* BindingElement */: - case 218 /* ClassDeclaration */: - case 190 /* ClassExpression */: - case 219 /* InterfaceDeclaration */: - case 222 /* ModuleDeclaration */: - case 221 /* EnumDeclaration */: - case 251 /* EnumMember */: - case 217 /* FunctionDeclaration */: - case 177 /* FunctionExpression */: - case 145 /* MethodDeclaration */: - case 147 /* GetAccessor */: - case 148 /* SetAccessor */: - case 220 /* TypeAliasDeclaration */: + case 217 /* VariableDeclaration */: + case 168 /* BindingElement */: + case 220 /* ClassDeclaration */: + case 191 /* ClassExpression */: + case 221 /* InterfaceDeclaration */: + case 224 /* ModuleDeclaration */: + case 223 /* EnumDeclaration */: + case 254 /* EnumMember */: + case 219 /* FunctionDeclaration */: + case 178 /* FunctionExpression */: + case 146 /* MethodDeclaration */: + case 148 /* GetAccessor */: + case 149 /* SetAccessor */: + case 222 /* TypeAliasDeclaration */: errorNode = node.name; break; + case 179 /* ArrowFunction */: + return getErrorSpanForArrowFunction(sourceFile, node); } if (errorNode === undefined) { // If we don't have a better node, then just set the error on the first token of @@ -4922,10 +5101,6 @@ var ts; return ts.createTextSpanFromBounds(pos, errorNode.end); } ts.getErrorSpanForNode = getErrorSpanForNode; - function isExternalModule(file) { - return file.externalModuleIndicator !== undefined; - } - ts.isExternalModule = isExternalModule; function isExternalOrCommonJsModule(file) { return (file.externalModuleIndicator || file.commonJsModuleIndicator) !== undefined; } @@ -4935,11 +5110,11 @@ var ts; } ts.isDeclarationFile = isDeclarationFile; function isConstEnumDeclaration(node) { - return node.kind === 221 /* EnumDeclaration */ && isConst(node); + return node.kind === 223 /* EnumDeclaration */ && isConst(node); } ts.isConstEnumDeclaration = isConstEnumDeclaration; function walkUpBindingElementsAndPatterns(node) { - while (node && (node.kind === 167 /* BindingElement */ || isBindingPattern(node))) { + while (node && (node.kind === 168 /* BindingElement */ || isBindingPattern(node))) { node = node.parent; } return node; @@ -4954,14 +5129,14 @@ var ts; function getCombinedNodeFlags(node) { node = walkUpBindingElementsAndPatterns(node); var flags = node.flags; - if (node.kind === 215 /* VariableDeclaration */) { + if (node.kind === 217 /* VariableDeclaration */) { node = node.parent; } - if (node && node.kind === 216 /* VariableDeclarationList */) { + if (node && node.kind === 218 /* VariableDeclarationList */) { flags |= node.flags; node = node.parent; } - if (node && node.kind === 197 /* VariableStatement */) { + if (node && node.kind === 199 /* VariableStatement */) { flags |= node.flags; } return flags; @@ -4976,11 +5151,11 @@ var ts; } ts.isLet = isLet; function isSuperCallExpression(n) { - return n.kind === 172 /* CallExpression */ && n.expression.kind === 95 /* SuperKeyword */; + return n.kind === 173 /* CallExpression */ && n.expression.kind === 95 /* SuperKeyword */; } ts.isSuperCallExpression = isSuperCallExpression; function isPrologueDirective(node) { - return node.kind === 199 /* ExpressionStatement */ && node.expression.kind === 9 /* StringLiteral */; + return node.kind === 201 /* ExpressionStatement */ && node.expression.kind === 9 /* StringLiteral */; } ts.isPrologueDirective = isPrologueDirective; function getLeadingCommentRangesOfNode(node, sourceFileOfNode) { @@ -4996,7 +5171,7 @@ var ts; } ts.getJsDocComments = getJsDocComments; function getJsDocCommentsFromText(node, text) { - var commentRanges = (node.kind === 140 /* Parameter */ || node.kind === 139 /* TypeParameter */) ? + var commentRanges = (node.kind === 141 /* Parameter */ || node.kind === 140 /* TypeParameter */) ? ts.concatenate(ts.getTrailingCommentRanges(text, node.pos), ts.getLeadingCommentRanges(text, node.pos)) : getLeadingCommentRangesOfNodeFromText(node, text); return ts.filter(commentRanges, isJsDocComment); @@ -5009,9 +5184,10 @@ var ts; } ts.getJsDocCommentsFromText = getJsDocCommentsFromText; ts.fullTripleSlashReferencePathRegEx = /^(\/\/\/\s*/; + ts.fullTripleSlashReferenceTypeReferenceDirectiveRegEx = /^(\/\/\/\s*/; ts.fullTripleSlashAMDReferencePathRegEx = /^(\/\/\/\s*/; function isTypeNode(node) { - if (152 /* FirstTypeNode */ <= node.kind && node.kind <= 164 /* LastTypeNode */) { + if (153 /* FirstTypeNode */ <= node.kind && node.kind <= 165 /* LastTypeNode */) { return true; } switch (node.kind) { @@ -5020,28 +5196,29 @@ var ts; case 131 /* StringKeyword */: case 120 /* BooleanKeyword */: case 132 /* SymbolKeyword */: + case 134 /* UndefinedKeyword */: return true; case 103 /* VoidKeyword */: - return node.parent.kind !== 181 /* VoidExpression */; - case 192 /* ExpressionWithTypeArguments */: + return node.parent.kind !== 182 /* VoidExpression */; + case 193 /* 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 */: // If the identifier is the RHS of a qualified name, then it's a type iff its parent is. - if (node.parent.kind === 137 /* QualifiedName */ && node.parent.right === node) { + if (node.parent.kind === 138 /* QualifiedName */ && node.parent.right === node) { node = node.parent; } - else if (node.parent.kind === 170 /* PropertyAccessExpression */ && node.parent.name === node) { + else if (node.parent.kind === 171 /* 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 === 137 /* QualifiedName */ || node.kind === 170 /* PropertyAccessExpression */, "'node' was expected to be a qualified name, identifier or property access in 'isTypeNode'."); - case 137 /* QualifiedName */: - case 170 /* PropertyAccessExpression */: + ts.Debug.assert(node.kind === 69 /* Identifier */ || node.kind === 138 /* QualifiedName */ || node.kind === 171 /* PropertyAccessExpression */, "'node' was expected to be a qualified name, identifier or property access in 'isTypeNode'."); + case 138 /* QualifiedName */: + case 171 /* PropertyAccessExpression */: case 97 /* ThisKeyword */: var parent_1 = node.parent; - if (parent_1.kind === 156 /* TypeQuery */) { + if (parent_1.kind === 157 /* TypeQuery */) { return false; } // Do not recursively call isTypeNode on the parent. In the example: @@ -5050,38 +5227,38 @@ var ts; // // Calling isTypeNode would consider the qualified name A.B a type node. Only C or // A.B.C is a type node. - if (152 /* FirstTypeNode */ <= parent_1.kind && parent_1.kind <= 164 /* LastTypeNode */) { + if (153 /* FirstTypeNode */ <= parent_1.kind && parent_1.kind <= 165 /* LastTypeNode */) { return true; } switch (parent_1.kind) { - case 192 /* ExpressionWithTypeArguments */: + case 193 /* ExpressionWithTypeArguments */: return !isExpressionWithTypeArgumentsInClassExtendsClause(parent_1); - case 139 /* TypeParameter */: + case 140 /* TypeParameter */: return node === parent_1.constraint; - case 143 /* PropertyDeclaration */: - case 142 /* PropertySignature */: - case 140 /* Parameter */: - case 215 /* VariableDeclaration */: + case 144 /* PropertyDeclaration */: + case 143 /* PropertySignature */: + case 141 /* Parameter */: + case 217 /* VariableDeclaration */: return node === parent_1.type; - case 217 /* FunctionDeclaration */: - case 177 /* FunctionExpression */: - case 178 /* ArrowFunction */: - case 146 /* Constructor */: - case 145 /* MethodDeclaration */: - case 144 /* MethodSignature */: - case 147 /* GetAccessor */: - case 148 /* SetAccessor */: + case 219 /* FunctionDeclaration */: + case 178 /* FunctionExpression */: + case 179 /* ArrowFunction */: + case 147 /* Constructor */: + case 146 /* MethodDeclaration */: + case 145 /* MethodSignature */: + case 148 /* GetAccessor */: + case 149 /* SetAccessor */: return node === parent_1.type; - case 149 /* CallSignature */: - case 150 /* ConstructSignature */: - case 151 /* IndexSignature */: + case 150 /* CallSignature */: + case 151 /* ConstructSignature */: + case 152 /* IndexSignature */: return node === parent_1.type; - case 175 /* TypeAssertionExpression */: + case 176 /* TypeAssertionExpression */: return node === parent_1.type; - case 172 /* CallExpression */: - case 173 /* NewExpression */: + case 173 /* CallExpression */: + case 174 /* NewExpression */: return parent_1.typeArguments && ts.indexOf(parent_1.typeArguments, node) >= 0; - case 174 /* TaggedTemplateExpression */: + case 175 /* TaggedTemplateExpression */: // TODO (drosen): TaggedTemplateExpressions may eventually support type arguments. return false; } @@ -5095,23 +5272,23 @@ var ts; return traverse(body); function traverse(node) { switch (node.kind) { - case 208 /* ReturnStatement */: + case 210 /* ReturnStatement */: return visitor(node); - case 224 /* CaseBlock */: - case 196 /* Block */: - case 200 /* IfStatement */: - case 201 /* DoStatement */: - case 202 /* WhileStatement */: - case 203 /* ForStatement */: - case 204 /* ForInStatement */: - case 205 /* ForOfStatement */: - case 209 /* WithStatement */: - case 210 /* SwitchStatement */: - case 245 /* CaseClause */: - case 246 /* DefaultClause */: - case 211 /* LabeledStatement */: - case 213 /* TryStatement */: - case 248 /* CatchClause */: + case 226 /* CaseBlock */: + case 198 /* Block */: + case 202 /* IfStatement */: + case 203 /* DoStatement */: + case 204 /* WhileStatement */: + case 205 /* ForStatement */: + case 206 /* ForInStatement */: + case 207 /* ForOfStatement */: + case 211 /* WithStatement */: + case 212 /* SwitchStatement */: + case 248 /* CaseClause */: + case 249 /* DefaultClause */: + case 213 /* LabeledStatement */: + case 215 /* TryStatement */: + case 251 /* CatchClause */: return ts.forEachChild(node, traverse); } } @@ -5121,18 +5298,18 @@ var ts; return traverse(body); function traverse(node) { switch (node.kind) { - case 188 /* YieldExpression */: + case 189 /* YieldExpression */: visitor(node); var operand = node.expression; if (operand) { traverse(operand); } - case 221 /* EnumDeclaration */: - case 219 /* InterfaceDeclaration */: - case 222 /* ModuleDeclaration */: - case 220 /* TypeAliasDeclaration */: - case 218 /* ClassDeclaration */: - case 190 /* ClassExpression */: + case 223 /* EnumDeclaration */: + case 221 /* InterfaceDeclaration */: + case 224 /* ModuleDeclaration */: + case 222 /* TypeAliasDeclaration */: + case 220 /* ClassDeclaration */: + case 191 /* 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. @@ -5140,7 +5317,7 @@ var ts; default: if (isFunctionLike(node)) { var name_5 = node.name; - if (name_5 && name_5.kind === 138 /* ComputedPropertyName */) { + if (name_5 && name_5.kind === 139 /* 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); @@ -5159,14 +5336,14 @@ var ts; function isVariableLike(node) { if (node) { switch (node.kind) { - case 167 /* BindingElement */: - case 251 /* EnumMember */: - case 140 /* Parameter */: - case 249 /* PropertyAssignment */: - case 143 /* PropertyDeclaration */: - case 142 /* PropertySignature */: - case 250 /* ShorthandPropertyAssignment */: - case 215 /* VariableDeclaration */: + case 168 /* BindingElement */: + case 254 /* EnumMember */: + case 141 /* Parameter */: + case 252 /* PropertyAssignment */: + case 144 /* PropertyDeclaration */: + case 143 /* PropertySignature */: + case 253 /* ShorthandPropertyAssignment */: + case 217 /* VariableDeclaration */: return true; } } @@ -5174,11 +5351,11 @@ var ts; } ts.isVariableLike = isVariableLike; function isAccessor(node) { - return node && (node.kind === 147 /* GetAccessor */ || node.kind === 148 /* SetAccessor */); + return node && (node.kind === 148 /* GetAccessor */ || node.kind === 149 /* SetAccessor */); } ts.isAccessor = isAccessor; function isClassLike(node) { - return node && (node.kind === 218 /* ClassDeclaration */ || node.kind === 190 /* ClassExpression */); + return node && (node.kind === 220 /* ClassDeclaration */ || node.kind === 191 /* ClassExpression */); } ts.isClassLike = isClassLike; function isFunctionLike(node) { @@ -5187,32 +5364,32 @@ var ts; ts.isFunctionLike = isFunctionLike; function isFunctionLikeKind(kind) { switch (kind) { - case 146 /* Constructor */: - case 177 /* FunctionExpression */: - case 217 /* FunctionDeclaration */: - case 178 /* ArrowFunction */: - case 145 /* MethodDeclaration */: - case 144 /* MethodSignature */: - case 147 /* GetAccessor */: - case 148 /* SetAccessor */: - case 149 /* CallSignature */: - case 150 /* ConstructSignature */: - case 151 /* IndexSignature */: - case 154 /* FunctionType */: - case 155 /* ConstructorType */: + case 147 /* Constructor */: + case 178 /* FunctionExpression */: + case 219 /* FunctionDeclaration */: + case 179 /* ArrowFunction */: + case 146 /* MethodDeclaration */: + case 145 /* MethodSignature */: + case 148 /* GetAccessor */: + case 149 /* SetAccessor */: + case 150 /* CallSignature */: + case 151 /* ConstructSignature */: + case 152 /* IndexSignature */: + case 155 /* FunctionType */: + case 156 /* ConstructorType */: return true; } } ts.isFunctionLikeKind = isFunctionLikeKind; function introducesArgumentsExoticObject(node) { switch (node.kind) { - case 145 /* MethodDeclaration */: - case 144 /* MethodSignature */: - case 146 /* Constructor */: - case 147 /* GetAccessor */: - case 148 /* SetAccessor */: - case 217 /* FunctionDeclaration */: - case 177 /* FunctionExpression */: + case 146 /* MethodDeclaration */: + case 145 /* MethodSignature */: + case 147 /* Constructor */: + case 148 /* GetAccessor */: + case 149 /* SetAccessor */: + case 219 /* FunctionDeclaration */: + case 178 /* FunctionExpression */: return true; } return false; @@ -5220,24 +5397,24 @@ var ts; ts.introducesArgumentsExoticObject = introducesArgumentsExoticObject; function isIterationStatement(node, lookInLabeledStatements) { switch (node.kind) { - case 203 /* ForStatement */: - case 204 /* ForInStatement */: - case 205 /* ForOfStatement */: - case 201 /* DoStatement */: - case 202 /* WhileStatement */: + case 205 /* ForStatement */: + case 206 /* ForInStatement */: + case 207 /* ForOfStatement */: + case 203 /* DoStatement */: + case 204 /* WhileStatement */: return true; - case 211 /* LabeledStatement */: + case 213 /* LabeledStatement */: return lookInLabeledStatements && isIterationStatement(node.statement, lookInLabeledStatements); } return false; } ts.isIterationStatement = isIterationStatement; function isFunctionBlock(node) { - return node && node.kind === 196 /* Block */ && isFunctionLike(node.parent); + return node && node.kind === 198 /* Block */ && isFunctionLike(node.parent); } ts.isFunctionBlock = isFunctionBlock; function isObjectLiteralMethod(node) { - return node && node.kind === 145 /* MethodDeclaration */ && node.parent.kind === 169 /* ObjectLiteralExpression */; + return node && node.kind === 146 /* MethodDeclaration */ && node.parent.kind === 170 /* ObjectLiteralExpression */; } ts.isObjectLiteralMethod = isObjectLiteralMethod; function isIdentifierTypePredicate(predicate) { @@ -5273,7 +5450,7 @@ var ts; return undefined; } switch (node.kind) { - case 138 /* ComputedPropertyName */: + case 139 /* 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 @@ -5288,9 +5465,9 @@ var ts; // the *body* of the container. node = node.parent; break; - case 141 /* Decorator */: + case 142 /* Decorator */: // Decorators are always applied outside of the body of a class or method. - if (node.parent.kind === 140 /* Parameter */ && isClassElement(node.parent.parent)) { + if (node.parent.kind === 141 /* 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; @@ -5301,26 +5478,26 @@ var ts; node = node.parent; } break; - case 178 /* ArrowFunction */: + case 179 /* ArrowFunction */: if (!includeArrowFunctions) { continue; } // Fall through - case 217 /* FunctionDeclaration */: - case 177 /* FunctionExpression */: - case 222 /* ModuleDeclaration */: - case 143 /* PropertyDeclaration */: - case 142 /* PropertySignature */: - case 145 /* MethodDeclaration */: - case 144 /* MethodSignature */: - case 146 /* Constructor */: - case 147 /* GetAccessor */: - case 148 /* SetAccessor */: - case 149 /* CallSignature */: - case 150 /* ConstructSignature */: - case 151 /* IndexSignature */: - case 221 /* EnumDeclaration */: - case 252 /* SourceFile */: + case 219 /* FunctionDeclaration */: + case 178 /* FunctionExpression */: + case 224 /* ModuleDeclaration */: + case 144 /* PropertyDeclaration */: + case 143 /* PropertySignature */: + case 146 /* MethodDeclaration */: + case 145 /* MethodSignature */: + case 147 /* Constructor */: + case 148 /* GetAccessor */: + case 149 /* SetAccessor */: + case 150 /* CallSignature */: + case 151 /* ConstructSignature */: + case 152 /* IndexSignature */: + case 223 /* EnumDeclaration */: + case 255 /* SourceFile */: return node; } } @@ -5341,26 +5518,26 @@ var ts; return node; } switch (node.kind) { - case 138 /* ComputedPropertyName */: + case 139 /* ComputedPropertyName */: node = node.parent; break; - case 217 /* FunctionDeclaration */: - case 177 /* FunctionExpression */: - case 178 /* ArrowFunction */: + case 219 /* FunctionDeclaration */: + case 178 /* FunctionExpression */: + case 179 /* ArrowFunction */: if (!stopOnFunctions) { continue; } - case 143 /* PropertyDeclaration */: - case 142 /* PropertySignature */: - case 145 /* MethodDeclaration */: - case 144 /* MethodSignature */: - case 146 /* Constructor */: - case 147 /* GetAccessor */: - case 148 /* SetAccessor */: + case 144 /* PropertyDeclaration */: + case 143 /* PropertySignature */: + case 146 /* MethodDeclaration */: + case 145 /* MethodSignature */: + case 147 /* Constructor */: + case 148 /* GetAccessor */: + case 149 /* SetAccessor */: return node; - case 141 /* Decorator */: + case 142 /* Decorator */: // Decorators are always applied outside of the body of a class or method. - if (node.parent.kind === 140 /* Parameter */ && isClassElement(node.parent.parent)) { + if (node.parent.kind === 141 /* 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; @@ -5379,20 +5556,20 @@ var ts; * Determines whether a node is a property or element access expression for super. */ function isSuperPropertyOrElementAccess(node) { - return (node.kind === 170 /* PropertyAccessExpression */ - || node.kind === 171 /* ElementAccessExpression */) + return (node.kind === 171 /* PropertyAccessExpression */ + || node.kind === 172 /* ElementAccessExpression */) && node.expression.kind === 95 /* SuperKeyword */; } ts.isSuperPropertyOrElementAccess = isSuperPropertyOrElementAccess; function getEntityNameFromTypeNode(node) { if (node) { switch (node.kind) { - case 153 /* TypeReference */: + case 154 /* TypeReference */: return node.typeName; - case 192 /* ExpressionWithTypeArguments */: + case 193 /* ExpressionWithTypeArguments */: return node.expression; case 69 /* Identifier */: - case 137 /* QualifiedName */: + case 138 /* QualifiedName */: return node; } } @@ -5400,7 +5577,7 @@ var ts; } ts.getEntityNameFromTypeNode = getEntityNameFromTypeNode; function getInvokedExpression(node) { - if (node.kind === 174 /* TaggedTemplateExpression */) { + if (node.kind === 175 /* TaggedTemplateExpression */) { return node.tag; } // Will either be a CallExpression, NewExpression, or Decorator. @@ -5409,25 +5586,25 @@ var ts; ts.getInvokedExpression = getInvokedExpression; function nodeCanBeDecorated(node) { switch (node.kind) { - case 218 /* ClassDeclaration */: + case 220 /* ClassDeclaration */: // classes are valid targets return true; - case 143 /* PropertyDeclaration */: + case 144 /* PropertyDeclaration */: // property declarations are valid if their parent is a class declaration. - return node.parent.kind === 218 /* ClassDeclaration */; - case 147 /* GetAccessor */: - case 148 /* SetAccessor */: - case 145 /* MethodDeclaration */: + return node.parent.kind === 220 /* ClassDeclaration */; + case 148 /* GetAccessor */: + case 149 /* SetAccessor */: + case 146 /* 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 === 218 /* ClassDeclaration */; - case 140 /* Parameter */: + && node.parent.kind === 220 /* ClassDeclaration */; + case 141 /* 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 === 146 /* Constructor */ - || node.parent.kind === 145 /* MethodDeclaration */ - || node.parent.kind === 148 /* SetAccessor */) - && node.parent.parent.kind === 218 /* ClassDeclaration */; + && (node.parent.kind === 147 /* Constructor */ + || node.parent.kind === 146 /* MethodDeclaration */ + || node.parent.kind === 149 /* SetAccessor */) + && node.parent.parent.kind === 220 /* ClassDeclaration */; } return false; } @@ -5438,13 +5615,23 @@ var ts; } ts.nodeIsDecorated = nodeIsDecorated; function isPropertyAccessExpression(node) { - return node.kind === 170 /* PropertyAccessExpression */; + return node.kind === 171 /* PropertyAccessExpression */; } ts.isPropertyAccessExpression = isPropertyAccessExpression; function isElementAccessExpression(node) { - return node.kind === 171 /* ElementAccessExpression */; + return node.kind === 172 /* ElementAccessExpression */; } ts.isElementAccessExpression = isElementAccessExpression; + function isJSXTagName(node) { + var parent = node.parent; + if (parent.kind === 242 /* JsxOpeningElement */ || + parent.kind === 241 /* JsxSelfClosingElement */ || + parent.kind === 244 /* JsxClosingElement */) { + return parent.tagName === node; + } + return false; + } + ts.isJSXTagName = isJSXTagName; function isExpression(node) { switch (node.kind) { case 95 /* SuperKeyword */: @@ -5452,42 +5639,43 @@ var ts; case 99 /* TrueKeyword */: case 84 /* FalseKeyword */: case 10 /* RegularExpressionLiteral */: - case 168 /* ArrayLiteralExpression */: - case 169 /* ObjectLiteralExpression */: - case 170 /* PropertyAccessExpression */: - case 171 /* ElementAccessExpression */: - case 172 /* CallExpression */: - case 173 /* NewExpression */: - case 174 /* TaggedTemplateExpression */: - case 193 /* AsExpression */: - case 175 /* TypeAssertionExpression */: - case 176 /* ParenthesizedExpression */: - case 177 /* FunctionExpression */: - case 190 /* ClassExpression */: - case 178 /* ArrowFunction */: - case 181 /* VoidExpression */: - case 179 /* DeleteExpression */: - case 180 /* TypeOfExpression */: - case 183 /* PrefixUnaryExpression */: - case 184 /* PostfixUnaryExpression */: - case 185 /* BinaryExpression */: - case 186 /* ConditionalExpression */: - case 189 /* SpreadElementExpression */: - case 187 /* TemplateExpression */: + case 169 /* ArrayLiteralExpression */: + case 170 /* ObjectLiteralExpression */: + case 171 /* PropertyAccessExpression */: + case 172 /* ElementAccessExpression */: + case 173 /* CallExpression */: + case 174 /* NewExpression */: + case 175 /* TaggedTemplateExpression */: + case 194 /* AsExpression */: + case 176 /* TypeAssertionExpression */: + case 195 /* NonNullExpression */: + case 177 /* ParenthesizedExpression */: + case 178 /* FunctionExpression */: + case 191 /* ClassExpression */: + case 179 /* ArrowFunction */: + case 182 /* VoidExpression */: + case 180 /* DeleteExpression */: + case 181 /* TypeOfExpression */: + case 184 /* PrefixUnaryExpression */: + case 185 /* PostfixUnaryExpression */: + case 186 /* BinaryExpression */: + case 187 /* ConditionalExpression */: + case 190 /* SpreadElementExpression */: + case 188 /* TemplateExpression */: case 11 /* NoSubstitutionTemplateLiteral */: - case 191 /* OmittedExpression */: - case 237 /* JsxElement */: - case 238 /* JsxSelfClosingElement */: - case 188 /* YieldExpression */: - case 182 /* AwaitExpression */: + case 192 /* OmittedExpression */: + case 240 /* JsxElement */: + case 241 /* JsxSelfClosingElement */: + case 189 /* YieldExpression */: + case 183 /* AwaitExpression */: return true; - case 137 /* QualifiedName */: - while (node.parent.kind === 137 /* QualifiedName */) { + case 138 /* QualifiedName */: + while (node.parent.kind === 138 /* QualifiedName */) { node = node.parent; } - return node.parent.kind === 156 /* TypeQuery */; + return node.parent.kind === 157 /* TypeQuery */ || isJSXTagName(node); case 69 /* Identifier */: - if (node.parent.kind === 156 /* TypeQuery */) { + if (node.parent.kind === 157 /* TypeQuery */ || isJSXTagName(node)) { return true; } // fall through @@ -5496,47 +5684,47 @@ var ts; case 97 /* ThisKeyword */: var parent_2 = node.parent; switch (parent_2.kind) { - case 215 /* VariableDeclaration */: - case 140 /* Parameter */: - case 143 /* PropertyDeclaration */: - case 142 /* PropertySignature */: - case 251 /* EnumMember */: - case 249 /* PropertyAssignment */: - case 167 /* BindingElement */: + case 217 /* VariableDeclaration */: + case 141 /* Parameter */: + case 144 /* PropertyDeclaration */: + case 143 /* PropertySignature */: + case 254 /* EnumMember */: + case 252 /* PropertyAssignment */: + case 168 /* BindingElement */: return parent_2.initializer === node; - case 199 /* ExpressionStatement */: - case 200 /* IfStatement */: - case 201 /* DoStatement */: - case 202 /* WhileStatement */: - case 208 /* ReturnStatement */: - case 209 /* WithStatement */: - case 210 /* SwitchStatement */: - case 245 /* CaseClause */: - case 212 /* ThrowStatement */: - case 210 /* SwitchStatement */: + case 201 /* ExpressionStatement */: + case 202 /* IfStatement */: + case 203 /* DoStatement */: + case 204 /* WhileStatement */: + case 210 /* ReturnStatement */: + case 211 /* WithStatement */: + case 212 /* SwitchStatement */: + case 248 /* CaseClause */: + case 214 /* ThrowStatement */: + case 212 /* SwitchStatement */: return parent_2.expression === node; - case 203 /* ForStatement */: + case 205 /* ForStatement */: var forStatement = parent_2; - return (forStatement.initializer === node && forStatement.initializer.kind !== 216 /* VariableDeclarationList */) || + return (forStatement.initializer === node && forStatement.initializer.kind !== 218 /* VariableDeclarationList */) || forStatement.condition === node || forStatement.incrementor === node; - case 204 /* ForInStatement */: - case 205 /* ForOfStatement */: + case 206 /* ForInStatement */: + case 207 /* ForOfStatement */: var forInStatement = parent_2; - return (forInStatement.initializer === node && forInStatement.initializer.kind !== 216 /* VariableDeclarationList */) || + return (forInStatement.initializer === node && forInStatement.initializer.kind !== 218 /* VariableDeclarationList */) || forInStatement.expression === node; - case 175 /* TypeAssertionExpression */: - case 193 /* AsExpression */: + case 176 /* TypeAssertionExpression */: + case 194 /* AsExpression */: return node === parent_2.expression; - case 194 /* TemplateSpan */: + case 196 /* TemplateSpan */: return node === parent_2.expression; - case 138 /* ComputedPropertyName */: + case 139 /* ComputedPropertyName */: return node === parent_2.expression; - case 141 /* Decorator */: - case 244 /* JsxExpression */: - case 243 /* JsxSpreadAttribute */: + case 142 /* Decorator */: + case 247 /* JsxExpression */: + case 246 /* JsxSpreadAttribute */: return true; - case 192 /* ExpressionWithTypeArguments */: + case 193 /* ExpressionWithTypeArguments */: return parent_2.expression === node && isExpressionWithTypeArgumentsInClassExtendsClause(parent_2); default: if (isExpression(parent_2)) { @@ -5560,7 +5748,7 @@ var ts; } ts.isInstantiatedModule = isInstantiatedModule; function isExternalModuleImportEqualsDeclaration(node) { - return node.kind === 225 /* ImportEqualsDeclaration */ && node.moduleReference.kind === 236 /* ExternalModuleReference */; + return node.kind === 228 /* ImportEqualsDeclaration */ && node.moduleReference.kind === 239 /* ExternalModuleReference */; } ts.isExternalModuleImportEqualsDeclaration = isExternalModuleImportEqualsDeclaration; function getExternalModuleImportEqualsDeclarationExpression(node) { @@ -5569,7 +5757,7 @@ var ts; } ts.getExternalModuleImportEqualsDeclarationExpression = getExternalModuleImportEqualsDeclarationExpression; function isInternalModuleImportEqualsDeclaration(node) { - return node.kind === 225 /* ImportEqualsDeclaration */ && node.moduleReference.kind !== 236 /* ExternalModuleReference */; + return node.kind === 228 /* ImportEqualsDeclaration */ && node.moduleReference.kind !== 239 /* ExternalModuleReference */; } ts.isInternalModuleImportEqualsDeclaration = isInternalModuleImportEqualsDeclaration; function isSourceFileJavaScript(file) { @@ -5587,7 +5775,7 @@ var ts; */ function isRequireCall(expression, checkArgumentIsStringLiteral) { // of the form 'require("name")' - var isRequire = expression.kind === 172 /* CallExpression */ && + var isRequire = expression.kind === 173 /* CallExpression */ && expression.expression.kind === 69 /* Identifier */ && expression.expression.text === "require" && expression.arguments.length === 1; @@ -5597,11 +5785,14 @@ var ts; /// Given a BinaryExpression, returns SpecialPropertyAssignmentKind for the various kinds of property /// assignments we treat as special in the binder function getSpecialPropertyAssignmentKind(expression) { - if (expression.kind !== 185 /* BinaryExpression */) { + if (!isInJavaScriptFile(expression)) { + return 0 /* None */; + } + if (expression.kind !== 186 /* BinaryExpression */) { return 0 /* None */; } var expr = expression; - if (expr.operatorToken.kind !== 56 /* EqualsToken */ || expr.left.kind !== 170 /* PropertyAccessExpression */) { + if (expr.operatorToken.kind !== 56 /* EqualsToken */ || expr.left.kind !== 171 /* PropertyAccessExpression */) { return 0 /* None */; } var lhs = expr.left; @@ -5619,7 +5810,7 @@ var ts; else if (lhs.expression.kind === 97 /* ThisKeyword */) { return 4 /* ThisProperty */; } - else if (lhs.expression.kind === 170 /* PropertyAccessExpression */) { + else if (lhs.expression.kind === 171 /* 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 */ && innerPropertyAccess.name.text === "prototype") { @@ -5630,19 +5821,19 @@ var ts; } ts.getSpecialPropertyAssignmentKind = getSpecialPropertyAssignmentKind; function getExternalModuleName(node) { - if (node.kind === 226 /* ImportDeclaration */) { + if (node.kind === 229 /* ImportDeclaration */) { return node.moduleSpecifier; } - if (node.kind === 225 /* ImportEqualsDeclaration */) { + if (node.kind === 228 /* ImportEqualsDeclaration */) { var reference = node.moduleReference; - if (reference.kind === 236 /* ExternalModuleReference */) { + if (reference.kind === 239 /* ExternalModuleReference */) { return reference.expression; } } - if (node.kind === 232 /* ExportDeclaration */) { + if (node.kind === 235 /* ExportDeclaration */) { return node.moduleSpecifier; } - if (node.kind === 222 /* ModuleDeclaration */ && node.name.kind === 9 /* StringLiteral */) { + if (node.kind === 224 /* ModuleDeclaration */ && node.name.kind === 9 /* StringLiteral */) { return node.name; } } @@ -5650,13 +5841,13 @@ var ts; function hasQuestionToken(node) { if (node) { switch (node.kind) { - case 140 /* Parameter */: - case 145 /* MethodDeclaration */: - case 144 /* MethodSignature */: - case 250 /* ShorthandPropertyAssignment */: - case 249 /* PropertyAssignment */: - case 143 /* PropertyDeclaration */: - case 142 /* PropertySignature */: + case 141 /* Parameter */: + case 146 /* MethodDeclaration */: + case 145 /* MethodSignature */: + case 253 /* ShorthandPropertyAssignment */: + case 252 /* PropertyAssignment */: + case 144 /* PropertyDeclaration */: + case 143 /* PropertySignature */: return node.questionToken !== undefined; } } @@ -5664,9 +5855,9 @@ var ts; } ts.hasQuestionToken = hasQuestionToken; function isJSDocConstructSignature(node) { - return node.kind === 265 /* JSDocFunctionType */ && + return node.kind === 268 /* JSDocFunctionType */ && node.parameters.length > 0 && - node.parameters[0].type.kind === 267 /* JSDocConstructorType */; + node.parameters[0].type.kind === 270 /* JSDocConstructorType */; } ts.isJSDocConstructSignature = isJSDocConstructSignature; function getJSDocTag(node, kind, checkParentVariableStatement) { @@ -5695,9 +5886,9 @@ var ts; // */ // var x = function(name) { return name.length; } if (checkParentVariableStatement) { - var isInitializerOfVariableDeclarationInStatement = node.parent.kind === 215 /* VariableDeclaration */ && + var isInitializerOfVariableDeclarationInStatement = node.parent.kind === 217 /* VariableDeclaration */ && node.parent.initializer === node && - node.parent.parent.parent.kind === 197 /* VariableStatement */; + node.parent.parent.parent.kind === 199 /* VariableStatement */; var variableStatementNode = isInitializerOfVariableDeclarationInStatement ? node.parent.parent.parent : undefined; if (variableStatementNode) { return variableStatementNode.jsDocComment; @@ -5705,13 +5896,13 @@ var ts; // Also recognize when the node is the RHS of an assignment expression var parent_3 = node.parent; var isSourceOfAssignmentExpressionStatement = parent_3 && parent_3.parent && - parent_3.kind === 185 /* BinaryExpression */ && + parent_3.kind === 186 /* BinaryExpression */ && parent_3.operatorToken.kind === 56 /* EqualsToken */ && - parent_3.parent.kind === 199 /* ExpressionStatement */; + parent_3.parent.kind === 201 /* ExpressionStatement */; if (isSourceOfAssignmentExpressionStatement) { return parent_3.parent.jsDocComment; } - var isPropertyAssignmentExpression = parent_3 && parent_3.kind === 249 /* PropertyAssignment */; + var isPropertyAssignmentExpression = parent_3 && parent_3.kind === 252 /* PropertyAssignment */; if (isPropertyAssignmentExpression) { return parent_3.jsDocComment; } @@ -5719,15 +5910,15 @@ var ts; return undefined; } function getJSDocTypeTag(node) { - return getJSDocTag(node, 273 /* JSDocTypeTag */, /*checkParentVariableStatement*/ false); + return getJSDocTag(node, 276 /* JSDocTypeTag */, /*checkParentVariableStatement*/ false); } ts.getJSDocTypeTag = getJSDocTypeTag; function getJSDocReturnTag(node) { - return getJSDocTag(node, 272 /* JSDocReturnTag */, /*checkParentVariableStatement*/ true); + return getJSDocTag(node, 275 /* JSDocReturnTag */, /*checkParentVariableStatement*/ true); } ts.getJSDocReturnTag = getJSDocReturnTag; function getJSDocTemplateTag(node) { - return getJSDocTag(node, 274 /* JSDocTemplateTag */, /*checkParentVariableStatement*/ false); + return getJSDocTag(node, 277 /* JSDocTemplateTag */, /*checkParentVariableStatement*/ false); } ts.getJSDocTemplateTag = getJSDocTemplateTag; function getCorrespondingJSDocParameterTag(parameter) { @@ -5739,7 +5930,7 @@ var ts; if (jsDocComment) { for (var _i = 0, _a = jsDocComment.tags; _i < _a.length; _i++) { var tag = _a[_i]; - if (tag.kind === 271 /* JSDocParameterTag */) { + if (tag.kind === 274 /* JSDocParameterTag */) { var parameterTag = tag; var name_6 = parameterTag.preParameterName || parameterTag.postParameterName; if (name_6.text === parameterName) { @@ -5759,12 +5950,12 @@ var ts; function isRestParameter(node) { if (node) { if (node.flags & 134217728 /* JavaScriptFile */) { - if (node.type && node.type.kind === 266 /* JSDocVariadicType */) { + if (node.type && node.type.kind === 269 /* JSDocVariadicType */) { return true; } var paramTag = getCorrespondingJSDocParameterTag(node); if (paramTag && paramTag.typeExpression) { - return paramTag.typeExpression.type.kind === 266 /* JSDocVariadicType */; + return paramTag.typeExpression.type.kind === 269 /* JSDocVariadicType */; } } return node.dotDotDotToken !== undefined; @@ -5785,7 +5976,7 @@ var ts; } ts.isTemplateLiteralKind = isTemplateLiteralKind; function isBindingPattern(node) { - return !!node && (node.kind === 166 /* ArrayBindingPattern */ || node.kind === 165 /* ObjectBindingPattern */); + return !!node && (node.kind === 167 /* ArrayBindingPattern */ || node.kind === 166 /* ObjectBindingPattern */); } ts.isBindingPattern = isBindingPattern; function isNodeDescendentOf(node, ancestor) { @@ -5799,7 +5990,7 @@ var ts; ts.isNodeDescendentOf = isNodeDescendentOf; function isInAmbientContext(node) { while (node) { - if (node.flags & 2 /* Ambient */ || (node.kind === 252 /* SourceFile */ && node.isDeclarationFile)) { + if (node.flags & 2 /* Ambient */ || (node.kind === 255 /* SourceFile */ && node.isDeclarationFile)) { return true; } node = node.parent; @@ -5809,34 +6000,34 @@ var ts; ts.isInAmbientContext = isInAmbientContext; function isDeclaration(node) { switch (node.kind) { - case 178 /* ArrowFunction */: - case 167 /* BindingElement */: - case 218 /* ClassDeclaration */: - case 190 /* ClassExpression */: - case 146 /* Constructor */: - case 221 /* EnumDeclaration */: - case 251 /* EnumMember */: - case 234 /* ExportSpecifier */: - case 217 /* FunctionDeclaration */: - case 177 /* FunctionExpression */: - case 147 /* GetAccessor */: - case 227 /* ImportClause */: - case 225 /* ImportEqualsDeclaration */: - case 230 /* ImportSpecifier */: - case 219 /* InterfaceDeclaration */: - case 145 /* MethodDeclaration */: - case 144 /* MethodSignature */: - case 222 /* ModuleDeclaration */: - case 228 /* NamespaceImport */: - case 140 /* Parameter */: - case 249 /* PropertyAssignment */: - case 143 /* PropertyDeclaration */: - case 142 /* PropertySignature */: - case 148 /* SetAccessor */: - case 250 /* ShorthandPropertyAssignment */: - case 220 /* TypeAliasDeclaration */: - case 139 /* TypeParameter */: - case 215 /* VariableDeclaration */: + case 179 /* ArrowFunction */: + case 168 /* BindingElement */: + case 220 /* ClassDeclaration */: + case 191 /* ClassExpression */: + case 147 /* Constructor */: + case 223 /* EnumDeclaration */: + case 254 /* EnumMember */: + case 237 /* ExportSpecifier */: + case 219 /* FunctionDeclaration */: + case 178 /* FunctionExpression */: + case 148 /* GetAccessor */: + case 230 /* ImportClause */: + case 228 /* ImportEqualsDeclaration */: + case 233 /* ImportSpecifier */: + case 221 /* InterfaceDeclaration */: + case 146 /* MethodDeclaration */: + case 145 /* MethodSignature */: + case 224 /* ModuleDeclaration */: + case 231 /* NamespaceImport */: + case 141 /* Parameter */: + case 252 /* PropertyAssignment */: + case 144 /* PropertyDeclaration */: + case 143 /* PropertySignature */: + case 149 /* SetAccessor */: + case 253 /* ShorthandPropertyAssignment */: + case 222 /* TypeAliasDeclaration */: + case 140 /* TypeParameter */: + case 217 /* VariableDeclaration */: return true; } return false; @@ -5844,25 +6035,25 @@ var ts; ts.isDeclaration = isDeclaration; function isStatement(n) { switch (n.kind) { - case 207 /* BreakStatement */: - case 206 /* ContinueStatement */: - case 214 /* DebuggerStatement */: - case 201 /* DoStatement */: - case 199 /* ExpressionStatement */: - case 198 /* EmptyStatement */: - case 204 /* ForInStatement */: - case 205 /* ForOfStatement */: - case 203 /* ForStatement */: - case 200 /* IfStatement */: - case 211 /* LabeledStatement */: - case 208 /* ReturnStatement */: - case 210 /* SwitchStatement */: - case 212 /* ThrowStatement */: - case 213 /* TryStatement */: - case 197 /* VariableStatement */: - case 202 /* WhileStatement */: - case 209 /* WithStatement */: - case 231 /* ExportAssignment */: + case 209 /* BreakStatement */: + case 208 /* ContinueStatement */: + case 216 /* DebuggerStatement */: + case 203 /* DoStatement */: + case 201 /* ExpressionStatement */: + case 200 /* EmptyStatement */: + case 206 /* ForInStatement */: + case 207 /* ForOfStatement */: + case 205 /* ForStatement */: + case 202 /* IfStatement */: + case 213 /* LabeledStatement */: + case 210 /* ReturnStatement */: + case 212 /* SwitchStatement */: + case 214 /* ThrowStatement */: + case 215 /* TryStatement */: + case 199 /* VariableStatement */: + case 204 /* WhileStatement */: + case 211 /* WithStatement */: + case 234 /* ExportAssignment */: return true; default: return false; @@ -5871,13 +6062,13 @@ var ts; ts.isStatement = isStatement; function isClassElement(n) { switch (n.kind) { - case 146 /* Constructor */: - case 143 /* PropertyDeclaration */: - case 145 /* MethodDeclaration */: - case 147 /* GetAccessor */: - case 148 /* SetAccessor */: - case 144 /* MethodSignature */: - case 151 /* IndexSignature */: + case 147 /* Constructor */: + case 144 /* PropertyDeclaration */: + case 146 /* MethodDeclaration */: + case 148 /* GetAccessor */: + case 149 /* SetAccessor */: + case 145 /* MethodSignature */: + case 152 /* IndexSignature */: return true; default: return false; @@ -5890,7 +6081,7 @@ var ts; return false; } var parent = name.parent; - if (parent.kind === 230 /* ImportSpecifier */ || parent.kind === 234 /* ExportSpecifier */) { + if (parent.kind === 233 /* ImportSpecifier */ || parent.kind === 237 /* ExportSpecifier */) { if (parent.propertyName) { return true; } @@ -5905,31 +6096,31 @@ var ts; function isIdentifierName(node) { var parent = node.parent; switch (parent.kind) { - case 143 /* PropertyDeclaration */: - case 142 /* PropertySignature */: - case 145 /* MethodDeclaration */: - case 144 /* MethodSignature */: - case 147 /* GetAccessor */: - case 148 /* SetAccessor */: - case 251 /* EnumMember */: - case 249 /* PropertyAssignment */: - case 170 /* PropertyAccessExpression */: + case 144 /* PropertyDeclaration */: + case 143 /* PropertySignature */: + case 146 /* MethodDeclaration */: + case 145 /* MethodSignature */: + case 148 /* GetAccessor */: + case 149 /* SetAccessor */: + case 254 /* EnumMember */: + case 252 /* PropertyAssignment */: + case 171 /* PropertyAccessExpression */: // Name in member declaration or property name in property access return parent.name === node; - case 137 /* QualifiedName */: + case 138 /* QualifiedName */: // Name on right hand side of dot in a type query if (parent.right === node) { - while (parent.kind === 137 /* QualifiedName */) { + while (parent.kind === 138 /* QualifiedName */) { parent = parent.parent; } - return parent.kind === 156 /* TypeQuery */; + return parent.kind === 157 /* TypeQuery */; } return false; - case 167 /* BindingElement */: - case 230 /* ImportSpecifier */: + case 168 /* BindingElement */: + case 233 /* ImportSpecifier */: // Property name in binding element or import specifier return parent.propertyName === node; - case 234 /* ExportSpecifier */: + case 237 /* ExportSpecifier */: // Any name in an export specifier return true; } @@ -5945,12 +6136,13 @@ var ts; // export = ... // export default ... function isAliasSymbolDeclaration(node) { - return node.kind === 225 /* ImportEqualsDeclaration */ || - node.kind === 227 /* ImportClause */ && !!node.name || - node.kind === 228 /* NamespaceImport */ || - node.kind === 230 /* ImportSpecifier */ || - node.kind === 234 /* ExportSpecifier */ || - node.kind === 231 /* ExportAssignment */ && node.expression.kind === 69 /* Identifier */; + return node.kind === 228 /* ImportEqualsDeclaration */ || + node.kind === 227 /* GlobalModuleExportDeclaration */ || + node.kind === 230 /* ImportClause */ && !!node.name || + node.kind === 231 /* NamespaceImport */ || + node.kind === 233 /* ImportSpecifier */ || + node.kind === 237 /* ExportSpecifier */ || + node.kind === 234 /* ExportAssignment */ && node.expression.kind === 69 /* Identifier */; } ts.isAliasSymbolDeclaration = isAliasSymbolDeclaration; function getClassExtendsHeritageClauseElement(node) { @@ -6007,32 +6199,32 @@ var ts; }; } else { - var matchResult = ts.fullTripleSlashReferencePathRegEx.exec(comment); - if (matchResult) { + var refMatchResult = ts.fullTripleSlashReferencePathRegEx.exec(comment); + var refLibResult = !refMatchResult && ts.fullTripleSlashReferenceTypeReferenceDirectiveRegEx.exec(comment); + if (refMatchResult || refLibResult) { var start = commentRange.pos; var end = commentRange.end; return { fileReference: { pos: start, end: end, - fileName: matchResult[3] + fileName: (refMatchResult || refLibResult)[3] }, - isNoDefaultLib: false - }; - } - else { - return { - diagnosticMessage: ts.Diagnostics.Invalid_reference_directive_syntax, - isNoDefaultLib: false + isNoDefaultLib: false, + isTypeReferenceDirective: !!refLibResult }; } + return { + diagnosticMessage: ts.Diagnostics.Invalid_reference_directive_syntax, + isNoDefaultLib: false + }; } } return undefined; } ts.getFileReferenceFromReferencePath = getFileReferenceFromReferencePath; function isKeyword(token) { - return 70 /* FirstKeyword */ <= token && token <= 136 /* LastKeyword */; + return 70 /* FirstKeyword */ <= token && token <= 137 /* LastKeyword */; } ts.isKeyword = isKeyword; function isTrivia(token) { @@ -6059,7 +6251,7 @@ var ts; } ts.hasDynamicName = hasDynamicName; function isDynamicName(name) { - return name.kind === 138 /* ComputedPropertyName */ && + return name.kind === 139 /* ComputedPropertyName */ && !isStringOrNumericLiteral(name.expression.kind) && !isWellKnownSymbolSyntactically(name.expression); } @@ -6077,7 +6269,7 @@ var ts; if (name.kind === 69 /* Identifier */ || name.kind === 9 /* StringLiteral */ || name.kind === 8 /* NumericLiteral */) { return name.text; } - if (name.kind === 138 /* ComputedPropertyName */) { + if (name.kind === 139 /* ComputedPropertyName */) { var nameExpression = name.expression; if (isWellKnownSymbolSyntactically(nameExpression)) { var rightHandSideName = nameExpression.name.text; @@ -6118,18 +6310,18 @@ var ts; ts.isModifierKind = isModifierKind; function isParameterDeclaration(node) { var root = getRootDeclaration(node); - return root.kind === 140 /* Parameter */; + return root.kind === 141 /* Parameter */; } ts.isParameterDeclaration = isParameterDeclaration; function getRootDeclaration(node) { - while (node.kind === 167 /* BindingElement */) { + while (node.kind === 168 /* BindingElement */) { node = node.parent.parent; } return node; } ts.getRootDeclaration = getRootDeclaration; function nodeStartsNewLexicalEnvironment(n) { - return isFunctionLike(n) || n.kind === 222 /* ModuleDeclaration */ || n.kind === 252 /* SourceFile */; + return isFunctionLike(n) || n.kind === 224 /* ModuleDeclaration */ || n.kind === 255 /* SourceFile */; } ts.nodeStartsNewLexicalEnvironment = nodeStartsNewLexicalEnvironment; /** @@ -6179,7 +6371,7 @@ var ts; } ts.cloneEntityName = cloneEntityName; function isQualifiedName(node) { - return node.kind === 137 /* QualifiedName */; + return node.kind === 138 /* QualifiedName */; } ts.isQualifiedName = isQualifiedName; function nodeIsSynthesized(node) { @@ -6430,6 +6622,17 @@ var ts; return emitOutputFilePathWithoutExtension + extension; } ts.getOwnEmitOutputFilePath = getOwnEmitOutputFilePath; + 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"; + } + } + ts.getDeclarationEmitOutputFilePath = getDeclarationEmitOutputFilePath; function getEmitScriptTarget(compilerOptions) { return compilerOptions.target || 0 /* ES3 */; } @@ -6475,21 +6678,22 @@ var ts; var emitFileNames = { jsFilePath: jsFilePath, sourceMapFilePath: getSourceMapFilePath(jsFilePath, options), - declarationFilePath: !isSourceFileJavaScript(sourceFile) ? getDeclarationEmitFilePath(jsFilePath, options) : undefined + declarationFilePath: !isSourceFileJavaScript(sourceFile) ? getDeclarationEmitOutputFilePath(sourceFile, host) : undefined }; action(emitFileNames, [sourceFile], /*isBundledEmit*/ false); } 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 - var bundledSources = ts.filter(host.getSourceFiles(), function (sourceFile) { return !isDeclarationFile(sourceFile) && - (!isExternalModule(sourceFile) || - (getEmitModuleKind(options) && isExternalModule(sourceFile))); }); // module that can emit - note falsy value from getEmitModuleKind means the module kind that shouldn't be emitted + var bundledSources = ts.filter(host.getSourceFiles(), function (sourceFile) { + return !isDeclarationFile(sourceFile) // Not a declaration file + && (!ts.isExternalModule(sourceFile) || !!getEmitModuleKind(options)); + }); // and not a module, unless module emit enabled if (bundledSources.length) { var jsFilePath = options.outFile || options.out; var emitFileNames = { jsFilePath: jsFilePath, sourceMapFilePath: getSourceMapFilePath(jsFilePath, options), - declarationFilePath: getDeclarationEmitFilePath(jsFilePath, options) + declarationFilePath: options.declaration ? ts.removeFileExtension(jsFilePath) + ".d.ts" : undefined }; action(emitFileNames, bundledSources, /*isBundledEmit*/ true); } @@ -6497,9 +6701,6 @@ var ts; function getSourceMapFilePath(jsFilePath, options) { return options.sourceMap ? jsFilePath + ".map" : undefined; } - function getDeclarationEmitFilePath(jsFilePath, options) { - return options.declaration ? ts.removeFileExtension(jsFilePath) + ".d.ts" : undefined; - } } ts.forEachExpectedEmitFile = forEachExpectedEmitFile; function getSourceFilePathInNewDir(sourceFile, host, newDirPath) { @@ -6508,10 +6709,10 @@ var ts; return ts.combinePaths(newDirPath, sourceFilePath); } ts.getSourceFilePathInNewDir = getSourceFilePathInNewDir; - function writeFile(host, diagnostics, fileName, data, writeByteOrderMark) { + function writeFile(host, diagnostics, fileName, data, writeByteOrderMark, sourceFiles) { host.writeFile(fileName, data, writeByteOrderMark, function (hostErrorMessage) { diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Could_not_write_file_0_Colon_1, fileName, hostErrorMessage)); - }); + }, sourceFiles); } ts.writeFile = writeFile; function getLineOfLocalPosition(currentSourceFile, pos) { @@ -6524,7 +6725,7 @@ var ts; ts.getLineOfLocalPositionFromLineMap = getLineOfLocalPositionFromLineMap; function getFirstConstructorWithBody(node) { return ts.forEach(node.members, function (member) { - if (member.kind === 146 /* Constructor */ && nodeIsPresent(member.body)) { + if (member.kind === 147 /* Constructor */ && nodeIsPresent(member.body)) { return member; } }); @@ -6541,10 +6742,10 @@ var ts; var setAccessor; if (hasDynamicName(accessor)) { firstAccessor = accessor; - if (accessor.kind === 147 /* GetAccessor */) { + if (accessor.kind === 148 /* GetAccessor */) { getAccessor = accessor; } - else if (accessor.kind === 148 /* SetAccessor */) { + else if (accessor.kind === 149 /* SetAccessor */) { setAccessor = accessor; } else { @@ -6553,7 +6754,7 @@ var ts; } else { ts.forEach(declarations, function (member) { - if ((member.kind === 147 /* GetAccessor */ || member.kind === 148 /* SetAccessor */) + if ((member.kind === 148 /* GetAccessor */ || member.kind === 149 /* SetAccessor */) && (member.flags & 32 /* Static */) === (accessor.flags & 32 /* Static */)) { var memberName = getPropertyNameForPropertyNameNode(member.name); var accessorName = getPropertyNameForPropertyNameNode(accessor.name); @@ -6564,10 +6765,10 @@ var ts; else if (!secondAccessor) { secondAccessor = member; } - if (member.kind === 147 /* GetAccessor */ && !getAccessor) { + if (member.kind === 148 /* GetAccessor */ && !getAccessor) { getAccessor = member; } - if (member.kind === 148 /* SetAccessor */ && !setAccessor) { + if (member.kind === 149 /* SetAccessor */ && !setAccessor) { setAccessor = member; } } @@ -6778,24 +6979,25 @@ var ts; function isLeftHandSideExpression(expr) { if (expr) { switch (expr.kind) { - case 170 /* PropertyAccessExpression */: - case 171 /* ElementAccessExpression */: - case 173 /* NewExpression */: - case 172 /* CallExpression */: - case 237 /* JsxElement */: - case 238 /* JsxSelfClosingElement */: - case 174 /* TaggedTemplateExpression */: - case 168 /* ArrayLiteralExpression */: - case 176 /* ParenthesizedExpression */: - case 169 /* ObjectLiteralExpression */: - case 190 /* ClassExpression */: - case 177 /* FunctionExpression */: + case 171 /* PropertyAccessExpression */: + case 172 /* ElementAccessExpression */: + case 174 /* NewExpression */: + case 173 /* CallExpression */: + case 195 /* NonNullExpression */: + case 240 /* JsxElement */: + case 241 /* JsxSelfClosingElement */: + case 175 /* TaggedTemplateExpression */: + case 169 /* ArrayLiteralExpression */: + case 177 /* ParenthesizedExpression */: + case 170 /* ObjectLiteralExpression */: + case 191 /* ClassExpression */: + case 178 /* FunctionExpression */: case 69 /* Identifier */: case 10 /* RegularExpressionLiteral */: case 8 /* NumericLiteral */: case 9 /* StringLiteral */: case 11 /* NoSubstitutionTemplateLiteral */: - case 187 /* TemplateExpression */: + case 188 /* TemplateExpression */: case 84 /* FalseKeyword */: case 93 /* NullKeyword */: case 97 /* ThisKeyword */: @@ -6812,7 +7014,7 @@ var ts; } ts.isAssignmentOperator = isAssignmentOperator; function isExpressionWithTypeArgumentsInClassExtendsClause(node) { - return node.kind === 192 /* ExpressionWithTypeArguments */ && + return node.kind === 193 /* ExpressionWithTypeArguments */ && node.parent.token === 83 /* ExtendsKeyword */ && isClassLike(node.parent.parent); } @@ -6835,16 +7037,16 @@ var ts; } } function isRightSideOfQualifiedNameOrPropertyAccess(node) { - return (node.parent.kind === 137 /* QualifiedName */ && node.parent.right === node) || - (node.parent.kind === 170 /* PropertyAccessExpression */ && node.parent.name === node); + return (node.parent.kind === 138 /* QualifiedName */ && node.parent.right === node) || + (node.parent.kind === 171 /* PropertyAccessExpression */ && node.parent.name === node); } ts.isRightSideOfQualifiedNameOrPropertyAccess = isRightSideOfQualifiedNameOrPropertyAccess; function isEmptyObjectLiteralOrArrayLiteral(expression) { var kind = expression.kind; - if (kind === 169 /* ObjectLiteralExpression */) { + if (kind === 170 /* ObjectLiteralExpression */) { return expression.properties.length === 0; } - if (kind === 168 /* ArrayLiteralExpression */) { + if (kind === 169 /* ArrayLiteralExpression */) { return expression.elements.length === 0; } return false; @@ -6986,6 +7188,11 @@ var ts; return carriageReturnLineFeed; } ts.getNewLineCharacter = getNewLineCharacter; + function isWatchSet(options) { + // Firefox has Object.prototype.watch + return options.watch && options.hasOwnProperty("watch"); + } + ts.isWatchSet = isWatchSet; })(ts || (ts = {})); var ts; (function (ts) { @@ -7199,9 +7406,9 @@ var ts; } ts.collapseTextChangeRangesAcrossMultipleVersions = collapseTextChangeRangesAcrossMultipleVersions; function getTypeParameterOwner(d) { - if (d && d.kind === 139 /* TypeParameter */) { + if (d && d.kind === 140 /* TypeParameter */) { for (var current = d; current; current = current.parent) { - if (ts.isFunctionLike(current) || ts.isClassLike(current) || current.kind === 219 /* InterfaceDeclaration */) { + if (ts.isFunctionLike(current) || ts.isClassLike(current) || current.kind === 221 /* InterfaceDeclaration */) { return current; } } @@ -7209,9 +7416,18 @@ var ts; } ts.getTypeParameterOwner = getTypeParameterOwner; function isParameterPropertyDeclaration(node) { - return node.flags & 28 /* AccessibilityModifier */ && node.parent.kind === 146 /* Constructor */ && ts.isClassLike(node.parent.parent); + return node.flags & 28 /* AccessibilityModifier */ && node.parent.kind === 147 /* Constructor */ && ts.isClassLike(node.parent.parent); } ts.isParameterPropertyDeclaration = isParameterPropertyDeclaration; + function startsWith(str, prefix) { + return str.lastIndexOf(prefix, 0) === 0; + } + ts.startsWith = startsWith; + function endsWith(str, suffix) { + var expectedPos = str.length - suffix.length; + return str.indexOf(suffix, expectedPos) === expectedPos; + } + ts.endsWith = endsWith; })(ts || (ts = {})); /// /// @@ -7221,7 +7437,7 @@ var ts; var NodeConstructor; var SourceFileConstructor; function createNode(kind, pos, end) { - if (kind === 252 /* SourceFile */) { + if (kind === 255 /* SourceFile */) { return new (SourceFileConstructor || (SourceFileConstructor = ts.objectAllocator.getSourceFileConstructor()))(kind, pos, end); } else { @@ -7264,26 +7480,26 @@ var ts; var visitNodes = cbNodeArray ? visitNodeArray : visitEachNode; var cbNodes = cbNodeArray || cbNode; switch (node.kind) { - case 137 /* QualifiedName */: + case 138 /* QualifiedName */: return visitNode(cbNode, node.left) || visitNode(cbNode, node.right); - case 139 /* TypeParameter */: + case 140 /* TypeParameter */: return visitNode(cbNode, node.name) || visitNode(cbNode, node.constraint) || visitNode(cbNode, node.expression); - case 250 /* ShorthandPropertyAssignment */: + case 253 /* 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 140 /* Parameter */: - case 143 /* PropertyDeclaration */: - case 142 /* PropertySignature */: - case 249 /* PropertyAssignment */: - case 215 /* VariableDeclaration */: - case 167 /* BindingElement */: + case 141 /* Parameter */: + case 144 /* PropertyDeclaration */: + case 143 /* PropertySignature */: + case 252 /* PropertyAssignment */: + case 217 /* VariableDeclaration */: + case 168 /* BindingElement */: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.propertyName) || @@ -7292,24 +7508,24 @@ var ts; visitNode(cbNode, node.questionToken) || visitNode(cbNode, node.type) || visitNode(cbNode, node.initializer); - case 154 /* FunctionType */: - case 155 /* ConstructorType */: - case 149 /* CallSignature */: - case 150 /* ConstructSignature */: - case 151 /* IndexSignature */: + case 155 /* FunctionType */: + case 156 /* ConstructorType */: + case 150 /* CallSignature */: + case 151 /* ConstructSignature */: + case 152 /* IndexSignature */: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNodes(cbNodes, node.typeParameters) || visitNodes(cbNodes, node.parameters) || visitNode(cbNode, node.type); - case 145 /* MethodDeclaration */: - case 144 /* MethodSignature */: - case 146 /* Constructor */: - case 147 /* GetAccessor */: - case 148 /* SetAccessor */: - case 177 /* FunctionExpression */: - case 217 /* FunctionDeclaration */: - case 178 /* ArrowFunction */: + case 146 /* MethodDeclaration */: + case 145 /* MethodSignature */: + case 147 /* Constructor */: + case 148 /* GetAccessor */: + case 149 /* SetAccessor */: + case 178 /* FunctionExpression */: + case 219 /* FunctionDeclaration */: + case 179 /* ArrowFunction */: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.asteriskToken) || @@ -7320,290 +7536,294 @@ var ts; visitNode(cbNode, node.type) || visitNode(cbNode, node.equalsGreaterThanToken) || visitNode(cbNode, node.body); - case 153 /* TypeReference */: + case 154 /* TypeReference */: return visitNode(cbNode, node.typeName) || visitNodes(cbNodes, node.typeArguments); - case 152 /* TypePredicate */: + case 153 /* TypePredicate */: return visitNode(cbNode, node.parameterName) || visitNode(cbNode, node.type); - case 156 /* TypeQuery */: + case 157 /* TypeQuery */: return visitNode(cbNode, node.exprName); - case 157 /* TypeLiteral */: + case 158 /* TypeLiteral */: return visitNodes(cbNodes, node.members); - case 158 /* ArrayType */: + case 159 /* ArrayType */: return visitNode(cbNode, node.elementType); - case 159 /* TupleType */: + case 160 /* TupleType */: return visitNodes(cbNodes, node.elementTypes); - case 160 /* UnionType */: - case 161 /* IntersectionType */: + case 161 /* UnionType */: + case 162 /* IntersectionType */: return visitNodes(cbNodes, node.types); - case 162 /* ParenthesizedType */: + case 163 /* ParenthesizedType */: return visitNode(cbNode, node.type); - case 165 /* ObjectBindingPattern */: - case 166 /* ArrayBindingPattern */: + case 166 /* ObjectBindingPattern */: + case 167 /* ArrayBindingPattern */: return visitNodes(cbNodes, node.elements); - case 168 /* ArrayLiteralExpression */: + case 169 /* ArrayLiteralExpression */: return visitNodes(cbNodes, node.elements); - case 169 /* ObjectLiteralExpression */: + case 170 /* ObjectLiteralExpression */: return visitNodes(cbNodes, node.properties); - case 170 /* PropertyAccessExpression */: + case 171 /* PropertyAccessExpression */: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.dotToken) || visitNode(cbNode, node.name); - case 171 /* ElementAccessExpression */: + case 172 /* ElementAccessExpression */: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.argumentExpression); - case 172 /* CallExpression */: - case 173 /* NewExpression */: + case 173 /* CallExpression */: + case 174 /* NewExpression */: return visitNode(cbNode, node.expression) || visitNodes(cbNodes, node.typeArguments) || visitNodes(cbNodes, node.arguments); - case 174 /* TaggedTemplateExpression */: + case 175 /* TaggedTemplateExpression */: return visitNode(cbNode, node.tag) || visitNode(cbNode, node.template); - case 175 /* TypeAssertionExpression */: + case 176 /* TypeAssertionExpression */: return visitNode(cbNode, node.type) || visitNode(cbNode, node.expression); - case 176 /* ParenthesizedExpression */: + case 177 /* ParenthesizedExpression */: return visitNode(cbNode, node.expression); - case 179 /* DeleteExpression */: + case 180 /* DeleteExpression */: return visitNode(cbNode, node.expression); - case 180 /* TypeOfExpression */: + case 181 /* TypeOfExpression */: return visitNode(cbNode, node.expression); - case 181 /* VoidExpression */: + case 182 /* VoidExpression */: return visitNode(cbNode, node.expression); - case 183 /* PrefixUnaryExpression */: + case 184 /* PrefixUnaryExpression */: return visitNode(cbNode, node.operand); - case 188 /* YieldExpression */: + case 189 /* YieldExpression */: return visitNode(cbNode, node.asteriskToken) || visitNode(cbNode, node.expression); - case 182 /* AwaitExpression */: + case 183 /* AwaitExpression */: return visitNode(cbNode, node.expression); - case 184 /* PostfixUnaryExpression */: + case 185 /* PostfixUnaryExpression */: return visitNode(cbNode, node.operand); - case 185 /* BinaryExpression */: + case 186 /* BinaryExpression */: return visitNode(cbNode, node.left) || visitNode(cbNode, node.operatorToken) || visitNode(cbNode, node.right); - case 193 /* AsExpression */: + case 194 /* AsExpression */: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.type); - case 186 /* ConditionalExpression */: + case 195 /* NonNullExpression */: + return visitNode(cbNode, node.expression); + case 187 /* ConditionalExpression */: return visitNode(cbNode, node.condition) || visitNode(cbNode, node.questionToken) || visitNode(cbNode, node.whenTrue) || visitNode(cbNode, node.colonToken) || visitNode(cbNode, node.whenFalse); - case 189 /* SpreadElementExpression */: + case 190 /* SpreadElementExpression */: return visitNode(cbNode, node.expression); - case 196 /* Block */: - case 223 /* ModuleBlock */: + case 198 /* Block */: + case 225 /* ModuleBlock */: return visitNodes(cbNodes, node.statements); - case 252 /* SourceFile */: + case 255 /* SourceFile */: return visitNodes(cbNodes, node.statements) || visitNode(cbNode, node.endOfFileToken); - case 197 /* VariableStatement */: + case 199 /* VariableStatement */: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.declarationList); - case 216 /* VariableDeclarationList */: + case 218 /* VariableDeclarationList */: return visitNodes(cbNodes, node.declarations); - case 199 /* ExpressionStatement */: + case 201 /* ExpressionStatement */: return visitNode(cbNode, node.expression); - case 200 /* IfStatement */: + case 202 /* IfStatement */: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.thenStatement) || visitNode(cbNode, node.elseStatement); - case 201 /* DoStatement */: + case 203 /* DoStatement */: return visitNode(cbNode, node.statement) || visitNode(cbNode, node.expression); - case 202 /* WhileStatement */: + case 204 /* WhileStatement */: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.statement); - case 203 /* ForStatement */: + case 205 /* ForStatement */: return visitNode(cbNode, node.initializer) || visitNode(cbNode, node.condition) || visitNode(cbNode, node.incrementor) || visitNode(cbNode, node.statement); - case 204 /* ForInStatement */: + case 206 /* ForInStatement */: return visitNode(cbNode, node.initializer) || visitNode(cbNode, node.expression) || visitNode(cbNode, node.statement); - case 205 /* ForOfStatement */: + case 207 /* ForOfStatement */: return visitNode(cbNode, node.initializer) || visitNode(cbNode, node.expression) || visitNode(cbNode, node.statement); - case 206 /* ContinueStatement */: - case 207 /* BreakStatement */: + case 208 /* ContinueStatement */: + case 209 /* BreakStatement */: return visitNode(cbNode, node.label); - case 208 /* ReturnStatement */: + case 210 /* ReturnStatement */: return visitNode(cbNode, node.expression); - case 209 /* WithStatement */: + case 211 /* WithStatement */: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.statement); - case 210 /* SwitchStatement */: + case 212 /* SwitchStatement */: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.caseBlock); - case 224 /* CaseBlock */: + case 226 /* CaseBlock */: return visitNodes(cbNodes, node.clauses); - case 245 /* CaseClause */: + case 248 /* CaseClause */: return visitNode(cbNode, node.expression) || visitNodes(cbNodes, node.statements); - case 246 /* DefaultClause */: + case 249 /* DefaultClause */: return visitNodes(cbNodes, node.statements); - case 211 /* LabeledStatement */: + case 213 /* LabeledStatement */: return visitNode(cbNode, node.label) || visitNode(cbNode, node.statement); - case 212 /* ThrowStatement */: + case 214 /* ThrowStatement */: return visitNode(cbNode, node.expression); - case 213 /* TryStatement */: + case 215 /* TryStatement */: return visitNode(cbNode, node.tryBlock) || visitNode(cbNode, node.catchClause) || visitNode(cbNode, node.finallyBlock); - case 248 /* CatchClause */: + case 251 /* CatchClause */: return visitNode(cbNode, node.variableDeclaration) || visitNode(cbNode, node.block); - case 141 /* Decorator */: + case 142 /* Decorator */: return visitNode(cbNode, node.expression); - case 218 /* ClassDeclaration */: - case 190 /* ClassExpression */: + case 220 /* ClassDeclaration */: + case 191 /* 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 219 /* InterfaceDeclaration */: + case 221 /* 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 220 /* TypeAliasDeclaration */: + case 222 /* TypeAliasDeclaration */: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNodes(cbNodes, node.typeParameters) || visitNode(cbNode, node.type); - case 221 /* EnumDeclaration */: + case 223 /* EnumDeclaration */: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNodes(cbNodes, node.members); - case 251 /* EnumMember */: + case 254 /* EnumMember */: return visitNode(cbNode, node.name) || visitNode(cbNode, node.initializer); - case 222 /* ModuleDeclaration */: + case 224 /* ModuleDeclaration */: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNode(cbNode, node.body); - case 225 /* ImportEqualsDeclaration */: + case 228 /* ImportEqualsDeclaration */: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNode(cbNode, node.moduleReference); - case 226 /* ImportDeclaration */: + case 229 /* ImportDeclaration */: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.importClause) || visitNode(cbNode, node.moduleSpecifier); - case 227 /* ImportClause */: + case 230 /* ImportClause */: return visitNode(cbNode, node.name) || visitNode(cbNode, node.namedBindings); - case 228 /* NamespaceImport */: + case 227 /* GlobalModuleExportDeclaration */: return visitNode(cbNode, node.name); - case 229 /* NamedImports */: - case 233 /* NamedExports */: + case 231 /* NamespaceImport */: + return visitNode(cbNode, node.name); + case 232 /* NamedImports */: + case 236 /* NamedExports */: return visitNodes(cbNodes, node.elements); - case 232 /* ExportDeclaration */: + case 235 /* ExportDeclaration */: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.exportClause) || visitNode(cbNode, node.moduleSpecifier); - case 230 /* ImportSpecifier */: - case 234 /* ExportSpecifier */: + case 233 /* ImportSpecifier */: + case 237 /* ExportSpecifier */: return visitNode(cbNode, node.propertyName) || visitNode(cbNode, node.name); - case 231 /* ExportAssignment */: + case 234 /* ExportAssignment */: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.expression); - case 187 /* TemplateExpression */: + case 188 /* TemplateExpression */: return visitNode(cbNode, node.head) || visitNodes(cbNodes, node.templateSpans); - case 194 /* TemplateSpan */: + case 196 /* TemplateSpan */: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.literal); - case 138 /* ComputedPropertyName */: + case 139 /* ComputedPropertyName */: return visitNode(cbNode, node.expression); - case 247 /* HeritageClause */: + case 250 /* HeritageClause */: return visitNodes(cbNodes, node.types); - case 192 /* ExpressionWithTypeArguments */: + case 193 /* ExpressionWithTypeArguments */: return visitNode(cbNode, node.expression) || visitNodes(cbNodes, node.typeArguments); - case 236 /* ExternalModuleReference */: + case 239 /* ExternalModuleReference */: return visitNode(cbNode, node.expression); - case 235 /* MissingDeclaration */: + case 238 /* MissingDeclaration */: return visitNodes(cbNodes, node.decorators); - case 237 /* JsxElement */: + case 240 /* JsxElement */: return visitNode(cbNode, node.openingElement) || visitNodes(cbNodes, node.children) || visitNode(cbNode, node.closingElement); - case 238 /* JsxSelfClosingElement */: - case 239 /* JsxOpeningElement */: + case 241 /* JsxSelfClosingElement */: + case 242 /* JsxOpeningElement */: return visitNode(cbNode, node.tagName) || visitNodes(cbNodes, node.attributes); - case 242 /* JsxAttribute */: + case 245 /* JsxAttribute */: return visitNode(cbNode, node.name) || visitNode(cbNode, node.initializer); - case 243 /* JsxSpreadAttribute */: + case 246 /* JsxSpreadAttribute */: return visitNode(cbNode, node.expression); - case 244 /* JsxExpression */: + case 247 /* JsxExpression */: return visitNode(cbNode, node.expression); - case 241 /* JsxClosingElement */: + case 244 /* JsxClosingElement */: return visitNode(cbNode, node.tagName); - case 253 /* JSDocTypeExpression */: + case 256 /* JSDocTypeExpression */: return visitNode(cbNode, node.type); - case 257 /* JSDocUnionType */: + case 260 /* JSDocUnionType */: return visitNodes(cbNodes, node.types); - case 258 /* JSDocTupleType */: + case 261 /* JSDocTupleType */: return visitNodes(cbNodes, node.types); - case 256 /* JSDocArrayType */: + case 259 /* JSDocArrayType */: return visitNode(cbNode, node.elementType); - case 260 /* JSDocNonNullableType */: + case 263 /* JSDocNonNullableType */: return visitNode(cbNode, node.type); - case 259 /* JSDocNullableType */: + case 262 /* JSDocNullableType */: return visitNode(cbNode, node.type); - case 261 /* JSDocRecordType */: + case 264 /* JSDocRecordType */: return visitNodes(cbNodes, node.members); - case 263 /* JSDocTypeReference */: + case 266 /* JSDocTypeReference */: return visitNode(cbNode, node.name) || visitNodes(cbNodes, node.typeArguments); - case 264 /* JSDocOptionalType */: + case 267 /* JSDocOptionalType */: return visitNode(cbNode, node.type); - case 265 /* JSDocFunctionType */: + case 268 /* JSDocFunctionType */: return visitNodes(cbNodes, node.parameters) || visitNode(cbNode, node.type); - case 266 /* JSDocVariadicType */: + case 269 /* JSDocVariadicType */: return visitNode(cbNode, node.type); - case 267 /* JSDocConstructorType */: + case 270 /* JSDocConstructorType */: return visitNode(cbNode, node.type); - case 268 /* JSDocThisType */: + case 271 /* JSDocThisType */: return visitNode(cbNode, node.type); - case 262 /* JSDocRecordMember */: + case 265 /* JSDocRecordMember */: return visitNode(cbNode, node.name) || visitNode(cbNode, node.type); - case 269 /* JSDocComment */: + case 272 /* JSDocComment */: return visitNodes(cbNodes, node.tags); - case 271 /* JSDocParameterTag */: + case 274 /* JSDocParameterTag */: return visitNode(cbNode, node.preParameterName) || visitNode(cbNode, node.typeExpression) || visitNode(cbNode, node.postParameterName); - case 272 /* JSDocReturnTag */: + case 275 /* JSDocReturnTag */: return visitNode(cbNode, node.typeExpression); - case 273 /* JSDocTypeTag */: + case 276 /* JSDocTypeTag */: return visitNode(cbNode, node.typeExpression); - case 274 /* JSDocTemplateTag */: + case 277 /* JSDocTemplateTag */: return visitNodes(cbNodes, node.typeParameters); } } @@ -7616,23 +7836,10 @@ var ts; return result; } ts.createSourceFile = createSourceFile; - /* @internal */ - function getScriptKindFromFileName(fileName) { - var ext = fileName.substr(fileName.lastIndexOf(".")); - switch (ext.toLowerCase()) { - case ".js": - return 1 /* JS */; - case ".jsx": - return 2 /* JSX */; - case ".ts": - return 3 /* TS */; - case ".tsx": - return 4 /* TSX */; - default: - return 3 /* TS */; - } + function isExternalModule(file) { + return file.externalModuleIndicator !== undefined; } - ts.getScriptKindFromFileName = getScriptKindFromFileName; + ts.isExternalModule = isExternalModule; // Produces a new SourceFile for the 'newText' provided. The 'textChangeRange' parameter // indicates what changed between the 'text' that this SourceFile has and the 'newText'. // The SourceFile will be created with the compiler attempting to reuse as many nodes from @@ -7754,12 +7961,7 @@ var ts; // attached to the EOF token. var parseErrorBeforeNextFinishedNode = false; function parseSourceFile(fileName, _sourceText, languageVersion, _syntaxCursor, setParentNodes, scriptKind) { - // Using scriptKind as a condition handles both: - // - 'scriptKind' is unspecified and thus it is `undefined` - // - 'scriptKind' is set and it is `Unknown` (0) - // If the 'scriptKind' is 'undefined' or 'Unknown' then attempt - // to get the ScriptKind from the file name. - scriptKind = scriptKind ? scriptKind : getScriptKindFromFileName(fileName); + scriptKind = ts.ensureScriptKind(fileName, scriptKind); initializeState(fileName, _sourceText, languageVersion, _syntaxCursor, scriptKind); var result = parseSourceFileWorker(fileName, languageVersion, setParentNodes, scriptKind); clearState(); @@ -7858,7 +8060,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(252 /* SourceFile */, /*pos*/ 0, /* end */ sourceText.length); + var sourceFile = new SourceFileConstructor(255 /* SourceFile */, /*pos*/ 0, /* end */ sourceText.length); nodeCount++; sourceFile.text = sourceText; sourceFile.bindDiagnostics = []; @@ -8211,7 +8413,7 @@ var ts; // PropertyName [Yield]: // LiteralPropertyName // ComputedPropertyName[?Yield] - var node = createNode(138 /* ComputedPropertyName */); + var node = createNode(139 /* ComputedPropertyName */); parseExpected(19 /* OpenBracketToken */); // We parse any expression (including a comma expression). But the grammar // says that only an assignment expression is allowed, so the grammar checker @@ -8240,7 +8442,7 @@ var ts; if (token === 77 /* DefaultKeyword */) { return lookAhead(nextTokenIsClassOrFunction); } - return token !== 37 /* AsteriskToken */ && token !== 15 /* OpenBraceToken */ && canFollowModifier(); + return token !== 37 /* AsteriskToken */ && token !== 116 /* AsKeyword */ && token !== 15 /* OpenBraceToken */ && canFollowModifier(); } if (token === 77 /* DefaultKeyword */) { return nextTokenIsClassOrFunction(); @@ -8532,7 +8734,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 & 62914560 /* ContextFlags */; + var nodeContextFlags = node.flags & 197132288 /* ContextFlags */; if (nodeContextFlags !== contextFlags) { return undefined; } @@ -8612,14 +8814,14 @@ var ts; function isReusableClassMember(node) { if (node) { switch (node.kind) { - case 146 /* Constructor */: - case 151 /* IndexSignature */: - case 147 /* GetAccessor */: - case 148 /* SetAccessor */: - case 143 /* PropertyDeclaration */: - case 195 /* SemicolonClassElement */: + case 147 /* Constructor */: + case 152 /* IndexSignature */: + case 148 /* GetAccessor */: + case 149 /* SetAccessor */: + case 144 /* PropertyDeclaration */: + case 197 /* SemicolonClassElement */: return true; - case 145 /* MethodDeclaration */: + case 146 /* 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. @@ -8634,8 +8836,8 @@ var ts; function isReusableSwitchClause(node) { if (node) { switch (node.kind) { - case 245 /* CaseClause */: - case 246 /* DefaultClause */: + case 248 /* CaseClause */: + case 249 /* DefaultClause */: return true; } } @@ -8644,58 +8846,58 @@ var ts; function isReusableStatement(node) { if (node) { switch (node.kind) { - case 217 /* FunctionDeclaration */: - case 197 /* VariableStatement */: - case 196 /* Block */: - case 200 /* IfStatement */: - case 199 /* ExpressionStatement */: - case 212 /* ThrowStatement */: - case 208 /* ReturnStatement */: - case 210 /* SwitchStatement */: - case 207 /* BreakStatement */: - case 206 /* ContinueStatement */: - case 204 /* ForInStatement */: - case 205 /* ForOfStatement */: - case 203 /* ForStatement */: - case 202 /* WhileStatement */: - case 209 /* WithStatement */: - case 198 /* EmptyStatement */: - case 213 /* TryStatement */: - case 211 /* LabeledStatement */: - case 201 /* DoStatement */: - case 214 /* DebuggerStatement */: - case 226 /* ImportDeclaration */: - case 225 /* ImportEqualsDeclaration */: - case 232 /* ExportDeclaration */: - case 231 /* ExportAssignment */: - case 222 /* ModuleDeclaration */: - case 218 /* ClassDeclaration */: - case 219 /* InterfaceDeclaration */: - case 221 /* EnumDeclaration */: - case 220 /* TypeAliasDeclaration */: + case 219 /* FunctionDeclaration */: + case 199 /* VariableStatement */: + case 198 /* Block */: + case 202 /* IfStatement */: + case 201 /* ExpressionStatement */: + case 214 /* ThrowStatement */: + case 210 /* ReturnStatement */: + case 212 /* SwitchStatement */: + case 209 /* BreakStatement */: + case 208 /* ContinueStatement */: + case 206 /* ForInStatement */: + case 207 /* ForOfStatement */: + case 205 /* ForStatement */: + case 204 /* WhileStatement */: + case 211 /* WithStatement */: + case 200 /* EmptyStatement */: + case 215 /* TryStatement */: + case 213 /* LabeledStatement */: + case 203 /* DoStatement */: + case 216 /* DebuggerStatement */: + case 229 /* ImportDeclaration */: + case 228 /* ImportEqualsDeclaration */: + case 235 /* ExportDeclaration */: + case 234 /* ExportAssignment */: + case 224 /* ModuleDeclaration */: + case 220 /* ClassDeclaration */: + case 221 /* InterfaceDeclaration */: + case 223 /* EnumDeclaration */: + case 222 /* TypeAliasDeclaration */: return true; } } return false; } function isReusableEnumMember(node) { - return node.kind === 251 /* EnumMember */; + return node.kind === 254 /* EnumMember */; } function isReusableTypeMember(node) { if (node) { switch (node.kind) { - case 150 /* ConstructSignature */: - case 144 /* MethodSignature */: - case 151 /* IndexSignature */: - case 142 /* PropertySignature */: - case 149 /* CallSignature */: + case 151 /* ConstructSignature */: + case 145 /* MethodSignature */: + case 152 /* IndexSignature */: + case 143 /* PropertySignature */: + case 150 /* CallSignature */: return true; } } return false; } function isReusableVariableDeclaration(node) { - if (node.kind !== 215 /* VariableDeclaration */) { + if (node.kind !== 217 /* VariableDeclaration */) { return false; } // Very subtle incremental parsing bug. Consider the following code: @@ -8716,7 +8918,7 @@ var ts; return variableDeclarator.initializer === undefined; } function isReusableParameter(node) { - if (node.kind !== 140 /* Parameter */) { + if (node.kind !== 141 /* Parameter */) { return false; } // See the comment in isReusableVariableDeclaration for why we do this. @@ -8833,7 +9035,7 @@ var ts; function parseEntityName(allowReservedWords, diagnosticMessage) { var entity = parseIdentifier(diagnosticMessage); while (parseOptional(21 /* DotToken */)) { - var node = createNode(137 /* QualifiedName */, entity.pos); + var node = createNode(138 /* QualifiedName */, entity.pos); node.left = entity; node.right = parseRightSideOfDot(allowReservedWords); entity = finishNode(node); @@ -8872,7 +9074,7 @@ var ts; return allowIdentifierNames ? parseIdentifierName() : parseIdentifier(); } function parseTemplateExpression() { - var template = createNode(187 /* TemplateExpression */); + var template = createNode(188 /* TemplateExpression */); template.head = parseTemplateLiteralFragment(); ts.Debug.assert(template.head.kind === 12 /* TemplateHead */, "Template head has wrong token kind"); var templateSpans = []; @@ -8885,7 +9087,7 @@ var ts; return finishNode(template); } function parseTemplateSpan() { - var span = createNode(194 /* TemplateSpan */); + var span = createNode(196 /* TemplateSpan */); span.expression = allowInAnd(parseExpression); var literal; if (token === 16 /* CloseBraceToken */) { @@ -8899,7 +9101,7 @@ var ts; return finishNode(span); } function parseStringLiteralTypeNode() { - return parseLiteralLikeNode(164 /* StringLiteralType */, /*internName*/ true); + return parseLiteralLikeNode(165 /* StringLiteralType */, /*internName*/ true); } function parseLiteralNode(internName) { return parseLiteralLikeNode(token, internName); @@ -8936,7 +9138,7 @@ var ts; // TYPES function parseTypeReference() { var typeName = parseEntityName(/*allowReservedWords*/ false, ts.Diagnostics.Type_expected); - var node = createNode(153 /* TypeReference */, typeName.pos); + var node = createNode(154 /* TypeReference */, typeName.pos); node.typeName = typeName; if (!scanner.hasPrecedingLineBreak() && token === 25 /* LessThanToken */) { node.typeArguments = parseBracketedList(18 /* TypeArguments */, parseType, 25 /* LessThanToken */, 27 /* GreaterThanToken */); @@ -8945,24 +9147,24 @@ var ts; } function parseThisTypePredicate(lhs) { nextToken(); - var node = createNode(152 /* TypePredicate */, lhs.pos); + var node = createNode(153 /* TypePredicate */, lhs.pos); node.parameterName = lhs; node.type = parseType(); return finishNode(node); } function parseThisTypeNode() { - var node = createNode(163 /* ThisType */); + var node = createNode(164 /* ThisType */); nextToken(); return finishNode(node); } function parseTypeQuery() { - var node = createNode(156 /* TypeQuery */); + var node = createNode(157 /* TypeQuery */); parseExpected(101 /* TypeOfKeyword */); node.exprName = parseEntityName(/*allowReservedWords*/ true); return finishNode(node); } function parseTypeParameter() { - var node = createNode(139 /* TypeParameter */); + var node = createNode(140 /* TypeParameter */); node.name = parseIdentifier(); if (parseOptional(83 /* ExtendsKeyword */)) { // It's not uncommon for people to write improper constraints to a generic. If the @@ -8997,7 +9199,7 @@ var ts; return undefined; } function isStartOfParameter() { - return token === 22 /* DotDotDotToken */ || isIdentifierOrPattern() || ts.isModifierKind(token) || token === 55 /* AtToken */; + return token === 22 /* DotDotDotToken */ || isIdentifierOrPattern() || ts.isModifierKind(token) || token === 55 /* AtToken */ || token === 97 /* ThisKeyword */; } function setModifiers(node, modifiers) { if (modifiers) { @@ -9006,7 +9208,12 @@ var ts; } } function parseParameter() { - var node = createNode(140 /* Parameter */); + var node = createNode(141 /* Parameter */); + if (token === 97 /* ThisKeyword */) { + node.name = createIdentifier(/*isIdentifier*/ true, undefined); + node.type = parseParameterType(); + return finishNode(node); + } node.decorators = parseDecorators(); setModifiers(node, parseModifiers()); node.dotDotDotToken = parseOptionalToken(22 /* DotDotDotToken */); @@ -9100,7 +9307,7 @@ var ts; } function parseSignatureMember(kind) { var node = createNode(kind); - if (kind === 150 /* ConstructSignature */) { + if (kind === 151 /* ConstructSignature */) { parseExpected(92 /* NewKeyword */); } fillSignature(54 /* ColonToken */, /*yieldContext*/ false, /*awaitContext*/ false, /*requireCompleteParameterList*/ false, node); @@ -9164,7 +9371,7 @@ var ts; return token === 54 /* ColonToken */ || token === 24 /* CommaToken */ || token === 20 /* CloseBracketToken */; } function parseIndexSignatureDeclaration(fullStart, decorators, modifiers) { - var node = createNode(151 /* IndexSignature */, fullStart); + var node = createNode(152 /* IndexSignature */, fullStart); node.decorators = decorators; setModifiers(node, modifiers); node.parameters = parseBracketedList(16 /* Parameters */, parseParameter, 19 /* OpenBracketToken */, 20 /* CloseBracketToken */); @@ -9176,7 +9383,7 @@ var ts; var name = parsePropertyName(); var questionToken = parseOptionalToken(53 /* QuestionToken */); if (token === 17 /* OpenParenToken */ || token === 25 /* LessThanToken */) { - var method = createNode(144 /* MethodSignature */, fullStart); + var method = createNode(145 /* MethodSignature */, fullStart); setModifiers(method, modifiers); method.name = name; method.questionToken = questionToken; @@ -9187,7 +9394,7 @@ var ts; return finishNode(method); } else { - var property = createNode(142 /* PropertySignature */, fullStart); + var property = createNode(143 /* PropertySignature */, fullStart); setModifiers(property, modifiers); property.name = name; property.questionToken = questionToken; @@ -9235,10 +9442,10 @@ var ts; } function parseTypeMember() { if (token === 17 /* OpenParenToken */ || token === 25 /* LessThanToken */) { - return parseSignatureMember(149 /* CallSignature */); + return parseSignatureMember(150 /* CallSignature */); } if (token === 92 /* NewKeyword */ && lookAhead(isStartOfConstructSignature)) { - return parseSignatureMember(150 /* ConstructSignature */); + return parseSignatureMember(151 /* ConstructSignature */); } var fullStart = getNodePos(); var modifiers = parseModifiers(); @@ -9252,7 +9459,7 @@ var ts; return token === 17 /* OpenParenToken */ || token === 25 /* LessThanToken */; } function parseTypeLiteral() { - var node = createNode(157 /* TypeLiteral */); + var node = createNode(158 /* TypeLiteral */); node.members = parseObjectTypeMembers(); return finishNode(node); } @@ -9268,12 +9475,12 @@ var ts; return members; } function parseTupleType() { - var node = createNode(159 /* TupleType */); + var node = createNode(160 /* TupleType */); node.elementTypes = parseBracketedList(19 /* TupleElementTypes */, parseType, 19 /* OpenBracketToken */, 20 /* CloseBracketToken */); return finishNode(node); } function parseParenthesizedType() { - var node = createNode(162 /* ParenthesizedType */); + var node = createNode(163 /* ParenthesizedType */); parseExpected(17 /* OpenParenToken */); node.type = parseType(); parseExpected(18 /* CloseParenToken */); @@ -9281,7 +9488,7 @@ var ts; } function parseFunctionOrConstructorType(kind) { var node = createNode(kind); - if (kind === 155 /* ConstructorType */) { + if (kind === 156 /* ConstructorType */) { parseExpected(92 /* NewKeyword */); } fillSignature(34 /* EqualsGreaterThanToken */, /*yieldContext*/ false, /*awaitContext*/ false, /*requireCompleteParameterList*/ false, node); @@ -9298,12 +9505,14 @@ var ts; case 129 /* NumberKeyword */: case 120 /* BooleanKeyword */: case 132 /* SymbolKeyword */: + case 134 /* UndefinedKeyword */: // 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 */: return parseStringLiteralTypeNode(); case 103 /* VoidKeyword */: + case 93 /* NullKeyword */: return parseTokenNode(); case 97 /* ThisKeyword */: { var thisKeyword = parseThisTypeNode(); @@ -9334,6 +9543,8 @@ var ts; case 120 /* BooleanKeyword */: case 132 /* SymbolKeyword */: case 103 /* VoidKeyword */: + case 134 /* UndefinedKeyword */: + case 93 /* NullKeyword */: case 97 /* ThisKeyword */: case 101 /* TypeOfKeyword */: case 15 /* OpenBraceToken */: @@ -9358,7 +9569,7 @@ var ts; var type = parseNonArrayType(); while (!scanner.hasPrecedingLineBreak() && parseOptional(19 /* OpenBracketToken */)) { parseExpected(20 /* CloseBracketToken */); - var node = createNode(158 /* ArrayType */, type.pos); + var node = createNode(159 /* ArrayType */, type.pos); node.elementType = type; type = finishNode(node); } @@ -9380,10 +9591,10 @@ var ts; return type; } function parseIntersectionTypeOrHigher() { - return parseUnionOrIntersectionType(161 /* IntersectionType */, parseArrayTypeOrHigher, 46 /* AmpersandToken */); + return parseUnionOrIntersectionType(162 /* IntersectionType */, parseArrayTypeOrHigher, 46 /* AmpersandToken */); } function parseUnionTypeOrHigher() { - return parseUnionOrIntersectionType(160 /* UnionType */, parseIntersectionTypeOrHigher, 47 /* BarToken */); + return parseUnionOrIntersectionType(161 /* UnionType */, parseIntersectionTypeOrHigher, 47 /* BarToken */); } function isStartOfFunctionType() { if (token === 25 /* LessThanToken */) { @@ -9396,7 +9607,7 @@ var ts; // Skip modifiers parseModifiers(); } - if (isIdentifier()) { + if (isIdentifier() || token === 97 /* ThisKeyword */) { nextToken(); return true; } @@ -9440,7 +9651,7 @@ var ts; var typePredicateVariable = isIdentifier() && tryParse(parseTypePredicatePrefix); var type = parseType(); if (typePredicateVariable) { - var node = createNode(152 /* TypePredicate */, typePredicateVariable.pos); + var node = createNode(153 /* TypePredicate */, typePredicateVariable.pos); node.parameterName = typePredicateVariable; node.type = type; return finishNode(node); @@ -9463,10 +9674,10 @@ var ts; } function parseTypeWorker() { if (isStartOfFunctionType()) { - return parseFunctionOrConstructorType(154 /* FunctionType */); + return parseFunctionOrConstructorType(155 /* FunctionType */); } if (token === 92 /* NewKeyword */) { - return parseFunctionOrConstructorType(155 /* ConstructorType */); + return parseFunctionOrConstructorType(156 /* ConstructorType */); } return parseUnionTypeOrHigher(); } @@ -9659,7 +9870,7 @@ var ts; return !scanner.hasPrecedingLineBreak() && isIdentifier(); } function parseYieldExpression() { - var node = createNode(188 /* YieldExpression */); + var node = createNode(189 /* YieldExpression */); // YieldExpression[In] : // yield // yield [no LineTerminator here] [Lexical goal InputElementRegExp]AssignmentExpression[?In, Yield] @@ -9679,8 +9890,8 @@ var ts; } function parseSimpleArrowFunctionExpression(identifier) { ts.Debug.assert(token === 34 /* EqualsGreaterThanToken */, "parseSimpleArrowFunctionExpression should only have been called if we had a =>"); - var node = createNode(178 /* ArrowFunction */, identifier.pos); - var parameter = createNode(140 /* Parameter */, identifier.pos); + var node = createNode(179 /* ArrowFunction */, identifier.pos); + var parameter = createNode(141 /* Parameter */, identifier.pos); parameter.name = identifier; finishNode(parameter); node.parameters = [parameter]; @@ -9832,7 +10043,7 @@ var ts; return parseParenthesizedArrowFunctionExpressionHead(/*allowAmbiguity*/ false); } function parseParenthesizedArrowFunctionExpressionHead(allowAmbiguity) { - var node = createNode(178 /* ArrowFunction */); + var node = createNode(179 /* ArrowFunction */); setModifiers(node, parseModifiersForArrowFunction()); var isAsync = !!(node.flags & 256 /* Async */); // Arrow functions are never generators. @@ -9898,7 +10109,7 @@ var ts; } // Note: we explicitly 'allowIn' in the whenTrue part of the condition expression, and // we do not that for the 'whenFalse' part. - var node = createNode(186 /* ConditionalExpression */, leftOperand.pos); + var node = createNode(187 /* ConditionalExpression */, leftOperand.pos); node.condition = leftOperand; node.questionToken = questionToken; node.whenTrue = doOutsideOfContext(disallowInAndDecoratorContext, parseAssignmentExpressionOrHigher); @@ -9911,7 +10122,7 @@ var ts; return parseBinaryExpressionRest(precedence, leftOperand); } function isInOrOfKeyword(t) { - return t === 90 /* InKeyword */ || t === 136 /* OfKeyword */; + return t === 90 /* InKeyword */ || t === 137 /* OfKeyword */; } function parseBinaryExpressionRest(precedence, leftOperand) { while (true) { @@ -10019,39 +10230,39 @@ var ts; return -1; } function makeBinaryExpression(left, operatorToken, right) { - var node = createNode(185 /* BinaryExpression */, left.pos); + var node = createNode(186 /* BinaryExpression */, left.pos); node.left = left; node.operatorToken = operatorToken; node.right = right; return finishNode(node); } function makeAsExpression(left, right) { - var node = createNode(193 /* AsExpression */, left.pos); + var node = createNode(194 /* AsExpression */, left.pos); node.expression = left; node.type = right; return finishNode(node); } function parsePrefixUnaryExpression() { - var node = createNode(183 /* PrefixUnaryExpression */); + var node = createNode(184 /* PrefixUnaryExpression */); node.operator = token; nextToken(); node.operand = parseSimpleUnaryExpression(); return finishNode(node); } function parseDeleteExpression() { - var node = createNode(179 /* DeleteExpression */); + var node = createNode(180 /* DeleteExpression */); nextToken(); node.expression = parseSimpleUnaryExpression(); return finishNode(node); } function parseTypeOfExpression() { - var node = createNode(180 /* TypeOfExpression */); + var node = createNode(181 /* TypeOfExpression */); nextToken(); node.expression = parseSimpleUnaryExpression(); return finishNode(node); } function parseVoidExpression() { - var node = createNode(181 /* VoidExpression */); + var node = createNode(182 /* VoidExpression */); nextToken(); node.expression = parseSimpleUnaryExpression(); return finishNode(node); @@ -10067,7 +10278,7 @@ var ts; return false; } function parseAwaitExpression() { - var node = createNode(182 /* AwaitExpression */); + var node = createNode(183 /* AwaitExpression */); nextToken(); node.expression = parseSimpleUnaryExpression(); return finishNode(node); @@ -10093,7 +10304,7 @@ var ts; var simpleUnaryExpression = parseSimpleUnaryExpression(); if (token === 38 /* AsteriskAsteriskToken */) { var start = ts.skipTrivia(sourceText, simpleUnaryExpression.pos); - if (simpleUnaryExpression.kind === 175 /* TypeAssertionExpression */) { + if (simpleUnaryExpression.kind === 176 /* 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 { @@ -10183,7 +10394,7 @@ var ts; */ function parseIncrementExpression() { if (token === 41 /* PlusPlusToken */ || token === 42 /* MinusMinusToken */) { - var node = createNode(183 /* PrefixUnaryExpression */); + var node = createNode(184 /* PrefixUnaryExpression */); node.operator = token; nextToken(); node.operand = parseLeftHandSideExpressionOrHigher(); @@ -10196,7 +10407,7 @@ var ts; var expression = parseLeftHandSideExpressionOrHigher(); ts.Debug.assert(ts.isLeftHandSideExpression(expression)); if ((token === 41 /* PlusPlusToken */ || token === 42 /* MinusMinusToken */) && !scanner.hasPrecedingLineBreak()) { - var node = createNode(184 /* PostfixUnaryExpression */, expression.pos); + var node = createNode(185 /* PostfixUnaryExpression */, expression.pos); node.operand = expression; node.operator = token; nextToken(); @@ -10300,7 +10511,7 @@ var ts; } // 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(170 /* PropertyAccessExpression */, expression.pos); + var node = createNode(171 /* PropertyAccessExpression */, expression.pos); node.expression = expression; node.dotToken = parseExpectedToken(21 /* DotToken */, /*reportAtCurrentPosition*/ false, ts.Diagnostics.super_must_be_followed_by_an_argument_list_or_member_access); node.name = parseRightSideOfDot(/*allowIdentifierNames*/ true); @@ -10319,8 +10530,8 @@ var ts; function parseJsxElementOrSelfClosingElement(inExpressionContext) { var opening = parseJsxOpeningOrSelfClosingElement(inExpressionContext); var result; - if (opening.kind === 239 /* JsxOpeningElement */) { - var node = createNode(237 /* JsxElement */, opening.pos); + if (opening.kind === 242 /* JsxOpeningElement */) { + var node = createNode(240 /* JsxElement */, opening.pos); node.openingElement = opening; node.children = parseJsxChildren(node.openingElement.tagName); node.closingElement = parseJsxClosingElement(inExpressionContext); @@ -10330,7 +10541,7 @@ var ts; result = finishNode(node); } else { - ts.Debug.assert(opening.kind === 238 /* JsxSelfClosingElement */); + ts.Debug.assert(opening.kind === 241 /* JsxSelfClosingElement */); // Nothing else to do for self-closing elements result = opening; } @@ -10345,7 +10556,7 @@ var ts; var invalidElement = tryParse(function () { return parseJsxElementOrSelfClosingElement(/*inExpressionContext*/ true); }); if (invalidElement) { parseErrorAtCurrentToken(ts.Diagnostics.JSX_expressions_must_have_one_parent_element); - var badNode = createNode(185 /* BinaryExpression */, result.pos); + var badNode = createNode(186 /* BinaryExpression */, result.pos); badNode.end = invalidElement.end; badNode.left = result; badNode.right = invalidElement; @@ -10357,13 +10568,13 @@ var ts; return result; } function parseJsxText() { - var node = createNode(240 /* JsxText */, scanner.getStartPos()); + var node = createNode(243 /* JsxText */, scanner.getStartPos()); token = scanner.scanJsxToken(); return finishNode(node); } function parseJsxChild() { switch (token) { - case 240 /* JsxText */: + case 243 /* JsxText */: return parseJsxText(); case 15 /* OpenBraceToken */: return parseJsxExpression(/*inExpressionContext*/ false); @@ -10405,7 +10616,7 @@ var ts; // 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(239 /* JsxOpeningElement */, fullStart); + node = createNode(242 /* JsxOpeningElement */, fullStart); scanJsxText(); } else { @@ -10417,7 +10628,7 @@ var ts; parseExpected(27 /* GreaterThanToken */, /*diagnostic*/ undefined, /*shouldAdvance*/ false); scanJsxText(); } - node = createNode(238 /* JsxSelfClosingElement */, fullStart); + node = createNode(241 /* JsxSelfClosingElement */, fullStart); } node.tagName = tagName; node.attributes = attributes; @@ -10428,7 +10639,7 @@ var ts; var elementName = parseIdentifierName(); while (parseOptional(21 /* DotToken */)) { scanJsxIdentifier(); - var node = createNode(137 /* QualifiedName */, elementName.pos); + var node = createNode(138 /* QualifiedName */, elementName.pos); node.left = elementName; node.right = parseIdentifierName(); elementName = finishNode(node); @@ -10436,7 +10647,7 @@ var ts; return elementName; } function parseJsxExpression(inExpressionContext) { - var node = createNode(244 /* JsxExpression */); + var node = createNode(247 /* JsxExpression */); parseExpected(15 /* OpenBraceToken */); if (token !== 16 /* CloseBraceToken */) { node.expression = parseAssignmentExpressionOrHigher(); @@ -10455,7 +10666,7 @@ var ts; return parseJsxSpreadAttribute(); } scanJsxIdentifier(); - var node = createNode(242 /* JsxAttribute */); + var node = createNode(245 /* JsxAttribute */); node.name = parseIdentifierName(); if (parseOptional(56 /* EqualsToken */)) { switch (token) { @@ -10470,7 +10681,7 @@ var ts; return finishNode(node); } function parseJsxSpreadAttribute() { - var node = createNode(243 /* JsxSpreadAttribute */); + var node = createNode(246 /* JsxSpreadAttribute */); parseExpected(15 /* OpenBraceToken */); parseExpected(22 /* DotDotDotToken */); node.expression = parseExpression(); @@ -10478,7 +10689,7 @@ var ts; return finishNode(node); } function parseJsxClosingElement(inExpressionContext) { - var node = createNode(241 /* JsxClosingElement */); + var node = createNode(244 /* JsxClosingElement */); parseExpected(26 /* LessThanSlashToken */); node.tagName = parseJsxElementName(); if (inExpressionContext) { @@ -10491,7 +10702,7 @@ var ts; return finishNode(node); } function parseTypeAssertion() { - var node = createNode(175 /* TypeAssertionExpression */); + var node = createNode(176 /* TypeAssertionExpression */); parseExpected(25 /* LessThanToken */); node.type = parseType(); parseExpected(27 /* GreaterThanToken */); @@ -10502,16 +10713,23 @@ var ts; while (true) { var dotToken = parseOptionalToken(21 /* DotToken */); if (dotToken) { - var propertyAccess = createNode(170 /* PropertyAccessExpression */, expression.pos); + var propertyAccess = createNode(171 /* PropertyAccessExpression */, expression.pos); propertyAccess.expression = expression; propertyAccess.dotToken = dotToken; propertyAccess.name = parseRightSideOfDot(/*allowIdentifierNames*/ true); expression = finishNode(propertyAccess); continue; } + if (token === 49 /* ExclamationToken */ && !scanner.hasPrecedingLineBreak()) { + nextToken(); + var nonNullExpression = createNode(195 /* 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(171 /* ElementAccessExpression */, expression.pos); + var indexedAccess = createNode(172 /* 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. @@ -10527,7 +10745,7 @@ var ts; continue; } if (token === 11 /* NoSubstitutionTemplateLiteral */ || token === 12 /* TemplateHead */) { - var tagExpression = createNode(174 /* TaggedTemplateExpression */, expression.pos); + var tagExpression = createNode(175 /* TaggedTemplateExpression */, expression.pos); tagExpression.tag = expression; tagExpression.template = token === 11 /* NoSubstitutionTemplateLiteral */ ? parseLiteralNode() @@ -10550,7 +10768,7 @@ var ts; if (!typeArguments) { return expression; } - var callExpr = createNode(172 /* CallExpression */, expression.pos); + var callExpr = createNode(173 /* CallExpression */, expression.pos); callExpr.expression = expression; callExpr.typeArguments = typeArguments; callExpr.arguments = parseArgumentList(); @@ -10558,7 +10776,7 @@ var ts; continue; } else if (token === 17 /* OpenParenToken */) { - var callExpr = createNode(172 /* CallExpression */, expression.pos); + var callExpr = createNode(173 /* CallExpression */, expression.pos); callExpr.expression = expression; callExpr.arguments = parseArgumentList(); expression = finishNode(callExpr); @@ -10668,28 +10886,28 @@ var ts; return parseIdentifier(ts.Diagnostics.Expression_expected); } function parseParenthesizedExpression() { - var node = createNode(176 /* ParenthesizedExpression */); + var node = createNode(177 /* ParenthesizedExpression */); parseExpected(17 /* OpenParenToken */); node.expression = allowInAnd(parseExpression); parseExpected(18 /* CloseParenToken */); return finishNode(node); } function parseSpreadElement() { - var node = createNode(189 /* SpreadElementExpression */); + var node = createNode(190 /* SpreadElementExpression */); parseExpected(22 /* DotDotDotToken */); node.expression = parseAssignmentExpressionOrHigher(); return finishNode(node); } function parseArgumentOrArrayLiteralElement() { return token === 22 /* DotDotDotToken */ ? parseSpreadElement() : - token === 24 /* CommaToken */ ? createNode(191 /* OmittedExpression */) : + token === 24 /* CommaToken */ ? createNode(192 /* OmittedExpression */) : parseAssignmentExpressionOrHigher(); } function parseArgumentExpression() { return doOutsideOfContext(disallowInAndDecoratorContext, parseArgumentOrArrayLiteralElement); } function parseArrayLiteralExpression() { - var node = createNode(168 /* ArrayLiteralExpression */); + var node = createNode(169 /* ArrayLiteralExpression */); parseExpected(19 /* OpenBracketToken */); if (scanner.hasPrecedingLineBreak()) { node.multiLine = true; @@ -10700,10 +10918,10 @@ var ts; } function tryParseAccessorDeclaration(fullStart, decorators, modifiers) { if (parseContextualModifier(123 /* GetKeyword */)) { - return parseAccessorDeclaration(147 /* GetAccessor */, fullStart, decorators, modifiers); + return addJSDocComment(parseAccessorDeclaration(148 /* GetAccessor */, fullStart, decorators, modifiers)); } else if (parseContextualModifier(130 /* SetKeyword */)) { - return parseAccessorDeclaration(148 /* SetAccessor */, fullStart, decorators, modifiers); + return parseAccessorDeclaration(149 /* SetAccessor */, fullStart, decorators, modifiers); } return undefined; } @@ -10730,7 +10948,7 @@ var ts; // 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 */); if (isShorthandPropertyAssignment) { - var shorthandDeclaration = createNode(250 /* ShorthandPropertyAssignment */, fullStart); + var shorthandDeclaration = createNode(253 /* ShorthandPropertyAssignment */, fullStart); shorthandDeclaration.name = propertyName; shorthandDeclaration.questionToken = questionToken; var equalsToken = parseOptionalToken(56 /* EqualsToken */); @@ -10741,7 +10959,7 @@ var ts; return addJSDocComment(finishNode(shorthandDeclaration)); } else { - var propertyAssignment = createNode(249 /* PropertyAssignment */, fullStart); + var propertyAssignment = createNode(252 /* PropertyAssignment */, fullStart); propertyAssignment.modifiers = modifiers; propertyAssignment.name = propertyName; propertyAssignment.questionToken = questionToken; @@ -10751,7 +10969,7 @@ var ts; } } function parseObjectLiteralExpression() { - var node = createNode(169 /* ObjectLiteralExpression */); + var node = createNode(170 /* ObjectLiteralExpression */); parseExpected(15 /* OpenBraceToken */); if (scanner.hasPrecedingLineBreak()) { node.multiLine = true; @@ -10770,7 +10988,7 @@ var ts; if (saveDecoratorContext) { setDecoratorContext(/*val*/ false); } - var node = createNode(177 /* FunctionExpression */); + var node = createNode(178 /* FunctionExpression */); setModifiers(node, parseModifiers()); parseExpected(87 /* FunctionKeyword */); node.asteriskToken = parseOptionalToken(37 /* AsteriskToken */); @@ -10792,7 +11010,7 @@ var ts; return isIdentifier() ? parseIdentifier() : undefined; } function parseNewExpression() { - var node = createNode(173 /* NewExpression */); + var node = createNode(174 /* NewExpression */); parseExpected(92 /* NewKeyword */); node.expression = parseMemberExpressionOrHigher(); node.typeArguments = tryParse(parseTypeArgumentsInExpression); @@ -10803,7 +11021,7 @@ var ts; } // STATEMENTS function parseBlock(ignoreMissingOpenBrace, diagnosticMessage) { - var node = createNode(196 /* Block */); + var node = createNode(198 /* Block */); if (parseExpected(15 /* OpenBraceToken */, diagnosticMessage) || ignoreMissingOpenBrace) { node.statements = parseList(1 /* BlockStatements */, parseStatement); parseExpected(16 /* CloseBraceToken */); @@ -10833,12 +11051,12 @@ var ts; return block; } function parseEmptyStatement() { - var node = createNode(198 /* EmptyStatement */); + var node = createNode(200 /* EmptyStatement */); parseExpected(23 /* SemicolonToken */); return finishNode(node); } function parseIfStatement() { - var node = createNode(200 /* IfStatement */); + var node = createNode(202 /* IfStatement */); parseExpected(88 /* IfKeyword */); parseExpected(17 /* OpenParenToken */); node.expression = allowInAnd(parseExpression); @@ -10848,7 +11066,7 @@ var ts; return finishNode(node); } function parseDoStatement() { - var node = createNode(201 /* DoStatement */); + var node = createNode(203 /* DoStatement */); parseExpected(79 /* DoKeyword */); node.statement = parseStatement(); parseExpected(104 /* WhileKeyword */); @@ -10863,7 +11081,7 @@ var ts; return finishNode(node); } function parseWhileStatement() { - var node = createNode(202 /* WhileStatement */); + var node = createNode(204 /* WhileStatement */); parseExpected(104 /* WhileKeyword */); parseExpected(17 /* OpenParenToken */); node.expression = allowInAnd(parseExpression); @@ -10886,21 +11104,21 @@ var ts; } var forOrForInOrForOfStatement; if (parseOptional(90 /* InKeyword */)) { - var forInStatement = createNode(204 /* ForInStatement */, pos); + var forInStatement = createNode(206 /* ForInStatement */, pos); forInStatement.initializer = initializer; forInStatement.expression = allowInAnd(parseExpression); parseExpected(18 /* CloseParenToken */); forOrForInOrForOfStatement = forInStatement; } - else if (parseOptional(136 /* OfKeyword */)) { - var forOfStatement = createNode(205 /* ForOfStatement */, pos); + else if (parseOptional(137 /* OfKeyword */)) { + var forOfStatement = createNode(207 /* ForOfStatement */, pos); forOfStatement.initializer = initializer; forOfStatement.expression = allowInAnd(parseAssignmentExpressionOrHigher); parseExpected(18 /* CloseParenToken */); forOrForInOrForOfStatement = forOfStatement; } else { - var forStatement = createNode(203 /* ForStatement */, pos); + var forStatement = createNode(205 /* ForStatement */, pos); forStatement.initializer = initializer; parseExpected(23 /* SemicolonToken */); if (token !== 23 /* SemicolonToken */ && token !== 18 /* CloseParenToken */) { @@ -10918,7 +11136,7 @@ var ts; } function parseBreakOrContinueStatement(kind) { var node = createNode(kind); - parseExpected(kind === 207 /* BreakStatement */ ? 70 /* BreakKeyword */ : 75 /* ContinueKeyword */); + parseExpected(kind === 209 /* BreakStatement */ ? 70 /* BreakKeyword */ : 75 /* ContinueKeyword */); if (!canParseSemicolon()) { node.label = parseIdentifier(); } @@ -10926,7 +11144,7 @@ var ts; return finishNode(node); } function parseReturnStatement() { - var node = createNode(208 /* ReturnStatement */); + var node = createNode(210 /* ReturnStatement */); parseExpected(94 /* ReturnKeyword */); if (!canParseSemicolon()) { node.expression = allowInAnd(parseExpression); @@ -10935,7 +11153,7 @@ var ts; return finishNode(node); } function parseWithStatement() { - var node = createNode(209 /* WithStatement */); + var node = createNode(211 /* WithStatement */); parseExpected(105 /* WithKeyword */); parseExpected(17 /* OpenParenToken */); node.expression = allowInAnd(parseExpression); @@ -10944,7 +11162,7 @@ var ts; return finishNode(node); } function parseCaseClause() { - var node = createNode(245 /* CaseClause */); + var node = createNode(248 /* CaseClause */); parseExpected(71 /* CaseKeyword */); node.expression = allowInAnd(parseExpression); parseExpected(54 /* ColonToken */); @@ -10952,7 +11170,7 @@ var ts; return finishNode(node); } function parseDefaultClause() { - var node = createNode(246 /* DefaultClause */); + var node = createNode(249 /* DefaultClause */); parseExpected(77 /* DefaultKeyword */); parseExpected(54 /* ColonToken */); node.statements = parseList(3 /* SwitchClauseStatements */, parseStatement); @@ -10962,12 +11180,12 @@ var ts; return token === 71 /* CaseKeyword */ ? parseCaseClause() : parseDefaultClause(); } function parseSwitchStatement() { - var node = createNode(210 /* SwitchStatement */); + var node = createNode(212 /* SwitchStatement */); parseExpected(96 /* SwitchKeyword */); parseExpected(17 /* OpenParenToken */); node.expression = allowInAnd(parseExpression); parseExpected(18 /* CloseParenToken */); - var caseBlock = createNode(224 /* CaseBlock */, scanner.getStartPos()); + var caseBlock = createNode(226 /* CaseBlock */, scanner.getStartPos()); parseExpected(15 /* OpenBraceToken */); caseBlock.clauses = parseList(2 /* SwitchClauses */, parseCaseOrDefaultClause); parseExpected(16 /* CloseBraceToken */); @@ -10982,7 +11200,7 @@ 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(212 /* ThrowStatement */); + var node = createNode(214 /* ThrowStatement */); parseExpected(98 /* ThrowKeyword */); node.expression = scanner.hasPrecedingLineBreak() ? undefined : allowInAnd(parseExpression); parseSemicolon(); @@ -10990,7 +11208,7 @@ var ts; } // TODO: Review for error recovery function parseTryStatement() { - var node = createNode(213 /* TryStatement */); + var node = createNode(215 /* TryStatement */); parseExpected(100 /* TryKeyword */); node.tryBlock = parseBlock(/*ignoreMissingOpenBrace*/ false); node.catchClause = token === 72 /* CatchKeyword */ ? parseCatchClause() : undefined; @@ -11003,7 +11221,7 @@ var ts; return finishNode(node); } function parseCatchClause() { - var result = createNode(248 /* CatchClause */); + var result = createNode(251 /* CatchClause */); parseExpected(72 /* CatchKeyword */); if (parseExpected(17 /* OpenParenToken */)) { result.variableDeclaration = parseVariableDeclaration(); @@ -11013,7 +11231,7 @@ var ts; return finishNode(result); } function parseDebuggerStatement() { - var node = createNode(214 /* DebuggerStatement */); + var node = createNode(216 /* DebuggerStatement */); parseExpected(76 /* DebuggerKeyword */); parseSemicolon(); return finishNode(node); @@ -11025,13 +11243,13 @@ var ts; var fullStart = scanner.getStartPos(); var expression = allowInAnd(parseExpression); if (expression.kind === 69 /* Identifier */ && parseOptional(54 /* ColonToken */)) { - var labeledStatement = createNode(211 /* LabeledStatement */, fullStart); + var labeledStatement = createNode(213 /* LabeledStatement */, fullStart); labeledStatement.label = expression; labeledStatement.statement = parseStatement(); return addJSDocComment(finishNode(labeledStatement)); } else { - var expressionStatement = createNode(199 /* ExpressionStatement */, fullStart); + var expressionStatement = createNode(201 /* ExpressionStatement */, fullStart); expressionStatement.expression = expression; parseSemicolon(); return addJSDocComment(finishNode(expressionStatement)); @@ -11099,8 +11317,9 @@ var ts; return false; } continue; - case 135 /* GlobalKeyword */: - return nextToken() === 15 /* OpenBraceToken */; + case 136 /* GlobalKeyword */: + nextToken(); + return token === 15 /* OpenBraceToken */ || token === 69 /* Identifier */ || token === 82 /* ExportKeyword */; case 89 /* ImportKeyword */: nextToken(); return token === 9 /* StringLiteral */ || token === 37 /* AsteriskToken */ || @@ -11108,7 +11327,8 @@ var ts; case 82 /* ExportKeyword */: nextToken(); if (token === 56 /* EqualsToken */ || token === 37 /* AsteriskToken */ || - token === 15 /* OpenBraceToken */ || token === 77 /* DefaultKeyword */) { + token === 15 /* OpenBraceToken */ || token === 77 /* DefaultKeyword */ || + token === 116 /* AsKeyword */) { return true; } continue; @@ -11160,7 +11380,7 @@ var ts; case 125 /* ModuleKeyword */: case 126 /* NamespaceKeyword */: case 133 /* TypeKeyword */: - case 135 /* GlobalKeyword */: + case 136 /* GlobalKeyword */: // When these don't start a declaration, they're an identifier in an expression statement return true; case 112 /* PublicKeyword */: @@ -11210,9 +11430,9 @@ var ts; case 86 /* ForKeyword */: return parseForOrForInOrForOfStatement(); case 75 /* ContinueKeyword */: - return parseBreakOrContinueStatement(206 /* ContinueStatement */); + return parseBreakOrContinueStatement(208 /* ContinueStatement */); case 70 /* BreakKeyword */: - return parseBreakOrContinueStatement(207 /* BreakStatement */); + return parseBreakOrContinueStatement(209 /* BreakStatement */); case 94 /* ReturnKeyword */: return parseReturnStatement(); case 105 /* WithKeyword */: @@ -11246,7 +11466,7 @@ var ts; case 115 /* AbstractKeyword */: case 113 /* StaticKeyword */: case 127 /* ReadonlyKeyword */: - case 135 /* GlobalKeyword */: + case 136 /* GlobalKeyword */: if (isStartOfDeclaration()) { return parseDeclaration(); } @@ -11273,7 +11493,7 @@ var ts; return parseTypeAliasDeclaration(fullStart, decorators, modifiers); case 81 /* EnumKeyword */: return parseEnumDeclaration(fullStart, decorators, modifiers); - case 135 /* GlobalKeyword */: + case 136 /* GlobalKeyword */: case 125 /* ModuleKeyword */: case 126 /* NamespaceKeyword */: return parseModuleDeclaration(fullStart, decorators, modifiers); @@ -11281,14 +11501,20 @@ var ts; return parseImportDeclarationOrImportEqualsDeclaration(fullStart, decorators, modifiers); case 82 /* ExportKeyword */: nextToken(); - return token === 77 /* DefaultKeyword */ || token === 56 /* EqualsToken */ ? - parseExportAssignment(fullStart, decorators, modifiers) : - parseExportDeclaration(fullStart, decorators, modifiers); + switch (token) { + case 77 /* DefaultKeyword */: + case 56 /* EqualsToken */: + return parseExportAssignment(fullStart, decorators, modifiers); + case 116 /* AsKeyword */: + return parseGlobalModuleExportDeclaration(fullStart, decorators, modifiers); + default: + return parseExportDeclaration(fullStart, decorators, modifiers); + } default: 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(235 /* MissingDeclaration */, /*reportAtCurrentPosition*/ true, ts.Diagnostics.Declaration_expected); + var node = createMissingNode(238 /* MissingDeclaration */, /*reportAtCurrentPosition*/ true, ts.Diagnostics.Declaration_expected); node.pos = fullStart; node.decorators = decorators; setModifiers(node, modifiers); @@ -11310,16 +11536,16 @@ var ts; // DECLARATIONS function parseArrayBindingElement() { if (token === 24 /* CommaToken */) { - return createNode(191 /* OmittedExpression */); + return createNode(192 /* OmittedExpression */); } - var node = createNode(167 /* BindingElement */); + var node = createNode(168 /* BindingElement */); node.dotDotDotToken = parseOptionalToken(22 /* DotDotDotToken */); node.name = parseIdentifierOrPattern(); node.initializer = parseBindingElementInitializer(/*inParameter*/ false); return finishNode(node); } function parseObjectBindingElement() { - var node = createNode(167 /* BindingElement */); + var node = createNode(168 /* BindingElement */); var tokenIsIdentifier = isIdentifier(); var propertyName = parsePropertyName(); if (tokenIsIdentifier && token !== 54 /* ColonToken */) { @@ -11334,14 +11560,14 @@ var ts; return finishNode(node); } function parseObjectBindingPattern() { - var node = createNode(165 /* ObjectBindingPattern */); + var node = createNode(166 /* ObjectBindingPattern */); parseExpected(15 /* OpenBraceToken */); node.elements = parseDelimitedList(9 /* ObjectBindingElements */, parseObjectBindingElement); parseExpected(16 /* CloseBraceToken */); return finishNode(node); } function parseArrayBindingPattern() { - var node = createNode(166 /* ArrayBindingPattern */); + var node = createNode(167 /* ArrayBindingPattern */); parseExpected(19 /* OpenBracketToken */); node.elements = parseDelimitedList(10 /* ArrayBindingElements */, parseArrayBindingElement); parseExpected(20 /* CloseBracketToken */); @@ -11360,7 +11586,7 @@ var ts; return parseIdentifier(); } function parseVariableDeclaration() { - var node = createNode(215 /* VariableDeclaration */); + var node = createNode(217 /* VariableDeclaration */); node.name = parseIdentifierOrPattern(); node.type = parseTypeAnnotation(); if (!isInOrOfKeyword(token)) { @@ -11369,7 +11595,7 @@ var ts; return finishNode(node); } function parseVariableDeclarationList(inForStatementInitializer) { - var node = createNode(216 /* VariableDeclarationList */); + var node = createNode(218 /* VariableDeclarationList */); switch (token) { case 102 /* VarKeyword */: break; @@ -11392,7 +11618,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 === 136 /* OfKeyword */ && lookAhead(canFollowContextualOfKeyword)) { + if (token === 137 /* OfKeyword */ && lookAhead(canFollowContextualOfKeyword)) { node.declarations = createMissingList(); } else { @@ -11407,7 +11633,7 @@ var ts; return nextTokenIsIdentifier() && nextToken() === 18 /* CloseParenToken */; } function parseVariableStatement(fullStart, decorators, modifiers) { - var node = createNode(197 /* VariableStatement */, fullStart); + var node = createNode(199 /* VariableStatement */, fullStart); node.decorators = decorators; setModifiers(node, modifiers); node.declarationList = parseVariableDeclarationList(/*inForStatementInitializer*/ false); @@ -11415,7 +11641,7 @@ var ts; return addJSDocComment(finishNode(node)); } function parseFunctionDeclaration(fullStart, decorators, modifiers) { - var node = createNode(217 /* FunctionDeclaration */, fullStart); + var node = createNode(219 /* FunctionDeclaration */, fullStart); node.decorators = decorators; setModifiers(node, modifiers); parseExpected(87 /* FunctionKeyword */); @@ -11428,7 +11654,7 @@ var ts; return addJSDocComment(finishNode(node)); } function parseConstructorDeclaration(pos, decorators, modifiers) { - var node = createNode(146 /* Constructor */, pos); + var node = createNode(147 /* Constructor */, pos); node.decorators = decorators; setModifiers(node, modifiers); parseExpected(121 /* ConstructorKeyword */); @@ -11437,7 +11663,7 @@ var ts; return addJSDocComment(finishNode(node)); } function parseMethodDeclaration(fullStart, decorators, modifiers, asteriskToken, name, questionToken, diagnosticMessage) { - var method = createNode(145 /* MethodDeclaration */, fullStart); + var method = createNode(146 /* MethodDeclaration */, fullStart); method.decorators = decorators; setModifiers(method, modifiers); method.asteriskToken = asteriskToken; @@ -11450,7 +11676,7 @@ var ts; return addJSDocComment(finishNode(method)); } function parsePropertyDeclaration(fullStart, decorators, modifiers, name, questionToken) { - var property = createNode(143 /* PropertyDeclaration */, fullStart); + var property = createNode(144 /* PropertyDeclaration */, fullStart); property.decorators = decorators; setModifiers(property, modifiers); property.name = name; @@ -11577,7 +11803,7 @@ var ts; decorators = []; decorators.pos = decoratorStart; } - var decorator = createNode(141 /* Decorator */, decoratorStart); + var decorator = createNode(142 /* Decorator */, decoratorStart); decorator.expression = doInDecoratorContext(parseLeftHandSideExpressionOrHigher); decorators.push(finishNode(decorator)); } @@ -11642,7 +11868,7 @@ var ts; } function parseClassElement() { if (token === 23 /* SemicolonToken */) { - var result = createNode(195 /* SemicolonClassElement */); + var result = createNode(197 /* SemicolonClassElement */); nextToken(); return finishNode(result); } @@ -11680,10 +11906,10 @@ var ts; return parseClassDeclarationOrExpression( /*fullStart*/ scanner.getStartPos(), /*decorators*/ undefined, - /*modifiers*/ undefined, 190 /* ClassExpression */); + /*modifiers*/ undefined, 191 /* ClassExpression */); } function parseClassDeclaration(fullStart, decorators, modifiers) { - return parseClassDeclarationOrExpression(fullStart, decorators, modifiers, 218 /* ClassDeclaration */); + return parseClassDeclarationOrExpression(fullStart, decorators, modifiers, 220 /* ClassDeclaration */); } function parseClassDeclarationOrExpression(fullStart, decorators, modifiers, kind) { var node = createNode(kind, fullStart); @@ -11727,7 +11953,7 @@ var ts; } function parseHeritageClause() { if (token === 83 /* ExtendsKeyword */ || token === 106 /* ImplementsKeyword */) { - var node = createNode(247 /* HeritageClause */); + var node = createNode(250 /* HeritageClause */); node.token = token; nextToken(); node.types = parseDelimitedList(7 /* HeritageClauseElement */, parseExpressionWithTypeArguments); @@ -11736,7 +11962,7 @@ var ts; return undefined; } function parseExpressionWithTypeArguments() { - var node = createNode(192 /* ExpressionWithTypeArguments */); + var node = createNode(193 /* ExpressionWithTypeArguments */); node.expression = parseLeftHandSideExpressionOrHigher(); if (token === 25 /* LessThanToken */) { node.typeArguments = parseBracketedList(18 /* TypeArguments */, parseType, 25 /* LessThanToken */, 27 /* GreaterThanToken */); @@ -11750,7 +11976,7 @@ var ts; return parseList(5 /* ClassMembers */, parseClassElement); } function parseInterfaceDeclaration(fullStart, decorators, modifiers) { - var node = createNode(219 /* InterfaceDeclaration */, fullStart); + var node = createNode(221 /* InterfaceDeclaration */, fullStart); node.decorators = decorators; setModifiers(node, modifiers); parseExpected(107 /* InterfaceKeyword */); @@ -11761,7 +11987,7 @@ var ts; return finishNode(node); } function parseTypeAliasDeclaration(fullStart, decorators, modifiers) { - var node = createNode(220 /* TypeAliasDeclaration */, fullStart); + var node = createNode(222 /* TypeAliasDeclaration */, fullStart); node.decorators = decorators; setModifiers(node, modifiers); parseExpected(133 /* TypeKeyword */); @@ -11777,13 +12003,13 @@ var ts; // ConstantEnumMemberSection, which starts at the beginning of an enum declaration // or any time an integer literal initializer is encountered. function parseEnumMember() { - var node = createNode(251 /* EnumMember */, scanner.getStartPos()); + var node = createNode(254 /* EnumMember */, scanner.getStartPos()); node.name = parsePropertyName(); node.initializer = allowInAnd(parseNonParameterInitializer); return finishNode(node); } function parseEnumDeclaration(fullStart, decorators, modifiers) { - var node = createNode(221 /* EnumDeclaration */, fullStart); + var node = createNode(223 /* EnumDeclaration */, fullStart); node.decorators = decorators; setModifiers(node, modifiers); parseExpected(81 /* EnumKeyword */); @@ -11798,7 +12024,7 @@ var ts; return finishNode(node); } function parseModuleBlock() { - var node = createNode(223 /* ModuleBlock */, scanner.getStartPos()); + var node = createNode(225 /* ModuleBlock */, scanner.getStartPos()); if (parseExpected(15 /* OpenBraceToken */)) { node.statements = parseList(1 /* BlockStatements */, parseStatement); parseExpected(16 /* CloseBraceToken */); @@ -11809,7 +12035,7 @@ var ts; return finishNode(node); } function parseModuleOrNamespaceDeclaration(fullStart, decorators, modifiers, flags) { - var node = createNode(222 /* ModuleDeclaration */, fullStart); + var node = createNode(224 /* 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 */; @@ -11823,10 +12049,10 @@ var ts; return finishNode(node); } function parseAmbientExternalModuleDeclaration(fullStart, decorators, modifiers) { - var node = createNode(222 /* ModuleDeclaration */, fullStart); + var node = createNode(224 /* ModuleDeclaration */, fullStart); node.decorators = decorators; setModifiers(node, modifiers); - if (token === 135 /* GlobalKeyword */) { + if (token === 136 /* GlobalKeyword */) { // parse 'global' as name of global scope augmentation node.name = parseIdentifier(); node.flags |= 131072 /* GlobalAugmentation */; @@ -11839,7 +12065,7 @@ var ts; } function parseModuleDeclaration(fullStart, decorators, modifiers) { var flags = modifiers ? modifiers.flags : 0; - if (token === 135 /* GlobalKeyword */) { + if (token === 136 /* GlobalKeyword */) { // global augmentation return parseAmbientExternalModuleDeclaration(fullStart, decorators, modifiers); } @@ -11864,17 +12090,27 @@ var ts; function nextTokenIsSlash() { return nextToken() === 39 /* SlashToken */; } + function parseGlobalModuleExportDeclaration(fullStart, decorators, modifiers) { + var exportDeclaration = createNode(227 /* GlobalModuleExportDeclaration */, fullStart); + exportDeclaration.decorators = decorators; + exportDeclaration.modifiers = modifiers; + parseExpected(116 /* AsKeyword */); + parseExpected(126 /* NamespaceKeyword */); + exportDeclaration.name = parseIdentifier(); + parseExpected(23 /* SemicolonToken */); + return finishNode(exportDeclaration); + } function parseImportDeclarationOrImportEqualsDeclaration(fullStart, decorators, modifiers) { parseExpected(89 /* ImportKeyword */); var afterImportPos = scanner.getStartPos(); var identifier; if (isIdentifier()) { identifier = parseIdentifier(); - if (token !== 24 /* CommaToken */ && token !== 134 /* FromKeyword */) { + if (token !== 24 /* CommaToken */ && token !== 135 /* FromKeyword */) { // ImportEquals declaration of type: // import x = require("mod"); or // import x = M.x; - var importEqualsDeclaration = createNode(225 /* ImportEqualsDeclaration */, fullStart); + var importEqualsDeclaration = createNode(228 /* ImportEqualsDeclaration */, fullStart); importEqualsDeclaration.decorators = decorators; setModifiers(importEqualsDeclaration, modifiers); importEqualsDeclaration.name = identifier; @@ -11885,7 +12121,7 @@ var ts; } } // Import statement - var importDeclaration = createNode(226 /* ImportDeclaration */, fullStart); + var importDeclaration = createNode(229 /* ImportDeclaration */, fullStart); importDeclaration.decorators = decorators; setModifiers(importDeclaration, modifiers); // ImportDeclaration: @@ -11895,7 +12131,7 @@ var ts; token === 37 /* AsteriskToken */ || token === 15 /* OpenBraceToken */) { importDeclaration.importClause = parseImportClause(identifier, afterImportPos); - parseExpected(134 /* FromKeyword */); + parseExpected(135 /* FromKeyword */); } importDeclaration.moduleSpecifier = parseModuleSpecifier(); parseSemicolon(); @@ -11908,7 +12144,7 @@ var ts; // NamedImports // ImportedDefaultBinding, NameSpaceImport // ImportedDefaultBinding, NamedImports - var importClause = createNode(227 /* ImportClause */, fullStart); + var importClause = createNode(230 /* ImportClause */, fullStart); if (identifier) { // ImportedDefaultBinding: // ImportedBinding @@ -11918,7 +12154,7 @@ var ts; // parse namespace or named imports if (!importClause.name || parseOptional(24 /* CommaToken */)) { - importClause.namedBindings = token === 37 /* AsteriskToken */ ? parseNamespaceImport() : parseNamedImportsOrExports(229 /* NamedImports */); + importClause.namedBindings = token === 37 /* AsteriskToken */ ? parseNamespaceImport() : parseNamedImportsOrExports(232 /* NamedImports */); } return finishNode(importClause); } @@ -11928,7 +12164,7 @@ var ts; : parseEntityName(/*allowReservedWords*/ false); } function parseExternalModuleReference() { - var node = createNode(236 /* ExternalModuleReference */); + var node = createNode(239 /* ExternalModuleReference */); parseExpected(128 /* RequireKeyword */); parseExpected(17 /* OpenParenToken */); node.expression = parseModuleSpecifier(); @@ -11951,7 +12187,7 @@ var ts; function parseNamespaceImport() { // NameSpaceImport: // * as ImportedBinding - var namespaceImport = createNode(228 /* NamespaceImport */); + var namespaceImport = createNode(231 /* NamespaceImport */); parseExpected(37 /* AsteriskToken */); parseExpected(116 /* AsKeyword */); namespaceImport.name = parseIdentifier(); @@ -11966,14 +12202,14 @@ var ts; // ImportsList: // ImportSpecifier // ImportsList, ImportSpecifier - node.elements = parseBracketedList(21 /* ImportOrExportSpecifiers */, kind === 229 /* NamedImports */ ? parseImportSpecifier : parseExportSpecifier, 15 /* OpenBraceToken */, 16 /* CloseBraceToken */); + node.elements = parseBracketedList(21 /* ImportOrExportSpecifiers */, kind === 232 /* NamedImports */ ? parseImportSpecifier : parseExportSpecifier, 15 /* OpenBraceToken */, 16 /* CloseBraceToken */); return finishNode(node); } function parseExportSpecifier() { - return parseImportOrExportSpecifier(234 /* ExportSpecifier */); + return parseImportOrExportSpecifier(237 /* ExportSpecifier */); } function parseImportSpecifier() { - return parseImportOrExportSpecifier(230 /* ImportSpecifier */); + return parseImportOrExportSpecifier(233 /* ImportSpecifier */); } function parseImportOrExportSpecifier(kind) { var node = createNode(kind); @@ -11998,27 +12234,27 @@ var ts; else { node.name = identifierName; } - if (kind === 230 /* ImportSpecifier */ && checkIdentifierIsKeyword) { + if (kind === 233 /* 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(232 /* ExportDeclaration */, fullStart); + var node = createNode(235 /* ExportDeclaration */, fullStart); node.decorators = decorators; setModifiers(node, modifiers); if (parseOptional(37 /* AsteriskToken */)) { - parseExpected(134 /* FromKeyword */); + parseExpected(135 /* FromKeyword */); node.moduleSpecifier = parseModuleSpecifier(); } else { - node.exportClause = parseNamedImportsOrExports(233 /* NamedExports */); + node.exportClause = parseNamedImportsOrExports(236 /* 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 === 134 /* FromKeyword */ || (token === 9 /* StringLiteral */ && !scanner.hasPrecedingLineBreak())) { - parseExpected(134 /* FromKeyword */); + if (token === 135 /* FromKeyword */ || (token === 9 /* StringLiteral */ && !scanner.hasPrecedingLineBreak())) { + parseExpected(135 /* FromKeyword */); node.moduleSpecifier = parseModuleSpecifier(); } } @@ -12026,7 +12262,7 @@ var ts; return finishNode(node); } function parseExportAssignment(fullStart, decorators, modifiers) { - var node = createNode(231 /* ExportAssignment */, fullStart); + var node = createNode(234 /* ExportAssignment */, fullStart); node.decorators = decorators; setModifiers(node, modifiers); if (parseOptional(56 /* EqualsToken */)) { @@ -12042,6 +12278,7 @@ var ts; function processReferenceComments(sourceFile) { var triviaScanner = ts.createScanner(sourceFile.languageVersion, /*skipTrivia*/ false, 0 /* Standard */, sourceText); var referencedFiles = []; + var typeReferenceDirectives = []; var amdDependencies = []; var amdModuleName; // Keep scanning all the leading trivia in the file until we get to something that @@ -12065,7 +12302,12 @@ var ts; sourceFile.hasNoDefaultLib = referencePathMatchResult.isNoDefaultLib; var diagnosticMessage = referencePathMatchResult.diagnosticMessage; if (fileReference) { - referencedFiles.push(fileReference); + if (referencePathMatchResult.isTypeReferenceDirective) { + typeReferenceDirectives.push(fileReference); + } + else { + referencedFiles.push(fileReference); + } } if (diagnosticMessage) { parseDiagnostics.push(ts.createFileDiagnostic(sourceFile, range.pos, range.end - range.pos, diagnosticMessage)); @@ -12095,16 +12337,17 @@ var ts; } } sourceFile.referencedFiles = referencedFiles; + sourceFile.typeReferenceDirectives = typeReferenceDirectives; sourceFile.amdDependencies = amdDependencies; sourceFile.moduleName = amdModuleName; } function setExternalModuleIndicator(sourceFile) { sourceFile.externalModuleIndicator = ts.forEach(sourceFile.statements, function (node) { return node.flags & 1 /* Export */ - || node.kind === 225 /* ImportEqualsDeclaration */ && node.moduleReference.kind === 236 /* ExternalModuleReference */ - || node.kind === 226 /* ImportDeclaration */ - || node.kind === 231 /* ExportAssignment */ - || node.kind === 232 /* ExportDeclaration */ + || node.kind === 228 /* ImportEqualsDeclaration */ && node.moduleReference.kind === 239 /* ExternalModuleReference */ + || node.kind === 229 /* ImportDeclaration */ + || node.kind === 234 /* ExportAssignment */ + || node.kind === 235 /* ExportDeclaration */ ? node : undefined; }); @@ -12177,7 +12420,7 @@ var ts; // Parses out a JSDoc type expression. /* @internal */ function parseJSDocTypeExpression() { - var result = createNode(253 /* JSDocTypeExpression */, scanner.getTokenPos()); + var result = createNode(256 /* JSDocTypeExpression */, scanner.getTokenPos()); parseExpected(15 /* OpenBraceToken */); result.type = parseJSDocTopLevelType(); parseExpected(16 /* CloseBraceToken */); @@ -12188,12 +12431,12 @@ var ts; function parseJSDocTopLevelType() { var type = parseJSDocType(); if (token === 47 /* BarToken */) { - var unionType = createNode(257 /* JSDocUnionType */, type.pos); + var unionType = createNode(260 /* JSDocUnionType */, type.pos); unionType.types = parseJSDocTypeList(type); type = finishNode(unionType); } if (token === 56 /* EqualsToken */) { - var optionalType = createNode(264 /* JSDocOptionalType */, type.pos); + var optionalType = createNode(267 /* JSDocOptionalType */, type.pos); nextToken(); optionalType.type = type; type = finishNode(optionalType); @@ -12204,20 +12447,20 @@ var ts; var type = parseBasicTypeExpression(); while (true) { if (token === 19 /* OpenBracketToken */) { - var arrayType = createNode(256 /* JSDocArrayType */, type.pos); + var arrayType = createNode(259 /* JSDocArrayType */, type.pos); arrayType.elementType = type; nextToken(); parseExpected(20 /* CloseBracketToken */); type = finishNode(arrayType); } else if (token === 53 /* QuestionToken */) { - var nullableType = createNode(259 /* JSDocNullableType */, type.pos); + var nullableType = createNode(262 /* JSDocNullableType */, type.pos); nullableType.type = type; nextToken(); type = finishNode(nullableType); } else if (token === 49 /* ExclamationToken */) { - var nonNullableType = createNode(260 /* JSDocNonNullableType */, type.pos); + var nonNullableType = createNode(263 /* JSDocNonNullableType */, type.pos); nonNullableType.type = type; nextToken(); type = finishNode(nonNullableType); @@ -12262,27 +12505,27 @@ var ts; return parseJSDocTypeReference(); } function parseJSDocThisType() { - var result = createNode(268 /* JSDocThisType */); + var result = createNode(271 /* JSDocThisType */); nextToken(); parseExpected(54 /* ColonToken */); result.type = parseJSDocType(); return finishNode(result); } function parseJSDocConstructorType() { - var result = createNode(267 /* JSDocConstructorType */); + var result = createNode(270 /* JSDocConstructorType */); nextToken(); parseExpected(54 /* ColonToken */); result.type = parseJSDocType(); return finishNode(result); } function parseJSDocVariadicType() { - var result = createNode(266 /* JSDocVariadicType */); + var result = createNode(269 /* JSDocVariadicType */); nextToken(); result.type = parseJSDocType(); return finishNode(result); } function parseJSDocFunctionType() { - var result = createNode(265 /* JSDocFunctionType */); + var result = createNode(268 /* JSDocFunctionType */); nextToken(); parseExpected(17 /* OpenParenToken */); result.parameters = parseDelimitedList(22 /* JSDocFunctionParameters */, parseJSDocParameter); @@ -12295,7 +12538,7 @@ var ts; return finishNode(result); } function parseJSDocParameter() { - var parameter = createNode(140 /* Parameter */); + var parameter = createNode(141 /* Parameter */); parameter.type = parseJSDocType(); if (parseOptional(56 /* EqualsToken */)) { parameter.questionToken = createNode(56 /* EqualsToken */); @@ -12303,7 +12546,7 @@ var ts; return finishNode(parameter); } function parseJSDocTypeReference() { - var result = createNode(263 /* JSDocTypeReference */); + var result = createNode(266 /* JSDocTypeReference */); result.name = parseSimplePropertyName(); if (token === 25 /* LessThanToken */) { result.typeArguments = parseTypeArguments(); @@ -12338,13 +12581,13 @@ var ts; } } function parseQualifiedName(left) { - var result = createNode(137 /* QualifiedName */, left.pos); + var result = createNode(138 /* QualifiedName */, left.pos); result.left = left; result.right = parseIdentifierName(); return finishNode(result); } function parseJSDocRecordType() { - var result = createNode(261 /* JSDocRecordType */); + var result = createNode(264 /* JSDocRecordType */); nextToken(); result.members = parseDelimitedList(24 /* JSDocRecordMembers */, parseJSDocRecordMember); checkForTrailingComma(result.members); @@ -12352,7 +12595,7 @@ var ts; return finishNode(result); } function parseJSDocRecordMember() { - var result = createNode(262 /* JSDocRecordMember */); + var result = createNode(265 /* JSDocRecordMember */); result.name = parseSimplePropertyName(); if (token === 54 /* ColonToken */) { nextToken(); @@ -12361,13 +12604,13 @@ var ts; return finishNode(result); } function parseJSDocNonNullableType() { - var result = createNode(260 /* JSDocNonNullableType */); + var result = createNode(263 /* JSDocNonNullableType */); nextToken(); result.type = parseJSDocType(); return finishNode(result); } function parseJSDocTupleType() { - var result = createNode(258 /* JSDocTupleType */); + var result = createNode(261 /* JSDocTupleType */); nextToken(); result.types = parseDelimitedList(25 /* JSDocTupleTypes */, parseJSDocType); checkForTrailingComma(result.types); @@ -12381,7 +12624,7 @@ var ts; } } function parseJSDocUnionType() { - var result = createNode(257 /* JSDocUnionType */); + var result = createNode(260 /* JSDocUnionType */); nextToken(); result.types = parseJSDocTypeList(parseJSDocType()); parseExpected(18 /* CloseParenToken */); @@ -12399,7 +12642,7 @@ var ts; return types; } function parseJSDocAllType() { - var result = createNode(254 /* JSDocAllType */); + var result = createNode(257 /* JSDocAllType */); nextToken(); return finishNode(result); } @@ -12422,11 +12665,11 @@ var ts; token === 27 /* GreaterThanToken */ || token === 56 /* EqualsToken */ || token === 47 /* BarToken */) { - var result = createNode(255 /* JSDocUnknownType */, pos); + var result = createNode(258 /* JSDocUnknownType */, pos); return finishNode(result); } else { - var result = createNode(259 /* JSDocNullableType */, pos); + var result = createNode(262 /* JSDocNullableType */, pos); result.type = parseJSDocType(); return finishNode(result); } @@ -12517,7 +12760,7 @@ var ts; if (!tags) { return undefined; } - var result = createNode(269 /* JSDocComment */, start); + var result = createNode(272 /* JSDocComment */, start); result.tags = tags; return finishNode(result, end); } @@ -12555,7 +12798,7 @@ var ts; return undefined; } function handleUnknownTag(atToken, tagName) { - var result = createNode(270 /* JSDocTag */, atToken.pos); + var result = createNode(273 /* JSDocTag */, atToken.pos); result.atToken = atToken; result.tagName = tagName; return finishNode(result); @@ -12609,7 +12852,7 @@ var ts; if (!typeExpression) { typeExpression = tryParseTypeExpression(); } - var result = createNode(271 /* JSDocParameterTag */, atToken.pos); + var result = createNode(274 /* JSDocParameterTag */, atToken.pos); result.atToken = atToken; result.tagName = tagName; result.preParameterName = preName; @@ -12619,27 +12862,27 @@ var ts; return finishNode(result); } function handleReturnTag(atToken, tagName) { - if (ts.forEach(tags, function (t) { return t.kind === 272 /* JSDocReturnTag */; })) { + if (ts.forEach(tags, function (t) { return t.kind === 275 /* JSDocReturnTag */; })) { parseErrorAtPosition(tagName.pos, scanner.getTokenPos() - tagName.pos, ts.Diagnostics._0_tag_already_specified, tagName.text); } - var result = createNode(272 /* JSDocReturnTag */, atToken.pos); + var result = createNode(275 /* 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 === 273 /* JSDocTypeTag */; })) { + if (ts.forEach(tags, function (t) { return t.kind === 276 /* JSDocTypeTag */; })) { parseErrorAtPosition(tagName.pos, scanner.getTokenPos() - tagName.pos, ts.Diagnostics._0_tag_already_specified, tagName.text); } - var result = createNode(273 /* JSDocTypeTag */, atToken.pos); + var result = createNode(276 /* JSDocTypeTag */, atToken.pos); result.atToken = atToken; result.tagName = tagName; result.typeExpression = tryParseTypeExpression(); return finishNode(result); } function handleTemplateTag(atToken, tagName) { - if (ts.forEach(tags, function (t) { return t.kind === 274 /* JSDocTemplateTag */; })) { + if (ts.forEach(tags, function (t) { return t.kind === 277 /* 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' @@ -12651,7 +12894,7 @@ var ts; parseErrorAtPosition(scanner.getStartPos(), 0, ts.Diagnostics.Identifier_expected); return undefined; } - var typeParameter = createNode(139 /* TypeParameter */, name_8.pos); + var typeParameter = createNode(140 /* TypeParameter */, name_8.pos); typeParameter.name = name_8; finishNode(typeParameter); typeParameters.push(typeParameter); @@ -12662,7 +12905,7 @@ var ts; break; } } - var result = createNode(274 /* JSDocTemplateTag */, atToken.pos); + var result = createNode(277 /* JSDocTemplateTag */, atToken.pos); result.atToken = atToken; result.tagName = tagName; result.typeParameters = typeParameters; @@ -13191,16 +13434,16 @@ var ts; function getModuleInstanceState(node) { // A module is uninstantiated if it contains only // 1. interface declarations, type alias declarations - if (node.kind === 219 /* InterfaceDeclaration */ || node.kind === 220 /* TypeAliasDeclaration */) { + if (node.kind === 221 /* InterfaceDeclaration */ || node.kind === 222 /* TypeAliasDeclaration */) { return 0 /* NonInstantiated */; } else if (ts.isConstEnumDeclaration(node)) { return 2 /* ConstEnumOnly */; } - else if ((node.kind === 226 /* ImportDeclaration */ || node.kind === 225 /* ImportEqualsDeclaration */) && !(node.flags & 1 /* Export */)) { + else if ((node.kind === 229 /* ImportDeclaration */ || node.kind === 228 /* ImportEqualsDeclaration */) && !(node.flags & 1 /* Export */)) { return 0 /* NonInstantiated */; } - else if (node.kind === 223 /* ModuleBlock */) { + else if (node.kind === 225 /* ModuleBlock */) { var state_1 = 0 /* NonInstantiated */; ts.forEachChild(node, function (n) { switch (getModuleInstanceState(n)) { @@ -13219,7 +13462,7 @@ var ts; }); return state_1; } - else if (node.kind === 222 /* ModuleDeclaration */) { + else if (node.kind === 224 /* ModuleDeclaration */) { return getModuleInstanceState(node.body); } else { @@ -13274,6 +13517,7 @@ var ts; var hasAsyncFunctions; var hasDecorators; var hasParameterDecorators; + var hasJsxSpreadAttribute; // 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). @@ -13307,6 +13551,7 @@ var ts; hasAsyncFunctions = false; hasDecorators = false; hasParameterDecorators = false; + hasJsxSpreadAttribute = false; } return bindSourceFile; function createSymbol(flags, name) { @@ -13329,7 +13574,7 @@ var ts; if (symbolFlags & 107455 /* Value */) { var valueDeclaration = symbol.valueDeclaration; if (!valueDeclaration || - (valueDeclaration.kind !== node.kind && valueDeclaration.kind === 222 /* ModuleDeclaration */)) { + (valueDeclaration.kind !== node.kind && valueDeclaration.kind === 224 /* ModuleDeclaration */)) { // other kinds of value declarations take precedence over modules symbol.valueDeclaration = node; } @@ -13342,7 +13587,7 @@ var ts; if (ts.isAmbientModule(node)) { return ts.isGlobalScopeAugmentation(node) ? "__global" : "\"" + node.name.text + "\""; } - if (node.name.kind === 138 /* ComputedPropertyName */) { + if (node.name.kind === 139 /* 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)) { @@ -13354,21 +13599,21 @@ var ts; return node.name.text; } switch (node.kind) { - case 146 /* Constructor */: + case 147 /* Constructor */: return "__constructor"; - case 154 /* FunctionType */: - case 149 /* CallSignature */: + case 155 /* FunctionType */: + case 150 /* CallSignature */: return "__call"; - case 155 /* ConstructorType */: - case 150 /* ConstructSignature */: + case 156 /* ConstructorType */: + case 151 /* ConstructSignature */: return "__new"; - case 151 /* IndexSignature */: + case 152 /* IndexSignature */: return "__index"; - case 232 /* ExportDeclaration */: + case 235 /* ExportDeclaration */: return "__export"; - case 231 /* ExportAssignment */: + case 234 /* ExportAssignment */: return node.isExportEquals ? "export=" : "default"; - case 185 /* BinaryExpression */: + case 186 /* BinaryExpression */: switch (ts.getSpecialPropertyAssignmentKind(node)) { case 2 /* ModuleExports */: // module.exports = ... @@ -13383,15 +13628,15 @@ var ts; } ts.Debug.fail("Unknown binary declaration kind"); break; - case 217 /* FunctionDeclaration */: - case 218 /* ClassDeclaration */: + case 219 /* FunctionDeclaration */: + case 220 /* ClassDeclaration */: return node.flags & 512 /* Default */ ? "default" : undefined; - case 265 /* JSDocFunctionType */: + case 268 /* JSDocFunctionType */: return ts.isJSDocConstructSignature(node) ? "__new" : "__call"; - case 140 /* Parameter */: + case 141 /* 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 === 265 /* JSDocFunctionType */); + ts.Debug.assert(node.parent.kind === 268 /* JSDocFunctionType */); var functionType = node.parent; var index = ts.indexOf(functionType.parameters, node); return "p" + index; @@ -13470,7 +13715,7 @@ var ts; function declareModuleMember(node, symbolFlags, symbolExcludes) { var hasExportModifier = ts.getCombinedNodeFlags(node) & 1 /* Export */; if (symbolFlags & 8388608 /* Alias */) { - if (node.kind === 234 /* ExportSpecifier */ || (node.kind === 225 /* ImportEqualsDeclaration */ && hasExportModifier)) { + if (node.kind === 237 /* ExportSpecifier */ || (node.kind === 228 /* ImportEqualsDeclaration */ && hasExportModifier)) { return declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes); } else { @@ -13559,10 +13804,10 @@ var ts; flags &= ~98304 /* ReachabilityCheckFlags */; // reset all emit helper flags on node (for incremental scenarios) flags &= ~3932160 /* EmitHelperFlags */; - if (kind === 219 /* InterfaceDeclaration */) { + if (kind === 221 /* InterfaceDeclaration */) { seenThisKeyword = false; } - var saveState = kind === 252 /* SourceFile */ || kind === 223 /* ModuleBlock */ || ts.isFunctionLikeKind(kind); + var saveState = kind === 255 /* SourceFile */ || kind === 225 /* ModuleBlock */ || ts.isFunctionLikeKind(kind); if (saveState) { savedReachabilityState = currentReachabilityState; savedLabelStack = labelStack; @@ -13583,10 +13828,10 @@ var ts; flags |= 65536 /* HasExplicitReturn */; } } - if (kind === 219 /* InterfaceDeclaration */) { + if (kind === 221 /* InterfaceDeclaration */) { flags = seenThisKeyword ? flags | 16384 /* ContainsThis */ : flags & ~16384 /* ContainsThis */; } - if (kind === 252 /* SourceFile */) { + if (kind === 255 /* SourceFile */) { if (hasClassExtends) { flags |= 262144 /* HasClassExtends */; } @@ -13599,6 +13844,9 @@ var ts; if (hasAsyncFunctions) { flags |= 2097152 /* HasAsyncFunctions */; } + if (hasJsxSpreadAttribute) { + flags |= 1073741824 /* HasJsxSpreadAttribute */; + } } node.flags = flags; if (saveState) { @@ -13622,40 +13870,40 @@ var ts; return; } switch (node.kind) { - case 202 /* WhileStatement */: + case 204 /* WhileStatement */: bindWhileStatement(node); break; - case 201 /* DoStatement */: + case 203 /* DoStatement */: bindDoStatement(node); break; - case 203 /* ForStatement */: + case 205 /* ForStatement */: bindForStatement(node); break; - case 204 /* ForInStatement */: - case 205 /* ForOfStatement */: + case 206 /* ForInStatement */: + case 207 /* ForOfStatement */: bindForInOrForOfStatement(node); break; - case 200 /* IfStatement */: + case 202 /* IfStatement */: bindIfStatement(node); break; - case 208 /* ReturnStatement */: - case 212 /* ThrowStatement */: + case 210 /* ReturnStatement */: + case 214 /* ThrowStatement */: bindReturnOrThrow(node); break; - case 207 /* BreakStatement */: - case 206 /* ContinueStatement */: + case 209 /* BreakStatement */: + case 208 /* ContinueStatement */: bindBreakOrContinueStatement(node); break; - case 213 /* TryStatement */: + case 215 /* TryStatement */: bindTryStatement(node); break; - case 210 /* SwitchStatement */: + case 212 /* SwitchStatement */: bindSwitchStatement(node); break; - case 224 /* CaseBlock */: + case 226 /* CaseBlock */: bindCaseBlock(node); break; - case 211 /* LabeledStatement */: + case 213 /* LabeledStatement */: bindLabeledStatement(node); break; default: @@ -13730,7 +13978,7 @@ var ts; function bindReturnOrThrow(n) { // bind expression (don't affect reachability) bind(n.expression); - if (n.kind === 208 /* ReturnStatement */) { + if (n.kind === 210 /* ReturnStatement */) { hasExplicitReturn = true; } currentReachabilityState = 4 /* Unreachable */; @@ -13739,7 +13987,7 @@ var ts; // call bind on label (don't affect reachability) bind(n.label); // for continue case touch label so it will be marked a used - var isValidJump = jumpToLabel(n.label, n.kind === 207 /* BreakStatement */ ? currentReachabilityState : 4 /* Unreachable */); + var isValidJump = jumpToLabel(n.label, n.kind === 209 /* BreakStatement */ ? currentReachabilityState : 4 /* Unreachable */); if (isValidJump) { currentReachabilityState = 4 /* Unreachable */; } @@ -13757,7 +14005,7 @@ var ts; // post catch/finally state is reachable if // - post try state is reachable - control flow can fall out of try block // - post catch state is reachable - control flow can fall out of catch block - currentReachabilityState = or(postTryState, postCatchState); + currentReachabilityState = n.catchClause ? or(postTryState, postCatchState) : postTryState; } function bindSwitchStatement(n) { var preSwitchState = currentReachabilityState; @@ -13765,18 +14013,21 @@ var ts; // bind expression (don't affect reachability) bind(n.expression); bind(n.caseBlock); - var hasDefault = ts.forEach(n.caseBlock.clauses, function (c) { return c.kind === 246 /* DefaultClause */; }); + var hasDefault = ts.forEach(n.caseBlock.clauses, function (c) { return c.kind === 249 /* DefaultClause */; }); // post switch state is unreachable if switch is exhaustive (has a default case ) and does not have fallthrough from the last case var postSwitchState = hasDefault && currentReachabilityState !== 2 /* Reachable */ ? 4 /* Unreachable */ : preSwitchState; popImplicitLabel(postSwitchLabel, postSwitchState); } function bindCaseBlock(n) { var startState = currentReachabilityState; - for (var _i = 0, _a = n.clauses; _i < _a.length; _i++) { - var clause = _a[_i]; + for (var i = 0; i < n.clauses.length; i++) { + var clause = n.clauses[i]; currentReachabilityState = startState; bind(clause); - if (clause.statements.length && currentReachabilityState === 2 /* Reachable */ && options.noFallthroughCasesInSwitch) { + if (clause.statements.length && + i !== n.clauses.length - 1 && + currentReachabilityState === 2 /* Reachable */ && + options.noFallthroughCasesInSwitch) { errorOnFirstToken(clause, ts.Diagnostics.Fallthrough_case_in_switch); } } @@ -13792,38 +14043,39 @@ var ts; } function getContainerFlags(node) { switch (node.kind) { - case 190 /* ClassExpression */: - case 218 /* ClassDeclaration */: - case 219 /* InterfaceDeclaration */: - case 221 /* EnumDeclaration */: - case 169 /* ObjectLiteralExpression */: - case 157 /* TypeLiteral */: - case 261 /* JSDocRecordType */: + case 191 /* ClassExpression */: + case 220 /* ClassDeclaration */: + case 221 /* InterfaceDeclaration */: + case 223 /* EnumDeclaration */: + case 170 /* ObjectLiteralExpression */: + case 158 /* TypeLiteral */: + case 264 /* JSDocRecordType */: return 1 /* IsContainer */; - case 149 /* CallSignature */: - case 150 /* ConstructSignature */: - case 151 /* IndexSignature */: - case 145 /* MethodDeclaration */: - case 144 /* MethodSignature */: - case 217 /* FunctionDeclaration */: - case 146 /* Constructor */: - case 147 /* GetAccessor */: - case 148 /* SetAccessor */: - case 154 /* FunctionType */: - case 155 /* ConstructorType */: - case 177 /* FunctionExpression */: - case 178 /* ArrowFunction */: - case 222 /* ModuleDeclaration */: - case 252 /* SourceFile */: - case 220 /* TypeAliasDeclaration */: + case 150 /* CallSignature */: + case 151 /* ConstructSignature */: + case 152 /* IndexSignature */: + case 146 /* MethodDeclaration */: + case 145 /* MethodSignature */: + case 219 /* FunctionDeclaration */: + case 147 /* Constructor */: + case 148 /* GetAccessor */: + case 149 /* SetAccessor */: + case 155 /* FunctionType */: + case 268 /* JSDocFunctionType */: + case 156 /* ConstructorType */: + case 178 /* FunctionExpression */: + case 179 /* ArrowFunction */: + case 224 /* ModuleDeclaration */: + case 255 /* SourceFile */: + case 222 /* TypeAliasDeclaration */: return 5 /* IsContainerWithLocals */; - case 248 /* CatchClause */: - case 203 /* ForStatement */: - case 204 /* ForInStatement */: - case 205 /* ForOfStatement */: - case 224 /* CaseBlock */: + case 251 /* CatchClause */: + case 205 /* ForStatement */: + case 206 /* ForInStatement */: + case 207 /* ForOfStatement */: + case 226 /* CaseBlock */: return 2 /* IsBlockScopedContainer */; - case 196 /* Block */: + case 198 /* 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 @@ -13860,40 +14112,40 @@ 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 222 /* ModuleDeclaration */: + case 224 /* ModuleDeclaration */: return declareModuleMember(node, symbolFlags, symbolExcludes); - case 252 /* SourceFile */: + case 255 /* SourceFile */: return declareSourceFileMember(node, symbolFlags, symbolExcludes); - case 190 /* ClassExpression */: - case 218 /* ClassDeclaration */: + case 191 /* ClassExpression */: + case 220 /* ClassDeclaration */: return declareClassMember(node, symbolFlags, symbolExcludes); - case 221 /* EnumDeclaration */: + case 223 /* EnumDeclaration */: return declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes); - case 157 /* TypeLiteral */: - case 169 /* ObjectLiteralExpression */: - case 219 /* InterfaceDeclaration */: - case 261 /* JSDocRecordType */: + case 158 /* TypeLiteral */: + case 170 /* ObjectLiteralExpression */: + case 221 /* InterfaceDeclaration */: + case 264 /* JSDocRecordType */: // 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 154 /* FunctionType */: - case 155 /* ConstructorType */: - case 149 /* CallSignature */: - case 150 /* ConstructSignature */: - case 151 /* IndexSignature */: - case 145 /* MethodDeclaration */: - case 144 /* MethodSignature */: - case 146 /* Constructor */: - case 147 /* GetAccessor */: - case 148 /* SetAccessor */: - case 217 /* FunctionDeclaration */: - case 177 /* FunctionExpression */: - case 178 /* ArrowFunction */: - case 265 /* JSDocFunctionType */: - case 220 /* TypeAliasDeclaration */: + case 155 /* FunctionType */: + case 156 /* ConstructorType */: + case 150 /* CallSignature */: + case 151 /* ConstructSignature */: + case 152 /* IndexSignature */: + case 146 /* MethodDeclaration */: + case 145 /* MethodSignature */: + case 147 /* Constructor */: + case 148 /* GetAccessor */: + case 149 /* SetAccessor */: + case 219 /* FunctionDeclaration */: + case 178 /* FunctionExpression */: + case 179 /* ArrowFunction */: + case 268 /* JSDocFunctionType */: + case 222 /* TypeAliasDeclaration */: // 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 @@ -13914,11 +14166,11 @@ var ts; : declareSymbol(file.locals, undefined, node, symbolFlags, symbolExcludes); } function hasExportDeclarations(node) { - var body = node.kind === 252 /* SourceFile */ ? node : node.body; - if (body.kind === 252 /* SourceFile */ || body.kind === 223 /* ModuleBlock */) { + var body = node.kind === 255 /* SourceFile */ ? node : node.body; + if (body.kind === 255 /* SourceFile */ || body.kind === 225 /* ModuleBlock */) { for (var _i = 0, _a = body.statements; _i < _a.length; _i++) { var stat = _a[_i]; - if (stat.kind === 232 /* ExportDeclaration */ || stat.kind === 231 /* ExportAssignment */) { + if (stat.kind === 235 /* ExportDeclaration */ || stat.kind === 234 /* ExportAssignment */) { return true; } } @@ -13941,7 +14193,12 @@ var ts; if (node.flags & 1 /* Export */) { errorOnFirstToken(node, ts.Diagnostics.export_modifier_cannot_be_applied_to_ambient_modules_and_module_augmentations_since_they_are_always_visible); } - declareSymbolAndAddToSymbolTable(node, 512 /* ValueModule */, 106639 /* ValueModuleExcludes */); + if (ts.isExternalModuleAugmentation(node)) { + declareSymbolAndAddToSymbolTable(node, 1024 /* NamespaceModule */, 0 /* NamespaceModuleExcludes */); + } + else { + declareSymbolAndAddToSymbolTable(node, 512 /* ValueModule */, 106639 /* ValueModuleExcludes */); + } } else { var state = getModuleInstanceState(node); @@ -14005,7 +14262,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 === 249 /* PropertyAssignment */ || prop.kind === 250 /* ShorthandPropertyAssignment */ || prop.kind === 145 /* MethodDeclaration */ + var currentKind = prop.kind === 252 /* PropertyAssignment */ || prop.kind === 253 /* ShorthandPropertyAssignment */ || prop.kind === 146 /* MethodDeclaration */ ? 1 /* Property */ : 2 /* Accessor */; var existingKind = seen[identifier.text]; @@ -14027,10 +14284,10 @@ var ts; } function bindBlockScopedDeclaration(node, symbolFlags, symbolExcludes) { switch (blockScopeContainer.kind) { - case 222 /* ModuleDeclaration */: + case 224 /* ModuleDeclaration */: declareModuleMember(node, symbolFlags, symbolExcludes); break; - case 252 /* SourceFile */: + case 255 /* SourceFile */: if (ts.isExternalModule(container)) { declareModuleMember(node, symbolFlags, symbolExcludes); break; @@ -14190,17 +14447,17 @@ var ts; } function updateStrictMode(node) { switch (node.kind) { - case 252 /* SourceFile */: - case 223 /* ModuleBlock */: + case 255 /* SourceFile */: + case 225 /* ModuleBlock */: updateStrictModeStatementList(node.statements); return; - case 196 /* Block */: + case 198 /* Block */: if (ts.isFunctionLike(node.parent)) { updateStrictModeStatementList(node.statements); } return; - case 218 /* ClassDeclaration */: - case 190 /* ClassExpression */: + case 220 /* ClassDeclaration */: + case 191 /* ClassExpression */: // All classes are automatically in strict mode in ES6. inStrictMode = true; return; @@ -14223,14 +14480,14 @@ var ts; var nodeText = ts.getTextOfNodeFromSourceText(file.text, node.expression); // Note: the node text must be exactly "use strict" or 'use strict'. It is not ok for the // string to contain unicode escapes (as per ES5). - return nodeText === "\"use strict\"" || nodeText === "'use strict'"; + return nodeText === '"use strict"' || nodeText === "'use strict'"; } function bindWorker(node) { switch (node.kind) { /* Strict mode checks */ case 69 /* Identifier */: return checkStrictModeIdentifier(node); - case 185 /* BinaryExpression */: + case 186 /* BinaryExpression */: if (ts.isInJavaScriptFile(node)) { var specialKind = ts.getSpecialPropertyAssignmentKind(node); switch (specialKind) { @@ -14254,100 +14511,105 @@ var ts; } } return checkStrictModeBinaryExpression(node); - case 248 /* CatchClause */: + case 251 /* CatchClause */: return checkStrictModeCatchClause(node); - case 179 /* DeleteExpression */: + case 180 /* DeleteExpression */: return checkStrictModeDeleteExpression(node); case 8 /* NumericLiteral */: return checkStrictModeNumericLiteral(node); - case 184 /* PostfixUnaryExpression */: + case 185 /* PostfixUnaryExpression */: return checkStrictModePostfixUnaryExpression(node); - case 183 /* PrefixUnaryExpression */: + case 184 /* PrefixUnaryExpression */: return checkStrictModePrefixUnaryExpression(node); - case 209 /* WithStatement */: + case 211 /* WithStatement */: return checkStrictModeWithStatement(node); - case 163 /* ThisType */: + case 164 /* ThisType */: seenThisKeyword = true; return; - case 152 /* TypePredicate */: + case 153 /* TypePredicate */: return checkTypePredicate(node); - case 139 /* TypeParameter */: + case 140 /* TypeParameter */: return declareSymbolAndAddToSymbolTable(node, 262144 /* TypeParameter */, 530912 /* TypeParameterExcludes */); - case 140 /* Parameter */: + case 141 /* Parameter */: return bindParameter(node); - case 215 /* VariableDeclaration */: - case 167 /* BindingElement */: + case 217 /* VariableDeclaration */: + case 168 /* BindingElement */: return bindVariableDeclarationOrBindingElement(node); - case 143 /* PropertyDeclaration */: - case 142 /* PropertySignature */: - case 262 /* JSDocRecordMember */: + case 144 /* PropertyDeclaration */: + case 143 /* PropertySignature */: + case 265 /* JSDocRecordMember */: return bindPropertyOrMethodOrAccessor(node, 4 /* Property */ | (node.questionToken ? 536870912 /* Optional */ : 0 /* None */), 107455 /* PropertyExcludes */); - case 249 /* PropertyAssignment */: - case 250 /* ShorthandPropertyAssignment */: + case 252 /* PropertyAssignment */: + case 253 /* ShorthandPropertyAssignment */: return bindPropertyOrMethodOrAccessor(node, 4 /* Property */, 107455 /* PropertyExcludes */); - case 251 /* EnumMember */: + case 254 /* EnumMember */: return bindPropertyOrMethodOrAccessor(node, 8 /* EnumMember */, 107455 /* EnumMemberExcludes */); - case 149 /* CallSignature */: - case 150 /* ConstructSignature */: - case 151 /* IndexSignature */: + case 246 /* JsxSpreadAttribute */: + hasJsxSpreadAttribute = true; + return; + case 150 /* CallSignature */: + case 151 /* ConstructSignature */: + case 152 /* IndexSignature */: return declareSymbolAndAddToSymbolTable(node, 131072 /* Signature */, 0 /* None */); - case 145 /* MethodDeclaration */: - case 144 /* MethodSignature */: + case 146 /* MethodDeclaration */: + case 145 /* 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) ? 107455 /* PropertyExcludes */ : 99263 /* MethodExcludes */); - case 217 /* FunctionDeclaration */: + case 219 /* FunctionDeclaration */: return bindFunctionDeclaration(node); - case 146 /* Constructor */: + case 147 /* Constructor */: return declareSymbolAndAddToSymbolTable(node, 16384 /* Constructor */, /*symbolExcludes:*/ 0 /* None */); - case 147 /* GetAccessor */: + case 148 /* GetAccessor */: return bindPropertyOrMethodOrAccessor(node, 32768 /* GetAccessor */, 41919 /* GetAccessorExcludes */); - case 148 /* SetAccessor */: + case 149 /* SetAccessor */: return bindPropertyOrMethodOrAccessor(node, 65536 /* SetAccessor */, 74687 /* SetAccessorExcludes */); - case 154 /* FunctionType */: - case 155 /* ConstructorType */: - case 265 /* JSDocFunctionType */: + case 155 /* FunctionType */: + case 156 /* ConstructorType */: + case 268 /* JSDocFunctionType */: return bindFunctionOrConstructorType(node); - case 157 /* TypeLiteral */: - case 261 /* JSDocRecordType */: + case 158 /* TypeLiteral */: + case 264 /* JSDocRecordType */: return bindAnonymousDeclaration(node, 2048 /* TypeLiteral */, "__type"); - case 169 /* ObjectLiteralExpression */: + case 170 /* ObjectLiteralExpression */: return bindObjectLiteralExpression(node); - case 177 /* FunctionExpression */: - case 178 /* ArrowFunction */: + case 178 /* FunctionExpression */: + case 179 /* ArrowFunction */: return bindFunctionExpression(node); - case 172 /* CallExpression */: + case 173 /* CallExpression */: if (ts.isInJavaScriptFile(node)) { bindCallExpression(node); } break; // Members of classes, interfaces, and modules - case 190 /* ClassExpression */: - case 218 /* ClassDeclaration */: + case 191 /* ClassExpression */: + case 220 /* ClassDeclaration */: return bindClassLikeDeclaration(node); - case 219 /* InterfaceDeclaration */: + case 221 /* InterfaceDeclaration */: return bindBlockScopedDeclaration(node, 64 /* Interface */, 792960 /* InterfaceExcludes */); - case 220 /* TypeAliasDeclaration */: + case 222 /* TypeAliasDeclaration */: return bindBlockScopedDeclaration(node, 524288 /* TypeAlias */, 793056 /* TypeAliasExcludes */); - case 221 /* EnumDeclaration */: + case 223 /* EnumDeclaration */: return bindEnumDeclaration(node); - case 222 /* ModuleDeclaration */: + case 224 /* ModuleDeclaration */: return bindModuleDeclaration(node); // Imports and exports - case 225 /* ImportEqualsDeclaration */: - case 228 /* NamespaceImport */: - case 230 /* ImportSpecifier */: - case 234 /* ExportSpecifier */: + case 228 /* ImportEqualsDeclaration */: + case 231 /* NamespaceImport */: + case 233 /* ImportSpecifier */: + case 237 /* ExportSpecifier */: return declareSymbolAndAddToSymbolTable(node, 8388608 /* Alias */, 8388608 /* AliasExcludes */); - case 227 /* ImportClause */: + case 227 /* GlobalModuleExportDeclaration */: + return bindGlobalModuleExportDeclaration(node); + case 230 /* ImportClause */: return bindImportClause(node); - case 232 /* ExportDeclaration */: + case 235 /* ExportDeclaration */: return bindExportDeclaration(node); - case 231 /* ExportAssignment */: + case 234 /* ExportAssignment */: return bindExportAssignment(node); - case 252 /* SourceFile */: + case 255 /* SourceFile */: return bindSourceFileIfExternalModule(); } } @@ -14356,7 +14618,7 @@ var ts; if (parameterName && parameterName.kind === 69 /* Identifier */) { checkStrictModeIdentifier(parameterName); } - if (parameterName && parameterName.kind === 163 /* ThisType */) { + if (parameterName && parameterName.kind === 164 /* ThisType */) { seenThisKeyword = true; } bind(type); @@ -14371,12 +14633,12 @@ var ts; bindAnonymousDeclaration(file, 512 /* ValueModule */, "\"" + ts.removeFileExtension(file.fileName) + "\""); } function bindExportAssignment(node) { - var boundExpression = node.kind === 231 /* ExportAssignment */ ? node.expression : node.right; + var boundExpression = node.kind === 234 /* ExportAssignment */ ? node.expression : node.right; if (!container.symbol || !container.symbol.exports) { // Export assignment in some sort of block construct bindAnonymousDeclaration(node, 8388608 /* Alias */, getDeclarationName(node)); } - else if (boundExpression.kind === 69 /* Identifier */ && node.kind === 231 /* ExportAssignment */) { + else if (boundExpression.kind === 69 /* Identifier */ && node.kind === 234 /* ExportAssignment */) { // An export default clause with an identifier exports all meanings of that identifier declareSymbol(container.symbol.exports, container.symbol, node, 8388608 /* Alias */, 107455 /* PropertyExcludes */ | 8388608 /* AliasExcludes */); } @@ -14385,6 +14647,28 @@ var ts; declareSymbol(container.symbol.exports, container.symbol, node, 4 /* Property */, 107455 /* PropertyExcludes */ | 8388608 /* AliasExcludes */); } } + function bindGlobalModuleExportDeclaration(node) { + if (node.modifiers && node.modifiers.length) { + file.bindDiagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.Modifiers_cannot_appear_here)); + } + if (node.parent.kind !== 255 /* SourceFile */) { + file.bindDiagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.Global_module_exports_may_only_appear_at_top_level)); + return; + } + else { + 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_4.isDeclarationFile) { + file.bindDiagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.Global_module_exports_may_only_appear_in_declaration_files)); + return; + } + } + file.symbol.globalExports = file.symbol.globalExports || {}; + declareSymbol(file.symbol.globalExports, file.symbol, node, 8388608 /* Alias */, 8388608 /* AliasExcludes */); + } function bindExportDeclaration(node) { if (!container.symbol || !container.symbol.exports) { // Export * in some sort of block construct @@ -14415,11 +14699,11 @@ var ts; function bindModuleExportsAssignment(node) { // 'module.exports = expr' assignment setCommonJsModuleIndicator(node); - bindExportAssignment(node); + declareSymbol(file.symbol.exports, file.symbol, node, 4 /* Property */ | 7340032 /* Export */ | 512 /* ValueModule */, 0 /* None */); } function bindThisPropertyAssignment(node) { // Declare a 'member' in case it turns out the container was an ES5 class - if (container.kind === 177 /* FunctionExpression */ || container.kind === 217 /* FunctionDeclaration */) { + if (container.kind === 178 /* FunctionExpression */ || container.kind === 219 /* FunctionDeclaration */) { container.symbol.members = container.symbol.members || {}; // It's acceptable for multiple 'this' assignments of the same identifier to occur declareSymbol(container.symbol.members, container.symbol, node, 4 /* Property */, 107455 /* PropertyExcludes */ & ~4 /* Property */); @@ -14463,7 +14747,7 @@ var ts; hasDecorators = true; } } - if (node.kind === 218 /* ClassDeclaration */) { + if (node.kind === 220 /* ClassDeclaration */) { bindBlockScopedDeclaration(node, 32 /* Class */, 899519 /* ClassExcludes */); } else { @@ -14641,13 +14925,13 @@ var ts; case 4 /* Unreachable */: var reportError = // report error on all statements except empty ones - (ts.isStatement(node) && node.kind !== 198 /* EmptyStatement */) || + (ts.isStatement(node) && node.kind !== 200 /* EmptyStatement */) || // report error on class declarations - node.kind === 218 /* ClassDeclaration */ || + node.kind === 220 /* ClassDeclaration */ || // report error on instantiated modules or const-enums only modules if preserveConstEnums is set - (node.kind === 222 /* ModuleDeclaration */ && shouldReportErrorOnModuleDeclaration(node)) || + (node.kind === 224 /* ModuleDeclaration */ && shouldReportErrorOnModuleDeclaration(node)) || // report error on regular enums and const enums if preserveConstEnums is set - (node.kind === 221 /* EnumDeclaration */ && (!ts.isConstEnumDeclaration(node) || options.preserveConstEnums)); + (node.kind === 223 /* EnumDeclaration */ && (!ts.isConstEnumDeclaration(node) || options.preserveConstEnums)); if (reportError) { currentReachabilityState = 8 /* ReportedUnreachable */; // unreachable code is reported if @@ -14661,7 +14945,7 @@ 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 !== 197 /* VariableStatement */ || + (node.kind !== 199 /* VariableStatement */ || ts.getCombinedNodeFlags(node.declarationList) & 3072 /* BlockScoped */ || ts.forEach(node.declarationList.declarations, function (d) { return d.initializer; })); if (reportUnreachableCode) { @@ -14735,6 +15019,7 @@ var ts; var languageVersion = compilerOptions.target || 0 /* ES3 */; var modulekind = ts.getEmitModuleKind(compilerOptions); var allowSyntheticDefaultImports = typeof compilerOptions.allowSyntheticDefaultImports !== "undefined" ? compilerOptions.allowSyntheticDefaultImports : modulekind === ts.ModuleKind.System; + var strictNullChecks = compilerOptions.strictNullChecks; var emitResolver = createResolver(); var undefinedSymbol = createSymbol(4 /* Property */ | 67108864 /* Transient */, "undefined"); undefinedSymbol.declarations = []; @@ -14749,9 +15034,7 @@ var ts; isUnknownSymbol: function (symbol) { return symbol === unknownSymbol; }, getDiagnostics: getDiagnostics, getGlobalDiagnostics: getGlobalDiagnostics, - // The language service will always care about the narrowed type of a symbol, because that is - // the type the language says the symbol should have. - getTypeOfSymbolAtLocation: getNarrowedTypeOfSymbol, + getTypeOfSymbolAtLocation: getTypeOfSymbolAtLocation, getSymbolsOfParameterPropertyDeclaration: getSymbolsOfParameterPropertyDeclaration, getDeclaredTypeOfSymbol: getDeclaredTypeOfSymbol, getPropertiesOfType: getPropertiesOfType, @@ -14786,14 +15069,16 @@ var ts; }; var unknownSymbol = createSymbol(4 /* Property */ | 67108864 /* Transient */, "unknown"); var resolvingSymbol = createSymbol(67108864 /* Transient */, "__resolving__"); + var nullableWideningFlags = strictNullChecks ? 0 : 2097152 /* ContainsUndefinedOrNull */; var anyType = createIntrinsicType(1 /* Any */, "any"); var stringType = createIntrinsicType(2 /* String */, "string"); var numberType = createIntrinsicType(4 /* Number */, "number"); var booleanType = createIntrinsicType(8 /* Boolean */, "boolean"); var esSymbolType = createIntrinsicType(16777216 /* ESSymbol */, "symbol"); var voidType = createIntrinsicType(16 /* Void */, "void"); - var undefinedType = createIntrinsicType(32 /* Undefined */ | 2097152 /* ContainsUndefinedOrNull */, "undefined"); - var nullType = createIntrinsicType(64 /* Null */ | 2097152 /* ContainsUndefinedOrNull */, "null"); + var undefinedType = createIntrinsicType(32 /* Undefined */ | nullableWideningFlags, "undefined"); + var nullType = createIntrinsicType(64 /* Null */ | nullableWideningFlags, "null"); + var emptyArrayElementType = createIntrinsicType(32 /* Undefined */ | 2097152 /* ContainsUndefinedOrNull */, "undefined"); var unknownType = createIntrinsicType(1 /* Any */, "unknown"); var emptyObjectType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined); var emptyUnionType = emptyObjectType; @@ -14804,11 +15089,11 @@ var ts; // in getPropagatingFlagsOfTypes, and it is checked in inferFromTypes. anyFunctionType.flags |= 8388608 /* ContainsAnyFunctionType */; var noConstraintType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined); - var anySignature = createSignature(undefined, undefined, emptyArray, anyType, /*typePredicate*/ undefined, 0, /*hasRestParameter*/ false, /*hasStringLiterals*/ false); - var unknownSignature = createSignature(undefined, undefined, emptyArray, unknownType, /*typePredicate*/ undefined, 0, /*hasRestParameter*/ false, /*hasStringLiterals*/ false); + var anySignature = createSignature(undefined, undefined, undefined, emptyArray, anyType, /*typePredicate*/ undefined, 0, /*hasRestParameter*/ false, /*hasStringLiterals*/ false); + var unknownSignature = createSignature(undefined, undefined, undefined, emptyArray, unknownType, /*typePredicate*/ undefined, 0, /*hasRestParameter*/ false, /*hasStringLiterals*/ false); var enumNumberIndexInfo = createIndexInfo(stringType, /*isReadonly*/ true); var globals = {}; - var globalESSymbolConstructorSymbol; + var getGlobalESSymbolConstructorSymbol; var getGlobalPromiseConstructorSymbol; var globalObjectType; var globalFunctionType; @@ -14818,13 +15103,16 @@ var ts; var globalNumberType; var globalBooleanType; var globalRegExpType; - var globalTemplateStringsArrayType; - var globalESSymbolType; - var globalIterableType; - var globalIteratorType; - var globalIterableIteratorType; var anyArrayType; 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 + // and they will not get an error from not having unrelated library files + var getGlobalTemplateStringsArrayType; + var getGlobalESSymbolType; + var getGlobalIterableType; + var getGlobalIteratorType; + var getGlobalIterableIteratorType; var getGlobalClassDecoratorType; var getGlobalParameterDecoratorType; var getGlobalPropertyDecoratorType; @@ -14887,6 +15175,7 @@ var ts; }; var subtypeRelation = {}; var assignableRelation = {}; + var comparableRelation = {}; var identityRelation = {}; // This is for caching the result of getSymbolDisplayBuilder. Do not access directly. var _displayBuilder; @@ -14986,7 +15275,7 @@ var ts; target.flags |= source.flags; if (source.valueDeclaration && (!target.valueDeclaration || - (target.valueDeclaration.kind === 222 /* ModuleDeclaration */ && source.valueDeclaration.kind !== 222 /* ModuleDeclaration */))) { + (target.valueDeclaration.kind === 224 /* ModuleDeclaration */ && source.valueDeclaration.kind !== 224 /* ModuleDeclaration */))) { // other kinds of value declarations take precedence over modules target.valueDeclaration = source.valueDeclaration; } @@ -15043,7 +15332,7 @@ var ts; } function mergeModuleAugmentation(moduleName) { var moduleAugmentation = moduleName.parent; - if (moduleAugmentation.symbol.valueDeclaration !== moduleAugmentation) { + if (moduleAugmentation.symbol.declarations[0] !== moduleAugmentation) { // this is a combined symbol for multiple augmentations within the same file. // its symbol already has accumulated information for all declarations // so we need to add it just once - do the work only for first declaration @@ -15099,7 +15388,7 @@ var ts; return nodeLinks[nodeId] || (nodeLinks[nodeId] = {}); } function isGlobalSourceFile(node) { - return node.kind === 252 /* SourceFile */ && !ts.isExternalOrCommonJsModule(node); + return node.kind === 255 /* SourceFile */ && !ts.isExternalOrCommonJsModule(node); } function getSymbol(symbols, name, meaning) { if (meaning && ts.hasProperty(symbols, name)) { @@ -15148,7 +15437,7 @@ var ts; 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 !== 215 /* VariableDeclaration */ || + return declaration.kind !== 217 /* VariableDeclaration */ || !isImmediatelyUsedInInitializerOfBlockScopedVariable(declaration, usage); } // declaration is after usage @@ -15156,14 +15445,14 @@ var ts; return isUsedInFunctionOrNonStaticProperty(declaration, usage); function isImmediatelyUsedInInitializerOfBlockScopedVariable(declaration, usage) { var container = ts.getEnclosingBlockScopeContainer(declaration); - if (declaration.parent.parent.kind === 197 /* VariableStatement */ || - declaration.parent.parent.kind === 203 /* ForStatement */) { + if (declaration.parent.parent.kind === 199 /* VariableStatement */ || + declaration.parent.parent.kind === 205 /* ForStatement */) { // variable statement/for statement case, // use site should not be inside variable declaration (initializer of declaration or binding element) return isSameScopeDescendentOf(usage, declaration, container); } - else if (declaration.parent.parent.kind === 205 /* ForOfStatement */ || - declaration.parent.parent.kind === 204 /* ForInStatement */) { + else if (declaration.parent.parent.kind === 207 /* ForOfStatement */ || + declaration.parent.parent.kind === 206 /* ForInStatement */) { // ForIn/ForOf case - use site should not be used in expression part var expression = declaration.parent.parent.expression; return isSameScopeDescendentOf(usage, expression, container); @@ -15180,7 +15469,7 @@ var ts; return true; } var initializerOfNonStaticProperty = current.parent && - current.parent.kind === 143 /* PropertyDeclaration */ && + current.parent.kind === 144 /* PropertyDeclaration */ && (current.parent.flags & 32 /* Static */) === 0 && current.parent.initializer === current; if (initializerOfNonStaticProperty) { @@ -15212,11 +15501,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 & 793056 /* Type */ && lastLocation.kind !== 269 /* JSDocComment */) { + if (meaning & result.flags & 793056 /* Type */ && lastLocation.kind !== 272 /* JSDocComment */) { useResult = result.flags & 262144 /* TypeParameter */ ? lastLocation === location.type || - lastLocation.kind === 140 /* Parameter */ || - lastLocation.kind === 139 /* TypeParameter */ + lastLocation.kind === 141 /* Parameter */ || + lastLocation.kind === 140 /* TypeParameter */ : false; } if (meaning & 107455 /* Value */ && result.flags & 1 /* FunctionScopedVariable */) { @@ -15225,9 +15514,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 === 140 /* Parameter */ || + lastLocation.kind === 141 /* Parameter */ || (lastLocation === location.type && - result.valueDeclaration.kind === 140 /* Parameter */); + result.valueDeclaration.kind === 141 /* Parameter */); } } if (useResult) { @@ -15239,12 +15528,12 @@ var ts; } } switch (location.kind) { - case 252 /* SourceFile */: + case 255 /* SourceFile */: if (!ts.isExternalOrCommonJsModule(location)) break; - case 222 /* ModuleDeclaration */: + case 224 /* ModuleDeclaration */: var moduleExports = getSymbolOfNode(location).exports; - if (location.kind === 252 /* SourceFile */ || ts.isAmbientModule(location)) { + if (location.kind === 255 /* 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"]) { @@ -15267,7 +15556,7 @@ var ts; // which is not the desired behavior. if (ts.hasProperty(moduleExports, name) && moduleExports[name].flags === 8388608 /* Alias */ && - ts.getDeclarationOfKind(moduleExports[name], 234 /* ExportSpecifier */)) { + ts.getDeclarationOfKind(moduleExports[name], 237 /* ExportSpecifier */)) { break; } } @@ -15275,13 +15564,13 @@ var ts; break loop; } break; - case 221 /* EnumDeclaration */: + case 223 /* EnumDeclaration */: if (result = getSymbol(getSymbolOfNode(location).exports, name, meaning & 8 /* EnumMember */)) { break loop; } break; - case 143 /* PropertyDeclaration */: - case 142 /* PropertySignature */: + case 144 /* PropertyDeclaration */: + case 143 /* 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 @@ -15298,9 +15587,9 @@ var ts; } } break; - case 218 /* ClassDeclaration */: - case 190 /* ClassExpression */: - case 219 /* InterfaceDeclaration */: + case 220 /* ClassDeclaration */: + case 191 /* ClassExpression */: + case 221 /* InterfaceDeclaration */: if (result = getSymbol(getSymbolOfNode(location).members, name, meaning & 793056 /* Type */)) { if (lastLocation && lastLocation.flags & 32 /* Static */) { // TypeScript 1.0 spec (April 2014): 3.4.1 @@ -15311,7 +15600,7 @@ var ts; } break loop; } - if (location.kind === 190 /* ClassExpression */ && meaning & 32 /* Class */) { + if (location.kind === 191 /* ClassExpression */ && meaning & 32 /* Class */) { var className = location.name; if (className && name === className.text) { result = location.symbol; @@ -15327,9 +15616,9 @@ var ts; // [foo()]() { } // <-- Reference to T from class's own computed property // } // - case 138 /* ComputedPropertyName */: + case 139 /* ComputedPropertyName */: grandparent = location.parent.parent; - if (ts.isClassLike(grandparent) || grandparent.kind === 219 /* InterfaceDeclaration */) { + if (ts.isClassLike(grandparent) || grandparent.kind === 221 /* InterfaceDeclaration */) { // A reference to this grandparent's type parameters would be an error if (result = getSymbol(getSymbolOfNode(grandparent).members, name, meaning & 793056 /* Type */)) { error(errorLocation, ts.Diagnostics.A_computed_property_name_cannot_reference_a_type_parameter_from_its_containing_type); @@ -15337,19 +15626,19 @@ var ts; } } break; - case 145 /* MethodDeclaration */: - case 144 /* MethodSignature */: - case 146 /* Constructor */: - case 147 /* GetAccessor */: - case 148 /* SetAccessor */: - case 217 /* FunctionDeclaration */: - case 178 /* ArrowFunction */: + case 146 /* MethodDeclaration */: + case 145 /* MethodSignature */: + case 147 /* Constructor */: + case 148 /* GetAccessor */: + case 149 /* SetAccessor */: + case 219 /* FunctionDeclaration */: + case 179 /* ArrowFunction */: if (meaning & 3 /* Variable */ && name === "arguments") { result = argumentsSymbol; break loop; } break; - case 177 /* FunctionExpression */: + case 178 /* FunctionExpression */: if (meaning & 3 /* Variable */ && name === "arguments") { result = argumentsSymbol; break loop; @@ -15362,7 +15651,7 @@ var ts; } } break; - case 141 /* Decorator */: + case 142 /* Decorator */: // Decorators are resolved at the class declaration. Resolving at the parameter // or member would result in looking up locals in the method. // @@ -15371,7 +15660,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 === 140 /* Parameter */) { + if (location.parent && location.parent.kind === 141 /* Parameter */) { location = location.parent; } // @@ -15465,7 +15754,7 @@ var ts; // 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 (!isBlockScopedNameDeclaredBeforeUse(ts.getAncestor(declaration, 215 /* VariableDeclaration */), errorLocation)) { + if (!isBlockScopedNameDeclaredBeforeUse(ts.getAncestor(declaration, 217 /* VariableDeclaration */), errorLocation)) { error(errorLocation, ts.Diagnostics.Block_scoped_variable_0_used_before_its_declaration, ts.declarationNameToString(declaration.name)); } } @@ -15486,10 +15775,10 @@ var ts; } function getAnyImportSyntax(node) { if (ts.isAliasSymbolDeclaration(node)) { - if (node.kind === 225 /* ImportEqualsDeclaration */) { + if (node.kind === 228 /* ImportEqualsDeclaration */) { return node; } - while (node && node.kind !== 226 /* ImportDeclaration */) { + while (node && node.kind !== 229 /* ImportDeclaration */) { node = node.parent; } return node; @@ -15499,7 +15788,7 @@ var ts; return ts.forEach(symbol.declarations, function (d) { return ts.isAliasSymbolDeclaration(d) ? d : undefined; }); } function getTargetOfImportEqualsDeclaration(node) { - if (node.moduleReference.kind === 236 /* ExternalModuleReference */) { + if (node.moduleReference.kind === 239 /* ExternalModuleReference */) { return resolveExternalModuleSymbol(resolveExternalModuleName(node, ts.getExternalModuleImportEqualsDeclarationExpression(node))); } return getSymbolOfPartOfRightHandSideOfImportEquals(node.moduleReference, node); @@ -15507,7 +15796,9 @@ var ts; function getTargetOfImportClause(node) { var moduleSymbol = resolveExternalModuleName(node, node.parent.moduleSpecifier); if (moduleSymbol) { - var exportDefaultSymbol = resolveSymbol(moduleSymbol.exports["default"]); + var exportDefaultSymbol = moduleSymbol.exports["export="] ? + getPropertyOfType(getTypeOfSymbol(moduleSymbol.exports["export="]), "default") : + resolveSymbol(moduleSymbol.exports["default"]); if (!exportDefaultSymbol && !allowSyntheticDefaultImports) { error(node.name, ts.Diagnostics.Module_0_has_no_default_export, symbolToString(moduleSymbol)); } @@ -15576,8 +15867,15 @@ var ts; if (targetSymbol) { var name_9 = specifier.propertyName || specifier.name; if (name_9.text) { + 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_9.text); + } + else { + symbolFromVariable = getPropertyOfVariable(targetSymbol, name_9.text); + } var symbolFromModule = getExportOfModule(targetSymbol, name_9.text); - var symbolFromVariable = getPropertyOfVariable(targetSymbol, name_9.text); var symbol = symbolFromModule && symbolFromVariable ? combineValueAndTypeSymbols(symbolFromVariable, symbolFromModule) : symbolFromModule || symbolFromVariable; @@ -15591,6 +15889,9 @@ var ts; function getTargetOfImportSpecifier(node) { return getExternalModuleMember(node.parent.parent.parent, node); } + function getTargetOfGlobalModuleExportDeclaration(node) { + return resolveExternalModuleSymbol(node.parent.symbol); + } function getTargetOfExportSpecifier(node) { return node.parent.parent.moduleSpecifier ? getExternalModuleMember(node.parent.parent, node) : @@ -15601,18 +15902,20 @@ var ts; } function getTargetOfAliasDeclaration(node) { switch (node.kind) { - case 225 /* ImportEqualsDeclaration */: + case 228 /* ImportEqualsDeclaration */: return getTargetOfImportEqualsDeclaration(node); - case 227 /* ImportClause */: + case 230 /* ImportClause */: return getTargetOfImportClause(node); - case 228 /* NamespaceImport */: + case 231 /* NamespaceImport */: return getTargetOfNamespaceImport(node); - case 230 /* ImportSpecifier */: + case 233 /* ImportSpecifier */: return getTargetOfImportSpecifier(node); - case 234 /* ExportSpecifier */: + case 237 /* ExportSpecifier */: return getTargetOfExportSpecifier(node); - case 231 /* ExportAssignment */: + case 234 /* ExportAssignment */: return getTargetOfExportAssignment(node); + case 227 /* GlobalModuleExportDeclaration */: + return getTargetOfGlobalModuleExportDeclaration(node); } } function resolveSymbol(symbol) { @@ -15656,11 +15959,11 @@ var ts; if (!links.referenced) { links.referenced = true; var node = getDeclarationOfAliasSymbol(symbol); - if (node.kind === 231 /* ExportAssignment */) { + if (node.kind === 234 /* ExportAssignment */) { // export default checkExpressionCached(node.expression); } - else if (node.kind === 234 /* ExportSpecifier */) { + else if (node.kind === 237 /* ExportSpecifier */) { // export { } or export { as foo } checkExpressionCached(node.propertyName || node.name); } @@ -15673,7 +15976,7 @@ var ts; // This function is only for imports with entity names function getSymbolOfPartOfRightHandSideOfImportEquals(entityName, importDeclaration) { if (!importDeclaration) { - importDeclaration = ts.getAncestor(entityName, 225 /* ImportEqualsDeclaration */); + importDeclaration = ts.getAncestor(entityName, 228 /* ImportEqualsDeclaration */); ts.Debug.assert(importDeclaration !== undefined); } // There are three things we might try to look for. In the following examples, @@ -15686,13 +15989,13 @@ var ts; entityName = entityName.parent; } // Check for case 1 and 3 in the above example - if (entityName.kind === 69 /* Identifier */ || entityName.parent.kind === 137 /* QualifiedName */) { + if (entityName.kind === 69 /* Identifier */ || entityName.parent.kind === 138 /* QualifiedName */) { return resolveEntityName(entityName, 1536 /* Namespace */); } else { // Case 2 in above example // entityName.kind could be a QualifiedName or a Missing identifier - ts.Debug.assert(entityName.parent.kind === 225 /* ImportEqualsDeclaration */); + ts.Debug.assert(entityName.parent.kind === 228 /* ImportEqualsDeclaration */); return resolveEntityName(entityName, 107455 /* Value */ | 793056 /* Type */ | 1536 /* Namespace */); } } @@ -15712,9 +16015,9 @@ var ts; return undefined; } } - else if (name.kind === 137 /* QualifiedName */ || name.kind === 170 /* PropertyAccessExpression */) { - var left = name.kind === 137 /* QualifiedName */ ? name.left : name.expression; - var right = name.kind === 137 /* QualifiedName */ ? name.right : name.name; + else if (name.kind === 138 /* QualifiedName */ || name.kind === 171 /* PropertyAccessExpression */) { + var left = name.kind === 138 /* QualifiedName */ ? name.left : name.expression; + var right = name.kind === 138 /* QualifiedName */ ? name.right : name.name; var namespace = resolveEntityName(left, 1536 /* Namespace */, ignoreErrors); if (!namespace || namespace === unknownSymbol || ts.nodeIsMissing(right)) { return undefined; @@ -15749,7 +16052,7 @@ var ts; } var isRelative = ts.isExternalModuleNameRelative(moduleName); if (!isRelative) { - var symbol = getSymbol(globals, "\"" + moduleName + "\"", 512 /* ValueModule */); + var symbol = getSymbol(globals, '"' + moduleName + '"', 512 /* ValueModule */); if (symbol) { // merged symbol is module declaration symbol combined with all augmentations return getMergedSymbol(symbol); @@ -15900,7 +16203,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 === 146 /* Constructor */ && ts.nodeIsPresent(member.body)) { + if (member.kind === 147 /* Constructor */ && ts.nodeIsPresent(member.body)) { return member; } } @@ -15971,21 +16274,15 @@ var ts; } } switch (location_1.kind) { - case 252 /* SourceFile */: + case 255 /* SourceFile */: if (!ts.isExternalOrCommonJsModule(location_1)) { break; } - case 222 /* ModuleDeclaration */: + case 224 /* ModuleDeclaration */: if (result = callback(getSymbolOfNode(location_1).exports)) { return result; } break; - case 218 /* ClassDeclaration */: - case 219 /* InterfaceDeclaration */: - if (result = callback(getSymbolOfNode(location_1).members)) { - return result; - } - break; } } return callback(globals); @@ -16022,7 +16319,7 @@ var ts; return ts.forEachValue(symbols, function (symbolFromSymbolTable) { if (symbolFromSymbolTable.flags & 8388608 /* Alias */ && symbolFromSymbolTable.name !== "export=" - && !ts.getDeclarationOfKind(symbolFromSymbolTable, 234 /* ExportSpecifier */)) { + && !ts.getDeclarationOfKind(symbolFromSymbolTable, 237 /* ExportSpecifier */)) { if (!useOnlyExternalAliasing || // Is this external alias, then use it to name ts.forEach(symbolFromSymbolTable.declarations, ts.isExternalModuleImportEqualsDeclaration)) { @@ -16041,7 +16338,9 @@ var ts; }); } if (symbol) { - return forEachSymbolTableInScope(enclosingDeclaration, getAccessibleSymbolChainFromSymbolTable); + if (!(isPropertyOrMethodDeclarationSymbol(symbol))) { + return forEachSymbolTableInScope(enclosingDeclaration, getAccessibleSymbolChainFromSymbolTable); + } } } function needsQualification(symbol, enclosingDeclaration, meaning) { @@ -16059,7 +16358,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, 234 /* ExportSpecifier */)) ? resolveAlias(symbolFromSymbolTable) : symbolFromSymbolTable; + symbolFromSymbolTable = (symbolFromSymbolTable.flags & 8388608 /* Alias */ && !ts.getDeclarationOfKind(symbolFromSymbolTable, 237 /* ExportSpecifier */)) ? resolveAlias(symbolFromSymbolTable) : symbolFromSymbolTable; if (symbolFromSymbolTable.flags & meaning) { qualify = true; return true; @@ -16069,6 +16368,24 @@ var ts; }); return qualify; } + function isPropertyOrMethodDeclarationSymbol(symbol) { + if (symbol.declarations && symbol.declarations.length) { + for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { + var declaration = _a[_i]; + switch (declaration.kind) { + case 144 /* PropertyDeclaration */: + case 146 /* MethodDeclaration */: + case 148 /* GetAccessor */: + case 149 /* SetAccessor */: + continue; + default: + return false; + } + } + return true; + } + return false; + } function isSymbolAccessible(symbol, enclosingDeclaration, meaning) { if (symbol && enclosingDeclaration && !(symbol.flags & 262144 /* TypeParameter */)) { var initialSymbol = symbol; @@ -16132,7 +16449,7 @@ var ts; } } function hasExternalModuleSymbol(declaration) { - return ts.isAmbientModule(declaration) || (declaration.kind === 252 /* SourceFile */ && ts.isExternalOrCommonJsModule(declaration)); + return ts.isAmbientModule(declaration) || (declaration.kind === 255 /* SourceFile */ && ts.isExternalOrCommonJsModule(declaration)); } function hasVisibleDeclarations(symbol) { var aliasesToMakeVisible; @@ -16168,12 +16485,12 @@ var ts; function isEntityNameVisible(entityName, enclosingDeclaration) { // get symbol of the first identifier of the entityName var meaning; - if (entityName.parent.kind === 156 /* TypeQuery */) { + if (entityName.parent.kind === 157 /* TypeQuery */ || ts.isExpressionWithTypeArgumentsInClassExtendsClause(entityName.parent)) { // Typeof value meaning = 107455 /* Value */ | 1048576 /* ExportValue */; } - else if (entityName.kind === 137 /* QualifiedName */ || entityName.kind === 170 /* PropertyAccessExpression */ || - entityName.parent.kind === 225 /* ImportEqualsDeclaration */) { + else if (entityName.kind === 138 /* QualifiedName */ || entityName.kind === 171 /* PropertyAccessExpression */ || + entityName.parent.kind === 228 /* ImportEqualsDeclaration */) { // Left identifier from type reference or TypeAlias // Entity name of the import declaration meaning = 1536 /* Namespace */; @@ -16244,10 +16561,10 @@ var ts; function getTypeAliasForTypeLiteral(type) { if (type.symbol && type.symbol.flags & 2048 /* TypeLiteral */) { var node = type.symbol.declarations[0].parent; - while (node.kind === 162 /* ParenthesizedType */) { + while (node.kind === 163 /* ParenthesizedType */) { node = node.parent; } - if (node.kind === 220 /* TypeAliasDeclaration */) { + if (node.kind === 222 /* TypeAliasDeclaration */) { return getSymbolOfNode(node); } } @@ -16255,7 +16572,7 @@ var ts; } function isTopLevelInExternalModuleAugmentation(node) { return node && node.parent && - node.parent.kind === 223 /* ModuleBlock */ && + node.parent.kind === 225 /* ModuleBlock */ && ts.isExternalModuleAugmentation(node.parent.parent); } function getSymbolDisplayBuilder() { @@ -16266,10 +16583,10 @@ var ts; return ts.declarationNameToString(declaration.name); } switch (declaration.kind) { - case 190 /* ClassExpression */: + case 191 /* ClassExpression */: return "(Anonymous class)"; - case 177 /* FunctionExpression */: - case 178 /* ArrowFunction */: + case 178 /* FunctionExpression */: + case 179 /* ArrowFunction */: return "(Anonymous function)"; } } @@ -16445,14 +16762,14 @@ var ts; while (i < length_1) { // Find group of type arguments for type parameters with the same declaring container. var start = i; - var parent_4 = getParentSymbolOfTypeParameter(outerTypeParameters[i]); + var parent_5 = getParentSymbolOfTypeParameter(outerTypeParameters[i]); do { i++; - } while (i < length_1 && getParentSymbolOfTypeParameter(outerTypeParameters[i]) === parent_4); + } while (i < length_1 && getParentSymbolOfTypeParameter(outerTypeParameters[i]) === parent_5); // When type parameters are their own type arguments for the whole group (i.e. we have // the default outer type arguments), we don't show the group. if (!ts.rangeEquals(outerTypeParameters, typeArguments, start, i)) { - writeSymbolTypeReference(parent_4, typeArguments, start, i, flags); + writeSymbolTypeReference(parent_5, typeArguments, start, i, flags); writePunctuation(writer, 21 /* DotToken */); } } @@ -16518,7 +16835,7 @@ var ts; var isNonLocalFunctionSymbol = !!(symbol.flags & 16 /* Function */) && (symbol.parent || ts.forEach(symbol.declarations, function (declaration) { - return declaration.parent.kind === 252 /* SourceFile */ || declaration.parent.kind === 223 /* ModuleBlock */; + return declaration.parent.kind === 255 /* SourceFile */ || declaration.parent.kind === 225 /* ModuleBlock */; })); if (isStaticMethodSymbol || isNonLocalFunctionSymbol) { // typeof is allowed only for static/non local functions @@ -16659,7 +16976,12 @@ var ts; if (ts.isRestParameter(parameterNode)) { writePunctuation(writer, 22 /* DotDotDotToken */); } - appendSymbolNameOnly(p, writer); + if (ts.isBindingPattern(parameterNode.name)) { + buildBindingPatternDisplay(parameterNode.name, writer, enclosingDeclaration, flags, symbolStack); + } + else { + appendSymbolNameOnly(p, writer); + } if (isOptionalParameter(parameterNode)) { writePunctuation(writer, 53 /* QuestionToken */); } @@ -16667,19 +16989,59 @@ var ts; 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 === 166 /* ObjectBindingPattern */) { + writePunctuation(writer, 15 /* OpenBraceToken */); + buildDisplayForCommaSeparatedList(bindingPattern.elements, writer, function (e) { return buildBindingElementDisplay(e, writer, enclosingDeclaration, flags, symbolStack); }); + writePunctuation(writer, 16 /* CloseBraceToken */); + } + else if (bindingPattern.kind === 167 /* ArrayBindingPattern */) { + writePunctuation(writer, 19 /* 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, 20 /* CloseBracketToken */); + } + } + function buildBindingElementDisplay(bindingElement, writer, enclosingDeclaration, flags, symbolStack) { + if (bindingElement.kind === 192 /* OmittedExpression */) { + return; + } + ts.Debug.assert(bindingElement.kind === 168 /* BindingElement */); + if (bindingElement.propertyName) { + writer.writeSymbol(ts.getTextOfNode(bindingElement.propertyName), bindingElement.symbol); + writePunctuation(writer, 54 /* ColonToken */); + writeSpace(writer); + } + if (ts.isBindingPattern(bindingElement.name)) { + buildBindingPatternDisplay(bindingElement.name, writer, enclosingDeclaration, flags, symbolStack); + } + else { + if (bindingElement.dotDotDotToken) { + writePunctuation(writer, 22 /* DotDotDotToken */); + } + appendSymbolNameOnly(bindingElement.symbol, writer); + } + } function buildDisplayForTypeParametersAndDelimiters(typeParameters, writer, enclosingDeclaration, flags, symbolStack) { if (typeParameters && typeParameters.length) { writePunctuation(writer, 25 /* LessThanToken */); - for (var i = 0; i < typeParameters.length; i++) { - if (i > 0) { - writePunctuation(writer, 24 /* CommaToken */); - writeSpace(writer); - } - buildTypeParameterDisplay(typeParameters[i], writer, enclosingDeclaration, flags, symbolStack); - } + buildDisplayForCommaSeparatedList(typeParameters, writer, function (p) { return buildTypeParameterDisplay(p, writer, enclosingDeclaration, flags, symbolStack); }); writePunctuation(writer, 27 /* GreaterThanToken */); } } + function buildDisplayForCommaSeparatedList(list, writer, action) { + for (var i = 0; i < list.length; i++) { + if (i > 0) { + writePunctuation(writer, 24 /* CommaToken */); + writeSpace(writer); + } + action(list[i]); + } + } function buildDisplayForTypeArgumentsAndDelimiters(typeParameters, mapper, writer, enclosingDeclaration, flags, symbolStack) { if (typeParameters && typeParameters.length) { writePunctuation(writer, 25 /* LessThanToken */); @@ -16693,10 +17055,16 @@ var ts; writePunctuation(writer, 27 /* GreaterThanToken */); } } - function buildDisplayForParametersAndDelimiters(parameters, writer, enclosingDeclaration, flags, symbolStack) { + function buildDisplayForParametersAndDelimiters(thisType, parameters, writer, enclosingDeclaration, flags, symbolStack) { writePunctuation(writer, 17 /* OpenParenToken */); + if (thisType) { + writeKeyword(writer, 97 /* ThisKeyword */); + writePunctuation(writer, 54 /* ColonToken */); + writeSpace(writer); + buildTypeDisplay(thisType, writer, enclosingDeclaration, flags, symbolStack); + } for (var i = 0; i < parameters.length; i++) { - if (i > 0) { + if (i > 0 || thisType) { writePunctuation(writer, 24 /* CommaToken */); writeSpace(writer); } @@ -16746,7 +17114,7 @@ var ts; else { buildDisplayForTypeParametersAndDelimiters(signature.typeParameters, writer, enclosingDeclaration, flags, symbolStack); } - buildDisplayForParametersAndDelimiters(signature.parameters, writer, enclosingDeclaration, flags, symbolStack); + buildDisplayForParametersAndDelimiters(signature.thisType, signature.parameters, writer, enclosingDeclaration, flags, symbolStack); buildReturnTypeDisplay(signature, writer, enclosingDeclaration, flags, symbolStack); } return _displayBuilder || (_displayBuilder = { @@ -16773,86 +17141,86 @@ var ts; return false; function determineIfDeclarationIsVisible() { switch (node.kind) { - case 167 /* BindingElement */: + case 168 /* BindingElement */: return isDeclarationVisible(node.parent.parent); - case 215 /* VariableDeclaration */: + case 217 /* 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 222 /* ModuleDeclaration */: - case 218 /* ClassDeclaration */: - case 219 /* InterfaceDeclaration */: - case 220 /* TypeAliasDeclaration */: - case 217 /* FunctionDeclaration */: - case 221 /* EnumDeclaration */: - case 225 /* ImportEqualsDeclaration */: + case 224 /* ModuleDeclaration */: + case 220 /* ClassDeclaration */: + case 221 /* InterfaceDeclaration */: + case 222 /* TypeAliasDeclaration */: + case 219 /* FunctionDeclaration */: + case 223 /* EnumDeclaration */: + case 228 /* ImportEqualsDeclaration */: // external module augmentation is always visible if (ts.isExternalModuleAugmentation(node)) { return true; } - var parent_5 = getDeclarationContainer(node); + var parent_6 = 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 !== 225 /* ImportEqualsDeclaration */ && parent_5.kind !== 252 /* SourceFile */ && ts.isInAmbientContext(parent_5))) { - return isGlobalSourceFile(parent_5); + !(node.kind !== 228 /* ImportEqualsDeclaration */ && parent_6.kind !== 255 /* SourceFile */ && ts.isInAmbientContext(parent_6))) { + return isGlobalSourceFile(parent_6); } // Exported members/ambient module elements (exception import declaration) are visible if parent is visible - return isDeclarationVisible(parent_5); - case 143 /* PropertyDeclaration */: - case 142 /* PropertySignature */: - case 147 /* GetAccessor */: - case 148 /* SetAccessor */: - case 145 /* MethodDeclaration */: - case 144 /* MethodSignature */: + return isDeclarationVisible(parent_6); + case 144 /* PropertyDeclaration */: + case 143 /* PropertySignature */: + case 148 /* GetAccessor */: + case 149 /* SetAccessor */: + case 146 /* MethodDeclaration */: + case 145 /* MethodSignature */: if (node.flags & (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 146 /* Constructor */: - case 150 /* ConstructSignature */: - case 149 /* CallSignature */: - case 151 /* IndexSignature */: - case 140 /* Parameter */: - case 223 /* ModuleBlock */: - case 154 /* FunctionType */: - case 155 /* ConstructorType */: - case 157 /* TypeLiteral */: - case 153 /* TypeReference */: - case 158 /* ArrayType */: - case 159 /* TupleType */: - case 160 /* UnionType */: - case 161 /* IntersectionType */: - case 162 /* ParenthesizedType */: + case 147 /* Constructor */: + case 151 /* ConstructSignature */: + case 150 /* CallSignature */: + case 152 /* IndexSignature */: + case 141 /* Parameter */: + case 225 /* ModuleBlock */: + case 155 /* FunctionType */: + case 156 /* ConstructorType */: + case 158 /* TypeLiteral */: + case 154 /* TypeReference */: + case 159 /* ArrayType */: + case 160 /* TupleType */: + case 161 /* UnionType */: + case 162 /* IntersectionType */: + case 163 /* 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 227 /* ImportClause */: - case 228 /* NamespaceImport */: - case 230 /* ImportSpecifier */: + case 230 /* ImportClause */: + case 231 /* NamespaceImport */: + case 233 /* ImportSpecifier */: return false; // Type parameters are always visible - case 139 /* TypeParameter */: + case 140 /* TypeParameter */: // Source file is always visible - case 252 /* SourceFile */: + case 255 /* SourceFile */: return true; // Export assignments do not create name bindings outside the module - case 231 /* ExportAssignment */: + case 234 /* ExportAssignment */: return false; default: - ts.Debug.fail("isDeclarationVisible unknown: SyntaxKind: " + node.kind); + return false; } } } function collectLinkedAliases(node) { var exportSymbol; - if (node.parent && node.parent.kind === 231 /* ExportAssignment */) { + if (node.parent && node.parent.kind === 234 /* ExportAssignment */) { exportSymbol = resolveName(node.parent, node.text, 107455 /* Value */ | 793056 /* Type */ | 1536 /* Namespace */ | 8388608 /* Alias */, ts.Diagnostics.Cannot_find_name_0, node); } - else if (node.parent.kind === 234 /* ExportSpecifier */) { + else if (node.parent.kind === 237 /* ExportSpecifier */) { var exportSpecifier = node.parent; exportSymbol = exportSpecifier.parent.parent.moduleSpecifier ? getExternalModuleMember(exportSpecifier.parent.parent, exportSpecifier) : @@ -16946,12 +17314,12 @@ var ts; node = ts.getRootDeclaration(node); while (node) { switch (node.kind) { - case 215 /* VariableDeclaration */: - case 216 /* VariableDeclarationList */: - case 230 /* ImportSpecifier */: - case 229 /* NamedImports */: - case 228 /* NamespaceImport */: - case 227 /* ImportClause */: + case 217 /* VariableDeclaration */: + case 218 /* VariableDeclarationList */: + case 233 /* ImportSpecifier */: + case 232 /* NamedImports */: + case 231 /* NamespaceImport */: + case 230 /* ImportClause */: node = node.parent; break; default: @@ -16988,7 +17356,7 @@ var ts; case 9 /* StringLiteral */: case 8 /* NumericLiteral */: return name.text; - case 138 /* ComputedPropertyName */: + case 139 /* ComputedPropertyName */: if (ts.isStringOrNumericLiteral(name.expression.kind)) { return name.expression.text; } @@ -16996,9 +17364,9 @@ var ts; return undefined; } function isComputedNonLiteralName(name) { - return name.kind === 138 /* ComputedPropertyName */ && !ts.isStringOrNumericLiteral(name.expression.kind); + return name.kind === 139 /* ComputedPropertyName */ && !ts.isStringOrNumericLiteral(name.expression.kind); } - // Return the inferred type for a binding element + /** Return the inferred type for a binding element */ function getTypeForBindingElement(declaration) { var pattern = declaration.parent; var parentType = getTypeForBindingElementParent(pattern.parent); @@ -17016,13 +17384,16 @@ var ts; return parentType; } var type; - if (pattern.kind === 165 /* ObjectBindingPattern */) { + if (pattern.kind === 166 /* ObjectBindingPattern */) { // Use explicitly specified property name ({ p: xxx } form), or otherwise the implied name ({ p } form) var name_10 = declaration.propertyName || declaration.name; if (isComputedNonLiteralName(name_10)) { // 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 = getTextOfPropertyName(name_10); @@ -17060,6 +17431,11 @@ var ts; 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. + if (strictNullChecks && declaration.initializer && !(getNullableKind(checkExpressionCached(declaration.initializer)) & 32 /* Undefined */)) { + type = removeNullableKind(type, 32 /* Undefined */); + } return type; } function getTypeForVariableLikeDeclarationFromJSDocComment(declaration) { @@ -17074,16 +17450,16 @@ var ts; if (typeTag && typeTag.typeExpression) { return typeTag.typeExpression.type; } - if (declaration.kind === 215 /* VariableDeclaration */ && - declaration.parent.kind === 216 /* VariableDeclarationList */ && - declaration.parent.parent.kind === 197 /* VariableStatement */) { + if (declaration.kind === 217 /* VariableDeclaration */ && + declaration.parent.kind === 218 /* VariableDeclarationList */ && + declaration.parent.parent.kind === 199 /* 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 === 140 /* Parameter */) { + else if (declaration.kind === 141 /* Parameter */) { // If it's a parameter, see if the parent has a jsdoc comment with an @param // annotation. var paramTag = ts.getCorrespondingJSDocParameterTag(declaration); @@ -17105,10 +17481,10 @@ var ts; } } // A variable declared in a for..in statement is always of type string - if (declaration.parent.parent.kind === 204 /* ForInStatement */) { + if (declaration.parent.parent.kind === 206 /* ForInStatement */) { return stringType; } - if (declaration.parent.parent.kind === 205 /* ForOfStatement */) { + if (declaration.parent.parent.kind === 207 /* 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, @@ -17120,21 +17496,24 @@ var ts; } // Use type from type annotation if one is present if (declaration.type) { - return getTypeFromTypeNode(declaration.type); + var type = getTypeFromTypeNode(declaration.type); + return strictNullChecks && declaration.questionToken ? addNullableKind(type, 32 /* Undefined */) : type; } - if (declaration.kind === 140 /* Parameter */) { + if (declaration.kind === 141 /* 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 === 148 /* SetAccessor */ && !ts.hasDynamicName(func)) { - var getter = ts.getDeclarationOfKind(declaration.parent.symbol, 147 /* GetAccessor */); + if (func.kind === 149 /* SetAccessor */ && !ts.hasDynamicName(func)) { + var getter = ts.getDeclarationOfKind(declaration.parent.symbol, 148 /* GetAccessor */); if (getter) { return getReturnTypeOfSignature(getSignatureFromDeclaration(getter)); } } // Use contextual parameter type if one is available - var type = getContextuallyTypedParameterType(declaration); + var type = declaration.symbol.name === "this" + ? getContextuallyTypedThisType(func) + : getContextuallyTypedParameterType(declaration); if (type) { - return type; + return strictNullChecks && declaration.questionToken ? addNullableKind(type, 32 /* Undefined */) : type; } } // Use the type of the initializer expression if one is present @@ -17142,7 +17521,7 @@ var ts; return checkExpressionCached(declaration.initializer); } // If it is a short-hand property assignment, use the type of the identifier - if (declaration.kind === 250 /* ShorthandPropertyAssignment */) { + if (declaration.kind === 253 /* ShorthandPropertyAssignment */) { return checkIdentifier(declaration.name); } // If the declaration specifies a binding pattern, use the type implied by the binding pattern @@ -17157,11 +17536,16 @@ var ts; // pattern. Otherwise, it is the type any. function getTypeFromBindingElement(element, includePatternInType) { if (element.initializer) { - return getWidenedType(checkExpressionCached(element.initializer)); + var type = checkExpressionCached(element.initializer); + reportErrorsFromWidening(element, type); + return getWidenedType(type); } if (ts.isBindingPattern(element.name)) { return getTypeFromBindingPattern(element.name, includePatternInType); } + if (compilerOptions.noImplicitAny) { + reportImplicitAnyError(element, anyType); + } return anyType; } // Return the type implied by an object binding pattern @@ -17198,7 +17582,7 @@ var ts; return languageVersion >= 2 /* ES6 */ ? 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 === 191 /* OmittedExpression */ ? anyType : getTypeFromBindingElement(e, includePatternInType); }); + var elementTypes = ts.map(elements, function (e) { return e.kind === 192 /* OmittedExpression */ ? anyType : getTypeFromBindingElement(e, includePatternInType); }); if (includePatternInType) { var result = createNewTupleType(elementTypes); result.pattern = pattern; @@ -17214,7 +17598,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) { - return pattern.kind === 165 /* ObjectBindingPattern */ + return pattern.kind === 166 /* ObjectBindingPattern */ ? getTypeFromObjectBindingPattern(pattern, includePatternInType) : getTypeFromArrayBindingPattern(pattern, includePatternInType); } @@ -17236,7 +17620,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 === 249 /* PropertyAssignment */) { + if (declaration.kind === 252 /* PropertyAssignment */) { return type; } return getWidenedType(type); @@ -17246,7 +17630,7 @@ var ts; // Report implicit any errors unless this is a private property within an ambient declaration if (reportErrors && compilerOptions.noImplicitAny) { var root = ts.getRootDeclaration(declaration); - if (!isPrivateWithinAmbient(root) && !(root.kind === 140 /* Parameter */ && isPrivateWithinAmbient(root.parent))) { + if (!isPrivateWithinAmbient(root) && !(root.kind === 141 /* Parameter */ && isPrivateWithinAmbient(root.parent))) { reportImplicitAnyError(declaration, type); } } @@ -17261,21 +17645,21 @@ var ts; } // Handle catch clause variables var declaration = symbol.valueDeclaration; - if (declaration.parent.kind === 248 /* CatchClause */) { + if (declaration.parent.kind === 251 /* CatchClause */) { return links.type = anyType; } // Handle export default expressions - if (declaration.kind === 231 /* ExportAssignment */) { + if (declaration.kind === 234 /* ExportAssignment */) { return links.type = checkExpression(declaration.expression); } // Handle module.exports = expr - if (declaration.kind === 185 /* BinaryExpression */) { + if (declaration.kind === 186 /* BinaryExpression */) { return links.type = getUnionType(ts.map(symbol.declarations, function (decl) { return checkExpressionCached(decl.right); })); } - if (declaration.kind === 170 /* PropertyAccessExpression */) { + if (declaration.kind === 171 /* PropertyAccessExpression */) { // Declarations only exist for property access expressions for certain // special assignment kinds - if (declaration.parent.kind === 185 /* BinaryExpression */) { + if (declaration.parent.kind === 186 /* BinaryExpression */) { // Handle exports.p = expr or this.p = expr or className.prototype.method = expr return links.type = checkExpressionCached(declaration.parent.right); } @@ -17305,7 +17689,7 @@ var ts; } function getAnnotatedAccessorType(accessor) { if (accessor) { - if (accessor.kind === 147 /* GetAccessor */) { + if (accessor.kind === 148 /* GetAccessor */) { return accessor.type && getTypeFromTypeNode(accessor.type); } else { @@ -17318,11 +17702,17 @@ var ts; function getTypeOfAccessors(symbol) { var links = getSymbolLinks(symbol); if (!links.type) { + var getter = ts.getDeclarationOfKind(symbol, 148 /* GetAccessor */); + var setter = ts.getDeclarationOfKind(symbol, 149 /* SetAccessor */); + if (getter && getter.flags & 134217728 /* JavaScriptFile */) { + var jsDocType = getTypeForVariableLikeDeclarationFromJSDocComment(getter); + if (jsDocType) { + return links.type = jsDocType; + } + } if (!pushTypeResolution(symbol, 0 /* Type */)) { return unknownType; } - var getter = ts.getDeclarationOfKind(symbol, 147 /* GetAccessor */); - var setter = ts.getDeclarationOfKind(symbol, 148 /* SetAccessor */); var type = void 0; // First try to see if the user specified a return type on the get-accessor. var getterReturnType = getAnnotatedAccessorType(getter); @@ -17351,7 +17741,7 @@ var ts; if (!popTypeResolution()) { type = anyType; if (compilerOptions.noImplicitAny) { - var getter_1 = ts.getDeclarationOfKind(symbol, 147 /* GetAccessor */); + var getter_1 = ts.getDeclarationOfKind(symbol, 148 /* 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)); } } @@ -17451,9 +17841,9 @@ var ts; if (!node) { return typeParameters; } - if (node.kind === 218 /* ClassDeclaration */ || node.kind === 190 /* ClassExpression */ || - node.kind === 217 /* FunctionDeclaration */ || node.kind === 177 /* FunctionExpression */ || - node.kind === 145 /* MethodDeclaration */ || node.kind === 178 /* ArrowFunction */) { + if (node.kind === 220 /* ClassDeclaration */ || node.kind === 191 /* ClassExpression */ || + node.kind === 219 /* FunctionDeclaration */ || node.kind === 178 /* FunctionExpression */ || + node.kind === 146 /* MethodDeclaration */ || node.kind === 179 /* ArrowFunction */) { var declarations = node.typeParameters; if (declarations) { return appendTypeParameters(appendOuterTypeParameters(typeParameters, node), declarations); @@ -17463,7 +17853,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, 219 /* InterfaceDeclaration */); + var declaration = symbol.flags & 32 /* Class */ ? symbol.valueDeclaration : ts.getDeclarationOfKind(symbol, 221 /* InterfaceDeclaration */); return appendOuterTypeParameters(undefined, declaration); } // The local type parameters are the combined set of type parameters from all declarations of the class, @@ -17472,8 +17862,8 @@ var ts; var result; for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var node = _a[_i]; - if (node.kind === 219 /* InterfaceDeclaration */ || node.kind === 218 /* ClassDeclaration */ || - node.kind === 190 /* ClassExpression */ || node.kind === 220 /* TypeAliasDeclaration */) { + if (node.kind === 221 /* InterfaceDeclaration */ || node.kind === 220 /* ClassDeclaration */ || + node.kind === 191 /* ClassExpression */ || node.kind === 222 /* TypeAliasDeclaration */) { var declaration = node; if (declaration.typeParameters) { result = appendTypeParameters(result, declaration.typeParameters); @@ -17613,7 +18003,7 @@ 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 === 219 /* InterfaceDeclaration */ && ts.getInterfaceBaseTypeNodes(declaration)) { + if (declaration.kind === 221 /* InterfaceDeclaration */ && ts.getInterfaceBaseTypeNodes(declaration)) { for (var _b = 0, _c = ts.getInterfaceBaseTypeNodes(declaration); _b < _c.length; _b++) { var node = _c[_b]; var baseType = getTypeFromTypeNode(node); @@ -17645,7 +18035,7 @@ var ts; function isIndependentInterface(symbol) { for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; - if (declaration.kind === 219 /* InterfaceDeclaration */) { + if (declaration.kind === 221 /* InterfaceDeclaration */) { if (declaration.flags & 16384 /* ContainsThis */) { return false; } @@ -17701,7 +18091,7 @@ var ts; if (!pushTypeResolution(symbol, 2 /* DeclaredType */)) { return unknownType; } - var declaration = ts.getDeclarationOfKind(symbol, 220 /* TypeAliasDeclaration */); + var declaration = ts.getDeclarationOfKind(symbol, 222 /* TypeAliasDeclaration */); var type = getTypeFromTypeNode(declaration.type); if (popTypeResolution()) { links.typeParameters = getLocalTypeParametersOfClassOrInterfaceOrTypeAlias(symbol); @@ -17734,7 +18124,7 @@ var ts; if (!links.declaredType) { var type = createType(512 /* TypeParameter */); type.symbol = symbol; - if (!ts.getDeclarationOfKind(symbol, 139 /* TypeParameter */).constraint) { + if (!ts.getDeclarationOfKind(symbol, 140 /* TypeParameter */).constraint) { type.constraint = noConstraintType; } links.declaredType = type; @@ -17790,11 +18180,13 @@ var ts; case 120 /* BooleanKeyword */: case 132 /* SymbolKeyword */: case 103 /* VoidKeyword */: - case 164 /* StringLiteralType */: + case 134 /* UndefinedKeyword */: + case 93 /* NullKeyword */: + case 165 /* StringLiteralType */: return true; - case 158 /* ArrayType */: + case 159 /* ArrayType */: return isIndependentType(node.elementType); - case 153 /* TypeReference */: + case 154 /* TypeReference */: return isIndependentTypeReference(node); } return false; @@ -17807,7 +18199,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 !== 146 /* Constructor */ && (!node.type || !isIndependentType(node.type))) { + if (node.kind !== 147 /* Constructor */ && (!node.type || !isIndependentType(node.type))) { return false; } for (var _i = 0, _a = node.parameters; _i < _a.length; _i++) { @@ -17828,12 +18220,12 @@ var ts; var declaration = symbol.declarations[0]; if (declaration) { switch (declaration.kind) { - case 143 /* PropertyDeclaration */: - case 142 /* PropertySignature */: + case 144 /* PropertyDeclaration */: + case 143 /* PropertySignature */: return isIndependentVariableLikeDeclaration(declaration); - case 145 /* MethodDeclaration */: - case 144 /* MethodSignature */: - case 146 /* Constructor */: + case 146 /* MethodDeclaration */: + case 145 /* MethodSignature */: + case 147 /* Constructor */: return isIndependentFunctionLikeDeclaration(declaration); } } @@ -17926,11 +18318,12 @@ var ts; type.typeArguments : ts.concatenate(type.typeArguments, [type]); resolveObjectTypeMembers(type, source, typeParameters, typeArguments); } - function createSignature(declaration, typeParameters, parameters, resolvedReturnType, typePredicate, minArgumentCount, hasRestParameter, hasStringLiterals) { + function createSignature(declaration, typeParameters, thisType, parameters, resolvedReturnType, typePredicate, minArgumentCount, hasRestParameter, hasStringLiterals) { var sig = new Signature(checker); sig.declaration = declaration; sig.typeParameters = typeParameters; sig.parameters = parameters; + sig.thisType = thisType; sig.resolvedReturnType = resolvedReturnType; sig.typePredicate = typePredicate; sig.minArgumentCount = minArgumentCount; @@ -17939,13 +18332,13 @@ var ts; return sig; } function cloneSignature(sig) { - return createSignature(sig.declaration, sig.typeParameters, sig.parameters, sig.resolvedReturnType, sig.typePredicate, sig.minArgumentCount, sig.hasRestParameter, sig.hasStringLiterals); + return createSignature(sig.declaration, sig.typeParameters, sig.thisType, sig.parameters, sig.resolvedReturnType, sig.typePredicate, sig.minArgumentCount, sig.hasRestParameter, sig.hasStringLiterals); } function getDefaultConstructSignatures(classType) { var baseConstructorType = getBaseConstructorTypeOfClass(classType); var baseSignatures = getSignaturesOfType(baseConstructorType, 1 /* Construct */); if (baseSignatures.length === 0) { - return [createSignature(undefined, classType.localTypeParameters, emptyArray, classType, /*typePredicate*/ undefined, 0, /*hasRestParameter*/ false, /*hasStringLiterals*/ false)]; + return [createSignature(undefined, classType.localTypeParameters, undefined, emptyArray, classType, /*typePredicate*/ undefined, 0, /*hasRestParameter*/ false, /*hasStringLiterals*/ false)]; } var baseTypeNode = getBaseTypeNodeOfClass(classType); var typeArguments = ts.map(baseTypeNode.typeArguments, getTypeFromTypeNode); @@ -17980,10 +18373,10 @@ var ts; addInheritedMembers(members, arrayType.properties); setObjectTypeMembers(type, members, arrayType.callSignatures, arrayType.constructSignatures, arrayType.stringIndexInfo, arrayType.numberIndexInfo); } - function findMatchingSignature(signatureList, signature, partialMatch, ignoreReturnTypes) { + function findMatchingSignature(signatureList, signature, partialMatch, ignoreThisTypes, ignoreReturnTypes) { for (var _i = 0, signatureList_1 = signatureList; _i < signatureList_1.length; _i++) { var s = signatureList_1[_i]; - if (compareSignaturesIdentical(s, signature, partialMatch, ignoreReturnTypes, compareTypesIdentical)) { + if (compareSignaturesIdentical(s, signature, partialMatch, ignoreThisTypes, ignoreReturnTypes, compareTypesIdentical)) { return s; } } @@ -17996,7 +18389,7 @@ var ts; return undefined; } for (var i = 1; i < signatureLists.length; i++) { - if (!findMatchingSignature(signatureLists[i], signature, /*partialMatch*/ false, /*ignoreReturnTypes*/ false)) { + if (!findMatchingSignature(signatureLists[i], signature, /*partialMatch*/ false, /*ignoreThisTypes*/ false, /*ignoreReturnTypes*/ false)) { return undefined; } } @@ -18005,7 +18398,7 @@ var ts; var result = undefined; for (var i = 0; i < signatureLists.length; i++) { // Allow matching non-generic signatures to have excess parameters and different return types - var match = i === listIndex ? signature : findMatchingSignature(signatureLists[i], signature, /*partialMatch*/ true, /*ignoreReturnTypes*/ true); + var match = i === listIndex ? signature : findMatchingSignature(signatureLists[i], signature, /*partialMatch*/ true, /*ignoreThisTypes*/ true, /*ignoreReturnTypes*/ true); if (!match) { return undefined; } @@ -18026,13 +18419,16 @@ var ts; for (var _i = 0, _a = signatureLists[i]; _i < _a.length; _i++) { var signature = _a[_i]; // Only process signatures with parameter lists that aren't already in the result list - if (!result || !findMatchingSignature(result, signature, /*partialMatch*/ false, /*ignoreReturnTypes*/ true)) { + if (!result || !findMatchingSignature(result, signature, /*partialMatch*/ false, /*ignoreThisTypes*/ true, /*ignoreReturnTypes*/ true)) { var unionSignatures = findMatchingSignatures(signatureLists, signature, i); if (unionSignatures) { var s = signature; // Union the result types when more than one signature matches if (unionSignatures.length > 1) { s = cloneSignature(signature); + if (ts.forEach(unionSignatures, function (sig) { return sig.thisType; })) { + s.thisType = getUnionType(ts.map(unionSignatures, function (sig) { return sig.thisType || anyType; })); + } // Clear resolved return type we possibly got from cloneSignature s.resolvedReturnType = undefined; s.unionSignatures = unionSignatures; @@ -18232,7 +18628,7 @@ var ts; type = globalBooleanType; } else if (type.flags & 16777216 /* ESSymbol */) { - type = globalESSymbolType; + type = getGlobalESSymbolType(); } return type; } @@ -18401,7 +18797,7 @@ var ts; } function isOptionalParameter(node) { if (node.flags & 134217728 /* JavaScriptFile */) { - if (node.type && node.type.kind === 264 /* JSDocOptionalType */) { + if (node.type && node.type.kind === 267 /* JSDocOptionalType */) { return true; } var paramTag = ts.getCorrespondingJSDocParameterTag(node); @@ -18410,7 +18806,7 @@ var ts; return true; } if (paramTag.typeExpression) { - return paramTag.typeExpression.type.kind === 264 /* JSDocOptionalType */; + return paramTag.typeExpression.type.kind === 267 /* JSDocOptionalType */; } } } @@ -18446,7 +18842,7 @@ var ts; function getSignatureFromDeclaration(declaration) { var links = getNodeLinks(declaration); if (!links.resolvedSignature) { - var classType = declaration.kind === 146 /* Constructor */ ? + var classType = declaration.kind === 147 /* Constructor */ ? getDeclaredTypeOfClassOrInterface(getMergedSymbol(declaration.parent.symbol)) : undefined; var typeParameters = classType ? classType.localTypeParameters : @@ -18455,6 +18851,8 @@ var ts; var parameters = []; var hasStringLiterals = false; var minArgumentCount = -1; + var thisType = undefined; + var hasThisParameter = void 0; var isJSConstructSignature = ts.isJSDocConstructSignature(declaration); var returnType = undefined; var typePredicate = undefined; @@ -18469,13 +18867,19 @@ var ts; var resolvedSymbol = resolveName(param, paramSymbol.name, 107455 /* Value */, undefined, undefined); paramSymbol = resolvedSymbol; } - parameters.push(paramSymbol); - if (param.type && param.type.kind === 164 /* StringLiteralType */) { + if (i === 0 && paramSymbol.name === "this") { + hasThisParameter = true; + thisType = param.type ? getTypeFromTypeNode(param.type) : unknownType; + } + else { + parameters.push(paramSymbol); + } + if (param.type && param.type.kind === 165 /* StringLiteralType */) { hasStringLiterals = true; } if (param.initializer || param.questionToken || param.dotDotDotToken) { if (minArgumentCount < 0) { - minArgumentCount = i; + minArgumentCount = i - (hasThisParameter ? 1 : 0); } } else { @@ -18484,7 +18888,7 @@ var ts; } } if (minArgumentCount < 0) { - minArgumentCount = declaration.parameters.length; + minArgumentCount = declaration.parameters.length - (hasThisParameter ? 1 : 0); } if (isJSConstructSignature) { minArgumentCount--; @@ -18495,7 +18899,7 @@ var ts; } else if (declaration.type) { returnType = getTypeFromTypeNode(declaration.type); - if (declaration.type.kind === 152 /* TypePredicate */) { + if (declaration.type.kind === 153 /* TypePredicate */) { typePredicate = createTypePredicateFromTypePredicateNode(declaration.type); } } @@ -18508,15 +18912,15 @@ 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 === 147 /* GetAccessor */ && !ts.hasDynamicName(declaration)) { - var setter = ts.getDeclarationOfKind(declaration.symbol, 148 /* SetAccessor */); + if (declaration.kind === 148 /* GetAccessor */ && !ts.hasDynamicName(declaration)) { + var setter = ts.getDeclarationOfKind(declaration.symbol, 149 /* SetAccessor */); returnType = getAnnotatedAccessorType(setter); } if (!returnType && ts.nodeIsMissing(declaration.body)) { returnType = anyType; } } - links.resolvedSignature = createSignature(declaration, typeParameters, parameters, returnType, typePredicate, minArgumentCount, ts.hasRestParameter(declaration), hasStringLiterals); + links.resolvedSignature = createSignature(declaration, typeParameters, thisType, parameters, returnType, typePredicate, minArgumentCount, ts.hasRestParameter(declaration), hasStringLiterals); } return links.resolvedSignature; } @@ -18527,20 +18931,20 @@ var ts; for (var i = 0, len = symbol.declarations.length; i < len; i++) { var node = symbol.declarations[i]; switch (node.kind) { - case 154 /* FunctionType */: - case 155 /* ConstructorType */: - case 217 /* FunctionDeclaration */: - case 145 /* MethodDeclaration */: - case 144 /* MethodSignature */: - case 146 /* Constructor */: - case 149 /* CallSignature */: - case 150 /* ConstructSignature */: - case 151 /* IndexSignature */: - case 147 /* GetAccessor */: - case 148 /* SetAccessor */: - case 177 /* FunctionExpression */: - case 178 /* ArrowFunction */: - case 265 /* JSDocFunctionType */: + case 155 /* FunctionType */: + case 156 /* ConstructorType */: + case 219 /* FunctionDeclaration */: + case 146 /* MethodDeclaration */: + case 145 /* MethodSignature */: + case 147 /* Constructor */: + case 150 /* CallSignature */: + case 151 /* ConstructSignature */: + case 152 /* IndexSignature */: + case 148 /* GetAccessor */: + case 149 /* SetAccessor */: + case 178 /* FunctionExpression */: + case 179 /* ArrowFunction */: + case 268 /* 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). @@ -18627,7 +19031,7 @@ 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 === 146 /* Constructor */ || signature.declaration.kind === 150 /* ConstructSignature */; + var isConstructor = signature.declaration.kind === 147 /* Constructor */ || signature.declaration.kind === 151 /* ConstructSignature */; var type = createObjectType(65536 /* Anonymous */ | 262144 /* FromSignature */); type.members = emptySymbols; type.properties = emptyArray; @@ -18668,7 +19072,7 @@ var ts; return undefined; } function getConstraintDeclaration(type) { - return ts.getDeclarationOfKind(type.symbol, 139 /* TypeParameter */).constraint; + return ts.getDeclarationOfKind(type.symbol, 140 /* TypeParameter */).constraint; } function hasConstraintReferenceTo(type, target) { var checked; @@ -18701,7 +19105,7 @@ var ts; return typeParameter.constraint === noConstraintType ? undefined : typeParameter.constraint; } function getParentSymbolOfTypeParameter(typeParameter) { - return getSymbolOfNode(ts.getDeclarationOfKind(typeParameter.symbol, 139 /* TypeParameter */).parent); + return getSymbolOfNode(ts.getDeclarationOfKind(typeParameter.symbol, 140 /* TypeParameter */).parent); } function getTypeListId(types) { if (types) { @@ -18727,11 +19131,13 @@ var ts; // It is only necessary to do so if a constituent type might be the undefined type, the null type, the type // of an object literal or the anyFunctionType. This is because there are operations in the type checker // that care about the presence of such types at arbitrary depth in a containing type. - function getPropagatingFlagsOfTypes(types) { + function getPropagatingFlagsOfTypes(types, excludeKinds) { var result = 0; for (var _i = 0, types_3 = types; _i < types_3.length; _i++) { var type = types_3[_i]; - result |= type.flags; + if (!(type.flags & excludeKinds)) { + result |= type.flags; + } } return result & 14680064 /* PropagatingFlags */; } @@ -18739,7 +19145,8 @@ var ts; var id = getTypeListId(typeArguments); var type = target.instantiations[id]; if (!type) { - var flags = 4096 /* Reference */ | (typeArguments ? getPropagatingFlagsOfTypes(typeArguments) : 0); + var propagatedFlags = typeArguments ? getPropagatingFlagsOfTypes(typeArguments, /*excludeKinds*/ 0) : 0; + var flags = 4096 /* Reference */ | propagatedFlags; type = target.instantiations[id] = createObjectType(flags, target.symbol); type.target = target; type.typeArguments = typeArguments; @@ -18748,7 +19155,7 @@ var ts; } // Get type from reference to class or interface function getTypeFromClassOrInterfaceReference(node, symbol) { - var type = getDeclaredTypeOfSymbol(symbol); + var type = getDeclaredTypeOfSymbol(getMergedSymbol(symbol)); var typeParameters = type.localTypeParameters; if (typeParameters) { if (!node.typeArguments || node.typeArguments.length !== typeParameters.length) { @@ -18798,11 +19205,11 @@ var ts; } function getTypeReferenceName(node) { switch (node.kind) { - case 153 /* TypeReference */: + case 154 /* TypeReference */: return node.typeName; - case 263 /* JSDocTypeReference */: + case 266 /* JSDocTypeReference */: return node.name; - case 192 /* ExpressionWithTypeArguments */: + case 193 /* ExpressionWithTypeArguments */: // We only support expressions that are simple qualified names. For other // expressions this produces undefined. if (ts.isSupportedExpressionWithTypeArguments(node)) { @@ -18827,7 +19234,7 @@ var ts; if (symbol.flags & 524288 /* TypeAlias */) { return getTypeFromTypeAliasReference(node, symbol); } - if (symbol.flags & 107455 /* Value */ && node.kind === 263 /* JSDocTypeReference */) { + if (symbol.flags & 107455 /* Value */ && node.kind === 266 /* 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. @@ -18840,7 +19247,7 @@ var ts; if (!links.resolvedType) { var symbol = void 0; var type = void 0; - if (node.kind === 263 /* JSDocTypeReference */) { + if (node.kind === 266 /* JSDocTypeReference */) { var typeReferenceName = getTypeReferenceName(node); symbol = resolveTypeReferenceName(node, typeReferenceName); type = getTypeReferenceType(node, symbol); @@ -18849,7 +19256,7 @@ var ts; } else { // We only support expressions that are simple qualified names. For other expressions this produces undefined. - var typeNameOrExpression = node.kind === 153 /* TypeReference */ ? node.typeName : + var typeNameOrExpression = node.kind === 154 /* TypeReference */ ? node.typeName : ts.isSupportedExpressionWithTypeArguments(node) ? node.expression : undefined; symbol = typeNameOrExpression && resolveEntityName(typeNameOrExpression, 793056 /* Type */) || unknownSymbol; @@ -18882,9 +19289,9 @@ var ts; for (var _i = 0, declarations_3 = declarations; _i < declarations_3.length; _i++) { var declaration = declarations_3[_i]; switch (declaration.kind) { - case 218 /* ClassDeclaration */: - case 219 /* InterfaceDeclaration */: - case 221 /* EnumDeclaration */: + case 220 /* ClassDeclaration */: + case 221 /* InterfaceDeclaration */: + case 223 /* EnumDeclaration */: return declaration; } } @@ -18925,9 +19332,6 @@ var ts; var typeSymbol = namespaceSymbol && getSymbol(namespaceSymbol.exports, name, 793056 /* Type */); return typeSymbol && getDeclaredTypeOfSymbol(typeSymbol); } - function getGlobalESSymbolConstructorSymbol() { - return globalESSymbolConstructorSymbol || (globalESSymbolConstructorSymbol = getGlobalValueSymbol("Symbol")); - } /** * Creates a TypeReference for a generic `TypedPropertyDescriptor`. */ @@ -18944,10 +19348,10 @@ var ts; return genericGlobalType !== emptyGenericType ? createTypeReference(genericGlobalType, typeArguments) : emptyObjectType; } function createIterableType(elementType) { - return createTypeFromGenericGlobalType(globalIterableType, [elementType]); + return createTypeFromGenericGlobalType(getGlobalIterableType(), [elementType]); } function createIterableIteratorType(elementType) { - return createTypeFromGenericGlobalType(globalIterableIteratorType, [elementType]); + return createTypeFromGenericGlobalType(getGlobalIterableIteratorType(), [elementType]); } function createArrayType(elementType) { return createTypeFromGenericGlobalType(globalArrayType, [elementType]); @@ -18964,7 +19368,8 @@ var ts; return tupleTypes[id] || (tupleTypes[id] = createNewTupleType(elementTypes)); } function createNewTupleType(elementTypes) { - var type = createObjectType(8192 /* Tuple */ | getPropagatingFlagsOfTypes(elementTypes)); + var propagatedFlags = getPropagatingFlagsOfTypes(elementTypes, /*excludeKinds*/ 0); + var type = createObjectType(8192 /* Tuple */ | propagatedFlags); type.elementTypes = elementTypes; return type; } @@ -18979,6 +19384,14 @@ var ts; if (type.flags & typeSetKind) { addTypesToSet(typeSet, type.types, typeSetKind); } + else if (type.flags & (1 /* Any */ | 32 /* Undefined */ | 64 /* Null */)) { + if (type.flags & 1 /* Any */) + typeSet.containsAny = true; + if (type.flags & 32 /* Undefined */) + typeSet.containsUndefined = true; + if (type.flags & 64 /* Null */) + typeSet.containsNull = true; + } else if (!ts.contains(typeSet, type)) { typeSet.push(type); } @@ -19008,24 +19421,6 @@ var ts; } } } - function containsTypeAny(types) { - for (var _i = 0, types_5 = types; _i < types_5.length; _i++) { - var type = types_5[_i]; - if (isTypeAny(type)) { - return true; - } - } - return false; - } - function removeAllButLast(types, typeToRemove) { - var i = types.length; - while (i > 0 && types.length > 1) { - i--; - if (types[i] === typeToRemove) { - types.splice(i, 1); - } - } - } // We reduce the constituent type set to only include types that aren't subtypes of other types, unless // the noSubtypeReduction flag is specified, in which case we perform a simple deduplication based on // object identity. Subtype reduction is possible only when union types are known not to circularly @@ -19039,23 +19434,29 @@ var ts; } var typeSet = []; addTypesToSet(typeSet, types, 16384 /* Union */); - if (containsTypeAny(typeSet)) { + if (typeSet.containsAny) { return anyType; } - if (noSubtypeReduction) { - removeAllButLast(typeSet, undefinedType); - removeAllButLast(typeSet, nullType); + if (strictNullChecks) { + if (typeSet.containsNull) + typeSet.push(nullType); + if (typeSet.containsUndefined) + typeSet.push(undefinedType); } - else { + if (!noSubtypeReduction) { removeSubtypes(typeSet); } - if (typeSet.length === 1) { + if (typeSet.length === 0) { + return typeSet.containsNull ? nullType : undefinedType; + } + else if (typeSet.length === 1) { return typeSet[0]; } var id = getTypeListId(typeSet); var type = unionTypes[id]; if (!type) { - type = unionTypes[id] = createObjectType(16384 /* Union */ | getPropagatingFlagsOfTypes(typeSet)); + var propagatedFlags = getPropagatingFlagsOfTypes(typeSet, /*excludeKinds*/ 96 /* Nullable */); + type = unionTypes[id] = createObjectType(16384 /* Union */ | propagatedFlags); type.types = typeSet; } return type; @@ -19078,16 +19479,23 @@ var ts; } var typeSet = []; addTypesToSet(typeSet, types, 32768 /* Intersection */); - if (containsTypeAny(typeSet)) { + if (typeSet.containsAny) { return anyType; } + if (strictNullChecks) { + if (typeSet.containsNull) + typeSet.push(nullType); + if (typeSet.containsUndefined) + typeSet.push(undefinedType); + } if (typeSet.length === 1) { return typeSet[0]; } var id = getTypeListId(typeSet); var type = intersectionTypes[id]; if (!type) { - type = intersectionTypes[id] = createObjectType(32768 /* Intersection */ | getPropagatingFlagsOfTypes(typeSet)); + var propagatedFlags = getPropagatingFlagsOfTypes(typeSet, /*excludeKinds*/ 96 /* Nullable */); + type = intersectionTypes[id] = createObjectType(32768 /* Intersection */ | propagatedFlags); type.types = typeSet; } return type; @@ -19141,9 +19549,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 === 219 /* InterfaceDeclaration */)) { + if (parent && (ts.isClassLike(parent) || parent.kind === 221 /* InterfaceDeclaration */)) { if (!(container.flags & 32 /* Static */) && - (container.kind !== 146 /* Constructor */ || ts.isNodeDescendentOf(node, container.body))) { + (container.kind !== 147 /* Constructor */ || ts.isNodeDescendentOf(node, container.body))) { return getDeclaredTypeOfClassOrInterface(getSymbolOfNode(parent)).thisType; } } @@ -19160,8 +19568,8 @@ var ts; function getTypeFromTypeNode(node) { switch (node.kind) { case 117 /* AnyKeyword */: - case 254 /* JSDocAllType */: - case 255 /* JSDocUnknownType */: + case 257 /* JSDocAllType */: + case 258 /* JSDocUnknownType */: return anyType; case 131 /* StringKeyword */: return stringType; @@ -19173,51 +19581,55 @@ var ts; return esSymbolType; case 103 /* VoidKeyword */: return voidType; - case 163 /* ThisType */: + case 134 /* UndefinedKeyword */: + return undefinedType; + case 93 /* NullKeyword */: + return nullType; + case 164 /* ThisType */: return getTypeFromThisTypeNode(node); - case 164 /* StringLiteralType */: + case 165 /* StringLiteralType */: return getTypeFromStringLiteralTypeNode(node); - case 153 /* TypeReference */: - case 263 /* JSDocTypeReference */: + case 154 /* TypeReference */: + case 266 /* JSDocTypeReference */: return getTypeFromTypeReference(node); - case 152 /* TypePredicate */: + case 153 /* TypePredicate */: return booleanType; - case 192 /* ExpressionWithTypeArguments */: + case 193 /* ExpressionWithTypeArguments */: return getTypeFromTypeReference(node); - case 156 /* TypeQuery */: + case 157 /* TypeQuery */: return getTypeFromTypeQueryNode(node); - case 158 /* ArrayType */: - case 256 /* JSDocArrayType */: + case 159 /* ArrayType */: + case 259 /* JSDocArrayType */: return getTypeFromArrayTypeNode(node); - case 159 /* TupleType */: + case 160 /* TupleType */: return getTypeFromTupleTypeNode(node); - case 160 /* UnionType */: - case 257 /* JSDocUnionType */: + case 161 /* UnionType */: + case 260 /* JSDocUnionType */: return getTypeFromUnionTypeNode(node); - case 161 /* IntersectionType */: + case 162 /* IntersectionType */: return getTypeFromIntersectionTypeNode(node); - case 162 /* ParenthesizedType */: - case 259 /* JSDocNullableType */: - case 260 /* JSDocNonNullableType */: - case 267 /* JSDocConstructorType */: - case 268 /* JSDocThisType */: - case 264 /* JSDocOptionalType */: + case 163 /* ParenthesizedType */: + case 262 /* JSDocNullableType */: + case 263 /* JSDocNonNullableType */: + case 270 /* JSDocConstructorType */: + case 271 /* JSDocThisType */: + case 267 /* JSDocOptionalType */: return getTypeFromTypeNode(node.type); - case 154 /* FunctionType */: - case 155 /* ConstructorType */: - case 157 /* TypeLiteral */: - case 265 /* JSDocFunctionType */: - case 261 /* JSDocRecordType */: + case 155 /* FunctionType */: + case 156 /* ConstructorType */: + case 158 /* TypeLiteral */: + case 268 /* JSDocFunctionType */: + case 264 /* JSDocRecordType */: return getTypeFromTypeLiteralOrFunctionOrConstructorTypeNode(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 137 /* QualifiedName */: + case 138 /* QualifiedName */: var symbol = getSymbolAtLocation(node); return symbol && getDeclaredTypeOfSymbol(symbol); - case 258 /* JSDocTupleType */: + case 261 /* JSDocTupleType */: return getTypeFromJSDocTupleType(node); - case 266 /* JSDocVariadicType */: + case 269 /* JSDocVariadicType */: return getTypeFromJSDocVariadicType(node); default: return unknownType; @@ -19240,40 +19652,26 @@ var ts; function createBinaryTypeMapper(source1, target1, source2, target2) { return function (t) { return t === source1 ? target1 : t === source2 ? target2 : t; }; } - function createTypeMapper(sources, targets) { - switch (sources.length) { - case 1: return createUnaryTypeMapper(sources[0], targets[0]); - case 2: return createBinaryTypeMapper(sources[0], targets[0], sources[1], targets[1]); - } + function createArrayTypeMapper(sources, targets) { return function (t) { for (var i = 0; i < sources.length; i++) { if (t === sources[i]) { - return targets[i]; + return targets ? targets[i] : anyType; } } return t; }; } - function createUnaryTypeEraser(source) { - return function (t) { return t === source ? anyType : t; }; - } - function createBinaryTypeEraser(source1, source2) { - return function (t) { return t === source1 || t === source2 ? anyType : t; }; + function createTypeMapper(sources, targets) { + var count = sources.length; + var mapper = count == 1 ? createUnaryTypeMapper(sources[0], targets ? targets[0] : anyType) : + count == 2 ? createBinaryTypeMapper(sources[0], targets ? targets[0] : anyType, sources[1], targets ? targets[1] : anyType) : + createArrayTypeMapper(sources, targets); + mapper.mappedTypes = sources; + return mapper; } function createTypeEraser(sources) { - switch (sources.length) { - case 1: return createUnaryTypeEraser(sources[0]); - case 2: return createBinaryTypeEraser(sources[0], sources[1]); - } - return function (t) { - for (var _i = 0, sources_1 = sources; _i < sources_1.length; _i++) { - var source = sources_1[_i]; - if (t === source) { - return anyType; - } - } - return t; - }; + return createTypeMapper(sources, undefined); } function getInferenceMapper(context) { if (!context.mapper) { @@ -19287,6 +19685,7 @@ var ts; } return t; }; + mapper.mappedTypes = context.typeParameters; mapper.context = context; context.mapper = mapper; } @@ -19296,7 +19695,9 @@ var ts; return type; } function combineTypeMappers(mapper1, mapper2) { - return function (t) { return instantiateType(mapper1(t), mapper2); }; + var mapper = function (t) { return instantiateType(mapper1(t), mapper2); }; + mapper.mappedTypes = mapper1.mappedTypes; + return mapper; } function cloneTypeParameter(typeParameter) { var result = createType(512 /* TypeParameter */); @@ -19337,7 +19738,7 @@ var ts; if (signature.typePredicate) { freshTypePredicate = cloneTypePredicate(signature.typePredicate, mapper); } - var result = createSignature(signature.declaration, freshTypeParameters, instantiateList(signature.parameters, mapper, instantiateSymbol), instantiateType(signature.resolvedReturnType, mapper), freshTypePredicate, signature.minArgumentCount, signature.hasRestParameter, signature.hasStringLiterals); + var result = createSignature(signature.declaration, freshTypeParameters, signature.thisType && instantiateType(signature.thisType, mapper), instantiateList(signature.parameters, mapper, instantiateSymbol), instantiateType(signature.resolvedReturnType, mapper), freshTypePredicate, signature.minArgumentCount, signature.hasRestParameter, signature.hasStringLiterals); result.target = signature; result.mapper = mapper; return result; @@ -19380,13 +19781,70 @@ var ts; mapper.instantiations[type.id] = result; return result; } + function isSymbolInScopeOfMappedTypeParameter(symbol, mapper) { + 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; + while (node) { + switch (node.kind) { + case 155 /* FunctionType */: + case 156 /* ConstructorType */: + case 219 /* FunctionDeclaration */: + case 146 /* MethodDeclaration */: + case 145 /* MethodSignature */: + case 147 /* Constructor */: + case 150 /* CallSignature */: + case 151 /* ConstructSignature */: + case 152 /* IndexSignature */: + case 148 /* GetAccessor */: + case 149 /* SetAccessor */: + case 178 /* FunctionExpression */: + case 179 /* ArrowFunction */: + case 220 /* ClassDeclaration */: + case 191 /* ClassExpression */: + case 221 /* InterfaceDeclaration */: + case 222 /* TypeAliasDeclaration */: + var declaration = node; + if (declaration.typeParameters) { + for (var _i = 0, _a = declaration.typeParameters; _i < _a.length; _i++) { + var d = _a[_i]; + if (ts.contains(mappedTypes, getDeclaredTypeOfTypeParameter(d.symbol))) { + return true; + } + } + } + if (ts.isClassLike(node) || node.kind === 221 /* InterfaceDeclaration */) { + var thisType = getDeclaredTypeOfClassOrInterface(getSymbolOfNode(node)).thisType; + if (thisType && ts.contains(mappedTypes, thisType)) { + return true; + } + } + break; + case 224 /* ModuleDeclaration */: + case 255 /* SourceFile */: + return false; + } + node = node.parent; + } + return false; + } function instantiateType(type, mapper) { if (type && mapper !== identityMapper) { if (type.flags & 512 /* TypeParameter */) { return mapper(type); } if (type.flags & 65536 /* Anonymous */) { - return type.symbol && type.symbol.flags & (16 /* Function */ | 8192 /* Method */ | 32 /* Class */ | 2048 /* TypeLiteral */ | 4096 /* ObjectLiteral */) ? + // 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 + // if none of the type parameters that are in scope in the type's declaration are mapped by + // the given mapper, however we can only do that analysis if the type isn't itself an + // instantiation. + return type.symbol && + type.symbol.flags & (16 /* Function */ | 8192 /* Method */ | 32 /* Class */ | 2048 /* TypeLiteral */ | 4096 /* ObjectLiteral */) && + (type.flags & 131072 /* Instantiated */ || isSymbolInScopeOfMappedTypeParameter(type.symbol, mapper)) ? instantiateAnonymousType(type, mapper) : type; } if (type.flags & 4096 /* Reference */) { @@ -19410,33 +19868,35 @@ 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 !== 145 /* MethodDeclaration */ || ts.isObjectLiteralMethod(node)); + ts.Debug.assert(node.kind !== 146 /* MethodDeclaration */ || ts.isObjectLiteralMethod(node)); switch (node.kind) { - case 177 /* FunctionExpression */: - case 178 /* ArrowFunction */: + case 178 /* FunctionExpression */: + case 179 /* ArrowFunction */: return isContextSensitiveFunctionLikeDeclaration(node); - case 169 /* ObjectLiteralExpression */: + case 170 /* ObjectLiteralExpression */: return ts.forEach(node.properties, isContextSensitive); - case 168 /* ArrayLiteralExpression */: + case 169 /* ArrayLiteralExpression */: return ts.forEach(node.elements, isContextSensitive); - case 186 /* ConditionalExpression */: + case 187 /* ConditionalExpression */: return isContextSensitive(node.whenTrue) || isContextSensitive(node.whenFalse); - case 185 /* BinaryExpression */: + case 186 /* BinaryExpression */: return node.operatorToken.kind === 52 /* BarBarToken */ && (isContextSensitive(node.left) || isContextSensitive(node.right)); - case 249 /* PropertyAssignment */: + case 252 /* PropertyAssignment */: return isContextSensitive(node.initializer); - case 145 /* MethodDeclaration */: - case 144 /* MethodSignature */: + case 146 /* MethodDeclaration */: + case 145 /* MethodSignature */: return isContextSensitiveFunctionLikeDeclaration(node); - case 176 /* ParenthesizedExpression */: + case 177 /* ParenthesizedExpression */: return isContextSensitive(node.expression); } return false; } function isContextSensitiveFunctionLikeDeclaration(node) { - return !node.typeParameters && node.parameters.length && !ts.forEach(node.parameters, function (p) { return p.type; }); + var areAllParametersUntyped = !ts.forEach(node.parameters, function (p) { return p.type; }); + var isNullaryArrow = node.kind === 179 /* ArrowFunction */ && !node.parameters.length; + return !node.typeParameters && areAllParametersUntyped && !isNullaryArrow; } function getTypeWithoutSignatures(type) { if (type.flags & 80896 /* ObjectType */) { @@ -19468,12 +19928,26 @@ var ts; function isTypeAssignableTo(source, target) { return checkTypeAssignableTo(source, target, /*errorNode*/ undefined); } + /** + * This is *not* a bi-directional relationship. + * If one needs to check both directions for comparability, use a second call to this function or 'checkTypeComparableTo'. + */ + function isTypeComparableTo(source, target) { + return checkTypeComparableTo(source, target, /*errorNode*/ undefined); + } function checkTypeSubtypeOf(source, target, errorNode, headMessage, containingMessageChain) { return checkTypeRelatedTo(source, target, subtypeRelation, errorNode, headMessage, containingMessageChain); } function checkTypeAssignableTo(source, target, errorNode, headMessage, containingMessageChain) { return checkTypeRelatedTo(source, target, assignableRelation, errorNode, headMessage, containingMessageChain); } + /** + * This is *not* a bi-directional relationship. + * If one needs to check both directions for comparability, use a second call to this function or 'isTypeComparableTo'. + */ + function checkTypeComparableTo(source, target, errorNode, headMessage, containingMessageChain) { + return checkTypeRelatedTo(source, target, comparableRelation, errorNode, headMessage, containingMessageChain); + } function isSignatureAssignableTo(source, target, ignoreReturnTypes) { return compareSignaturesRelated(source, target, ignoreReturnTypes, /*reportErrors*/ false, /*errorReporter*/ undefined, compareTypesAssignable) !== 0 /* False */; } @@ -19493,15 +19967,27 @@ var ts; source = getErasedSignature(source); target = getErasedSignature(target); var result = -1 /* True */; + if (source.thisType && target.thisType && source.thisType !== voidType) { + // void sources are assignable to anything. + var related = compareTypes(source.thisType, target.thisType, /*reportErrors*/ false) + || compareTypes(target.thisType, source.thisType, reportErrors); + if (!related) { + if (reportErrors) { + errorReporter(ts.Diagnostics.The_this_types_of_each_signature_are_incompatible); + } + return 0 /* False */; + } + result &= related; + } var sourceMax = getNumNonRestParameters(source); var targetMax = getNumNonRestParameters(target); var checkCount = getNumParametersToCheckForSignatureRelatability(source, sourceMax, target, targetMax); var sourceParams = source.parameters; var targetParams = target.parameters; for (var i = 0; i < checkCount; i++) { - var s = i < sourceMax ? getTypeOfSymbol(sourceParams[i]) : getRestTypeOfSignature(source); - var t = i < targetMax ? getTypeOfSymbol(targetParams[i]) : getRestTypeOfSignature(target); - var related = compareTypes(t, s, /*reportErrors*/ false) || compareTypes(s, t, reportErrors); + var s = i < sourceMax ? getTypeOfParameter(sourceParams[i]) : getRestTypeOfSignature(source); + var t = i < targetMax ? getTypeOfParameter(targetParams[i]) : getRestTypeOfSignature(target); + var related = compareTypes(s, t, /*reportErrors*/ false) || compareTypes(t, s, reportErrors); if (!related) { if (reportErrors) { errorReporter(ts.Diagnostics.Types_of_parameters_0_and_1_are_incompatible, sourceParams[i < sourceMax ? i : sourceMax].name, targetParams[i < targetMax ? i : targetMax].name); @@ -19600,7 +20086,7 @@ var ts; * Checks if 'source' is related to 'target' (e.g.: is a assignable to). * @param source The left-hand-side of the relation. * @param target The right-hand-side of the relation. - * @param relation The relation considered. One of 'identityRelation', 'assignableRelation', or 'subTypeRelation'. + * @param relation The relation considered. One of 'identityRelation', 'subtypeRelation', 'assignableRelation', or 'comparableRelation'. * Used as both to determine which checks are performed and as a cache of previously computed results. * @param errorNode The suggested node upon which all errors will be reported, if defined. This may or may not be the actual node used. * @param headMessage If the error chain should be prepended by a head message, then headMessage will be used. @@ -19637,7 +20123,12 @@ var ts; sourceType = typeToString(source, /*enclosingDeclaration*/ undefined, 128 /* UseFullyQualifiedType */); targetType = typeToString(target, /*enclosingDeclaration*/ undefined, 128 /* UseFullyQualifiedType */); } - reportError(message || ts.Diagnostics.Type_0_is_not_assignable_to_type_1, sourceType, targetType); + 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; + } + reportError(message, sourceType, targetType); } // Compare two types and return // Ternary.True if they are related with no assumptions, @@ -19653,20 +20144,24 @@ var ts; } if (isTypeAny(target)) return -1 /* True */; - if (source === undefinedType) - return -1 /* True */; - if (source === nullType && target !== undefinedType) - return -1 /* True */; + if (source.flags & 32 /* Undefined */) { + if (!strictNullChecks || target.flags & (32 /* Undefined */ | 16 /* Void */) || source === emptyArrayElementType) + return -1 /* True */; + } + if (source.flags & 64 /* Null */) { + if (!strictNullChecks || target.flags & 64 /* Null */) + return -1 /* True */; + } if (source.flags & 128 /* Enum */ && target === numberType) return -1 /* True */; if (source.flags & 128 /* Enum */ && target.flags & 128 /* Enum */) { - if (result = enumRelatedTo(source, target)) { + if (result = enumRelatedTo(source, target, reportErrors)) { return result; } } if (source.flags & 256 /* StringLiteral */ && target === stringType) return -1 /* True */; - if (relation === assignableRelation) { + if (relation === assignableRelation || relation === comparableRelation) { if (isTypeAny(source)) return -1 /* True */; if (source === numberType && target.flags & 128 /* Enum */) @@ -19691,29 +20186,48 @@ var ts; } } var saveErrorInfo = errorInfo; - // Note that the "each" checks must precede the "some" checks to produce the correct results + // Note that these checks are specifically ordered to produce correct results. if (source.flags & 16384 /* Union */) { - if (result = eachTypeRelatedToType(source, target, reportErrors)) { + if (relation === comparableRelation) { + result = someTypeRelatedToType(source, target, reportErrors); + } + else { + result = eachTypeRelatedToType(source, target, reportErrors); + } + if (result) { return result; } } else if (target.flags & 32768 /* Intersection */) { - if (result = typeRelatedToEachType(source, target, reportErrors)) { + result = typeRelatedToEachType(source, target, reportErrors); + if (result) { return result; } } else { - // It is necessary to try "some" checks on both sides because there may be nested "each" checks + // 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 & 32768 /* Intersection */) { - // If target is a union type the following check will report errors so we suppress them here - if (result = someTypeRelatedToType(source, target, reportErrors && !(target.flags & 16384 /* Union */))) { + // 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; } } if (target.flags & 16384 /* Union */) { - if (result = typeRelatedToSomeType(source, target, reportErrors)) { + if (result = typeRelatedToSomeType(source, target, reportErrors && !(source.flags & 16777726 /* Primitive */))) { return result; } } @@ -19770,8 +20284,8 @@ var ts; } if (source.flags & 16384 /* Union */ && target.flags & 16384 /* Union */ || source.flags & 32768 /* Intersection */ && target.flags & 32768 /* Intersection */) { - if (result = eachTypeRelatedToSomeType(source, target)) { - if (result &= eachTypeRelatedToSomeType(target, source)) { + if (result = eachTypeRelatedToSomeType(source, target, /*reportErrors*/ false)) { + if (result &= eachTypeRelatedToSomeType(target, source, /*reportErrors*/ false)) { return result; } } @@ -19785,7 +20299,8 @@ var ts; function isKnownProperty(type, name) { if (type.flags & 80896 /* ObjectType */) { var resolved = resolveStructuredTypeMembers(type); - if (relation === assignableRelation && (type === globalObjectType || resolved.properties.length === 0) || + if ((relation === assignableRelation || relation === comparableRelation) && + (type === globalObjectType || resolved.properties.length === 0) || resolved.stringIndexInfo || resolved.numberIndexInfo || getPropertyOfType(type, name)) { return true; } @@ -19819,7 +20334,7 @@ var ts; } return false; } - function eachTypeRelatedToSomeType(source, target) { + function eachTypeRelatedToSomeType(source, target, reportErrors) { var result = -1 /* True */; var sourceTypes = source.types; for (var _i = 0, sourceTypes_1 = sourceTypes; _i < sourceTypes_1.length; _i++) { @@ -19834,7 +20349,19 @@ var ts; } function typeRelatedToSomeType(source, target, reportErrors) { var targetTypes = target.types; - for (var i = 0, len = targetTypes.length; i < len; i++) { + var len = targetTypes.length; + // The null and undefined types are guaranteed to be at the end of the constituent type list. In order + // to produce the best possible errors we first check the nullable types, such that the last type we + // check and report errors from is a non-nullable type if one is present. + while (len >= 2 && targetTypes[len - 1].flags & 96 /* Nullable */) { + var related = isRelatedTo(source, targetTypes[len - 1], /*reportErrors*/ false); + if (related) { + return related; + } + len--; + } + // Now check the non-nullable types and report errors on the last one. + for (var i = 0; i < len; i++) { var related = isRelatedTo(source, targetTypes[i], reportErrors && i === len - 1); if (related) { return related; @@ -19857,7 +20384,19 @@ var ts; } function someTypeRelatedToType(source, target, reportErrors) { var sourceTypes = source.types; - for (var i = 0, len = sourceTypes.length; i < len; i++) { + var len = sourceTypes.length; + // The null and undefined types are guaranteed to be at the end of the constituent type list. In order + // to produce the best possible errors we first check the nullable types, such that the last type we + // check and report errors from is a non-nullable type if one is present. + while (len >= 2 && sourceTypes[len - 1].flags & 96 /* Nullable */) { + var related = isRelatedTo(sourceTypes[len - 1], target, /*reportErrors*/ false); + if (related) { + return related; + } + len--; + } + // Now check the non-nullable types and report errors on the last one. + for (var i = 0; i < len; i++) { var related = isRelatedTo(sourceTypes[i], target, reportErrors && i === len - 1); if (related) { return related; @@ -20141,7 +20680,7 @@ var ts; } var result = -1 /* True */; for (var i = 0, len = sourceSignatures.length; i < len; i++) { - var related = compareSignaturesIdentical(sourceSignatures[i], targetSignatures[i], /*partialMatch*/ false, /*ignoreReturnTypes*/ false, isRelatedTo); + var related = compareSignaturesIdentical(sourceSignatures[i], targetSignatures[i], /*partialMatch*/ false, /*ignoreThisTypes*/ false, /*ignoreReturnTypes*/ false, isRelatedTo); if (!related) { return 0 /* False */; } @@ -20216,7 +20755,7 @@ var ts; } return 0 /* False */; } - function enumRelatedTo(source, target) { + function enumRelatedTo(source, target, reportErrors) { if (source.symbol.name !== target.symbol.name || source.symbol.flags & 128 /* ConstEnum */ || target.symbol.flags & 128 /* ConstEnum */) { @@ -20228,7 +20767,9 @@ var ts; if (property.flags & 8 /* EnumMember */) { var targetProperty = getPropertyOfType(targetEnumType, property.name); if (!targetProperty || !(targetProperty.flags & 8 /* EnumMember */)) { - reportError(ts.Diagnostics.Property_0_is_missing_in_type_1, property.name, typeToString(target, /*enclosingDeclaration*/ undefined, 128 /* UseFullyQualifiedType */)); + if (reportErrors) { + reportError(ts.Diagnostics.Property_0_is_missing_in_type_1, property.name, typeToString(target, /*enclosingDeclaration*/ undefined, 128 /* UseFullyQualifiedType */)); + } return 0 /* False */; } } @@ -20343,7 +20884,7 @@ var ts; /** * See signatureRelatedTo, compareSignaturesIdentical */ - function compareSignaturesIdentical(source, target, partialMatch, ignoreReturnTypes, compareTypes) { + function compareSignaturesIdentical(source, target, partialMatch, ignoreThisTypes, ignoreReturnTypes, compareTypes) { // TODO (drosen): De-duplicate code between related functions. if (source === target) { return -1 /* True */; @@ -20364,10 +20905,17 @@ var ts; source = getErasedSignature(source); target = getErasedSignature(target); var result = -1 /* True */; + if (!ignoreThisTypes && source.thisType && target.thisType) { + var related = compareTypes(source.thisType, target.thisType); + if (!related) { + return 0 /* False */; + } + result &= related; + } var targetLen = target.parameters.length; for (var i = 0; i < targetLen; i++) { - var s = isRestParameterIndex(source, i) ? getRestTypeOfSignature(source) : getTypeOfSymbol(source.parameters[i]); - var t = isRestParameterIndex(target, i) ? getRestTypeOfSignature(target) : getTypeOfSymbol(target.parameters[i]); + var s = isRestParameterIndex(source, i) ? getRestTypeOfSignature(source) : getTypeOfParameter(source.parameters[i]); + var t = isRestParameterIndex(target, i) ? getRestTypeOfSignature(target) : getTypeOfParameter(target.parameters[i]); var related = compareTypes(s, t); if (!related) { return 0 /* False */; @@ -20383,15 +20931,31 @@ var ts; return signature.hasRestParameter && parameterIndex >= signature.parameters.length - 1; } function isSupertypeOfEach(candidate, types) { - for (var _i = 0, types_6 = types; _i < types_6.length; _i++) { - var type = types_6[_i]; - if (candidate !== type && !isTypeSubtypeOf(type, candidate)) + for (var _i = 0, types_5 = types; _i < types_5.length; _i++) { + var t = types_5[_i]; + if (candidate !== t && !isTypeSubtypeOf(t, candidate)) return false; } return true; } + function getCombinedFlagsOfTypes(types) { + var flags = 0; + for (var _i = 0, types_6 = types; _i < types_6.length; _i++) { + var t = types_6[_i]; + flags |= t.flags; + } + return flags; + } function getCommonSupertype(types) { - return ts.forEach(types, function (t) { return isSupertypeOfEach(t, types) ? t : undefined; }); + if (!strictNullChecks) { + return ts.forEach(types, function (t) { return isSupertypeOfEach(t, types) ? t : undefined; }); + } + var primaryTypes = ts.filter(types, function (t) { return !(t.flags & 96 /* Nullable */); }); + if (!primaryTypes.length) { + return getUnionType(types); + } + var supertype = ts.forEach(primaryTypes, function (t) { return isSupertypeOfEach(t, primaryTypes) ? t : undefined; }); + return supertype && addNullableKind(supertype, getCombinedFlagsOfTypes(types) & 96 /* Nullable */); } function reportNoCommonSupertypeError(types, errorLocation, errorMessageChainHead) { // The downfallType/bestSupertypeDownfallType is the first type that caused a particular candidate @@ -20433,7 +20997,7 @@ var ts; // 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 & 4096 /* Reference */ && (type.target === globalArrayType || type.target === globalReadonlyArrayType) || - !(type.flags & (32 /* Undefined */ | 64 /* Null */)) && isTypeAssignableTo(type, anyReadonlyArrayType); + !(type.flags & 96 /* Nullable */) && isTypeAssignableTo(type, anyReadonlyArrayType); } function isTupleLikeType(type) { return !!getPropertyOfType(type, "0"); @@ -20448,6 +21012,60 @@ var ts; function isTupleType(type) { return !!(type.flags & 8192 /* Tuple */); } + function getNullableKind(type) { + var flags = type.flags; + if (flags & 16384 /* Union */) { + for (var _i = 0, _a = type.types; _i < _a.length; _i++) { + var t = _a[_i]; + flags |= t.flags; + } + } + return flags & 96 /* Nullable */; + } + function getNullableTypeOfKind(kind) { + return kind & 64 /* Null */ ? kind & 32 /* Undefined */ ? + getUnionType([nullType, undefinedType]) : nullType : undefinedType; + } + function addNullableKind(type, kind) { + if ((getNullableKind(type) & kind) !== kind) { + var types = [type]; + if (kind & 32 /* Undefined */) { + types.push(undefinedType); + } + if (kind & 64 /* Null */) { + types.push(nullType); + } + type = getUnionType(types); + } + return type; + } + function removeNullableKind(type, kind) { + if (type.flags & 16384 /* Union */ && getNullableKind(type) & kind) { + var firstType = void 0; + var types = void 0; + for (var _i = 0, _a = type.types; _i < _a.length; _i++) { + var t = _a[_i]; + if (!(t.flags & kind)) { + if (!firstType) { + firstType = t; + } + else { + if (!types) { + types = [firstType]; + } + types.push(t); + } + } + } + if (firstType) { + type = types ? getUnionType(types) : firstType; + } + } + return type; + } + function getNonNullableType(type) { + return strictNullChecks ? removeNullableKind(type, 96 /* Nullable */) : type; + } /** * Return true if type was inferred from an object literal or written as an object type literal * with no call or construct signatures. @@ -20497,16 +21115,19 @@ var ts; var numberIndexInfo = getIndexInfoOfType(type, 1 /* Number */); return createAnonymousType(type.symbol, members, emptyArray, emptyArray, stringIndexInfo && createIndexInfo(getWidenedType(stringIndexInfo.type), stringIndexInfo.isReadonly), numberIndexInfo && createIndexInfo(getWidenedType(numberIndexInfo.type), numberIndexInfo.isReadonly)); } + function getWidenedConstituentType(type) { + return type.flags & 96 /* Nullable */ ? type : getWidenedType(type); + } function getWidenedType(type) { if (type.flags & 6291456 /* RequiresWidening */) { - if (type.flags & (32 /* Undefined */ | 64 /* Null */)) { + if (type.flags & 96 /* Nullable */) { return anyType; } if (type.flags & 524288 /* ObjectLiteral */) { return getWidenedTypeOfObjectLiteral(type); } if (type.flags & 16384 /* Union */) { - return getUnionType(ts.map(type.types, getWidenedType), /*noSubtypeReduction*/ true); + return getUnionType(ts.map(type.types, getWidenedConstituentType), /*noSubtypeReduction*/ true); } if (isArrayType(type)) { return createArrayType(getWidenedType(type.typeArguments[0])); @@ -20567,22 +21188,25 @@ var ts; var typeAsString = typeToString(getWidenedType(type)); var diagnostic; switch (declaration.kind) { - case 143 /* PropertyDeclaration */: - case 142 /* PropertySignature */: + case 144 /* PropertyDeclaration */: + case 143 /* PropertySignature */: diagnostic = ts.Diagnostics.Member_0_implicitly_has_an_1_type; break; - case 140 /* Parameter */: + case 141 /* 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 217 /* FunctionDeclaration */: - case 145 /* MethodDeclaration */: - case 144 /* MethodSignature */: - case 147 /* GetAccessor */: - case 148 /* SetAccessor */: - case 177 /* FunctionExpression */: - case 178 /* ArrowFunction */: + case 168 /* BindingElement */: + diagnostic = ts.Diagnostics.Binding_element_0_implicitly_has_an_1_type; + break; + case 219 /* FunctionDeclaration */: + case 146 /* MethodDeclaration */: + case 145 /* MethodSignature */: + case 148 /* GetAccessor */: + case 149 /* SetAccessor */: + case 178 /* FunctionExpression */: + case 179 /* ArrowFunction */: if (!declaration.name) { error(declaration, ts.Diagnostics.Function_expression_which_lacks_return_type_annotation_implicitly_has_an_0_return_type, typeAsString); return; @@ -20607,25 +21231,19 @@ var ts; var targetMax = target.parameters.length; var count; if (source.hasRestParameter && target.hasRestParameter) { - count = sourceMax > targetMax ? sourceMax : targetMax; - sourceMax--; - targetMax--; + count = Math.max(sourceMax, targetMax); } else if (source.hasRestParameter) { - sourceMax--; count = targetMax; } else if (target.hasRestParameter) { - targetMax--; count = sourceMax; } else { - count = sourceMax < targetMax ? sourceMax : targetMax; + count = Math.min(sourceMax, targetMax); } for (var i = 0; i < count; i++) { - var s = i < sourceMax ? getTypeOfSymbol(source.parameters[i]) : getRestTypeOfSignature(source); - var t = i < targetMax ? getTypeOfSymbol(target.parameters[i]) : getRestTypeOfSignature(target); - callback(s, t); + callback(getTypeAtPosition(source, i), getTypeAtPosition(target, i)); } } function createInferenceContext(typeParameters, inferUnionTypes) { @@ -20920,10 +21538,21 @@ var ts; return context.inferredTypes; } // EXPRESSION TYPE CHECKING + function createTransientIdentifier(symbol, location) { + var result = ts.createNode(69 /* Identifier */); + result.text = symbol.name; + result.resolvedSymbol = symbol; + result.parent = location; + result.id = -1; + return result; + } function getResolvedSymbol(node) { + if (node.id === -1) { + return node.resolvedSymbol; + } var links = getNodeLinks(node); if (!links.resolvedSymbol) { - links.resolvedSymbol = (!ts.nodeIsMissing(node) && resolveName(node, node.text, 107455 /* Value */ | 1048576 /* ExportValue */, ts.Diagnostics.Cannot_find_name_0, node)) || unknownSymbol; + links.resolvedSymbol = !ts.nodeIsMissing(node) && resolveName(node, node.text, 107455 /* Value */ | 1048576 /* ExportValue */, ts.Diagnostics.Cannot_find_name_0, node) || unknownSymbol; } return links.resolvedSymbol; } @@ -20933,10 +21562,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 156 /* TypeQuery */: + case 157 /* TypeQuery */: return true; case 69 /* Identifier */: - case 137 /* QualifiedName */: + case 138 /* QualifiedName */: node = node.parent; continue; default: @@ -20945,174 +21574,294 @@ var ts; } ts.Debug.fail("should not get here"); } + // Return the assignment key for a "dotted name" (i.e. a sequence of identifiers + // separated by dots). The key consists of the id of the symbol referenced by the + // 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 getAssignmentKey(node) { + if (node.kind === 69 /* Identifier */) { + var symbol = getResolvedSymbol(node); + return symbol !== unknownSymbol ? "" + getSymbolId(symbol) : undefined; + } + if (node.kind === 97 /* ThisKeyword */) { + return "0"; + } + if (node.kind === 171 /* PropertyAccessExpression */) { + var key = getAssignmentKey(node.expression); + return key && key + "." + node.name.text; + } + return undefined; + } function hasInitializer(node) { return !!(node.initializer || ts.isBindingPattern(node.parent) && hasInitializer(node.parent.parent)); } - // Check if a given variable is assigned within a given syntax node - function isVariableAssignedWithin(symbol, node) { - var links = getNodeLinks(node); - if (links.assignmentChecks) { - var cachedResult = links.assignmentChecks[symbol.id]; - if (cachedResult !== undefined) { - return cachedResult; - } - } - else { - links.assignmentChecks = {}; - } - return links.assignmentChecks[symbol.id] = isAssignedIn(node); - function isAssignedInBinaryExpression(node) { - if (node.operatorToken.kind >= 56 /* FirstAssignment */ && node.operatorToken.kind <= 68 /* LastAssignment */) { - var n = skipParenthesizedNodes(node.left); - if (n.kind === 69 /* Identifier */ && getResolvedSymbol(n) === symbol) { - return true; + // For a given node compute a map of which dotted names are assigned within + // the node. + function getAssignmentMap(node) { + var assignmentMap = {}; + visit(node); + return assignmentMap; + function visitReference(node) { + if (isAssignmentTarget(node) || isCompoundAssignmentTarget(node)) { + var key = getAssignmentKey(node); + if (key) { + assignmentMap[key] = true; } } - return ts.forEachChild(node, isAssignedIn); + ts.forEachChild(node, visit); } - function isAssignedInVariableDeclaration(node) { - if (!ts.isBindingPattern(node.name) && getSymbolOfNode(node) === symbol && hasInitializer(node)) { - return true; + function visitVariableDeclaration(node) { + if (!ts.isBindingPattern(node.name) && hasInitializer(node)) { + assignmentMap[getSymbolId(getSymbolOfNode(node))] = true; } - return ts.forEachChild(node, isAssignedIn); + ts.forEachChild(node, visit); } - function isAssignedIn(node) { + function visit(node) { switch (node.kind) { - case 185 /* BinaryExpression */: - return isAssignedInBinaryExpression(node); - case 215 /* VariableDeclaration */: - case 167 /* BindingElement */: - return isAssignedInVariableDeclaration(node); - case 165 /* ObjectBindingPattern */: - case 166 /* ArrayBindingPattern */: - case 168 /* ArrayLiteralExpression */: - case 169 /* ObjectLiteralExpression */: - case 170 /* PropertyAccessExpression */: - case 171 /* ElementAccessExpression */: - case 172 /* CallExpression */: - case 173 /* NewExpression */: - case 175 /* TypeAssertionExpression */: - case 193 /* AsExpression */: - case 176 /* ParenthesizedExpression */: - case 183 /* PrefixUnaryExpression */: - case 179 /* DeleteExpression */: - case 182 /* AwaitExpression */: - case 180 /* TypeOfExpression */: - case 181 /* VoidExpression */: - case 184 /* PostfixUnaryExpression */: - case 188 /* YieldExpression */: - case 186 /* ConditionalExpression */: - case 189 /* SpreadElementExpression */: - case 196 /* Block */: - case 197 /* VariableStatement */: - case 199 /* ExpressionStatement */: - case 200 /* IfStatement */: - case 201 /* DoStatement */: - case 202 /* WhileStatement */: - case 203 /* ForStatement */: - case 204 /* ForInStatement */: - case 205 /* ForOfStatement */: - case 208 /* ReturnStatement */: - case 209 /* WithStatement */: - case 210 /* SwitchStatement */: - case 245 /* CaseClause */: - case 246 /* DefaultClause */: - case 211 /* LabeledStatement */: - case 212 /* ThrowStatement */: - case 213 /* TryStatement */: - case 248 /* CatchClause */: - case 237 /* JsxElement */: - case 238 /* JsxSelfClosingElement */: - case 242 /* JsxAttribute */: - case 243 /* JsxSpreadAttribute */: - case 239 /* JsxOpeningElement */: - case 244 /* JsxExpression */: - return ts.forEachChild(node, isAssignedIn); + case 69 /* Identifier */: + case 171 /* PropertyAccessExpression */: + visitReference(node); + break; + case 217 /* VariableDeclaration */: + case 168 /* BindingElement */: + visitVariableDeclaration(node); + break; + case 186 /* BinaryExpression */: + case 166 /* ObjectBindingPattern */: + case 167 /* ArrayBindingPattern */: + case 169 /* ArrayLiteralExpression */: + case 170 /* ObjectLiteralExpression */: + case 172 /* ElementAccessExpression */: + case 173 /* CallExpression */: + case 174 /* NewExpression */: + case 176 /* TypeAssertionExpression */: + case 194 /* AsExpression */: + case 195 /* NonNullExpression */: + case 177 /* ParenthesizedExpression */: + case 184 /* PrefixUnaryExpression */: + case 180 /* DeleteExpression */: + case 183 /* AwaitExpression */: + case 181 /* TypeOfExpression */: + case 182 /* VoidExpression */: + case 185 /* PostfixUnaryExpression */: + case 189 /* YieldExpression */: + case 187 /* ConditionalExpression */: + case 190 /* SpreadElementExpression */: + case 198 /* Block */: + case 199 /* VariableStatement */: + case 201 /* ExpressionStatement */: + case 202 /* IfStatement */: + case 203 /* DoStatement */: + case 204 /* WhileStatement */: + case 205 /* ForStatement */: + case 206 /* ForInStatement */: + case 207 /* ForOfStatement */: + case 210 /* ReturnStatement */: + case 211 /* WithStatement */: + case 212 /* SwitchStatement */: + case 226 /* CaseBlock */: + case 248 /* CaseClause */: + case 249 /* DefaultClause */: + case 213 /* LabeledStatement */: + case 214 /* ThrowStatement */: + case 215 /* TryStatement */: + case 251 /* CatchClause */: + case 240 /* JsxElement */: + case 241 /* JsxSelfClosingElement */: + case 245 /* JsxAttribute */: + case 246 /* JsxSpreadAttribute */: + case 242 /* JsxOpeningElement */: + case 247 /* JsxExpression */: + ts.forEachChild(node, visit); + break; } - return false; } } - // Get the narrowed type of a given symbol at a given location - function getNarrowedTypeOfSymbol(symbol, node) { - var type = getTypeOfSymbol(symbol); - // Only narrow when symbol is variable of type any or an object, union, or type parameter type - if (node && symbol.flags & 3 /* Variable */) { - if (isTypeAny(type) || type.flags & (80896 /* ObjectType */ | 16384 /* Union */ | 512 /* TypeParameter */)) { - var declaration = ts.getDeclarationOfKind(symbol, 215 /* VariableDeclaration */); - var top_1 = declaration && getDeclarationContainer(declaration); - var originalType = type; - var nodeStack = []; - loop: while (node.parent) { - var child = node; - node = node.parent; - switch (node.kind) { - case 200 /* IfStatement */: - case 186 /* ConditionalExpression */: - case 185 /* BinaryExpression */: - nodeStack.push({ node: node, child: child }); - break; - case 252 /* SourceFile */: - case 222 /* ModuleDeclaration */: - // Stop at the first containing file or module declaration - break loop; - } - if (node === top_1) { - break; - } - } - var nodes = void 0; - while (nodes = nodeStack.pop()) { - var node_1 = nodes.node, child = nodes.child; - switch (node_1.kind) { - case 200 /* IfStatement */: - // In a branch of an if statement, narrow based on controlling expression - if (child !== node_1.expression) { - type = narrowType(type, node_1.expression, /*assumeTrue*/ child === node_1.thenStatement); - } - break; - case 186 /* ConditionalExpression */: - // In a branch of a conditional expression, narrow based on controlling condition - if (child !== node_1.condition) { - type = narrowType(type, node_1.condition, /*assumeTrue*/ child === node_1.whenTrue); - } - break; - case 185 /* BinaryExpression */: - // In the right operand of an && or ||, narrow based on left operand - if (child === node_1.right) { - if (node_1.operatorToken.kind === 51 /* AmpersandAmpersandToken */) { - type = narrowType(type, node_1.left, /*assumeTrue*/ true); - } - else if (node_1.operatorToken.kind === 52 /* BarBarToken */) { - type = narrowType(type, node_1.left, /*assumeTrue*/ false); - } - } - break; - default: - ts.Debug.fail("Unreachable!"); - } - // Use original type if construct contains assignments to variable - if (type !== originalType && isVariableAssignedWithin(symbol, node_1)) { - type = originalType; - } - } - // Preserve old top-level behavior - if the branch is really an empty set, revert to prior type - if (type === emptyUnionType) { - type = originalType; - } + function isReferenceAssignedWithin(reference, node) { + if (reference.kind !== 97 /* ThisKeyword */) { + var key = getAssignmentKey(reference); + if (key) { + var links = getNodeLinks(node); + return (links.assignmentMap || (links.assignmentMap = getAssignmentMap(node)))[key]; } } - return type; - function narrowTypeByEquality(type, expr, assumeTrue) { - // Check that we have 'typeof ' on the left and string literal on the right - if (expr.left.kind !== 180 /* TypeOfExpression */ || expr.right.kind !== 9 /* StringLiteral */) { + return false; + } + function isAnyPartOfReferenceAssignedWithin(reference, node) { + while (true) { + if (isReferenceAssignedWithin(reference, node)) { + return true; + } + if (reference.kind !== 171 /* PropertyAccessExpression */) { + return false; + } + reference = reference.expression; + } + } + function isNullOrUndefinedLiteral(node) { + return node.kind === 93 /* NullKeyword */ || + node.kind === 69 /* Identifier */ && getResolvedSymbol(node) === undefinedSymbol; + } + function getLeftmostIdentifierOrThis(node) { + switch (node.kind) { + case 69 /* Identifier */: + case 97 /* ThisKeyword */: + return node; + case 171 /* PropertyAccessExpression */: + return getLeftmostIdentifierOrThis(node.expression); + } + return undefined; + } + function isMatchingReference(source, target) { + if (source.kind === target.kind) { + switch (source.kind) { + case 69 /* Identifier */: + return getResolvedSymbol(source) === getResolvedSymbol(target); + case 97 /* ThisKeyword */: + return true; + case 171 /* PropertyAccessExpression */: + return source.name.text === target.name.text && + isMatchingReference(source.expression, target.expression); + } + } + return false; + } + // Get the narrowed type of a given symbol at a given location + function getNarrowedTypeOfReference(type, reference) { + if (!(type.flags & (1 /* Any */ | 80896 /* ObjectType */ | 16384 /* Union */ | 512 /* TypeParameter */))) { + return type; + } + var leftmostNode = getLeftmostIdentifierOrThis(reference); + if (!leftmostNode) { + return type; + } + var top; + if (leftmostNode.kind === 69 /* Identifier */) { + var leftmostSymbol = getExportSymbolOfValueSymbolIfExported(getResolvedSymbol(leftmostNode)); + if (!leftmostSymbol) { return type; } + var declaration = leftmostSymbol.valueDeclaration; + if (!declaration || declaration.kind !== 217 /* VariableDeclaration */ && declaration.kind !== 141 /* Parameter */ && declaration.kind !== 168 /* BindingElement */) { + return type; + } + top = getDeclarationContainer(declaration); + } + var originalType = type; + var nodeStack = []; + var node = reference; + loop: while (node.parent) { + var child = node; + node = node.parent; + switch (node.kind) { + case 202 /* IfStatement */: + case 187 /* ConditionalExpression */: + case 186 /* BinaryExpression */: + nodeStack.push({ node: node, child: child }); + break; + case 255 /* SourceFile */: + case 224 /* ModuleDeclaration */: + break loop; + default: + if (node === top || ts.isFunctionLikeKind(node.kind)) { + break loop; + } + break; + } + } + var nodes; + while (nodes = nodeStack.pop()) { + var node_1 = nodes.node, child = nodes.child; + switch (node_1.kind) { + case 202 /* IfStatement */: + // In a branch of an if statement, narrow based on controlling expression + if (child !== node_1.expression) { + type = narrowType(type, node_1.expression, /*assumeTrue*/ child === node_1.thenStatement); + } + break; + case 187 /* ConditionalExpression */: + // In a branch of a conditional expression, narrow based on controlling condition + if (child !== node_1.condition) { + type = narrowType(type, node_1.condition, /*assumeTrue*/ child === node_1.whenTrue); + } + break; + case 186 /* BinaryExpression */: + // In the right operand of an && or ||, narrow based on left operand + if (child === node_1.right) { + if (node_1.operatorToken.kind === 51 /* AmpersandAmpersandToken */) { + type = narrowType(type, node_1.left, /*assumeTrue*/ true); + } + else if (node_1.operatorToken.kind === 52 /* BarBarToken */) { + type = narrowType(type, node_1.left, /*assumeTrue*/ false); + } + } + break; + default: + ts.Debug.fail("Unreachable!"); + } + // Use original type if construct contains assignments to variable + if (type !== originalType && isAnyPartOfReferenceAssignedWithin(reference, node_1)) { + type = originalType; + } + } + // Preserve old top-level behavior - if the branch is really an empty set, revert to prior type + if (type === emptyUnionType) { + type = originalType; + } + return type; + function narrowTypeByTruthiness(type, expr, assumeTrue) { + return strictNullChecks && assumeTrue && isMatchingReference(expr, reference) ? getNonNullableType(type) : type; + } + function narrowTypeByBinaryExpression(type, expr, assumeTrue) { + switch (expr.operatorToken.kind) { + case 30 /* EqualsEqualsToken */: + case 31 /* ExclamationEqualsToken */: + case 32 /* EqualsEqualsEqualsToken */: + case 33 /* ExclamationEqualsEqualsToken */: + if (isNullOrUndefinedLiteral(expr.right)) { + return narrowTypeByNullCheck(type, expr, assumeTrue); + } + if (expr.left.kind === 181 /* TypeOfExpression */ && expr.right.kind === 9 /* StringLiteral */) { + return narrowTypeByTypeof(type, expr, assumeTrue); + } + break; + case 51 /* AmpersandAmpersandToken */: + return narrowTypeByAnd(type, expr, assumeTrue); + case 52 /* BarBarToken */: + return narrowTypeByOr(type, expr, assumeTrue); + case 91 /* InstanceOfKeyword */: + return narrowTypeByInstanceof(type, expr, assumeTrue); + } + return type; + } + function narrowTypeByNullCheck(type, expr, assumeTrue) { + // We have '==', '!=', '===', or '!==' operator with 'null' or 'undefined' on the right + var operator = expr.operatorToken.kind; + if (operator === 31 /* ExclamationEqualsToken */ || operator === 33 /* ExclamationEqualsEqualsToken */) { + assumeTrue = !assumeTrue; + } + if (!strictNullChecks || !isMatchingReference(expr.left, reference)) { + return type; + } + var doubleEquals = operator === 30 /* EqualsEqualsToken */ || operator === 31 /* ExclamationEqualsToken */; + var exprNullableKind = doubleEquals ? 96 /* Nullable */ : + expr.right.kind === 93 /* NullKeyword */ ? 64 /* Null */ : 32 /* Undefined */; + if (assumeTrue) { + var nullableKind = getNullableKind(type) & exprNullableKind; + return nullableKind ? getNullableTypeOfKind(nullableKind) : type; + } + return removeNullableKind(type, exprNullableKind); + } + function narrowTypeByTypeof(type, expr, assumeTrue) { + // We have '==', '!=', '====', or !==' operator with 'typeof xxx' on the left + // and string literal on the right var left = expr.left; var right = expr.right; - if (left.expression.kind !== 69 /* Identifier */ || getResolvedSymbol(left.expression) !== symbol) { + if (!isMatchingReference(left.expression, reference)) { return type; } - if (expr.operatorToken.kind === 33 /* ExclamationEqualsEqualsToken */) { + if (expr.operatorToken.kind === 31 /* ExclamationEqualsToken */ || + expr.operatorToken.kind === 33 /* ExclamationEqualsEqualsToken */) { assumeTrue = !assumeTrue; } var typeInfo = primitiveTypeInfo[right.text]; @@ -21172,7 +21921,7 @@ var ts; } function narrowTypeByInstanceof(type, expr, assumeTrue) { // Check that type is not any, assumed result is true, and we have variable symbol on the left - if (isTypeAny(type) || expr.left.kind !== 69 /* Identifier */ || getResolvedSymbol(expr.left) !== symbol) { + if (isTypeAny(type) || !isMatchingReference(expr.left, reference)) { return type; } // Check that right operand is a function type with a prototype property @@ -21222,7 +21971,8 @@ var ts; return getUnionType(assignableConstituents); } } - if (isTypeAssignableTo(narrowedTypeCandidate, originalType)) { + var targetType = originalType.flags & 512 /* TypeParameter */ ? getApparentType(originalType) : originalType; + if (isTypeAssignableTo(narrowedTypeCandidate, targetType)) { // Narrow to the target type if it's assignable to the current type return narrowedTypeCandidate; } @@ -21238,59 +21988,38 @@ var ts; return type; } if (ts.isIdentifierTypePredicate(predicate)) { - if (callExpression.arguments[predicate.parameterIndex] && - getSymbolAtTypePredicatePosition(callExpression.arguments[predicate.parameterIndex]) === symbol) { + var predicateArgument = callExpression.arguments[predicate.parameterIndex]; + if (predicateArgument && isMatchingReference(predicateArgument, reference)) { return getNarrowedType(type, predicate.type, assumeTrue); } } else { var invokedExpression = skipParenthesizedNodes(callExpression.expression); - return narrowTypeByThisTypePredicate(type, predicate, invokedExpression, assumeTrue); - } - return type; - } - function narrowTypeByThisTypePredicate(type, predicate, invokedExpression, assumeTrue) { - if (invokedExpression.kind === 171 /* ElementAccessExpression */ || invokedExpression.kind === 170 /* PropertyAccessExpression */) { - var accessExpression = invokedExpression; - var possibleIdentifier = skipParenthesizedNodes(accessExpression.expression); - if (possibleIdentifier.kind === 69 /* Identifier */ && getSymbolAtTypePredicatePosition(possibleIdentifier) === symbol) { - return getNarrowedType(type, predicate.type, assumeTrue); + if (invokedExpression.kind === 172 /* ElementAccessExpression */ || invokedExpression.kind === 171 /* PropertyAccessExpression */) { + var accessExpression = invokedExpression; + var possibleReference = skipParenthesizedNodes(accessExpression.expression); + if (isMatchingReference(possibleReference, reference)) { + return getNarrowedType(type, predicate.type, assumeTrue); + } } } return type; } - function getSymbolAtTypePredicatePosition(expr) { - expr = skipParenthesizedNodes(expr); - switch (expr.kind) { - case 69 /* Identifier */: - case 170 /* PropertyAccessExpression */: - return getSymbolOfEntityNameOrPropertyAccessExpression(expr); - } - } // Narrow the given type based on the given expression having the assumed boolean value. The returned type // will be a subtype or the same type as the argument. function narrowType(type, expr, assumeTrue) { switch (expr.kind) { - case 172 /* CallExpression */: + case 69 /* Identifier */: + case 97 /* ThisKeyword */: + case 171 /* PropertyAccessExpression */: + return narrowTypeByTruthiness(type, expr, assumeTrue); + case 173 /* CallExpression */: return narrowTypeByTypePredicate(type, expr, assumeTrue); - case 176 /* ParenthesizedExpression */: + case 177 /* ParenthesizedExpression */: return narrowType(type, expr.expression, assumeTrue); - case 185 /* BinaryExpression */: - var operator = expr.operatorToken.kind; - if (operator === 32 /* EqualsEqualsEqualsToken */ || operator === 33 /* ExclamationEqualsEqualsToken */) { - return narrowTypeByEquality(type, expr, assumeTrue); - } - else if (operator === 51 /* AmpersandAmpersandToken */) { - return narrowTypeByAnd(type, expr, assumeTrue); - } - else if (operator === 52 /* BarBarToken */) { - return narrowTypeByOr(type, expr, assumeTrue); - } - else if (operator === 91 /* InstanceOfKeyword */) { - return narrowTypeByInstanceof(type, expr, assumeTrue); - } - break; - case 183 /* PrefixUnaryExpression */: + case 186 /* BinaryExpression */: + return narrowTypeByBinaryExpression(type, expr, assumeTrue); + case 184 /* PrefixUnaryExpression */: if (expr.operator === 49 /* ExclamationToken */) { return narrowType(type, expr.operand, !assumeTrue); } @@ -21299,12 +22028,124 @@ var ts; return type; } } + function getTypeOfSymbolAtLocation(symbol, location) { + // The language service will always care about the narrowed type of a symbol, because that is + // the type the language says the symbol should have. + var type = getTypeOfSymbol(symbol); + if (location.kind === 69 /* Identifier */) { + if (ts.isRightSideOfQualifiedNameOrPropertyAccess(location)) { + location = location.parent; + } + // If location is an identifier or property access that references the given + // symbol, use the location as the reference with respect to which we narrow. + if (ts.isExpression(location)) { + checkExpression(location); + if (getNodeLinks(location).resolvedSymbol === symbol) { + return getNarrowedTypeOfReference(type, location); + } + } + } + // 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. To answer that question we manufacture a transient + // identifier at the location and narrow with respect to that identifier. + return getNarrowedTypeOfReference(type, createTransientIdentifier(symbol, location)); + } function skipParenthesizedNodes(expression) { - while (expression.kind === 176 /* ParenthesizedExpression */) { + while (expression.kind === 177 /* ParenthesizedExpression */) { expression = expression.expression; } return expression; } + function findFirstAssignment(symbol, container) { + return visit(ts.isFunctionLike(container) ? container.body : container); + function visit(node) { + switch (node.kind) { + case 69 /* Identifier */: + var assignment = getAssignmentRoot(node); + return assignment && getResolvedSymbol(node) === symbol ? assignment : undefined; + case 186 /* BinaryExpression */: + case 217 /* VariableDeclaration */: + case 168 /* BindingElement */: + case 166 /* ObjectBindingPattern */: + case 167 /* ArrayBindingPattern */: + case 169 /* ArrayLiteralExpression */: + case 170 /* ObjectLiteralExpression */: + case 171 /* PropertyAccessExpression */: + case 172 /* ElementAccessExpression */: + case 173 /* CallExpression */: + case 174 /* NewExpression */: + case 176 /* TypeAssertionExpression */: + case 194 /* AsExpression */: + case 195 /* NonNullExpression */: + case 177 /* ParenthesizedExpression */: + case 184 /* PrefixUnaryExpression */: + case 180 /* DeleteExpression */: + case 183 /* AwaitExpression */: + case 181 /* TypeOfExpression */: + case 182 /* VoidExpression */: + case 185 /* PostfixUnaryExpression */: + case 189 /* YieldExpression */: + case 187 /* ConditionalExpression */: + case 190 /* SpreadElementExpression */: + case 199 /* VariableStatement */: + case 201 /* ExpressionStatement */: + case 202 /* IfStatement */: + case 203 /* DoStatement */: + case 204 /* WhileStatement */: + case 205 /* ForStatement */: + case 206 /* ForInStatement */: + case 207 /* ForOfStatement */: + case 210 /* ReturnStatement */: + case 211 /* WithStatement */: + case 212 /* SwitchStatement */: + case 226 /* CaseBlock */: + case 248 /* CaseClause */: + case 249 /* DefaultClause */: + case 213 /* LabeledStatement */: + case 214 /* ThrowStatement */: + case 215 /* TryStatement */: + case 251 /* CatchClause */: + case 240 /* JsxElement */: + case 241 /* JsxSelfClosingElement */: + case 245 /* JsxAttribute */: + case 246 /* JsxSpreadAttribute */: + case 242 /* JsxOpeningElement */: + case 247 /* JsxExpression */: + case 198 /* Block */: + case 255 /* SourceFile */: + return ts.forEachChild(node, visit); + } + return undefined; + } + } + function checkVariableAssignedBefore(symbol, reference) { + if (!(symbol.flags & 3 /* Variable */)) { + return; + } + var declaration = symbol.valueDeclaration; + if (!declaration || declaration.kind !== 217 /* VariableDeclaration */ || declaration.initializer || ts.isInAmbientContext(declaration)) { + return; + } + var parentParentKind = declaration.parent.parent.kind; + if (parentParentKind === 207 /* ForOfStatement */ || parentParentKind === 206 /* ForInStatement */) { + return; + } + var declarationContainer = ts.getContainingFunction(declaration) || ts.getSourceFileOfNode(declaration); + var referenceContainer = ts.getContainingFunction(reference) || ts.getSourceFileOfNode(reference); + if (declarationContainer !== referenceContainer) { + return; + } + var links = getSymbolLinks(symbol); + if (!links.firstAssignmentChecked) { + links.firstAssignmentChecked = true; + links.firstAssignment = findFirstAssignment(symbol, declarationContainer); + } + if (links.firstAssignment && links.firstAssignment.end <= reference.pos) { + return; + } + error(reference, ts.Diagnostics.Variable_0_is_used_before_being_assigned, symbolToString(symbol)); + } function checkIdentifier(node) { var symbol = getResolvedSymbol(node); // As noted in ECMAScript 6 language spec, arrow functions never have an arguments objects. @@ -21315,7 +22156,7 @@ var ts; // can explicitly bound arguments objects if (symbol === argumentsSymbol) { var container = ts.getContainingFunction(node); - if (container.kind === 178 /* ArrowFunction */) { + if (container.kind === 179 /* ArrowFunction */) { if (languageVersion < 2 /* ES6 */) { error(node, ts.Diagnostics.The_arguments_object_cannot_be_referenced_in_an_arrow_function_in_ES3_and_ES5_Consider_using_a_standard_function_expression); } @@ -21333,7 +22174,7 @@ var ts; // behavior of class names in ES6. if (languageVersion === 2 /* ES6 */ && localOrExportSymbol.flags & 32 /* Class */ - && localOrExportSymbol.valueDeclaration.kind === 218 /* ClassDeclaration */ + && localOrExportSymbol.valueDeclaration.kind === 220 /* ClassDeclaration */ && ts.nodeIsDecorated(localOrExportSymbol.valueDeclaration)) { var container = ts.getContainingClass(node); while (container !== undefined) { @@ -21348,7 +22189,11 @@ var ts; checkCollisionWithCapturedSuperVariable(node, node); checkCollisionWithCapturedThisVariable(node, node); checkNestedBlockScopedBinding(node, symbol); - return getNarrowedTypeOfSymbol(localOrExportSymbol, node); + var type = getTypeOfSymbol(localOrExportSymbol); + if (strictNullChecks && !isAssignmentTarget(node) && !(type.flags & 1 /* Any */) && !(getNullableKind(type) & 32 /* Undefined */)) { + checkVariableAssignedBefore(symbol, node); + } + return getNarrowedTypeOfReference(type, node); } function isInsideFunction(node, threshold) { var current = node; @@ -21363,7 +22208,7 @@ var ts; function checkNestedBlockScopedBinding(node, symbol) { if (languageVersion >= 2 /* ES6 */ || (symbol.flags & (2 /* BlockScopedVariable */ | 32 /* Class */)) === 0 || - symbol.valueDeclaration.parent.kind === 248 /* CatchClause */) { + symbol.valueDeclaration.parent.kind === 251 /* CatchClause */) { return; } // 1. walk from the use site up to the declaration and check @@ -21388,8 +22233,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 === 203 /* ForStatement */ && - ts.getAncestor(symbol.valueDeclaration, 216 /* VariableDeclarationList */).parent === container && + if (container.kind === 205 /* ForStatement */ && + ts.getAncestor(symbol.valueDeclaration, 218 /* VariableDeclarationList */).parent === container && isAssignedInBodyOfForStatement(node, container)) { getNodeLinks(symbol.valueDeclaration).flags |= 2097152 /* NeedsLoopOutParameter */; } @@ -21403,15 +22248,15 @@ var ts; function isAssignedInBodyOfForStatement(node, container) { var current = node; // skip parenthesized nodes - while (current.parent.kind === 176 /* ParenthesizedExpression */) { + while (current.parent.kind === 177 /* ParenthesizedExpression */) { current = current.parent; } // check if node is used as LHS in some assignment expression var isAssigned = false; - if (current.parent.kind === 185 /* BinaryExpression */) { - isAssigned = current.parent.left === current && ts.isAssignmentOperator(current.parent.operatorToken.kind); + if (isAssignmentTarget(current)) { + isAssigned = true; } - if ((current.parent.kind === 183 /* PrefixUnaryExpression */ || current.parent.kind === 184 /* PostfixUnaryExpression */)) { + else if ((current.parent.kind === 184 /* PrefixUnaryExpression */ || current.parent.kind === 185 /* PostfixUnaryExpression */)) { var expr = current.parent; isAssigned = expr.operator === 41 /* PlusPlusToken */ || expr.operator === 42 /* MinusMinusToken */; } @@ -21432,7 +22277,7 @@ var ts; } function captureLexicalThis(node, container) { getNodeLinks(node).flags |= 2 /* LexicalThis */; - if (container.kind === 143 /* PropertyDeclaration */ || container.kind === 146 /* Constructor */) { + if (container.kind === 144 /* PropertyDeclaration */ || container.kind === 147 /* Constructor */) { var classNode = container.parent; getNodeLinks(classNode).flags |= 4 /* CaptureThis */; } @@ -21480,7 +22325,7 @@ var ts; // tell whether 'this' needs to be captured. var container = ts.getThisContainer(node, /* includeArrowFunctions */ true); var needToCaptureLexicalThis = false; - if (container.kind === 146 /* Constructor */) { + if (container.kind === 147 /* Constructor */) { var containingClassDecl = container.parent; var baseTypeNode = ts.getClassExtendsHeritageClauseElement(containingClassDecl); // If a containing class does not have extends clause or the class extends null @@ -21501,41 +22346,60 @@ var ts; } } // Now skip arrow functions to get the "real" owner of 'this'. - if (container.kind === 178 /* ArrowFunction */) { + if (container.kind === 179 /* 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 */); } switch (container.kind) { - case 222 /* ModuleDeclaration */: + case 224 /* 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 221 /* EnumDeclaration */: + case 223 /* 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 146 /* Constructor */: + case 147 /* Constructor */: if (isInConstructorArgumentInitializer(node, container)) { error(node, ts.Diagnostics.this_cannot_be_referenced_in_constructor_arguments); } break; - case 143 /* PropertyDeclaration */: - case 142 /* PropertySignature */: + case 144 /* PropertyDeclaration */: + case 143 /* PropertySignature */: if (container.flags & 32 /* Static */) { error(node, ts.Diagnostics.this_cannot_be_referenced_in_a_static_property_initializer); } break; - case 138 /* ComputedPropertyName */: + case 139 /* ComputedPropertyName */: error(node, ts.Diagnostics.this_cannot_be_referenced_in_a_computed_property_name); break; } if (needToCaptureLexicalThis) { captureLexicalThis(node, container); } + if (ts.isFunctionLike(container)) { + var type = getContextuallyTypedThisType(container); + if (type) { + return type; + } + var signature = getSignatureFromDeclaration(container); + if (signature.thisType) { + return signature.thisType; + } + if (container.parent && container.parent.kind === 170 /* ObjectLiteralExpression */) { + // Note: this works because object literal methods are deferred, + // which means that the type of the containing object literal is already known. + var type_1 = checkExpressionCached(container.parent); + if (type_1) { + return type_1; + } + } + } if (ts.isClassLike(container.parent)) { var symbol = getSymbolOfNode(container.parent); - return container.flags & 32 /* Static */ ? getTypeOfSymbol(symbol) : getDeclaredTypeOfSymbol(symbol).thisType; + var type = container.flags & 32 /* Static */ ? getTypeOfSymbol(symbol) : getDeclaredTypeOfSymbol(symbol).thisType; + return getNarrowedTypeOfReference(type, node); } if (ts.isInJavaScriptFile(node)) { var type = getTypeForThisExpressionFromJSDoc(container); @@ -21544,7 +22408,7 @@ var ts; } // 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 === 177 /* FunctionExpression */) { + if (container.kind === 178 /* FunctionExpression */) { if (ts.getSpecialPropertyAssignmentKind(container.parent) === 3 /* PrototypeProperty */) { // Get the 'x' of 'x.prototype.y = f' (here, 'f' is 'container') var className = container.parent // x.prototype.y = f @@ -21558,32 +22422,36 @@ var ts; } } } + if (compilerOptions.noImplicitThis) { + // With noImplicitThis, functions may not reference 'this' if it has type 'any' + error(node, ts.Diagnostics.this_implicitly_has_type_any_because_it_does_not_have_a_type_annotation); + } return anyType; } function getTypeForThisExpressionFromJSDoc(node) { var typeTag = ts.getJSDocTypeTag(node); - if (typeTag && typeTag.typeExpression && typeTag.typeExpression.type && typeTag.typeExpression.type.kind === 265 /* JSDocFunctionType */) { + if (typeTag && typeTag.typeExpression && typeTag.typeExpression.type && typeTag.typeExpression.type.kind === 268 /* JSDocFunctionType */) { var jsDocFunctionType = typeTag.typeExpression.type; - if (jsDocFunctionType.parameters.length > 0 && jsDocFunctionType.parameters[0].type.kind === 268 /* JSDocThisType */) { + if (jsDocFunctionType.parameters.length > 0 && jsDocFunctionType.parameters[0].type.kind === 271 /* JSDocThisType */) { return getTypeFromTypeNode(jsDocFunctionType.parameters[0].type); } } } function isInConstructorArgumentInitializer(node, constructorDecl) { for (var n = node; n && n !== constructorDecl; n = n.parent) { - if (n.kind === 140 /* Parameter */) { + if (n.kind === 141 /* Parameter */) { return true; } } return false; } function checkSuperExpression(node) { - var isCallExpression = node.parent.kind === 172 /* CallExpression */ && node.parent.expression === node; + var isCallExpression = node.parent.kind === 173 /* CallExpression */ && node.parent.expression === node; var container = ts.getSuperContainer(node, /*stopOnFunctions*/ true); var needToCaptureLexicalThis = false; if (!isCallExpression) { // adjust the container reference in case if super is used inside arrow functions with arbitrary deep nesting - while (container && container.kind === 178 /* ArrowFunction */) { + while (container && container.kind === 179 /* ArrowFunction */) { container = ts.getSuperContainer(container, /*stopOnFunctions*/ true); needToCaptureLexicalThis = languageVersion < 2 /* ES6 */; } @@ -21597,16 +22465,16 @@ var ts; // [super.foo()]() {} // } var current = node; - while (current && current !== container && current.kind !== 138 /* ComputedPropertyName */) { + while (current && current !== container && current.kind !== 139 /* ComputedPropertyName */) { current = current.parent; } - if (current && current.kind === 138 /* ComputedPropertyName */) { + if (current && current.kind === 139 /* 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 === 169 /* ObjectLiteralExpression */)) { + else if (!container || !container.parent || !(ts.isClassLike(container.parent) || container.parent.kind === 170 /* ObjectLiteralExpression */)) { error(node, ts.Diagnostics.super_can_only_be_referenced_in_members_of_derived_classes_or_object_literal_expressions); } else { @@ -21677,7 +22545,7 @@ 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 === 145 /* MethodDeclaration */ && container.flags & 256 /* Async */) { + if (container.kind === 146 /* MethodDeclaration */ && container.flags & 256 /* Async */) { if (ts.isSuperPropertyOrElementAccess(node.parent) && isAssignmentTarget(node.parent)) { getNodeLinks(container).flags |= 4096 /* AsyncMethodWithSuperBinding */; } @@ -21691,7 +22559,7 @@ var ts; // in this case they should also use correct lexical this captureLexicalThis(node.parent, container); } - if (container.parent.kind === 169 /* ObjectLiteralExpression */) { + if (container.parent.kind === 170 /* ObjectLiteralExpression */) { if (languageVersion < 2 /* ES6 */) { error(node, ts.Diagnostics.super_is_only_allowed_in_members_of_object_literal_expressions_when_option_target_is_ES2015_or_higher); return unknownType; @@ -21711,7 +22579,7 @@ var ts; } return unknownType; } - if (container.kind === 146 /* Constructor */ && isInConstructorArgumentInitializer(node, container)) { + if (container.kind === 147 /* 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; @@ -21726,7 +22594,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 === 146 /* Constructor */; + return container.kind === 147 /* Constructor */; } else { // TS 1.0 SPEC (April 2014) @@ -21734,27 +22602,38 @@ 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 === 169 /* ObjectLiteralExpression */) { + if (ts.isClassLike(container.parent) || container.parent.kind === 170 /* ObjectLiteralExpression */) { if (container.flags & 32 /* Static */) { - return container.kind === 145 /* MethodDeclaration */ || - container.kind === 144 /* MethodSignature */ || - container.kind === 147 /* GetAccessor */ || - container.kind === 148 /* SetAccessor */; + return container.kind === 146 /* MethodDeclaration */ || + container.kind === 145 /* MethodSignature */ || + container.kind === 148 /* GetAccessor */ || + container.kind === 149 /* SetAccessor */; } else { - return container.kind === 145 /* MethodDeclaration */ || - container.kind === 144 /* MethodSignature */ || - container.kind === 147 /* GetAccessor */ || - container.kind === 148 /* SetAccessor */ || - container.kind === 143 /* PropertyDeclaration */ || - container.kind === 142 /* PropertySignature */ || - container.kind === 146 /* Constructor */; + return container.kind === 146 /* MethodDeclaration */ || + container.kind === 145 /* MethodSignature */ || + container.kind === 148 /* GetAccessor */ || + container.kind === 149 /* SetAccessor */ || + container.kind === 144 /* PropertyDeclaration */ || + container.kind === 143 /* PropertySignature */ || + container.kind === 147 /* Constructor */; } } } return false; } } + function getContextuallyTypedThisType(func) { + if ((isFunctionExpressionOrArrowFunction(func) || ts.isObjectLiteralMethod(func)) && + isContextSensitive(func) && + func.kind !== 179 /* ArrowFunction */) { + var contextualSignature = getContextualSignature(func); + if (contextualSignature) { + return contextualSignature.thisType; + } + } + return undefined; + } // Return contextual type of parameter or undefined if no contextual type is available function getContextuallyTypedParameterType(parameter) { var func = parameter.parent; @@ -21779,18 +22658,21 @@ var ts; } return undefined; } - // In a variable, parameter or property declaration with a type annotation, the contextual type of an initializer - // expression is the type of the variable, parameter or property. Otherwise, in a parameter declaration of a - // contextually typed function expression, the contextual type of an initializer expression is the contextual type - // of the parameter. Otherwise, in a variable or parameter declaration with a binding pattern name, the contextual - // type of an initializer expression is the type implied by the binding pattern. + // In a variable, parameter or property declaration with a type annotation, + // the contextual type of an initializer expression is the type of the variable, parameter or property. + // Otherwise, in a parameter declaration of a contextually typed function expression, + // the contextual type of an initializer expression is the contextual type of the parameter. + // Otherwise, in a variable or parameter declaration with a binding pattern name, + // the contextual type of an initializer expression is the type implied by the binding pattern. + // Otherwise, in a binding pattern inside a variable or parameter declaration, + // the contextual type of an initializer expression is the type annotation of the containing declaration, if present. function getContextualTypeForInitializerExpression(node) { var declaration = node.parent; if (node === declaration.initializer) { if (declaration.type) { return getTypeFromTypeNode(declaration.type); } - if (declaration.kind === 140 /* Parameter */) { + if (declaration.kind === 141 /* Parameter */) { var type = getContextuallyTypedParameterType(declaration); if (type) { return type; @@ -21799,6 +22681,18 @@ var ts; if (ts.isBindingPattern(declaration.name)) { return getTypeFromBindingPattern(declaration.name, /*includePatternInType*/ true); } + if (ts.isBindingPattern(declaration.parent)) { + var parentDeclaration = declaration.parent.parent; + var name_11 = declaration.propertyName || declaration.name; + if (ts.isVariableLike(parentDeclaration) && + parentDeclaration.type && + !ts.isBindingPattern(name_11)) { + var text = getTextOfPropertyName(name_11); + if (text) { + return getTypeOfPropertyOfType(getTypeFromTypeNode(parentDeclaration.type), text); + } + } + } } return undefined; } @@ -21823,7 +22717,7 @@ var ts; } function isInParameterInitializerBeforeContainingFunction(node) { while (node.parent && !ts.isFunctionLike(node.parent)) { - if (node.parent.kind === 140 /* Parameter */ && node.parent.initializer === node) { + if (node.parent.kind === 141 /* Parameter */ && node.parent.initializer === node) { return true; } node = node.parent; @@ -21834,8 +22728,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 === 146 /* Constructor */ || - functionDecl.kind === 147 /* GetAccessor */ && ts.getSetAccessorTypeAnnotationNode(ts.getDeclarationOfKind(functionDecl.symbol, 148 /* SetAccessor */))) { + functionDecl.kind === 147 /* Constructor */ || + functionDecl.kind === 148 /* GetAccessor */ && ts.getSetAccessorTypeAnnotationNode(ts.getDeclarationOfKind(functionDecl.symbol, 149 /* SetAccessor */))) { return getReturnTypeOfSignature(getSignatureFromDeclaration(functionDecl)); } // Otherwise, if the containing function is contextually typed by a function type with exactly one call signature @@ -21857,7 +22751,7 @@ var ts; return undefined; } function getContextualTypeForSubstitutionExpression(template, substitutionExpression) { - if (template.parent.kind === 174 /* TaggedTemplateExpression */) { + if (template.parent.kind === 175 /* TaggedTemplateExpression */) { return getContextualTypeForArgument(template.parent, substitutionExpression); } return undefined; @@ -21984,13 +22878,13 @@ var ts; var kind = attribute.kind; var jsxElement = attribute.parent; var attrsType = getJsxElementAttributesType(jsxElement); - if (attribute.kind === 242 /* JsxAttribute */) { + if (attribute.kind === 245 /* JsxAttribute */) { if (!attrsType || isTypeAny(attrsType)) { return undefined; } return getTypeOfPropertyOfType(attrsType, attribute.name.text); } - else if (attribute.kind === 243 /* JsxSpreadAttribute */) { + else if (attribute.kind === 246 /* JsxSpreadAttribute */) { return attrsType; } ts.Debug.fail("Expected JsxAttribute or JsxSpreadAttribute, got ts.SyntaxKind[" + kind + "]"); @@ -22028,40 +22922,40 @@ var ts; } var parent = node.parent; switch (parent.kind) { - case 215 /* VariableDeclaration */: - case 140 /* Parameter */: - case 143 /* PropertyDeclaration */: - case 142 /* PropertySignature */: - case 167 /* BindingElement */: + case 217 /* VariableDeclaration */: + case 141 /* Parameter */: + case 144 /* PropertyDeclaration */: + case 143 /* PropertySignature */: + case 168 /* BindingElement */: return getContextualTypeForInitializerExpression(node); - case 178 /* ArrowFunction */: - case 208 /* ReturnStatement */: + case 179 /* ArrowFunction */: + case 210 /* ReturnStatement */: return getContextualTypeForReturnExpression(node); - case 188 /* YieldExpression */: + case 189 /* YieldExpression */: return getContextualTypeForYieldOperand(parent); - case 172 /* CallExpression */: - case 173 /* NewExpression */: + case 173 /* CallExpression */: + case 174 /* NewExpression */: return getContextualTypeForArgument(parent, node); - case 175 /* TypeAssertionExpression */: - case 193 /* AsExpression */: + case 176 /* TypeAssertionExpression */: + case 194 /* AsExpression */: return getTypeFromTypeNode(parent.type); - case 185 /* BinaryExpression */: + case 186 /* BinaryExpression */: return getContextualTypeForBinaryOperand(node); - case 249 /* PropertyAssignment */: + case 252 /* PropertyAssignment */: return getContextualTypeForObjectLiteralElement(parent); - case 168 /* ArrayLiteralExpression */: + case 169 /* ArrayLiteralExpression */: return getContextualTypeForElementExpression(node); - case 186 /* ConditionalExpression */: + case 187 /* ConditionalExpression */: return getContextualTypeForConditionalOperand(node); - case 194 /* TemplateSpan */: - ts.Debug.assert(parent.parent.kind === 187 /* TemplateExpression */); + case 196 /* TemplateSpan */: + ts.Debug.assert(parent.parent.kind === 188 /* TemplateExpression */); return getContextualTypeForSubstitutionExpression(parent.parent, node); - case 176 /* ParenthesizedExpression */: + case 177 /* ParenthesizedExpression */: return getContextualType(parent); - case 244 /* JsxExpression */: + case 247 /* JsxExpression */: return getContextualType(parent); - case 242 /* JsxAttribute */: - case 243 /* JsxSpreadAttribute */: + case 245 /* JsxAttribute */: + case 246 /* JsxSpreadAttribute */: return getContextualTypeForJsxAttribute(parent); } return undefined; @@ -22078,7 +22972,7 @@ var ts; } } function isFunctionExpressionOrArrowFunction(node) { - return node.kind === 177 /* FunctionExpression */ || node.kind === 178 /* ArrowFunction */; + return node.kind === 178 /* FunctionExpression */ || node.kind === 179 /* ArrowFunction */; } function getContextualSignatureForFunctionLikeDeclaration(node) { // Only function expressions, arrow functions, and object literal methods are contextually typed. @@ -22092,7 +22986,7 @@ 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 !== 145 /* MethodDeclaration */ || ts.isObjectLiteralMethod(node)); + ts.Debug.assert(node.kind !== 146 /* MethodDeclaration */ || ts.isObjectLiteralMethod(node)); var type = ts.isObjectLiteralMethod(node) ? getContextualTypeForObjectLiteralMethod(node) : getApparentTypeOfContextualType(node); @@ -22112,7 +23006,7 @@ var ts; // This signature will contribute to contextual union signature signatureList = [signature]; } - else if (!compareSignaturesIdentical(signatureList[0], signature, /*partialMatch*/ false, /*ignoreReturnTypes*/ true, compareTypesIdentical)) { + else if (!compareSignaturesIdentical(signatureList[0], signature, /*partialMatch*/ false, /*ignoreThisTypes*/ true, /*ignoreReturnTypes*/ true, compareTypesIdentical)) { // Signatures aren't identical, do not use return undefined; } @@ -22150,19 +23044,38 @@ var ts; function isInferentialContext(mapper) { return mapper && mapper.context; } + // Return the root assignment node of an assignment target + function getAssignmentRoot(node) { + while (node.parent.kind === 177 /* ParenthesizedExpression */) { + node = node.parent; + } + while (true) { + if (node.parent.kind === 252 /* PropertyAssignment */) { + node = node.parent.parent; + } + else if (node.parent.kind === 169 /* ArrayLiteralExpression */) { + node = node.parent; + } + else { + break; + } + } + var parent = node.parent; + return parent.kind === 186 /* BinaryExpression */ && + parent.operatorToken.kind === 56 /* EqualsToken */ && + parent.left === node ? parent : undefined; + } // 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) { + return !!getAssignmentRoot(node); + } + function isCompoundAssignmentTarget(node) { var parent = node.parent; - if (parent.kind === 185 /* BinaryExpression */ && parent.operatorToken.kind === 56 /* EqualsToken */ && parent.left === node) { - return true; - } - if (parent.kind === 249 /* PropertyAssignment */) { - return isAssignmentTarget(parent.parent); - } - if (parent.kind === 168 /* ArrayLiteralExpression */) { - return isAssignmentTarget(parent); + if (parent.kind === 186 /* BinaryExpression */ && parent.left === node) { + var operator = parent.operatorToken.kind; + return operator >= 56 /* FirstAssignment */ && operator <= 68 /* LastAssignment */; } return false; } @@ -22177,8 +23090,8 @@ var ts; return checkIteratedTypeOrElementType(arrayOrIterableType, node.expression, /*allowStringInput*/ false); } function hasDefaultValue(node) { - return (node.kind === 167 /* BindingElement */ && !!node.initializer) || - (node.kind === 185 /* BinaryExpression */ && node.operatorToken.kind === 56 /* EqualsToken */); + return (node.kind === 168 /* BindingElement */ && !!node.initializer) || + (node.kind === 186 /* BinaryExpression */ && node.operatorToken.kind === 56 /* EqualsToken */); } function checkArrayLiteral(node, contextualMapper) { var elements = node.elements; @@ -22187,7 +23100,7 @@ var ts; var inDestructuringPattern = isAssignmentTarget(node); for (var _i = 0, elements_1 = elements; _i < elements_1.length; _i++) { var e = elements_1[_i]; - if (inDestructuringPattern && e.kind === 189 /* SpreadElementExpression */) { + if (inDestructuringPattern && e.kind === 190 /* SpreadElementExpression */) { // Given the following situation: // var c: {}; // [...c] = ["", 0]; @@ -22211,7 +23124,7 @@ var ts; var type = checkExpression(e, contextualMapper); elementTypes.push(type); } - hasSpreadElement = hasSpreadElement || e.kind === 189 /* SpreadElementExpression */; + hasSpreadElement = hasSpreadElement || e.kind === 190 /* SpreadElementExpression */; } if (!hasSpreadElement) { // If array literal is actually a destructuring pattern, mark it as an implied type. We do this such @@ -22226,7 +23139,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 === 166 /* ArrayBindingPattern */ || pattern.kind === 168 /* ArrayLiteralExpression */)) { + if (pattern && (pattern.kind === 167 /* ArrayBindingPattern */ || pattern.kind === 169 /* ArrayLiteralExpression */)) { var patternElements = pattern.elements; for (var i = elementTypes.length; i < patternElements.length; i++) { var patternElement = patternElements[i]; @@ -22234,7 +23147,7 @@ var ts; elementTypes.push(contextualType.elementTypes[i]); } else { - if (patternElement.kind !== 191 /* OmittedExpression */) { + if (patternElement.kind !== 192 /* OmittedExpression */) { error(patternElement, ts.Diagnostics.Initializer_provides_no_value_for_this_binding_element_and_the_binding_element_has_no_default_value); } elementTypes.push(unknownType); @@ -22246,10 +23159,10 @@ var ts; } } } - return createArrayType(elementTypes.length ? getUnionType(elementTypes) : undefinedType); + return createArrayType(elementTypes.length ? getUnionType(elementTypes) : emptyArrayElementType); } function isNumericName(name) { - return name.kind === 138 /* ComputedPropertyName */ ? isNumericComputedName(name) : isNumericLiteralName(name.text); + return name.kind === 139 /* 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, @@ -22316,7 +23229,7 @@ var ts; var propertiesArray = []; var contextualType = getApparentTypeOfContextualType(node); var contextualTypeHasPattern = contextualType && contextualType.pattern && - (contextualType.pattern.kind === 165 /* ObjectBindingPattern */ || contextualType.pattern.kind === 169 /* ObjectLiteralExpression */); + (contextualType.pattern.kind === 166 /* ObjectBindingPattern */ || contextualType.pattern.kind === 170 /* ObjectLiteralExpression */); var typeFlags = 0; var patternWithComputedProperties = false; var hasComputedStringProperty = false; @@ -22324,18 +23237,18 @@ var ts; for (var _i = 0, _a = node.properties; _i < _a.length; _i++) { var memberDecl = _a[_i]; var member = memberDecl.symbol; - if (memberDecl.kind === 249 /* PropertyAssignment */ || - memberDecl.kind === 250 /* ShorthandPropertyAssignment */ || + if (memberDecl.kind === 252 /* PropertyAssignment */ || + memberDecl.kind === 253 /* ShorthandPropertyAssignment */ || ts.isObjectLiteralMethod(memberDecl)) { var type = void 0; - if (memberDecl.kind === 249 /* PropertyAssignment */) { + if (memberDecl.kind === 252 /* PropertyAssignment */) { type = checkPropertyAssignment(memberDecl, contextualMapper); } - else if (memberDecl.kind === 145 /* MethodDeclaration */) { + else if (memberDecl.kind === 146 /* MethodDeclaration */) { type = checkObjectLiteralMethod(memberDecl, contextualMapper); } else { - ts.Debug.assert(memberDecl.kind === 250 /* ShorthandPropertyAssignment */); + ts.Debug.assert(memberDecl.kind === 253 /* ShorthandPropertyAssignment */); type = checkExpression(memberDecl.name, contextualMapper); } typeFlags |= type.flags; @@ -22343,8 +23256,8 @@ var ts; 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 === 249 /* PropertyAssignment */ && hasDefaultValue(memberDecl.initializer)) || - (memberDecl.kind === 250 /* ShorthandPropertyAssignment */ && memberDecl.objectAssignmentInitializer); + var isOptional = (memberDecl.kind === 252 /* PropertyAssignment */ && hasDefaultValue(memberDecl.initializer)) || + (memberDecl.kind === 253 /* ShorthandPropertyAssignment */ && memberDecl.objectAssignmentInitializer); if (isOptional) { prop.flags |= 536870912 /* Optional */; } @@ -22378,7 +23291,7 @@ var ts; // 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 === 147 /* GetAccessor */ || memberDecl.kind === 148 /* SetAccessor */); + ts.Debug.assert(memberDecl.kind === 148 /* GetAccessor */ || memberDecl.kind === 149 /* SetAccessor */); checkAccessorDeclaration(memberDecl); } if (ts.hasDynamicName(memberDecl)) { @@ -22426,18 +23339,23 @@ var ts; // Check attributes checkJsxOpeningLikeElement(node.openingElement); // Perform resolution on the closing tag so that rename/go to definition/etc work - getJsxTagSymbol(node.closingElement); + if (isJsxIntrinsicIdentifier(node.closingElement.tagName)) { + getIntrinsicTagSymbol(node.closingElement); + } + else { + checkExpression(node.closingElement.tagName); + } // Check children for (var _i = 0, _a = node.children; _i < _a.length; _i++) { var child = _a[_i]; switch (child.kind) { - case 244 /* JsxExpression */: + case 247 /* JsxExpression */: checkJsxExpression(child); break; - case 237 /* JsxElement */: + case 240 /* JsxElement */: checkJsxElement(child); break; - case 238 /* JsxSelfClosingElement */: + case 241 /* JsxSelfClosingElement */: checkJsxSelfClosingElement(child); break; } @@ -22455,7 +23373,7 @@ var ts; * Returns true iff React would emit this tag name as a string rather than an identifier or qualified name */ function isJsxIntrinsicIdentifier(tagName) { - if (tagName.kind === 137 /* QualifiedName */) { + if (tagName.kind === 138 /* QualifiedName */) { return false; } else { @@ -22525,14 +23443,6 @@ var ts; } return jsxTypes[name]; } - function getJsxTagSymbol(node) { - if (isJsxIntrinsicIdentifier(node.tagName)) { - return getIntrinsicTagSymbol(node); - } - else { - return checkExpression(node.tagName).symbol; - } - } /** * Looks up an intrinsic tag name and returns a symbol that either points to an intrinsic * property (in which case nodeLinks.jsxFlags will be IntrinsicNamedElement) or an intrinsic @@ -22648,18 +23558,20 @@ var ts; if (!elemClassType || !isTypeAssignableTo(elemInstanceType, elemClassType)) { // Is this is a stateless function component? See if its single signature's return type is // assignable to the JSX Element Type - var elemType = checkExpression(node.tagName); - var callSignatures = elemType && getSignaturesOfType(elemType, 0 /* Call */); - var callSignature = callSignatures && callSignatures.length > 0 && callSignatures[0]; - var callReturnType = callSignature && getReturnTypeOfSignature(callSignature); - var paramType = callReturnType && (callSignature.parameters.length === 0 ? emptyObjectType : getTypeOfSymbol(callSignature.parameters[0])); - if (callReturnType && isTypeAssignableTo(callReturnType, jsxElementType)) { - // Intersect in JSX.IntrinsicAttributes if it exists - var intrinsicAttributes = getJsxType(JsxNames.IntrinsicAttributes); - if (intrinsicAttributes !== unknownType) { - paramType = intersectTypes(intrinsicAttributes, paramType); + if (jsxElementType) { + var elemType = checkExpression(node.tagName); + var callSignatures = elemType && getSignaturesOfType(elemType, 0 /* Call */); + var callSignature = callSignatures && callSignatures.length > 0 && callSignatures[0]; + var callReturnType = callSignature && getReturnTypeOfSignature(callSignature); + var paramType = callReturnType && (callSignature.parameters.length === 0 ? emptyObjectType : getTypeOfSymbol(callSignature.parameters[0])); + if (callReturnType && isTypeAssignableTo(callReturnType, jsxElementType)) { + // Intersect in JSX.IntrinsicAttributes if it exists + var intrinsicAttributes = getJsxType(JsxNames.IntrinsicAttributes); + if (intrinsicAttributes !== unknownType) { + paramType = intersectTypes(intrinsicAttributes, paramType); + } + return links.resolvedJsxType = paramType; } - return links.resolvedJsxType = paramType; } } // Issue an error if this return type isn't assignable to JSX.ElementClass @@ -22770,11 +23682,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 === 242 /* JsxAttribute */) { + if (node.attributes[i].kind === 245 /* JsxAttribute */) { checkJsxAttribute((node.attributes[i]), targetAttributesType, nameTable); } else { - ts.Debug.assert(node.attributes[i].kind === 243 /* JsxSpreadAttribute */); + ts.Debug.assert(node.attributes[i].kind === 246 /* JsxSpreadAttribute */); var spreadType = checkJsxSpreadAttribute((node.attributes[i]), targetAttributesType, nameTable); if (isTypeAny(spreadType)) { sawSpreadedAny = true; @@ -22804,7 +23716,7 @@ 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 : 143 /* PropertyDeclaration */; + return s.valueDeclaration ? s.valueDeclaration.kind : 144 /* PropertyDeclaration */; } function getDeclarationFlagsFromSymbol(s) { return s.valueDeclaration ? ts.getCombinedNodeFlags(s.valueDeclaration) : s.flags & 134217728 /* Prototype */ ? 4 /* Public */ | 32 /* Static */ : 0; @@ -22820,10 +23732,10 @@ var ts; function checkClassPropertyAccess(node, left, type, prop) { var flags = getDeclarationFlagsFromSymbol(prop); var declaringClass = getDeclaredTypeOfSymbol(getParentOfSymbol(prop)); + var errorNode = node.kind === 171 /* PropertyAccessExpression */ || node.kind === 217 /* VariableDeclaration */ ? + node.name : + node.right; if (left.kind === 95 /* SuperKeyword */) { - var errorNode = node.kind === 170 /* PropertyAccessExpression */ ? - node.name : - node.right; // 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, @@ -22831,7 +23743,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) !== 145 /* MethodDeclaration */) { + if (languageVersion < 2 /* ES6 */ && getDeclarationKindFromSymbol(prop) !== 146 /* 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); @@ -22851,13 +23763,11 @@ var ts; return true; } // Property is known to be private or protected at this point - // Get the declaring and enclosing class instance types - var enclosingClassDeclaration = ts.getContainingClass(node); - var enclosingClass = enclosingClassDeclaration ? getDeclaredTypeOfSymbol(getSymbolOfNode(enclosingClassDeclaration)) : undefined; - // Private property is accessible if declaring and enclosing class are the same + // Private property is accessible if the property is within the declaring class if (flags & 8 /* Private */) { - if (declaringClass !== enclosingClass) { - error(node, ts.Diagnostics.Property_0_is_private_and_only_accessible_within_class_1, symbolToString(prop), typeToString(declaringClass)); + var declaringClassDeclaration = getClassLikeDeclarationOfSymbol(getParentOfSymbol(prop)); + if (!isNodeWithinClass(node, declaringClassDeclaration)) { + error(errorNode, ts.Diagnostics.Property_0_is_private_and_only_accessible_within_class_1, symbolToString(prop), typeToString(declaringClass)); return false; } return true; @@ -22867,9 +23777,14 @@ var ts; if (left.kind === 95 /* SuperKeyword */) { return true; } - // A protected property is accessible in the declaring class and classes derived from it - if (!enclosingClass || !hasBaseType(enclosingClass, declaringClass)) { - error(node, ts.Diagnostics.Property_0_is_protected_and_only_accessible_within_class_1_and_its_subclasses, symbolToString(prop), typeToString(declaringClass)); + // Get the enclosing class that has the declaring class as its base type + var enclosingClass = forEachEnclosingClass(node, function (enclosingDeclaration) { + var enclosingClass = getDeclaredTypeOfSymbol(getSymbolOfNode(enclosingDeclaration)); + return hasBaseType(enclosingClass, declaringClass) ? enclosingClass : undefined; + }); + // A protected property is accessible if the property is within the declaring class or classes derived from it + if (!enclosingClass) { + error(errorNode, ts.Diagnostics.Property_0_is_protected_and_only_accessible_within_class_1_and_its_subclasses, symbolToString(prop), typeToString(declaringClass)); return false; } // No further restrictions for static properties @@ -22883,11 +23798,19 @@ var ts; } // TODO: why is the first part of this check here? if (!(getTargetType(type).flags & (1024 /* Class */ | 2048 /* Interface */) && hasBaseType(type, enclosingClass))) { - error(node, ts.Diagnostics.Property_0_is_protected_and_only_accessible_through_an_instance_of_class_1, symbolToString(prop), typeToString(enclosingClass)); + error(errorNode, ts.Diagnostics.Property_0_is_protected_and_only_accessible_through_an_instance_of_class_1, symbolToString(prop), typeToString(enclosingClass)); return false; } return true; } + function checkNonNullExpression(node) { + var type = checkExpression(node); + if (strictNullChecks && getNullableKind(type)) { + error(node, ts.Diagnostics.Object_is_possibly_null_or_undefined); + return getNonNullableType(type); + } + return type; + } function checkPropertyAccessExpression(node) { return checkPropertyAccessExpressionOrQualifiedName(node, node.expression, node.name); } @@ -22895,7 +23818,7 @@ var ts; return checkPropertyAccessExpressionOrQualifiedName(node, node.left, node.right); } function checkPropertyAccessExpressionOrQualifiedName(node, left, right) { - var type = checkExpression(left); + var type = checkNonNullExpression(left); if (isTypeAny(type)) { return type; } @@ -22915,10 +23838,12 @@ var ts; if (prop.parent && prop.parent.flags & 32 /* Class */) { checkClassPropertyAccess(node, left, apparentType, prop); } - return getTypeOfSymbol(prop); + var propType = getTypeOfSymbol(prop); + return node.kind === 171 /* PropertyAccessExpression */ && prop.flags & 4 /* Property */ ? + getNarrowedTypeOfReference(propType, node) : propType; } function isValidPropertyAccess(node, propertyName) { - var left = node.kind === 170 /* PropertyAccessExpression */ + var left = node.kind === 171 /* PropertyAccessExpression */ ? node.expression : node.left; var type = checkExpression(left); @@ -22935,7 +23860,7 @@ var ts; */ function getForInVariableSymbol(node) { var initializer = node.initializer; - if (initializer.kind === 216 /* VariableDeclarationList */) { + if (initializer.kind === 218 /* VariableDeclarationList */) { var variable = initializer.declarations[0]; if (variable && !ts.isBindingPattern(variable.name)) { return getSymbolOfNode(variable); @@ -22964,7 +23889,7 @@ var ts; var child = expr; var node = expr.parent; while (node) { - if (node.kind === 204 /* ForInStatement */ && + if (node.kind === 206 /* ForInStatement */ && child === node.statement && getForInVariableSymbol(node) === symbol && hasNumericPropertyNames(checkExpression(node.expression))) { @@ -22981,7 +23906,7 @@ var ts; // Grammar checking if (!node.argumentExpression) { var sourceFile = ts.getSourceFileOfNode(node); - if (node.parent.kind === 173 /* NewExpression */ && node.parent.expression === node) { + if (node.parent.kind === 174 /* 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); @@ -22993,7 +23918,7 @@ var ts; } } // Obtain base constraint such that we can bail out if the constraint is an unknown type - var objectType = getApparentType(checkExpression(node.expression)); + var objectType = getApparentType(checkNonNullExpression(node.expression)); var indexType = node.argumentExpression ? checkExpression(node.argumentExpression) : unknownType; if (objectType === unknownType) { return unknownType; @@ -23014,15 +23939,15 @@ var ts; // - 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_11 = getPropertyNameForIndexedAccess(node.argumentExpression, indexType); - if (name_11 !== undefined) { - var prop = getPropertyOfType(objectType, name_11); + var name_12 = getPropertyNameForIndexedAccess(node.argumentExpression, indexType); + if (name_12 !== undefined) { + var prop = getPropertyOfType(objectType, name_12); 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_11, symbolToString(objectType.symbol)); + error(node.argumentExpression, ts.Diagnostics.Property_0_does_not_exist_on_const_enum_1, name_12, symbolToString(objectType.symbol)); return unknownType; } } @@ -23066,7 +23991,7 @@ var ts; if (indexArgumentExpression.kind === 9 /* StringLiteral */ || indexArgumentExpression.kind === 8 /* NumericLiteral */) { return indexArgumentExpression.text; } - if (indexArgumentExpression.kind === 171 /* ElementAccessExpression */ || indexArgumentExpression.kind === 170 /* PropertyAccessExpression */) { + if (indexArgumentExpression.kind === 172 /* ElementAccessExpression */ || indexArgumentExpression.kind === 171 /* PropertyAccessExpression */) { var value = getConstantValue(indexArgumentExpression); if (value !== undefined) { return value.toString(); @@ -23121,10 +24046,10 @@ var ts; return true; } function resolveUntypedCall(node) { - if (node.kind === 174 /* TaggedTemplateExpression */) { + if (node.kind === 175 /* TaggedTemplateExpression */) { checkExpression(node.template); } - else if (node.kind !== 141 /* Decorator */) { + else if (node.kind !== 142 /* Decorator */) { ts.forEach(node.arguments, function (argument) { checkExpression(argument); }); @@ -23154,13 +24079,13 @@ var ts; for (var _i = 0, signatures_2 = signatures; _i < signatures_2.length; _i++) { var signature = signatures_2[_i]; var symbol = signature.declaration && getSymbolOfNode(signature.declaration); - var parent_6 = signature.declaration && signature.declaration.parent; + var parent_7 = signature.declaration && signature.declaration.parent; if (!lastSymbol || symbol === lastSymbol) { - if (lastParent && parent_6 === lastParent) { + if (lastParent && parent_7 === lastParent) { index++; } else { - lastParent = parent_6; + lastParent = parent_7; index = cutoffIndex; } } @@ -23168,7 +24093,7 @@ var ts; // current declaration belongs to a different symbol // set cutoffIndex so re-orderings in the future won't change result set from 0 to cutoffIndex index = cutoffIndex = result.length; - lastParent = parent_6; + lastParent = parent_7; } lastSymbol = symbol; // specialized signatures always need to be placed before non-specialized signatures regardless @@ -23190,7 +24115,7 @@ var ts; function getSpreadArgumentIndex(args) { for (var i = 0; i < args.length; i++) { var arg = args[i]; - if (arg && arg.kind === 189 /* SpreadElementExpression */) { + if (arg && arg.kind === 190 /* SpreadElementExpression */) { return i; } } @@ -23202,13 +24127,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 === 174 /* TaggedTemplateExpression */) { + if (node.kind === 175 /* 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 adjustedArgCount = args.length; typeArguments = undefined; - if (tagExpression.template.kind === 187 /* TemplateExpression */) { + if (tagExpression.template.kind === 188 /* 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; @@ -23225,7 +24150,7 @@ var ts; callIsIncomplete = !!templateLiteral.isUnterminated; } } - else if (node.kind === 141 /* Decorator */) { + else if (node.kind === 142 /* Decorator */) { isDecorator = true; typeArguments = undefined; adjustedArgCount = getEffectiveArgumentCount(node, /*args*/ undefined, signature); @@ -23234,7 +24159,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 === 173 /* NewExpression */); + ts.Debug.assert(callExpression.kind === 174 /* NewExpression */); return signature.minArgumentCount === 0; } // For IDE scenarios we may have an incomplete call, so a trailing comma is tantamount to adding another argument. @@ -23307,13 +24232,18 @@ var ts; if (context.failedTypeParameterIndex !== undefined && !context.inferences[context.failedTypeParameterIndex].isFixed) { context.failedTypeParameterIndex = undefined; } + if (signature.thisType) { + var thisArgumentNode = getThisArgumentOfCall(node); + var thisArgumentType = thisArgumentNode ? checkExpression(thisArgumentNode) : voidType; + inferTypes(context, thisArgumentType, signature.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. var argCount = getEffectiveArgumentCount(node, args, signature); 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 !== 191 /* OmittedExpression */) { + if (arg === undefined || arg.kind !== 192 /* OmittedExpression */) { var paramType = getTypeAtPosition(signature, i); var argType = getEffectiveArgumentType(node, i, arg); // If the effective argument type is 'undefined', there is no synthetic type @@ -23369,11 +24299,24 @@ var ts; return typeArgumentsAreAssignable; } function checkApplicableSignature(node, args, signature, relation, excludeArgument, reportErrors) { + if (signature.thisType && signature.thisType !== voidType && node.kind !== 174 /* 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. + var thisArgumentNode = getThisArgumentOfCall(node); + var thisArgumentType = thisArgumentNode ? checkExpression(thisArgumentNode) : voidType; + var errorNode = reportErrors ? (thisArgumentNode || node) : undefined; + var headMessage_1 = ts.Diagnostics.The_this_context_of_type_0_is_not_assignable_to_method_s_this_of_type_1; + if (!checkTypeRelatedTo(thisArgumentType, signature.thisType, relation, errorNode, headMessage_1)) { + return false; + } + } + var headMessage = ts.Diagnostics.Argument_of_type_0_is_not_assignable_to_parameter_of_type_1; var argCount = getEffectiveArgumentCount(node, args, signature); 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 !== 191 /* OmittedExpression */) { + if (arg === undefined || arg.kind !== 192 /* 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); @@ -23386,7 +24329,6 @@ var ts; } // Use argument expression as error location when reporting errors var errorNode = reportErrors ? getEffectiveArgumentErrorNode(node, i, arg) : undefined; - var headMessage = ts.Diagnostics.Argument_of_type_0_is_not_assignable_to_parameter_of_type_1; if (!checkTypeRelatedTo(argType, paramType, relation, errorNode, headMessage)) { return false; } @@ -23394,6 +24336,20 @@ var ts; } return true; } + /** + * Returns the this argument in calls like x.f(...) and x[f](...). Undefined otherwise. + */ + function getThisArgumentOfCall(node) { + if (node.kind === 173 /* CallExpression */) { + var callee = node.expression; + if (callee.kind === 171 /* PropertyAccessExpression */) { + return callee.expression; + } + else if (callee.kind === 172 /* ElementAccessExpression */) { + return callee.expression; + } + } + } /** * Returns the effective arguments for an expression that works like a function invocation. * @@ -23405,16 +24361,16 @@ var ts; */ function getEffectiveCallArguments(node) { var args; - if (node.kind === 174 /* TaggedTemplateExpression */) { + if (node.kind === 175 /* TaggedTemplateExpression */) { var template = node.template; args = [undefined]; - if (template.kind === 187 /* TemplateExpression */) { + if (template.kind === 188 /* TemplateExpression */) { ts.forEach(template.templateSpans, function (span) { args.push(span.expression); }); } } - else if (node.kind === 141 /* Decorator */) { + else if (node.kind === 142 /* 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. @@ -23439,19 +24395,19 @@ var ts; * Otherwise, the argument count is the length of the 'args' array. */ function getEffectiveArgumentCount(node, args, signature) { - if (node.kind === 141 /* Decorator */) { + if (node.kind === 142 /* Decorator */) { switch (node.parent.kind) { - case 218 /* ClassDeclaration */: - case 190 /* ClassExpression */: + case 220 /* ClassDeclaration */: + case 191 /* ClassExpression */: // A class decorator will have one argument (see `ClassDecorator` in core.d.ts) return 1; - case 143 /* PropertyDeclaration */: + case 144 /* PropertyDeclaration */: // A property declaration decorator will have two arguments (see // `PropertyDecorator` in core.d.ts) return 2; - case 145 /* MethodDeclaration */: - case 147 /* GetAccessor */: - case 148 /* SetAccessor */: + case 146 /* MethodDeclaration */: + case 148 /* GetAccessor */: + case 149 /* 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. @@ -23461,7 +24417,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 140 /* Parameter */: + case 141 /* Parameter */: // A parameter declaration decorator will have three arguments (see // `ParameterDecorator` in core.d.ts) return 3; @@ -23485,25 +24441,25 @@ var ts; */ function getEffectiveDecoratorFirstArgumentType(node) { // The first argument to a decorator is its `target`. - if (node.kind === 218 /* ClassDeclaration */) { + if (node.kind === 220 /* 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 === 140 /* Parameter */) { + if (node.kind === 141 /* Parameter */) { // For a parameter decorator, the `target` is the parent type of the // parameter's containing method. node = node.parent; - if (node.kind === 146 /* Constructor */) { + if (node.kind === 147 /* Constructor */) { var classSymbol = getSymbolOfNode(node); return getTypeOfSymbol(classSymbol); } } - if (node.kind === 143 /* PropertyDeclaration */ || - node.kind === 145 /* MethodDeclaration */ || - node.kind === 147 /* GetAccessor */ || - node.kind === 148 /* SetAccessor */) { + if (node.kind === 144 /* PropertyDeclaration */ || + node.kind === 146 /* MethodDeclaration */ || + node.kind === 148 /* GetAccessor */ || + node.kind === 149 /* 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 @@ -23530,21 +24486,21 @@ var ts; */ function getEffectiveDecoratorSecondArgumentType(node) { // The second argument to a decorator is its `propertyKey` - if (node.kind === 218 /* ClassDeclaration */) { + if (node.kind === 220 /* ClassDeclaration */) { ts.Debug.fail("Class decorators should not have a second synthetic argument."); return unknownType; } - if (node.kind === 140 /* Parameter */) { + if (node.kind === 141 /* Parameter */) { node = node.parent; - if (node.kind === 146 /* Constructor */) { + if (node.kind === 147 /* Constructor */) { // For a constructor parameter decorator, the `propertyKey` will be `undefined`. return anyType; } } - if (node.kind === 143 /* PropertyDeclaration */ || - node.kind === 145 /* MethodDeclaration */ || - node.kind === 147 /* GetAccessor */ || - node.kind === 148 /* SetAccessor */) { + if (node.kind === 144 /* PropertyDeclaration */ || + node.kind === 146 /* MethodDeclaration */ || + node.kind === 148 /* GetAccessor */ || + node.kind === 149 /* 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 @@ -23555,7 +24511,7 @@ var ts; case 8 /* NumericLiteral */: case 9 /* StringLiteral */: return getStringLiteralTypeForText(element.name.text); - case 138 /* ComputedPropertyName */: + case 139 /* ComputedPropertyName */: var nameType = checkComputedPropertyName(element.name); if (isTypeOfKind(nameType, 16777216 /* ESSymbol */)) { return nameType; @@ -23581,21 +24537,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 === 218 /* ClassDeclaration */) { + if (node.kind === 220 /* ClassDeclaration */) { ts.Debug.fail("Class decorators should not have a third synthetic argument."); return unknownType; } - if (node.kind === 140 /* Parameter */) { + if (node.kind === 141 /* Parameter */) { // The `parameterIndex` for a parameter decorator is always a number return numberType; } - if (node.kind === 143 /* PropertyDeclaration */) { + if (node.kind === 144 /* PropertyDeclaration */) { ts.Debug.fail("Property decorators should not have a third synthetic argument."); return unknownType; } - if (node.kind === 145 /* MethodDeclaration */ || - node.kind === 147 /* GetAccessor */ || - node.kind === 148 /* SetAccessor */) { + if (node.kind === 146 /* MethodDeclaration */ || + node.kind === 148 /* GetAccessor */ || + node.kind === 149 /* SetAccessor */) { // The `descriptor` for a method decorator will be a `TypedPropertyDescriptor` // for the type of the member. var propertyType = getTypeOfNode(node); @@ -23627,11 +24583,11 @@ var ts; // 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 === 141 /* Decorator */) { + if (node.kind === 142 /* Decorator */) { return getEffectiveDecoratorArgumentType(node, argIndex); } - else if (argIndex === 0 && node.kind === 174 /* TaggedTemplateExpression */) { - return globalTemplateStringsArrayType; + else if (argIndex === 0 && node.kind === 175 /* TaggedTemplateExpression */) { + return getGlobalTemplateStringsArrayType(); } // This is not a synthetic argument, so we return 'undefined' // to signal that the caller needs to check the argument. @@ -23642,8 +24598,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 === 141 /* Decorator */ || - (argIndex === 0 && node.kind === 174 /* TaggedTemplateExpression */)) { + if (node.kind === 142 /* Decorator */ || + (argIndex === 0 && node.kind === 175 /* TaggedTemplateExpression */)) { return undefined; } return args[argIndex]; @@ -23652,11 +24608,11 @@ var ts; * Gets the error node to use when reporting errors for an effective argument. */ function getEffectiveArgumentErrorNode(node, argIndex, arg) { - if (node.kind === 141 /* Decorator */) { + if (node.kind === 142 /* Decorator */) { // For a decorator, we use the expression of the decorator for error reporting. return node.expression; } - else if (argIndex === 0 && node.kind === 174 /* TaggedTemplateExpression */) { + else if (argIndex === 0 && node.kind === 175 /* TaggedTemplateExpression */) { // For a the first argument of a tagged template expression, we use the template of the tag for error reporting. return node.template; } @@ -23665,8 +24621,8 @@ var ts; } } function resolveCall(node, signatures, candidatesOutArray, headMessage) { - var isTaggedTemplate = node.kind === 174 /* TaggedTemplateExpression */; - var isDecorator = node.kind === 141 /* Decorator */; + var isTaggedTemplate = node.kind === 175 /* TaggedTemplateExpression */; + var isDecorator = node.kind === 142 /* Decorator */; var typeArguments; if (!isTaggedTemplate && !isDecorator) { typeArguments = node.typeArguments; @@ -23892,7 +24848,7 @@ var ts; } return resolveUntypedCall(node); } - var funcType = checkExpression(node.expression); + var funcType = checkNonNullExpression(node.expression); var apparentType = getApparentType(funcType); if (apparentType === unknownType) { // Another error has already been reported @@ -23940,7 +24896,7 @@ var ts; error(node.arguments[spreadIndex], ts.Diagnostics.Spread_operator_in_new_expressions_is_only_available_when_targeting_ECMAScript_5_and_higher); } } - var expressionType = checkExpression(node.expression); + var expressionType = checkNonNullExpression(node.expression); // 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 @@ -23983,13 +24939,16 @@ var ts; // If expressionType's apparent type is an object type with no construct signatures but // one or more call signatures, the expression is processed as a function call. A compile-time // error occurs if the result of the function call is not Void. The type of the result of the - // operation is Any. + // operation is Any. It is an error to have a Void this type. var callSignatures = getSignaturesOfType(expressionType, 0 /* Call */); if (callSignatures.length) { var signature = resolveCall(node, callSignatures, candidatesOutArray); if (getReturnTypeOfSignature(signature) !== voidType) { error(node, ts.Diagnostics.Only_a_void_function_can_be_called_with_the_new_keyword); } + if (signature.thisType === voidType) { + error(node, ts.Diagnostics.A_function_that_is_called_with_the_new_keyword_cannot_have_a_this_type_that_is_void); + } return signature; } error(node, ts.Diagnostics.Cannot_use_new_with_an_expression_whose_type_lacks_a_call_or_construct_signature); @@ -24041,16 +25000,16 @@ var ts; */ function getDiagnosticHeadMessageForDecoratorResolution(node) { switch (node.parent.kind) { - case 218 /* ClassDeclaration */: - case 190 /* ClassExpression */: + case 220 /* ClassDeclaration */: + case 191 /* ClassExpression */: return ts.Diagnostics.Unable_to_resolve_signature_of_class_decorator_when_called_as_an_expression; - case 140 /* Parameter */: + case 141 /* Parameter */: return ts.Diagnostics.Unable_to_resolve_signature_of_parameter_decorator_when_called_as_an_expression; - case 143 /* PropertyDeclaration */: + case 144 /* PropertyDeclaration */: return ts.Diagnostics.Unable_to_resolve_signature_of_property_decorator_when_called_as_an_expression; - case 145 /* MethodDeclaration */: - case 147 /* GetAccessor */: - case 148 /* SetAccessor */: + case 146 /* MethodDeclaration */: + case 148 /* GetAccessor */: + case 149 /* SetAccessor */: return ts.Diagnostics.Unable_to_resolve_signature_of_method_decorator_when_called_as_an_expression; } } @@ -24087,16 +25046,16 @@ var ts; // to correctly fill the candidatesOutArray. if (!links.resolvedSignature || candidatesOutArray) { links.resolvedSignature = anySignature; - if (node.kind === 172 /* CallExpression */) { + if (node.kind === 173 /* CallExpression */) { links.resolvedSignature = resolveCallExpression(node, candidatesOutArray); } - else if (node.kind === 173 /* NewExpression */) { + else if (node.kind === 174 /* NewExpression */) { links.resolvedSignature = resolveNewExpression(node, candidatesOutArray); } - else if (node.kind === 174 /* TaggedTemplateExpression */) { + else if (node.kind === 175 /* TaggedTemplateExpression */) { links.resolvedSignature = resolveTaggedTemplateExpression(node, candidatesOutArray); } - else if (node.kind === 141 /* Decorator */) { + else if (node.kind === 142 /* Decorator */) { links.resolvedSignature = resolveDecorator(node, candidatesOutArray); } else { @@ -24124,12 +25083,12 @@ var ts; if (node.expression.kind === 95 /* SuperKeyword */) { return voidType; } - if (node.kind === 173 /* NewExpression */) { + if (node.kind === 174 /* NewExpression */) { var declaration = signature.declaration; if (declaration && - declaration.kind !== 146 /* Constructor */ && - declaration.kind !== 150 /* ConstructSignature */ && - declaration.kind !== 155 /* ConstructorType */ && + declaration.kind !== 147 /* Constructor */ && + declaration.kind !== 151 /* ConstructSignature */ && + declaration.kind !== 156 /* 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 @@ -24158,19 +25117,29 @@ var ts; var targetType = getTypeFromTypeNode(node.type); if (produceDiagnostics && targetType !== unknownType) { var widenedType = getWidenedType(exprType); - // Permit 'number[] | "foo"' to be asserted to 'string'. - var bothAreStringLike = maybeTypeOfKind(targetType, 258 /* StringLike */) && - maybeTypeOfKind(widenedType, 258 /* StringLike */); - if (!bothAreStringLike && !(isTypeAssignableTo(targetType, widenedType))) { - checkTypeAssignableTo(exprType, targetType, node, ts.Diagnostics.Neither_type_0_nor_type_1_is_assignable_to_the_other); + if (!isTypeComparableTo(targetType, widenedType)) { + checkTypeComparableTo(exprType, targetType, node, ts.Diagnostics.Type_0_cannot_be_converted_to_type_1); } } return targetType; } + function checkNonNullAssertion(node) { + return getNonNullableType(checkExpression(node.expression)); + } + function getTypeOfParameter(symbol) { + var type = getTypeOfSymbol(symbol); + if (strictNullChecks) { + var declaration = symbol.valueDeclaration; + if (declaration && declaration.initializer) { + return addNullableKind(type, 32 /* Undefined */); + } + } + return type; + } function getTypeAtPosition(signature, pos) { return signature.hasRestParameter ? - pos < signature.parameters.length - 1 ? getTypeOfSymbol(signature.parameters[pos]) : getRestTypeOfSignature(signature) : - pos < signature.parameters.length ? getTypeOfSymbol(signature.parameters[pos]) : anyType; + pos < signature.parameters.length - 1 ? getTypeOfParameter(signature.parameters[pos]) : getRestTypeOfSignature(signature) : + pos < signature.parameters.length ? getTypeOfParameter(signature.parameters[pos]) : anyType; } function assignContextualParameterTypes(signature, context, mapper) { var len = signature.parameters.length - (signature.hasRestParameter ? 1 : 0); @@ -24191,7 +25160,7 @@ 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 !== 191 /* OmittedExpression */) { + if (element.kind !== 192 /* OmittedExpression */) { if (element.name.kind === 69 /* Identifier */) { getSymbolLinks(getSymbolOfNode(element)).type = getTypeForBindingElement(element); } @@ -24263,7 +25232,7 @@ var ts; } var isAsync = ts.isAsyncFunctionLike(func); var type; - if (func.body.kind !== 196 /* Block */) { + if (func.body.kind !== 198 /* 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 @@ -24287,7 +25256,8 @@ var ts; } } else { - types = checkAndAggregateReturnExpressionTypes(func.body, contextualMapper, isAsync); + var hasImplicitReturn = !!(func.flags & 32768 /* HasImplicitReturn */); + types = checkAndAggregateReturnExpressionTypes(func.body, contextualMapper, isAsync, hasImplicitReturn); if (types.length === 0) { if (isAsync) { // For an async function, the return type will not be void, but rather a Promise for void. @@ -24357,8 +25327,9 @@ var ts; }); return aggregatedTypes; } - function checkAndAggregateReturnExpressionTypes(body, contextualMapper, isAsync) { + function checkAndAggregateReturnExpressionTypes(body, contextualMapper, isAsync, hasImplicitReturn) { var aggregatedTypes = []; + var hasOmittedExpressions = false; ts.forEachReturnStatement(body, function (returnStatement) { var expr = returnStatement.expression; if (expr) { @@ -24374,7 +25345,15 @@ var ts; aggregatedTypes.push(type); } } + else { + hasOmittedExpressions = true; + } }); + if (strictNullChecks && aggregatedTypes.length && (hasOmittedExpressions || hasImplicitReturn)) { + if (!ts.contains(aggregatedTypes, undefinedType)) { + aggregatedTypes.push(undefinedType); + } + } return aggregatedTypes; } /** @@ -24396,7 +25375,7 @@ 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 !== 196 /* Block */ || !(func.flags & 32768 /* HasImplicitReturn */)) { + if (ts.nodeIsMissing(func.body) || func.body.kind !== 198 /* Block */ || !(func.flags & 32768 /* HasImplicitReturn */)) { return; } var hasExplicitReturn = func.flags & 65536 /* HasExplicitReturn */; @@ -24406,15 +25385,19 @@ var ts; // NOTE: having returnType !== undefined is a precondition for entering this branch so func.type will always be present error(func.type, ts.Diagnostics.A_function_whose_declared_type_is_neither_void_nor_any_must_return_a_value); } + else if (returnType && strictNullChecks && !isTypeAssignableTo(undefinedType, returnType)) { + error(func.type, ts.Diagnostics.Function_lacks_ending_return_statement_and_return_type_does_not_include_undefined); + } else if (compilerOptions.noImplicitReturns) { if (!returnType) { // If return type annotation is omitted check if function has any explicit return statements. // If it does not have any - its inferred return type is void - don't do any checks. // Otherwise get inferred return type from function body and report error only if it is not void / anytype - var inferredReturnType = hasExplicitReturn - ? getReturnTypeOfSignature(getSignatureFromDeclaration(func)) - : voidType; - if (inferredReturnType === voidType || isTypeAny(inferredReturnType)) { + if (!hasExplicitReturn) { + return; + } + var inferredReturnType = getReturnTypeOfSignature(getSignatureFromDeclaration(func)); + if (isUnwrappedReturnTypeVoidOrAny(func, inferredReturnType)) { return; } } @@ -24422,14 +25405,15 @@ var ts; } } function checkFunctionExpressionOrObjectLiteralMethod(node, contextualMapper) { - ts.Debug.assert(node.kind !== 145 /* MethodDeclaration */ || ts.isObjectLiteralMethod(node)); + ts.Debug.assert(node.kind !== 146 /* MethodDeclaration */ || ts.isObjectLiteralMethod(node)); // Grammar checking var hasGrammarError = checkGrammarFunctionLikeDeclaration(node); - if (!hasGrammarError && node.kind === 177 /* FunctionExpression */) { + if (!hasGrammarError && node.kind === 178 /* FunctionExpression */) { checkGrammarForGenerator(node); } // The identityMapper object is used to indicate that function expressions are wildcards if (contextualMapper === identityMapper && isContextSensitive(node)) { + checkNodeDeferred(node); return anyFunctionType; } var links = getNodeLinks(node); @@ -24465,14 +25449,14 @@ var ts; } } } - if (produceDiagnostics && node.kind !== 145 /* MethodDeclaration */ && node.kind !== 144 /* MethodSignature */) { + if (produceDiagnostics && node.kind !== 146 /* MethodDeclaration */ && node.kind !== 145 /* MethodSignature */) { checkCollisionWithCapturedSuperVariable(node, node.name); checkCollisionWithCapturedThisVariable(node, node.name); } return type; } function checkFunctionExpressionOrObjectLiteralMethodDeferred(node) { - ts.Debug.assert(node.kind !== 145 /* MethodDeclaration */ || ts.isObjectLiteralMethod(node)); + ts.Debug.assert(node.kind !== 146 /* MethodDeclaration */ || ts.isObjectLiteralMethod(node)); var isAsync = ts.isAsyncFunctionLike(node); var returnOrPromisedType = node.type && (isAsync ? checkAsyncFunctionReturnType(node) : getTypeFromTypeNode(node.type)); if (!node.asteriskToken) { @@ -24488,7 +25472,7 @@ var ts; // checkFunctionExpressionBodies). So it must be done now. getReturnTypeOfSignature(getSignatureFromDeclaration(node)); } - if (node.body.kind === 196 /* Block */) { + if (node.body.kind === 198 /* Block */) { checkSourceElement(node.body); } else { @@ -24532,23 +25516,23 @@ var ts; if (isReadonlySymbol(symbol)) { // Allow assignments to readonly properties within constructors of the same class declaration. if (symbol.flags & 4 /* Property */ && - (expr.kind === 170 /* PropertyAccessExpression */ || expr.kind === 171 /* ElementAccessExpression */) && + (expr.kind === 171 /* PropertyAccessExpression */ || expr.kind === 172 /* ElementAccessExpression */) && expr.expression.kind === 97 /* ThisKeyword */) { var func = ts.getContainingFunction(expr); - return !(func && func.kind === 146 /* Constructor */ && func.parent === symbol.valueDeclaration.parent); + return !(func && func.kind === 147 /* Constructor */ && func.parent === symbol.valueDeclaration.parent); } return true; } return false; } function isReferenceThroughNamespaceImport(expr) { - if (expr.kind === 170 /* PropertyAccessExpression */ || expr.kind === 171 /* ElementAccessExpression */) { + if (expr.kind === 171 /* PropertyAccessExpression */ || expr.kind === 172 /* ElementAccessExpression */) { var node = skipParenthesizedNodes(expr.expression); if (node.kind === 69 /* Identifier */) { var symbol = getNodeLinks(node).resolvedSymbol; if (symbol.flags & 8388608 /* Alias */) { var declaration = getDeclarationOfAliasSymbol(symbol); - return declaration && declaration.kind === 228 /* NamespaceImport */; + return declaration && declaration.kind === 231 /* NamespaceImport */; } } } @@ -24557,7 +25541,7 @@ var ts; function checkReferenceExpression(expr, invalidReferenceMessage, constantVariableMessage) { // References are combinations of identifiers, parentheses, and property accesses. var node = skipParenthesizedNodes(expr); - if (node.kind !== 69 /* Identifier */ && node.kind !== 170 /* PropertyAccessExpression */ && node.kind !== 171 /* ElementAccessExpression */) { + if (node.kind !== 69 /* Identifier */ && node.kind !== 171 /* PropertyAccessExpression */ && node.kind !== 172 /* ElementAccessExpression */) { error(expr, invalidReferenceMessage); return false; } @@ -24580,7 +25564,7 @@ var ts; } } } - else if (node.kind === 171 /* ElementAccessExpression */) { + else if (node.kind === 172 /* ElementAccessExpression */) { if (links.resolvedIndexInfo && links.resolvedIndexInfo.isReadonly) { error(expr, constantVariableMessage); return false; @@ -24627,7 +25611,7 @@ var ts; return booleanType; case 41 /* PlusPlusToken */: case 42 /* MinusMinusToken */: - var ok = checkArithmeticOperandType(node.operand, operandType, ts.Diagnostics.An_arithmetic_operand_must_be_of_type_any_number_or_an_enum_type); + 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); @@ -24638,7 +25622,7 @@ var ts; } function checkPostfixUnaryExpression(node) { var operandType = checkExpression(node.operand); - var ok = checkArithmeticOperandType(node.operand, operandType, ts.Diagnostics.An_arithmetic_operand_must_be_of_type_any_number_or_an_enum_type); + 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); @@ -24728,22 +25712,22 @@ var ts; var properties = node.properties; for (var _i = 0, properties_3 = properties; _i < properties_3.length; _i++) { var p = properties_3[_i]; - if (p.kind === 249 /* PropertyAssignment */ || p.kind === 250 /* ShorthandPropertyAssignment */) { - var name_12 = p.name; - if (name_12.kind === 138 /* ComputedPropertyName */) { - checkComputedPropertyName(name_12); + if (p.kind === 252 /* PropertyAssignment */ || p.kind === 253 /* ShorthandPropertyAssignment */) { + var name_13 = p.name; + if (name_13.kind === 139 /* ComputedPropertyName */) { + checkComputedPropertyName(name_13); } - if (isComputedNonLiteralName(name_12)) { + if (isComputedNonLiteralName(name_13)) { continue; } - var text = getTextOfPropertyName(name_12); + var text = getTextOfPropertyName(name_13); var type = isTypeAny(sourceType) ? sourceType : getTypeOfPropertyOfType(sourceType, text) || isNumericLiteralName(text) && getIndexTypeOfType(sourceType, 1 /* Number */) || getIndexTypeOfType(sourceType, 0 /* String */); if (type) { - if (p.kind === 250 /* ShorthandPropertyAssignment */) { + if (p.kind === 253 /* ShorthandPropertyAssignment */) { checkDestructuringAssignment(p, type); } else { @@ -24752,7 +25736,7 @@ var ts; } } else { - error(name_12, ts.Diagnostics.Type_0_has_no_property_1_and_no_string_index_signature, typeToString(sourceType), ts.declarationNameToString(name_12)); + error(name_13, ts.Diagnostics.Type_0_has_no_property_1_and_no_string_index_signature, typeToString(sourceType), ts.declarationNameToString(name_13)); } } else { @@ -24769,8 +25753,8 @@ var ts; var elements = node.elements; for (var i = 0; i < elements.length; i++) { var e = elements[i]; - if (e.kind !== 191 /* OmittedExpression */) { - if (e.kind !== 189 /* SpreadElementExpression */) { + if (e.kind !== 192 /* OmittedExpression */) { + if (e.kind !== 190 /* SpreadElementExpression */) { var propName = "" + i; var type = isTypeAny(sourceType) ? sourceType @@ -24795,7 +25779,7 @@ var ts; } else { var restExpression = e.expression; - if (restExpression.kind === 185 /* BinaryExpression */ && restExpression.operatorToken.kind === 56 /* EqualsToken */) { + if (restExpression.kind === 186 /* BinaryExpression */ && restExpression.operatorToken.kind === 56 /* EqualsToken */) { error(restExpression.operatorToken, ts.Diagnostics.A_rest_element_cannot_have_an_initializer); } else { @@ -24809,7 +25793,7 @@ var ts; } function checkDestructuringAssignment(exprOrAssignment, sourceType, contextualMapper) { var target; - if (exprOrAssignment.kind === 250 /* ShorthandPropertyAssignment */) { + if (exprOrAssignment.kind === 253 /* ShorthandPropertyAssignment */) { var prop = exprOrAssignment; if (prop.objectAssignmentInitializer) { checkBinaryLikeExpression(prop.name, prop.equalsToken, prop.objectAssignmentInitializer, contextualMapper); @@ -24819,14 +25803,14 @@ var ts; else { target = exprOrAssignment; } - if (target.kind === 185 /* BinaryExpression */ && target.operatorToken.kind === 56 /* EqualsToken */) { + if (target.kind === 186 /* BinaryExpression */ && target.operatorToken.kind === 56 /* EqualsToken */) { checkBinaryExpression(target, contextualMapper); target = target.left; } - if (target.kind === 169 /* ObjectLiteralExpression */) { + if (target.kind === 170 /* ObjectLiteralExpression */) { return checkObjectLiteralAssignment(target, sourceType, contextualMapper); } - if (target.kind === 168 /* ArrayLiteralExpression */) { + if (target.kind === 169 /* ArrayLiteralExpression */) { return checkArrayLiteralAssignment(target, sourceType, contextualMapper); } return checkReferenceAssignment(target, sourceType, contextualMapper); @@ -24843,7 +25827,7 @@ var ts; } function checkBinaryLikeExpression(left, operatorToken, right, contextualMapper, errorNode) { var operator = operatorToken.kind; - if (operator === 56 /* EqualsToken */ && (left.kind === 169 /* ObjectLiteralExpression */ || left.kind === 168 /* ArrayLiteralExpression */)) { + if (operator === 56 /* EqualsToken */ && (left.kind === 170 /* ObjectLiteralExpression */ || left.kind === 169 /* ArrayLiteralExpression */)) { return checkDestructuringAssignment(left, checkExpression(right, contextualMapper), contextualMapper); } var leftType = checkExpression(left, contextualMapper); @@ -24877,10 +25861,12 @@ var ts; // as having the primitive type Number. If one operand is the null or undefined value, // it is treated as having the type of the other operand. // The result is always of the Number primitive type. - if (leftType.flags & (32 /* Undefined */ | 64 /* Null */)) + if (leftType.flags & 96 /* Nullable */) leftType = rightType; - if (rightType.flags & (32 /* Undefined */ | 64 /* Null */)) + if (rightType.flags & 96 /* Nullable */) rightType = leftType; + leftType = getNonNullableType(leftType); + rightType = getNonNullableType(rightType); var suggestedOperator = void 0; // if a user tries to apply a bitwise operator to 2 boolean operands // try and return them a helpful suggestion @@ -24904,10 +25890,12 @@ var ts; // 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. // If one operand is the null or undefined value, it is treated as having the type of the other operand. - if (leftType.flags & (32 /* Undefined */ | 64 /* Null */)) + if (leftType.flags & 96 /* Nullable */) leftType = rightType; - if (rightType.flags & (32 /* Undefined */ | 64 /* Null */)) + if (rightType.flags & 96 /* Nullable */) rightType = leftType; + leftType = getNonNullableType(leftType); + rightType = getNonNullableType(rightType); var resultType = void 0; if (isTypeOfKind(leftType, 132 /* NumberLike */) && isTypeOfKind(rightType, 132 /* NumberLike */)) { // Operands of an enum type are treated as having the primitive type Number. @@ -24949,11 +25937,7 @@ var ts; case 31 /* ExclamationEqualsToken */: case 32 /* EqualsEqualsEqualsToken */: case 33 /* ExclamationEqualsEqualsToken */: - // Permit 'number[] | "foo"' to be asserted to 'string'. - if (maybeTypeOfKind(leftType, 258 /* StringLike */) && maybeTypeOfKind(rightType, 258 /* StringLike */)) { - return booleanType; - } - if (!isTypeAssignableTo(leftType, rightType) && !isTypeAssignableTo(rightType, leftType)) { + if (!isTypeComparableTo(leftType, rightType) && !isTypeComparableTo(rightType, leftType)) { reportOperatorError(); } return booleanType; @@ -24962,9 +25946,9 @@ var ts; case 90 /* InKeyword */: return checkInExpression(left, right, leftType, rightType); case 51 /* AmpersandAmpersandToken */: - return rightType; + return addNullableKind(rightType, getNullableKind(leftType)); case 52 /* BarBarToken */: - return getUnionType([leftType, rightType]); + return getUnionType([getNonNullableType(leftType), rightType]); case 56 /* EqualsToken */: checkAssignmentOperator(rightType); return getRegularTypeOfObjectLiteral(rightType); @@ -25112,7 +26096,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 === 138 /* ComputedPropertyName */) { + if (node.name.kind === 139 /* ComputedPropertyName */) { checkComputedPropertyName(node.name); } return checkExpression(node.initializer, contextualMapper); @@ -25123,7 +26107,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 === 138 /* ComputedPropertyName */) { + if (node.name.kind === 139 /* ComputedPropertyName */) { checkComputedPropertyName(node.name); } var uninstantiatedType = checkFunctionExpressionOrObjectLiteralMethod(node, contextualMapper); @@ -25153,7 +26137,7 @@ var ts; // contextually typed function and arrow expressions in the initial phase. function checkExpression(node, contextualMapper) { var type; - if (node.kind === 137 /* QualifiedName */) { + if (node.kind === 138 /* QualifiedName */) { type = checkQualifiedName(node); } else { @@ -25165,9 +26149,9 @@ var ts; // - 'left' in property access // - 'object' in indexed access // - target in rhs of import statement - var ok = (node.parent.kind === 170 /* PropertyAccessExpression */ && node.parent.expression === node) || - (node.parent.kind === 171 /* ElementAccessExpression */ && node.parent.expression === node) || - ((node.kind === 69 /* Identifier */ || node.kind === 137 /* QualifiedName */) && isInRightSideOfImportOrExportAssignment(node)); + var ok = (node.parent.kind === 171 /* PropertyAccessExpression */ && node.parent.expression === node) || + (node.parent.kind === 172 /* ElementAccessExpression */ && node.parent.expression === node) || + ((node.kind === 69 /* Identifier */ || node.kind === 138 /* 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); } @@ -25194,7 +26178,7 @@ var ts; return booleanType; case 8 /* NumericLiteral */: return checkNumericLiteral(node); - case 187 /* TemplateExpression */: + case 188 /* TemplateExpression */: return checkTemplateExpression(node); case 9 /* StringLiteral */: return checkStringLiteralExpression(node); @@ -25202,58 +26186,60 @@ var ts; return stringType; case 10 /* RegularExpressionLiteral */: return globalRegExpType; - case 168 /* ArrayLiteralExpression */: + case 169 /* ArrayLiteralExpression */: return checkArrayLiteral(node, contextualMapper); - case 169 /* ObjectLiteralExpression */: + case 170 /* ObjectLiteralExpression */: return checkObjectLiteral(node, contextualMapper); - case 170 /* PropertyAccessExpression */: + case 171 /* PropertyAccessExpression */: return checkPropertyAccessExpression(node); - case 171 /* ElementAccessExpression */: + case 172 /* ElementAccessExpression */: return checkIndexedAccess(node); - case 172 /* CallExpression */: - case 173 /* NewExpression */: + case 173 /* CallExpression */: + case 174 /* NewExpression */: return checkCallExpression(node); - case 174 /* TaggedTemplateExpression */: + case 175 /* TaggedTemplateExpression */: return checkTaggedTemplateExpression(node); - case 176 /* ParenthesizedExpression */: + case 177 /* ParenthesizedExpression */: return checkExpression(node.expression, contextualMapper); - case 190 /* ClassExpression */: + case 191 /* ClassExpression */: return checkClassExpression(node); - case 177 /* FunctionExpression */: - case 178 /* ArrowFunction */: + case 178 /* FunctionExpression */: + case 179 /* ArrowFunction */: return checkFunctionExpressionOrObjectLiteralMethod(node, contextualMapper); - case 180 /* TypeOfExpression */: + case 181 /* TypeOfExpression */: return checkTypeOfExpression(node); - case 175 /* TypeAssertionExpression */: - case 193 /* AsExpression */: + case 176 /* TypeAssertionExpression */: + case 194 /* AsExpression */: return checkAssertion(node); - case 179 /* DeleteExpression */: + case 195 /* NonNullExpression */: + return checkNonNullAssertion(node); + case 180 /* DeleteExpression */: return checkDeleteExpression(node); - case 181 /* VoidExpression */: + case 182 /* VoidExpression */: return checkVoidExpression(node); - case 182 /* AwaitExpression */: + case 183 /* AwaitExpression */: return checkAwaitExpression(node); - case 183 /* PrefixUnaryExpression */: + case 184 /* PrefixUnaryExpression */: return checkPrefixUnaryExpression(node); - case 184 /* PostfixUnaryExpression */: + case 185 /* PostfixUnaryExpression */: return checkPostfixUnaryExpression(node); - case 185 /* BinaryExpression */: + case 186 /* BinaryExpression */: return checkBinaryExpression(node, contextualMapper); - case 186 /* ConditionalExpression */: + case 187 /* ConditionalExpression */: return checkConditionalExpression(node, contextualMapper); - case 189 /* SpreadElementExpression */: + case 190 /* SpreadElementExpression */: return checkSpreadElementExpression(node, contextualMapper); - case 191 /* OmittedExpression */: + case 192 /* OmittedExpression */: return undefinedType; - case 188 /* YieldExpression */: + case 189 /* YieldExpression */: return checkYieldExpression(node); - case 244 /* JsxExpression */: + case 247 /* JsxExpression */: return checkJsxExpression(node); - case 237 /* JsxElement */: + case 240 /* JsxElement */: return checkJsxElement(node); - case 238 /* JsxSelfClosingElement */: + case 241 /* JsxSelfClosingElement */: return checkJsxSelfClosingElement(node); - case 239 /* JsxOpeningElement */: + case 242 /* JsxOpeningElement */: ts.Debug.fail("Shouldn't ever directly check a JsxOpeningElement"); } return unknownType; @@ -25281,13 +26267,24 @@ var ts; var func = ts.getContainingFunction(node); if (node.flags & 28 /* AccessibilityModifier */) { func = ts.getContainingFunction(node); - if (!(func.kind === 146 /* Constructor */ && ts.nodeIsPresent(func.body))) { + if (!(func.kind === 147 /* Constructor */ && ts.nodeIsPresent(func.body))) { error(node, ts.Diagnostics.A_parameter_property_is_only_allowed_in_a_constructor_implementation); } } if (node.questionToken && ts.isBindingPattern(node.name) && func.body) { error(node, ts.Diagnostics.A_binding_pattern_parameter_cannot_be_optional_in_an_implementation_signature); } + if (node.name.text === "this") { + if (ts.indexOf(func.parameters, node) !== 0) { + error(node, ts.Diagnostics.A_this_parameter_must_be_the_first_parameter); + } + if (func.kind === 147 /* Constructor */ || func.kind === 151 /* ConstructSignature */ || func.kind === 156 /* ConstructorType */) { + error(node, ts.Diagnostics.A_constructor_cannot_have_a_this_parameter); + } + if (func.kind === 149 /* SetAccessor */) { + error(node, ts.Diagnostics.A_setter_cannot_have_a_this_parameter); + } + } // Only check rest parameter type if it's not a binding pattern. Since binding patterns are // not allowed in a rest parameter, we already have an error from checkGrammarParameterList. if (node.dotDotDotToken && !ts.isBindingPattern(node.name) && !isArrayType(getTypeOfSymbol(node.symbol))) { @@ -25298,9 +26295,9 @@ var ts; if (!node.asteriskToken || !node.body) { return false; } - return node.kind === 145 /* MethodDeclaration */ || - node.kind === 217 /* FunctionDeclaration */ || - node.kind === 177 /* FunctionExpression */; + return node.kind === 146 /* MethodDeclaration */ || + node.kind === 219 /* FunctionDeclaration */ || + node.kind === 178 /* FunctionExpression */; } function getTypePredicateParameterIndex(parameterList, parameter) { if (parameterList) { @@ -25335,15 +26332,17 @@ var ts; error(parameterName, ts.Diagnostics.A_type_predicate_cannot_reference_a_rest_parameter); } else { - checkTypeAssignableTo(typePredicate.type, getTypeOfNode(parent.parameters[typePredicate.parameterIndex]), node.type); + 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, + /*headMessage*/ undefined, leadingError); } } else if (parameterName) { var hasReportedError = false; for (var _i = 0, _a = parent.parameters; _i < _a.length; _i++) { - var name_13 = _a[_i].name; - if (ts.isBindingPattern(name_13) && - checkIfTypePredicateVariableIsDeclaredInBindingPattern(name_13, parameterName, typePredicate.parameterName)) { + var name_14 = _a[_i].name; + if (ts.isBindingPattern(name_14) && + checkIfTypePredicateVariableIsDeclaredInBindingPattern(name_14, parameterName, typePredicate.parameterName)) { hasReportedError = true; break; } @@ -25356,30 +26355,30 @@ var ts; } function getTypePredicateParent(node) { switch (node.parent.kind) { - case 178 /* ArrowFunction */: - case 149 /* CallSignature */: - case 217 /* FunctionDeclaration */: - case 177 /* FunctionExpression */: - case 154 /* FunctionType */: - case 145 /* MethodDeclaration */: - case 144 /* MethodSignature */: - var parent_7 = node.parent; - if (node === parent_7.type) { - return parent_7; + case 179 /* ArrowFunction */: + case 150 /* CallSignature */: + case 219 /* FunctionDeclaration */: + case 178 /* FunctionExpression */: + case 155 /* FunctionType */: + case 146 /* MethodDeclaration */: + case 145 /* MethodSignature */: + var parent_8 = node.parent; + if (node === parent_8.type) { + return parent_8; } } } function checkIfTypePredicateVariableIsDeclaredInBindingPattern(pattern, predicateVariableNode, predicateVariableName) { for (var _i = 0, _a = pattern.elements; _i < _a.length; _i++) { - var name_14 = _a[_i].name; - if (name_14.kind === 69 /* Identifier */ && - name_14.text === predicateVariableName) { + var name_15 = _a[_i].name; + if (name_15.kind === 69 /* Identifier */ && + name_15.text === predicateVariableName) { error(predicateVariableNode, ts.Diagnostics.A_type_predicate_cannot_reference_element_0_in_a_binding_pattern, predicateVariableName); return true; } - else if (name_14.kind === 166 /* ArrayBindingPattern */ || - name_14.kind === 165 /* ObjectBindingPattern */) { - if (checkIfTypePredicateVariableIsDeclaredInBindingPattern(name_14, predicateVariableNode, predicateVariableName)) { + else if (name_15.kind === 167 /* ArrayBindingPattern */ || + name_15.kind === 166 /* ObjectBindingPattern */) { + if (checkIfTypePredicateVariableIsDeclaredInBindingPattern(name_15, predicateVariableNode, predicateVariableName)) { return true; } } @@ -25387,12 +26386,12 @@ var ts; } function checkSignatureDeclaration(node) { // Grammar checking - if (node.kind === 151 /* IndexSignature */) { + if (node.kind === 152 /* IndexSignature */) { checkGrammarIndexSignature(node); } - else if (node.kind === 154 /* FunctionType */ || node.kind === 217 /* FunctionDeclaration */ || node.kind === 155 /* ConstructorType */ || - node.kind === 149 /* CallSignature */ || node.kind === 146 /* Constructor */ || - node.kind === 150 /* ConstructSignature */) { + else if (node.kind === 155 /* FunctionType */ || node.kind === 219 /* FunctionDeclaration */ || node.kind === 156 /* ConstructorType */ || + node.kind === 150 /* CallSignature */ || node.kind === 147 /* Constructor */ || + node.kind === 151 /* ConstructSignature */) { checkGrammarFunctionLikeDeclaration(node); } checkTypeParameters(node.typeParameters); @@ -25404,10 +26403,10 @@ var ts; checkCollisionWithArgumentsInGeneratedCode(node); if (compilerOptions.noImplicitAny && !node.type) { switch (node.kind) { - case 150 /* ConstructSignature */: + case 151 /* ConstructSignature */: error(node, ts.Diagnostics.Construct_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type); break; - case 149 /* CallSignature */: + case 150 /* CallSignature */: error(node, ts.Diagnostics.Call_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type); break; } @@ -25437,7 +26436,7 @@ var ts; } } function checkTypeForDuplicateIndexSignatures(node) { - if (node.kind === 219 /* InterfaceDeclaration */) { + if (node.kind === 221 /* 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 @@ -25532,12 +26531,12 @@ var ts; if (n.kind === 97 /* ThisKeyword */) { error(n, ts.Diagnostics.this_cannot_be_referenced_in_current_location); } - else if (n.kind !== 177 /* FunctionExpression */ && n.kind !== 217 /* FunctionDeclaration */) { + else if (n.kind !== 178 /* FunctionExpression */ && n.kind !== 219 /* FunctionDeclaration */) { ts.forEachChild(n, markThisReferencesAsErrors); } } function isInstancePropertyWithInitializer(n) { - return n.kind === 143 /* PropertyDeclaration */ && + return n.kind === 144 /* PropertyDeclaration */ && !(n.flags & 32 /* Static */) && !!n.initializer; } @@ -25566,7 +26565,7 @@ var ts; var superCallStatement = void 0; for (var _i = 0, statements_2 = statements; _i < statements_2.length; _i++) { var statement = statements_2[_i]; - if (statement.kind === 199 /* ExpressionStatement */ && ts.isSuperCallExpression(statement.expression)) { + if (statement.kind === 201 /* ExpressionStatement */ && ts.isSuperCallExpression(statement.expression)) { superCallStatement = statement; break; } @@ -25590,7 +26589,7 @@ var ts; checkGrammarFunctionLikeDeclaration(node) || checkGrammarAccessor(node) || checkGrammarComputedPropertyName(node.name); checkDecorators(node); checkSignatureDeclaration(node); - if (node.kind === 147 /* GetAccessor */) { + if (node.kind === 148 /* GetAccessor */) { if (!ts.isInAmbientContext(node) && ts.nodeIsPresent(node.body) && (node.flags & 32768 /* HasImplicitReturn */)) { if (node.flags & 65536 /* HasExplicitReturn */) { if (compilerOptions.noImplicitReturns) { @@ -25605,13 +26604,13 @@ 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 === 138 /* ComputedPropertyName */) { + if (node.name.kind === 139 /* 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 === 147 /* GetAccessor */ ? 148 /* SetAccessor */ : 147 /* GetAccessor */; + var otherKind = node.kind === 148 /* GetAccessor */ ? 149 /* SetAccessor */ : 148 /* GetAccessor */; var otherAccessor = ts.getDeclarationOfKind(node.symbol, otherKind); if (otherAccessor) { if (((node.flags & 28 /* AccessibilityModifier */) !== (otherAccessor.flags & 28 /* AccessibilityModifier */))) { @@ -25633,7 +26632,7 @@ var ts; } getTypeOfAccessors(getSymbolOfNode(node)); } - if (node.parent.kind !== 169 /* ObjectLiteralExpression */) { + if (node.parent.kind !== 170 /* ObjectLiteralExpression */) { checkSourceElement(node.body); } else { @@ -25708,9 +26707,9 @@ var ts; var flags = ts.getCombinedNodeFlags(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 !== 219 /* InterfaceDeclaration */ && - n.parent.kind !== 218 /* ClassDeclaration */ && - n.parent.kind !== 190 /* ClassExpression */ && + if (n.parent.kind !== 221 /* InterfaceDeclaration */ && + n.parent.kind !== 220 /* ClassDeclaration */ && + n.parent.kind !== 191 /* ClassExpression */ && ts.isInAmbientContext(n)) { if (!(flags & 2 /* Ambient */)) { // It is nested in an ambient context, which means it is automatically exported @@ -25798,7 +26797,7 @@ 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 === 145 /* MethodDeclaration */ || node.kind === 144 /* MethodSignature */) && + var reportError = (node.kind === 146 /* MethodDeclaration */ || node.kind === 145 /* MethodSignature */) && (node.flags & 32 /* Static */) !== (subsequentNode.flags & 32 /* Static */); // we can get here in two cases // 1. mixed static and instance class members @@ -25840,7 +26839,7 @@ var ts; var current = declarations_4[_i]; var node = current; var inAmbientContext = ts.isInAmbientContext(node); - var inAmbientContextOrInterface = node.parent.kind === 219 /* InterfaceDeclaration */ || node.parent.kind === 157 /* TypeLiteral */ || inAmbientContext; + var inAmbientContextOrInterface = node.parent.kind === 221 /* InterfaceDeclaration */ || node.parent.kind === 158 /* TypeLiteral */ || inAmbientContext; if (inAmbientContextOrInterface) { // check if declarations are consecutive only if they are non-ambient // 1. ambient declarations can be interleaved @@ -25851,7 +26850,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 === 217 /* FunctionDeclaration */ || node.kind === 145 /* MethodDeclaration */ || node.kind === 144 /* MethodSignature */ || node.kind === 146 /* Constructor */) { + if (node.kind === 219 /* FunctionDeclaration */ || node.kind === 146 /* MethodDeclaration */ || node.kind === 145 /* MethodSignature */ || node.kind === 147 /* Constructor */) { var currentNodeFlags = getEffectiveDeclarationFlags(node, flagsToCheck); someNodeFlags |= currentNodeFlags; allNodeFlags &= currentNodeFlags; @@ -25973,16 +26972,16 @@ var ts; } function getDeclarationSpaces(d) { switch (d.kind) { - case 219 /* InterfaceDeclaration */: + case 221 /* InterfaceDeclaration */: return 2097152 /* ExportType */; - case 222 /* ModuleDeclaration */: + case 224 /* ModuleDeclaration */: return ts.isAmbientModule(d) || ts.getModuleInstanceState(d) !== 0 /* NonInstantiated */ ? 4194304 /* ExportNamespace */ | 1048576 /* ExportValue */ : 4194304 /* ExportNamespace */; - case 218 /* ClassDeclaration */: - case 221 /* EnumDeclaration */: + case 220 /* ClassDeclaration */: + case 223 /* EnumDeclaration */: return 2097152 /* ExportType */ | 1048576 /* ExportValue */; - case 225 /* ImportEqualsDeclaration */: + case 228 /* ImportEqualsDeclaration */: var result_1 = 0; var target = resolveAlias(getSymbolOfNode(d)); ts.forEach(target.declarations, function (d) { result_1 |= getDeclarationSpaces(d); }); @@ -26094,7 +27093,7 @@ var ts; return checkNonThenableType(type, location, message); } else { - if (type.id === promisedType.id || awaitedTypeStack.indexOf(promisedType.id) >= 0) { + if (type.id === promisedType.id || ts.indexOf(awaitedTypeStack, promisedType.id) >= 0) { // We have a bad actor in the form of a promise whose promised type is // the same promise type, or a mutually recursive promise. Return the // unknown type as we cannot guess the shape. If this were the actual @@ -26263,22 +27262,22 @@ var ts; var headMessage = getDiagnosticHeadMessageForDecoratorResolution(node); var errorInfo; switch (node.parent.kind) { - case 218 /* ClassDeclaration */: + case 220 /* ClassDeclaration */: var classSymbol = getSymbolOfNode(node.parent); var classConstructorType = getTypeOfSymbol(classSymbol); expectedReturnType = getUnionType([classConstructorType, voidType]); break; - case 140 /* Parameter */: + case 141 /* 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 143 /* PropertyDeclaration */: + case 144 /* 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 145 /* MethodDeclaration */: - case 147 /* GetAccessor */: - case 148 /* SetAccessor */: + case 146 /* MethodDeclaration */: + case 148 /* GetAccessor */: + case 149 /* SetAccessor */: var methodType = getTypeOfNode(node.parent); var descriptorType = createTypedPropertyDescriptorType(methodType); expectedReturnType = getUnionType([descriptorType, voidType]); @@ -26291,9 +27290,9 @@ var ts; // 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 === 153 /* TypeReference */) { + if (node && node.kind === 154 /* TypeReference */) { var root = getFirstIdentifier(node.typeName); - var meaning = root.parent.kind === 153 /* TypeReference */ ? 793056 /* Type */ : 1536 /* Namespace */; + var meaning = root.parent.kind === 154 /* TypeReference */ ? 793056 /* Type */ : 1536 /* 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 @@ -26340,20 +27339,20 @@ var ts; if (compilerOptions.emitDecoratorMetadata) { // we only need to perform these checks if we are emitting serialized type metadata for the target of a decorator. switch (node.kind) { - case 218 /* ClassDeclaration */: + case 220 /* ClassDeclaration */: var constructor = ts.getFirstConstructorWithBody(node); if (constructor) { checkParameterTypeAnnotationsAsExpressions(constructor); } break; - case 145 /* MethodDeclaration */: - case 147 /* GetAccessor */: - case 148 /* SetAccessor */: + case 146 /* MethodDeclaration */: + case 148 /* GetAccessor */: + case 149 /* SetAccessor */: checkParameterTypeAnnotationsAsExpressions(node); checkReturnTypeAnnotationAsExpression(node); break; - case 143 /* PropertyDeclaration */: - case 140 /* Parameter */: + case 144 /* PropertyDeclaration */: + case 141 /* Parameter */: checkTypeAnnotationAsExpression(node); break; } @@ -26376,7 +27375,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 === 138 /* ComputedPropertyName */) { + if (node.name && node.name.kind === 139 /* ComputedPropertyName */) { // This check will account for methods in class/interface declarations, // as well as accessors in classes/object literals checkComputedPropertyName(node.name); @@ -26427,7 +27426,7 @@ var ts; } function checkBlock(node) { // Grammar checking for SyntaxKind.Block - if (node.kind === 196 /* Block */) { + if (node.kind === 198 /* Block */) { checkGrammarStatementInAmbientContext(node); } ts.forEach(node.statements, checkSourceElement); @@ -26447,12 +27446,12 @@ var ts; if (!(identifier && identifier.text === name)) { return false; } - if (node.kind === 143 /* PropertyDeclaration */ || - node.kind === 142 /* PropertySignature */ || - node.kind === 145 /* MethodDeclaration */ || - node.kind === 144 /* MethodSignature */ || - node.kind === 147 /* GetAccessor */ || - node.kind === 148 /* SetAccessor */) { + if (node.kind === 144 /* PropertyDeclaration */ || + node.kind === 143 /* PropertySignature */ || + node.kind === 146 /* MethodDeclaration */ || + node.kind === 145 /* MethodSignature */ || + node.kind === 148 /* GetAccessor */ || + node.kind === 149 /* SetAccessor */) { // it is ok to have member named '_super' or '_this' - member access is always qualified return false; } @@ -26461,7 +27460,7 @@ var ts; return false; } var root = ts.getRootDeclaration(node); - if (root.kind === 140 /* Parameter */ && ts.nodeIsMissing(root.parent.body)) { + if (root.kind === 141 /* Parameter */ && ts.nodeIsMissing(root.parent.body)) { // just an overload - no codegen impact return false; } @@ -26514,12 +27513,12 @@ var ts; return; } // Uninstantiated modules shouldnt do this check - if (node.kind === 222 /* ModuleDeclaration */ && ts.getModuleInstanceState(node) !== 1 /* Instantiated */) { + if (node.kind === 224 /* 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 === 252 /* SourceFile */ && ts.isExternalOrCommonJsModule(parent)) { + if (parent.kind === 255 /* 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)); } @@ -26529,12 +27528,12 @@ var ts; return; } // Uninstantiated modules shouldnt do this check - if (node.kind === 222 /* ModuleDeclaration */ && ts.getModuleInstanceState(node) !== 1 /* Instantiated */) { + if (node.kind === 224 /* 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 === 252 /* SourceFile */ && ts.isExternalOrCommonJsModule(parent) && parent.flags & 2097152 /* HasAsyncFunctions */) { + if (parent.kind === 255 /* SourceFile */ && ts.isExternalOrCommonJsModule(parent) && parent.flags & 2097152 /* 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)); } @@ -26569,7 +27568,7 @@ var ts; // 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 === 215 /* VariableDeclaration */ && !node.initializer) { + if (node.kind === 217 /* VariableDeclaration */ && !node.initializer) { return; } var symbol = getSymbolOfNode(node); @@ -26579,24 +27578,24 @@ var ts; localDeclarationSymbol !== symbol && localDeclarationSymbol.flags & 2 /* BlockScopedVariable */) { if (getDeclarationFlagsFromSymbol(localDeclarationSymbol) & 3072 /* BlockScoped */) { - var varDeclList = ts.getAncestor(localDeclarationSymbol.valueDeclaration, 216 /* VariableDeclarationList */); - var container = varDeclList.parent.kind === 197 /* VariableStatement */ && varDeclList.parent.parent + var varDeclList = ts.getAncestor(localDeclarationSymbol.valueDeclaration, 218 /* VariableDeclarationList */); + var container = varDeclList.parent.kind === 199 /* 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 === 196 /* Block */ && ts.isFunctionLike(container.parent) || - container.kind === 223 /* ModuleBlock */ || - container.kind === 222 /* ModuleDeclaration */ || - container.kind === 252 /* SourceFile */); + (container.kind === 198 /* Block */ && ts.isFunctionLike(container.parent) || + container.kind === 225 /* ModuleBlock */ || + container.kind === 224 /* ModuleDeclaration */ || + container.kind === 255 /* 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_15 = symbolToString(localDeclarationSymbol); - error(node, ts.Diagnostics.Cannot_initialize_outer_scoped_variable_0_in_the_same_scope_as_block_scoped_declaration_1, name_15, name_15); + var name_16 = symbolToString(localDeclarationSymbol); + error(node, ts.Diagnostics.Cannot_initialize_outer_scoped_variable_0_in_the_same_scope_as_block_scoped_declaration_1, name_16, name_16); } } } @@ -26604,7 +27603,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 !== 140 /* Parameter */) { + if (ts.getRootDeclaration(node).kind !== 141 /* Parameter */) { return; } var func = ts.getContainingFunction(node); @@ -26615,7 +27614,7 @@ var ts; // check FunctionLikeDeclaration.locals (stores parameters\function local variable) // if it contains entry with a specified name and if this entry matches the resolved symbol if (referencedSymbol && referencedSymbol !== unknownSymbol && getSymbol(func.locals, referencedSymbol.name, 107455 /* Value */) === referencedSymbol) { - if (referencedSymbol.valueDeclaration.kind === 140 /* Parameter */) { + if (referencedSymbol.valueDeclaration.kind === 141 /* Parameter */) { if (referencedSymbol.valueDeclaration === node) { error(n, ts.Diagnostics.Parameter_0_cannot_be_referenced_in_its_initializer, ts.declarationNameToString(node.name)); return; @@ -26641,31 +27640,39 @@ 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 === 138 /* ComputedPropertyName */) { + if (node.name.kind === 139 /* ComputedPropertyName */) { checkComputedPropertyName(node.name); if (node.initializer) { checkExpressionCached(node.initializer); } } - if (node.kind === 167 /* BindingElement */) { + if (node.kind === 168 /* BindingElement */) { // check computed properties inside property names of binding elements - if (node.propertyName && node.propertyName.kind === 138 /* ComputedPropertyName */) { + if (node.propertyName && node.propertyName.kind === 139 /* ComputedPropertyName */) { checkComputedPropertyName(node.propertyName); } + // check private/protected variable access + var parent_9 = node.parent.parent; + var parentType = getTypeForBindingElementParent(parent_9); + var name_17 = node.propertyName || node.name; + var property = getPropertyOfType(parentType, getTextOfPropertyName(name_17)); + if (parent_9.initializer && property && getParentOfSymbol(property)) { + checkClassPropertyAccess(parent_9, parent_9.initializer, parentType, property); + } } // For a binding pattern, check contained binding elements if (ts.isBindingPattern(node.name)) { 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 === 140 /* Parameter */ && ts.nodeIsMissing(ts.getContainingFunction(node).body)) { + if (node.initializer && ts.getRootDeclaration(node).kind === 141 /* 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 !== 204 /* ForInStatement */) { + if (node.initializer && node.parent.parent.kind !== 206 /* ForInStatement */) { checkTypeAssignableTo(checkExpressionCached(node.initializer), getWidenedTypeForVariableLikeDeclaration(node), node, /*headMessage*/ undefined); checkParameterInitializer(node); } @@ -26676,7 +27683,7 @@ var ts; 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 !== 204 /* ForInStatement */) { + if (node.initializer && node.parent.parent.kind !== 206 /* ForInStatement */) { checkTypeAssignableTo(checkExpressionCached(node.initializer), type, node, /*headMessage*/ undefined); checkParameterInitializer(node); } @@ -26692,10 +27699,10 @@ var ts; checkTypeAssignableTo(checkExpressionCached(node.initializer), declarationType, node, /*headMessage*/ undefined); } } - if (node.kind !== 143 /* PropertyDeclaration */ && node.kind !== 142 /* PropertySignature */) { + if (node.kind !== 144 /* PropertyDeclaration */ && node.kind !== 143 /* PropertySignature */) { // We know we don't have a binding pattern or computed name here checkExportsOnMergedDeclarations(node); - if (node.kind === 215 /* VariableDeclaration */ || node.kind === 167 /* BindingElement */) { + if (node.kind === 217 /* VariableDeclaration */ || node.kind === 168 /* BindingElement */) { checkVarDeclaredNamesNotShadowed(node); } checkCollisionWithCapturedSuperVariable(node, node.name); @@ -26719,7 +27726,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 === 169 /* ObjectLiteralExpression */) { + if (node.modifiers && node.parent.kind === 170 /* ObjectLiteralExpression */) { if (ts.isAsyncFunctionLike(node)) { if (node.modifiers.length > 1) { return grammarErrorOnFirstToken(node, ts.Diagnostics.Modifiers_cannot_appear_here); @@ -26740,7 +27747,7 @@ var ts; checkGrammarStatementInAmbientContext(node); checkExpression(node.expression); checkSourceElement(node.thenStatement); - if (node.thenStatement.kind === 198 /* EmptyStatement */) { + if (node.thenStatement.kind === 200 /* EmptyStatement */) { error(node.thenStatement, ts.Diagnostics.The_body_of_an_if_statement_cannot_be_the_empty_statement); } checkSourceElement(node.elseStatement); @@ -26760,12 +27767,12 @@ var ts; function checkForStatement(node) { // Grammar checking if (!checkGrammarStatementInAmbientContext(node)) { - if (node.initializer && node.initializer.kind === 216 /* VariableDeclarationList */) { + if (node.initializer && node.initializer.kind === 218 /* VariableDeclarationList */) { checkGrammarVariableDeclarationList(node.initializer); } } if (node.initializer) { - if (node.initializer.kind === 216 /* VariableDeclarationList */) { + if (node.initializer.kind === 218 /* VariableDeclarationList */) { ts.forEach(node.initializer.declarations, checkVariableDeclaration); } else { @@ -26785,14 +27792,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 === 216 /* VariableDeclarationList */) { + if (node.initializer.kind === 218 /* 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 === 168 /* ArrayLiteralExpression */ || varExpr.kind === 169 /* ObjectLiteralExpression */) { + if (varExpr.kind === 169 /* ArrayLiteralExpression */ || varExpr.kind === 170 /* 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. @@ -26821,7 +27828,7 @@ var ts; // 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 === 216 /* VariableDeclarationList */) { + if (node.initializer.kind === 218 /* 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); @@ -26835,7 +27842,7 @@ 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 === 168 /* ArrayLiteralExpression */ || varExpr.kind === 169 /* ObjectLiteralExpression */) { + if (varExpr.kind === 169 /* ArrayLiteralExpression */ || varExpr.kind === 170 /* ObjectLiteralExpression */) { error(varExpr, ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern); } else if (!isTypeAnyOrAllConstituentTypesHaveKind(leftType, 258 /* StringLike */)) { @@ -26846,7 +27853,7 @@ var ts; 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); } } - var rightType = checkExpression(node.expression); + 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, 80896 /* ObjectType */ | 512 /* TypeParameter */)) { @@ -26863,7 +27870,7 @@ var ts; } } function checkRightHandSideOfForOf(rhsExpression) { - var expressionType = getTypeOfExpression(rhsExpression); + var expressionType = checkNonNullExpression(rhsExpression); return checkIteratedTypeOrElementType(expressionType, rhsExpression, /*allowStringInput*/ true); } function checkIteratedTypeOrElementType(inputType, errorNode, allowStringInput) { @@ -26926,7 +27933,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 & 4096 /* Reference */) && type.target === globalIterableType) { + if ((type.flags & 4096 /* Reference */) && type.target === getGlobalIterableType()) { typeAsIterable.iterableElementType = type.typeArguments[0]; } else { @@ -26967,7 +27974,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 & 4096 /* Reference */) && type.target === globalIteratorType) { + if ((type.flags & 4096 /* Reference */) && type.target === getGlobalIteratorType()) { typeAsIterator.iteratorElementType = type.typeArguments[0]; } else { @@ -27004,7 +28011,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 & 4096 /* Reference */) && type.target === globalIterableIteratorType) { + if ((type.flags & 4096 /* Reference */) && type.target === getGlobalIterableIteratorType()) { return type.typeArguments[0]; } return getElementTypeOfIterable(type, /*errorNode*/ undefined) || @@ -27080,7 +28087,11 @@ var ts; // TODO: Check that target label is valid } function isGetAccessorWithAnnotatedSetAccessor(node) { - return !!(node.kind === 147 /* GetAccessor */ && ts.getSetAccessorTypeAnnotationNode(ts.getDeclarationOfKind(node.symbol, 148 /* SetAccessor */))); + return !!(node.kind === 148 /* GetAccessor */ && ts.getSetAccessorTypeAnnotationNode(ts.getDeclarationOfKind(node.symbol, 149 /* SetAccessor */))); + } + function isUnwrappedReturnTypeVoidOrAny(func, returnType) { + var unwrappedReturnType = ts.isAsyncFunctionLike(func) ? getPromisedType(returnType) : returnType; + return maybeTypeOfKind(unwrappedReturnType, 16 /* Void */ | 1 /* Any */); } function checkReturnStatement(node) { // Grammar checking @@ -27090,12 +28101,12 @@ var ts; grammarErrorOnFirstToken(node, ts.Diagnostics.A_return_statement_can_only_be_used_within_a_function_body); } } - if (node.expression) { - var func = ts.getContainingFunction(node); - if (func) { - var signature = getSignatureFromDeclaration(func); - var returnType = getReturnTypeOfSignature(signature); - var exprType = checkExpressionCached(node.expression); + var func = ts.getContainingFunction(node); + if (func) { + var signature = getSignatureFromDeclaration(func); + var returnType = getReturnTypeOfSignature(signature); + if (strictNullChecks || node.expression) { + var exprType = node.expression ? checkExpressionCached(node.expression) : undefinedType; if (func.asteriskToken) { // A generator does not need its return expressions checked against its return type. // Instead, the yield expressions are checked against the element type. @@ -27103,30 +28114,36 @@ var ts; // for generators. return; } - if (func.kind === 148 /* SetAccessor */) { - error(node.expression, ts.Diagnostics.Setters_cannot_return_a_value); + if (func.kind === 149 /* SetAccessor */) { + if (node.expression) { + error(node.expression, ts.Diagnostics.Setters_cannot_return_a_value); + } } - else if (func.kind === 146 /* Constructor */) { - if (!checkTypeAssignableTo(exprType, returnType, node.expression)) { + else if (func.kind === 147 /* 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); } } else if (func.type || isGetAccessorWithAnnotatedSetAccessor(func)) { if (ts.isAsyncFunctionLike(func)) { var promisedType = getPromisedType(returnType); - var awaitedType = checkAwaitedType(exprType, node.expression, ts.Diagnostics.Return_expression_in_async_function_does_not_have_a_valid_callable_then_member); + var awaitedType = checkAwaitedType(exprType, node.expression || node, ts.Diagnostics.Return_expression_in_async_function_does_not_have_a_valid_callable_then_member); if (promisedType) { // If the function has a return type, but promisedType is // undefined, an error will be reported in checkAsyncFunctionReturnType // so we don't need to report one here. - checkTypeAssignableTo(awaitedType, promisedType, node.expression); + checkTypeAssignableTo(awaitedType, promisedType, node.expression || node); } } else { - checkTypeAssignableTo(exprType, returnType, node.expression); + checkTypeAssignableTo(exprType, returnType, node.expression || node); } } } + else if (func.kind !== 147 /* 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); + } } } function checkWithStatement(node) { @@ -27145,10 +28162,9 @@ var ts; var firstDefaultClause; var hasDuplicateDefaultClause = false; var expressionType = checkExpression(node.expression); - var expressionTypeIsStringLike = maybeTypeOfKind(expressionType, 258 /* StringLike */); ts.forEach(node.caseBlock.clauses, function (clause) { // Grammar check for duplicate default clauses, skip if we already report duplicate default clause - if (clause.kind === 246 /* DefaultClause */ && !hasDuplicateDefaultClause) { + if (clause.kind === 249 /* DefaultClause */ && !hasDuplicateDefaultClause) { if (firstDefaultClause === undefined) { firstDefaultClause = clause; } @@ -27160,18 +28176,15 @@ var ts; hasDuplicateDefaultClause = true; } } - if (produceDiagnostics && clause.kind === 245 /* CaseClause */) { + if (produceDiagnostics && clause.kind === 248 /* 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 assignable to or from the type of the 'switch' expression. + // 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); - var expressionTypeIsAssignableToCaseType = - // Permit 'number[] | "foo"' to be asserted to 'string'. - (expressionTypeIsStringLike && maybeTypeOfKind(caseType, 258 /* StringLike */)) || - isTypeAssignableTo(expressionType, caseType); - if (!expressionTypeIsAssignableToCaseType) { - // 'expressionType is not assignable to caseType', try the reversed check and report errors if it fails - checkTypeAssignableTo(caseType, expressionType, caseClause.expression, /*headMessage*/ undefined); + if (!isTypeComparableTo(expressionType, caseType)) { + // expressionType is not comparable to caseType, try the reversed check and report errors if it fails + checkTypeComparableTo(caseType, expressionType, caseClause.expression, /*headMessage*/ undefined); } } ts.forEach(clause.statements, checkSourceElement); @@ -27185,7 +28198,7 @@ var ts; if (ts.isFunctionLike(current)) { break; } - if (current.kind === 211 /* LabeledStatement */ && current.label.text === node.label.text) { + if (current.kind === 213 /* 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; @@ -27290,7 +28303,7 @@ 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 === 138 /* ComputedPropertyName */ || prop.parent === containingType.symbol) { + if (prop.valueDeclaration.name.kind === 139 /* ComputedPropertyName */ || prop.parent === containingType.symbol) { errorNode = prop.valueDeclaration; } else if (indexDeclaration) { @@ -27348,7 +28361,7 @@ var ts; var firstDecl; for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; - if (declaration.kind === 218 /* ClassDeclaration */ || declaration.kind === 219 /* InterfaceDeclaration */) { + if (declaration.kind === 220 /* ClassDeclaration */ || declaration.kind === 221 /* InterfaceDeclaration */) { if (!firstDecl) { firstDecl = declaration; } @@ -27504,7 +28517,7 @@ var ts; // 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 === 190 /* ClassExpression */) { + if (derivedClassDecl.kind === 191 /* ClassExpression */) { error(derivedClassDecl, ts.Diagnostics.Non_abstract_class_expression_does_not_implement_inherited_abstract_member_0_from_class_1, symbolToString(baseProperty), typeToString(baseType)); } else { @@ -27552,7 +28565,7 @@ var ts; } } function isAccessor(kind) { - return kind === 147 /* GetAccessor */ || kind === 148 /* SetAccessor */; + return kind === 148 /* GetAccessor */ || kind === 149 /* SetAccessor */; } function areTypeParametersIdentical(list1, list2) { if (!list1 && !list2) { @@ -27624,7 +28637,7 @@ var ts; var symbol = getSymbolOfNode(node); checkTypeParameterListsIdentical(node, symbol); // Only check this symbol once - var firstInterfaceDecl = ts.getDeclarationOfKind(symbol, 219 /* InterfaceDeclaration */); + var firstInterfaceDecl = ts.getDeclarationOfKind(symbol, 221 /* InterfaceDeclaration */); if (node === firstInterfaceDecl) { var type = getDeclaredTypeOfSymbol(symbol); var typeWithThis = getTypeWithThisArgument(type); @@ -27728,7 +28741,7 @@ var ts; return value; function evalConstant(e) { switch (e.kind) { - case 183 /* PrefixUnaryExpression */: + case 184 /* PrefixUnaryExpression */: var value_1 = evalConstant(e.operand); if (value_1 === undefined) { return undefined; @@ -27739,7 +28752,7 @@ var ts; case 50 /* TildeToken */: return ~value_1; } return undefined; - case 185 /* BinaryExpression */: + case 186 /* BinaryExpression */: var left = evalConstant(e.left); if (left === undefined) { return undefined; @@ -27764,11 +28777,11 @@ var ts; return undefined; case 8 /* NumericLiteral */: return +e.text; - case 176 /* ParenthesizedExpression */: + case 177 /* ParenthesizedExpression */: return evalConstant(e.expression); case 69 /* Identifier */: - case 171 /* ElementAccessExpression */: - case 170 /* PropertyAccessExpression */: + case 172 /* ElementAccessExpression */: + case 171 /* PropertyAccessExpression */: var member = initializer.parent; var currentType = getTypeOfSymbol(getSymbolOfNode(member.parent)); var enumType_1; @@ -27781,7 +28794,7 @@ var ts; } else { var expression = void 0; - if (e.kind === 171 /* ElementAccessExpression */) { + if (e.kind === 172 /* ElementAccessExpression */) { if (e.argumentExpression === undefined || e.argumentExpression.kind !== 9 /* StringLiteral */) { return undefined; @@ -27799,7 +28812,7 @@ var ts; if (current.kind === 69 /* Identifier */) { break; } - else if (current.kind === 170 /* PropertyAccessExpression */) { + else if (current.kind === 171 /* PropertyAccessExpression */) { current = current.expression; } else { @@ -27871,7 +28884,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 !== 221 /* EnumDeclaration */) { + if (declaration.kind !== 223 /* EnumDeclaration */) { return false; } var enumDeclaration = declaration; @@ -27894,8 +28907,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 === 218 /* ClassDeclaration */ || - (declaration.kind === 217 /* FunctionDeclaration */ && ts.nodeIsPresent(declaration.body))) && + if ((declaration.kind === 220 /* ClassDeclaration */ || + (declaration.kind === 219 /* FunctionDeclaration */ && ts.nodeIsPresent(declaration.body))) && !ts.isInAmbientContext(declaration)) { return declaration; } @@ -27957,7 +28970,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, 218 /* ClassDeclaration */); + var mergedClass = ts.getDeclarationOfKind(symbol, 220 /* ClassDeclaration */); if (mergedClass && inSameLexicalScope(node, mergedClass)) { getNodeLinks(node).flags |= 32768 /* LexicalModuleMergesWithClass */; @@ -28003,31 +29016,31 @@ var ts; } function checkModuleAugmentationElement(node, isGlobalAugmentation) { switch (node.kind) { - case 197 /* VariableStatement */: + case 199 /* 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 231 /* ExportAssignment */: - case 232 /* ExportDeclaration */: + case 234 /* ExportAssignment */: + case 235 /* ExportDeclaration */: grammarErrorOnFirstToken(node, ts.Diagnostics.Exports_and_export_assignments_are_not_permitted_in_module_augmentations); break; - case 225 /* ImportEqualsDeclaration */: + case 228 /* ImportEqualsDeclaration */: if (node.moduleReference.kind !== 9 /* StringLiteral */) { error(node.name, ts.Diagnostics.Module_augmentation_cannot_introduce_new_names_in_the_top_level_scope); break; } // fallthrough - case 226 /* ImportDeclaration */: + case 229 /* ImportDeclaration */: grammarErrorOnFirstToken(node, ts.Diagnostics.Imports_are_not_permitted_in_module_augmentations_Consider_moving_them_to_the_enclosing_external_module); break; - case 167 /* BindingElement */: - case 215 /* VariableDeclaration */: - var name_16 = node.name; - if (ts.isBindingPattern(name_16)) { - for (var _b = 0, _c = name_16.elements; _b < _c.length; _b++) { + case 168 /* BindingElement */: + case 217 /* VariableDeclaration */: + var name_18 = node.name; + if (ts.isBindingPattern(name_18)) { + for (var _b = 0, _c = name_18.elements; _b < _c.length; _b++) { var el = _c[_b]; // mark individual names in binding pattern checkModuleAugmentationElement(el, isGlobalAugmentation); @@ -28035,12 +29048,12 @@ var ts; break; } // fallthrough - case 218 /* ClassDeclaration */: - case 221 /* EnumDeclaration */: - case 217 /* FunctionDeclaration */: - case 219 /* InterfaceDeclaration */: - case 222 /* ModuleDeclaration */: - case 220 /* TypeAliasDeclaration */: + case 220 /* ClassDeclaration */: + case 223 /* EnumDeclaration */: + case 219 /* FunctionDeclaration */: + case 221 /* InterfaceDeclaration */: + case 224 /* ModuleDeclaration */: + case 222 /* TypeAliasDeclaration */: var symbol = getSymbolOfNode(node); if (symbol) { // module augmentations cannot introduce new names on the top level scope of the module @@ -28055,7 +29068,7 @@ var ts; } else { // symbol should not originate in augmentation - reportError = ts.isExternalModuleAugmentation(symbol.parent.valueDeclaration); + reportError = ts.isExternalModuleAugmentation(symbol.parent.declarations[0]); } } if (reportError) { @@ -28067,10 +29080,10 @@ var ts; } function getFirstIdentifier(node) { while (true) { - if (node.kind === 137 /* QualifiedName */) { + if (node.kind === 138 /* QualifiedName */) { node = node.left; } - else if (node.kind === 170 /* PropertyAccessExpression */) { + else if (node.kind === 171 /* PropertyAccessExpression */) { node = node.expression; } else { @@ -28086,9 +29099,9 @@ var ts; error(moduleName, ts.Diagnostics.String_literal_expected); return false; } - var inAmbientExternalModule = node.parent.kind === 223 /* ModuleBlock */ && ts.isAmbientModule(node.parent.parent); - if (node.parent.kind !== 252 /* SourceFile */ && !inAmbientExternalModule) { - error(moduleName, node.kind === 232 /* ExportDeclaration */ ? + var inAmbientExternalModule = node.parent.kind === 225 /* ModuleBlock */ && ts.isAmbientModule(node.parent.parent); + if (node.parent.kind !== 255 /* SourceFile */ && !inAmbientExternalModule) { + error(moduleName, node.kind === 235 /* ExportDeclaration */ ? ts.Diagnostics.Export_declarations_are_not_permitted_in_a_namespace : ts.Diagnostics.Import_declarations_in_a_namespace_cannot_reference_a_module); return false; @@ -28111,11 +29124,17 @@ var ts; var symbol = getSymbolOfNode(node); var target = resolveAlias(symbol); if (target !== unknownSymbol) { - var excludedMeanings = (symbol.flags & 107455 /* Value */ ? 107455 /* Value */ : 0) | + // For external modules symbol represent local symbol for an alias. + // This local symbol will merge any other local declarations (excluding other aliases) + // and symbol.flags will contains combined representation for all merged declaration. + // Based on symbol.flags we can compute a set of excluded meanings (meaning that resolved alias should not have, + // otherwise it will conflict with some local declaration). Note that in addition to normal flags we include matching SymbolFlags.Export* + // in order to prevent collisions with declarations that were exported from the current module (they still contribute to local names). + var excludedMeanings = (symbol.flags & (107455 /* Value */ | 1048576 /* ExportValue */) ? 107455 /* Value */ : 0) | (symbol.flags & 793056 /* Type */ ? 793056 /* Type */ : 0) | (symbol.flags & 1536 /* Namespace */ ? 1536 /* Namespace */ : 0); if (target.flags & excludedMeanings) { - var message = node.kind === 234 /* ExportSpecifier */ ? + var message = node.kind === 237 /* 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)); @@ -28143,7 +29162,7 @@ var ts; checkImportBinding(importClause); } if (importClause.namedBindings) { - if (importClause.namedBindings.kind === 228 /* NamespaceImport */) { + if (importClause.namedBindings.kind === 231 /* NamespaceImport */) { checkImportBinding(importClause.namedBindings); } else { @@ -28200,8 +29219,8 @@ var ts; // export { x, y } // export { x, y } from "foo" ts.forEach(node.exportClause.elements, checkExportSpecifier); - var inAmbientExternalModule = node.parent.kind === 223 /* ModuleBlock */ && ts.isAmbientModule(node.parent.parent); - if (node.parent.kind !== 252 /* SourceFile */ && !inAmbientExternalModule) { + var inAmbientExternalModule = node.parent.kind === 225 /* ModuleBlock */ && ts.isAmbientModule(node.parent.parent); + if (node.parent.kind !== 255 /* SourceFile */ && !inAmbientExternalModule) { error(node, ts.Diagnostics.Export_declarations_are_not_permitted_in_a_namespace); } } @@ -28215,7 +29234,7 @@ var ts; } } function checkGrammarModuleElementContext(node, errorMessage) { - if (node.parent.kind !== 252 /* SourceFile */ && node.parent.kind !== 223 /* ModuleBlock */ && node.parent.kind !== 222 /* ModuleDeclaration */) { + if (node.parent.kind !== 255 /* SourceFile */ && node.parent.kind !== 225 /* ModuleBlock */ && node.parent.kind !== 224 /* ModuleDeclaration */) { return grammarErrorOnFirstToken(node, errorMessage); } } @@ -28239,8 +29258,8 @@ 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 === 252 /* SourceFile */ ? node.parent : node.parent.parent; - if (container.kind === 222 /* ModuleDeclaration */ && !ts.isAmbientModule(container)) { + var container = node.parent.kind === 255 /* SourceFile */ ? node.parent : node.parent.parent; + if (container.kind === 224 /* ModuleDeclaration */ && !ts.isAmbientModule(container)) { error(node, ts.Diagnostics.An_export_assignment_cannot_be_used_in_a_namespace); return; } @@ -28315,7 +29334,7 @@ var ts; links.exportsChecked = true; } function isNotOverload(declaration) { - return declaration.kind !== 217 /* FunctionDeclaration */ || !!declaration.body; + return declaration.kind !== 219 /* FunctionDeclaration */ || !!declaration.body; } } function checkSourceElement(node) { @@ -28327,118 +29346,118 @@ 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 222 /* ModuleDeclaration */: - case 218 /* ClassDeclaration */: - case 219 /* InterfaceDeclaration */: - case 217 /* FunctionDeclaration */: + case 224 /* ModuleDeclaration */: + case 220 /* ClassDeclaration */: + case 221 /* InterfaceDeclaration */: + case 219 /* FunctionDeclaration */: cancellationToken.throwIfCancellationRequested(); } } switch (kind) { - case 139 /* TypeParameter */: + case 140 /* TypeParameter */: return checkTypeParameter(node); - case 140 /* Parameter */: + case 141 /* Parameter */: return checkParameter(node); - case 143 /* PropertyDeclaration */: - case 142 /* PropertySignature */: + case 144 /* PropertyDeclaration */: + case 143 /* PropertySignature */: return checkPropertyDeclaration(node); - case 154 /* FunctionType */: - case 155 /* ConstructorType */: - case 149 /* CallSignature */: - case 150 /* ConstructSignature */: + case 155 /* FunctionType */: + case 156 /* ConstructorType */: + case 150 /* CallSignature */: + case 151 /* ConstructSignature */: return checkSignatureDeclaration(node); - case 151 /* IndexSignature */: + case 152 /* IndexSignature */: return checkSignatureDeclaration(node); - case 145 /* MethodDeclaration */: - case 144 /* MethodSignature */: + case 146 /* MethodDeclaration */: + case 145 /* MethodSignature */: return checkMethodDeclaration(node); - case 146 /* Constructor */: + case 147 /* Constructor */: return checkConstructorDeclaration(node); - case 147 /* GetAccessor */: - case 148 /* SetAccessor */: + case 148 /* GetAccessor */: + case 149 /* SetAccessor */: return checkAccessorDeclaration(node); - case 153 /* TypeReference */: + case 154 /* TypeReference */: return checkTypeReferenceNode(node); - case 152 /* TypePredicate */: + case 153 /* TypePredicate */: return checkTypePredicate(node); - case 156 /* TypeQuery */: + case 157 /* TypeQuery */: return checkTypeQuery(node); - case 157 /* TypeLiteral */: + case 158 /* TypeLiteral */: return checkTypeLiteral(node); - case 158 /* ArrayType */: + case 159 /* ArrayType */: return checkArrayType(node); - case 159 /* TupleType */: + case 160 /* TupleType */: return checkTupleType(node); - case 160 /* UnionType */: - case 161 /* IntersectionType */: + case 161 /* UnionType */: + case 162 /* IntersectionType */: return checkUnionOrIntersectionType(node); - case 162 /* ParenthesizedType */: + case 163 /* ParenthesizedType */: return checkSourceElement(node.type); - case 217 /* FunctionDeclaration */: + case 219 /* FunctionDeclaration */: return checkFunctionDeclaration(node); - case 196 /* Block */: - case 223 /* ModuleBlock */: + case 198 /* Block */: + case 225 /* ModuleBlock */: return checkBlock(node); - case 197 /* VariableStatement */: + case 199 /* VariableStatement */: return checkVariableStatement(node); - case 199 /* ExpressionStatement */: + case 201 /* ExpressionStatement */: return checkExpressionStatement(node); - case 200 /* IfStatement */: + case 202 /* IfStatement */: return checkIfStatement(node); - case 201 /* DoStatement */: + case 203 /* DoStatement */: return checkDoStatement(node); - case 202 /* WhileStatement */: + case 204 /* WhileStatement */: return checkWhileStatement(node); - case 203 /* ForStatement */: + case 205 /* ForStatement */: return checkForStatement(node); - case 204 /* ForInStatement */: + case 206 /* ForInStatement */: return checkForInStatement(node); - case 205 /* ForOfStatement */: + case 207 /* ForOfStatement */: return checkForOfStatement(node); - case 206 /* ContinueStatement */: - case 207 /* BreakStatement */: + case 208 /* ContinueStatement */: + case 209 /* BreakStatement */: return checkBreakOrContinueStatement(node); - case 208 /* ReturnStatement */: + case 210 /* ReturnStatement */: return checkReturnStatement(node); - case 209 /* WithStatement */: + case 211 /* WithStatement */: return checkWithStatement(node); - case 210 /* SwitchStatement */: + case 212 /* SwitchStatement */: return checkSwitchStatement(node); - case 211 /* LabeledStatement */: + case 213 /* LabeledStatement */: return checkLabeledStatement(node); - case 212 /* ThrowStatement */: + case 214 /* ThrowStatement */: return checkThrowStatement(node); - case 213 /* TryStatement */: + case 215 /* TryStatement */: return checkTryStatement(node); - case 215 /* VariableDeclaration */: + case 217 /* VariableDeclaration */: return checkVariableDeclaration(node); - case 167 /* BindingElement */: + case 168 /* BindingElement */: return checkBindingElement(node); - case 218 /* ClassDeclaration */: + case 220 /* ClassDeclaration */: return checkClassDeclaration(node); - case 219 /* InterfaceDeclaration */: + case 221 /* InterfaceDeclaration */: return checkInterfaceDeclaration(node); - case 220 /* TypeAliasDeclaration */: + case 222 /* TypeAliasDeclaration */: return checkTypeAliasDeclaration(node); - case 221 /* EnumDeclaration */: + case 223 /* EnumDeclaration */: return checkEnumDeclaration(node); - case 222 /* ModuleDeclaration */: + case 224 /* ModuleDeclaration */: return checkModuleDeclaration(node); - case 226 /* ImportDeclaration */: + case 229 /* ImportDeclaration */: return checkImportDeclaration(node); - case 225 /* ImportEqualsDeclaration */: + case 228 /* ImportEqualsDeclaration */: return checkImportEqualsDeclaration(node); - case 232 /* ExportDeclaration */: + case 235 /* ExportDeclaration */: return checkExportDeclaration(node); - case 231 /* ExportAssignment */: + case 234 /* ExportAssignment */: return checkExportAssignment(node); - case 198 /* EmptyStatement */: + case 200 /* EmptyStatement */: checkGrammarStatementInAmbientContext(node); return; - case 214 /* DebuggerStatement */: + case 216 /* DebuggerStatement */: checkGrammarStatementInAmbientContext(node); return; - case 235 /* MissingDeclaration */: + case 238 /* MissingDeclaration */: return checkMissingDeclaration(node); } } @@ -28460,17 +29479,17 @@ var ts; for (var _i = 0, deferredNodes_1 = deferredNodes; _i < deferredNodes_1.length; _i++) { var node = deferredNodes_1[_i]; switch (node.kind) { - case 177 /* FunctionExpression */: - case 178 /* ArrowFunction */: - case 145 /* MethodDeclaration */: - case 144 /* MethodSignature */: + case 178 /* FunctionExpression */: + case 179 /* ArrowFunction */: + case 146 /* MethodDeclaration */: + case 145 /* MethodSignature */: checkFunctionExpressionOrObjectLiteralMethodDeferred(node); break; - case 147 /* GetAccessor */: - case 148 /* SetAccessor */: + case 148 /* GetAccessor */: + case 149 /* SetAccessor */: checkAccessorDeferred(node); break; - case 190 /* ClassExpression */: + case 191 /* ClassExpression */: checkClassExpressionDeferred(node); break; } @@ -28545,7 +29564,7 @@ var ts; function isInsideWithStatementBody(node) { if (node) { while (node.parent) { - if (node.parent.kind === 209 /* WithStatement */ && node.parent.statement === node) { + if (node.parent.kind === 211 /* WithStatement */ && node.parent.statement === node) { return true; } node = node.parent; @@ -28568,25 +29587,25 @@ var ts; copySymbols(location.locals, meaning); } switch (location.kind) { - case 252 /* SourceFile */: + case 255 /* SourceFile */: if (!ts.isExternalOrCommonJsModule(location)) { break; } - case 222 /* ModuleDeclaration */: + case 224 /* ModuleDeclaration */: copySymbols(getSymbolOfNode(location).exports, meaning & 8914931 /* ModuleMember */); break; - case 221 /* EnumDeclaration */: + case 223 /* EnumDeclaration */: copySymbols(getSymbolOfNode(location).exports, meaning & 8 /* EnumMember */); break; - case 190 /* ClassExpression */: + case 191 /* 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 218 /* ClassDeclaration */: - case 219 /* InterfaceDeclaration */: + case 220 /* ClassDeclaration */: + case 221 /* 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. @@ -28595,7 +29614,7 @@ var ts; copySymbols(getSymbolOfNode(location).members, meaning & 793056 /* Type */); } break; - case 177 /* FunctionExpression */: + case 178 /* FunctionExpression */: var funcName = location.name; if (funcName) { copySymbol(location.symbol, meaning); @@ -28644,48 +29663,51 @@ var ts; } function isTypeDeclaration(node) { switch (node.kind) { - case 139 /* TypeParameter */: - case 218 /* ClassDeclaration */: - case 219 /* InterfaceDeclaration */: - case 220 /* TypeAliasDeclaration */: - case 221 /* EnumDeclaration */: + case 140 /* TypeParameter */: + case 220 /* ClassDeclaration */: + case 221 /* InterfaceDeclaration */: + case 222 /* TypeAliasDeclaration */: + case 223 /* 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 === 137 /* QualifiedName */) { + while (node.parent && node.parent.kind === 138 /* QualifiedName */) { node = node.parent; } - return node.parent && node.parent.kind === 153 /* TypeReference */; + return node.parent && node.parent.kind === 154 /* TypeReference */; } function isHeritageClauseElementIdentifier(entityName) { var node = entityName; - while (node.parent && node.parent.kind === 170 /* PropertyAccessExpression */) { + while (node.parent && node.parent.kind === 171 /* PropertyAccessExpression */) { node = node.parent; } - return node.parent && node.parent.kind === 192 /* ExpressionWithTypeArguments */; + return node.parent && node.parent.kind === 193 /* ExpressionWithTypeArguments */; } - function isNodeWithinClass(node, classDeclaration) { + function forEachEnclosingClass(node, callback) { + var result; while (true) { node = ts.getContainingClass(node); - if (!node) { - return false; - } - if (node === classDeclaration) { - return true; - } + if (!node) + break; + if (result = callback(node)) + break; } + return result; + } + function isNodeWithinClass(node, classDeclaration) { + return !!forEachEnclosingClass(node, function (n) { return n === classDeclaration; }); } function getLeftSideOfImportEqualsOrExportAssignment(nodeOnRightSide) { - while (nodeOnRightSide.parent.kind === 137 /* QualifiedName */) { + while (nodeOnRightSide.parent.kind === 138 /* QualifiedName */) { nodeOnRightSide = nodeOnRightSide.parent; } - if (nodeOnRightSide.parent.kind === 225 /* ImportEqualsDeclaration */) { + if (nodeOnRightSide.parent.kind === 228 /* ImportEqualsDeclaration */) { return nodeOnRightSide.parent.moduleReference === nodeOnRightSide && nodeOnRightSide.parent; } - if (nodeOnRightSide.parent.kind === 231 /* ExportAssignment */) { + if (nodeOnRightSide.parent.kind === 234 /* ExportAssignment */) { return nodeOnRightSide.parent.expression === nodeOnRightSide && nodeOnRightSide.parent; } return undefined; @@ -28697,7 +29719,7 @@ var ts; if (ts.isDeclarationName(entityName)) { return getSymbolOfNode(entityName.parent); } - if (ts.isInJavaScriptFile(entityName) && entityName.parent.kind === 170 /* PropertyAccessExpression */) { + if (ts.isInJavaScriptFile(entityName) && entityName.parent.kind === 171 /* PropertyAccessExpression */) { var specialPropertyAssignmentKind = ts.getSpecialPropertyAssignmentKind(entityName.parent.parent); switch (specialPropertyAssignmentKind) { case 1 /* ExportsProperty */: @@ -28709,11 +29731,11 @@ var ts; default: } } - if (entityName.parent.kind === 231 /* ExportAssignment */) { + if (entityName.parent.kind === 234 /* ExportAssignment */) { return resolveEntityName(entityName, /*all meanings*/ 107455 /* Value */ | 793056 /* Type */ | 1536 /* Namespace */ | 8388608 /* Alias */); } - if (entityName.kind !== 170 /* PropertyAccessExpression */) { + if (entityName.kind !== 171 /* PropertyAccessExpression */) { if (isInRightSideOfImportOrExportAssignment(entityName)) { // Since we already checked for ExportAssignment, this really could only be an Import return getSymbolOfPartOfRightHandSideOfImportEquals(entityName); @@ -28725,7 +29747,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 === 192 /* ExpressionWithTypeArguments */) { + if (entityName.parent.kind === 193 /* ExpressionWithTypeArguments */) { meaning = 793056 /* Type */; // In a class 'extends' clause we are also looking for a value. if (ts.isExpressionWithTypeArgumentsInClassExtendsClause(entityName.parent)) { @@ -28738,30 +29760,28 @@ var ts; meaning |= 8388608 /* Alias */; return resolveEntityName(entityName, meaning); } - else if ((entityName.parent.kind === 239 /* JsxOpeningElement */) || - (entityName.parent.kind === 238 /* JsxSelfClosingElement */) || - (entityName.parent.kind === 241 /* JsxClosingElement */)) { - return getJsxTagSymbol(entityName.parent); - } else if (ts.isExpression(entityName)) { if (ts.nodeIsMissing(entityName)) { // Missing entity name. return undefined; } if (entityName.kind === 69 /* Identifier */) { + if (ts.isJSXTagName(entityName) && isJsxIntrinsicIdentifier(entityName)) { + return getIntrinsicTagSymbol(entityName.parent); + } // Include aliases in the meaning, this ensures that we do not follow aliases to where they point and instead // return the alias symbol. var meaning = 107455 /* Value */ | 8388608 /* Alias */; return resolveEntityName(entityName, meaning); } - else if (entityName.kind === 170 /* PropertyAccessExpression */) { + else if (entityName.kind === 171 /* PropertyAccessExpression */) { var symbol = getNodeLinks(entityName).resolvedSymbol; if (!symbol) { checkPropertyAccessExpression(entityName); } return getNodeLinks(entityName).resolvedSymbol; } - else if (entityName.kind === 137 /* QualifiedName */) { + else if (entityName.kind === 138 /* QualifiedName */) { var symbol = getNodeLinks(entityName).resolvedSymbol; if (!symbol) { checkQualifiedName(entityName); @@ -28770,16 +29790,16 @@ var ts; } } else if (isTypeReferenceIdentifier(entityName)) { - var meaning = entityName.parent.kind === 153 /* TypeReference */ ? 793056 /* Type */ : 1536 /* Namespace */; + var meaning = entityName.parent.kind === 154 /* TypeReference */ ? 793056 /* Type */ : 1536 /* Namespace */; // Include aliases in the meaning, this ensures that we do not follow aliases to where they point and instead // return the alias symbol. meaning |= 8388608 /* Alias */; return resolveEntityName(entityName, meaning); } - else if (entityName.parent.kind === 242 /* JsxAttribute */) { + else if (entityName.parent.kind === 245 /* JsxAttribute */) { return getJsxAttributePropertySymbol(entityName.parent); } - if (entityName.parent.kind === 152 /* TypePredicate */) { + if (entityName.parent.kind === 153 /* TypePredicate */) { return resolveEntityName(entityName, /*meaning*/ 1 /* FunctionScopedVariable */); } // Do we want to return undefined here? @@ -28796,12 +29816,12 @@ var ts; } if (node.kind === 69 /* Identifier */) { if (isInRightSideOfImportOrExportAssignment(node)) { - return node.parent.kind === 231 /* ExportAssignment */ + return node.parent.kind === 234 /* ExportAssignment */ ? getSymbolOfEntityNameOrPropertyAccessExpression(node) : getSymbolOfPartOfRightHandSideOfImportEquals(node); } - else if (node.parent.kind === 167 /* BindingElement */ && - node.parent.parent.kind === 165 /* ObjectBindingPattern */ && + else if (node.parent.kind === 168 /* BindingElement */ && + node.parent.parent.kind === 166 /* ObjectBindingPattern */ && node === node.parent.propertyName) { var typeOfPattern = getTypeOfNode(node.parent.parent); var propertyDeclaration = typeOfPattern && getPropertyOfType(typeOfPattern, node.text); @@ -28812,19 +29832,19 @@ var ts; } switch (node.kind) { case 69 /* Identifier */: - case 170 /* PropertyAccessExpression */: - case 137 /* QualifiedName */: + case 171 /* PropertyAccessExpression */: + case 138 /* QualifiedName */: return getSymbolOfEntityNameOrPropertyAccessExpression(node); case 97 /* ThisKeyword */: case 95 /* SuperKeyword */: var type = ts.isExpression(node) ? checkExpression(node) : getTypeFromTypeNode(node); return type.symbol; - case 163 /* ThisType */: + case 164 /* ThisType */: return getTypeFromTypeNode(node).symbol; case 121 /* ConstructorKeyword */: // constructor keyword for an overload, should take us to the definition if it exist var constructorDeclaration = node.parent; - if (constructorDeclaration && constructorDeclaration.kind === 146 /* Constructor */) { + if (constructorDeclaration && constructorDeclaration.kind === 147 /* Constructor */) { return constructorDeclaration.parent.symbol; } return undefined; @@ -28832,14 +29852,14 @@ var ts; // External module name in an import declaration if ((ts.isExternalModuleImportEqualsDeclaration(node.parent.parent) && ts.getExternalModuleImportEqualsDeclarationExpression(node.parent.parent) === node) || - ((node.parent.kind === 226 /* ImportDeclaration */ || node.parent.kind === 232 /* ExportDeclaration */) && + ((node.parent.kind === 229 /* ImportDeclaration */ || node.parent.kind === 235 /* ExportDeclaration */) && node.parent.moduleSpecifier === node)) { return resolveExternalModuleName(node, node); } // Fall through case 8 /* NumericLiteral */: // index access - if (node.parent.kind === 171 /* ElementAccessExpression */ && node.parent.argumentExpression === node) { + if (node.parent.kind === 172 /* ElementAccessExpression */ && node.parent.argumentExpression === node) { var objectType = checkExpression(node.parent.expression); if (objectType === unknownType) return undefined; @@ -28856,7 +29876,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 === 250 /* ShorthandPropertyAssignment */) { + if (location && location.kind === 253 /* ShorthandPropertyAssignment */) { return resolveEntityName(location.name, 107455 /* Value */ | 8388608 /* Alias */); } return undefined; @@ -28944,9 +29964,9 @@ var ts; function getRootSymbols(symbol) { if (symbol.flags & 268435456 /* SyntheticProperty */) { var symbols_3 = []; - var name_17 = symbol.name; + var name_19 = symbol.name; ts.forEach(getSymbolLinks(symbol).containingType.types, function (t) { - var symbol = getPropertyOfType(t, name_17); + var symbol = getPropertyOfType(t, name_19); if (symbol) { symbols_3.push(symbol); } @@ -29006,11 +30026,11 @@ var ts; } var parentSymbol = getParentOfSymbol(symbol); if (parentSymbol) { - if (parentSymbol.flags & 512 /* ValueModule */ && parentSymbol.valueDeclaration.kind === 252 /* SourceFile */) { + if (parentSymbol.flags & 512 /* ValueModule */ && parentSymbol.valueDeclaration.kind === 255 /* SourceFile */) { return parentSymbol.valueDeclaration; } for (var n = node.parent; n; n = n.parent) { - if ((n.kind === 222 /* ModuleDeclaration */ || n.kind === 221 /* EnumDeclaration */) && getSymbolOfNode(n) === parentSymbol) { + if ((n.kind === 224 /* ModuleDeclaration */ || n.kind === 223 /* EnumDeclaration */) && getSymbolOfNode(n) === parentSymbol) { return n; } } @@ -29052,7 +30072,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 === 196 /* Block */ && ts.isIterationStatement(container.parent, /*lookInLabeledStatements*/ false); + var inLoopBodyBlock = container.kind === 198 /* Block */ && ts.isIterationStatement(container.parent, /*lookInLabeledStatements*/ false); links.isDeclarationWithCollidingName = !ts.isBlockScopedContainerTopLevel(container) && (!isDeclaredInLoop || (!inLoopInitializer && !inLoopBodyBlock)); } else { @@ -29078,22 +30098,22 @@ var ts; } function isValueAliasDeclaration(node) { switch (node.kind) { - case 225 /* ImportEqualsDeclaration */: - case 227 /* ImportClause */: - case 228 /* NamespaceImport */: - case 230 /* ImportSpecifier */: - case 234 /* ExportSpecifier */: + case 228 /* ImportEqualsDeclaration */: + case 230 /* ImportClause */: + case 231 /* NamespaceImport */: + case 233 /* ImportSpecifier */: + case 237 /* ExportSpecifier */: return isAliasResolvedToValue(getSymbolOfNode(node)); - case 232 /* ExportDeclaration */: + case 235 /* ExportDeclaration */: var exportClause = node.exportClause; return exportClause && ts.forEach(exportClause.elements, isValueAliasDeclaration); - case 231 /* ExportAssignment */: + case 234 /* ExportAssignment */: return node.expression && node.expression.kind === 69 /* Identifier */ ? isAliasResolvedToValue(getSymbolOfNode(node)) : true; } return false; } function isTopLevelValueImportEqualsWithEntityName(node) { - if (node.parent.kind !== 252 /* SourceFile */ || !ts.isInternalModuleImportEqualsDeclaration(node)) { + if (node.parent.kind !== 255 /* SourceFile */ || !ts.isInternalModuleImportEqualsDeclaration(node)) { // parent is not source file or it is not reference to internal module return false; } @@ -29155,7 +30175,7 @@ var ts; return getNodeLinks(node).enumMemberValue; } function getConstantValue(node) { - if (node.kind === 251 /* EnumMember */) { + if (node.kind === 254 /* EnumMember */) { return getEnumMemberValue(node); } var symbol = getNodeLinks(node).resolvedSymbol; @@ -29231,9 +30251,15 @@ var ts; getSymbolDisplayBuilder().buildTypeDisplay(getReturnTypeOfSignature(signature), writer, enclosingDeclaration, flags); } function writeTypeOfExpression(expr, enclosingDeclaration, flags, writer) { - var type = getTypeOfExpression(expr); + var type = getWidenedType(getTypeOfExpression(expr)); getSymbolDisplayBuilder().buildTypeDisplay(type, writer, enclosingDeclaration, flags); } + function writeBaseConstructorTypeOfClass(node, enclosingDeclaration, flags, writer) { + var classType = getDeclaredTypeOfSymbol(getSymbolOfNode(node)); + resolveBaseTypesOfClass(classType); + var baseType = classType.resolvedBaseTypes.length ? classType.resolvedBaseTypes[0] : unknownType; + getSymbolDisplayBuilder().buildTypeDisplay(baseType, writer, enclosingDeclaration, flags); + } function hasGlobalName(name) { return ts.hasProperty(globals, name); } @@ -29263,6 +30289,7 @@ var ts; writeTypeOfDeclaration: writeTypeOfDeclaration, writeReturnTypeOfSignatureDeclaration: writeReturnTypeOfSignatureDeclaration, writeTypeOfExpression: writeTypeOfExpression, + writeBaseConstructorTypeOfClass: writeBaseConstructorTypeOfClass, isSymbolAccessible: isSymbolAccessible, isEntityNameVisible: isEntityNameVisible, getConstantValue: getConstantValue, @@ -29281,7 +30308,7 @@ var ts; if (!moduleSymbol) { return undefined; } - return ts.getDeclarationOfKind(moduleSymbol, 252 /* SourceFile */); + return ts.getDeclarationOfKind(moduleSymbol, 255 /* SourceFile */); } function initializeTypeChecker() { // Bind all source files and propagate errors @@ -29297,6 +30324,9 @@ var ts; if (file.moduleAugmentations.length) { (augmentations || (augmentations = [])).push(file.moduleAugmentations); } + if (file.wasReferenced && file.symbol && file.symbol.globalExports) { + mergeSymbolTable(globals, file.symbol.globalExports); + } }); if (augmentations) { // merge module augmentations. @@ -29328,6 +30358,7 @@ var ts; getGlobalMethodDecoratorType = ts.memoize(function () { return getGlobalType("MethodDecorator"); }); getGlobalParameterDecoratorType = ts.memoize(function () { return getGlobalType("ParameterDecorator"); }); getGlobalTypedPropertyDescriptorType = ts.memoize(function () { return getGlobalType("TypedPropertyDescriptor", /*arity*/ 1); }); + getGlobalESSymbolConstructorSymbol = ts.memoize(function () { return getGlobalValueSymbol("Symbol"); }); getGlobalPromiseType = ts.memoize(function () { return getGlobalType("Promise", /*arity*/ 1); }); tryGetGlobalPromiseType = ts.memoize(function () { return getGlobalSymbol("Promise", 793056 /* Type */, /*diagnostic*/ undefined) && getGlobalPromiseType(); }); getGlobalPromiseLikeType = ts.memoize(function () { return getGlobalType("PromiseLike", /*arity*/ 1); }); @@ -29335,26 +30366,18 @@ var ts; getGlobalPromiseConstructorSymbol = ts.memoize(function () { return getGlobalValueSymbol("Promise"); }); getGlobalPromiseConstructorLikeType = ts.memoize(function () { return getGlobalType("PromiseConstructorLike"); }); getGlobalThenableType = ts.memoize(createThenableType); - // If we're in ES6 mode, load the TemplateStringsArray. - // Otherwise, default to 'unknown' for the purposes of type checking in LS scenarios. + getGlobalTemplateStringsArrayType = ts.memoize(function () { return getGlobalType("TemplateStringsArray"); }); if (languageVersion >= 2 /* ES6 */) { - globalTemplateStringsArrayType = getGlobalType("TemplateStringsArray"); - globalESSymbolType = getGlobalType("Symbol"); - globalESSymbolConstructorSymbol = getGlobalValueSymbol("Symbol"); - globalIterableType = getGlobalType("Iterable", /*arity*/ 1); - globalIteratorType = getGlobalType("Iterator", /*arity*/ 1); - globalIterableIteratorType = getGlobalType("IterableIterator", /*arity*/ 1); + 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); }); + getGlobalIterableIteratorType = ts.memoize(function () { return getGlobalType("IterableIterator", /*arity*/ 1); }); } else { - globalTemplateStringsArrayType = unknownType; - // Consider putting Symbol interface in lib.d.ts. On the plus side, putting it in lib.d.ts would make it - // extensible for Polyfilling Symbols. But putting it into lib.d.ts could also break users that have - // a global Symbol already, particularly if it is a class. - globalESSymbolType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined); - globalESSymbolConstructorSymbol = undefined; - globalIterableType = emptyGenericType; - globalIteratorType = emptyGenericType; - globalIterableIteratorType = emptyGenericType; + getGlobalESSymbolType = ts.memoize(function () { return emptyObjectType; }); + getGlobalIterableType = ts.memoize(function () { return emptyGenericType; }); + getGlobalIteratorType = ts.memoize(function () { return emptyGenericType; }); + getGlobalIterableIteratorType = ts.memoize(function () { return emptyGenericType; }); } anyArrayType = createArrayType(anyType); var symbol = getGlobalSymbol("ReadonlyArray", 793056 /* Type */, /*diagnostic*/ undefined); @@ -29385,14 +30408,14 @@ var ts; return false; } if (!ts.nodeCanBeDecorated(node)) { - if (node.kind === 145 /* MethodDeclaration */ && !ts.nodeIsPresent(node.body)) { + if (node.kind === 146 /* 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 === 147 /* GetAccessor */ || node.kind === 148 /* SetAccessor */) { + else if (node.kind === 148 /* GetAccessor */ || node.kind === 149 /* 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); @@ -29402,38 +30425,38 @@ var ts; } function checkGrammarModifiers(node) { switch (node.kind) { - case 147 /* GetAccessor */: - case 148 /* SetAccessor */: - case 146 /* Constructor */: - case 143 /* PropertyDeclaration */: - case 142 /* PropertySignature */: - case 145 /* MethodDeclaration */: - case 144 /* MethodSignature */: - case 151 /* IndexSignature */: - case 222 /* ModuleDeclaration */: - case 226 /* ImportDeclaration */: - case 225 /* ImportEqualsDeclaration */: - case 232 /* ExportDeclaration */: - case 231 /* ExportAssignment */: - case 140 /* Parameter */: + case 148 /* GetAccessor */: + case 149 /* SetAccessor */: + case 147 /* Constructor */: + case 144 /* PropertyDeclaration */: + case 143 /* PropertySignature */: + case 146 /* MethodDeclaration */: + case 145 /* MethodSignature */: + case 152 /* IndexSignature */: + case 224 /* ModuleDeclaration */: + case 229 /* ImportDeclaration */: + case 228 /* ImportEqualsDeclaration */: + case 235 /* ExportDeclaration */: + case 234 /* ExportAssignment */: + case 141 /* Parameter */: break; - case 217 /* FunctionDeclaration */: + case 219 /* FunctionDeclaration */: if (node.modifiers && (node.modifiers.length > 1 || node.modifiers[0].kind !== 118 /* AsyncKeyword */) && - node.parent.kind !== 223 /* ModuleBlock */ && node.parent.kind !== 252 /* SourceFile */) { + node.parent.kind !== 225 /* ModuleBlock */ && node.parent.kind !== 255 /* SourceFile */) { return grammarErrorOnFirstToken(node, ts.Diagnostics.Modifiers_cannot_appear_here); } break; - case 218 /* ClassDeclaration */: - case 219 /* InterfaceDeclaration */: - case 197 /* VariableStatement */: - case 220 /* TypeAliasDeclaration */: - if (node.modifiers && node.parent.kind !== 223 /* ModuleBlock */ && node.parent.kind !== 252 /* SourceFile */) { + case 220 /* ClassDeclaration */: + case 221 /* InterfaceDeclaration */: + case 199 /* VariableStatement */: + case 222 /* TypeAliasDeclaration */: + if (node.modifiers && node.parent.kind !== 225 /* ModuleBlock */ && node.parent.kind !== 255 /* SourceFile */) { return grammarErrorOnFirstToken(node, ts.Diagnostics.Modifiers_cannot_appear_here); } break; - case 221 /* EnumDeclaration */: + case 223 /* EnumDeclaration */: if (node.modifiers && (node.modifiers.length > 1 || node.modifiers[0].kind !== 74 /* ConstKeyword */) && - node.parent.kind !== 223 /* ModuleBlock */ && node.parent.kind !== 252 /* SourceFile */) { + node.parent.kind !== 225 /* ModuleBlock */ && node.parent.kind !== 255 /* SourceFile */) { return grammarErrorOnFirstToken(node, ts.Diagnostics.Modifiers_cannot_appear_here); } break; @@ -29448,16 +30471,16 @@ var ts; for (var _i = 0, _a = node.modifiers; _i < _a.length; _i++) { var modifier = _a[_i]; if (modifier.kind !== 127 /* ReadonlyKeyword */) { - if (node.kind === 142 /* PropertySignature */ || node.kind === 144 /* MethodSignature */) { + if (node.kind === 143 /* PropertySignature */ || node.kind === 145 /* MethodSignature */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_type_member, ts.tokenToString(modifier.kind)); } - if (node.kind === 151 /* IndexSignature */) { + if (node.kind === 152 /* 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 !== 221 /* EnumDeclaration */ && node.parent.kind === 218 /* ClassDeclaration */) { + if (node.kind !== 223 /* EnumDeclaration */ && node.parent.kind === 220 /* ClassDeclaration */) { return grammarErrorOnNode(node, ts.Diagnostics.A_class_member_cannot_have_the_0_keyword, ts.tokenToString(74 /* ConstKeyword */)); } break; @@ -29483,7 +30506,7 @@ 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 === 223 /* ModuleBlock */ || node.parent.kind === 252 /* SourceFile */) { + else if (node.parent.kind === 225 /* ModuleBlock */ || node.parent.kind === 255 /* SourceFile */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_module_or_namespace_element, text); } else if (flags & 128 /* Abstract */) { @@ -29506,10 +30529,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 === 223 /* ModuleBlock */ || node.parent.kind === 252 /* SourceFile */) { + else if (node.parent.kind === 225 /* ModuleBlock */ || node.parent.kind === 255 /* SourceFile */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_module_or_namespace_element, "static"); } - else if (node.kind === 140 /* Parameter */) { + else if (node.kind === 141 /* Parameter */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "static"); } else if (flags & 128 /* Abstract */) { @@ -29522,7 +30545,7 @@ var ts; if (flags & 64 /* Readonly */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "readonly"); } - else if (node.kind !== 143 /* PropertyDeclaration */ && node.kind !== 142 /* PropertySignature */ && node.kind !== 151 /* IndexSignature */) { + else if (node.kind !== 144 /* PropertyDeclaration */ && node.kind !== 143 /* PropertySignature */ && node.kind !== 152 /* IndexSignature */) { return grammarErrorOnNode(modifier, ts.Diagnostics.readonly_modifier_can_only_appear_on_a_property_declaration_or_index_signature); } flags |= 64 /* Readonly */; @@ -29541,10 +30564,10 @@ 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 === 218 /* ClassDeclaration */) { + else if (node.parent.kind === 220 /* ClassDeclaration */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_class_element, "export"); } - else if (node.kind === 140 /* Parameter */) { + else if (node.kind === 141 /* Parameter */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "export"); } flags |= 1 /* Export */; @@ -29556,13 +30579,13 @@ var ts; 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 === 218 /* ClassDeclaration */) { + else if (node.parent.kind === 220 /* ClassDeclaration */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_class_element, "declare"); } - else if (node.kind === 140 /* Parameter */) { + else if (node.kind === 141 /* Parameter */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "declare"); } - else if (ts.isInAmbientContext(node.parent) && node.parent.kind === 223 /* ModuleBlock */) { + else if (ts.isInAmbientContext(node.parent) && node.parent.kind === 225 /* ModuleBlock */) { return grammarErrorOnNode(modifier, ts.Diagnostics.A_declare_modifier_cannot_be_used_in_an_already_ambient_context); } flags |= 2 /* Ambient */; @@ -29572,14 +30595,14 @@ var ts; if (flags & 128 /* Abstract */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "abstract"); } - if (node.kind !== 218 /* ClassDeclaration */) { - if (node.kind !== 145 /* MethodDeclaration */ && - node.kind !== 143 /* PropertyDeclaration */ && - node.kind !== 147 /* GetAccessor */ && - node.kind !== 148 /* SetAccessor */) { + if (node.kind !== 220 /* ClassDeclaration */) { + if (node.kind !== 146 /* MethodDeclaration */ && + node.kind !== 144 /* PropertyDeclaration */ && + node.kind !== 148 /* GetAccessor */ && + node.kind !== 149 /* SetAccessor */) { return grammarErrorOnNode(modifier, ts.Diagnostics.abstract_modifier_can_only_appear_on_a_class_method_or_property_declaration); } - if (!(node.parent.kind === 218 /* ClassDeclaration */ && node.parent.flags & 128 /* Abstract */)) { + if (!(node.parent.kind === 220 /* ClassDeclaration */ && node.parent.flags & 128 /* Abstract */)) { return grammarErrorOnNode(modifier, ts.Diagnostics.Abstract_methods_can_only_appear_within_an_abstract_class); } if (flags & 32 /* Static */) { @@ -29598,7 +30621,7 @@ var ts; 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 === 140 /* Parameter */) { + else if (node.kind === 141 /* Parameter */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "async"); } flags |= 256 /* Async */; @@ -29606,7 +30629,7 @@ var ts; break; } } - if (node.kind === 146 /* Constructor */) { + if (node.kind === 147 /* Constructor */) { if (flags & 32 /* Static */) { return grammarErrorOnNode(lastStatic, ts.Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration, "static"); } @@ -29621,10 +30644,10 @@ var ts; } return; } - else if ((node.kind === 226 /* ImportDeclaration */ || node.kind === 225 /* ImportEqualsDeclaration */) && flags & 2 /* Ambient */) { + else if ((node.kind === 229 /* ImportDeclaration */ || node.kind === 228 /* ImportEqualsDeclaration */) && flags & 2 /* Ambient */) { return grammarErrorOnNode(lastDeclare, ts.Diagnostics.A_0_modifier_cannot_be_used_with_an_import_declaration, "declare"); } - else if (node.kind === 140 /* Parameter */ && (flags & 28 /* AccessibilityModifier */) && ts.isBindingPattern(node.name)) { + else if (node.kind === 141 /* Parameter */ && (flags & 28 /* AccessibilityModifier */) && ts.isBindingPattern(node.name)) { return grammarErrorOnNode(node, ts.Diagnostics.A_parameter_property_may_not_be_a_binding_pattern); } if (flags & 256 /* Async */) { @@ -29636,10 +30659,10 @@ var ts; return grammarErrorOnNode(asyncModifier, ts.Diagnostics.Async_functions_are_only_available_when_targeting_ECMAScript_6_and_higher); } switch (node.kind) { - case 145 /* MethodDeclaration */: - case 217 /* FunctionDeclaration */: - case 177 /* FunctionExpression */: - case 178 /* ArrowFunction */: + case 146 /* MethodDeclaration */: + case 219 /* FunctionDeclaration */: + case 178 /* FunctionExpression */: + case 179 /* ArrowFunction */: if (!node.asteriskToken) { return false; } @@ -29705,7 +30728,7 @@ var ts; checkGrammarParameterList(node.parameters) || checkGrammarArrowFunction(node, file); } function checkGrammarArrowFunction(node, file) { - if (node.kind === 178 /* ArrowFunction */) { + if (node.kind === 179 /* ArrowFunction */) { var arrowFunction = node; var startLine = ts.getLineAndCharacterOfPosition(file, arrowFunction.equalsGreaterThanToken.pos).line; var endLine = ts.getLineAndCharacterOfPosition(file, arrowFunction.equalsGreaterThanToken.end).line; @@ -29768,7 +30791,7 @@ var ts; 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 === 191 /* OmittedExpression */) { + if (arg.kind === 192 /* OmittedExpression */) { return grammarErrorAtPos(sourceFile, arg.pos, 0, ts.Diagnostics.Argument_expression_expected); } } @@ -29842,19 +30865,19 @@ var ts; } function checkGrammarComputedPropertyName(node) { // If node is not a computedPropertyName, just skip the grammar checking - if (node.kind !== 138 /* ComputedPropertyName */) { + if (node.kind !== 139 /* ComputedPropertyName */) { return false; } var computedPropertyName = node; - if (computedPropertyName.expression.kind === 185 /* BinaryExpression */ && computedPropertyName.expression.operatorToken.kind === 24 /* CommaToken */) { + if (computedPropertyName.expression.kind === 186 /* BinaryExpression */ && computedPropertyName.expression.operatorToken.kind === 24 /* 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 === 217 /* FunctionDeclaration */ || - node.kind === 177 /* FunctionExpression */ || - node.kind === 145 /* MethodDeclaration */); + ts.Debug.assert(node.kind === 219 /* FunctionDeclaration */ || + node.kind === 178 /* FunctionExpression */ || + node.kind === 146 /* MethodDeclaration */); if (ts.isInAmbientContext(node)) { return grammarErrorOnNode(node.asteriskToken, ts.Diagnostics.Generators_are_not_allowed_in_an_ambient_context); } @@ -29878,21 +30901,21 @@ var ts; var SetAccessor = 4; var GetOrSetAccessor = GetAccessor | SetAccessor; var _loop_1 = function(prop) { - var name_18 = prop.name; - if (prop.kind === 191 /* OmittedExpression */ || - name_18.kind === 138 /* ComputedPropertyName */) { + var name_20 = prop.name; + if (prop.kind === 192 /* OmittedExpression */ || + name_20.kind === 139 /* ComputedPropertyName */) { // If the name is not a ComputedPropertyName, the grammar checking will skip it - checkGrammarComputedPropertyName(name_18); + checkGrammarComputedPropertyName(name_20); return "continue"; } - if (prop.kind === 250 /* ShorthandPropertyAssignment */ && !inDestructuring && prop.objectAssignmentInitializer) { + if (prop.kind === 253 /* 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) }; } // 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 !== 145 /* MethodDeclaration */) { + if (mod.kind !== 118 /* AsyncKeyword */ || prop.kind !== 146 /* MethodDeclaration */) { grammarErrorOnNode(mod, ts.Diagnostics._0_modifier_cannot_be_used_here, ts.getTextOfNode(mod)); } }); @@ -29905,44 +30928,44 @@ 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 === 249 /* PropertyAssignment */ || prop.kind === 250 /* ShorthandPropertyAssignment */) { + if (prop.kind === 252 /* PropertyAssignment */ || prop.kind === 253 /* ShorthandPropertyAssignment */) { // Grammar checking for computedPropertyName and shorthandPropertyAssignment checkGrammarForInvalidQuestionMark(prop, prop.questionToken, ts.Diagnostics.An_object_member_cannot_be_declared_optional); - if (name_18.kind === 8 /* NumericLiteral */) { - checkGrammarNumericLiteral(name_18); + if (name_20.kind === 8 /* NumericLiteral */) { + checkGrammarNumericLiteral(name_20); } currentKind = Property; } - else if (prop.kind === 145 /* MethodDeclaration */) { + else if (prop.kind === 146 /* MethodDeclaration */) { currentKind = Property; } - else if (prop.kind === 147 /* GetAccessor */) { + else if (prop.kind === 148 /* GetAccessor */) { currentKind = GetAccessor; } - else if (prop.kind === 148 /* SetAccessor */) { + else if (prop.kind === 149 /* SetAccessor */) { currentKind = SetAccessor; } else { ts.Debug.fail("Unexpected syntax kind:" + prop.kind); } - if (!ts.hasProperty(seen, name_18.text)) { - seen[name_18.text] = currentKind; + if (!ts.hasProperty(seen, name_20.text)) { + seen[name_20.text] = currentKind; } else { - var existingKind = seen[name_18.text]; + var existingKind = seen[name_20.text]; if (currentKind === Property && existingKind === Property) { return "continue"; } else if ((currentKind & GetOrSetAccessor) && (existingKind & GetOrSetAccessor)) { if (existingKind !== GetOrSetAccessor && currentKind !== existingKind) { - seen[name_18.text] = currentKind | existingKind; + seen[name_20.text] = currentKind | existingKind; } else { - return { value: grammarErrorOnNode(name_18, ts.Diagnostics.An_object_literal_cannot_have_multiple_get_Slashset_accessors_with_the_same_name) }; + return { value: grammarErrorOnNode(name_20, ts.Diagnostics.An_object_literal_cannot_have_multiple_get_Slashset_accessors_with_the_same_name) }; } } else { - return { value: grammarErrorOnNode(name_18, ts.Diagnostics.An_object_literal_cannot_have_property_and_accessor_with_the_same_name) }; + return { value: grammarErrorOnNode(name_20, ts.Diagnostics.An_object_literal_cannot_have_property_and_accessor_with_the_same_name) }; } } }; @@ -29950,26 +30973,25 @@ var ts; var prop = _a[_i]; var state_2 = _loop_1(prop); if (typeof state_2 === "object") return state_2.value; - if (state_2 === "continue") continue; } } function checkGrammarJsxElement(node) { var seen = {}; for (var _i = 0, _a = node.attributes; _i < _a.length; _i++) { var attr = _a[_i]; - if (attr.kind === 243 /* JsxSpreadAttribute */) { + if (attr.kind === 246 /* JsxSpreadAttribute */) { continue; } var jsxAttr = attr; - var name_19 = jsxAttr.name; - if (!ts.hasProperty(seen, name_19.text)) { - seen[name_19.text] = true; + var name_21 = jsxAttr.name; + if (!ts.hasProperty(seen, name_21.text)) { + seen[name_21.text] = true; } else { - return grammarErrorOnNode(name_19, ts.Diagnostics.JSX_elements_cannot_have_multiple_attributes_with_the_same_name); + return grammarErrorOnNode(name_21, ts.Diagnostics.JSX_elements_cannot_have_multiple_attributes_with_the_same_name); } var initializer = jsxAttr.initializer; - if (initializer && initializer.kind === 244 /* JsxExpression */ && !initializer.expression) { + if (initializer && initializer.kind === 247 /* JsxExpression */ && !initializer.expression) { return grammarErrorOnNode(jsxAttr.initializer, ts.Diagnostics.JSX_attributes_must_only_be_assigned_a_non_empty_expression); } } @@ -29978,7 +31000,7 @@ var ts; if (checkGrammarStatementInAmbientContext(forInOrOfStatement)) { return true; } - if (forInOrOfStatement.initializer.kind === 216 /* VariableDeclarationList */) { + if (forInOrOfStatement.initializer.kind === 218 /* VariableDeclarationList */) { var variableList = forInOrOfStatement.initializer; if (!checkGrammarVariableDeclarationList(variableList)) { var declarations = variableList.declarations; @@ -29993,20 +31015,20 @@ var ts; return false; } if (declarations.length > 1) { - var diagnostic = forInOrOfStatement.kind === 204 /* ForInStatement */ + var diagnostic = forInOrOfStatement.kind === 206 /* 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 === 204 /* ForInStatement */ + var diagnostic = forInOrOfStatement.kind === 206 /* 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 === 204 /* ForInStatement */ + var diagnostic = forInOrOfStatement.kind === 206 /* 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); @@ -30029,10 +31051,10 @@ var ts; else if (accessor.typeParameters) { return grammarErrorOnNode(accessor.name, ts.Diagnostics.An_accessor_cannot_have_type_parameters); } - else if (kind === 147 /* GetAccessor */ && accessor.parameters.length) { + else if (kind === 148 /* GetAccessor */ && accessor.parameters.length) { return grammarErrorOnNode(accessor.name, ts.Diagnostics.A_get_accessor_cannot_have_parameters); } - else if (kind === 148 /* SetAccessor */) { + else if (kind === 149 /* SetAccessor */) { if (accessor.type) { return grammarErrorOnNode(accessor.name, ts.Diagnostics.A_set_accessor_cannot_have_a_return_type_annotation); } @@ -30067,7 +31089,7 @@ var ts; checkGrammarForGenerator(node)) { return true; } - if (node.parent.kind === 169 /* ObjectLiteralExpression */) { + if (node.parent.kind === 170 /* ObjectLiteralExpression */) { if (checkGrammarForInvalidQuestionMark(node, node.questionToken, ts.Diagnostics.A_class_member_cannot_be_declared_optional)) { return true; } @@ -30091,10 +31113,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 === 219 /* InterfaceDeclaration */) { + else if (node.parent.kind === 221 /* 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 === 157 /* TypeLiteral */) { + else if (node.parent.kind === 158 /* TypeLiteral */) { return checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_a_type_literal_must_directly_refer_to_a_built_in_symbol); } } @@ -30105,11 +31127,11 @@ var ts; return grammarErrorOnNode(node, ts.Diagnostics.Jump_target_cannot_cross_function_boundary); } switch (current.kind) { - case 211 /* LabeledStatement */: + case 213 /* 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 === 206 /* ContinueStatement */ + var isMisplacedContinueLabel = node.kind === 208 /* 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); @@ -30117,8 +31139,8 @@ var ts; return false; } break; - case 210 /* SwitchStatement */: - if (node.kind === 207 /* BreakStatement */ && !node.label) { + case 212 /* SwitchStatement */: + if (node.kind === 209 /* BreakStatement */ && !node.label) { // unlabeled break within switch statement - ok return false; } @@ -30133,13 +31155,13 @@ var ts; current = current.parent; } if (node.label) { - var message = node.kind === 207 /* BreakStatement */ + var message = node.kind === 209 /* 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 === 207 /* BreakStatement */ + var message = node.kind === 209 /* 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); @@ -30151,7 +31173,7 @@ var ts; if (node !== ts.lastOrUndefined(elements)) { return grammarErrorOnNode(node, ts.Diagnostics.A_rest_element_must_be_last_in_an_array_destructuring_pattern); } - if (node.name.kind === 166 /* ArrayBindingPattern */ || node.name.kind === 165 /* ObjectBindingPattern */) { + if (node.name.kind === 167 /* ArrayBindingPattern */ || node.name.kind === 166 /* ObjectBindingPattern */) { return grammarErrorOnNode(node.name, ts.Diagnostics.A_rest_element_cannot_contain_a_binding_pattern); } if (node.initializer) { @@ -30161,7 +31183,7 @@ var ts; } } function checkGrammarVariableDeclaration(node) { - if (node.parent.parent.kind !== 204 /* ForInStatement */ && node.parent.parent.kind !== 205 /* ForOfStatement */) { + if (node.parent.parent.kind !== 206 /* ForInStatement */ && node.parent.parent.kind !== 207 /* ForOfStatement */) { if (ts.isInAmbientContext(node)) { if (node.initializer) { // Error on equals token which immediate precedes the initializer @@ -30197,7 +31219,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 !== 191 /* OmittedExpression */) { + if (element.kind !== 192 /* OmittedExpression */) { checkGrammarNameInLetOrConstDeclarations(element.name); } } @@ -30214,15 +31236,15 @@ var ts; } function allowLetAndConstDeclarations(parent) { switch (parent.kind) { - case 200 /* IfStatement */: - case 201 /* DoStatement */: - case 202 /* WhileStatement */: - case 209 /* WithStatement */: - case 203 /* ForStatement */: - case 204 /* ForInStatement */: - case 205 /* ForOfStatement */: + case 202 /* IfStatement */: + case 203 /* DoStatement */: + case 204 /* WhileStatement */: + case 211 /* WithStatement */: + case 205 /* ForStatement */: + case 206 /* ForInStatement */: + case 207 /* ForOfStatement */: return false; - case 211 /* LabeledStatement */: + case 213 /* LabeledStatement */: return allowLetAndConstDeclarations(parent.parent); } return true; @@ -30278,7 +31300,7 @@ var ts; return true; } } - else if (node.parent.kind === 219 /* InterfaceDeclaration */) { + else if (node.parent.kind === 221 /* InterfaceDeclaration */) { if (checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_an_interface_must_directly_refer_to_a_built_in_symbol)) { return true; } @@ -30286,7 +31308,7 @@ var ts; return grammarErrorOnNode(node.initializer, ts.Diagnostics.An_interface_property_cannot_have_an_initializer); } } - else if (node.parent.kind === 157 /* TypeLiteral */) { + else if (node.parent.kind === 158 /* 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; } @@ -30311,12 +31333,12 @@ var ts; // export_opt AmbientDeclaration // // TODO: The spec needs to be amended to reflect this grammar. - if (node.kind === 219 /* InterfaceDeclaration */ || - node.kind === 220 /* TypeAliasDeclaration */ || - node.kind === 226 /* ImportDeclaration */ || - node.kind === 225 /* ImportEqualsDeclaration */ || - node.kind === 232 /* ExportDeclaration */ || - node.kind === 231 /* ExportAssignment */ || + if (node.kind === 221 /* InterfaceDeclaration */ || + node.kind === 222 /* TypeAliasDeclaration */ || + node.kind === 229 /* ImportDeclaration */ || + node.kind === 228 /* ImportEqualsDeclaration */ || + node.kind === 235 /* ExportDeclaration */ || + node.kind === 234 /* ExportAssignment */ || (node.flags & 2 /* Ambient */) || (node.flags & (1 /* Export */ | 512 /* Default */))) { return false; @@ -30326,7 +31348,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 === 197 /* VariableStatement */) { + if (ts.isDeclaration(decl) || decl.kind === 199 /* VariableStatement */) { if (checkGrammarTopLevelElementForRequiredDeclareModifier(decl)) { return true; } @@ -30352,7 +31374,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 === 196 /* Block */ || node.parent.kind === 223 /* ModuleBlock */ || node.parent.kind === 252 /* SourceFile */) { + if (node.parent.kind === 198 /* Block */ || node.parent.kind === 225 /* ModuleBlock */ || node.parent.kind === 255 /* SourceFile */) { var links_1 = getNodeLinks(node.parent); // Check if the containing block ever report this error if (!links_1.hasReportedStatementInAmbientContext) { @@ -30708,7 +31730,7 @@ var ts; function getDeclarationDiagnostics(host, resolver, targetSourceFile) { var declarationDiagnostics = ts.createDiagnosticCollection(); ts.forEachExpectedEmitFile(host, getDeclarationDiagnosticsFromFile, targetSourceFile); - return declarationDiagnostics.getDiagnostics(targetSourceFile.fileName); + return declarationDiagnostics.getDiagnostics(targetSourceFile ? targetSourceFile.fileName : undefined); function getDeclarationDiagnosticsFromFile(_a, sources, isBundledEmit) { var declarationFilePath = _a.declarationFilePath; emitDeclarations(host, resolver, declarationDiagnostics, declarationFilePath, sources, isBundledEmit); @@ -30788,7 +31810,7 @@ var ts; var oldWriter = writer; ts.forEach(moduleElementDeclarationEmitInfo, function (aliasEmitInfo) { if (aliasEmitInfo.isVisible && !aliasEmitInfo.asynchronousOutput) { - ts.Debug.assert(aliasEmitInfo.node.kind === 226 /* ImportDeclaration */); + ts.Debug.assert(aliasEmitInfo.node.kind === 229 /* ImportDeclaration */); createAndSetNewTextWriterWithSymbolWriter(); ts.Debug.assert(aliasEmitInfo.indent === 0 || (aliasEmitInfo.indent === 1 && isBundledEmit)); for (var i = 0; i < aliasEmitInfo.indent; i++) { @@ -30857,10 +31879,10 @@ var ts; var oldWriter = writer; ts.forEach(nodes, function (declaration) { var nodeToCheck; - if (declaration.kind === 215 /* VariableDeclaration */) { + if (declaration.kind === 217 /* VariableDeclaration */) { nodeToCheck = declaration.parent.parent; } - else if (declaration.kind === 229 /* NamedImports */ || declaration.kind === 230 /* ImportSpecifier */ || declaration.kind === 227 /* ImportClause */) { + else if (declaration.kind === 232 /* NamedImports */ || declaration.kind === 233 /* ImportSpecifier */ || declaration.kind === 230 /* ImportClause */) { ts.Debug.fail("We should be getting ImportDeclaration instead to write"); } else { @@ -30878,7 +31900,7 @@ var ts; // 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 === 226 /* ImportDeclaration */) { + if (moduleElementEmitInfo.node.kind === 229 /* 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; @@ -30888,12 +31910,12 @@ var ts; for (var declarationIndent = moduleElementEmitInfo.indent; declarationIndent; declarationIndent--) { increaseIndent(); } - if (nodeToCheck.kind === 222 /* ModuleDeclaration */) { + if (nodeToCheck.kind === 224 /* ModuleDeclaration */) { ts.Debug.assert(asynchronousSubModuleDeclarationEmitInfo === undefined); asynchronousSubModuleDeclarationEmitInfo = []; } writeModuleElement(nodeToCheck); - if (nodeToCheck.kind === 222 /* ModuleDeclaration */) { + if (nodeToCheck.kind === 224 /* ModuleDeclaration */) { moduleElementEmitInfo.subModuleElementDeclarationEmitInfo = asynchronousSubModuleDeclarationEmitInfo; asynchronousSubModuleDeclarationEmitInfo = undefined; } @@ -31001,35 +32023,37 @@ var ts; case 120 /* BooleanKeyword */: case 132 /* SymbolKeyword */: case 103 /* VoidKeyword */: - case 163 /* ThisType */: - case 164 /* StringLiteralType */: + case 134 /* UndefinedKeyword */: + case 93 /* NullKeyword */: + case 164 /* ThisType */: + case 165 /* StringLiteralType */: return writeTextOfNode(currentText, type); - case 192 /* ExpressionWithTypeArguments */: + case 193 /* ExpressionWithTypeArguments */: return emitExpressionWithTypeArguments(type); - case 153 /* TypeReference */: + case 154 /* TypeReference */: return emitTypeReference(type); - case 156 /* TypeQuery */: + case 157 /* TypeQuery */: return emitTypeQuery(type); - case 158 /* ArrayType */: + case 159 /* ArrayType */: return emitArrayType(type); - case 159 /* TupleType */: + case 160 /* TupleType */: return emitTupleType(type); - case 160 /* UnionType */: + case 161 /* UnionType */: return emitUnionType(type); - case 161 /* IntersectionType */: + case 162 /* IntersectionType */: return emitIntersectionType(type); - case 162 /* ParenthesizedType */: + case 163 /* ParenthesizedType */: return emitParenType(type); - case 154 /* FunctionType */: - case 155 /* ConstructorType */: + case 155 /* FunctionType */: + case 156 /* ConstructorType */: return emitSignatureDeclarationWithJsDocComments(type); - case 157 /* TypeLiteral */: + case 158 /* TypeLiteral */: return emitTypeLiteral(type); case 69 /* Identifier */: return emitEntityName(type); - case 137 /* QualifiedName */: + case 138 /* QualifiedName */: return emitEntityName(type); - case 152 /* TypePredicate */: + case 153 /* TypePredicate */: return emitTypePredicate(type); } function writeEntityName(entityName) { @@ -31037,8 +32061,8 @@ var ts; writeTextOfNode(currentText, entityName); } else { - var left = entityName.kind === 137 /* QualifiedName */ ? entityName.left : entityName.expression; - var right = entityName.kind === 137 /* QualifiedName */ ? entityName.right : entityName.name; + var left = entityName.kind === 138 /* QualifiedName */ ? entityName.left : entityName.expression; + var right = entityName.kind === 138 /* QualifiedName */ ? entityName.right : entityName.name; writeEntityName(left); write("."); writeTextOfNode(currentText, right); @@ -31047,13 +32071,13 @@ var ts; function emitEntityName(entityName) { var visibilityResult = resolver.isEntityNameVisible(entityName, // Aliases can be written asynchronously so use correct enclosing declaration - entityName.parent.kind === 225 /* ImportEqualsDeclaration */ ? entityName.parent : enclosingDeclaration); + entityName.parent.kind === 228 /* ImportEqualsDeclaration */ ? entityName.parent : enclosingDeclaration); handleSymbolAccessibilityError(visibilityResult); writeEntityName(entityName); } function emitExpressionWithTypeArguments(node) { if (ts.isSupportedExpressionWithTypeArguments(node)) { - ts.Debug.assert(node.expression.kind === 69 /* Identifier */ || node.expression.kind === 170 /* PropertyAccessExpression */); + ts.Debug.assert(node.expression.kind === 69 /* Identifier */ || node.expression.kind === 171 /* PropertyAccessExpression */); emitEntityName(node.expression); if (node.typeArguments) { write("<"); @@ -31132,9 +32156,9 @@ var ts; var count = 0; while (true) { count++; - var name_20 = baseName + "_" + count; - if (!ts.hasProperty(currentIdentifiers, name_20)) { - return name_20; + var name_22 = baseName + "_" + count; + if (!ts.hasProperty(currentIdentifiers, name_22)) { + return name_22; } } } @@ -31146,7 +32170,10 @@ var ts; else { // Expression var tempVarName = getExportDefaultTempVariableName(); - write("declare var "); + if (!noDeclare) { + write("declare "); + } + write("var "); write(tempVarName); write(": "); writer.getSymbolAccessibilityDiagnostic = getDefaultExportAccessibilityDiagnostic; @@ -31178,10 +32205,10 @@ var ts; if (isModuleElementVisible) { writeModuleElement(node); } - else if (node.kind === 225 /* ImportEqualsDeclaration */ || - (node.parent.kind === 252 /* SourceFile */ && isCurrentFileExternalModule)) { + else if (node.kind === 228 /* ImportEqualsDeclaration */ || + (node.parent.kind === 255 /* SourceFile */ && isCurrentFileExternalModule)) { var isVisible = void 0; - if (asynchronousSubModuleDeclarationEmitInfo && node.parent.kind !== 252 /* SourceFile */) { + if (asynchronousSubModuleDeclarationEmitInfo && node.parent.kind !== 255 /* SourceFile */) { // Import declaration of another module that is visited async so lets put it in right spot asynchronousSubModuleDeclarationEmitInfo.push({ node: node, @@ -31191,7 +32218,7 @@ var ts; }); } else { - if (node.kind === 226 /* ImportDeclaration */) { + if (node.kind === 229 /* ImportDeclaration */) { var importDeclaration = node; if (importDeclaration.importClause) { isVisible = (importDeclaration.importClause.name && resolver.isDeclarationVisible(importDeclaration.importClause)) || @@ -31209,23 +32236,23 @@ var ts; } function writeModuleElement(node) { switch (node.kind) { - case 217 /* FunctionDeclaration */: + case 219 /* FunctionDeclaration */: return writeFunctionDeclaration(node); - case 197 /* VariableStatement */: + case 199 /* VariableStatement */: return writeVariableStatement(node); - case 219 /* InterfaceDeclaration */: + case 221 /* InterfaceDeclaration */: return writeInterfaceDeclaration(node); - case 218 /* ClassDeclaration */: + case 220 /* ClassDeclaration */: return writeClassDeclaration(node); - case 220 /* TypeAliasDeclaration */: + case 222 /* TypeAliasDeclaration */: return writeTypeAliasDeclaration(node); - case 221 /* EnumDeclaration */: + case 223 /* EnumDeclaration */: return writeEnumDeclaration(node); - case 222 /* ModuleDeclaration */: + case 224 /* ModuleDeclaration */: return writeModuleDeclaration(node); - case 225 /* ImportEqualsDeclaration */: + case 228 /* ImportEqualsDeclaration */: return writeImportEqualsDeclaration(node); - case 226 /* ImportDeclaration */: + case 229 /* ImportDeclaration */: return writeImportDeclaration(node); default: ts.Debug.fail("Unknown symbol kind"); @@ -31233,7 +32260,7 @@ var ts; } 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 === 252 /* SourceFile */) { + if (node.parent.kind === 255 /* SourceFile */) { // If the node is exported if (node.flags & 1 /* Export */) { write("export "); @@ -31241,7 +32268,7 @@ var ts; if (node.flags & 512 /* Default */) { write("default "); } - else if (node.kind !== 219 /* InterfaceDeclaration */ && !noDeclare) { + else if (node.kind !== 221 /* InterfaceDeclaration */ && !noDeclare) { write("declare "); } } @@ -31293,7 +32320,7 @@ var ts; } function isVisibleNamedBinding(namedBindings) { if (namedBindings) { - if (namedBindings.kind === 228 /* NamespaceImport */) { + if (namedBindings.kind === 231 /* NamespaceImport */) { return resolver.isDeclarationVisible(namedBindings); } else { @@ -31317,7 +32344,7 @@ var ts; // If the default binding was emitted, write the separated write(", "); } - if (node.importClause.namedBindings.kind === 228 /* NamespaceImport */) { + if (node.importClause.namedBindings.kind === 231 /* NamespaceImport */) { write("* as "); writeTextOfNode(currentText, node.importClause.namedBindings.name); } @@ -31338,13 +32365,13 @@ var ts; // 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 !== 222 /* ModuleDeclaration */; + resultHasExternalModuleIndicator = resultHasExternalModuleIndicator || parent.kind !== 224 /* ModuleDeclaration */; var moduleSpecifier; - if (parent.kind === 225 /* ImportEqualsDeclaration */) { + if (parent.kind === 228 /* ImportEqualsDeclaration */) { var node = parent; moduleSpecifier = ts.getExternalModuleImportEqualsDeclarationExpression(node); } - else if (parent.kind === 222 /* ModuleDeclaration */) { + else if (parent.kind === 224 /* ModuleDeclaration */) { moduleSpecifier = parent.name; } else { @@ -31354,9 +32381,9 @@ var ts; if (moduleSpecifier.kind === 9 /* StringLiteral */ && isBundledEmit && (compilerOptions.out || compilerOptions.outFile)) { var moduleName = ts.getExternalModuleNameFromDeclaration(host, resolver, parent); if (moduleName) { - write("\""); + write('"'); write(moduleName); - write("\""); + write('"'); return; } } @@ -31414,7 +32441,7 @@ var ts; writeTextOfNode(currentText, node.name); } } - while (node.body.kind !== 223 /* ModuleBlock */) { + while (node.body.kind !== 225 /* ModuleBlock */) { node = node.body; write("."); writeTextOfNode(currentText, node.name); @@ -31479,7 +32506,7 @@ var ts; writeLine(); } function isPrivateMethodTypeParameter(node) { - return node.parent.kind === 145 /* MethodDeclaration */ && (node.parent.flags & 8 /* Private */); + return node.parent.kind === 146 /* MethodDeclaration */ && (node.parent.flags & 8 /* Private */); } function emitTypeParameters(typeParameters) { function emitTypeParameter(node) { @@ -31490,15 +32517,15 @@ var ts; // 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 === 154 /* FunctionType */ || - node.parent.kind === 155 /* ConstructorType */ || - (node.parent.parent && node.parent.parent.kind === 157 /* TypeLiteral */)) { - ts.Debug.assert(node.parent.kind === 145 /* MethodDeclaration */ || - node.parent.kind === 144 /* MethodSignature */ || - node.parent.kind === 154 /* FunctionType */ || - node.parent.kind === 155 /* ConstructorType */ || - node.parent.kind === 149 /* CallSignature */ || - node.parent.kind === 150 /* ConstructSignature */); + if (node.parent.kind === 155 /* FunctionType */ || + node.parent.kind === 156 /* ConstructorType */ || + (node.parent.parent && node.parent.parent.kind === 158 /* TypeLiteral */)) { + ts.Debug.assert(node.parent.kind === 146 /* MethodDeclaration */ || + node.parent.kind === 145 /* MethodSignature */ || + node.parent.kind === 155 /* FunctionType */ || + node.parent.kind === 156 /* ConstructorType */ || + node.parent.kind === 150 /* CallSignature */ || + node.parent.kind === 151 /* ConstructSignature */); emitType(node.constraint); } else { @@ -31509,31 +32536,31 @@ var ts; // Type parameter constraints are named by user so we should always be able to name it var diagnosticMessage; switch (node.parent.kind) { - case 218 /* ClassDeclaration */: + case 220 /* ClassDeclaration */: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_class_has_or_is_using_private_name_1; break; - case 219 /* InterfaceDeclaration */: + case 221 /* InterfaceDeclaration */: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1; break; - case 150 /* ConstructSignature */: + case 151 /* ConstructSignature */: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1; break; - case 149 /* CallSignature */: + case 150 /* CallSignature */: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1; break; - case 145 /* MethodDeclaration */: - case 144 /* MethodSignature */: + case 146 /* MethodDeclaration */: + case 145 /* 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 === 218 /* ClassDeclaration */) { + else if (node.parent.parent.kind === 220 /* 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 217 /* FunctionDeclaration */: + case 219 /* FunctionDeclaration */: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_function_has_or_is_using_private_name_1; break; default: @@ -31564,10 +32591,14 @@ var ts; else if (!isImplementsList && node.expression.kind === 93 /* NullKeyword */) { write("null"); } + else { + writer.getSymbolAccessibilityDiagnostic = getHeritageClauseVisibilityError; + resolver.writeBaseConstructorTypeOfClass(enclosingDeclaration, enclosingDeclaration, 2 /* UseTypeOfFunction */, writer); + } function getHeritageClauseVisibilityError(symbolAccessibilityResult) { var diagnosticMessage; // Heritage clause is written by user so it can always be named - if (node.parent.parent.kind === 218 /* ClassDeclaration */) { + if (node.parent.parent.kind === 220 /* 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 : @@ -31651,7 +32682,7 @@ var ts; 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 !== 215 /* VariableDeclaration */ || resolver.isDeclarationVisible(node)) { + if (node.kind !== 217 /* VariableDeclaration */ || resolver.isDeclarationVisible(node)) { if (ts.isBindingPattern(node.name)) { emitBindingPattern(node.name); } @@ -31661,10 +32692,10 @@ var ts; // what we want, namely the name expression enclosed in brackets. writeTextOfNode(currentText, node.name); // If optional property emit ? - if ((node.kind === 143 /* PropertyDeclaration */ || node.kind === 142 /* PropertySignature */) && ts.hasQuestionToken(node)) { + if ((node.kind === 144 /* PropertyDeclaration */ || node.kind === 143 /* PropertySignature */) && ts.hasQuestionToken(node)) { write("?"); } - if ((node.kind === 143 /* PropertyDeclaration */ || node.kind === 142 /* PropertySignature */) && node.parent.kind === 157 /* TypeLiteral */) { + if ((node.kind === 144 /* PropertyDeclaration */ || node.kind === 143 /* PropertySignature */) && node.parent.kind === 158 /* TypeLiteral */) { emitTypeOfVariableDeclarationFromTypeLiteral(node); } else if (!(node.flags & 8 /* Private */)) { @@ -31673,14 +32704,14 @@ var ts; } } function getVariableDeclarationTypeVisibilityDiagnosticMessage(symbolAccessibilityResult) { - if (node.kind === 215 /* VariableDeclaration */) { + if (node.kind === 217 /* 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 === 143 /* PropertyDeclaration */ || node.kind === 142 /* PropertySignature */) { + else if (node.kind === 144 /* PropertyDeclaration */ || node.kind === 143 /* PropertySignature */) { // TODO(jfreeman): Deal with computed properties in error reporting. if (node.flags & 32 /* Static */) { return symbolAccessibilityResult.errorModuleName ? @@ -31689,7 +32720,7 @@ var ts; 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 === 218 /* ClassDeclaration */) { + else if (node.parent.kind === 220 /* 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 : @@ -31721,7 +32752,7 @@ var ts; var elements = []; for (var _i = 0, _a = bindingPattern.elements; _i < _a.length; _i++) { var element = _a[_i]; - if (element.kind !== 191 /* OmittedExpression */) { + if (element.kind !== 192 /* OmittedExpression */) { elements.push(element); } } @@ -31791,7 +32822,7 @@ var ts; var type = getTypeAnnotationFromAccessor(node); if (!type) { // couldn't get type for the first accessor, try the another one - var anotherAccessor = node.kind === 147 /* GetAccessor */ ? accessors.setAccessor : accessors.getAccessor; + var anotherAccessor = node.kind === 148 /* GetAccessor */ ? accessors.setAccessor : accessors.getAccessor; type = getTypeAnnotationFromAccessor(anotherAccessor); if (type) { accessorWithTypeAnnotation = anotherAccessor; @@ -31804,7 +32835,7 @@ var ts; } function getTypeAnnotationFromAccessor(accessor) { if (accessor) { - return accessor.kind === 147 /* GetAccessor */ + return accessor.kind === 148 /* GetAccessor */ ? accessor.type // Getter - return type : accessor.parameters.length > 0 ? accessor.parameters[0].type // Setter parameter type @@ -31813,7 +32844,7 @@ var ts; } function getAccessorDeclarationTypeVisibilityError(symbolAccessibilityResult) { var diagnosticMessage; - if (accessorWithTypeAnnotation.kind === 148 /* SetAccessor */) { + if (accessorWithTypeAnnotation.kind === 149 /* 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 ? @@ -31863,17 +32894,17 @@ var ts; // so no need to verify if the declaration is visible if (!resolver.isImplementationOfOverload(node)) { emitJsDocComments(node); - if (node.kind === 217 /* FunctionDeclaration */) { + if (node.kind === 219 /* FunctionDeclaration */) { emitModuleElementDeclarationFlags(node); } - else if (node.kind === 145 /* MethodDeclaration */ || node.kind === 146 /* Constructor */) { + else if (node.kind === 146 /* MethodDeclaration */ || node.kind === 147 /* Constructor */) { emitClassMemberDeclarationFlags(node.flags); } - if (node.kind === 217 /* FunctionDeclaration */) { + if (node.kind === 219 /* FunctionDeclaration */) { write("function "); writeTextOfNode(currentText, node.name); } - else if (node.kind === 146 /* Constructor */) { + else if (node.kind === 147 /* Constructor */) { write("constructor"); } else { @@ -31892,14 +32923,14 @@ var ts; function emitSignatureDeclaration(node) { var prevEnclosingDeclaration = enclosingDeclaration; enclosingDeclaration = node; - if (node.kind === 151 /* IndexSignature */) { + if (node.kind === 152 /* IndexSignature */) { // Index signature can have readonly modifier emitClassMemberDeclarationFlags(node.flags); write("["); } else { // Construct signature or constructor type write new Signature - if (node.kind === 150 /* ConstructSignature */ || node.kind === 155 /* ConstructorType */) { + if (node.kind === 151 /* ConstructSignature */ || node.kind === 156 /* ConstructorType */) { write("new "); } emitTypeParameters(node.typeParameters); @@ -31907,22 +32938,22 @@ var ts; } // Parameters emitCommaList(node.parameters, emitParameterDeclaration); - if (node.kind === 151 /* IndexSignature */) { + if (node.kind === 152 /* IndexSignature */) { write("]"); } else { write(")"); } // If this is not a constructor and is not private, emit the return type - var isFunctionTypeOrConstructorType = node.kind === 154 /* FunctionType */ || node.kind === 155 /* ConstructorType */; - if (isFunctionTypeOrConstructorType || node.parent.kind === 157 /* TypeLiteral */) { + var isFunctionTypeOrConstructorType = node.kind === 155 /* FunctionType */ || node.kind === 156 /* ConstructorType */; + if (isFunctionTypeOrConstructorType || node.parent.kind === 158 /* TypeLiteral */) { // Emit type literal signature return type only if specified if (node.type) { write(isFunctionTypeOrConstructorType ? " => " : ": "); emitType(node.type); } } - else if (node.kind !== 146 /* Constructor */ && !(node.flags & 8 /* Private */)) { + else if (node.kind !== 147 /* Constructor */ && !(node.flags & 8 /* Private */)) { writeReturnTypeAtSignature(node, getReturnTypeVisibilityError); } enclosingDeclaration = prevEnclosingDeclaration; @@ -31933,26 +32964,26 @@ var ts; function getReturnTypeVisibilityError(symbolAccessibilityResult) { var diagnosticMessage; switch (node.kind) { - case 150 /* ConstructSignature */: + case 151 /* 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 149 /* CallSignature */: + case 150 /* 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 151 /* IndexSignature */: + case 152 /* 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 145 /* MethodDeclaration */: - case 144 /* MethodSignature */: + case 146 /* MethodDeclaration */: + case 145 /* MethodSignature */: if (node.flags & 32 /* Static */) { diagnosticMessage = symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* CannotBeNamed */ ? @@ -31960,7 +32991,7 @@ var ts; 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 === 218 /* ClassDeclaration */) { + else if (node.parent.kind === 220 /* 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 : @@ -31974,7 +33005,7 @@ var ts; ts.Diagnostics.Return_type_of_method_from_exported_interface_has_or_is_using_private_name_0; } break; - case 217 /* FunctionDeclaration */: + case 219 /* 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 : @@ -32009,9 +33040,9 @@ var ts; write("?"); } decreaseIndent(); - if (node.parent.kind === 154 /* FunctionType */ || - node.parent.kind === 155 /* ConstructorType */ || - node.parent.parent.kind === 157 /* TypeLiteral */) { + if (node.parent.kind === 155 /* FunctionType */ || + node.parent.kind === 156 /* ConstructorType */ || + node.parent.parent.kind === 158 /* TypeLiteral */) { emitTypeOfVariableDeclarationFromTypeLiteral(node); } else if (!(node.parent.flags & 8 /* Private */)) { @@ -32027,24 +33058,24 @@ var ts; } function getParameterDeclarationTypeVisibilityDiagnosticMessage(symbolAccessibilityResult) { switch (node.parent.kind) { - case 146 /* Constructor */: + case 147 /* 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 150 /* ConstructSignature */: + case 151 /* 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 149 /* CallSignature */: + case 150 /* 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 145 /* MethodDeclaration */: - case 144 /* MethodSignature */: + case 146 /* MethodDeclaration */: + case 145 /* MethodSignature */: if (node.parent.flags & 32 /* Static */) { return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* CannotBeNamed */ ? @@ -32052,7 +33083,7 @@ var ts; 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 === 218 /* ClassDeclaration */) { + else if (node.parent.parent.kind === 220 /* 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 : @@ -32065,7 +33096,7 @@ var ts; 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 217 /* FunctionDeclaration */: + case 219 /* 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 : @@ -32077,12 +33108,12 @@ var ts; } function emitBindingPattern(bindingPattern) { // We have to explicitly emit square bracket and bracket because these tokens are not store inside the node. - if (bindingPattern.kind === 165 /* ObjectBindingPattern */) { + if (bindingPattern.kind === 166 /* ObjectBindingPattern */) { write("{"); emitCommaList(bindingPattern.elements, emitBindingElement); write("}"); } - else if (bindingPattern.kind === 166 /* ArrayBindingPattern */) { + else if (bindingPattern.kind === 167 /* ArrayBindingPattern */) { write("["); var elements = bindingPattern.elements; emitCommaList(elements, emitBindingElement); @@ -32093,7 +33124,7 @@ var ts; } } function emitBindingElement(bindingElement) { - if (bindingElement.kind === 191 /* OmittedExpression */) { + if (bindingElement.kind === 192 /* 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) @@ -32102,7 +33133,7 @@ var ts; // emit : function foo([ , x, , ]) {} write(" "); } - else if (bindingElement.kind === 167 /* BindingElement */) { + else if (bindingElement.kind === 168 /* 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" @@ -32141,40 +33172,40 @@ var ts; } function emitNode(node) { switch (node.kind) { - case 217 /* FunctionDeclaration */: - case 222 /* ModuleDeclaration */: - case 225 /* ImportEqualsDeclaration */: - case 219 /* InterfaceDeclaration */: - case 218 /* ClassDeclaration */: - case 220 /* TypeAliasDeclaration */: - case 221 /* EnumDeclaration */: + case 219 /* FunctionDeclaration */: + case 224 /* ModuleDeclaration */: + case 228 /* ImportEqualsDeclaration */: + case 221 /* InterfaceDeclaration */: + case 220 /* ClassDeclaration */: + case 222 /* TypeAliasDeclaration */: + case 223 /* EnumDeclaration */: return emitModuleElement(node, isModuleElementVisible(node)); - case 197 /* VariableStatement */: + case 199 /* VariableStatement */: return emitModuleElement(node, isVariableStatementVisible(node)); - case 226 /* ImportDeclaration */: + case 229 /* ImportDeclaration */: // Import declaration without import clause is visible, otherwise it is not visible return emitModuleElement(node, /*isModuleElementVisible*/ !node.importClause); - case 232 /* ExportDeclaration */: + case 235 /* ExportDeclaration */: return emitExportDeclaration(node); - case 146 /* Constructor */: - case 145 /* MethodDeclaration */: - case 144 /* MethodSignature */: + case 147 /* Constructor */: + case 146 /* MethodDeclaration */: + case 145 /* MethodSignature */: return writeFunctionDeclaration(node); - case 150 /* ConstructSignature */: - case 149 /* CallSignature */: - case 151 /* IndexSignature */: + case 151 /* ConstructSignature */: + case 150 /* CallSignature */: + case 152 /* IndexSignature */: return emitSignatureDeclarationWithJsDocComments(node); - case 147 /* GetAccessor */: - case 148 /* SetAccessor */: + case 148 /* GetAccessor */: + case 149 /* SetAccessor */: return emitAccessorDeclaration(node); - case 143 /* PropertyDeclaration */: - case 142 /* PropertySignature */: + case 144 /* PropertyDeclaration */: + case 143 /* PropertySignature */: return emitPropertyDeclaration(node); - case 251 /* EnumMember */: + case 254 /* EnumMember */: return emitEnumMemberDeclaration(node); - case 231 /* ExportAssignment */: + case 234 /* ExportAssignment */: return emitExportAssignment(node); - case 252 /* SourceFile */: + case 255 /* SourceFile */: return emitSourceFile(node); } } @@ -32197,7 +33228,7 @@ var ts; if (declFileName) { declFileName = ts.getRelativePathToDirectoryOrUrl(ts.getDirectoryPath(ts.normalizeSlashes(declarationFilePath)), declFileName, host.getCurrentDirectory(), host.getCanonicalFileName, /*isAbsolutePathAnUrl*/ false); - referencePathsOutput += "/// " + newLine; + referencePathsOutput += '/// ' + newLine; } return addedBundledEmitReference; function getDeclFileName(emitFileNames, sourceFiles, isBundledEmit) { @@ -32533,6 +33564,7 @@ var ts; 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 @@ -32544,6 +33576,7 @@ var ts; 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(); @@ -32552,6 +33585,7 @@ var ts; return { emitSkipped: emitSkipped, diagnostics: emitterDiagnostics.getDiagnostics(), + emittedFiles: emittedFilesList, sourceMaps: sourceMapDataList }; function isUniqueLocalName(name, container) { @@ -32622,6 +33656,7 @@ var ts; var decoratedClassAliases; var convertedLoopState; var extendsEmitted; + var assignEmitted; var decorateEmitted; var paramEmitted; var awaiterEmitted; @@ -32674,7 +33709,7 @@ var ts; if (sourceMappingURL) { write("//# sourceMappingURL=" + sourceMappingURL); } - writeEmittedFiles(writer.getText(), jsFilePath, sourceMapFilePath, /*writeByteOrderMark*/ compilerOptions.emitBOM); + writeEmittedFiles(writer.getText(), jsFilePath, sourceMapFilePath, /*writeByteOrderMark*/ compilerOptions.emitBOM, sourceFiles); // reset the state sourceMap.reset(); writer.reset(); @@ -32692,6 +33727,7 @@ var ts; decorateEmitted = false; paramEmitted = false; awaiterEmitted = false; + assignEmitted = false; tempFlags = 0; tempVariables = undefined; tempParameters = undefined; @@ -32728,10 +33764,10 @@ var ts; // Note that names generated by makeTempVariableName and makeUniqueName will never conflict. function makeTempVariableName(flags) { if (flags && !(tempFlags & flags)) { - var name_21 = flags === 268435456 /* _i */ ? "_i" : "_n"; - if (isUniqueName(name_21)) { + var name_23 = flags === 268435456 /* _i */ ? "_i" : "_n"; + if (isUniqueName(name_23)) { tempFlags |= flags; - return name_21; + return name_23; } } while (true) { @@ -32739,9 +33775,9 @@ var ts; tempFlags++; // Skip over 'i' and 'n' if (count !== 8 && count !== 13) { - var name_22 = count < 26 ? "_" + String.fromCharCode(97 /* a */ + count) : "_" + (count - 26); - if (isUniqueName(name_22)) { - return name_22; + var name_24 = count < 26 ? "_" + String.fromCharCode(97 /* a */ + count) : "_" + (count - 26); + if (isUniqueName(name_24)) { + return name_24; } } } @@ -32785,17 +33821,17 @@ var ts; switch (node.kind) { case 69 /* Identifier */: return makeUniqueName(node.text); - case 222 /* ModuleDeclaration */: - case 221 /* EnumDeclaration */: + case 224 /* ModuleDeclaration */: + case 223 /* EnumDeclaration */: return generateNameForModuleOrEnum(node); - case 226 /* ImportDeclaration */: - case 232 /* ExportDeclaration */: + case 229 /* ImportDeclaration */: + case 235 /* ExportDeclaration */: return generateNameForImportOrExportDeclaration(node); - case 217 /* FunctionDeclaration */: - case 218 /* ClassDeclaration */: - case 231 /* ExportAssignment */: + case 219 /* FunctionDeclaration */: + case 220 /* ClassDeclaration */: + case 234 /* ExportAssignment */: return generateNameForExportDefault(); - case 190 /* ClassExpression */: + case 191 /* ClassExpression */: return generateNameForClassExpression(); } } @@ -32804,14 +33840,14 @@ var ts; return nodeToGeneratedName[id] || (nodeToGeneratedName[id] = ts.unescapeIdentifier(generateNameForNode(node))); } /** Write emitted output to disk */ - function writeEmittedFiles(emitOutput, jsFilePath, sourceMapFilePath, writeByteOrderMark) { + function writeEmittedFiles(emitOutput, jsFilePath, sourceMapFilePath, writeByteOrderMark, sourceFiles) { if (compilerOptions.sourceMap && !compilerOptions.inlineSourceMap) { - ts.writeFile(host, emitterDiagnostics, sourceMapFilePath, sourceMap.getText(), /*writeByteOrderMark*/ false); + ts.writeFile(host, emitterDiagnostics, sourceMapFilePath, sourceMap.getText(), /*writeByteOrderMark*/ false, sourceFiles); } if (sourceMapDataList) { sourceMapDataList.push(sourceMap.getSourceMapData()); } - ts.writeFile(host, emitterDiagnostics, jsFilePath, emitOutput, writeByteOrderMark); + ts.writeFile(host, emitterDiagnostics, jsFilePath, emitOutput, writeByteOrderMark, sourceFiles); } // Create a temporary variable with a unique unused name. function createTempVariable(flags) { @@ -32990,7 +34026,7 @@ var ts; // 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, "\""); + 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. @@ -33001,7 +34037,7 @@ var ts; // or an escaped quoted form of the original text if it's string-like. switch (node.kind) { case 9 /* StringLiteral */: - return getQuotedEscapedLiteralText("\"", node.text, "\""); + return getQuotedEscapedLiteralText('"', node.text, '"'); case 11 /* NoSubstitutionTemplateLiteral */: return getQuotedEscapedLiteralText("`", node.text, "`"); case 12 /* TemplateHead */: @@ -33065,10 +34101,10 @@ var ts; write("("); emit(tempVariable); // Now we emit the expressions - if (node.template.kind === 187 /* TemplateExpression */) { + if (node.template.kind === 188 /* TemplateExpression */) { ts.forEach(node.template.templateSpans, function (templateSpan) { write(", "); - var needsParens = templateSpan.expression.kind === 185 /* BinaryExpression */ + var needsParens = templateSpan.expression.kind === 186 /* BinaryExpression */ && templateSpan.expression.operatorToken.kind === 24 /* CommaToken */; emitParenthesizedIf(templateSpan.expression, needsParens); }); @@ -33103,7 +34139,7 @@ var ts; // ("abc" + 1) << (2 + "") // rather than // "abc" + (1 << 2) + "" - var needsParens = templateSpan.expression.kind !== 176 /* ParenthesizedExpression */ + var needsParens = templateSpan.expression.kind !== 177 /* 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 @@ -33145,11 +34181,11 @@ var ts; } function templateNeedsParens(template, parent) { switch (parent.kind) { - case 172 /* CallExpression */: - case 173 /* NewExpression */: + case 173 /* CallExpression */: + case 174 /* NewExpression */: return parent.expression === template; - case 174 /* TaggedTemplateExpression */: - case 176 /* ParenthesizedExpression */: + case 175 /* TaggedTemplateExpression */: + case 177 /* ParenthesizedExpression */: return false; default: return comparePrecedenceToBinaryPlus(parent) !== -1 /* LessThan */; @@ -33170,7 +34206,7 @@ var ts; // 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 185 /* BinaryExpression */: + case 186 /* BinaryExpression */: switch (expression.operatorToken.kind) { case 37 /* AsteriskToken */: case 39 /* SlashToken */: @@ -33182,8 +34218,8 @@ var ts; default: return -1 /* LessThan */; } - case 188 /* YieldExpression */: - case 186 /* ConditionalExpression */: + case 189 /* YieldExpression */: + case 187 /* ConditionalExpression */: return -1 /* LessThan */; default: return 1 /* GreaterThan */; @@ -33199,9 +34235,9 @@ var ts; /// 'Div' for upper-cased or dotted names function emitTagName(name) { if (name.kind === 69 /* Identifier */ && ts.isIntrinsicJsxName(name.text)) { - write("\""); + write('"'); emit(name); - write("\""); + write('"'); } else { emit(name); @@ -33215,9 +34251,9 @@ var ts; emit(name); } else { - write("\""); + write('"'); emit(name); - write("\""); + write('"'); } } /// Emit an name/value pair for an attribute (e.g. "x: 3") @@ -33248,14 +34284,13 @@ var ts; } else { // Either emit one big object literal (no spread attribs), or - // a call to React.__spread + // a call to the __assign helper var attrs = openingNode.attributes; - if (ts.forEach(attrs, function (attr) { return attr.kind === 243 /* JsxSpreadAttribute */; })) { - emitExpressionIdentifier(syntheticReactRef); - write(".__spread("); + if (ts.forEach(attrs, function (attr) { return attr.kind === 246 /* JsxSpreadAttribute */; })) { + write("__assign("); var haveOpenedObjectLiteral = false; for (var i = 0; i < attrs.length; i++) { - if (attrs[i].kind === 243 /* JsxSpreadAttribute */) { + if (attrs[i].kind === 246 /* JsxSpreadAttribute */) { // If this is the first argument, we need to emit a {} as the first argument if (i === 0) { write("{}, "); @@ -33270,7 +34305,7 @@ var ts; emit(attrs[i].expression); } else { - ts.Debug.assert(attrs[i].kind === 242 /* JsxAttribute */); + ts.Debug.assert(attrs[i].kind === 245 /* JsxAttribute */); if (haveOpenedObjectLiteral) { write(", "); } @@ -33331,7 +34366,7 @@ var ts; decreaseIndent(); } else if (firstChild) { - if (firstChild.kind !== 237 /* JsxElement */ && firstChild.kind !== 238 /* JsxSelfClosingElement */) { + if (firstChild.kind !== 240 /* JsxElement */ && firstChild.kind !== 241 /* JsxSelfClosingElement */) { emit(firstChild); } else { @@ -33348,11 +34383,11 @@ var ts; write(")"); // closes "React.createElement(" emitTrailingComments(openingNode); } - if (node.kind === 237 /* JsxElement */) { + if (node.kind === 240 /* JsxElement */) { emitJsxElement(node.openingElement, node.children); } else { - ts.Debug.assert(node.kind === 238 /* JsxSelfClosingElement */); + ts.Debug.assert(node.kind === 241 /* JsxSelfClosingElement */); emitJsxElement(node); } } @@ -33374,11 +34409,11 @@ var ts; if (i > 0) { write(" "); } - if (attribs[i].kind === 243 /* JsxSpreadAttribute */) { + if (attribs[i].kind === 246 /* JsxSpreadAttribute */) { emitJsxSpreadAttribute(attribs[i]); } else { - ts.Debug.assert(attribs[i].kind === 242 /* JsxAttribute */); + ts.Debug.assert(attribs[i].kind === 245 /* JsxAttribute */); emitJsxAttribute(attribs[i]); } } @@ -33386,11 +34421,11 @@ var ts; function emitJsxOpeningOrSelfClosingElement(node) { write("<"); emit(node.tagName); - if (node.attributes.length > 0 || (node.kind === 238 /* JsxSelfClosingElement */)) { + if (node.attributes.length > 0 || (node.kind === 241 /* JsxSelfClosingElement */)) { write(" "); } emitAttributes(node.attributes); - if (node.kind === 238 /* JsxSelfClosingElement */) { + if (node.kind === 241 /* JsxSelfClosingElement */) { write("/>"); } else { @@ -33409,11 +34444,11 @@ var ts; } emitJsxClosingElement(node.closingElement); } - if (node.kind === 237 /* JsxElement */) { + if (node.kind === 240 /* JsxElement */) { emitJsxElement(node); } else { - ts.Debug.assert(node.kind === 238 /* JsxSelfClosingElement */); + ts.Debug.assert(node.kind === 241 /* JsxSelfClosingElement */); emitJsxOpeningOrSelfClosingElement(node); } } @@ -33421,11 +34456,11 @@ var ts; // 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 !== 167 /* BindingElement */); + ts.Debug.assert(node.kind !== 168 /* BindingElement */); if (node.kind === 9 /* StringLiteral */) { emitLiteral(node); } - else if (node.kind === 138 /* ComputedPropertyName */) { + else if (node.kind === 139 /* 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: @@ -33456,75 +34491,76 @@ var ts; emit(node.expression); } else { - write("\""); + write('"'); if (node.kind === 8 /* NumericLiteral */) { write(node.text); } else { writeTextOfNode(currentText, node); } - write("\""); + write('"'); } } function isExpressionIdentifier(node) { var parent = node.parent; switch (parent.kind) { - case 168 /* ArrayLiteralExpression */: - case 193 /* AsExpression */: - case 185 /* BinaryExpression */: - case 172 /* CallExpression */: - case 245 /* CaseClause */: - case 138 /* ComputedPropertyName */: - case 186 /* ConditionalExpression */: - case 141 /* Decorator */: - case 179 /* DeleteExpression */: - case 201 /* DoStatement */: - case 171 /* ElementAccessExpression */: - case 231 /* ExportAssignment */: - case 199 /* ExpressionStatement */: - case 192 /* ExpressionWithTypeArguments */: - case 203 /* ForStatement */: - case 204 /* ForInStatement */: - case 205 /* ForOfStatement */: - case 200 /* IfStatement */: - case 241 /* JsxClosingElement */: - case 238 /* JsxSelfClosingElement */: - case 239 /* JsxOpeningElement */: - case 243 /* JsxSpreadAttribute */: - case 244 /* JsxExpression */: - case 173 /* NewExpression */: - case 176 /* ParenthesizedExpression */: - case 184 /* PostfixUnaryExpression */: - case 183 /* PrefixUnaryExpression */: - case 208 /* ReturnStatement */: - case 250 /* ShorthandPropertyAssignment */: - case 189 /* SpreadElementExpression */: - case 210 /* SwitchStatement */: - case 174 /* TaggedTemplateExpression */: - case 194 /* TemplateSpan */: - case 212 /* ThrowStatement */: - case 175 /* TypeAssertionExpression */: - case 180 /* TypeOfExpression */: - case 181 /* VoidExpression */: - case 202 /* WhileStatement */: - case 209 /* WithStatement */: - case 188 /* YieldExpression */: + case 169 /* ArrayLiteralExpression */: + case 194 /* AsExpression */: + case 186 /* BinaryExpression */: + case 173 /* CallExpression */: + case 248 /* CaseClause */: + case 139 /* ComputedPropertyName */: + case 187 /* ConditionalExpression */: + case 142 /* Decorator */: + case 180 /* DeleteExpression */: + case 203 /* DoStatement */: + case 172 /* ElementAccessExpression */: + case 234 /* ExportAssignment */: + case 201 /* ExpressionStatement */: + case 193 /* ExpressionWithTypeArguments */: + case 205 /* ForStatement */: + case 206 /* ForInStatement */: + case 207 /* ForOfStatement */: + case 202 /* IfStatement */: + case 244 /* JsxClosingElement */: + case 241 /* JsxSelfClosingElement */: + case 242 /* JsxOpeningElement */: + case 246 /* JsxSpreadAttribute */: + case 247 /* JsxExpression */: + case 174 /* NewExpression */: + case 195 /* NonNullExpression */: + case 177 /* ParenthesizedExpression */: + case 185 /* PostfixUnaryExpression */: + case 184 /* PrefixUnaryExpression */: + case 210 /* ReturnStatement */: + case 253 /* ShorthandPropertyAssignment */: + case 190 /* SpreadElementExpression */: + case 212 /* SwitchStatement */: + case 175 /* TaggedTemplateExpression */: + case 196 /* TemplateSpan */: + case 214 /* ThrowStatement */: + case 176 /* TypeAssertionExpression */: + case 181 /* TypeOfExpression */: + case 182 /* VoidExpression */: + case 204 /* WhileStatement */: + case 211 /* WithStatement */: + case 189 /* YieldExpression */: return true; - case 167 /* BindingElement */: - case 251 /* EnumMember */: - case 140 /* Parameter */: - case 249 /* PropertyAssignment */: - case 143 /* PropertyDeclaration */: - case 215 /* VariableDeclaration */: + case 168 /* BindingElement */: + case 254 /* EnumMember */: + case 141 /* Parameter */: + case 252 /* PropertyAssignment */: + case 144 /* PropertyDeclaration */: + case 217 /* VariableDeclaration */: return parent.initializer === node; - case 170 /* PropertyAccessExpression */: + case 171 /* PropertyAccessExpression */: return parent.expression === node; - case 178 /* ArrowFunction */: - case 177 /* FunctionExpression */: + case 179 /* ArrowFunction */: + case 178 /* FunctionExpression */: return parent.body === node; - case 225 /* ImportEqualsDeclaration */: + case 228 /* ImportEqualsDeclaration */: return parent.moduleReference === node; - case 137 /* QualifiedName */: + case 138 /* QualifiedName */: return parent.left === node; } return false; @@ -33532,7 +34568,7 @@ var ts; function emitExpressionIdentifier(node) { var container = resolver.getReferencedExportContainer(node); if (container) { - if (container.kind === 252 /* SourceFile */) { + if (container.kind === 255 /* SourceFile */) { // Identifier references module export if (modulekind !== ts.ModuleKind.ES6 && modulekind !== ts.ModuleKind.System) { write("exports."); @@ -33548,19 +34584,19 @@ var ts; if (modulekind !== ts.ModuleKind.ES6) { var declaration = resolver.getReferencedImportDeclaration(node); if (declaration) { - if (declaration.kind === 227 /* ImportClause */) { + if (declaration.kind === 230 /* ImportClause */) { // Identifier references default import write(getGeneratedNameForNode(declaration.parent)); - write(languageVersion === 0 /* ES3 */ ? "[\"default\"]" : ".default"); + write(languageVersion === 0 /* ES3 */ ? '["default"]' : ".default"); return; } - else if (declaration.kind === 230 /* ImportSpecifier */) { + else if (declaration.kind === 233 /* ImportSpecifier */) { // Identifier references named import write(getGeneratedNameForNode(declaration.parent.parent.parent)); - var name_23 = declaration.propertyName || declaration.name; - var identifier = ts.getTextOfNodeFromSourceText(currentText, name_23); + var name_25 = declaration.propertyName || declaration.name; + var identifier = ts.getTextOfNodeFromSourceText(currentText, name_25); if (languageVersion === 0 /* ES3 */ && identifier === "default") { - write("[\"default\"]"); + write('["default"]'); } else { write("."); @@ -33600,13 +34636,13 @@ var ts; } function isNameOfNestedBlockScopedRedeclarationOrCapturedBinding(node) { if (languageVersion < 2 /* ES6 */) { - var parent_8 = node.parent; - switch (parent_8.kind) { - case 167 /* BindingElement */: - case 218 /* ClassDeclaration */: - case 221 /* EnumDeclaration */: - case 215 /* VariableDeclaration */: - return parent_8.name === node && resolver.isDeclarationWithCollidingName(parent_8); + var parent_10 = node.parent; + switch (parent_10.kind) { + case 168 /* BindingElement */: + case 220 /* ClassDeclaration */: + case 223 /* EnumDeclaration */: + case 217 /* VariableDeclaration */: + return parent_10.name === node && resolver.isDeclarationWithCollidingName(parent_10); } } return false; @@ -33615,8 +34651,8 @@ var ts; if (convertedLoopState) { if (node.text == "arguments" && resolver.isArgumentsLocalBinding(node)) { // in converted loop body arguments cannot be used directly. - var name_24 = convertedLoopState.argumentsName || (convertedLoopState.argumentsName = makeUniqueName("arguments")); - write(name_24); + var name_26 = convertedLoopState.argumentsName || (convertedLoopState.argumentsName = makeUniqueName("arguments")); + write(name_26); return; } } @@ -33716,10 +34752,10 @@ var ts; } } function needsParenthesisForAwaitExpressionAsYield(node) { - if (node.parent.kind === 185 /* BinaryExpression */ && !ts.isAssignmentOperator(node.parent.operatorToken.kind)) { + if (node.parent.kind === 186 /* BinaryExpression */ && !ts.isAssignmentOperator(node.parent.operatorToken.kind)) { return true; } - else if (node.parent.kind === 186 /* ConditionalExpression */ && node.parent.condition === node) { + else if (node.parent.kind === 187 /* ConditionalExpression */ && node.parent.condition === node) { return true; } return false; @@ -33727,11 +34763,11 @@ var ts; function needsParenthesisForPropertyAccessOrInvocation(node) { switch (node.kind) { case 69 /* Identifier */: - case 168 /* ArrayLiteralExpression */: - case 170 /* PropertyAccessExpression */: - case 171 /* ElementAccessExpression */: - case 172 /* CallExpression */: - case 176 /* ParenthesizedExpression */: + case 169 /* ArrayLiteralExpression */: + case 171 /* PropertyAccessExpression */: + case 172 /* ElementAccessExpression */: + case 173 /* CallExpression */: + case 177 /* 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; @@ -33751,17 +34787,17 @@ var ts; write(", "); } var e = elements[pos]; - if (e.kind === 189 /* SpreadElementExpression */) { + if (e.kind === 190 /* SpreadElementExpression */) { e = e.expression; emitParenthesizedIf(e, /*parenthesized*/ group === 0 && needsParenthesisForPropertyAccessOrInvocation(e)); pos++; - if (pos === length && group === 0 && needsUniqueCopy && e.kind !== 168 /* ArrayLiteralExpression */) { + if (pos === length && group === 0 && needsUniqueCopy && e.kind !== 169 /* ArrayLiteralExpression */) { write(".slice()"); } } else { var i = pos; - while (i < length && elements[i].kind !== 189 /* SpreadElementExpression */) { + while (i < length && elements[i].kind !== 190 /* SpreadElementExpression */) { i++; } write("["); @@ -33784,7 +34820,7 @@ var ts; } } function isSpreadElementExpression(node) { - return node.kind === 189 /* SpreadElementExpression */; + return node.kind === 190 /* SpreadElementExpression */; } function emitArrayLiteral(node) { var elements = node.elements; @@ -33854,7 +34890,7 @@ var ts; writeComma(); var property = properties[i]; emitStart(property); - if (property.kind === 147 /* GetAccessor */ || property.kind === 148 /* SetAccessor */) { + if (property.kind === 148 /* GetAccessor */ || property.kind === 149 /* SetAccessor */) { // TODO (drosen): Reconcile with 'emitMemberFunctions'. var accessors = ts.getAllAccessorDeclarations(node.properties, property); if (property !== accessors.firstAccessor) { @@ -33906,13 +34942,13 @@ var ts; emitMemberAccessForPropertyName(property.name); emitEnd(property.name); write(" = "); - if (property.kind === 249 /* PropertyAssignment */) { + if (property.kind === 252 /* PropertyAssignment */) { emit(property.initializer); } - else if (property.kind === 250 /* ShorthandPropertyAssignment */) { + else if (property.kind === 253 /* ShorthandPropertyAssignment */) { emitExpressionIdentifier(property.name); } - else if (property.kind === 145 /* MethodDeclaration */) { + else if (property.kind === 146 /* MethodDeclaration */) { emitFunctionDeclaration(property); } else { @@ -33946,7 +34982,7 @@ var ts; // 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 === 138 /* ComputedPropertyName */) { + if (properties[i].name.kind === 139 /* ComputedPropertyName */) { numInitialNonComputedProperties = i; break; } @@ -33962,21 +34998,21 @@ var ts; emitObjectLiteralBody(node, properties.length); } function createBinaryExpression(left, operator, right, startsOnNewLine) { - var result = ts.createSynthesizedNode(185 /* BinaryExpression */, startsOnNewLine); + var result = ts.createSynthesizedNode(186 /* BinaryExpression */, startsOnNewLine); result.operatorToken = ts.createSynthesizedNode(operator); result.left = left; result.right = right; return result; } function createPropertyAccessExpression(expression, name) { - var result = ts.createSynthesizedNode(170 /* PropertyAccessExpression */); + var result = ts.createSynthesizedNode(171 /* PropertyAccessExpression */); result.expression = parenthesizeForAccess(expression); result.dotToken = ts.createSynthesizedNode(21 /* DotToken */); result.name = name; return result; } function createElementAccessExpression(expression, argumentExpression) { - var result = ts.createSynthesizedNode(171 /* ElementAccessExpression */); + var result = ts.createSynthesizedNode(172 /* ElementAccessExpression */); result.expression = parenthesizeForAccess(expression); result.argumentExpression = argumentExpression; return result; @@ -33984,7 +35020,9 @@ var ts; 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 === 175 /* TypeAssertionExpression */ || expr.kind === 193 /* AsExpression */) { + while (expr.kind === 176 /* TypeAssertionExpression */ || + expr.kind === 194 /* AsExpression */ || + expr.kind === 195 /* NonNullExpression */) { expr = expr.expression; } // isLeftHandSideExpression is almost the correct criterion for when it is not necessary @@ -33996,11 +35034,11 @@ var ts; // 1.x -> not the same as (1).x // if (ts.isLeftHandSideExpression(expr) && - expr.kind !== 173 /* NewExpression */ && + expr.kind !== 174 /* NewExpression */ && expr.kind !== 8 /* NumericLiteral */) { return expr; } - var node = ts.createSynthesizedNode(176 /* ParenthesizedExpression */); + var node = ts.createSynthesizedNode(177 /* ParenthesizedExpression */); node.expression = expr; return node; } @@ -34035,7 +35073,12 @@ var ts; // Return true if identifier resolves to an exported member of a namespace function isNamespaceExportReference(node) { var container = resolver.getReferencedExportContainer(node); - return container && container.kind !== 252 /* SourceFile */; + return container && container.kind !== 255 /* SourceFile */; + } + // Return true if identifier resolves to an imported identifier + function isImportedReference(node) { + var declaration = resolver.getReferencedImportDeclaration(node); + return declaration && (declaration.kind === 230 /* ImportClause */ || declaration.kind === 233 /* ImportSpecifier */); } function emitShorthandPropertyAssignment(node) { // The name property of a short-hand property assignment is considered an expression position, so here @@ -34050,7 +35093,18 @@ var ts; // let obj = { y }; // } // Here we need to emit obj = { y : m.y } regardless of the output target. - if (modulekind !== ts.ModuleKind.ES6 || isNamespaceExportReference(node.name)) { + // 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)) || isNamespaceExportReference(node.name)) { // Emit identifier as an identifier write(": "); emit(node.name); @@ -34065,7 +35119,7 @@ var ts; if (constantValue !== undefined) { write(constantValue.toString()); if (!compilerOptions.removeComments) { - var propertyName = node.kind === 170 /* PropertyAccessExpression */ ? ts.declarationNameToString(node.name) : ts.getTextOfNode(node.argumentExpression); + var propertyName = node.kind === 171 /* PropertyAccessExpression */ ? ts.declarationNameToString(node.name) : ts.getTextOfNode(node.argumentExpression); write(" /* " + propertyName + " */"); } return true; @@ -34076,7 +35130,7 @@ var ts; if (compilerOptions.isolatedModules) { return undefined; } - return node.kind === 170 /* PropertyAccessExpression */ || node.kind === 171 /* ElementAccessExpression */ + return node.kind === 171 /* PropertyAccessExpression */ || node.kind === 172 /* ElementAccessExpression */ ? resolver.getConstantValue(node) : undefined; } @@ -34106,9 +35160,9 @@ var ts; if (languageVersion === 2 /* ES6 */ && node.expression.kind === 95 /* SuperKeyword */ && isInAsyncMethodWithSuperInES6(node)) { - var name_25 = ts.createSynthesizedNode(9 /* StringLiteral */); - name_25.text = node.name.text; - emitSuperAccessInAsyncMethod(node.expression, name_25); + var name_27 = ts.createSynthesizedNode(9 /* StringLiteral */); + name_27.text = node.name.text; + emitSuperAccessInAsyncMethod(node.expression, name_27); return; } emit(node.expression); @@ -34173,7 +35227,7 @@ var ts; } emitExpressionIdentifier(node); break; - case 137 /* QualifiedName */: + case 138 /* QualifiedName */: emitQualifiedNameAsExpression(node, useFallback); break; default: @@ -34197,10 +35251,13 @@ var ts; write("]"); } function hasSpreadElement(elements) { - return ts.forEach(elements, function (e) { return e.kind === 189 /* SpreadElementExpression */; }); + return ts.forEach(elements, function (e) { return e.kind === 190 /* SpreadElementExpression */; }); } function skipParentheses(node) { - while (node.kind === 176 /* ParenthesizedExpression */ || node.kind === 175 /* TypeAssertionExpression */ || node.kind === 193 /* AsExpression */) { + while (node.kind === 177 /* ParenthesizedExpression */ || + node.kind === 176 /* TypeAssertionExpression */ || + node.kind === 194 /* AsExpression */ || + node.kind === 195 /* NonNullExpression */) { node = node.expression; } return node; @@ -34221,13 +35278,13 @@ var ts; function emitCallWithSpread(node) { var target; var expr = skipParentheses(node.expression); - if (expr.kind === 170 /* PropertyAccessExpression */) { + if (expr.kind === 171 /* PropertyAccessExpression */) { // Target will be emitted as "this" argument target = emitCallTarget(expr.expression); write("."); emit(expr.name); } - else if (expr.kind === 171 /* ElementAccessExpression */) { + else if (expr.kind === 172 /* ElementAccessExpression */) { // Target will be emitted as "this" argument target = emitCallTarget(expr.expression); write("["); @@ -34360,12 +35417,16 @@ var ts; // 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 !== 178 /* ArrowFunction */) { - if (node.expression.kind === 175 /* TypeAssertionExpression */ || node.expression.kind === 193 /* AsExpression */) { + if (!ts.nodeIsSynthesized(node) && node.parent.kind !== 179 /* ArrowFunction */) { + if (node.expression.kind === 176 /* TypeAssertionExpression */ || + node.expression.kind === 194 /* AsExpression */ || + node.expression.kind === 195 /* NonNullExpression */) { var operand = node.expression.expression; // Make sure we consider all nested cast expressions, e.g.: // (-A).x; - while (operand.kind === 175 /* TypeAssertionExpression */ || operand.kind === 193 /* AsExpression */) { + while (operand.kind === 176 /* TypeAssertionExpression */ || + operand.kind === 194 /* AsExpression */ || + operand.kind === 195 /* NonNullExpression */) { operand = operand.expression; } // We have an expression of the form: (SubExpr) @@ -34376,15 +35437,15 @@ var ts; // (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 !== 183 /* PrefixUnaryExpression */ && - operand.kind !== 181 /* VoidExpression */ && - operand.kind !== 180 /* TypeOfExpression */ && - operand.kind !== 179 /* DeleteExpression */ && - operand.kind !== 184 /* PostfixUnaryExpression */ && - operand.kind !== 173 /* NewExpression */ && - !(operand.kind === 172 /* CallExpression */ && node.parent.kind === 173 /* NewExpression */) && - !(operand.kind === 177 /* FunctionExpression */ && node.parent.kind === 172 /* CallExpression */) && - !(operand.kind === 8 /* NumericLiteral */ && node.parent.kind === 170 /* PropertyAccessExpression */)) { + if (operand.kind !== 184 /* PrefixUnaryExpression */ && + operand.kind !== 182 /* VoidExpression */ && + operand.kind !== 181 /* TypeOfExpression */ && + operand.kind !== 180 /* DeleteExpression */ && + operand.kind !== 185 /* PostfixUnaryExpression */ && + operand.kind !== 174 /* NewExpression */ && + !(operand.kind === 173 /* CallExpression */ && node.parent.kind === 174 /* NewExpression */) && + !(operand.kind === 178 /* FunctionExpression */ && node.parent.kind === 173 /* CallExpression */) && + !(operand.kind === 8 /* NumericLiteral */ && node.parent.kind === 171 /* PropertyAccessExpression */)) { emit(operand); return; } @@ -34413,7 +35474,7 @@ var ts; if (!isCurrentFileSystemExternalModule() || node.kind !== 69 /* Identifier */ || ts.nodeIsSynthesized(node)) { return false; } - var isVariableDeclarationOrBindingElement = node.parent && (node.parent.kind === 215 /* VariableDeclaration */ || node.parent.kind === 167 /* BindingElement */); + var isVariableDeclarationOrBindingElement = node.parent && (node.parent.kind === 217 /* VariableDeclaration */ || node.parent.kind === 168 /* BindingElement */); var targetDeclaration = isVariableDeclarationOrBindingElement ? node.parent : resolver.getReferencedValueDeclaration(node); @@ -34444,7 +35505,7 @@ var ts; // 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 === 183 /* PrefixUnaryExpression */) { + if (node.operand.kind === 184 /* PrefixUnaryExpression */) { var operand = node.operand; if (node.operator === 35 /* PlusToken */ && (operand.operator === 35 /* PlusToken */ || operand.operator === 41 /* PlusPlusToken */)) { write(" "); @@ -34500,7 +35561,7 @@ var ts; } var current = ts.getRootDeclaration(node).parent; while (current) { - if (current.kind === 252 /* SourceFile */) { + if (current.kind === 255 /* SourceFile */) { return !isExported || ((ts.getCombinedNodeFlags(node) & 1 /* Export */) !== 0); } else if (ts.isDeclaration(current)) { @@ -34523,7 +35584,7 @@ var ts; if (ts.isElementAccessExpression(leftHandSideExpression)) { shouldEmitParentheses = true; write("("); - synthesizedLHS = ts.createSynthesizedNode(171 /* ElementAccessExpression */, /*startsOnNewLine*/ false); + synthesizedLHS = ts.createSynthesizedNode(172 /* ElementAccessExpression */, /*startsOnNewLine*/ false); var identifier = emitTempVariableAssignment(leftHandSideExpression.expression, /*canDefineTempVariablesInPlace*/ false, /*shouldEmitCommaBeforeAssignment*/ false); synthesizedLHS.expression = identifier; if (leftHandSideExpression.argumentExpression.kind !== 8 /* NumericLiteral */ && @@ -34540,7 +35601,7 @@ var ts; else if (ts.isPropertyAccessExpression(leftHandSideExpression)) { shouldEmitParentheses = true; write("("); - synthesizedLHS = ts.createSynthesizedNode(170 /* PropertyAccessExpression */, /*startsOnNewLine*/ false); + synthesizedLHS = ts.createSynthesizedNode(171 /* PropertyAccessExpression */, /*startsOnNewLine*/ false); var identifier = emitTempVariableAssignment(leftHandSideExpression.expression, /*canDefineTempVariablesInPlace*/ false, /*shouldEmitCommaBeforeAssignment*/ false); synthesizedLHS.expression = identifier; synthesizedLHS.dotToken = leftHandSideExpression.dotToken; @@ -34568,8 +35629,8 @@ var ts; } function emitBinaryExpression(node) { if (languageVersion < 2 /* ES6 */ && node.operatorToken.kind === 56 /* EqualsToken */ && - (node.left.kind === 169 /* ObjectLiteralExpression */ || node.left.kind === 168 /* ArrayLiteralExpression */)) { - emitDestructuring(node, node.parent.kind === 199 /* ExpressionStatement */); + (node.left.kind === 170 /* ObjectLiteralExpression */ || node.left.kind === 169 /* ArrayLiteralExpression */)) { + emitDestructuring(node, node.parent.kind === 201 /* ExpressionStatement */); } else { var exportChanged = node.operatorToken.kind >= 56 /* FirstAssignment */ && @@ -34634,7 +35695,7 @@ var ts; } } function isSingleLineEmptyBlock(node) { - if (node && node.kind === 196 /* Block */) { + if (node && node.kind === 198 /* Block */) { var block = node; return block.statements.length === 0 && nodeEndIsOnSameLineAsNodeStart(block, block); } @@ -34648,12 +35709,12 @@ var ts; } emitToken(15 /* OpenBraceToken */, node.pos); increaseIndent(); - if (node.kind === 223 /* ModuleBlock */) { - ts.Debug.assert(node.parent.kind === 222 /* ModuleDeclaration */); + if (node.kind === 225 /* ModuleBlock */) { + ts.Debug.assert(node.parent.kind === 224 /* ModuleDeclaration */); emitCaptureThisForNodeIfNecessary(node.parent); } emitLines(node.statements); - if (node.kind === 223 /* ModuleBlock */) { + if (node.kind === 225 /* ModuleBlock */) { emitTempDeclarations(/*newLine*/ true); } decreaseIndent(); @@ -34661,7 +35722,7 @@ var ts; emitToken(16 /* CloseBraceToken */, node.statements.end); } function emitEmbeddedStatement(node) { - if (node.kind === 196 /* Block */) { + if (node.kind === 198 /* Block */) { write(" "); emit(node); } @@ -34673,7 +35734,7 @@ var ts; } } function emitExpressionStatement(node) { - emitParenthesizedIf(node.expression, /*parenthesized*/ node.expression.kind === 178 /* ArrowFunction */); + emitParenthesizedIf(node.expression, /*parenthesized*/ node.expression.kind === 179 /* ArrowFunction */); write(";"); } function emitIfStatement(node) { @@ -34686,7 +35747,7 @@ var ts; if (node.elseStatement) { writeLine(); emitToken(80 /* ElseKeyword */, node.thenStatement.end); - if (node.elseStatement.kind === 200 /* IfStatement */) { + if (node.elseStatement.kind === 202 /* IfStatement */) { write(" "); emit(node.elseStatement); } @@ -34706,7 +35767,7 @@ var ts; else { emitNormalLoopBody(node, /*emitAsEmbeddedStatement*/ true); } - if (node.statement.kind === 196 /* Block */) { + if (node.statement.kind === 198 /* Block */) { write(" "); } else { @@ -34796,7 +35857,7 @@ var ts; } else { var loop = convertLoopBody(node); - if (node.parent.kind === 211 /* LabeledStatement */) { + if (node.parent.kind === 213 /* LabeledStatement */) { // if parent of the loop was labeled statement - attach the label to loop skipping converted loop body emitLabelAndColon(node.parent); } @@ -34807,11 +35868,11 @@ var ts; var functionName = makeUniqueName("_loop"); var loopInitializer; switch (node.kind) { - case 203 /* ForStatement */: - case 204 /* ForInStatement */: - case 205 /* ForOfStatement */: + case 205 /* ForStatement */: + case 206 /* ForInStatement */: + case 207 /* ForOfStatement */: var initializer = node.initializer; - if (initializer && initializer.kind === 216 /* VariableDeclarationList */) { + if (initializer && initializer.kind === 218 /* VariableDeclarationList */) { loopInitializer = node.initializer; } break; @@ -34826,7 +35887,7 @@ var ts; processVariableDeclaration(varDeclaration.name); } } - var bodyIsBlock = node.statement.kind === 196 /* Block */; + var bodyIsBlock = node.statement.kind === 198 /* Block */; var paramList = loopParameters ? loopParameters.join(", ") : ""; writeLine(); write("var " + functionName + " = function(" + paramList + ")"); @@ -34861,7 +35922,7 @@ var ts; emit(node.statement); } writeLine(); - // end of loop body -> copy out parameter + // end of loop body -> copy out parameter copyLoopOutParameters(convertedLoopState, 1 /* ToOutParameter */, /*emitAsStatements*/ true); decreaseIndent(); writeLine(); @@ -34968,7 +36029,7 @@ var ts; if (emitAsEmbeddedStatement) { emitEmbeddedStatement(node.statement); } - else if (node.statement.kind === 196 /* Block */) { + else if (node.statement.kind === 198 /* Block */) { emitLines(node.statement.statements); } else { @@ -35009,7 +36070,8 @@ var ts; } // 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()'; - var isSimpleLoop = !loop.state.nonLocalJumps && + // 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"); @@ -35044,10 +36106,6 @@ var ts; write("if (" + loopResult + " === \"break\") break;"); writeLine(); } - if (loop.state.nonLocalJumps & 4 /* Continue */) { - write("if (" + loopResult + " === \"continue\") continue;"); - 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); } @@ -35102,7 +36160,7 @@ var ts; var endPos = emitToken(86 /* ForKeyword */, node.pos); write(" "); endPos = emitToken(17 /* OpenParenToken */, endPos); - if (node.initializer && node.initializer.kind === 216 /* VariableDeclarationList */) { + if (node.initializer && node.initializer.kind === 218 /* VariableDeclarationList */) { var variableDeclarationList = node.initializer; var startIsEmitted = tryEmitStartOfVariableDeclarationList(variableDeclarationList); if (startIsEmitted) { @@ -35128,7 +36186,7 @@ var ts; } } function emitForInOrForOfStatement(node) { - if (languageVersion < 2 /* ES6 */ && node.kind === 205 /* ForOfStatement */) { + if (languageVersion < 2 /* ES6 */ && node.kind === 207 /* ForOfStatement */) { emitLoop(node, emitDownLevelForOfStatementWorker); } else { @@ -35139,7 +36197,7 @@ var ts; var endPos = emitToken(86 /* ForKeyword */, node.pos); write(" "); endPos = emitToken(17 /* OpenParenToken */, endPos); - if (node.initializer.kind === 216 /* VariableDeclarationList */) { + if (node.initializer.kind === 218 /* VariableDeclarationList */) { var variableDeclarationList = node.initializer; if (variableDeclarationList.declarations.length >= 1) { tryEmitStartOfVariableDeclarationList(variableDeclarationList); @@ -35149,7 +36207,7 @@ var ts; else { emit(node.initializer); } - if (node.kind === 204 /* ForInStatement */) { + if (node.kind === 206 /* ForInStatement */) { write(" in "); } else { @@ -35239,7 +36297,7 @@ var ts; // let v = _a[_i]; var rhsIterationValue = createElementAccessExpression(rhsReference, counter); emitStart(node.initializer); - if (node.initializer.kind === 216 /* VariableDeclarationList */) { + if (node.initializer.kind === 218 /* VariableDeclarationList */) { write("var "); var variableDeclarationList = node.initializer; if (variableDeclarationList.declarations.length > 0) { @@ -35269,7 +36327,7 @@ var ts; // 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 === 168 /* ArrayLiteralExpression */ || node.initializer.kind === 169 /* ObjectLiteralExpression */) { + if (node.initializer.kind === 169 /* ArrayLiteralExpression */ || node.initializer.kind === 170 /* 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); @@ -35297,7 +36355,7 @@ var ts; // 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 === 207 /* BreakStatement */ ? 2 /* Break */ : 4 /* Continue */; + var jump = node.kind === 209 /* BreakStatement */ ? 2 /* Break */ : 4 /* Continue */; var canUseBreakOrContinue = (node.label && convertedLoopState.labels && convertedLoopState.labels[node.label.text]) || (!node.label && (convertedLoopState.allowedNonLabeledJumps & jump)); if (!canUseBreakOrContinue) { @@ -35305,18 +36363,19 @@ var ts; // explicit exit from loop -> copy out parameters copyLoopOutParameters(convertedLoopState, 1 /* ToOutParameter */, /*emitAsStatements*/ false); if (!node.label) { - if (node.kind === 207 /* BreakStatement */) { + if (node.kind === 209 /* 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 === 207 /* BreakStatement */) { + if (node.kind === 209 /* BreakStatement */) { labelMarker = "break-" + node.label.text; setLabeledJump(convertedLoopState, /*isBreak*/ true, node.label.text, labelMarker); } @@ -35329,7 +36388,7 @@ var ts; return; } } - emitToken(node.kind === 207 /* BreakStatement */ ? 70 /* BreakKeyword */ : 75 /* ContinueKeyword */, node.pos); + emitToken(node.kind === 209 /* BreakStatement */ ? 70 /* BreakKeyword */ : 75 /* ContinueKeyword */, node.pos); emitOptional(" ", node.label); write(";"); } @@ -35395,7 +36454,7 @@ var ts; ts.getLineOfLocalPositionFromLineMap(currentLineMap, ts.skipTrivia(currentText, node2.pos)); } function emitCaseOrDefaultClause(node) { - if (node.kind === 245 /* CaseClause */) { + if (node.kind === 248 /* CaseClause */) { write("case "); emit(node.expression); write(":"); @@ -35464,7 +36523,7 @@ var ts; function getContainingModule(node) { do { node = node.parent; - } while (node && node.kind !== 222 /* ModuleDeclaration */); + } while (node && node.kind !== 224 /* ModuleDeclaration */); return node; } function emitContainingModuleName(node) { @@ -35489,19 +36548,19 @@ var ts; function createVoidZero() { var zero = ts.createSynthesizedNode(8 /* NumericLiteral */); zero.text = "0"; - var result = ts.createSynthesizedNode(181 /* VoidExpression */); + var result = ts.createSynthesizedNode(182 /* VoidExpression */); result.expression = zero; return result; } function emitEs6ExportDefaultCompat(node) { - if (node.parent.kind === 252 /* SourceFile */) { - ts.Debug.assert(!!(node.flags & 512 /* Default */) || node.kind === 231 /* ExportAssignment */); + if (node.parent.kind === 255 /* SourceFile */) { + ts.Debug.assert(!!(node.flags & 512 /* Default */) || node.kind === 234 /* 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 });"); + write('Object.defineProperty(exports, "__esModule", { value: true });'); writeLine(); } else { @@ -35535,7 +36594,7 @@ var ts; if (node.flags & 512 /* Default */) { emitEs6ExportDefaultCompat(node); if (languageVersion === 0 /* ES3 */) { - write("exports[\"default\"]"); + write('exports["default"]'); } else { write("exports.default"); @@ -35601,7 +36660,7 @@ var ts; emitNodeWithCommentsAndWithoutSourcemap(name); write("\", "); } - var isVariableDeclarationOrBindingElement = name.parent && (name.parent.kind === 215 /* VariableDeclaration */ || name.parent.kind === 167 /* BindingElement */); + var isVariableDeclarationOrBindingElement = name.parent && (name.parent.kind === 217 /* VariableDeclaration */ || name.parent.kind === 168 /* 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); @@ -35635,8 +36694,8 @@ var ts; return identifier; } function isFirstVariableDeclaration(root) { - return root.kind === 215 /* VariableDeclaration */ && - root.parent.kind === 216 /* VariableDeclarationList */ && + return root.kind === 217 /* VariableDeclaration */ && + root.parent.kind === 218 /* VariableDeclarationList */ && root.parent.declarations[0] === root; } function emitDestructuring(root, isAssignmentExpressionStatement, value) { @@ -35646,15 +36705,15 @@ var ts; // 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 === 215 /* VariableDeclaration */) { + if (root.kind === 217 /* VariableDeclaration */) { var isExported = ts.getCombinedNodeFlags(root) & 1 /* Export */; var isSourceLevelForSystemModuleKind = shouldHoistDeclarationInSystemJsModule(root); canDefineTempVariablesInPlace = !isExported && !isSourceLevelForSystemModuleKind; } - else if (root.kind === 140 /* Parameter */) { + else if (root.kind === 141 /* Parameter */) { canDefineTempVariablesInPlace = true; } - if (root.kind === 185 /* BinaryExpression */) { + if (root.kind === 186 /* BinaryExpression */) { emitAssignmentExpression(root); } else { @@ -35689,14 +36748,14 @@ var ts; // 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(185 /* BinaryExpression */); + var equals = ts.createSynthesizedNode(186 /* 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(186 /* ConditionalExpression */); + var cond = ts.createSynthesizedNode(187 /* ConditionalExpression */); cond.condition = condition; cond.questionToken = ts.createSynthesizedNode(53 /* QuestionToken */); cond.whenTrue = whenTrue; @@ -35711,7 +36770,7 @@ var ts; } function createPropertyAccessForDestructuringProperty(object, propName) { var index; - var nameIsComputed = propName.kind === 138 /* ComputedPropertyName */; + var nameIsComputed = propName.kind === 139 /* 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); @@ -35731,7 +36790,7 @@ var ts; : createElementAccessExpression(object, index); } function createSliceCall(value, sliceIndex) { - var call = ts.createSynthesizedNode(172 /* CallExpression */); + var call = ts.createSynthesizedNode(173 /* CallExpression */); var sliceIdentifier = ts.createSynthesizedNode(69 /* Identifier */); sliceIdentifier.text = "slice"; call.expression = createPropertyAccessExpression(value, sliceIdentifier); @@ -35749,9 +36808,9 @@ var ts; } for (var _a = 0, properties_5 = properties; _a < properties_5.length; _a++) { var p = properties_5[_a]; - if (p.kind === 249 /* PropertyAssignment */ || p.kind === 250 /* ShorthandPropertyAssignment */) { + if (p.kind === 252 /* PropertyAssignment */ || p.kind === 253 /* ShorthandPropertyAssignment */) { var propName = p.name; - var target_1 = p.kind === 250 /* ShorthandPropertyAssignment */ ? p : p.initializer || propName; + var target_1 = p.kind === 253 /* 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); } @@ -35767,9 +36826,9 @@ var ts; } for (var i = 0; i < elements.length; i++) { var e = elements[i]; - if (e.kind !== 191 /* OmittedExpression */) { + if (e.kind !== 192 /* OmittedExpression */) { // Assignment for target = value.propName should highlight whole property, hence use e as source map node - if (e.kind !== 189 /* SpreadElementExpression */) { + if (e.kind !== 190 /* SpreadElementExpression */) { emitDestructuringAssignment(e, createElementAccessExpression(value, createNumericLiteral(i)), e); } else if (i === elements.length - 1) { @@ -35780,20 +36839,20 @@ var ts; } 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 === 250 /* ShorthandPropertyAssignment */) { + if (target.kind === 253 /* ShorthandPropertyAssignment */) { if (target.objectAssignmentInitializer) { value = createDefaultValueCheck(value, target.objectAssignmentInitializer, sourceMapNode); } target = target.name; } - else if (target.kind === 185 /* BinaryExpression */ && target.operatorToken.kind === 56 /* EqualsToken */) { + else if (target.kind === 186 /* BinaryExpression */ && target.operatorToken.kind === 56 /* EqualsToken */) { value = createDefaultValueCheck(value, target.right, sourceMapNode); target = target.left; } - if (target.kind === 169 /* ObjectLiteralExpression */) { + if (target.kind === 170 /* ObjectLiteralExpression */) { emitObjectLiteralAssignment(target, value, sourceMapNode); } - else if (target.kind === 168 /* ArrayLiteralExpression */) { + else if (target.kind === 169 /* ArrayLiteralExpression */) { emitArrayLiteralAssignment(target, value, sourceMapNode); } else { @@ -35815,7 +36874,7 @@ var ts; emitDestructuringAssignment(target, value, ts.nodeIsSynthesized(root) ? target : root); } else { - if (root.parent.kind !== 176 /* ParenthesizedExpression */) { + if (root.parent.kind !== 177 /* ParenthesizedExpression */) { write("("); } // Temporary assignment needed to emit root should highlight whole binary expression @@ -35824,7 +36883,7 @@ var ts; emitDestructuringAssignment(target, value, root); write(", "); emit(value); - if (root.parent.kind !== 176 /* ParenthesizedExpression */) { + if (root.parent.kind !== 177 /* ParenthesizedExpression */) { write(")"); } } @@ -35852,12 +36911,12 @@ var ts; } for (var i = 0; i < numElements; i++) { var element = elements[i]; - if (pattern.kind === 165 /* ObjectBindingPattern */) { + if (pattern.kind === 166 /* 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 !== 191 /* OmittedExpression */) { + else if (element.kind !== 192 /* OmittedExpression */) { if (!element.dotDotDotToken) { // Rewrite element to a declaration that accesses array element at index i emitBindingElement(element, createElementAccessExpression(value, createNumericLiteral(i))); @@ -35876,12 +36935,26 @@ var ts; } function emitVariableDeclaration(node) { if (ts.isBindingPattern(node.name)) { - if (languageVersion < 2 /* ES6 */) { - emitDestructuring(node, /*isAssignmentExpressionStatement*/ false); - } - else { + 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 { @@ -35917,12 +36990,12 @@ var ts; var isCapturedInFunction = flags & 131072 /* CapturedBlockScopedBinding */; var isDeclaredInLoop = flags & 262144 /* BlockScopedBindingInLoop */; var emittedAsTopLevel = ts.isBlockScopedContainerTopLevel(container) || - (isCapturedInFunction && isDeclaredInLoop && container.kind === 196 /* Block */ && ts.isIterationStatement(container.parent, /*lookInLabeledStatements*/ false)); + (isCapturedInFunction && isDeclaredInLoop && container.kind === 198 /* Block */ && ts.isIterationStatement(container.parent, /*lookInLabeledStatements*/ false)); var emittedAsNestedLetDeclaration = ts.getCombinedNodeFlags(node) & 1024 /* Let */ && !emittedAsTopLevel; var emitExplicitInitializer = emittedAsNestedLetDeclaration && - container.kind !== 204 /* ForInStatement */ && - container.kind !== 205 /* ForOfStatement */ && + container.kind !== 206 /* ForInStatement */ && + container.kind !== 207 /* ForOfStatement */ && (!resolver.isDeclarationWithCollidingName(node) || (isDeclaredInLoop && !isCapturedInFunction && !ts.isIterationStatement(container, /*lookInLabeledStatements*/ false))); if (emitExplicitInitializer) { @@ -35943,7 +37016,7 @@ var ts; } } function emitExportVariableAssignments(node) { - if (node.kind === 191 /* OmittedExpression */) { + if (node.kind === 192 /* OmittedExpression */) { return; } var name = node.name; @@ -35957,7 +37030,7 @@ var ts; function isES6ExportedDeclaration(node) { return !!(node.flags & 1 /* Export */) && modulekind === ts.ModuleKind.ES6 && - node.parent.kind === 252 /* SourceFile */; + node.parent.kind === 255 /* SourceFile */; } function emitVariableStatement(node) { var startIsEmitted = false; @@ -36008,12 +37081,12 @@ var ts; function emitParameter(node) { if (languageVersion < 2 /* ES6 */) { if (ts.isBindingPattern(node.name)) { - var name_26 = createTempVariable(0 /* Auto */); + var name_28 = createTempVariable(0 /* Auto */); if (!tempParameters) { tempParameters = []; } - tempParameters.push(name_26); - emit(name_26); + tempParameters.push(name_28); + emit(name_28); } else { emit(node.name); @@ -36118,12 +37191,12 @@ var ts; } } function emitAccessor(node) { - write(node.kind === 147 /* GetAccessor */ ? "get " : "set "); + write(node.kind === 148 /* GetAccessor */ ? "get " : "set "); emit(node.name); emitSignatureAndBody(node); } function shouldEmitAsArrowFunction(node) { - return node.kind === 178 /* ArrowFunction */ && languageVersion >= 2 /* ES6 */; + return node.kind === 179 /* ArrowFunction */ && languageVersion >= 2 /* ES6 */; } function emitDeclarationName(node) { if (node.name) { @@ -36134,11 +37207,11 @@ var ts; } } function shouldEmitFunctionName(node) { - if (node.kind === 177 /* FunctionExpression */) { + if (node.kind === 178 /* FunctionExpression */) { // Emit name if one is present return !!node.name; } - if (node.kind === 217 /* FunctionDeclaration */) { + if (node.kind === 219 /* 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; } @@ -36150,12 +37223,12 @@ var ts; // 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 !== 145 /* MethodDeclaration */ && - kind !== 144 /* MethodSignature */ && + if (kind !== 146 /* MethodDeclaration */ && + kind !== 145 /* MethodSignature */ && parent && - parent.kind !== 249 /* PropertyAssignment */ && - parent.kind !== 172 /* CallExpression */ && - parent.kind !== 168 /* ArrayLiteralExpression */) { + parent.kind !== 252 /* PropertyAssignment */ && + parent.kind !== 173 /* CallExpression */ && + parent.kind !== 169 /* ArrayLiteralExpression */) { // 1. Methods will emit comments at their assignment declaration sites. // // 2. If the function is a property of object literal, emitting leading-comments @@ -36194,11 +37267,13 @@ var ts; emitDeclarationName(node); } emitSignatureAndBody(node); - if (modulekind !== ts.ModuleKind.ES6 && kind === 217 /* FunctionDeclaration */ && parent === currentSourceFile && node.name) { + if (modulekind !== ts.ModuleKind.ES6 && kind === 219 /* FunctionDeclaration */ && parent === currentSourceFile && node.name) { emitExportMemberAssignments(node.name); } emitEnd(node); - if (kind !== 145 /* MethodDeclaration */ && kind !== 144 /* MethodSignature */) { + if (kind !== 146 /* MethodDeclaration */ && + kind !== 145 /* MethodSignature */ && + kind !== 179 /* ArrowFunction */) { emitTrailingComments(node); } } @@ -36215,8 +37290,9 @@ var ts; write("("); if (node) { var parameters = node.parameters; + var skipCount = node.parameters.length && node.parameters[0].name.text === "this" ? 1 : 0; var omitCount = languageVersion < 2 /* ES6 */ && ts.hasRestParameter(node) ? 1 : 0; - emitList(parameters, 0, parameters.length - omitCount, /*multiLine*/ false, /*trailingComma*/ false); + emitList(parameters, skipCount, parameters.length - omitCount - skipCount, /*multiLine*/ false, /*trailingComma*/ false); } write(")"); decreaseIndent(); @@ -36231,7 +37307,7 @@ var ts; } function emitAsyncFunctionBodyForES6(node) { var promiseConstructor = ts.getEntityNameFromTypeNode(node.type); - var isArrowFunction = node.kind === 178 /* ArrowFunction */; + var isArrowFunction = node.kind === 179 /* 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 @@ -36353,7 +37429,7 @@ var ts; write(" { }"); } else { - if (node.body.kind === 196 /* Block */) { + if (node.body.kind === 198 /* Block */) { emitBlockFunctionBody(node, node.body); } else { @@ -36412,10 +37488,10 @@ var ts; write(" "); // Unwrap all type assertions. var current = body; - while (current.kind === 175 /* TypeAssertionExpression */) { + while (current.kind === 176 /* TypeAssertionExpression */) { current = current.expression; } - emitParenthesizedIf(body, current.kind === 169 /* ObjectLiteralExpression */); + emitParenthesizedIf(body, current.kind === 170 /* ObjectLiteralExpression */); } function emitDownLevelExpressionFunctionBody(node, body) { write(" {"); @@ -36500,7 +37576,7 @@ var ts; return undefined; } var statement = statements[index]; - if (statement.kind === 199 /* ExpressionStatement */) { + if (statement.kind === 201 /* ExpressionStatement */) { return ts.isSuperCallExpression(statement.expression) ? statement : undefined; } } @@ -36529,7 +37605,7 @@ var ts; emitNodeWithCommentsAndWithoutSourcemap(memberName); write("]"); } - else if (memberName.kind === 138 /* ComputedPropertyName */) { + else if (memberName.kind === 139 /* ComputedPropertyName */) { emitComputedPropertyName(memberName); } else { @@ -36541,7 +37617,7 @@ var ts; var properties = []; for (var _a = 0, _b = node.members; _a < _b.length; _a++) { var member = _b[_a]; - if (member.kind === 143 /* PropertyDeclaration */ && isStatic === ((member.flags & 32 /* Static */) !== 0) && member.initializer) { + if (member.kind === 144 /* PropertyDeclaration */ && isStatic === ((member.flags & 32 /* Static */) !== 0) && member.initializer) { properties.push(member); } } @@ -36581,11 +37657,11 @@ var ts; } function emitMemberFunctionsForES5AndLower(node) { ts.forEach(node.members, function (member) { - if (member.kind === 195 /* SemicolonClassElement */) { + if (member.kind === 197 /* SemicolonClassElement */) { writeLine(); write(";"); } - else if (member.kind === 145 /* MethodDeclaration */ || node.kind === 144 /* MethodSignature */) { + else if (member.kind === 146 /* MethodDeclaration */ || node.kind === 145 /* MethodSignature */) { if (!member.body) { return emitCommentsOnNotEmittedNode(member); } @@ -36602,7 +37678,7 @@ var ts; write(";"); emitTrailingComments(member); } - else if (member.kind === 147 /* GetAccessor */ || member.kind === 148 /* SetAccessor */) { + else if (member.kind === 148 /* GetAccessor */ || member.kind === 149 /* SetAccessor */) { var accessors = ts.getAllAccessorDeclarations(node.members, member); if (member === accessors.firstAccessor) { writeLine(); @@ -36652,22 +37728,22 @@ var ts; function emitMemberFunctionsForES6AndHigher(node) { for (var _a = 0, _b = node.members; _a < _b.length; _a++) { var member = _b[_a]; - if ((member.kind === 145 /* MethodDeclaration */ || node.kind === 144 /* MethodSignature */) && !member.body) { + if ((member.kind === 146 /* MethodDeclaration */ || node.kind === 145 /* MethodSignature */) && !member.body) { emitCommentsOnNotEmittedNode(member); } - else if (member.kind === 145 /* MethodDeclaration */ || - member.kind === 147 /* GetAccessor */ || - member.kind === 148 /* SetAccessor */) { + else if (member.kind === 146 /* MethodDeclaration */ || + member.kind === 148 /* GetAccessor */ || + member.kind === 149 /* SetAccessor */) { writeLine(); emitLeadingComments(member); emitStart(member); if (member.flags & 32 /* Static */) { write("static "); } - if (member.kind === 147 /* GetAccessor */) { + if (member.kind === 148 /* GetAccessor */) { write("get "); } - else if (member.kind === 148 /* SetAccessor */) { + else if (member.kind === 149 /* SetAccessor */) { write("set "); } if (member.asteriskToken) { @@ -36678,7 +37754,7 @@ var ts; emitEnd(member); emitTrailingComments(member); } - else if (member.kind === 195 /* SemicolonClassElement */) { + else if (member.kind === 197 /* SemicolonClassElement */) { writeLine(); write(";"); } @@ -36707,11 +37783,11 @@ var ts; var hasInstancePropertyWithInitializer = false; // Emit the constructor overload pinned comments ts.forEach(node.members, function (member) { - if (member.kind === 146 /* Constructor */ && !member.body) { + if (member.kind === 147 /* Constructor */ && !member.body) { emitCommentsOnNotEmittedNode(member); } // Check if there is any non-static property assignment - if (member.kind === 143 /* PropertyDeclaration */ && member.initializer && (member.flags & 32 /* Static */) === 0) { + if (member.kind === 144 /* PropertyDeclaration */ && member.initializer && (member.flags & 32 /* Static */) === 0) { hasInstancePropertyWithInitializer = true; } }); @@ -36825,9 +37901,11 @@ var ts; } function emitClassLikeDeclarationForES6AndHigher(node) { var decoratedClassAlias; - var thisNodeIsDecorated = ts.nodeIsDecorated(node); - if (node.kind === 218 /* ClassDeclaration */) { - if (thisNodeIsDecorated) { + var isHoistedDeclarationInSystemModule = shouldHoistDeclarationInSystemJsModule(node); + var isDecorated = ts.nodeIsDecorated(node); + var rewriteAsClassExpression = isDecorated || isHoistedDeclarationInSystemModule; + if (node.kind === 220 /* ClassDeclaration */) { + if (rewriteAsClassExpression) { // When we emit an ES6 class that has a class decorator, we must tailor the // emit to certain specific cases. // @@ -36907,7 +37985,10 @@ var ts; // --------------------------------------------------------------------- // [Example 4] // - if (resolver.getNodeCheckFlags(node) & 524288 /* ClassWithBodyScopedClassBinding */) { + // 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; write("let " + decoratedClassAlias + ";"); @@ -36916,7 +37997,9 @@ var ts; if (isES6ExportedDeclaration(node) && !(node.flags & 512 /* Default */)) { write("export "); } - write("let "); + if (!isHoistedDeclarationInSystemModule) { + write("let "); + } emitDeclarationName(node); if (decoratedClassAlias !== undefined) { write(" = " + decoratedClassAlias); @@ -36942,7 +38025,7 @@ var ts; // 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 === 190 /* ClassExpression */; + var isClassExpressionWithStaticProperties = staticProperties.length > 0 && node.kind === 191 /* ClassExpression */; var tempVariable; if (isClassExpressionWithStaticProperties) { tempVariable = createAndRecordTempVariable(0 /* Auto */); @@ -36955,7 +38038,7 @@ var ts; // 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) && !thisNodeIsDecorated)) { + if (node.name || (node.flags & 512 /* Default */ && (staticProperties.length > 0 || modulekind !== ts.ModuleKind.ES6) && !rewriteAsClassExpression)) { write(" "); emitDeclarationName(node); } @@ -36972,7 +38055,7 @@ var ts; decreaseIndent(); writeLine(); emitToken(16 /* CloseBraceToken */, node.members.end); - if (thisNodeIsDecorated) { + if (rewriteAsClassExpression) { decoratedClassAliases[ts.getNodeId(node)] = undefined; write(";"); } @@ -37010,14 +38093,14 @@ var ts; // 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 (thisNodeIsDecorated) { + if (isDecorated) { writeLine(); write("export default "); emitDeclarationName(node); write(";"); } } - else if (node.parent.kind !== 252 /* SourceFile */) { + else if (node.parent.kind !== 255 /* SourceFile */) { writeLine(); emitStart(node); emitModuleMemberName(node); @@ -37029,7 +38112,7 @@ var ts; } } function emitClassLikeDeclarationBelowES6(node) { - if (node.kind === 218 /* ClassDeclaration */) { + if (node.kind === 220 /* ClassDeclaration */) { // source file level classes in system modules are hoisted so 'var's for them are already defined if (!shouldHoistDeclarationInSystemJsModule(node)) { write("var "); @@ -37090,11 +38173,11 @@ var ts; emit(baseTypeNode.expression); } write("))"); - if (node.kind === 218 /* ClassDeclaration */) { + if (node.kind === 220 /* ClassDeclaration */) { write(";"); } emitEnd(node); - if (node.kind === 218 /* ClassDeclaration */) { + if (node.kind === 220 /* ClassDeclaration */) { emitExportMemberAssignment(node); } } @@ -37181,7 +38264,7 @@ var ts; else { decorators = member.decorators; // we only decorate the parameters here if this is a method - if (member.kind === 145 /* MethodDeclaration */) { + if (member.kind === 146 /* MethodDeclaration */) { functionLikeMember = member; } } @@ -37238,7 +38321,7 @@ var ts; write(", "); emitExpressionForPropertyName(member.name); if (languageVersion > 0 /* ES3 */) { - if (member.kind !== 143 /* PropertyDeclaration */) { + if (member.kind !== 144 /* 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"); @@ -37280,10 +38363,10 @@ var ts; // The caller should have already tested whether the node has decorators and whether the emitDecoratorMetadata // compiler option is set. switch (node.kind) { - case 145 /* MethodDeclaration */: - case 147 /* GetAccessor */: - case 148 /* SetAccessor */: - case 143 /* PropertyDeclaration */: + case 146 /* MethodDeclaration */: + case 148 /* GetAccessor */: + case 149 /* SetAccessor */: + case 144 /* PropertyDeclaration */: return true; } return false; @@ -37293,7 +38376,7 @@ var ts; // The caller should have already tested whether the node has decorators and whether the emitDecoratorMetadata // compiler option is set. switch (node.kind) { - case 145 /* MethodDeclaration */: + case 146 /* MethodDeclaration */: return true; } return false; @@ -37303,9 +38386,9 @@ var ts; // The caller should have already tested whether the node has decorators and whether the emitDecoratorMetadata // compiler option is set. switch (node.kind) { - case 218 /* ClassDeclaration */: - case 145 /* MethodDeclaration */: - case 148 /* SetAccessor */: + case 220 /* ClassDeclaration */: + case 146 /* MethodDeclaration */: + case 149 /* SetAccessor */: return true; } return false; @@ -37323,19 +38406,19 @@ var ts; // // For rules on serializing type annotations, see `serializeTypeNode`. switch (node.kind) { - case 218 /* ClassDeclaration */: + case 220 /* ClassDeclaration */: write("Function"); return; - case 143 /* PropertyDeclaration */: + case 144 /* PropertyDeclaration */: emitSerializedTypeNode(node.type); return; - case 140 /* Parameter */: + case 141 /* Parameter */: emitSerializedTypeNode(node.type); return; - case 147 /* GetAccessor */: + case 148 /* GetAccessor */: emitSerializedTypeNode(node.type); return; - case 148 /* SetAccessor */: + case 149 /* SetAccessor */: emitSerializedTypeNode(ts.getSetAccessorTypeAnnotationNode(node)); return; } @@ -37351,23 +38434,23 @@ var ts; case 103 /* VoidKeyword */: write("void 0"); return; - case 162 /* ParenthesizedType */: + case 163 /* ParenthesizedType */: emitSerializedTypeNode(node.type); return; - case 154 /* FunctionType */: - case 155 /* ConstructorType */: + case 155 /* FunctionType */: + case 156 /* ConstructorType */: write("Function"); return; - case 158 /* ArrayType */: - case 159 /* TupleType */: + case 159 /* ArrayType */: + case 160 /* TupleType */: write("Array"); return; - case 152 /* TypePredicate */: + case 153 /* TypePredicate */: case 120 /* BooleanKeyword */: write("Boolean"); return; case 131 /* StringKeyword */: - case 164 /* StringLiteralType */: + case 165 /* StringLiteralType */: write("String"); return; case 129 /* NumberKeyword */: @@ -37376,15 +38459,15 @@ var ts; case 132 /* SymbolKeyword */: write("Symbol"); return; - case 153 /* TypeReference */: + case 154 /* TypeReference */: emitSerializedTypeReferenceNode(node); return; - case 156 /* TypeQuery */: - case 157 /* TypeLiteral */: - case 160 /* UnionType */: - case 161 /* IntersectionType */: + case 157 /* TypeQuery */: + case 158 /* TypeLiteral */: + case 161 /* UnionType */: + case 162 /* IntersectionType */: case 117 /* AnyKeyword */: - case 163 /* ThisType */: + case 164 /* ThisType */: break; default: ts.Debug.fail("Cannot serialize unexpected type node."); @@ -37457,7 +38540,7 @@ var ts; // For the rules on serializing the type of each parameter declaration, see `serializeTypeOfDeclaration`. if (node) { var valueDeclaration = void 0; - if (node.kind === 218 /* ClassDeclaration */) { + if (node.kind === 220 /* ClassDeclaration */) { valueDeclaration = ts.getFirstConstructorWithBody(node); } else if (ts.isFunctionLike(node) && ts.nodeIsPresent(node.body)) { @@ -37473,10 +38556,10 @@ var ts; } if (parameters[i].dotDotDotToken) { var parameterType = parameters[i].type; - if (parameterType.kind === 158 /* ArrayType */) { + if (parameterType.kind === 159 /* ArrayType */) { parameterType = parameterType.elementType; } - else if (parameterType.kind === 153 /* TypeReference */ && parameterType.typeArguments && parameterType.typeArguments.length === 1) { + else if (parameterType.kind === 154 /* TypeReference */ && parameterType.typeArguments && parameterType.typeArguments.length === 1) { parameterType = parameterType.typeArguments[0]; } else { @@ -37553,7 +38636,7 @@ var ts; 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, 221 /* EnumDeclaration */))) { + if (!(node.flags & 1 /* Export */) || (isES6ExportedEnum && isFirstDeclarationOfKind(node, node.symbol && node.symbol.declarations, 223 /* EnumDeclaration */))) { emitStart(node); if (isES6ExportedEnum) { write("export "); @@ -37635,7 +38718,7 @@ var ts; } } function getInnerMostModuleDeclarationFromDottedModule(moduleDeclaration) { - if (moduleDeclaration.body.kind === 222 /* ModuleDeclaration */) { + if (moduleDeclaration.body.kind === 224 /* ModuleDeclaration */) { var recursiveInnerModule = getInnerMostModuleDeclarationFromDottedModule(moduleDeclaration.body); return recursiveInnerModule || moduleDeclaration.body; } @@ -37659,7 +38742,7 @@ var ts; var emitVarForModule = !hoistedInDeclarationScope && !isModuleMergedWithES6Class(node); if (emitVarForModule) { var isES6ExportedNamespace = isES6ExportedDeclaration(node); - if (!isES6ExportedNamespace || isFirstDeclarationOfKind(node, node.symbol && node.symbol.declarations, 222 /* ModuleDeclaration */)) { + if (!isES6ExportedNamespace || isFirstDeclarationOfKind(node, node.symbol && node.symbol.declarations, 224 /* ModuleDeclaration */)) { emitStart(node); if (isES6ExportedNamespace) { write("export "); @@ -37677,7 +38760,7 @@ var ts; write(getGeneratedNameForNode(node)); emitEnd(node.name); write(") "); - if (node.body.kind === 223 /* ModuleBlock */) { + if (node.body.kind === 225 /* ModuleBlock */) { var saveConvertedLoopState = convertedLoopState; var saveTempFlags = tempFlags; var saveTempVariables = tempVariables; @@ -37753,16 +38836,16 @@ var ts; } } function getNamespaceDeclarationNode(node) { - if (node.kind === 225 /* ImportEqualsDeclaration */) { + if (node.kind === 228 /* ImportEqualsDeclaration */) { return node; } var importClause = node.importClause; - if (importClause && importClause.namedBindings && importClause.namedBindings.kind === 228 /* NamespaceImport */) { + if (importClause && importClause.namedBindings && importClause.namedBindings.kind === 231 /* NamespaceImport */) { return importClause.namedBindings; } } function isDefaultImport(node) { - return node.kind === 226 /* ImportDeclaration */ && node.importClause && !!node.importClause.name; + return node.kind === 229 /* ImportDeclaration */ && node.importClause && !!node.importClause.name; } function emitExportImportAssignments(node) { if (ts.isAliasSymbolDeclaration(node) && resolver.isValueAliasDeclaration(node)) { @@ -37790,7 +38873,7 @@ var ts; if (shouldEmitNamedBindings) { emitLeadingComments(node.importClause.namedBindings); emitStart(node.importClause.namedBindings); - if (node.importClause.namedBindings.kind === 228 /* NamespaceImport */) { + if (node.importClause.namedBindings.kind === 231 /* NamespaceImport */) { write("* as "); emit(node.importClause.namedBindings.name); } @@ -37816,7 +38899,7 @@ var ts; } function emitExternalImportDeclaration(node) { if (ts.contains(externalImports, node)) { - var isExportedImport = node.kind === 225 /* ImportEqualsDeclaration */ && (node.flags & 1 /* Export */) !== 0; + var isExportedImport = node.kind === 228 /* ImportEqualsDeclaration */ && (node.flags & 1 /* Export */) !== 0; var namespaceDeclaration = getNamespaceDeclarationNode(node); var varOrConst = (languageVersion <= 1 /* ES5 */) ? "var " : "const "; if (modulekind !== ts.ModuleKind.AMD) { @@ -37838,7 +38921,7 @@ var ts; // import { x, y } from "foo" // import d, * as x from "foo" // import d, { x, y } from "foo" - var isNakedImport = 226 /* ImportDeclaration */ && !node.importClause; + var isNakedImport = 229 /* ImportDeclaration */ && !node.importClause; if (!isNakedImport) { write(varOrConst); write(getGeneratedNameForNode(node)); @@ -38017,8 +39100,8 @@ var ts; write("export default "); var expression = node.expression; emit(expression); - if (expression.kind !== 217 /* FunctionDeclaration */ && - expression.kind !== 218 /* ClassDeclaration */) { + if (expression.kind !== 219 /* FunctionDeclaration */ && + expression.kind !== 220 /* ClassDeclaration */) { write(";"); } emitEnd(node); @@ -38035,7 +39118,7 @@ var ts; emitEs6ExportDefaultCompat(node); emitContainingModuleName(node); if (languageVersion === 0 /* ES3 */) { - write("[\"default\"] = "); + write('["default"] = '); } else { write(".default = "); @@ -38055,7 +39138,7 @@ var ts; for (var _a = 0, _b = sourceFile.statements; _a < _b.length; _a++) { var node = _b[_a]; switch (node.kind) { - case 226 /* ImportDeclaration */: + case 229 /* ImportDeclaration */: if (!node.importClause || resolver.isReferencedAliasDeclaration(node.importClause, /*checkChildren*/ true)) { // import "mod" @@ -38065,13 +39148,13 @@ var ts; externalImports.push(node); } break; - case 225 /* ImportEqualsDeclaration */: - if (node.moduleReference.kind === 236 /* ExternalModuleReference */ && resolver.isReferencedAliasDeclaration(node)) { + case 228 /* ImportEqualsDeclaration */: + if (node.moduleReference.kind === 239 /* ExternalModuleReference */ && resolver.isReferencedAliasDeclaration(node)) { // import x = require("mod") where x is referenced externalImports.push(node); } break; - case 232 /* ExportDeclaration */: + case 235 /* ExportDeclaration */: if (node.moduleSpecifier) { if (!node.exportClause) { // export * from "mod" @@ -38089,12 +39172,12 @@ var ts; // export { x, y } for (var _c = 0, _d = node.exportClause.elements; _c < _d.length; _c++) { var specifier = _d[_c]; - var name_27 = (specifier.propertyName || specifier.name).text; - (exportSpecifiers[name_27] || (exportSpecifiers[name_27] = [])).push(specifier); + var name_29 = (specifier.propertyName || specifier.name).text; + (exportSpecifiers[name_29] || (exportSpecifiers[name_29] = [])).push(specifier); } } break; - case 231 /* ExportAssignment */: + case 234 /* ExportAssignment */: if (node.isExportEquals && !exportEquals) { // export = x exportEquals = node; @@ -38120,18 +39203,18 @@ var ts; if (namespaceDeclaration && !isDefaultImport(node)) { return ts.getTextOfNodeFromSourceText(currentText, namespaceDeclaration.name); } - if (node.kind === 226 /* ImportDeclaration */ && node.importClause) { + if (node.kind === 229 /* ImportDeclaration */ && node.importClause) { return getGeneratedNameForNode(node); } - if (node.kind === 232 /* ExportDeclaration */ && node.moduleSpecifier) { + if (node.kind === 235 /* ExportDeclaration */ && node.moduleSpecifier) { return getGeneratedNameForNode(node); } } function getExternalModuleNameText(importNode, emitRelativePathAsModuleName) { if (emitRelativePathAsModuleName) { - var name_28 = getExternalModuleNameFromDeclaration(host, resolver, importNode); - if (name_28) { - return "\"" + name_28 + "\""; + var name_30 = getExternalModuleNameFromDeclaration(host, resolver, importNode); + if (name_30) { + return "\"" + name_30 + "\""; } } var moduleName = ts.getExternalModuleName(importNode); @@ -38149,8 +39232,8 @@ var ts; 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 === 232 /* ExportDeclaration */ || - (importNode.kind === 226 /* ImportDeclaration */ && !importNode.importClause); + var skipNode = importNode.kind === 235 /* ExportDeclaration */ || + (importNode.kind === 229 /* ImportDeclaration */ && !importNode.importClause); if (skipNode) { continue; } @@ -38183,7 +39266,7 @@ var ts; var hasExportDeclarationWithExportClause = false; for (var _a = 0, externalImports_2 = externalImports; _a < externalImports_2.length; _a++) { var externalImport = externalImports_2[_a]; - if (externalImport.kind === 232 /* ExportDeclaration */ && externalImport.exportClause) { + if (externalImport.kind === 235 /* ExportDeclaration */ && externalImport.exportClause) { hasExportDeclarationWithExportClause = true; break; } @@ -38215,7 +39298,7 @@ var ts; } for (var _d = 0, externalImports_3 = externalImports; _d < externalImports_3.length; _d++) { var externalImport = externalImports_3[_d]; - if (externalImport.kind !== 232 /* ExportDeclaration */) { + if (externalImport.kind !== 235 /* ExportDeclaration */) { continue; } var exportDecl = externalImport; @@ -38303,12 +39386,12 @@ var ts; var seen = {}; for (var i = 0; i < hoistedVars.length; i++) { var local = hoistedVars[i]; - var name_29 = local.kind === 69 /* Identifier */ + var name_31 = local.kind === 69 /* Identifier */ ? local : local.name; - if (name_29) { + if (name_31) { // do not emit duplicate entries (in case of declaration merging) in the list of hoisted variables - var text = ts.unescapeIdentifier(name_29.text); + var text = ts.unescapeIdentifier(name_31.text); if (ts.hasProperty(seen, text)) { continue; } @@ -38319,7 +39402,7 @@ var ts; if (i !== 0) { write(", "); } - if (local.kind === 218 /* ClassDeclaration */ || local.kind === 222 /* ModuleDeclaration */ || local.kind === 221 /* EnumDeclaration */) { + if (local.kind === 220 /* ClassDeclaration */ || local.kind === 224 /* ModuleDeclaration */ || local.kind === 223 /* EnumDeclaration */) { emitDeclarationName(local); } else { @@ -38353,21 +39436,21 @@ var ts; if (node.flags & 2 /* Ambient */) { return; } - if (node.kind === 217 /* FunctionDeclaration */) { + if (node.kind === 219 /* FunctionDeclaration */) { if (!hoistedFunctionDeclarations) { hoistedFunctionDeclarations = []; } hoistedFunctionDeclarations.push(node); return; } - if (node.kind === 218 /* ClassDeclaration */) { + if (node.kind === 220 /* ClassDeclaration */) { if (!hoistedVars) { hoistedVars = []; } hoistedVars.push(node); return; } - if (node.kind === 221 /* EnumDeclaration */) { + if (node.kind === 223 /* EnumDeclaration */) { if (shouldEmitEnumDeclaration(node)) { if (!hoistedVars) { hoistedVars = []; @@ -38376,7 +39459,7 @@ var ts; } return; } - if (node.kind === 222 /* ModuleDeclaration */) { + if (node.kind === 224 /* ModuleDeclaration */) { if (shouldEmitModuleDeclaration(node)) { if (!hoistedVars) { hoistedVars = []; @@ -38385,17 +39468,17 @@ var ts; } return; } - if (node.kind === 215 /* VariableDeclaration */ || node.kind === 167 /* BindingElement */) { + if (node.kind === 217 /* VariableDeclaration */ || node.kind === 168 /* BindingElement */) { if (shouldHoistVariable(node, /*checkIfSourceFileLevelDecl*/ false)) { - var name_30 = node.name; - if (name_30.kind === 69 /* Identifier */) { + var name_32 = node.name; + if (name_32.kind === 69 /* Identifier */) { if (!hoistedVars) { hoistedVars = []; } - hoistedVars.push(name_30); + hoistedVars.push(name_32); } else { - ts.forEachChild(name_30, visit); + ts.forEachChild(name_32, visit); } } return; @@ -38426,7 +39509,7 @@ var ts; // 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 === 252 /* SourceFile */; + ts.getEnclosingBlockScopeContainer(node).kind === 255 /* SourceFile */; } function isCurrentFileSystemExternalModule() { return modulekind === ts.ModuleKind.System && isCurrentFileExternalModule; @@ -38501,21 +39584,21 @@ var ts; var entry = group_1[_a]; var importVariableName = getLocalNameForExternalImport(entry) || ""; switch (entry.kind) { - case 226 /* ImportDeclaration */: + case 229 /* ImportDeclaration */: if (!entry.importClause) { // 'import "..."' case // module is imported only for side-effects, no emit required break; } // fall-through - case 225 /* ImportEqualsDeclaration */: + case 228 /* ImportEqualsDeclaration */: ts.Debug.assert(importVariableName !== ""); writeLine(); // save import into the local write(importVariableName + " = " + parameterName + ";"); writeLine(); break; - case 232 /* ExportDeclaration */: + case 235 /* ExportDeclaration */: ts.Debug.assert(importVariableName !== ""); if (entry.exportClause) { // export {a, b as c} from 'foo' @@ -38574,10 +39657,10 @@ var ts; // - 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 217 /* FunctionDeclaration */: - case 226 /* ImportDeclaration */: + case 219 /* FunctionDeclaration */: + case 229 /* ImportDeclaration */: continue; - case 232 /* ExportDeclaration */: + case 235 /* ExportDeclaration */: if (!statement.moduleSpecifier) { for (var _a = 0, _b = statement.exportClause.elements; _a < _b.length; _a++) { var element = _b[_a]; @@ -38586,7 +39669,7 @@ var ts; } } continue; - case 225 /* ImportEqualsDeclaration */: + case 228 /* ImportEqualsDeclaration */: if (!ts.isInternalModuleImportEqualsDeclaration(statement)) { // - import equals declarations that import external modules are not emitted continue; @@ -38633,7 +39716,7 @@ var ts; 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 + // 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 (ts.hasProperty(groupIndices, key)) { // deduplicate/group entries in dependency list by the dependency name @@ -38676,11 +39759,11 @@ var ts; for (var _a = 0, _b = node.amdDependencies; _a < _b.length; _a++) { var amdDependency = _b[_a]; if (amdDependency.name) { - aliasedModuleNames.push("\"" + amdDependency.path + "\""); + aliasedModuleNames.push('"' + amdDependency.path + '"'); importAliasNames.push(amdDependency.name); } else { - unaliasedModuleNames.push("\"" + amdDependency.path + "\""); + unaliasedModuleNames.push('"' + amdDependency.path + '"'); } } for (var _c = 0, externalImports_4 = externalImports; _c < externalImports_4.length; _c++) { @@ -38718,7 +39801,7 @@ var ts; } function emitAMDDependencyList(_a) { var aliasedModuleNames = _a.aliasedModuleNames, unaliasedModuleNames = _a.unaliasedModuleNames; - write("[\"require\", \"exports\""); + write('["require", "exports"'); if (aliasedModuleNames.length) { write(", "); write(aliasedModuleNames.join(", ")); @@ -38750,8 +39833,8 @@ var ts; emitExportStarHelper(); emitCaptureThisForNodeIfNecessary(node); emitLinesStartingAt(node.statements, startIndex); - emitTempDeclarations(/*newLine*/ true); emitExportEquals(/*emitAsReturn*/ true); + emitTempDeclarations(/*newLine*/ true); decreaseIndent(); writeLine(); write("});"); @@ -38763,8 +39846,8 @@ var ts; emitExportStarHelper(); emitCaptureThisForNodeIfNecessary(node); emitLinesStartingAt(node.statements, startIndex); - emitTempDeclarations(/*newLine*/ true); emitExportEquals(/*emitAsReturn*/ false); + emitTempDeclarations(/*newLine*/ true); } function emitUMDModule(node) { emitEmitHelpers(node); @@ -38781,8 +39864,8 @@ var ts; emitExportStarHelper(); emitCaptureThisForNodeIfNecessary(node); emitLinesStartingAt(node.statements, startIndex); - emitTempDeclarations(/*newLine*/ true); emitExportEquals(/*emitAsReturn*/ true); + emitTempDeclarations(/*newLine*/ true); decreaseIndent(); writeLine(); write("});"); @@ -38856,7 +39939,7 @@ var ts; if (entities[m] !== undefined) { var ch = String.fromCharCode(entities[m]); // " needs to be escaped - return ch === "\"" ? "\\\"" : ch; + return ch === '"' ? "\\\"" : ch; } else { return s; @@ -38866,11 +39949,11 @@ var ts; return result; } function isJsxChildEmittable(child) { - if (child.kind === 244 /* JsxExpression */) { + if (child.kind === 247 /* JsxExpression */) { // Don't emit empty expressions return !!child.expression; } - else if (child.kind === 240 /* JsxText */) { + else if (child.kind === 243 /* JsxText */) { // Don't emit empty strings return !!getTextToEmit(child); } @@ -38895,9 +39978,9 @@ var ts; function emitJsxText(node) { switch (compilerOptions.jsx) { case 2 /* React */: - write("\""); + write('"'); write(trimReactWhitespaceAndApplyEntities(node)); - write("\""); + write('"'); break; case 1 /* Preserve */: default: @@ -38921,7 +40004,7 @@ var ts; } } function isUseStrictPrologue(node) { - return !!node.expression.text.match(/use strict/); + return node.expression.text === "use strict"; } function ensureUseStrictPrologue(startWithNewLine, writeUseStrict) { if (writeUseStrict) { @@ -38967,10 +40050,14 @@ var ts; 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 */)) { + 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) { @@ -39070,24 +40157,24 @@ var ts; 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 219 /* InterfaceDeclaration */: - case 217 /* FunctionDeclaration */: - case 226 /* ImportDeclaration */: - case 225 /* ImportEqualsDeclaration */: - case 220 /* TypeAliasDeclaration */: - case 231 /* ExportAssignment */: + case 221 /* InterfaceDeclaration */: + case 219 /* FunctionDeclaration */: + case 229 /* ImportDeclaration */: + case 228 /* ImportEqualsDeclaration */: + case 222 /* TypeAliasDeclaration */: + case 234 /* ExportAssignment */: return true; } } function shouldEmitLeadingAndTrailingComments(node) { switch (node.kind) { - case 197 /* VariableStatement */: + case 199 /* VariableStatement */: return shouldEmitLeadingAndTrailingCommentsForVariableStatement(node); - case 222 /* ModuleDeclaration */: + case 224 /* ModuleDeclaration */: // Only emit the leading/trailing comments for a module if we're actually // emitting the module as well. return shouldEmitModuleDeclaration(node); - case 221 /* EnumDeclaration */: + case 223 /* EnumDeclaration */: // Only emit the leading/trailing comments for an enum if we're actually // emitting the module as well. return shouldEmitEnumDeclaration(node); @@ -39099,9 +40186,9 @@ var ts; // 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 !== 196 /* Block */ && + if (node.kind !== 198 /* Block */ && node.parent && - node.parent.kind === 178 /* ArrowFunction */ && + node.parent.kind === 179 /* ArrowFunction */ && node.parent.body === node && compilerOptions.target <= 1 /* ES5 */) { return false; @@ -39114,13 +40201,13 @@ var ts; switch (node.kind) { case 69 /* Identifier */: return emitIdentifier(node); - case 140 /* Parameter */: + case 141 /* Parameter */: return emitParameter(node); - case 145 /* MethodDeclaration */: - case 144 /* MethodSignature */: + case 146 /* MethodDeclaration */: + case 145 /* MethodSignature */: return emitMethod(node); - case 147 /* GetAccessor */: - case 148 /* SetAccessor */: + case 148 /* GetAccessor */: + case 149 /* SetAccessor */: return emitAccessor(node); case 97 /* ThisKeyword */: return emitThis(node); @@ -39140,142 +40227,142 @@ var ts; case 13 /* TemplateMiddle */: case 14 /* TemplateTail */: return emitLiteral(node); - case 187 /* TemplateExpression */: + case 188 /* TemplateExpression */: return emitTemplateExpression(node); - case 194 /* TemplateSpan */: + case 196 /* TemplateSpan */: return emitTemplateSpan(node); - case 237 /* JsxElement */: - case 238 /* JsxSelfClosingElement */: + case 240 /* JsxElement */: + case 241 /* JsxSelfClosingElement */: return emitJsxElement(node); - case 240 /* JsxText */: + case 243 /* JsxText */: return emitJsxText(node); - case 244 /* JsxExpression */: + case 247 /* JsxExpression */: return emitJsxExpression(node); - case 137 /* QualifiedName */: + case 138 /* QualifiedName */: return emitQualifiedName(node); - case 165 /* ObjectBindingPattern */: + case 166 /* ObjectBindingPattern */: return emitObjectBindingPattern(node); - case 166 /* ArrayBindingPattern */: + case 167 /* ArrayBindingPattern */: return emitArrayBindingPattern(node); - case 167 /* BindingElement */: + case 168 /* BindingElement */: return emitBindingElement(node); - case 168 /* ArrayLiteralExpression */: + case 169 /* ArrayLiteralExpression */: return emitArrayLiteral(node); - case 169 /* ObjectLiteralExpression */: + case 170 /* ObjectLiteralExpression */: return emitObjectLiteral(node); - case 249 /* PropertyAssignment */: + case 252 /* PropertyAssignment */: return emitPropertyAssignment(node); - case 250 /* ShorthandPropertyAssignment */: + case 253 /* ShorthandPropertyAssignment */: return emitShorthandPropertyAssignment(node); - case 138 /* ComputedPropertyName */: + case 139 /* ComputedPropertyName */: return emitComputedPropertyName(node); - case 170 /* PropertyAccessExpression */: + case 171 /* PropertyAccessExpression */: return emitPropertyAccess(node); - case 171 /* ElementAccessExpression */: + case 172 /* ElementAccessExpression */: return emitIndexedAccess(node); - case 172 /* CallExpression */: + case 173 /* CallExpression */: return emitCallExpression(node); - case 173 /* NewExpression */: + case 174 /* NewExpression */: return emitNewExpression(node); - case 174 /* TaggedTemplateExpression */: + case 175 /* TaggedTemplateExpression */: return emitTaggedTemplateExpression(node); - case 175 /* TypeAssertionExpression */: + case 176 /* TypeAssertionExpression */: + case 194 /* AsExpression */: + case 195 /* NonNullExpression */: return emit(node.expression); - case 193 /* AsExpression */: - return emit(node.expression); - case 176 /* ParenthesizedExpression */: + case 177 /* ParenthesizedExpression */: return emitParenExpression(node); - case 217 /* FunctionDeclaration */: - case 177 /* FunctionExpression */: - case 178 /* ArrowFunction */: + case 219 /* FunctionDeclaration */: + case 178 /* FunctionExpression */: + case 179 /* ArrowFunction */: return emitFunctionDeclaration(node); - case 179 /* DeleteExpression */: + case 180 /* DeleteExpression */: return emitDeleteExpression(node); - case 180 /* TypeOfExpression */: + case 181 /* TypeOfExpression */: return emitTypeOfExpression(node); - case 181 /* VoidExpression */: + case 182 /* VoidExpression */: return emitVoidExpression(node); - case 182 /* AwaitExpression */: + case 183 /* AwaitExpression */: return emitAwaitExpression(node); - case 183 /* PrefixUnaryExpression */: + case 184 /* PrefixUnaryExpression */: return emitPrefixUnaryExpression(node); - case 184 /* PostfixUnaryExpression */: + case 185 /* PostfixUnaryExpression */: return emitPostfixUnaryExpression(node); - case 185 /* BinaryExpression */: + case 186 /* BinaryExpression */: return emitBinaryExpression(node); - case 186 /* ConditionalExpression */: + case 187 /* ConditionalExpression */: return emitConditionalExpression(node); - case 189 /* SpreadElementExpression */: + case 190 /* SpreadElementExpression */: return emitSpreadElementExpression(node); - case 188 /* YieldExpression */: + case 189 /* YieldExpression */: return emitYieldExpression(node); - case 191 /* OmittedExpression */: + case 192 /* OmittedExpression */: return; - case 196 /* Block */: - case 223 /* ModuleBlock */: + case 198 /* Block */: + case 225 /* ModuleBlock */: return emitBlock(node); - case 197 /* VariableStatement */: + case 199 /* VariableStatement */: return emitVariableStatement(node); - case 198 /* EmptyStatement */: + case 200 /* EmptyStatement */: return write(";"); - case 199 /* ExpressionStatement */: + case 201 /* ExpressionStatement */: return emitExpressionStatement(node); - case 200 /* IfStatement */: + case 202 /* IfStatement */: return emitIfStatement(node); - case 201 /* DoStatement */: + case 203 /* DoStatement */: return emitDoStatement(node); - case 202 /* WhileStatement */: + case 204 /* WhileStatement */: return emitWhileStatement(node); - case 203 /* ForStatement */: + case 205 /* ForStatement */: return emitForStatement(node); - case 205 /* ForOfStatement */: - case 204 /* ForInStatement */: + case 207 /* ForOfStatement */: + case 206 /* ForInStatement */: return emitForInOrForOfStatement(node); - case 206 /* ContinueStatement */: - case 207 /* BreakStatement */: + case 208 /* ContinueStatement */: + case 209 /* BreakStatement */: return emitBreakOrContinueStatement(node); - case 208 /* ReturnStatement */: + case 210 /* ReturnStatement */: return emitReturnStatement(node); - case 209 /* WithStatement */: + case 211 /* WithStatement */: return emitWithStatement(node); - case 210 /* SwitchStatement */: + case 212 /* SwitchStatement */: return emitSwitchStatement(node); - case 245 /* CaseClause */: - case 246 /* DefaultClause */: + case 248 /* CaseClause */: + case 249 /* DefaultClause */: return emitCaseOrDefaultClause(node); - case 211 /* LabeledStatement */: + case 213 /* LabeledStatement */: return emitLabeledStatement(node); - case 212 /* ThrowStatement */: + case 214 /* ThrowStatement */: return emitThrowStatement(node); - case 213 /* TryStatement */: + case 215 /* TryStatement */: return emitTryStatement(node); - case 248 /* CatchClause */: + case 251 /* CatchClause */: return emitCatchClause(node); - case 214 /* DebuggerStatement */: + case 216 /* DebuggerStatement */: return emitDebuggerStatement(node); - case 215 /* VariableDeclaration */: + case 217 /* VariableDeclaration */: return emitVariableDeclaration(node); - case 190 /* ClassExpression */: + case 191 /* ClassExpression */: return emitClassExpression(node); - case 218 /* ClassDeclaration */: + case 220 /* ClassDeclaration */: return emitClassDeclaration(node); - case 219 /* InterfaceDeclaration */: + case 221 /* InterfaceDeclaration */: return emitInterfaceDeclaration(node); - case 221 /* EnumDeclaration */: + case 223 /* EnumDeclaration */: return emitEnumDeclaration(node); - case 251 /* EnumMember */: + case 254 /* EnumMember */: return emitEnumMember(node); - case 222 /* ModuleDeclaration */: + case 224 /* ModuleDeclaration */: return emitModuleDeclaration(node); - case 226 /* ImportDeclaration */: + case 229 /* ImportDeclaration */: return emitImportDeclaration(node); - case 225 /* ImportEqualsDeclaration */: + case 228 /* ImportEqualsDeclaration */: return emitImportEqualsDeclaration(node); - case 232 /* ExportDeclaration */: + case 235 /* ExportDeclaration */: return emitExportDeclaration(node); - case 231 /* ExportAssignment */: + case 234 /* ExportAssignment */: return emitExportAssignment(node); - case 252 /* SourceFile */: + case 255 /* SourceFile */: return emitSourceFileNode(node); } } @@ -39314,7 +40401,7 @@ var ts; 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 === 252 /* SourceFile */ || node.pos !== node.parent.pos) { + if (node.parent.kind === 255 /* SourceFile */ || node.pos !== node.parent.pos) { if (hasDetachedComments(node.pos)) { // get comments without detached comments return getLeadingCommentsWithoutDetachedComments(); @@ -39329,7 +40416,7 @@ var ts; 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 === 252 /* SourceFile */ || node.end !== node.parent.end) { + if (node.parent.kind === 255 /* SourceFile */ || node.end !== node.parent.end) { return ts.getTrailingCommentRanges(currentText, node.end); } } @@ -39444,6 +40531,15 @@ var ts; if (declarationFilePath) { emitSkipped = ts.writeDeclarationFile(declarationFilePath, sourceFiles, isBundledEmit, host, resolver, emitterDiagnostics) || emitSkipped; } + if (!emitSkipped && emittedFilesList) { + emittedFilesList.push(jsFilePath); + if (sourceMapFilePath) { + emittedFilesList.push(sourceMapFilePath); + } + if (declarationFilePath) { + emittedFilesList.push(declarationFilePath); + } + } } } ts.emitFiles = emitFiles; @@ -39459,10 +40555,15 @@ var ts; /* @internal */ ts.ioWriteTime = 0; /** The version of the TypeScript compiler release */ var emptyArray = []; + var defaultLibrarySearchPaths = [ + "types/", + "node_modules/", + "node_modules/@types/", + ]; ts.version = "1.9.0"; function findConfigFile(searchPath, fileExists) { - var fileName = "tsconfig.json"; while (true) { + var fileName = ts.combinePaths(searchPath, "tsconfig.json"); if (fileExists(fileName)) { return fileName; } @@ -39471,7 +40572,6 @@ var ts; break; } searchPath = parentPath; - fileName = "../" + fileName; } return undefined; } @@ -39482,18 +40582,49 @@ var ts; return ts.normalizePath(referencedFileName); } ts.resolveTripleslashReference = resolveTripleslashReference; + /* @internal */ + function computeCommonSourceDirectoryOfFilenames(fileNames, currentDirectory, getCanonicalFileName) { + var commonPathComponents; + var failed = ts.forEach(fileNames, function (sourceFile) { + // Each file contributes into common source file path + var sourcePathComponents = ts.getNormalizedPathComponents(sourceFile, currentDirectory); + sourcePathComponents.pop(); // The base file name is not part of the common directory path + if (!commonPathComponents) { + // first file + commonPathComponents = sourcePathComponents; + return; + } + for (var i = 0, n = Math.min(commonPathComponents.length, sourcePathComponents.length); i < n; i++) { + if (getCanonicalFileName(commonPathComponents[i]) !== getCanonicalFileName(sourcePathComponents[i])) { + if (i === 0) { + // Failed to find any common path component + return true; + } + // New common path found that is 0 -> i-1 + commonPathComponents.length = i; + break; + } + } + // If the sourcePathComponents was shorter than the commonPathComponents, truncate to the sourcePathComponents + if (sourcePathComponents.length < commonPathComponents.length) { + commonPathComponents.length = sourcePathComponents.length; + } + }); + // A common path can not be found when paths span multiple drives on windows, for example + if (failed) { + return ""; + } + if (!commonPathComponents) { + return currentDirectory; + } + return ts.getNormalizedPathFromPathComponents(commonPathComponents); + } + ts.computeCommonSourceDirectoryOfFilenames = computeCommonSourceDirectoryOfFilenames; function trace(host, message) { host.trace(ts.formatMessage.apply(undefined, arguments)); } function isTraceEnabled(compilerOptions, host) { - return compilerOptions.traceModuleResolution && host.trace !== undefined; - } - function startsWith(str, prefix) { - return str.lastIndexOf(prefix, 0) === 0; - } - function endsWith(str, suffix) { - var expectedPos = str.length - suffix.length; - return str.indexOf(suffix, expectedPos) === expectedPos; + return compilerOptions.traceResolution && host.trace !== undefined; } function hasZeroOrOneAsteriskCharacter(str) { var seenAsterisk = false; @@ -39521,6 +40652,150 @@ var ts; var startsWithDotSlashOrDotDotSlash = i === 0 || (i === 1 && moduleName.charCodeAt(0) === 46 /* dot */); return !startsWithDotSlashOrDotDotSlash; } + function tryReadTypesSection(packageJsonPath, baseDirectory, state) { + var jsonContent; + try { + var jsonText = state.host.readFile(packageJsonPath); + jsonContent = jsonText ? JSON.parse(jsonText) : {}; + } + catch (e) { + // gracefully handle if readFile fails or returns not JSON + jsonContent = {}; + } + var typesFile; + var fieldName; + // first try to read content of 'typings' section (backward compatibility) + if (jsonContent.typings) { + if (typeof jsonContent.typings === "string") { + fieldName = "typings"; + typesFile = jsonContent.typings; + } + else { + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.Expected_type_of_0_field_in_package_json_to_be_string_got_1, "typings", typeof jsonContent.typings); + } + } + } + // then read 'types' + if (!typesFile && jsonContent.types) { + if (typeof jsonContent.types === "string") { + fieldName = "types"; + typesFile = jsonContent.types; + } + else { + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.Expected_type_of_0_field_in_package_json_to_be_string_got_1, "types", typeof jsonContent.types); + } + } + } + if (typesFile) { + 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; + } + return undefined; + } + var typeReferenceExtensions = [".d.ts"]; + /** + * @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 + }; + // use typesRoot and fallback to directory that contains tsconfig if typesRoot is not set + var rootDir = options.typesRoot || (options.configFilePath ? ts.getDirectoryPath(options.configFilePath) : undefined); + if (traceEnabled) { + if (containingFile === undefined) { + if (rootDir === 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, rootDir); + } + } + else { + if (rootDir === 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, rootDir); + } + } + } + var failedLookupLocations = []; + // Check primary library paths + if (rootDir !== undefined) { + var effectivePrimarySearchPaths = options.typesSearchPaths || defaultLibrarySearchPaths; + for (var _i = 0, effectivePrimarySearchPaths_1 = effectivePrimarySearchPaths; _i < effectivePrimarySearchPaths_1.length; _i++) { + var searchPath = effectivePrimarySearchPaths_1[_i]; + var primaryPath = ts.combinePaths(rootDir, searchPath); + if (traceEnabled) { + trace(host, ts.Diagnostics.Resolving_with_primary_search_path_0, primaryPath); + } + var candidate = ts.combinePaths(primaryPath, 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); + } + else { + initialLocationForSecondaryLookup = rootDir; + } + 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) { @@ -39642,10 +40917,10 @@ var ts; // 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 (!endsWith(normalizedRoot, ts.directorySeparator)) { + if (!ts.endsWith(normalizedRoot, ts.directorySeparator)) { normalizedRoot += ts.directorySeparator; } - var isLongestMatchingPrefix = startsWith(candidate, normalizedRoot) && + 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); @@ -39715,8 +40990,8 @@ var ts; var prefix = pattern.substr(0, indexOfStar); var suffix = pattern.substr(indexOfStar + 1); if (moduleName.length >= prefix.length + suffix.length && - startsWith(moduleName, prefix) && - endsWith(moduleName, suffix)) { + ts.startsWith(moduleName, prefix) && + ts.endsWith(moduleName, suffix)) { // use length of prefix as betterness criteria if (prefix.length > longestMatchPrefixLength) { longestMatchPrefixLength = prefix.length; @@ -39802,6 +41077,13 @@ var ts; * 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) { + if (!onlyRecordFailures) { + // check if containig 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, tryLoad); function tryLoad(ext) { if (ext === ".tsx" && state.skipTsx) { @@ -39810,7 +41092,7 @@ var ts; var fileName = ts.fileExtensionIs(candidate, ext) ? candidate : candidate + ext; if (!onlyRecordFailures && state.host.fileExists(fileName)) { if (state.traceEnabled) { - trace(state.host, ts.Diagnostics.File_0_exist_use_it_as_a_module_resolution_result, fileName); + trace(state.host, ts.Diagnostics.File_0_exist_use_it_as_a_name_resolution_result, fileName); } return fileName; } @@ -39830,33 +41112,16 @@ var ts; if (state.traceEnabled) { trace(state.host, ts.Diagnostics.Found_package_json_at_0, packageJsonPath); } - var jsonContent = void 0; - try { - var jsonText = state.host.readFile(packageJsonPath); - jsonContent = jsonText ? JSON.parse(jsonText) : { typings: undefined }; - } - catch (e) { - // gracefully handle if readFile fails or returns not JSON - jsonContent = { typings: undefined }; - } - if (jsonContent.typings) { - if (typeof jsonContent.typings === "string") { - var typingsFile = ts.normalizePath(ts.combinePaths(candidate, jsonContent.typings)); - if (state.traceEnabled) { - trace(state.host, ts.Diagnostics.package_json_has_typings_field_0_that_references_1, jsonContent.typings, typingsFile); - } - var result = loadModuleFromFile(typingsFile, extensions, failedLookupLocation, !directoryProbablyExists(ts.getDirectoryPath(typingsFile), state.host), state); - if (result) { - return result; - } - } - else if (state.traceEnabled) { - trace(state.host, ts.Diagnostics.Expected_type_of_typings_field_in_package_json_to_be_string_got_0, typeof jsonContent.typings); + var typesFile = tryReadTypesSection(packageJsonPath, candidate, state); + if (typesFile) { + var result = loadModuleFromFile(typesFile, extensions, failedLookupLocation, !directoryProbablyExists(ts.getDirectoryPath(typesFile), state.host), state); + if (result) { + return result; } } else { if (state.traceEnabled) { - trace(state.host, ts.Diagnostics.package_json_does_not_have_typings_field); + trace(state.host, ts.Diagnostics.package_json_does_not_have_types_field); } } } @@ -39869,20 +41134,30 @@ var ts; } return loadModuleFromFile(ts.combinePaths(candidate, "index"), extensions, failedLookupLocation, !directoryExists, state); } + 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)); + // Load only typescript files irrespective of allowJs option if loading from node modules + var result = loadModuleFromFile(candidate, ts.supportedTypeScriptExtensions, failedLookupLocations, !nodeModulesFolderExists, state); + if (result) { + return result; + } + result = loadNodeModuleFromDirectory(ts.supportedTypeScriptExtensions, 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") { - var nodeModulesFolder = ts.combinePaths(directory, "node_modules"); - var nodeModulesFolderExists = directoryProbablyExists(nodeModulesFolder, state.host); - var candidate = ts.normalizePath(ts.combinePaths(nodeModulesFolder, moduleName)); - // Load only typescript files irrespective of allowJs option if loading from node modules - var result = loadModuleFromFile(candidate, ts.supportedTypeScriptExtensions, failedLookupLocations, !nodeModulesFolderExists, state); - if (result) { - return result; - } - result = loadNodeModuleFromDirectory(ts.supportedTypeScriptExtensions, candidate, failedLookupLocations, !nodeModulesFolderExists, state); + var result = + // first: try to load module as-is + loadModuleFromNodeModulesFolder(moduleName, directory, failedLookupLocations, state) || + // second: try to load module from the scope '@types' + loadModuleFromNodeModulesFolder(ts.combinePaths("@types", moduleName), directory, failedLookupLocations, state); if (result) { return result; } @@ -39979,11 +41254,40 @@ var ts; ts.sys.createDirectory(directoryPath); } } + var outputFingerprints; + function writeFileIfUpdated(fileName, data, writeByteOrderMark) { + if (!outputFingerprints) { + outputFingerprints = {}; + } + var hash = ts.sys.createHash(data); + var mtimeBefore = ts.sys.getModifiedTime(fileName); + if (mtimeBefore && ts.hasProperty(outputFingerprints, fileName)) { + var fingerprint = outputFingerprints[fileName]; + // If output has not been changed, and the file has no external modification + if (fingerprint.byteOrderMark === writeByteOrderMark && + fingerprint.hash === hash && + fingerprint.mtime.getTime() === mtimeBefore.getTime()) { + return; + } + } + ts.sys.writeFile(fileName, data, writeByteOrderMark); + var mtimeAfter = ts.sys.getModifiedTime(fileName); + outputFingerprints[fileName] = { + hash: hash, + byteOrderMark: writeByteOrderMark, + mtime: mtimeAfter + }; + } function writeFile(fileName, data, writeByteOrderMark, onError) { try { var start = new Date().getTime(); ensureDirectoriesExist(ts.getDirectoryPath(ts.normalizePath(fileName))); - ts.sys.writeFile(fileName, data, writeByteOrderMark); + if (ts.isWatchSet(options) && ts.sys.createHash && ts.sys.getModifiedTime) { + writeFileIfUpdated(fileName, data, writeByteOrderMark); + } + else { + ts.sys.writeFile(fileName, data, writeByteOrderMark); + } ts.ioWriteTime += new Date().getTime() - start; } catch (e) { @@ -39992,10 +41296,14 @@ var ts; } } } + function getDefaultLibLocation() { + return ts.getDirectoryPath(ts.normalizePath(ts.sys.getExecutingFilePath())); + } var newLine = ts.getNewLineCharacter(options); return { getSourceFile: getSourceFile, - getDefaultLibFileName: function (options) { return ts.combinePaths(ts.getDirectoryPath(ts.normalizePath(ts.sys.getExecutingFilePath())), ts.getDefaultLibFileName(options)); }, + getDefaultLibLocation: getDefaultLibLocation, + getDefaultLibFileName: function (options) { return ts.combinePaths(getDefaultLibLocation(), ts.getDefaultLibFileName(options)); }, writeFile: writeFile, getCurrentDirectory: ts.memoize(function () { return ts.sys.getCurrentDirectory(); }), useCaseSensitiveFileNames: function () { return ts.sys.useCaseSensitiveFileNames; }, @@ -40039,68 +41347,88 @@ var ts; } } ts.flattenDiagnosticMessageText = flattenDiagnosticMessageText; + function loadWithLocalCache(names, containingFile, loader) { + if (names.length === 0) { + return []; + } + var resolutions = []; + var cache = {}; + for (var _i = 0, names_1 = names; _i < names_1.length; _i++) { + var name_33 = names_1[_i]; + var result = void 0; + if (ts.hasProperty(cache, name_33)) { + result = cache[name_33]; + } + else { + result = loader(name_33, containingFile); + cache[name_33] = result; + } + resolutions.push(result); + } + return resolutions; + } function createProgram(rootNames, options, host, oldProgram) { var program; var files = []; - var fileProcessingDiagnostics = ts.createDiagnosticCollection(); - var programDiagnostics = ts.createDiagnosticCollection(); var commonSourceDirectory; var diagnosticsProducingTypeChecker; var noDiagnosticsTypeChecker; var classifiableNames; - var skipDefaultLib = options.noLib; - var supportedExtensions = ts.getSupportedExtensions(options); + var resolvedTypeReferenceDirectives = {}; + var fileProcessingDiagnostics = ts.createDiagnosticCollection(); var start = new Date().getTime(); host = host || createCompilerHost(options); + var skipDefaultLib = options.noLib; + var programDiagnostics = ts.createDiagnosticCollection(); + var currentDirectory = host.getCurrentDirectory(); + var supportedExtensions = ts.getSupportedExtensions(options); // Map storing if there is emit blocking diagnostics for given input var hasEmitBlockingDiagnostics = ts.createFileMap(getCanonicalFileName); - var currentDirectory = host.getCurrentDirectory(); - var resolveModuleNamesWorker = host.resolveModuleNames - ? (function (moduleNames, containingFile) { return host.resolveModuleNames(moduleNames, containingFile); }) - : (function (moduleNames, containingFile) { - var resolvedModuleNames = []; - // resolveModuleName does not store any results between calls. - // lookup is a local cache to avoid resolving the same module name several times - var lookup = {}; - for (var _i = 0, moduleNames_1 = moduleNames; _i < moduleNames_1.length; _i++) { - var moduleName = moduleNames_1[_i]; - var resolvedName = void 0; - if (ts.hasProperty(lookup, moduleName)) { - resolvedName = lookup[moduleName]; - } - else { - resolvedName = resolveModuleName(moduleName, containingFile, options, host).resolvedModule; - lookup[moduleName] = resolvedName; - } - resolvedModuleNames.push(resolvedName); - } - return resolvedModuleNames; - }); + var resolveModuleNamesWorker; + if (host.resolveModuleNames) { + resolveModuleNamesWorker = function (moduleNames, containingFile) { return host.resolveModuleNames(moduleNames, containingFile); }; + } + else { + var loader_1 = function (moduleName, containingFile) { return resolveModuleName(moduleName, containingFile, options, host).resolvedModule; }; + resolveModuleNamesWorker = function (moduleNames, containingFile) { return loadWithLocalCache(moduleNames, containingFile, loader_1); }; + } + var resolveTypeReferenceDirectiveNamesWorker; + if (host.resolveTypeReferenceDirectives) { + resolveTypeReferenceDirectiveNamesWorker = function (typeDirectiveNames, containingFile) { return host.resolveTypeReferenceDirectives(typeDirectiveNames, containingFile); }; + } + else { + var loader_2 = function (typesRef, containingFile) { return resolveTypeReferenceDirective(typesRef, containingFile, options, host).resolvedTypeReferenceDirective; }; + resolveTypeReferenceDirectiveNamesWorker = function (typeReferenceDirectiveNames, containingFile) { return loadWithLocalCache(typeReferenceDirectiveNames, containingFile, loader_2); }; + } var filesByName = ts.createFileMap(); // stores 'filename -> file association' ignoring case // used to track cases when two file names differ only in casing var filesByNameIgnoreCase = host.useCaseSensitiveFileNames() ? ts.createFileMap(function (fileName) { return fileName.toLowerCase(); }) : undefined; - if (oldProgram) { - // 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.noResolve !== options.noResolve) || - (oldOptions.target !== options.target) || - (oldOptions.noLib !== options.noLib) || - (oldOptions.jsx !== options.jsx) || - (oldOptions.allowJs !== options.allowJs)) { - oldProgram = undefined; - } - } if (!tryReuseStructureFromOldProgram()) { + // load type declarations specified via 'types' argument + if (options.types && options.types.length) { + var resolutions = resolveTypeReferenceDirectiveNamesWorker(options.types, /*containingFile*/ undefined); + for (var i = 0; i < options.types.length; i++) { + processTypeReferenceDirective(options.types[i], resolutions[i]); + } + } ts.forEach(rootNames, function (name) { return processRootFile(name, /*isDefaultLib*/ false); }); // Do not process the default library if: // - The '--noLib' flag is used. // - A 'no-default-lib' reference comment is encountered in // processing the root files. if (!skipDefaultLib) { - processRootFile(host.getDefaultLibFileName(options), /*isDefaultLib*/ true); + // If '--lib' is not specified, include default library file according to '--target' + // otherwise, using options specified in '--lib' instead of '--target' default library file + if (!options.lib) { + processRootFile(host.getDefaultLibFileName(options), /*isDefaultLib*/ true); + } + else { + var libDirectory_1 = host.getDefaultLibLocation ? host.getDefaultLibLocation() : ts.getDirectoryPath(host.getDefaultLibFileName(options)); + ts.forEach(options.lib, function (libFileName) { + processRootFile(ts.combinePaths(libDirectory_1, libFileName), /*isDefaultLib*/ true); + }); + } } } // unconditionally set oldProgram to undefined to prevent it from being captured in closure @@ -40125,7 +41453,8 @@ var ts; getIdentifierCount: function () { return getDiagnosticsProducingTypeChecker().getIdentifierCount(); }, getSymbolCount: function () { return getDiagnosticsProducingTypeChecker().getSymbolCount(); }, getTypeCount: function () { return getDiagnosticsProducingTypeChecker().getTypeCount(); }, - getFileProcessingDiagnostics: function () { return fileProcessingDiagnostics; } + getFileProcessingDiagnostics: function () { return fileProcessingDiagnostics; }, + resolvedTypeReferenceDirectives: resolvedTypeReferenceDirectives }; verifyCompilerOptions(); ts.programTime += new Date().getTime() - start; @@ -40164,12 +41493,29 @@ var ts; if (!oldProgram) { return false; } + // 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.noResolve !== options.noResolve) || + (oldOptions.target !== options.target) || + (oldOptions.noLib !== options.noLib) || + (oldOptions.jsx !== options.jsx) || + (oldOptions.allowJs !== options.allowJs) || + (oldOptions.rootDir !== options.rootDir) || + (oldOptions.typesSearchPaths !== options.typesSearchPaths) || + (oldOptions.configFilePath !== options.configFilePath)) { + return false; + } ts.Debug.assert(!oldProgram.structureIsReused); // there is an old program, check if we can reuse its structure var oldRootNames = oldProgram.getRootFileNames(); if (!ts.arrayIsEqualTo(oldRootNames, rootNames)) { return false; } + if (!ts.arrayIsEqualTo(options.types, oldOptions.types)) { + return false; + } // check if program source files has changed in the way that can affect structure of the program var newSourceFiles = []; var filePaths = []; @@ -40203,25 +41549,32 @@ var ts; // moduleAugmentations has changed return false; } + if (!ts.arrayIsEqualTo(oldSourceFile.typeReferenceDirectives, newSourceFile.typeReferenceDirectives, fileReferenceIsEqualTo)) { + // '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, ts.getNormalizedAbsolutePath(newSourceFile.fileName, currentDirectory)); + var resolutions = resolveModuleNamesWorker(moduleNames, newSourceFilePath); // ensure that module resolution results are still correct - for (var i = 0; i < moduleNames.length; i++) { - var newResolution = resolutions[i]; - var oldResolution = ts.getResolvedModule(oldSourceFile, moduleNames[i]); - var resolutionChanged = oldResolution - ? !newResolution || - oldResolution.resolvedFileName !== newResolution.resolvedFileName || - !!oldResolution.isExternalLibraryImport !== !!newResolution.isExternalLibraryImport - : newResolution; - if (resolutionChanged) { - return false; - } + var resolutionsChanged = ts.hasChangesInResolutions(moduleNames, resolutions, oldSourceFile.resolvedModules, ts.moduleResolutionIsEqualTo); + if (resolutionsChanged) { + return false; } } - // pass the cache of module resolutions from the old source file + 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); } else { @@ -40241,6 +41594,7 @@ var ts; var modifiedFile = modifiedSourceFiles_1[_b]; fileProcessingDiagnostics.reattachFileDiagnostics(modifiedFile); } + resolvedTypeReferenceDirectives = oldProgram.resolvedTypeReferenceDirectives; oldProgram.structureIsReused = true; return true; } @@ -40253,7 +41607,7 @@ var ts; getNewLine: function () { return host.getNewLine(); }, getSourceFile: program.getSourceFile, getSourceFiles: program.getSourceFiles, - writeFile: writeFileCallback || (function (fileName, data, writeByteOrderMark, onError) { return host.writeFile(fileName, data, writeByteOrderMark, onError); }), + writeFile: writeFileCallback || (function (fileName, data, writeByteOrderMark, onError, sourceFiles) { return host.writeFile(fileName, data, writeByteOrderMark, onError, sourceFiles); }), isEmitBlocked: isEmitBlocked }; } @@ -40273,7 +41627,7 @@ var ts; function emitWorker(program, sourceFile, writeFileCallback, cancellationToken) { var declarationDiagnostics = []; if (options.noEmit) { - return { diagnostics: declarationDiagnostics, sourceMaps: undefined, emitSkipped: true }; + return { diagnostics: declarationDiagnostics, sourceMaps: undefined, emittedFiles: undefined, emitSkipped: true }; } // If the noEmitOnError flag is set, then check if we have any errors so far. If so, // immediately bail out. Note that we pass 'undefined' for 'sourceFile' so that we @@ -40284,7 +41638,12 @@ var ts; declarationDiagnostics = program.getDeclarationDiagnostics(/*sourceFile*/ undefined, cancellationToken); } if (diagnostics.length > 0 || declarationDiagnostics.length > 0) { - return { diagnostics: diagnostics, sourceMaps: undefined, emitSkipped: true }; + return { + diagnostics: ts.concatenate(diagnostics, declarationDiagnostics), + sourceMaps: undefined, + emittedFiles: undefined, + emitSkipped: true + }; } } // Create the emit resolver outside of the "emitTime" tracking code below. That way @@ -40324,7 +41683,14 @@ var ts; return getDiagnosticsHelper(sourceFile, getSemanticDiagnosticsForFile, cancellationToken); } function getDeclarationDiagnostics(sourceFile, cancellationToken) { - return getDiagnosticsHelper(sourceFile, getDeclarationDiagnosticsForFile, cancellationToken); + var options = program.getCompilerOptions(); + // collect diagnostics from the program only once if either no source file was specified or out/outFile is set (bundled emit) + if (!sourceFile || options.out || options.outFile) { + return getDeclarationDiagnosticsWorker(sourceFile, cancellationToken); + } + else { + return getDiagnosticsHelper(sourceFile, getDeclarationDiagnosticsForFile, cancellationToken); + } } function getSyntacticDiagnosticsForFile(sourceFile, cancellationToken) { return sourceFile.parseDiagnostics; @@ -40376,47 +41742,47 @@ var ts; return false; } switch (node.kind) { - case 225 /* ImportEqualsDeclaration */: + case 228 /* ImportEqualsDeclaration */: diagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.import_can_only_be_used_in_a_ts_file)); return true; - case 231 /* ExportAssignment */: + case 234 /* ExportAssignment */: if (node.isExportEquals) { diagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.export_can_only_be_used_in_a_ts_file)); return true; } break; - case 218 /* ClassDeclaration */: + case 220 /* ClassDeclaration */: var classDeclaration = node; if (checkModifiers(classDeclaration.modifiers) || checkTypeParameters(classDeclaration.typeParameters)) { return true; } break; - case 247 /* HeritageClause */: + case 250 /* 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; } break; - case 219 /* InterfaceDeclaration */: + case 221 /* InterfaceDeclaration */: diagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.interface_declarations_can_only_be_used_in_a_ts_file)); return true; - case 222 /* ModuleDeclaration */: + case 224 /* ModuleDeclaration */: diagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.module_declarations_can_only_be_used_in_a_ts_file)); return true; - case 220 /* TypeAliasDeclaration */: + case 222 /* TypeAliasDeclaration */: diagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.type_aliases_can_only_be_used_in_a_ts_file)); return true; - case 145 /* MethodDeclaration */: - case 144 /* MethodSignature */: - case 146 /* Constructor */: - case 147 /* GetAccessor */: - case 148 /* SetAccessor */: - case 177 /* FunctionExpression */: - case 217 /* FunctionDeclaration */: - case 178 /* ArrowFunction */: - case 217 /* FunctionDeclaration */: + case 146 /* MethodDeclaration */: + case 145 /* MethodSignature */: + case 147 /* Constructor */: + case 148 /* GetAccessor */: + case 149 /* SetAccessor */: + case 178 /* FunctionExpression */: + case 219 /* FunctionDeclaration */: + case 179 /* ArrowFunction */: + case 219 /* FunctionDeclaration */: var functionDeclaration = node; if (checkModifiers(functionDeclaration.modifiers) || checkTypeParameters(functionDeclaration.typeParameters) || @@ -40424,20 +41790,20 @@ var ts; return true; } break; - case 197 /* VariableStatement */: + case 199 /* VariableStatement */: var variableStatement = node; if (checkModifiers(variableStatement.modifiers)) { return true; } break; - case 215 /* VariableDeclaration */: + case 217 /* VariableDeclaration */: var variableDeclaration = node; if (checkTypeAnnotation(variableDeclaration.type)) { return true; } break; - case 172 /* CallExpression */: - case 173 /* NewExpression */: + case 173 /* CallExpression */: + case 174 /* NewExpression */: var expression = node; if (expression.typeArguments && expression.typeArguments.length > 0) { var start_2 = expression.typeArguments.pos; @@ -40445,7 +41811,7 @@ var ts; return true; } break; - case 140 /* Parameter */: + case 141 /* Parameter */: var parameter = node; if (parameter.modifiers) { var start_3 = parameter.modifiers.pos; @@ -40461,17 +41827,17 @@ var ts; return true; } break; - case 143 /* PropertyDeclaration */: + case 144 /* PropertyDeclaration */: diagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.property_declarations_can_only_be_used_in_a_ts_file)); return true; - case 221 /* EnumDeclaration */: + case 223 /* EnumDeclaration */: diagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.enum_declarations_can_only_be_used_in_a_ts_file)); return true; - case 175 /* TypeAssertionExpression */: + case 176 /* 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 141 /* Decorator */: + case 142 /* 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)); } @@ -40519,16 +41885,17 @@ var ts; } }); } - function getDeclarationDiagnosticsForFile(sourceFile, cancellationToken) { + function getDeclarationDiagnosticsWorker(sourceFile, cancellationToken) { return runWithCancellationToken(function () { - if (!ts.isDeclarationFile(sourceFile)) { - var resolver = getDiagnosticsProducingTypeChecker().getEmitResolver(sourceFile, cancellationToken); - // Don't actually write any files since we're just getting diagnostics. - var writeFile_1 = function () { }; - return ts.getDeclarationDiagnostics(getEmitHost(writeFile_1), resolver, sourceFile); - } + 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); }); } + function getDeclarationDiagnosticsForFile(sourceFile, cancellationToken) { + return ts.isDeclarationFile(sourceFile) ? [] : getDeclarationDiagnosticsWorker(sourceFile, cancellationToken); + } function getOptionsDiagnostics() { var allDiagnostics = []; ts.addRange(allDiagnostics, fileProcessingDiagnostics.getGlobalDiagnostics()); @@ -40544,7 +41911,7 @@ var ts; return ts.getBaseFileName(fileName).indexOf(".") >= 0; } function processRootFile(fileName, isDefaultLib) { - processSourceFile(ts.normalizePath(fileName), isDefaultLib); + processSourceFile(ts.normalizePath(fileName), isDefaultLib, /*isReference*/ true); } function fileReferenceIsEqualTo(a, b) { return a.fileName === b.fileName; @@ -40575,9 +41942,9 @@ var ts; return; function collectModuleReferences(node, inAmbientModule) { switch (node.kind) { - case 226 /* ImportDeclaration */: - case 225 /* ImportEqualsDeclaration */: - case 232 /* ExportDeclaration */: + case 229 /* ImportDeclaration */: + case 228 /* ImportEqualsDeclaration */: + case 235 /* ExportDeclaration */: var moduleNameExpr = ts.getExternalModuleName(node); if (!moduleNameExpr || moduleNameExpr.kind !== 9 /* StringLiteral */) { break; @@ -40592,7 +41959,7 @@ var ts; (imports || (imports = [])).push(moduleNameExpr); } break; - case 222 /* ModuleDeclaration */: + case 224 /* ModuleDeclaration */: if (ts.isAmbientModule(node) && (inAmbientModule || node.flags & 2 /* Ambient */ || ts.isDeclarationFile(file))) { var moduleName = node.name; // Ambient module declarations can be interpreted as augmentations for some existing external modules. @@ -40626,7 +41993,10 @@ var ts; } } } - function processSourceFile(fileName, isDefaultLib, refFile, refPos, refEnd) { + /** + * '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) { var diagnosticArgument; var diagnostic; if (hasExtension(fileName)) { @@ -40634,7 +42004,7 @@ var ts; 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, refFile, refPos, refEnd)) { + else if (!findSourceFile(fileName, ts.toPath(fileName, currentDirectory, getCanonicalFileName), isDefaultLib, isReference, refFile, refPos, refEnd)) { diagnostic = ts.Diagnostics.File_0_not_found; diagnosticArgument = [fileName]; } @@ -40644,13 +42014,13 @@ var ts; } } else { - var nonTsFile = options.allowNonTsExtensions && findSourceFile(fileName, ts.toPath(fileName, currentDirectory, getCanonicalFileName), isDefaultLib, refFile, refPos, refEnd); + var nonTsFile = options.allowNonTsExtensions && findSourceFile(fileName, ts.toPath(fileName, currentDirectory, getCanonicalFileName), isDefaultLib, isReference, 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, refFile, refPos, refEnd); })) { + else if (!ts.forEach(supportedExtensions, function (extension) { return findSourceFile(fileName + extension, ts.toPath(fileName + extension, currentDirectory, getCanonicalFileName), isDefaultLib, isReference, refFile, refPos, refEnd); })) { diagnostic = ts.Diagnostics.File_0_not_found; fileName += ".ts"; diagnosticArgument = [fileName]; @@ -40675,7 +42045,7 @@ var ts; } } // Get source file from normalized fileName - function findSourceFile(fileName, path, isDefaultLib, refFile, refPos, refEnd) { + function findSourceFile(fileName, path, isDefaultLib, isReference, 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 @@ -40683,6 +42053,9 @@ var ts; if (file_1 && options.forceConsistentCasingInFileNames && ts.getNormalizedAbsolutePath(file_1.fileName, currentDirectory) !== ts.getNormalizedAbsolutePath(fileName, currentDirectory)) { reportFileNamesDifferOnlyInCasingError(fileName, file_1.fileName, refFile, refPos, refEnd); } + if (file_1) { + file_1.wasReferenced = file_1.wasReferenced || isReference; + } return file_1; } // We haven't looked for this file, do so now and cache result @@ -40696,6 +42069,7 @@ var ts; }); filesByName.set(path, file); if (file) { + file.wasReferenced = file.wasReferenced || isReference; file.path = path; if (host.useCaseSensitiveFileNames()) { // for case-sensitive file systems check if we've already seen some file with similar filename ignoring case @@ -40710,7 +42084,8 @@ var ts; skipDefaultLib = skipDefaultLib || file.hasNoDefaultLib; var basePath = ts.getDirectoryPath(fileName); if (!options.noResolve) { - processReferencedFiles(file, basePath); + processReferencedFiles(file, basePath, isDefaultLib); + processTypeReferenceDirectives(file); } // always process imported modules to record module name resolutions processImportedModules(file, basePath); @@ -40723,12 +42098,71 @@ var ts; } return file; } - function processReferencedFiles(file, basePath) { + function processReferencedFiles(file, basePath, isDefaultLib) { ts.forEach(file.referencedFiles, function (ref) { var referencedFileName = resolveTripleslashReference(ref.fileName, file.fileName); - processSourceFile(referencedFileName, /*isDefaultLib*/ false, file, ref.pos, ref.end); + processSourceFile(referencedFileName, isDefaultLib, /*isReference*/ true, file, ref.pos, ref.end); }); } + function processTypeReferenceDirectives(file) { + var typeDirectives = ts.map(file.typeReferenceDirectives, function (l) { return l.fileName; }); + var resolutions = resolveTypeReferenceDirectiveNamesWorker(typeDirectives, file.fileName); + for (var i = 0; i < typeDirectives.length; i++) { + var ref = file.typeReferenceDirectives[i]; + var resolvedTypeReferenceDirective = resolutions[i]; + // store resolved type directive on the file + ts.setResolvedTypeReferenceDirective(file, ref.fileName, resolvedTypeReferenceDirective); + processTypeReferenceDirective(ref.fileName, resolvedTypeReferenceDirective, file, ref.pos, ref.end); + } + } + function processTypeReferenceDirective(typeReferenceDirective, resolvedTypeReferenceDirective, refFile, refPos, refEnd) { + // If we already found this library as a primary reference - nothing to do + var previousResolution = resolvedTypeReferenceDirectives[typeReferenceDirective]; + if (previousResolution && previousResolution.primary) { + return; + } + var saveResolution = true; + if (resolvedTypeReferenceDirective) { + if (resolvedTypeReferenceDirective.primary) { + // resolved from the primary path + processSourceFile(resolvedTypeReferenceDirective.resolvedFileName, /*isDefaultLib*/ false, /*isReference*/ true, 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_library_definitions_for_0_found_at_1_and_2_Copy_the_correct_file_to_the_typings_folder_to_resolve_this_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); + } + } + } + else { + fileProcessingDiagnostics.add(createDiagnostic(refFile, refPos, refEnd, ts.Diagnostics.Cannot_find_name_0, typeReferenceDirective)); + } + if (saveResolution) { + resolvedTypeReferenceDirectives[typeReferenceDirective] = resolvedTypeReferenceDirective; + } + } + function createDiagnostic(refFile, refPos, refEnd, message) { + var args = []; + for (var _i = 4; _i < arguments.length; _i++) { + args[_i - 4] = arguments[_i]; + } + if (refFile === undefined || refPos === undefined || refEnd === undefined) { + return ts.createCompilerDiagnostic.apply(void 0, [message].concat(args)); + } + else { + return ts.createFileDiagnostic.apply(void 0, [refFile, refPos, refEnd - refPos, message].concat(args)); + } + } function getCanonicalFileName(fileName) { return host.getCanonicalFileName(fileName); } @@ -40749,7 +42183,7 @@ var ts; !options.noResolve && i < file.imports.length; if (shouldAddFile) { - var importedFile = findSourceFile(resolution.resolvedFileName, ts.toPath(resolution.resolvedFileName, currentDirectory, getCanonicalFileName), /*isDefaultLib*/ false, file, ts.skipTrivia(file.text, file.imports[i].pos), file.imports[i].end); + var importedFile = findSourceFile(resolution.resolvedFileName, ts.toPath(resolution.resolvedFileName, currentDirectory, getCanonicalFileName), /*isDefaultLib*/ false, /*isReference*/ false, file, ts.skipTrivia(file.text, file.imports[i].pos), file.imports[i].end); if (importedFile && resolution.isExternalLibraryImport) { // Since currently irrespective of allowJs, we only look for supportedTypeScript extension external module files, // this check is ok. Otherwise this would be never true for javascript file @@ -40772,50 +42206,21 @@ var ts; return; } function computeCommonSourceDirectory(sourceFiles) { - var commonPathComponents; - var failed = ts.forEach(files, function (sourceFile) { - // Each file contributes into common source file path - if (ts.isDeclarationFile(sourceFile)) { - return; + var fileNames = []; + for (var _i = 0, sourceFiles_2 = sourceFiles; _i < sourceFiles_2.length; _i++) { + var file = sourceFiles_2[_i]; + if (!file.isDeclarationFile) { + fileNames.push(file.fileName); } - var sourcePathComponents = ts.getNormalizedPathComponents(sourceFile.fileName, currentDirectory); - sourcePathComponents.pop(); // The base file name is not part of the common directory path - if (!commonPathComponents) { - // first file - commonPathComponents = sourcePathComponents; - return; - } - for (var i = 0, n = Math.min(commonPathComponents.length, sourcePathComponents.length); i < n; i++) { - if (getCanonicalFileName(commonPathComponents[i]) !== getCanonicalFileName(sourcePathComponents[i])) { - if (i === 0) { - // Failed to find any common path component - return true; - } - // New common path found that is 0 -> i-1 - commonPathComponents.length = i; - break; - } - } - // If the sourcePathComponents was shorter than the commonPathComponents, truncate to the sourcePathComponents - if (sourcePathComponents.length < commonPathComponents.length) { - commonPathComponents.length = sourcePathComponents.length; - } - }); - // A common path can not be found when paths span multiple drives on windows, for example - if (failed) { - return ""; } - if (!commonPathComponents) { - return currentDirectory; - } - return ts.getNormalizedPathFromPathComponents(commonPathComponents); + return computeCommonSourceDirectoryOfFilenames(fileNames, currentDirectory, getCanonicalFileName); } function checkSourceFilesBelongToPath(sourceFiles, rootDirectory) { var allFilesBelongToPath = true; if (sourceFiles) { var absoluteRootDirectoryPath = host.getCanonicalFileName(ts.getNormalizedAbsolutePath(rootDirectory, currentDirectory)); - for (var _i = 0, sourceFiles_2 = sourceFiles; _i < sourceFiles_2.length; _i++) { - var sourceFile = sourceFiles_2[_i]; + for (var _i = 0, sourceFiles_3 = sourceFiles; _i < sourceFiles_3.length; _i++) { + var sourceFile = sourceFiles_3[_i]; if (!ts.isDeclarationFile(sourceFile)) { var absoluteSourceFilePath = host.getCanonicalFileName(ts.getNormalizedAbsolutePath(sourceFile.fileName, currentDirectory)); if (absoluteSourceFilePath.indexOf(absoluteRootDirectoryPath) !== 0) { @@ -40889,6 +42294,17 @@ var ts; programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "sourceRoot", "sourceMap")); } } + if (options.declarationDir) { + if (!options.declaration) { + programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "declarationDir", "declaration")); + } + if (options.out || options.outFile) { + programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "declarationDir", options.out ? "out" : "outFile")); + } + } + if (options.lib && options.noLib) { + programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "lib", "noLib")); + } var languageVersion = options.target || 0 /* ES3 */; var outFile = options.outFile || options.out; var firstExternalModuleSourceFile = ts.forEach(files, function (f) { return ts.isExternalModule(f) ? f : undefined; }); @@ -40927,21 +42343,7 @@ var ts; programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Cannot_find_the_common_subdirectory_path_for_the_input_files)); } } - if (options.noEmit) { - if (options.out) { - programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "noEmit", "out")); - } - if (options.outFile) { - programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "noEmit", "outFile")); - } - if (options.outDir) { - programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "noEmit", "outDir")); - } - if (options.declaration) { - programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "noEmit", "declaration")); - } - } - else if (options.allowJs && options.declaration) { + if (!options.noEmit && options.allowJs && options.declaration) { programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "allowJs", "declaration")); } if (options.emitDecoratorMetadata && @@ -41005,6 +42407,12 @@ var ts; type: "boolean", description: ts.Diagnostics.Generates_corresponding_d_ts_file }, + { + name: "declarationDir", + type: "string", + isFilePath: true, + paramType: ts.Diagnostics.DIRECTORY + }, { name: "diagnostics", type: "boolean" @@ -41039,13 +42447,12 @@ var ts; "react": 2 /* React */ }, paramType: ts.Diagnostics.KIND, - description: ts.Diagnostics.Specify_JSX_code_generation_Colon_preserve_or_react, - error: ts.Diagnostics.Argument_for_jsx_must_be_preserve_or_react + description: ts.Diagnostics.Specify_JSX_code_generation_Colon_preserve_or_react }, { name: "reactNamespace", type: "string", - description: ts.Diagnostics.Specifies_the_object_invoked_for_createElement_and_spread_when_targeting_react_JSX_emit + description: ts.Diagnostics.Specify_the_object_invoked_for_createElement_and_spread_when_targeting_react_JSX_emit }, { name: "listFiles", @@ -41059,7 +42466,7 @@ var ts; name: "mapRoot", type: "string", isFilePath: true, - description: ts.Diagnostics.Specifies_the_location_where_debugger_should_locate_map_files_instead_of_generated_locations, + description: ts.Diagnostics.Specify_the_location_where_debugger_should_locate_map_files_instead_of_generated_locations, paramType: ts.Diagnostics.LOCATION }, { @@ -41075,8 +42482,7 @@ var ts; "es2015": ts.ModuleKind.ES2015 }, description: ts.Diagnostics.Specify_module_code_generation_Colon_commonjs_amd_system_umd_or_es2015, - paramType: ts.Diagnostics.KIND, - error: ts.Diagnostics.Argument_for_module_option_must_be_commonjs_amd_system_umd_es2015_or_none + paramType: ts.Diagnostics.KIND }, { name: "newLine", @@ -41084,9 +42490,8 @@ var ts; "crlf": 0 /* CarriageReturnLineFeed */, "lf": 1 /* LineFeed */ }, - description: ts.Diagnostics.Specifies_the_end_of_line_sequence_to_be_used_when_emitting_files_Colon_CRLF_dos_or_LF_unix, - paramType: ts.Diagnostics.NEWLINE, - error: ts.Diagnostics.Argument_for_newLine_option_must_be_CRLF_or_LF + 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 }, { name: "noEmit", @@ -41107,6 +42512,11 @@ var ts; type: "boolean", 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 + }, { name: "noLib", type: "boolean" @@ -41147,7 +42557,6 @@ var ts; }, { name: "pretty", - paramType: ts.Diagnostics.KIND, description: ts.Diagnostics.Stylize_errors_and_messages_using_color_and_context_experimental, type: "boolean" }, @@ -41168,8 +42577,8 @@ var ts; name: "rootDir", type: "string", isFilePath: true, - description: ts.Diagnostics.Specifies_the_root_directory_of_input_files_Use_to_control_the_output_directory_structure_with_outDir, - paramType: ts.Diagnostics.LOCATION + paramType: ts.Diagnostics.LOCATION, + description: ts.Diagnostics.Specify_the_root_directory_of_input_files_Use_to_control_the_output_directory_structure_with_outDir }, { name: "isolatedModules", @@ -41184,7 +42593,7 @@ var ts; name: "sourceRoot", type: "string", isFilePath: true, - description: ts.Diagnostics.Specifies_the_location_where_debugger_should_locate_TypeScript_files_instead_of_source_locations, + description: ts.Diagnostics.Specify_the_location_where_debugger_should_locate_TypeScript_files_instead_of_source_locations, paramType: ts.Diagnostics.LOCATION }, { @@ -41213,9 +42622,8 @@ var ts; "es6": 2 /* ES6 */, "es2015": 2 /* ES2015 */ }, - description: ts.Diagnostics.Specify_ECMAScript_target_version_Colon_ES3_default_ES5_or_ES2015_experimental, - paramType: ts.Diagnostics.VERSION, - error: ts.Diagnostics.Argument_for_target_option_must_be_ES3_ES5_or_ES2015 + description: ts.Diagnostics.Specify_ECMAScript_target_version_Colon_ES3_default_ES5_or_ES2015, + paramType: ts.Diagnostics.VERSION }, { name: "version", @@ -41246,8 +42654,7 @@ var ts; "node": ts.ModuleResolutionKind.NodeJs, "classic": ts.ModuleResolutionKind.Classic }, - description: ts.Diagnostics.Specifies_module_resolution_strategy_Colon_node_Node_js_or_classic_TypeScript_pre_1_6, - error: ts.Diagnostics.Argument_for_moduleResolution_option_must_be_node_or_classic + description: ts.Diagnostics.Specify_module_resolution_strategy_Colon_node_Node_js_or_classic_TypeScript_pre_1_6 }, { name: "allowUnusedLabels", @@ -41291,14 +42698,41 @@ var ts; // this option can only be specified in tsconfig.json // use type = object to copy the value as-is name: "rootDirs", - type: "object", + type: "list", isTSConfigOnly: true, - isFilePath: true + element: { + name: "rootDirs", + type: "string", + isFilePath: true + } }, { - name: "traceModuleResolution", + name: "typesSearchPaths", + type: "list", + isTSConfigOnly: true, + element: { + name: "typesSearchPaths", + type: "string", + isFilePath: true + } + }, + { + name: "typesRoot", + type: "string" + }, + { + name: "types", + type: "list", + element: { + name: "types", + type: "string" + }, + description: ts.Diagnostics.Type_declaration_files_to_be_included_in_compilation + }, + { + name: "traceResolution", type: "boolean", - description: ts.Diagnostics.Enable_tracing_of_the_module_resolution_process + description: ts.Diagnostics.Enable_tracing_of_the_name_resolution_process }, { name: "allowJs", @@ -41314,6 +42748,69 @@ var ts; name: "noImplicitUseStrict", type: "boolean", description: ts.Diagnostics.Do_not_emit_use_strict_directives_in_module_output + }, + { + name: "listEmittedFiles", + type: "boolean" + }, + { + name: "lib", + type: "list", + element: { + name: "lib", + type: { + // JavaScript only + "es5": "lib.es5.d.ts", + "es6": "lib.es2015.d.ts", + "es2015": "lib.es2015.d.ts", + "es7": "lib.es2016.d.ts", + "es2016": "lib.es2016.d.ts", + // Host only + "dom": "lib.dom.d.ts", + "webworker": "lib.webworker.d.ts", + "scripthost": "lib.scripthost.d.ts", + // ES2015 Or ESNext By-feature options + "es2015.core": "lib.es2015.core.d.ts", + "es2015.collection": "lib.es2015.collection.d.ts", + "es2015.generator": "lib.es2015.generator.d.ts", + "es2015.iterable": "lib.es2015.iterable.d.ts", + "es2015.promise": "lib.es2015.promise.d.ts", + "es2015.proxy": "lib.es2015.proxy.d.ts", + "es2015.reflect": "lib.es2015.reflect.d.ts", + "es2015.symbol": "lib.es2015.symbol.d.ts", + "es2015.symbol.wellknown": "lib.es2015.symbol.wellknown.d.ts", + "es2016.array.include": "lib.es2016.array.include.d.ts" + } + }, + description: ts.Diagnostics.Specify_library_files_to_be_included_in_the_compilation_Colon + }, + { + name: "strictNullChecks", + type: "boolean", + description: ts.Diagnostics.Enable_strict_null_checks + } + ]; + /* @internal */ + ts.typingOptionDeclarations = [ + { + name: "enableAutoDiscovery", + type: "boolean" + }, + { + name: "include", + type: "list", + element: { + name: "include", + type: "string" + } + }, + { + name: "exclude", + type: "list", + element: { + name: "exclude", + type: "string" + } } ]; var optionNameMapCache; @@ -41334,6 +42831,41 @@ var ts; return optionNameMapCache; } ts.getOptionNameMap = getOptionNameMap; + /* @internal */ + function createCompilerDiagnosticForInvalidCustomType(opt) { + var namesOfType = []; + ts.forEachKey(opt.type, function (key) { + namesOfType.push(" '" + key + "'"); + }); + 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 = (value || "").trim().toLowerCase(); + var map = opt.type; + if (ts.hasProperty(map, key)) { + return map[key]; + } + else { + errors.push(createCompilerDiagnosticForInvalidCustomType(opt)); + } + } + ts.parseCustomTypeOption = parseCustomTypeOption; + /* @internal */ + function parseListTypeOption(opt, value, errors) { + var values = (value || "").trim().split(","); + switch (opt.element.type) { + case "number": + return ts.map(values, parseInt); + case "string": + return ts.map(values, function (v) { return v || ""; }); + default: + return ts.filter(ts.map(values, function (v) { return parseCustomTypeOption(opt.element, v, errors); }), function (v) { return !!v; }); + } + } + ts.parseListTypeOption = parseListTypeOption; + /* @internal */ function parseCommandLine(commandLine, readFile) { var options = {}; var fileNames = []; @@ -41381,17 +42913,15 @@ var ts; options[opt.name] = args[i] || ""; i++; break; + case "list": + options[opt.name] = parseListTypeOption(opt, args[i], errors); + i++; + break; // If not a primitive, the possible types are specified in what is effectively a map of options. default: - var map_1 = opt.type; - var key = (args[i] || "").toLowerCase(); + options[opt.name] = parseCustomTypeOption(opt, args[i], errors); i++; - if (ts.hasProperty(map_1, key)) { - options[opt.name] = map_1[key]; - } - else { - errors.push(ts.createCompilerDiagnostic(opt.error)); - } + break; } } } @@ -41503,17 +43033,22 @@ var ts; */ function parseJsonConfigFileContent(json, host, basePath, existingOptions, configFileName) { if (existingOptions === void 0) { existingOptions = {}; } - var _a = convertCompilerOptionsFromJson(json["compilerOptions"], basePath, configFileName), optionsFromJsonConfigFile = _a.options, errors = _a.errors; - var options = ts.extend(existingOptions, optionsFromJsonConfigFile); + var errors = []; + var compilerOptions = convertCompilerOptionsFromJsonWorker(json["compilerOptions"], basePath, errors, configFileName); + var options = ts.extend(existingOptions, compilerOptions); + var typingOptions = convertTypingOptionsFromJsonWorker(json["typingOptions"], basePath, errors, configFileName); + options.configFilePath = configFileName; + var fileNames = getFileNames(errors); return { options: options, - fileNames: getFileNames(), + fileNames: fileNames, + typingOptions: typingOptions, errors: errors }; - function getFileNames() { + function getFileNames(errors) { var fileNames = []; if (ts.hasProperty(json, "files")) { - if (json["files"] instanceof Array) { + if (ts.isArray(json["files"])) { fileNames = ts.map(json["files"], function (s) { return ts.combinePaths(basePath, s); }); } else { @@ -41523,7 +43058,7 @@ var ts; else { var filesSeen = {}; var exclude = []; - if (json["exclude"] instanceof Array) { + if (ts.isArray(json["exclude"])) { exclude = json["exclude"]; } else { @@ -41565,86 +43100,88 @@ var ts; } } } + if (ts.hasProperty(json, "excludes") && !ts.hasProperty(json, "exclude")) { + errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Unknown_option_excludes_Did_you_mean_exclude)); + } return fileNames; } } ts.parseJsonConfigFileContent = parseJsonConfigFileContent; function convertCompilerOptionsFromJson(jsonOptions, basePath, configFileName) { - var options = {}; var errors = []; - if (configFileName && ts.getBaseFileName(configFileName) === "jsconfig.json") { - options.allowJs = true; - } - if (!jsonOptions) { - return { options: options, errors: errors }; - } - var optionNameMap = ts.arrayToMap(ts.optionDeclarations, function (opt) { return opt.name; }); - for (var id in jsonOptions) { - if (ts.hasProperty(optionNameMap, id)) { - var opt = optionNameMap[id]; - var optType = opt.type; - var value = jsonOptions[id]; - var expectedType = typeof optType === "string" ? optType : "string"; - if (typeof value === expectedType) { - if (typeof optType !== "string") { - var key = value.toLowerCase(); - if (ts.hasProperty(optType, key)) { - value = optType[key]; - } - else { - errors.push(ts.createCompilerDiagnostic(opt.error)); - value = 0; - } - } - if (opt.isFilePath) { - switch (typeof value) { - case "string": - value = ts.normalizePath(ts.combinePaths(basePath, value)); - break; - case "object": - // "object" options with 'isFilePath' = true expected to be string arrays - var paths = []; - var invalidOptionType = false; - if (!ts.isArray(value)) { - invalidOptionType = true; - } - else { - for (var _i = 0, _a = value; _i < _a.length; _i++) { - var element = _a[_i]; - if (typeof element === "string") { - paths.push(ts.normalizePath(ts.combinePaths(basePath, element))); - } - else { - invalidOptionType = true; - break; - } - } - } - if (invalidOptionType) { - errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_should_have_array_of_strings_as_a_value, opt.name)); - } - else { - value = paths; - } - break; - } - if (value === "") { - value = "."; - } - } - options[opt.name] = value; - } - else { - errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Compiler_option_0_requires_a_value_of_type_1, id, expectedType)); - } - } - else { - errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Unknown_compiler_option_0, id)); - } - } + var options = convertCompilerOptionsFromJsonWorker(jsonOptions, basePath, errors, configFileName); return { options: options, errors: errors }; } ts.convertCompilerOptionsFromJson = convertCompilerOptionsFromJson; + function convertTypingOptionsFromJson(jsonOptions, basePath, configFileName) { + var errors = []; + var options = convertTypingOptionsFromJsonWorker(jsonOptions, basePath, errors, configFileName); + return { options: options, errors: errors }; + } + ts.convertTypingOptionsFromJson = convertTypingOptionsFromJson; + function convertCompilerOptionsFromJsonWorker(jsonOptions, basePath, errors, configFileName) { + var options = ts.getBaseFileName(configFileName) === "jsconfig.json" ? { allowJs: 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); + return options; + } + function convertOptionsFromJson(optionDeclarations, jsonOptions, basePath, defaultOptions, diagnosticMessage, errors) { + if (!jsonOptions) { + return; + } + var optionNameMap = ts.arrayToMap(optionDeclarations, function (opt) { return opt.name; }); + for (var id in jsonOptions) { + if (ts.hasProperty(optionNameMap, id)) { + var opt = optionNameMap[id]; + defaultOptions[opt.name] = convertJsonOption(opt, jsonOptions[id], basePath, errors); + } + else { + errors.push(ts.createCompilerDiagnostic(diagnosticMessage, id)); + } + } + } + function convertJsonOption(opt, value, basePath, errors) { + var optType = opt.type; + var expectedType = typeof optType === "string" ? optType : "string"; + if (optType === "list" && ts.isArray(value)) { + return convertJsonOptionOfListType(opt, value, basePath, errors); + } + else if (typeof value === expectedType) { + if (typeof optType !== "string") { + return convertJsonOptionOfCustomType(opt, value, errors); + } + else { + if (opt.isFilePath) { + value = ts.normalizePath(ts.combinePaths(basePath, value)); + if (value === "") { + value = "."; + } + } + } + return value; + } + else { + errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Compiler_option_0_requires_a_value_of_type_1, opt.name, expectedType)); + } + } + function convertJsonOptionOfCustomType(opt, value, errors) { + var key = value.toLowerCase(); + if (ts.hasProperty(opt.type, key)) { + return opt.type[key]; + } + else { + errors.push(createCompilerDiagnosticForInvalidCustomType(opt)); + } + } + function convertJsonOptionOfListType(option, values, basePath, errors) { + return ts.filter(ts.map(values, function (v) { return convertJsonOption(option.element, v, basePath, errors); }), function (v) { return !!v; }); + } })(ts || (ts = {})); /* @internal */ var ts; @@ -41718,7 +43255,7 @@ var ts; } } function autoCollapse(node) { - return ts.isFunctionBlock(node) && node.parent.kind !== 178 /* ArrowFunction */; + return ts.isFunctionBlock(node) && node.parent.kind !== 179 /* ArrowFunction */; } var depth = 0; var maxDepth = 20; @@ -41730,30 +43267,30 @@ var ts; addOutliningForLeadingCommentsForNode(n); } switch (n.kind) { - case 196 /* Block */: + case 198 /* Block */: if (!ts.isFunctionBlock(n)) { - var parent_9 = n.parent; + var parent_11 = 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 collaps the block, but consider its hint span + // If the latter, we want to collapse the block, but consider its hint span // to be the entire span of the parent. - if (parent_9.kind === 201 /* DoStatement */ || - parent_9.kind === 204 /* ForInStatement */ || - parent_9.kind === 205 /* ForOfStatement */ || - parent_9.kind === 203 /* ForStatement */ || - parent_9.kind === 200 /* IfStatement */ || - parent_9.kind === 202 /* WhileStatement */ || - parent_9.kind === 209 /* WithStatement */ || - parent_9.kind === 248 /* CatchClause */) { - addOutliningSpan(parent_9, openBrace, closeBrace, autoCollapse(n)); + if (parent_11.kind === 203 /* DoStatement */ || + parent_11.kind === 206 /* ForInStatement */ || + parent_11.kind === 207 /* ForOfStatement */ || + parent_11.kind === 205 /* ForStatement */ || + parent_11.kind === 202 /* IfStatement */ || + parent_11.kind === 204 /* WhileStatement */ || + parent_11.kind === 211 /* WithStatement */ || + parent_11.kind === 251 /* CatchClause */) { + addOutliningSpan(parent_11, openBrace, closeBrace, autoCollapse(n)); break; } - if (parent_9.kind === 213 /* TryStatement */) { + if (parent_11.kind === 215 /* TryStatement */) { // Could be the try-block, or the finally-block. - var tryStatement = parent_9; + var tryStatement = parent_11; if (tryStatement.tryBlock === n) { - addOutliningSpan(parent_9, openBrace, closeBrace, autoCollapse(n)); + addOutliningSpan(parent_11, openBrace, closeBrace, autoCollapse(n)); break; } else if (tryStatement.finallyBlock === n) { @@ -41776,23 +43313,23 @@ var ts; break; } // Fallthrough. - case 223 /* ModuleBlock */: { + case 225 /* ModuleBlock */: { var openBrace = ts.findChildOfKind(n, 15 /* OpenBraceToken */, sourceFile); var closeBrace = ts.findChildOfKind(n, 16 /* CloseBraceToken */, sourceFile); addOutliningSpan(n.parent, openBrace, closeBrace, autoCollapse(n)); break; } - case 218 /* ClassDeclaration */: - case 219 /* InterfaceDeclaration */: - case 221 /* EnumDeclaration */: - case 169 /* ObjectLiteralExpression */: - case 224 /* CaseBlock */: { + case 220 /* ClassDeclaration */: + case 221 /* InterfaceDeclaration */: + case 223 /* EnumDeclaration */: + case 170 /* ObjectLiteralExpression */: + case 226 /* 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 168 /* ArrayLiteralExpression */: + case 169 /* ArrayLiteralExpression */: var openBracket = ts.findChildOfKind(n, 19 /* OpenBracketToken */, sourceFile); var closeBracket = ts.findChildOfKind(n, 20 /* CloseBracketToken */, sourceFile); addOutliningSpan(n, openBracket, closeBracket, autoCollapse(n)); @@ -41822,12 +43359,12 @@ var ts; ts.forEach(program.getSourceFiles(), function (sourceFile) { cancellationToken.throwIfCancellationRequested(); var nameToDeclarations = sourceFile.getNamedDeclarations(); - for (var name_31 in nameToDeclarations) { - var declarations = ts.getProperty(nameToDeclarations, name_31); + for (var name_34 in nameToDeclarations) { + var declarations = ts.getProperty(nameToDeclarations, name_34); 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_31); + var matches = patternMatcher.getMatchesForLastSegmentOfPattern(name_34); if (!matches) { continue; } @@ -41840,14 +43377,14 @@ var ts; if (!containers) { return undefined; } - matches = patternMatcher.getMatches(containers, name_31); + matches = patternMatcher.getMatches(containers, name_34); if (!matches) { continue; } } var fileName = sourceFile.fileName; var matchKind = bestMatchKind(matches); - rawItems.push({ name: name_31, fileName: fileName, matchKind: matchKind, isCaseSensitive: allMatchesAreCaseSensitive(matches), declaration: declaration }); + rawItems.push({ name: name_34, fileName: fileName, matchKind: matchKind, isCaseSensitive: allMatchesAreCaseSensitive(matches), declaration: declaration }); } } } @@ -41885,7 +43422,7 @@ var ts; if (text !== undefined) { containers.unshift(text); } - else if (declaration.name.kind === 138 /* ComputedPropertyName */) { + else if (declaration.name.kind === 139 /* ComputedPropertyName */) { return tryAddComputedPropertyName(declaration.name.expression, containers, /*includeLastPortion*/ true); } else { @@ -41906,7 +43443,7 @@ var ts; } return true; } - if (expression.kind === 170 /* PropertyAccessExpression */) { + if (expression.kind === 171 /* PropertyAccessExpression */) { var propertyAccess = expression; if (includeLastPortion) { containers.unshift(propertyAccess.name.text); @@ -41919,7 +43456,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 === 138 /* ComputedPropertyName */) { + if (declaration.name.kind === 139 /* ComputedPropertyName */) { if (!tryAddComputedPropertyName(declaration.name.expression, containers, /*includeLastPortion*/ false)) { return undefined; } @@ -41982,6 +43519,11 @@ var ts; var NavigationBar; (function (NavigationBar) { function getNavigationBarItems(sourceFile, compilerOptions) { + // TODO: Handle JS files differently in 'navbar' calls for now, but ideally we should unify + // the 'navbar' and 'navto' logic for TypeScript and JavaScript. + if (ts.isSourceFileJavaScript(sourceFile)) { + return getJsNavigationBarItems(sourceFile, compilerOptions); + } // If the source file has any child items, then it included in the tree // and takes lexical ownership of all other top-level items. var hasGlobalNode = false; @@ -41993,17 +43535,17 @@ var ts; var current = node.parent; while (current) { switch (current.kind) { - case 222 /* ModuleDeclaration */: + case 224 /* ModuleDeclaration */: // If we have a module declared as A.B.C, it is more "intuitive" // to say it only has a single layer of depth do { current = current.parent; - } while (current.kind === 222 /* ModuleDeclaration */); + } while (current.kind === 224 /* ModuleDeclaration */); // fall through - case 218 /* ClassDeclaration */: - case 221 /* EnumDeclaration */: - case 219 /* InterfaceDeclaration */: - case 217 /* FunctionDeclaration */: + case 220 /* ClassDeclaration */: + case 223 /* EnumDeclaration */: + case 221 /* InterfaceDeclaration */: + case 219 /* FunctionDeclaration */: indent++; } current = current.parent; @@ -42014,21 +43556,21 @@ var ts; var childNodes = []; function visit(node) { switch (node.kind) { - case 197 /* VariableStatement */: + case 199 /* VariableStatement */: ts.forEach(node.declarationList.declarations, visit); break; - case 165 /* ObjectBindingPattern */: - case 166 /* ArrayBindingPattern */: + case 166 /* ObjectBindingPattern */: + case 167 /* ArrayBindingPattern */: ts.forEach(node.elements, visit); break; - case 232 /* ExportDeclaration */: + case 235 /* 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 226 /* ImportDeclaration */: + case 229 /* ImportDeclaration */: var importClause = node.importClause; if (importClause) { // Handle default import case e.g.: @@ -42040,7 +43582,7 @@ var ts; // import * as NS from "mod"; // import {a, b as B} from "mod"; if (importClause.namedBindings) { - if (importClause.namedBindings.kind === 228 /* NamespaceImport */) { + if (importClause.namedBindings.kind === 231 /* NamespaceImport */) { childNodes.push(importClause.namedBindings); } else { @@ -42049,21 +43591,21 @@ var ts; } } break; - case 167 /* BindingElement */: - case 215 /* VariableDeclaration */: + case 168 /* BindingElement */: + case 217 /* VariableDeclaration */: if (ts.isBindingPattern(node.name)) { visit(node.name); break; } // Fall through - case 218 /* ClassDeclaration */: - case 221 /* EnumDeclaration */: - case 219 /* InterfaceDeclaration */: - case 222 /* ModuleDeclaration */: - case 217 /* FunctionDeclaration */: - case 225 /* ImportEqualsDeclaration */: - case 230 /* ImportSpecifier */: - case 234 /* ExportSpecifier */: + case 220 /* ClassDeclaration */: + case 223 /* EnumDeclaration */: + case 221 /* InterfaceDeclaration */: + case 224 /* ModuleDeclaration */: + case 219 /* FunctionDeclaration */: + case 228 /* ImportEqualsDeclaration */: + case 233 /* ImportSpecifier */: + case 237 /* ExportSpecifier */: childNodes.push(node); break; } @@ -42111,17 +43653,31 @@ var ts; for (var _i = 0, nodes_4 = nodes; _i < nodes_4.length; _i++) { var node = nodes_4[_i]; switch (node.kind) { - case 218 /* ClassDeclaration */: - case 221 /* EnumDeclaration */: - case 219 /* InterfaceDeclaration */: + case 220 /* ClassDeclaration */: + topLevelNodes.push(node); + for (var _a = 0, _b = node.members; _a < _b.length; _a++) { + var member = _b[_a]; + if (member.kind === 146 /* MethodDeclaration */ || member.kind === 147 /* Constructor */) { + if (member.body) { + // We do not include methods that does not have child functions in it, because of duplications. + if (hasNamedFunctionDeclarations(member.body.statements)) { + topLevelNodes.push(member); + } + addTopLevelNodes(member.body.statements, topLevelNodes); + } + } + } + break; + case 223 /* EnumDeclaration */: + case 221 /* InterfaceDeclaration */: topLevelNodes.push(node); break; - case 222 /* ModuleDeclaration */: + case 224 /* ModuleDeclaration */: var moduleDeclaration = node; topLevelNodes.push(node); addTopLevelNodes(getInnermostModule(moduleDeclaration).body.statements, topLevelNodes); break; - case 217 /* FunctionDeclaration */: + case 219 /* FunctionDeclaration */: var functionDeclaration = node; if (isTopLevelFunctionDeclaration(functionDeclaration)) { topLevelNodes.push(node); @@ -42131,20 +43687,36 @@ var ts; } } } + function hasNamedFunctionDeclarations(nodes) { + for (var _i = 0, nodes_5 = nodes; _i < nodes_5.length; _i++) { + var s = nodes_5[_i]; + if (s.kind === 219 /* FunctionDeclaration */ && !isEmpty(s.name.text)) { + return true; + } + } + return false; + } function isTopLevelFunctionDeclaration(functionDeclaration) { - if (functionDeclaration.kind === 217 /* FunctionDeclaration */) { - // A function declaration is 'top level' if it contains any function declarations - // within it. - if (functionDeclaration.body && functionDeclaration.body.kind === 196 /* Block */) { + if (functionDeclaration.kind === 219 /* FunctionDeclaration */) { + // A function declaration is 'top level' if it contains any function declarations + // within it. + if (functionDeclaration.body && functionDeclaration.body.kind === 198 /* Block */) { // Proper function declarations can only have identifier names - if (ts.forEach(functionDeclaration.body.statements, function (s) { return s.kind === 217 /* FunctionDeclaration */ && !isEmpty(s.name.text); })) { + if (hasNamedFunctionDeclarations(functionDeclaration.body.statements)) { return true; } - // Or if it is not parented by another function. i.e all functions - // at module scope are 'top level'. + // Or if it is not parented by another function. I.e all functions at module scope are 'top level'. if (!ts.isFunctionBlock(functionDeclaration.parent)) { return true; } + else { + // We have made sure that a grand parent node exists with 'isFunctionBlock()' above. + var grandParentKind = functionDeclaration.parent.parent.kind; + if (grandParentKind === 146 /* MethodDeclaration */ || + grandParentKind === 147 /* Constructor */) { + return true; + } + } } } return false; @@ -42152,8 +43724,8 @@ var ts; function getItemsWorker(nodes, createItem) { var items = []; var keyToItem = {}; - for (var _i = 0, nodes_5 = nodes; _i < nodes_5.length; _i++) { - var child = nodes_5[_i]; + for (var _i = 0, nodes_6 = nodes; _i < nodes_6.length; _i++) { + var child = nodes_6[_i]; var item = createItem(child); if (item !== undefined) { if (item.text.length > 0) { @@ -42197,7 +43769,7 @@ var ts; } function createChildItem(node) { switch (node.kind) { - case 140 /* Parameter */: + case 141 /* Parameter */: if (ts.isBindingPattern(node.name)) { break; } @@ -42205,36 +43777,36 @@ var ts; return undefined; } return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.memberVariableElement); - case 145 /* MethodDeclaration */: - case 144 /* MethodSignature */: + case 146 /* MethodDeclaration */: + case 145 /* MethodSignature */: return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.memberFunctionElement); - case 147 /* GetAccessor */: + case 148 /* GetAccessor */: return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.memberGetAccessorElement); - case 148 /* SetAccessor */: + case 149 /* SetAccessor */: return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.memberSetAccessorElement); - case 151 /* IndexSignature */: + case 152 /* IndexSignature */: return createItem(node, "[]", ts.ScriptElementKind.indexSignatureElement); - case 251 /* EnumMember */: + case 254 /* EnumMember */: return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.memberVariableElement); - case 149 /* CallSignature */: + case 150 /* CallSignature */: return createItem(node, "()", ts.ScriptElementKind.callSignatureElement); - case 150 /* ConstructSignature */: + case 151 /* ConstructSignature */: return createItem(node, "new()", ts.ScriptElementKind.constructSignatureElement); - case 143 /* PropertyDeclaration */: - case 142 /* PropertySignature */: + case 144 /* PropertyDeclaration */: + case 143 /* PropertySignature */: return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.memberVariableElement); - case 217 /* FunctionDeclaration */: + case 219 /* FunctionDeclaration */: return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.functionElement); - case 215 /* VariableDeclaration */: - case 167 /* BindingElement */: + case 217 /* VariableDeclaration */: + case 168 /* BindingElement */: var variableDeclarationNode = void 0; - var name_32; - if (node.kind === 167 /* BindingElement */) { - name_32 = node.name; + var name_35; + if (node.kind === 168 /* BindingElement */) { + name_35 = node.name; variableDeclarationNode = node; // binding elements are added only for variable declarations // bubble up to the containing variable declaration - while (variableDeclarationNode && variableDeclarationNode.kind !== 215 /* VariableDeclaration */) { + while (variableDeclarationNode && variableDeclarationNode.kind !== 217 /* VariableDeclaration */) { variableDeclarationNode = variableDeclarationNode.parent; } ts.Debug.assert(variableDeclarationNode !== undefined); @@ -42242,24 +43814,24 @@ var ts; else { ts.Debug.assert(!ts.isBindingPattern(node.name)); variableDeclarationNode = node; - name_32 = node.name; + name_35 = node.name; } if (ts.isConst(variableDeclarationNode)) { - return createItem(node, getTextOfNode(name_32), ts.ScriptElementKind.constElement); + return createItem(node, getTextOfNode(name_35), ts.ScriptElementKind.constElement); } else if (ts.isLet(variableDeclarationNode)) { - return createItem(node, getTextOfNode(name_32), ts.ScriptElementKind.letElement); + return createItem(node, getTextOfNode(name_35), ts.ScriptElementKind.letElement); } else { - return createItem(node, getTextOfNode(name_32), ts.ScriptElementKind.variableElement); + return createItem(node, getTextOfNode(name_35), ts.ScriptElementKind.variableElement); } - case 146 /* Constructor */: + case 147 /* Constructor */: return createItem(node, "constructor", ts.ScriptElementKind.constructorImplementationElement); - case 234 /* ExportSpecifier */: - case 230 /* ImportSpecifier */: - case 225 /* ImportEqualsDeclaration */: - case 227 /* ImportClause */: - case 228 /* NamespaceImport */: + case 237 /* ExportSpecifier */: + case 233 /* ImportSpecifier */: + case 228 /* ImportEqualsDeclaration */: + case 230 /* ImportClause */: + case 231 /* NamespaceImport */: return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.alias); } return undefined; @@ -42289,17 +43861,20 @@ var ts; } function createTopLevelItem(node) { switch (node.kind) { - case 252 /* SourceFile */: + case 255 /* SourceFile */: return createSourceFileItem(node); - case 218 /* ClassDeclaration */: + case 220 /* ClassDeclaration */: return createClassItem(node); - case 221 /* EnumDeclaration */: + case 146 /* MethodDeclaration */: + case 147 /* Constructor */: + return createMemberFunctionLikeItem(node); + case 223 /* EnumDeclaration */: return createEnumItem(node); - case 219 /* InterfaceDeclaration */: - return createIterfaceItem(node); - case 222 /* ModuleDeclaration */: + case 221 /* InterfaceDeclaration */: + return createInterfaceItem(node); + case 224 /* ModuleDeclaration */: return createModuleItem(node); - case 217 /* FunctionDeclaration */: + case 219 /* FunctionDeclaration */: return createFunctionItem(node); } return undefined; @@ -42311,7 +43886,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 === 222 /* ModuleDeclaration */) { + while (moduleDeclaration.body && moduleDeclaration.body.kind === 224 /* ModuleDeclaration */) { moduleDeclaration = moduleDeclaration.body; result.push(moduleDeclaration.name.text); } @@ -42323,12 +43898,29 @@ var ts; return getNavigationBarItem(moduleName, ts.ScriptElementKind.moduleElement, ts.getNodeModifiers(node), [getNodeSpan(node)], childItems, getIndent(node)); } function createFunctionItem(node) { - if (node.body && node.body.kind === 196 /* Block */) { + if (node.body && node.body.kind === 198 /* Block */) { var childItems = getItemsWorker(sortNodes(node.body.statements), createChildItem); return getNavigationBarItem(!node.name ? "default" : node.name.text, ts.ScriptElementKind.functionElement, ts.getNodeModifiers(node), [getNodeSpan(node)], childItems, getIndent(node)); } return undefined; } + function createMemberFunctionLikeItem(node) { + if (node.body && node.body.kind === 198 /* Block */) { + var childItems = getItemsWorker(sortNodes(node.body.statements), createChildItem); + var scriptElementKind = void 0; + var memberFunctionName = void 0; + if (node.kind === 146 /* MethodDeclaration */) { + memberFunctionName = ts.getPropertyNameForPropertyNameNode(node.name); + scriptElementKind = ts.ScriptElementKind.memberFunctionElement; + } + else { + memberFunctionName = "constructor"; + scriptElementKind = ts.ScriptElementKind.constructorImplementationElement; + } + return getNavigationBarItem(memberFunctionName, scriptElementKind, ts.getNodeModifiers(node), [getNodeSpan(node)], childItems, getIndent(node)); + } + return undefined; + } function createSourceFileItem(node) { var childItems = getItemsWorker(getChildNodes(node.statements), createChildItem); if (childItems === undefined || childItems.length === 0) { @@ -42344,7 +43936,7 @@ var ts; var childItems; if (node.members) { var constructor = ts.forEach(node.members, function (member) { - return member.kind === 146 /* Constructor */ && member; + return member.kind === 147 /* Constructor */ && member; }); // Add the constructor parameters in as children of the class (for property parameters). // Note that *all non-binding pattern named* parameters will be added to the nodes array, but parameters that @@ -42362,13 +43954,13 @@ var ts; var childItems = getItemsWorker(sortNodes(removeComputedProperties(node)), createChildItem); return getNavigationBarItem(node.name.text, ts.ScriptElementKind.enumElement, ts.getNodeModifiers(node), [getNodeSpan(node)], childItems, getIndent(node)); } - function createIterfaceItem(node) { + function createInterfaceItem(node) { var childItems = getItemsWorker(sortNodes(removeDynamicallyNamedProperties(node)), createChildItem); return getNavigationBarItem(node.name.text, ts.ScriptElementKind.interfaceElement, ts.getNodeModifiers(node), [getNodeSpan(node)], childItems, getIndent(node)); } } function removeComputedProperties(node) { - return ts.filter(node.members, function (member) { return member.name === undefined || member.name.kind !== 138 /* ComputedPropertyName */; }); + return ts.filter(node.members, function (member) { return member.name === undefined || member.name.kind !== 139 /* ComputedPropertyName */; }); } /** * Like removeComputedProperties, but retains the properties with well known symbol names @@ -42377,13 +43969,13 @@ var ts; return ts.filter(node.members, function (member) { return !ts.hasDynamicName(member); }); } function getInnermostModule(node) { - while (node.body.kind === 222 /* ModuleDeclaration */) { + while (node.body.kind === 224 /* ModuleDeclaration */) { node = node.body; } return node; } function getNodeSpan(node) { - return node.kind === 252 /* SourceFile */ + return node.kind === 255 /* SourceFile */ ? ts.createTextSpanFromBounds(node.getFullStart(), node.getEnd()) : ts.createTextSpanFromBounds(node.getStart(), node.getEnd()); } @@ -42392,6 +43984,188 @@ var ts; } } NavigationBar.getNavigationBarItems = getNavigationBarItems; + function getJsNavigationBarItems(sourceFile, compilerOptions) { + var anonFnText = ""; + var anonClassText = ""; + var indent = 0; + var rootName = ts.isExternalModule(sourceFile) ? + "\"" + ts.escapeString(ts.getBaseFileName(ts.removeFileExtension(ts.normalizePath(sourceFile.fileName)))) + "\"" + : ""; + var sourceFileItem = getNavBarItem(rootName, ts.ScriptElementKind.moduleElement, [getNodeSpan(sourceFile)]); + var topItem = sourceFileItem; + // Walk the whole file, because we want to also find function expressions - which may be in variable initializer, + // call arguments, expressions, etc... + ts.forEachChild(sourceFile, visitNode); + function visitNode(node) { + var newItem = createNavBarItem(node); + if (newItem) { + topItem.childItems.push(newItem); + } + // Add a level if traversing into a container + if (newItem && (ts.isFunctionLike(node) || ts.isClassLike(node))) { + var lastTop = topItem; + indent++; + topItem = newItem; + ts.forEachChild(node, visitNode); + topItem = lastTop; + indent--; + // If the last item added was an anonymous function expression, and it had no children, discard it. + if (newItem && newItem.text === anonFnText && newItem.childItems.length === 0) { + topItem.childItems.pop(); + } + } + else { + ts.forEachChild(node, visitNode); + } + } + function createNavBarItem(node) { + switch (node.kind) { + case 217 /* VariableDeclaration */: + // Only add to the navbar if at the top-level of the file + // Note: "const" and "let" are also SyntaxKind.VariableDeclarations + if (node.parent /*VariableDeclarationList*/.parent /*VariableStatement*/ + .parent /*SourceFile*/.kind !== 255 /* SourceFile */) { + return undefined; + } + // If it is initialized with a function expression, handle it when we reach the function expression node + var varDecl = node; + if (varDecl.initializer && (varDecl.initializer.kind === 178 /* FunctionExpression */ || + varDecl.initializer.kind === 179 /* ArrowFunction */ || + varDecl.initializer.kind === 191 /* ClassExpression */)) { + return undefined; + } + // Fall through + case 219 /* FunctionDeclaration */: + case 220 /* ClassDeclaration */: + case 147 /* Constructor */: + case 148 /* GetAccessor */: + case 149 /* SetAccessor */: + // "export default function().." looks just like a regular function/class declaration, except with the 'default' flag + var name_36 = node.flags && (node.flags & 512 /* Default */) && !node.name ? "default" : + node.kind === 147 /* Constructor */ ? "constructor" : + ts.declarationNameToString(node.name); + return getNavBarItem(name_36, getScriptKindForElementKind(node.kind), [getNodeSpan(node)]); + case 178 /* FunctionExpression */: + case 179 /* ArrowFunction */: + case 191 /* ClassExpression */: + return getDefineModuleItem(node) || getFunctionOrClassExpressionItem(node); + case 146 /* MethodDeclaration */: + var methodDecl = node; + return getNavBarItem(ts.declarationNameToString(methodDecl.name), ts.ScriptElementKind.memberFunctionElement, [getNodeSpan(node)]); + case 234 /* ExportAssignment */: + // e.g. "export default " + return getNavBarItem("default", ts.ScriptElementKind.variableElement, [getNodeSpan(node)]); + case 230 /* ImportClause */: + if (!node.name) { + // No default import (this node is still a parent of named & namespace imports, which are handled below) + return undefined; + } + // fall through + case 233 /* ImportSpecifier */: // e.g. 'id' in: import {id} from 'mod' (in NamedImports, in ImportClause) + case 231 /* NamespaceImport */: // e.g. '* as ns' in: import * as ns from 'mod' (in ImportClause) + case 237 /* ExportSpecifier */: + // Export specifiers are only interesting if they are reexports from another module, or renamed, else they are already globals + if (node.kind === 237 /* ExportSpecifier */) { + if (!node.parent.parent.moduleSpecifier && !node.propertyName) { + return undefined; + } + } + var decl = node; + if (!decl.name) { + return undefined; + } + var declName = ts.declarationNameToString(decl.name); + return getNavBarItem(declName, ts.ScriptElementKind.constElement, [getNodeSpan(node)]); + default: + return undefined; + } + } + function getNavBarItem(text, kind, spans, kindModifiers) { + if (kindModifiers === void 0) { kindModifiers = ts.ScriptElementKindModifier.none; } + return { + text: text, kind: kind, kindModifiers: kindModifiers, spans: spans, childItems: [], indent: indent, bolded: false, grayed: false + }; + } + function getDefineModuleItem(node) { + if (node.kind !== 178 /* FunctionExpression */ && node.kind !== 179 /* ArrowFunction */) { + return undefined; + } + // No match if this is not a call expression to an identifier named 'define' + if (node.parent.kind !== 173 /* CallExpression */) { + return undefined; + } + var callExpr = node.parent; + if (callExpr.expression.kind !== 69 /* Identifier */ || callExpr.expression.getText() !== 'define') { + return undefined; + } + // Return a module of either the given text in the first argument, or of the source file path + var defaultName = node.getSourceFile().fileName; + if (callExpr.arguments[0].kind === 9 /* StringLiteral */) { + defaultName = (callExpr.arguments[0]).text; + } + return getNavBarItem(defaultName, ts.ScriptElementKind.moduleElement, [getNodeSpan(node.parent)]); + } + function getFunctionOrClassExpressionItem(node) { + if (node.kind !== 178 /* FunctionExpression */ && + node.kind !== 179 /* ArrowFunction */ && + node.kind !== 191 /* ClassExpression */) { + return undefined; + } + var fnExpr = node; + var fnName; + if (fnExpr.name && ts.getFullWidth(fnExpr.name) > 0) { + // The expression has an identifier, so use that as the name + fnName = ts.declarationNameToString(fnExpr.name); + } + else { + // See if it is a var initializer. If so, use the var name. + if (fnExpr.parent.kind === 217 /* VariableDeclaration */) { + fnName = ts.declarationNameToString(fnExpr.parent.name); + } + else if (fnExpr.parent.kind === 186 /* BinaryExpression */ && + fnExpr.parent.operatorToken.kind === 56 /* EqualsToken */) { + fnName = fnExpr.parent.left.getText(); + if (fnName.length > 20) { + fnName = fnName.substring(0, 17) + "..."; + } + } + else if (fnExpr.parent.kind === 252 /* PropertyAssignment */ && + fnExpr.parent.name) { + fnName = fnExpr.parent.name.getText(); + } + else { + fnName = node.kind === 191 /* ClassExpression */ ? anonClassText : anonFnText; + } + } + var scriptKind = node.kind === 191 /* ClassExpression */ ? ts.ScriptElementKind.classElement : ts.ScriptElementKind.functionElement; + return getNavBarItem(fnName, scriptKind, [getNodeSpan(node)]); + } + function getNodeSpan(node) { + return node.kind === 255 /* SourceFile */ + ? ts.createTextSpanFromBounds(node.getFullStart(), node.getEnd()) + : ts.createTextSpanFromBounds(node.getStart(), node.getEnd()); + } + function getScriptKindForElementKind(kind) { + switch (kind) { + case 217 /* VariableDeclaration */: + return ts.ScriptElementKind.variableElement; + case 219 /* FunctionDeclaration */: + return ts.ScriptElementKind.functionElement; + case 220 /* ClassDeclaration */: + return ts.ScriptElementKind.classElement; + case 147 /* Constructor */: + return ts.ScriptElementKind.constructorImplementationElement; + case 148 /* GetAccessor */: + return ts.ScriptElementKind.memberGetAccessorElement; + case 149 /* SetAccessor */: + return ts.ScriptElementKind.memberSetAccessorElement; + default: + return "unknown"; + } + } + return sourceFileItem.childItems; + } + NavigationBar.getJsNavigationBarItems = getJsNavigationBarItems; })(NavigationBar = ts.NavigationBar || (ts.NavigationBar = {})); })(ts || (ts = {})); /* @internal */ @@ -43008,7 +44782,7 @@ var ts; // break; // case TypeScript.SyntaxKind.GreaterThanGreaterThanGreaterThanToken: // stack++; - // // Intentaion fall through + // // Intentional fall through // case TypeScript.SyntaxKind.GreaterThanToken: // stack++; // break; @@ -43028,7 +44802,7 @@ var ts; // } // break; // case TypeScript.SyntaxKind.EqualsGreaterThanToken: - // // This can be a function type or a constructor type. In either case, we want to skip the function defintion + // // This can be a function type or a constructor type. In either case, we want to skip the function definition // token = previousToken(token, /*includeSkippedTokens*/ true); // if (token && token.kind() === TypeScript.SyntaxKind.CloseParenToken) { // // Skip untill the matching open paren token @@ -43047,7 +44821,7 @@ var ts; // } // } // else { - // // This is not a funtion type. exit the main loop + // // This is not a function type. exit the main loop // break whileLoop; // } // break; @@ -43134,7 +44908,7 @@ var ts; } return createSignatureHelpItems(candidates, resolvedSignature, argumentInfo); function createJavaScriptSignatureHelpItems(argumentInfo) { - if (argumentInfo.invocation.kind !== 172 /* CallExpression */) { + if (argumentInfo.invocation.kind !== 173 /* CallExpression */) { return undefined; } // See if we can find some symbol with the call expression name that has call signatures. @@ -43142,7 +44916,7 @@ var ts; var expression = callExpression.expression; var name = expression.kind === 69 /* Identifier */ ? expression - : expression.kind === 170 /* PropertyAccessExpression */ + : expression.kind === 171 /* PropertyAccessExpression */ ? expression.name : undefined; if (!name || !name.text) { @@ -43175,7 +44949,7 @@ var ts; * in the argument of an invocation; returns undefined otherwise. */ function getImmediatelyContainingArgumentInfo(node) { - if (node.parent.kind === 172 /* CallExpression */ || node.parent.kind === 173 /* NewExpression */) { + if (node.parent.kind === 173 /* CallExpression */ || node.parent.kind === 174 /* NewExpression */) { var callExpression = node.parent; // There are 3 cases to handle: // 1. The token introduces a list, and should begin a sig help session @@ -43228,25 +45002,25 @@ var ts; }; } } - else if (node.kind === 11 /* NoSubstitutionTemplateLiteral */ && node.parent.kind === 174 /* TaggedTemplateExpression */) { + else if (node.kind === 11 /* NoSubstitutionTemplateLiteral */ && node.parent.kind === 175 /* 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); } } - else if (node.kind === 12 /* TemplateHead */ && node.parent.parent.kind === 174 /* TaggedTemplateExpression */) { + else if (node.kind === 12 /* TemplateHead */ && node.parent.parent.kind === 175 /* TaggedTemplateExpression */) { var templateExpression = node.parent; var tagExpression = templateExpression.parent; - ts.Debug.assert(templateExpression.kind === 187 /* TemplateExpression */); + ts.Debug.assert(templateExpression.kind === 188 /* TemplateExpression */); var argumentIndex = ts.isInsideTemplateLiteral(node, position) ? 0 : 1; return getArgumentListInfoForTemplate(tagExpression, argumentIndex); } - else if (node.parent.kind === 194 /* TemplateSpan */ && node.parent.parent.parent.kind === 174 /* TaggedTemplateExpression */) { + else if (node.parent.kind === 196 /* TemplateSpan */ && node.parent.parent.parent.kind === 175 /* TaggedTemplateExpression */) { var templateSpan = node.parent; var templateExpression = templateSpan.parent; var tagExpression = templateExpression.parent; - ts.Debug.assert(templateExpression.kind === 187 /* TemplateExpression */); + ts.Debug.assert(templateExpression.kind === 188 /* TemplateExpression */); // If we're just after a template tail, don't show signature help. if (node.kind === 14 /* TemplateTail */ && !ts.isInsideTemplateLiteral(node, position)) { return undefined; @@ -43364,7 +45138,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 === 187 /* TemplateExpression */) { + if (template.kind === 188 /* TemplateExpression */) { var lastSpan = ts.lastOrUndefined(template.templateSpans); if (lastSpan.literal.getFullWidth() === 0) { applicableSpanEnd = ts.skipTrivia(sourceFile.text, applicableSpanEnd, /*stopAfterLineBreak*/ false); @@ -43373,7 +45147,7 @@ var ts; return ts.createTextSpan(applicableSpanStart, applicableSpanEnd - applicableSpanStart); } function getContainingArgumentInfo(node) { - for (var n = node; n.kind !== 252 /* SourceFile */; n = n.parent) { + for (var n = node; n.kind !== 255 /* SourceFile */; n = n.parent) { if (ts.isFunctionBlock(n)) { return undefined; } @@ -43438,7 +45212,7 @@ var ts; signatureHelpParameters = typeParameters && typeParameters.length > 0 ? ts.map(typeParameters, createSignatureHelpParameterForTypeParameter) : emptyArray; suffixDisplayParts.push(ts.punctuationPart(27 /* GreaterThanToken */)); var parameterParts = ts.mapToDisplayParts(function (writer) { - return typeChecker.getSymbolDisplayBuilder().buildDisplayForParametersAndDelimiters(candidateSignature.parameters, writer, invocation); + return typeChecker.getSymbolDisplayBuilder().buildDisplayForParametersAndDelimiters(candidateSignature.thisType, candidateSignature.parameters, writer, invocation); }); ts.addRange(suffixDisplayParts, parameterParts); } @@ -43511,31 +45285,6 @@ var ts; /* @internal */ var ts; (function (ts) { - function getEndLinePosition(line, sourceFile) { - ts.Debug.assert(line >= 0); - var lineStarts = sourceFile.getLineStarts(); - var lineIndex = line; - if (lineIndex + 1 === lineStarts.length) { - // last line - return EOF - return sourceFile.text.length - 1; - } - else { - // current line start - var start = lineStarts[lineIndex]; - // take the start position of the next line -1 = it should be some line break - var pos = lineStarts[lineIndex + 1] - 1; - ts.Debug.assert(ts.isLineBreak(sourceFile.text.charCodeAt(pos))); - // walk backwards skipping line breaks, stop the the beginning of current line. - // i.e: - // - // $ <- end of line for this position should match the start position - while (start <= pos && ts.isLineBreak(sourceFile.text.charCodeAt(pos))) { - pos--; - } - return pos; - } - } - ts.getEndLinePosition = getEndLinePosition; function getLineStartPositionForPosition(position, sourceFile) { var lineStarts = sourceFile.getLineStarts(); var line = sourceFile.getLineAndCharacterOfPosition(position).line; @@ -43573,40 +45322,40 @@ var ts; return false; } switch (n.kind) { - case 218 /* ClassDeclaration */: - case 219 /* InterfaceDeclaration */: - case 221 /* EnumDeclaration */: - case 169 /* ObjectLiteralExpression */: - case 165 /* ObjectBindingPattern */: - case 157 /* TypeLiteral */: - case 196 /* Block */: - case 223 /* ModuleBlock */: - case 224 /* CaseBlock */: + case 220 /* ClassDeclaration */: + case 221 /* InterfaceDeclaration */: + case 223 /* EnumDeclaration */: + case 170 /* ObjectLiteralExpression */: + case 166 /* ObjectBindingPattern */: + case 158 /* TypeLiteral */: + case 198 /* Block */: + case 225 /* ModuleBlock */: + case 226 /* CaseBlock */: return nodeEndsWith(n, 16 /* CloseBraceToken */, sourceFile); - case 248 /* CatchClause */: + case 251 /* CatchClause */: return isCompletedNode(n.block, sourceFile); - case 173 /* NewExpression */: + case 174 /* NewExpression */: if (!n.arguments) { return true; } // fall through - case 172 /* CallExpression */: - case 176 /* ParenthesizedExpression */: - case 162 /* ParenthesizedType */: + case 173 /* CallExpression */: + case 177 /* ParenthesizedExpression */: + case 163 /* ParenthesizedType */: return nodeEndsWith(n, 18 /* CloseParenToken */, sourceFile); - case 154 /* FunctionType */: - case 155 /* ConstructorType */: + case 155 /* FunctionType */: + case 156 /* ConstructorType */: return isCompletedNode(n.type, sourceFile); - case 146 /* Constructor */: - case 147 /* GetAccessor */: - case 148 /* SetAccessor */: - case 217 /* FunctionDeclaration */: - case 177 /* FunctionExpression */: - case 145 /* MethodDeclaration */: - case 144 /* MethodSignature */: - case 150 /* ConstructSignature */: - case 149 /* CallSignature */: - case 178 /* ArrowFunction */: + case 147 /* Constructor */: + case 148 /* GetAccessor */: + case 149 /* SetAccessor */: + case 219 /* FunctionDeclaration */: + case 178 /* FunctionExpression */: + case 146 /* MethodDeclaration */: + case 145 /* MethodSignature */: + case 151 /* ConstructSignature */: + case 150 /* CallSignature */: + case 179 /* ArrowFunction */: if (n.body) { return isCompletedNode(n.body, sourceFile); } @@ -43616,64 +45365,64 @@ var ts; // 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 222 /* ModuleDeclaration */: + case 224 /* ModuleDeclaration */: return n.body && isCompletedNode(n.body, sourceFile); - case 200 /* IfStatement */: + case 202 /* IfStatement */: if (n.elseStatement) { return isCompletedNode(n.elseStatement, sourceFile); } return isCompletedNode(n.thenStatement, sourceFile); - case 199 /* ExpressionStatement */: + case 201 /* ExpressionStatement */: return isCompletedNode(n.expression, sourceFile) || hasChildOfKind(n, 23 /* SemicolonToken */); - case 168 /* ArrayLiteralExpression */: - case 166 /* ArrayBindingPattern */: - case 171 /* ElementAccessExpression */: - case 138 /* ComputedPropertyName */: - case 159 /* TupleType */: + case 169 /* ArrayLiteralExpression */: + case 167 /* ArrayBindingPattern */: + case 172 /* ElementAccessExpression */: + case 139 /* ComputedPropertyName */: + case 160 /* TupleType */: return nodeEndsWith(n, 20 /* CloseBracketToken */, sourceFile); - case 151 /* IndexSignature */: + case 152 /* IndexSignature */: if (n.type) { return isCompletedNode(n.type, sourceFile); } return hasChildOfKind(n, 20 /* CloseBracketToken */, sourceFile); - case 245 /* CaseClause */: - case 246 /* DefaultClause */: - // there is no such thing as terminator token for CaseClause/DefaultClause so for simplicitly always consider them non-completed + case 248 /* CaseClause */: + case 249 /* DefaultClause */: + // there is no such thing as terminator token for CaseClause/DefaultClause so for simplicity always consider them non-completed return false; - case 203 /* ForStatement */: - case 204 /* ForInStatement */: - case 205 /* ForOfStatement */: - case 202 /* WhileStatement */: + case 205 /* ForStatement */: + case 206 /* ForInStatement */: + case 207 /* ForOfStatement */: + case 204 /* WhileStatement */: return isCompletedNode(n.statement, sourceFile); - case 201 /* DoStatement */: + case 203 /* 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 156 /* TypeQuery */: + case 157 /* TypeQuery */: return isCompletedNode(n.exprName, sourceFile); - case 180 /* TypeOfExpression */: - case 179 /* DeleteExpression */: - case 181 /* VoidExpression */: - case 188 /* YieldExpression */: - case 189 /* SpreadElementExpression */: + case 181 /* TypeOfExpression */: + case 180 /* DeleteExpression */: + case 182 /* VoidExpression */: + case 189 /* YieldExpression */: + case 190 /* SpreadElementExpression */: var unaryWordExpression = n; return isCompletedNode(unaryWordExpression.expression, sourceFile); - case 174 /* TaggedTemplateExpression */: + case 175 /* TaggedTemplateExpression */: return isCompletedNode(n.template, sourceFile); - case 187 /* TemplateExpression */: + case 188 /* TemplateExpression */: var lastSpan = ts.lastOrUndefined(n.templateSpans); return isCompletedNode(lastSpan, sourceFile); - case 194 /* TemplateSpan */: + case 196 /* TemplateSpan */: return ts.nodeIsPresent(n.literal); - case 183 /* PrefixUnaryExpression */: + case 184 /* PrefixUnaryExpression */: return isCompletedNode(n.operand, sourceFile); - case 185 /* BinaryExpression */: + case 186 /* BinaryExpression */: return isCompletedNode(n.right, sourceFile); - case 186 /* ConditionalExpression */: + case 187 /* ConditionalExpression */: return isCompletedNode(n.whenFalse, sourceFile); default: return true; @@ -43729,7 +45478,7 @@ var ts; // for the position of the relevant node (or comma). var syntaxList = ts.forEach(node.parent.getChildren(), function (c) { // find syntax list that covers the span of the node - if (c.kind === 275 /* SyntaxList */ && c.pos <= node.pos && c.end >= node.end) { + if (c.kind === 278 /* SyntaxList */ && c.pos <= node.pos && c.end >= node.end) { return c; } }); @@ -43746,7 +45495,7 @@ var ts; } 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 litera)) + * and (position < end or (position === end && token is keyword or identifier or numeric/string literal)) */ function getTouchingPropertyName(sourceFile, position) { return getTouchingToken(sourceFile, position, function (n) { return isPropertyName(n.kind); }); @@ -43835,7 +45584,7 @@ var ts; function findPrecedingToken(position, sourceFile, startNode) { return find(startNode || sourceFile); function findRightmostToken(n) { - if (isToken(n) || n.kind === 240 /* JsxText */) { + if (isToken(n) || n.kind === 243 /* JsxText */) { return n; } var children = n.getChildren(); @@ -43843,7 +45592,7 @@ var ts; return candidate && findRightmostToken(candidate); } function find(n) { - if (isToken(n) || n.kind === 240 /* JsxText */) { + if (isToken(n) || n.kind === 243 /* JsxText */) { return n; } var children = n.getChildren(); @@ -43857,10 +45606,10 @@ var ts; // 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 === 240 /* JsxText */)) { + if (position < child.end && (nodeHasTokens(child) || child.kind === 243 /* JsxText */)) { var start = child.getStart(sourceFile); var lookInPreviousChild = (start >= position) || - (child.kind === 240 /* JsxText */ && start === child.end); // whitespace only JsxText + (child.kind === 243 /* 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); @@ -43872,7 +45621,7 @@ var ts; } } } - ts.Debug.assert(startNode !== undefined || n.kind === 252 /* SourceFile */); + ts.Debug.assert(startNode !== undefined || n.kind === 255 /* 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. @@ -43894,7 +45643,7 @@ var ts; ts.findPrecedingToken = findPrecedingToken; function isInString(sourceFile, position) { var token = getTokenAtPosition(sourceFile, position); - return token && (token.kind === 9 /* StringLiteral */ || token.kind === 164 /* StringLiteralType */) && position > token.getStart(); + return token && (token.kind === 9 /* StringLiteral */ || token.kind === 165 /* StringLiteralType */) && position > token.getStart(); } ts.isInString = isInString; function isInComment(sourceFile, position) { @@ -43998,17 +45747,17 @@ var ts; } ts.getNodeModifiers = getNodeModifiers; function getTypeArgumentOrTypeParameterList(node) { - if (node.kind === 153 /* TypeReference */ || node.kind === 172 /* CallExpression */) { + if (node.kind === 154 /* TypeReference */ || node.kind === 173 /* CallExpression */) { return node.typeArguments; } - if (ts.isFunctionLike(node) || node.kind === 218 /* ClassDeclaration */ || node.kind === 219 /* InterfaceDeclaration */) { + if (ts.isFunctionLike(node) || node.kind === 220 /* ClassDeclaration */ || node.kind === 221 /* InterfaceDeclaration */) { return node.typeParameters; } return undefined; } ts.getTypeArgumentOrTypeParameterList = getTypeArgumentOrTypeParameterList; function isToken(n) { - return n.kind >= 0 /* FirstToken */ && n.kind <= 136 /* LastToken */; + return n.kind >= 0 /* FirstToken */ && n.kind <= 137 /* LastToken */; } ts.isToken = isToken; function isWord(kind) { @@ -44024,7 +45773,7 @@ var ts; ts.isComment = isComment; function isStringOrRegularExpressionOrTemplateLiteral(kind) { if (kind === 9 /* StringLiteral */ - || kind === 164 /* StringLiteralType */ + || kind === 165 /* StringLiteralType */ || kind === 10 /* RegularExpressionLiteral */ || ts.isTemplateLiteralKind(kind)) { return true; @@ -44068,18 +45817,18 @@ var ts; } ts.compareDataObjects = compareDataObjects; function isArrayLiteralOrObjectLiteralDestructuringPattern(node) { - if (node.kind === 168 /* ArrayLiteralExpression */ || - node.kind === 169 /* ObjectLiteralExpression */) { + if (node.kind === 169 /* ArrayLiteralExpression */ || + node.kind === 170 /* ObjectLiteralExpression */) { // [a,b,c] from: // [a, b, c] = someExpression; - if (node.parent.kind === 185 /* BinaryExpression */ && + if (node.parent.kind === 186 /* 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 === 205 /* ForOfStatement */ && + if (node.parent.kind === 207 /* ForOfStatement */ && node.parent.initializer === node) { return true; } @@ -44087,7 +45836,7 @@ var ts; // [x, [a, b, c] ] = someExpression // or // {x, a: {a, b, c} } = someExpression - if (isArrayLiteralOrObjectLiteralDestructuringPattern(node.parent.kind === 249 /* PropertyAssignment */ ? node.parent.parent : node.parent)) { + if (isArrayLiteralOrObjectLiteralDestructuringPattern(node.parent.kind === 252 /* PropertyAssignment */ ? node.parent.parent : node.parent)) { return true; } } @@ -44100,7 +45849,7 @@ var ts; var ts; (function (ts) { function isFirstDeclarationOfSymbolParameter(symbol) { - return symbol.declarations && symbol.declarations.length > 0 && symbol.declarations[0].kind === 140 /* Parameter */; + return symbol.declarations && symbol.declarations.length > 0 && symbol.declarations[0].kind === 141 /* Parameter */; } ts.isFirstDeclarationOfSymbolParameter = isFirstDeclarationOfSymbolParameter; var displayPartWriter = getDisplayPartWriter(); @@ -44288,7 +46037,7 @@ var ts; ts.getDeclaredName = getDeclaredName; function isImportOrExportSpecifierName(location) { return location.parent && - (location.parent.kind === 230 /* ImportSpecifier */ || location.parent.kind === 234 /* ExportSpecifier */) && + (location.parent.kind === 233 /* ImportSpecifier */ || location.parent.kind === 237 /* ExportSpecifier */) && location.parent.propertyName === location; } ts.isImportOrExportSpecifierName = isImportOrExportSpecifierName; @@ -44308,6 +46057,213 @@ var ts; 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 can be determined from the file name + var scriptKind = ts.getScriptKindFromFileName(fileName); + if (scriptKind === 0 /* Unknown */ && host && host.getScriptKind) { + // Next check to see if the host can resolve the script kind + scriptKind = host.getScriptKind(fileName); + } + return ts.ensureScriptKind(fileName, scriptKind); + } + ts.getScriptKind = getScriptKind; +})(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 = {}; + if (!typingOptions || !typingOptions.enableAutoDiscovery) { + return { cachedTypingPaths: [], newTypingNames: [], filesToWatch: [] }; + } + // 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); }); + if (result.config) { + safeList = result.config; + } + else { + safeList = {}; + } + ; + } + 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_37 in packageNameToTypingLocation) { + if (ts.hasProperty(inferredTypings, name_37) && !inferredTypings[name_37]) { + inferredTypings[name_37] = packageNameToTypingLocation[name_37]; + } + } + // 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 (!ts.hasProperty(inferredTypings, typing)) { + 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.getKeys(jsonConfig.dependencies)); + } + if (jsonConfig.devDependencies) { + mergeTypings(ts.getKeys(jsonConfig.devDependencies)); + } + if (jsonConfig.optionalDependencies) { + mergeTypings(ts.getKeys(jsonConfig.optionalDependencies)); + } + if (jsonConfig.peerDependencies) { + mergeTypings(ts.getKeys(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 ts.hasProperty(safeList, f); })); + } + 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", /*exclude*/ undefined, /*depth*/ 2); + for (var _i = 0, fileNames_1 = fileNames; _i < fileNames_1.length; _i++) { + var fileName = fileNames_1[_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 = {})); /// /// @@ -44411,10 +46367,10 @@ var ts; function shouldRescanJsxIdentifier(node) { if (node.parent) { switch (node.parent.kind) { - case 242 /* JsxAttribute */: - case 239 /* JsxOpeningElement */: - case 241 /* JsxClosingElement */: - case 238 /* JsxSelfClosingElement */: + case 245 /* JsxAttribute */: + case 242 /* JsxOpeningElement */: + case 244 /* JsxClosingElement */: + case 241 /* JsxSelfClosingElement */: return node.kind === 69 /* Identifier */; } } @@ -44455,7 +46411,7 @@ var ts; // readTokenInfo was called before with the same expected scan action. // No need to re-scan text, return existing 'lastTokenInfo' // it is ok to call fixTokenKind here since it does not affect - // what portion of text is consumed. In opposize rescanning can change it, + // what portion of text is consumed. In contrast rescanning can change it, // i.e. for '>=' when originally scanner eats just one character // and rescanning forces it to consume more. return fixTokenKind(lastTokenInfo, n); @@ -45018,9 +46974,9 @@ var ts; } Rules.prototype.getRuleName = function (rule) { var o = this; - for (var name_33 in o) { - if (o[name_33] === rule) { - return name_33; + for (var name_38 in o) { + if (o[name_38] === rule) { + return name_38; } } throw new Error("Unknown rule"); @@ -45029,40 +46985,40 @@ var ts; /// Contexts /// Rules.IsForContext = function (context) { - return context.contextNode.kind === 203 /* ForStatement */; + return context.contextNode.kind === 205 /* ForStatement */; }; Rules.IsNotForContext = function (context) { return !Rules.IsForContext(context); }; Rules.IsBinaryOpContext = function (context) { switch (context.contextNode.kind) { - case 185 /* BinaryExpression */: - case 186 /* ConditionalExpression */: - case 193 /* AsExpression */: - case 152 /* TypePredicate */: - case 160 /* UnionType */: - case 161 /* IntersectionType */: + case 186 /* BinaryExpression */: + case 187 /* ConditionalExpression */: + case 194 /* AsExpression */: + case 153 /* TypePredicate */: + case 161 /* UnionType */: + case 162 /* IntersectionType */: return true; // equals in binding elements: function foo([[x, y] = [1, 2]]) - case 167 /* BindingElement */: + case 168 /* BindingElement */: // equals in type X = ... - case 220 /* TypeAliasDeclaration */: + case 222 /* TypeAliasDeclaration */: // equal in import a = module('a'); - case 225 /* ImportEqualsDeclaration */: + case 228 /* ImportEqualsDeclaration */: // equal in let a = 0; - case 215 /* VariableDeclaration */: + case 217 /* VariableDeclaration */: // equal in p = 0; - case 140 /* Parameter */: - case 251 /* EnumMember */: - case 143 /* PropertyDeclaration */: - case 142 /* PropertySignature */: + case 141 /* Parameter */: + case 254 /* EnumMember */: + case 144 /* PropertyDeclaration */: + case 143 /* PropertySignature */: return context.currentTokenSpan.kind === 56 /* EqualsToken */ || context.nextTokenSpan.kind === 56 /* EqualsToken */; // "in" keyword in for (let x in []) { } - case 204 /* ForInStatement */: + case 206 /* ForInStatement */: return context.currentTokenSpan.kind === 90 /* InKeyword */ || context.nextTokenSpan.kind === 90 /* InKeyword */; // Technically, "of" is not a binary operator, but format it the same way as "in" - case 205 /* ForOfStatement */: - return context.currentTokenSpan.kind === 136 /* OfKeyword */ || context.nextTokenSpan.kind === 136 /* OfKeyword */; + case 207 /* ForOfStatement */: + return context.currentTokenSpan.kind === 137 /* OfKeyword */ || context.nextTokenSpan.kind === 137 /* OfKeyword */; } return false; }; @@ -45070,7 +47026,7 @@ var ts; return !Rules.IsBinaryOpContext(context); }; Rules.IsConditionalOperatorContext = function (context) { - return context.contextNode.kind === 186 /* ConditionalExpression */; + return context.contextNode.kind === 187 /* ConditionalExpression */; }; Rules.IsSameLineTokenOrBeforeMultilineBlockContext = function (context) { //// This check is mainly used inside SpaceBeforeOpenBraceInControl and SpaceBeforeOpenBraceInFunction. @@ -45082,13 +47038,13 @@ var ts; //// Ex: //// if (1) //// { ... } - //// * ) and { are on differnet lines. We only need to format if the block is multiline context. So in this case we don't format. + //// * ) and { are on different lines. We only need to format if the block is multiline context. So in this case we don't format. //// //// Ex: //// if (1) //// { ... //// } - //// * ) and { are on differnet lines. We only need to format if the block is multiline context. So in this case we format. + //// * ) and { are on different lines. We only need to format if the block is multiline context. So in this case we format. return context.TokensAreOnSameLine() || Rules.IsBeforeMultilineBlockContext(context); }; // This check is done before an open brace in a control construct, a function, or a typescript block declaration @@ -45114,93 +47070,93 @@ var ts; return true; } switch (node.kind) { - case 196 /* Block */: - case 224 /* CaseBlock */: - case 169 /* ObjectLiteralExpression */: - case 223 /* ModuleBlock */: + case 198 /* Block */: + case 226 /* CaseBlock */: + case 170 /* ObjectLiteralExpression */: + case 225 /* ModuleBlock */: return true; } return false; }; Rules.IsFunctionDeclContext = function (context) { switch (context.contextNode.kind) { - case 217 /* FunctionDeclaration */: - case 145 /* MethodDeclaration */: - case 144 /* MethodSignature */: + case 219 /* FunctionDeclaration */: + case 146 /* MethodDeclaration */: + case 145 /* MethodSignature */: //case SyntaxKind.MemberFunctionDeclaration: - case 147 /* GetAccessor */: - case 148 /* SetAccessor */: + case 148 /* GetAccessor */: + case 149 /* SetAccessor */: ///case SyntaxKind.MethodSignature: - case 149 /* CallSignature */: - case 177 /* FunctionExpression */: - case 146 /* Constructor */: - case 178 /* ArrowFunction */: + case 150 /* CallSignature */: + case 178 /* FunctionExpression */: + case 147 /* Constructor */: + case 179 /* ArrowFunction */: //case SyntaxKind.ConstructorDeclaration: //case SyntaxKind.SimpleArrowFunctionExpression: //case SyntaxKind.ParenthesizedArrowFunctionExpression: - case 219 /* InterfaceDeclaration */: + case 221 /* InterfaceDeclaration */: return true; } return false; }; Rules.IsFunctionDeclarationOrFunctionExpressionContext = function (context) { - return context.contextNode.kind === 217 /* FunctionDeclaration */ || context.contextNode.kind === 177 /* FunctionExpression */; + return context.contextNode.kind === 219 /* FunctionDeclaration */ || context.contextNode.kind === 178 /* FunctionExpression */; }; Rules.IsTypeScriptDeclWithBlockContext = function (context) { return Rules.NodeIsTypeScriptDeclWithBlockContext(context.contextNode); }; Rules.NodeIsTypeScriptDeclWithBlockContext = function (node) { switch (node.kind) { - case 218 /* ClassDeclaration */: - case 190 /* ClassExpression */: - case 219 /* InterfaceDeclaration */: - case 221 /* EnumDeclaration */: - case 157 /* TypeLiteral */: - case 222 /* ModuleDeclaration */: + case 220 /* ClassDeclaration */: + case 191 /* ClassExpression */: + case 221 /* InterfaceDeclaration */: + case 223 /* EnumDeclaration */: + case 158 /* TypeLiteral */: + case 224 /* ModuleDeclaration */: return true; } return false; }; Rules.IsAfterCodeBlockContext = function (context) { switch (context.currentTokenParent.kind) { - case 218 /* ClassDeclaration */: - case 222 /* ModuleDeclaration */: - case 221 /* EnumDeclaration */: - case 196 /* Block */: - case 248 /* CatchClause */: - case 223 /* ModuleBlock */: - case 210 /* SwitchStatement */: + case 220 /* ClassDeclaration */: + case 224 /* ModuleDeclaration */: + case 223 /* EnumDeclaration */: + case 198 /* Block */: + case 251 /* CatchClause */: + case 225 /* ModuleBlock */: + case 212 /* SwitchStatement */: return true; } return false; }; Rules.IsControlDeclContext = function (context) { switch (context.contextNode.kind) { - case 200 /* IfStatement */: - case 210 /* SwitchStatement */: - case 203 /* ForStatement */: - case 204 /* ForInStatement */: - case 205 /* ForOfStatement */: - case 202 /* WhileStatement */: - case 213 /* TryStatement */: - case 201 /* DoStatement */: - case 209 /* WithStatement */: + case 202 /* IfStatement */: + case 212 /* SwitchStatement */: + case 205 /* ForStatement */: + case 206 /* ForInStatement */: + case 207 /* ForOfStatement */: + case 204 /* WhileStatement */: + case 215 /* TryStatement */: + case 203 /* DoStatement */: + case 211 /* WithStatement */: // TODO // case SyntaxKind.ElseClause: - case 248 /* CatchClause */: + case 251 /* CatchClause */: return true; default: return false; } }; Rules.IsObjectContext = function (context) { - return context.contextNode.kind === 169 /* ObjectLiteralExpression */; + return context.contextNode.kind === 170 /* ObjectLiteralExpression */; }; Rules.IsFunctionCallContext = function (context) { - return context.contextNode.kind === 172 /* CallExpression */; + return context.contextNode.kind === 173 /* CallExpression */; }; Rules.IsNewContext = function (context) { - return context.contextNode.kind === 173 /* NewExpression */; + return context.contextNode.kind === 174 /* NewExpression */; }; Rules.IsFunctionCallOrNewContext = function (context) { return Rules.IsFunctionCallContext(context) || Rules.IsNewContext(context); @@ -45212,10 +47168,10 @@ var ts; return context.nextTokenSpan.kind !== 20 /* CloseBracketToken */; }; Rules.IsArrowFunctionContext = function (context) { - return context.contextNode.kind === 178 /* ArrowFunction */; + return context.contextNode.kind === 179 /* ArrowFunction */; }; Rules.IsNonJsxSameLineTokenContext = function (context) { - return context.TokensAreOnSameLine() && context.contextNode.kind !== 240 /* JsxText */; + return context.TokensAreOnSameLine() && context.contextNode.kind !== 243 /* JsxText */; }; Rules.IsNotBeforeBlockInFunctionDeclarationContext = function (context) { return !Rules.IsFunctionDeclContext(context) && !Rules.IsBeforeBlockContext(context); @@ -45230,41 +47186,41 @@ var ts; while (ts.isExpression(node)) { node = node.parent; } - return node.kind === 141 /* Decorator */; + return node.kind === 142 /* Decorator */; }; Rules.IsStartOfVariableDeclarationList = function (context) { - return context.currentTokenParent.kind === 216 /* VariableDeclarationList */ && + return context.currentTokenParent.kind === 218 /* 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 === 222 /* ModuleDeclaration */; + return context.contextNode.kind === 224 /* ModuleDeclaration */; }; Rules.IsObjectTypeContext = function (context) { - return context.contextNode.kind === 157 /* TypeLiteral */; // && context.contextNode.parent.kind !== SyntaxKind.InterfaceDeclaration; + return context.contextNode.kind === 158 /* TypeLiteral */; // && context.contextNode.parent.kind !== SyntaxKind.InterfaceDeclaration; }; Rules.IsTypeArgumentOrParameterOrAssertion = function (token, parent) { if (token.kind !== 25 /* LessThanToken */ && token.kind !== 27 /* GreaterThanToken */) { return false; } switch (parent.kind) { - case 153 /* TypeReference */: - case 175 /* TypeAssertionExpression */: - case 218 /* ClassDeclaration */: - case 190 /* ClassExpression */: - case 219 /* InterfaceDeclaration */: - case 217 /* FunctionDeclaration */: - case 177 /* FunctionExpression */: - case 178 /* ArrowFunction */: - case 145 /* MethodDeclaration */: - case 144 /* MethodSignature */: - case 149 /* CallSignature */: - case 150 /* ConstructSignature */: - case 172 /* CallExpression */: - case 173 /* NewExpression */: - case 192 /* ExpressionWithTypeArguments */: + case 154 /* TypeReference */: + case 176 /* TypeAssertionExpression */: + case 220 /* ClassDeclaration */: + case 191 /* ClassExpression */: + case 221 /* InterfaceDeclaration */: + case 219 /* FunctionDeclaration */: + case 178 /* FunctionExpression */: + case 179 /* ArrowFunction */: + case 146 /* MethodDeclaration */: + case 145 /* MethodSignature */: + case 150 /* CallSignature */: + case 151 /* ConstructSignature */: + case 173 /* CallExpression */: + case 174 /* NewExpression */: + case 193 /* ExpressionWithTypeArguments */: return true; default: return false; @@ -45275,13 +47231,13 @@ var ts; Rules.IsTypeArgumentOrParameterOrAssertion(context.nextTokenSpan, context.nextTokenParent); }; Rules.IsTypeAssertionContext = function (context) { - return context.contextNode.kind === 175 /* TypeAssertionExpression */; + return context.contextNode.kind === 176 /* TypeAssertionExpression */; }; Rules.IsVoidOpContext = function (context) { - return context.currentTokenSpan.kind === 103 /* VoidKeyword */ && context.currentTokenParent.kind === 181 /* VoidExpression */; + return context.currentTokenSpan.kind === 103 /* VoidKeyword */ && context.currentTokenParent.kind === 182 /* VoidExpression */; }; Rules.IsYieldOrYieldStarWithOperand = function (context) { - return context.contextNode.kind === 188 /* YieldExpression */ && context.contextNode.expression !== undefined; + return context.contextNode.kind === 189 /* YieldExpression */ && context.contextNode.expression !== undefined; }; return Rules; }()); @@ -45305,7 +47261,7 @@ var ts; return result; }; RulesMap.prototype.Initialize = function (rules) { - this.mapRowLength = 136 /* LastToken */ + 1; + this.mapRowLength = 137 /* 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); @@ -45500,7 +47456,7 @@ var ts; } TokenAllAccess.prototype.GetTokens = function () { var result = []; - for (var token = 0 /* FirstToken */; token <= 136 /* LastToken */; token++) { + for (var token = 0 /* FirstToken */; token <= 137 /* LastToken */; token++) { result.push(token); } return result; @@ -45542,9 +47498,9 @@ var ts; }; TokenRange.Any = TokenRange.AllTokens(); TokenRange.AnyIncludingMultilineComments = TokenRange.FromTokens(TokenRange.Any.GetTokens().concat([3 /* MultiLineCommentTrivia */])); - TokenRange.Keywords = TokenRange.FromRange(70 /* FirstKeyword */, 136 /* LastKeyword */); + TokenRange.Keywords = TokenRange.FromRange(70 /* FirstKeyword */, 137 /* LastKeyword */); TokenRange.BinaryOperators = TokenRange.FromRange(25 /* FirstBinaryOperator */, 68 /* LastBinaryOperator */); - TokenRange.BinaryKeywordOperators = TokenRange.FromTokens([90 /* InKeyword */, 91 /* InstanceOfKeyword */, 136 /* OfKeyword */, 116 /* AsKeyword */, 124 /* IsKeyword */]); + TokenRange.BinaryKeywordOperators = TokenRange.FromTokens([90 /* InKeyword */, 91 /* InstanceOfKeyword */, 137 /* 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 */]); @@ -45695,12 +47651,20 @@ var ts; if (line === 0) { return []; } - // get the span for the previous\current line + // After the enter key, the cursor is now at a new line. The new line may or may not contain non-whitespace characters. + // If the new line has only whitespaces, we won't want to format this line, because that would remove the indentation as + // trailing whitespaces. So the end of the formatting span should be the later one between: + // 1. the end of the previous line + // 2. the last non-whitespace character in the current line + var endOfFormatSpan = ts.getEndLinePosition(line, sourceFile); + while (ts.isWhiteSpace(sourceFile.text.charCodeAt(endOfFormatSpan)) && !ts.isLineBreak(sourceFile.text.charCodeAt(endOfFormatSpan))) { + endOfFormatSpan--; + } var span = { // get start position for the previous line pos: ts.getStartPositionOfLine(line - 1, sourceFile), - // get end position for the current line (end value is exclusive so add 1 to the result) - end: ts.getEndLinePosition(line, sourceFile) + 1 + // end value is exclusive so add 1 to the result + end: endOfFormatSpan + 1 }; return formatSpan(span, sourceFile, options, rulesProvider, 2 /* FormatOnEnter */); } @@ -45774,17 +47738,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 218 /* ClassDeclaration */: - case 219 /* InterfaceDeclaration */: + case 220 /* ClassDeclaration */: + case 221 /* InterfaceDeclaration */: return ts.rangeContainsRange(parent.members, node); - case 222 /* ModuleDeclaration */: + case 224 /* ModuleDeclaration */: var body = parent.body; - return body && body.kind === 196 /* Block */ && ts.rangeContainsRange(body.statements, node); - case 252 /* SourceFile */: - case 196 /* Block */: - case 223 /* ModuleBlock */: + return body && body.kind === 198 /* Block */ && ts.rangeContainsRange(body.statements, node); + case 255 /* SourceFile */: + case 198 /* Block */: + case 225 /* ModuleBlock */: return ts.rangeContainsRange(parent.statements, node); - case 248 /* CatchClause */: + case 251 /* CatchClause */: return ts.rangeContainsRange(parent.block.statements, node); } return false; @@ -45858,7 +47822,7 @@ var ts; // no preceding token found - start from the beginning of enclosing node return enclosingNode.pos; } - // preceding token ends after the start of original range (i.e when originaRange.pos falls in the middle of literal) + // preceding token ends after the start of original range (i.e when originalRange.pos falls in the middle of literal) // start from the beginning of enclosingNode to handle the entire 'originalRange' if (precedingToken.end >= originalRange.pos) { return enclosingNode.pos; @@ -45986,19 +47950,19 @@ var ts; return node.modifiers[0].kind; } switch (node.kind) { - case 218 /* ClassDeclaration */: return 73 /* ClassKeyword */; - case 219 /* InterfaceDeclaration */: return 107 /* InterfaceKeyword */; - case 217 /* FunctionDeclaration */: return 87 /* FunctionKeyword */; - case 221 /* EnumDeclaration */: return 221 /* EnumDeclaration */; - case 147 /* GetAccessor */: return 123 /* GetKeyword */; - case 148 /* SetAccessor */: return 130 /* SetKeyword */; - case 145 /* MethodDeclaration */: + case 220 /* ClassDeclaration */: return 73 /* ClassKeyword */; + case 221 /* InterfaceDeclaration */: return 107 /* InterfaceKeyword */; + case 219 /* FunctionDeclaration */: return 87 /* FunctionKeyword */; + case 223 /* EnumDeclaration */: return 223 /* EnumDeclaration */; + case 148 /* GetAccessor */: return 123 /* GetKeyword */; + case 149 /* SetAccessor */: return 130 /* SetKeyword */; + case 146 /* MethodDeclaration */: if (node.asteriskToken) { return 37 /* AsteriskToken */; } // fall-through - case 143 /* PropertyDeclaration */: - case 140 /* Parameter */: + case 144 /* PropertyDeclaration */: + case 141 /* Parameter */: return node.name.kind; } } @@ -46138,7 +48102,7 @@ var ts; consumeTokenAndAdvanceScanner(tokenInfo, node, parentDynamicIndentation, child); return inheritedIndentation; } - var effectiveParentStartLine = child.kind === 141 /* Decorator */ ? childStartLine : undecoratedParentStartLine; + var effectiveParentStartLine = child.kind === 142 /* Decorator */ ? childStartLine : undecoratedParentStartLine; var childIndentation = computeIndentation(child, childStartLine, childIndentationAmount, node, parentDynamicIndentation, effectiveParentStartLine); processNode(child, childContextNode, childStartLine, undecoratedChildStartLine, childIndentation.indentation, childIndentation.delta); childContextNode = node; @@ -46171,8 +48135,8 @@ var ts; } } var inheritedIndentation = -1 /* Unknown */; - for (var _i = 0, nodes_6 = nodes; _i < nodes_6.length; _i++) { - var child = nodes_6[_i]; + for (var _i = 0, nodes_7 = nodes; _i < nodes_7.length; _i++) { + var child = nodes_7[_i]; inheritedIndentation = processChildNode(child, inheritedIndentation, node, listDynamicIndentation, startLine, startLine, /*isListElement*/ true); } if (listEndToken !== 0 /* Unknown */) { @@ -46482,20 +48446,20 @@ var ts; } function isSomeBlock(kind) { switch (kind) { - case 196 /* Block */: - case 223 /* ModuleBlock */: + case 198 /* Block */: + case 225 /* ModuleBlock */: return true; } return false; } function getOpenTokenForList(node, list) { switch (node.kind) { - case 146 /* Constructor */: - case 217 /* FunctionDeclaration */: - case 177 /* FunctionExpression */: - case 145 /* MethodDeclaration */: - case 144 /* MethodSignature */: - case 178 /* ArrowFunction */: + case 147 /* Constructor */: + case 219 /* FunctionDeclaration */: + case 178 /* FunctionExpression */: + case 146 /* MethodDeclaration */: + case 145 /* MethodSignature */: + case 179 /* ArrowFunction */: if (node.typeParameters === list) { return 25 /* LessThanToken */; } @@ -46503,8 +48467,8 @@ var ts; return 17 /* OpenParenToken */; } break; - case 172 /* CallExpression */: - case 173 /* NewExpression */: + case 173 /* CallExpression */: + case 174 /* NewExpression */: if (node.typeArguments === list) { return 25 /* LessThanToken */; } @@ -46512,7 +48476,7 @@ var ts; return 17 /* OpenParenToken */; } break; - case 153 /* TypeReference */: + case 154 /* TypeReference */: if (node.typeArguments === list) { return 25 /* LessThanToken */; } @@ -46628,7 +48592,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 !== 185 /* BinaryExpression */) { + if (precedingToken.kind === 24 /* CommaToken */ && precedingToken.parent.kind !== 186 /* 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 */) { @@ -46747,7 +48711,7 @@ var ts; // - 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 === 252 /* SourceFile */ || !parentAndChildShareLine); + (parent.kind === 255 /* SourceFile */ || !parentAndChildShareLine); if (!useActualIndentation) { return -1 /* Unknown */; } @@ -46780,7 +48744,7 @@ var ts; return sourceFile.getLineAndCharacterOfPosition(n.getStart(sourceFile)); } function childStartsOnTheSameLineWithElseInIfStatement(parent, child, childStartLine, sourceFile) { - if (parent.kind === 200 /* IfStatement */ && parent.elseStatement === child) { + if (parent.kind === 202 /* IfStatement */ && parent.elseStatement === child) { var elseKeyword = ts.findChildOfKind(parent, 80 /* ElseKeyword */, sourceFile); ts.Debug.assert(elseKeyword !== undefined); var elseKeywordStartLine = getStartLineAndCharacterForNode(elseKeyword, sourceFile).line; @@ -46792,23 +48756,23 @@ var ts; function getContainingList(node, sourceFile) { if (node.parent) { switch (node.parent.kind) { - case 153 /* TypeReference */: + case 154 /* TypeReference */: if (node.parent.typeArguments && ts.rangeContainsStartEnd(node.parent.typeArguments, node.getStart(sourceFile), node.getEnd())) { return node.parent.typeArguments; } break; - case 169 /* ObjectLiteralExpression */: + case 170 /* ObjectLiteralExpression */: return node.parent.properties; - case 168 /* ArrayLiteralExpression */: + case 169 /* ArrayLiteralExpression */: return node.parent.elements; - case 217 /* FunctionDeclaration */: - case 177 /* FunctionExpression */: - case 178 /* ArrowFunction */: - case 145 /* MethodDeclaration */: - case 144 /* MethodSignature */: - case 149 /* CallSignature */: - case 150 /* ConstructSignature */: { + case 219 /* FunctionDeclaration */: + case 178 /* FunctionExpression */: + case 179 /* ArrowFunction */: + case 146 /* MethodDeclaration */: + case 145 /* MethodSignature */: + case 150 /* CallSignature */: + case 151 /* ConstructSignature */: { var start = node.getStart(sourceFile); if (node.parent.typeParameters && ts.rangeContainsStartEnd(node.parent.typeParameters, start, node.getEnd())) { @@ -46819,8 +48783,8 @@ var ts; } break; } - case 173 /* NewExpression */: - case 172 /* CallExpression */: { + case 174 /* NewExpression */: + case 173 /* CallExpression */: { var start = node.getStart(sourceFile); if (node.parent.typeArguments && ts.rangeContainsStartEnd(node.parent.typeArguments, start, node.getEnd())) { @@ -46850,8 +48814,8 @@ var ts; if (node.kind === 18 /* CloseParenToken */) { return -1 /* Unknown */; } - if (node.parent && (node.parent.kind === 172 /* CallExpression */ || - node.parent.kind === 173 /* NewExpression */) && + if (node.parent && (node.parent.kind === 173 /* CallExpression */ || + node.parent.kind === 174 /* NewExpression */) && node.parent.expression !== node) { var fullCallOrNewExpression = node.parent.expression; var startingExpression = getStartingExpression(fullCallOrNewExpression); @@ -46869,10 +48833,10 @@ var ts; function getStartingExpression(node) { while (true) { switch (node.kind) { - case 172 /* CallExpression */: - case 173 /* NewExpression */: - case 170 /* PropertyAccessExpression */: - case 171 /* ElementAccessExpression */: + case 173 /* CallExpression */: + case 174 /* NewExpression */: + case 171 /* PropertyAccessExpression */: + case 172 /* ElementAccessExpression */: node = node.expression; break; default: @@ -46936,45 +48900,45 @@ var ts; SmartIndenter.findFirstNonWhitespaceColumn = findFirstNonWhitespaceColumn; function nodeContentIsAlwaysIndented(kind) { switch (kind) { - case 199 /* ExpressionStatement */: - case 218 /* ClassDeclaration */: - case 190 /* ClassExpression */: - case 219 /* InterfaceDeclaration */: - case 221 /* EnumDeclaration */: - case 220 /* TypeAliasDeclaration */: - case 168 /* ArrayLiteralExpression */: - case 196 /* Block */: - case 223 /* ModuleBlock */: - case 169 /* ObjectLiteralExpression */: - case 157 /* TypeLiteral */: - case 159 /* TupleType */: - case 224 /* CaseBlock */: - case 246 /* DefaultClause */: - case 245 /* CaseClause */: - case 176 /* ParenthesizedExpression */: - case 170 /* PropertyAccessExpression */: - case 172 /* CallExpression */: - case 173 /* NewExpression */: - case 197 /* VariableStatement */: - case 215 /* VariableDeclaration */: - case 231 /* ExportAssignment */: - case 208 /* ReturnStatement */: - case 186 /* ConditionalExpression */: - case 166 /* ArrayBindingPattern */: - case 165 /* ObjectBindingPattern */: - case 239 /* JsxOpeningElement */: - case 238 /* JsxSelfClosingElement */: - case 244 /* JsxExpression */: - case 144 /* MethodSignature */: - case 149 /* CallSignature */: - case 150 /* ConstructSignature */: - case 140 /* Parameter */: - case 154 /* FunctionType */: - case 155 /* ConstructorType */: - case 162 /* ParenthesizedType */: - case 174 /* TaggedTemplateExpression */: - case 182 /* AwaitExpression */: - case 229 /* NamedImports */: + case 201 /* ExpressionStatement */: + case 220 /* ClassDeclaration */: + case 191 /* ClassExpression */: + case 221 /* InterfaceDeclaration */: + case 223 /* EnumDeclaration */: + case 222 /* TypeAliasDeclaration */: + case 169 /* ArrayLiteralExpression */: + case 198 /* Block */: + case 225 /* ModuleBlock */: + case 170 /* ObjectLiteralExpression */: + case 158 /* TypeLiteral */: + case 160 /* TupleType */: + case 226 /* CaseBlock */: + case 249 /* DefaultClause */: + case 248 /* CaseClause */: + case 177 /* ParenthesizedExpression */: + case 171 /* PropertyAccessExpression */: + case 173 /* CallExpression */: + case 174 /* NewExpression */: + case 199 /* VariableStatement */: + case 217 /* VariableDeclaration */: + case 234 /* ExportAssignment */: + case 210 /* ReturnStatement */: + case 187 /* ConditionalExpression */: + case 167 /* ArrayBindingPattern */: + case 166 /* ObjectBindingPattern */: + case 242 /* JsxOpeningElement */: + case 241 /* JsxSelfClosingElement */: + case 247 /* JsxExpression */: + case 145 /* MethodSignature */: + case 150 /* CallSignature */: + case 151 /* ConstructSignature */: + case 141 /* Parameter */: + case 155 /* FunctionType */: + case 156 /* ConstructorType */: + case 163 /* ParenthesizedType */: + case 175 /* TaggedTemplateExpression */: + case 183 /* AwaitExpression */: + case 232 /* NamedImports */: return true; } return false; @@ -46983,22 +48947,22 @@ var ts; function nodeWillIndentChild(parent, child, indentByDefault) { var childKind = child ? child.kind : 0 /* Unknown */; switch (parent.kind) { - case 201 /* DoStatement */: - case 202 /* WhileStatement */: - case 204 /* ForInStatement */: - case 205 /* ForOfStatement */: - case 203 /* ForStatement */: - case 200 /* IfStatement */: - case 217 /* FunctionDeclaration */: - case 177 /* FunctionExpression */: - case 145 /* MethodDeclaration */: - case 178 /* ArrowFunction */: - case 146 /* Constructor */: - case 147 /* GetAccessor */: - case 148 /* SetAccessor */: - return childKind !== 196 /* Block */; - case 237 /* JsxElement */: - return childKind !== 241 /* JsxClosingElement */; + case 203 /* DoStatement */: + case 204 /* WhileStatement */: + case 206 /* ForInStatement */: + case 207 /* ForOfStatement */: + case 205 /* ForStatement */: + case 202 /* IfStatement */: + case 219 /* FunctionDeclaration */: + case 178 /* FunctionExpression */: + case 146 /* MethodDeclaration */: + case 179 /* ArrowFunction */: + case 147 /* Constructor */: + case 148 /* GetAccessor */: + case 149 /* SetAccessor */: + return childKind !== 198 /* Block */; + case 240 /* JsxElement */: + return childKind !== 244 /* JsxClosingElement */; } // No explicit rule for given nodes so the result will follow the default value argument return indentByDefault; @@ -47022,6 +48986,7 @@ var ts; /// /// /// +/// /// /// var ts; @@ -47145,11 +49110,11 @@ var ts; return pos; }; NodeObject.prototype.createSyntaxList = function (nodes) { - var list = createNode(275 /* SyntaxList */, nodes.pos, nodes.end, 0, this); + var list = createNode(278 /* SyntaxList */, nodes.pos, nodes.end, 0, this); list._children = []; var pos = nodes.pos; - for (var _i = 0, nodes_7 = nodes; _i < nodes_7.length; _i++) { - var node = nodes_7[_i]; + for (var _i = 0, nodes_8 = nodes; _i < nodes_8.length; _i++) { + var node = nodes_8[_i]; if (pos < node.pos) { pos = this.addSyntheticNodes(list._children, pos, node.pos); } @@ -47164,7 +49129,7 @@ var ts; NodeObject.prototype.createChildren = function (sourceFile) { var _this = this; var children; - if (this.kind >= 137 /* FirstNode */) { + if (this.kind >= 138 /* FirstNode */) { scanner.setText((sourceFile || this.getSourceFile()).text); children = []; var pos_3 = this.pos; @@ -47211,7 +49176,7 @@ var ts; return undefined; } var child = children[0]; - return child.kind < 137 /* FirstNode */ ? child : child.getFirstToken(sourceFile); + return child.kind < 138 /* FirstNode */ ? child : child.getFirstToken(sourceFile); }; NodeObject.prototype.getLastToken = function (sourceFile) { var children = this.getChildren(sourceFile); @@ -47219,7 +49184,7 @@ var ts; if (!child) { return undefined; } - return child.kind < 137 /* FirstNode */ ? child : child.getLastToken(sourceFile); + return child.kind < 138 /* FirstNode */ ? child : child.getLastToken(sourceFile); }; return NodeObject; }()); @@ -47268,7 +49233,7 @@ var ts; if (ts.indexOf(declarations, declaration) === indexOfDeclaration) { var sourceFileOfDeclaration_1 = 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 === 140 /* Parameter */) { + if (canUseParsedParamTagComments && declaration.kind === 141 /* Parameter */) { ts.forEach(getJsDocCommentTextRange(declaration.parent, sourceFileOfDeclaration_1), function (jsDocCommentTextRange) { var cleanedParamJsDocComment = getCleanedParamJsDocComment(jsDocCommentTextRange.pos, jsDocCommentTextRange.end, sourceFileOfDeclaration_1); if (cleanedParamJsDocComment) { @@ -47277,15 +49242,15 @@ var ts; }); } // If this is left side of dotted module declaration, there is no doc comments associated with this node - if (declaration.kind === 222 /* ModuleDeclaration */ && declaration.body.kind === 222 /* ModuleDeclaration */) { + if (declaration.kind === 224 /* ModuleDeclaration */ && declaration.body.kind === 224 /* ModuleDeclaration */) { return; } // If this is dotted module name, get the doc comments from the parent - while (declaration.kind === 222 /* ModuleDeclaration */ && declaration.parent.kind === 222 /* ModuleDeclaration */) { + while (declaration.kind === 224 /* ModuleDeclaration */ && declaration.parent.kind === 224 /* ModuleDeclaration */) { declaration = declaration.parent; } // Get the cleaned js doc comment text from the declaration - ts.forEach(getJsDocCommentTextRange(declaration.kind === 215 /* VariableDeclaration */ ? declaration.parent.parent : declaration, sourceFileOfDeclaration_1), function (jsDocCommentTextRange) { + ts.forEach(getJsDocCommentTextRange(declaration.kind === 217 /* VariableDeclaration */ ? declaration.parent.parent : declaration, sourceFileOfDeclaration_1), function (jsDocCommentTextRange) { var cleanedJsDocComment = getCleanedJsDocComment(jsDocCommentTextRange.pos, jsDocCommentTextRange.end, sourceFileOfDeclaration_1); if (cleanedJsDocComment) { ts.addRange(jsDocCommentParts, cleanedJsDocComment); @@ -47630,9 +49595,9 @@ var ts; if (result_2 !== undefined) { return result_2; } - if (declaration.name.kind === 138 /* ComputedPropertyName */) { + if (declaration.name.kind === 139 /* ComputedPropertyName */) { var expr = declaration.name.expression; - if (expr.kind === 170 /* PropertyAccessExpression */) { + if (expr.kind === 171 /* PropertyAccessExpression */) { return expr.name.text; } return getTextOfIdentifierOrLiteral(expr); @@ -47652,9 +49617,9 @@ var ts; } function visit(node) { switch (node.kind) { - case 217 /* FunctionDeclaration */: - case 145 /* MethodDeclaration */: - case 144 /* MethodSignature */: + case 219 /* FunctionDeclaration */: + case 146 /* MethodDeclaration */: + case 145 /* MethodSignature */: var functionDeclaration = node; var declarationName = getDeclarationName(functionDeclaration); if (declarationName) { @@ -47674,60 +49639,60 @@ var ts; ts.forEachChild(node, visit); } break; - case 218 /* ClassDeclaration */: - case 219 /* InterfaceDeclaration */: - case 220 /* TypeAliasDeclaration */: - case 221 /* EnumDeclaration */: - case 222 /* ModuleDeclaration */: - case 225 /* ImportEqualsDeclaration */: - case 234 /* ExportSpecifier */: - case 230 /* ImportSpecifier */: - case 225 /* ImportEqualsDeclaration */: - case 227 /* ImportClause */: - case 228 /* NamespaceImport */: - case 147 /* GetAccessor */: - case 148 /* SetAccessor */: - case 157 /* TypeLiteral */: + case 220 /* ClassDeclaration */: + case 221 /* InterfaceDeclaration */: + case 222 /* TypeAliasDeclaration */: + case 223 /* EnumDeclaration */: + case 224 /* ModuleDeclaration */: + case 228 /* ImportEqualsDeclaration */: + case 237 /* ExportSpecifier */: + case 233 /* ImportSpecifier */: + case 228 /* ImportEqualsDeclaration */: + case 230 /* ImportClause */: + case 231 /* NamespaceImport */: + case 148 /* GetAccessor */: + case 149 /* SetAccessor */: + case 158 /* TypeLiteral */: addDeclaration(node); // fall through - case 146 /* Constructor */: - case 197 /* VariableStatement */: - case 216 /* VariableDeclarationList */: - case 165 /* ObjectBindingPattern */: - case 166 /* ArrayBindingPattern */: - case 223 /* ModuleBlock */: + case 147 /* Constructor */: + case 199 /* VariableStatement */: + case 218 /* VariableDeclarationList */: + case 166 /* ObjectBindingPattern */: + case 167 /* ArrayBindingPattern */: + case 225 /* ModuleBlock */: ts.forEachChild(node, visit); break; - case 196 /* Block */: + case 198 /* Block */: if (ts.isFunctionBlock(node)) { ts.forEachChild(node, visit); } break; - case 140 /* Parameter */: + case 141 /* Parameter */: // Only consider properties defined as constructor parameters if (!(node.flags & 28 /* AccessibilityModifier */)) { break; } // fall through - case 215 /* VariableDeclaration */: - case 167 /* BindingElement */: + case 217 /* VariableDeclaration */: + case 168 /* BindingElement */: if (ts.isBindingPattern(node.name)) { ts.forEachChild(node.name, visit); break; } - case 251 /* EnumMember */: - case 143 /* PropertyDeclaration */: - case 142 /* PropertySignature */: + case 254 /* EnumMember */: + case 144 /* PropertyDeclaration */: + case 143 /* PropertySignature */: addDeclaration(node); break; - case 232 /* ExportDeclaration */: + case 235 /* 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 226 /* ImportDeclaration */: + case 229 /* ImportDeclaration */: var importClause = node.importClause; if (importClause) { // Handle default import case e.g.: @@ -47739,7 +49704,7 @@ var ts; // import * as NS from "mod"; // import {a, b as B} from "mod"; if (importClause.namedBindings) { - if (importClause.namedBindings.kind === 228 /* NamespaceImport */) { + if (importClause.namedBindings.kind === 231 /* NamespaceImport */) { addDeclaration(importClause.namedBindings); } else { @@ -47961,16 +49926,16 @@ var ts; } return ts.forEach(symbol.declarations, function (declaration) { // Function expressions are local - if (declaration.kind === 177 /* FunctionExpression */) { + if (declaration.kind === 178 /* FunctionExpression */) { return true; } - if (declaration.kind !== 215 /* VariableDeclaration */ && declaration.kind !== 217 /* FunctionDeclaration */) { + if (declaration.kind !== 217 /* VariableDeclaration */ && declaration.kind !== 219 /* FunctionDeclaration */) { return false; } // If the parent is not sourceFile or module block it is local variable - for (var parent_10 = declaration.parent; !ts.isFunctionBlock(parent_10); parent_10 = parent_10.parent) { + for (var parent_12 = declaration.parent; !ts.isFunctionBlock(parent_12); parent_12 = parent_12.parent) { // Reached source file or module block - if (parent_10.kind === 252 /* SourceFile */ || parent_10.kind === 223 /* ModuleBlock */) { + if (parent_12.kind === 255 /* SourceFile */ || parent_12.kind === 225 /* ModuleBlock */) { return false; } } @@ -48010,14 +49975,13 @@ var ts; }; HostCache.prototype.createEntry = function (fileName, path) { var entry; - var scriptKind = this.host.getScriptKind ? this.host.getScriptKind(fileName) : 0 /* Unknown */; var scriptSnapshot = this.host.getScriptSnapshot(fileName); if (scriptSnapshot) { entry = { hostFileName: fileName, version: this.host.getScriptVersion(fileName), scriptSnapshot: scriptSnapshot, - scriptKind: scriptKind ? scriptKind : ts.getScriptKindFromFileName(fileName) + scriptKind: ts.getScriptKind(fileName, this.host) }; } this.fileNameToEntry.set(path, entry); @@ -48065,7 +50029,7 @@ var ts; // The host does not know about this file. throw new Error("Could not find file: '" + fileName + "'."); } - var scriptKind = this.host.getScriptKind ? this.host.getScriptKind(fileName) : 0 /* Unknown */; + var scriptKind = ts.getScriptKind(fileName, this.host); var version = this.host.getScriptVersion(fileName); var sourceFile; if (this.currentFileName !== fileName) { @@ -48326,9 +50290,24 @@ var ts; 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) { @@ -48338,25 +50317,37 @@ var ts; isNoDefaultLib = referencePathMatchResult.isNoDefaultLib; var fileReference = referencePathMatchResult.fileReference; if (fileReference) { - referencedFiles.push(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(scanner.getTokenValue()); + ambientExternalModules.push({ ref: getFileReference(), depth: braceNesting }); } function recordModuleName() { - var importPath = scanner.getTokenValue(); - var pos = scanner.getTokenPos(); - importedFiles.push({ - fileName: importPath, - pos: pos, - end: pos + importPath.length - }); + importedFiles.push(getFileReference()); + markAsExternalModuleIfTopLevel(); + } + function markAsExternalModuleIfTopLevel() { + if (braceNesting === 0) { + externalModule = true; + } } /** * Returns true if at least one token was consumed from the stream @@ -48365,9 +50356,9 @@ var ts; var token = scanner.getToken(); if (token === 122 /* DeclareKeyword */) { // declare module "mod" - token = scanner.scan(); + token = nextToken(); if (token === 125 /* ModuleKeyword */) { - token = scanner.scan(); + token = nextToken(); if (token === 9 /* StringLiteral */) { recordAmbientExternalModule(); } @@ -48382,7 +50373,7 @@ var ts; function tryConsumeImport() { var token = scanner.getToken(); if (token === 89 /* ImportKeyword */) { - token = scanner.scan(); + token = nextToken(); if (token === 9 /* StringLiteral */) { // import "mod"; recordModuleName(); @@ -48390,9 +50381,9 @@ var ts; } else { if (token === 69 /* Identifier */ || ts.isKeyword(token)) { - token = scanner.scan(); - if (token === 134 /* FromKeyword */) { - token = scanner.scan(); + token = nextToken(); + if (token === 135 /* FromKeyword */) { + token = nextToken(); if (token === 9 /* StringLiteral */) { // import d from "mod"; recordModuleName(); @@ -48406,7 +50397,7 @@ var ts; } else if (token === 24 /* CommaToken */) { // consume comma and keep going - token = scanner.scan(); + token = nextToken(); } else { // unknown syntax @@ -48414,16 +50405,16 @@ var ts; } } if (token === 15 /* OpenBraceToken */) { - token = scanner.scan(); + 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 = scanner.scan(); + token = nextToken(); } if (token === 16 /* CloseBraceToken */) { - token = scanner.scan(); - if (token === 134 /* FromKeyword */) { - token = scanner.scan(); + token = nextToken(); + if (token === 135 /* FromKeyword */) { + token = nextToken(); if (token === 9 /* StringLiteral */) { // import {a as A} from "mod"; // import d, {a, b as B} from "mod" @@ -48433,13 +50424,13 @@ var ts; } } else if (token === 37 /* AsteriskToken */) { - token = scanner.scan(); + token = nextToken(); if (token === 116 /* AsKeyword */) { - token = scanner.scan(); + token = nextToken(); if (token === 69 /* Identifier */ || ts.isKeyword(token)) { - token = scanner.scan(); - if (token === 134 /* FromKeyword */) { - token = scanner.scan(); + token = nextToken(); + if (token === 135 /* FromKeyword */) { + token = nextToken(); if (token === 9 /* StringLiteral */) { // import * as NS from "mod" // import d, * as NS from "mod" @@ -48457,18 +50448,19 @@ var ts; function tryConsumeExport() { var token = scanner.getToken(); if (token === 82 /* ExportKeyword */) { - token = scanner.scan(); + markAsExternalModuleIfTopLevel(); + token = nextToken(); if (token === 15 /* OpenBraceToken */) { - token = scanner.scan(); + 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 = scanner.scan(); + token = nextToken(); } if (token === 16 /* CloseBraceToken */) { - token = scanner.scan(); - if (token === 134 /* FromKeyword */) { - token = scanner.scan(); + token = nextToken(); + if (token === 135 /* FromKeyword */) { + token = nextToken(); if (token === 9 /* StringLiteral */) { // export {a as A} from "mod"; // export {a, b as B} from "mod" @@ -48478,9 +50470,9 @@ var ts; } } else if (token === 37 /* AsteriskToken */) { - token = scanner.scan(); - if (token === 134 /* FromKeyword */) { - token = scanner.scan(); + token = nextToken(); + if (token === 135 /* FromKeyword */) { + token = nextToken(); if (token === 9 /* StringLiteral */) { // export * from "mod" recordModuleName(); @@ -48488,9 +50480,9 @@ var ts; } } else if (token === 89 /* ImportKeyword */) { - token = scanner.scan(); + token = nextToken(); if (token === 69 /* Identifier */ || ts.isKeyword(token)) { - token = scanner.scan(); + token = nextToken(); if (token === 56 /* EqualsToken */) { if (tryConsumeRequireCall(/*skipCurrentToken*/ true)) { return true; @@ -48503,11 +50495,11 @@ var ts; return false; } function tryConsumeRequireCall(skipCurrentToken) { - var token = skipCurrentToken ? scanner.scan() : scanner.getToken(); + var token = skipCurrentToken ? nextToken() : scanner.getToken(); if (token === 128 /* RequireKeyword */) { - token = scanner.scan(); + token = nextToken(); if (token === 17 /* OpenParenToken */) { - token = scanner.scan(); + token = nextToken(); if (token === 9 /* StringLiteral */) { // require("mod"); recordModuleName(); @@ -48520,16 +50512,16 @@ var ts; function tryConsumeDefine() { var token = scanner.getToken(); if (token === 69 /* Identifier */ && scanner.getTokenValue() === "define") { - token = scanner.scan(); + token = nextToken(); if (token !== 17 /* OpenParenToken */) { return true; } - token = scanner.scan(); + token = nextToken(); if (token === 9 /* StringLiteral */) { // looks like define ("modname", ... - skip string literal and comma - token = scanner.scan(); + token = nextToken(); if (token === 24 /* CommaToken */) { - token = scanner.scan(); + token = nextToken(); } else { // unexpected token @@ -48541,7 +50533,7 @@ var ts; return true; } // skip open bracket - token = scanner.scan(); + token = nextToken(); var i = 0; // scan until ']' or EOF while (token !== 20 /* CloseBracketToken */ && token !== 1 /* EndOfFileToken */) { @@ -48550,7 +50542,7 @@ var ts; recordModuleName(); i++; } - token = scanner.scan(); + token = nextToken(); } return true; } @@ -48558,7 +50550,7 @@ var ts; } function processImports() { scanner.setText(sourceText); - scanner.scan(); + nextToken(); // Look for: // import "mod"; // import d from "mod" @@ -48583,7 +50575,7 @@ var ts; continue; } else { - scanner.scan(); + nextToken(); } } scanner.setText(undefined); @@ -48592,13 +50584,42 @@ var ts; processImports(); } processTripleSlashDirectives(); - return { referencedFiles: referencedFiles, importedFiles: importedFiles, isLibFile: isNoDefaultLib, ambientExternalModules: ambientExternalModules }; + 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 === 211 /* LabeledStatement */ && referenceNode.label.text === labelName) { + if (referenceNode.kind === 213 /* LabeledStatement */ && referenceNode.label.text === labelName) { return referenceNode.label; } referenceNode = referenceNode.parent; @@ -48607,12 +50628,12 @@ var ts; } function isJumpStatementTarget(node) { return node.kind === 69 /* Identifier */ && - (node.parent.kind === 207 /* BreakStatement */ || node.parent.kind === 206 /* ContinueStatement */) && + (node.parent.kind === 209 /* BreakStatement */ || node.parent.kind === 208 /* ContinueStatement */) && node.parent.label === node; } function isLabelOfLabeledStatement(node) { return node.kind === 69 /* Identifier */ && - node.parent.kind === 211 /* LabeledStatement */ && + node.parent.kind === 213 /* LabeledStatement */ && node.parent.label === node; } /** @@ -48620,7 +50641,7 @@ var ts; * Note: 'node' cannot be a SourceFile. */ function isLabeledBy(node, labelName) { - for (var owner = node.parent; owner.kind === 211 /* LabeledStatement */; owner = owner.parent) { + for (var owner = node.parent; owner.kind === 213 /* LabeledStatement */; owner = owner.parent) { if (owner.label.text === labelName) { return true; } @@ -48631,25 +50652,25 @@ var ts; return isLabelOfLabeledStatement(node) || isJumpStatementTarget(node); } function isRightSideOfQualifiedName(node) { - return node.parent.kind === 137 /* QualifiedName */ && node.parent.right === node; + return node.parent.kind === 138 /* QualifiedName */ && node.parent.right === node; } function isRightSideOfPropertyAccess(node) { - return node && node.parent && node.parent.kind === 170 /* PropertyAccessExpression */ && node.parent.name === node; + return node && node.parent && node.parent.kind === 171 /* PropertyAccessExpression */ && node.parent.name === node; } function isCallExpressionTarget(node) { if (isRightSideOfPropertyAccess(node)) { node = node.parent; } - return node && node.parent && node.parent.kind === 172 /* CallExpression */ && node.parent.expression === node; + return node && node.parent && node.parent.kind === 173 /* CallExpression */ && node.parent.expression === node; } function isNewExpressionTarget(node) { if (isRightSideOfPropertyAccess(node)) { node = node.parent; } - return node && node.parent && node.parent.kind === 173 /* NewExpression */ && node.parent.expression === node; + return node && node.parent && node.parent.kind === 174 /* NewExpression */ && node.parent.expression === node; } function isNameOfModuleDeclaration(node) { - return node.parent.kind === 222 /* ModuleDeclaration */ && node.parent.name === node; + return node.parent.kind === 224 /* ModuleDeclaration */ && node.parent.name === node; } function isNameOfFunctionDeclaration(node) { return node.kind === 69 /* Identifier */ && @@ -48658,22 +50679,22 @@ var ts; /** Returns true if node is a name of an object literal property, e.g. "a" in x = { "a": 1 } */ function isNameOfPropertyAssignment(node) { return (node.kind === 69 /* Identifier */ || node.kind === 9 /* StringLiteral */ || node.kind === 8 /* NumericLiteral */) && - (node.parent.kind === 249 /* PropertyAssignment */ || node.parent.kind === 250 /* ShorthandPropertyAssignment */) && node.parent.name === node; + (node.parent.kind === 252 /* PropertyAssignment */ || node.parent.kind === 253 /* ShorthandPropertyAssignment */) && node.parent.name === node; } function isLiteralNameOfPropertyDeclarationOrIndexAccess(node) { if (node.kind === 9 /* StringLiteral */ || node.kind === 8 /* NumericLiteral */) { switch (node.parent.kind) { - case 143 /* PropertyDeclaration */: - case 142 /* PropertySignature */: - case 249 /* PropertyAssignment */: - case 251 /* EnumMember */: - case 145 /* MethodDeclaration */: - case 144 /* MethodSignature */: - case 147 /* GetAccessor */: - case 148 /* SetAccessor */: - case 222 /* ModuleDeclaration */: + case 144 /* PropertyDeclaration */: + case 143 /* PropertySignature */: + case 252 /* PropertyAssignment */: + case 254 /* EnumMember */: + case 146 /* MethodDeclaration */: + case 145 /* MethodSignature */: + case 148 /* GetAccessor */: + case 149 /* SetAccessor */: + case 224 /* ModuleDeclaration */: return node.parent.name === node; - case 171 /* ElementAccessExpression */: + case 172 /* ElementAccessExpression */: return node.parent.argumentExpression === node; } } @@ -48732,7 +50753,7 @@ var ts; })(BreakContinueSearchType || (BreakContinueSearchType = {})); // A cache of completion entries for keywords, these do not change between sessions var keywordCompletions = []; - for (var i = 70 /* FirstKeyword */; i <= 136 /* LastKeyword */; i++) { + for (var i = 70 /* FirstKeyword */; i <= 137 /* LastKeyword */; i++) { keywordCompletions.push({ name: ts.tokenToString(i), kind: ScriptElementKind.keyword, @@ -48747,17 +50768,17 @@ var ts; return undefined; } switch (node.kind) { - case 252 /* SourceFile */: - case 145 /* MethodDeclaration */: - case 144 /* MethodSignature */: - case 217 /* FunctionDeclaration */: - case 177 /* FunctionExpression */: - case 147 /* GetAccessor */: - case 148 /* SetAccessor */: - case 218 /* ClassDeclaration */: - case 219 /* InterfaceDeclaration */: - case 221 /* EnumDeclaration */: - case 222 /* ModuleDeclaration */: + case 255 /* SourceFile */: + case 146 /* MethodDeclaration */: + case 145 /* MethodSignature */: + case 219 /* FunctionDeclaration */: + case 178 /* FunctionExpression */: + case 148 /* GetAccessor */: + case 149 /* SetAccessor */: + case 220 /* ClassDeclaration */: + case 221 /* InterfaceDeclaration */: + case 223 /* EnumDeclaration */: + case 224 /* ModuleDeclaration */: return node; } } @@ -48765,38 +50786,38 @@ var ts; ts.getContainerNode = getContainerNode; /* @internal */ function getNodeKind(node) { switch (node.kind) { - case 222 /* ModuleDeclaration */: return ScriptElementKind.moduleElement; - case 218 /* ClassDeclaration */: return ScriptElementKind.classElement; - case 219 /* InterfaceDeclaration */: return ScriptElementKind.interfaceElement; - case 220 /* TypeAliasDeclaration */: return ScriptElementKind.typeElement; - case 221 /* EnumDeclaration */: return ScriptElementKind.enumElement; - case 215 /* VariableDeclaration */: + case 224 /* ModuleDeclaration */: return ScriptElementKind.moduleElement; + case 220 /* ClassDeclaration */: return ScriptElementKind.classElement; + case 221 /* InterfaceDeclaration */: return ScriptElementKind.interfaceElement; + case 222 /* TypeAliasDeclaration */: return ScriptElementKind.typeElement; + case 223 /* EnumDeclaration */: return ScriptElementKind.enumElement; + case 217 /* VariableDeclaration */: return ts.isConst(node) ? ScriptElementKind.constElement : ts.isLet(node) ? ScriptElementKind.letElement : ScriptElementKind.variableElement; - case 217 /* FunctionDeclaration */: return ScriptElementKind.functionElement; - case 147 /* GetAccessor */: return ScriptElementKind.memberGetAccessorElement; - case 148 /* SetAccessor */: return ScriptElementKind.memberSetAccessorElement; - case 145 /* MethodDeclaration */: - case 144 /* MethodSignature */: + case 219 /* FunctionDeclaration */: return ScriptElementKind.functionElement; + case 148 /* GetAccessor */: return ScriptElementKind.memberGetAccessorElement; + case 149 /* SetAccessor */: return ScriptElementKind.memberSetAccessorElement; + case 146 /* MethodDeclaration */: + case 145 /* MethodSignature */: return ScriptElementKind.memberFunctionElement; - case 143 /* PropertyDeclaration */: - case 142 /* PropertySignature */: + case 144 /* PropertyDeclaration */: + case 143 /* PropertySignature */: return ScriptElementKind.memberVariableElement; - case 151 /* IndexSignature */: return ScriptElementKind.indexSignatureElement; - case 150 /* ConstructSignature */: return ScriptElementKind.constructSignatureElement; - case 149 /* CallSignature */: return ScriptElementKind.callSignatureElement; - case 146 /* Constructor */: return ScriptElementKind.constructorImplementationElement; - case 139 /* TypeParameter */: return ScriptElementKind.typeParameterElement; - case 251 /* EnumMember */: return ScriptElementKind.variableElement; - case 140 /* Parameter */: return (node.flags & 28 /* AccessibilityModifier */) ? ScriptElementKind.memberVariableElement : ScriptElementKind.parameterElement; - case 225 /* ImportEqualsDeclaration */: - case 230 /* ImportSpecifier */: - case 227 /* ImportClause */: - case 234 /* ExportSpecifier */: - case 228 /* NamespaceImport */: + case 152 /* IndexSignature */: return ScriptElementKind.indexSignatureElement; + case 151 /* ConstructSignature */: return ScriptElementKind.constructSignatureElement; + case 150 /* CallSignature */: return ScriptElementKind.callSignatureElement; + case 147 /* Constructor */: return ScriptElementKind.constructorImplementationElement; + case 140 /* TypeParameter */: return ScriptElementKind.typeParameterElement; + case 254 /* EnumMember */: return ScriptElementKind.variableElement; + case 141 /* Parameter */: return (node.flags & 28 /* AccessibilityModifier */) ? ScriptElementKind.memberVariableElement : ScriptElementKind.parameterElement; + case 228 /* ImportEqualsDeclaration */: + case 233 /* ImportSpecifier */: + case 230 /* ImportClause */: + case 237 /* ExportSpecifier */: + case 231 /* NamespaceImport */: return ScriptElementKind.alias; } return ScriptElementKind.unknown; @@ -48892,7 +50913,7 @@ var ts; getCurrentDirectory: function () { return currentDirectory; }, fileExists: function (fileName) { // stub missing host functionality - ts.Debug.assert(!host.resolveModuleNames); + ts.Debug.assert(!host.resolveModuleNames || !host.resolveTypeReferenceDirectives); return hostCache.getOrCreateEntry(fileName) !== undefined; }, readFile: function (fileName) { @@ -48901,7 +50922,7 @@ var ts; return entry && entry.scriptSnapshot.getText(0, entry.scriptSnapshot.getLength()); }, directoryExists: function (directoryName) { - ts.Debug.assert(!host.resolveModuleNames); + ts.Debug.assert(!host.resolveModuleNames || !host.resolveTypeReferenceDirectives); return ts.directoryProbablyExists(directoryName, host); } }; @@ -48911,6 +50932,11 @@ var ts; if (host.resolveModuleNames) { compilerHost.resolveModuleNames = function (moduleNames, containingFile) { return host.resolveModuleNames(moduleNames, containingFile); }; } + if (host.resolveTypeReferenceDirectives) { + compilerHost.resolveTypeReferenceDirectives = function (typeReferenceDirectiveNames, containingFile) { + return host.resolveTypeReferenceDirectives(typeReferenceDirectiveNames, containingFile); + }; + } var newProgram = ts.createProgram(hostCache.getRootFileNames(), newSettings, compilerHost, program); // Release any files we have acquired in the old program but are // not part of the new program. @@ -49115,9 +51141,9 @@ var ts; isJsDocTagName = true; } switch (tag.kind) { - case 273 /* JSDocTypeTag */: - case 271 /* JSDocParameterTag */: - case 272 /* JSDocReturnTag */: + case 276 /* JSDocTypeTag */: + case 274 /* JSDocParameterTag */: + case 275 /* JSDocReturnTag */: var tagWithExpression = tag; if (tagWithExpression.typeExpression) { insideJsDocTagExpression = tagWithExpression.typeExpression.pos < position && position < tagWithExpression.typeExpression.end; @@ -49162,13 +51188,13 @@ var ts; log("Returning an empty list because completion was requested in an invalid position."); return undefined; } - var parent_11 = contextToken.parent, kind = contextToken.kind; + var parent_13 = contextToken.parent, kind = contextToken.kind; if (kind === 21 /* DotToken */) { - if (parent_11.kind === 170 /* PropertyAccessExpression */) { + if (parent_13.kind === 171 /* PropertyAccessExpression */) { node = contextToken.parent.expression; isRightOfDot = true; } - else if (parent_11.kind === 137 /* QualifiedName */) { + else if (parent_13.kind === 138 /* QualifiedName */) { node = contextToken.parent.left; isRightOfDot = true; } @@ -49183,7 +51209,7 @@ var ts; isRightOfOpenTag = true; location = contextToken; } - else if (kind === 39 /* SlashToken */ && contextToken.parent.kind === 241 /* JsxClosingElement */) { + else if (kind === 39 /* SlashToken */ && contextToken.parent.kind === 244 /* JsxClosingElement */) { isStartingCloseTag = true; location = contextToken; } @@ -49199,7 +51225,7 @@ var ts; else if (isRightOfOpenTag) { var tagSymbols = typeChecker.getJsxIntrinsicTagNames(); if (tryGetGlobalSymbols()) { - symbols = tagSymbols.concat(symbols.filter(function (s) { return !!(s.flags & 107455 /* Value */); })); + symbols = tagSymbols.concat(symbols.filter(function (s) { return !!(s.flags & (107455 /* Value */ | 8388608 /* Alias */)); })); } else { symbols = tagSymbols; @@ -49230,7 +51256,7 @@ var ts; // Right of dot member completion list isMemberCompletion = true; isNewIdentifierLocation = false; - if (node.kind === 69 /* Identifier */ || node.kind === 137 /* QualifiedName */ || node.kind === 170 /* PropertyAccessExpression */) { + if (node.kind === 69 /* Identifier */ || node.kind === 138 /* QualifiedName */ || node.kind === 171 /* PropertyAccessExpression */) { var symbol = typeChecker.getSymbolAtLocation(node); // This is an alias, follow what it aliases if (symbol && symbol.flags & 8388608 /* Alias */) { @@ -49286,7 +51312,7 @@ var ts; } if (jsxContainer = tryGetContainingJsxElement(contextToken)) { var attrsType = void 0; - if ((jsxContainer.kind === 238 /* JsxSelfClosingElement */) || (jsxContainer.kind === 239 /* JsxOpeningElement */)) { + if ((jsxContainer.kind === 241 /* JsxSelfClosingElement */) || (jsxContainer.kind === 242 /* JsxOpeningElement */)) { // Cursor is inside a JSX self-closing element or opening element attrsType = typeChecker.getJsxElementAttributesType(jsxContainer); if (attrsType) { @@ -49358,15 +51384,15 @@ var ts; return result; } function isInJsxText(contextToken) { - if (contextToken.kind === 240 /* JsxText */) { + if (contextToken.kind === 243 /* JsxText */) { return true; } if (contextToken.kind === 27 /* GreaterThanToken */ && contextToken.parent) { - if (contextToken.parent.kind === 239 /* JsxOpeningElement */) { + if (contextToken.parent.kind === 242 /* JsxOpeningElement */) { return true; } - if (contextToken.parent.kind === 241 /* JsxClosingElement */ || contextToken.parent.kind === 238 /* JsxSelfClosingElement */) { - return contextToken.parent.parent && contextToken.parent.parent.kind === 237 /* JsxElement */; + if (contextToken.parent.kind === 244 /* JsxClosingElement */ || contextToken.parent.kind === 241 /* JsxSelfClosingElement */) { + return contextToken.parent.parent && contextToken.parent.parent.kind === 240 /* JsxElement */; } } return false; @@ -49376,40 +51402,40 @@ var ts; var containingNodeKind = previousToken.parent.kind; switch (previousToken.kind) { case 24 /* CommaToken */: - return containingNodeKind === 172 /* CallExpression */ // func( a, | - || containingNodeKind === 146 /* Constructor */ // constructor( a, | /* public, protected, private keywords are allowed here, so show completion */ - || containingNodeKind === 173 /* NewExpression */ // new C(a, | - || containingNodeKind === 168 /* ArrayLiteralExpression */ // [a, | - || containingNodeKind === 185 /* BinaryExpression */ // const x = (a, | - || containingNodeKind === 154 /* FunctionType */; // var x: (s: string, list| + return containingNodeKind === 173 /* CallExpression */ // func( a, | + || containingNodeKind === 147 /* Constructor */ // constructor( a, | /* public, protected, private keywords are allowed here, so show completion */ + || containingNodeKind === 174 /* NewExpression */ // new C(a, | + || containingNodeKind === 169 /* ArrayLiteralExpression */ // [a, | + || containingNodeKind === 186 /* BinaryExpression */ // const x = (a, | + || containingNodeKind === 155 /* FunctionType */; // var x: (s: string, list| case 17 /* OpenParenToken */: - return containingNodeKind === 172 /* CallExpression */ // func( | - || containingNodeKind === 146 /* Constructor */ // constructor( | - || containingNodeKind === 173 /* NewExpression */ // new C(a| - || containingNodeKind === 176 /* ParenthesizedExpression */ // const x = (a| - || containingNodeKind === 162 /* ParenthesizedType */; // function F(pred: (a| /* this can become an arrow function, where 'a' is the argument */ + return containingNodeKind === 173 /* CallExpression */ // func( | + || containingNodeKind === 147 /* Constructor */ // constructor( | + || containingNodeKind === 174 /* NewExpression */ // new C(a| + || containingNodeKind === 177 /* ParenthesizedExpression */ // const x = (a| + || containingNodeKind === 163 /* ParenthesizedType */; // function F(pred: (a| /* this can become an arrow function, where 'a' is the argument */ case 19 /* OpenBracketToken */: - return containingNodeKind === 168 /* ArrayLiteralExpression */ // [ | - || containingNodeKind === 151 /* IndexSignature */ // [ | : string ] - || containingNodeKind === 138 /* ComputedPropertyName */; // [ | /* this can become an index signature */ + return containingNodeKind === 169 /* ArrayLiteralExpression */ // [ | + || containingNodeKind === 152 /* IndexSignature */ // [ | : string ] + || containingNodeKind === 139 /* ComputedPropertyName */; // [ | /* this can become an index signature */ case 125 /* ModuleKeyword */: // module | case 126 /* NamespaceKeyword */: return true; case 21 /* DotToken */: - return containingNodeKind === 222 /* ModuleDeclaration */; // module A.| + return containingNodeKind === 224 /* ModuleDeclaration */; // module A.| case 15 /* OpenBraceToken */: - return containingNodeKind === 218 /* ClassDeclaration */; // class A{ | + return containingNodeKind === 220 /* ClassDeclaration */; // class A{ | case 56 /* EqualsToken */: - return containingNodeKind === 215 /* VariableDeclaration */ // const x = a| - || containingNodeKind === 185 /* BinaryExpression */; // x = a| + return containingNodeKind === 217 /* VariableDeclaration */ // const x = a| + || containingNodeKind === 186 /* BinaryExpression */; // x = a| case 12 /* TemplateHead */: - return containingNodeKind === 187 /* TemplateExpression */; // `aa ${| + return containingNodeKind === 188 /* TemplateExpression */; // `aa ${| case 13 /* TemplateMiddle */: - return containingNodeKind === 194 /* TemplateSpan */; // `aa ${10} dd ${| + return containingNodeKind === 196 /* TemplateSpan */; // `aa ${10} dd ${| case 112 /* PublicKeyword */: case 110 /* PrivateKeyword */: case 111 /* ProtectedKeyword */: - return containingNodeKind === 143 /* PropertyDeclaration */; // class A{ public | + return containingNodeKind === 144 /* PropertyDeclaration */; // class A{ public | } // Previous token may have been a keyword that was converted to an identifier. switch (previousToken.getText()) { @@ -49423,7 +51449,7 @@ var ts; } function isInStringOrRegularExpressionOrTemplateLiteral(contextToken) { if (contextToken.kind === 9 /* StringLiteral */ - || contextToken.kind === 164 /* StringLiteralType */ + || contextToken.kind === 165 /* StringLiteralType */ || contextToken.kind === 10 /* RegularExpressionLiteral */ || ts.isTemplateLiteralKind(contextToken.kind)) { var start_7 = contextToken.getStart(); @@ -49453,14 +51479,14 @@ var ts; isMemberCompletion = true; var typeForObject; var existingMembers; - if (objectLikeContainer.kind === 169 /* ObjectLiteralExpression */) { + if (objectLikeContainer.kind === 170 /* ObjectLiteralExpression */) { // We are completing on contextual types, but may also include properties // other than those within the declared type. isNewIdentifierLocation = true; typeForObject = typeChecker.getContextualType(objectLikeContainer); existingMembers = objectLikeContainer.properties; } - else if (objectLikeContainer.kind === 165 /* ObjectBindingPattern */) { + else if (objectLikeContainer.kind === 166 /* ObjectBindingPattern */) { // We are *only* completing on properties from the type being destructured. isNewIdentifierLocation = false; var rootDeclaration = ts.getRootDeclaration(objectLikeContainer.parent); @@ -49468,7 +51494,18 @@ var ts; // 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. - if (rootDeclaration.initializer || rootDeclaration.type) { + // Also proceed if rootDeclaration is 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 === 141 /* Parameter */) { + if (ts.isExpression(rootDeclaration.parent)) { + canGetType = !!typeChecker.getContextualType(rootDeclaration.parent); + } + else if (rootDeclaration.parent.kind === 146 /* MethodDeclaration */ || rootDeclaration.parent.kind === 149 /* SetAccessor */) { + canGetType = ts.isExpression(rootDeclaration.parent.parent) && !!typeChecker.getContextualType(rootDeclaration.parent.parent); + } + } + if (canGetType) { typeForObject = typeChecker.getTypeAtLocation(objectLikeContainer); existingMembers = objectLikeContainer.elements; } @@ -49506,9 +51543,9 @@ var ts; * @returns true if 'symbols' was successfully populated; false otherwise. */ function tryGetImportOrExportClauseCompletionSymbols(namedImportsOrExports) { - var declarationKind = namedImportsOrExports.kind === 229 /* NamedImports */ ? - 226 /* ImportDeclaration */ : - 232 /* ExportDeclaration */; + var declarationKind = namedImportsOrExports.kind === 232 /* NamedImports */ ? + 229 /* ImportDeclaration */ : + 235 /* ExportDeclaration */; var importOrExportDeclaration = ts.getAncestor(namedImportsOrExports, declarationKind); var moduleSpecifier = importOrExportDeclaration.moduleSpecifier; if (!moduleSpecifier) { @@ -49533,9 +51570,9 @@ var ts; switch (contextToken.kind) { case 15 /* OpenBraceToken */: // const x = { | case 24 /* CommaToken */: - var parent_12 = contextToken.parent; - if (parent_12 && (parent_12.kind === 169 /* ObjectLiteralExpression */ || parent_12.kind === 165 /* ObjectBindingPattern */)) { - return parent_12; + var parent_14 = contextToken.parent; + if (parent_14 && (parent_14.kind === 170 /* ObjectLiteralExpression */ || parent_14.kind === 166 /* ObjectBindingPattern */)) { + return parent_14; } break; } @@ -49552,8 +51589,8 @@ var ts; case 15 /* OpenBraceToken */: // import { | case 24 /* CommaToken */: switch (contextToken.parent.kind) { - case 229 /* NamedImports */: - case 233 /* NamedExports */: + case 232 /* NamedImports */: + case 236 /* NamedExports */: return contextToken.parent; } } @@ -49562,37 +51599,37 @@ var ts; } function tryGetContainingJsxElement(contextToken) { if (contextToken) { - var parent_13 = contextToken.parent; + var parent_15 = contextToken.parent; switch (contextToken.kind) { case 26 /* LessThanSlashToken */: case 39 /* SlashToken */: case 69 /* Identifier */: - case 242 /* JsxAttribute */: - case 243 /* JsxSpreadAttribute */: - if (parent_13 && (parent_13.kind === 238 /* JsxSelfClosingElement */ || parent_13.kind === 239 /* JsxOpeningElement */)) { - return parent_13; + case 245 /* JsxAttribute */: + case 246 /* JsxSpreadAttribute */: + if (parent_15 && (parent_15.kind === 241 /* JsxSelfClosingElement */ || parent_15.kind === 242 /* JsxOpeningElement */)) { + return parent_15; } - else if (parent_13.kind === 242 /* JsxAttribute */) { - return parent_13.parent; + else if (parent_15.kind === 245 /* JsxAttribute */) { + return parent_15.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_13 && ((parent_13.kind === 242 /* JsxAttribute */) || (parent_13.kind === 243 /* JsxSpreadAttribute */))) { - return parent_13.parent; + if (parent_15 && ((parent_15.kind === 245 /* JsxAttribute */) || (parent_15.kind === 246 /* JsxSpreadAttribute */))) { + return parent_15.parent; } break; case 16 /* CloseBraceToken */: - if (parent_13 && - parent_13.kind === 244 /* JsxExpression */ && - parent_13.parent && - (parent_13.parent.kind === 242 /* JsxAttribute */)) { - return parent_13.parent.parent; + if (parent_15 && + parent_15.kind === 247 /* JsxExpression */ && + parent_15.parent && + (parent_15.parent.kind === 245 /* JsxAttribute */)) { + return parent_15.parent.parent; } - if (parent_13 && parent_13.kind === 243 /* JsxSpreadAttribute */) { - return parent_13.parent; + if (parent_15 && parent_15.kind === 246 /* JsxSpreadAttribute */) { + return parent_15.parent; } break; } @@ -49601,16 +51638,16 @@ var ts; } function isFunction(kind) { switch (kind) { - case 177 /* FunctionExpression */: - case 178 /* ArrowFunction */: - case 217 /* FunctionDeclaration */: - case 145 /* MethodDeclaration */: - case 144 /* MethodSignature */: - case 147 /* GetAccessor */: - case 148 /* SetAccessor */: - case 149 /* CallSignature */: - case 150 /* ConstructSignature */: - case 151 /* IndexSignature */: + case 178 /* FunctionExpression */: + case 179 /* ArrowFunction */: + case 219 /* FunctionDeclaration */: + case 146 /* MethodDeclaration */: + case 145 /* MethodSignature */: + case 148 /* GetAccessor */: + case 149 /* SetAccessor */: + case 150 /* CallSignature */: + case 151 /* ConstructSignature */: + case 152 /* IndexSignature */: return true; } return false; @@ -49622,54 +51659,54 @@ var ts; var containingNodeKind = contextToken.parent.kind; switch (contextToken.kind) { case 24 /* CommaToken */: - return containingNodeKind === 215 /* VariableDeclaration */ || - containingNodeKind === 216 /* VariableDeclarationList */ || - containingNodeKind === 197 /* VariableStatement */ || - containingNodeKind === 221 /* EnumDeclaration */ || + return containingNodeKind === 217 /* VariableDeclaration */ || + containingNodeKind === 218 /* VariableDeclarationList */ || + containingNodeKind === 199 /* VariableStatement */ || + containingNodeKind === 223 /* EnumDeclaration */ || isFunction(containingNodeKind) || - containingNodeKind === 218 /* ClassDeclaration */ || - containingNodeKind === 190 /* ClassExpression */ || - containingNodeKind === 219 /* InterfaceDeclaration */ || - containingNodeKind === 166 /* ArrayBindingPattern */ || - containingNodeKind === 220 /* TypeAliasDeclaration */; // type Map, K, | + containingNodeKind === 220 /* ClassDeclaration */ || + containingNodeKind === 191 /* ClassExpression */ || + containingNodeKind === 221 /* InterfaceDeclaration */ || + containingNodeKind === 167 /* ArrayBindingPattern */ || + containingNodeKind === 222 /* TypeAliasDeclaration */; // type Map, K, | case 21 /* DotToken */: - return containingNodeKind === 166 /* ArrayBindingPattern */; // var [.| + return containingNodeKind === 167 /* ArrayBindingPattern */; // var [.| case 54 /* ColonToken */: - return containingNodeKind === 167 /* BindingElement */; // var {x :html| + return containingNodeKind === 168 /* BindingElement */; // var {x :html| case 19 /* OpenBracketToken */: - return containingNodeKind === 166 /* ArrayBindingPattern */; // var [x| + return containingNodeKind === 167 /* ArrayBindingPattern */; // var [x| case 17 /* OpenParenToken */: - return containingNodeKind === 248 /* CatchClause */ || + return containingNodeKind === 251 /* CatchClause */ || isFunction(containingNodeKind); case 15 /* OpenBraceToken */: - return containingNodeKind === 221 /* EnumDeclaration */ || - containingNodeKind === 219 /* InterfaceDeclaration */ || - containingNodeKind === 157 /* TypeLiteral */; // const x : { | + return containingNodeKind === 223 /* EnumDeclaration */ || + containingNodeKind === 221 /* InterfaceDeclaration */ || + containingNodeKind === 158 /* TypeLiteral */; // const x : { | case 23 /* SemicolonToken */: - return containingNodeKind === 142 /* PropertySignature */ && + return containingNodeKind === 143 /* PropertySignature */ && contextToken.parent && contextToken.parent.parent && - (contextToken.parent.parent.kind === 219 /* InterfaceDeclaration */ || - contextToken.parent.parent.kind === 157 /* TypeLiteral */); // const x : { a; | + (contextToken.parent.parent.kind === 221 /* InterfaceDeclaration */ || + contextToken.parent.parent.kind === 158 /* TypeLiteral */); // const x : { a; | case 25 /* LessThanToken */: - return containingNodeKind === 218 /* ClassDeclaration */ || - containingNodeKind === 190 /* ClassExpression */ || - containingNodeKind === 219 /* InterfaceDeclaration */ || - containingNodeKind === 220 /* TypeAliasDeclaration */ || + return containingNodeKind === 220 /* ClassDeclaration */ || + containingNodeKind === 191 /* ClassExpression */ || + containingNodeKind === 221 /* InterfaceDeclaration */ || + containingNodeKind === 222 /* TypeAliasDeclaration */ || isFunction(containingNodeKind); case 113 /* StaticKeyword */: - return containingNodeKind === 143 /* PropertyDeclaration */; + return containingNodeKind === 144 /* PropertyDeclaration */; case 22 /* DotDotDotToken */: - return containingNodeKind === 140 /* Parameter */ || + return containingNodeKind === 141 /* Parameter */ || (contextToken.parent && contextToken.parent.parent && - contextToken.parent.parent.kind === 166 /* ArrayBindingPattern */); // var [...z| + contextToken.parent.parent.kind === 167 /* ArrayBindingPattern */); // var [...z| case 112 /* PublicKeyword */: case 110 /* PrivateKeyword */: case 111 /* ProtectedKeyword */: - return containingNodeKind === 140 /* Parameter */; + return containingNodeKind === 141 /* Parameter */; case 116 /* AsKeyword */: - return containingNodeKind === 230 /* ImportSpecifier */ || - containingNodeKind === 234 /* ExportSpecifier */ || - containingNodeKind === 228 /* NamespaceImport */; + return containingNodeKind === 233 /* ImportSpecifier */ || + containingNodeKind === 237 /* ExportSpecifier */ || + containingNodeKind === 231 /* NamespaceImport */; case 73 /* ClassKeyword */: case 81 /* EnumKeyword */: case 107 /* InterfaceKeyword */: @@ -49729,8 +51766,8 @@ var ts; if (element.getStart() <= position && position <= element.getEnd()) { continue; } - var name_34 = element.propertyName || element.name; - existingImportsOrExports[name_34.text] = true; + var name_39 = element.propertyName || element.name; + existingImportsOrExports[name_39.text] = true; } if (ts.isEmpty(existingImportsOrExports)) { return exportsOfModule; @@ -49751,10 +51788,10 @@ var ts; 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 !== 249 /* PropertyAssignment */ && - m.kind !== 250 /* ShorthandPropertyAssignment */ && - m.kind !== 167 /* BindingElement */ && - m.kind !== 145 /* MethodDeclaration */) { + if (m.kind !== 252 /* PropertyAssignment */ && + m.kind !== 253 /* ShorthandPropertyAssignment */ && + m.kind !== 168 /* BindingElement */ && + m.kind !== 146 /* MethodDeclaration */) { continue; } // If this is the current item we are editing right now, do not filter it out @@ -49762,7 +51799,7 @@ var ts; continue; } var existingName = void 0; - if (m.kind === 167 /* BindingElement */ && m.propertyName) { + if (m.kind === 168 /* BindingElement */ && m.propertyName) { // include only identifiers in completion list if (m.propertyName.kind === 69 /* Identifier */) { existingName = m.propertyName.text; @@ -49792,7 +51829,7 @@ var ts; if (attr.getStart() <= position && position <= attr.getEnd()) { continue; } - if (attr.kind === 242 /* JsxAttribute */) { + if (attr.kind === 245 /* JsxAttribute */) { seenNames[attr.name.text] = true; } } @@ -49819,7 +51856,7 @@ var ts; else { if (!symbols || symbols.length === 0) { if (sourceFile.languageVariant === 1 /* JSX */ && - location.parent && location.parent.kind === 241 /* JsxClosingElement */) { + location.parent && location.parent.kind === 244 /* 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: @@ -49847,14 +51884,14 @@ var ts; var entries = []; var target = program.getCompilerOptions().target; var nameTable = getNameTable(sourceFile); - for (var name_35 in nameTable) { + for (var name_40 in nameTable) { // Skip identifiers produced only from the current location - if (nameTable[name_35] === position) { + if (nameTable[name_40] === position) { continue; } - if (!uniqueNames[name_35]) { - uniqueNames[name_35] = name_35; - var displayName = getCompletionEntryDisplayName(name_35, target, /*performCharacterChecks*/ true); + if (!uniqueNames[name_40]) { + uniqueNames[name_40] = name_40; + var displayName = getCompletionEntryDisplayName(name_40, target, /*performCharacterChecks*/ true); if (displayName) { var entry = { name: displayName, @@ -49960,7 +51997,7 @@ var ts; function getSymbolKind(symbol, location) { var flags = symbol.getFlags(); if (flags & 32 /* Class */) - return ts.getDeclarationOfKind(symbol, 190 /* ClassExpression */) ? + return ts.getDeclarationOfKind(symbol, 191 /* ClassExpression */) ? ScriptElementKind.localClassElement : ScriptElementKind.classElement; if (flags & 384 /* Enum */) return ScriptElementKind.enumElement; @@ -49991,6 +52028,9 @@ var ts; 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; @@ -50052,6 +52092,7 @@ var ts; 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 */) { @@ -50060,9 +52101,9 @@ var ts; symbolKind = ScriptElementKind.memberVariableElement; } var signature = void 0; - type = typeChecker.getTypeOfSymbolAtLocation(symbol, location); + type = isThisExpression ? typeChecker.getTypeAtLocation(location) : typeChecker.getTypeOfSymbolAtLocation(symbol, location); if (type) { - if (location.parent && location.parent.kind === 170 /* PropertyAccessExpression */) { + if (location.parent && location.parent.kind === 171 /* 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)) { @@ -50071,7 +52112,7 @@ var ts; } // try get the call/construct signature from the type if it matches var callExpression = void 0; - if (location.kind === 172 /* CallExpression */ || location.kind === 173 /* NewExpression */) { + if (location.kind === 173 /* CallExpression */ || location.kind === 174 /* NewExpression */) { callExpression = location; } else if (isCallExpressionTarget(location) || isNewExpressionTarget(location)) { @@ -50084,7 +52125,7 @@ var ts; // Use the first candidate: signature = candidateSignatures[0]; } - var useConstructSignatures = callExpression.kind === 173 /* NewExpression */ || callExpression.expression.kind === 95 /* SuperKeyword */; + var useConstructSignatures = callExpression.kind === 174 /* 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 @@ -50137,24 +52178,24 @@ var ts; } } else if ((isNameOfFunctionDeclaration(location) && !(symbol.flags & 98304 /* Accessor */)) || - (location.kind === 121 /* ConstructorKeyword */ && location.parent.kind === 146 /* Constructor */)) { + (location.kind === 121 /* ConstructorKeyword */ && location.parent.kind === 147 /* Constructor */)) { // get the signature from the declaration and write it var functionDeclaration = location.parent; - var allSignatures = functionDeclaration.kind === 146 /* Constructor */ ? type.getConstructSignatures() : type.getCallSignatures(); + var allSignatures = functionDeclaration.kind === 147 /* Constructor */ ? type.getConstructSignatures() : type.getCallSignatures(); if (!typeChecker.isImplementationOfOverload(functionDeclaration)) { signature = typeChecker.getSignatureFromDeclaration(functionDeclaration); } else { signature = allSignatures[0]; } - if (functionDeclaration.kind === 146 /* Constructor */) { + if (functionDeclaration.kind === 147 /* Constructor */) { // show (constructor) Type(...) signature symbolKind = ScriptElementKind.constructorImplementationElement; addPrefixForAnyFunctionOrVar(type.symbol, symbolKind); } else { // (function/method) symbol(..signature) - addPrefixForAnyFunctionOrVar(functionDeclaration.kind === 149 /* CallSignature */ && + addPrefixForAnyFunctionOrVar(functionDeclaration.kind === 150 /* CallSignature */ && !(type.symbol.flags & 2048 /* TypeLiteral */ || type.symbol.flags & 4096 /* ObjectLiteral */) ? type.symbol : symbol, symbolKind); } addSignatureDisplayParts(signature, allSignatures); @@ -50162,8 +52203,8 @@ var ts; } } } - if (symbolFlags & 32 /* Class */ && !hasAddedSymbolInfo) { - if (ts.getDeclarationOfKind(symbol, 190 /* ClassExpression */)) { + if (symbolFlags & 32 /* Class */ && !hasAddedSymbolInfo && !isThisExpression) { + if (ts.getDeclarationOfKind(symbol, 191 /* 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 @@ -50207,7 +52248,7 @@ var ts; } if (symbolFlags & 1536 /* Module */) { addNewLineIfDisplayPartsExist(); - var declaration = ts.getDeclarationOfKind(symbol, 222 /* ModuleDeclaration */); + var declaration = ts.getDeclarationOfKind(symbol, 224 /* ModuleDeclaration */); var isNamespace = declaration && declaration.name && declaration.name.kind === 69 /* Identifier */; displayParts.push(ts.keywordPart(isNamespace ? 126 /* NamespaceKeyword */ : 125 /* ModuleKeyword */)); displayParts.push(ts.spacePart()); @@ -50230,17 +52271,17 @@ var ts; } else { // Method/function type parameter - var declaration = ts.getDeclarationOfKind(symbol, 139 /* TypeParameter */); + var declaration = ts.getDeclarationOfKind(symbol, 140 /* TypeParameter */); ts.Debug.assert(declaration !== undefined); declaration = declaration.parent; if (declaration) { if (ts.isFunctionLikeKind(declaration.kind)) { var signature = typeChecker.getSignatureFromDeclaration(declaration); - if (declaration.kind === 150 /* ConstructSignature */) { + if (declaration.kind === 151 /* ConstructSignature */) { displayParts.push(ts.keywordPart(92 /* NewKeyword */)); displayParts.push(ts.spacePart()); } - else if (declaration.kind !== 149 /* CallSignature */ && declaration.name) { + else if (declaration.kind !== 150 /* CallSignature */ && declaration.name) { addFullSymbolName(declaration.symbol); } ts.addRange(displayParts, ts.signatureToDisplayParts(typeChecker, signature, sourceFile, 32 /* WriteTypeArgumentsOfSignature */)); @@ -50260,7 +52301,7 @@ var ts; if (symbolFlags & 8 /* EnumMember */) { addPrefixForAnyFunctionOrVar(symbol, "enum member"); var declaration = symbol.declarations[0]; - if (declaration.kind === 251 /* EnumMember */) { + if (declaration.kind === 254 /* EnumMember */) { var constantValue = typeChecker.getConstantValue(declaration); if (constantValue !== undefined) { displayParts.push(ts.spacePart()); @@ -50276,7 +52317,7 @@ var ts; displayParts.push(ts.spacePart()); addFullSymbolName(symbol); ts.forEach(symbol.declarations, function (declaration) { - if (declaration.kind === 225 /* ImportEqualsDeclaration */) { + if (declaration.kind === 228 /* ImportEqualsDeclaration */) { var importEqualsDeclaration = declaration; if (ts.isExternalModuleImportEqualsDeclaration(importEqualsDeclaration)) { displayParts.push(ts.spacePart()); @@ -50303,11 +52344,18 @@ var ts; if (!hasAddedSymbolInfo) { if (symbolKind !== ScriptElementKind.unknown) { if (type) { - addPrefixForAnyFunctionOrVar(symbol, symbolKind); + 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) { + symbolKind === ScriptElementKind.localVariableElement || + isThisExpression) { displayParts.push(ts.punctuationPart(54 /* ColonToken */)); displayParts.push(ts.spacePart()); // If the type is type parameter, format it specially @@ -50409,10 +52457,10 @@ var ts; // Try getting just type at this position and show switch (node.kind) { case 69 /* Identifier */: - case 170 /* PropertyAccessExpression */: - case 137 /* QualifiedName */: + case 171 /* PropertyAccessExpression */: + case 138 /* QualifiedName */: case 97 /* ThisKeyword */: - case 163 /* ThisType */: + case 164 /* ThisType */: case 95 /* SuperKeyword */: // For the identifiers/this/super etc get the type at position var type = typeChecker.getTypeAtLocation(node); @@ -50491,8 +52539,8 @@ var ts; var declarations = []; var definition; ts.forEach(signatureDeclarations, function (d) { - if ((selectConstructors && d.kind === 146 /* Constructor */) || - (!selectConstructors && (d.kind === 217 /* FunctionDeclaration */ || d.kind === 145 /* MethodDeclaration */ || d.kind === 144 /* MethodSignature */))) { + if ((selectConstructors && d.kind === 147 /* Constructor */) || + (!selectConstructors && (d.kind === 219 /* FunctionDeclaration */ || d.kind === 146 /* MethodDeclaration */ || d.kind === 145 /* MethodSignature */))) { declarations.push(d); if (d.body) definition = d; @@ -50509,6 +52557,25 @@ var ts; 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 + }; + } /// Goto definition function getDefinitionAtPosition(fileName, position) { synchronizeHostData(); @@ -50524,18 +52591,20 @@ var ts; return label ? [createDefinitionInfo(label, ScriptElementKind.label, labelName, /*containerName*/ undefined)] : undefined; } /// Triple slash reference comments - var comment = ts.forEach(sourceFile.referencedFiles, function (r) { return (r.pos <= position && position < r.end) ? r : undefined; }); + var comment = findReferenceInPosition(sourceFile.referencedFiles, position); if (comment) { var referenceFile = ts.tryResolveScriptReference(program, sourceFile, comment); if (referenceFile) { - return [{ - fileName: referenceFile.fileName, - textSpan: ts.createTextSpanFromBounds(0, 0), - kind: ScriptElementKind.scriptElement, - name: comment.fileName, - containerName: undefined, - containerKind: undefined - }]; + return [getDefinitionInfoForFileReference(comment.fileName, referenceFile.fileName)]; + } + return undefined; + } + // Type reference directives + var typeReferenceDirective = findReferenceInPosition(sourceFile.typeReferenceDirectives, position); + if (typeReferenceDirective) { + var referenceFile = ts.lookUp(program.resolvedTypeReferenceDirectives, typeReferenceDirective.fileName); + if (referenceFile && referenceFile.resolvedFileName) { + return [getDefinitionInfoForFileReference(typeReferenceDirective.fileName, referenceFile.resolvedFileName)]; } return undefined; } @@ -50559,7 +52628,7 @@ var ts; // if (node.kind === 69 /* Identifier */ && (node.parent === declaration || - (declaration.kind === 230 /* ImportSpecifier */ && declaration.parent && declaration.parent.kind === 229 /* NamedImports */))) { + (declaration.kind === 233 /* ImportSpecifier */ && declaration.parent && declaration.parent.kind === 232 /* NamedImports */))) { symbol = typeChecker.getAliasedSymbol(symbol); } } @@ -50568,7 +52637,7 @@ var ts; // 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 === 250 /* ShorthandPropertyAssignment */) { + if (node.parent.kind === 253 /* ShorthandPropertyAssignment */) { var shorthandSymbol = typeChecker.getShorthandAssignmentValueSymbol(symbol.valueDeclaration); if (!shorthandSymbol) { return []; @@ -50644,7 +52713,7 @@ var ts; function getSemanticDocumentHighlights(node) { if (node.kind === 69 /* Identifier */ || node.kind === 97 /* ThisKeyword */ || - node.kind === 163 /* ThisType */ || + node.kind === 164 /* ThisType */ || node.kind === 95 /* SuperKeyword */ || isLiteralNameOfPropertyDeclarationOrIndexAccess(node) || isNameOfExternalModuleImportOrDeclaration(node)) { @@ -50698,75 +52767,75 @@ var ts; switch (node.kind) { case 88 /* IfKeyword */: case 80 /* ElseKeyword */: - if (hasKind(node.parent, 200 /* IfStatement */)) { + if (hasKind(node.parent, 202 /* IfStatement */)) { return getIfElseOccurrences(node.parent); } break; case 94 /* ReturnKeyword */: - if (hasKind(node.parent, 208 /* ReturnStatement */)) { + if (hasKind(node.parent, 210 /* ReturnStatement */)) { return getReturnOccurrences(node.parent); } break; case 98 /* ThrowKeyword */: - if (hasKind(node.parent, 212 /* ThrowStatement */)) { + if (hasKind(node.parent, 214 /* ThrowStatement */)) { return getThrowOccurrences(node.parent); } break; case 72 /* CatchKeyword */: - if (hasKind(parent(parent(node)), 213 /* TryStatement */)) { + if (hasKind(parent(parent(node)), 215 /* TryStatement */)) { return getTryCatchFinallyOccurrences(node.parent.parent); } break; case 100 /* TryKeyword */: case 85 /* FinallyKeyword */: - if (hasKind(parent(node), 213 /* TryStatement */)) { + if (hasKind(parent(node), 215 /* TryStatement */)) { return getTryCatchFinallyOccurrences(node.parent); } break; case 96 /* SwitchKeyword */: - if (hasKind(node.parent, 210 /* SwitchStatement */)) { + if (hasKind(node.parent, 212 /* SwitchStatement */)) { return getSwitchCaseDefaultOccurrences(node.parent); } break; case 71 /* CaseKeyword */: case 77 /* DefaultKeyword */: - if (hasKind(parent(parent(parent(node))), 210 /* SwitchStatement */)) { + if (hasKind(parent(parent(parent(node))), 212 /* SwitchStatement */)) { return getSwitchCaseDefaultOccurrences(node.parent.parent.parent); } break; case 70 /* BreakKeyword */: case 75 /* ContinueKeyword */: - if (hasKind(node.parent, 207 /* BreakStatement */) || hasKind(node.parent, 206 /* ContinueStatement */)) { + if (hasKind(node.parent, 209 /* BreakStatement */) || hasKind(node.parent, 208 /* ContinueStatement */)) { return getBreakOrContinueStatementOccurrences(node.parent); } break; case 86 /* ForKeyword */: - if (hasKind(node.parent, 203 /* ForStatement */) || - hasKind(node.parent, 204 /* ForInStatement */) || - hasKind(node.parent, 205 /* ForOfStatement */)) { + if (hasKind(node.parent, 205 /* ForStatement */) || + hasKind(node.parent, 206 /* ForInStatement */) || + hasKind(node.parent, 207 /* ForOfStatement */)) { return getLoopBreakContinueOccurrences(node.parent); } break; case 104 /* WhileKeyword */: case 79 /* DoKeyword */: - if (hasKind(node.parent, 202 /* WhileStatement */) || hasKind(node.parent, 201 /* DoStatement */)) { + if (hasKind(node.parent, 204 /* WhileStatement */) || hasKind(node.parent, 203 /* DoStatement */)) { return getLoopBreakContinueOccurrences(node.parent); } break; case 121 /* ConstructorKeyword */: - if (hasKind(node.parent, 146 /* Constructor */)) { + if (hasKind(node.parent, 147 /* Constructor */)) { return getConstructorOccurrences(node.parent); } break; case 123 /* GetKeyword */: case 130 /* SetKeyword */: - if (hasKind(node.parent, 147 /* GetAccessor */) || hasKind(node.parent, 148 /* SetAccessor */)) { + if (hasKind(node.parent, 148 /* GetAccessor */) || hasKind(node.parent, 149 /* SetAccessor */)) { return getGetAndSetOccurrences(node.parent); } break; default: if (ts.isModifierKind(node.kind) && node.parent && - (ts.isDeclaration(node.parent) || node.parent.kind === 197 /* VariableStatement */)) { + (ts.isDeclaration(node.parent) || node.parent.kind === 199 /* VariableStatement */)) { return getModifierOccurrences(node.kind, node.parent); } } @@ -50782,10 +52851,10 @@ var ts; aggregate(node); return statementAccumulator; function aggregate(node) { - if (node.kind === 212 /* ThrowStatement */) { + if (node.kind === 214 /* ThrowStatement */) { statementAccumulator.push(node); } - else if (node.kind === 213 /* TryStatement */) { + else if (node.kind === 215 /* TryStatement */) { var tryStatement = node; if (tryStatement.catchClause) { aggregate(tryStatement.catchClause); @@ -50812,19 +52881,19 @@ var ts; function getThrowStatementOwner(throwStatement) { var child = throwStatement; while (child.parent) { - var parent_14 = child.parent; - if (ts.isFunctionBlock(parent_14) || parent_14.kind === 252 /* SourceFile */) { - return parent_14; + var parent_16 = child.parent; + if (ts.isFunctionBlock(parent_16) || parent_16.kind === 255 /* SourceFile */) { + return parent_16; } // 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_14.kind === 213 /* TryStatement */) { - var tryStatement = parent_14; + if (parent_16.kind === 215 /* TryStatement */) { + var tryStatement = parent_16; if (tryStatement.tryBlock === child && tryStatement.catchClause) { return child; } } - child = parent_14; + child = parent_16; } return undefined; } @@ -50833,7 +52902,7 @@ var ts; aggregate(node); return statementAccumulator; function aggregate(node) { - if (node.kind === 207 /* BreakStatement */ || node.kind === 206 /* ContinueStatement */) { + if (node.kind === 209 /* BreakStatement */ || node.kind === 208 /* ContinueStatement */) { statementAccumulator.push(node); } else if (!ts.isFunctionLike(node)) { @@ -50848,16 +52917,16 @@ var ts; function getBreakOrContinueOwner(statement) { for (var node_2 = statement.parent; node_2; node_2 = node_2.parent) { switch (node_2.kind) { - case 210 /* SwitchStatement */: - if (statement.kind === 206 /* ContinueStatement */) { + case 212 /* SwitchStatement */: + if (statement.kind === 208 /* ContinueStatement */) { continue; } // Fall through. - case 203 /* ForStatement */: - case 204 /* ForInStatement */: - case 205 /* ForOfStatement */: - case 202 /* WhileStatement */: - case 201 /* DoStatement */: + case 205 /* ForStatement */: + case 206 /* ForInStatement */: + case 207 /* ForOfStatement */: + case 204 /* WhileStatement */: + case 203 /* DoStatement */: if (!statement.label || isLabeledBy(node_2, statement.label.text)) { return node_2; } @@ -50876,24 +52945,24 @@ var ts; 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 === 218 /* ClassDeclaration */ || - container.kind === 190 /* ClassExpression */ || - (declaration.kind === 140 /* Parameter */ && hasKind(container, 146 /* Constructor */)))) { + if (!(container.kind === 220 /* ClassDeclaration */ || + container.kind === 191 /* ClassExpression */ || + (declaration.kind === 141 /* Parameter */ && hasKind(container, 147 /* Constructor */)))) { return undefined; } } else if (modifier === 113 /* StaticKeyword */) { - if (!(container.kind === 218 /* ClassDeclaration */ || container.kind === 190 /* ClassExpression */)) { + if (!(container.kind === 220 /* ClassDeclaration */ || container.kind === 191 /* ClassExpression */)) { return undefined; } } else if (modifier === 82 /* ExportKeyword */ || modifier === 122 /* DeclareKeyword */) { - if (!(container.kind === 223 /* ModuleBlock */ || container.kind === 252 /* SourceFile */)) { + if (!(container.kind === 225 /* ModuleBlock */ || container.kind === 255 /* SourceFile */)) { return undefined; } } else if (modifier === 115 /* AbstractKeyword */) { - if (!(container.kind === 218 /* ClassDeclaration */ || declaration.kind === 218 /* ClassDeclaration */)) { + if (!(container.kind === 220 /* ClassDeclaration */ || declaration.kind === 220 /* ClassDeclaration */)) { return undefined; } } @@ -50905,8 +52974,8 @@ var ts; var modifierFlag = getFlagFromModifier(modifier); var nodes; switch (container.kind) { - case 223 /* ModuleBlock */: - case 252 /* SourceFile */: + case 225 /* ModuleBlock */: + case 255 /* SourceFile */: // Container is either a class declaration or the declaration is a classDeclaration if (modifierFlag & 128 /* Abstract */) { nodes = declaration.members.concat(declaration); @@ -50915,17 +52984,17 @@ var ts; nodes = container.statements; } break; - case 146 /* Constructor */: + case 147 /* Constructor */: nodes = container.parameters.concat(container.parent.members); break; - case 218 /* ClassDeclaration */: - case 190 /* ClassExpression */: + case 220 /* ClassDeclaration */: + case 191 /* 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 === 146 /* Constructor */ && member; + return member.kind === 147 /* Constructor */ && member; }); if (constructor) { nodes = nodes.concat(constructor.parameters); @@ -50978,8 +53047,8 @@ var ts; } function getGetAndSetOccurrences(accessorDeclaration) { var keywords = []; - tryPushAccessorKeyword(accessorDeclaration.symbol, 147 /* GetAccessor */); - tryPushAccessorKeyword(accessorDeclaration.symbol, 148 /* SetAccessor */); + tryPushAccessorKeyword(accessorDeclaration.symbol, 148 /* GetAccessor */); + tryPushAccessorKeyword(accessorDeclaration.symbol, 149 /* SetAccessor */); return ts.map(keywords, getHighlightSpanForNode); function tryPushAccessorKeyword(accessorSymbol, accessorKind) { var accessor = ts.getDeclarationOfKind(accessorSymbol, accessorKind); @@ -51002,7 +53071,7 @@ var ts; 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 === 201 /* DoStatement */) { + if (loopNode.kind === 203 /* DoStatement */) { var loopTokens = loopNode.getChildren(); for (var i = loopTokens.length - 1; i >= 0; i--) { if (pushKeywordIf(keywords, loopTokens[i], 104 /* WhileKeyword */)) { @@ -51023,13 +53092,13 @@ var ts; var owner = getBreakOrContinueOwner(breakOrContinueStatement); if (owner) { switch (owner.kind) { - case 203 /* ForStatement */: - case 204 /* ForInStatement */: - case 205 /* ForOfStatement */: - case 201 /* DoStatement */: - case 202 /* WhileStatement */: + case 205 /* ForStatement */: + case 206 /* ForInStatement */: + case 207 /* ForOfStatement */: + case 203 /* DoStatement */: + case 204 /* WhileStatement */: return getLoopBreakContinueOccurrences(owner); - case 210 /* SwitchStatement */: + case 212 /* SwitchStatement */: return getSwitchCaseDefaultOccurrences(owner); } } @@ -51083,7 +53152,7 @@ var ts; 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, 196 /* Block */))) { + if (!(func && hasKind(func.body, 198 /* Block */))) { return undefined; } var keywords = []; @@ -51099,7 +53168,7 @@ var ts; function getIfElseOccurrences(ifStatement) { var keywords = []; // Traverse upwards through all parent if-statements linked by their else-branches. - while (hasKind(ifStatement.parent, 200 /* IfStatement */) && ifStatement.parent.elseStatement === ifStatement) { + while (hasKind(ifStatement.parent, 202 /* IfStatement */) && ifStatement.parent.elseStatement === ifStatement) { ifStatement = ifStatement.parent; } // Now traverse back down through the else branches, aggregating if/else keywords of if-statements. @@ -51112,7 +53181,7 @@ var ts; break; } } - if (!hasKind(ifStatement.elseStatement, 200 /* IfStatement */)) { + if (!hasKind(ifStatement.elseStatement, 202 /* IfStatement */)) { break; } ifStatement = ifStatement.elseStatement; @@ -51229,7 +53298,7 @@ var ts; return getLabelReferencesInNode(node.parent, node); } } - if (node.kind === 97 /* ThisKeyword */ || node.kind === 163 /* ThisType */) { + if (node.kind === 97 /* ThisKeyword */ || node.kind === 164 /* ThisType */) { return getReferencesForThisKeyword(node, sourceFiles); } if (node.kind === 95 /* SuperKeyword */) { @@ -51263,8 +53332,8 @@ var ts; } else { var internedName = getInternedName(symbol, node, declarations); - for (var _i = 0, sourceFiles_3 = sourceFiles; _i < sourceFiles_3.length; _i++) { - var sourceFile = sourceFiles_3[_i]; + for (var _i = 0, sourceFiles_4 = sourceFiles; _i < sourceFiles_4.length; _i++) { + var sourceFile = sourceFiles_4[_i]; cancellationToken.throwIfCancellationRequested(); var nameTable = getNameTable(sourceFile); if (ts.lookUp(nameTable, internedName) !== undefined) { @@ -51291,7 +53360,7 @@ var ts; }; } function isImportSpecifierSymbol(symbol) { - return (symbol.flags & 8388608 /* Alias */) && !!ts.getDeclarationOfKind(symbol, 230 /* ImportSpecifier */); + return (symbol.flags & 8388608 /* Alias */) && !!ts.getDeclarationOfKind(symbol, 233 /* ImportSpecifier */); } function getInternedName(symbol, location, declarations) { // If this is an export or import specifier it could have been renamed using the 'as' syntax. @@ -51317,14 +53386,14 @@ var ts; // 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 === 177 /* FunctionExpression */ || valueDeclaration.kind === 190 /* ClassExpression */)) { + if (valueDeclaration && (valueDeclaration.kind === 178 /* FunctionExpression */ || valueDeclaration.kind === 191 /* 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, 218 /* ClassDeclaration */); + return ts.getAncestor(privateDeclaration, 220 /* ClassDeclaration */); } } // If the symbol is an import we would like to find it if we are looking for what it imports. @@ -51350,7 +53419,7 @@ var ts; // Different declarations have different containers, bail out return undefined; } - if (container.kind === 252 /* SourceFile */ && !ts.isExternalModule(container)) { + if (container.kind === 255 /* 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; @@ -51523,13 +53592,13 @@ var ts; // Whether 'super' occurs in a static context within a class. var staticFlag = 32 /* Static */; switch (searchSpaceNode.kind) { - case 143 /* PropertyDeclaration */: - case 142 /* PropertySignature */: - case 145 /* MethodDeclaration */: - case 144 /* MethodSignature */: - case 146 /* Constructor */: - case 147 /* GetAccessor */: - case 148 /* SetAccessor */: + case 144 /* PropertyDeclaration */: + case 143 /* PropertySignature */: + case 146 /* MethodDeclaration */: + case 145 /* MethodSignature */: + case 147 /* Constructor */: + case 148 /* GetAccessor */: + case 149 /* SetAccessor */: staticFlag &= searchSpaceNode.flags; searchSpaceNode = searchSpaceNode.parent; // re-assign to be the owning class break; @@ -51561,27 +53630,27 @@ var ts; // Whether 'this' occurs in a static context within a class. var staticFlag = 32 /* Static */; switch (searchSpaceNode.kind) { - case 145 /* MethodDeclaration */: - case 144 /* MethodSignature */: + case 146 /* MethodDeclaration */: + case 145 /* MethodSignature */: if (ts.isObjectLiteralMethod(searchSpaceNode)) { break; } // fall through - case 143 /* PropertyDeclaration */: - case 142 /* PropertySignature */: - case 146 /* Constructor */: - case 147 /* GetAccessor */: - case 148 /* SetAccessor */: + case 144 /* PropertyDeclaration */: + case 143 /* PropertySignature */: + case 147 /* Constructor */: + case 148 /* GetAccessor */: + case 149 /* SetAccessor */: staticFlag &= searchSpaceNode.flags; searchSpaceNode = searchSpaceNode.parent; // re-assign to be the owning class break; - case 252 /* SourceFile */: + case 255 /* SourceFile */: if (ts.isExternalModule(searchSpaceNode)) { return undefined; } // Fall through - case 217 /* FunctionDeclaration */: - case 177 /* FunctionExpression */: + case 219 /* FunctionDeclaration */: + case 178 /* 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. @@ -51590,7 +53659,7 @@ var ts; } var references = []; var possiblePositions; - if (searchSpaceNode.kind === 252 /* SourceFile */) { + if (searchSpaceNode.kind === 255 /* SourceFile */) { ts.forEach(sourceFiles, function (sourceFile) { possiblePositions = getPossibleSymbolReferencePositions(sourceFile, "this", sourceFile.getStart(), sourceFile.getEnd()); getThisReferencesInFile(sourceFile, sourceFile, possiblePositions, references); @@ -51616,33 +53685,33 @@ var ts; ts.forEach(possiblePositions, function (position) { cancellationToken.throwIfCancellationRequested(); var node = ts.getTouchingWord(sourceFile, position); - if (!node || (node.kind !== 97 /* ThisKeyword */ && node.kind !== 163 /* ThisType */)) { + if (!node || (node.kind !== 97 /* ThisKeyword */ && node.kind !== 164 /* ThisType */)) { return; } var container = ts.getThisContainer(node, /* includeArrowFunctions */ false); switch (searchSpaceNode.kind) { - case 177 /* FunctionExpression */: - case 217 /* FunctionDeclaration */: + case 178 /* FunctionExpression */: + case 219 /* FunctionDeclaration */: if (searchSpaceNode.symbol === container.symbol) { result.push(getReferenceEntryFromNode(node)); } break; - case 145 /* MethodDeclaration */: - case 144 /* MethodSignature */: + case 146 /* MethodDeclaration */: + case 145 /* MethodSignature */: if (ts.isObjectLiteralMethod(searchSpaceNode) && searchSpaceNode.symbol === container.symbol) { result.push(getReferenceEntryFromNode(node)); } break; - case 190 /* ClassExpression */: - case 218 /* ClassDeclaration */: + case 191 /* ClassExpression */: + case 220 /* 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 252 /* SourceFile */: - if (container.kind === 252 /* SourceFile */ && !ts.isExternalModule(container)) { + case 255 /* SourceFile */: + if (container.kind === 255 /* SourceFile */ && !ts.isExternalModule(container)) { result.push(getReferenceEntryFromNode(node)); } break; @@ -51662,7 +53731,7 @@ var ts; // export {a as somethingElse} // We want the *local* declaration of 'a' as declared in the import, // *not* as declared within "mod" (or farther) - if (location.parent.kind === 234 /* ExportSpecifier */) { + if (location.parent.kind === 237 /* ExportSpecifier */) { result.push(typeChecker.getExportSpecifierLocalTargetSymbol(location.parent)); } // If the location is in a context sensitive location (i.e. in an object literal) try @@ -51692,7 +53761,7 @@ var ts; // 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 === 140 /* Parameter */ && + if (symbol.valueDeclaration && symbol.valueDeclaration.kind === 141 /* Parameter */ && ts.isParameterPropertyDeclaration(symbol.valueDeclaration)) { result = result.concat(typeChecker.getSymbolsOfParameterPropertyDeclaration(symbol.valueDeclaration, symbol.name)); } @@ -51737,11 +53806,11 @@ var ts; } if (symbol.flags & (32 /* Class */ | 64 /* Interface */)) { ts.forEach(symbol.getDeclarations(), function (declaration) { - if (declaration.kind === 218 /* ClassDeclaration */) { + if (declaration.kind === 220 /* ClassDeclaration */) { getPropertySymbolFromTypeReference(ts.getClassExtendsHeritageClauseElement(declaration)); ts.forEach(ts.getClassImplementsHeritageClauseElements(declaration), getPropertySymbolFromTypeReference); } - else if (declaration.kind === 219 /* InterfaceDeclaration */) { + else if (declaration.kind === 221 /* InterfaceDeclaration */) { ts.forEach(ts.getInterfaceBaseTypeNodes(declaration), getPropertySymbolFromTypeReference); } }); @@ -51778,7 +53847,7 @@ var ts; // import {a} from "mod"; // export {a as somethingElse} // We want the local target of the export (i.e. the import symbol) and not the final target (i.e. "mod".a) - if (referenceLocation.parent.kind === 234 /* ExportSpecifier */) { + if (referenceLocation.parent.kind === 237 /* ExportSpecifier */) { var aliasedSymbol = typeChecker.getExportSpecifierLocalTargetSymbol(referenceLocation.parent); if (searchSymbols.indexOf(aliasedSymbol) >= 0) { return aliasedSymbol; @@ -51813,19 +53882,19 @@ var ts; if (isNameOfPropertyAssignment(node)) { var objectLiteral = node.parent.parent; var contextualType = typeChecker.getContextualType(objectLiteral); - var name_36 = node.text; + var name_41 = node.text; if (contextualType) { if (contextualType.flags & 16384 /* Union */) { // This is a union type, first see if the property we are looking for is a union property (i.e. exists in all types) // if not, search the constituent types for the property - var unionProperty = contextualType.getProperty(name_36); + var unionProperty = contextualType.getProperty(name_41); if (unionProperty) { return [unionProperty]; } else { var result_5 = []; ts.forEach(contextualType.types, function (t) { - var symbol = t.getProperty(name_36); + var symbol = t.getProperty(name_41); if (symbol) { result_5.push(symbol); } @@ -51834,7 +53903,7 @@ var ts; } } else { - var symbol_1 = contextualType.getProperty(name_36); + var symbol_1 = contextualType.getProperty(name_41); if (symbol_1) { return [symbol_1]; } @@ -51892,10 +53961,10 @@ var ts; } var parent = node.parent; if (parent) { - if (parent.kind === 184 /* PostfixUnaryExpression */ || parent.kind === 183 /* PrefixUnaryExpression */) { + if (parent.kind === 185 /* PostfixUnaryExpression */ || parent.kind === 184 /* PrefixUnaryExpression */) { return true; } - else if (parent.kind === 185 /* BinaryExpression */ && parent.left === node) { + else if (parent.kind === 186 /* BinaryExpression */ && parent.left === node) { var operator = parent.operatorToken.kind; return 56 /* FirstAssignment */ <= operator && operator <= 68 /* LastAssignment */; } @@ -51926,33 +53995,33 @@ var ts; } function getMeaningFromDeclaration(node) { switch (node.kind) { - case 140 /* Parameter */: - case 215 /* VariableDeclaration */: - case 167 /* BindingElement */: - case 143 /* PropertyDeclaration */: - case 142 /* PropertySignature */: - case 249 /* PropertyAssignment */: - case 250 /* ShorthandPropertyAssignment */: - case 251 /* EnumMember */: - case 145 /* MethodDeclaration */: - case 144 /* MethodSignature */: - case 146 /* Constructor */: - case 147 /* GetAccessor */: - case 148 /* SetAccessor */: - case 217 /* FunctionDeclaration */: - case 177 /* FunctionExpression */: - case 178 /* ArrowFunction */: - case 248 /* CatchClause */: + case 141 /* Parameter */: + case 217 /* VariableDeclaration */: + case 168 /* BindingElement */: + case 144 /* PropertyDeclaration */: + case 143 /* PropertySignature */: + case 252 /* PropertyAssignment */: + case 253 /* ShorthandPropertyAssignment */: + case 254 /* EnumMember */: + case 146 /* MethodDeclaration */: + case 145 /* MethodSignature */: + case 147 /* Constructor */: + case 148 /* GetAccessor */: + case 149 /* SetAccessor */: + case 219 /* FunctionDeclaration */: + case 178 /* FunctionExpression */: + case 179 /* ArrowFunction */: + case 251 /* CatchClause */: return 1 /* Value */; - case 139 /* TypeParameter */: - case 219 /* InterfaceDeclaration */: - case 220 /* TypeAliasDeclaration */: - case 157 /* TypeLiteral */: + case 140 /* TypeParameter */: + case 221 /* InterfaceDeclaration */: + case 222 /* TypeAliasDeclaration */: + case 158 /* TypeLiteral */: return 2 /* Type */; - case 218 /* ClassDeclaration */: - case 221 /* EnumDeclaration */: + case 220 /* ClassDeclaration */: + case 223 /* EnumDeclaration */: return 1 /* Value */ | 2 /* Type */; - case 222 /* ModuleDeclaration */: + case 224 /* ModuleDeclaration */: if (ts.isAmbientModule(node)) { return 4 /* Namespace */ | 1 /* Value */; } @@ -51962,15 +54031,15 @@ var ts; else { return 4 /* Namespace */; } - case 229 /* NamedImports */: - case 230 /* ImportSpecifier */: - case 225 /* ImportEqualsDeclaration */: - case 226 /* ImportDeclaration */: - case 231 /* ExportAssignment */: - case 232 /* ExportDeclaration */: + case 232 /* NamedImports */: + case 233 /* ImportSpecifier */: + case 228 /* ImportEqualsDeclaration */: + case 229 /* ImportDeclaration */: + case 234 /* ExportAssignment */: + case 235 /* ExportDeclaration */: return 1 /* Value */ | 2 /* Type */ | 4 /* Namespace */; // An external module can be a Value - case 252 /* SourceFile */: + case 255 /* SourceFile */: return 4 /* Namespace */ | 1 /* Value */; } return 1 /* Value */ | 2 /* Type */ | 4 /* Namespace */; @@ -51979,10 +54048,10 @@ var ts; if (ts.isRightSideOfQualifiedNameOrPropertyAccess(node)) { node = node.parent; } - return node.parent.kind === 153 /* TypeReference */ || - (node.parent.kind === 192 /* ExpressionWithTypeArguments */ && !ts.isExpressionWithTypeArgumentsInClassExtendsClause(node.parent)) || + return node.parent.kind === 154 /* TypeReference */ || + (node.parent.kind === 193 /* ExpressionWithTypeArguments */ && !ts.isExpressionWithTypeArgumentsInClassExtendsClause(node.parent)) || (node.kind === 97 /* ThisKeyword */ && !ts.isExpression(node)) || - node.kind === 163 /* ThisType */; + node.kind === 164 /* ThisType */; } function isNamespaceReference(node) { return isQualifiedNameNamespaceReference(node) || isPropertyAccessNamespaceReference(node); @@ -51990,32 +54059,32 @@ var ts; function isPropertyAccessNamespaceReference(node) { var root = node; var isLastClause = true; - if (root.parent.kind === 170 /* PropertyAccessExpression */) { - while (root.parent && root.parent.kind === 170 /* PropertyAccessExpression */) { + if (root.parent.kind === 171 /* PropertyAccessExpression */) { + while (root.parent && root.parent.kind === 171 /* PropertyAccessExpression */) { root = root.parent; } isLastClause = root.name === node; } - if (!isLastClause && root.parent.kind === 192 /* ExpressionWithTypeArguments */ && root.parent.parent.kind === 247 /* HeritageClause */) { + if (!isLastClause && root.parent.kind === 193 /* ExpressionWithTypeArguments */ && root.parent.parent.kind === 250 /* HeritageClause */) { var decl = root.parent.parent.parent; - return (decl.kind === 218 /* ClassDeclaration */ && root.parent.parent.token === 106 /* ImplementsKeyword */) || - (decl.kind === 219 /* InterfaceDeclaration */ && root.parent.parent.token === 83 /* ExtendsKeyword */); + return (decl.kind === 220 /* ClassDeclaration */ && root.parent.parent.token === 106 /* ImplementsKeyword */) || + (decl.kind === 221 /* InterfaceDeclaration */ && root.parent.parent.token === 83 /* ExtendsKeyword */); } return false; } function isQualifiedNameNamespaceReference(node) { var root = node; var isLastClause = true; - if (root.parent.kind === 137 /* QualifiedName */) { - while (root.parent && root.parent.kind === 137 /* QualifiedName */) { + if (root.parent.kind === 138 /* QualifiedName */) { + while (root.parent && root.parent.kind === 138 /* QualifiedName */) { root = root.parent; } isLastClause = root.right === node; } - return root.parent.kind === 153 /* TypeReference */ && !isLastClause; + return root.parent.kind === 154 /* TypeReference */ && !isLastClause; } function isInRightSideOfImport(node) { - while (node.parent.kind === 137 /* QualifiedName */) { + while (node.parent.kind === 138 /* QualifiedName */) { node = node.parent; } return ts.isInternalModuleImportEqualsDeclaration(node.parent) && node.parent.moduleReference === node; @@ -52025,15 +54094,15 @@ var ts; // import a = |b|; // Namespace // import a = |b.c|; // Value, type, namespace // import a = |b.c|.d; // Namespace - if (node.parent.kind === 137 /* QualifiedName */ && + if (node.parent.kind === 138 /* QualifiedName */ && node.parent.right === node && - node.parent.parent.kind === 225 /* ImportEqualsDeclaration */) { + node.parent.parent.kind === 228 /* ImportEqualsDeclaration */) { return 1 /* Value */ | 2 /* Type */ | 4 /* Namespace */; } return 4 /* Namespace */; } function getMeaningFromLocation(node) { - if (node.parent.kind === 231 /* ExportAssignment */) { + if (node.parent.kind === 234 /* ExportAssignment */) { return 1 /* Value */ | 2 /* Type */ | 4 /* Namespace */; } else if (isInRightSideOfImport(node)) { @@ -52062,7 +54131,7 @@ var ts; return ts.SignatureHelp.getSignatureHelpItems(program, sourceFile, position, cancellationToken); } /// Syntactic features - function getSourceFile(fileName) { + function getNonBoundSourceFile(fileName) { return syntaxTreeCache.getCurrentSourceFile(fileName); } function getNameOrDottedNameSpan(fileName, startPos, endPos) { @@ -52073,16 +54142,16 @@ var ts; return; } switch (node.kind) { - case 170 /* PropertyAccessExpression */: - case 137 /* QualifiedName */: + case 171 /* PropertyAccessExpression */: + case 138 /* QualifiedName */: case 9 /* StringLiteral */: - case 164 /* StringLiteralType */: + case 165 /* StringLiteralType */: case 84 /* FalseKeyword */: case 99 /* TrueKeyword */: case 93 /* NullKeyword */: case 95 /* SuperKeyword */: case 97 /* ThisKeyword */: - case 163 /* ThisType */: + case 164 /* ThisType */: case 69 /* Identifier */: break; // Cant create the text span @@ -52099,7 +54168,7 @@ var ts; // 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 === 222 /* ModuleDeclaration */ && + if (nodeForStartPos.parent.parent.kind === 224 /* ModuleDeclaration */ && nodeForStartPos.parent.parent.body === nodeForStartPos.parent) { // Use parent module declarations name for start pos nodeForStartPos = nodeForStartPos.parent.parent.name; @@ -52140,10 +54209,10 @@ var ts; // 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 222 /* ModuleDeclaration */: - case 218 /* ClassDeclaration */: - case 219 /* InterfaceDeclaration */: - case 217 /* FunctionDeclaration */: + case 224 /* ModuleDeclaration */: + case 220 /* ClassDeclaration */: + case 221 /* InterfaceDeclaration */: + case 219 /* FunctionDeclaration */: cancellationToken.throwIfCancellationRequested(); } } @@ -52197,7 +54266,7 @@ var ts; */ function hasValueSideModule(symbol) { return ts.forEach(symbol.declarations, function (declaration) { - return declaration.kind === 222 /* ModuleDeclaration */ && + return declaration.kind === 224 /* ModuleDeclaration */ && ts.getModuleInstanceState(declaration) === 1 /* Instantiated */; }); } @@ -52358,16 +54427,16 @@ var ts; pushClassification(tag.tagName.pos, tag.tagName.end - tag.tagName.pos, 18 /* docCommentTagName */); pos = tag.tagName.end; switch (tag.kind) { - case 271 /* JSDocParameterTag */: + case 274 /* JSDocParameterTag */: processJSDocParameterTag(tag); break; - case 274 /* JSDocTemplateTag */: + case 277 /* JSDocTemplateTag */: processJSDocTemplateTag(tag); break; - case 273 /* JSDocTypeTag */: + case 276 /* JSDocTypeTag */: processElement(tag.typeExpression); break; - case 272 /* JSDocReturnTag */: + case 275 /* JSDocReturnTag */: processElement(tag.typeExpression); break; } @@ -52434,10 +54503,10 @@ var ts; return true; } var classifiedElementName = tryClassifyJsxElementName(node); - if (!ts.isToken(node) && node.kind !== 240 /* JsxText */ && classifiedElementName === undefined) { + if (!ts.isToken(node) && node.kind !== 243 /* JsxText */ && classifiedElementName === undefined) { return false; } - var tokenStart = node.kind === 240 /* JsxText */ ? node.pos : classifyLeadingTriviaAndGetTokenStart(node); + var tokenStart = node.kind === 243 /* JsxText */ ? node.pos : classifyLeadingTriviaAndGetTokenStart(node); var tokenWidth = node.end - tokenStart; ts.Debug.assert(tokenWidth >= 0); if (tokenWidth > 0) { @@ -52450,22 +54519,22 @@ var ts; } function tryClassifyJsxElementName(token) { switch (token.parent && token.parent.kind) { - case 239 /* JsxOpeningElement */: + case 242 /* JsxOpeningElement */: if (token.parent.tagName === token) { return 19 /* jsxOpenTagName */; } break; - case 241 /* JsxClosingElement */: + case 244 /* JsxClosingElement */: if (token.parent.tagName === token) { return 20 /* jsxCloseTagName */; } break; - case 238 /* JsxSelfClosingElement */: + case 241 /* JsxSelfClosingElement */: if (token.parent.tagName === token) { return 21 /* jsxSelfClosingTagName */; } break; - case 242 /* JsxAttribute */: + case 245 /* JsxAttribute */: if (token.parent.name === token) { return 22 /* jsxAttribute */; } @@ -52493,17 +54562,17 @@ var ts; if (token) { if (tokenKind === 56 /* EqualsToken */) { // the '=' in a variable declaration is special cased here. - if (token.parent.kind === 215 /* VariableDeclaration */ || - token.parent.kind === 143 /* PropertyDeclaration */ || - token.parent.kind === 140 /* Parameter */ || - token.parent.kind === 242 /* JsxAttribute */) { + if (token.parent.kind === 217 /* VariableDeclaration */ || + token.parent.kind === 144 /* PropertyDeclaration */ || + token.parent.kind === 141 /* Parameter */ || + token.parent.kind === 245 /* JsxAttribute */) { return 5 /* operator */; } } - if (token.parent.kind === 185 /* BinaryExpression */ || - token.parent.kind === 183 /* PrefixUnaryExpression */ || - token.parent.kind === 184 /* PostfixUnaryExpression */ || - token.parent.kind === 186 /* ConditionalExpression */) { + if (token.parent.kind === 186 /* BinaryExpression */ || + token.parent.kind === 184 /* PrefixUnaryExpression */ || + token.parent.kind === 185 /* PostfixUnaryExpression */ || + token.parent.kind === 187 /* ConditionalExpression */) { return 5 /* operator */; } } @@ -52512,8 +54581,8 @@ var ts; else if (tokenKind === 8 /* NumericLiteral */) { return 4 /* numericLiteral */; } - else if (tokenKind === 9 /* StringLiteral */ || tokenKind === 164 /* StringLiteralType */) { - return token.parent.kind === 242 /* JsxAttribute */ ? 24 /* jsxAttributeStringLiteralValue */ : 6 /* stringLiteral */; + else if (tokenKind === 9 /* StringLiteral */ || tokenKind === 165 /* StringLiteralType */) { + return token.parent.kind === 245 /* JsxAttribute */ ? 24 /* jsxAttributeStringLiteralValue */ : 6 /* stringLiteral */; } else if (tokenKind === 10 /* RegularExpressionLiteral */) { // TODO: we should get another classification type for these literals. @@ -52523,38 +54592,38 @@ var ts; // TODO (drosen): we should *also* get another classification type for these literals. return 6 /* stringLiteral */; } - else if (tokenKind === 240 /* JsxText */) { + else if (tokenKind === 243 /* JsxText */) { return 23 /* jsxText */; } else if (tokenKind === 69 /* Identifier */) { if (token) { switch (token.parent.kind) { - case 218 /* ClassDeclaration */: + case 220 /* ClassDeclaration */: if (token.parent.name === token) { return 11 /* className */; } return; - case 139 /* TypeParameter */: + case 140 /* TypeParameter */: if (token.parent.name === token) { return 15 /* typeParameterName */; } return; - case 219 /* InterfaceDeclaration */: + case 221 /* InterfaceDeclaration */: if (token.parent.name === token) { return 13 /* interfaceName */; } return; - case 221 /* EnumDeclaration */: + case 223 /* EnumDeclaration */: if (token.parent.name === token) { return 12 /* enumName */; } return; - case 222 /* ModuleDeclaration */: + case 224 /* ModuleDeclaration */: if (token.parent.name === token) { return 14 /* moduleName */; } return; - case 140 /* Parameter */: + case 141 /* Parameter */: if (token.parent.name === token) { return 17 /* parameterName */; } @@ -52698,19 +54767,19 @@ var ts; var commentOwner; findOwner: for (commentOwner = tokenAtPos; commentOwner; commentOwner = commentOwner.parent) { switch (commentOwner.kind) { - case 217 /* FunctionDeclaration */: - case 145 /* MethodDeclaration */: - case 146 /* Constructor */: - case 218 /* ClassDeclaration */: - case 197 /* VariableStatement */: + case 219 /* FunctionDeclaration */: + case 146 /* MethodDeclaration */: + case 147 /* Constructor */: + case 220 /* ClassDeclaration */: + case 199 /* VariableStatement */: break findOwner; - case 252 /* SourceFile */: + case 255 /* SourceFile */: return undefined; - case 222 /* ModuleDeclaration */: + case 224 /* 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 === 222 /* ModuleDeclaration */) { + if (commentOwner.parent.kind === 224 /* ModuleDeclaration */) { return undefined; } break findOwner; @@ -52751,7 +54820,7 @@ var ts; if (ts.isFunctionLike(commentOwner)) { return commentOwner.parameters; } - if (commentOwner.kind === 197 /* VariableStatement */) { + if (commentOwner.kind === 199 /* VariableStatement */) { var varStatement = commentOwner; var varDeclarations = varStatement.declarationList.declarations; if (varDeclarations.length === 1 && varDeclarations[0].initializer) { @@ -52769,17 +54838,17 @@ var ts; * @returns the parameters of a signature found on the RHS if one exists; otherwise 'emptyArray'. */ function getParametersFromRightHandSideOfAssignment(rightHandSide) { - while (rightHandSide.kind === 176 /* ParenthesizedExpression */) { + while (rightHandSide.kind === 177 /* ParenthesizedExpression */) { rightHandSide = rightHandSide.expression; } switch (rightHandSide.kind) { - case 177 /* FunctionExpression */: - case 178 /* ArrowFunction */: + case 178 /* FunctionExpression */: + case 179 /* ArrowFunction */: return rightHandSide.parameters; - case 190 /* ClassExpression */: + case 191 /* ClassExpression */: for (var _i = 0, _a = rightHandSide.members; _i < _a.length; _i++) { var member = _a[_i]; - if (member.kind === 146 /* Constructor */) { + if (member.kind === 147 /* Constructor */) { return member.parameters; } } @@ -53004,7 +55073,7 @@ var ts; getFormattingEditsAfterKeystroke: getFormattingEditsAfterKeystroke, getDocCommentTemplateAtPosition: getDocCommentTemplateAtPosition, getEmitOutput: getEmitOutput, - getSourceFile: getSourceFile, + getNonBoundSourceFile: getNonBoundSourceFile, getProgram: getProgram }; } @@ -53033,7 +55102,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 === 236 /* ExternalModuleReference */ || + node.parent.kind === 239 /* ExternalModuleReference */ || isArgumentOfElementAccessExpression(node)) { nameTable[node.text] = nameTable[node.text] === undefined ? node.pos : -1; } @@ -53046,7 +55115,7 @@ var ts; function isArgumentOfElementAccessExpression(node) { return node && node.parent && - node.parent.kind === 171 /* ElementAccessExpression */ && + node.parent.kind === 172 /* ElementAccessExpression */ && node.parent.argumentExpression === node; } /// Classifier @@ -53305,7 +55374,7 @@ var ts; var end = scanner.getTextPos(); addResult(start, end, classFromKind(token)); if (end >= text.length) { - if (token === 9 /* StringLiteral */ || token === 164 /* StringLiteralType */) { + if (token === 9 /* StringLiteral */ || token === 165 /* StringLiteralType */) { // Check to see if we finished up on a multiline string literal. var tokenText = scanner.getTokenText(); if (scanner.isUnterminated()) { @@ -53428,7 +55497,7 @@ var ts; } } function isKeyword(token) { - return token >= 70 /* FirstKeyword */ && token <= 136 /* LastKeyword */; + return token >= 70 /* FirstKeyword */ && token <= 137 /* LastKeyword */; } function classFromKind(token) { if (isKeyword(token)) { @@ -53444,7 +55513,7 @@ var ts; case 8 /* NumericLiteral */: return 4 /* numericLiteral */; case 9 /* StringLiteral */: - case 164 /* StringLiteralType */: + case 165 /* StringLiteralType */: return 6 /* stringLiteral */; case 10 /* RegularExpressionLiteral */: return 7 /* regularExpressionLiteral */; @@ -53556,113 +55625,113 @@ var ts; function spanInNode(node) { if (node) { switch (node.kind) { - case 197 /* VariableStatement */: + case 199 /* VariableStatement */: // Span on first variable declaration return spanInVariableDeclaration(node.declarationList.declarations[0]); - case 215 /* VariableDeclaration */: - case 143 /* PropertyDeclaration */: - case 142 /* PropertySignature */: + case 217 /* VariableDeclaration */: + case 144 /* PropertyDeclaration */: + case 143 /* PropertySignature */: return spanInVariableDeclaration(node); - case 140 /* Parameter */: + case 141 /* Parameter */: return spanInParameterDeclaration(node); - case 217 /* FunctionDeclaration */: - case 145 /* MethodDeclaration */: - case 144 /* MethodSignature */: - case 147 /* GetAccessor */: - case 148 /* SetAccessor */: - case 146 /* Constructor */: - case 177 /* FunctionExpression */: - case 178 /* ArrowFunction */: + case 219 /* FunctionDeclaration */: + case 146 /* MethodDeclaration */: + case 145 /* MethodSignature */: + case 148 /* GetAccessor */: + case 149 /* SetAccessor */: + case 147 /* Constructor */: + case 178 /* FunctionExpression */: + case 179 /* ArrowFunction */: return spanInFunctionDeclaration(node); - case 196 /* Block */: + case 198 /* Block */: if (ts.isFunctionBlock(node)) { return spanInFunctionBlock(node); } // Fall through - case 223 /* ModuleBlock */: + case 225 /* ModuleBlock */: return spanInBlock(node); - case 248 /* CatchClause */: + case 251 /* CatchClause */: return spanInBlock(node.block); - case 199 /* ExpressionStatement */: + case 201 /* ExpressionStatement */: // span on the expression return textSpan(node.expression); - case 208 /* ReturnStatement */: + case 210 /* ReturnStatement */: // span on return keyword and expression if present return textSpan(node.getChildAt(0), node.expression); - case 202 /* WhileStatement */: + case 204 /* WhileStatement */: // Span on while(...) return textSpanEndingAtNextToken(node, node.expression); - case 201 /* DoStatement */: + case 203 /* DoStatement */: // span in statement of the do statement return spanInNode(node.statement); - case 214 /* DebuggerStatement */: + case 216 /* DebuggerStatement */: // span on debugger keyword return textSpan(node.getChildAt(0)); - case 200 /* IfStatement */: + case 202 /* IfStatement */: // set on if(..) span return textSpanEndingAtNextToken(node, node.expression); - case 211 /* LabeledStatement */: + case 213 /* LabeledStatement */: // span in statement return spanInNode(node.statement); - case 207 /* BreakStatement */: - case 206 /* ContinueStatement */: + case 209 /* BreakStatement */: + case 208 /* ContinueStatement */: // On break or continue keyword and label if present return textSpan(node.getChildAt(0), node.label); - case 203 /* ForStatement */: + case 205 /* ForStatement */: return spanInForStatement(node); - case 204 /* ForInStatement */: + case 206 /* ForInStatement */: // span of for (a in ...) return textSpanEndingAtNextToken(node, node.expression); - case 205 /* ForOfStatement */: + case 207 /* ForOfStatement */: // span in initializer return spanInInitializerOfForLike(node); - case 210 /* SwitchStatement */: + case 212 /* SwitchStatement */: // span on switch(...) return textSpanEndingAtNextToken(node, node.expression); - case 245 /* CaseClause */: - case 246 /* DefaultClause */: + case 248 /* CaseClause */: + case 249 /* DefaultClause */: // span in first statement of the clause return spanInNode(node.statements[0]); - case 213 /* TryStatement */: + case 215 /* TryStatement */: // span in try block return spanInBlock(node.tryBlock); - case 212 /* ThrowStatement */: + case 214 /* ThrowStatement */: // span in throw ... return textSpan(node, node.expression); - case 231 /* ExportAssignment */: + case 234 /* ExportAssignment */: // span on export = id return textSpan(node, node.expression); - case 225 /* ImportEqualsDeclaration */: + case 228 /* ImportEqualsDeclaration */: // import statement without including semicolon return textSpan(node, node.moduleReference); - case 226 /* ImportDeclaration */: + case 229 /* ImportDeclaration */: // import statement without including semicolon return textSpan(node, node.moduleSpecifier); - case 232 /* ExportDeclaration */: + case 235 /* ExportDeclaration */: // import statement without including semicolon return textSpan(node, node.moduleSpecifier); - case 222 /* ModuleDeclaration */: + case 224 /* ModuleDeclaration */: // span on complete module if it is instantiated if (ts.getModuleInstanceState(node) !== 1 /* Instantiated */) { return undefined; } - case 218 /* ClassDeclaration */: - case 221 /* EnumDeclaration */: - case 251 /* EnumMember */: - case 167 /* BindingElement */: + case 220 /* ClassDeclaration */: + case 223 /* EnumDeclaration */: + case 254 /* EnumMember */: + case 168 /* BindingElement */: // span on complete node return textSpan(node); - case 209 /* WithStatement */: + case 211 /* WithStatement */: // span in statement return spanInNode(node.statement); - case 141 /* Decorator */: + case 142 /* Decorator */: return spanInNodeArray(node.parent.decorators); - case 165 /* ObjectBindingPattern */: - case 166 /* ArrayBindingPattern */: + case 166 /* ObjectBindingPattern */: + case 167 /* ArrayBindingPattern */: return spanInBindingPattern(node); // No breakpoint in interface, type alias - case 219 /* InterfaceDeclaration */: - case 220 /* TypeAliasDeclaration */: + case 221 /* InterfaceDeclaration */: + case 222 /* TypeAliasDeclaration */: return undefined; // Tokens: case 23 /* SemicolonToken */: @@ -53692,7 +55761,7 @@ var ts; case 72 /* CatchKeyword */: case 85 /* FinallyKeyword */: return spanInNextNode(node); - case 136 /* OfKeyword */: + case 137 /* OfKeyword */: return spanInOfKeyword(node); default: // Destructuring pattern in destructuring assignment @@ -53705,13 +55774,13 @@ var ts; // 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 == 189 /* SpreadElementExpression */ || - node.kind === 249 /* PropertyAssignment */ || - node.kind === 250 /* ShorthandPropertyAssignment */) && + node.kind == 190 /* SpreadElementExpression */ || + node.kind === 252 /* PropertyAssignment */ || + node.kind === 253 /* ShorthandPropertyAssignment */) && ts.isArrayLiteralOrObjectLiteralDestructuringPattern(node.parent)) { return textSpan(node); } - if (node.kind === 185 /* BinaryExpression */) { + if (node.kind === 186 /* BinaryExpression */) { var binaryExpression = node; // Set breakpoint in destructuring pattern if its destructuring assignment // [a, b, c] or {a, b, c} of @@ -53734,22 +55803,22 @@ var ts; } if (ts.isExpression(node)) { switch (node.parent.kind) { - case 201 /* DoStatement */: + case 203 /* DoStatement */: // Set span as if on while keyword return spanInPreviousNode(node); - case 141 /* Decorator */: + case 142 /* Decorator */: // Set breakpoint on the decorator emit return spanInNode(node.parent); - case 203 /* ForStatement */: - case 205 /* ForOfStatement */: + case 205 /* ForStatement */: + case 207 /* ForOfStatement */: return textSpan(node); - case 185 /* BinaryExpression */: + case 186 /* BinaryExpression */: if (node.parent.operatorToken.kind === 24 /* CommaToken */) { // if this is comma expression, the breakpoint is possible in this expression return textSpan(node); } break; - case 178 /* ArrowFunction */: + case 179 /* ArrowFunction */: if (node.parent.body === node) { // If this is body of arrow function, it is allowed to have the breakpoint return textSpan(node); @@ -53758,13 +55827,13 @@ var ts; } } // If this is name of property assignment, set breakpoint in the initializer - if (node.parent.kind === 249 /* PropertyAssignment */ && + if (node.parent.kind === 252 /* 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 === 175 /* TypeAssertionExpression */ && node.parent.type === node) { + if (node.parent.kind === 176 /* TypeAssertionExpression */ && node.parent.type === node) { return spanInNextNode(node.parent.type); } // return type of function go to previous token @@ -53772,8 +55841,8 @@ var ts; return spanInPreviousNode(node); } // initializer of variable/parameter declaration go to previous node - if ((node.parent.kind === 215 /* VariableDeclaration */ || - node.parent.kind === 140 /* Parameter */)) { + if ((node.parent.kind === 217 /* VariableDeclaration */ || + node.parent.kind === 141 /* Parameter */)) { var paramOrVarDecl = node.parent; if (paramOrVarDecl.initializer === node || paramOrVarDecl.type === node || @@ -53781,7 +55850,7 @@ var ts; return spanInPreviousNode(node); } } - if (node.parent.kind === 185 /* BinaryExpression */) { + if (node.parent.kind === 186 /* BinaryExpression */) { var binaryExpression = node.parent; if (ts.isArrayLiteralOrObjectLiteralDestructuringPattern(binaryExpression.left) && (binaryExpression.right === node || @@ -53807,7 +55876,7 @@ var ts; } function spanInVariableDeclaration(variableDeclaration) { // If declaration of for in statement, just set the span in parent - if (variableDeclaration.parent.parent.kind === 204 /* ForInStatement */) { + if (variableDeclaration.parent.parent.kind === 206 /* ForInStatement */) { return spanInNode(variableDeclaration.parent.parent); } // If this is a destructuring pattern set breakpoint in binding pattern @@ -53818,7 +55887,7 @@ var ts; // or its declaration from 'for of' if (variableDeclaration.initializer || (variableDeclaration.flags & 1 /* Export */) || - variableDeclaration.parent.parent.kind === 205 /* ForOfStatement */) { + variableDeclaration.parent.parent.kind === 207 /* ForOfStatement */) { return textSpanFromVariableDeclaration(variableDeclaration); } var declarations = variableDeclaration.parent.declarations; @@ -53858,7 +55927,7 @@ var ts; } function canFunctionHaveSpanInWholeDeclaration(functionDeclaration) { return !!(functionDeclaration.flags & 1 /* Export */) || - (functionDeclaration.parent.kind === 218 /* ClassDeclaration */ && functionDeclaration.kind !== 146 /* Constructor */); + (functionDeclaration.parent.kind === 220 /* ClassDeclaration */ && functionDeclaration.kind !== 147 /* Constructor */); } function spanInFunctionDeclaration(functionDeclaration) { // No breakpoints in the function signature @@ -53881,34 +55950,34 @@ var ts; } function spanInBlock(block) { switch (block.parent.kind) { - case 222 /* ModuleDeclaration */: + case 224 /* ModuleDeclaration */: if (ts.getModuleInstanceState(block.parent) !== 1 /* Instantiated */) { return undefined; } // Set on parent if on same line otherwise on first statement - case 202 /* WhileStatement */: - case 200 /* IfStatement */: - case 204 /* ForInStatement */: + case 204 /* WhileStatement */: + case 202 /* IfStatement */: + case 206 /* 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 203 /* ForStatement */: - case 205 /* ForOfStatement */: + case 205 /* ForStatement */: + case 207 /* 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(forLikeStaement) { - if (forLikeStaement.initializer.kind === 216 /* VariableDeclarationList */) { + function spanInInitializerOfForLike(forLikeStatement) { + if (forLikeStatement.initializer.kind === 218 /* VariableDeclarationList */) { // declaration list, set breakpoint in first declaration - var variableDeclarationList = forLikeStaement.initializer; + var variableDeclarationList = forLikeStatement.initializer; if (variableDeclarationList.declarations.length > 0) { return spanInNode(variableDeclarationList.declarations[0]); } } else { // Expression - set breakpoint in it - return spanInNode(forLikeStaement.initializer); + return spanInNode(forLikeStatement.initializer); } } function spanInForStatement(forStatement) { @@ -53924,23 +55993,23 @@ var ts; } function spanInBindingPattern(bindingPattern) { // Set breakpoint in first binding element - var firstBindingElement = ts.forEach(bindingPattern.elements, function (element) { return element.kind !== 191 /* OmittedExpression */ ? element : undefined; }); + var firstBindingElement = ts.forEach(bindingPattern.elements, function (element) { return element.kind !== 192 /* OmittedExpression */ ? element : undefined; }); if (firstBindingElement) { return spanInNode(firstBindingElement); } // Empty binding pattern of binding element, set breakpoint on binding element - if (bindingPattern.parent.kind === 167 /* BindingElement */) { + if (bindingPattern.parent.kind === 168 /* BindingElement */) { return textSpan(bindingPattern.parent); } // Variable declaration is used as the span return textSpanFromVariableDeclaration(bindingPattern.parent); } function spanInArrayLiteralOrObjectLiteralDestructuringPattern(node) { - ts.Debug.assert(node.kind !== 166 /* ArrayBindingPattern */ && node.kind !== 165 /* ObjectBindingPattern */); - var elements = node.kind === 168 /* ArrayLiteralExpression */ ? + ts.Debug.assert(node.kind !== 167 /* ArrayBindingPattern */ && node.kind !== 166 /* ObjectBindingPattern */); + var elements = node.kind === 169 /* ArrayLiteralExpression */ ? node.elements : node.properties; - var firstBindingElement = ts.forEach(elements, function (element) { return element.kind !== 191 /* OmittedExpression */ ? element : undefined; }); + var firstBindingElement = ts.forEach(elements, function (element) { return element.kind !== 192 /* OmittedExpression */ ? element : undefined; }); if (firstBindingElement) { return spanInNode(firstBindingElement); } @@ -53948,18 +56017,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 === 185 /* BinaryExpression */ ? node.parent : node); + return textSpan(node.parent.kind === 186 /* BinaryExpression */ ? node.parent : node); } // Tokens: function spanInOpenBraceToken(node) { switch (node.parent.kind) { - case 221 /* EnumDeclaration */: + case 223 /* EnumDeclaration */: var enumDeclaration = node.parent; return spanInNodeIfStartsOnSameLine(ts.findPrecedingToken(node.pos, sourceFile, node.parent), enumDeclaration.members.length ? enumDeclaration.members[0] : enumDeclaration.getLastToken(sourceFile)); - case 218 /* ClassDeclaration */: + case 220 /* ClassDeclaration */: var classDeclaration = node.parent; return spanInNodeIfStartsOnSameLine(ts.findPrecedingToken(node.pos, sourceFile, node.parent), classDeclaration.members.length ? classDeclaration.members[0] : classDeclaration.getLastToken(sourceFile)); - case 224 /* CaseBlock */: + case 226 /* CaseBlock */: return spanInNodeIfStartsOnSameLine(node.parent.parent, node.parent.clauses[0]); } // Default to parent node @@ -53967,24 +56036,24 @@ var ts; } function spanInCloseBraceToken(node) { switch (node.parent.kind) { - case 223 /* ModuleBlock */: + case 225 /* ModuleBlock */: // If this is not instantiated module block no bp span if (ts.getModuleInstanceState(node.parent.parent) !== 1 /* Instantiated */) { return undefined; } - case 221 /* EnumDeclaration */: - case 218 /* ClassDeclaration */: + case 223 /* EnumDeclaration */: + case 220 /* ClassDeclaration */: // Span on close brace token return textSpan(node); - case 196 /* Block */: + case 198 /* Block */: if (ts.isFunctionBlock(node.parent)) { // Span on close brace token return textSpan(node); } // fall through. - case 248 /* CatchClause */: + case 251 /* CatchClause */: return spanInNode(ts.lastOrUndefined(node.parent.statements)); - case 224 /* CaseBlock */: + case 226 /* CaseBlock */: // breakpoint in last statement of the last clause var caseBlock = node.parent; var lastClause = ts.lastOrUndefined(caseBlock.clauses); @@ -53992,7 +56061,7 @@ var ts; return spanInNode(ts.lastOrUndefined(lastClause.statements)); } return undefined; - case 165 /* ObjectBindingPattern */: + case 166 /* 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); @@ -54008,7 +56077,7 @@ var ts; } function spanInCloseBracketToken(node) { switch (node.parent.kind) { - case 166 /* ArrayBindingPattern */: + case 167 /* 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); @@ -54023,12 +56092,12 @@ var ts; } } function spanInOpenParenToken(node) { - if (node.parent.kind === 201 /* DoStatement */ || - node.parent.kind === 172 /* CallExpression */ || - node.parent.kind === 173 /* NewExpression */) { + if (node.parent.kind === 203 /* DoStatement */ || + node.parent.kind === 173 /* CallExpression */ || + node.parent.kind === 174 /* NewExpression */) { return spanInPreviousNode(node); } - if (node.parent.kind === 176 /* ParenthesizedExpression */) { + if (node.parent.kind === 177 /* ParenthesizedExpression */) { return spanInNextNode(node); } // Default to parent node @@ -54037,21 +56106,21 @@ var ts; function spanInCloseParenToken(node) { // Is this close paren token of parameter list, set span in previous token switch (node.parent.kind) { - case 177 /* FunctionExpression */: - case 217 /* FunctionDeclaration */: - case 178 /* ArrowFunction */: - case 145 /* MethodDeclaration */: - case 144 /* MethodSignature */: - case 147 /* GetAccessor */: - case 148 /* SetAccessor */: - case 146 /* Constructor */: - case 202 /* WhileStatement */: - case 201 /* DoStatement */: - case 203 /* ForStatement */: - case 205 /* ForOfStatement */: - case 172 /* CallExpression */: - case 173 /* NewExpression */: - case 176 /* ParenthesizedExpression */: + case 178 /* FunctionExpression */: + case 219 /* FunctionDeclaration */: + case 179 /* ArrowFunction */: + case 146 /* MethodDeclaration */: + case 145 /* MethodSignature */: + case 148 /* GetAccessor */: + case 149 /* SetAccessor */: + case 147 /* Constructor */: + case 204 /* WhileStatement */: + case 203 /* DoStatement */: + case 205 /* ForStatement */: + case 207 /* ForOfStatement */: + case 173 /* CallExpression */: + case 174 /* NewExpression */: + case 177 /* ParenthesizedExpression */: return spanInPreviousNode(node); // Default to parent node default: @@ -54061,20 +56130,20 @@ var ts; function spanInColonToken(node) { // Is this : specifying return annotation of the function declaration if (ts.isFunctionLike(node.parent) || - node.parent.kind === 249 /* PropertyAssignment */ || - node.parent.kind === 140 /* Parameter */) { + node.parent.kind === 252 /* PropertyAssignment */ || + node.parent.kind === 141 /* Parameter */) { return spanInPreviousNode(node); } return spanInNode(node.parent); } function spanInGreaterThanOrLessThanToken(node) { - if (node.parent.kind === 175 /* TypeAssertionExpression */) { + if (node.parent.kind === 176 /* TypeAssertionExpression */) { return spanInNextNode(node); } return spanInNode(node.parent); } function spanInWhileKeyword(node) { - if (node.parent.kind === 201 /* DoStatement */) { + if (node.parent.kind === 203 /* DoStatement */) { // Set span on while expression return textSpanEndingAtNextToken(node, node.parent.expression); } @@ -54082,7 +56151,7 @@ var ts; return spanInNode(node.parent); } function spanInOfKeyword(node) { - if (node.parent.kind === 205 /* ForOfStatement */) { + if (node.parent.kind === 207 /* ForOfStatement */) { // set using next token return spanInNextNode(node); } @@ -54171,6 +56240,12 @@ var ts; if ("directoryExists" in this.shimHost) { this.directoryExists = function (directoryName) { return _this.shimHost.directoryExists(directoryName); }; } + if ("getTypeReferenceDirectiveResolutionsForFile" in this.shimHost) { + this.resolveTypeReferenceDirectives = function (typeDirectiveNames, containingFile) { + var typeDirectivesForFile = JSON.parse(_this.shimHost.getTypeReferenceDirectiveResolutionsForFile(containingFile)); + return ts.map(typeDirectiveNames, function (name) { return ts.lookUp(typeDirectivesForFile, name); }); + }; + } } LanguageServiceShimHostAdapter.prototype.log = function (s) { if (this.loggingEnabled) { @@ -54277,8 +56352,16 @@ var ts; this.directoryExists = function (directoryName) { return _this.shimHost.directoryExists(directoryName); }; } } - CoreServicesShimHostAdapter.prototype.readDirectory = function (rootDir, extension, exclude) { - var encoded = this.shimHost.readDirectory(rootDir, extension, JSON.stringify(exclude)); + CoreServicesShimHostAdapter.prototype.readDirectory = function (rootDir, extension, exclude, depth) { + // Wrap the API changes for 2.0 release. This try/catch + // should be removed once TypeScript 2.0 has shipped. + var encoded; + try { + encoded = this.shimHost.readDirectory(rootDir, extension, JSON.stringify(exclude), depth); + } + catch (e) { + encoded = this.shimHost.readDirectory(rootDir, extension, JSON.stringify(exclude)); + } return JSON.parse(encoded); }; CoreServicesShimHostAdapter.prototype.fileExists = function (fileName) { @@ -54525,7 +56608,7 @@ var ts; var _this = this; return this.forwardJSONCall("getDocumentHighlights('" + fileName + "', " + position + ")", function () { var results = _this.languageService.getDocumentHighlights(fileName, position, JSON.parse(filesToSearch)); - // workaround for VS document higlighting issue - keep only items from the initial file + // workaround for VS document highlighting issue - keep only items from the initial file var normalizedName = ts.normalizeSlashes(fileName).toLowerCase(); return ts.filter(results, function (r) { return ts.normalizeSlashes(r.fileName).toLowerCase() === normalizedName; }); }); @@ -54646,33 +56729,47 @@ var ts; }; }); }; + CoreServicesShimObject.prototype.resolveTypeReferenceDirective = function (fileName, typeReferenceDirective, compilerOptionsJson) { + var _this = this; + return this.forwardJSONCall("resolveTypeReferenceDirective(" + fileName + ")", function () { + var compilerOptions = JSON.parse(compilerOptionsJson); + var result = ts.resolveTypeReferenceDirective(typeReferenceDirective, ts.normalizeSlashes(fileName), compilerOptions, _this.host); + return { + resolvedFileName: result.resolvedTypeReferenceDirective ? result.resolvedTypeReferenceDirective.resolvedFileName : undefined, + primary: result.resolvedTypeReferenceDirective ? result.resolvedTypeReferenceDirective.primary : true, + failedLookupLocations: result.failedLookupLocations + }; + }); + }; CoreServicesShimObject.prototype.getPreProcessedFileInfo = function (fileName, sourceTextSnapshot) { + var _this = this; return this.forwardJSONCall("getPreProcessedFileInfo('" + fileName + "')", function () { // for now treat files as JavaScript var result = ts.preProcessFile(sourceTextSnapshot.getText(0, sourceTextSnapshot.getLength()), /* readImportFiles */ true, /* detectJavaScriptImports */ true); - var convertResult = { - referencedFiles: [], - importedFiles: [], + return { + referencedFiles: _this.convertFileReferences(result.referencedFiles), + importedFiles: _this.convertFileReferences(result.importedFiles), ambientExternalModules: result.ambientExternalModules, - isLibFile: result.isLibFile + isLibFile: result.isLibFile, + typeReferenceDirectives: _this.convertFileReferences(result.typeReferenceDirectives) }; - ts.forEach(result.referencedFiles, function (refFile) { - convertResult.referencedFiles.push({ - path: ts.normalizePath(refFile.fileName), - position: refFile.pos, - length: refFile.end - refFile.pos - }); - }); - ts.forEach(result.importedFiles, function (importedFile) { - convertResult.importedFiles.push({ - path: ts.normalizeSlashes(importedFile.fileName), - position: importedFile.pos, - length: importedFile.end - importedFile.pos - }); - }); - return convertResult; }); }; + CoreServicesShimObject.prototype.convertFileReferences = function (refs) { + if (!refs) { + return undefined; + } + var result = []; + for (var _i = 0, refs_2 = refs; _i < refs_2.length; _i++) { + var ref = refs_2[_i]; + result.push({ + path: ts.normalizeSlashes(ref.fileName), + position: ref.pos, + length: ref.end - ref.pos + }); + } + return result; + }; CoreServicesShimObject.prototype.getTSConfigFileInfo = function (fileName, sourceTextSnapshot) { var _this = this; return this.forwardJSONCall("getTSConfigFileInfo('" + fileName + "')", function () { @@ -54681,6 +56778,7 @@ var ts; if (result.error) { return { options: {}, + typingOptions: {}, files: [], errors: [realizeDiagnostic(result.error, "\r\n")] }; @@ -54689,6 +56787,7 @@ var ts; var configFile = ts.parseJsonConfigFileContent(result.config, _this.host, ts.getDirectoryPath(normalizedFileName), /*existingOptions*/ {}, normalizedFileName); return { options: configFile.options, + typingOptions: configFile.typingOptions, files: configFile.fileNames, errors: realizeDiagnostics(configFile.errors, "\r\n") }; @@ -54697,6 +56796,14 @@ var ts; CoreServicesShimObject.prototype.getDefaultCompilationSettings = function () { return this.forwardJSONCall("getDefaultCompilationSettings()", function () { return ts.getDefaultCompilerOptions(); }); }; + CoreServicesShimObject.prototype.discoverTypings = function (discoverTypingsJson) { + var _this = this; + 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 CoreServicesShimObject; }(ShimBase)); var TypeScriptServicesFactory = (function () { diff --git a/scripts/tslint/noNullRule.ts b/scripts/tslint/noNullRule.ts deleted file mode 100644 index 8e9deca996b..00000000000 --- a/scripts/tslint/noNullRule.ts +++ /dev/null @@ -1,20 +0,0 @@ -import * as Lint from "tslint/lib/lint"; -import * as ts from "typescript"; - - -export class Rule extends Lint.Rules.AbstractRule { - public static FAILURE_STRING = "Don't use the 'null' keyword - use 'undefined' for missing values instead"; - - public apply(sourceFile: ts.SourceFile): Lint.RuleFailure[] { - return this.applyWithWalker(new NullWalker(sourceFile, this.getOptions())); - } -} - -class NullWalker extends Lint.RuleWalker { - visitNode(node: ts.Node) { - super.visitNode(node); - if (node.kind === ts.SyntaxKind.NullKeyword) { - this.addFailure(this.createFailure(node.getStart(), node.getWidth(), Rule.FAILURE_STRING)); - } - } -} diff --git a/src/compiler/binder.ts b/src/compiler/binder.ts index 45629da8adf..0dab05691fa 100644 --- a/src/compiler/binder.ts +++ b/src/compiler/binder.ts @@ -104,6 +104,7 @@ namespace ts { function createBinder(): (file: SourceFile, options: CompilerOptions) => void { let file: SourceFile; let options: CompilerOptions; + let languageVersion: ScriptTarget; let parent: Node; let container: Node; let blockScopeContainer: Node; @@ -122,6 +123,7 @@ namespace ts { let hasAsyncFunctions: boolean; let hasDecorators: boolean; let hasParameterDecorators: boolean; + let hasJsxSpreadAttribute: boolean; // 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 @@ -135,6 +137,7 @@ namespace ts { function bindSourceFile(f: SourceFile, opts: CompilerOptions) { file = f; options = opts; + languageVersion = getEmitScriptTarget(options); inStrictMode = !!file.externalModuleIndicator; classifiableNames = {}; @@ -148,6 +151,7 @@ namespace ts { file = undefined; options = undefined; + languageVersion = undefined; parent = undefined; container = undefined; blockScopeContainer = undefined; @@ -161,6 +165,7 @@ namespace ts { hasAsyncFunctions = false; hasDecorators = false; hasParameterDecorators = false; + hasJsxSpreadAttribute = false; } return bindSourceFile; @@ -503,6 +508,9 @@ namespace ts { if (hasAsyncFunctions) { flags |= NodeFlags.HasAsyncFunctions; } + if (hasJsxSpreadAttribute) { + flags |= NodeFlags.HasJsxSpreadAttribute; + } } node.flags = flags; @@ -1127,6 +1135,35 @@ namespace ts { } } + function getStrictModeBlockScopeFunctionDeclarationMessage(node: Node) { + // Provide specialized messages to help the user understand why we think they're in + // strict mode. + if (getContainingClass(node)) { + return Diagnostics.Function_declarations_are_not_allowed_inside_blocks_in_strict_mode_when_targeting_ES3_or_ES5_Class_definitions_are_automatically_in_strict_mode; + } + + if (file.externalModuleIndicator) { + return Diagnostics.Function_declarations_are_not_allowed_inside_blocks_in_strict_mode_when_targeting_ES3_or_ES5_Modules_are_automatically_in_strict_mode; + } + + return Diagnostics.Function_declarations_are_not_allowed_inside_blocks_in_strict_mode_when_targeting_ES3_or_ES5; + } + + function checkStrictModeFunctionDeclaration(node: FunctionDeclaration) { + if (languageVersion < ScriptTarget.ES6) { + // Report error if function is not top level function declaration + if (blockScopeContainer.kind !== SyntaxKind.SourceFile && + blockScopeContainer.kind !== SyntaxKind.ModuleDeclaration && + !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. + const errorSpan = getErrorSpanForNode(file, node); + file.bindDiagnostics.push(createFileDiagnostic(file, errorSpan.start, errorSpan.length, + getStrictModeBlockScopeFunctionDeclarationMessage(node))); + } + } + } + function checkStrictModeNumericLiteral(node: LiteralExpression) { if (inStrictMode && node.isOctalLiteral) { file.bindDiagnostics.push(createDiagnosticForNode(node, Diagnostics.Octal_literals_are_not_allowed_in_strict_mode)); @@ -1306,6 +1343,10 @@ namespace ts { case SyntaxKind.EnumMember: return bindPropertyOrMethodOrAccessor(node, SymbolFlags.EnumMember, SymbolFlags.EnumMemberExcludes); + case SyntaxKind.JsxSpreadAttribute: + hasJsxSpreadAttribute = true; + return; + case SyntaxKind.CallSignature: case SyntaxKind.ConstructSignature: case SyntaxKind.IndexSignature: @@ -1641,7 +1682,13 @@ namespace ts { } checkStrictModeFunctionName(node); - return declareSymbolAndAddToSymbolTable(node, SymbolFlags.Function, SymbolFlags.FunctionExcludes); + if (inStrictMode) { + checkStrictModeFunctionDeclaration(node); + return bindBlockScopedDeclaration(node, SymbolFlags.Function, SymbolFlags.FunctionExcludes); + } + else { + return declareSymbolAndAddToSymbolTable(node, SymbolFlags.Function, SymbolFlags.FunctionExcludes); + } } function bindFunctionExpression(node: FunctionExpression) { diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index c903696f88f..2cc5fb123ee 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -83,6 +83,7 @@ namespace ts { getShorthandAssignmentValueSymbol, getExportSpecifierLocalTargetSymbol, getTypeAtLocation: getTypeOfNode, + getPropertySymbolOfDestructuringAssignment, typeToString, getSymbolDisplayBuilder, symbolToString, @@ -131,14 +132,14 @@ namespace ts { const noConstraintType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined); - const anySignature = createSignature(undefined, undefined, emptyArray, anyType, /*typePredicate*/ undefined, 0, /*hasRestParameter*/ false, /*hasStringLiterals*/ false); - const unknownSignature = createSignature(undefined, undefined, emptyArray, unknownType, /*typePredicate*/ undefined, 0, /*hasRestParameter*/ false, /*hasStringLiterals*/ false); + const anySignature = createSignature(undefined, undefined, undefined, emptyArray, anyType, /*typePredicate*/ undefined, 0, /*hasRestParameter*/ false, /*hasStringLiterals*/ false); + const unknownSignature = createSignature(undefined, undefined, undefined, emptyArray, unknownType, /*typePredicate*/ undefined, 0, /*hasRestParameter*/ false, /*hasStringLiterals*/ false); const enumNumberIndexInfo = createIndexInfo(stringType, /*isReadonly*/ true); const globals: SymbolTable = {}; - let globalESSymbolConstructorSymbol: Symbol; + let getGlobalESSymbolConstructorSymbol: () => Symbol; let getGlobalPromiseConstructorSymbol: () => Symbol; @@ -150,14 +151,19 @@ namespace ts { let globalNumberType: ObjectType; let globalBooleanType: ObjectType; let globalRegExpType: ObjectType; - let globalTemplateStringsArrayType: ObjectType; - let globalESSymbolType: ObjectType; - let globalIterableType: GenericType; - let globalIteratorType: GenericType; - let globalIterableIteratorType: GenericType; - let anyArrayType: Type; let anyReadonlyArrayType: Type; + + // 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 + // and they will not get an error from not having unrelated library files + let getGlobalTemplateStringsArrayType: () => ObjectType; + + let getGlobalESSymbolType: () => ObjectType; + let getGlobalIterableType: () => GenericType; + let getGlobalIteratorType: () => GenericType; + let getGlobalIterableIteratorType: () => GenericType; + let getGlobalClassDecoratorType: () => ObjectType; let getGlobalParameterDecoratorType: () => ObjectType; let getGlobalPropertyDecoratorType: () => ObjectType; @@ -2294,10 +2300,16 @@ namespace ts { } } - function buildDisplayForParametersAndDelimiters(parameters: Symbol[], writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags, symbolStack?: Symbol[]) { + function buildDisplayForParametersAndDelimiters(thisType: Type, parameters: Symbol[], writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags, symbolStack?: Symbol[]) { writePunctuation(writer, SyntaxKind.OpenParenToken); + if (thisType) { + writeKeyword(writer, SyntaxKind.ThisKeyword); + writePunctuation(writer, SyntaxKind.ColonToken); + writeSpace(writer); + buildTypeDisplay(thisType, writer, enclosingDeclaration, flags, symbolStack); + } for (let i = 0; i < parameters.length; i++) { - if (i > 0) { + if (i > 0 || thisType) { writePunctuation(writer, SyntaxKind.CommaToken); writeSpace(writer); } @@ -2353,7 +2365,7 @@ namespace ts { buildDisplayForTypeParametersAndDelimiters(signature.typeParameters, writer, enclosingDeclaration, flags, symbolStack); } - buildDisplayForParametersAndDelimiters(signature.parameters, writer, enclosingDeclaration, flags, symbolStack); + buildDisplayForParametersAndDelimiters(signature.thisType, signature.parameters, writer, enclosingDeclaration, flags, symbolStack); buildReturnTypeDisplay(signature, writer, enclosingDeclaration, flags, symbolStack); } @@ -2793,7 +2805,9 @@ namespace ts { } } // Use contextual parameter type if one is available - const type = getContextuallyTypedParameterType(declaration); + const type = declaration.symbol.name === "this" + ? getContextuallyTypedThisType(func) + : getContextuallyTypedParameterType(declaration); if (type) { return strictNullChecks && declaration.questionToken ? addNullableKind(type, TypeFlags.Undefined) : type; } @@ -2823,11 +2837,16 @@ namespace ts { // pattern. Otherwise, it is the type any. function getTypeFromBindingElement(element: BindingElement, includePatternInType?: boolean): Type { if (element.initializer) { - return getWidenedType(checkExpressionCached(element.initializer)); + const type = checkExpressionCached(element.initializer); + reportErrorsFromWidening(element, type); + return getWidenedType(type); } if (isBindingPattern(element.name)) { return getTypeFromBindingPattern(element.name, includePatternInType); } + if (compilerOptions.noImplicitAny && !declarationBelongsToPrivateAmbientMember(element)) { + reportImplicitAnyError(element, anyType); + } return anyType; } @@ -2918,14 +2937,19 @@ namespace ts { // Report implicit any errors unless this is a private property within an ambient declaration if (reportErrors && compilerOptions.noImplicitAny) { - const root = getRootDeclaration(declaration); - if (!isPrivateWithinAmbient(root) && !(root.kind === SyntaxKind.Parameter && isPrivateWithinAmbient(root.parent))) { + if (!declarationBelongsToPrivateAmbientMember(declaration)) { reportImplicitAnyError(declaration, type); } } return type; } + function declarationBelongsToPrivateAmbientMember(declaration: VariableLikeDeclaration) { + const root = getRootDeclaration(declaration); + const memberDeclaration = root.kind === SyntaxKind.Parameter ? root.parent : root; + return isPrivateWithinAmbient(memberDeclaration); + } + function getTypeOfVariableOrParameterOrProperty(symbol: Symbol): Type { const links = getSymbolLinks(symbol); if (!links.type) { @@ -3655,12 +3679,13 @@ namespace ts { resolveObjectTypeMembers(type, source, typeParameters, typeArguments); } - function createSignature(declaration: SignatureDeclaration, typeParameters: TypeParameter[], parameters: Symbol[], + function createSignature(declaration: SignatureDeclaration, typeParameters: TypeParameter[], thisType: Type, parameters: Symbol[], resolvedReturnType: Type, typePredicate: TypePredicate, minArgumentCount: number, hasRestParameter: boolean, hasStringLiterals: boolean): Signature { const sig = new Signature(checker); sig.declaration = declaration; sig.typeParameters = typeParameters; sig.parameters = parameters; + sig.thisType = thisType; sig.resolvedReturnType = resolvedReturnType; sig.typePredicate = typePredicate; sig.minArgumentCount = minArgumentCount; @@ -3670,7 +3695,7 @@ namespace ts { } function cloneSignature(sig: Signature): Signature { - return createSignature(sig.declaration, sig.typeParameters, sig.parameters, sig.resolvedReturnType, + return createSignature(sig.declaration, sig.typeParameters, sig.thisType, sig.parameters, sig.resolvedReturnType, sig.typePredicate, sig.minArgumentCount, sig.hasRestParameter, sig.hasStringLiterals); } @@ -3678,7 +3703,7 @@ namespace ts { const baseConstructorType = getBaseConstructorTypeOfClass(classType); const baseSignatures = getSignaturesOfType(baseConstructorType, SignatureKind.Construct); if (baseSignatures.length === 0) { - return [createSignature(undefined, classType.localTypeParameters, emptyArray, classType, /*typePredicate*/ undefined, 0, /*hasRestParameter*/ false, /*hasStringLiterals*/ false)]; + return [createSignature(undefined, classType.localTypeParameters, undefined, emptyArray, classType, /*typePredicate*/ undefined, 0, /*hasRestParameter*/ false, /*hasStringLiterals*/ false)]; } const baseTypeNode = getBaseTypeNodeOfClass(classType); const typeArguments = map(baseTypeNode.typeArguments, getTypeFromTypeNode); @@ -3715,9 +3740,9 @@ namespace ts { setObjectTypeMembers(type, members, arrayType.callSignatures, arrayType.constructSignatures, arrayType.stringIndexInfo, arrayType.numberIndexInfo); } - function findMatchingSignature(signatureList: Signature[], signature: Signature, partialMatch: boolean, ignoreReturnTypes: boolean): Signature { + function findMatchingSignature(signatureList: Signature[], signature: Signature, partialMatch: boolean, ignoreThisTypes: boolean, ignoreReturnTypes: boolean): Signature { for (const s of signatureList) { - if (compareSignaturesIdentical(s, signature, partialMatch, ignoreReturnTypes, compareTypesIdentical)) { + if (compareSignaturesIdentical(s, signature, partialMatch, ignoreThisTypes, ignoreReturnTypes, compareTypesIdentical)) { return s; } } @@ -3731,7 +3756,7 @@ namespace ts { return undefined; } for (let i = 1; i < signatureLists.length; i++) { - if (!findMatchingSignature(signatureLists[i], signature, /*partialMatch*/ false, /*ignoreReturnTypes*/ false)) { + if (!findMatchingSignature(signatureLists[i], signature, /*partialMatch*/ false, /*ignoreThisTypes*/ false, /*ignoreReturnTypes*/ false)) { return undefined; } } @@ -3740,7 +3765,7 @@ namespace ts { let result: Signature[] = undefined; for (let i = 0; i < signatureLists.length; i++) { // Allow matching non-generic signatures to have excess parameters and different return types - const match = i === listIndex ? signature : findMatchingSignature(signatureLists[i], signature, /*partialMatch*/ true, /*ignoreReturnTypes*/ true); + const match = i === listIndex ? signature : findMatchingSignature(signatureLists[i], signature, /*partialMatch*/ true, /*ignoreThisTypes*/ true, /*ignoreReturnTypes*/ true); if (!match) { return undefined; } @@ -3761,13 +3786,16 @@ namespace ts { for (let i = 0; i < signatureLists.length; i++) { for (const signature of signatureLists[i]) { // Only process signatures with parameter lists that aren't already in the result list - if (!result || !findMatchingSignature(result, signature, /*partialMatch*/ false, /*ignoreReturnTypes*/ true)) { + if (!result || !findMatchingSignature(result, signature, /*partialMatch*/ false, /*ignoreThisTypes*/ true, /*ignoreReturnTypes*/ true)) { const unionSignatures = findMatchingSignatures(signatureLists, signature, i); if (unionSignatures) { let s = signature; // Union the result types when more than one signature matches if (unionSignatures.length > 1) { s = cloneSignature(signature); + if (forEach(unionSignatures, sig => sig.thisType)) { + s.thisType = getUnionType(map(unionSignatures, sig => sig.thisType || anyType)); + } // Clear resolved return type we possibly got from cloneSignature s.resolvedReturnType = undefined; s.unionSignatures = unionSignatures; @@ -3977,7 +4005,7 @@ namespace ts { type = globalBooleanType; } else if (type.flags & TypeFlags.ESSymbol) { - type = globalESSymbolType; + type = getGlobalESSymbolType(); } return type; } @@ -4221,6 +4249,8 @@ namespace ts { const parameters: Symbol[] = []; let hasStringLiterals = false; let minArgumentCount = -1; + let thisType: Type = undefined; + let hasThisParameter: boolean; const isJSConstructSignature = isJSDocConstructSignature(declaration); let returnType: Type = undefined; let typePredicate: TypePredicate = undefined; @@ -4237,7 +4267,13 @@ namespace ts { const resolvedSymbol = resolveName(param, paramSymbol.name, SymbolFlags.Value, undefined, undefined); paramSymbol = resolvedSymbol; } - parameters.push(paramSymbol); + if (i === 0 && paramSymbol.name === "this") { + hasThisParameter = true; + thisType = param.type ? getTypeFromTypeNode(param.type) : unknownType; + } + else { + parameters.push(paramSymbol); + } if (param.type && param.type.kind === SyntaxKind.StringLiteralType) { hasStringLiterals = true; @@ -4245,7 +4281,7 @@ namespace ts { if (param.initializer || param.questionToken || param.dotDotDotToken) { if (minArgumentCount < 0) { - minArgumentCount = i; + minArgumentCount = i - (hasThisParameter ? 1 : 0); } } else { @@ -4255,7 +4291,7 @@ namespace ts { } if (minArgumentCount < 0) { - minArgumentCount = declaration.parameters.length; + minArgumentCount = declaration.parameters.length - (hasThisParameter ? 1 : 0); } if (isJSConstructSignature) { @@ -4291,7 +4327,7 @@ namespace ts { } } - links.resolvedSignature = createSignature(declaration, typeParameters, parameters, returnType, typePredicate, minArgumentCount, hasRestParameter(declaration), hasStringLiterals); + links.resolvedSignature = createSignature(declaration, typeParameters, thisType, parameters, returnType, typePredicate, minArgumentCount, hasRestParameter(declaration), hasStringLiterals); } return links.resolvedSignature; } @@ -4748,10 +4784,6 @@ namespace ts { return typeSymbol && getDeclaredTypeOfSymbol(typeSymbol); } - function getGlobalESSymbolConstructorSymbol() { - return globalESSymbolConstructorSymbol || (globalESSymbolConstructorSymbol = getGlobalValueSymbol("Symbol")); - } - /** * Creates a TypeReference for a generic `TypedPropertyDescriptor`. */ @@ -4770,11 +4802,11 @@ namespace ts { } function createIterableType(elementType: Type): Type { - return createTypeFromGenericGlobalType(globalIterableType, [elementType]); + return createTypeFromGenericGlobalType(getGlobalIterableType(), [elementType]); } function createIterableIteratorType(elementType: Type): Type { - return createTypeFromGenericGlobalType(globalIterableIteratorType, [elementType]); + return createTypeFromGenericGlobalType(getGlobalIterableIteratorType(), [elementType]); } function createArrayType(elementType: Type): Type { @@ -4987,7 +5019,7 @@ namespace ts { return links.resolvedType; } - function getThisType(node: TypeNode): Type { + function getThisType(node: Node): Type { const container = getThisContainer(node, /*includeArrowFunctions*/ false); const parent = container && container.parent; if (parent && (isClassLike(parent) || parent.kind === SyntaxKind.InterfaceDeclaration)) { @@ -5194,6 +5226,7 @@ namespace ts { freshTypePredicate = cloneTypePredicate(signature.typePredicate, mapper); } const result = createSignature(signature.declaration, freshTypeParameters, + signature.thisType && instantiateType(signature.thisType, mapper), instantiateList(signature.parameters, mapper, instantiateSymbol), instantiateType(signature.resolvedReturnType, mapper), freshTypePredicate, @@ -5362,7 +5395,9 @@ namespace ts { } function isContextSensitiveFunctionLikeDeclaration(node: FunctionLikeDeclaration) { - return !node.typeParameters && node.parameters.length && !forEach(node.parameters, p => p.type); + const areAllParametersUntyped = !forEach(node.parameters, p => p.type); + const isNullaryArrow = node.kind === SyntaxKind.ArrowFunction && !node.parameters.length; + return !node.typeParameters && areAllParametersUntyped && !isNullaryArrow; } function getTypeWithoutSignatures(type: Type): Type { @@ -5402,6 +5437,10 @@ namespace ts { return checkTypeAssignableTo(source, target, /*errorNode*/ undefined); } + /** + * This is *not* a bi-directional relationship. + * If one needs to check both directions for comparability, use a second call to this function or 'checkTypeComparableTo'. + */ function isTypeComparableTo(source: Type, target: Type): boolean { return checkTypeComparableTo(source, target, /*errorNode*/ undefined); } @@ -5414,6 +5453,10 @@ namespace ts { return checkTypeRelatedTo(source, target, assignableRelation, errorNode, headMessage, containingMessageChain); } + /** + * This is *not* a bi-directional relationship. + * If one needs to check both directions for comparability, use a second call to this function or 'isTypeComparableTo'. + */ function checkTypeComparableTo(source: Type, target: Type, errorNode: Node, headMessage?: DiagnosticMessage, containingMessageChain?: DiagnosticMessageChain): boolean { return checkTypeRelatedTo(source, target, comparableRelation, errorNode, headMessage, containingMessageChain); } @@ -5447,6 +5490,18 @@ namespace ts { target = getErasedSignature(target); let result = Ternary.True; + if (source.thisType && target.thisType && source.thisType !== voidType) { + // void sources are assignable to anything. + const related = compareTypes(source.thisType, target.thisType, /*reportErrors*/ false) + || compareTypes(target.thisType, source.thisType, reportErrors); + if (!related) { + if (reportErrors) { + errorReporter(Diagnostics.The_this_types_of_each_signature_are_incompatible); + } + return Ternary.False; + } + result &= related; + } const sourceMax = getNumNonRestParameters(source); const targetMax = getNumNonRestParameters(target); @@ -5624,7 +5679,14 @@ namespace ts { sourceType = typeToString(source, /*enclosingDeclaration*/ undefined, TypeFormatFlags.UseFullyQualifiedType); targetType = typeToString(target, /*enclosingDeclaration*/ undefined, TypeFormatFlags.UseFullyQualifiedType); } - reportError(message || Diagnostics.Type_0_is_not_assignable_to_type_1, sourceType, targetType); + + if (!message) { + message = relation === comparableRelation ? + Diagnostics.Type_0_is_not_comparable_to_type_1 : + Diagnostics.Type_0_is_not_assignable_to_type_1; + } + + reportError(message, sourceType, targetType); } // Compare two types and return @@ -5653,10 +5715,12 @@ namespace ts { } } if (source.flags & TypeFlags.StringLiteral && target === stringType) return Ternary.True; + if (relation === assignableRelation || relation === comparableRelation) { if (isTypeAny(source)) return Ternary.True; if (source === numberType && target.flags & TypeFlags.Enum) return Ternary.True; } + if (source.flags & TypeFlags.Boolean && target.flags & TypeFlags.Boolean) { return Ternary.True; } @@ -5679,26 +5743,28 @@ namespace ts { const saveErrorInfo = errorInfo; - // Note that the "each" checks must precede the "some" checks to produce the correct results + // Note that these checks are specifically ordered to produce correct results. if (source.flags & TypeFlags.Union) { if (relation === comparableRelation) { - if (result = someTypeRelatedToType(source, target, reportErrors)) { - return result; - } + result = someTypeRelatedToType(source as UnionType, target, reportErrors); } else { - if (result = eachTypeRelatedToType(source, target, reportErrors)) { - return result; - } + result = eachTypeRelatedToType(source as UnionType, target, reportErrors); + } + + if (result) { + return result; } } else if (target.flags & TypeFlags.Intersection) { - if (result = typeRelatedToEachType(source, target, reportErrors)) { + result = typeRelatedToEachType(source, target as IntersectionType, reportErrors); + + if (result) { return result; } } else { - // It is necessary to try "some" checks on both sides because there may be nested "each" checks + // 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 & TypeFlags.Intersection) { @@ -5780,8 +5846,8 @@ namespace ts { } if (source.flags & TypeFlags.Union && target.flags & TypeFlags.Union || source.flags & TypeFlags.Intersection && target.flags & TypeFlags.Intersection) { - if (result = eachTypeRelatedToSomeType(source, target)) { - if (result &= eachTypeRelatedToSomeType(target, source)) { + if (result = eachTypeRelatedToSomeType(source, target, /*reportErrors*/ false)) { + if (result &= eachTypeRelatedToSomeType(target, source, /*reportErrors*/ false)) { return result; } } @@ -5832,7 +5898,7 @@ namespace ts { return false; } - function eachTypeRelatedToSomeType(source: UnionOrIntersectionType, target: UnionOrIntersectionType): Ternary { + function eachTypeRelatedToSomeType(source: UnionOrIntersectionType, target: UnionOrIntersectionType, reportErrors: boolean): Ternary { let result = Ternary.True; const sourceTypes = source.types; for (const sourceType of sourceTypes) { @@ -6192,7 +6258,7 @@ namespace ts { } let result = Ternary.True; for (let i = 0, len = sourceSignatures.length; i < len; i++) { - const related = compareSignaturesIdentical(sourceSignatures[i], targetSignatures[i], /*partialMatch*/ false, /*ignoreReturnTypes*/ false, isRelatedTo); + const related = compareSignaturesIdentical(sourceSignatures[i], targetSignatures[i], /*partialMatch*/ false, /*ignoreThisTypes*/ false, /*ignoreReturnTypes*/ false, isRelatedTo); if (!related) { return Ternary.False; } @@ -6414,7 +6480,7 @@ namespace ts { /** * See signatureRelatedTo, compareSignaturesIdentical */ - function compareSignaturesIdentical(source: Signature, target: Signature, partialMatch: boolean, ignoreReturnTypes: boolean, compareTypes: (s: Type, t: Type) => Ternary): Ternary { + function compareSignaturesIdentical(source: Signature, target: Signature, partialMatch: boolean, ignoreThisTypes: boolean, ignoreReturnTypes: boolean, compareTypes: (s: Type, t: Type) => Ternary): Ternary { // TODO (drosen): De-duplicate code between related functions. if (source === target) { return Ternary.True; @@ -6435,6 +6501,13 @@ namespace ts { source = getErasedSignature(source); target = getErasedSignature(target); let result = Ternary.True; + if (!ignoreThisTypes && source.thisType && target.thisType) { + const related = compareTypes(source.thisType, target.thisType); + if (!related) { + return Ternary.False; + } + result &= related; + } const targetLen = target.parameters.length; for (let i = 0; i < targetLen; i++) { const s = isRestParameterIndex(source, i) ? getRestTypeOfSignature(source) : getTypeOfParameter(source.parameters[i]); @@ -6742,6 +6815,9 @@ namespace ts { Diagnostics.Rest_parameter_0_implicitly_has_an_any_type : Diagnostics.Parameter_0_implicitly_has_an_1_type; break; + case SyntaxKind.BindingElement: + diagnostic = Diagnostics.Binding_element_0_implicitly_has_an_1_type; + break; case SyntaxKind.FunctionDeclaration: case SyntaxKind.MethodDeclaration: case SyntaxKind.MethodSignature: @@ -6771,29 +6847,23 @@ namespace ts { } function forEachMatchingParameterType(source: Signature, target: Signature, callback: (s: Type, t: Type) => void) { - let sourceMax = source.parameters.length; - let targetMax = target.parameters.length; + const sourceMax = source.parameters.length; + const targetMax = target.parameters.length; let count: number; if (source.hasRestParameter && target.hasRestParameter) { - count = sourceMax > targetMax ? sourceMax : targetMax; - sourceMax--; - targetMax--; + count = Math.max(sourceMax, targetMax); } else if (source.hasRestParameter) { - sourceMax--; count = targetMax; } else if (target.hasRestParameter) { - targetMax--; count = sourceMax; } else { - count = sourceMax < targetMax ? sourceMax : targetMax; + count = Math.min(sourceMax, targetMax); } for (let i = 0; i < count; i++) { - const s = i < sourceMax ? getTypeOfParameter(source.parameters[i]) : getRestTypeOfSignature(source); - const t = i < targetMax ? getTypeOfParameter(target.parameters[i]) : getRestTypeOfSignature(target); - callback(s, t); + callback(getTypeAtPosition(source, i), getTypeAtPosition(target, i)); } } @@ -8025,7 +8095,24 @@ namespace ts { if (needToCaptureLexicalThis) { captureLexicalThis(node, container); } - + if (isFunctionLike(container)) { + const type = getContextuallyTypedThisType(container); + if (type) { + return type; + } + const signature = getSignatureFromDeclaration(container); + if (signature.thisType) { + return signature.thisType; + } + if (container.parent && container.parent.kind === SyntaxKind.ObjectLiteralExpression) { + // Note: this works because object literal methods are deferred, + // which means that the type of the containing object literal is already known. + const type = checkExpressionCached(container.parent); + if (type) { + return type; + } + } + } if (isClassLike(container.parent)) { const symbol = getSymbolOfNode(container.parent); const type = container.flags & NodeFlags.Static ? getTypeOfSymbol(symbol) : (getDeclaredTypeOfSymbol(symbol)).thisType; @@ -8055,6 +8142,10 @@ namespace ts { } } + if (compilerOptions.noImplicitThis) { + // With noImplicitThis, functions may not reference 'this' if it has type 'any' + error(node, Diagnostics.this_implicitly_has_type_any_because_it_does_not_have_a_type_annotation); + } return anyType; } @@ -8272,6 +8363,19 @@ namespace ts { } } + function getContextuallyTypedThisType(func: FunctionLikeDeclaration): Type { + if ((isFunctionExpressionOrArrowFunction(func) || isObjectLiteralMethod(func)) && + isContextSensitive(func) && + func.kind !== SyntaxKind.ArrowFunction) { + const contextualSignature = getContextualSignature(func); + if (contextualSignature) { + return contextualSignature.thisType; + } + } + + return undefined; + } + // Return contextual type of parameter or undefined if no contextual type is available function getContextuallyTypedParameterType(parameter: ParameterDeclaration): Type { const func = parameter.parent; @@ -8681,7 +8785,7 @@ namespace ts { // This signature will contribute to contextual union signature signatureList = [signature]; } - else if (!compareSignaturesIdentical(signatureList[0], signature, /*partialMatch*/ false, /*ignoreReturnTypes*/ true, compareTypesIdentical)) { + else if (!compareSignaturesIdentical(signatureList[0], signature, /*partialMatch*/ false, /*ignoreThisTypes*/ true, /*ignoreReturnTypes*/ true, compareTypesIdentical)) { // Signatures aren't identical, do not use return undefined; } @@ -10051,6 +10155,12 @@ namespace ts { context.failedTypeParameterIndex = undefined; } + if (signature.thisType) { + const thisArgumentNode = getThisArgumentOfCall(node); + const thisArgumentType = thisArgumentNode ? checkExpression(thisArgumentNode) : voidType; + inferTypes(context, thisArgumentType, signature.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. const argCount = getEffectiveArgumentCount(node, args, signature); @@ -10124,6 +10234,20 @@ namespace ts { } function checkApplicableSignature(node: CallLikeExpression, args: Expression[], signature: Signature, relation: Map, excludeArgument: boolean[], reportErrors: boolean) { + + if (signature.thisType && signature.thisType !== voidType && node.kind !== SyntaxKind.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. + const thisArgumentNode = getThisArgumentOfCall(node); + const thisArgumentType = thisArgumentNode ? checkExpression(thisArgumentNode) : voidType; + const errorNode = reportErrors ? (thisArgumentNode || node) : undefined; + const headMessage = Diagnostics.The_this_context_of_type_0_is_not_assignable_to_method_s_this_of_type_1; + if (!checkTypeRelatedTo(thisArgumentType, signature.thisType, relation, errorNode, headMessage)) { + return false; + } + } + const headMessage = Diagnostics.Argument_of_type_0_is_not_assignable_to_parameter_of_type_1; const argCount = getEffectiveArgumentCount(node, args, signature); for (let i = 0; i < argCount; i++) { const arg = getEffectiveArgument(node, args, i); @@ -10143,7 +10267,6 @@ namespace ts { // Use argument expression as error location when reporting errors const errorNode = reportErrors ? getEffectiveArgumentErrorNode(node, i, arg) : undefined; - const headMessage = Diagnostics.Argument_of_type_0_is_not_assignable_to_parameter_of_type_1; if (!checkTypeRelatedTo(argType, paramType, relation, errorNode, headMessage)) { return false; } @@ -10153,6 +10276,21 @@ namespace ts { return true; } + /** + * Returns the this argument in calls like x.f(...) and x[f](...). Undefined otherwise. + */ + function getThisArgumentOfCall(node: CallLikeExpression): LeftHandSideExpression { + if (node.kind === SyntaxKind.CallExpression) { + const callee = (node).expression; + if (callee.kind === SyntaxKind.PropertyAccessExpression) { + return (callee as PropertyAccessExpression).expression; + } + else if (callee.kind === SyntaxKind.ElementAccessExpression) { + return (callee as ElementAccessExpression).expression; + } + } + } + /** * Returns the effective arguments for an expression that works like a function invocation. * @@ -10420,7 +10558,7 @@ namespace ts { return getEffectiveDecoratorArgumentType(node, argIndex); } else if (argIndex === 0 && node.kind === SyntaxKind.TaggedTemplateExpression) { - return globalTemplateStringsArrayType; + return getGlobalTemplateStringsArrayType(); } // This is not a synthetic argument, so we return 'undefined' @@ -10810,13 +10948,16 @@ namespace ts { // If expressionType's apparent type is an object type with no construct signatures but // one or more call signatures, the expression is processed as a function call. A compile-time // error occurs if the result of the function call is not Void. The type of the result of the - // operation is Any. + // operation is Any. It is an error to have a Void this type. const callSignatures = getSignaturesOfType(expressionType, SignatureKind.Call); if (callSignatures.length) { const signature = resolveCall(node, callSignatures, candidatesOutArray); if (getReturnTypeOfSignature(signature) !== voidType) { error(node, Diagnostics.Only_a_void_function_can_be_called_with_the_new_keyword); } + if (signature.thisType === voidType) { + error(node, Diagnostics.A_function_that_is_called_with_the_new_keyword_cannot_have_a_this_type_that_is_void); + } return signature; } @@ -11020,7 +11161,7 @@ namespace ts { if (produceDiagnostics && targetType !== unknownType) { const widenedType = getWidenedType(exprType); if (!isTypeComparableTo(targetType, widenedType)) { - checkTypeComparableTo(exprType, targetType, node, Diagnostics.Neither_type_0_nor_type_1_is_assignable_to_the_other); + checkTypeComparableTo(exprType, targetType, node, Diagnostics.Type_0_cannot_be_converted_to_type_1); } } return targetType; @@ -11675,39 +11816,43 @@ namespace ts { function checkObjectLiteralAssignment(node: ObjectLiteralExpression, sourceType: Type, contextualMapper?: TypeMapper): Type { const properties = node.properties; for (const p of properties) { - if (p.kind === SyntaxKind.PropertyAssignment || p.kind === SyntaxKind.ShorthandPropertyAssignment) { - const name = (p).name; - if (name.kind === SyntaxKind.ComputedPropertyName) { - checkComputedPropertyName(name); - } - if (isComputedNonLiteralName(name)) { - continue; - } + checkObjectLiteralDestructuringPropertyAssignment(sourceType, p, contextualMapper); + } + return sourceType; + } - const text = getTextOfPropertyName(name); - const type = isTypeAny(sourceType) - ? sourceType - : getTypeOfPropertyOfType(sourceType, text) || - isNumericLiteralName(text) && getIndexTypeOfType(sourceType, IndexKind.Number) || - getIndexTypeOfType(sourceType, IndexKind.String); - if (type) { - if (p.kind === SyntaxKind.ShorthandPropertyAssignment) { - checkDestructuringAssignment(p, type); - } - else { - // non-shorthand property assignments should always have initializers - checkDestructuringAssignment((p).initializer, type); - } + function checkObjectLiteralDestructuringPropertyAssignment(objectLiteralType: Type, property: ObjectLiteralElement, contextualMapper?: TypeMapper) { + if (property.kind === SyntaxKind.PropertyAssignment || property.kind === SyntaxKind.ShorthandPropertyAssignment) { + const name = (property).name; + if (name.kind === SyntaxKind.ComputedPropertyName) { + checkComputedPropertyName(name); + } + if (isComputedNonLiteralName(name)) { + return undefined; + } + + const text = getTextOfPropertyName(name); + const type = isTypeAny(objectLiteralType) + ? objectLiteralType + : getTypeOfPropertyOfType(objectLiteralType, text) || + isNumericLiteralName(text) && getIndexTypeOfType(objectLiteralType, IndexKind.Number) || + getIndexTypeOfType(objectLiteralType, IndexKind.String); + if (type) { + if (property.kind === SyntaxKind.ShorthandPropertyAssignment) { + return checkDestructuringAssignment(property, type); } else { - error(name, Diagnostics.Type_0_has_no_property_1_and_no_string_index_signature, typeToString(sourceType), declarationNameToString(name)); + // non-shorthand property assignments should always have initializers + return checkDestructuringAssignment((property).initializer, type); } } else { - error(p, Diagnostics.Property_assignment_expected); + error(name, Diagnostics.Type_0_has_no_property_1_and_no_string_index_signature, typeToString(objectLiteralType), declarationNameToString(name)); } } - return sourceType; + else { + error(property, Diagnostics.Property_assignment_expected); + } } function checkArrayLiteralAssignment(node: ArrayLiteralExpression, sourceType: Type, contextualMapper?: TypeMapper): Type { @@ -11717,44 +11862,51 @@ namespace ts { const elementType = checkIteratedTypeOrElementType(sourceType, node, /*allowStringInput*/ false) || unknownType; const elements = node.elements; for (let i = 0; i < elements.length; i++) { - const e = elements[i]; - if (e.kind !== SyntaxKind.OmittedExpression) { - if (e.kind !== SyntaxKind.SpreadElementExpression) { - const propName = "" + i; - const type = isTypeAny(sourceType) - ? sourceType - : isTupleLikeType(sourceType) - ? getTypeOfPropertyOfType(sourceType, propName) - : elementType; - if (type) { - checkDestructuringAssignment(e, type, contextualMapper); - } - else { - if (isTupleType(sourceType)) { - error(e, Diagnostics.Tuple_type_0_with_length_1_cannot_be_assigned_to_tuple_with_length_2, typeToString(sourceType), (sourceType).elementTypes.length, elements.length); - } - else { - error(e, Diagnostics.Type_0_has_no_property_1, typeToString(sourceType), propName); - } - } + checkArrayLiteralDestructuringElementAssignment(node, sourceType, i, elementType, contextualMapper); + } + return sourceType; + } + + function checkArrayLiteralDestructuringElementAssignment(node: ArrayLiteralExpression, sourceType: Type, + elementIndex: number, elementType: Type, contextualMapper?: TypeMapper) { + const elements = node.elements; + const element = elements[elementIndex]; + if (element.kind !== SyntaxKind.OmittedExpression) { + if (element.kind !== SyntaxKind.SpreadElementExpression) { + const propName = "" + elementIndex; + const type = isTypeAny(sourceType) + ? sourceType + : isTupleLikeType(sourceType) + ? getTypeOfPropertyOfType(sourceType, propName) + : elementType; + if (type) { + return checkDestructuringAssignment(element, type, contextualMapper); } else { - if (i < elements.length - 1) { - error(e, Diagnostics.A_rest_element_must_be_last_in_an_array_destructuring_pattern); + if (isTupleType(sourceType)) { + error(element, Diagnostics.Tuple_type_0_with_length_1_cannot_be_assigned_to_tuple_with_length_2, typeToString(sourceType), (sourceType).elementTypes.length, elements.length); } else { - const restExpression = (e).expression; - if (restExpression.kind === SyntaxKind.BinaryExpression && (restExpression).operatorToken.kind === SyntaxKind.EqualsToken) { - error((restExpression).operatorToken, Diagnostics.A_rest_element_cannot_have_an_initializer); - } - else { - checkDestructuringAssignment(restExpression, createArrayType(elementType), contextualMapper); - } + error(element, Diagnostics.Type_0_has_no_property_1, typeToString(sourceType), propName); + } + } + } + else { + if (elementIndex < elements.length - 1) { + error(element, Diagnostics.A_rest_element_must_be_last_in_an_array_destructuring_pattern); + } + else { + const restExpression = (element).expression; + if (restExpression.kind === SyntaxKind.BinaryExpression && (restExpression).operatorToken.kind === SyntaxKind.EqualsToken) { + error((restExpression).operatorToken, Diagnostics.A_rest_element_cannot_have_an_initializer); + } + else { + return checkDestructuringAssignment(restExpression, createArrayType(elementType), contextualMapper); } } } } - return sourceType; + return undefined; } function checkDestructuringAssignment(exprOrAssignment: Expression | ShorthandPropertyAssignment, sourceType: Type, contextualMapper?: TypeMapper): Type { @@ -12290,6 +12442,17 @@ namespace ts { if (node.questionToken && isBindingPattern(node.name) && func.body) { error(node, Diagnostics.A_binding_pattern_parameter_cannot_be_optional_in_an_implementation_signature); } + if ((node.name).text === "this") { + if (indexOf(func.parameters, node) !== 0) { + error(node, Diagnostics.A_this_parameter_must_be_the_first_parameter); + } + if (func.kind === SyntaxKind.Constructor || func.kind === SyntaxKind.ConstructSignature || func.kind === SyntaxKind.ConstructorType) { + error(node, Diagnostics.A_constructor_cannot_have_a_this_parameter); + } + if (func.kind === SyntaxKind.SetAccessor) { + error(node, Diagnostics.A_setter_cannot_have_a_this_parameter); + } + } // Only check rest parameter type if it's not a binding pattern. Since binding patterns are // not allowed in a rest parameter, we already have an error from checkGrammarParameterList. @@ -14184,7 +14347,7 @@ namespace 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 & TypeFlags.Reference) && (type).target === globalIterableType) { + if ((type.flags & TypeFlags.Reference) && (type).target === getGlobalIterableType()) { typeAsIterable.iterableElementType = (type).typeArguments[0]; } else { @@ -14230,7 +14393,7 @@ namespace 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 & TypeFlags.Reference) && (type).target === globalIteratorType) { + if ((type.flags & TypeFlags.Reference) && (type).target === getGlobalIteratorType()) { typeAsIterator.iteratorElementType = (type).typeArguments[0]; } else { @@ -14274,7 +14437,7 @@ namespace ts { // As an optimization, if the type is instantiated directly using the globalIterableIteratorType (IterableIterator), // then just grab its type argument. - if ((type.flags & TypeFlags.Reference) && (type).target === globalIterableIteratorType) { + if ((type.flags & TypeFlags.Reference) && (type).target === getGlobalIterableIteratorType()) { return (type).typeArguments[0]; } @@ -14463,7 +14626,7 @@ namespace ts { if (produceDiagnostics && clause.kind === SyntaxKind.CaseClause) { const caseClause = clause; - // TypeScript 1.0 spec (April 2014):5.9 + // 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. const caseType = checkExpression(caseClause.expression); @@ -16416,6 +16579,53 @@ namespace ts { return unknownType; } + // Gets the type of object literal or array literal of destructuring assignment. + // { a } from + // for ( { a } of elems) { + // } + // [ a ] from + // [a] = [ some array ...] + function getTypeOfArrayLiteralOrObjectLiteralDestructuringAssignment(expr: Expression): Type { + Debug.assert(expr.kind === SyntaxKind.ObjectLiteralExpression || expr.kind === SyntaxKind.ArrayLiteralExpression); + // If this is from "for of" + // for ( { a } of elems) { + // } + if (expr.parent.kind === SyntaxKind.ForOfStatement) { + const iteratedType = checkRightHandSideOfForOf((expr.parent).expression); + return checkDestructuringAssignment(expr, iteratedType || unknownType); + } + // If this is from "for" initializer + // for ({a } = elems[0];.....) { } + if (expr.parent.kind === SyntaxKind.BinaryExpression) { + const iteratedType = checkExpression((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 === SyntaxKind.PropertyAssignment) { + const typeOfParentObjectLiteral = getTypeOfArrayLiteralOrObjectLiteralDestructuringAssignment(expr.parent.parent); + return checkObjectLiteralDestructuringPropertyAssignment(typeOfParentObjectLiteral || unknownType, expr.parent); + } + // Array literal assignment - array destructuring pattern + Debug.assert(expr.parent.kind === SyntaxKind.ArrayLiteralExpression); + // [{ property1: p1, property2 }] = elems; + const typeOfArrayLiteral = getTypeOfArrayLiteralOrObjectLiteralDestructuringAssignment(expr.parent); + const elementType = checkIteratedTypeOrElementType(typeOfArrayLiteral || unknownType, expr.parent, /*allowStringInput*/ false) || unknownType; + return checkArrayLiteralDestructuringElementAssignment(expr.parent, typeOfArrayLiteral, + indexOf((expr.parent).elements, expr), elementType || unknownType); + } + + // Gets the property symbol corresponding to the property in destructuring assignment + // 'property1' from + // for ( { property1: a } of elems) { + // } + // 'property1' at location 'a' from: + // [a] = [ property1, property2 ] + function getPropertySymbolOfDestructuringAssignment(location: Identifier) { + // Get the type of the object or array literal and then look for property of given name in the type + const typeOfObjectLiteral = getTypeOfArrayLiteralOrObjectLiteralDestructuringAssignment(location.parent.parent); + return typeOfObjectLiteral && getPropertyOfType(typeOfObjectLiteral, location.text); + } function getTypeOfExpression(expr: Expression): Type { if (isRightSideOfQualifiedNameOrPropertyAccess(expr)) { @@ -16801,6 +17011,25 @@ namespace ts { } function createResolver(): EmitResolver { + // this variable and functions that use it are deliberately moved here from the outer scope + // to avoid scope pollution + const resolvedTypeReferenceDirectives = host.getResolvedTypeReferenceDirectives(); + let fileToDirective: FileMap; + if (resolvedTypeReferenceDirectives) { + // populate reverse mapping: file path -> type reference directive that was resolved to this file + fileToDirective = createFileMap(); + for (const key in resolvedTypeReferenceDirectives) { + if (!hasProperty(resolvedTypeReferenceDirectives, key)) { + continue; + } + const resolvedDirective = resolvedTypeReferenceDirectives[key]; + if (!resolvedDirective) { + continue; + } + const file = host.getSourceFile(resolvedDirective.resolvedFileName); + fileToDirective.set(file.path, key); + } + } return { getReferencedExportContainer, getReferencedImportDeclaration, @@ -16826,8 +17055,84 @@ namespace ts { isOptionalParameter, moduleExportsSomeValue, isArgumentsLocalBinding, - getExternalModuleFileFromDeclaration + getExternalModuleFileFromDeclaration, + getTypeReferenceDirectivesForEntityName, + getTypeReferenceDirectivesForSymbol }; + + // defined here to avoid outer scope pollution + function getTypeReferenceDirectivesForEntityName(node: EntityName | PropertyAccessExpression): string[] { + // program does not have any files with type reference directives - bail out + if (!fileToDirective) { + return undefined; + } + // 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 + const meaning = (node.kind === SyntaxKind.PropertyAccessExpression) || (node.kind === SyntaxKind.Identifier && isInTypeQuery(node)) + ? SymbolFlags.Value | SymbolFlags.ExportValue + : SymbolFlags.Type | SymbolFlags.Namespace; + + const symbol = resolveEntityName(node, meaning, /*ignoreErrors*/true); + return symbol && symbol !== unknownSymbol ? getTypeReferenceDirectivesForSymbol(symbol, meaning) : undefined; + } + + // defined here to avoid outer scope pollution + function getTypeReferenceDirectivesForSymbol(symbol: Symbol, meaning?: SymbolFlags): string[] { + // program does not have any files with type reference directives - bail out + if (!fileToDirective) { + return undefined; + } + if (!isSymbolFromTypeDeclarationFile(symbol)) { + return undefined; + } + // check what declarations in the symbol can contribute to the target meaning + let typeReferenceDirectives: string[]; + for (const decl of symbol.declarations) { + // check meaning of the local symbol to see if declaration needs to be analyzed further + if (decl.symbol && decl.symbol.flags & meaning) { + const file = getSourceFileOfNode(decl); + const typeReferenceDirective = fileToDirective.get(file.path); + if (typeReferenceDirective) { + (typeReferenceDirectives || (typeReferenceDirectives = [])).push(typeReferenceDirective); + } + } + } + return typeReferenceDirectives; + } + + function isSymbolFromTypeDeclarationFile(symbol: Symbol): boolean { + // bail out if symbol does not have associated declarations (i.e. this is transient symbol created for property in binding pattern) + if (!symbol.declarations) { + return false; + } + + // walk the parent chain for symbols to make sure that top level parent symbol is in the global scope + // external modules cannot define or contribute to type declaration files + let current = symbol; + while (true) { + const parent = getParentOfSymbol(current); + if (parent) { + current = parent; + } + else { + break; + } + } + + if (current.valueDeclaration && current.valueDeclaration.kind === SyntaxKind.SourceFile && current.flags & SymbolFlags.ValueModule) { + return false; + } + + // check that at least one declaration of top level symbol originates from type declaration file + for (const decl of symbol.declarations) { + const file = getSourceFileOfNode(decl); + if (fileToDirective.contains(file.path)) { + return true; + } + } + return false; + } } function getExternalModuleFileFromDeclaration(declaration: ImportEqualsDeclaration | ImportDeclaration | ExportDeclaration | ModuleDeclaration): SourceFile { @@ -16884,12 +17189,14 @@ namespace ts { globalNumberType = getGlobalType("Number"); globalBooleanType = getGlobalType("Boolean"); globalRegExpType = getGlobalType("RegExp"); + jsxElementType = getExportedTypeFromNamespace("JSX", JsxNames.Element); getGlobalClassDecoratorType = memoize(() => getGlobalType("ClassDecorator")); getGlobalPropertyDecoratorType = memoize(() => getGlobalType("PropertyDecorator")); getGlobalMethodDecoratorType = memoize(() => getGlobalType("MethodDecorator")); getGlobalParameterDecoratorType = memoize(() => getGlobalType("ParameterDecorator")); getGlobalTypedPropertyDescriptorType = memoize(() => getGlobalType("TypedPropertyDescriptor", /*arity*/ 1)); + getGlobalESSymbolConstructorSymbol = memoize(() => getGlobalValueSymbol("Symbol")); getGlobalPromiseType = memoize(() => getGlobalType("Promise", /*arity*/ 1)); tryGetGlobalPromiseType = memoize(() => getGlobalSymbol("Promise", SymbolFlags.Type, /*diagnostic*/ undefined) && getGlobalPromiseType()); getGlobalPromiseLikeType = memoize(() => getGlobalType("PromiseLike", /*arity*/ 1)); @@ -16898,27 +17205,19 @@ namespace ts { getGlobalPromiseConstructorLikeType = memoize(() => getGlobalType("PromiseConstructorLike")); getGlobalThenableType = memoize(createThenableType); - // If we're in ES6 mode, load the TemplateStringsArray. - // Otherwise, default to 'unknown' for the purposes of type checking in LS scenarios. + getGlobalTemplateStringsArrayType = memoize(() => getGlobalType("TemplateStringsArray")); + if (languageVersion >= ScriptTarget.ES6) { - globalTemplateStringsArrayType = getGlobalType("TemplateStringsArray"); - globalESSymbolType = getGlobalType("Symbol"); - globalESSymbolConstructorSymbol = getGlobalValueSymbol("Symbol"); - globalIterableType = getGlobalType("Iterable", /*arity*/ 1); - globalIteratorType = getGlobalType("Iterator", /*arity*/ 1); - globalIterableIteratorType = getGlobalType("IterableIterator", /*arity*/ 1); + getGlobalESSymbolType = memoize(() => getGlobalType("Symbol")); + getGlobalIterableType = memoize(() => getGlobalType("Iterable", /*arity*/ 1)); + getGlobalIteratorType = memoize(() => getGlobalType("Iterator", /*arity*/ 1)); + getGlobalIterableIteratorType = memoize(() => getGlobalType("IterableIterator", /*arity*/ 1)); } else { - globalTemplateStringsArrayType = unknownType; - - // Consider putting Symbol interface in lib.d.ts. On the plus side, putting it in lib.d.ts would make it - // extensible for Polyfilling Symbols. But putting it into lib.d.ts could also break users that have - // a global Symbol already, particularly if it is a class. - globalESSymbolType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined); - globalESSymbolConstructorSymbol = undefined; - globalIterableType = emptyGenericType; - globalIteratorType = emptyGenericType; - globalIterableIteratorType = emptyGenericType; + getGlobalESSymbolType = memoize(() => emptyObjectType); + getGlobalIterableType = memoize(() => emptyGenericType); + getGlobalIteratorType = memoize(() => emptyGenericType); + getGlobalIterableIteratorType = memoize(() => emptyGenericType); } anyArrayType = createArrayType(anyType); diff --git a/src/compiler/commandLineParser.ts b/src/compiler/commandLineParser.ts index cc17383c064..bd9373e2d3f 100644 --- a/src/compiler/commandLineParser.ts +++ b/src/compiler/commandLineParser.ts @@ -122,6 +122,11 @@ namespace ts { type: "boolean", description: Diagnostics.Raise_error_on_expressions_and_declarations_with_an_implied_any_type, }, + { + name: "noImplicitThis", + type: "boolean", + description: Diagnostics.Raise_error_on_this_expressions_with_an_implied_any_type, + }, { name: "noLib", type: "boolean", @@ -162,7 +167,6 @@ namespace ts { }, { name: "pretty", - paramType: Diagnostics.KIND, description: Diagnostics.Stylize_errors_and_messages_using_color_and_context_experimental, type: "boolean" }, @@ -313,9 +317,32 @@ namespace ts { } }, { - name: "traceModuleResolution", + name: "typesSearchPaths", + type: "list", + isTSConfigOnly: true, + element: { + name: "typesSearchPaths", + type: "string", + isFilePath: true + } + }, + { + name: "typesRoot", + type: "string" + }, + { + name: "types", + type: "list", + element: { + name: "types", + type: "string" + }, + description: Diagnostics.Type_declaration_files_to_be_included_in_compilation + }, + { + name: "traceResolution", type: "boolean", - description: Diagnostics.Enable_tracing_of_the_module_resolution_process + description: Diagnostics.Enable_tracing_of_the_name_resolution_process }, { name: "allowJs", @@ -332,6 +359,41 @@ namespace ts { type: "boolean", description: Diagnostics.Do_not_emit_use_strict_directives_in_module_output }, + { + name: "listEmittedFiles", + type: "boolean" + }, + { + name: "lib", + type: "list", + element: { + name: "lib", + type: { + // JavaScript only + "es5": "lib.es5.d.ts", + "es6": "lib.es2015.d.ts", + "es2015": "lib.es2015.d.ts", + "es7": "lib.es2016.d.ts", + "es2016": "lib.es2016.d.ts", + // Host only + "dom": "lib.dom.d.ts", + "webworker": "lib.webworker.d.ts", + "scripthost": "lib.scripthost.d.ts", + // ES2015 Or ESNext By-feature options + "es2015.core": "lib.es2015.core.d.ts", + "es2015.collection": "lib.es2015.collection.d.ts", + "es2015.generator": "lib.es2015.generator.d.ts", + "es2015.iterable": "lib.es2015.iterable.d.ts", + "es2015.promise": "lib.es2015.promise.d.ts", + "es2015.proxy": "lib.es2015.proxy.d.ts", + "es2015.reflect": "lib.es2015.reflect.d.ts", + "es2015.symbol": "lib.es2015.symbol.d.ts", + "es2015.symbol.wellknown": "lib.es2015.symbol.wellknown.d.ts", + "es2016.array.include": "lib.es2016.array.include.d.ts" + }, + }, + description: Diagnostics.Specify_library_files_to_be_included_in_the_compilation_Colon + }, { name: "strictNullChecks", type: "boolean", @@ -370,6 +432,7 @@ namespace ts { } let optionNameMapCache: OptionNameMap; + /* @internal */ export function getOptionNameMap(): OptionNameMap { if (optionNameMapCache) { @@ -399,6 +462,32 @@ namespace ts { return createCompilerDiagnostic(Diagnostics.Argument_for_0_option_must_be_Colon_1, `--${opt.name}`, namesOfType); } + /* @internal */ + export function parseCustomTypeOption(opt: CommandLineOptionOfCustomType, value: string, errors: Diagnostic[]) { + const key = (value || "").trim().toLowerCase(); + const map = opt.type; + if (hasProperty(map, key)) { + return map[key]; + } + else { + errors.push(createCompilerDiagnosticForInvalidCustomType(opt)); + } + } + + /* @internal */ + export function parseListTypeOption(opt: CommandLineOptionOfListType, value: string, errors: Diagnostic[]): (string | number)[] { + const values = (value || "").trim().split(","); + switch (opt.element.type) { + case "number": + return ts.map(values, parseInt); + case "string": + return ts.map(values, v => v || ""); + default: + return filter(map(values, v => parseCustomTypeOption(opt.element, v, errors)), v => !!v); + } + } + + /* @internal */ export function parseCommandLine(commandLine: string[], readFile?: (path: string) => string): ParsedCommandLine { const options: CompilerOptions = {}; const fileNames: string[] = []; @@ -453,12 +542,12 @@ namespace ts { i++; break; case "list": - options[opt.name] = parseListTypeOption(opt, args[i]); + options[opt.name] = parseListTypeOption(opt, args[i], errors); i++; break; // If not a primitive, the possible types are specified in what is effectively a map of options. default: - options[opt.name] = parseCustomTypeOption(opt, args[i]); + options[opt.name] = parseCustomTypeOption(opt, args[i], errors); i++; break; } @@ -471,29 +560,6 @@ namespace ts { else { fileNames.push(s); } - - function parseCustomTypeOption(opt: CommandLineOptionOfCustomType, value: string) { - const key = (value || "").trim().toLowerCase(); - const map = opt.type; - if (hasProperty(map, key)) { - return map[key]; - } - else { - errors.push(createCompilerDiagnosticForInvalidCustomType(opt)); - } - } - - function parseListTypeOption(opt: CommandLineOptionOfListType, value: string): (string | number)[] { - const values = (value || "").trim().split(","); - switch (opt.element.type) { - case "number": - return ts.map(values, parseInt); - case "string": - return ts.map(values, v => v || ""); - default: - return filter(map(values, v => parseCustomTypeOption(opt.element, v)), v => !!v); - } - } } } @@ -598,6 +664,7 @@ namespace ts { const compilerOptions: CompilerOptions = convertCompilerOptionsFromJsonWorker(json["compilerOptions"], basePath, errors, configFileName); const options = extend(existingOptions, compilerOptions); const typingOptions: TypingOptions = convertTypingOptionsFromJsonWorker(json["typingOptions"], basePath, errors, configFileName); + options.configFilePath = configFileName; const fileNames = getFileNames(errors); @@ -667,6 +734,9 @@ namespace ts { } } } + if (hasProperty(json, "excludes") && !hasProperty(json, "exclude")) { + errors.push(createCompilerDiagnostic(Diagnostics.Unknown_option_excludes_Did_you_mean_exclude)); + } return fileNames; } } diff --git a/src/compiler/declarationEmitter.ts b/src/compiler/declarationEmitter.ts index 0a8b6615a23..38df2e45d48 100644 --- a/src/compiler/declarationEmitter.ts +++ b/src/compiler/declarationEmitter.ts @@ -15,7 +15,7 @@ namespace ts { reportedDeclarationError: boolean; moduleElementDeclarationEmitInfo: ModuleElementDeclarationEmitInfo[]; synchronousDeclarationOutput: string; - referencePathsOutput: string; + referencesOutput: string; } type GetSymbolAccessibilityDiagnostic = (symbolAccessibilityResult: SymbolAccessibilityResult) => SymbolAccessibilityDiagnostic; @@ -35,7 +35,7 @@ namespace ts { forEachExpectedEmitFile(host, getDeclarationDiagnosticsFromFile, targetSourceFile); return declarationDiagnostics.getDiagnostics(targetSourceFile ? targetSourceFile.fileName : undefined); - function getDeclarationDiagnosticsFromFile({ declarationFilePath }, sources: SourceFile[], isBundledEmit: boolean) { + function getDeclarationDiagnosticsFromFile({ declarationFilePath }: EmitFileNames, sources: SourceFile[], isBundledEmit: boolean) { emitDeclarations(host, resolver, declarationDiagnostics, declarationFilePath, sources, isBundledEmit); } } @@ -73,7 +73,9 @@ namespace ts { // 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 - let referencePathsOutput = ""; + let referencesOutput = ""; + + let usedTypeDirectiveReferences: Map; // Emit references corresponding to each file const emittedReferencedFiles: SourceFile[] = []; @@ -153,11 +155,19 @@ namespace ts { } }); + if (usedTypeDirectiveReferences) { + for (const directive in usedTypeDirectiveReferences) { + if (hasProperty(usedTypeDirectiveReferences, directive)) { + referencesOutput += `/// ${newLine}`; + } + } + } + return { reportedDeclarationError, moduleElementDeclarationEmitInfo: allSourcesModuleElementDeclarationEmitInfo, synchronousDeclarationOutput: writer.getText(), - referencePathsOutput, + referencesOutput, }; function hasInternalAnnotation(range: CommentRange) { @@ -253,6 +263,21 @@ namespace ts { setWriter(oldWriter); } + function recordTypeReferenceDirectivesIfNecessary(typeReferenceDirectives: string[]): void { + if (!typeReferenceDirectives) { + return; + } + + if (!usedTypeDirectiveReferences) { + usedTypeDirectiveReferences = {}; + } + for (const directive of typeReferenceDirectives) { + if (!hasProperty(usedTypeDirectiveReferences, directive)) { + usedTypeDirectiveReferences[directive] = directive; + } + } + } + function handleSymbolAccessibilityError(symbolAccessibilityResult: SymbolAccessibilityResult) { if (symbolAccessibilityResult.accessibility === SymbolAccessibility.Accessible) { // write the aliases @@ -284,6 +309,7 @@ namespace ts { function trackSymbol(symbol: Symbol, enclosingDeclaration?: Node, meaning?: SymbolFlags) { handleSymbolAccessibilityError(resolver.isSymbolAccessible(symbol, enclosingDeclaration, meaning)); + recordTypeReferenceDirectivesIfNecessary(resolver.getTypeReferenceDirectivesForSymbol(symbol, meaning)); } function reportInaccessibleThisError() { @@ -420,6 +446,7 @@ namespace ts { entityName.parent.kind === SyntaxKind.ImportEqualsDeclaration ? entityName.parent : enclosingDeclaration); handleSymbolAccessibilityError(visibilityResult); + recordTypeReferenceDirectivesIfNecessary(resolver.getTypeReferenceDirectivesForEntityName(entityName)); writeEntityName(entityName); } @@ -530,7 +557,10 @@ namespace ts { else { // Expression const tempVarName = getExportDefaultTempVariableName(); - write("declare var "); + if (!noDeclare) { + write("declare "); + } + write("var "); write(tempVarName); write(": "); writer.getSymbolAccessibilityDiagnostic = getDefaultExportAccessibilityDiagnostic; @@ -1685,7 +1715,7 @@ namespace ts { host.getCanonicalFileName, /*isAbsolutePathAnUrl*/ false); - referencePathsOutput += '/// ' + newLine; + referencesOutput += `/// ${newLine}`; } return addedBundledEmitReference; @@ -1707,7 +1737,7 @@ namespace ts { const emitDeclarationResult = emitDeclarations(host, resolver, emitterDiagnostics, declarationFilePath, sourceFiles, isBundledEmit); const emitSkipped = emitDeclarationResult.reportedDeclarationError || host.isEmitBlocked(declarationFilePath) || host.getCompilerOptions().noEmit; if (!emitSkipped) { - const declarationOutput = emitDeclarationResult.referencePathsOutput + const declarationOutput = emitDeclarationResult.referencesOutput + getDeclarationOutput(emitDeclarationResult.synchronousDeclarationOutput, emitDeclarationResult.moduleElementDeclarationEmitInfo); writeFile(host, emitterDiagnostics, declarationFilePath, declarationOutput, host.getCompilerOptions().emitBOM); } diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index c887a9c7112..942eb588b4f 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -811,10 +811,22 @@ "category": "Error", "code": 1249 }, - "'{0}' tag cannot be used independently as a top level JSDoc tag.": { + "Function declarations are not allowed inside blocks in strict mode when targeting 'ES3' or 'ES5'.": { "category": "Error", "code": 1250 }, + "Function declarations are not allowed inside blocks in strict mode when targeting 'ES3' or 'ES5'. Class definitions are automatically in strict mode.": { + "category": "Error", + "code": 1251 + }, + "Function declarations are not allowed inside blocks in strict mode when targeting 'ES3' or 'ES5'. Modules are automatically in strict mode.": { + "category": "Error", + "code": 1252 + }, + "'{0}' tag cannot be used independently as a top level JSDoc tag.": { + "category": "Error", + "code": 1253 + }, "'with' statements are not allowed in an async function block.": { "category": "Error", "code": 1300 @@ -1051,7 +1063,7 @@ "category": "Error", "code": 2351 }, - "Neither type '{0}' nor type '{1}' is assignable to the other.": { + "Type '{0}' cannot be converted to type '{1}'.": { "category": "Error", "code": 2352 }, @@ -1879,6 +1891,38 @@ "category": "Error", "code": 2677 }, + "Type '{0}' is not comparable to type '{1}'.": { + "category": "Error", + "code": 2678 + }, + "A function that is called with the 'new' keyword cannot have a 'this' type that is 'void'.": { + "category": "Error", + "code": 2679 + }, + "A 'this' parameter must be the first parameter.": { + "category": "Error", + "code": 2680 + }, + "A constructor cannot have a 'this' parameter.": { + "category": "Error", + "code": 2681 + }, + "A setter cannot have a 'this' parameter.": { + "category": "Error", + "code": 2682 + }, + "'this' implicitly has type 'any' because it does not have a type annotation.": { + "category": "Error", + "code": 2683 + }, + "The 'this' context of type '{0}' is not assignable to method's 'this' of type '{1}'.": { + "category": "Error", + "code": 2684 + }, + "The 'this' types of each signature are incompatible.": { + "category": "Error", + "code": 2685 + }, "Import declaration '{0}' is using private name '{1}'.": { "category": "Error", "code": 4000 @@ -2159,6 +2203,11 @@ "category": "Error", "code": 4082 }, + "Conflicting library definitions for '{0}' found at '{1}' and '{2}'. Copy the correct file to the 'typings' folder to resolve this conflict.": { + "category": "Message", + "code": 4090 + }, + "The current host does not support the '{0}' option.": { "category": "Error", "code": 5001 @@ -2492,6 +2541,10 @@ "category": "Message", "code": 6078 }, + "Specify library files to be included in the compilation: ": { + "category": "Message", + "code": 6079 + }, "Specify JSX code generation: 'preserve' or 'react'": { "category": "Message", "code": 6080 @@ -2508,7 +2561,7 @@ "category": "Message", "code": 6084 }, - "Enable tracing of the module resolution process.": { + "Enable tracing of the name resolution process.": { "category": "Message", "code": 6085 }, @@ -2556,7 +2609,7 @@ "category": "Message", "code": 6096 }, - "File '{0}' exist - use it as a module resolution result.": { + "File '{0}' exist - use it as a name resolution result.": { "category": "Message", "code": 6097 }, @@ -2568,11 +2621,11 @@ "category": "Message", "code": 6099 }, - "'package.json' does not have 'typings' field.": { + "'package.json' does not have 'types' field.": { "category": "Message", "code": 6100 }, - "'package.json' has 'typings' field '{0}' that references '{1}'.": { + "'package.json' has '{0}' field '{1}' that references '{2}'.": { "category": "Message", "code": 6101 }, @@ -2588,7 +2641,7 @@ "category": "Message", "code": 6104 }, - "Expected type of 'typings' field in 'package.json' to be 'string', got '{0}'.": { + "Expected type of '{0}' field in 'package.json' to be 'string', got '{1}'.": { "category": "Message", "code": 6105 }, @@ -2624,7 +2677,66 @@ "category": "Message", "code": 6113 }, - + "Unknown option 'excludes'. Did you mean 'exclude'?": { + "category": "Error", + "code": 6114 + }, + "Raise error on 'this' expressions with an implied 'any' type.": { + "category": "Message", + "code": 6115 + }, + "======== Resolving type reference directive '{0}', containing file '{1}', root directory '{2}'. ========": { + "category": "Message", + "code": 6116 + }, + "Resolving using primary search paths...": { + "category": "Message", + "code": 6117 + }, + "Resolving from node_modules folder...": { + "category": "Message", + "code": 6118 + }, + "======== Type reference directive '{0}' was successfully resolved to '{1}', primary: {2}. ========": { + "category": "Message", + "code": 6119 + }, + "======== Type reference directive '{0}' was not resolved. ========": { + "category": "Message", + "code": 6120 + }, + "Resolving with primary search path '{0}'": { + "category": "Message", + "code": 6121 + }, + "Root directory cannot be determined, skipping primary search paths.": { + "category": "Message", + "code": 6122 + }, + "======== Resolving type reference directive '{0}', containing file '{1}', root directory not set. ========": { + "category": "Message", + "code": 6123 + }, + "Type declaration files to be included in compilation.": { + "category": "Message", + "code": 6124 + }, + "Looking up in 'node_modules' folder, initial location '{0}'": { + "category": "Message", + "code": 6125 + }, + "Containing file is not specified and root directory cannot be determined, skipping lookup in 'node_modules' folder.": { + "category": "Message", + "code": 6126 + }, + "======== Resolving type reference directive '{0}', containing file not set, root directory '{1}'. ========": { + "category": "Message", + "code": 6127 + }, + "======== Resolving type reference directive '{0}', containing file not set, root directory not set. ========": { + "category": "Message", + "code": 6128 + }, "Variable '{0}' implicitly has an '{1}' type.": { "category": "Error", "code": 7005 @@ -2713,6 +2825,10 @@ "category": "Error", "code": 7030 }, + "Binding element '{0}' implicitly has an '{1}' type.": { + "category": "Error", + "code": 7031 + }, "You cannot rename this element.": { "category": "Error", "code": 8000 diff --git a/src/compiler/emitter.ts b/src/compiler/emitter.ts index 0cb28a72a67..254b8d7e61b 100644 --- a/src/compiler/emitter.ts +++ b/src/compiler/emitter.ts @@ -345,6 +345,16 @@ var __extends = (this && this.__extends) || function (d, b) { d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); };`; + const assignHelper = ` +var __assign = (this && this.__assign) || Object.assign || function(t) { + for (var s, i = 1, n = arguments.length; i < n; i++) { + s = arguments[i]; + for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) + t[p] = s[p]; + } + return t; +};`; + // emit output for the __decorate helper function const decorateHelper = ` var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { @@ -380,6 +390,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge const languageVersion = getEmitScriptTarget(compilerOptions); const modulekind = getEmitModuleKind(compilerOptions); const sourceMapDataList: SourceMapData[] = compilerOptions.sourceMap || compilerOptions.inlineSourceMap ? [] : undefined; + const emittedFilesList: string[] = compilerOptions.listEmittedFiles ? [] : undefined; const emitterDiagnostics = createDiagnosticCollection(); let emitSkipped = false; const newLine = host.getNewLine(); @@ -390,6 +401,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge return { emitSkipped, diagnostics: emitterDiagnostics.getDiagnostics(), + emittedFiles: emittedFilesList, sourceMaps: sourceMapDataList }; @@ -540,6 +552,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge let convertedLoopState: ConvertedLoopState; let extendsEmitted: boolean; + let assignEmitted: boolean; let decorateEmitted: boolean; let paramEmitted: boolean; let awaiterEmitted: boolean; @@ -623,6 +636,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge decorateEmitted = false; paramEmitted = false; awaiterEmitted = false; + assignEmitted = false; tempFlags = 0; tempVariables = undefined; tempParameters = undefined; @@ -1259,11 +1273,10 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge } else { // Either emit one big object literal (no spread attribs), or - // a call to React.__spread + // a call to the __assign helper const attrs = openingNode.attributes; if (forEach(attrs, attr => attr.kind === SyntaxKind.JsxSpreadAttribute)) { - emitExpressionIdentifier(syntheticReactRef); - write(".__spread("); + write("__assign("); let haveOpenedObjectLiteral = false; for (let i = 0; i < attrs.length; i++) { @@ -4609,7 +4622,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge } emitEnd(node); - if (kind !== SyntaxKind.MethodDeclaration && kind !== SyntaxKind.MethodSignature) { + if (kind !== SyntaxKind.MethodDeclaration && + kind !== SyntaxKind.MethodSignature && + kind !== SyntaxKind.ArrowFunction) { emitTrailingComments(node); } } @@ -4628,8 +4643,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge write("("); if (node) { const parameters = node.parameters; + const skipCount = node.parameters.length && (node.parameters[0].name).text === "this" ? 1 : 0; const omitCount = languageVersion < ScriptTarget.ES6 && hasRestParameter(node) ? 1 : 0; - emitList(parameters, 0, parameters.length - omitCount, /*multiLine*/ false, /*trailingComma*/ false); + emitList(parameters, skipCount, parameters.length - omitCount - skipCount, /*multiLine*/ false, /*trailingComma*/ false); } write(")"); decreaseIndent(); @@ -7649,7 +7665,7 @@ const _super = (function (geti, seti) { } function isUseStrictPrologue(node: ExpressionStatement): boolean { - return !!(node.expression as StringLiteral).text.match(/use strict/); + return (node.expression as StringLiteral).text === "use strict"; } function ensureUseStrictPrologue(startWithNewLine: boolean, writeUseStrict: boolean) { @@ -7699,11 +7715,16 @@ const _super = (function (geti, seti) { if (!compilerOptions.noEmitHelpers) { // Only Emit __extends function when target ES5. // For target ES6 and above, we can emit classDeclaration as is. - if ((languageVersion < ScriptTarget.ES6) && (!extendsEmitted && node.flags & NodeFlags.HasClassExtends)) { + if (languageVersion < ScriptTarget.ES6 && !extendsEmitted && node.flags & NodeFlags.HasClassExtends) { writeLines(extendsHelper); extendsEmitted = true; } + if (compilerOptions.jsx !== JsxEmit.Preserve && !assignEmitted && (node.flags & NodeFlags.HasJsxSpreadAttribute)) { + writeLines(assignHelper); + assignEmitted = true; + } + if (!decorateEmitted && node.flags & NodeFlags.HasDecorators) { writeLines(decorateHelper); if (compilerOptions.emitDecoratorMetadata) { @@ -8230,6 +8251,16 @@ const _super = (function (geti, seti) { if (declarationFilePath) { emitSkipped = writeDeclarationFile(declarationFilePath, sourceFiles, isBundledEmit, host, resolver, emitterDiagnostics) || emitSkipped; } + + if (!emitSkipped && emittedFilesList) { + emittedFilesList.push(jsFilePath); + if (sourceMapFilePath) { + emittedFilesList.push(sourceMapFilePath); + } + if (declarationFilePath) { + emittedFilesList.push(declarationFilePath); + } + } } } } diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index 009a3e13fa2..058098eff1d 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -2025,7 +2025,7 @@ namespace ts { } function isStartOfParameter(): boolean { - return token === SyntaxKind.DotDotDotToken || isIdentifierOrPattern() || isModifierKind(token) || token === SyntaxKind.AtToken; + return token === SyntaxKind.DotDotDotToken || isIdentifierOrPattern() || isModifierKind(token) || token === SyntaxKind.AtToken || token === SyntaxKind.ThisKeyword; } function setModifiers(node: Node, modifiers: ModifiersArray) { @@ -2037,15 +2037,19 @@ namespace ts { function parseParameter(): ParameterDeclaration { const node = createNode(SyntaxKind.Parameter); + if (token === SyntaxKind.ThisKeyword) { + node.name = createIdentifier(/*isIdentifier*/true, undefined); + node.type = parseParameterType(); + return finishNode(node); + } + node.decorators = parseDecorators(); setModifiers(node, parseModifiers()); node.dotDotDotToken = parseOptionalToken(SyntaxKind.DotDotDotToken); // FormalParameter [Yield,Await]: // BindingElement[?Yield,?Await] - node.name = parseIdentifierOrPattern(); - if (getFullWidth(node.name) === 0 && node.flags === 0 && isModifierKind(token)) { // in cases like // 'use strict' @@ -2488,7 +2492,7 @@ namespace ts { // Skip modifiers parseModifiers(); } - if (isIdentifier()) { + if (isIdentifier() || token === SyntaxKind.ThisKeyword) { nextToken(); return true; } @@ -5520,6 +5524,7 @@ namespace ts { function processReferenceComments(sourceFile: SourceFile): void { const triviaScanner = createScanner(sourceFile.languageVersion, /*skipTrivia*/false, LanguageVariant.Standard, sourceText); const referencedFiles: FileReference[] = []; + const typeReferenceDirectives: FileReference[] = []; const amdDependencies: { path: string; name: string }[] = []; let amdModuleName: string; @@ -5546,7 +5551,12 @@ namespace ts { sourceFile.hasNoDefaultLib = referencePathMatchResult.isNoDefaultLib; const diagnosticMessage = referencePathMatchResult.diagnosticMessage; if (fileReference) { - referencedFiles.push(fileReference); + if (referencePathMatchResult.isTypeReferenceDirective) { + typeReferenceDirectives.push(fileReference); + } + else { + referencedFiles.push(fileReference); + } } if (diagnosticMessage) { parseDiagnostics.push(createFileDiagnostic(sourceFile, range.pos, range.end - range.pos, diagnosticMessage)); @@ -5578,6 +5588,7 @@ namespace ts { } sourceFile.referencedFiles = referencedFiles; + sourceFile.typeReferenceDirectives = typeReferenceDirectives; sourceFile.amdDependencies = amdDependencies; sourceFile.moduleName = amdModuleName; } diff --git a/src/compiler/program.ts b/src/compiler/program.ts index b528143384e..8d0e8b296e1 100644 --- a/src/compiler/program.ts +++ b/src/compiler/program.ts @@ -12,11 +12,17 @@ namespace ts { const emptyArray: any[] = []; + const defaultLibrarySearchPaths = [ + "types/", + "node_modules/", + "node_modules/@types/", + ]; + export const version = "1.9.0"; export function findConfigFile(searchPath: string, fileExists: (fileName: string) => boolean): string { - let fileName = "tsconfig.json"; while (true) { + const fileName = combinePaths(searchPath, "tsconfig.json"); if (fileExists(fileName)) { return fileName; } @@ -25,7 +31,6 @@ namespace ts { break; } searchPath = parentPath; - fileName = "../" + fileName; } return undefined; } @@ -36,22 +41,58 @@ namespace ts { return normalizePath(referencedFileName); } + /* @internal */ + export function computeCommonSourceDirectoryOfFilenames(fileNames: string[], currentDirectory: string, getCanonicalFileName: (fileName: string) => string): string { + let commonPathComponents: string[]; + const failed = forEach(fileNames, sourceFile => { + // Each file contributes into common source file path + const sourcePathComponents = getNormalizedPathComponents(sourceFile, currentDirectory); + sourcePathComponents.pop(); // The base file name is not part of the common directory path + + if (!commonPathComponents) { + // first file + commonPathComponents = sourcePathComponents; + return; + } + + for (let i = 0, n = Math.min(commonPathComponents.length, sourcePathComponents.length); i < n; i++) { + if (getCanonicalFileName(commonPathComponents[i]) !== getCanonicalFileName(sourcePathComponents[i])) { + if (i === 0) { + // Failed to find any common path component + return true; + } + + // New common path found that is 0 -> i-1 + commonPathComponents.length = i; + break; + } + } + + // If the sourcePathComponents was shorter than the commonPathComponents, truncate to the sourcePathComponents + if (sourcePathComponents.length < commonPathComponents.length) { + commonPathComponents.length = sourcePathComponents.length; + } + }); + + // A common path can not be found when paths span multiple drives on windows, for example + if (failed) { + return ""; + } + + if (!commonPathComponents) { // Can happen when all input files are .d.ts files + return currentDirectory; + } + + return getNormalizedPathFromPathComponents(commonPathComponents); + } + function trace(host: ModuleResolutionHost, message: DiagnosticMessage, ...args: any[]): void; function trace(host: ModuleResolutionHost, message: DiagnosticMessage): void { host.trace(formatMessage.apply(undefined, arguments)); } function isTraceEnabled(compilerOptions: CompilerOptions, host: ModuleResolutionHost): boolean { - return compilerOptions.traceModuleResolution && host.trace !== undefined; - } - - function startsWith(str: string, prefix: string): boolean { - return str.lastIndexOf(prefix, 0) === 0; - } - - function endsWith(str: string, suffix: string): boolean { - const expectedPos = str.length - suffix.length; - return str.indexOf(suffix, expectedPos) === expectedPos; + return compilerOptions.traceResolution && host.trace !== undefined; } function hasZeroOrOneAsteriskCharacter(str: string): boolean { @@ -92,6 +133,160 @@ namespace ts { skipTsx: boolean; } + function tryReadTypesSection(packageJsonPath: string, baseDirectory: string, state: ModuleResolutionState): string { + let jsonContent: { typings?: string, types?: string }; + try { + const jsonText = state.host.readFile(packageJsonPath); + jsonContent = jsonText ? <{ typings?: string, types?: string }>JSON.parse(jsonText) : {}; + } + catch (e) { + // gracefully handle if readFile fails or returns not JSON + jsonContent = {}; + } + + let typesFile: string; + let fieldName: string; + // first try to read content of 'typings' section (backward compatibility) + if (jsonContent.typings) { + if (typeof jsonContent.typings === "string") { + fieldName = "typings"; + typesFile = jsonContent.typings; + } + else { + if (state.traceEnabled) { + trace(state.host, Diagnostics.Expected_type_of_0_field_in_package_json_to_be_string_got_1, "typings", typeof jsonContent.typings); + } + } + } + // then read 'types' + if (!typesFile && jsonContent.types) { + if (typeof jsonContent.types === "string") { + fieldName = "types"; + typesFile = jsonContent.types; + } + else { + if (state.traceEnabled) { + trace(state.host, Diagnostics.Expected_type_of_0_field_in_package_json_to_be_string_got_1, "types", typeof jsonContent.types); + } + } + } + if (typesFile) { + const typesFilePath = normalizePath(combinePaths(baseDirectory, typesFile)); + if (state.traceEnabled) { + trace(state.host, Diagnostics.package_json_has_0_field_1_that_references_2, fieldName, typesFile, typesFilePath); + } + return typesFilePath; + } + return undefined; + } + + const typeReferenceExtensions = [".d.ts"]; + + /** + * @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. + */ + export function resolveTypeReferenceDirective(typeReferenceDirectiveName: string, containingFile: string, options: CompilerOptions, host: ModuleResolutionHost): ResolvedTypeReferenceDirectiveWithFailedLookupLocations { + const traceEnabled = isTraceEnabled(options, host); + const moduleResolutionState: ModuleResolutionState = { + compilerOptions: options, + host: host, + skipTsx: true, + traceEnabled + }; + + // use typesRoot and fallback to directory that contains tsconfig if typesRoot is not set + const rootDir = options.typesRoot || (options.configFilePath ? getDirectoryPath(options.configFilePath) : undefined); + + if (traceEnabled) { + if (containingFile === undefined) { + if (rootDir === undefined) { + trace(host, Diagnostics.Resolving_type_reference_directive_0_containing_file_not_set_root_directory_not_set, typeReferenceDirectiveName); + } + else { + trace(host, Diagnostics.Resolving_type_reference_directive_0_containing_file_not_set_root_directory_1, typeReferenceDirectiveName, rootDir); + } + } + else { + if (rootDir === undefined) { + trace(host, Diagnostics.Resolving_type_reference_directive_0_containing_file_1_root_directory_not_set, typeReferenceDirectiveName, containingFile); + } + else { + trace(host, Diagnostics.Resolving_type_reference_directive_0_containing_file_1_root_directory_2, typeReferenceDirectiveName, containingFile, rootDir); + } + } + } + + const failedLookupLocations: string[] = []; + + // Check primary library paths + if (rootDir !== undefined) { + const effectivePrimarySearchPaths = options.typesSearchPaths || defaultLibrarySearchPaths; + for (const searchPath of effectivePrimarySearchPaths) { + const primaryPath = combinePaths(rootDir, searchPath); + if (traceEnabled) { + trace(host, Diagnostics.Resolving_with_primary_search_path_0, primaryPath); + } + const candidate = combinePaths(primaryPath, typeReferenceDirectiveName); + const candidateDirectory = getDirectoryPath(candidate); + const resolvedFile = loadNodeModuleFromDirectory(typeReferenceExtensions, candidate, failedLookupLocations, + !directoryProbablyExists(candidateDirectory, host), moduleResolutionState); + + if (resolvedFile) { + if (traceEnabled) { + trace(host, Diagnostics.Type_reference_directive_0_was_successfully_resolved_to_1_primary_Colon_2, typeReferenceDirectiveName, resolvedFile, true); + } + return { + resolvedTypeReferenceDirective: { primary: true, resolvedFileName: resolvedFile }, + failedLookupLocations + }; + } + } + } + else { + if (traceEnabled) { + trace(host, Diagnostics.Root_directory_cannot_be_determined_skipping_primary_search_paths); + } + } + + let resolvedFile: string; + let initialLocationForSecondaryLookup: string; + if (containingFile) { + initialLocationForSecondaryLookup = getDirectoryPath(containingFile); + } + else { + initialLocationForSecondaryLookup = rootDir; + } + + if (initialLocationForSecondaryLookup !== undefined) { + // check secondary locations + if (traceEnabled) { + trace(host, Diagnostics.Looking_up_in_node_modules_folder_initial_location_0, initialLocationForSecondaryLookup); + } + resolvedFile = loadModuleFromNodeModules(typeReferenceDirectiveName, initialLocationForSecondaryLookup, failedLookupLocations, moduleResolutionState); + if (traceEnabled) { + if (resolvedFile) { + trace(host, Diagnostics.Type_reference_directive_0_was_successfully_resolved_to_1_primary_Colon_2, typeReferenceDirectiveName, resolvedFile, false); + } + else { + trace(host, Diagnostics.Type_reference_directive_0_was_not_resolved, typeReferenceDirectiveName); + } + } + } + else { + if (traceEnabled) { + trace(host, 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 + }; + } + export function resolveModuleName(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost): ResolvedModuleWithFailedLookupLocations { const traceEnabled = isTraceEnabled(compilerOptions, host); if (traceEnabled) { @@ -371,7 +566,7 @@ namespace ts { const traceEnabled = isTraceEnabled(compilerOptions, host); const failedLookupLocations: string[] = []; - const state = {compilerOptions, host, traceEnabled, skipTsx: false}; + const state = { compilerOptions, host, traceEnabled, skipTsx: false }; let resolvedFileName = tryLoadModuleUsingOptionalResolutionSettings(moduleName, containingDirectory, nodeLoadModuleByRelativeName, failedLookupLocations, supportedExtensions, state); @@ -407,7 +602,7 @@ namespace ts { } /* @internal */ - export function directoryProbablyExists(directoryName: string, host: { directoryExists?: (directoryName: string) => boolean } ): boolean { + export function directoryProbablyExists(directoryName: string, host: { directoryExists?: (directoryName: string) => boolean }): boolean { // if host does not support 'directoryExists' assume that directory will exist return !host.directoryExists || host.directoryExists(directoryName); } @@ -417,6 +612,13 @@ namespace ts { * 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: string, extensions: string[], failedLookupLocation: string[], onlyRecordFailures: boolean, state: ModuleResolutionState): string { + if (!onlyRecordFailures) { + // check if containig folder exists - if it doesn't then just record failures for all supported extensions without disk probing + const directory = getDirectoryPath(candidate); + if (directory) { + onlyRecordFailures = !directoryProbablyExists(directory, state.host); + } + } return forEach(extensions, tryLoad); function tryLoad(ext: string): string { @@ -426,7 +628,7 @@ namespace ts { const fileName = fileExtensionIs(candidate, ext) ? candidate : candidate + ext; if (!onlyRecordFailures && state.host.fileExists(fileName)) { if (state.traceEnabled) { - trace(state.host, Diagnostics.File_0_exist_use_it_as_a_module_resolution_result, fileName); + trace(state.host, Diagnostics.File_0_exist_use_it_as_a_name_resolution_result, fileName); } return fileName; } @@ -447,36 +649,16 @@ namespace ts { if (state.traceEnabled) { trace(state.host, Diagnostics.Found_package_json_at_0, packageJsonPath); } - - let jsonContent: { typings?: string }; - - try { - const jsonText = state.host.readFile(packageJsonPath); - jsonContent = jsonText ? <{ typings?: string }>JSON.parse(jsonText) : { typings: undefined }; - } - catch (e) { - // gracefully handle if readFile fails or returns not JSON - jsonContent = { typings: undefined }; - } - - if (jsonContent.typings) { - if (typeof jsonContent.typings === "string") { - const typingsFile = normalizePath(combinePaths(candidate, jsonContent.typings)); - if (state.traceEnabled) { - trace(state.host, Diagnostics.package_json_has_typings_field_0_that_references_1, jsonContent.typings, typingsFile); - } - const result = loadModuleFromFile(typingsFile, extensions, failedLookupLocation, !directoryProbablyExists(getDirectoryPath(typingsFile), state.host), state); - if (result) { - return result; - } - } - else if (state.traceEnabled) { - trace(state.host, Diagnostics.Expected_type_of_typings_field_in_package_json_to_be_string_got_0, typeof jsonContent.typings); + const typesFile = tryReadTypesSection(packageJsonPath, candidate, state); + if (typesFile) { + const result = loadModuleFromFile(typesFile, extensions, failedLookupLocation, !directoryProbablyExists(getDirectoryPath(typesFile), state.host), state); + if (result) { + return result; } } else { if (state.traceEnabled) { - trace(state.host, Diagnostics.package_json_does_not_have_typings_field); + trace(state.host, Diagnostics.package_json_does_not_have_types_field); } } } @@ -491,20 +673,31 @@ namespace ts { return loadModuleFromFile(combinePaths(candidate, "index"), extensions, failedLookupLocation, !directoryExists, state); } + function loadModuleFromNodeModulesFolder(moduleName: string, directory: string, failedLookupLocations: string[], state: ModuleResolutionState): string { + const nodeModulesFolder = combinePaths(directory, "node_modules"); + const nodeModulesFolderExists = directoryProbablyExists(nodeModulesFolder, state.host); + const candidate = normalizePath(combinePaths(nodeModulesFolder, moduleName)); + // Load only typescript files irrespective of allowJs option if loading from node modules + let result = loadModuleFromFile(candidate, supportedTypeScriptExtensions, failedLookupLocations, !nodeModulesFolderExists, state); + if (result) { + return result; + } + result = loadNodeModuleFromDirectory(supportedTypeScriptExtensions, candidate, failedLookupLocations, !nodeModulesFolderExists, state); + if (result) { + return result; + } + } + function loadModuleFromNodeModules(moduleName: string, directory: string, failedLookupLocations: string[], state: ModuleResolutionState): string { directory = normalizeSlashes(directory); while (true) { const baseName = getBaseFileName(directory); if (baseName !== "node_modules") { - const nodeModulesFolder = combinePaths(directory, "node_modules"); - const nodeModulesFolderExists = directoryProbablyExists(nodeModulesFolder, state.host); - const candidate = normalizePath(combinePaths(nodeModulesFolder, moduleName)); - // Load only typescript files irrespective of allowJs option if loading from node modules - let result = loadModuleFromFile(candidate, supportedTypeScriptExtensions, failedLookupLocations, !nodeModulesFolderExists, state); - if (result) { - return result; - } - result = loadNodeModuleFromDirectory(supportedTypeScriptExtensions, candidate, failedLookupLocations, !nodeModulesFolderExists, state); + const result = + // first: try to load module as-is + loadModuleFromNodeModulesFolder(moduleName, directory, failedLookupLocations, state) || + // second: try to load module from the scope '@types' + loadModuleFromNodeModulesFolder(combinePaths("@types", moduleName), directory, failedLookupLocations, state); if (result) { return result; } @@ -554,7 +747,7 @@ namespace ts { return referencedSourceFile - ? { resolvedModule: { resolvedFileName: referencedSourceFile }, failedLookupLocations } + ? { resolvedModule: { resolvedFileName: referencedSourceFile }, failedLookupLocations } : { resolvedModule: undefined, failedLookupLocations }; } @@ -566,6 +759,12 @@ namespace ts { sourceMap: false, }; + interface OutputFingerprint { + hash: string; + byteOrderMark: boolean; + mtime: Date; + } + export function createCompilerHost(options: CompilerOptions, setParentNodes?: boolean): CompilerHost { const existingDirectories: Map = {}; @@ -616,11 +815,50 @@ namespace ts { } } + let outputFingerprints: Map; + + function writeFileIfUpdated(fileName: string, data: string, writeByteOrderMark: boolean): void { + if (!outputFingerprints) { + outputFingerprints = {}; + } + + const hash = sys.createHash(data); + const mtimeBefore = sys.getModifiedTime(fileName); + + if (mtimeBefore && hasProperty(outputFingerprints, fileName)) { + const fingerprint = outputFingerprints[fileName]; + + // If output has not been changed, and the file has no external modification + if (fingerprint.byteOrderMark === writeByteOrderMark && + fingerprint.hash === hash && + fingerprint.mtime.getTime() === mtimeBefore.getTime()) { + return; + } + } + + sys.writeFile(fileName, data, writeByteOrderMark); + + const mtimeAfter = sys.getModifiedTime(fileName); + + outputFingerprints[fileName] = { + hash, + byteOrderMark: writeByteOrderMark, + mtime: mtimeAfter + }; + } + function writeFile(fileName: string, data: string, writeByteOrderMark: boolean, onError?: (message: string) => void) { try { const start = new Date().getTime(); ensureDirectoriesExist(getDirectoryPath(normalizePath(fileName))); - sys.writeFile(fileName, data, writeByteOrderMark); + + if (isWatchSet(options) && sys.createHash && sys.getModifiedTime) { + writeFileIfUpdated(fileName, data, writeByteOrderMark); + } + else { + sys.writeFile(fileName, data, writeByteOrderMark); + } + ioWriteTime += new Date().getTime() - start; } catch (e) { @@ -630,11 +868,16 @@ namespace ts { } } + function getDefaultLibLocation(): string { + return getDirectoryPath(normalizePath(sys.getExecutingFilePath())); + } + const newLine = getNewLineCharacter(options); return { getSourceFile, - getDefaultLibFileName: options => combinePaths(getDirectoryPath(normalizePath(sys.getExecutingFilePath())), getDefaultLibFileName(options)), + getDefaultLibLocation, + getDefaultLibFileName: options => combinePaths(getDefaultLibLocation(), getDefaultLibFileName(options)), writeFile, getCurrentDirectory: memoize(() => sys.getCurrentDirectory()), useCaseSensitiveFileNames: () => sys.useCaseSensitiveFileNames, @@ -649,9 +892,9 @@ namespace ts { export function getPreEmitDiagnostics(program: Program, sourceFile?: SourceFile, cancellationToken?: CancellationToken): Diagnostic[] { let diagnostics = program.getOptionsDiagnostics(cancellationToken).concat( - program.getSyntacticDiagnostics(sourceFile, cancellationToken), - program.getGlobalDiagnostics(cancellationToken), - program.getSemanticDiagnostics(sourceFile, cancellationToken)); + program.getSyntacticDiagnostics(sourceFile, cancellationToken), + program.getGlobalDiagnostics(cancellationToken), + program.getSemanticDiagnostics(sourceFile, cancellationToken)); if (program.getCompilerOptions().declaration) { diagnostics = diagnostics.concat(program.getDeclarationDiagnostics(sourceFile, cancellationToken)); @@ -686,75 +929,98 @@ namespace ts { } } + function loadWithLocalCache(names: string[], containingFile: string, loader: (name: string, containingFile: string) => T): T[] { + if (names.length === 0) { + return []; + } + const resolutions: T[] = []; + const cache: Map = {}; + for (const name of names) { + let result: T; + if (hasProperty(cache, name)) { + result = cache[name]; + } + else { + result = loader(name, containingFile); + cache[name] = result; + } + resolutions.push(result); + } + return resolutions; + } + export function createProgram(rootNames: string[], options: CompilerOptions, host?: CompilerHost, oldProgram?: Program): Program { let program: Program; let files: SourceFile[] = []; - let fileProcessingDiagnostics = createDiagnosticCollection(); - const programDiagnostics = createDiagnosticCollection(); - let commonSourceDirectory: string; let diagnosticsProducingTypeChecker: TypeChecker; let noDiagnosticsTypeChecker: TypeChecker; let classifiableNames: Map; - let skipDefaultLib = options.noLib; - const supportedExtensions = getSupportedExtensions(options); + let resolvedTypeReferenceDirectives: Map = {}; + let fileProcessingDiagnostics = createDiagnosticCollection(); const start = new Date().getTime(); host = host || createCompilerHost(options); + + let skipDefaultLib = options.noLib; + const programDiagnostics = createDiagnosticCollection(); + const currentDirectory = host.getCurrentDirectory(); + const supportedExtensions = getSupportedExtensions(options); + // Map storing if there is emit blocking diagnostics for given input const hasEmitBlockingDiagnostics = createFileMap(getCanonicalFileName); - const currentDirectory = host.getCurrentDirectory(); - const resolveModuleNamesWorker = host.resolveModuleNames - ? ((moduleNames: string[], containingFile: string) => host.resolveModuleNames(moduleNames, containingFile)) - : ((moduleNames: string[], containingFile: string) => { - const resolvedModuleNames: ResolvedModule[] = []; - // resolveModuleName does not store any results between calls. - // lookup is a local cache to avoid resolving the same module name several times - const lookup: Map = {}; - for (const moduleName of moduleNames) { - let resolvedName: ResolvedModule; - if (hasProperty(lookup, moduleName)) { - resolvedName = lookup[moduleName]; - } - else { - resolvedName = resolveModuleName(moduleName, containingFile, options, host).resolvedModule; - lookup[moduleName] = resolvedName; - } - resolvedModuleNames.push(resolvedName); - } - return resolvedModuleNames; - }); + let resolveModuleNamesWorker: (moduleNames: string[], containingFile: string) => ResolvedModule[]; + if (host.resolveModuleNames) { + resolveModuleNamesWorker = (moduleNames, containingFile) => host.resolveModuleNames(moduleNames, containingFile); + } + else { + const loader = (moduleName: string, containingFile: string) => resolveModuleName(moduleName, containingFile, options, host).resolvedModule; + resolveModuleNamesWorker = (moduleNames, containingFile) => loadWithLocalCache(moduleNames, containingFile, loader); + } + + let resolveTypeReferenceDirectiveNamesWorker: (typeDirectiveNames: string[], containingFile: string) => ResolvedTypeReferenceDirective[]; + if (host.resolveTypeReferenceDirectives) { + resolveTypeReferenceDirectiveNamesWorker = (typeDirectiveNames, containingFile) => host.resolveTypeReferenceDirectives(typeDirectiveNames, containingFile); + } + else { + const loader = (typesRef: string, containingFile: string) => resolveTypeReferenceDirective(typesRef, containingFile, options, host).resolvedTypeReferenceDirective; + resolveTypeReferenceDirectiveNamesWorker = (typeReferenceDirectiveNames, containingFile) => loadWithLocalCache(typeReferenceDirectiveNames, containingFile, loader); + } const filesByName = createFileMap(); // stores 'filename -> file association' ignoring case // used to track cases when two file names differ only in casing const filesByNameIgnoreCase = host.useCaseSensitiveFileNames() ? createFileMap(fileName => fileName.toLowerCase()) : undefined; - if (oldProgram) { - // check properties that can affect structure of the program or module resolution strategy - // if any of these properties has changed - structure cannot be reused - const oldOptions = oldProgram.getCompilerOptions(); - if ((oldOptions.module !== options.module) || - (oldOptions.noResolve !== options.noResolve) || - (oldOptions.target !== options.target) || - (oldOptions.noLib !== options.noLib) || - (oldOptions.jsx !== options.jsx) || - (oldOptions.allowJs !== options.allowJs)) { - oldProgram = undefined; - } - } - if (!tryReuseStructureFromOldProgram()) { + // load type declarations specified via 'types' argument + if (options.types && options.types.length) { + const resolutions = resolveTypeReferenceDirectiveNamesWorker(options.types, /*containingFile*/ undefined); + for (let i = 0; i < options.types.length; i++) { + processTypeReferenceDirective(options.types[i], resolutions[i]); + } + } + forEach(rootNames, name => processRootFile(name, /*isDefaultLib*/ false)); // Do not process the default library if: // - The '--noLib' flag is used. // - A 'no-default-lib' reference comment is encountered in // processing the root files. if (!skipDefaultLib) { - processRootFile(host.getDefaultLibFileName(options), /*isDefaultLib*/ true); + // If '--lib' is not specified, include default library file according to '--target' + // otherwise, using options specified in '--lib' instead of '--target' default library file + if (!options.lib) { + processRootFile(host.getDefaultLibFileName(options), /*isDefaultLib*/ true); + } + else { + const libDirectory = host.getDefaultLibLocation ? host.getDefaultLibLocation() : getDirectoryPath(host.getDefaultLibFileName(options)); + forEach(options.lib, libFileName => { + processRootFile(combinePaths(libDirectory, libFileName), /*isDefaultLib*/ true); + }); + } } } @@ -781,7 +1047,8 @@ namespace ts { getIdentifierCount: () => getDiagnosticsProducingTypeChecker().getIdentifierCount(), getSymbolCount: () => getDiagnosticsProducingTypeChecker().getSymbolCount(), getTypeCount: () => getDiagnosticsProducingTypeChecker().getTypeCount(), - getFileProcessingDiagnostics: () => fileProcessingDiagnostics + getFileProcessingDiagnostics: () => fileProcessingDiagnostics, + getResolvedTypeReferenceDirectives: () => resolvedTypeReferenceDirectives }; verifyCompilerOptions(); @@ -828,6 +1095,21 @@ namespace ts { return false; } + // check properties that can affect structure of the program or module resolution strategy + // if any of these properties has changed - structure cannot be reused + const oldOptions = oldProgram.getCompilerOptions(); + if ((oldOptions.module !== options.module) || + (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.typesSearchPaths !== options.typesSearchPaths) || + (oldOptions.configFilePath !== options.configFilePath)) { + return false; + } + Debug.assert(!oldProgram.structureIsReused); // there is an old program, check if we can reuse its structure @@ -836,6 +1118,10 @@ namespace ts { return false; } + if (!arrayIsEqualTo(options.types, oldOptions.types)) { + return false; + } + // check if program source files has changed in the way that can affect structure of the program const newSourceFiles: SourceFile[] = []; const filePaths: Path[] = []; @@ -874,26 +1160,33 @@ namespace ts { return false; } + if (!arrayIsEqualTo(oldSourceFile.typeReferenceDirectives, newSourceFile.typeReferenceDirectives, fileReferenceIsEqualTo)) { + // 'types' references has changed + return false; + } + + const newSourceFilePath = getNormalizedAbsolutePath(newSourceFile.fileName, currentDirectory); if (resolveModuleNamesWorker) { const moduleNames = map(concatenate(newSourceFile.imports, newSourceFile.moduleAugmentations), getTextOfLiteral); - const resolutions = resolveModuleNamesWorker(moduleNames, getNormalizedAbsolutePath(newSourceFile.fileName, currentDirectory)); + const resolutions = resolveModuleNamesWorker(moduleNames, newSourceFilePath); // ensure that module resolution results are still correct - for (let i = 0; i < moduleNames.length; i++) { - const newResolution = resolutions[i]; - const oldResolution = getResolvedModule(oldSourceFile, moduleNames[i]); - const resolutionChanged = oldResolution - ? !newResolution || - oldResolution.resolvedFileName !== newResolution.resolvedFileName || - !!oldResolution.isExternalLibraryImport !== !!newResolution.isExternalLibraryImport - : newResolution; - - if (resolutionChanged) { - return false; - } + const resolutionsChanged = hasChangesInResolutions(moduleNames, resolutions, oldSourceFile.resolvedModules, moduleResolutionIsEqualTo); + if (resolutionsChanged) { + return false; } } - // pass the cache of module resolutions from the old source file + if (resolveTypeReferenceDirectiveNamesWorker) { + const typesReferenceDirectives = map(newSourceFile.typeReferenceDirectives, x => x.fileName); + const resolutions = resolveTypeReferenceDirectiveNamesWorker(typesReferenceDirectives, newSourceFilePath); + // ensure that types resolutions are still correct + const resolutionsChanged = hasChangesInResolutions(typesReferenceDirectives, resolutions, oldSourceFile.resolvedTypeReferenceDirectiveNames, 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); } else { @@ -916,6 +1209,7 @@ namespace ts { for (const modifiedFile of modifiedSourceFiles) { fileProcessingDiagnostics.reattachFileDiagnostics(modifiedFile); } + resolvedTypeReferenceDirectives = oldProgram.getResolvedTypeReferenceDirectives(); oldProgram.structureIsReused = true; return true; @@ -956,7 +1250,7 @@ namespace ts { let declarationDiagnostics: Diagnostic[] = []; if (options.noEmit) { - return { diagnostics: declarationDiagnostics, sourceMaps: undefined, emitSkipped: true }; + return { diagnostics: declarationDiagnostics, sourceMaps: undefined, emittedFiles: undefined, emitSkipped: true }; } // If the noEmitOnError flag is set, then check if we have any errors so far. If so, @@ -976,6 +1270,7 @@ namespace ts { return { diagnostics: concatenate(diagnostics, declarationDiagnostics), sourceMaps: undefined, + emittedFiles: undefined, emitSkipped: true }; } @@ -1007,9 +1302,9 @@ namespace ts { } function getDiagnosticsHelper( - sourceFile: SourceFile, - getDiagnostics: (sourceFile: SourceFile, cancellationToken: CancellationToken) => Diagnostic[], - cancellationToken: CancellationToken): Diagnostic[] { + sourceFile: SourceFile, + getDiagnostics: (sourceFile: SourceFile, cancellationToken: CancellationToken) => Diagnostic[], + cancellationToken: CancellationToken): Diagnostic[] { if (sourceFile) { return getDiagnostics(sourceFile, cancellationToken); } @@ -1483,7 +1778,8 @@ namespace ts { const basePath = getDirectoryPath(fileName); if (!options.noResolve) { - processReferencedFiles(file, basePath); + processReferencedFiles(file, basePath, isDefaultLib); + processTypeReferenceDirectives(file); } // always process imported modules to record module name resolutions @@ -1500,13 +1796,80 @@ namespace ts { return file; } - function processReferencedFiles(file: SourceFile, basePath: string) { + function processReferencedFiles(file: SourceFile, basePath: string, isDefaultLib: boolean) { forEach(file.referencedFiles, ref => { const referencedFileName = resolveTripleslashReference(ref.fileName, file.fileName); - processSourceFile(referencedFileName, /*isDefaultLib*/ false, /*isReference*/ true, file, ref.pos, ref.end); + processSourceFile(referencedFileName, isDefaultLib, /*isReference*/ true, file, ref.pos, ref.end); }); } + function processTypeReferenceDirectives(file: SourceFile) { + const typeDirectives = map(file.typeReferenceDirectives, l => l.fileName); + const resolutions = resolveTypeReferenceDirectiveNamesWorker(typeDirectives, file.fileName); + + for (let i = 0; i < typeDirectives.length; i++) { + const ref = file.typeReferenceDirectives[i]; + const resolvedTypeReferenceDirective = resolutions[i]; + // store resolved type directive on the file + setResolvedTypeReferenceDirective(file, ref.fileName, resolvedTypeReferenceDirective); + processTypeReferenceDirective(ref.fileName, resolvedTypeReferenceDirective, file, ref.pos, ref.end); + } + } + + function processTypeReferenceDirective(typeReferenceDirective: string, resolvedTypeReferenceDirective: ResolvedTypeReferenceDirective, + refFile?: SourceFile, refPos?: number, refEnd?: number): void { + + // If we already found this library as a primary reference - nothing to do + const previousResolution = resolvedTypeReferenceDirectives[typeReferenceDirective]; + if (previousResolution && previousResolution.primary) { + return; + } + let saveResolution = true; + if (resolvedTypeReferenceDirective) { + if (resolvedTypeReferenceDirective.primary) { + // resolved from the primary path + processSourceFile(resolvedTypeReferenceDirective.resolvedFileName, /*isDefaultLib*/ false, /*isReference*/ true, 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) { + const otherFileText = host.readFile(resolvedTypeReferenceDirective.resolvedFileName); + if (otherFileText !== getSourceFile(previousResolution.resolvedFileName).text) { + fileProcessingDiagnostics.add(createDiagnostic(refFile, refPos, refEnd, + Diagnostics.Conflicting_library_definitions_for_0_found_at_1_and_2_Copy_the_correct_file_to_the_typings_folder_to_resolve_this_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); + } + } + } + else { + fileProcessingDiagnostics.add(createDiagnostic(refFile, refPos, refEnd, Diagnostics.Cannot_find_name_0, typeReferenceDirective)); + } + + if (saveResolution) { + resolvedTypeReferenceDirectives[typeReferenceDirective] = resolvedTypeReferenceDirective; + } + } + + function createDiagnostic(refFile: SourceFile, refPos: number, refEnd: number, message: DiagnosticMessage, ...args: any[]): Diagnostic { + if (refFile === undefined || refPos === undefined || refEnd === undefined) { + return createCompilerDiagnostic(message, ...args); + } + else { + return createFileDiagnostic(refFile, refPos, refEnd - refPos, message, ...args); + } + } + function getCanonicalFileName(fileName: string): string { return host.getCanonicalFileName(fileName); } @@ -1554,51 +1917,13 @@ namespace ts { } function computeCommonSourceDirectory(sourceFiles: SourceFile[]): string { - let commonPathComponents: string[]; - const failed = forEach(files, sourceFile => { - // Each file contributes into common source file path - if (isDeclarationFile(sourceFile)) { - return; + const fileNames: string[] = []; + for (const file of sourceFiles) { + if (!file.isDeclarationFile) { + fileNames.push(file.fileName); } - - const sourcePathComponents = getNormalizedPathComponents(sourceFile.fileName, currentDirectory); - sourcePathComponents.pop(); // The base file name is not part of the common directory path - - if (!commonPathComponents) { - // first file - commonPathComponents = sourcePathComponents; - return; - } - - for (let i = 0, n = Math.min(commonPathComponents.length, sourcePathComponents.length); i < n; i++) { - if (getCanonicalFileName(commonPathComponents[i]) !== getCanonicalFileName(sourcePathComponents[i])) { - if (i === 0) { - // Failed to find any common path component - return true; - } - - // New common path found that is 0 -> i-1 - commonPathComponents.length = i; - break; - } - } - - // If the sourcePathComponents was shorter than the commonPathComponents, truncate to the sourcePathComponents - if (sourcePathComponents.length < commonPathComponents.length) { - commonPathComponents.length = sourcePathComponents.length; - } - }); - - // A common path can not be found when paths span multiple drives on windows, for example - if (failed) { - return ""; } - - if (!commonPathComponents) { // Can happen when all input files are .d.ts files - return currentDirectory; - } - - return getNormalizedPathFromPathComponents(commonPathComponents); + return computeCommonSourceDirectoryOfFilenames(fileNames, currentDirectory, getCanonicalFileName); } function checkSourceFilesBelongToPath(sourceFiles: SourceFile[], rootDirectory: string): boolean { @@ -1700,6 +2025,10 @@ namespace ts { } } + if (options.lib && options.noLib) { + programDiagnostics.add(createCompilerDiagnostic(Diagnostics.Option_0_cannot_be_specified_with_option_1, "lib", "noLib")); + } + const languageVersion = options.target || ScriptTarget.ES3; const outFile = options.outFile || options.out; @@ -1742,7 +2071,7 @@ namespace ts { // If we failed to find a good common directory, but outDir is specified and at least one of our files is on a windows drive/URL/other resource, add a failure if (options.outDir && dir === "" && forEach(files, file => getRootLength(file.fileName) > 1)) { - programDiagnostics.add(createCompilerDiagnostic(Diagnostics.Cannot_find_the_common_subdirectory_path_for_the_input_files)); + programDiagnostics.add(createCompilerDiagnostic(Diagnostics.Cannot_find_the_common_subdirectory_path_for_the_input_files)); } } diff --git a/src/compiler/sys.ts b/src/compiler/sys.ts index 1ced01fb349..c391560befd 100644 --- a/src/compiler/sys.ts +++ b/src/compiler/sys.ts @@ -20,6 +20,8 @@ namespace ts { getExecutingFilePath(): string; getCurrentDirectory(): string; readDirectory(path: string, extension?: string, exclude?: string[]): string[]; + getModifiedTime?(path: string): Date; + createHash?(data: string): string; getMemoryUsage?(): number; exit(exitCode?: number): void; } @@ -226,6 +228,7 @@ namespace ts { const _fs = require("fs"); const _path = require("path"); const _os = require("os"); + const _crypto = require("crypto"); // average async stat takes about 30 microseconds // set chunk size to do 30 files in < 1 millisecond @@ -584,6 +587,19 @@ namespace ts { return process.cwd(); }, readDirectory, + getModifiedTime(path) { + try { + return _fs.statSync(path).mtime; + } + catch (e) { + return undefined; + } + }, + createHash(data) { + const hash = _crypto.createHash("md5"); + hash.update(data); + return hash.digest("hex"); + }, getMemoryUsage() { if (global.gc) { global.gc(); @@ -626,7 +642,10 @@ namespace ts { }; } - if (typeof WScript !== "undefined" && typeof ActiveXObject === "function") { + if (typeof ChakraHost !== "undefined") { + return getChakraSystem(); + } + else if (typeof WScript !== "undefined" && typeof ActiveXObject === "function") { return getWScriptSystem(); } else if (typeof process !== "undefined" && process.nextTick && !process.browser && typeof require !== "undefined") { @@ -634,9 +653,6 @@ namespace ts { // process.browser check excludes webpack and browserify return getNodeSystem(); } - else if (typeof ChakraHost !== "undefined") { - return getChakraSystem(); - } else { return undefined; // Unsupported host } diff --git a/src/compiler/tsc.ts b/src/compiler/tsc.ts index 24f95ab358f..c2199cf7345 100644 --- a/src/compiler/tsc.ts +++ b/src/compiler/tsc.ts @@ -14,6 +14,20 @@ namespace ts { } } + function reportEmittedFiles(files: string[], host: CompilerHost): void { + if (!files || files.length == 0) { + return; + } + + const currentDir = sys.getCurrentDirectory(); + + for (const file of files) { + const filepath = getNormalizedAbsolutePath(file, currentDir); + + sys.write(`TSFILE: ${filepath}${sys.newLine}`); + } + } + /** * Checks to see if the locale is in the appropriate format, * and if it is, attempts to set the appropriate language. @@ -108,7 +122,6 @@ namespace ts { sys.write(output); } - const redForegroundEscapeSequence = "\u001b[91m"; const yellowForegroundEscapeSequence = "\u001b[93m"; const blueForegroundEscapeSequence = "\u001b[93m"; @@ -240,11 +253,6 @@ namespace ts { return typeof JSON === "object" && typeof JSON.parse === "function"; } - function isWatchSet(options: CompilerOptions) { - // Firefox has Object.prototype.watch - return options.watch && options.hasOwnProperty("watch"); - } - export function executeCommandLine(args: string[]): void { const commandLine = parseCommandLine(args); let configFileName: string; // Configuration file name (if any) @@ -338,8 +346,7 @@ namespace ts { return sys.exit(ExitStatus.DiagnosticsPresent_OutputsSkipped); } if (configFileName) { - const configFilePath = toPath(configFileName, sys.getCurrentDirectory(), createGetCanonicalFileName(sys.useCaseSensitiveFileNames)); - configFileWatcher = sys.watchFile(configFilePath, configFileChanged); + configFileWatcher = sys.watchFile(configFileName, configFileChanged); } if (sys.watchDirectory && configFileName) { const directory = ts.getDirectoryPath(configFileName); @@ -451,8 +458,7 @@ namespace ts { const sourceFile = hostGetSourceFile(fileName, languageVersion, onError); if (sourceFile && isWatchSet(compilerOptions) && sys.watchFile) { // Attach a file watcher - const filePath = toPath(sourceFile.fileName, sys.getCurrentDirectory(), createGetCanonicalFileName(sys.useCaseSensitiveFileNames)); - sourceFile.fileWatcher = sys.watchFile(filePath, (fileName: string, removed?: boolean) => sourceFileChanged(sourceFile, removed)); + sourceFile.fileWatcher = sys.watchFile(sourceFile.fileName, (fileName: string, removed?: boolean) => sourceFileChanged(sourceFile, removed)); } return sourceFile; } @@ -604,6 +610,8 @@ namespace ts { reportDiagnostics(sortAndDeduplicateDiagnostics(diagnostics), compilerHost); + reportEmittedFiles(emitOutput.emittedFiles, compilerHost); + if (emitOutput.emitSkipped && diagnostics.length > 0) { // If the emitter didn't emit anything, then pass that value along. return ExitStatus.DiagnosticsPresent_OutputsSkipped; @@ -655,6 +663,8 @@ namespace ts { const usageColumn: string[] = []; // Things like "-d, --declaration" go in here. const descriptionColumn: string[] = []; + const optionsDescriptionMap: Map = {}; // Map between option.description and list of option.type if it is a kind + for (let i = 0; i < optsList.length; i++) { const option = optsList[i]; @@ -675,7 +685,22 @@ namespace ts { usageText += getParamType(option); usageColumn.push(usageText); - descriptionColumn.push(getDiagnosticText(option.description)); + let description: string; + + if (option.name === "lib") { + description = getDiagnosticText(option.description); + const options: string[] = []; + const element = (option).element; + forEachKey(>element.type, key => { + options.push(`'${key}'`); + }); + optionsDescriptionMap[description] = options; + } + else { + description = getDiagnosticText(option.description); + } + + descriptionColumn.push(description); // Set the new margin for the description column if necessary. marginLength = Math.max(usageText.length, marginLength); @@ -691,7 +716,16 @@ namespace ts { for (let i = 0; i < usageColumn.length; i++) { const usage = usageColumn[i]; const description = descriptionColumn[i]; + const kindsList = optionsDescriptionMap[description]; output += usage + makePadding(marginLength - usage.length + 2) + description + sys.newLine; + + if (kindsList) { + output += makePadding(marginLength + 4); + for (const kind of kindsList) { + output += kind + " "; + } + output += sys.newLine; + } } sys.write(output); diff --git a/src/compiler/types.ts b/src/compiler/types.ts index 838b5d951f2..7743f7c35de 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -410,6 +410,7 @@ namespace ts { JavaScriptFile = 1 << 27, // If node was parsed in a JavaScript ThisNodeOrAnySubNodesHasError = 1 << 28, // If this node or any of its children had an error HasAggregatedChildData = 1 << 29, // If we've computed data from children and cached it in this node + HasJsxSpreadAttribute = 1 << 30, Modifier = Export | Ambient | Public | Private | Protected | Static | Abstract | Default | Async, AccessibilityModifier = Public | Private | Protected, @@ -1566,6 +1567,7 @@ namespace ts { amdDependencies: AmdDependency[]; moduleName: string; referencedFiles: FileReference[]; + typeReferenceDirectives: FileReference[]; languageVariant: LanguageVariant; isDeclarationFile: boolean; @@ -1613,6 +1615,7 @@ namespace ts { // It is used to resolve module names in the checker. // Content of this field should never be used directly - use getResolvedModuleFileName/setResolvedModuleFileName functions instead /* @internal */ resolvedModules: Map; + /* @internal */ resolvedTypeReferenceDirectiveNames: Map; /* @internal */ imports: LiteralExpression[]; /* @internal */ moduleAugmentations: LiteralExpression[]; } @@ -1689,6 +1692,7 @@ namespace ts { /* @internal */ getTypeCount(): number; /* @internal */ getFileProcessingDiagnostics(): DiagnosticCollection; + /* @internal */ getResolvedTypeReferenceDirectives(): Map; // For testing purposes only. /* @internal */ structureIsReused?: boolean; } @@ -1739,6 +1743,7 @@ namespace ts { emitSkipped: boolean; /** Contains declaration emit diagnostics */ diagnostics: Diagnostic[]; + emittedFiles: string[]; // Array of files the compiler wrote to disk /* @internal */ sourceMaps: SourceMapData[]; // Array of sourceMapData if compiler emitted sourcemaps } @@ -1748,6 +1753,7 @@ namespace ts { getSourceFiles(): SourceFile[]; getSourceFile(fileName: string): SourceFile; + getResolvedTypeReferenceDirectives(): Map; } export interface TypeChecker { @@ -1765,6 +1771,7 @@ namespace ts { getSymbolsOfParameterPropertyDeclaration(parameter: ParameterDeclaration, parameterName: string): Symbol[]; getShorthandAssignmentValueSymbol(location: Node): Symbol; getExportSpecifierLocalTargetSymbol(location: ExportSpecifier): Symbol; + getPropertySymbolOfDestructuringAssignment(location: Identifier): Symbol; getTypeAtLocation(node: Node): Type; typeToString(type: Type, enclosingDeclaration?: Node, flags?: TypeFormatFlags): string; symbolToString(symbol: Symbol, enclosingDeclaration?: Node, meaning?: SymbolFlags): string; @@ -1808,7 +1815,7 @@ namespace ts { buildTypeParameterDisplay(tp: TypeParameter, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void; buildTypePredicateDisplay(predicate: TypePredicate, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void; buildTypeParameterDisplayFromSymbol(symbol: Symbol, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void; - buildDisplayForParametersAndDelimiters(parameters: Symbol[], writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void; + buildDisplayForParametersAndDelimiters(thisType: Type, parameters: Symbol[], writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void; buildDisplayForTypeParametersAndDelimiters(typeParameters: TypeParameter[], writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void; buildReturnTypeDisplay(signature: Signature, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void; } @@ -1955,6 +1962,8 @@ namespace ts { moduleExportsSomeValue(moduleReferenceExpression: Expression): boolean; isArgumentsLocalBinding(node: Identifier): boolean; getExternalModuleFileFromDeclaration(declaration: ImportEqualsDeclaration | ImportDeclaration | ExportDeclaration | ModuleDeclaration): SourceFile; + getTypeReferenceDirectivesForEntityName(name: EntityName | PropertyAccessExpression): string[]; + getTypeReferenceDirectivesForSymbol(symbol: Symbol, meaning?: SymbolFlags): string[]; } export const enum SymbolFlags { @@ -2310,6 +2319,7 @@ namespace ts { declaration: SignatureDeclaration; // Originating declaration typeParameters: TypeParameter[]; // Type parameters (undefined if non-generic) parameters: Symbol[]; // Parameters + thisType?: Type; // type of this-type /* @internal */ resolvedReturnType: Type; // Resolved return type /* @internal */ @@ -2445,6 +2455,7 @@ namespace ts { jsx?: JsxEmit; reactNamespace?: string; listFiles?: boolean; + typesSearchPaths?: string[]; locale?: string; mapRoot?: string; module?: ModuleKind; @@ -2454,6 +2465,7 @@ namespace ts { noEmitOnError?: boolean; noErrorTruncation?: boolean; noImplicitAny?: boolean; + noImplicitThis?: boolean; noLib?: boolean; noResolve?: boolean; out?: string; @@ -2483,11 +2495,12 @@ namespace ts { baseUrl?: string; paths?: PathSubstitutions; rootDirs?: RootPaths; - traceModuleResolution?: boolean; + traceResolution?: boolean; allowSyntheticDefaultImports?: boolean; allowJs?: boolean; noImplicitUseStrict?: boolean; strictNullChecks?: boolean; + listEmittedFiles?: boolean; lib?: string[]; /* @internal */ stripInternal?: boolean; @@ -2496,8 +2509,15 @@ namespace ts { // Do not perform validation of output file name in transpile scenarios /* @internal */ suppressOutputPathCheck?: boolean; - list?: string[]; + /* @internal */ + // When options come from a config file, its path is recorded here + configFilePath?: string; + /* @internal */ + // Path used to used to compute primary search locations + typesRoot?: string; + types?: string[]; + list?: string[]; [option: string]: CompilerOptionsValue; } @@ -2778,10 +2798,23 @@ namespace ts { failedLookupLocations: string[]; } + export interface ResolvedTypeReferenceDirective { + // True if the type declaration file was found in a primary lookup location + primary: boolean; + // The location of the .d.ts file we located, or undefined if resolution failed + resolvedFileName?: string; + } + + export interface ResolvedTypeReferenceDirectiveWithFailedLookupLocations { + resolvedTypeReferenceDirective: ResolvedTypeReferenceDirective; + failedLookupLocations: string[]; + } + export interface CompilerHost extends ModuleResolutionHost { getSourceFile(fileName: string, languageVersion: ScriptTarget, onError?: (message: string) => void): SourceFile; getCancellationToken?(): CancellationToken; getDefaultLibFileName(options: CompilerOptions): string; + getDefaultLibLocation?(): string; writeFile: WriteFileCallback; getCurrentDirectory(): string; getCanonicalFileName(fileName: string): string; @@ -2796,6 +2829,10 @@ namespace ts { * 'throw new Error("NotImplemented")' */ resolveModuleNames?(moduleNames: string[], containingFile: string): ResolvedModule[]; + /** + * 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[]; } export interface TextSpan { diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index fab5e9f8f8b..ebf6b42581a 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -6,6 +6,7 @@ namespace ts { fileReference?: FileReference; diagnosticMessage?: DiagnosticMessage; isNoDefaultLib?: boolean; + isTypeReferenceDirective?: boolean; } export interface SynthesizedNode extends Node { @@ -118,6 +119,43 @@ namespace ts { sourceFile.resolvedModules[moduleNameText] = resolvedModule; } + export function setResolvedTypeReferenceDirective(sourceFile: SourceFile, typeReferenceDirectiveName: string, resolvedTypeReferenceDirective: ResolvedTypeReferenceDirective): void { + if (!sourceFile.resolvedTypeReferenceDirectiveNames) { + sourceFile.resolvedTypeReferenceDirectiveNames = {}; + } + + sourceFile.resolvedTypeReferenceDirectiveNames[typeReferenceDirectiveName] = resolvedTypeReferenceDirective; + } + + /* @internal */ + export function moduleResolutionIsEqualTo(oldResolution: ResolvedModule, newResolution: ResolvedModule): boolean { + return oldResolution.resolvedFileName === newResolution.resolvedFileName && oldResolution.isExternalLibraryImport === newResolution.isExternalLibraryImport; + } + + /* @internal */ + export function typeDirectiveIsEqualTo(oldResolution: ResolvedTypeReferenceDirective, newResolution: ResolvedTypeReferenceDirective): boolean { + return oldResolution.resolvedFileName === newResolution.resolvedFileName && oldResolution.primary === newResolution.primary; + } + + /* @internal */ + export function hasChangesInResolutions(names: string[], newResolutions: T[], oldResolutions: Map, comparer: (oldResolution: T, newResolution: T) => boolean): boolean { + if (names.length !== newResolutions.length) { + return false; + } + for (let i = 0; i < names.length; i++) { + const newResolution = newResolutions[i]; + const oldResolution = oldResolutions && hasProperty(oldResolutions, names[i]) ? oldResolutions[names[i]] : undefined; + const changed = + oldResolution + ? !newResolution || !comparer(oldResolution, newResolution) + : newResolution; + if (changed) { + return true; + } + } + return false; + } + // Returns true if this node contains a parse error anywhere underneath it. export function containsParseError(node: Node): boolean { aggregateChildData(node); @@ -179,6 +217,33 @@ namespace ts { return node.pos; } + export function getEndLinePosition(line: number, sourceFile: SourceFile): number { + Debug.assert(line >= 0); + const lineStarts = getLineStarts(sourceFile); + + const lineIndex = line; + const sourceText = sourceFile.text; + if (lineIndex + 1 === lineStarts.length) { + // last line - return EOF + return sourceText.length - 1; + } + else { + // current line start + const start = lineStarts[lineIndex]; + // take the start position of the next line - 1 = it should be some line break + let pos = lineStarts[lineIndex + 1] - 1; + Debug.assert(isLineBreak(sourceText.charCodeAt(pos))); + // walk backwards skipping line breaks, stop the the beginning of current line. + // i.e: + // + // $ <- end of line for this position should match the start position + while (start <= pos && isLineBreak(sourceText.charCodeAt(pos))) { + pos--; + } + return pos; + } + } + // Returns true if this node is missing from the actual source code. A 'missing' node is different // from 'undefined/defined'. When a node is undefined (which can happen for optional nodes // in the tree), it is definitely missing. However, a node may be defined, but still be @@ -402,6 +467,20 @@ namespace ts { return createTextSpanFromBounds(start, scanner.getTextPos()); } + function getErrorSpanForArrowFunction(sourceFile: SourceFile, node: ArrowFunction): TextSpan { + const pos = skipTrivia(sourceFile.text, node.pos); + if (node.body && node.body.kind === SyntaxKind.Block) { + const { line: startLine } = getLineAndCharacterOfPosition(sourceFile, node.body.pos); + const { line: endLine } = getLineAndCharacterOfPosition(sourceFile, node.body.end); + if (startLine < endLine) { + // The arrow function spans multiple lines, + // make the error span be the first line, inclusive. + return createTextSpan(pos, getEndLinePosition(startLine, sourceFile) - pos + 1); + } + } + return createTextSpanFromBounds(pos, node.end); + } + export function getErrorSpanForNode(sourceFile: SourceFile, node: Node): TextSpan { let errorNode = node; switch (node.kind) { @@ -430,6 +509,8 @@ namespace ts { case SyntaxKind.TypeAliasDeclaration: errorNode = (node).name; break; + case SyntaxKind.ArrowFunction: + return getErrorSpanForArrowFunction(sourceFile, node); } if (errorNode === undefined) { @@ -536,6 +617,7 @@ namespace ts { } export let fullTripleSlashReferencePathRegEx = /^(\/\/\/\s*/; + export let fullTripleSlashReferenceTypeReferenceDirectiveRegEx = /^(\/\/\/\s*/; export let fullTripleSlashAMDReferencePathRegEx = /^(\/\/\/\s*/; export function isTypeNode(node: Node): boolean { @@ -1591,25 +1673,26 @@ namespace ts { }; } else { - const matchResult = fullTripleSlashReferencePathRegEx.exec(comment); - if (matchResult) { + const refMatchResult = fullTripleSlashReferencePathRegEx.exec(comment); + const refLibResult = !refMatchResult && fullTripleSlashReferenceTypeReferenceDirectiveRegEx.exec(comment); + if (refMatchResult || refLibResult) { const start = commentRange.pos; const end = commentRange.end; return { fileReference: { pos: start, end: end, - fileName: matchResult[3] + fileName: (refMatchResult || refLibResult)[3] }, - isNoDefaultLib: false - }; - } - else { - return { - diagnosticMessage: Diagnostics.Invalid_reference_directive_syntax, - isNoDefaultLib: false + isNoDefaultLib: false, + isTypeReferenceDirective: !!refLibResult }; } + + return { + diagnosticMessage: Diagnostics.Invalid_reference_directive_syntax, + isNoDefaultLib: false + }; } } @@ -2685,6 +2768,11 @@ namespace ts { } return carriageReturnLineFeed; } + + export function isWatchSet(options: CompilerOptions) { + // Firefox has Object.prototype.watch + return options.watch && options.hasOwnProperty("watch"); + } } namespace ts { @@ -2922,4 +3010,13 @@ namespace ts { export function isParameterPropertyDeclaration(node: ParameterDeclaration): boolean { return node.flags & NodeFlags.AccessibilityModifier && node.parent.kind === SyntaxKind.Constructor && isClassLike(node.parent.parent); } + + export function startsWith(str: string, prefix: string): boolean { + return str.lastIndexOf(prefix, 0) === 0; + } + + export function endsWith(str: string, suffix: string): boolean { + const expectedPos = str.length - suffix.length; + return str.indexOf(suffix, expectedPos) === expectedPos; + } } diff --git a/src/harness/compilerRunner.ts b/src/harness/compilerRunner.ts index 3362cb1d375..4842fd5a723 100644 --- a/src/harness/compilerRunner.ts +++ b/src/harness/compilerRunner.ts @@ -1,7 +1,7 @@ /// /// /// -/* tslint:disable:no-null */ +/* tslint:disable:no-null-keyword */ const enum CompilerTestType { Conformance, @@ -102,6 +102,10 @@ class CompilerBaselineRunner extends RunnerBase { }); } + if (tsConfigOptions && tsConfigOptions.configFilePath !== undefined) { + tsConfigOptions.configFilePath = ts.combinePaths(rootDir, tsConfigOptions.configFilePath); + } + const output = Harness.Compiler.compileFiles( toBeCompiled, otherFiles, harnessSettings, /*options*/ tsConfigOptions, /*currentDirectory*/ undefined); @@ -140,7 +144,7 @@ class CompilerBaselineRunner extends RunnerBase { }); it (`Correct module resolution tracing for ${fileName}`, () => { - if (options.traceModuleResolution) { + if (options.traceResolution) { Harness.Baseline.runBaseline("Correct sourcemap content for " + fileName, justName.replace(/\.tsx?$/, ".trace.json"), () => { return JSON.stringify(result.traceResults || [], undefined, 4); }); @@ -252,125 +256,128 @@ class CompilerBaselineRunner extends RunnerBase { } // NEWTODO: Type baselines - if (result.errors.length === 0) { - // The full walker simulates the types that you would get from doing a full - // compile. The pull walker simulates the types you get when you just do - // a type query for a random node (like how the LS would do it). Most of the - // time, these will be the same. However, occasionally, they can be different. - // Specifically, when the compiler internally depends on symbol IDs to order - // things, then we may see different results because symbols can be created in a - // different order with 'pull' operations, and thus can produce slightly differing - // output. - // - // For example, with a full type check, we may see a type displayed as: number | string - // But with a pull type check, we may see it as: string | number - // - // These types are equivalent, but depend on what order the compiler observed - // certain parts of the program. - - const program = result.program; - const allFiles = toBeCompiled.concat(otherFiles).filter(file => !!program.getSourceFile(file.unitName)); - - const fullWalker = new TypeWriterWalker(program, /*fullTypeCheck*/ true); - - const fullResults: ts.Map = {}; - const pullResults: ts.Map = {}; - - for (const sourceFile of allFiles) { - fullResults[sourceFile.unitName] = fullWalker.getTypeAndSymbols(sourceFile.unitName); - pullResults[sourceFile.unitName] = fullWalker.getTypeAndSymbols(sourceFile.unitName); - } - - // Produce baselines. The first gives the types for all expressions. - // The second gives symbols for all identifiers. - let e1: Error, e2: Error; - try { - checkBaseLines(/*isSymbolBaseLine*/ false); - } - catch (e) { - e1 = e; - } - - try { - checkBaseLines(/*isSymbolBaseLine*/ true); - } - catch (e) { - e2 = e; - } - - if (e1 || e2) { - throw e1 || e2; - } - + if (result.errors.length !== 0) { return; + } - function checkBaseLines(isSymbolBaseLine: boolean) { - const fullBaseLine = generateBaseLine(fullResults, isSymbolBaseLine); - const pullBaseLine = generateBaseLine(pullResults, isSymbolBaseLine); + // The full walker simulates the types that you would get from doing a full + // compile. The pull walker simulates the types you get when you just do + // a type query for a random node (like how the LS would do it). Most of the + // time, these will be the same. However, occasionally, they can be different. + // Specifically, when the compiler internally depends on symbol IDs to order + // things, then we may see different results because symbols can be created in a + // different order with 'pull' operations, and thus can produce slightly differing + // output. + // + // For example, with a full type check, we may see a type displayed as: number | string + // But with a pull type check, we may see it as: string | number + // + // These types are equivalent, but depend on what order the compiler observed + // certain parts of the program. - const fullExtension = isSymbolBaseLine ? ".symbols" : ".types"; - const pullExtension = isSymbolBaseLine ? ".symbols.pull" : ".types.pull"; + const program = result.program; + const allFiles = toBeCompiled.concat(otherFiles).filter(file => !!program.getSourceFile(file.unitName)); - if (fullBaseLine !== pullBaseLine) { - Harness.Baseline.runBaseline("Correct full information for " + fileName, justName.replace(/\.tsx?/, fullExtension), () => fullBaseLine); - Harness.Baseline.runBaseline("Correct pull information for " + fileName, justName.replace(/\.tsx?/, pullExtension), () => pullBaseLine); - } - else { - Harness.Baseline.runBaseline("Correct information for " + fileName, justName.replace(/\.tsx?/, fullExtension), () => fullBaseLine); - } + const fullWalker = new TypeWriterWalker(program, /*fullTypeCheck*/ true); + + const fullResults: ts.Map = {}; + const pullResults: ts.Map = {}; + + for (const sourceFile of allFiles) { + fullResults[sourceFile.unitName] = fullWalker.getTypeAndSymbols(sourceFile.unitName); + pullResults[sourceFile.unitName] = fullWalker.getTypeAndSymbols(sourceFile.unitName); + } + + // Produce baselines. The first gives the types for all expressions. + // The second gives symbols for all identifiers. + let e1: Error, e2: Error; + try { + checkBaseLines(/*isSymbolBaseLine*/ false); + } + catch (e) { + e1 = e; + } + + try { + checkBaseLines(/*isSymbolBaseLine*/ true); + } + catch (e) { + e2 = e; + } + + if (e1 || e2) { + throw e1 || e2; + } + + return; + + function checkBaseLines(isSymbolBaseLine: boolean) { + const fullBaseLine = generateBaseLine(fullResults, isSymbolBaseLine); + const pullBaseLine = generateBaseLine(pullResults, isSymbolBaseLine); + + const fullExtension = isSymbolBaseLine ? ".symbols" : ".types"; + const pullExtension = isSymbolBaseLine ? ".symbols.pull" : ".types.pull"; + + if (fullBaseLine !== pullBaseLine) { + Harness.Baseline.runBaseline("Correct full information for " + fileName, justName.replace(/\.tsx?/, fullExtension), () => fullBaseLine); + Harness.Baseline.runBaseline("Correct pull information for " + fileName, justName.replace(/\.tsx?/, pullExtension), () => pullBaseLine); } - - function generateBaseLine(typeWriterResults: ts.Map, isSymbolBaseline: boolean): string { - const typeLines: string[] = []; - const typeMap: { [fileName: string]: { [lineNum: number]: string[]; } } = {}; - - allFiles.forEach(file => { - const codeLines = file.content.split("\n"); - typeWriterResults[file.unitName].forEach(result => { - if (isSymbolBaseline && !result.symbol) { - return; - } - - const typeOrSymbolString = isSymbolBaseline ? result.symbol : result.type; - const formattedLine = result.sourceText.replace(/\r?\n/g, "") + " : " + typeOrSymbolString; - if (!typeMap[file.unitName]) { - typeMap[file.unitName] = {}; - } - - let typeInfo = [formattedLine]; - const existingTypeInfo = typeMap[file.unitName][result.line]; - if (existingTypeInfo) { - typeInfo = existingTypeInfo.concat(typeInfo); - } - typeMap[file.unitName][result.line] = typeInfo; - }); - - typeLines.push("=== " + file.unitName + " ===\r\n"); - for (let i = 0; i < codeLines.length; i++) { - const currentCodeLine = codeLines[i]; - typeLines.push(currentCodeLine + "\r\n"); - if (typeMap[file.unitName]) { - const typeInfo = typeMap[file.unitName][i]; - if (typeInfo) { - typeInfo.forEach(ty => { - typeLines.push(">" + ty + "\r\n"); - }); - if (i + 1 < codeLines.length && (codeLines[i + 1].match(/^\s*[{|}]\s*$/) || codeLines[i + 1].trim() === "")) { - } - else { - typeLines.push("\r\n"); - } - } - } - else { - typeLines.push("No type information for this code."); - } - } - }); - - return typeLines.join(""); + else { + Harness.Baseline.runBaseline("Correct information for " + fileName, justName.replace(/\.tsx?/, fullExtension), () => fullBaseLine); } } + + function generateBaseLine(typeWriterResults: ts.Map, isSymbolBaseline: boolean): string { + const typeLines: string[] = []; + const typeMap: { [fileName: string]: { [lineNum: number]: string[]; } } = {}; + + allFiles.forEach(file => { + const codeLines = file.content.split("\n"); + typeWriterResults[file.unitName].forEach(result => { + if (isSymbolBaseline && !result.symbol) { + return; + } + + const typeOrSymbolString = isSymbolBaseline ? result.symbol : result.type; + const formattedLine = result.sourceText.replace(/\r?\n/g, "") + " : " + typeOrSymbolString; + if (!typeMap[file.unitName]) { + typeMap[file.unitName] = {}; + } + + let typeInfo = [formattedLine]; + const existingTypeInfo = typeMap[file.unitName][result.line]; + if (existingTypeInfo) { + typeInfo = existingTypeInfo.concat(typeInfo); + } + typeMap[file.unitName][result.line] = typeInfo; + }); + + typeLines.push("=== " + file.unitName + " ===\r\n"); + for (let i = 0; i < codeLines.length; i++) { + const currentCodeLine = codeLines[i]; + typeLines.push(currentCodeLine + "\r\n"); + if (typeMap[file.unitName]) { + const typeInfo = typeMap[file.unitName][i]; + if (typeInfo) { + typeInfo.forEach(ty => { + typeLines.push(">" + ty + "\r\n"); + }); + if (i + 1 < codeLines.length && (codeLines[i + 1].match(/^\s*[{|}]\s*$/) || codeLines[i + 1].trim() === "")) { + } + else { + typeLines.push("\r\n"); + } + } + } + else { + typeLines.push("No type information for this code."); + } + } + }); + + return typeLines.join(""); + } + }); }); } diff --git a/src/harness/fourslash.ts b/src/harness/fourslash.ts index 2fba2d13299..48b79017f8d 100644 --- a/src/harness/fourslash.ts +++ b/src/harness/fourslash.ts @@ -18,7 +18,7 @@ /// /// /// -/* tslint:disable:no-null */ +/* tslint:disable:no-null-keyword */ namespace FourSlash { ts.disableIncrementalParsing = false; @@ -221,8 +221,8 @@ namespace FourSlash { function tryAdd(path: string) { const inputFile = inputFiles[path]; - if (inputFile && !Harness.isLibraryFile(path)) { - languageServiceAdapterHost.addScript(path, inputFile); + if (inputFile && !Harness.isDefaultLibraryFile(path)) { + languageServiceAdapterHost.addScript(path, inputFile, /*isRootFile*/ true); return true; } } @@ -247,6 +247,10 @@ namespace FourSlash { // Create a new Services Adapter this.cancellationToken = new TestCancellationToken(); const compilationOptions = convertGlobalOptionsToCompilerOptions(this.testData.globalOptions); + if (compilationOptions.typesRoot) { + compilationOptions.typesRoot = ts.getNormalizedAbsolutePath(compilationOptions.typesRoot, this.basePath); + } + const languageServiceAdapter = this.getLanguageServiceAdapter(testType, this.cancellationToken, compilationOptions); this.languageServiceAdapterHost = languageServiceAdapter.getHost(); this.languageService = languageServiceAdapter.getLanguageService(); @@ -268,7 +272,7 @@ namespace FourSlash { if (startResolveFileRef) { // Add the entry-point file itself into the languageServiceShimHost - this.languageServiceAdapterHost.addScript(startResolveFileRef.fileName, startResolveFileRef.content); + this.languageServiceAdapterHost.addScript(startResolveFileRef.fileName, startResolveFileRef.content, /*isRootFile*/ true); const resolvedResult = languageServiceAdapter.getPreProcessedFileInfo(startResolveFileRef.fileName, startResolveFileRef.content); const referencedFiles: ts.FileReference[] = resolvedResult.referencedFiles; @@ -291,17 +295,19 @@ namespace FourSlash { // Check if no-default-lib flag is false and if so add default library if (!resolvedResult.isLibFile) { - this.languageServiceAdapterHost.addScript(Harness.Compiler.defaultLibFileName, Harness.Compiler.defaultLibSourceFile.text); + this.languageServiceAdapterHost.addScript(Harness.Compiler.defaultLibFileName, + Harness.Compiler.getDefaultLibrarySourceFile().text, /*isRootFile*/ false); } } else { // resolveReference file-option is not specified then do not resolve any files and include all inputFiles ts.forEachKey(this.inputFiles, fileName => { - if (!Harness.isLibraryFile(fileName)) { - this.languageServiceAdapterHost.addScript(fileName, this.inputFiles[fileName]); + if (!Harness.isDefaultLibraryFile(fileName)) { + this.languageServiceAdapterHost.addScript(fileName, this.inputFiles[fileName], /*isRootFile*/ true); } }); - this.languageServiceAdapterHost.addScript(Harness.Compiler.defaultLibFileName, Harness.Compiler.defaultLibSourceFile.text); + this.languageServiceAdapterHost.addScript(Harness.Compiler.defaultLibFileName, + Harness.Compiler.getDefaultLibrarySourceFile().text, /*isRootFile*/ false); } this.formatCodeOptions = { diff --git a/src/harness/fourslashRunner.ts b/src/harness/fourslashRunner.ts index 84e352359c4..386bd9e340c 100644 --- a/src/harness/fourslashRunner.ts +++ b/src/harness/fourslashRunner.ts @@ -1,7 +1,7 @@ /// /// /// -/* tslint:disable:no-null */ +/* tslint:disable:no-null-keyword */ const enum FourSlashTestType { Native, diff --git a/src/harness/harness.ts b/src/harness/harness.ts index 330f57cf5c9..790ecebb75f 100644 --- a/src/harness/harness.ts +++ b/src/harness/harness.ts @@ -23,7 +23,7 @@ /// /// /// -/* tslint:disable:no-null */ +/* tslint:disable:no-null-keyword */ // Block scoped definitions work poorly for global variables, temporarily enable var /* tslint:disable:no-var-keyword */ @@ -65,6 +65,11 @@ namespace Utils { return Buffer ? (new Buffer(s)).toString("utf8") : s; } + export function byteLength(s: string, encoding?: string): number { + // stub implementation if Buffer is not available (in-browser case) + return Buffer ? Buffer.byteLength(s, encoding) : s.length; + } + export function evalFile(fileContents: string, fileName: string, nodeContext?: any) { const environment = getExecutionEnvironment(); switch (environment) { @@ -817,15 +822,33 @@ namespace Harness { const lineFeed = "\n"; export const defaultLibFileName = "lib.d.ts"; - export const defaultLibSourceFile = createSourceFileAndAssertInvariants(defaultLibFileName, IO.readFile(libFolder + "lib.core.d.ts"), /*languageVersion*/ ts.ScriptTarget.Latest); - export const defaultES6LibSourceFile = createSourceFileAndAssertInvariants(defaultLibFileName, IO.readFile(libFolder + "lib.core.es6.d.ts"), /*languageVersion*/ ts.ScriptTarget.Latest); + export const es2015DefaultLibFileName = "lib.es2015.d.ts"; + + const libFileNameSourceFileMap: ts.Map = { + [defaultLibFileName]: createSourceFileAndAssertInvariants(defaultLibFileName, IO.readFile(libFolder + "lib.es5.d.ts"), /*languageVersion*/ ts.ScriptTarget.Latest) + }; + + export function getDefaultLibrarySourceFile(fileName = defaultLibFileName): ts.SourceFile { + if (!isDefaultLibraryFile(fileName)) { + return undefined; + } + + if (!libFileNameSourceFileMap[fileName]) { + libFileNameSourceFileMap[fileName] = createSourceFileAndAssertInvariants(fileName, IO.readFile(libFolder + fileName), ts.ScriptTarget.Latest); + } + return libFileNameSourceFileMap[fileName]; + } + + export function getDefaultLibFileName(options: ts.CompilerOptions): string { + return options.target === ts.ScriptTarget.ES6 ? es2015DefaultLibFileName : defaultLibFileName; + } // Cache these between executions so we don't have to re-parse them for every test export const fourslashFileName = "fourslash.ts"; export let fourslashSourceFile: ts.SourceFile; export function getCanonicalFileName(fileName: string): string { - return Harness.IO.useCaseSensitiveFileNames() ? fileName : fileName.toLowerCase(); + return fileName; } export function createCompilerHost( @@ -850,23 +873,21 @@ namespace Harness { } } - function getSourceFile(fn: string, languageVersion: ts.ScriptTarget) { - fn = ts.normalizePath(fn); - const path = ts.toPath(fn, currentDirectory, getCanonicalFileName); + function getSourceFile(fileName: string, languageVersion: ts.ScriptTarget) { + fileName = ts.normalizePath(fileName); + const path = ts.toPath(fileName, currentDirectory, getCanonicalFileName); if (fileMap.contains(path)) { return fileMap.get(path); } - else if (fn === fourslashFileName) { + else if (fileName === fourslashFileName) { const tsFn = "tests/cases/fourslash/" + fourslashFileName; fourslashSourceFile = fourslashSourceFile || createSourceFileAndAssertInvariants(tsFn, Harness.IO.readFile(tsFn), scriptTarget); return fourslashSourceFile; } else { - if (fn === defaultLibFileName) { - return languageVersion === ts.ScriptTarget.ES6 ? defaultES6LibSourceFile : defaultLibSourceFile; - } // Don't throw here -- the compiler might be looking for a test that actually doesn't exist as part of the TC - return undefined; + // Return if it is other library file, otherwise return undefined + return getDefaultLibrarySourceFile(fileName); } } @@ -875,16 +896,21 @@ namespace Harness { newLineKind === ts.NewLineKind.LineFeed ? lineFeed : Harness.IO.newLine(); + return { getCurrentDirectory: () => currentDirectory, getSourceFile, - getDefaultLibFileName: options => defaultLibFileName, + getDefaultLibFileName, writeFile, getCanonicalFileName, useCaseSensitiveFileNames: () => useCaseSensitiveFileNames, getNewLine: () => newLine, - fileExists: fileName => getSourceFile(fileName, ts.ScriptTarget.ES5) !== undefined, - readFile: (fileName: string): string => { return Harness.IO.readFile(fileName); } + fileExists: fileName => { + return fileMap.contains(ts.toPath(fileName, currentDirectory, getCanonicalFileName)); + }, + readFile: (fileName: string): string => { + return fileMap.get(ts.toPath(fileName, currentDirectory, getCanonicalFileName)).getText(); + } }; } @@ -929,6 +955,7 @@ namespace Harness { } const option = getCommandLineOption(name); if (option) { + const errors: ts.Diagnostic[] = []; switch (option.type) { case "boolean": options[option.name] = value.toLowerCase() === "true"; @@ -937,15 +964,16 @@ namespace Harness { options[option.name] = value; break; // If not a primitive, the possible types are specified in what is effectively a map of options. + case "list": + options[option.name] = ts.parseListTypeOption(option, value, errors); + break; default: - let map = >option.type; - let key = value.toLowerCase(); - if (ts.hasProperty(map, key)) { - options[option.name] = map[key]; - } - else { - throw new Error(`Unknown value '${value}' for compiler option '${name}'.`); - } + options[option.name] = ts.parseCustomTypeOption(option, value, errors); + break; + } + + if (errors.length > 0) { + throw new Error(`Unknown value '${value}' for compiler option '${name}'.`); } } else { @@ -972,7 +1000,6 @@ namespace Harness { compilerOptions: ts.CompilerOptions, // Current directory is needed for rwcRunner to be able to use currentDirectory defined in json file currentDirectory: string): CompilationOutput { - const options: ts.CompilerOptions & HarnessOptions = compilerOptions ? ts.clone(compilerOptions) : { noResolve: false }; options.target = options.target || ts.ScriptTarget.ES3; options.newLine = options.newLine || ts.NewLineKind.CarriageReturnLineFeed; @@ -1024,7 +1051,7 @@ namespace Harness { options.newLine); let traceResults: string[]; - if (options.traceModuleResolution) { + if (options.traceResolution) { traceResults = []; compilerHost.trace = text => traceResults.push(text); } @@ -1147,7 +1174,7 @@ namespace Harness { // then they will be added twice thus triggering 'total errors' assertion with condition // 'totalErrorsReportedInNonLibraryFiles + numLibraryDiagnostics + numTest262HarnessDiagnostics, diagnostics.length - if (!error.file || !isLibraryFile(error.file.fileName)) { + if (!error.file || !isDefaultLibraryFile(error.file.fileName)) { totalErrorsReportedInNonLibraryFiles++; } } @@ -1226,7 +1253,7 @@ namespace Harness { }); const numLibraryDiagnostics = ts.countWhere(diagnostics, diagnostic => { - return diagnostic.file && (isLibraryFile(diagnostic.file.fileName) || isBuiltFile(diagnostic.file.fileName)); + return diagnostic.file && (isDefaultLibraryFile(diagnostic.file.fileName) || isBuiltFile(diagnostic.file.fileName)); }); const numTest262HarnessDiagnostics = ts.countWhere(diagnostics, diagnostic => { @@ -1470,6 +1497,7 @@ namespace Harness { baseDir = ts.getNormalizedAbsolutePath(baseDir, rootDir); } tsConfig = ts.parseJsonConfigFileContent(configJson.config, parseConfigHost, baseDir); + tsConfig.options.configFilePath = data.name; // delete entry from the list testUnitData.splice(i, 1); @@ -1613,8 +1641,10 @@ namespace Harness { } } - export function isLibraryFile(filePath: string): boolean { - return (Path.getFileName(filePath) === "lib.d.ts") || (Path.getFileName(filePath) === "lib.core.d.ts"); + export function isDefaultLibraryFile(filePath: string): boolean { + // We need to make sure that the filePath is prefixed with "lib." not just containing "lib." and end with ".d.ts" + const fileName = Path.getFileName(filePath); + return ts.startsWith(fileName, "lib.") && ts.endsWith(fileName, ".d.ts"); } export function isBuiltFile(filePath: string): boolean { @@ -1622,7 +1652,7 @@ namespace Harness { } export function getDefaultLibraryFile(io: Harness.IO): Harness.Compiler.TestFile { - const libFile = Harness.userSpecifiedRoot + Harness.libFolder + "lib.d.ts"; + const libFile = Harness.userSpecifiedRoot + Harness.libFolder + Harness.Compiler.defaultLibFileName; return { unitName: libFile, content: io.readFile(libFile) }; } diff --git a/src/harness/harnessLanguageService.ts b/src/harness/harnessLanguageService.ts index 12bb6a470e4..b27d746390b 100644 --- a/src/harness/harnessLanguageService.ts +++ b/src/harness/harnessLanguageService.ts @@ -9,7 +9,7 @@ namespace Harness.LanguageService { public editRanges: { length: number; textChangeRange: ts.TextChangeRange; }[] = []; private lineMap: number[] = undefined; - constructor(public fileName: string, public content: string) { + constructor(public fileName: string, public content: string, public isRootFile: boolean) { this.setContent(content); } @@ -135,7 +135,13 @@ namespace Harness.LanguageService { public getFilenames(): string[] { const fileNames: string[] = []; - ts.forEachKey(this.fileNameToScript, (fileName) => { fileNames.push(fileName); }); + ts.forEachValue(this.fileNameToScript, (scriptInfo) => { + if (scriptInfo.isRootFile) { + // only include root files here + // usually it means that we won't include lib.d.ts in the list of root files so it won't mess the computation of compilation root dir. + fileNames.push(scriptInfo.fileName); + } + }); return fileNames; } @@ -143,8 +149,8 @@ namespace Harness.LanguageService { return ts.lookUp(this.fileNameToScript, fileName); } - public addScript(fileName: string, content: string): void { - this.fileNameToScript[fileName] = new ScriptInfo(fileName, content); + public addScript(fileName: string, content: string, isRootFile: boolean): void { + this.fileNameToScript[fileName] = new ScriptInfo(fileName, content, isRootFile); } public editScript(fileName: string, start: number, end: number, newText: string) { @@ -177,7 +183,7 @@ namespace Harness.LanguageService { getCompilationSettings() { return this.settings; } getCancellationToken() { return this.cancellationToken; } getCurrentDirectory(): string { return ""; } - getDefaultLibFileName(): string { return ""; } + getDefaultLibFileName(): string { return Harness.Compiler.defaultLibFileName; } getScriptFileNames(): string[] { return this.getFilenames(); } getScriptSnapshot(fileName: string): ts.IScriptSnapshot { const script = this.getScriptInfo(fileName); @@ -210,6 +216,7 @@ namespace Harness.LanguageService { private nativeHost: NativeLanguageServiceHost; public getModuleResolutionsForFile: (fileName: string) => string; + public getTypeReferenceDirectiveResolutionsForFile: (fileName: string) => string; constructor(preprocessToResolve: boolean, cancellationToken?: ts.HostCancellationToken, options?: ts.CompilerOptions) { super(cancellationToken, options); @@ -236,12 +243,25 @@ namespace Harness.LanguageService { } return JSON.stringify(imports); }; + this.getTypeReferenceDirectiveResolutionsForFile = (fileName) => { + const scriptInfo = this.getScriptInfo(fileName); + const preprocessInfo = ts.preProcessFile(scriptInfo.content, /*readImportFiles*/ false); + const resolutions: ts.Map = {}; + const settings = this.nativeHost.getCompilationSettings(); + for (const typeReferenceDirective of preprocessInfo.typeReferenceDirectives) { + const resolutionInfo = ts.resolveTypeReferenceDirective(typeReferenceDirective.fileName, fileName, settings, moduleResolutionHost); + if (resolutionInfo.resolvedTypeReferenceDirective.resolvedFileName) { + resolutions[typeReferenceDirective.fileName] = resolutionInfo.resolvedTypeReferenceDirective; + } + } + return JSON.stringify(resolutions); + }; } } getFilenames(): string[] { return this.nativeHost.getFilenames(); } getScriptInfo(fileName: string): ScriptInfo { return this.nativeHost.getScriptInfo(fileName); } - addScript(fileName: string, content: string): void { this.nativeHost.addScript(fileName, content); } + addScript(fileName: string, content: string, isRootFile: boolean): void { this.nativeHost.addScript(fileName, content, isRootFile); } editScript(fileName: string, start: number, end: number, newText: string): void { this.nativeHost.editScript(fileName, start, end, newText); } positionToLineAndCharacter(fileName: string, position: number): ts.LineAndCharacter { return this.nativeHost.positionToLineAndCharacter(fileName, position); } @@ -442,6 +462,7 @@ namespace Harness.LanguageService { getPreProcessedFileInfo(fileName: string, fileContents: string): ts.PreProcessedFileInfo { let shimResult: { referencedFiles: ts.IFileReference[]; + typeReferenceDirectives: ts.IFileReference[]; importedFiles: ts.IFileReference[]; isLibFile: boolean; }; @@ -453,7 +474,8 @@ namespace Harness.LanguageService { referencedFiles: [], importedFiles: [], ambientExternalModules: [], - isLibFile: shimResult.isLibFile + isLibFile: shimResult.isLibFile, + typeReferenceDirectives: [] }; ts.forEach(shimResult.referencedFiles, refFile => { @@ -472,6 +494,13 @@ namespace Harness.LanguageService { }); }); + ts.forEach(shimResult.typeReferenceDirectives, typeRefDirective => { + convertResult.importedFiles.push({ + fileName: typeRefDirective.path, + pos: typeRefDirective.position, + end: typeRefDirective.position + typeRefDirective.length + }); + }); return convertResult; } } diff --git a/src/harness/loggedIO.ts b/src/harness/loggedIO.ts index 2c4d019d45b..0002a6af288 100644 --- a/src/harness/loggedIO.ts +++ b/src/harness/loggedIO.ts @@ -1,7 +1,7 @@ /// /// /// -/* tslint:disable:no-null */ +/* tslint:disable:no-null-keyword */ interface FileInformation { contents: string; @@ -237,8 +237,8 @@ namespace Playback { ), path)); wrapper.writeFile = recordReplay(wrapper.writeFile, underlying)( - (path, contents) => callAndRecord(underlying.writeFile(path, contents), recordLog.filesWritten, { path, contents, bom: false }), - (path, contents) => noOpReplay("writeFile")); + (path: string, contents: string) => callAndRecord(underlying.writeFile(path, contents), recordLog.filesWritten, { path, contents, bom: false }), + (path: string, contents: string) => noOpReplay("writeFile")); wrapper.exit = (exitCode) => { if (recordLog !== undefined) { diff --git a/src/harness/projectsRunner.ts b/src/harness/projectsRunner.ts index f5df92bedbf..9ee4359d8d3 100644 --- a/src/harness/projectsRunner.ts +++ b/src/harness/projectsRunner.ts @@ -1,6 +1,6 @@ /// /// -/* tslint:disable:no-null */ +/* tslint:disable:no-null-keyword */ // Test case is json of below type in tests/cases/project/ interface ProjectRunnerTestCase { @@ -156,7 +156,7 @@ class ProjectRunner extends RunnerBase { function getSourceFile(fileName: string, languageVersion: ts.ScriptTarget): ts.SourceFile { let sourceFile: ts.SourceFile = undefined; if (fileName === Harness.Compiler.defaultLibFileName) { - sourceFile = languageVersion === ts.ScriptTarget.ES6 ? Harness.Compiler.defaultES6LibSourceFile : Harness.Compiler.defaultLibSourceFile; + sourceFile = Harness.Compiler.getDefaultLibrarySourceFile(Harness.Compiler.getDefaultLibFileName(compilerOptions)); } else { const text = getSourceFileText(fileName); @@ -412,7 +412,7 @@ class ProjectRunner extends RunnerBase { function getErrorsBaseline(compilerResult: CompileProjectFilesResult) { const inputFiles = compilerResult.program ? ts.map(ts.filter(compilerResult.program.getSourceFiles(), - sourceFile => sourceFile.fileName !== "lib.d.ts"), + sourceFile => !Harness.isDefaultLibraryFile(sourceFile.fileName)), sourceFile => { return { unitName: ts.isRootedDiskPath(sourceFile.fileName) ? diff --git a/src/harness/runner.ts b/src/harness/runner.ts index ec8e1105c2f..bb3cafea0a8 100644 --- a/src/harness/runner.ts +++ b/src/harness/runner.ts @@ -20,7 +20,7 @@ /// /// -/* tslint:disable:no-null */ +/* tslint:disable:no-null-keyword */ let runners: RunnerBase[] = []; let iterations = 1; diff --git a/src/harness/rwcRunner.ts b/src/harness/rwcRunner.ts index 11ed5e7a680..8c3b3c70a1f 100644 --- a/src/harness/rwcRunner.ts +++ b/src/harness/rwcRunner.ts @@ -2,7 +2,7 @@ /// /// /// -/* tslint:disable:no-null */ +/* tslint:disable:no-null-keyword */ namespace RWC { function runWithIOLog(ioLog: IOLog, fn: (oldIO: Harness.IO) => void) { @@ -95,13 +95,13 @@ namespace RWC { continue; } - if (!Harness.isLibraryFile(fileRead.path)) { + if (!Harness.isDefaultLibraryFile(fileRead.path)) { if (inInputList) { continue; } otherFiles.push(getHarnessCompilerInputUnit(fileRead.path)); } - else if (!opts.options.noLib && Harness.isLibraryFile(fileRead.path)) { + else if (!opts.options.noLib && Harness.isDefaultLibraryFile(fileRead.path)) { if (!inInputList) { // If useCustomLibraryFile is true, we will use lib.d.ts from json object // otherwise use the lib.d.ts from built/local diff --git a/src/harness/test262Runner.ts b/src/harness/test262Runner.ts index 262145b4764..cc9957c1fac 100644 --- a/src/harness/test262Runner.ts +++ b/src/harness/test262Runner.ts @@ -1,6 +1,6 @@ /// /// -/* tslint:disable:no-null */ +/* tslint:disable:no-null-keyword */ class Test262BaselineRunner extends RunnerBase { private static basePath = "internal/cases/test262"; diff --git a/src/lib/dom.generated.d.ts b/src/lib/dom.generated.d.ts index ec71fa78e8d..f3ced0f6011 100644 --- a/src/lib/dom.generated.d.ts +++ b/src/lib/dom.generated.d.ts @@ -1,4 +1,3 @@ - ///////////////////////////// /// IE DOM APIs ///////////////////////////// @@ -12,11 +11,6 @@ interface AriaRequestEventInit extends EventInit { attributeValue?: string; } -interface ClipboardEventInit extends EventInit { - data?: string; - dataType?: string; -} - interface CommandEventInit extends EventInit { commandName?: string; detail?: string; @@ -30,6 +24,31 @@ interface ConfirmSiteSpecificExceptionsInformation extends ExceptionInformation arrayOfDomainStrings?: string[]; } +interface ConstrainBooleanParameters { + exact?: boolean; + ideal?: boolean; +} + +interface ConstrainDOMStringParameters { + exact?: string | string[]; + ideal?: string | string[]; +} + +interface ConstrainDoubleRange extends DoubleRange { + exact?: number; + ideal?: number; +} + +interface ConstrainLongRange extends LongRange { + exact?: number; + ideal?: number; +} + +interface ConstrainVideoFacingModeParameters { + exact?: string | string[]; + ideal?: string | string[]; +} + interface CustomEventInit extends EventInit { detail?: any; } @@ -40,17 +59,44 @@ interface DeviceAccelerationDict { z?: number; } +interface DeviceLightEventInit extends EventInit { + value?: number; +} + interface DeviceRotationRateDict { alpha?: number; beta?: number; gamma?: number; } +interface DoubleRange { + max?: number; + min?: number; +} + interface EventInit { bubbles?: boolean; cancelable?: boolean; } +interface EventModifierInit extends UIEventInit { + ctrlKey?: boolean; + shiftKey?: boolean; + altKey?: boolean; + metaKey?: boolean; + modifierAltGraph?: boolean; + modifierCapsLock?: boolean; + modifierFn?: boolean; + modifierFnLock?: boolean; + modifierHyper?: boolean; + modifierNumLock?: boolean; + modifierOS?: boolean; + modifierScrollLock?: boolean; + modifierSuper?: boolean; + modifierSymbol?: boolean; + modifierSymbolLock?: boolean; +} + interface ExceptionInformation { domain?: string; } @@ -64,17 +110,415 @@ interface HashChangeEventInit extends EventInit { oldURL?: string; } +interface IDBIndexParameters { + multiEntry?: boolean; + unique?: boolean; +} + +interface IDBObjectStoreParameters { + autoIncrement?: boolean; + keyPath?: IDBKeyPath; +} + interface KeyAlgorithm { name?: string; } -interface KeyboardEventInit extends SharedKeyboardAndMouseEventInit { +interface KeyboardEventInit extends EventModifierInit { key?: string; location?: number; repeat?: boolean; } -interface MouseEventInit extends SharedKeyboardAndMouseEventInit { +interface LongRange { + max?: number; + min?: number; +} + +interface MSAccountInfo { + rpDisplayName?: string; + userDisplayName?: string; + accountName?: string; + userId?: string; + accountImageUri?: string; +} + +interface MSAudioLocalClientEvent extends MSLocalClientEventBase { + networkSendQualityEventRatio?: number; + networkDelayEventRatio?: number; + cpuInsufficientEventRatio?: number; + deviceHalfDuplexAECEventRatio?: number; + deviceRenderNotFunctioningEventRatio?: number; + deviceCaptureNotFunctioningEventRatio?: number; + deviceGlitchesEventRatio?: number; + deviceLowSNREventRatio?: number; + deviceLowSpeechLevelEventRatio?: number; + deviceClippingEventRatio?: number; + deviceEchoEventRatio?: number; + deviceNearEndToEchoRatioEventRatio?: number; + deviceRenderZeroVolumeEventRatio?: number; + deviceRenderMuteEventRatio?: number; + deviceMultipleEndpointsEventCount?: number; + deviceHowlingEventCount?: number; +} + +interface MSAudioRecvPayload extends MSPayloadBase { + samplingRate?: number; + signal?: MSAudioRecvSignal; + packetReorderRatio?: number; + packetReorderDepthAvg?: number; + packetReorderDepthMax?: number; + burstLossLength1?: number; + burstLossLength2?: number; + burstLossLength3?: number; + burstLossLength4?: number; + burstLossLength5?: number; + burstLossLength6?: number; + burstLossLength7?: number; + burstLossLength8OrHigher?: number; + fecRecvDistance1?: number; + fecRecvDistance2?: number; + fecRecvDistance3?: number; + ratioConcealedSamplesAvg?: number; + ratioStretchedSamplesAvg?: number; + ratioCompressedSamplesAvg?: number; +} + +interface MSAudioRecvSignal { + initialSignalLevelRMS?: number; + recvSignalLevelCh1?: number; + recvNoiseLevelCh1?: number; + renderSignalLevel?: number; + renderNoiseLevel?: number; + renderLoopbackSignalLevel?: number; +} + +interface MSAudioSendPayload extends MSPayloadBase { + samplingRate?: number; + signal?: MSAudioSendSignal; + audioFECUsed?: boolean; + sendMutePercent?: number; +} + +interface MSAudioSendSignal { + noiseLevel?: number; + sendSignalLevelCh1?: number; + sendNoiseLevelCh1?: number; +} + +interface MSConnectivity { + iceType?: string; + iceWarningFlags?: MSIceWarningFlags; + relayAddress?: MSRelayAddress; +} + +interface MSCredentialFilter { + accept?: MSCredentialSpec[]; +} + +interface MSCredentialParameters { + type?: string; +} + +interface MSCredentialSpec { + type?: string; + id?: string; +} + +interface MSDelay { + roundTrip?: number; + roundTripMax?: number; +} + +interface MSDescription extends RTCStats { + connectivity?: MSConnectivity; + transport?: string; + networkconnectivity?: MSNetworkConnectivityInfo; + localAddr?: MSIPAddressInfo; + remoteAddr?: MSIPAddressInfo; + deviceDevName?: string; + reflexiveLocalIPAddr?: MSIPAddressInfo; +} + +interface MSFIDOCredentialParameters extends MSCredentialParameters { + algorithm?: string | Algorithm; + authenticators?: AAGUID[]; +} + +interface MSIPAddressInfo { + ipAddr?: string; + port?: number; + manufacturerMacAddrMask?: string; +} + +interface MSIceWarningFlags { + turnTcpTimedOut?: boolean; + turnUdpAllocateFailed?: boolean; + turnUdpSendFailed?: boolean; + turnTcpAllocateFailed?: boolean; + turnTcpSendFailed?: boolean; + udpLocalConnectivityFailed?: boolean; + udpNatConnectivityFailed?: boolean; + udpRelayConnectivityFailed?: boolean; + tcpNatConnectivityFailed?: boolean; + tcpRelayConnectivityFailed?: boolean; + connCheckMessageIntegrityFailed?: boolean; + allocationMessageIntegrityFailed?: boolean; + connCheckOtherError?: boolean; + turnAuthUnknownUsernameError?: boolean; + noRelayServersConfigured?: boolean; + multipleRelayServersAttempted?: boolean; + portRangeExhausted?: boolean; + alternateServerReceived?: boolean; + pseudoTLSFailure?: boolean; + turnTurnTcpConnectivityFailed?: boolean; + useCandidateChecksFailed?: boolean; + fipsAllocationFailure?: boolean; +} + +interface MSJitter { + interArrival?: number; + interArrivalMax?: number; + interArrivalSD?: number; +} + +interface MSLocalClientEventBase extends RTCStats { + networkReceiveQualityEventRatio?: number; + networkBandwidthLowEventRatio?: number; +} + +interface MSNetwork extends RTCStats { + jitter?: MSJitter; + delay?: MSDelay; + packetLoss?: MSPacketLoss; + utilization?: MSUtilization; +} + +interface MSNetworkConnectivityInfo { + vpn?: boolean; + linkspeed?: number; + networkConnectionDetails?: string; +} + +interface MSNetworkInterfaceType { + interfaceTypeEthernet?: boolean; + interfaceTypeWireless?: boolean; + interfaceTypePPP?: boolean; + interfaceTypeTunnel?: boolean; + interfaceTypeWWAN?: boolean; +} + +interface MSOutboundNetwork extends MSNetwork { + appliedBandwidthLimit?: number; +} + +interface MSPacketLoss { + lossRate?: number; + lossRateMax?: number; +} + +interface MSPayloadBase extends RTCStats { + payloadDescription?: string; +} + +interface MSRelayAddress { + relayAddress?: string; + port?: number; +} + +interface MSSignatureParameters { + userPrompt?: string; +} + +interface MSTransportDiagnosticsStats extends RTCStats { + baseAddress?: string; + localAddress?: string; + localSite?: string; + networkName?: string; + remoteAddress?: string; + remoteSite?: string; + localMR?: string; + remoteMR?: string; + iceWarningFlags?: MSIceWarningFlags; + portRangeMin?: number; + portRangeMax?: number; + localMRTCPPort?: number; + remoteMRTCPPort?: number; + stunVer?: number; + numConsentReqSent?: number; + numConsentReqReceived?: number; + numConsentRespSent?: number; + numConsentRespReceived?: number; + interfaces?: MSNetworkInterfaceType; + baseInterface?: MSNetworkInterfaceType; + protocol?: string; + localInterface?: MSNetworkInterfaceType; + localAddrType?: string; + remoteAddrType?: string; + iceRole?: string; + rtpRtcpMux?: boolean; + allocationTimeInMs?: number; + msRtcEngineVersion?: string; +} + +interface MSUtilization { + packets?: number; + bandwidthEstimation?: number; + bandwidthEstimationMin?: number; + bandwidthEstimationMax?: number; + bandwidthEstimationStdDev?: number; + bandwidthEstimationAvg?: number; +} + +interface MSVideoPayload extends MSPayloadBase { + resoluton?: string; + videoBitRateAvg?: number; + videoBitRateMax?: number; + videoFrameRateAvg?: number; + videoPacketLossRate?: number; + durationSeconds?: number; +} + +interface MSVideoRecvPayload extends MSVideoPayload { + videoFrameLossRate?: number; + recvCodecType?: string; + recvResolutionWidth?: number; + recvResolutionHeight?: number; + videoResolutions?: MSVideoResolutionDistribution; + recvFrameRateAverage?: number; + recvBitRateMaximum?: number; + recvBitRateAverage?: number; + recvVideoStreamsMax?: number; + recvVideoStreamsMin?: number; + recvVideoStreamsMode?: number; + videoPostFECPLR?: number; + lowBitRateCallPercent?: number; + lowFrameRateCallPercent?: number; + reorderBufferTotalPackets?: number; + recvReorderBufferReorderedPackets?: number; + recvReorderBufferPacketsDroppedDueToBufferExhaustion?: number; + recvReorderBufferMaxSuccessfullyOrderedExtent?: number; + recvReorderBufferMaxSuccessfullyOrderedLateTime?: number; + recvReorderBufferPacketsDroppedDueToTimeout?: number; + recvFpsHarmonicAverage?: number; + recvNumResSwitches?: number; +} + +interface MSVideoResolutionDistribution { + cifQuality?: number; + vgaQuality?: number; + h720Quality?: number; + h1080Quality?: number; + h1440Quality?: number; + h2160Quality?: number; +} + +interface MSVideoSendPayload extends MSVideoPayload { + sendFrameRateAverage?: number; + sendBitRateMaximum?: number; + sendBitRateAverage?: number; + sendVideoStreamsMax?: number; + sendResolutionWidth?: number; + sendResolutionHeight?: number; +} + +interface MediaEncryptedEventInit extends EventInit { + initDataType?: string; + initData?: ArrayBuffer; +} + +interface MediaKeyMessageEventInit extends EventInit { + messageType?: string; + message?: ArrayBuffer; +} + +interface MediaKeySystemConfiguration { + initDataTypes?: string[]; + audioCapabilities?: MediaKeySystemMediaCapability[]; + videoCapabilities?: MediaKeySystemMediaCapability[]; + distinctiveIdentifier?: string; + persistentState?: string; +} + +interface MediaKeySystemMediaCapability { + contentType?: string; + robustness?: string; +} + +interface MediaStreamConstraints { + video?: boolean | MediaTrackConstraints; + audio?: boolean | MediaTrackConstraints; +} + +interface MediaStreamErrorEventInit extends EventInit { + error?: MediaStreamError; +} + +interface MediaStreamTrackEventInit extends EventInit { + track?: MediaStreamTrack; +} + +interface MediaTrackCapabilities { + width?: number | LongRange; + height?: number | LongRange; + aspectRatio?: number | DoubleRange; + frameRate?: number | DoubleRange; + facingMode?: string; + volume?: number | DoubleRange; + sampleRate?: number | LongRange; + sampleSize?: number | LongRange; + echoCancellation?: boolean[]; + deviceId?: string; + groupId?: string; +} + +interface MediaTrackConstraintSet { + width?: number | ConstrainLongRange; + height?: number | ConstrainLongRange; + aspectRatio?: number | ConstrainDoubleRange; + frameRate?: number | ConstrainDoubleRange; + facingMode?: string | string[] | ConstrainDOMStringParameters; + volume?: number | ConstrainDoubleRange; + sampleRate?: number | ConstrainLongRange; + sampleSize?: number | ConstrainLongRange; + echoCancelation?: boolean | ConstrainBooleanParameters; + deviceId?: string | string[] | ConstrainDOMStringParameters; + groupId?: string | string[] | ConstrainDOMStringParameters; +} + +interface MediaTrackConstraints extends MediaTrackConstraintSet { + advanced?: MediaTrackConstraintSet[]; +} + +interface MediaTrackSettings { + width?: number; + height?: number; + aspectRatio?: number; + frameRate?: number; + facingMode?: string; + volume?: number; + sampleRate?: number; + sampleSize?: number; + echoCancellation?: boolean; + deviceId?: string; + groupId?: string; +} + +interface MediaTrackSupportedConstraints { + width?: boolean; + height?: boolean; + aspectRatio?: boolean; + frameRate?: boolean; + facingMode?: boolean; + volume?: boolean; + sampleRate?: boolean; + sampleSize?: boolean; + echoCancellation?: boolean; + deviceId?: boolean; + groupId?: boolean; +} + +interface MouseEventInit extends EventModifierInit { screenX?: number; screenY?: number; clientX?: number; @@ -107,6 +551,10 @@ interface ObjectURLOptions { oneTimeOnly?: boolean; } +interface PeriodicWaveConstraints { + disableNormalization?: boolean; +} + interface PointerEventInit extends MouseEventInit { pointerId?: number; width?: number; @@ -124,22 +572,266 @@ interface PositionOptions { maximumAge?: number; } -interface SharedKeyboardAndMouseEventInit extends UIEventInit { - ctrlKey?: boolean; - shiftKey?: boolean; - altKey?: boolean; - metaKey?: boolean; - keyModifierStateAltGraph?: boolean; - keyModifierStateCapsLock?: boolean; - keyModifierStateFn?: boolean; - keyModifierStateFnLock?: boolean; - keyModifierStateHyper?: boolean; - keyModifierStateNumLock?: boolean; - keyModifierStateOS?: boolean; - keyModifierStateScrollLock?: boolean; - keyModifierStateSuper?: boolean; - keyModifierStateSymbol?: boolean; - keyModifierStateSymbolLock?: boolean; +interface RTCDTMFToneChangeEventInit extends EventInit { + tone?: string; +} + +interface RTCDtlsFingerprint { + algorithm?: string; + value?: string; +} + +interface RTCDtlsParameters { + role?: string; + fingerprints?: RTCDtlsFingerprint[]; +} + +interface RTCIceCandidate { + foundation?: string; + priority?: number; + ip?: string; + protocol?: string; + port?: number; + type?: string; + tcpType?: string; + relatedAddress?: string; + relatedPort?: number; +} + +interface RTCIceCandidateAttributes extends RTCStats { + ipAddress?: string; + portNumber?: number; + transport?: string; + candidateType?: string; + priority?: number; + addressSourceUrl?: string; +} + +interface RTCIceCandidateComplete { +} + +interface RTCIceCandidatePair { + local?: RTCIceCandidate; + remote?: RTCIceCandidate; +} + +interface RTCIceCandidatePairStats extends RTCStats { + transportId?: string; + localCandidateId?: string; + remoteCandidateId?: string; + state?: string; + priority?: number; + nominated?: boolean; + writable?: boolean; + readable?: boolean; + bytesSent?: number; + bytesReceived?: number; + roundTripTime?: number; + availableOutgoingBitrate?: number; + availableIncomingBitrate?: number; +} + +interface RTCIceGatherOptions { + gatherPolicy?: string; + iceservers?: RTCIceServer[]; +} + +interface RTCIceParameters { + usernameFragment?: string; + password?: string; +} + +interface RTCIceServer { + urls?: any; + username?: string; + credential?: string; +} + +interface RTCInboundRTPStreamStats extends RTCRTPStreamStats { + packetsReceived?: number; + bytesReceived?: number; + packetsLost?: number; + jitter?: number; + fractionLost?: number; +} + +interface RTCMediaStreamTrackStats extends RTCStats { + trackIdentifier?: string; + remoteSource?: boolean; + ssrcIds?: string[]; + frameWidth?: number; + frameHeight?: number; + framesPerSecond?: number; + framesSent?: number; + framesReceived?: number; + framesDecoded?: number; + framesDropped?: number; + framesCorrupted?: number; + audioLevel?: number; + echoReturnLoss?: number; + echoReturnLossEnhancement?: number; +} + +interface RTCOutboundRTPStreamStats extends RTCRTPStreamStats { + packetsSent?: number; + bytesSent?: number; + targetBitrate?: number; + roundTripTime?: number; +} + +interface RTCRTPStreamStats extends RTCStats { + ssrc?: string; + associateStatsId?: string; + isRemote?: boolean; + mediaTrackId?: string; + transportId?: string; + codecId?: string; + firCount?: number; + pliCount?: number; + nackCount?: number; + sliCount?: number; +} + +interface RTCRtcpFeedback { + type?: string; + parameter?: string; +} + +interface RTCRtcpParameters { + ssrc?: number; + cname?: string; + reducedSize?: boolean; + mux?: boolean; +} + +interface RTCRtpCapabilities { + codecs?: RTCRtpCodecCapability[]; + headerExtensions?: RTCRtpHeaderExtension[]; + fecMechanisms?: string[]; +} + +interface RTCRtpCodecCapability { + name?: string; + kind?: string; + clockRate?: number; + preferredPayloadType?: number; + maxptime?: number; + numChannels?: number; + rtcpFeedback?: RTCRtcpFeedback[]; + parameters?: any; + options?: any; + maxTemporalLayers?: number; + maxSpatialLayers?: number; + svcMultiStreamSupport?: boolean; +} + +interface RTCRtpCodecParameters { + name?: string; + payloadType?: any; + clockRate?: number; + maxptime?: number; + numChannels?: number; + rtcpFeedback?: RTCRtcpFeedback[]; + parameters?: any; +} + +interface RTCRtpContributingSource { + timestamp?: number; + csrc?: number; + audioLevel?: number; +} + +interface RTCRtpEncodingParameters { + ssrc?: number; + codecPayloadType?: number; + fec?: RTCRtpFecParameters; + rtx?: RTCRtpRtxParameters; + priority?: number; + maxBitrate?: number; + minQuality?: number; + framerateBias?: number; + resolutionScale?: number; + framerateScale?: number; + active?: boolean; + encodingId?: string; + dependencyEncodingIds?: string[]; + ssrcRange?: RTCSsrcRange; +} + +interface RTCRtpFecParameters { + ssrc?: number; + mechanism?: string; +} + +interface RTCRtpHeaderExtension { + kind?: string; + uri?: string; + preferredId?: number; + preferredEncrypt?: boolean; +} + +interface RTCRtpHeaderExtensionParameters { + uri?: string; + id?: number; + encrypt?: boolean; +} + +interface RTCRtpParameters { + muxId?: string; + codecs?: RTCRtpCodecParameters[]; + headerExtensions?: RTCRtpHeaderExtensionParameters[]; + encodings?: RTCRtpEncodingParameters[]; + rtcp?: RTCRtcpParameters; +} + +interface RTCRtpRtxParameters { + ssrc?: number; +} + +interface RTCRtpUnhandled { + ssrc?: number; + payloadType?: number; + muxId?: string; +} + +interface RTCSrtpKeyParam { + keyMethod?: string; + keySalt?: string; + lifetime?: string; + mkiValue?: number; + mkiLength?: number; +} + +interface RTCSrtpSdesParameters { + tag?: number; + cryptoSuite?: string; + keyParams?: RTCSrtpKeyParam[]; + sessionParams?: string[]; +} + +interface RTCSsrcRange { + min?: number; + max?: number; +} + +interface RTCStats { + timestamp?: number; + type?: string; + id?: string; + msType?: string; +} + +interface RTCStatsReport { +} + +interface RTCTransportStats extends RTCStats { + bytesSent?: number; + bytesReceived?: number; + rtcpTransportStatsId?: string; + activeConnection?: boolean; + selectedCandidatePairId?: string; + localCertificateId?: string; + remoteCertificateId?: string; } interface StoreExceptionsInformation extends ExceptionInformation { @@ -185,18 +877,18 @@ interface ANGLE_instanced_arrays { drawArraysInstancedANGLE(mode: number, first: number, count: number, primcount: number): void; drawElementsInstancedANGLE(mode: number, count: number, type: number, offset: number, primcount: number): void; vertexAttribDivisorANGLE(index: number, divisor: number): void; - VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE: number; + readonly VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE: number; } declare var ANGLE_instanced_arrays: { prototype: ANGLE_instanced_arrays; new(): ANGLE_instanced_arrays; - VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE: number; + readonly VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE: number; } interface AnalyserNode extends AudioNode { fftSize: number; - frequencyBinCount: number; + readonly frequencyBinCount: number; maxDecibels: number; minDecibels: number; smoothingTimeConstant: number; @@ -212,8 +904,8 @@ declare var AnalyserNode: { } interface AnimationEvent extends Event { - animationName: string; - elapsedTime: number; + readonly animationName: string; + readonly elapsedTime: number; initAnimationEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, animationNameArg: string, elapsedTimeArg: number): void; } @@ -231,16 +923,16 @@ interface ApplicationCache extends EventTarget { onobsolete: (ev: Event) => any; onprogress: (ev: ProgressEvent) => any; onupdateready: (ev: Event) => any; - status: number; + readonly status: number; abort(): void; swapCache(): void; update(): void; - CHECKING: number; - DOWNLOADING: number; - IDLE: number; - OBSOLETE: number; - UNCACHED: number; - UPDATEREADY: number; + readonly CHECKING: number; + readonly DOWNLOADING: number; + readonly IDLE: number; + readonly OBSOLETE: number; + readonly UNCACHED: number; + readonly UPDATEREADY: number; addEventListener(type: "cached", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "checking", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "downloading", listener: (ev: Event) => any, useCapture?: boolean): void; @@ -255,16 +947,16 @@ interface ApplicationCache extends EventTarget { declare var ApplicationCache: { prototype: ApplicationCache; new(): ApplicationCache; - CHECKING: number; - DOWNLOADING: number; - IDLE: number; - OBSOLETE: number; - UNCACHED: number; - UPDATEREADY: number; + readonly CHECKING: number; + readonly DOWNLOADING: number; + readonly IDLE: number; + readonly OBSOLETE: number; + readonly UNCACHED: number; + readonly UPDATEREADY: number; } interface AriaRequestEvent extends Event { - attributeName: string; + readonly attributeName: string; attributeValue: string; } @@ -274,9 +966,10 @@ declare var AriaRequestEvent: { } interface Attr extends Node { - name: string; - ownerElement: Element; - specified: boolean; + readonly name: string; + readonly ownerElement: Element; + readonly prefix: string; + readonly specified: boolean; value: string; } @@ -286,10 +979,12 @@ declare var Attr: { } interface AudioBuffer { - duration: number; - length: number; - numberOfChannels: number; - sampleRate: number; + readonly duration: number; + readonly length: number; + readonly numberOfChannels: number; + readonly sampleRate: number; + copyFromChannel(destination: Float32Array, channelNumber: number, startInChannel?: number): void; + copyToChannel(source: Float32Array, channelNumber: number, startInChannel?: number): void; getChannelData(channel: number): Float32Array; } @@ -300,14 +995,15 @@ declare var AudioBuffer: { interface AudioBufferSourceNode extends AudioNode { buffer: AudioBuffer; + readonly detune: AudioParam; loop: boolean; loopEnd: number; loopStart: number; - onended: (ev: Event) => any; - playbackRate: AudioParam; + onended: (ev: MediaStreamErrorEvent) => any; + readonly playbackRate: AudioParam; start(when?: number, offset?: number, duration?: number): void; stop(when?: number): void; - addEventListener(type: "ended", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "ended", listener: (ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -317,10 +1013,10 @@ declare var AudioBufferSourceNode: { } interface AudioContext extends EventTarget { - currentTime: number; - destination: AudioDestinationNode; - listener: AudioListener; - sampleRate: number; + readonly currentTime: number; + readonly destination: AudioDestinationNode; + readonly listener: AudioListener; + readonly sampleRate: number; state: string; createAnalyser(): AnalyserNode; createBiquadFilter(): BiquadFilterNode; @@ -333,13 +1029,14 @@ interface AudioContext extends EventTarget { createDynamicsCompressor(): DynamicsCompressorNode; createGain(): GainNode; createMediaElementSource(mediaElement: HTMLMediaElement): MediaElementAudioSourceNode; + createMediaStreamSource(mediaStream: MediaStream): MediaStreamAudioSourceNode; createOscillator(): OscillatorNode; createPanner(): PannerNode; - createPeriodicWave(real: Float32Array, imag: Float32Array): PeriodicWave; + createPeriodicWave(real: Float32Array, imag: Float32Array, constraints?: PeriodicWaveConstraints): PeriodicWave; createScriptProcessor(bufferSize?: number, numberOfInputChannels?: number, numberOfOutputChannels?: number): ScriptProcessorNode; createStereoPanner(): StereoPannerNode; createWaveShaper(): WaveShaperNode; - decodeAudioData(audioData: ArrayBuffer, successCallback: DecodeSuccessCallback, errorCallback?: DecodeErrorCallback): void; + decodeAudioData(audioData: ArrayBuffer, successCallback?: DecodeSuccessCallback, errorCallback?: DecodeErrorCallback): PromiseLike; } declare var AudioContext: { @@ -348,7 +1045,7 @@ declare var AudioContext: { } interface AudioDestinationNode extends AudioNode { - maxChannelCount: number; + readonly maxChannelCount: number; } declare var AudioDestinationNode: { @@ -373,9 +1070,9 @@ interface AudioNode extends EventTarget { channelCount: number; channelCountMode: string; channelInterpretation: string; - context: AudioContext; - numberOfInputs: number; - numberOfOutputs: number; + readonly context: AudioContext; + readonly numberOfInputs: number; + readonly numberOfOutputs: number; connect(destination: AudioNode, output?: number, input?: number): void; disconnect(output?: number): void; disconnect(destination: AudioNode, output?: number, input?: number): void; @@ -388,7 +1085,7 @@ declare var AudioNode: { } interface AudioParam { - defaultValue: number; + readonly defaultValue: number; value: number; cancelScheduledValues(startTime: number): void; exponentialRampToValueAtTime(value: number, endTime: number): void; @@ -404,9 +1101,9 @@ declare var AudioParam: { } interface AudioProcessingEvent extends Event { - inputBuffer: AudioBuffer; - outputBuffer: AudioBuffer; - playbackTime: number; + readonly inputBuffer: AudioBuffer; + readonly outputBuffer: AudioBuffer; + readonly playbackTime: number; } declare var AudioProcessingEvent: { @@ -416,11 +1113,11 @@ declare var AudioProcessingEvent: { interface AudioTrack { enabled: boolean; - id: string; + readonly id: string; kind: string; - label: string; + readonly label: string; language: string; - sourceBuffer: SourceBuffer; + readonly sourceBuffer: SourceBuffer; } declare var AudioTrack: { @@ -429,7 +1126,7 @@ declare var AudioTrack: { } interface AudioTrackList extends EventTarget { - length: number; + readonly length: number; onaddtrack: (ev: TrackEvent) => any; onchange: (ev: Event) => any; onremovetrack: (ev: TrackEvent) => any; @@ -448,7 +1145,7 @@ declare var AudioTrackList: { } interface BarProp { - visible: boolean; + readonly visible: boolean; } declare var BarProp: { @@ -466,10 +1163,10 @@ declare var BeforeUnloadEvent: { } interface BiquadFilterNode extends AudioNode { - Q: AudioParam; - detune: AudioParam; - frequency: AudioParam; - gain: AudioParam; + readonly Q: AudioParam; + readonly detune: AudioParam; + readonly frequency: AudioParam; + readonly gain: AudioParam; type: string; getFrequencyResponse(frequencyHz: Float32Array, magResponse: Float32Array, phaseResponse: Float32Array): void; } @@ -480,8 +1177,8 @@ declare var BiquadFilterNode: { } interface Blob { - size: number; - type: string; + readonly size: number; + readonly type: string; msClose(): void; msDetachStream(): any; slice(start?: number, end?: number, contentType?: string): Blob; @@ -515,7 +1212,7 @@ declare var CSSConditionRule: { } interface CSSFontFaceRule extends CSSRule { - style: CSSStyleDeclaration; + readonly style: CSSStyleDeclaration; } declare var CSSFontFaceRule: { @@ -524,9 +1221,9 @@ declare var CSSFontFaceRule: { } interface CSSGroupingRule extends CSSRule { - cssRules: CSSRuleList; - deleteRule(index?: number): void; - insertRule(rule: string, index?: number): number; + readonly cssRules: CSSRuleList; + deleteRule(index: number): void; + insertRule(rule: string, index: number): number; } declare var CSSGroupingRule: { @@ -535,9 +1232,9 @@ declare var CSSGroupingRule: { } interface CSSImportRule extends CSSRule { - href: string; - media: MediaList; - styleSheet: CSSStyleSheet; + readonly href: string; + readonly media: MediaList; + readonly styleSheet: CSSStyleSheet; } declare var CSSImportRule: { @@ -547,7 +1244,7 @@ declare var CSSImportRule: { interface CSSKeyframeRule extends CSSRule { keyText: string; - style: CSSStyleDeclaration; + readonly style: CSSStyleDeclaration; } declare var CSSKeyframeRule: { @@ -556,7 +1253,7 @@ declare var CSSKeyframeRule: { } interface CSSKeyframesRule extends CSSRule { - cssRules: CSSRuleList; + readonly cssRules: CSSRuleList; name: string; appendRule(rule: string): void; deleteRule(rule: string): void; @@ -569,7 +1266,7 @@ declare var CSSKeyframesRule: { } interface CSSMediaRule extends CSSConditionRule { - media: MediaList; + readonly media: MediaList; } declare var CSSMediaRule: { @@ -578,8 +1275,8 @@ declare var CSSMediaRule: { } interface CSSNamespaceRule extends CSSRule { - namespaceURI: string; - prefix: string; + readonly namespaceURI: string; + readonly prefix: string; } declare var CSSNamespaceRule: { @@ -588,10 +1285,10 @@ declare var CSSNamespaceRule: { } interface CSSPageRule extends CSSRule { - pseudoClass: string; - selector: string; + readonly pseudoClass: string; + readonly selector: string; selectorText: string; - style: CSSStyleDeclaration; + readonly style: CSSStyleDeclaration; } declare var CSSPageRule: { @@ -601,42 +1298,42 @@ declare var CSSPageRule: { interface CSSRule { cssText: string; - parentRule: CSSRule; - parentStyleSheet: CSSStyleSheet; - type: number; - CHARSET_RULE: number; - FONT_FACE_RULE: number; - IMPORT_RULE: number; - KEYFRAMES_RULE: number; - KEYFRAME_RULE: number; - MEDIA_RULE: number; - NAMESPACE_RULE: number; - PAGE_RULE: number; - STYLE_RULE: number; - SUPPORTS_RULE: number; - UNKNOWN_RULE: number; - VIEWPORT_RULE: number; + readonly parentRule: CSSRule; + readonly parentStyleSheet: CSSStyleSheet; + readonly type: number; + readonly CHARSET_RULE: number; + readonly FONT_FACE_RULE: number; + readonly IMPORT_RULE: number; + readonly KEYFRAMES_RULE: number; + readonly KEYFRAME_RULE: number; + readonly MEDIA_RULE: number; + readonly NAMESPACE_RULE: number; + readonly PAGE_RULE: number; + readonly STYLE_RULE: number; + readonly SUPPORTS_RULE: number; + readonly UNKNOWN_RULE: number; + readonly VIEWPORT_RULE: number; } declare var CSSRule: { prototype: CSSRule; new(): CSSRule; - CHARSET_RULE: number; - FONT_FACE_RULE: number; - IMPORT_RULE: number; - KEYFRAMES_RULE: number; - KEYFRAME_RULE: number; - MEDIA_RULE: number; - NAMESPACE_RULE: number; - PAGE_RULE: number; - STYLE_RULE: number; - SUPPORTS_RULE: number; - UNKNOWN_RULE: number; - VIEWPORT_RULE: number; + readonly CHARSET_RULE: number; + readonly FONT_FACE_RULE: number; + readonly IMPORT_RULE: number; + readonly KEYFRAMES_RULE: number; + readonly KEYFRAME_RULE: number; + readonly MEDIA_RULE: number; + readonly NAMESPACE_RULE: number; + readonly PAGE_RULE: number; + readonly STYLE_RULE: number; + readonly SUPPORTS_RULE: number; + readonly UNKNOWN_RULE: number; + readonly VIEWPORT_RULE: number; } interface CSSRuleList { - length: number; + readonly length: number; item(index: number): CSSRule; [index: number]: CSSRule; } @@ -769,7 +1466,7 @@ interface CSSStyleDeclaration { justifyContent: string; kerning: string; left: string; - length: number; + readonly length: number; letterSpacing: string; lightingColor: string; lineHeight: string; @@ -856,7 +1553,7 @@ interface CSSStyleDeclaration { pageBreakAfter: string; pageBreakBefore: string; pageBreakInside: string; - parentRule: CSSRule; + readonly parentRule: CSSRule; perspective: string; perspectiveOrigin: string; pointerEvents: string; @@ -881,7 +1578,6 @@ interface CSSStyleDeclaration { textAlignLast: string; textAnchor: string; textDecoration: string; - textFillColor: string; textIndent: string; textJustify: string; textKashida: string; @@ -917,25 +1613,12 @@ interface CSSStyleDeclaration { webkitAnimationTimingFunction: string; webkitAppearance: string; webkitBackfaceVisibility: string; - webkitBackground: string; - webkitBackgroundAttachment: string; webkitBackgroundClip: string; - webkitBackgroundColor: string; - webkitBackgroundImage: string; webkitBackgroundOrigin: string; - webkitBackgroundPosition: string; - webkitBackgroundPositionX: string; - webkitBackgroundPositionY: string; - webkitBackgroundRepeat: string; webkitBackgroundSize: string; webkitBorderBottomLeftRadius: string; webkitBorderBottomRightRadius: string; webkitBorderImage: string; - webkitBorderImageOutset: string; - webkitBorderImageRepeat: string; - webkitBorderImageSlice: string; - webkitBorderImageSource: string; - webkitBorderImageWidth: string; webkitBorderRadius: string; webkitBorderTopLeftRadius: string; webkitBorderTopRightRadius: string; @@ -981,6 +1664,7 @@ interface CSSStyleDeclaration { webkitTransitionDuration: string; webkitTransitionProperty: string; webkitTransitionTimingFunction: string; + webkitUserModify: string; webkitUserSelect: string; webkitWritingMode: string; whiteSpace: string; @@ -1006,9 +1690,9 @@ declare var CSSStyleDeclaration: { } interface CSSStyleRule extends CSSRule { - readOnly: boolean; + readonly readOnly: boolean; selectorText: string; - style: CSSStyleDeclaration; + readonly style: CSSStyleDeclaration; } declare var CSSStyleRule: { @@ -1017,18 +1701,18 @@ declare var CSSStyleRule: { } interface CSSStyleSheet extends StyleSheet { - cssRules: CSSRuleList; + readonly cssRules: CSSRuleList; cssText: string; - href: string; - id: string; - imports: StyleSheetList; - isAlternate: boolean; - isPrefAlternate: boolean; - ownerRule: CSSRule; - owningElement: Element; - pages: StyleSheetPageList; - readOnly: boolean; - rules: CSSRuleList; + readonly href: string; + readonly id: string; + readonly imports: StyleSheetList; + readonly isAlternate: boolean; + readonly isPrefAlternate: boolean; + readonly ownerRule: CSSRule; + readonly owningElement: Element; + readonly pages: StyleSheetPageList; + readonly readOnly: boolean; + readonly rules: CSSRuleList; addImport(bstrURL: string, lIndex?: number): number; addPageRule(bstrSelector: string, bstrStyle: string, lIndex?: number): number; addRule(bstrSelector: string, bstrStyle?: string, lIndex?: number): number; @@ -1068,8 +1752,8 @@ declare var CanvasPattern: { new(): CanvasPattern; } -interface CanvasRenderingContext2D { - canvas: HTMLCanvasElement; +interface CanvasRenderingContext2D extends Object, CanvasPathMethods { + readonly canvas: HTMLCanvasElement; fillStyle: string | CanvasGradient | CanvasPattern; font: string; globalAlpha: number; @@ -1088,13 +1772,9 @@ interface CanvasRenderingContext2D { strokeStyle: string | CanvasGradient | CanvasPattern; textAlign: string; textBaseline: string; - arc(x: number, y: number, radius: number, startAngle: number, endAngle: number, anticlockwise?: boolean): void; - arcTo(x1: number, y1: number, x2: number, y2: number, radius: number): void; beginPath(): void; - bezierCurveTo(cp1x: number, cp1y: number, cp2x: number, cp2y: number, x: number, y: number): void; clearRect(x: number, y: number, w: number, h: number): void; clip(fillRule?: string): void; - closePath(): void; createImageData(imageDataOrSw: number | ImageData, sh?: number): ImageData; createLinearGradient(x0: number, y0: number, x1: number, y1: number): CanvasGradient; createPattern(image: HTMLImageElement | HTMLCanvasElement | HTMLVideoElement, repetition: string): CanvasPattern; @@ -1106,12 +1786,8 @@ interface CanvasRenderingContext2D { getImageData(sx: number, sy: number, sw: number, sh: number): ImageData; getLineDash(): number[]; isPointInPath(x: number, y: number, fillRule?: string): boolean; - lineTo(x: number, y: number): void; measureText(text: string): TextMetrics; - moveTo(x: number, y: number): void; putImageData(imagedata: ImageData, dx: number, dy: number, dirtyX?: number, dirtyY?: number, dirtyWidth?: number, dirtyHeight?: number): void; - quadraticCurveTo(cpx: number, cpy: number, x: number, y: number): void; - rect(x: number, y: number, w: number, h: number): void; restore(): void; rotate(angle: number): void; save(): void; @@ -1148,7 +1824,7 @@ declare var ChannelSplitterNode: { interface CharacterData extends Node, ChildNode { data: string; - length: number; + readonly length: number; appendData(arg: string): void; deleteData(offset: number, count: number): void; insertData(offset: number, arg: string): void; @@ -1164,11 +1840,11 @@ declare var CharacterData: { interface ClientRect { bottom: number; - height: number; + readonly height: number; left: number; right: number; top: number; - width: number; + readonly width: number; } declare var ClientRect: { @@ -1177,7 +1853,7 @@ declare var ClientRect: { } interface ClientRectList { - length: number; + readonly length: number; item(index: number): ClientRect; [index: number]: ClientRect; } @@ -1188,7 +1864,7 @@ declare var ClientRectList: { } interface ClipboardEvent extends Event { - clipboardData: DataTransfer; + readonly clipboardData: DataTransfer; } declare var ClipboardEvent: { @@ -1197,9 +1873,9 @@ declare var ClipboardEvent: { } interface CloseEvent extends Event { - code: number; - reason: string; - wasClean: boolean; + readonly code: number; + readonly reason: string; + readonly wasClean: boolean; initCloseEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, wasCleanArg: boolean, codeArg: number, reasonArg: string): void; } @@ -1209,8 +1885,8 @@ declare var CloseEvent: { } interface CommandEvent extends Event { - commandName: string; - detail: string; + readonly commandName: string; + readonly detail: string; } declare var CommandEvent: { @@ -1228,8 +1904,8 @@ declare var Comment: { } interface CompositionEvent extends UIEvent { - data: string; - locale: string; + readonly data: string; + readonly locale: string; initCompositionEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, dataArg: string, locale: string): void; } @@ -1246,6 +1922,7 @@ interface Console { dir(value?: any, ...optionalParams: any[]): void; dirxml(value: any): void; error(message?: any, ...optionalParams: any[]): void; + exception(message?: string, ...optionalParams: any[]): void; group(groupTitle?: string): void; groupCollapsed(groupTitle?: string): void; groupEnd(): void; @@ -1255,6 +1932,7 @@ interface Console { profile(reportName?: string): void; profileEnd(): void; select(element: Element): void; + table(...data: any[]): void; time(timerName?: string): void; timeEnd(timerName?: string): void; trace(message?: any, ...optionalParams: any[]): void; @@ -1277,13 +1955,13 @@ declare var ConvolverNode: { } interface Coordinates { - accuracy: number; - altitude: number; - altitudeAccuracy: number; - heading: number; - latitude: number; - longitude: number; - speed: number; + readonly accuracy: number; + readonly altitude: number; + readonly altitudeAccuracy: number; + readonly heading: number; + readonly latitude: number; + readonly longitude: number; + readonly speed: number; } declare var Coordinates: { @@ -1292,7 +1970,7 @@ declare var Coordinates: { } interface Crypto extends Object, RandomSource { - subtle: SubtleCrypto; + readonly subtle: SubtleCrypto; } declare var Crypto: { @@ -1301,10 +1979,10 @@ declare var Crypto: { } interface CryptoKey { - algorithm: KeyAlgorithm; - extractable: boolean; - type: string; - usages: string[]; + readonly algorithm: KeyAlgorithm; + readonly extractable: boolean; + readonly type: string; + readonly usages: string[]; } declare var CryptoKey: { @@ -1323,7 +2001,7 @@ declare var CryptoKeyPair: { } interface CustomEvent extends Event { - detail: any; + readonly detail: any; initCustomEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, detailArg: any): void; } @@ -1333,7 +2011,7 @@ declare var CustomEvent: { } interface DOMError { - name: string; + readonly name: string; toString(): string; } @@ -1343,69 +2021,69 @@ declare var DOMError: { } interface DOMException { - code: number; - message: string; - name: string; + readonly code: number; + readonly message: string; + readonly name: string; toString(): string; - ABORT_ERR: number; - DATA_CLONE_ERR: number; - DOMSTRING_SIZE_ERR: number; - HIERARCHY_REQUEST_ERR: number; - INDEX_SIZE_ERR: number; - INUSE_ATTRIBUTE_ERR: number; - INVALID_ACCESS_ERR: number; - INVALID_CHARACTER_ERR: number; - INVALID_MODIFICATION_ERR: number; - INVALID_NODE_TYPE_ERR: number; - INVALID_STATE_ERR: number; - NAMESPACE_ERR: number; - NETWORK_ERR: number; - NOT_FOUND_ERR: number; - NOT_SUPPORTED_ERR: number; - NO_DATA_ALLOWED_ERR: number; - NO_MODIFICATION_ALLOWED_ERR: number; - PARSE_ERR: number; - QUOTA_EXCEEDED_ERR: number; - SECURITY_ERR: number; - SERIALIZE_ERR: number; - SYNTAX_ERR: number; - TIMEOUT_ERR: number; - TYPE_MISMATCH_ERR: number; - URL_MISMATCH_ERR: number; - VALIDATION_ERR: number; - WRONG_DOCUMENT_ERR: number; + readonly ABORT_ERR: number; + readonly DATA_CLONE_ERR: number; + readonly DOMSTRING_SIZE_ERR: number; + readonly HIERARCHY_REQUEST_ERR: number; + readonly INDEX_SIZE_ERR: number; + readonly INUSE_ATTRIBUTE_ERR: number; + readonly INVALID_ACCESS_ERR: number; + readonly INVALID_CHARACTER_ERR: number; + readonly INVALID_MODIFICATION_ERR: number; + readonly INVALID_NODE_TYPE_ERR: number; + readonly INVALID_STATE_ERR: number; + readonly NAMESPACE_ERR: number; + readonly NETWORK_ERR: number; + readonly NOT_FOUND_ERR: number; + readonly NOT_SUPPORTED_ERR: number; + readonly NO_DATA_ALLOWED_ERR: number; + readonly NO_MODIFICATION_ALLOWED_ERR: number; + readonly PARSE_ERR: number; + readonly QUOTA_EXCEEDED_ERR: number; + readonly SECURITY_ERR: number; + readonly SERIALIZE_ERR: number; + readonly SYNTAX_ERR: number; + readonly TIMEOUT_ERR: number; + readonly TYPE_MISMATCH_ERR: number; + readonly URL_MISMATCH_ERR: number; + readonly VALIDATION_ERR: number; + readonly WRONG_DOCUMENT_ERR: number; } declare var DOMException: { prototype: DOMException; new(): DOMException; - ABORT_ERR: number; - DATA_CLONE_ERR: number; - DOMSTRING_SIZE_ERR: number; - HIERARCHY_REQUEST_ERR: number; - INDEX_SIZE_ERR: number; - INUSE_ATTRIBUTE_ERR: number; - INVALID_ACCESS_ERR: number; - INVALID_CHARACTER_ERR: number; - INVALID_MODIFICATION_ERR: number; - INVALID_NODE_TYPE_ERR: number; - INVALID_STATE_ERR: number; - NAMESPACE_ERR: number; - NETWORK_ERR: number; - NOT_FOUND_ERR: number; - NOT_SUPPORTED_ERR: number; - NO_DATA_ALLOWED_ERR: number; - NO_MODIFICATION_ALLOWED_ERR: number; - PARSE_ERR: number; - QUOTA_EXCEEDED_ERR: number; - SECURITY_ERR: number; - SERIALIZE_ERR: number; - SYNTAX_ERR: number; - TIMEOUT_ERR: number; - TYPE_MISMATCH_ERR: number; - URL_MISMATCH_ERR: number; - VALIDATION_ERR: number; - WRONG_DOCUMENT_ERR: number; + readonly ABORT_ERR: number; + readonly DATA_CLONE_ERR: number; + readonly DOMSTRING_SIZE_ERR: number; + readonly HIERARCHY_REQUEST_ERR: number; + readonly INDEX_SIZE_ERR: number; + readonly INUSE_ATTRIBUTE_ERR: number; + readonly INVALID_ACCESS_ERR: number; + readonly INVALID_CHARACTER_ERR: number; + readonly INVALID_MODIFICATION_ERR: number; + readonly INVALID_NODE_TYPE_ERR: number; + readonly INVALID_STATE_ERR: number; + readonly NAMESPACE_ERR: number; + readonly NETWORK_ERR: number; + readonly NOT_FOUND_ERR: number; + readonly NOT_SUPPORTED_ERR: number; + readonly NO_DATA_ALLOWED_ERR: number; + readonly NO_MODIFICATION_ALLOWED_ERR: number; + readonly PARSE_ERR: number; + readonly QUOTA_EXCEEDED_ERR: number; + readonly SECURITY_ERR: number; + readonly SERIALIZE_ERR: number; + readonly SYNTAX_ERR: number; + readonly TIMEOUT_ERR: number; + readonly TYPE_MISMATCH_ERR: number; + readonly URL_MISMATCH_ERR: number; + readonly VALIDATION_ERR: number; + readonly WRONG_DOCUMENT_ERR: number; } interface DOMImplementation { @@ -1439,7 +2117,7 @@ declare var DOMSettableTokenList: { } interface DOMStringList { - length: number; + readonly length: number; contains(str: string): boolean; item(index: number): string; [index: number]: string; @@ -1460,7 +2138,7 @@ declare var DOMStringMap: { } interface DOMTokenList { - length: number; + readonly length: number; add(...token: string[]): void; contains(token: string): boolean; item(index: number): string; @@ -1487,9 +2165,9 @@ declare var DataCue: { interface DataTransfer { dropEffect: string; effectAllowed: string; - files: FileList; - items: DataTransferItemList; - types: DOMStringList; + readonly files: FileList; + readonly items: DataTransferItemList; + readonly types: DOMStringList; clearData(format?: string): boolean; getData(format: string): string; setData(format: string, data: string): boolean; @@ -1501,8 +2179,8 @@ declare var DataTransfer: { } interface DataTransferItem { - kind: string; - type: string; + readonly kind: string; + readonly type: string; getAsFile(): File; getAsString(_callback: FunctionStringCallback): void; } @@ -1513,7 +2191,7 @@ declare var DataTransferItem: { } interface DataTransferItemList { - length: number; + readonly length: number; add(data: File): DataTransferItem; clear(): void; item(index: number): DataTransferItem; @@ -1527,9 +2205,9 @@ declare var DataTransferItemList: { } interface DeferredPermissionRequest { - id: number; - type: string; - uri: string; + readonly id: number; + readonly type: string; + readonly uri: string; allow(): void; deny(): void; } @@ -1540,7 +2218,7 @@ declare var DeferredPermissionRequest: { } interface DelayNode extends AudioNode { - delayTime: AudioParam; + readonly delayTime: AudioParam; } declare var DelayNode: { @@ -1549,9 +2227,9 @@ declare var DelayNode: { } interface DeviceAcceleration { - x: number; - y: number; - z: number; + readonly x: number; + readonly y: number; + readonly z: number; } declare var DeviceAcceleration: { @@ -1559,11 +2237,20 @@ declare var DeviceAcceleration: { new(): DeviceAcceleration; } +interface DeviceLightEvent extends Event { + readonly value: number; +} + +declare var DeviceLightEvent: { + prototype: DeviceLightEvent; + new(type: string, eventInitDict?: DeviceLightEventInit): DeviceLightEvent; +} + interface DeviceMotionEvent extends Event { - acceleration: DeviceAcceleration; - accelerationIncludingGravity: DeviceAcceleration; - interval: number; - rotationRate: DeviceRotationRate; + readonly acceleration: DeviceAcceleration; + readonly accelerationIncludingGravity: DeviceAcceleration; + readonly interval: number; + readonly rotationRate: DeviceRotationRate; initDeviceMotionEvent(type: string, bubbles: boolean, cancelable: boolean, acceleration: DeviceAccelerationDict, accelerationIncludingGravity: DeviceAccelerationDict, rotationRate: DeviceRotationRateDict, interval: number): void; } @@ -1573,10 +2260,10 @@ declare var DeviceMotionEvent: { } interface DeviceOrientationEvent extends Event { - absolute: boolean; - alpha: number; - beta: number; - gamma: number; + readonly absolute: boolean; + readonly alpha: number; + readonly beta: number; + readonly gamma: number; initDeviceOrientationEvent(type: string, bubbles: boolean, cancelable: boolean, alpha: number, beta: number, gamma: number, absolute: boolean): void; } @@ -1586,9 +2273,9 @@ declare var DeviceOrientationEvent: { } interface DeviceRotationRate { - alpha: number; - beta: number; - gamma: number; + readonly alpha: number; + readonly beta: number; + readonly gamma: number; } declare var DeviceRotationRate: { @@ -1600,15 +2287,15 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven /** * Sets or gets the URL for the current document. */ - URL: string; + readonly URL: string; /** * Gets the URL for the document, stripped of any character encoding. */ - URLUnencoded: string; + readonly URLUnencoded: string; /** * Gets the object that has the focus when the parent document has focus. */ - activeElement: Element; + readonly activeElement: Element; /** * Sets or gets the color of all active links in the document. */ @@ -1616,15 +2303,15 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven /** * Returns a reference to the collection of elements contained by the object. */ - all: HTMLCollection; + readonly all: HTMLAllCollection; /** * Retrieves a collection of all a objects that have a name and/or id property. Objects in this collection are in HTML source order. */ - anchors: HTMLCollection; + anchors: HTMLCollectionOf; /** * Retrieves a collection of all applet objects in the document. */ - applets: HTMLCollection; + applets: HTMLCollectionOf; /** * Deprecated. Sets or retrieves a value that indicates the background color behind the object. */ @@ -1633,7 +2320,7 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven * Specifies the beginning and end of the document body. */ body: HTMLElement; - characterSet: string; + readonly characterSet: string; /** * Gets or sets the character set used to encode the object. */ @@ -1641,13 +2328,14 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven /** * Gets a value that indicates whether standards-compliant mode is switched on for the object. */ - compatMode: string; + readonly compatMode: string; cookie: string; + readonly currentScript: HTMLScriptElement | SVGScriptElement; /** * Gets the default character set from the current regional language settings. */ - defaultCharset: string; - defaultView: Window; + readonly defaultCharset: string; + readonly defaultView: Window; /** * Sets or gets a value that indicates whether the document can be edited. */ @@ -1659,7 +2347,7 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven /** * Gets an object representing the document type declaration associated with the current document. */ - doctype: DocumentType; + readonly doctype: DocumentType; /** * Gets a reference to the root node of the document. */ @@ -1671,7 +2359,7 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven /** * Retrieves a collection of all embed objects in the document. */ - embeds: HTMLCollection; + embeds: HTMLCollectionOf; /** * Sets or gets the foreground (text) color of the document. */ @@ -1679,27 +2367,27 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven /** * Retrieves a collection, in source order, of all form objects in the document. */ - forms: HTMLCollection; - fullscreenElement: Element; - fullscreenEnabled: boolean; - head: HTMLHeadElement; - hidden: boolean; + forms: HTMLCollectionOf; + readonly fullscreenElement: Element; + readonly fullscreenEnabled: boolean; + readonly head: HTMLHeadElement; + readonly hidden: boolean; /** * Retrieves a collection, in source order, of img objects in the document. */ - images: HTMLCollection; + images: HTMLCollectionOf; /** * Gets the implementation object of the current document. */ - implementation: DOMImplementation; + readonly implementation: DOMImplementation; /** * Returns the character encoding used to create the webpage that is loaded into the document object. */ - inputEncoding: string; + readonly inputEncoding: string; /** * Gets the date that the page was last modified, if the page supplies one. */ - lastModified: string; + readonly lastModified: string; /** * Sets or gets the color of the document links. */ @@ -1707,16 +2395,13 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven /** * Retrieves a collection of all a objects that specify the href property and all area objects in the document. */ - links: HTMLCollection; + links: HTMLCollectionOf; /** * Contains information about the current URL. */ - location: Location; - media: string; + readonly location: Location; msCSSOMElementFloatMetrics: boolean; msCapsLockWarningOff: boolean; - msHidden: boolean; - msVisibilityState: string; /** * Fires when the user aborts the download. * @param ev The event. @@ -1818,7 +2503,7 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven * Occurs when the end of playback is reached. * @param ev The event */ - onended: (ev: Event) => any; + onended: (ev: MediaStreamErrorEvent) => any; /** * Fires when an error occurs during object loading. * @param ev The event. @@ -1832,6 +2517,7 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven onfullscreenchange: (ev: Event) => any; onfullscreenerror: (ev: Event) => any; oninput: (ev: Event) => any; + oninvalid: (ev: Event) => any; /** * Fires when the user presses a key. * @param ev The keyboard event @@ -1896,7 +2582,7 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven * Fires when the wheel button is rotated. * @param ev The mouse event */ - onmousewheel: (ev: MouseWheelEvent) => any; + onmousewheel: (ev: WheelEvent) => any; onmscontentzoom: (ev: UIEvent) => any; onmsgesturechange: (ev: MSGestureEvent) => any; onmsgesturedoubletap: (ev: MSGestureEvent) => any; @@ -1981,6 +2667,11 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven * @param ev The event. */ onselect: (ev: UIEvent) => any; + /** + * Fires when the selection state of a document changes. + * @param ev The event. + */ + onselectionchange: (ev: Event) => any; onselectstart: (ev: Event) => any; /** * Occurs when the download has stopped. @@ -2019,51 +2710,51 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven onwaiting: (ev: Event) => any; onwebkitfullscreenchange: (ev: Event) => any; onwebkitfullscreenerror: (ev: Event) => any; - plugins: HTMLCollection; - pointerLockElement: Element; + plugins: HTMLCollectionOf; + readonly pointerLockElement: Element; /** * Retrieves a value that indicates the current state of the object. */ - readyState: string; + readonly readyState: string; /** * Gets the URL of the location that referred the user to the current page. */ - referrer: string; + readonly referrer: string; /** * Gets the root svg element in the document hierarchy. */ - rootElement: SVGSVGElement; + readonly rootElement: SVGSVGElement; /** * Retrieves a collection of all script objects in the document. */ - scripts: HTMLCollection; - security: string; + scripts: HTMLCollectionOf; + readonly scrollingElement: Element; /** * Retrieves a collection of styleSheet objects representing the style sheets that correspond to each instance of a link or style object in the document. */ - styleSheets: StyleSheetList; + readonly styleSheets: StyleSheetList; /** * Contains the title of the document. */ title: string; - visibilityState: string; + readonly visibilityState: string; /** * Sets or gets the color of the links that the user has visited. */ vlinkColor: string; - webkitCurrentFullScreenElement: Element; - webkitFullscreenElement: Element; - webkitFullscreenEnabled: boolean; - webkitIsFullScreen: boolean; - xmlEncoding: string; + readonly webkitCurrentFullScreenElement: Element; + readonly webkitFullscreenElement: Element; + readonly webkitFullscreenEnabled: boolean; + readonly webkitIsFullScreen: boolean; + readonly xmlEncoding: string; xmlStandalone: boolean; /** * Gets or sets the version attribute specified in the declaration of an XML document. */ xmlVersion: string; - currentScript: HTMLScriptElement; adoptNode(source: Node): Node; captureEvents(): void; + caretRangeFromPoint(x: number, y: number): Range; clear(): void; /** * Closes an output stream and forces the sent data to display. @@ -2090,37 +2781,24 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven * @param tagName The name of an element. */ createElement(tagName: "a"): HTMLAnchorElement; - createElement(tagName: "abbr"): HTMLPhraseElement; - createElement(tagName: "acronym"): HTMLPhraseElement; - createElement(tagName: "address"): HTMLBlockElement; createElement(tagName: "applet"): HTMLAppletElement; createElement(tagName: "area"): HTMLAreaElement; createElement(tagName: "audio"): HTMLAudioElement; - createElement(tagName: "b"): HTMLPhraseElement; createElement(tagName: "base"): HTMLBaseElement; createElement(tagName: "basefont"): HTMLBaseFontElement; - createElement(tagName: "bdo"): HTMLPhraseElement; - createElement(tagName: "big"): HTMLPhraseElement; - createElement(tagName: "blockquote"): HTMLBlockElement; + createElement(tagName: "blockquote"): HTMLQuoteElement; createElement(tagName: "body"): HTMLBodyElement; createElement(tagName: "br"): HTMLBRElement; createElement(tagName: "button"): HTMLButtonElement; createElement(tagName: "canvas"): HTMLCanvasElement; createElement(tagName: "caption"): HTMLTableCaptionElement; - createElement(tagName: "center"): HTMLBlockElement; - createElement(tagName: "cite"): HTMLPhraseElement; - createElement(tagName: "code"): HTMLPhraseElement; createElement(tagName: "col"): HTMLTableColElement; createElement(tagName: "colgroup"): HTMLTableColElement; createElement(tagName: "datalist"): HTMLDataListElement; - createElement(tagName: "dd"): HTMLDDElement; createElement(tagName: "del"): HTMLModElement; - createElement(tagName: "dfn"): HTMLPhraseElement; createElement(tagName: "dir"): HTMLDirectoryElement; createElement(tagName: "div"): HTMLDivElement; createElement(tagName: "dl"): HTMLDListElement; - createElement(tagName: "dt"): HTMLDTElement; - createElement(tagName: "em"): HTMLPhraseElement; createElement(tagName: "embed"): HTMLEmbedElement; createElement(tagName: "fieldset"): HTMLFieldSetElement; createElement(tagName: "font"): HTMLFontElement; @@ -2136,52 +2814,41 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven createElement(tagName: "head"): HTMLHeadElement; createElement(tagName: "hr"): HTMLHRElement; createElement(tagName: "html"): HTMLHtmlElement; - createElement(tagName: "i"): HTMLPhraseElement; createElement(tagName: "iframe"): HTMLIFrameElement; createElement(tagName: "img"): HTMLImageElement; createElement(tagName: "input"): HTMLInputElement; createElement(tagName: "ins"): HTMLModElement; - createElement(tagName: "isindex"): HTMLIsIndexElement; - createElement(tagName: "kbd"): HTMLPhraseElement; - createElement(tagName: "keygen"): HTMLBlockElement; + createElement(tagName: "isindex"): HTMLUnknownElement; createElement(tagName: "label"): HTMLLabelElement; createElement(tagName: "legend"): HTMLLegendElement; createElement(tagName: "li"): HTMLLIElement; createElement(tagName: "link"): HTMLLinkElement; - createElement(tagName: "listing"): HTMLBlockElement; + createElement(tagName: "listing"): HTMLPreElement; createElement(tagName: "map"): HTMLMapElement; createElement(tagName: "marquee"): HTMLMarqueeElement; createElement(tagName: "menu"): HTMLMenuElement; createElement(tagName: "meta"): HTMLMetaElement; - createElement(tagName: "nextid"): HTMLNextIdElement; - createElement(tagName: "nobr"): HTMLPhraseElement; + createElement(tagName: "meter"): HTMLMeterElement; + createElement(tagName: "nextid"): HTMLUnknownElement; createElement(tagName: "object"): HTMLObjectElement; createElement(tagName: "ol"): HTMLOListElement; createElement(tagName: "optgroup"): HTMLOptGroupElement; createElement(tagName: "option"): HTMLOptionElement; createElement(tagName: "p"): HTMLParagraphElement; createElement(tagName: "param"): HTMLParamElement; - createElement(tagName: "plaintext"): HTMLBlockElement; + createElement(tagName: "picture"): HTMLPictureElement; createElement(tagName: "pre"): HTMLPreElement; createElement(tagName: "progress"): HTMLProgressElement; createElement(tagName: "q"): HTMLQuoteElement; - createElement(tagName: "rt"): HTMLPhraseElement; - createElement(tagName: "ruby"): HTMLPhraseElement; - createElement(tagName: "s"): HTMLPhraseElement; - createElement(tagName: "samp"): HTMLPhraseElement; createElement(tagName: "script"): HTMLScriptElement; createElement(tagName: "select"): HTMLSelectElement; - createElement(tagName: "small"): HTMLPhraseElement; createElement(tagName: "source"): HTMLSourceElement; createElement(tagName: "span"): HTMLSpanElement; - createElement(tagName: "strike"): HTMLPhraseElement; - createElement(tagName: "strong"): HTMLPhraseElement; createElement(tagName: "style"): HTMLStyleElement; - createElement(tagName: "sub"): HTMLPhraseElement; - createElement(tagName: "sup"): HTMLPhraseElement; createElement(tagName: "table"): HTMLTableElement; createElement(tagName: "tbody"): HTMLTableSectionElement; createElement(tagName: "td"): HTMLTableDataCellElement; + createElement(tagName: "template"): HTMLTemplateElement; createElement(tagName: "textarea"): HTMLTextAreaElement; createElement(tagName: "tfoot"): HTMLTableSectionElement; createElement(tagName: "th"): HTMLTableHeaderCellElement; @@ -2189,13 +2856,10 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven createElement(tagName: "title"): HTMLTitleElement; createElement(tagName: "tr"): HTMLTableRowElement; createElement(tagName: "track"): HTMLTrackElement; - createElement(tagName: "tt"): HTMLPhraseElement; - createElement(tagName: "u"): HTMLPhraseElement; createElement(tagName: "ul"): HTMLUListElement; - createElement(tagName: "var"): HTMLPhraseElement; createElement(tagName: "video"): HTMLVideoElement; createElement(tagName: "x-ms-webview"): MSHTMLWebViewElement; - createElement(tagName: "xmp"): HTMLBlockElement; + createElement(tagName: "xmp"): HTMLPreElement; createElement(tagName: string): HTMLElement; createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "a"): SVGAElement createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "circle"): SVGCircleElement @@ -2280,7 +2944,7 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven * @param data String that specifies the nodeValue property of the text node. */ createTextNode(data: string): Text; - createTouch(view: any, target: EventTarget, identifier: number, pageX: number, pageY: number, screenX: number, screenY: number): Touch; + createTouch(view: Window, target: EventTarget, identifier: number, pageX: number, pageY: number, screenX: number, screenY: number): Touch; createTouchList(...touches: Touch[]): TouchList; /** * Creates a TreeWalker object that you can use to traverse filtered lists of nodes or elements in a document. @@ -2331,44 +2995,44 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven * @param name Specifies the name of an element. */ getElementsByTagName(tagname: "a"): NodeListOf; - getElementsByTagName(tagname: "abbr"): NodeListOf; - getElementsByTagName(tagname: "acronym"): NodeListOf; - getElementsByTagName(tagname: "address"): NodeListOf; + getElementsByTagName(tagname: "abbr"): NodeListOf; + getElementsByTagName(tagname: "acronym"): NodeListOf; + getElementsByTagName(tagname: "address"): NodeListOf; getElementsByTagName(tagname: "applet"): NodeListOf; getElementsByTagName(tagname: "area"): NodeListOf; getElementsByTagName(tagname: "article"): NodeListOf; getElementsByTagName(tagname: "aside"): NodeListOf; getElementsByTagName(tagname: "audio"): NodeListOf; - getElementsByTagName(tagname: "b"): NodeListOf; + getElementsByTagName(tagname: "b"): NodeListOf; getElementsByTagName(tagname: "base"): NodeListOf; getElementsByTagName(tagname: "basefont"): NodeListOf; - getElementsByTagName(tagname: "bdo"): NodeListOf; - getElementsByTagName(tagname: "big"): NodeListOf; - getElementsByTagName(tagname: "blockquote"): NodeListOf; + getElementsByTagName(tagname: "bdo"): NodeListOf; + getElementsByTagName(tagname: "big"): NodeListOf; + getElementsByTagName(tagname: "blockquote"): NodeListOf; getElementsByTagName(tagname: "body"): NodeListOf; getElementsByTagName(tagname: "br"): NodeListOf; getElementsByTagName(tagname: "button"): NodeListOf; getElementsByTagName(tagname: "canvas"): NodeListOf; getElementsByTagName(tagname: "caption"): NodeListOf; - getElementsByTagName(tagname: "center"): NodeListOf; + getElementsByTagName(tagname: "center"): NodeListOf; getElementsByTagName(tagname: "circle"): NodeListOf; - getElementsByTagName(tagname: "cite"): NodeListOf; + getElementsByTagName(tagname: "cite"): NodeListOf; getElementsByTagName(tagname: "clippath"): NodeListOf; - getElementsByTagName(tagname: "code"): NodeListOf; + getElementsByTagName(tagname: "code"): NodeListOf; getElementsByTagName(tagname: "col"): NodeListOf; getElementsByTagName(tagname: "colgroup"): NodeListOf; getElementsByTagName(tagname: "datalist"): NodeListOf; - getElementsByTagName(tagname: "dd"): NodeListOf; + getElementsByTagName(tagname: "dd"): NodeListOf; getElementsByTagName(tagname: "defs"): NodeListOf; getElementsByTagName(tagname: "del"): NodeListOf; getElementsByTagName(tagname: "desc"): NodeListOf; - getElementsByTagName(tagname: "dfn"): NodeListOf; + getElementsByTagName(tagname: "dfn"): NodeListOf; getElementsByTagName(tagname: "dir"): NodeListOf; getElementsByTagName(tagname: "div"): NodeListOf; getElementsByTagName(tagname: "dl"): NodeListOf; - getElementsByTagName(tagname: "dt"): NodeListOf; + getElementsByTagName(tagname: "dt"): NodeListOf; getElementsByTagName(tagname: "ellipse"): NodeListOf; - getElementsByTagName(tagname: "em"): NodeListOf; + getElementsByTagName(tagname: "em"): NodeListOf; getElementsByTagName(tagname: "embed"): NodeListOf; getElementsByTagName(tagname: "feblend"): NodeListOf; getElementsByTagName(tagname: "fecolormatrix"): NodeListOf; @@ -2416,22 +3080,22 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven getElementsByTagName(tagname: "hgroup"): NodeListOf; getElementsByTagName(tagname: "hr"): NodeListOf; getElementsByTagName(tagname: "html"): NodeListOf; - getElementsByTagName(tagname: "i"): NodeListOf; + getElementsByTagName(tagname: "i"): NodeListOf; getElementsByTagName(tagname: "iframe"): NodeListOf; getElementsByTagName(tagname: "image"): NodeListOf; getElementsByTagName(tagname: "img"): NodeListOf; getElementsByTagName(tagname: "input"): NodeListOf; getElementsByTagName(tagname: "ins"): NodeListOf; - getElementsByTagName(tagname: "isindex"): NodeListOf; - getElementsByTagName(tagname: "kbd"): NodeListOf; - getElementsByTagName(tagname: "keygen"): NodeListOf; + getElementsByTagName(tagname: "isindex"): NodeListOf; + getElementsByTagName(tagname: "kbd"): NodeListOf; + getElementsByTagName(tagname: "keygen"): NodeListOf; getElementsByTagName(tagname: "label"): NodeListOf; getElementsByTagName(tagname: "legend"): NodeListOf; getElementsByTagName(tagname: "li"): NodeListOf; getElementsByTagName(tagname: "line"): NodeListOf; getElementsByTagName(tagname: "lineargradient"): NodeListOf; getElementsByTagName(tagname: "link"): NodeListOf; - getElementsByTagName(tagname: "listing"): NodeListOf; + getElementsByTagName(tagname: "listing"): NodeListOf; getElementsByTagName(tagname: "map"): NodeListOf; getElementsByTagName(tagname: "mark"): NodeListOf; getElementsByTagName(tagname: "marker"): NodeListOf; @@ -2440,9 +3104,10 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven getElementsByTagName(tagname: "menu"): NodeListOf; getElementsByTagName(tagname: "meta"): NodeListOf; getElementsByTagName(tagname: "metadata"): NodeListOf; + getElementsByTagName(tagname: "meter"): NodeListOf; getElementsByTagName(tagname: "nav"): NodeListOf; - getElementsByTagName(tagname: "nextid"): NodeListOf; - getElementsByTagName(tagname: "nobr"): NodeListOf; + getElementsByTagName(tagname: "nextid"): NodeListOf; + getElementsByTagName(tagname: "nobr"): NodeListOf; getElementsByTagName(tagname: "noframes"): NodeListOf; getElementsByTagName(tagname: "noscript"): NodeListOf; getElementsByTagName(tagname: "object"): NodeListOf; @@ -2453,7 +3118,8 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven getElementsByTagName(tagname: "param"): NodeListOf; getElementsByTagName(tagname: "path"): NodeListOf; getElementsByTagName(tagname: "pattern"): NodeListOf; - getElementsByTagName(tagname: "plaintext"): NodeListOf; + getElementsByTagName(tagname: "picture"): NodeListOf; + getElementsByTagName(tagname: "plaintext"): NodeListOf; getElementsByTagName(tagname: "polygon"): NodeListOf; getElementsByTagName(tagname: "polyline"): NodeListOf; getElementsByTagName(tagname: "pre"): NodeListOf; @@ -2461,28 +3127,29 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven getElementsByTagName(tagname: "q"): NodeListOf; getElementsByTagName(tagname: "radialgradient"): NodeListOf; getElementsByTagName(tagname: "rect"): NodeListOf; - getElementsByTagName(tagname: "rt"): NodeListOf; - getElementsByTagName(tagname: "ruby"): NodeListOf; - getElementsByTagName(tagname: "s"): NodeListOf; - getElementsByTagName(tagname: "samp"): NodeListOf; + getElementsByTagName(tagname: "rt"): NodeListOf; + getElementsByTagName(tagname: "ruby"): NodeListOf; + getElementsByTagName(tagname: "s"): NodeListOf; + getElementsByTagName(tagname: "samp"): NodeListOf; getElementsByTagName(tagname: "script"): NodeListOf; getElementsByTagName(tagname: "section"): NodeListOf; getElementsByTagName(tagname: "select"): NodeListOf; - getElementsByTagName(tagname: "small"): NodeListOf; + getElementsByTagName(tagname: "small"): NodeListOf; getElementsByTagName(tagname: "source"): NodeListOf; getElementsByTagName(tagname: "span"): NodeListOf; getElementsByTagName(tagname: "stop"): NodeListOf; - getElementsByTagName(tagname: "strike"): NodeListOf; - getElementsByTagName(tagname: "strong"): NodeListOf; + getElementsByTagName(tagname: "strike"): NodeListOf; + getElementsByTagName(tagname: "strong"): NodeListOf; getElementsByTagName(tagname: "style"): NodeListOf; - getElementsByTagName(tagname: "sub"): NodeListOf; - getElementsByTagName(tagname: "sup"): NodeListOf; + getElementsByTagName(tagname: "sub"): NodeListOf; + getElementsByTagName(tagname: "sup"): NodeListOf; getElementsByTagName(tagname: "svg"): NodeListOf; getElementsByTagName(tagname: "switch"): NodeListOf; getElementsByTagName(tagname: "symbol"): NodeListOf; getElementsByTagName(tagname: "table"): NodeListOf; getElementsByTagName(tagname: "tbody"): NodeListOf; getElementsByTagName(tagname: "td"): NodeListOf; + getElementsByTagName(tagname: "template"): NodeListOf; getElementsByTagName(tagname: "text"): NodeListOf; getElementsByTagName(tagname: "textpath"): NodeListOf; getElementsByTagName(tagname: "textarea"): NodeListOf; @@ -2493,16 +3160,16 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven getElementsByTagName(tagname: "tr"): NodeListOf; getElementsByTagName(tagname: "track"): NodeListOf; getElementsByTagName(tagname: "tspan"): NodeListOf; - getElementsByTagName(tagname: "tt"): NodeListOf; - getElementsByTagName(tagname: "u"): NodeListOf; + getElementsByTagName(tagname: "tt"): NodeListOf; + getElementsByTagName(tagname: "u"): NodeListOf; getElementsByTagName(tagname: "ul"): NodeListOf; getElementsByTagName(tagname: "use"): NodeListOf; - getElementsByTagName(tagname: "var"): NodeListOf; + getElementsByTagName(tagname: "var"): NodeListOf; getElementsByTagName(tagname: "video"): NodeListOf; getElementsByTagName(tagname: "view"): NodeListOf; getElementsByTagName(tagname: "wbr"): NodeListOf; getElementsByTagName(tagname: "x-ms-webview"): NodeListOf; - getElementsByTagName(tagname: "xmp"): NodeListOf; + getElementsByTagName(tagname: "xmp"): NodeListOf; getElementsByTagName(tagname: string): NodeListOf; getElementsByTagNameNS(namespaceURI: string, localName: string): NodeListOf; /** @@ -2514,8 +3181,8 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven */ hasFocus(): boolean; importNode(importedNode: Node, deep: boolean): Node; - msElementsFromPoint(x: number, y: number): NodeList; - msElementsFromRect(left: number, top: number, width: number, height: number): NodeList; + msElementsFromPoint(x: number, y: number): NodeListOf; + msElementsFromRect(left: number, top: number, width: number, height: number): NodeListOf; /** * 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. * @param url Specifies a MIME type for the document. @@ -2611,12 +3278,13 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven addEventListener(type: "drop", listener: (ev: DragEvent) => any, useCapture?: boolean): void; addEventListener(type: "durationchange", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "emptied", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "ended", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "ended", listener: (ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: "focus", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; addEventListener(type: "fullscreenchange", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "fullscreenerror", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "input", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "invalid", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "keydown", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "keypress", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "keyup", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; @@ -2629,7 +3297,7 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven addEventListener(type: "mouseout", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "mouseover", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "mouseup", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousewheel", listener: (ev: MouseWheelEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mousewheel", listener: (ev: WheelEvent) => any, useCapture?: boolean): void; addEventListener(type: "mssitemodejumplistitemremoved", listener: (ev: MSSiteModeEvent) => any, useCapture?: boolean): void; addEventListener(type: "msthumbnailclick", listener: (ev: MSSiteModeEvent) => any, useCapture?: boolean): void; addEventListener(type: "pause", listener: (ev: Event) => any, useCapture?: boolean): void; @@ -2653,6 +3321,7 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven addEventListener(type: "seeked", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "seeking", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "select", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "selectionchange", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "selectstart", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "stalled", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "stop", listener: (ev: Event) => any, useCapture?: boolean): void; @@ -2686,12 +3355,12 @@ declare var DocumentFragment: { } interface DocumentType extends Node, ChildNode { - entities: NamedNodeMap; - internalSubset: string; - name: string; - notations: NamedNodeMap; - publicId: string; - systemId: string; + readonly entities: NamedNodeMap; + readonly internalSubset: string; + readonly name: string; + readonly notations: NamedNodeMap; + readonly publicId: string; + readonly systemId: string; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -2701,7 +3370,7 @@ declare var DocumentType: { } interface DragEvent extends MouseEvent { - dataTransfer: DataTransfer; + readonly dataTransfer: DataTransfer; 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; msConvertURL(file: File, targetType: string, targetURL?: string): void; } @@ -2712,12 +3381,12 @@ declare var DragEvent: { } interface DynamicsCompressorNode extends AudioNode { - attack: AudioParam; - knee: AudioParam; - ratio: AudioParam; - reduction: AudioParam; - release: AudioParam; - threshold: AudioParam; + readonly attack: AudioParam; + readonly knee: AudioParam; + readonly ratio: AudioParam; + readonly reduction: AudioParam; + readonly release: AudioParam; + readonly threshold: AudioParam; } declare var DynamicsCompressorNode: { @@ -2725,26 +3394,36 @@ declare var DynamicsCompressorNode: { new(): DynamicsCompressorNode; } +interface EXT_frag_depth { +} + +declare var EXT_frag_depth: { + prototype: EXT_frag_depth; + new(): EXT_frag_depth; +} + interface EXT_texture_filter_anisotropic { - MAX_TEXTURE_MAX_ANISOTROPY_EXT: number; - TEXTURE_MAX_ANISOTROPY_EXT: number; + readonly MAX_TEXTURE_MAX_ANISOTROPY_EXT: number; + readonly TEXTURE_MAX_ANISOTROPY_EXT: number; } declare var EXT_texture_filter_anisotropic: { prototype: EXT_texture_filter_anisotropic; new(): EXT_texture_filter_anisotropic; - MAX_TEXTURE_MAX_ANISOTROPY_EXT: number; - TEXTURE_MAX_ANISOTROPY_EXT: number; + readonly MAX_TEXTURE_MAX_ANISOTROPY_EXT: number; + readonly TEXTURE_MAX_ANISOTROPY_EXT: number; } interface Element extends Node, GlobalEventHandlers, ElementTraversal, NodeSelector, ChildNode { - classList: DOMTokenList; - clientHeight: number; - clientLeft: number; - clientTop: number; - clientWidth: number; + readonly classList: DOMTokenList; + className: string; + readonly clientHeight: number; + readonly clientLeft: number; + readonly clientTop: number; + readonly clientWidth: number; + id: string; msContentZoomFactor: number; - msRegionOverflow: string; + readonly msRegionOverflow: string; onariarequest: (ev: AriaRequestEvent) => any; oncommand: (ev: CommandEvent) => any; ongotpointercapture: (ev: PointerEvent) => any; @@ -2772,13 +3451,12 @@ interface Element extends Node, GlobalEventHandlers, ElementTraversal, NodeSelec ontouchstart: (ev: TouchEvent) => any; onwebkitfullscreenchange: (ev: Event) => any; onwebkitfullscreenerror: (ev: Event) => any; - scrollHeight: number; + readonly prefix: string; + readonly scrollHeight: number; scrollLeft: number; scrollTop: number; - scrollWidth: number; - tagName: string; - id: string; - className: string; + readonly scrollWidth: number; + readonly tagName: string; innerHTML: string; getAttribute(name?: string): string; getAttributeNS(namespaceURI: string, localName: string): string; @@ -2787,44 +3465,44 @@ interface Element extends Node, GlobalEventHandlers, ElementTraversal, NodeSelec getBoundingClientRect(): ClientRect; getClientRects(): ClientRectList; getElementsByTagName(name: "a"): NodeListOf; - getElementsByTagName(name: "abbr"): NodeListOf; - getElementsByTagName(name: "acronym"): NodeListOf; - getElementsByTagName(name: "address"): NodeListOf; + getElementsByTagName(name: "abbr"): NodeListOf; + getElementsByTagName(name: "acronym"): NodeListOf; + getElementsByTagName(name: "address"): NodeListOf; getElementsByTagName(name: "applet"): NodeListOf; getElementsByTagName(name: "area"): NodeListOf; getElementsByTagName(name: "article"): NodeListOf; getElementsByTagName(name: "aside"): NodeListOf; getElementsByTagName(name: "audio"): NodeListOf; - getElementsByTagName(name: "b"): NodeListOf; + getElementsByTagName(name: "b"): NodeListOf; getElementsByTagName(name: "base"): NodeListOf; getElementsByTagName(name: "basefont"): NodeListOf; - getElementsByTagName(name: "bdo"): NodeListOf; - getElementsByTagName(name: "big"): NodeListOf; - getElementsByTagName(name: "blockquote"): NodeListOf; + getElementsByTagName(name: "bdo"): NodeListOf; + getElementsByTagName(name: "big"): NodeListOf; + getElementsByTagName(name: "blockquote"): NodeListOf; getElementsByTagName(name: "body"): NodeListOf; getElementsByTagName(name: "br"): NodeListOf; getElementsByTagName(name: "button"): NodeListOf; getElementsByTagName(name: "canvas"): NodeListOf; getElementsByTagName(name: "caption"): NodeListOf; - getElementsByTagName(name: "center"): NodeListOf; + getElementsByTagName(name: "center"): NodeListOf; getElementsByTagName(name: "circle"): NodeListOf; - getElementsByTagName(name: "cite"): NodeListOf; + getElementsByTagName(name: "cite"): NodeListOf; getElementsByTagName(name: "clippath"): NodeListOf; - getElementsByTagName(name: "code"): NodeListOf; + getElementsByTagName(name: "code"): NodeListOf; getElementsByTagName(name: "col"): NodeListOf; getElementsByTagName(name: "colgroup"): NodeListOf; getElementsByTagName(name: "datalist"): NodeListOf; - getElementsByTagName(name: "dd"): NodeListOf; + getElementsByTagName(name: "dd"): NodeListOf; getElementsByTagName(name: "defs"): NodeListOf; getElementsByTagName(name: "del"): NodeListOf; getElementsByTagName(name: "desc"): NodeListOf; - getElementsByTagName(name: "dfn"): NodeListOf; + getElementsByTagName(name: "dfn"): NodeListOf; getElementsByTagName(name: "dir"): NodeListOf; getElementsByTagName(name: "div"): NodeListOf; getElementsByTagName(name: "dl"): NodeListOf; - getElementsByTagName(name: "dt"): NodeListOf; + getElementsByTagName(name: "dt"): NodeListOf; getElementsByTagName(name: "ellipse"): NodeListOf; - getElementsByTagName(name: "em"): NodeListOf; + getElementsByTagName(name: "em"): NodeListOf; getElementsByTagName(name: "embed"): NodeListOf; getElementsByTagName(name: "feblend"): NodeListOf; getElementsByTagName(name: "fecolormatrix"): NodeListOf; @@ -2872,22 +3550,22 @@ interface Element extends Node, GlobalEventHandlers, ElementTraversal, NodeSelec getElementsByTagName(name: "hgroup"): NodeListOf; getElementsByTagName(name: "hr"): NodeListOf; getElementsByTagName(name: "html"): NodeListOf; - getElementsByTagName(name: "i"): NodeListOf; + getElementsByTagName(name: "i"): NodeListOf; getElementsByTagName(name: "iframe"): NodeListOf; getElementsByTagName(name: "image"): NodeListOf; getElementsByTagName(name: "img"): NodeListOf; getElementsByTagName(name: "input"): NodeListOf; getElementsByTagName(name: "ins"): NodeListOf; - getElementsByTagName(name: "isindex"): NodeListOf; - getElementsByTagName(name: "kbd"): NodeListOf; - getElementsByTagName(name: "keygen"): NodeListOf; + getElementsByTagName(name: "isindex"): NodeListOf; + getElementsByTagName(name: "kbd"): NodeListOf; + getElementsByTagName(name: "keygen"): NodeListOf; getElementsByTagName(name: "label"): NodeListOf; getElementsByTagName(name: "legend"): NodeListOf; getElementsByTagName(name: "li"): NodeListOf; getElementsByTagName(name: "line"): NodeListOf; getElementsByTagName(name: "lineargradient"): NodeListOf; getElementsByTagName(name: "link"): NodeListOf; - getElementsByTagName(name: "listing"): NodeListOf; + getElementsByTagName(name: "listing"): NodeListOf; getElementsByTagName(name: "map"): NodeListOf; getElementsByTagName(name: "mark"): NodeListOf; getElementsByTagName(name: "marker"): NodeListOf; @@ -2896,9 +3574,10 @@ interface Element extends Node, GlobalEventHandlers, ElementTraversal, NodeSelec getElementsByTagName(name: "menu"): NodeListOf; getElementsByTagName(name: "meta"): NodeListOf; getElementsByTagName(name: "metadata"): NodeListOf; + getElementsByTagName(name: "meter"): NodeListOf; getElementsByTagName(name: "nav"): NodeListOf; - getElementsByTagName(name: "nextid"): NodeListOf; - getElementsByTagName(name: "nobr"): NodeListOf; + getElementsByTagName(name: "nextid"): NodeListOf; + getElementsByTagName(name: "nobr"): NodeListOf; getElementsByTagName(name: "noframes"): NodeListOf; getElementsByTagName(name: "noscript"): NodeListOf; getElementsByTagName(name: "object"): NodeListOf; @@ -2909,7 +3588,8 @@ interface Element extends Node, GlobalEventHandlers, ElementTraversal, NodeSelec getElementsByTagName(name: "param"): NodeListOf; getElementsByTagName(name: "path"): NodeListOf; getElementsByTagName(name: "pattern"): NodeListOf; - getElementsByTagName(name: "plaintext"): NodeListOf; + getElementsByTagName(name: "picture"): NodeListOf; + getElementsByTagName(name: "plaintext"): NodeListOf; getElementsByTagName(name: "polygon"): NodeListOf; getElementsByTagName(name: "polyline"): NodeListOf; getElementsByTagName(name: "pre"): NodeListOf; @@ -2917,28 +3597,29 @@ interface Element extends Node, GlobalEventHandlers, ElementTraversal, NodeSelec getElementsByTagName(name: "q"): NodeListOf; getElementsByTagName(name: "radialgradient"): NodeListOf; getElementsByTagName(name: "rect"): NodeListOf; - getElementsByTagName(name: "rt"): NodeListOf; - getElementsByTagName(name: "ruby"): NodeListOf; - getElementsByTagName(name: "s"): NodeListOf; - getElementsByTagName(name: "samp"): NodeListOf; + getElementsByTagName(name: "rt"): NodeListOf; + getElementsByTagName(name: "ruby"): NodeListOf; + getElementsByTagName(name: "s"): NodeListOf; + getElementsByTagName(name: "samp"): NodeListOf; getElementsByTagName(name: "script"): NodeListOf; getElementsByTagName(name: "section"): NodeListOf; getElementsByTagName(name: "select"): NodeListOf; - getElementsByTagName(name: "small"): NodeListOf; + getElementsByTagName(name: "small"): NodeListOf; getElementsByTagName(name: "source"): NodeListOf; getElementsByTagName(name: "span"): NodeListOf; getElementsByTagName(name: "stop"): NodeListOf; - getElementsByTagName(name: "strike"): NodeListOf; - getElementsByTagName(name: "strong"): NodeListOf; + getElementsByTagName(name: "strike"): NodeListOf; + getElementsByTagName(name: "strong"): NodeListOf; getElementsByTagName(name: "style"): NodeListOf; - getElementsByTagName(name: "sub"): NodeListOf; - getElementsByTagName(name: "sup"): NodeListOf; + getElementsByTagName(name: "sub"): NodeListOf; + getElementsByTagName(name: "sup"): NodeListOf; getElementsByTagName(name: "svg"): NodeListOf; getElementsByTagName(name: "switch"): NodeListOf; getElementsByTagName(name: "symbol"): NodeListOf; getElementsByTagName(name: "table"): NodeListOf; getElementsByTagName(name: "tbody"): NodeListOf; getElementsByTagName(name: "td"): NodeListOf; + getElementsByTagName(name: "template"): NodeListOf; getElementsByTagName(name: "text"): NodeListOf; getElementsByTagName(name: "textpath"): NodeListOf; getElementsByTagName(name: "textarea"): NodeListOf; @@ -2949,16 +3630,16 @@ interface Element extends Node, GlobalEventHandlers, ElementTraversal, NodeSelec getElementsByTagName(name: "tr"): NodeListOf; getElementsByTagName(name: "track"): NodeListOf; getElementsByTagName(name: "tspan"): NodeListOf; - getElementsByTagName(name: "tt"): NodeListOf; - getElementsByTagName(name: "u"): NodeListOf; + getElementsByTagName(name: "tt"): NodeListOf; + getElementsByTagName(name: "u"): NodeListOf; getElementsByTagName(name: "ul"): NodeListOf; getElementsByTagName(name: "use"): NodeListOf; - getElementsByTagName(name: "var"): NodeListOf; + getElementsByTagName(name: "var"): NodeListOf; getElementsByTagName(name: "video"): NodeListOf; getElementsByTagName(name: "view"): NodeListOf; getElementsByTagName(name: "wbr"): NodeListOf; getElementsByTagName(name: "x-ms-webview"): NodeListOf; - getElementsByTagName(name: "xmp"): NodeListOf; + getElementsByTagName(name: "xmp"): NodeListOf; getElementsByTagName(name: string): NodeListOf; getElementsByTagNameNS(namespaceURI: string, localName: string): NodeListOf; hasAttribute(name: string): boolean; @@ -3031,11 +3712,11 @@ declare var Element: { } interface ErrorEvent extends Event { - colno: number; - error: any; - filename: string; - lineno: number; - message: string; + readonly colno: number; + readonly error: any; + readonly filename: string; + readonly lineno: number; + readonly message: string; initErrorEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, messageArg: string, filenameArg: string, linenoArg: number): void; } @@ -3045,39 +3726,39 @@ declare var ErrorEvent: { } interface Event { - bubbles: boolean; + readonly bubbles: boolean; cancelBubble: boolean; - cancelable: boolean; - currentTarget: EventTarget; - defaultPrevented: boolean; - eventPhase: number; - isTrusted: boolean; + readonly cancelable: boolean; + readonly currentTarget: EventTarget; + readonly defaultPrevented: boolean; + readonly eventPhase: number; + readonly isTrusted: boolean; returnValue: boolean; - srcElement: Element; - target: EventTarget; - timeStamp: number; - type: string; + readonly srcElement: Element; + readonly target: EventTarget; + readonly timeStamp: number; + readonly type: string; initEvent(eventTypeArg: string, canBubbleArg: boolean, cancelableArg: boolean): void; preventDefault(): void; stopImmediatePropagation(): void; stopPropagation(): void; - AT_TARGET: number; - BUBBLING_PHASE: number; - CAPTURING_PHASE: number; + readonly AT_TARGET: number; + readonly BUBBLING_PHASE: number; + readonly CAPTURING_PHASE: number; } declare var Event: { prototype: Event; new(type: string, eventInitDict?: EventInit): Event; - AT_TARGET: number; - BUBBLING_PHASE: number; - CAPTURING_PHASE: number; + readonly AT_TARGET: number; + readonly BUBBLING_PHASE: number; + readonly CAPTURING_PHASE: number; } interface EventTarget { - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; + addEventListener(type: string, listener?: EventListenerOrEventListenerObject, useCapture?: boolean): void; dispatchEvent(evt: Event): boolean; - removeEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; + removeEventListener(type: string, listener?: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var EventTarget: { @@ -3094,8 +3775,9 @@ declare var External: { } interface File extends Blob { - lastModifiedDate: any; - name: string; + readonly lastModifiedDate: any; + readonly name: string; + readonly webkitRelativePath: string; } declare var File: { @@ -3104,7 +3786,7 @@ declare var File: { } interface FileList { - length: number; + readonly length: number; item(index: number): File; [index: number]: File; } @@ -3115,7 +3797,7 @@ declare var FileList: { } interface FileReader extends EventTarget, MSBaseReader { - error: DOMError; + readonly error: DOMError; readAsArrayBuffer(blob: Blob): void; readAsBinaryString(blob: Blob): void; readAsDataURL(blob: Blob): void; @@ -3129,7 +3811,7 @@ declare var FileReader: { } interface FocusEvent extends UIEvent { - relatedTarget: EventTarget; + readonly relatedTarget: EventTarget; initFocusEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, relatedTargetArg: EventTarget): void; } @@ -3148,7 +3830,7 @@ declare var FormData: { } interface GainNode extends AudioNode { - gain: AudioParam; + readonly gain: AudioParam; } declare var GainNode: { @@ -3157,13 +3839,13 @@ declare var GainNode: { } interface Gamepad { - axes: number[]; - buttons: GamepadButton[]; - connected: boolean; - id: string; - index: number; - mapping: string; - timestamp: number; + readonly axes: number[]; + readonly buttons: GamepadButton[]; + readonly connected: boolean; + readonly id: string; + readonly index: number; + readonly mapping: string; + readonly timestamp: number; } declare var Gamepad: { @@ -3172,8 +3854,8 @@ declare var Gamepad: { } interface GamepadButton { - pressed: boolean; - value: number; + readonly pressed: boolean; + readonly value: number; } declare var GamepadButton: { @@ -3182,7 +3864,7 @@ declare var GamepadButton: { } interface GamepadEvent extends Event { - gamepad: Gamepad; + readonly gamepad: Gamepad; } declare var GamepadEvent: { @@ -3220,6 +3902,7 @@ interface HTMLAnchorElement extends HTMLElement { * Sets or retrieves the coordinates of the object. */ coords: string; + download: string; /** * Contains the anchor portion of the URL including the hash sign (#). */ @@ -3240,12 +3923,12 @@ interface HTMLAnchorElement extends HTMLElement { * Sets or retrieves the language code of the object. */ hreflang: string; - mimeType: string; + readonly mimeType: string; /** * Sets or retrieves the shape of the object. */ name: string; - nameProp: string; + readonly nameProp: string; /** * Contains the pathname of the URL. */ @@ -3258,7 +3941,7 @@ interface HTMLAnchorElement extends HTMLElement { * Contains the protocol of the URL. */ protocol: string; - protocolLong: string; + readonly protocolLong: string; /** * Sets or retrieves the relationship between the object and the destination of the link. */ @@ -3300,7 +3983,7 @@ interface HTMLAppletElement extends HTMLElement { /** * 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. */ - BaseHref: string; + readonly BaseHref: string; align: string; /** * Sets or retrieves a text alternative to the graphic. @@ -3327,7 +4010,7 @@ interface HTMLAppletElement extends HTMLElement { /** * Address of a pointer to the document this page or frame contains. If there is no document, then null will be returned. */ - contentDocument: Document; + readonly contentDocument: Document; /** * Sets or retrieves the URL that references the data of the object. */ @@ -3336,7 +4019,7 @@ interface HTMLAppletElement extends HTMLElement { * Sets or retrieves a character string that can be used to implement your own declare functionality for the object. */ declare: boolean; - form: HTMLFormElement; + readonly form: HTMLFormElement; /** * Sets or retrieves the height of the object. */ @@ -3377,6 +4060,7 @@ interface HTMLAreaElement extends HTMLElement { * Sets or retrieves the coordinates of the object. */ coords: string; + download: string; /** * Sets or retrieves the subsection of the href property that follows the number sign (#). */ @@ -3502,23 +4186,6 @@ declare var HTMLBaseFontElement: { new(): HTMLBaseFontElement; } -interface HTMLBlockElement extends HTMLElement { - /** - * Sets or retrieves reference information about the object. - */ - cite: string; - clear: string; - /** - * Sets or retrieves the width of the object. - */ - width: number; -} - -declare var HTMLBlockElement: { - prototype: HTMLBlockElement; - new(): HTMLBlockElement; -} - interface HTMLBodyElement extends HTMLElement { aLink: any; background: string; @@ -3546,7 +4213,6 @@ interface HTMLBodyElement extends HTMLElement { onunload: (ev: Event) => any; text: any; vLink: any; - createTextRange(): TextRange; addEventListener(type: "MSContentZoom", listener: (ev: UIEvent) => any, useCapture?: boolean): void; addEventListener(type: "MSGestureChange", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void; addEventListener(type: "MSGestureDoubleTap", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void; @@ -3571,10 +4237,10 @@ interface HTMLBodyElement extends HTMLElement { addEventListener(type: "afterprint", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "ariarequest", listener: (ev: AriaRequestEvent) => any, useCapture?: boolean): void; addEventListener(type: "beforeactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecopy", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecut", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforecopy", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforecut", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "beforedeactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforepaste", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforepaste", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "beforeprint", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "beforeunload", listener: (ev: BeforeUnloadEvent) => any, useCapture?: boolean): void; addEventListener(type: "blur", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; @@ -3585,9 +4251,9 @@ interface HTMLBodyElement extends HTMLElement { addEventListener(type: "click", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "command", listener: (ev: CommandEvent) => any, useCapture?: boolean): void; addEventListener(type: "contextmenu", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "copy", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "copy", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "cuechange", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "cut", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "cut", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "dblclick", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "deactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; addEventListener(type: "drag", listener: (ev: DragEvent) => any, useCapture?: boolean): void; @@ -3599,7 +4265,7 @@ interface HTMLBodyElement extends HTMLElement { addEventListener(type: "drop", listener: (ev: DragEvent) => any, useCapture?: boolean): void; addEventListener(type: "durationchange", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "emptied", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "ended", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "ended", listener: (ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: "focus", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; @@ -3607,6 +4273,7 @@ interface HTMLBodyElement extends HTMLElement { addEventListener(type: "gotpointercapture", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; addEventListener(type: "hashchange", listener: (ev: HashChangeEvent) => any, useCapture?: boolean): void; addEventListener(type: "input", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "invalid", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "keydown", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "keypress", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "keyup", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; @@ -3624,13 +4291,13 @@ interface HTMLBodyElement extends HTMLElement { addEventListener(type: "mouseout", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "mouseover", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "mouseup", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousewheel", listener: (ev: MouseWheelEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mousewheel", listener: (ev: WheelEvent) => any, useCapture?: boolean): void; addEventListener(type: "offline", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "online", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "orientationchange", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "pagehide", listener: (ev: PageTransitionEvent) => any, useCapture?: boolean): void; addEventListener(type: "pageshow", listener: (ev: PageTransitionEvent) => any, useCapture?: boolean): void; - addEventListener(type: "paste", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "paste", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "pause", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "play", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "playing", listener: (ev: Event) => any, useCapture?: boolean): void; @@ -3684,7 +4351,7 @@ interface HTMLButtonElement extends HTMLElement { /** * Retrieves a reference to the form that the object is embedded in. */ - form: HTMLFormElement; + readonly form: HTMLFormElement; /** * Overrides the action attribute (where the data on a form is sent) on the parent form element. */ @@ -3717,11 +4384,11 @@ interface HTMLButtonElement extends HTMLElement { /** * 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. */ - validationMessage: string; + readonly validationMessage: string; /** * Returns a ValidityState object that represents the validity states of an element. */ - validity: ValidityState; + readonly validity: ValidityState; /** * Sets or retrieves the default or selected value of the control. */ @@ -3729,15 +4396,11 @@ interface HTMLButtonElement extends HTMLElement { /** * Returns whether an element will successfully validate based on forms validation rules and constraints. */ - willValidate: boolean; + readonly willValidate: boolean; /** * Returns whether a form will validate when it is submitted, without having to submit it. */ checkValidity(): boolean; - /** - * Creates a TextRange object for the element. - */ - createTextRange(): TextRange; /** * Sets a custom error message that is displayed when a form is submitted. * @param error Sets a custom error message that is displayed when a form is submitted. @@ -3787,11 +4450,11 @@ interface HTMLCollection { /** * Sets or retrieves the number of objects in a collection. */ - length: number; + readonly length: number; /** * Retrieves an object from various collections. */ - item(nameOrIndex?: any, optionalIndex?: any): Element; + item(index: number): Element; /** * Retrieves a select object or an object from an options collection. */ @@ -3804,18 +4467,6 @@ declare var HTMLCollection: { new(): HTMLCollection; } -interface HTMLDDElement extends HTMLElement { - /** - * Sets or retrieves whether the browser automatically performs wordwrap. - */ - noWrap: boolean; -} - -declare var HTMLDDElement: { - prototype: HTMLDDElement; - new(): HTMLDDElement; -} - interface HTMLDListElement extends HTMLElement { compact: boolean; } @@ -3825,20 +4476,8 @@ declare var HTMLDListElement: { new(): HTMLDListElement; } -interface HTMLDTElement extends HTMLElement { - /** - * Sets or retrieves whether the browser automatically performs wordwrap. - */ - noWrap: boolean; -} - -declare var HTMLDTElement: { - prototype: HTMLDTElement; - new(): HTMLDTElement; -} - interface HTMLDataListElement extends HTMLElement { - options: HTMLCollection; + options: HTMLCollectionOf; } declare var HTMLDataListElement: { @@ -3881,38 +4520,38 @@ declare var HTMLDocument: { interface HTMLElement extends Element { accessKey: string; - children: HTMLCollection; + readonly children: HTMLCollection; contentEditable: string; - dataset: DOMStringMap; + readonly dataset: DOMStringMap; dir: string; draggable: boolean; hidden: boolean; hideFocus: boolean; innerHTML: string; innerText: string; - isContentEditable: boolean; + readonly isContentEditable: boolean; lang: string; - offsetHeight: number; - offsetLeft: number; - offsetParent: Element; - offsetTop: number; - offsetWidth: number; + readonly offsetHeight: number; + readonly offsetLeft: number; + readonly offsetParent: Element; + readonly offsetTop: number; + readonly offsetWidth: number; onabort: (ev: Event) => any; onactivate: (ev: UIEvent) => any; onbeforeactivate: (ev: UIEvent) => any; - onbeforecopy: (ev: DragEvent) => any; - onbeforecut: (ev: DragEvent) => any; + onbeforecopy: (ev: ClipboardEvent) => any; + onbeforecut: (ev: ClipboardEvent) => any; onbeforedeactivate: (ev: UIEvent) => any; - onbeforepaste: (ev: DragEvent) => any; + onbeforepaste: (ev: ClipboardEvent) => any; onblur: (ev: FocusEvent) => any; oncanplay: (ev: Event) => any; oncanplaythrough: (ev: Event) => any; onchange: (ev: Event) => any; onclick: (ev: MouseEvent) => any; oncontextmenu: (ev: PointerEvent) => any; - oncopy: (ev: DragEvent) => any; + oncopy: (ev: ClipboardEvent) => any; oncuechange: (ev: Event) => any; - oncut: (ev: DragEvent) => any; + oncut: (ev: ClipboardEvent) => any; ondblclick: (ev: MouseEvent) => any; ondeactivate: (ev: UIEvent) => any; ondrag: (ev: DragEvent) => any; @@ -3924,10 +4563,11 @@ interface HTMLElement extends Element { ondrop: (ev: DragEvent) => any; ondurationchange: (ev: Event) => any; onemptied: (ev: Event) => any; - onended: (ev: Event) => any; + onended: (ev: MediaStreamErrorEvent) => any; onerror: (ev: Event) => any; onfocus: (ev: FocusEvent) => any; oninput: (ev: Event) => any; + oninvalid: (ev: Event) => any; onkeydown: (ev: KeyboardEvent) => any; onkeypress: (ev: KeyboardEvent) => any; onkeyup: (ev: KeyboardEvent) => any; @@ -3942,10 +4582,10 @@ interface HTMLElement extends Element { onmouseout: (ev: MouseEvent) => any; onmouseover: (ev: MouseEvent) => any; onmouseup: (ev: MouseEvent) => any; - onmousewheel: (ev: MouseWheelEvent) => any; + onmousewheel: (ev: WheelEvent) => any; onmscontentzoom: (ev: UIEvent) => any; onmsmanipulationstatechanged: (ev: MSManipulationEvent) => any; - onpaste: (ev: DragEvent) => any; + onpaste: (ev: ClipboardEvent) => any; onpause: (ev: Event) => any; onplay: (ev: Event) => any; onplaying: (ev: Event) => any; @@ -3966,7 +4606,7 @@ interface HTMLElement extends Element { outerHTML: string; outerText: string; spellcheck: boolean; - style: CSSStyleDeclaration; + readonly style: CSSStyleDeclaration; tabIndex: number; title: string; blur(): void; @@ -4002,10 +4642,10 @@ interface HTMLElement extends Element { addEventListener(type: "activate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; addEventListener(type: "ariarequest", listener: (ev: AriaRequestEvent) => any, useCapture?: boolean): void; addEventListener(type: "beforeactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecopy", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecut", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforecopy", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforecut", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "beforedeactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforepaste", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforepaste", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "blur", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; addEventListener(type: "canplay", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "canplaythrough", listener: (ev: Event) => any, useCapture?: boolean): void; @@ -4013,9 +4653,9 @@ interface HTMLElement extends Element { addEventListener(type: "click", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "command", listener: (ev: CommandEvent) => any, useCapture?: boolean): void; addEventListener(type: "contextmenu", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "copy", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "copy", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "cuechange", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "cut", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "cut", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "dblclick", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "deactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; addEventListener(type: "drag", listener: (ev: DragEvent) => any, useCapture?: boolean): void; @@ -4027,11 +4667,12 @@ interface HTMLElement extends Element { addEventListener(type: "drop", listener: (ev: DragEvent) => any, useCapture?: boolean): void; addEventListener(type: "durationchange", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "emptied", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "ended", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "ended", listener: (ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: "focus", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; addEventListener(type: "gotpointercapture", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; addEventListener(type: "input", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "invalid", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "keydown", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "keypress", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "keyup", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; @@ -4047,8 +4688,8 @@ interface HTMLElement extends Element { addEventListener(type: "mouseout", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "mouseover", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "mouseup", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousewheel", listener: (ev: MouseWheelEvent) => any, useCapture?: boolean): void; - addEventListener(type: "paste", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mousewheel", listener: (ev: WheelEvent) => any, useCapture?: boolean): void; + addEventListener(type: "paste", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "pause", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "play", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "playing", listener: (ev: Event) => any, useCapture?: boolean): void; @@ -4110,7 +4751,7 @@ interface HTMLEmbedElement extends HTMLElement, GetSVGDocument { /** * Gets the source associated with the media element for use by the PlayToManager. */ - msPlayToSource: any; + readonly msPlayToSource: any; /** * Sets or retrieves the name of the object. */ @@ -4118,12 +4759,12 @@ interface HTMLEmbedElement extends HTMLElement, GetSVGDocument { /** * Retrieves the palette used for the embedded document. */ - palette: string; + readonly palette: string; /** * Retrieves the URL of the plug-in used to view an embedded document. */ - pluginspage: string; - readyState: string; + readonly pluginspage: string; + readonly readyState: string; /** * Sets or retrieves a URL to be loaded by the object. */ @@ -4153,19 +4794,19 @@ interface HTMLFieldSetElement extends HTMLElement { /** * Retrieves a reference to the form that the object is embedded in. */ - form: HTMLFormElement; + readonly form: HTMLFormElement; /** * 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. */ - validationMessage: string; + readonly validationMessage: string; /** * Returns a ValidityState object that represents the validity states of an element. */ - validity: ValidityState; + readonly validity: ValidityState; /** * Returns whether an element will successfully validate based on forms validation rules and constraints. */ - willValidate: boolean; + readonly willValidate: boolean; /** * Returns whether a form will validate when it is submitted, without having to submit it. */ @@ -4211,7 +4852,7 @@ interface HTMLFormElement extends HTMLElement { /** * Retrieves a collection, in source order, of all controls in a given form. */ - elements: HTMLCollection; + readonly elements: HTMLCollection; /** * Sets or retrieves the MIME encoding for the form. */ @@ -4223,7 +4864,7 @@ interface HTMLFormElement extends HTMLElement { /** * Sets or retrieves the number of objects in a collection. */ - length: number; + readonly length: number; /** * Sets or retrieves how to send the form data to the server. */ @@ -4282,11 +4923,11 @@ interface HTMLFrameElement extends HTMLElement, GetSVGDocument { /** * Retrieves the document object of the page or frame. */ - contentDocument: Document; + readonly contentDocument: Document; /** * Retrieves the object of the specified. */ - contentWindow: Window; + readonly contentWindow: Window; /** * Sets or retrieves whether to display a border for the frame. */ @@ -4327,10 +4968,6 @@ interface HTMLFrameElement extends HTMLElement, GetSVGDocument { * Sets or retrieves whether the frame can be scrolled. */ scrolling: string; - /** - * Sets the value indicating whether the source file of a frame or iframe has specific security restrictions applied. - */ - security: any; /** * Sets or retrieves a URL to be loaded by the object. */ @@ -4362,10 +4999,10 @@ interface HTMLFrameElement extends HTMLElement, GetSVGDocument { addEventListener(type: "activate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; addEventListener(type: "ariarequest", listener: (ev: AriaRequestEvent) => any, useCapture?: boolean): void; addEventListener(type: "beforeactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecopy", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecut", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforecopy", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforecut", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "beforedeactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforepaste", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforepaste", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "blur", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; addEventListener(type: "canplay", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "canplaythrough", listener: (ev: Event) => any, useCapture?: boolean): void; @@ -4373,9 +5010,9 @@ interface HTMLFrameElement extends HTMLElement, GetSVGDocument { addEventListener(type: "click", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "command", listener: (ev: CommandEvent) => any, useCapture?: boolean): void; addEventListener(type: "contextmenu", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "copy", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "copy", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "cuechange", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "cut", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "cut", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "dblclick", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "deactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; addEventListener(type: "drag", listener: (ev: DragEvent) => any, useCapture?: boolean): void; @@ -4387,11 +5024,12 @@ interface HTMLFrameElement extends HTMLElement, GetSVGDocument { addEventListener(type: "drop", listener: (ev: DragEvent) => any, useCapture?: boolean): void; addEventListener(type: "durationchange", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "emptied", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "ended", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "ended", listener: (ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: "focus", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; addEventListener(type: "gotpointercapture", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; addEventListener(type: "input", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "invalid", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "keydown", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "keypress", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "keyup", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; @@ -4408,8 +5046,8 @@ interface HTMLFrameElement extends HTMLElement, GetSVGDocument { addEventListener(type: "mouseout", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "mouseover", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "mouseup", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousewheel", listener: (ev: MouseWheelEvent) => any, useCapture?: boolean): void; - addEventListener(type: "paste", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mousewheel", listener: (ev: WheelEvent) => any, useCapture?: boolean): void; + addEventListener(type: "paste", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "pause", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "play", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "playing", listener: (ev: Event) => any, useCapture?: boolean): void; @@ -4519,10 +5157,10 @@ interface HTMLFrameSetElement extends HTMLElement { addEventListener(type: "activate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; addEventListener(type: "ariarequest", listener: (ev: AriaRequestEvent) => any, useCapture?: boolean): void; addEventListener(type: "beforeactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecopy", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecut", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforecopy", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforecut", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "beforedeactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforepaste", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforepaste", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "beforeprint", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "beforeunload", listener: (ev: BeforeUnloadEvent) => any, useCapture?: boolean): void; addEventListener(type: "blur", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; @@ -4533,9 +5171,9 @@ interface HTMLFrameSetElement extends HTMLElement { addEventListener(type: "click", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "command", listener: (ev: CommandEvent) => any, useCapture?: boolean): void; addEventListener(type: "contextmenu", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "copy", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "copy", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "cuechange", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "cut", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "cut", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "dblclick", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "deactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; addEventListener(type: "drag", listener: (ev: DragEvent) => any, useCapture?: boolean): void; @@ -4547,7 +5185,7 @@ interface HTMLFrameSetElement extends HTMLElement { addEventListener(type: "drop", listener: (ev: DragEvent) => any, useCapture?: boolean): void; addEventListener(type: "durationchange", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "emptied", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "ended", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "ended", listener: (ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: "focus", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; @@ -4555,6 +5193,7 @@ interface HTMLFrameSetElement extends HTMLElement { addEventListener(type: "gotpointercapture", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; addEventListener(type: "hashchange", listener: (ev: HashChangeEvent) => any, useCapture?: boolean): void; addEventListener(type: "input", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "invalid", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "keydown", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "keypress", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "keyup", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; @@ -4572,13 +5211,13 @@ interface HTMLFrameSetElement extends HTMLElement { addEventListener(type: "mouseout", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "mouseover", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "mouseup", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousewheel", listener: (ev: MouseWheelEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mousewheel", listener: (ev: WheelEvent) => any, useCapture?: boolean): void; addEventListener(type: "offline", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "online", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "orientationchange", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "pagehide", listener: (ev: PageTransitionEvent) => any, useCapture?: boolean): void; addEventListener(type: "pageshow", listener: (ev: PageTransitionEvent) => any, useCapture?: boolean): void; - addEventListener(type: "paste", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "paste", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "pause", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "play", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "playing", listener: (ev: Event) => any, useCapture?: boolean): void; @@ -4657,7 +5296,6 @@ interface HTMLHeadingElement extends HTMLElement { * Sets or retrieves a value that indicates the table alignment. */ align: string; - clear: string; } declare var HTMLHeadingElement: { @@ -4690,11 +5328,11 @@ interface HTMLIFrameElement extends HTMLElement, GetSVGDocument { /** * Retrieves the document object of the page or frame. */ - contentDocument: Document; + readonly contentDocument: Document; /** * Retrieves the object of the specified. */ - contentWindow: Window; + readonly contentWindow: Window; /** * Sets or retrieves whether to display a border for the frame. */ @@ -4735,15 +5373,11 @@ interface HTMLIFrameElement extends HTMLElement, GetSVGDocument { * Raised when the object has been completely received from the server. */ onload: (ev: Event) => any; - sandbox: DOMSettableTokenList; + readonly sandbox: DOMSettableTokenList; /** * Sets or retrieves whether the frame can be scrolled. */ scrolling: string; - /** - * Sets the value indicating whether the source file of a frame or iframe has specific security restrictions applied. - */ - security: any; /** * Sets or retrieves a URL to be loaded by the object. */ @@ -4779,10 +5413,10 @@ interface HTMLIFrameElement extends HTMLElement, GetSVGDocument { addEventListener(type: "activate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; addEventListener(type: "ariarequest", listener: (ev: AriaRequestEvent) => any, useCapture?: boolean): void; addEventListener(type: "beforeactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecopy", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecut", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforecopy", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforecut", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "beforedeactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforepaste", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforepaste", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "blur", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; addEventListener(type: "canplay", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "canplaythrough", listener: (ev: Event) => any, useCapture?: boolean): void; @@ -4790,9 +5424,9 @@ interface HTMLIFrameElement extends HTMLElement, GetSVGDocument { addEventListener(type: "click", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "command", listener: (ev: CommandEvent) => any, useCapture?: boolean): void; addEventListener(type: "contextmenu", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "copy", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "copy", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "cuechange", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "cut", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "cut", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "dblclick", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "deactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; addEventListener(type: "drag", listener: (ev: DragEvent) => any, useCapture?: boolean): void; @@ -4804,11 +5438,12 @@ interface HTMLIFrameElement extends HTMLElement, GetSVGDocument { addEventListener(type: "drop", listener: (ev: DragEvent) => any, useCapture?: boolean): void; addEventListener(type: "durationchange", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "emptied", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "ended", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "ended", listener: (ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: "focus", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; addEventListener(type: "gotpointercapture", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; addEventListener(type: "input", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "invalid", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "keydown", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "keypress", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "keyup", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; @@ -4825,8 +5460,8 @@ interface HTMLIFrameElement extends HTMLElement, GetSVGDocument { addEventListener(type: "mouseout", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "mouseover", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "mouseup", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousewheel", listener: (ev: MouseWheelEvent) => any, useCapture?: boolean): void; - addEventListener(type: "paste", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mousewheel", listener: (ev: WheelEvent) => any, useCapture?: boolean): void; + addEventListener(type: "paste", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "pause", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "play", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "playing", listener: (ev: Event) => any, useCapture?: boolean): void; @@ -4883,9 +5518,9 @@ interface HTMLImageElement extends HTMLElement { /** * Retrieves whether the object is fully loaded. */ - complete: boolean; + readonly complete: boolean; crossOrigin: string; - currentSrc: string; + readonly currentSrc: string; /** * Sets or retrieves the height of the object. */ @@ -4902,6 +5537,7 @@ interface HTMLImageElement extends HTMLElement { * Sets or retrieves a Uniform Resource Identifier (URI) to a long description of the object. */ longDesc: string; + lowsrc: string; /** * Gets or sets whether the DLNA PlayTo device is available. */ @@ -4914,7 +5550,7 @@ interface HTMLImageElement extends HTMLElement { /** * Gets the source associated with the media element for use by the PlayToManager. */ - msPlayToSource: any; + readonly msPlayToSource: any; /** * Sets or retrieves the name of the object. */ @@ -4922,11 +5558,12 @@ interface HTMLImageElement extends HTMLElement { /** * The original height of the image resource before sizing. */ - naturalHeight: number; + readonly naturalHeight: number; /** * The original width of the image resource before sizing. */ - naturalWidth: number; + readonly naturalWidth: number; + sizes: string; /** * The address or URL of the a media resource that is to be considered. */ @@ -4944,8 +5581,8 @@ interface HTMLImageElement extends HTMLElement { * Sets or retrieves the width of the object. */ width: number; - x: number; - y: number; + readonly x: number; + readonly y: number; msGetAsCastingSource(): any; } @@ -4987,7 +5624,7 @@ interface HTMLInputElement extends HTMLElement { /** * Retrieves whether the object is fully loaded. */ - complete: boolean; + readonly complete: boolean; /** * Sets or retrieves the state of the check box or radio button. */ @@ -5000,11 +5637,11 @@ interface HTMLInputElement extends HTMLElement { /** * Returns a FileList object on a file type input object. */ - files: FileList; + readonly files: FileList; /** * Retrieves a reference to the form that the object is embedded in. */ - form: HTMLFormElement; + readonly form: HTMLFormElement; /** * Overrides the action attribute (where the data on a form is sent) on the parent form element. */ @@ -5037,7 +5674,7 @@ interface HTMLInputElement extends HTMLElement { /** * Specifies the ID of a pre-defined datalist of options for an input element. */ - list: HTMLElement; + readonly list: HTMLElement; /** * 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. */ @@ -5071,6 +5708,7 @@ interface HTMLInputElement extends HTMLElement { * When present, marks an element that can't be submitted without a value. */ required: boolean; + selectionDirection: string; /** * Gets or sets the end position or offset of a text selection. */ @@ -5100,11 +5738,11 @@ interface HTMLInputElement extends HTMLElement { /** * 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. */ - validationMessage: string; + readonly validationMessage: string; /** * Returns a ValidityState object that represents the validity states of an element. */ - validity: ValidityState; + readonly validity: ValidityState; /** * Returns the value of the data at the cursor's current position. */ @@ -5118,6 +5756,7 @@ interface HTMLInputElement extends HTMLElement { * Sets or retrieves the vertical margin for the object. */ vspace: number; + webkitdirectory: boolean; /** * Sets or retrieves the width of the object. */ @@ -5125,15 +5764,12 @@ interface HTMLInputElement extends HTMLElement { /** * Returns whether an element will successfully validate based on forms validation rules and constraints. */ - willValidate: boolean; + readonly willValidate: boolean; + minLength: number; /** * Returns whether a form will validate when it is submitted, without having to submit it. */ checkValidity(): boolean; - /** - * Creates a TextRange object for the element. - */ - createTextRange(): TextRange; /** * Makes the selection equal to the current object. */ @@ -5148,7 +5784,7 @@ interface HTMLInputElement extends HTMLElement { * @param start The offset into the text field for the start of the selection. * @param end The offset into the text field for the end of the selection. */ - setSelectionRange(start: number, end: number): void; + setSelectionRange(start?: number, end?: number, direction?: string): void; /** * 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. * @param n Value to decrement the value by. @@ -5166,23 +5802,6 @@ declare var HTMLInputElement: { new(): HTMLInputElement; } -interface HTMLIsIndexElement extends HTMLElement { - /** - * Sets or retrieves the URL to which the form content is sent for processing. - */ - action: string; - /** - * Retrieves a reference to the form that the object is embedded in. - */ - form: HTMLFormElement; - prompt: string; -} - -declare var HTMLIsIndexElement: { - prototype: HTMLIsIndexElement; - new(): HTMLIsIndexElement; -} - interface HTMLLIElement extends HTMLElement { type: string; /** @@ -5200,7 +5819,7 @@ interface HTMLLabelElement extends HTMLElement { /** * Retrieves a reference to the form that the object is embedded in. */ - form: HTMLFormElement; + readonly form: HTMLFormElement; /** * Sets or retrieves the object to which the given label object is assigned. */ @@ -5220,7 +5839,7 @@ interface HTMLLegendElement extends HTMLElement { /** * Retrieves a reference to the form that the object is embedded in. */ - form: HTMLFormElement; + readonly form: HTMLFormElement; } declare var HTMLLegendElement: { @@ -5262,6 +5881,7 @@ interface HTMLLinkElement extends HTMLElement, LinkStyle { * Sets or retrieves the MIME type of the object. */ type: string; + import?: Document; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -5274,7 +5894,7 @@ interface HTMLMapElement extends HTMLElement { /** * Retrieves a collection of the area objects defined for the given map object. */ - areas: HTMLAreasCollection; + readonly areas: HTMLAreasCollection; /** * Sets or retrieves the name of the object. */ @@ -5326,10 +5946,10 @@ interface HTMLMarqueeElement extends HTMLElement { addEventListener(type: "activate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; addEventListener(type: "ariarequest", listener: (ev: AriaRequestEvent) => any, useCapture?: boolean): void; addEventListener(type: "beforeactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecopy", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecut", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforecopy", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforecut", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "beforedeactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforepaste", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforepaste", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "blur", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; addEventListener(type: "bounce", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "canplay", listener: (ev: Event) => any, useCapture?: boolean): void; @@ -5338,9 +5958,9 @@ interface HTMLMarqueeElement extends HTMLElement { addEventListener(type: "click", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "command", listener: (ev: CommandEvent) => any, useCapture?: boolean): void; addEventListener(type: "contextmenu", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "copy", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "copy", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "cuechange", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "cut", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "cut", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "dblclick", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "deactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; addEventListener(type: "drag", listener: (ev: DragEvent) => any, useCapture?: boolean): void; @@ -5352,12 +5972,13 @@ interface HTMLMarqueeElement extends HTMLElement { addEventListener(type: "drop", listener: (ev: DragEvent) => any, useCapture?: boolean): void; addEventListener(type: "durationchange", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "emptied", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "ended", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "ended", listener: (ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: "finish", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "focus", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; addEventListener(type: "gotpointercapture", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; addEventListener(type: "input", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "invalid", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "keydown", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "keypress", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "keyup", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; @@ -5373,8 +5994,8 @@ interface HTMLMarqueeElement extends HTMLElement { addEventListener(type: "mouseout", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "mouseover", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "mouseup", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousewheel", listener: (ev: MouseWheelEvent) => any, useCapture?: boolean): void; - addEventListener(type: "paste", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mousewheel", listener: (ev: WheelEvent) => any, useCapture?: boolean): void; + addEventListener(type: "paste", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "pause", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "play", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "playing", listener: (ev: Event) => any, useCapture?: boolean): void; @@ -5420,7 +6041,7 @@ interface HTMLMediaElement extends HTMLElement { /** * Returns an AudioTrackList object with the audio tracks for a given video element. */ - audioTracks: AudioTrackList; + readonly audioTracks: AudioTrackList; /** * Gets or sets a value that indicates whether to start playing the media automatically. */ @@ -5428,15 +6049,16 @@ interface HTMLMediaElement extends HTMLElement { /** * Gets a collection of buffered time ranges. */ - buffered: TimeRanges; + readonly buffered: TimeRanges; /** * 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). */ controls: boolean; + crossOrigin: string; /** * Gets the address or URL of the current media resource that is selected by IHTMLMediaElement. */ - currentSrc: string; + readonly currentSrc: string; /** * Gets or sets the current playback position, in seconds. */ @@ -5449,19 +6071,20 @@ interface HTMLMediaElement extends HTMLElement { /** * 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. */ - duration: number; + readonly duration: number; /** * Gets information about whether the playback has ended or not. */ - ended: boolean; + readonly ended: boolean; /** * Returns an object representing the current error state of the audio or video element. */ - error: MediaError; + readonly error: MediaError; /** * Gets or sets a flag to specify whether playback should restart after it completes. */ loop: boolean; + readonly mediaKeys: MediaKeys; /** * Specifies the purpose of the audio or video media, such as background audio or alerts. */ @@ -5470,11 +6093,11 @@ interface HTMLMediaElement extends HTMLElement { * Specifies the output device id that the audio will be sent to. */ msAudioDeviceType: string; - msGraphicsTrustStatus: MSGraphicsTrust; + readonly msGraphicsTrustStatus: MSGraphicsTrust; /** * Gets the MSMediaKeys object, which is used for decrypting media data, that is associated with this media element. */ - msKeys: MSMediaKeys; + readonly msKeys: MSMediaKeys; /** * Gets or sets whether the DLNA PlayTo device is available. */ @@ -5490,7 +6113,7 @@ interface HTMLMediaElement extends HTMLElement { /** * Gets the source associated with the media element for use by the PlayToManager. */ - msPlayToSource: any; + readonly msPlayToSource: any; /** * Specifies whether or not to enable low-latency playback on the media element. */ @@ -5502,12 +6125,13 @@ interface HTMLMediaElement extends HTMLElement { /** * Gets the current network activity for the element. */ - networkState: number; + readonly networkState: number; + onencrypted: (ev: MediaEncryptedEvent) => any; onmsneedkey: (ev: MSMediaKeyNeededEvent) => any; /** * Gets a flag that specifies whether playback is paused. */ - paused: boolean; + readonly paused: boolean; /** * 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. */ @@ -5515,7 +6139,7 @@ interface HTMLMediaElement extends HTMLElement { /** * Gets TimeRanges for the current media resource that has been played. */ - played: TimeRanges; + readonly played: TimeRanges; /** * Gets or sets the current playback position, in seconds. */ @@ -5524,17 +6148,18 @@ interface HTMLMediaElement extends HTMLElement { /** * Returns a TimeRanges object that represents the ranges of the current media resource that can be seeked. */ - seekable: TimeRanges; + readonly seekable: TimeRanges; /** * Gets a flag that indicates whether the the client is currently moving to a new playback position in the media resource. */ - seeking: boolean; + readonly seeking: boolean; /** * The address or URL of the a media resource that is to be considered. */ src: string; - textTracks: TextTrackList; - videoTracks: VideoTrackList; + srcObject: MediaStream; + readonly textTracks: TextTrackList; + readonly videoTracks: VideoTrackList; /** * Gets or sets the volume level for audio portions of the media element. */ @@ -5570,15 +6195,16 @@ interface HTMLMediaElement extends HTMLElement { * Loads and starts playback of a media resource. */ play(): void; - HAVE_CURRENT_DATA: number; - HAVE_ENOUGH_DATA: number; - HAVE_FUTURE_DATA: number; - HAVE_METADATA: number; - HAVE_NOTHING: number; - NETWORK_EMPTY: number; - NETWORK_IDLE: number; - NETWORK_LOADING: number; - NETWORK_NO_SOURCE: number; + setMediaKeys(mediaKeys: MediaKeys): PromiseLike; + readonly HAVE_CURRENT_DATA: number; + readonly HAVE_ENOUGH_DATA: number; + readonly HAVE_FUTURE_DATA: number; + readonly HAVE_METADATA: number; + readonly HAVE_NOTHING: number; + readonly NETWORK_EMPTY: number; + readonly NETWORK_IDLE: number; + readonly NETWORK_LOADING: number; + readonly NETWORK_NO_SOURCE: number; addEventListener(type: "MSContentZoom", listener: (ev: UIEvent) => any, useCapture?: boolean): void; addEventListener(type: "MSGestureChange", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void; addEventListener(type: "MSGestureDoubleTap", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void; @@ -5602,10 +6228,10 @@ interface HTMLMediaElement extends HTMLElement { addEventListener(type: "activate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; addEventListener(type: "ariarequest", listener: (ev: AriaRequestEvent) => any, useCapture?: boolean): void; addEventListener(type: "beforeactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecopy", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecut", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforecopy", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforecut", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "beforedeactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforepaste", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforepaste", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "blur", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; addEventListener(type: "canplay", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "canplaythrough", listener: (ev: Event) => any, useCapture?: boolean): void; @@ -5613,9 +6239,9 @@ interface HTMLMediaElement extends HTMLElement { addEventListener(type: "click", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "command", listener: (ev: CommandEvent) => any, useCapture?: boolean): void; addEventListener(type: "contextmenu", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "copy", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "copy", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "cuechange", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "cut", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "cut", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "dblclick", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "deactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; addEventListener(type: "drag", listener: (ev: DragEvent) => any, useCapture?: boolean): void; @@ -5627,11 +6253,13 @@ interface HTMLMediaElement extends HTMLElement { addEventListener(type: "drop", listener: (ev: DragEvent) => any, useCapture?: boolean): void; addEventListener(type: "durationchange", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "emptied", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "ended", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "encrypted", listener: (ev: MediaEncryptedEvent) => any, useCapture?: boolean): void; + addEventListener(type: "ended", listener: (ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: "focus", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; addEventListener(type: "gotpointercapture", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; addEventListener(type: "input", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "invalid", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "keydown", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "keypress", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "keyup", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; @@ -5647,9 +6275,9 @@ interface HTMLMediaElement extends HTMLElement { addEventListener(type: "mouseout", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "mouseover", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "mouseup", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousewheel", listener: (ev: MouseWheelEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mousewheel", listener: (ev: WheelEvent) => any, useCapture?: boolean): void; addEventListener(type: "msneedkey", listener: (ev: MSMediaKeyNeededEvent) => any, useCapture?: boolean): void; - addEventListener(type: "paste", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "paste", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "pause", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "play", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "playing", listener: (ev: Event) => any, useCapture?: boolean): void; @@ -5688,15 +6316,15 @@ interface HTMLMediaElement extends HTMLElement { declare var HTMLMediaElement: { prototype: HTMLMediaElement; new(): HTMLMediaElement; - HAVE_CURRENT_DATA: number; - HAVE_ENOUGH_DATA: number; - HAVE_FUTURE_DATA: number; - HAVE_METADATA: number; - HAVE_NOTHING: number; - NETWORK_EMPTY: number; - NETWORK_IDLE: number; - NETWORK_LOADING: number; - NETWORK_NO_SOURCE: number; + readonly HAVE_CURRENT_DATA: number; + readonly HAVE_ENOUGH_DATA: number; + readonly HAVE_FUTURE_DATA: number; + readonly HAVE_METADATA: number; + readonly HAVE_NOTHING: number; + readonly NETWORK_EMPTY: number; + readonly NETWORK_IDLE: number; + readonly NETWORK_LOADING: number; + readonly NETWORK_NO_SOURCE: number; } interface HTMLMenuElement extends HTMLElement { @@ -5741,6 +6369,20 @@ declare var HTMLMetaElement: { new(): HTMLMetaElement; } +interface HTMLMeterElement extends HTMLElement { + high: number; + low: number; + max: number; + min: number; + optimum: number; + value: number; +} + +declare var HTMLMeterElement: { + prototype: HTMLMeterElement; + new(): HTMLMeterElement; +} + interface HTMLModElement extends HTMLElement { /** * Sets or retrieves reference information about the object. @@ -5757,15 +6399,6 @@ declare var HTMLModElement: { new(): HTMLModElement; } -interface HTMLNextIdElement extends HTMLElement { - n: string; -} - -declare var HTMLNextIdElement: { - prototype: HTMLNextIdElement; - new(): HTMLNextIdElement; -} - interface HTMLOListElement extends HTMLElement { compact: boolean; /** @@ -5784,7 +6417,7 @@ interface HTMLObjectElement extends HTMLElement, GetSVGDocument { /** * 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. */ - BaseHref: string; + readonly BaseHref: string; align: string; /** * Sets or retrieves a text alternative to the graphic. @@ -5814,7 +6447,7 @@ interface HTMLObjectElement extends HTMLElement, GetSVGDocument { /** * Retrieves the document object of the page or frame. */ - contentDocument: Document; + readonly contentDocument: Document; /** * Sets or retrieves the URL that references the data of the object. */ @@ -5823,7 +6456,7 @@ interface HTMLObjectElement extends HTMLElement, GetSVGDocument { /** * Retrieves a reference to the form that the object is embedded in. */ - form: HTMLFormElement; + readonly form: HTMLFormElement; /** * Sets or retrieves the height of the object. */ @@ -5844,7 +6477,7 @@ interface HTMLObjectElement extends HTMLElement, GetSVGDocument { /** * Gets the source associated with the media element for use by the PlayToManager. */ - msPlayToSource: any; + readonly msPlayToSource: any; /** * Sets or retrieves the name of the object. */ @@ -5852,8 +6485,8 @@ interface HTMLObjectElement extends HTMLElement, GetSVGDocument { /** * Retrieves the contained object. */ - object: any; - readyState: number; + readonly object: any; + readonly readyState: number; /** * Sets or retrieves a message to be displayed while an object is loading. */ @@ -5869,11 +6502,11 @@ interface HTMLObjectElement extends HTMLElement, GetSVGDocument { /** * 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. */ - validationMessage: string; + readonly validationMessage: string; /** * Returns a ValidityState object that represents the validity states of an element. */ - validity: ValidityState; + readonly validity: ValidityState; vspace: number; /** * Sets or retrieves the width of the object. @@ -5882,7 +6515,7 @@ interface HTMLObjectElement extends HTMLElement, GetSVGDocument { /** * Returns whether an element will successfully validate based on forms validation rules and constraints. */ - willValidate: boolean; + readonly willValidate: boolean; /** * Returns whether a form will validate when it is submitted, without having to submit it. */ @@ -5909,11 +6542,11 @@ interface HTMLOptGroupElement extends HTMLElement { /** * Retrieves a reference to the form that the object is embedded in. */ - form: HTMLFormElement; + readonly form: HTMLFormElement; /** * Sets or retrieves the ordinal position of an option in a list box. */ - index: number; + readonly index: number; /** * Sets or retrieves a value that you can use to implement your own label functionality for the object. */ @@ -5925,7 +6558,7 @@ interface HTMLOptGroupElement extends HTMLElement { /** * Sets or retrieves the text string specified by the option tag. */ - text: string; + readonly text: string; /** * Sets or retrieves the value which is returned to the server when the form control is submitted. */ @@ -5946,11 +6579,11 @@ interface HTMLOptionElement extends HTMLElement { /** * Retrieves a reference to the form that the object is embedded in. */ - form: HTMLFormElement; + readonly form: HTMLFormElement; /** * Sets or retrieves the ordinal position of an option in a list box. */ - index: number; + readonly index: number; /** * Sets or retrieves a value that you can use to implement your own label functionality for the object. */ @@ -5975,6 +6608,18 @@ declare var HTMLOptionElement: { create(): HTMLOptionElement; } +interface HTMLOptionsCollection extends HTMLCollection { + length: number; + selectedIndex: number; + add(element: HTMLOptionElement | HTMLOptGroupElement, before?: HTMLElement | number): void; + remove(index: number): void; +} + +declare var HTMLOptionsCollection: { + prototype: HTMLOptionsCollection; + new(): HTMLOptionsCollection; +} + interface HTMLParagraphElement extends HTMLElement { /** * Sets or retrieves how the object is aligned with adjacent text. @@ -6012,28 +6657,15 @@ declare var HTMLParamElement: { new(): HTMLParamElement; } -interface HTMLPhraseElement extends HTMLElement { - /** - * Sets or retrieves reference information about the object. - */ - cite: string; - /** - * Sets or retrieves the date and time of a modification to the object. - */ - dateTime: string; +interface HTMLPictureElement extends HTMLElement { } -declare var HTMLPhraseElement: { - prototype: HTMLPhraseElement; - new(): HTMLPhraseElement; +declare var HTMLPictureElement: { + prototype: HTMLPictureElement; + new(): HTMLPictureElement; } interface HTMLPreElement extends HTMLElement { - /** - * Indicates a citation by rendering text in italic type. - */ - cite: string; - clear: string; /** * Sets or gets a value that you can use to implement your own width functionality for the object. */ @@ -6049,7 +6681,7 @@ interface HTMLProgressElement extends HTMLElement { /** * Retrieves a reference to the form that the object is embedded in. */ - form: HTMLFormElement; + readonly form: HTMLFormElement; /** * Defines the maximum, or "done" value for a progress element. */ @@ -6057,7 +6689,7 @@ interface HTMLProgressElement extends HTMLElement { /** * 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). */ - position: number; + readonly position: number; /** * Sets or gets the current value of a progress element. The value must be a non-negative number between 0 and the max value. */ @@ -6074,10 +6706,6 @@ interface HTMLQuoteElement extends HTMLElement { * Sets or retrieves reference information about the object. */ cite: string; - /** - * Sets or retrieves the date and time of a modification to the object. - */ - dateTime: string; } declare var HTMLQuoteElement: { @@ -6131,7 +6759,7 @@ interface HTMLSelectElement extends HTMLElement { /** * Retrieves a reference to the form that the object is embedded in. */ - form: HTMLFormElement; + readonly form: HTMLFormElement; /** * Sets or retrieves the number of objects in a collection. */ @@ -6144,7 +6772,7 @@ interface HTMLSelectElement extends HTMLElement { * Sets or retrieves the name of the object. */ name: string; - options: HTMLCollection; + options: HTMLCollectionOf; /** * When present, marks an element that can't be submitted without a value. */ @@ -6153,6 +6781,7 @@ interface HTMLSelectElement extends HTMLElement { * Sets or retrieves the index of the selected option in a select object. */ selectedIndex: number; + selectedOptions: HTMLCollectionOf; /** * Sets or retrieves the number of rows in the list box. */ @@ -6160,15 +6789,15 @@ interface HTMLSelectElement extends HTMLElement { /** * Retrieves the type of select control based on the value of the MULTIPLE attribute. */ - type: string; + readonly type: string; /** * 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. */ - validationMessage: string; + readonly validationMessage: string; /** * Returns a ValidityState object that represents the validity states of an element. */ - validity: ValidityState; + readonly validity: ValidityState; /** * Sets or retrieves the value which is returned to the server when the form control is submitted. */ @@ -6176,8 +6805,7 @@ interface HTMLSelectElement extends HTMLElement { /** * Returns whether an element will successfully validate based on forms validation rules and constraints. */ - willValidate: boolean; - selectedOptions: HTMLCollection; + readonly willValidate: boolean; /** * Adds an element to the areas, controlRange, or options collection. * @param element Variant of type Number that specifies the index position in the collection where the element is placed. If no value is given, the method places the element at the end of the collection. @@ -6223,10 +6851,12 @@ interface HTMLSourceElement extends HTMLElement { */ media: string; msKeySystem: string; + sizes: string; /** * The address or URL of the a media resource that is to be considered. */ src: string; + srcset: string; /** * Gets or sets the MIME type of a media resource. */ @@ -6247,6 +6877,7 @@ declare var HTMLSpanElement: { } interface HTMLStyleElement extends HTMLElement, LinkStyle { + disabled: boolean; /** * Sets or retrieves the media type. */ @@ -6296,7 +6927,7 @@ interface HTMLTableCellElement extends HTMLElement, HTMLTableAlignment { /** * Retrieves the position of the object in the cells collection of a row. */ - cellIndex: number; + readonly cellIndex: number; /** * Sets or retrieves the number columns in the table that the object should span. */ @@ -6403,7 +7034,7 @@ interface HTMLTableElement extends HTMLElement { /** * Sets or retrieves the number of horizontal rows contained in the object. */ - rows: HTMLCollection; + rows: HTMLCollectionOf; /** * Sets or retrieves which dividing lines (inner borders) are displayed. */ @@ -6415,7 +7046,7 @@ interface HTMLTableElement extends HTMLElement { /** * Retrieves a collection of all tBody objects in the table. Objects in this collection are in source order. */ - tBodies: HTMLCollection; + tBodies: HTMLCollectionOf; /** * Retrieves the tFoot object of the table. */ @@ -6494,7 +7125,7 @@ interface HTMLTableRowElement extends HTMLElement, HTMLTableAlignment { /** * Retrieves a collection of all cells in the table row. */ - cells: HTMLCollection; + cells: HTMLCollectionOf; /** * Sets or retrieves the height of the object. */ @@ -6502,11 +7133,11 @@ interface HTMLTableRowElement extends HTMLElement, HTMLTableAlignment { /** * Retrieves the position of the object in the rows collection for the table. */ - rowIndex: number; + readonly rowIndex: number; /** * Retrieves the position of the object in the collection. */ - sectionRowIndex: number; + readonly sectionRowIndex: number; /** * Removes the specified cell from the table row, as well as from the cells collection. * @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. @@ -6516,7 +7147,7 @@ interface HTMLTableRowElement extends HTMLElement, HTMLTableAlignment { * Creates a new cell in the table row, and adds the cell to the cells collection. * @param index Number that specifies where to insert the cell in the tr. The default value is -1, which appends the new cell to the end of the cells collection. */ - insertCell(index?: number): HTMLTableCellElement; + insertCell(index?: number): HTMLTableDataCellElement; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -6533,7 +7164,7 @@ interface HTMLTableSectionElement extends HTMLElement, HTMLTableAlignment { /** * Sets or retrieves the number of horizontal rows contained in the object. */ - rows: HTMLCollection; + rows: HTMLCollectionOf; /** * Removes the specified row (tr) from the element and from the rows collection. * @param index Number that specifies the zero-based position in the rows collection of the row to remove. @@ -6552,6 +7183,15 @@ declare var HTMLTableSectionElement: { new(): HTMLTableSectionElement; } +interface HTMLTemplateElement extends HTMLElement { + readonly content: DocumentFragment; +} + +declare var HTMLTemplateElement: { + prototype: HTMLTemplateElement; + new(): HTMLTemplateElement; +} + interface HTMLTextAreaElement extends HTMLElement { /** * 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. @@ -6569,7 +7209,7 @@ interface HTMLTextAreaElement extends HTMLElement { /** * Retrieves a reference to the form that the object is embedded in. */ - form: HTMLFormElement; + readonly form: HTMLFormElement; /** * Sets or retrieves the maximum number of characters that the user can enter in a text control. */ @@ -6609,15 +7249,15 @@ interface HTMLTextAreaElement extends HTMLElement { /** * Retrieves the type of control. */ - type: string; + readonly type: string; /** * 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. */ - validationMessage: string; + readonly validationMessage: string; /** * Returns a ValidityState object that represents the validity states of an element. */ - validity: ValidityState; + readonly validity: ValidityState; /** * Retrieves or sets the text in the entry field of the textArea element. */ @@ -6625,19 +7265,16 @@ interface HTMLTextAreaElement extends HTMLElement { /** * Returns whether an element will successfully validate based on forms validation rules and constraints. */ - willValidate: boolean; + readonly willValidate: boolean; /** * Sets or retrieves how to handle wordwrapping in the object. */ wrap: string; + minLength: number; /** * Returns whether a form will validate when it is submitted, without having to submit it. */ checkValidity(): boolean; - /** - * Creates a TextRange object for the element. - */ - createTextRange(): TextRange; /** * Highlights the input area of a form element. */ @@ -6676,23 +7313,23 @@ interface HTMLTrackElement extends HTMLElement { default: boolean; kind: string; label: string; - readyState: number; + readonly readyState: number; src: string; srclang: string; - track: TextTrack; - ERROR: number; - LOADED: number; - LOADING: number; - NONE: number; + readonly track: TextTrack; + readonly ERROR: number; + readonly LOADED: number; + readonly LOADING: number; + readonly NONE: number; } declare var HTMLTrackElement: { prototype: HTMLTrackElement; new(): HTMLTrackElement; - ERROR: number; - LOADED: number; - LOADING: number; - NONE: number; + readonly ERROR: number; + readonly LOADED: number; + readonly LOADING: number; + readonly NONE: number; } interface HTMLUListElement extends HTMLElement { @@ -6719,8 +7356,8 @@ interface HTMLVideoElement extends HTMLMediaElement { */ height: number; msHorizontalMirror: boolean; - msIsLayoutOptimalForPlayback: boolean; - msIsStereo3D: boolean; + readonly msIsLayoutOptimalForPlayback: boolean; + readonly msIsStereo3D: boolean; msStereo3DPackingMode: string; msStereo3DRenderMode: string; msZoom: boolean; @@ -6734,13 +7371,13 @@ interface HTMLVideoElement extends HTMLMediaElement { /** * Gets the intrinsic height of a video in CSS pixels, or zero if the dimensions are not known. */ - videoHeight: number; + readonly videoHeight: number; /** * Gets the intrinsic width of a video in CSS pixels, or zero if the dimensions are not known. */ - videoWidth: number; - webkitDisplayingFullscreen: boolean; - webkitSupportsFullscreen: boolean; + readonly videoWidth: number; + readonly webkitDisplayingFullscreen: boolean; + readonly webkitSupportsFullscreen: boolean; /** * Gets or sets the width of the video element. */ @@ -6779,10 +7416,10 @@ interface HTMLVideoElement extends HTMLMediaElement { addEventListener(type: "activate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; addEventListener(type: "ariarequest", listener: (ev: AriaRequestEvent) => any, useCapture?: boolean): void; addEventListener(type: "beforeactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecopy", listener: (ev: DragEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforecut", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforecopy", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforecut", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "beforedeactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; - addEventListener(type: "beforepaste", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "beforepaste", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "blur", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; addEventListener(type: "canplay", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "canplaythrough", listener: (ev: Event) => any, useCapture?: boolean): void; @@ -6790,9 +7427,9 @@ interface HTMLVideoElement extends HTMLMediaElement { addEventListener(type: "click", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "command", listener: (ev: CommandEvent) => any, useCapture?: boolean): void; addEventListener(type: "contextmenu", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; - addEventListener(type: "copy", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "copy", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "cuechange", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "cut", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "cut", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "dblclick", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "deactivate", listener: (ev: UIEvent) => any, useCapture?: boolean): void; addEventListener(type: "drag", listener: (ev: DragEvent) => any, useCapture?: boolean): void; @@ -6804,11 +7441,13 @@ interface HTMLVideoElement extends HTMLMediaElement { addEventListener(type: "drop", listener: (ev: DragEvent) => any, useCapture?: boolean): void; addEventListener(type: "durationchange", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "emptied", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "ended", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "encrypted", listener: (ev: MediaEncryptedEvent) => any, useCapture?: boolean): void; + addEventListener(type: "ended", listener: (ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: "focus", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; addEventListener(type: "gotpointercapture", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; addEventListener(type: "input", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "invalid", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "keydown", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "keypress", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "keyup", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; @@ -6824,9 +7463,9 @@ interface HTMLVideoElement extends HTMLMediaElement { addEventListener(type: "mouseout", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "mouseover", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "mouseup", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousewheel", listener: (ev: MouseWheelEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mousewheel", listener: (ev: WheelEvent) => any, useCapture?: boolean): void; addEventListener(type: "msneedkey", listener: (ev: MSMediaKeyNeededEvent) => any, useCapture?: boolean): void; - addEventListener(type: "paste", listener: (ev: DragEvent) => any, useCapture?: boolean): void; + addEventListener(type: "paste", listener: (ev: ClipboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "pause", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "play", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "playing", listener: (ev: Event) => any, useCapture?: boolean): void; @@ -6868,8 +7507,8 @@ declare var HTMLVideoElement: { } interface HashChangeEvent extends Event { - newURL: string; - oldURL: string; + readonly newURL: string; + readonly oldURL: string; } declare var HashChangeEvent: { @@ -6878,8 +7517,8 @@ declare var HashChangeEvent: { } interface History { - length: number; - state: any; + readonly length: number; + readonly state: any; back(distance?: any): void; forward(distance?: any): void; go(delta?: any): void; @@ -6893,31 +7532,31 @@ declare var History: { } interface IDBCursor { - direction: string; - key: any; - primaryKey: any; + readonly direction: string; + key: IDBKeyRange | IDBValidKey; + readonly primaryKey: any; source: IDBObjectStore | IDBIndex; advance(count: number): void; - continue(key?: any): void; + continue(key?: IDBKeyRange | IDBValidKey): void; delete(): IDBRequest; update(value: any): IDBRequest; - NEXT: string; - NEXT_NO_DUPLICATE: string; - PREV: string; - PREV_NO_DUPLICATE: string; + readonly NEXT: string; + readonly NEXT_NO_DUPLICATE: string; + readonly PREV: string; + readonly PREV_NO_DUPLICATE: string; } declare var IDBCursor: { prototype: IDBCursor; new(): IDBCursor; - NEXT: string; - NEXT_NO_DUPLICATE: string; - PREV: string; - PREV_NO_DUPLICATE: string; + readonly NEXT: string; + readonly NEXT_NO_DUPLICATE: string; + readonly PREV: string; + readonly PREV_NO_DUPLICATE: string; } interface IDBCursorWithValue extends IDBCursor { - value: any; + readonly value: any; } declare var IDBCursorWithValue: { @@ -6926,15 +7565,17 @@ declare var IDBCursorWithValue: { } interface IDBDatabase extends EventTarget { - name: string; - objectStoreNames: DOMStringList; + readonly name: string; + readonly objectStoreNames: DOMStringList; onabort: (ev: Event) => any; onerror: (ev: Event) => any; version: number; + onversionchange: (ev: IDBVersionChangeEvent) => any; close(): void; createObjectStore(name: string, optionalParameters?: IDBObjectStoreParameters): IDBObjectStore; deleteObjectStore(name: string): void; transaction(storeNames: string | string[], mode?: string): IDBTransaction; + addEventListener(type: "versionchange", listener: (ev: IDBVersionChangeEvent) => any, useCapture?: boolean): void; addEventListener(type: "abort", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; @@ -6958,15 +7599,15 @@ declare var IDBFactory: { interface IDBIndex { keyPath: string | string[]; - name: string; - objectStore: IDBObjectStore; - unique: boolean; + readonly name: string; + readonly objectStore: IDBObjectStore; + readonly unique: boolean; multiEntry: boolean; - count(key?: any): IDBRequest; - get(key: any): IDBRequest; - getKey(key: any): IDBRequest; - openCursor(range?: IDBKeyRange, direction?: string): IDBRequest; - openKeyCursor(range?: IDBKeyRange, direction?: string): IDBRequest; + count(key?: IDBKeyRange | IDBValidKey): IDBRequest; + get(key: IDBKeyRange | IDBValidKey): IDBRequest; + getKey(key: IDBKeyRange | IDBValidKey): IDBRequest; + openCursor(range?: IDBKeyRange | IDBValidKey, direction?: string): IDBRequest; + openKeyCursor(range?: IDBKeyRange | IDBValidKey, direction?: string): IDBRequest; } declare var IDBIndex: { @@ -6975,37 +7616,37 @@ declare var IDBIndex: { } interface IDBKeyRange { - lower: any; - lowerOpen: boolean; - upper: any; - upperOpen: boolean; + readonly lower: any; + readonly lowerOpen: boolean; + readonly upper: any; + readonly upperOpen: boolean; } declare var IDBKeyRange: { prototype: IDBKeyRange; new(): IDBKeyRange; bound(lower: any, upper: any, lowerOpen?: boolean, upperOpen?: boolean): IDBKeyRange; - lowerBound(bound: any, open?: boolean): IDBKeyRange; + lowerBound(lower: any, open?: boolean): IDBKeyRange; only(value: any): IDBKeyRange; - upperBound(bound: any, open?: boolean): IDBKeyRange; + upperBound(upper: any, open?: boolean): IDBKeyRange; } interface IDBObjectStore { - indexNames: DOMStringList; + readonly indexNames: DOMStringList; keyPath: string | string[]; - name: string; - transaction: IDBTransaction; + readonly name: string; + readonly transaction: IDBTransaction; autoIncrement: boolean; - add(value: any, key?: any): IDBRequest; + add(value: any, key?: IDBKeyRange | IDBValidKey): IDBRequest; clear(): IDBRequest; - count(key?: any): IDBRequest; + count(key?: IDBKeyRange | IDBValidKey): IDBRequest; createIndex(name: string, keyPath: string | string[], optionalParameters?: IDBIndexParameters): IDBIndex; - delete(key: any): IDBRequest; + delete(key: IDBKeyRange | IDBValidKey): IDBRequest; deleteIndex(indexName: string): void; get(key: any): IDBRequest; index(name: string): IDBIndex; - openCursor(range?: any, direction?: string): IDBRequest; - put(value: any, key?: any): IDBRequest; + openCursor(range?: IDBKeyRange | IDBValidKey, direction?: string): IDBRequest; + put(value: any, key?: IDBKeyRange | IDBValidKey): IDBRequest; } declare var IDBObjectStore: { @@ -7029,13 +7670,13 @@ declare var IDBOpenDBRequest: { } interface IDBRequest extends EventTarget { - error: DOMError; + readonly error: DOMError; onerror: (ev: Event) => any; onsuccess: (ev: Event) => any; - readyState: string; - result: any; + readonly readyState: string; + readonly result: any; source: IDBObjectStore | IDBIndex | IDBCursor; - transaction: IDBTransaction; + readonly transaction: IDBTransaction; addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: "success", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; @@ -7047,17 +7688,17 @@ declare var IDBRequest: { } interface IDBTransaction extends EventTarget { - db: IDBDatabase; - error: DOMError; - mode: string; + readonly db: IDBDatabase; + readonly error: DOMError; + readonly mode: string; onabort: (ev: Event) => any; oncomplete: (ev: Event) => any; onerror: (ev: Event) => any; abort(): void; objectStore(name: string): IDBObjectStore; - READ_ONLY: string; - READ_WRITE: string; - VERSION_CHANGE: string; + readonly READ_ONLY: string; + readonly READ_WRITE: string; + readonly VERSION_CHANGE: string; addEventListener(type: "abort", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "complete", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; @@ -7067,14 +7708,14 @@ interface IDBTransaction extends EventTarget { declare var IDBTransaction: { prototype: IDBTransaction; new(): IDBTransaction; - READ_ONLY: string; - READ_WRITE: string; - VERSION_CHANGE: string; + readonly READ_ONLY: string; + readonly READ_WRITE: string; + readonly VERSION_CHANGE: string; } interface IDBVersionChangeEvent extends Event { - newVersion: number; - oldVersion: number; + readonly newVersion: number; + readonly oldVersion: number; } declare var IDBVersionChangeEvent: { @@ -7084,8 +7725,8 @@ declare var IDBVersionChangeEvent: { interface ImageData { data: Uint8ClampedArray; - height: number; - width: number; + readonly height: number; + readonly width: number; } declare var ImageData: { @@ -7095,37 +7736,47 @@ declare var ImageData: { } interface KeyboardEvent extends UIEvent { - altKey: boolean; - char: string; - charCode: number; - ctrlKey: boolean; - key: string; - keyCode: number; - locale: string; - location: number; - metaKey: boolean; - repeat: boolean; - shiftKey: boolean; - which: number; + readonly altKey: boolean; + readonly char: string; + readonly charCode: number; + readonly ctrlKey: boolean; + readonly key: string; + readonly keyCode: number; + readonly locale: string; + readonly location: number; + readonly metaKey: boolean; + readonly repeat: boolean; + readonly shiftKey: boolean; + readonly which: number; getModifierState(keyArg: string): boolean; initKeyboardEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, keyArg: string, locationArg: number, modifiersListArg: string, repeat: boolean, locale: string): void; - DOM_KEY_LOCATION_JOYSTICK: number; - DOM_KEY_LOCATION_LEFT: number; - DOM_KEY_LOCATION_MOBILE: number; - DOM_KEY_LOCATION_NUMPAD: number; - DOM_KEY_LOCATION_RIGHT: number; - DOM_KEY_LOCATION_STANDARD: number; + readonly DOM_KEY_LOCATION_JOYSTICK: number; + readonly DOM_KEY_LOCATION_LEFT: number; + readonly DOM_KEY_LOCATION_MOBILE: number; + readonly DOM_KEY_LOCATION_NUMPAD: number; + readonly DOM_KEY_LOCATION_RIGHT: number; + readonly DOM_KEY_LOCATION_STANDARD: number; } declare var KeyboardEvent: { prototype: KeyboardEvent; new(typeArg: string, eventInitDict?: KeyboardEventInit): KeyboardEvent; - DOM_KEY_LOCATION_JOYSTICK: number; - DOM_KEY_LOCATION_LEFT: number; - DOM_KEY_LOCATION_MOBILE: number; - DOM_KEY_LOCATION_NUMPAD: number; - DOM_KEY_LOCATION_RIGHT: number; - DOM_KEY_LOCATION_STANDARD: number; + readonly DOM_KEY_LOCATION_JOYSTICK: number; + readonly DOM_KEY_LOCATION_LEFT: number; + readonly DOM_KEY_LOCATION_MOBILE: number; + readonly DOM_KEY_LOCATION_NUMPAD: number; + readonly DOM_KEY_LOCATION_RIGHT: number; + readonly DOM_KEY_LOCATION_STANDARD: number; +} + +interface ListeningStateChangedEvent extends Event { + readonly label: string; + readonly state: string; +} + +declare var ListeningStateChangedEvent: { + prototype: ListeningStateChangedEvent; + new(): ListeningStateChangedEvent; } interface Location { @@ -7133,7 +7784,7 @@ interface Location { host: string; hostname: string; href: string; - origin: string; + readonly origin: string; pathname: string; port: string; protocol: string; @@ -7150,7 +7801,7 @@ declare var Location: { } interface LongRunningScriptDetectedEvent extends Event { - executionTime: number; + readonly executionTime: number; stopPageScriptExecution: boolean; } @@ -7169,29 +7820,29 @@ interface MSApp { execAsyncAtPriority(asynchronousCallback: MSExecAtPriorityFunctionCallback, priority: string, ...args: any[]): void; execAtPriority(synchronousCallback: MSExecAtPriorityFunctionCallback, priority: string, ...args: any[]): any; getCurrentPriority(): string; - getHtmlPrintDocumentSourceAsync(htmlDoc: any): any; + getHtmlPrintDocumentSourceAsync(htmlDoc: any): PromiseLike; getViewId(view: any): any; isTaskScheduledAtPriorityOrHigher(priority: string): boolean; pageHandlesAllApplicationActivations(enabled: boolean): void; suppressSubdownloadCredentialPrompts(suppress: boolean): void; terminateApp(exceptionObject: any): void; - CURRENT: string; - HIGH: string; - IDLE: string; - NORMAL: string; + readonly CURRENT: string; + readonly HIGH: string; + readonly IDLE: string; + readonly NORMAL: string; } declare var MSApp: MSApp; interface MSAppAsyncOperation extends EventTarget { - error: DOMError; + readonly error: DOMError; oncomplete: (ev: Event) => any; onerror: (ev: Event) => any; - readyState: number; - result: any; + readonly readyState: number; + readonly result: any; start(): void; - COMPLETED: number; - ERROR: number; - STARTED: number; + readonly COMPLETED: number; + readonly ERROR: number; + readonly STARTED: number; addEventListener(type: "complete", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; @@ -7200,9 +7851,19 @@ interface MSAppAsyncOperation extends EventTarget { declare var MSAppAsyncOperation: { prototype: MSAppAsyncOperation; new(): MSAppAsyncOperation; - COMPLETED: number; - ERROR: number; - STARTED: number; + readonly COMPLETED: number; + readonly ERROR: number; + readonly STARTED: number; +} + +interface MSAssertion { + readonly id: string; + readonly type: string; +} + +declare var MSAssertion: { + prototype: MSAssertion; + new(): MSAssertion; } interface MSBlobBuilder { @@ -7215,44 +7876,46 @@ declare var MSBlobBuilder: { new(): MSBlobBuilder; } -interface MSCSSMatrix { - a: number; - b: number; - c: number; - d: number; - e: number; - f: number; - m11: number; - m12: number; - m13: number; - m14: number; - m21: number; - m22: number; - m23: number; - m24: number; - m31: number; - m32: number; - m33: number; - m34: number; - m41: number; - m42: number; - m43: number; - m44: number; - inverse(): MSCSSMatrix; - multiply(secondMatrix: MSCSSMatrix): MSCSSMatrix; - rotate(angleX: number, angleY?: number, angleZ?: number): MSCSSMatrix; - rotateAxisAngle(x: number, y: number, z: number, angle: number): MSCSSMatrix; - scale(scaleX: number, scaleY?: number, scaleZ?: number): MSCSSMatrix; - setMatrixValue(value: string): void; - skewX(angle: number): MSCSSMatrix; - skewY(angle: number): MSCSSMatrix; - toString(): string; - translate(x: number, y: number, z?: number): MSCSSMatrix; +interface MSCredentials { + getAssertion(challenge: string, filter?: MSCredentialFilter, params?: MSSignatureParameters): PromiseLike; + makeCredential(accountInfo: MSAccountInfo, params: MSCredentialParameters[], challenge?: string): PromiseLike; } -declare var MSCSSMatrix: { - prototype: MSCSSMatrix; - new(text?: string): MSCSSMatrix; +declare var MSCredentials: { + prototype: MSCredentials; + new(): MSCredentials; +} + +interface MSFIDOCredentialAssertion extends MSAssertion { + readonly algorithm: string | Algorithm; + readonly attestation: any; + readonly publicKey: string; + readonly transportHints: string[]; +} + +declare var MSFIDOCredentialAssertion: { + prototype: MSFIDOCredentialAssertion; + new(): MSFIDOCredentialAssertion; +} + +interface MSFIDOSignature { + readonly authnrData: string; + readonly clientData: string; + readonly signature: string; +} + +declare var MSFIDOSignature: { + prototype: MSFIDOSignature; + new(): MSFIDOSignature; +} + +interface MSFIDOSignatureAssertion extends MSAssertion { + readonly signature: MSFIDOSignature; +} + +declare var MSFIDOSignatureAssertion: { + prototype: MSFIDOSignatureAssertion; + new(): MSFIDOSignatureAssertion; } interface MSGesture { @@ -7267,44 +7930,44 @@ declare var MSGesture: { } interface MSGestureEvent extends UIEvent { - clientX: number; - clientY: number; - expansion: number; - gestureObject: any; - hwTimestamp: number; - offsetX: number; - offsetY: number; - rotation: number; - scale: number; - screenX: number; - screenY: number; - translationX: number; - translationY: number; - velocityAngular: number; - velocityExpansion: number; - velocityX: number; - velocityY: number; + readonly clientX: number; + readonly clientY: number; + readonly expansion: number; + readonly gestureObject: any; + readonly hwTimestamp: number; + readonly offsetX: number; + readonly offsetY: number; + readonly rotation: number; + readonly scale: number; + readonly screenX: number; + readonly screenY: number; + readonly translationX: number; + readonly translationY: number; + readonly velocityAngular: number; + readonly velocityExpansion: number; + readonly velocityX: number; + readonly velocityY: number; 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; - MSGESTURE_FLAG_BEGIN: number; - MSGESTURE_FLAG_CANCEL: number; - MSGESTURE_FLAG_END: number; - MSGESTURE_FLAG_INERTIA: number; - MSGESTURE_FLAG_NONE: number; + readonly MSGESTURE_FLAG_BEGIN: number; + readonly MSGESTURE_FLAG_CANCEL: number; + readonly MSGESTURE_FLAG_END: number; + readonly MSGESTURE_FLAG_INERTIA: number; + readonly MSGESTURE_FLAG_NONE: number; } declare var MSGestureEvent: { prototype: MSGestureEvent; new(): MSGestureEvent; - MSGESTURE_FLAG_BEGIN: number; - MSGESTURE_FLAG_CANCEL: number; - MSGESTURE_FLAG_END: number; - MSGESTURE_FLAG_INERTIA: number; - MSGESTURE_FLAG_NONE: number; + readonly MSGESTURE_FLAG_BEGIN: number; + readonly MSGESTURE_FLAG_CANCEL: number; + readonly MSGESTURE_FLAG_END: number; + readonly MSGESTURE_FLAG_INERTIA: number; + readonly MSGESTURE_FLAG_NONE: number; } interface MSGraphicsTrust { - constrictionActive: boolean; - status: string; + readonly constrictionActive: boolean; + readonly status: string; } declare var MSGraphicsTrust: { @@ -7313,12 +7976,12 @@ declare var MSGraphicsTrust: { } interface MSHTMLWebViewElement extends HTMLElement { - canGoBack: boolean; - canGoForward: boolean; - containsFullScreenElement: boolean; - documentTitle: string; + readonly canGoBack: boolean; + readonly canGoForward: boolean; + readonly containsFullScreenElement: boolean; + readonly documentTitle: string; height: number; - settings: MSWebViewSettings; + readonly settings: MSWebViewSettings; src: string; width: number; addWebAllowedObject(name: string, applicationObject: any): void; @@ -7344,12 +8007,12 @@ declare var MSHTMLWebViewElement: { } interface MSInputMethodContext extends EventTarget { - compositionEndOffset: number; - compositionStartOffset: number; + readonly compositionEndOffset: number; + readonly compositionStartOffset: number; oncandidatewindowhide: (ev: Event) => any; oncandidatewindowshow: (ev: Event) => any; oncandidatewindowupdate: (ev: Event) => any; - target: HTMLElement; + readonly target: HTMLElement; getCandidateWindowClientRect(): ClientRect; getCompositionAlternatives(): string[]; hasComposition(): boolean; @@ -7366,59 +8029,59 @@ declare var MSInputMethodContext: { } interface MSManipulationEvent extends UIEvent { - currentState: number; - inertiaDestinationX: number; - inertiaDestinationY: number; - lastState: number; + readonly currentState: number; + readonly inertiaDestinationX: number; + readonly inertiaDestinationY: number; + readonly lastState: number; initMSManipulationEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, lastState: number, currentState: number): void; - MS_MANIPULATION_STATE_ACTIVE: number; - MS_MANIPULATION_STATE_CANCELLED: number; - MS_MANIPULATION_STATE_COMMITTED: number; - MS_MANIPULATION_STATE_DRAGGING: number; - MS_MANIPULATION_STATE_INERTIA: number; - MS_MANIPULATION_STATE_PRESELECT: number; - MS_MANIPULATION_STATE_SELECTING: number; - MS_MANIPULATION_STATE_STOPPED: number; + readonly MS_MANIPULATION_STATE_ACTIVE: number; + readonly MS_MANIPULATION_STATE_CANCELLED: number; + readonly MS_MANIPULATION_STATE_COMMITTED: number; + readonly MS_MANIPULATION_STATE_DRAGGING: number; + readonly MS_MANIPULATION_STATE_INERTIA: number; + readonly MS_MANIPULATION_STATE_PRESELECT: number; + readonly MS_MANIPULATION_STATE_SELECTING: number; + readonly MS_MANIPULATION_STATE_STOPPED: number; } declare var MSManipulationEvent: { prototype: MSManipulationEvent; new(): MSManipulationEvent; - MS_MANIPULATION_STATE_ACTIVE: number; - MS_MANIPULATION_STATE_CANCELLED: number; - MS_MANIPULATION_STATE_COMMITTED: number; - MS_MANIPULATION_STATE_DRAGGING: number; - MS_MANIPULATION_STATE_INERTIA: number; - MS_MANIPULATION_STATE_PRESELECT: number; - MS_MANIPULATION_STATE_SELECTING: number; - MS_MANIPULATION_STATE_STOPPED: number; + readonly MS_MANIPULATION_STATE_ACTIVE: number; + readonly MS_MANIPULATION_STATE_CANCELLED: number; + readonly MS_MANIPULATION_STATE_COMMITTED: number; + readonly MS_MANIPULATION_STATE_DRAGGING: number; + readonly MS_MANIPULATION_STATE_INERTIA: number; + readonly MS_MANIPULATION_STATE_PRESELECT: number; + readonly MS_MANIPULATION_STATE_SELECTING: number; + readonly MS_MANIPULATION_STATE_STOPPED: number; } interface MSMediaKeyError { - code: number; - systemCode: number; - MS_MEDIA_KEYERR_CLIENT: number; - MS_MEDIA_KEYERR_DOMAIN: number; - MS_MEDIA_KEYERR_HARDWARECHANGE: number; - MS_MEDIA_KEYERR_OUTPUT: number; - MS_MEDIA_KEYERR_SERVICE: number; - MS_MEDIA_KEYERR_UNKNOWN: number; + readonly code: number; + readonly systemCode: number; + readonly MS_MEDIA_KEYERR_CLIENT: number; + readonly MS_MEDIA_KEYERR_DOMAIN: number; + readonly MS_MEDIA_KEYERR_HARDWARECHANGE: number; + readonly MS_MEDIA_KEYERR_OUTPUT: number; + readonly MS_MEDIA_KEYERR_SERVICE: number; + readonly MS_MEDIA_KEYERR_UNKNOWN: number; } declare var MSMediaKeyError: { prototype: MSMediaKeyError; new(): MSMediaKeyError; - MS_MEDIA_KEYERR_CLIENT: number; - MS_MEDIA_KEYERR_DOMAIN: number; - MS_MEDIA_KEYERR_HARDWARECHANGE: number; - MS_MEDIA_KEYERR_OUTPUT: number; - MS_MEDIA_KEYERR_SERVICE: number; - MS_MEDIA_KEYERR_UNKNOWN: number; + readonly MS_MEDIA_KEYERR_CLIENT: number; + readonly MS_MEDIA_KEYERR_DOMAIN: number; + readonly MS_MEDIA_KEYERR_HARDWARECHANGE: number; + readonly MS_MEDIA_KEYERR_OUTPUT: number; + readonly MS_MEDIA_KEYERR_SERVICE: number; + readonly MS_MEDIA_KEYERR_UNKNOWN: number; } interface MSMediaKeyMessageEvent extends Event { - destinationURL: string; - message: Uint8Array; + readonly destinationURL: string; + readonly message: Uint8Array; } declare var MSMediaKeyMessageEvent: { @@ -7427,7 +8090,7 @@ declare var MSMediaKeyMessageEvent: { } interface MSMediaKeyNeededEvent extends Event { - initData: Uint8Array; + readonly initData: Uint8Array; } declare var MSMediaKeyNeededEvent: { @@ -7436,9 +8099,9 @@ declare var MSMediaKeyNeededEvent: { } interface MSMediaKeySession extends EventTarget { - error: MSMediaKeyError; - keySystem: string; - sessionId: string; + readonly error: MSMediaKeyError; + readonly keySystem: string; + readonly sessionId: string; close(): void; update(key: Uint8Array): void; } @@ -7449,7 +8112,7 @@ declare var MSMediaKeySession: { } interface MSMediaKeys { - keySystem: string; + readonly keySystem: string; createSession(type: string, initData: Uint8Array, cdmData?: Uint8Array): MSMediaKeySession; } @@ -7457,40 +8120,22 @@ declare var MSMediaKeys: { prototype: MSMediaKeys; new(keySystem: string): MSMediaKeys; isTypeSupported(keySystem: string, type?: string): boolean; -} - -interface MSMimeTypesCollection { - length: number; -} - -declare var MSMimeTypesCollection: { - prototype: MSMimeTypesCollection; - new(): MSMimeTypesCollection; -} - -interface MSPluginsCollection { - length: number; - refresh(reload?: boolean): void; -} - -declare var MSPluginsCollection: { - prototype: MSPluginsCollection; - new(): MSPluginsCollection; + isTypeSupportedWithFeatures(keySystem: string, type?: string): string; } interface MSPointerEvent extends MouseEvent { - currentPoint: any; - height: number; - hwTimestamp: number; - intermediatePoints: any; - isPrimary: boolean; - pointerId: number; - pointerType: any; - pressure: number; - rotation: number; - tiltX: number; - tiltY: number; - width: number; + readonly currentPoint: any; + readonly height: number; + readonly hwTimestamp: number; + readonly intermediatePoints: any; + readonly isPrimary: boolean; + readonly pointerId: number; + readonly pointerType: any; + readonly pressure: number; + readonly rotation: number; + readonly tiltX: number; + readonly tiltY: number; + readonly width: number; getCurrentPoint(element: Element): void; getIntermediatePoints(element: Element): void; 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; @@ -7502,7 +8147,7 @@ declare var MSPointerEvent: { } interface MSRangeCollection { - length: number; + readonly length: number; item(index: number): Range; [index: number]: Range; } @@ -7513,8 +8158,8 @@ declare var MSRangeCollection: { } interface MSSiteModeEvent extends Event { - actionURL: string; - buttonID: number; + readonly actionURL: string; + readonly buttonID: number; } declare var MSSiteModeEvent: { @@ -7523,7 +8168,7 @@ declare var MSSiteModeEvent: { } interface MSStream { - type: string; + readonly type: string; msClose(): void; msDetachStream(): any; } @@ -7534,7 +8179,7 @@ declare var MSStream: { } interface MSStreamReader extends EventTarget, MSBaseReader { - error: DOMError; + readonly error: DOMError; readAsArrayBuffer(stream: MSStream, size?: number): void; readAsBinaryString(stream: MSStream, size?: number): void; readAsBlob(stream: MSStream, size?: number): void; @@ -7549,20 +8194,20 @@ declare var MSStreamReader: { } interface MSWebViewAsyncOperation extends EventTarget { - error: DOMError; + readonly error: DOMError; oncomplete: (ev: Event) => any; onerror: (ev: Event) => any; - readyState: number; - result: any; - target: MSHTMLWebViewElement; - type: number; + readonly readyState: number; + readonly result: any; + readonly target: MSHTMLWebViewElement; + readonly type: number; start(): void; - COMPLETED: number; - ERROR: number; - STARTED: number; - TYPE_CAPTURE_PREVIEW_TO_RANDOM_ACCESS_STREAM: number; - TYPE_CREATE_DATA_PACKAGE_FROM_SELECTION: number; - TYPE_INVOKE_SCRIPT: number; + readonly COMPLETED: number; + readonly ERROR: number; + readonly STARTED: number; + readonly TYPE_CAPTURE_PREVIEW_TO_RANDOM_ACCESS_STREAM: number; + readonly TYPE_CREATE_DATA_PACKAGE_FROM_SELECTION: number; + readonly TYPE_INVOKE_SCRIPT: number; addEventListener(type: "complete", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; @@ -7571,12 +8216,12 @@ interface MSWebViewAsyncOperation extends EventTarget { declare var MSWebViewAsyncOperation: { prototype: MSWebViewAsyncOperation; new(): MSWebViewAsyncOperation; - COMPLETED: number; - ERROR: number; - STARTED: number; - TYPE_CAPTURE_PREVIEW_TO_RANDOM_ACCESS_STREAM: number; - TYPE_CREATE_DATA_PACKAGE_FROM_SELECTION: number; - TYPE_INVOKE_SCRIPT: number; + readonly COMPLETED: number; + readonly ERROR: number; + readonly STARTED: number; + readonly TYPE_CAPTURE_PREVIEW_TO_RANDOM_ACCESS_STREAM: number; + readonly TYPE_CREATE_DATA_PACKAGE_FROM_SELECTION: number; + readonly TYPE_INVOKE_SCRIPT: number; } interface MSWebViewSettings { @@ -7589,6 +8234,32 @@ declare var MSWebViewSettings: { new(): MSWebViewSettings; } +interface MediaDeviceInfo { + readonly deviceId: string; + readonly groupId: string; + readonly kind: string; + readonly label: string; +} + +declare var MediaDeviceInfo: { + prototype: MediaDeviceInfo; + new(): MediaDeviceInfo; +} + +interface MediaDevices extends EventTarget { + ondevicechange: (ev: Event) => any; + enumerateDevices(): any; + getSupportedConstraints(): MediaTrackSupportedConstraints; + getUserMedia(constraints: MediaStreamConstraints): PromiseLike; + addEventListener(type: "devicechange", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var MediaDevices: { + prototype: MediaDevices; + new(): MediaDevices; +} + interface MediaElementAudioSourceNode extends AudioNode { } @@ -7597,28 +8268,98 @@ declare var MediaElementAudioSourceNode: { new(): MediaElementAudioSourceNode; } +interface MediaEncryptedEvent extends Event { + readonly initData: ArrayBuffer; + readonly initDataType: string; +} + +declare var MediaEncryptedEvent: { + prototype: MediaEncryptedEvent; + new(type: string, eventInitDict?: MediaEncryptedEventInit): MediaEncryptedEvent; +} + interface MediaError { - code: number; - msExtendedCode: number; - MEDIA_ERR_ABORTED: number; - MEDIA_ERR_DECODE: number; - MEDIA_ERR_NETWORK: number; - MEDIA_ERR_SRC_NOT_SUPPORTED: number; - MS_MEDIA_ERR_ENCRYPTED: number; + readonly code: number; + readonly msExtendedCode: number; + readonly MEDIA_ERR_ABORTED: number; + readonly MEDIA_ERR_DECODE: number; + readonly MEDIA_ERR_NETWORK: number; + readonly MEDIA_ERR_SRC_NOT_SUPPORTED: number; + readonly MS_MEDIA_ERR_ENCRYPTED: number; } declare var MediaError: { prototype: MediaError; new(): MediaError; - MEDIA_ERR_ABORTED: number; - MEDIA_ERR_DECODE: number; - MEDIA_ERR_NETWORK: number; - MEDIA_ERR_SRC_NOT_SUPPORTED: number; - MS_MEDIA_ERR_ENCRYPTED: number; + readonly MEDIA_ERR_ABORTED: number; + readonly MEDIA_ERR_DECODE: number; + readonly MEDIA_ERR_NETWORK: number; + readonly MEDIA_ERR_SRC_NOT_SUPPORTED: number; + readonly MS_MEDIA_ERR_ENCRYPTED: number; +} + +interface MediaKeyMessageEvent extends Event { + readonly message: ArrayBuffer; + readonly messageType: string; +} + +declare var MediaKeyMessageEvent: { + prototype: MediaKeyMessageEvent; + new(type: string, eventInitDict?: MediaKeyMessageEventInit): MediaKeyMessageEvent; +} + +interface MediaKeySession extends EventTarget { + readonly closed: PromiseLike; + readonly expiration: number; + readonly keyStatuses: MediaKeyStatusMap; + readonly sessionId: string; + close(): PromiseLike; + generateRequest(initDataType: string, initData: any): PromiseLike; + load(sessionId: string): PromiseLike; + remove(): PromiseLike; + update(response: any): PromiseLike; +} + +declare var MediaKeySession: { + prototype: MediaKeySession; + new(): MediaKeySession; +} + +interface MediaKeyStatusMap { + readonly size: number; + forEach(callback: ForEachCallback): void; + get(keyId: any): string; + has(keyId: any): boolean; +} + +declare var MediaKeyStatusMap: { + prototype: MediaKeyStatusMap; + new(): MediaKeyStatusMap; +} + +interface MediaKeySystemAccess { + readonly keySystem: string; + createMediaKeys(): PromiseLike; + getConfiguration(): MediaKeySystemConfiguration; +} + +declare var MediaKeySystemAccess: { + prototype: MediaKeySystemAccess; + new(): MediaKeySystemAccess; +} + +interface MediaKeys { + createSession(sessionType?: string): MediaKeySession; + setServerCertificate(serverCertificate: any): PromiseLike; +} + +declare var MediaKeys: { + prototype: MediaKeys; + new(): MediaKeys; } interface MediaList { - length: number; + readonly length: number; mediaText: string; appendMedium(newMedium: string): void; deleteMedium(oldMedium: string): void; @@ -7633,8 +8374,8 @@ declare var MediaList: { } interface MediaQueryList { - matches: boolean; - media: string; + readonly matches: boolean; + readonly media: string; addListener(listener: MediaQueryListListener): void; removeListener(listener: MediaQueryListListener): void; } @@ -7645,10 +8386,10 @@ declare var MediaQueryList: { } interface MediaSource extends EventTarget { - activeSourceBuffers: SourceBufferList; + readonly activeSourceBuffers: SourceBufferList; duration: number; - readyState: string; - sourceBuffers: SourceBufferList; + readonly readyState: string; + readonly sourceBuffers: SourceBufferList; addSourceBuffer(type: string): SourceBuffer; endOfStream(error?: number): void; removeSourceBuffer(sourceBuffer: SourceBuffer): void; @@ -7660,9 +8401,104 @@ declare var MediaSource: { isTypeSupported(type: string): boolean; } +interface MediaStream extends EventTarget { + readonly active: boolean; + readonly id: string; + onactive: (ev: Event) => any; + onaddtrack: (ev: TrackEvent) => any; + oninactive: (ev: Event) => any; + onremovetrack: (ev: TrackEvent) => any; + addTrack(track: MediaStreamTrack): void; + clone(): MediaStream; + getAudioTracks(): MediaStreamTrack[]; + getTrackById(trackId: string): MediaStreamTrack; + getTracks(): MediaStreamTrack[]; + getVideoTracks(): MediaStreamTrack[]; + removeTrack(track: MediaStreamTrack): void; + stop(): void; + addEventListener(type: "active", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "addtrack", listener: (ev: TrackEvent) => any, useCapture?: boolean): void; + addEventListener(type: "inactive", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "removetrack", listener: (ev: TrackEvent) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var MediaStream: { + prototype: MediaStream; + new(streamOrTracks?: MediaStream | MediaStreamTrack[]): MediaStream; +} + +interface MediaStreamAudioSourceNode extends AudioNode { +} + +declare var MediaStreamAudioSourceNode: { + prototype: MediaStreamAudioSourceNode; + new(): MediaStreamAudioSourceNode; +} + +interface MediaStreamError { + readonly constraintName: string; + readonly message: string; + readonly name: string; +} + +declare var MediaStreamError: { + prototype: MediaStreamError; + new(): MediaStreamError; +} + +interface MediaStreamErrorEvent extends Event { + readonly error: MediaStreamError; +} + +declare var MediaStreamErrorEvent: { + prototype: MediaStreamErrorEvent; + new(type: string, eventInitDict?: MediaStreamErrorEventInit): MediaStreamErrorEvent; +} + +interface MediaStreamTrack extends EventTarget { + enabled: boolean; + readonly id: string; + readonly kind: string; + readonly label: string; + readonly muted: boolean; + onended: (ev: MediaStreamErrorEvent) => any; + onmute: (ev: Event) => any; + onoverconstrained: (ev: MediaStreamErrorEvent) => any; + onunmute: (ev: Event) => any; + readonly readonly: boolean; + readonly readyState: string; + readonly remote: boolean; + applyConstraints(constraints: MediaTrackConstraints): PromiseLike; + clone(): MediaStreamTrack; + getCapabilities(): MediaTrackCapabilities; + getConstraints(): MediaTrackConstraints; + getSettings(): MediaTrackSettings; + stop(): void; + addEventListener(type: "ended", listener: (ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mute", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "overconstrained", listener: (ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: "unmute", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var MediaStreamTrack: { + prototype: MediaStreamTrack; + new(): MediaStreamTrack; +} + +interface MediaStreamTrackEvent extends Event { + readonly track: MediaStreamTrack; +} + +declare var MediaStreamTrackEvent: { + prototype: MediaStreamTrackEvent; + new(type: string, eventInitDict?: MediaStreamTrackEventInit): MediaStreamTrackEvent; +} + interface MessageChannel { - port1: MessagePort; - port2: MessagePort; + readonly port1: MessagePort; + readonly port2: MessagePort; } declare var MessageChannel: { @@ -7671,10 +8507,10 @@ declare var MessageChannel: { } interface MessageEvent extends Event { - data: any; - origin: string; - ports: any; - source: Window; + readonly data: any; + readonly origin: string; + readonly ports: any; + readonly source: Window; initMessageEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, dataArg: any, originArg: string, lastEventIdArg: string, sourceArg: Window): void; } @@ -7698,10 +8534,10 @@ declare var MessagePort: { } interface MimeType { - description: string; - enabledPlugin: Plugin; - suffixes: string; - type: string; + readonly description: string; + readonly enabledPlugin: Plugin; + readonly suffixes: string; + readonly type: string; } declare var MimeType: { @@ -7710,7 +8546,7 @@ declare var MimeType: { } interface MimeTypeArray { - length: number; + readonly length: number; item(index: number): Plugin; namedItem(type: string): Plugin; [index: number]: Plugin; @@ -7722,30 +8558,30 @@ declare var MimeTypeArray: { } interface MouseEvent extends UIEvent { - altKey: boolean; - button: number; - buttons: number; - clientX: number; - clientY: number; - ctrlKey: boolean; - fromElement: Element; - layerX: number; - layerY: number; - metaKey: boolean; - movementX: number; - movementY: number; - offsetX: number; - offsetY: number; - pageX: number; - pageY: number; - relatedTarget: EventTarget; - screenX: number; - screenY: number; - shiftKey: boolean; - toElement: Element; - which: number; - x: number; - y: number; + readonly altKey: boolean; + readonly button: number; + readonly buttons: number; + readonly clientX: number; + readonly clientY: number; + readonly ctrlKey: boolean; + readonly fromElement: Element; + readonly layerX: number; + readonly layerY: number; + readonly metaKey: boolean; + readonly movementX: number; + readonly movementY: number; + readonly offsetX: number; + readonly offsetY: number; + readonly pageX: number; + readonly pageY: number; + readonly relatedTarget: EventTarget; + readonly screenX: number; + readonly screenY: number; + readonly shiftKey: boolean; + readonly toElement: Element; + readonly which: number; + readonly x: number; + readonly y: number; getModifierState(keyArg: string): boolean; 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; } @@ -7755,36 +8591,24 @@ declare var MouseEvent: { new(typeArg: string, eventInitDict?: MouseEventInit): MouseEvent; } -interface MouseWheelEvent extends MouseEvent { - wheelDelta: number; - wheelDeltaX: number; - wheelDeltaY: number; - initMouseWheelEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, screenXArg: number, screenYArg: number, clientXArg: number, clientYArg: number, buttonArg: number, relatedTargetArg: EventTarget, modifiersListArg: string, wheelDeltaArg: number): void; -} - -declare var MouseWheelEvent: { - prototype: MouseWheelEvent; - new(): MouseWheelEvent; -} - interface MutationEvent extends Event { - attrChange: number; - attrName: string; - newValue: string; - prevValue: string; - relatedNode: Node; + readonly attrChange: number; + readonly attrName: string; + readonly newValue: string; + readonly prevValue: string; + readonly relatedNode: Node; initMutationEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, relatedNodeArg: Node, prevValueArg: string, newValueArg: string, attrNameArg: string, attrChangeArg: number): void; - ADDITION: number; - MODIFICATION: number; - REMOVAL: number; + readonly ADDITION: number; + readonly MODIFICATION: number; + readonly REMOVAL: number; } declare var MutationEvent: { prototype: MutationEvent; new(): MutationEvent; - ADDITION: number; - MODIFICATION: number; - REMOVAL: number; + readonly ADDITION: number; + readonly MODIFICATION: number; + readonly REMOVAL: number; } interface MutationObserver { @@ -7799,15 +8623,15 @@ declare var MutationObserver: { } interface MutationRecord { - addedNodes: NodeList; - attributeName: string; - attributeNamespace: string; - nextSibling: Node; - oldValue: string; - previousSibling: Node; - removedNodes: NodeList; - target: Node; - type: string; + readonly addedNodes: NodeList; + readonly attributeName: string; + readonly attributeNamespace: string; + readonly nextSibling: Node; + readonly oldValue: string; + readonly previousSibling: Node; + readonly removedNodes: NodeList; + readonly target: Node; + readonly type: string; } declare var MutationRecord: { @@ -7816,7 +8640,7 @@ declare var MutationRecord: { } interface NamedNodeMap { - length: number; + readonly length: number; getNamedItem(name: string): Attr; getNamedItemNS(namespaceURI: string, localName: string): Attr; item(index: number): Attr; @@ -7833,8 +8657,8 @@ declare var NamedNodeMap: { } interface NavigationCompletedEvent extends NavigationEvent { - isSuccess: boolean; - webErrorStatus: number; + readonly isSuccess: boolean; + readonly webErrorStatus: number; } declare var NavigationCompletedEvent: { @@ -7843,7 +8667,7 @@ declare var NavigationCompletedEvent: { } interface NavigationEvent extends Event { - uri: string; + readonly uri: string; } declare var NavigationEvent: { @@ -7852,7 +8676,7 @@ declare var NavigationEvent: { } interface NavigationEventWithReferrer extends NavigationEvent { - referer: string; + readonly referer: string; } declare var NavigationEventWithReferrer: { @@ -7860,27 +8684,22 @@ declare var NavigationEventWithReferrer: { new(): NavigationEventWithReferrer; } -interface Navigator extends Object, NavigatorID, NavigatorOnLine, NavigatorContentUtils, NavigatorStorageUtils, NavigatorGeolocation, MSNavigatorDoNotTrack, MSFileSaver { - appCodeName: string; - appMinorVersion: string; - browserLanguage: string; - connectionSpeed: number; - cookieEnabled: boolean; - cpuClass: string; - language: string; - maxTouchPoints: number; - mimeTypes: MSMimeTypesCollection; - msManipulationViewsEnabled: boolean; - msMaxTouchPoints: number; - msPointerEnabled: boolean; - plugins: MSPluginsCollection; - pointerEnabled: boolean; - systemLanguage: string; - userLanguage: string; - webdriver: boolean; +interface Navigator extends Object, NavigatorID, NavigatorOnLine, NavigatorContentUtils, NavigatorStorageUtils, NavigatorGeolocation, MSNavigatorDoNotTrack, MSFileSaver, NavigatorUserMedia { + readonly appCodeName: string; + readonly cookieEnabled: boolean; + readonly language: string; + readonly maxTouchPoints: number; + readonly mimeTypes: MimeTypeArray; + readonly msManipulationViewsEnabled: boolean; + readonly msMaxTouchPoints: number; + readonly msPointerEnabled: boolean; + readonly plugins: PluginArray; + readonly pointerEnabled: boolean; + readonly webdriver: boolean; getGamepads(): Gamepad[]; javaEnabled(): boolean; msLaunchUri(uri: string, successCallback?: MSLaunchUriCallback, noHandlerCallback?: MSLaunchUriCallback): void; + requestMediaKeySystemAccess(keySystem: string, supportedConfigurations: MediaKeySystemConfiguration[]): PromiseLike; vibrate(pattern: number | number[]): boolean; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -7891,26 +8710,26 @@ declare var Navigator: { } interface Node extends EventTarget { - attributes: NamedNodeMap; - baseURI: string; - childNodes: NodeList; - firstChild: Node; - lastChild: Node; - localName: string; - namespaceURI: string; - nextSibling: Node; - nodeName: string; - nodeType: number; + readonly attributes: NamedNodeMap; + readonly baseURI: string; + readonly childNodes: NodeList; + readonly firstChild: Node; + readonly lastChild: Node; + readonly localName: string; + readonly namespaceURI: string; + readonly nextSibling: Node; + readonly nodeName: string; + readonly nodeType: number; nodeValue: string; - ownerDocument: Document; - parentElement: HTMLElement; - parentNode: Node; - prefix: string; - previousSibling: Node; + readonly ownerDocument: Document; + readonly parentElement: HTMLElement; + readonly parentNode: Node; + readonly previousSibling: Node; textContent: string; appendChild(newChild: Node): Node; cloneNode(deep?: boolean): Node; compareDocumentPosition(other: Node): number; + contains(child: Node): boolean; hasAttributes(): boolean; hasChildNodes(): boolean; insertBefore(newChild: Node, refChild?: Node): Node; @@ -7923,47 +8742,47 @@ interface Node extends EventTarget { removeChild(oldChild: Node): Node; replaceChild(newChild: Node, oldChild: Node): Node; contains(node: Node): boolean; - ATTRIBUTE_NODE: number; - CDATA_SECTION_NODE: number; - COMMENT_NODE: number; - DOCUMENT_FRAGMENT_NODE: number; - DOCUMENT_NODE: number; - DOCUMENT_POSITION_CONTAINED_BY: number; - DOCUMENT_POSITION_CONTAINS: number; - DOCUMENT_POSITION_DISCONNECTED: number; - DOCUMENT_POSITION_FOLLOWING: number; - DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC: number; - DOCUMENT_POSITION_PRECEDING: number; - DOCUMENT_TYPE_NODE: number; - ELEMENT_NODE: number; - ENTITY_NODE: number; - ENTITY_REFERENCE_NODE: number; - NOTATION_NODE: number; - PROCESSING_INSTRUCTION_NODE: number; - TEXT_NODE: number; + readonly ATTRIBUTE_NODE: number; + readonly CDATA_SECTION_NODE: number; + readonly COMMENT_NODE: number; + readonly DOCUMENT_FRAGMENT_NODE: number; + readonly DOCUMENT_NODE: number; + readonly DOCUMENT_POSITION_CONTAINED_BY: number; + readonly DOCUMENT_POSITION_CONTAINS: number; + readonly DOCUMENT_POSITION_DISCONNECTED: number; + readonly DOCUMENT_POSITION_FOLLOWING: number; + readonly DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC: number; + readonly DOCUMENT_POSITION_PRECEDING: number; + readonly DOCUMENT_TYPE_NODE: number; + readonly ELEMENT_NODE: number; + readonly ENTITY_NODE: number; + readonly ENTITY_REFERENCE_NODE: number; + readonly NOTATION_NODE: number; + readonly PROCESSING_INSTRUCTION_NODE: number; + readonly TEXT_NODE: number; } declare var Node: { prototype: Node; new(): Node; - ATTRIBUTE_NODE: number; - CDATA_SECTION_NODE: number; - COMMENT_NODE: number; - DOCUMENT_FRAGMENT_NODE: number; - DOCUMENT_NODE: number; - DOCUMENT_POSITION_CONTAINED_BY: number; - DOCUMENT_POSITION_CONTAINS: number; - DOCUMENT_POSITION_DISCONNECTED: number; - DOCUMENT_POSITION_FOLLOWING: number; - DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC: number; - DOCUMENT_POSITION_PRECEDING: number; - DOCUMENT_TYPE_NODE: number; - ELEMENT_NODE: number; - ENTITY_NODE: number; - ENTITY_REFERENCE_NODE: number; - NOTATION_NODE: number; - PROCESSING_INSTRUCTION_NODE: number; - TEXT_NODE: number; + readonly ATTRIBUTE_NODE: number; + readonly CDATA_SECTION_NODE: number; + readonly COMMENT_NODE: number; + readonly DOCUMENT_FRAGMENT_NODE: number; + readonly DOCUMENT_NODE: number; + readonly DOCUMENT_POSITION_CONTAINED_BY: number; + readonly DOCUMENT_POSITION_CONTAINS: number; + readonly DOCUMENT_POSITION_DISCONNECTED: number; + readonly DOCUMENT_POSITION_FOLLOWING: number; + readonly DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC: number; + readonly DOCUMENT_POSITION_PRECEDING: number; + readonly DOCUMENT_TYPE_NODE: number; + readonly ELEMENT_NODE: number; + readonly ENTITY_NODE: number; + readonly ENTITY_REFERENCE_NODE: number; + readonly NOTATION_NODE: number; + readonly PROCESSING_INSTRUCTION_NODE: number; + readonly TEXT_NODE: number; } interface NodeFilter { @@ -7971,29 +8790,29 @@ interface NodeFilter { } declare var NodeFilter: { - FILTER_ACCEPT: number; - FILTER_REJECT: number; - FILTER_SKIP: number; - SHOW_ALL: number; - SHOW_ATTRIBUTE: number; - SHOW_CDATA_SECTION: number; - SHOW_COMMENT: number; - SHOW_DOCUMENT: number; - SHOW_DOCUMENT_FRAGMENT: number; - SHOW_DOCUMENT_TYPE: number; - SHOW_ELEMENT: number; - SHOW_ENTITY: number; - SHOW_ENTITY_REFERENCE: number; - SHOW_NOTATION: number; - SHOW_PROCESSING_INSTRUCTION: number; - SHOW_TEXT: number; + readonly FILTER_ACCEPT: number; + readonly FILTER_REJECT: number; + readonly FILTER_SKIP: number; + readonly SHOW_ALL: number; + readonly SHOW_ATTRIBUTE: number; + readonly SHOW_CDATA_SECTION: number; + readonly SHOW_COMMENT: number; + readonly SHOW_DOCUMENT: number; + readonly SHOW_DOCUMENT_FRAGMENT: number; + readonly SHOW_DOCUMENT_TYPE: number; + readonly SHOW_ELEMENT: number; + readonly SHOW_ENTITY: number; + readonly SHOW_ENTITY_REFERENCE: number; + readonly SHOW_NOTATION: number; + readonly SHOW_PROCESSING_INSTRUCTION: number; + readonly SHOW_TEXT: number; } interface NodeIterator { - expandEntityReferences: boolean; - filter: NodeFilter; - root: Node; - whatToShow: number; + readonly expandEntityReferences: boolean; + readonly filter: NodeFilter; + readonly root: Node; + readonly whatToShow: number; detach(): void; nextNode(): Node; previousNode(): Node; @@ -8005,7 +8824,7 @@ declare var NodeIterator: { } interface NodeList { - length: number; + readonly length: number; item(index: number): Node; [index: number]: Node; } @@ -8024,13 +8843,13 @@ declare var OES_element_index_uint: { } interface OES_standard_derivatives { - FRAGMENT_SHADER_DERIVATIVE_HINT_OES: number; + readonly FRAGMENT_SHADER_DERIVATIVE_HINT_OES: number; } declare var OES_standard_derivatives: { prototype: OES_standard_derivatives; new(): OES_standard_derivatives; - FRAGMENT_SHADER_DERIVATIVE_HINT_OES: number; + readonly FRAGMENT_SHADER_DERIVATIVE_HINT_OES: number; } interface OES_texture_float { @@ -8050,7 +8869,7 @@ declare var OES_texture_float_linear: { } interface OfflineAudioCompletionEvent extends Event { - renderedBuffer: AudioBuffer; + readonly renderedBuffer: AudioBuffer; } declare var OfflineAudioCompletionEvent: { @@ -8060,7 +8879,7 @@ declare var OfflineAudioCompletionEvent: { interface OfflineAudioContext extends AudioContext { oncomplete: (ev: Event) => any; - startRendering(): void; + startRendering(): PromiseLike; addEventListener(type: "complete", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -8071,14 +8890,14 @@ declare var OfflineAudioContext: { } interface OscillatorNode extends AudioNode { - detune: AudioParam; - frequency: AudioParam; - onended: (ev: Event) => any; + readonly detune: AudioParam; + readonly frequency: AudioParam; + onended: (ev: MediaStreamErrorEvent) => any; type: string; setPeriodicWave(periodicWave: PeriodicWave): void; start(when?: number): void; stop(when?: number): void; - addEventListener(type: "ended", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "ended", listener: (ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -8087,8 +8906,25 @@ declare var OscillatorNode: { new(): OscillatorNode; } +interface OverflowEvent extends UIEvent { + readonly horizontalOverflow: boolean; + readonly orient: number; + readonly verticalOverflow: boolean; + readonly BOTH: number; + readonly HORIZONTAL: number; + readonly VERTICAL: number; +} + +declare var OverflowEvent: { + prototype: OverflowEvent; + new(): OverflowEvent; + readonly BOTH: number; + readonly HORIZONTAL: number; + readonly VERTICAL: number; +} + interface PageTransitionEvent extends Event { - persisted: boolean; + readonly persisted: boolean; } declare var PageTransitionEvent: { @@ -8116,17 +8952,17 @@ declare var PannerNode: { } interface PerfWidgetExternal { - activeNetworkRequestCount: number; - averageFrameTime: number; - averagePaintTime: number; - extraInformationEnabled: boolean; - independentRenderingEnabled: boolean; - irDisablingContentString: string; - irStatusAvailable: boolean; - maxCpuSpeed: number; - paintRequestsPerSecond: number; - performanceCounter: number; - performanceCounterFrequency: number; + readonly activeNetworkRequestCount: number; + readonly averageFrameTime: number; + readonly averagePaintTime: number; + readonly extraInformationEnabled: boolean; + readonly independentRenderingEnabled: boolean; + readonly irDisablingContentString: string; + readonly irStatusAvailable: boolean; + readonly maxCpuSpeed: number; + readonly paintRequestsPerSecond: number; + readonly performanceCounter: number; + readonly performanceCounterFrequency: number; addEventListener(eventType: string, callback: Function): void; getMemoryUsage(): number; getProcessCpuUsage(): number; @@ -8145,8 +8981,8 @@ declare var PerfWidgetExternal: { } interface Performance { - navigation: PerformanceNavigation; - timing: PerformanceTiming; + readonly navigation: PerformanceNavigation; + readonly timing: PerformanceTiming; clearMarks(markName?: string): void; clearMeasures(measureName?: string): void; clearResourceTimings(): void; @@ -8168,10 +9004,10 @@ declare var Performance: { } interface PerformanceEntry { - duration: number; - entryType: string; - name: string; - startTime: number; + readonly duration: number; + readonly entryType: string; + readonly name: string; + readonly startTime: number; } declare var PerformanceEntry: { @@ -8196,47 +9032,47 @@ declare var PerformanceMeasure: { } interface PerformanceNavigation { - redirectCount: number; - type: number; + readonly redirectCount: number; + readonly type: number; toJSON(): any; - TYPE_BACK_FORWARD: number; - TYPE_NAVIGATE: number; - TYPE_RELOAD: number; - TYPE_RESERVED: number; + readonly TYPE_BACK_FORWARD: number; + readonly TYPE_NAVIGATE: number; + readonly TYPE_RELOAD: number; + readonly TYPE_RESERVED: number; } declare var PerformanceNavigation: { prototype: PerformanceNavigation; new(): PerformanceNavigation; - TYPE_BACK_FORWARD: number; - TYPE_NAVIGATE: number; - TYPE_RELOAD: number; - TYPE_RESERVED: number; + readonly TYPE_BACK_FORWARD: number; + readonly TYPE_NAVIGATE: number; + readonly TYPE_RELOAD: number; + readonly TYPE_RESERVED: number; } interface PerformanceNavigationTiming extends PerformanceEntry { - connectEnd: number; - connectStart: number; - domComplete: number; - domContentLoadedEventEnd: number; - domContentLoadedEventStart: number; - domInteractive: number; - domLoading: number; - domainLookupEnd: number; - domainLookupStart: number; - fetchStart: number; - loadEventEnd: number; - loadEventStart: number; - navigationStart: number; - redirectCount: number; - redirectEnd: number; - redirectStart: number; - requestStart: number; - responseEnd: number; - responseStart: number; - type: string; - unloadEventEnd: number; - unloadEventStart: number; + readonly connectEnd: number; + readonly connectStart: number; + readonly domComplete: number; + readonly domContentLoadedEventEnd: number; + readonly domContentLoadedEventStart: number; + readonly domInteractive: number; + readonly domLoading: number; + readonly domainLookupEnd: number; + readonly domainLookupStart: number; + readonly fetchStart: number; + readonly loadEventEnd: number; + readonly loadEventStart: number; + readonly navigationStart: number; + readonly redirectCount: number; + readonly redirectEnd: number; + readonly redirectStart: number; + readonly requestStart: number; + readonly responseEnd: number; + readonly responseStart: number; + readonly type: string; + readonly unloadEventEnd: number; + readonly unloadEventStart: number; } declare var PerformanceNavigationTiming: { @@ -8245,17 +9081,17 @@ declare var PerformanceNavigationTiming: { } interface PerformanceResourceTiming extends PerformanceEntry { - connectEnd: number; - connectStart: number; - domainLookupEnd: number; - domainLookupStart: number; - fetchStart: number; - initiatorType: string; - redirectEnd: number; - redirectStart: number; - requestStart: number; - responseEnd: number; - responseStart: number; + readonly connectEnd: number; + readonly connectStart: number; + readonly domainLookupEnd: number; + readonly domainLookupStart: number; + readonly fetchStart: number; + readonly initiatorType: string; + readonly redirectEnd: number; + readonly redirectStart: number; + readonly requestStart: number; + readonly responseEnd: number; + readonly responseStart: number; } declare var PerformanceResourceTiming: { @@ -8264,27 +9100,27 @@ declare var PerformanceResourceTiming: { } interface PerformanceTiming { - connectEnd: number; - connectStart: number; - domComplete: number; - domContentLoadedEventEnd: number; - domContentLoadedEventStart: number; - domInteractive: number; - domLoading: number; - domainLookupEnd: number; - domainLookupStart: number; - fetchStart: number; - loadEventEnd: number; - loadEventStart: number; - msFirstPaint: number; - navigationStart: number; - redirectEnd: number; - redirectStart: number; - requestStart: number; - responseEnd: number; - responseStart: number; - unloadEventEnd: number; - unloadEventStart: number; + readonly connectEnd: number; + readonly connectStart: number; + readonly domComplete: number; + readonly domContentLoadedEventEnd: number; + readonly domContentLoadedEventStart: number; + readonly domInteractive: number; + readonly domLoading: number; + readonly domainLookupEnd: number; + readonly domainLookupStart: number; + readonly fetchStart: number; + readonly loadEventEnd: number; + readonly loadEventStart: number; + readonly msFirstPaint: number; + readonly navigationStart: number; + readonly redirectEnd: number; + readonly redirectStart: number; + readonly requestStart: number; + readonly responseEnd: number; + readonly responseStart: number; + readonly unloadEventEnd: number; + readonly unloadEventStart: number; toJSON(): any; } @@ -8302,7 +9138,7 @@ declare var PeriodicWave: { } interface PermissionRequest extends DeferredPermissionRequest { - state: string; + readonly state: string; defer(): void; } @@ -8312,7 +9148,7 @@ declare var PermissionRequest: { } interface PermissionRequestedEvent extends Event { - permissionRequest: PermissionRequest; + readonly permissionRequest: PermissionRequest; } declare var PermissionRequestedEvent: { @@ -8321,11 +9157,11 @@ declare var PermissionRequestedEvent: { } interface Plugin { - description: string; - filename: string; - length: number; - name: string; - version: string; + readonly description: string; + readonly filename: string; + readonly length: number; + readonly name: string; + readonly version: string; item(index: number): MimeType; namedItem(type: string): MimeType; [index: number]: MimeType; @@ -8337,7 +9173,7 @@ declare var Plugin: { } interface PluginArray { - length: number; + readonly length: number; item(index: number): Plugin; namedItem(name: string): Plugin; refresh(reload?: boolean): void; @@ -8350,18 +9186,18 @@ declare var PluginArray: { } interface PointerEvent extends MouseEvent { - currentPoint: any; - height: number; - hwTimestamp: number; - intermediatePoints: any; - isPrimary: boolean; - pointerId: number; - pointerType: any; - pressure: number; - rotation: number; - tiltX: number; - tiltY: number; - width: number; + readonly currentPoint: any; + readonly height: number; + readonly hwTimestamp: number; + readonly intermediatePoints: any; + readonly isPrimary: boolean; + readonly pointerId: number; + readonly pointerType: any; + readonly pressure: number; + readonly rotation: number; + readonly tiltX: number; + readonly tiltY: number; + readonly width: number; getCurrentPoint(element: Element): void; getIntermediatePoints(element: Element): void; 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; @@ -8373,7 +9209,7 @@ declare var PointerEvent: { } interface PopStateEvent extends Event { - state: any; + readonly state: any; initPopStateEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, stateArg: any): void; } @@ -8383,8 +9219,8 @@ declare var PopStateEvent: { } interface Position { - coords: Coordinates; - timestamp: number; + readonly coords: Coordinates; + readonly timestamp: number; } declare var Position: { @@ -8393,24 +9229,24 @@ declare var Position: { } interface PositionError { - code: number; - message: string; + readonly code: number; + readonly message: string; toString(): string; - PERMISSION_DENIED: number; - POSITION_UNAVAILABLE: number; - TIMEOUT: number; + readonly PERMISSION_DENIED: number; + readonly POSITION_UNAVAILABLE: number; + readonly TIMEOUT: number; } declare var PositionError: { prototype: PositionError; new(): PositionError; - PERMISSION_DENIED: number; - POSITION_UNAVAILABLE: number; - TIMEOUT: number; + readonly PERMISSION_DENIED: number; + readonly POSITION_UNAVAILABLE: number; + readonly TIMEOUT: number; } interface ProcessingInstruction extends CharacterData { - target: string; + readonly target: string; } declare var ProcessingInstruction: { @@ -8419,9 +9255,9 @@ declare var ProcessingInstruction: { } interface ProgressEvent extends Event { - lengthComputable: boolean; - loaded: number; - total: number; + readonly lengthComputable: boolean; + readonly loaded: number; + readonly total: number; initProgressEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, lengthComputableArg: boolean, loadedArg: number, totalArg: number): void; } @@ -8430,13 +9266,210 @@ declare var ProgressEvent: { new(type: string, eventInitDict?: ProgressEventInit): ProgressEvent; } +interface RTCDTMFToneChangeEvent extends Event { + readonly tone: string; +} + +declare var RTCDTMFToneChangeEvent: { + prototype: RTCDTMFToneChangeEvent; + new(type: string, eventInitDict: RTCDTMFToneChangeEventInit): RTCDTMFToneChangeEvent; +} + +interface RTCDtlsTransport extends RTCStatsProvider { + ondtlsstatechange: (ev: RTCDtlsTransportStateChangedEvent) => any; + onerror: (ev: Event) => any; + readonly state: string; + readonly transport: RTCIceTransport; + getLocalParameters(): RTCDtlsParameters; + getRemoteCertificates(): ArrayBuffer[]; + getRemoteParameters(): RTCDtlsParameters; + start(remoteParameters: RTCDtlsParameters): void; + stop(): void; + addEventListener(type: "dtlsstatechange", listener: (ev: RTCDtlsTransportStateChangedEvent) => any, useCapture?: boolean): void; + addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var RTCDtlsTransport: { + prototype: RTCDtlsTransport; + new(transport: RTCIceTransport): RTCDtlsTransport; +} + +interface RTCDtlsTransportStateChangedEvent extends Event { + readonly state: string; +} + +declare var RTCDtlsTransportStateChangedEvent: { + prototype: RTCDtlsTransportStateChangedEvent; + new(): RTCDtlsTransportStateChangedEvent; +} + +interface RTCDtmfSender extends EventTarget { + readonly canInsertDTMF: boolean; + readonly duration: number; + readonly interToneGap: number; + ontonechange: (ev: RTCDTMFToneChangeEvent) => any; + readonly sender: RTCRtpSender; + readonly toneBuffer: string; + insertDTMF(tones: string, duration?: number, interToneGap?: number): void; + addEventListener(type: "tonechange", listener: (ev: RTCDTMFToneChangeEvent) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var RTCDtmfSender: { + prototype: RTCDtmfSender; + new(sender: RTCRtpSender): RTCDtmfSender; +} + +interface RTCIceCandidatePairChangedEvent extends Event { + readonly pair: RTCIceCandidatePair; +} + +declare var RTCIceCandidatePairChangedEvent: { + prototype: RTCIceCandidatePairChangedEvent; + new(): RTCIceCandidatePairChangedEvent; +} + +interface RTCIceGatherer extends RTCStatsProvider { + readonly component: string; + onerror: (ev: Event) => any; + onlocalcandidate: (ev: RTCIceGathererEvent) => any; + createAssociatedGatherer(): RTCIceGatherer; + getLocalCandidates(): RTCIceCandidate[]; + getLocalParameters(): RTCIceParameters; + addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: "localcandidate", listener: (ev: RTCIceGathererEvent) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var RTCIceGatherer: { + prototype: RTCIceGatherer; + new(options: RTCIceGatherOptions): RTCIceGatherer; +} + +interface RTCIceGathererEvent extends Event { + readonly candidate: RTCIceCandidate | RTCIceCandidateComplete; +} + +declare var RTCIceGathererEvent: { + prototype: RTCIceGathererEvent; + new(): RTCIceGathererEvent; +} + +interface RTCIceTransport extends RTCStatsProvider { + readonly component: string; + readonly iceGatherer: RTCIceGatherer; + oncandidatepairchange: (ev: RTCIceCandidatePairChangedEvent) => any; + onicestatechange: (ev: RTCIceTransportStateChangedEvent) => any; + readonly role: string; + readonly state: string; + addRemoteCandidate(remoteCandidate: RTCIceCandidate | RTCIceCandidateComplete): void; + createAssociatedTransport(): RTCIceTransport; + getNominatedCandidatePair(): RTCIceCandidatePair; + getRemoteCandidates(): RTCIceCandidate[]; + getRemoteParameters(): RTCIceParameters; + setRemoteCandidates(remoteCandidates: RTCIceCandidate[]): void; + start(gatherer: RTCIceGatherer, remoteParameters: RTCIceParameters, role?: string): void; + stop(): void; + addEventListener(type: "candidatepairchange", listener: (ev: RTCIceCandidatePairChangedEvent) => any, useCapture?: boolean): void; + addEventListener(type: "icestatechange", listener: (ev: RTCIceTransportStateChangedEvent) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var RTCIceTransport: { + prototype: RTCIceTransport; + new(): RTCIceTransport; +} + +interface RTCIceTransportStateChangedEvent extends Event { + readonly state: string; +} + +declare var RTCIceTransportStateChangedEvent: { + prototype: RTCIceTransportStateChangedEvent; + new(): RTCIceTransportStateChangedEvent; +} + +interface RTCRtpReceiver extends RTCStatsProvider { + onerror: (ev: Event) => any; + readonly rtcpTransport: RTCDtlsTransport; + readonly track: MediaStreamTrack; + readonly transport: RTCDtlsTransport | RTCSrtpSdesTransport; + getContributingSources(): RTCRtpContributingSource[]; + receive(parameters: RTCRtpParameters): void; + requestSendCSRC(csrc: number): void; + setTransport(transport: RTCDtlsTransport | RTCSrtpSdesTransport, rtcpTransport?: RTCDtlsTransport): void; + stop(): void; + addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var RTCRtpReceiver: { + prototype: RTCRtpReceiver; + new(transport: RTCDtlsTransport | RTCSrtpSdesTransport, kind: string, rtcpTransport?: RTCDtlsTransport): RTCRtpReceiver; + getCapabilities(kind?: string): RTCRtpCapabilities; +} + +interface RTCRtpSender extends RTCStatsProvider { + onerror: (ev: Event) => any; + onssrcconflict: (ev: RTCSsrcConflictEvent) => any; + readonly rtcpTransport: RTCDtlsTransport; + readonly track: MediaStreamTrack; + readonly transport: RTCDtlsTransport | RTCSrtpSdesTransport; + send(parameters: RTCRtpParameters): void; + setTrack(track: MediaStreamTrack): void; + setTransport(transport: RTCDtlsTransport | RTCSrtpSdesTransport, rtcpTransport?: RTCDtlsTransport): void; + stop(): void; + addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: "ssrcconflict", listener: (ev: RTCSsrcConflictEvent) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var RTCRtpSender: { + prototype: RTCRtpSender; + new(track: MediaStreamTrack, transport: RTCDtlsTransport | RTCSrtpSdesTransport, rtcpTransport?: RTCDtlsTransport): RTCRtpSender; + getCapabilities(kind?: string): RTCRtpCapabilities; +} + +interface RTCSrtpSdesTransport extends EventTarget { + onerror: (ev: Event) => any; + readonly transport: RTCIceTransport; + addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var RTCSrtpSdesTransport: { + prototype: RTCSrtpSdesTransport; + new(transport: RTCIceTransport, encryptParameters: RTCSrtpSdesParameters, decryptParameters: RTCSrtpSdesParameters): RTCSrtpSdesTransport; + getLocalParameters(): RTCSrtpSdesParameters[]; +} + +interface RTCSsrcConflictEvent extends Event { + readonly ssrc: number; +} + +declare var RTCSsrcConflictEvent: { + prototype: RTCSsrcConflictEvent; + new(): RTCSsrcConflictEvent; +} + +interface RTCStatsProvider extends EventTarget { + getStats(): PromiseLike; + msGetStats(): PromiseLike; +} + +declare var RTCStatsProvider: { + prototype: RTCStatsProvider; + new(): RTCStatsProvider; +} + interface Range { - collapsed: boolean; - commonAncestorContainer: Node; - endContainer: Node; - endOffset: number; - startContainer: Node; - startOffset: number; + readonly collapsed: boolean; + readonly commonAncestorContainer: Node; + readonly endContainer: Node; + readonly endOffset: number; + readonly startContainer: Node; + readonly startOffset: number; cloneContents(): DocumentFragment; cloneRange(): Range; collapse(toStart: boolean): void; @@ -8459,23 +9492,23 @@ interface Range { setStartBefore(refNode: Node): void; surroundContents(newParent: Node): void; toString(): string; - END_TO_END: number; - END_TO_START: number; - START_TO_END: number; - START_TO_START: number; + readonly END_TO_END: number; + readonly END_TO_START: number; + readonly START_TO_END: number; + readonly START_TO_START: number; } declare var Range: { prototype: Range; new(): Range; - END_TO_END: number; - END_TO_START: number; - START_TO_END: number; - START_TO_START: number; + readonly END_TO_END: number; + readonly END_TO_START: number; + readonly START_TO_END: number; + readonly START_TO_START: number; } interface SVGAElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired, SVGURIReference { - target: SVGAnimatedString; + readonly target: SVGAnimatedString; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -8485,32 +9518,32 @@ declare var SVGAElement: { } interface SVGAngle { - unitType: number; + readonly unitType: number; value: number; valueAsString: string; valueInSpecifiedUnits: number; convertToSpecifiedUnits(unitType: number): void; newValueSpecifiedUnits(unitType: number, valueInSpecifiedUnits: number): void; - SVG_ANGLETYPE_DEG: number; - SVG_ANGLETYPE_GRAD: number; - SVG_ANGLETYPE_RAD: number; - SVG_ANGLETYPE_UNKNOWN: number; - SVG_ANGLETYPE_UNSPECIFIED: number; + readonly SVG_ANGLETYPE_DEG: number; + readonly SVG_ANGLETYPE_GRAD: number; + readonly SVG_ANGLETYPE_RAD: number; + readonly SVG_ANGLETYPE_UNKNOWN: number; + readonly SVG_ANGLETYPE_UNSPECIFIED: number; } declare var SVGAngle: { prototype: SVGAngle; new(): SVGAngle; - SVG_ANGLETYPE_DEG: number; - SVG_ANGLETYPE_GRAD: number; - SVG_ANGLETYPE_RAD: number; - SVG_ANGLETYPE_UNKNOWN: number; - SVG_ANGLETYPE_UNSPECIFIED: number; + readonly SVG_ANGLETYPE_DEG: number; + readonly SVG_ANGLETYPE_GRAD: number; + readonly SVG_ANGLETYPE_RAD: number; + readonly SVG_ANGLETYPE_UNKNOWN: number; + readonly SVG_ANGLETYPE_UNSPECIFIED: number; } interface SVGAnimatedAngle { - animVal: SVGAngle; - baseVal: SVGAngle; + readonly animVal: SVGAngle; + readonly baseVal: SVGAngle; } declare var SVGAnimatedAngle: { @@ -8519,7 +9552,7 @@ declare var SVGAnimatedAngle: { } interface SVGAnimatedBoolean { - animVal: boolean; + readonly animVal: boolean; baseVal: boolean; } @@ -8529,7 +9562,7 @@ declare var SVGAnimatedBoolean: { } interface SVGAnimatedEnumeration { - animVal: number; + readonly animVal: number; baseVal: number; } @@ -8539,7 +9572,7 @@ declare var SVGAnimatedEnumeration: { } interface SVGAnimatedInteger { - animVal: number; + readonly animVal: number; baseVal: number; } @@ -8549,8 +9582,8 @@ declare var SVGAnimatedInteger: { } interface SVGAnimatedLength { - animVal: SVGLength; - baseVal: SVGLength; + readonly animVal: SVGLength; + readonly baseVal: SVGLength; } declare var SVGAnimatedLength: { @@ -8559,8 +9592,8 @@ declare var SVGAnimatedLength: { } interface SVGAnimatedLengthList { - animVal: SVGLengthList; - baseVal: SVGLengthList; + readonly animVal: SVGLengthList; + readonly baseVal: SVGLengthList; } declare var SVGAnimatedLengthList: { @@ -8569,7 +9602,7 @@ declare var SVGAnimatedLengthList: { } interface SVGAnimatedNumber { - animVal: number; + readonly animVal: number; baseVal: number; } @@ -8579,8 +9612,8 @@ declare var SVGAnimatedNumber: { } interface SVGAnimatedNumberList { - animVal: SVGNumberList; - baseVal: SVGNumberList; + readonly animVal: SVGNumberList; + readonly baseVal: SVGNumberList; } declare var SVGAnimatedNumberList: { @@ -8589,8 +9622,8 @@ declare var SVGAnimatedNumberList: { } interface SVGAnimatedPreserveAspectRatio { - animVal: SVGPreserveAspectRatio; - baseVal: SVGPreserveAspectRatio; + readonly animVal: SVGPreserveAspectRatio; + readonly baseVal: SVGPreserveAspectRatio; } declare var SVGAnimatedPreserveAspectRatio: { @@ -8599,8 +9632,8 @@ declare var SVGAnimatedPreserveAspectRatio: { } interface SVGAnimatedRect { - animVal: SVGRect; - baseVal: SVGRect; + readonly animVal: SVGRect; + readonly baseVal: SVGRect; } declare var SVGAnimatedRect: { @@ -8609,7 +9642,7 @@ declare var SVGAnimatedRect: { } interface SVGAnimatedString { - animVal: string; + readonly animVal: string; baseVal: string; } @@ -8619,8 +9652,8 @@ declare var SVGAnimatedString: { } interface SVGAnimatedTransformList { - animVal: SVGTransformList; - baseVal: SVGTransformList; + readonly animVal: SVGTransformList; + readonly baseVal: SVGTransformList; } declare var SVGAnimatedTransformList: { @@ -8629,9 +9662,9 @@ declare var SVGAnimatedTransformList: { } interface SVGCircleElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired { - cx: SVGAnimatedLength; - cy: SVGAnimatedLength; - r: SVGAnimatedLength; + readonly cx: SVGAnimatedLength; + readonly cy: SVGAnimatedLength; + readonly r: SVGAnimatedLength; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -8641,7 +9674,7 @@ declare var SVGCircleElement: { } interface SVGClipPathElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired, SVGUnitTypes { - clipPathUnits: SVGAnimatedEnumeration; + readonly clipPathUnits: SVGAnimatedEnumeration; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -8651,30 +9684,30 @@ declare var SVGClipPathElement: { } interface SVGComponentTransferFunctionElement extends SVGElement { - amplitude: SVGAnimatedNumber; - exponent: SVGAnimatedNumber; - intercept: SVGAnimatedNumber; - offset: SVGAnimatedNumber; - slope: SVGAnimatedNumber; - tableValues: SVGAnimatedNumberList; - type: SVGAnimatedEnumeration; - SVG_FECOMPONENTTRANSFER_TYPE_DISCRETE: number; - SVG_FECOMPONENTTRANSFER_TYPE_GAMMA: number; - SVG_FECOMPONENTTRANSFER_TYPE_IDENTITY: number; - SVG_FECOMPONENTTRANSFER_TYPE_LINEAR: number; - SVG_FECOMPONENTTRANSFER_TYPE_TABLE: number; - SVG_FECOMPONENTTRANSFER_TYPE_UNKNOWN: number; + readonly amplitude: SVGAnimatedNumber; + readonly exponent: SVGAnimatedNumber; + readonly intercept: SVGAnimatedNumber; + readonly offset: SVGAnimatedNumber; + readonly slope: SVGAnimatedNumber; + readonly tableValues: SVGAnimatedNumberList; + readonly type: SVGAnimatedEnumeration; + readonly SVG_FECOMPONENTTRANSFER_TYPE_DISCRETE: number; + readonly SVG_FECOMPONENTTRANSFER_TYPE_GAMMA: number; + readonly SVG_FECOMPONENTTRANSFER_TYPE_IDENTITY: number; + readonly SVG_FECOMPONENTTRANSFER_TYPE_LINEAR: number; + readonly SVG_FECOMPONENTTRANSFER_TYPE_TABLE: number; + readonly SVG_FECOMPONENTTRANSFER_TYPE_UNKNOWN: number; } declare var SVGComponentTransferFunctionElement: { prototype: SVGComponentTransferFunctionElement; new(): SVGComponentTransferFunctionElement; - SVG_FECOMPONENTTRANSFER_TYPE_DISCRETE: number; - SVG_FECOMPONENTTRANSFER_TYPE_GAMMA: number; - SVG_FECOMPONENTTRANSFER_TYPE_IDENTITY: number; - SVG_FECOMPONENTTRANSFER_TYPE_LINEAR: number; - SVG_FECOMPONENTTRANSFER_TYPE_TABLE: number; - SVG_FECOMPONENTTRANSFER_TYPE_UNKNOWN: number; + readonly SVG_FECOMPONENTTRANSFER_TYPE_DISCRETE: number; + readonly SVG_FECOMPONENTTRANSFER_TYPE_GAMMA: number; + readonly SVG_FECOMPONENTTRANSFER_TYPE_IDENTITY: number; + readonly SVG_FECOMPONENTTRANSFER_TYPE_LINEAR: number; + readonly SVG_FECOMPONENTTRANSFER_TYPE_TABLE: number; + readonly SVG_FECOMPONENTTRANSFER_TYPE_UNKNOWN: number; } interface SVGDefsElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired { @@ -8696,7 +9729,6 @@ declare var SVGDescElement: { } interface SVGElement extends Element { - id: string; onclick: (ev: MouseEvent) => any; ondblclick: (ev: MouseEvent) => any; onfocusin: (ev: FocusEvent) => any; @@ -8707,8 +9739,8 @@ interface SVGElement extends Element { onmouseout: (ev: MouseEvent) => any; onmouseover: (ev: MouseEvent) => any; onmouseup: (ev: MouseEvent) => any; - ownerSVGElement: SVGSVGElement; - viewportElement: SVGElement; + readonly ownerSVGElement: SVGSVGElement; + readonly viewportElement: SVGElement; xmlbase: string; className: any; addEventListener(type: "MSGestureChange", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void; @@ -8766,14 +9798,14 @@ declare var SVGElement: { } interface SVGElementInstance extends EventTarget { - childNodes: SVGElementInstanceList; - correspondingElement: SVGElement; - correspondingUseElement: SVGUseElement; - firstChild: SVGElementInstance; - lastChild: SVGElementInstance; - nextSibling: SVGElementInstance; - parentNode: SVGElementInstance; - previousSibling: SVGElementInstance; + readonly childNodes: SVGElementInstanceList; + readonly correspondingElement: SVGElement; + readonly correspondingUseElement: SVGUseElement; + readonly firstChild: SVGElementInstance; + readonly lastChild: SVGElementInstance; + readonly nextSibling: SVGElementInstance; + readonly parentNode: SVGElementInstance; + readonly previousSibling: SVGElementInstance; } declare var SVGElementInstance: { @@ -8782,7 +9814,7 @@ declare var SVGElementInstance: { } interface SVGElementInstanceList { - length: number; + readonly length: number; item(index: number): SVGElementInstance; } @@ -8792,10 +9824,10 @@ declare var SVGElementInstanceList: { } interface SVGEllipseElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired { - cx: SVGAnimatedLength; - cy: SVGAnimatedLength; - rx: SVGAnimatedLength; - ry: SVGAnimatedLength; + readonly cx: SVGAnimatedLength; + readonly cy: SVGAnimatedLength; + readonly rx: SVGAnimatedLength; + readonly ry: SVGAnimatedLength; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -8805,75 +9837,75 @@ declare var SVGEllipseElement: { } interface SVGFEBlendElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { - in1: SVGAnimatedString; - in2: SVGAnimatedString; - mode: SVGAnimatedEnumeration; - SVG_FEBLEND_MODE_COLOR: number; - SVG_FEBLEND_MODE_COLOR_BURN: number; - SVG_FEBLEND_MODE_COLOR_DODGE: number; - SVG_FEBLEND_MODE_DARKEN: number; - SVG_FEBLEND_MODE_DIFFERENCE: number; - SVG_FEBLEND_MODE_EXCLUSION: number; - SVG_FEBLEND_MODE_HARD_LIGHT: number; - SVG_FEBLEND_MODE_HUE: number; - SVG_FEBLEND_MODE_LIGHTEN: number; - SVG_FEBLEND_MODE_LUMINOSITY: number; - SVG_FEBLEND_MODE_MULTIPLY: number; - SVG_FEBLEND_MODE_NORMAL: number; - SVG_FEBLEND_MODE_OVERLAY: number; - SVG_FEBLEND_MODE_SATURATION: number; - SVG_FEBLEND_MODE_SCREEN: number; - SVG_FEBLEND_MODE_SOFT_LIGHT: number; - SVG_FEBLEND_MODE_UNKNOWN: number; + readonly in1: SVGAnimatedString; + readonly in2: SVGAnimatedString; + readonly mode: SVGAnimatedEnumeration; + readonly SVG_FEBLEND_MODE_COLOR: number; + readonly SVG_FEBLEND_MODE_COLOR_BURN: number; + readonly SVG_FEBLEND_MODE_COLOR_DODGE: number; + readonly SVG_FEBLEND_MODE_DARKEN: number; + readonly SVG_FEBLEND_MODE_DIFFERENCE: number; + readonly SVG_FEBLEND_MODE_EXCLUSION: number; + readonly SVG_FEBLEND_MODE_HARD_LIGHT: number; + readonly SVG_FEBLEND_MODE_HUE: number; + readonly SVG_FEBLEND_MODE_LIGHTEN: number; + readonly SVG_FEBLEND_MODE_LUMINOSITY: number; + readonly SVG_FEBLEND_MODE_MULTIPLY: number; + readonly SVG_FEBLEND_MODE_NORMAL: number; + readonly SVG_FEBLEND_MODE_OVERLAY: number; + readonly SVG_FEBLEND_MODE_SATURATION: number; + readonly SVG_FEBLEND_MODE_SCREEN: number; + readonly SVG_FEBLEND_MODE_SOFT_LIGHT: number; + readonly SVG_FEBLEND_MODE_UNKNOWN: number; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var SVGFEBlendElement: { prototype: SVGFEBlendElement; new(): SVGFEBlendElement; - SVG_FEBLEND_MODE_COLOR: number; - SVG_FEBLEND_MODE_COLOR_BURN: number; - SVG_FEBLEND_MODE_COLOR_DODGE: number; - SVG_FEBLEND_MODE_DARKEN: number; - SVG_FEBLEND_MODE_DIFFERENCE: number; - SVG_FEBLEND_MODE_EXCLUSION: number; - SVG_FEBLEND_MODE_HARD_LIGHT: number; - SVG_FEBLEND_MODE_HUE: number; - SVG_FEBLEND_MODE_LIGHTEN: number; - SVG_FEBLEND_MODE_LUMINOSITY: number; - SVG_FEBLEND_MODE_MULTIPLY: number; - SVG_FEBLEND_MODE_NORMAL: number; - SVG_FEBLEND_MODE_OVERLAY: number; - SVG_FEBLEND_MODE_SATURATION: number; - SVG_FEBLEND_MODE_SCREEN: number; - SVG_FEBLEND_MODE_SOFT_LIGHT: number; - SVG_FEBLEND_MODE_UNKNOWN: number; + readonly SVG_FEBLEND_MODE_COLOR: number; + readonly SVG_FEBLEND_MODE_COLOR_BURN: number; + readonly SVG_FEBLEND_MODE_COLOR_DODGE: number; + readonly SVG_FEBLEND_MODE_DARKEN: number; + readonly SVG_FEBLEND_MODE_DIFFERENCE: number; + readonly SVG_FEBLEND_MODE_EXCLUSION: number; + readonly SVG_FEBLEND_MODE_HARD_LIGHT: number; + readonly SVG_FEBLEND_MODE_HUE: number; + readonly SVG_FEBLEND_MODE_LIGHTEN: number; + readonly SVG_FEBLEND_MODE_LUMINOSITY: number; + readonly SVG_FEBLEND_MODE_MULTIPLY: number; + readonly SVG_FEBLEND_MODE_NORMAL: number; + readonly SVG_FEBLEND_MODE_OVERLAY: number; + readonly SVG_FEBLEND_MODE_SATURATION: number; + readonly SVG_FEBLEND_MODE_SCREEN: number; + readonly SVG_FEBLEND_MODE_SOFT_LIGHT: number; + readonly SVG_FEBLEND_MODE_UNKNOWN: number; } interface SVGFEColorMatrixElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { - in1: SVGAnimatedString; - type: SVGAnimatedEnumeration; - values: SVGAnimatedNumberList; - SVG_FECOLORMATRIX_TYPE_HUEROTATE: number; - SVG_FECOLORMATRIX_TYPE_LUMINANCETOALPHA: number; - SVG_FECOLORMATRIX_TYPE_MATRIX: number; - SVG_FECOLORMATRIX_TYPE_SATURATE: number; - SVG_FECOLORMATRIX_TYPE_UNKNOWN: number; + readonly in1: SVGAnimatedString; + readonly type: SVGAnimatedEnumeration; + readonly values: SVGAnimatedNumberList; + readonly SVG_FECOLORMATRIX_TYPE_HUEROTATE: number; + readonly SVG_FECOLORMATRIX_TYPE_LUMINANCETOALPHA: number; + readonly SVG_FECOLORMATRIX_TYPE_MATRIX: number; + readonly SVG_FECOLORMATRIX_TYPE_SATURATE: number; + readonly SVG_FECOLORMATRIX_TYPE_UNKNOWN: number; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var SVGFEColorMatrixElement: { prototype: SVGFEColorMatrixElement; new(): SVGFEColorMatrixElement; - SVG_FECOLORMATRIX_TYPE_HUEROTATE: number; - SVG_FECOLORMATRIX_TYPE_LUMINANCETOALPHA: number; - SVG_FECOLORMATRIX_TYPE_MATRIX: number; - SVG_FECOLORMATRIX_TYPE_SATURATE: number; - SVG_FECOLORMATRIX_TYPE_UNKNOWN: number; + readonly SVG_FECOLORMATRIX_TYPE_HUEROTATE: number; + readonly SVG_FECOLORMATRIX_TYPE_LUMINANCETOALPHA: number; + readonly SVG_FECOLORMATRIX_TYPE_MATRIX: number; + readonly SVG_FECOLORMATRIX_TYPE_SATURATE: number; + readonly SVG_FECOLORMATRIX_TYPE_UNKNOWN: number; } interface SVGFEComponentTransferElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { - in1: SVGAnimatedString; + readonly in1: SVGAnimatedString; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -8883,70 +9915,70 @@ declare var SVGFEComponentTransferElement: { } interface SVGFECompositeElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { - in1: SVGAnimatedString; - in2: SVGAnimatedString; - k1: SVGAnimatedNumber; - k2: SVGAnimatedNumber; - k3: SVGAnimatedNumber; - k4: SVGAnimatedNumber; - operator: SVGAnimatedEnumeration; - SVG_FECOMPOSITE_OPERATOR_ARITHMETIC: number; - SVG_FECOMPOSITE_OPERATOR_ATOP: number; - SVG_FECOMPOSITE_OPERATOR_IN: number; - SVG_FECOMPOSITE_OPERATOR_OUT: number; - SVG_FECOMPOSITE_OPERATOR_OVER: number; - SVG_FECOMPOSITE_OPERATOR_UNKNOWN: number; - SVG_FECOMPOSITE_OPERATOR_XOR: number; + readonly in1: SVGAnimatedString; + readonly in2: SVGAnimatedString; + readonly k1: SVGAnimatedNumber; + readonly k2: SVGAnimatedNumber; + readonly k3: SVGAnimatedNumber; + readonly k4: SVGAnimatedNumber; + readonly operator: SVGAnimatedEnumeration; + readonly SVG_FECOMPOSITE_OPERATOR_ARITHMETIC: number; + readonly SVG_FECOMPOSITE_OPERATOR_ATOP: number; + readonly SVG_FECOMPOSITE_OPERATOR_IN: number; + readonly SVG_FECOMPOSITE_OPERATOR_OUT: number; + readonly SVG_FECOMPOSITE_OPERATOR_OVER: number; + readonly SVG_FECOMPOSITE_OPERATOR_UNKNOWN: number; + readonly SVG_FECOMPOSITE_OPERATOR_XOR: number; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var SVGFECompositeElement: { prototype: SVGFECompositeElement; new(): SVGFECompositeElement; - SVG_FECOMPOSITE_OPERATOR_ARITHMETIC: number; - SVG_FECOMPOSITE_OPERATOR_ATOP: number; - SVG_FECOMPOSITE_OPERATOR_IN: number; - SVG_FECOMPOSITE_OPERATOR_OUT: number; - SVG_FECOMPOSITE_OPERATOR_OVER: number; - SVG_FECOMPOSITE_OPERATOR_UNKNOWN: number; - SVG_FECOMPOSITE_OPERATOR_XOR: number; + readonly SVG_FECOMPOSITE_OPERATOR_ARITHMETIC: number; + readonly SVG_FECOMPOSITE_OPERATOR_ATOP: number; + readonly SVG_FECOMPOSITE_OPERATOR_IN: number; + readonly SVG_FECOMPOSITE_OPERATOR_OUT: number; + readonly SVG_FECOMPOSITE_OPERATOR_OVER: number; + readonly SVG_FECOMPOSITE_OPERATOR_UNKNOWN: number; + readonly SVG_FECOMPOSITE_OPERATOR_XOR: number; } interface SVGFEConvolveMatrixElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { - bias: SVGAnimatedNumber; - divisor: SVGAnimatedNumber; - edgeMode: SVGAnimatedEnumeration; - in1: SVGAnimatedString; - kernelMatrix: SVGAnimatedNumberList; - kernelUnitLengthX: SVGAnimatedNumber; - kernelUnitLengthY: SVGAnimatedNumber; - orderX: SVGAnimatedInteger; - orderY: SVGAnimatedInteger; - preserveAlpha: SVGAnimatedBoolean; - targetX: SVGAnimatedInteger; - targetY: SVGAnimatedInteger; - SVG_EDGEMODE_DUPLICATE: number; - SVG_EDGEMODE_NONE: number; - SVG_EDGEMODE_UNKNOWN: number; - SVG_EDGEMODE_WRAP: number; + readonly bias: SVGAnimatedNumber; + readonly divisor: SVGAnimatedNumber; + readonly edgeMode: SVGAnimatedEnumeration; + readonly in1: SVGAnimatedString; + readonly kernelMatrix: SVGAnimatedNumberList; + readonly kernelUnitLengthX: SVGAnimatedNumber; + readonly kernelUnitLengthY: SVGAnimatedNumber; + readonly orderX: SVGAnimatedInteger; + readonly orderY: SVGAnimatedInteger; + readonly preserveAlpha: SVGAnimatedBoolean; + readonly targetX: SVGAnimatedInteger; + readonly targetY: SVGAnimatedInteger; + readonly SVG_EDGEMODE_DUPLICATE: number; + readonly SVG_EDGEMODE_NONE: number; + readonly SVG_EDGEMODE_UNKNOWN: number; + readonly SVG_EDGEMODE_WRAP: number; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var SVGFEConvolveMatrixElement: { prototype: SVGFEConvolveMatrixElement; new(): SVGFEConvolveMatrixElement; - SVG_EDGEMODE_DUPLICATE: number; - SVG_EDGEMODE_NONE: number; - SVG_EDGEMODE_UNKNOWN: number; - SVG_EDGEMODE_WRAP: number; + readonly SVG_EDGEMODE_DUPLICATE: number; + readonly SVG_EDGEMODE_NONE: number; + readonly SVG_EDGEMODE_UNKNOWN: number; + readonly SVG_EDGEMODE_WRAP: number; } interface SVGFEDiffuseLightingElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { - diffuseConstant: SVGAnimatedNumber; - in1: SVGAnimatedString; - kernelUnitLengthX: SVGAnimatedNumber; - kernelUnitLengthY: SVGAnimatedNumber; - surfaceScale: SVGAnimatedNumber; + readonly diffuseConstant: SVGAnimatedNumber; + readonly in1: SVGAnimatedString; + readonly kernelUnitLengthX: SVGAnimatedNumber; + readonly kernelUnitLengthY: SVGAnimatedNumber; + readonly surfaceScale: SVGAnimatedNumber; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -8956,32 +9988,32 @@ declare var SVGFEDiffuseLightingElement: { } interface SVGFEDisplacementMapElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { - in1: SVGAnimatedString; - in2: SVGAnimatedString; - scale: SVGAnimatedNumber; - xChannelSelector: SVGAnimatedEnumeration; - yChannelSelector: SVGAnimatedEnumeration; - SVG_CHANNEL_A: number; - SVG_CHANNEL_B: number; - SVG_CHANNEL_G: number; - SVG_CHANNEL_R: number; - SVG_CHANNEL_UNKNOWN: number; + readonly in1: SVGAnimatedString; + readonly in2: SVGAnimatedString; + readonly scale: SVGAnimatedNumber; + readonly xChannelSelector: SVGAnimatedEnumeration; + readonly yChannelSelector: SVGAnimatedEnumeration; + readonly SVG_CHANNEL_A: number; + readonly SVG_CHANNEL_B: number; + readonly SVG_CHANNEL_G: number; + readonly SVG_CHANNEL_R: number; + readonly SVG_CHANNEL_UNKNOWN: number; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var SVGFEDisplacementMapElement: { prototype: SVGFEDisplacementMapElement; new(): SVGFEDisplacementMapElement; - SVG_CHANNEL_A: number; - SVG_CHANNEL_B: number; - SVG_CHANNEL_G: number; - SVG_CHANNEL_R: number; - SVG_CHANNEL_UNKNOWN: number; + readonly SVG_CHANNEL_A: number; + readonly SVG_CHANNEL_B: number; + readonly SVG_CHANNEL_G: number; + readonly SVG_CHANNEL_R: number; + readonly SVG_CHANNEL_UNKNOWN: number; } interface SVGFEDistantLightElement extends SVGElement { - azimuth: SVGAnimatedNumber; - elevation: SVGAnimatedNumber; + readonly azimuth: SVGAnimatedNumber; + readonly elevation: SVGAnimatedNumber; } declare var SVGFEDistantLightElement: { @@ -9031,9 +10063,9 @@ declare var SVGFEFuncRElement: { } interface SVGFEGaussianBlurElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { - in1: SVGAnimatedString; - stdDeviationX: SVGAnimatedNumber; - stdDeviationY: SVGAnimatedNumber; + readonly in1: SVGAnimatedString; + readonly stdDeviationX: SVGAnimatedNumber; + readonly stdDeviationY: SVGAnimatedNumber; setStdDeviation(stdDeviationX: number, stdDeviationY: number): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -9044,7 +10076,7 @@ declare var SVGFEGaussianBlurElement: { } interface SVGFEImageElement extends SVGElement, SVGFilterPrimitiveStandardAttributes, SVGLangSpace, SVGURIReference, SVGExternalResourcesRequired { - preserveAspectRatio: SVGAnimatedPreserveAspectRatio; + readonly preserveAspectRatio: SVGAnimatedPreserveAspectRatio; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -9063,7 +10095,7 @@ declare var SVGFEMergeElement: { } interface SVGFEMergeNodeElement extends SVGElement { - in1: SVGAnimatedString; + readonly in1: SVGAnimatedString; } declare var SVGFEMergeNodeElement: { @@ -9072,28 +10104,28 @@ declare var SVGFEMergeNodeElement: { } interface SVGFEMorphologyElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { - in1: SVGAnimatedString; - operator: SVGAnimatedEnumeration; - radiusX: SVGAnimatedNumber; - radiusY: SVGAnimatedNumber; - SVG_MORPHOLOGY_OPERATOR_DILATE: number; - SVG_MORPHOLOGY_OPERATOR_ERODE: number; - SVG_MORPHOLOGY_OPERATOR_UNKNOWN: number; + readonly in1: SVGAnimatedString; + readonly operator: SVGAnimatedEnumeration; + readonly radiusX: SVGAnimatedNumber; + readonly radiusY: SVGAnimatedNumber; + readonly SVG_MORPHOLOGY_OPERATOR_DILATE: number; + readonly SVG_MORPHOLOGY_OPERATOR_ERODE: number; + readonly SVG_MORPHOLOGY_OPERATOR_UNKNOWN: number; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var SVGFEMorphologyElement: { prototype: SVGFEMorphologyElement; new(): SVGFEMorphologyElement; - SVG_MORPHOLOGY_OPERATOR_DILATE: number; - SVG_MORPHOLOGY_OPERATOR_ERODE: number; - SVG_MORPHOLOGY_OPERATOR_UNKNOWN: number; + readonly SVG_MORPHOLOGY_OPERATOR_DILATE: number; + readonly SVG_MORPHOLOGY_OPERATOR_ERODE: number; + readonly SVG_MORPHOLOGY_OPERATOR_UNKNOWN: number; } interface SVGFEOffsetElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { - dx: SVGAnimatedNumber; - dy: SVGAnimatedNumber; - in1: SVGAnimatedString; + readonly dx: SVGAnimatedNumber; + readonly dy: SVGAnimatedNumber; + readonly in1: SVGAnimatedString; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -9103,9 +10135,9 @@ declare var SVGFEOffsetElement: { } interface SVGFEPointLightElement extends SVGElement { - x: SVGAnimatedNumber; - y: SVGAnimatedNumber; - z: SVGAnimatedNumber; + readonly x: SVGAnimatedNumber; + readonly y: SVGAnimatedNumber; + readonly z: SVGAnimatedNumber; } declare var SVGFEPointLightElement: { @@ -9114,12 +10146,12 @@ declare var SVGFEPointLightElement: { } interface SVGFESpecularLightingElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { - in1: SVGAnimatedString; - kernelUnitLengthX: SVGAnimatedNumber; - kernelUnitLengthY: SVGAnimatedNumber; - specularConstant: SVGAnimatedNumber; - specularExponent: SVGAnimatedNumber; - surfaceScale: SVGAnimatedNumber; + readonly in1: SVGAnimatedString; + readonly kernelUnitLengthX: SVGAnimatedNumber; + readonly kernelUnitLengthY: SVGAnimatedNumber; + readonly specularConstant: SVGAnimatedNumber; + readonly specularExponent: SVGAnimatedNumber; + readonly surfaceScale: SVGAnimatedNumber; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -9129,14 +10161,14 @@ declare var SVGFESpecularLightingElement: { } interface SVGFESpotLightElement extends SVGElement { - limitingConeAngle: SVGAnimatedNumber; - pointsAtX: SVGAnimatedNumber; - pointsAtY: SVGAnimatedNumber; - pointsAtZ: SVGAnimatedNumber; - specularExponent: SVGAnimatedNumber; - x: SVGAnimatedNumber; - y: SVGAnimatedNumber; - z: SVGAnimatedNumber; + readonly limitingConeAngle: SVGAnimatedNumber; + readonly pointsAtX: SVGAnimatedNumber; + readonly pointsAtY: SVGAnimatedNumber; + readonly pointsAtZ: SVGAnimatedNumber; + readonly specularExponent: SVGAnimatedNumber; + readonly x: SVGAnimatedNumber; + readonly y: SVGAnimatedNumber; + readonly z: SVGAnimatedNumber; } declare var SVGFESpotLightElement: { @@ -9145,7 +10177,7 @@ declare var SVGFESpotLightElement: { } interface SVGFETileElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { - in1: SVGAnimatedString; + readonly in1: SVGAnimatedString; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -9155,41 +10187,41 @@ declare var SVGFETileElement: { } interface SVGFETurbulenceElement extends SVGElement, SVGFilterPrimitiveStandardAttributes { - baseFrequencyX: SVGAnimatedNumber; - baseFrequencyY: SVGAnimatedNumber; - numOctaves: SVGAnimatedInteger; - seed: SVGAnimatedNumber; - stitchTiles: SVGAnimatedEnumeration; - type: SVGAnimatedEnumeration; - SVG_STITCHTYPE_NOSTITCH: number; - SVG_STITCHTYPE_STITCH: number; - SVG_STITCHTYPE_UNKNOWN: number; - SVG_TURBULENCE_TYPE_FRACTALNOISE: number; - SVG_TURBULENCE_TYPE_TURBULENCE: number; - SVG_TURBULENCE_TYPE_UNKNOWN: number; + readonly baseFrequencyX: SVGAnimatedNumber; + readonly baseFrequencyY: SVGAnimatedNumber; + readonly numOctaves: SVGAnimatedInteger; + readonly seed: SVGAnimatedNumber; + readonly stitchTiles: SVGAnimatedEnumeration; + readonly type: SVGAnimatedEnumeration; + readonly SVG_STITCHTYPE_NOSTITCH: number; + readonly SVG_STITCHTYPE_STITCH: number; + readonly SVG_STITCHTYPE_UNKNOWN: number; + readonly SVG_TURBULENCE_TYPE_FRACTALNOISE: number; + readonly SVG_TURBULENCE_TYPE_TURBULENCE: number; + readonly SVG_TURBULENCE_TYPE_UNKNOWN: number; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var SVGFETurbulenceElement: { prototype: SVGFETurbulenceElement; new(): SVGFETurbulenceElement; - SVG_STITCHTYPE_NOSTITCH: number; - SVG_STITCHTYPE_STITCH: number; - SVG_STITCHTYPE_UNKNOWN: number; - SVG_TURBULENCE_TYPE_FRACTALNOISE: number; - SVG_TURBULENCE_TYPE_TURBULENCE: number; - SVG_TURBULENCE_TYPE_UNKNOWN: number; + readonly SVG_STITCHTYPE_NOSTITCH: number; + readonly SVG_STITCHTYPE_STITCH: number; + readonly SVG_STITCHTYPE_UNKNOWN: number; + readonly SVG_TURBULENCE_TYPE_FRACTALNOISE: number; + readonly SVG_TURBULENCE_TYPE_TURBULENCE: number; + readonly SVG_TURBULENCE_TYPE_UNKNOWN: number; } interface SVGFilterElement extends SVGElement, SVGUnitTypes, SVGStylable, SVGLangSpace, SVGURIReference, SVGExternalResourcesRequired { - filterResX: SVGAnimatedInteger; - filterResY: SVGAnimatedInteger; - filterUnits: SVGAnimatedEnumeration; - height: SVGAnimatedLength; - primitiveUnits: SVGAnimatedEnumeration; - width: SVGAnimatedLength; - x: SVGAnimatedLength; - y: SVGAnimatedLength; + readonly filterResX: SVGAnimatedInteger; + readonly filterResY: SVGAnimatedInteger; + readonly filterUnits: SVGAnimatedEnumeration; + readonly height: SVGAnimatedLength; + readonly primitiveUnits: SVGAnimatedEnumeration; + readonly width: SVGAnimatedLength; + readonly x: SVGAnimatedLength; + readonly y: SVGAnimatedLength; setFilterRes(filterResX: number, filterResY: number): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -9200,10 +10232,10 @@ declare var SVGFilterElement: { } interface SVGForeignObjectElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired { - height: SVGAnimatedLength; - width: SVGAnimatedLength; - x: SVGAnimatedLength; - y: SVGAnimatedLength; + readonly height: SVGAnimatedLength; + readonly width: SVGAnimatedLength; + readonly x: SVGAnimatedLength; + readonly y: SVGAnimatedLength; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -9222,31 +10254,31 @@ declare var SVGGElement: { } interface SVGGradientElement extends SVGElement, SVGStylable, SVGExternalResourcesRequired, SVGURIReference, SVGUnitTypes { - gradientTransform: SVGAnimatedTransformList; - gradientUnits: SVGAnimatedEnumeration; - spreadMethod: SVGAnimatedEnumeration; - SVG_SPREADMETHOD_PAD: number; - SVG_SPREADMETHOD_REFLECT: number; - SVG_SPREADMETHOD_REPEAT: number; - SVG_SPREADMETHOD_UNKNOWN: number; + readonly gradientTransform: SVGAnimatedTransformList; + readonly gradientUnits: SVGAnimatedEnumeration; + readonly spreadMethod: SVGAnimatedEnumeration; + readonly SVG_SPREADMETHOD_PAD: number; + readonly SVG_SPREADMETHOD_REFLECT: number; + readonly SVG_SPREADMETHOD_REPEAT: number; + readonly SVG_SPREADMETHOD_UNKNOWN: number; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var SVGGradientElement: { prototype: SVGGradientElement; new(): SVGGradientElement; - SVG_SPREADMETHOD_PAD: number; - SVG_SPREADMETHOD_REFLECT: number; - SVG_SPREADMETHOD_REPEAT: number; - SVG_SPREADMETHOD_UNKNOWN: number; + readonly SVG_SPREADMETHOD_PAD: number; + readonly SVG_SPREADMETHOD_REFLECT: number; + readonly SVG_SPREADMETHOD_REPEAT: number; + readonly SVG_SPREADMETHOD_UNKNOWN: number; } interface SVGImageElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired, SVGURIReference { - height: SVGAnimatedLength; - preserveAspectRatio: SVGAnimatedPreserveAspectRatio; - width: SVGAnimatedLength; - x: SVGAnimatedLength; - y: SVGAnimatedLength; + readonly height: SVGAnimatedLength; + readonly preserveAspectRatio: SVGAnimatedPreserveAspectRatio; + readonly width: SVGAnimatedLength; + readonly x: SVGAnimatedLength; + readonly y: SVGAnimatedLength; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -9256,43 +10288,43 @@ declare var SVGImageElement: { } interface SVGLength { - unitType: number; + readonly unitType: number; value: number; valueAsString: string; valueInSpecifiedUnits: number; convertToSpecifiedUnits(unitType: number): void; newValueSpecifiedUnits(unitType: number, valueInSpecifiedUnits: number): void; - SVG_LENGTHTYPE_CM: number; - SVG_LENGTHTYPE_EMS: number; - SVG_LENGTHTYPE_EXS: number; - SVG_LENGTHTYPE_IN: number; - SVG_LENGTHTYPE_MM: number; - SVG_LENGTHTYPE_NUMBER: number; - SVG_LENGTHTYPE_PC: number; - SVG_LENGTHTYPE_PERCENTAGE: number; - SVG_LENGTHTYPE_PT: number; - SVG_LENGTHTYPE_PX: number; - SVG_LENGTHTYPE_UNKNOWN: number; + readonly SVG_LENGTHTYPE_CM: number; + readonly SVG_LENGTHTYPE_EMS: number; + readonly SVG_LENGTHTYPE_EXS: number; + readonly SVG_LENGTHTYPE_IN: number; + readonly SVG_LENGTHTYPE_MM: number; + readonly SVG_LENGTHTYPE_NUMBER: number; + readonly SVG_LENGTHTYPE_PC: number; + readonly SVG_LENGTHTYPE_PERCENTAGE: number; + readonly SVG_LENGTHTYPE_PT: number; + readonly SVG_LENGTHTYPE_PX: number; + readonly SVG_LENGTHTYPE_UNKNOWN: number; } declare var SVGLength: { prototype: SVGLength; new(): SVGLength; - SVG_LENGTHTYPE_CM: number; - SVG_LENGTHTYPE_EMS: number; - SVG_LENGTHTYPE_EXS: number; - SVG_LENGTHTYPE_IN: number; - SVG_LENGTHTYPE_MM: number; - SVG_LENGTHTYPE_NUMBER: number; - SVG_LENGTHTYPE_PC: number; - SVG_LENGTHTYPE_PERCENTAGE: number; - SVG_LENGTHTYPE_PT: number; - SVG_LENGTHTYPE_PX: number; - SVG_LENGTHTYPE_UNKNOWN: number; + readonly SVG_LENGTHTYPE_CM: number; + readonly SVG_LENGTHTYPE_EMS: number; + readonly SVG_LENGTHTYPE_EXS: number; + readonly SVG_LENGTHTYPE_IN: number; + readonly SVG_LENGTHTYPE_MM: number; + readonly SVG_LENGTHTYPE_NUMBER: number; + readonly SVG_LENGTHTYPE_PC: number; + readonly SVG_LENGTHTYPE_PERCENTAGE: number; + readonly SVG_LENGTHTYPE_PT: number; + readonly SVG_LENGTHTYPE_PX: number; + readonly SVG_LENGTHTYPE_UNKNOWN: number; } interface SVGLengthList { - numberOfItems: number; + readonly numberOfItems: number; appendItem(newItem: SVGLength): SVGLength; clear(): void; getItem(index: number): SVGLength; @@ -9308,10 +10340,10 @@ declare var SVGLengthList: { } interface SVGLineElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired { - x1: SVGAnimatedLength; - x2: SVGAnimatedLength; - y1: SVGAnimatedLength; - y2: SVGAnimatedLength; + readonly x1: SVGAnimatedLength; + readonly x2: SVGAnimatedLength; + readonly y1: SVGAnimatedLength; + readonly y2: SVGAnimatedLength; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -9321,10 +10353,10 @@ declare var SVGLineElement: { } interface SVGLinearGradientElement extends SVGGradientElement { - x1: SVGAnimatedLength; - x2: SVGAnimatedLength; - y1: SVGAnimatedLength; - y2: SVGAnimatedLength; + readonly x1: SVGAnimatedLength; + readonly x2: SVGAnimatedLength; + readonly y1: SVGAnimatedLength; + readonly y2: SVGAnimatedLength; } declare var SVGLinearGradientElement: { @@ -9333,42 +10365,42 @@ declare var SVGLinearGradientElement: { } interface SVGMarkerElement extends SVGElement, SVGStylable, SVGLangSpace, SVGExternalResourcesRequired, SVGFitToViewBox { - markerHeight: SVGAnimatedLength; - markerUnits: SVGAnimatedEnumeration; - markerWidth: SVGAnimatedLength; - orientAngle: SVGAnimatedAngle; - orientType: SVGAnimatedEnumeration; - refX: SVGAnimatedLength; - refY: SVGAnimatedLength; + readonly markerHeight: SVGAnimatedLength; + readonly markerUnits: SVGAnimatedEnumeration; + readonly markerWidth: SVGAnimatedLength; + readonly orientAngle: SVGAnimatedAngle; + readonly orientType: SVGAnimatedEnumeration; + readonly refX: SVGAnimatedLength; + readonly refY: SVGAnimatedLength; setOrientToAngle(angle: SVGAngle): void; setOrientToAuto(): void; - SVG_MARKERUNITS_STROKEWIDTH: number; - SVG_MARKERUNITS_UNKNOWN: number; - SVG_MARKERUNITS_USERSPACEONUSE: number; - SVG_MARKER_ORIENT_ANGLE: number; - SVG_MARKER_ORIENT_AUTO: number; - SVG_MARKER_ORIENT_UNKNOWN: number; + readonly SVG_MARKERUNITS_STROKEWIDTH: number; + readonly SVG_MARKERUNITS_UNKNOWN: number; + readonly SVG_MARKERUNITS_USERSPACEONUSE: number; + readonly SVG_MARKER_ORIENT_ANGLE: number; + readonly SVG_MARKER_ORIENT_AUTO: number; + readonly SVG_MARKER_ORIENT_UNKNOWN: number; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var SVGMarkerElement: { prototype: SVGMarkerElement; new(): SVGMarkerElement; - SVG_MARKERUNITS_STROKEWIDTH: number; - SVG_MARKERUNITS_UNKNOWN: number; - SVG_MARKERUNITS_USERSPACEONUSE: number; - SVG_MARKER_ORIENT_ANGLE: number; - SVG_MARKER_ORIENT_AUTO: number; - SVG_MARKER_ORIENT_UNKNOWN: number; + readonly SVG_MARKERUNITS_STROKEWIDTH: number; + readonly SVG_MARKERUNITS_UNKNOWN: number; + readonly SVG_MARKERUNITS_USERSPACEONUSE: number; + readonly SVG_MARKER_ORIENT_ANGLE: number; + readonly SVG_MARKER_ORIENT_AUTO: number; + readonly SVG_MARKER_ORIENT_UNKNOWN: number; } interface SVGMaskElement extends SVGElement, SVGStylable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired, SVGUnitTypes { - height: SVGAnimatedLength; - maskContentUnits: SVGAnimatedEnumeration; - maskUnits: SVGAnimatedEnumeration; - width: SVGAnimatedLength; - x: SVGAnimatedLength; - y: SVGAnimatedLength; + readonly height: SVGAnimatedLength; + readonly maskContentUnits: SVGAnimatedEnumeration; + readonly maskUnits: SVGAnimatedEnumeration; + readonly width: SVGAnimatedLength; + readonly x: SVGAnimatedLength; + readonly y: SVGAnimatedLength; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -9420,7 +10452,7 @@ declare var SVGNumber: { } interface SVGNumberList { - numberOfItems: number; + readonly numberOfItems: number; appendItem(newItem: SVGNumber): SVGNumber; clear(): void; getItem(index: number): SVGNumber; @@ -9467,53 +10499,53 @@ declare var SVGPathElement: { } interface SVGPathSeg { - pathSegType: number; - pathSegTypeAsLetter: string; - PATHSEG_ARC_ABS: number; - PATHSEG_ARC_REL: number; - PATHSEG_CLOSEPATH: number; - PATHSEG_CURVETO_CUBIC_ABS: number; - PATHSEG_CURVETO_CUBIC_REL: number; - PATHSEG_CURVETO_CUBIC_SMOOTH_ABS: number; - PATHSEG_CURVETO_CUBIC_SMOOTH_REL: number; - PATHSEG_CURVETO_QUADRATIC_ABS: number; - PATHSEG_CURVETO_QUADRATIC_REL: number; - PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS: number; - PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL: number; - PATHSEG_LINETO_ABS: number; - PATHSEG_LINETO_HORIZONTAL_ABS: number; - PATHSEG_LINETO_HORIZONTAL_REL: number; - PATHSEG_LINETO_REL: number; - PATHSEG_LINETO_VERTICAL_ABS: number; - PATHSEG_LINETO_VERTICAL_REL: number; - PATHSEG_MOVETO_ABS: number; - PATHSEG_MOVETO_REL: number; - PATHSEG_UNKNOWN: number; + readonly pathSegType: number; + readonly pathSegTypeAsLetter: string; + readonly PATHSEG_ARC_ABS: number; + readonly PATHSEG_ARC_REL: number; + readonly PATHSEG_CLOSEPATH: number; + readonly PATHSEG_CURVETO_CUBIC_ABS: number; + readonly PATHSEG_CURVETO_CUBIC_REL: number; + readonly PATHSEG_CURVETO_CUBIC_SMOOTH_ABS: number; + readonly PATHSEG_CURVETO_CUBIC_SMOOTH_REL: number; + readonly PATHSEG_CURVETO_QUADRATIC_ABS: number; + readonly PATHSEG_CURVETO_QUADRATIC_REL: number; + readonly PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS: number; + readonly PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL: number; + readonly PATHSEG_LINETO_ABS: number; + readonly PATHSEG_LINETO_HORIZONTAL_ABS: number; + readonly PATHSEG_LINETO_HORIZONTAL_REL: number; + readonly PATHSEG_LINETO_REL: number; + readonly PATHSEG_LINETO_VERTICAL_ABS: number; + readonly PATHSEG_LINETO_VERTICAL_REL: number; + readonly PATHSEG_MOVETO_ABS: number; + readonly PATHSEG_MOVETO_REL: number; + readonly PATHSEG_UNKNOWN: number; } declare var SVGPathSeg: { prototype: SVGPathSeg; new(): SVGPathSeg; - PATHSEG_ARC_ABS: number; - PATHSEG_ARC_REL: number; - PATHSEG_CLOSEPATH: number; - PATHSEG_CURVETO_CUBIC_ABS: number; - PATHSEG_CURVETO_CUBIC_REL: number; - PATHSEG_CURVETO_CUBIC_SMOOTH_ABS: number; - PATHSEG_CURVETO_CUBIC_SMOOTH_REL: number; - PATHSEG_CURVETO_QUADRATIC_ABS: number; - PATHSEG_CURVETO_QUADRATIC_REL: number; - PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS: number; - PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL: number; - PATHSEG_LINETO_ABS: number; - PATHSEG_LINETO_HORIZONTAL_ABS: number; - PATHSEG_LINETO_HORIZONTAL_REL: number; - PATHSEG_LINETO_REL: number; - PATHSEG_LINETO_VERTICAL_ABS: number; - PATHSEG_LINETO_VERTICAL_REL: number; - PATHSEG_MOVETO_ABS: number; - PATHSEG_MOVETO_REL: number; - PATHSEG_UNKNOWN: number; + readonly PATHSEG_ARC_ABS: number; + readonly PATHSEG_ARC_REL: number; + readonly PATHSEG_CLOSEPATH: number; + readonly PATHSEG_CURVETO_CUBIC_ABS: number; + readonly PATHSEG_CURVETO_CUBIC_REL: number; + readonly PATHSEG_CURVETO_CUBIC_SMOOTH_ABS: number; + readonly PATHSEG_CURVETO_CUBIC_SMOOTH_REL: number; + readonly PATHSEG_CURVETO_QUADRATIC_ABS: number; + readonly PATHSEG_CURVETO_QUADRATIC_REL: number; + readonly PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS: number; + readonly PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL: number; + readonly PATHSEG_LINETO_ABS: number; + readonly PATHSEG_LINETO_HORIZONTAL_ABS: number; + readonly PATHSEG_LINETO_HORIZONTAL_REL: number; + readonly PATHSEG_LINETO_REL: number; + readonly PATHSEG_LINETO_VERTICAL_ABS: number; + readonly PATHSEG_LINETO_VERTICAL_REL: number; + readonly PATHSEG_MOVETO_ABS: number; + readonly PATHSEG_MOVETO_REL: number; + readonly PATHSEG_UNKNOWN: number; } interface SVGPathSegArcAbs extends SVGPathSeg { @@ -9707,7 +10739,7 @@ declare var SVGPathSegLinetoVerticalRel: { } interface SVGPathSegList { - numberOfItems: number; + readonly numberOfItems: number; appendItem(newItem: SVGPathSeg): SVGPathSeg; clear(): void; getItem(index: number): SVGPathSeg; @@ -9743,13 +10775,13 @@ declare var SVGPathSegMovetoRel: { } interface SVGPatternElement extends SVGElement, SVGStylable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired, SVGFitToViewBox, SVGURIReference, SVGUnitTypes { - height: SVGAnimatedLength; - patternContentUnits: SVGAnimatedEnumeration; - patternTransform: SVGAnimatedTransformList; - patternUnits: SVGAnimatedEnumeration; - width: SVGAnimatedLength; - x: SVGAnimatedLength; - y: SVGAnimatedLength; + readonly height: SVGAnimatedLength; + readonly patternContentUnits: SVGAnimatedEnumeration; + readonly patternTransform: SVGAnimatedTransformList; + readonly patternUnits: SVGAnimatedEnumeration; + readonly width: SVGAnimatedLength; + readonly x: SVGAnimatedLength; + readonly y: SVGAnimatedLength; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -9770,7 +10802,7 @@ declare var SVGPoint: { } interface SVGPointList { - numberOfItems: number; + readonly numberOfItems: number; appendItem(newItem: SVGPoint): SVGPoint; clear(): void; getItem(index: number): SVGPoint; @@ -9806,47 +10838,47 @@ declare var SVGPolylineElement: { interface SVGPreserveAspectRatio { align: number; meetOrSlice: number; - SVG_MEETORSLICE_MEET: number; - SVG_MEETORSLICE_SLICE: number; - SVG_MEETORSLICE_UNKNOWN: number; - SVG_PRESERVEASPECTRATIO_NONE: number; - SVG_PRESERVEASPECTRATIO_UNKNOWN: number; - SVG_PRESERVEASPECTRATIO_XMAXYMAX: number; - SVG_PRESERVEASPECTRATIO_XMAXYMID: number; - SVG_PRESERVEASPECTRATIO_XMAXYMIN: number; - SVG_PRESERVEASPECTRATIO_XMIDYMAX: number; - SVG_PRESERVEASPECTRATIO_XMIDYMID: number; - SVG_PRESERVEASPECTRATIO_XMIDYMIN: number; - SVG_PRESERVEASPECTRATIO_XMINYMAX: number; - SVG_PRESERVEASPECTRATIO_XMINYMID: number; - SVG_PRESERVEASPECTRATIO_XMINYMIN: number; + readonly SVG_MEETORSLICE_MEET: number; + readonly SVG_MEETORSLICE_SLICE: number; + readonly SVG_MEETORSLICE_UNKNOWN: number; + readonly SVG_PRESERVEASPECTRATIO_NONE: number; + readonly SVG_PRESERVEASPECTRATIO_UNKNOWN: number; + readonly SVG_PRESERVEASPECTRATIO_XMAXYMAX: number; + readonly SVG_PRESERVEASPECTRATIO_XMAXYMID: number; + readonly SVG_PRESERVEASPECTRATIO_XMAXYMIN: number; + readonly SVG_PRESERVEASPECTRATIO_XMIDYMAX: number; + readonly SVG_PRESERVEASPECTRATIO_XMIDYMID: number; + readonly SVG_PRESERVEASPECTRATIO_XMIDYMIN: number; + readonly SVG_PRESERVEASPECTRATIO_XMINYMAX: number; + readonly SVG_PRESERVEASPECTRATIO_XMINYMID: number; + readonly SVG_PRESERVEASPECTRATIO_XMINYMIN: number; } declare var SVGPreserveAspectRatio: { prototype: SVGPreserveAspectRatio; new(): SVGPreserveAspectRatio; - SVG_MEETORSLICE_MEET: number; - SVG_MEETORSLICE_SLICE: number; - SVG_MEETORSLICE_UNKNOWN: number; - SVG_PRESERVEASPECTRATIO_NONE: number; - SVG_PRESERVEASPECTRATIO_UNKNOWN: number; - SVG_PRESERVEASPECTRATIO_XMAXYMAX: number; - SVG_PRESERVEASPECTRATIO_XMAXYMID: number; - SVG_PRESERVEASPECTRATIO_XMAXYMIN: number; - SVG_PRESERVEASPECTRATIO_XMIDYMAX: number; - SVG_PRESERVEASPECTRATIO_XMIDYMID: number; - SVG_PRESERVEASPECTRATIO_XMIDYMIN: number; - SVG_PRESERVEASPECTRATIO_XMINYMAX: number; - SVG_PRESERVEASPECTRATIO_XMINYMID: number; - SVG_PRESERVEASPECTRATIO_XMINYMIN: number; + readonly SVG_MEETORSLICE_MEET: number; + readonly SVG_MEETORSLICE_SLICE: number; + readonly SVG_MEETORSLICE_UNKNOWN: number; + readonly SVG_PRESERVEASPECTRATIO_NONE: number; + readonly SVG_PRESERVEASPECTRATIO_UNKNOWN: number; + readonly SVG_PRESERVEASPECTRATIO_XMAXYMAX: number; + readonly SVG_PRESERVEASPECTRATIO_XMAXYMID: number; + readonly SVG_PRESERVEASPECTRATIO_XMAXYMIN: number; + readonly SVG_PRESERVEASPECTRATIO_XMIDYMAX: number; + readonly SVG_PRESERVEASPECTRATIO_XMIDYMID: number; + readonly SVG_PRESERVEASPECTRATIO_XMIDYMIN: number; + readonly SVG_PRESERVEASPECTRATIO_XMINYMAX: number; + readonly SVG_PRESERVEASPECTRATIO_XMINYMID: number; + readonly SVG_PRESERVEASPECTRATIO_XMINYMIN: number; } interface SVGRadialGradientElement extends SVGGradientElement { - cx: SVGAnimatedLength; - cy: SVGAnimatedLength; - fx: SVGAnimatedLength; - fy: SVGAnimatedLength; - r: SVGAnimatedLength; + readonly cx: SVGAnimatedLength; + readonly cy: SVGAnimatedLength; + readonly fx: SVGAnimatedLength; + readonly fy: SVGAnimatedLength; + readonly r: SVGAnimatedLength; } declare var SVGRadialGradientElement: { @@ -9867,12 +10899,12 @@ declare var SVGRect: { } interface SVGRectElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired { - height: SVGAnimatedLength; - rx: SVGAnimatedLength; - ry: SVGAnimatedLength; - width: SVGAnimatedLength; - x: SVGAnimatedLength; - y: SVGAnimatedLength; + readonly height: SVGAnimatedLength; + readonly rx: SVGAnimatedLength; + readonly ry: SVGAnimatedLength; + readonly width: SVGAnimatedLength; + readonly x: SVGAnimatedLength; + readonly y: SVGAnimatedLength; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -9885,22 +10917,22 @@ interface SVGSVGElement extends SVGElement, DocumentEvent, SVGLocatable, SVGTest contentScriptType: string; contentStyleType: string; currentScale: number; - currentTranslate: SVGPoint; - height: SVGAnimatedLength; + readonly currentTranslate: SVGPoint; + readonly height: SVGAnimatedLength; onabort: (ev: Event) => any; onerror: (ev: Event) => any; onresize: (ev: UIEvent) => any; onscroll: (ev: UIEvent) => any; onunload: (ev: Event) => any; onzoom: (ev: SVGZoomEvent) => any; - pixelUnitToMillimeterX: number; - pixelUnitToMillimeterY: number; - screenPixelToMillimeterX: number; - screenPixelToMillimeterY: number; - viewport: SVGRect; - width: SVGAnimatedLength; - x: SVGAnimatedLength; - y: SVGAnimatedLength; + readonly pixelUnitToMillimeterX: number; + readonly pixelUnitToMillimeterY: number; + readonly screenPixelToMillimeterX: number; + readonly screenPixelToMillimeterY: number; + readonly viewport: SVGRect; + readonly width: SVGAnimatedLength; + readonly x: SVGAnimatedLength; + readonly y: SVGAnimatedLength; checkEnclosure(element: SVGElement, rect: SVGRect): boolean; checkIntersection(element: SVGElement, rect: SVGRect): boolean; createSVGAngle(): SVGAngle; @@ -9916,8 +10948,8 @@ interface SVGSVGElement extends SVGElement, DocumentEvent, SVGLocatable, SVGTest getComputedStyle(elt: Element, pseudoElt?: string): CSSStyleDeclaration; getCurrentTime(): number; getElementById(elementId: string): Element; - getEnclosureList(rect: SVGRect, referenceElement: SVGElement): NodeList; - getIntersectionList(rect: SVGRect, referenceElement: SVGElement): NodeList; + getEnclosureList(rect: SVGRect, referenceElement: SVGElement): NodeListOf; + getIntersectionList(rect: SVGRect, referenceElement: SVGElement): NodeListOf; pauseAnimations(): void; setCurrentTime(seconds: number): void; suspendRedraw(maxWaitMilliseconds: number): number; @@ -9995,7 +11027,7 @@ declare var SVGScriptElement: { } interface SVGStopElement extends SVGElement, SVGStylable { - offset: SVGAnimatedNumber; + readonly offset: SVGAnimatedNumber; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -10005,7 +11037,7 @@ declare var SVGStopElement: { } interface SVGStringList { - numberOfItems: number; + readonly numberOfItems: number; appendItem(newItem: string): string; clear(): void; getItem(index: number): string; @@ -10021,6 +11053,7 @@ declare var SVGStringList: { } interface SVGStyleElement extends SVGElement, SVGLangSpace { + disabled: boolean; media: string; title: string; type: string; @@ -10059,8 +11092,8 @@ declare var SVGTSpanElement: { } interface SVGTextContentElement extends SVGElement, SVGStylable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired { - lengthAdjust: SVGAnimatedEnumeration; - textLength: SVGAnimatedLength; + readonly lengthAdjust: SVGAnimatedEnumeration; + readonly textLength: SVGAnimatedLength; getCharNumAtPosition(point: SVGPoint): number; getComputedTextLength(): number; getEndPositionOfChar(charnum: number): SVGPoint; @@ -10070,18 +11103,18 @@ interface SVGTextContentElement extends SVGElement, SVGStylable, SVGTests, SVGLa getStartPositionOfChar(charnum: number): SVGPoint; getSubStringLength(charnum: number, nchars: number): number; selectSubString(charnum: number, nchars: number): void; - LENGTHADJUST_SPACING: number; - LENGTHADJUST_SPACINGANDGLYPHS: number; - LENGTHADJUST_UNKNOWN: number; + readonly LENGTHADJUST_SPACING: number; + readonly LENGTHADJUST_SPACINGANDGLYPHS: number; + readonly LENGTHADJUST_UNKNOWN: number; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var SVGTextContentElement: { prototype: SVGTextContentElement; new(): SVGTextContentElement; - LENGTHADJUST_SPACING: number; - LENGTHADJUST_SPACINGANDGLYPHS: number; - LENGTHADJUST_UNKNOWN: number; + readonly LENGTHADJUST_SPACING: number; + readonly LENGTHADJUST_SPACINGANDGLYPHS: number; + readonly LENGTHADJUST_UNKNOWN: number; } interface SVGTextElement extends SVGTextPositioningElement, SVGTransformable { @@ -10094,35 +11127,35 @@ declare var SVGTextElement: { } interface SVGTextPathElement extends SVGTextContentElement, SVGURIReference { - method: SVGAnimatedEnumeration; - spacing: SVGAnimatedEnumeration; - startOffset: SVGAnimatedLength; - TEXTPATH_METHODTYPE_ALIGN: number; - TEXTPATH_METHODTYPE_STRETCH: number; - TEXTPATH_METHODTYPE_UNKNOWN: number; - TEXTPATH_SPACINGTYPE_AUTO: number; - TEXTPATH_SPACINGTYPE_EXACT: number; - TEXTPATH_SPACINGTYPE_UNKNOWN: number; + readonly method: SVGAnimatedEnumeration; + readonly spacing: SVGAnimatedEnumeration; + readonly startOffset: SVGAnimatedLength; + readonly TEXTPATH_METHODTYPE_ALIGN: number; + readonly TEXTPATH_METHODTYPE_STRETCH: number; + readonly TEXTPATH_METHODTYPE_UNKNOWN: number; + readonly TEXTPATH_SPACINGTYPE_AUTO: number; + readonly TEXTPATH_SPACINGTYPE_EXACT: number; + readonly TEXTPATH_SPACINGTYPE_UNKNOWN: number; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var SVGTextPathElement: { prototype: SVGTextPathElement; new(): SVGTextPathElement; - TEXTPATH_METHODTYPE_ALIGN: number; - TEXTPATH_METHODTYPE_STRETCH: number; - TEXTPATH_METHODTYPE_UNKNOWN: number; - TEXTPATH_SPACINGTYPE_AUTO: number; - TEXTPATH_SPACINGTYPE_EXACT: number; - TEXTPATH_SPACINGTYPE_UNKNOWN: number; + readonly TEXTPATH_METHODTYPE_ALIGN: number; + readonly TEXTPATH_METHODTYPE_STRETCH: number; + readonly TEXTPATH_METHODTYPE_UNKNOWN: number; + readonly TEXTPATH_SPACINGTYPE_AUTO: number; + readonly TEXTPATH_SPACINGTYPE_EXACT: number; + readonly TEXTPATH_SPACINGTYPE_UNKNOWN: number; } interface SVGTextPositioningElement extends SVGTextContentElement { - dx: SVGAnimatedLengthList; - dy: SVGAnimatedLengthList; - rotate: SVGAnimatedNumberList; - x: SVGAnimatedLengthList; - y: SVGAnimatedLengthList; + readonly dx: SVGAnimatedLengthList; + readonly dy: SVGAnimatedLengthList; + readonly rotate: SVGAnimatedNumberList; + readonly x: SVGAnimatedLengthList; + readonly y: SVGAnimatedLengthList; } declare var SVGTextPositioningElement: { @@ -10140,38 +11173,38 @@ declare var SVGTitleElement: { } interface SVGTransform { - angle: number; - matrix: SVGMatrix; - type: number; + readonly angle: number; + readonly matrix: SVGMatrix; + readonly type: number; setMatrix(matrix: SVGMatrix): void; setRotate(angle: number, cx: number, cy: number): void; setScale(sx: number, sy: number): void; setSkewX(angle: number): void; setSkewY(angle: number): void; setTranslate(tx: number, ty: number): void; - SVG_TRANSFORM_MATRIX: number; - SVG_TRANSFORM_ROTATE: number; - SVG_TRANSFORM_SCALE: number; - SVG_TRANSFORM_SKEWX: number; - SVG_TRANSFORM_SKEWY: number; - SVG_TRANSFORM_TRANSLATE: number; - SVG_TRANSFORM_UNKNOWN: number; + readonly SVG_TRANSFORM_MATRIX: number; + readonly SVG_TRANSFORM_ROTATE: number; + readonly SVG_TRANSFORM_SCALE: number; + readonly SVG_TRANSFORM_SKEWX: number; + readonly SVG_TRANSFORM_SKEWY: number; + readonly SVG_TRANSFORM_TRANSLATE: number; + readonly SVG_TRANSFORM_UNKNOWN: number; } declare var SVGTransform: { prototype: SVGTransform; new(): SVGTransform; - SVG_TRANSFORM_MATRIX: number; - SVG_TRANSFORM_ROTATE: number; - SVG_TRANSFORM_SCALE: number; - SVG_TRANSFORM_SKEWX: number; - SVG_TRANSFORM_SKEWY: number; - SVG_TRANSFORM_TRANSLATE: number; - SVG_TRANSFORM_UNKNOWN: number; + readonly SVG_TRANSFORM_MATRIX: number; + readonly SVG_TRANSFORM_ROTATE: number; + readonly SVG_TRANSFORM_SCALE: number; + readonly SVG_TRANSFORM_SKEWX: number; + readonly SVG_TRANSFORM_SKEWY: number; + readonly SVG_TRANSFORM_TRANSLATE: number; + readonly SVG_TRANSFORM_UNKNOWN: number; } interface SVGTransformList { - numberOfItems: number; + readonly numberOfItems: number; appendItem(newItem: SVGTransform): SVGTransform; clear(): void; consolidate(): SVGTransform; @@ -10189,19 +11222,19 @@ declare var SVGTransformList: { } interface SVGUnitTypes { - SVG_UNIT_TYPE_OBJECTBOUNDINGBOX: number; - SVG_UNIT_TYPE_UNKNOWN: number; - SVG_UNIT_TYPE_USERSPACEONUSE: number; + readonly SVG_UNIT_TYPE_OBJECTBOUNDINGBOX: number; + readonly SVG_UNIT_TYPE_UNKNOWN: number; + readonly SVG_UNIT_TYPE_USERSPACEONUSE: number; } declare var SVGUnitTypes: SVGUnitTypes; interface SVGUseElement extends SVGElement, SVGStylable, SVGTransformable, SVGTests, SVGLangSpace, SVGExternalResourcesRequired, SVGURIReference { - animatedInstanceRoot: SVGElementInstance; - height: SVGAnimatedLength; - instanceRoot: SVGElementInstance; - width: SVGAnimatedLength; - x: SVGAnimatedLength; - y: SVGAnimatedLength; + readonly animatedInstanceRoot: SVGElementInstance; + readonly height: SVGAnimatedLength; + readonly instanceRoot: SVGElementInstance; + readonly width: SVGAnimatedLength; + readonly x: SVGAnimatedLength; + readonly y: SVGAnimatedLength; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -10211,7 +11244,7 @@ declare var SVGUseElement: { } interface SVGViewElement extends SVGElement, SVGExternalResourcesRequired, SVGFitToViewBox, SVGZoomAndPan { - viewTarget: SVGStringList; + readonly viewTarget: SVGStringList; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -10221,21 +11254,21 @@ declare var SVGViewElement: { } interface SVGZoomAndPan { - zoomAndPan: number; + readonly zoomAndPan: number; } declare var SVGZoomAndPan: { - SVG_ZOOMANDPAN_DISABLE: number; - SVG_ZOOMANDPAN_MAGNIFY: number; - SVG_ZOOMANDPAN_UNKNOWN: number; + readonly SVG_ZOOMANDPAN_DISABLE: number; + readonly SVG_ZOOMANDPAN_MAGNIFY: number; + readonly SVG_ZOOMANDPAN_UNKNOWN: number; } interface SVGZoomEvent extends UIEvent { - newScale: number; - newTranslate: SVGPoint; - previousScale: number; - previousTranslate: SVGPoint; - zoomRectScreen: SVGRect; + readonly newScale: number; + readonly newTranslate: SVGPoint; + readonly previousScale: number; + readonly previousTranslate: SVGPoint; + readonly zoomRectScreen: SVGRect; } declare var SVGZoomEvent: { @@ -10244,22 +11277,22 @@ declare var SVGZoomEvent: { } interface Screen extends EventTarget { - availHeight: number; - availWidth: number; + readonly availHeight: number; + readonly availWidth: number; bufferDepth: number; - colorDepth: number; - deviceXDPI: number; - deviceYDPI: number; - fontSmoothingEnabled: boolean; - height: number; - logicalXDPI: number; - logicalYDPI: number; - msOrientation: string; + readonly colorDepth: number; + readonly deviceXDPI: number; + readonly deviceYDPI: number; + readonly fontSmoothingEnabled: boolean; + readonly height: number; + readonly logicalXDPI: number; + readonly logicalYDPI: number; + readonly msOrientation: string; onmsorientationchange: (ev: Event) => any; - pixelDepth: number; - systemXDPI: number; - systemYDPI: number; - width: number; + readonly pixelDepth: number; + readonly systemXDPI: number; + readonly systemYDPI: number; + readonly width: number; msLockOrientation(orientations: string | string[]): boolean; msUnlockOrientation(): void; addEventListener(type: "MSOrientationChange", listener: (ev: Event) => any, useCapture?: boolean): void; @@ -10272,8 +11305,8 @@ declare var Screen: { } interface ScriptNotifyEvent extends Event { - callingUri: string; - value: string; + readonly callingUri: string; + readonly value: string; } declare var ScriptNotifyEvent: { @@ -10282,7 +11315,7 @@ declare var ScriptNotifyEvent: { } interface ScriptProcessorNode extends AudioNode { - bufferSize: number; + readonly bufferSize: number; onaudioprocess: (ev: AudioProcessingEvent) => any; addEventListener(type: "audioprocess", listener: (ev: AudioProcessingEvent) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; @@ -10294,13 +11327,13 @@ declare var ScriptProcessorNode: { } interface Selection { - anchorNode: Node; - anchorOffset: number; - focusNode: Node; - focusOffset: number; - isCollapsed: boolean; - rangeCount: number; - type: string; + readonly anchorNode: Node; + readonly anchorOffset: number; + readonly focusNode: Node; + readonly focusOffset: number; + readonly isCollapsed: boolean; + readonly rangeCount: number; + readonly type: string; addRange(range: Range): void; collapse(parentNode: Node, offset: number): void; collapseToEnd(): void; @@ -10325,12 +11358,12 @@ declare var Selection: { interface SourceBuffer extends EventTarget { appendWindowEnd: number; appendWindowStart: number; - audioTracks: AudioTrackList; - buffered: TimeRanges; + readonly audioTracks: AudioTrackList; + readonly buffered: TimeRanges; mode: string; timestampOffset: number; - updating: boolean; - videoTracks: VideoTrackList; + readonly updating: boolean; + readonly videoTracks: VideoTrackList; abort(): void; appendBuffer(data: ArrayBuffer | ArrayBufferView): void; appendStream(stream: MSStream, maxSize?: number): void; @@ -10343,7 +11376,7 @@ declare var SourceBuffer: { } interface SourceBufferList extends EventTarget { - length: number; + readonly length: number; item(index: number): SourceBuffer; [index: number]: SourceBuffer; } @@ -10354,7 +11387,7 @@ declare var SourceBufferList: { } interface StereoPannerNode extends AudioNode { - pan: AudioParam; + readonly pan: AudioParam; } declare var StereoPannerNode: { @@ -10363,9 +11396,9 @@ declare var StereoPannerNode: { } interface Storage { - length: number; + readonly length: number; clear(): void; - getItem(key: string): any; + getItem(key: string): string; key(index: number): string; removeItem(key: string): void; setItem(key: string, data: string): void; @@ -10379,7 +11412,7 @@ declare var Storage: { } interface StorageEvent extends Event { - url: string; + readonly url: string; key?: string; oldValue?: string; newValue?: string; @@ -10392,7 +11425,7 @@ declare var StorageEvent: { } interface StyleMedia { - type: string; + readonly type: string; matchMedium(mediaquery: string): boolean; } @@ -10403,12 +11436,12 @@ declare var StyleMedia: { interface StyleSheet { disabled: boolean; - href: string; - media: MediaList; - ownerNode: Node; - parentStyleSheet: StyleSheet; - title: string; - type: string; + readonly href: string; + readonly media: MediaList; + readonly ownerNode: Node; + readonly parentStyleSheet: StyleSheet; + readonly title: string; + readonly type: string; } declare var StyleSheet: { @@ -10417,7 +11450,7 @@ declare var StyleSheet: { } interface StyleSheetList { - length: number; + readonly length: number; item(index?: number): StyleSheet; [index: number]: StyleSheet; } @@ -10428,7 +11461,7 @@ declare var StyleSheetList: { } interface StyleSheetPageList { - length: number; + readonly length: number; item(index: number): CSSPageRule; [index: number]: CSSPageRule; } @@ -10439,18 +11472,18 @@ declare var StyleSheetPageList: { } interface SubtleCrypto { - decrypt(algorithm: string | Algorithm, key: CryptoKey, data: ArrayBufferView): any; - deriveBits(algorithm: string | Algorithm, baseKey: CryptoKey, length: number): any; - deriveKey(algorithm: string | Algorithm, baseKey: CryptoKey, derivedKeyType: string | Algorithm, extractable: boolean, keyUsages: string[]): any; - digest(algorithm: string | Algorithm, data: ArrayBufferView): any; - encrypt(algorithm: string | Algorithm, key: CryptoKey, data: ArrayBufferView): any; - exportKey(format: string, key: CryptoKey): any; - generateKey(algorithm: string | Algorithm, extractable: boolean, keyUsages: string[]): any; - importKey(format: string, keyData: ArrayBufferView, algorithm: string | Algorithm, extractable: boolean, keyUsages: string[]): any; - sign(algorithm: string | Algorithm, key: CryptoKey, data: ArrayBufferView): any; - unwrapKey(format: string, wrappedKey: ArrayBufferView, unwrappingKey: CryptoKey, unwrapAlgorithm: string | Algorithm, unwrappedKeyAlgorithm: string | Algorithm, extractable: boolean, keyUsages: string[]): any; - verify(algorithm: string | Algorithm, key: CryptoKey, signature: ArrayBufferView, data: ArrayBufferView): any; - wrapKey(format: string, key: CryptoKey, wrappingKey: CryptoKey, wrapAlgorithm: string | Algorithm): any; + decrypt(algorithm: string | Algorithm, key: CryptoKey, data: ArrayBufferView): PromiseLike; + deriveBits(algorithm: string | Algorithm, baseKey: CryptoKey, length: number): PromiseLike; + deriveKey(algorithm: string | Algorithm, baseKey: CryptoKey, derivedKeyType: string | Algorithm, extractable: boolean, keyUsages: string[]): PromiseLike; + digest(algorithm: string | Algorithm, data: ArrayBufferView): PromiseLike; + encrypt(algorithm: string | Algorithm, key: CryptoKey, data: ArrayBufferView): PromiseLike; + exportKey(format: string, key: CryptoKey): PromiseLike; + generateKey(algorithm: string | Algorithm, extractable: boolean, keyUsages: string[]): PromiseLike; + importKey(format: string, keyData: ArrayBufferView, algorithm: string | Algorithm, extractable: boolean, keyUsages: string[]): PromiseLike; + sign(algorithm: string | Algorithm, key: CryptoKey, data: ArrayBufferView): PromiseLike; + unwrapKey(format: string, wrappedKey: ArrayBufferView, unwrappingKey: CryptoKey, unwrapAlgorithm: string | Algorithm, unwrappedKeyAlgorithm: string | Algorithm, extractable: boolean, keyUsages: string[]): PromiseLike; + verify(algorithm: string | Algorithm, key: CryptoKey, signature: ArrayBufferView, data: ArrayBufferView): PromiseLike; + wrapKey(format: string, key: CryptoKey, wrappingKey: CryptoKey, wrapAlgorithm: string | Algorithm): PromiseLike; } declare var SubtleCrypto: { @@ -10459,8 +11492,7 @@ declare var SubtleCrypto: { } interface Text extends CharacterData { - wholeText: string; - replaceWholeText(content: string): Text; + readonly wholeText: string; splitText(offset: number): Text; } @@ -10470,39 +11502,39 @@ declare var Text: { } interface TextEvent extends UIEvent { - data: string; - inputMethod: number; - locale: string; + readonly data: string; + readonly inputMethod: number; + readonly locale: string; initTextEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, dataArg: string, inputMethod: number, locale: string): void; - DOM_INPUT_METHOD_DROP: number; - DOM_INPUT_METHOD_HANDWRITING: number; - DOM_INPUT_METHOD_IME: number; - DOM_INPUT_METHOD_KEYBOARD: number; - DOM_INPUT_METHOD_MULTIMODAL: number; - DOM_INPUT_METHOD_OPTION: number; - DOM_INPUT_METHOD_PASTE: number; - DOM_INPUT_METHOD_SCRIPT: number; - DOM_INPUT_METHOD_UNKNOWN: number; - DOM_INPUT_METHOD_VOICE: number; + readonly DOM_INPUT_METHOD_DROP: number; + readonly DOM_INPUT_METHOD_HANDWRITING: number; + readonly DOM_INPUT_METHOD_IME: number; + readonly DOM_INPUT_METHOD_KEYBOARD: number; + readonly DOM_INPUT_METHOD_MULTIMODAL: number; + readonly DOM_INPUT_METHOD_OPTION: number; + readonly DOM_INPUT_METHOD_PASTE: number; + readonly DOM_INPUT_METHOD_SCRIPT: number; + readonly DOM_INPUT_METHOD_UNKNOWN: number; + readonly DOM_INPUT_METHOD_VOICE: number; } declare var TextEvent: { prototype: TextEvent; new(): TextEvent; - DOM_INPUT_METHOD_DROP: number; - DOM_INPUT_METHOD_HANDWRITING: number; - DOM_INPUT_METHOD_IME: number; - DOM_INPUT_METHOD_KEYBOARD: number; - DOM_INPUT_METHOD_MULTIMODAL: number; - DOM_INPUT_METHOD_OPTION: number; - DOM_INPUT_METHOD_PASTE: number; - DOM_INPUT_METHOD_SCRIPT: number; - DOM_INPUT_METHOD_UNKNOWN: number; - DOM_INPUT_METHOD_VOICE: number; + readonly DOM_INPUT_METHOD_DROP: number; + readonly DOM_INPUT_METHOD_HANDWRITING: number; + readonly DOM_INPUT_METHOD_IME: number; + readonly DOM_INPUT_METHOD_KEYBOARD: number; + readonly DOM_INPUT_METHOD_MULTIMODAL: number; + readonly DOM_INPUT_METHOD_OPTION: number; + readonly DOM_INPUT_METHOD_PASTE: number; + readonly DOM_INPUT_METHOD_SCRIPT: number; + readonly DOM_INPUT_METHOD_UNKNOWN: number; + readonly DOM_INPUT_METHOD_VOICE: number; } interface TextMetrics { - width: number; + readonly width: number; } declare var TextMetrics: { @@ -10510,83 +11542,27 @@ declare var TextMetrics: { new(): TextMetrics; } -interface TextRange { - boundingHeight: number; - boundingLeft: number; - boundingTop: number; - boundingWidth: number; - htmlText: string; - offsetLeft: number; - offsetTop: number; - text: string; - collapse(start?: boolean): void; - compareEndPoints(how: string, sourceRange: TextRange): number; - duplicate(): TextRange; - execCommand(cmdID: string, showUI?: boolean, value?: any): boolean; - execCommandShowHelp(cmdID: string): boolean; - expand(Unit: string): boolean; - findText(string: string, count?: number, flags?: number): boolean; - getBookmark(): string; - getBoundingClientRect(): ClientRect; - getClientRects(): ClientRectList; - inRange(range: TextRange): boolean; - isEqual(range: TextRange): boolean; - move(unit: string, count?: number): number; - moveEnd(unit: string, count?: number): number; - moveStart(unit: string, count?: number): number; - moveToBookmark(bookmark: string): boolean; - moveToElementText(element: Element): void; - moveToPoint(x: number, y: number): void; - parentElement(): Element; - pasteHTML(html: string): void; - queryCommandEnabled(cmdID: string): boolean; - queryCommandIndeterm(cmdID: string): boolean; - queryCommandState(cmdID: string): boolean; - queryCommandSupported(cmdID: string): boolean; - queryCommandText(cmdID: string): string; - queryCommandValue(cmdID: string): any; - scrollIntoView(fStart?: boolean): void; - select(): void; - setEndPoint(how: string, SourceRange: TextRange): void; -} - -declare var TextRange: { - prototype: TextRange; - new(): TextRange; -} - -interface TextRangeCollection { - length: number; - item(index: number): TextRange; - [index: number]: TextRange; -} - -declare var TextRangeCollection: { - prototype: TextRangeCollection; - new(): TextRangeCollection; -} - interface TextTrack extends EventTarget { - activeCues: TextTrackCueList; - cues: TextTrackCueList; - inBandMetadataTrackDispatchType: string; - kind: string; - label: string; - language: string; + readonly activeCues: TextTrackCueList; + readonly cues: TextTrackCueList; + readonly inBandMetadataTrackDispatchType: string; + readonly kind: string; + readonly label: string; + readonly language: string; mode: any; oncuechange: (ev: Event) => any; onerror: (ev: Event) => any; onload: (ev: Event) => any; - readyState: number; + readonly readyState: number; addCue(cue: TextTrackCue): void; removeCue(cue: TextTrackCue): void; - DISABLED: number; - ERROR: number; - HIDDEN: number; - LOADED: number; - LOADING: number; - NONE: number; - SHOWING: number; + readonly DISABLED: number; + readonly ERROR: number; + readonly HIDDEN: number; + readonly LOADED: number; + readonly LOADING: number; + readonly NONE: number; + readonly SHOWING: number; addEventListener(type: "cuechange", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: "load", listener: (ev: Event) => any, useCapture?: boolean): void; @@ -10596,13 +11572,13 @@ interface TextTrack extends EventTarget { declare var TextTrack: { prototype: TextTrack; new(): TextTrack; - DISABLED: number; - ERROR: number; - HIDDEN: number; - LOADED: number; - LOADING: number; - NONE: number; - SHOWING: number; + readonly DISABLED: number; + readonly ERROR: number; + readonly HIDDEN: number; + readonly LOADED: number; + readonly LOADING: number; + readonly NONE: number; + readonly SHOWING: number; } interface TextTrackCue extends EventTarget { @@ -10613,7 +11589,7 @@ interface TextTrackCue extends EventTarget { pauseOnExit: boolean; startTime: number; text: string; - track: TextTrack; + readonly track: TextTrack; getCueAsHTML(): DocumentFragment; addEventListener(type: "enter", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "exit", listener: (ev: Event) => any, useCapture?: boolean): void; @@ -10626,7 +11602,7 @@ declare var TextTrackCue: { } interface TextTrackCueList { - length: number; + readonly length: number; getCueById(id: string): TextTrackCue; item(index: number): TextTrackCue; [index: number]: TextTrackCue; @@ -10638,7 +11614,7 @@ declare var TextTrackCueList: { } interface TextTrackList extends EventTarget { - length: number; + readonly length: number; onaddtrack: (ev: TrackEvent) => any; item(index: number): TextTrack; addEventListener(type: "addtrack", listener: (ev: TrackEvent) => any, useCapture?: boolean): void; @@ -10652,7 +11628,7 @@ declare var TextTrackList: { } interface TimeRanges { - length: number; + readonly length: number; end(index: number): number; start(index: number): number; } @@ -10663,14 +11639,14 @@ declare var TimeRanges: { } interface Touch { - clientX: number; - clientY: number; - identifier: number; - pageX: number; - pageY: number; - screenX: number; - screenY: number; - target: EventTarget; + readonly clientX: number; + readonly clientY: number; + readonly identifier: number; + readonly pageX: number; + readonly pageY: number; + readonly screenX: number; + readonly screenY: number; + readonly target: EventTarget; } declare var Touch: { @@ -10679,13 +11655,13 @@ declare var Touch: { } interface TouchEvent extends UIEvent { - altKey: boolean; - changedTouches: TouchList; - ctrlKey: boolean; - metaKey: boolean; - shiftKey: boolean; - targetTouches: TouchList; - touches: TouchList; + readonly altKey: boolean; + readonly changedTouches: TouchList; + readonly ctrlKey: boolean; + readonly metaKey: boolean; + readonly shiftKey: boolean; + readonly targetTouches: TouchList; + readonly touches: TouchList; } declare var TouchEvent: { @@ -10694,7 +11670,7 @@ declare var TouchEvent: { } interface TouchList { - length: number; + readonly length: number; item(index: number): Touch; [index: number]: Touch; } @@ -10705,7 +11681,7 @@ declare var TouchList: { } interface TrackEvent extends Event { - track: any; + readonly track: any; } declare var TrackEvent: { @@ -10714,8 +11690,8 @@ declare var TrackEvent: { } interface TransitionEvent extends Event { - elapsedTime: number; - propertyName: string; + readonly elapsedTime: number; + readonly propertyName: string; initTransitionEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, propertyNameArg: string, elapsedTimeArg: number): void; } @@ -10726,10 +11702,10 @@ declare var TransitionEvent: { interface TreeWalker { currentNode: Node; - expandEntityReferences: boolean; - filter: NodeFilter; - root: Node; - whatToShow: number; + readonly expandEntityReferences: boolean; + readonly filter: NodeFilter; + readonly root: Node; + readonly whatToShow: number; firstChild(): Node; lastChild(): Node; nextNode(): Node; @@ -10745,8 +11721,8 @@ declare var TreeWalker: { } interface UIEvent extends Event { - detail: number; - view: Window; + readonly detail: number; + readonly view: Window; initUIEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number): void; } @@ -10756,13 +11732,29 @@ declare var UIEvent: { } interface URL { + hash: string; + host: string; + hostname: string; + href: string; + readonly origin: string; + password: string; + pathname: string; + port: string; + protocol: string; + search: string; + username: string; + toString(): string; +} + +declare var URL: { + prototype: URL; + new(url: string, base?: string): URL; createObjectURL(object: any, options?: ObjectURLOptions): string; revokeObjectURL(url: string): void; } -declare var URL: URL; interface UnviewableContentIdentifiedEvent extends NavigationEventWithReferrer { - mediaType: string; + readonly mediaType: string; } declare var UnviewableContentIdentifiedEvent: { @@ -10771,16 +11763,16 @@ declare var UnviewableContentIdentifiedEvent: { } interface ValidityState { - badInput: boolean; - customError: boolean; - patternMismatch: boolean; - rangeOverflow: boolean; - rangeUnderflow: boolean; - stepMismatch: boolean; - tooLong: boolean; - typeMismatch: boolean; - valid: boolean; - valueMissing: boolean; + readonly badInput: boolean; + readonly customError: boolean; + readonly patternMismatch: boolean; + readonly rangeOverflow: boolean; + readonly rangeUnderflow: boolean; + readonly stepMismatch: boolean; + readonly tooLong: boolean; + readonly typeMismatch: boolean; + readonly valid: boolean; + readonly valueMissing: boolean; } declare var ValidityState: { @@ -10789,11 +11781,11 @@ declare var ValidityState: { } interface VideoPlaybackQuality { - corruptedVideoFrames: number; - creationTime: number; - droppedVideoFrames: number; - totalFrameDelay: number; - totalVideoFrames: number; + readonly corruptedVideoFrames: number; + readonly creationTime: number; + readonly droppedVideoFrames: number; + readonly totalFrameDelay: number; + readonly totalVideoFrames: number; } declare var VideoPlaybackQuality: { @@ -10802,12 +11794,12 @@ declare var VideoPlaybackQuality: { } interface VideoTrack { - id: string; + readonly id: string; kind: string; - label: string; + readonly label: string; language: string; selected: boolean; - sourceBuffer: SourceBuffer; + readonly sourceBuffer: SourceBuffer; } declare var VideoTrack: { @@ -10816,11 +11808,11 @@ declare var VideoTrack: { } interface VideoTrackList extends EventTarget { - length: number; + readonly length: number; onaddtrack: (ev: TrackEvent) => any; onchange: (ev: Event) => any; onremovetrack: (ev: TrackEvent) => any; - selectedIndex: number; + readonly selectedIndex: number; getTrackById(id: string): VideoTrack; item(index: number): VideoTrack; addEventListener(type: "addtrack", listener: (ev: TrackEvent) => any, useCapture?: boolean): void; @@ -10836,41 +11828,41 @@ declare var VideoTrackList: { } interface WEBGL_compressed_texture_s3tc { - COMPRESSED_RGBA_S3TC_DXT1_EXT: number; - COMPRESSED_RGBA_S3TC_DXT3_EXT: number; - COMPRESSED_RGBA_S3TC_DXT5_EXT: number; - COMPRESSED_RGB_S3TC_DXT1_EXT: number; + readonly COMPRESSED_RGBA_S3TC_DXT1_EXT: number; + readonly COMPRESSED_RGBA_S3TC_DXT3_EXT: number; + readonly COMPRESSED_RGBA_S3TC_DXT5_EXT: number; + readonly COMPRESSED_RGB_S3TC_DXT1_EXT: number; } declare var WEBGL_compressed_texture_s3tc: { prototype: WEBGL_compressed_texture_s3tc; new(): WEBGL_compressed_texture_s3tc; - COMPRESSED_RGBA_S3TC_DXT1_EXT: number; - COMPRESSED_RGBA_S3TC_DXT3_EXT: number; - COMPRESSED_RGBA_S3TC_DXT5_EXT: number; - COMPRESSED_RGB_S3TC_DXT1_EXT: number; + readonly COMPRESSED_RGBA_S3TC_DXT1_EXT: number; + readonly COMPRESSED_RGBA_S3TC_DXT3_EXT: number; + readonly COMPRESSED_RGBA_S3TC_DXT5_EXT: number; + readonly COMPRESSED_RGB_S3TC_DXT1_EXT: number; } interface WEBGL_debug_renderer_info { - UNMASKED_RENDERER_WEBGL: number; - UNMASKED_VENDOR_WEBGL: number; + readonly UNMASKED_RENDERER_WEBGL: number; + readonly UNMASKED_VENDOR_WEBGL: number; } declare var WEBGL_debug_renderer_info: { prototype: WEBGL_debug_renderer_info; new(): WEBGL_debug_renderer_info; - UNMASKED_RENDERER_WEBGL: number; - UNMASKED_VENDOR_WEBGL: number; + readonly UNMASKED_RENDERER_WEBGL: number; + readonly UNMASKED_VENDOR_WEBGL: number; } interface WEBGL_depth_texture { - UNSIGNED_INT_24_8_WEBGL: number; + readonly UNSIGNED_INT_24_8_WEBGL: number; } declare var WEBGL_depth_texture: { prototype: WEBGL_depth_texture; new(): WEBGL_depth_texture; - UNSIGNED_INT_24_8_WEBGL: number; + readonly UNSIGNED_INT_24_8_WEBGL: number; } interface WaveShaperNode extends AudioNode { @@ -10884,9 +11876,9 @@ declare var WaveShaperNode: { } interface WebGLActiveInfo { - name: string; - size: number; - type: number; + readonly name: string; + readonly size: number; + readonly type: number; } declare var WebGLActiveInfo: { @@ -10903,12 +11895,12 @@ declare var WebGLBuffer: { } interface WebGLContextEvent extends Event { - statusMessage: string; + readonly statusMessage: string; } declare var WebGLContextEvent: { prototype: WebGLContextEvent; - new(): WebGLContextEvent; + new(type: string, eventInitDict?: WebGLContextEventInit): WebGLContextEvent; } interface WebGLFramebuffer extends WebGLObject { @@ -10944,9 +11936,9 @@ declare var WebGLRenderbuffer: { } interface WebGLRenderingContext { - canvas: HTMLCanvasElement; - drawingBufferHeight: number; - drawingBufferWidth: number; + readonly canvas: HTMLCanvasElement; + readonly drawingBufferHeight: number; + readonly drawingBufferWidth: number; activeTexture(texture: number): void; attachShader(program: WebGLProgram, shader: WebGLShader): void; bindAttribLocation(program: WebGLProgram, index: number, name: string): void; @@ -11061,635 +12053,635 @@ interface WebGLRenderingContext { texSubImage2D(target: number, level: number, xoffset: number, yoffset: number, format: number, type: number, video: HTMLVideoElement): void; texSubImage2D(target: number, level: number, xoffset: number, yoffset: number, format: number, type: number, pixels: ImageData): void; uniform1f(location: WebGLUniformLocation, x: number): void; - uniform1fv(location: WebGLUniformLocation, v: Float32Array): void; + uniform1fv(location: WebGLUniformLocation, v: Float32Array | number[]): void; uniform1i(location: WebGLUniformLocation, x: number): void; - uniform1iv(location: WebGLUniformLocation, v: Int32Array): void; + uniform1iv(location: WebGLUniformLocation, v: Int32Array | number[]): void; uniform2f(location: WebGLUniformLocation, x: number, y: number): void; - uniform2fv(location: WebGLUniformLocation, v: Float32Array): void; + uniform2fv(location: WebGLUniformLocation, v: Float32Array | number[]): void; uniform2i(location: WebGLUniformLocation, x: number, y: number): void; - uniform2iv(location: WebGLUniformLocation, v: Int32Array): void; + uniform2iv(location: WebGLUniformLocation, v: Int32Array | number[]): void; uniform3f(location: WebGLUniformLocation, x: number, y: number, z: number): void; - uniform3fv(location: WebGLUniformLocation, v: Float32Array): void; + uniform3fv(location: WebGLUniformLocation, v: Float32Array | number[]): void; uniform3i(location: WebGLUniformLocation, x: number, y: number, z: number): void; - uniform3iv(location: WebGLUniformLocation, v: Int32Array): void; + uniform3iv(location: WebGLUniformLocation, v: Int32Array | number[]): void; uniform4f(location: WebGLUniformLocation, x: number, y: number, z: number, w: number): void; - uniform4fv(location: WebGLUniformLocation, v: Float32Array): void; + uniform4fv(location: WebGLUniformLocation, v: Float32Array | number[]): void; uniform4i(location: WebGLUniformLocation, x: number, y: number, z: number, w: number): void; - uniform4iv(location: WebGLUniformLocation, v: Int32Array): void; - uniformMatrix2fv(location: WebGLUniformLocation, transpose: boolean, value: Float32Array): void; - uniformMatrix3fv(location: WebGLUniformLocation, transpose: boolean, value: Float32Array): void; - uniformMatrix4fv(location: WebGLUniformLocation, transpose: boolean, value: Float32Array): void; + uniform4iv(location: WebGLUniformLocation, v: Int32Array | number[]): void; + uniformMatrix2fv(location: WebGLUniformLocation, transpose: boolean, value: Float32Array | number[]): void; + uniformMatrix3fv(location: WebGLUniformLocation, transpose: boolean, value: Float32Array | number[]): void; + uniformMatrix4fv(location: WebGLUniformLocation, transpose: boolean, value: Float32Array | number[]): void; useProgram(program: WebGLProgram): void; validateProgram(program: WebGLProgram): void; vertexAttrib1f(indx: number, x: number): void; - vertexAttrib1fv(indx: number, values: Float32Array): void; + vertexAttrib1fv(indx: number, values: Float32Array | number[]): void; vertexAttrib2f(indx: number, x: number, y: number): void; - vertexAttrib2fv(indx: number, values: Float32Array): void; + vertexAttrib2fv(indx: number, values: Float32Array | number[]): void; vertexAttrib3f(indx: number, x: number, y: number, z: number): void; - vertexAttrib3fv(indx: number, values: Float32Array): void; + vertexAttrib3fv(indx: number, values: Float32Array | number[]): void; vertexAttrib4f(indx: number, x: number, y: number, z: number, w: number): void; - vertexAttrib4fv(indx: number, values: Float32Array): void; + vertexAttrib4fv(indx: number, values: Float32Array | number[]): void; vertexAttribPointer(indx: number, size: number, type: number, normalized: boolean, stride: number, offset: number): void; viewport(x: number, y: number, width: number, height: number): void; - ACTIVE_ATTRIBUTES: number; - ACTIVE_TEXTURE: number; - ACTIVE_UNIFORMS: number; - ALIASED_LINE_WIDTH_RANGE: number; - ALIASED_POINT_SIZE_RANGE: number; - ALPHA: number; - ALPHA_BITS: number; - ALWAYS: number; - ARRAY_BUFFER: number; - ARRAY_BUFFER_BINDING: number; - ATTACHED_SHADERS: number; - BACK: number; - BLEND: number; - BLEND_COLOR: number; - BLEND_DST_ALPHA: number; - BLEND_DST_RGB: number; - BLEND_EQUATION: number; - BLEND_EQUATION_ALPHA: number; - BLEND_EQUATION_RGB: number; - BLEND_SRC_ALPHA: number; - BLEND_SRC_RGB: number; - BLUE_BITS: number; - BOOL: number; - BOOL_VEC2: number; - BOOL_VEC3: number; - BOOL_VEC4: number; - BROWSER_DEFAULT_WEBGL: number; - BUFFER_SIZE: number; - BUFFER_USAGE: number; - BYTE: number; - CCW: number; - CLAMP_TO_EDGE: number; - COLOR_ATTACHMENT0: number; - COLOR_BUFFER_BIT: number; - COLOR_CLEAR_VALUE: number; - COLOR_WRITEMASK: number; - COMPILE_STATUS: number; - COMPRESSED_TEXTURE_FORMATS: number; - CONSTANT_ALPHA: number; - CONSTANT_COLOR: number; - CONTEXT_LOST_WEBGL: number; - CULL_FACE: number; - CULL_FACE_MODE: number; - CURRENT_PROGRAM: number; - CURRENT_VERTEX_ATTRIB: number; - CW: number; - DECR: number; - DECR_WRAP: number; - DELETE_STATUS: number; - DEPTH_ATTACHMENT: number; - DEPTH_BITS: number; - DEPTH_BUFFER_BIT: number; - DEPTH_CLEAR_VALUE: number; - DEPTH_COMPONENT: number; - DEPTH_COMPONENT16: number; - DEPTH_FUNC: number; - DEPTH_RANGE: number; - DEPTH_STENCIL: number; - DEPTH_STENCIL_ATTACHMENT: number; - DEPTH_TEST: number; - DEPTH_WRITEMASK: number; - DITHER: number; - DONT_CARE: number; - DST_ALPHA: number; - DST_COLOR: number; - DYNAMIC_DRAW: number; - ELEMENT_ARRAY_BUFFER: number; - ELEMENT_ARRAY_BUFFER_BINDING: number; - EQUAL: number; - FASTEST: number; - FLOAT: number; - FLOAT_MAT2: number; - FLOAT_MAT3: number; - FLOAT_MAT4: number; - FLOAT_VEC2: number; - FLOAT_VEC3: number; - FLOAT_VEC4: number; - FRAGMENT_SHADER: number; - FRAMEBUFFER: number; - FRAMEBUFFER_ATTACHMENT_OBJECT_NAME: number; - FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE: number; - FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE: number; - FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL: number; - FRAMEBUFFER_BINDING: number; - FRAMEBUFFER_COMPLETE: number; - FRAMEBUFFER_INCOMPLETE_ATTACHMENT: number; - FRAMEBUFFER_INCOMPLETE_DIMENSIONS: number; - FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT: number; - FRAMEBUFFER_UNSUPPORTED: number; - FRONT: number; - FRONT_AND_BACK: number; - FRONT_FACE: number; - FUNC_ADD: number; - FUNC_REVERSE_SUBTRACT: number; - FUNC_SUBTRACT: number; - GENERATE_MIPMAP_HINT: number; - GEQUAL: number; - GREATER: number; - GREEN_BITS: number; - HIGH_FLOAT: number; - HIGH_INT: number; - IMPLEMENTATION_COLOR_READ_FORMAT: number; - IMPLEMENTATION_COLOR_READ_TYPE: number; - INCR: number; - INCR_WRAP: number; - INT: number; - INT_VEC2: number; - INT_VEC3: number; - INT_VEC4: number; - INVALID_ENUM: number; - INVALID_FRAMEBUFFER_OPERATION: number; - INVALID_OPERATION: number; - INVALID_VALUE: number; - INVERT: number; - KEEP: number; - LEQUAL: number; - LESS: number; - LINEAR: number; - LINEAR_MIPMAP_LINEAR: number; - LINEAR_MIPMAP_NEAREST: number; - LINES: number; - LINE_LOOP: number; - LINE_STRIP: number; - LINE_WIDTH: number; - LINK_STATUS: number; - LOW_FLOAT: number; - LOW_INT: number; - LUMINANCE: number; - LUMINANCE_ALPHA: number; - MAX_COMBINED_TEXTURE_IMAGE_UNITS: number; - MAX_CUBE_MAP_TEXTURE_SIZE: number; - MAX_FRAGMENT_UNIFORM_VECTORS: number; - MAX_RENDERBUFFER_SIZE: number; - MAX_TEXTURE_IMAGE_UNITS: number; - MAX_TEXTURE_SIZE: number; - MAX_VARYING_VECTORS: number; - MAX_VERTEX_ATTRIBS: number; - MAX_VERTEX_TEXTURE_IMAGE_UNITS: number; - MAX_VERTEX_UNIFORM_VECTORS: number; - MAX_VIEWPORT_DIMS: number; - MEDIUM_FLOAT: number; - MEDIUM_INT: number; - MIRRORED_REPEAT: number; - NEAREST: number; - NEAREST_MIPMAP_LINEAR: number; - NEAREST_MIPMAP_NEAREST: number; - NEVER: number; - NICEST: number; - NONE: number; - NOTEQUAL: number; - NO_ERROR: number; - ONE: number; - ONE_MINUS_CONSTANT_ALPHA: number; - ONE_MINUS_CONSTANT_COLOR: number; - ONE_MINUS_DST_ALPHA: number; - ONE_MINUS_DST_COLOR: number; - ONE_MINUS_SRC_ALPHA: number; - ONE_MINUS_SRC_COLOR: number; - OUT_OF_MEMORY: number; - PACK_ALIGNMENT: number; - POINTS: number; - POLYGON_OFFSET_FACTOR: number; - POLYGON_OFFSET_FILL: number; - POLYGON_OFFSET_UNITS: number; - RED_BITS: number; - RENDERBUFFER: number; - RENDERBUFFER_ALPHA_SIZE: number; - RENDERBUFFER_BINDING: number; - RENDERBUFFER_BLUE_SIZE: number; - RENDERBUFFER_DEPTH_SIZE: number; - RENDERBUFFER_GREEN_SIZE: number; - RENDERBUFFER_HEIGHT: number; - RENDERBUFFER_INTERNAL_FORMAT: number; - RENDERBUFFER_RED_SIZE: number; - RENDERBUFFER_STENCIL_SIZE: number; - RENDERBUFFER_WIDTH: number; - RENDERER: number; - REPEAT: number; - REPLACE: number; - RGB: number; - RGB565: number; - RGB5_A1: number; - RGBA: number; - RGBA4: number; - SAMPLER_2D: number; - SAMPLER_CUBE: number; - SAMPLES: number; - SAMPLE_ALPHA_TO_COVERAGE: number; - SAMPLE_BUFFERS: number; - SAMPLE_COVERAGE: number; - SAMPLE_COVERAGE_INVERT: number; - SAMPLE_COVERAGE_VALUE: number; - SCISSOR_BOX: number; - SCISSOR_TEST: number; - SHADER_TYPE: number; - SHADING_LANGUAGE_VERSION: number; - SHORT: number; - SRC_ALPHA: number; - SRC_ALPHA_SATURATE: number; - SRC_COLOR: number; - STATIC_DRAW: number; - STENCIL_ATTACHMENT: number; - STENCIL_BACK_FAIL: number; - STENCIL_BACK_FUNC: number; - STENCIL_BACK_PASS_DEPTH_FAIL: number; - STENCIL_BACK_PASS_DEPTH_PASS: number; - STENCIL_BACK_REF: number; - STENCIL_BACK_VALUE_MASK: number; - STENCIL_BACK_WRITEMASK: number; - STENCIL_BITS: number; - STENCIL_BUFFER_BIT: number; - STENCIL_CLEAR_VALUE: number; - STENCIL_FAIL: number; - STENCIL_FUNC: number; - STENCIL_INDEX: number; - STENCIL_INDEX8: number; - STENCIL_PASS_DEPTH_FAIL: number; - STENCIL_PASS_DEPTH_PASS: number; - STENCIL_REF: number; - STENCIL_TEST: number; - STENCIL_VALUE_MASK: number; - STENCIL_WRITEMASK: number; - STREAM_DRAW: number; - SUBPIXEL_BITS: number; - TEXTURE: number; - TEXTURE0: number; - TEXTURE1: number; - TEXTURE10: number; - TEXTURE11: number; - TEXTURE12: number; - TEXTURE13: number; - TEXTURE14: number; - TEXTURE15: number; - TEXTURE16: number; - TEXTURE17: number; - TEXTURE18: number; - TEXTURE19: number; - TEXTURE2: number; - TEXTURE20: number; - TEXTURE21: number; - TEXTURE22: number; - TEXTURE23: number; - TEXTURE24: number; - TEXTURE25: number; - TEXTURE26: number; - TEXTURE27: number; - TEXTURE28: number; - TEXTURE29: number; - TEXTURE3: number; - TEXTURE30: number; - TEXTURE31: number; - TEXTURE4: number; - TEXTURE5: number; - TEXTURE6: number; - TEXTURE7: number; - TEXTURE8: number; - TEXTURE9: number; - TEXTURE_2D: number; - TEXTURE_BINDING_2D: number; - TEXTURE_BINDING_CUBE_MAP: number; - TEXTURE_CUBE_MAP: number; - TEXTURE_CUBE_MAP_NEGATIVE_X: number; - TEXTURE_CUBE_MAP_NEGATIVE_Y: number; - TEXTURE_CUBE_MAP_NEGATIVE_Z: number; - TEXTURE_CUBE_MAP_POSITIVE_X: number; - TEXTURE_CUBE_MAP_POSITIVE_Y: number; - TEXTURE_CUBE_MAP_POSITIVE_Z: number; - TEXTURE_MAG_FILTER: number; - TEXTURE_MIN_FILTER: number; - TEXTURE_WRAP_S: number; - TEXTURE_WRAP_T: number; - TRIANGLES: number; - TRIANGLE_FAN: number; - TRIANGLE_STRIP: number; - UNPACK_ALIGNMENT: number; - UNPACK_COLORSPACE_CONVERSION_WEBGL: number; - UNPACK_FLIP_Y_WEBGL: number; - UNPACK_PREMULTIPLY_ALPHA_WEBGL: number; - UNSIGNED_BYTE: number; - UNSIGNED_INT: number; - UNSIGNED_SHORT: number; - UNSIGNED_SHORT_4_4_4_4: number; - UNSIGNED_SHORT_5_5_5_1: number; - UNSIGNED_SHORT_5_6_5: number; - VALIDATE_STATUS: number; - VENDOR: number; - VERSION: number; - VERTEX_ATTRIB_ARRAY_BUFFER_BINDING: number; - VERTEX_ATTRIB_ARRAY_ENABLED: number; - VERTEX_ATTRIB_ARRAY_NORMALIZED: number; - VERTEX_ATTRIB_ARRAY_POINTER: number; - VERTEX_ATTRIB_ARRAY_SIZE: number; - VERTEX_ATTRIB_ARRAY_STRIDE: number; - VERTEX_ATTRIB_ARRAY_TYPE: number; - VERTEX_SHADER: number; - VIEWPORT: number; - ZERO: number; + readonly ACTIVE_ATTRIBUTES: number; + readonly ACTIVE_TEXTURE: number; + readonly ACTIVE_UNIFORMS: number; + readonly ALIASED_LINE_WIDTH_RANGE: number; + readonly ALIASED_POINT_SIZE_RANGE: number; + readonly ALPHA: number; + readonly ALPHA_BITS: number; + readonly ALWAYS: number; + readonly ARRAY_BUFFER: number; + readonly ARRAY_BUFFER_BINDING: number; + readonly ATTACHED_SHADERS: number; + readonly BACK: number; + readonly BLEND: number; + readonly BLEND_COLOR: number; + readonly BLEND_DST_ALPHA: number; + readonly BLEND_DST_RGB: number; + readonly BLEND_EQUATION: number; + readonly BLEND_EQUATION_ALPHA: number; + readonly BLEND_EQUATION_RGB: number; + readonly BLEND_SRC_ALPHA: number; + readonly BLEND_SRC_RGB: number; + readonly BLUE_BITS: number; + readonly BOOL: number; + readonly BOOL_VEC2: number; + readonly BOOL_VEC3: number; + readonly BOOL_VEC4: number; + readonly BROWSER_DEFAULT_WEBGL: number; + readonly BUFFER_SIZE: number; + readonly BUFFER_USAGE: number; + readonly BYTE: number; + readonly CCW: number; + readonly CLAMP_TO_EDGE: number; + readonly COLOR_ATTACHMENT0: number; + readonly COLOR_BUFFER_BIT: number; + readonly COLOR_CLEAR_VALUE: number; + readonly COLOR_WRITEMASK: number; + readonly COMPILE_STATUS: number; + readonly COMPRESSED_TEXTURE_FORMATS: number; + readonly CONSTANT_ALPHA: number; + readonly CONSTANT_COLOR: number; + readonly CONTEXT_LOST_WEBGL: number; + readonly CULL_FACE: number; + readonly CULL_FACE_MODE: number; + readonly CURRENT_PROGRAM: number; + readonly CURRENT_VERTEX_ATTRIB: number; + readonly CW: number; + readonly DECR: number; + readonly DECR_WRAP: number; + readonly DELETE_STATUS: number; + readonly DEPTH_ATTACHMENT: number; + readonly DEPTH_BITS: number; + readonly DEPTH_BUFFER_BIT: number; + readonly DEPTH_CLEAR_VALUE: number; + readonly DEPTH_COMPONENT: number; + readonly DEPTH_COMPONENT16: number; + readonly DEPTH_FUNC: number; + readonly DEPTH_RANGE: number; + readonly DEPTH_STENCIL: number; + readonly DEPTH_STENCIL_ATTACHMENT: number; + readonly DEPTH_TEST: number; + readonly DEPTH_WRITEMASK: number; + readonly DITHER: number; + readonly DONT_CARE: number; + readonly DST_ALPHA: number; + readonly DST_COLOR: number; + readonly DYNAMIC_DRAW: number; + readonly ELEMENT_ARRAY_BUFFER: number; + readonly ELEMENT_ARRAY_BUFFER_BINDING: number; + readonly EQUAL: number; + readonly FASTEST: number; + readonly FLOAT: number; + readonly FLOAT_MAT2: number; + readonly FLOAT_MAT3: number; + readonly FLOAT_MAT4: number; + readonly FLOAT_VEC2: number; + readonly FLOAT_VEC3: number; + readonly FLOAT_VEC4: number; + readonly FRAGMENT_SHADER: number; + readonly FRAMEBUFFER: number; + readonly FRAMEBUFFER_ATTACHMENT_OBJECT_NAME: number; + readonly FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE: number; + readonly FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE: number; + readonly FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL: number; + readonly FRAMEBUFFER_BINDING: number; + readonly FRAMEBUFFER_COMPLETE: number; + readonly FRAMEBUFFER_INCOMPLETE_ATTACHMENT: number; + readonly FRAMEBUFFER_INCOMPLETE_DIMENSIONS: number; + readonly FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT: number; + readonly FRAMEBUFFER_UNSUPPORTED: number; + readonly FRONT: number; + readonly FRONT_AND_BACK: number; + readonly FRONT_FACE: number; + readonly FUNC_ADD: number; + readonly FUNC_REVERSE_SUBTRACT: number; + readonly FUNC_SUBTRACT: number; + readonly GENERATE_MIPMAP_HINT: number; + readonly GEQUAL: number; + readonly GREATER: number; + readonly GREEN_BITS: number; + readonly HIGH_FLOAT: number; + readonly HIGH_INT: number; + readonly IMPLEMENTATION_COLOR_READ_FORMAT: number; + readonly IMPLEMENTATION_COLOR_READ_TYPE: number; + readonly INCR: number; + readonly INCR_WRAP: number; + readonly INT: number; + readonly INT_VEC2: number; + readonly INT_VEC3: number; + readonly INT_VEC4: number; + readonly INVALID_ENUM: number; + readonly INVALID_FRAMEBUFFER_OPERATION: number; + readonly INVALID_OPERATION: number; + readonly INVALID_VALUE: number; + readonly INVERT: number; + readonly KEEP: number; + readonly LEQUAL: number; + readonly LESS: number; + readonly LINEAR: number; + readonly LINEAR_MIPMAP_LINEAR: number; + readonly LINEAR_MIPMAP_NEAREST: number; + readonly LINES: number; + readonly LINE_LOOP: number; + readonly LINE_STRIP: number; + readonly LINE_WIDTH: number; + readonly LINK_STATUS: number; + readonly LOW_FLOAT: number; + readonly LOW_INT: number; + readonly LUMINANCE: number; + readonly LUMINANCE_ALPHA: number; + readonly MAX_COMBINED_TEXTURE_IMAGE_UNITS: number; + readonly MAX_CUBE_MAP_TEXTURE_SIZE: number; + readonly MAX_FRAGMENT_UNIFORM_VECTORS: number; + readonly MAX_RENDERBUFFER_SIZE: number; + readonly MAX_TEXTURE_IMAGE_UNITS: number; + readonly MAX_TEXTURE_SIZE: number; + readonly MAX_VARYING_VECTORS: number; + readonly MAX_VERTEX_ATTRIBS: number; + readonly MAX_VERTEX_TEXTURE_IMAGE_UNITS: number; + readonly MAX_VERTEX_UNIFORM_VECTORS: number; + readonly MAX_VIEWPORT_DIMS: number; + readonly MEDIUM_FLOAT: number; + readonly MEDIUM_INT: number; + readonly MIRRORED_REPEAT: number; + readonly NEAREST: number; + readonly NEAREST_MIPMAP_LINEAR: number; + readonly NEAREST_MIPMAP_NEAREST: number; + readonly NEVER: number; + readonly NICEST: number; + readonly NONE: number; + readonly NOTEQUAL: number; + readonly NO_ERROR: number; + readonly ONE: number; + readonly ONE_MINUS_CONSTANT_ALPHA: number; + readonly ONE_MINUS_CONSTANT_COLOR: number; + readonly ONE_MINUS_DST_ALPHA: number; + readonly ONE_MINUS_DST_COLOR: number; + readonly ONE_MINUS_SRC_ALPHA: number; + readonly ONE_MINUS_SRC_COLOR: number; + readonly OUT_OF_MEMORY: number; + readonly PACK_ALIGNMENT: number; + readonly POINTS: number; + readonly POLYGON_OFFSET_FACTOR: number; + readonly POLYGON_OFFSET_FILL: number; + readonly POLYGON_OFFSET_UNITS: number; + readonly RED_BITS: number; + readonly RENDERBUFFER: number; + readonly RENDERBUFFER_ALPHA_SIZE: number; + readonly RENDERBUFFER_BINDING: number; + readonly RENDERBUFFER_BLUE_SIZE: number; + readonly RENDERBUFFER_DEPTH_SIZE: number; + readonly RENDERBUFFER_GREEN_SIZE: number; + readonly RENDERBUFFER_HEIGHT: number; + readonly RENDERBUFFER_INTERNAL_FORMAT: number; + readonly RENDERBUFFER_RED_SIZE: number; + readonly RENDERBUFFER_STENCIL_SIZE: number; + readonly RENDERBUFFER_WIDTH: number; + readonly RENDERER: number; + readonly REPEAT: number; + readonly REPLACE: number; + readonly RGB: number; + readonly RGB565: number; + readonly RGB5_A1: number; + readonly RGBA: number; + readonly RGBA4: number; + readonly SAMPLER_2D: number; + readonly SAMPLER_CUBE: number; + readonly SAMPLES: number; + readonly SAMPLE_ALPHA_TO_COVERAGE: number; + readonly SAMPLE_BUFFERS: number; + readonly SAMPLE_COVERAGE: number; + readonly SAMPLE_COVERAGE_INVERT: number; + readonly SAMPLE_COVERAGE_VALUE: number; + readonly SCISSOR_BOX: number; + readonly SCISSOR_TEST: number; + readonly SHADER_TYPE: number; + readonly SHADING_LANGUAGE_VERSION: number; + readonly SHORT: number; + readonly SRC_ALPHA: number; + readonly SRC_ALPHA_SATURATE: number; + readonly SRC_COLOR: number; + readonly STATIC_DRAW: number; + readonly STENCIL_ATTACHMENT: number; + readonly STENCIL_BACK_FAIL: number; + readonly STENCIL_BACK_FUNC: number; + readonly STENCIL_BACK_PASS_DEPTH_FAIL: number; + readonly STENCIL_BACK_PASS_DEPTH_PASS: number; + readonly STENCIL_BACK_REF: number; + readonly STENCIL_BACK_VALUE_MASK: number; + readonly STENCIL_BACK_WRITEMASK: number; + readonly STENCIL_BITS: number; + readonly STENCIL_BUFFER_BIT: number; + readonly STENCIL_CLEAR_VALUE: number; + readonly STENCIL_FAIL: number; + readonly STENCIL_FUNC: number; + readonly STENCIL_INDEX: number; + readonly STENCIL_INDEX8: number; + readonly STENCIL_PASS_DEPTH_FAIL: number; + readonly STENCIL_PASS_DEPTH_PASS: number; + readonly STENCIL_REF: number; + readonly STENCIL_TEST: number; + readonly STENCIL_VALUE_MASK: number; + readonly STENCIL_WRITEMASK: number; + readonly STREAM_DRAW: number; + readonly SUBPIXEL_BITS: number; + readonly TEXTURE: number; + readonly TEXTURE0: number; + readonly TEXTURE1: number; + readonly TEXTURE10: number; + readonly TEXTURE11: number; + readonly TEXTURE12: number; + readonly TEXTURE13: number; + readonly TEXTURE14: number; + readonly TEXTURE15: number; + readonly TEXTURE16: number; + readonly TEXTURE17: number; + readonly TEXTURE18: number; + readonly TEXTURE19: number; + readonly TEXTURE2: number; + readonly TEXTURE20: number; + readonly TEXTURE21: number; + readonly TEXTURE22: number; + readonly TEXTURE23: number; + readonly TEXTURE24: number; + readonly TEXTURE25: number; + readonly TEXTURE26: number; + readonly TEXTURE27: number; + readonly TEXTURE28: number; + readonly TEXTURE29: number; + readonly TEXTURE3: number; + readonly TEXTURE30: number; + readonly TEXTURE31: number; + readonly TEXTURE4: number; + readonly TEXTURE5: number; + readonly TEXTURE6: number; + readonly TEXTURE7: number; + readonly TEXTURE8: number; + readonly TEXTURE9: number; + readonly TEXTURE_2D: number; + readonly TEXTURE_BINDING_2D: number; + readonly TEXTURE_BINDING_CUBE_MAP: number; + readonly TEXTURE_CUBE_MAP: number; + readonly TEXTURE_CUBE_MAP_NEGATIVE_X: number; + readonly TEXTURE_CUBE_MAP_NEGATIVE_Y: number; + readonly TEXTURE_CUBE_MAP_NEGATIVE_Z: number; + readonly TEXTURE_CUBE_MAP_POSITIVE_X: number; + readonly TEXTURE_CUBE_MAP_POSITIVE_Y: number; + readonly TEXTURE_CUBE_MAP_POSITIVE_Z: number; + readonly TEXTURE_MAG_FILTER: number; + readonly TEXTURE_MIN_FILTER: number; + readonly TEXTURE_WRAP_S: number; + readonly TEXTURE_WRAP_T: number; + readonly TRIANGLES: number; + readonly TRIANGLE_FAN: number; + readonly TRIANGLE_STRIP: number; + readonly UNPACK_ALIGNMENT: number; + readonly UNPACK_COLORSPACE_CONVERSION_WEBGL: number; + readonly UNPACK_FLIP_Y_WEBGL: number; + readonly UNPACK_PREMULTIPLY_ALPHA_WEBGL: number; + readonly UNSIGNED_BYTE: number; + readonly UNSIGNED_INT: number; + readonly UNSIGNED_SHORT: number; + readonly UNSIGNED_SHORT_4_4_4_4: number; + readonly UNSIGNED_SHORT_5_5_5_1: number; + readonly UNSIGNED_SHORT_5_6_5: number; + readonly VALIDATE_STATUS: number; + readonly VENDOR: number; + readonly VERSION: number; + readonly VERTEX_ATTRIB_ARRAY_BUFFER_BINDING: number; + readonly VERTEX_ATTRIB_ARRAY_ENABLED: number; + readonly VERTEX_ATTRIB_ARRAY_NORMALIZED: number; + readonly VERTEX_ATTRIB_ARRAY_POINTER: number; + readonly VERTEX_ATTRIB_ARRAY_SIZE: number; + readonly VERTEX_ATTRIB_ARRAY_STRIDE: number; + readonly VERTEX_ATTRIB_ARRAY_TYPE: number; + readonly VERTEX_SHADER: number; + readonly VIEWPORT: number; + readonly ZERO: number; } declare var WebGLRenderingContext: { prototype: WebGLRenderingContext; new(): WebGLRenderingContext; - ACTIVE_ATTRIBUTES: number; - ACTIVE_TEXTURE: number; - ACTIVE_UNIFORMS: number; - ALIASED_LINE_WIDTH_RANGE: number; - ALIASED_POINT_SIZE_RANGE: number; - ALPHA: number; - ALPHA_BITS: number; - ALWAYS: number; - ARRAY_BUFFER: number; - ARRAY_BUFFER_BINDING: number; - ATTACHED_SHADERS: number; - BACK: number; - BLEND: number; - BLEND_COLOR: number; - BLEND_DST_ALPHA: number; - BLEND_DST_RGB: number; - BLEND_EQUATION: number; - BLEND_EQUATION_ALPHA: number; - BLEND_EQUATION_RGB: number; - BLEND_SRC_ALPHA: number; - BLEND_SRC_RGB: number; - BLUE_BITS: number; - BOOL: number; - BOOL_VEC2: number; - BOOL_VEC3: number; - BOOL_VEC4: number; - BROWSER_DEFAULT_WEBGL: number; - BUFFER_SIZE: number; - BUFFER_USAGE: number; - BYTE: number; - CCW: number; - CLAMP_TO_EDGE: number; - COLOR_ATTACHMENT0: number; - COLOR_BUFFER_BIT: number; - COLOR_CLEAR_VALUE: number; - COLOR_WRITEMASK: number; - COMPILE_STATUS: number; - COMPRESSED_TEXTURE_FORMATS: number; - CONSTANT_ALPHA: number; - CONSTANT_COLOR: number; - CONTEXT_LOST_WEBGL: number; - CULL_FACE: number; - CULL_FACE_MODE: number; - CURRENT_PROGRAM: number; - CURRENT_VERTEX_ATTRIB: number; - CW: number; - DECR: number; - DECR_WRAP: number; - DELETE_STATUS: number; - DEPTH_ATTACHMENT: number; - DEPTH_BITS: number; - DEPTH_BUFFER_BIT: number; - DEPTH_CLEAR_VALUE: number; - DEPTH_COMPONENT: number; - DEPTH_COMPONENT16: number; - DEPTH_FUNC: number; - DEPTH_RANGE: number; - DEPTH_STENCIL: number; - DEPTH_STENCIL_ATTACHMENT: number; - DEPTH_TEST: number; - DEPTH_WRITEMASK: number; - DITHER: number; - DONT_CARE: number; - DST_ALPHA: number; - DST_COLOR: number; - DYNAMIC_DRAW: number; - ELEMENT_ARRAY_BUFFER: number; - ELEMENT_ARRAY_BUFFER_BINDING: number; - EQUAL: number; - FASTEST: number; - FLOAT: number; - FLOAT_MAT2: number; - FLOAT_MAT3: number; - FLOAT_MAT4: number; - FLOAT_VEC2: number; - FLOAT_VEC3: number; - FLOAT_VEC4: number; - FRAGMENT_SHADER: number; - FRAMEBUFFER: number; - FRAMEBUFFER_ATTACHMENT_OBJECT_NAME: number; - FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE: number; - FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE: number; - FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL: number; - FRAMEBUFFER_BINDING: number; - FRAMEBUFFER_COMPLETE: number; - FRAMEBUFFER_INCOMPLETE_ATTACHMENT: number; - FRAMEBUFFER_INCOMPLETE_DIMENSIONS: number; - FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT: number; - FRAMEBUFFER_UNSUPPORTED: number; - FRONT: number; - FRONT_AND_BACK: number; - FRONT_FACE: number; - FUNC_ADD: number; - FUNC_REVERSE_SUBTRACT: number; - FUNC_SUBTRACT: number; - GENERATE_MIPMAP_HINT: number; - GEQUAL: number; - GREATER: number; - GREEN_BITS: number; - HIGH_FLOAT: number; - HIGH_INT: number; - IMPLEMENTATION_COLOR_READ_FORMAT: number; - IMPLEMENTATION_COLOR_READ_TYPE: number; - INCR: number; - INCR_WRAP: number; - INT: number; - INT_VEC2: number; - INT_VEC3: number; - INT_VEC4: number; - INVALID_ENUM: number; - INVALID_FRAMEBUFFER_OPERATION: number; - INVALID_OPERATION: number; - INVALID_VALUE: number; - INVERT: number; - KEEP: number; - LEQUAL: number; - LESS: number; - LINEAR: number; - LINEAR_MIPMAP_LINEAR: number; - LINEAR_MIPMAP_NEAREST: number; - LINES: number; - LINE_LOOP: number; - LINE_STRIP: number; - LINE_WIDTH: number; - LINK_STATUS: number; - LOW_FLOAT: number; - LOW_INT: number; - LUMINANCE: number; - LUMINANCE_ALPHA: number; - MAX_COMBINED_TEXTURE_IMAGE_UNITS: number; - MAX_CUBE_MAP_TEXTURE_SIZE: number; - MAX_FRAGMENT_UNIFORM_VECTORS: number; - MAX_RENDERBUFFER_SIZE: number; - MAX_TEXTURE_IMAGE_UNITS: number; - MAX_TEXTURE_SIZE: number; - MAX_VARYING_VECTORS: number; - MAX_VERTEX_ATTRIBS: number; - MAX_VERTEX_TEXTURE_IMAGE_UNITS: number; - MAX_VERTEX_UNIFORM_VECTORS: number; - MAX_VIEWPORT_DIMS: number; - MEDIUM_FLOAT: number; - MEDIUM_INT: number; - MIRRORED_REPEAT: number; - NEAREST: number; - NEAREST_MIPMAP_LINEAR: number; - NEAREST_MIPMAP_NEAREST: number; - NEVER: number; - NICEST: number; - NONE: number; - NOTEQUAL: number; - NO_ERROR: number; - ONE: number; - ONE_MINUS_CONSTANT_ALPHA: number; - ONE_MINUS_CONSTANT_COLOR: number; - ONE_MINUS_DST_ALPHA: number; - ONE_MINUS_DST_COLOR: number; - ONE_MINUS_SRC_ALPHA: number; - ONE_MINUS_SRC_COLOR: number; - OUT_OF_MEMORY: number; - PACK_ALIGNMENT: number; - POINTS: number; - POLYGON_OFFSET_FACTOR: number; - POLYGON_OFFSET_FILL: number; - POLYGON_OFFSET_UNITS: number; - RED_BITS: number; - RENDERBUFFER: number; - RENDERBUFFER_ALPHA_SIZE: number; - RENDERBUFFER_BINDING: number; - RENDERBUFFER_BLUE_SIZE: number; - RENDERBUFFER_DEPTH_SIZE: number; - RENDERBUFFER_GREEN_SIZE: number; - RENDERBUFFER_HEIGHT: number; - RENDERBUFFER_INTERNAL_FORMAT: number; - RENDERBUFFER_RED_SIZE: number; - RENDERBUFFER_STENCIL_SIZE: number; - RENDERBUFFER_WIDTH: number; - RENDERER: number; - REPEAT: number; - REPLACE: number; - RGB: number; - RGB565: number; - RGB5_A1: number; - RGBA: number; - RGBA4: number; - SAMPLER_2D: number; - SAMPLER_CUBE: number; - SAMPLES: number; - SAMPLE_ALPHA_TO_COVERAGE: number; - SAMPLE_BUFFERS: number; - SAMPLE_COVERAGE: number; - SAMPLE_COVERAGE_INVERT: number; - SAMPLE_COVERAGE_VALUE: number; - SCISSOR_BOX: number; - SCISSOR_TEST: number; - SHADER_TYPE: number; - SHADING_LANGUAGE_VERSION: number; - SHORT: number; - SRC_ALPHA: number; - SRC_ALPHA_SATURATE: number; - SRC_COLOR: number; - STATIC_DRAW: number; - STENCIL_ATTACHMENT: number; - STENCIL_BACK_FAIL: number; - STENCIL_BACK_FUNC: number; - STENCIL_BACK_PASS_DEPTH_FAIL: number; - STENCIL_BACK_PASS_DEPTH_PASS: number; - STENCIL_BACK_REF: number; - STENCIL_BACK_VALUE_MASK: number; - STENCIL_BACK_WRITEMASK: number; - STENCIL_BITS: number; - STENCIL_BUFFER_BIT: number; - STENCIL_CLEAR_VALUE: number; - STENCIL_FAIL: number; - STENCIL_FUNC: number; - STENCIL_INDEX: number; - STENCIL_INDEX8: number; - STENCIL_PASS_DEPTH_FAIL: number; - STENCIL_PASS_DEPTH_PASS: number; - STENCIL_REF: number; - STENCIL_TEST: number; - STENCIL_VALUE_MASK: number; - STENCIL_WRITEMASK: number; - STREAM_DRAW: number; - SUBPIXEL_BITS: number; - TEXTURE: number; - TEXTURE0: number; - TEXTURE1: number; - TEXTURE10: number; - TEXTURE11: number; - TEXTURE12: number; - TEXTURE13: number; - TEXTURE14: number; - TEXTURE15: number; - TEXTURE16: number; - TEXTURE17: number; - TEXTURE18: number; - TEXTURE19: number; - TEXTURE2: number; - TEXTURE20: number; - TEXTURE21: number; - TEXTURE22: number; - TEXTURE23: number; - TEXTURE24: number; - TEXTURE25: number; - TEXTURE26: number; - TEXTURE27: number; - TEXTURE28: number; - TEXTURE29: number; - TEXTURE3: number; - TEXTURE30: number; - TEXTURE31: number; - TEXTURE4: number; - TEXTURE5: number; - TEXTURE6: number; - TEXTURE7: number; - TEXTURE8: number; - TEXTURE9: number; - TEXTURE_2D: number; - TEXTURE_BINDING_2D: number; - TEXTURE_BINDING_CUBE_MAP: number; - TEXTURE_CUBE_MAP: number; - TEXTURE_CUBE_MAP_NEGATIVE_X: number; - TEXTURE_CUBE_MAP_NEGATIVE_Y: number; - TEXTURE_CUBE_MAP_NEGATIVE_Z: number; - TEXTURE_CUBE_MAP_POSITIVE_X: number; - TEXTURE_CUBE_MAP_POSITIVE_Y: number; - TEXTURE_CUBE_MAP_POSITIVE_Z: number; - TEXTURE_MAG_FILTER: number; - TEXTURE_MIN_FILTER: number; - TEXTURE_WRAP_S: number; - TEXTURE_WRAP_T: number; - TRIANGLES: number; - TRIANGLE_FAN: number; - TRIANGLE_STRIP: number; - UNPACK_ALIGNMENT: number; - UNPACK_COLORSPACE_CONVERSION_WEBGL: number; - UNPACK_FLIP_Y_WEBGL: number; - UNPACK_PREMULTIPLY_ALPHA_WEBGL: number; - UNSIGNED_BYTE: number; - UNSIGNED_INT: number; - UNSIGNED_SHORT: number; - UNSIGNED_SHORT_4_4_4_4: number; - UNSIGNED_SHORT_5_5_5_1: number; - UNSIGNED_SHORT_5_6_5: number; - VALIDATE_STATUS: number; - VENDOR: number; - VERSION: number; - VERTEX_ATTRIB_ARRAY_BUFFER_BINDING: number; - VERTEX_ATTRIB_ARRAY_ENABLED: number; - VERTEX_ATTRIB_ARRAY_NORMALIZED: number; - VERTEX_ATTRIB_ARRAY_POINTER: number; - VERTEX_ATTRIB_ARRAY_SIZE: number; - VERTEX_ATTRIB_ARRAY_STRIDE: number; - VERTEX_ATTRIB_ARRAY_TYPE: number; - VERTEX_SHADER: number; - VIEWPORT: number; - ZERO: number; + readonly ACTIVE_ATTRIBUTES: number; + readonly ACTIVE_TEXTURE: number; + readonly ACTIVE_UNIFORMS: number; + readonly ALIASED_LINE_WIDTH_RANGE: number; + readonly ALIASED_POINT_SIZE_RANGE: number; + readonly ALPHA: number; + readonly ALPHA_BITS: number; + readonly ALWAYS: number; + readonly ARRAY_BUFFER: number; + readonly ARRAY_BUFFER_BINDING: number; + readonly ATTACHED_SHADERS: number; + readonly BACK: number; + readonly BLEND: number; + readonly BLEND_COLOR: number; + readonly BLEND_DST_ALPHA: number; + readonly BLEND_DST_RGB: number; + readonly BLEND_EQUATION: number; + readonly BLEND_EQUATION_ALPHA: number; + readonly BLEND_EQUATION_RGB: number; + readonly BLEND_SRC_ALPHA: number; + readonly BLEND_SRC_RGB: number; + readonly BLUE_BITS: number; + readonly BOOL: number; + readonly BOOL_VEC2: number; + readonly BOOL_VEC3: number; + readonly BOOL_VEC4: number; + readonly BROWSER_DEFAULT_WEBGL: number; + readonly BUFFER_SIZE: number; + readonly BUFFER_USAGE: number; + readonly BYTE: number; + readonly CCW: number; + readonly CLAMP_TO_EDGE: number; + readonly COLOR_ATTACHMENT0: number; + readonly COLOR_BUFFER_BIT: number; + readonly COLOR_CLEAR_VALUE: number; + readonly COLOR_WRITEMASK: number; + readonly COMPILE_STATUS: number; + readonly COMPRESSED_TEXTURE_FORMATS: number; + readonly CONSTANT_ALPHA: number; + readonly CONSTANT_COLOR: number; + readonly CONTEXT_LOST_WEBGL: number; + readonly CULL_FACE: number; + readonly CULL_FACE_MODE: number; + readonly CURRENT_PROGRAM: number; + readonly CURRENT_VERTEX_ATTRIB: number; + readonly CW: number; + readonly DECR: number; + readonly DECR_WRAP: number; + readonly DELETE_STATUS: number; + readonly DEPTH_ATTACHMENT: number; + readonly DEPTH_BITS: number; + readonly DEPTH_BUFFER_BIT: number; + readonly DEPTH_CLEAR_VALUE: number; + readonly DEPTH_COMPONENT: number; + readonly DEPTH_COMPONENT16: number; + readonly DEPTH_FUNC: number; + readonly DEPTH_RANGE: number; + readonly DEPTH_STENCIL: number; + readonly DEPTH_STENCIL_ATTACHMENT: number; + readonly DEPTH_TEST: number; + readonly DEPTH_WRITEMASK: number; + readonly DITHER: number; + readonly DONT_CARE: number; + readonly DST_ALPHA: number; + readonly DST_COLOR: number; + readonly DYNAMIC_DRAW: number; + readonly ELEMENT_ARRAY_BUFFER: number; + readonly ELEMENT_ARRAY_BUFFER_BINDING: number; + readonly EQUAL: number; + readonly FASTEST: number; + readonly FLOAT: number; + readonly FLOAT_MAT2: number; + readonly FLOAT_MAT3: number; + readonly FLOAT_MAT4: number; + readonly FLOAT_VEC2: number; + readonly FLOAT_VEC3: number; + readonly FLOAT_VEC4: number; + readonly FRAGMENT_SHADER: number; + readonly FRAMEBUFFER: number; + readonly FRAMEBUFFER_ATTACHMENT_OBJECT_NAME: number; + readonly FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE: number; + readonly FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE: number; + readonly FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL: number; + readonly FRAMEBUFFER_BINDING: number; + readonly FRAMEBUFFER_COMPLETE: number; + readonly FRAMEBUFFER_INCOMPLETE_ATTACHMENT: number; + readonly FRAMEBUFFER_INCOMPLETE_DIMENSIONS: number; + readonly FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT: number; + readonly FRAMEBUFFER_UNSUPPORTED: number; + readonly FRONT: number; + readonly FRONT_AND_BACK: number; + readonly FRONT_FACE: number; + readonly FUNC_ADD: number; + readonly FUNC_REVERSE_SUBTRACT: number; + readonly FUNC_SUBTRACT: number; + readonly GENERATE_MIPMAP_HINT: number; + readonly GEQUAL: number; + readonly GREATER: number; + readonly GREEN_BITS: number; + readonly HIGH_FLOAT: number; + readonly HIGH_INT: number; + readonly IMPLEMENTATION_COLOR_READ_FORMAT: number; + readonly IMPLEMENTATION_COLOR_READ_TYPE: number; + readonly INCR: number; + readonly INCR_WRAP: number; + readonly INT: number; + readonly INT_VEC2: number; + readonly INT_VEC3: number; + readonly INT_VEC4: number; + readonly INVALID_ENUM: number; + readonly INVALID_FRAMEBUFFER_OPERATION: number; + readonly INVALID_OPERATION: number; + readonly INVALID_VALUE: number; + readonly INVERT: number; + readonly KEEP: number; + readonly LEQUAL: number; + readonly LESS: number; + readonly LINEAR: number; + readonly LINEAR_MIPMAP_LINEAR: number; + readonly LINEAR_MIPMAP_NEAREST: number; + readonly LINES: number; + readonly LINE_LOOP: number; + readonly LINE_STRIP: number; + readonly LINE_WIDTH: number; + readonly LINK_STATUS: number; + readonly LOW_FLOAT: number; + readonly LOW_INT: number; + readonly LUMINANCE: number; + readonly LUMINANCE_ALPHA: number; + readonly MAX_COMBINED_TEXTURE_IMAGE_UNITS: number; + readonly MAX_CUBE_MAP_TEXTURE_SIZE: number; + readonly MAX_FRAGMENT_UNIFORM_VECTORS: number; + readonly MAX_RENDERBUFFER_SIZE: number; + readonly MAX_TEXTURE_IMAGE_UNITS: number; + readonly MAX_TEXTURE_SIZE: number; + readonly MAX_VARYING_VECTORS: number; + readonly MAX_VERTEX_ATTRIBS: number; + readonly MAX_VERTEX_TEXTURE_IMAGE_UNITS: number; + readonly MAX_VERTEX_UNIFORM_VECTORS: number; + readonly MAX_VIEWPORT_DIMS: number; + readonly MEDIUM_FLOAT: number; + readonly MEDIUM_INT: number; + readonly MIRRORED_REPEAT: number; + readonly NEAREST: number; + readonly NEAREST_MIPMAP_LINEAR: number; + readonly NEAREST_MIPMAP_NEAREST: number; + readonly NEVER: number; + readonly NICEST: number; + readonly NONE: number; + readonly NOTEQUAL: number; + readonly NO_ERROR: number; + readonly ONE: number; + readonly ONE_MINUS_CONSTANT_ALPHA: number; + readonly ONE_MINUS_CONSTANT_COLOR: number; + readonly ONE_MINUS_DST_ALPHA: number; + readonly ONE_MINUS_DST_COLOR: number; + readonly ONE_MINUS_SRC_ALPHA: number; + readonly ONE_MINUS_SRC_COLOR: number; + readonly OUT_OF_MEMORY: number; + readonly PACK_ALIGNMENT: number; + readonly POINTS: number; + readonly POLYGON_OFFSET_FACTOR: number; + readonly POLYGON_OFFSET_FILL: number; + readonly POLYGON_OFFSET_UNITS: number; + readonly RED_BITS: number; + readonly RENDERBUFFER: number; + readonly RENDERBUFFER_ALPHA_SIZE: number; + readonly RENDERBUFFER_BINDING: number; + readonly RENDERBUFFER_BLUE_SIZE: number; + readonly RENDERBUFFER_DEPTH_SIZE: number; + readonly RENDERBUFFER_GREEN_SIZE: number; + readonly RENDERBUFFER_HEIGHT: number; + readonly RENDERBUFFER_INTERNAL_FORMAT: number; + readonly RENDERBUFFER_RED_SIZE: number; + readonly RENDERBUFFER_STENCIL_SIZE: number; + readonly RENDERBUFFER_WIDTH: number; + readonly RENDERER: number; + readonly REPEAT: number; + readonly REPLACE: number; + readonly RGB: number; + readonly RGB565: number; + readonly RGB5_A1: number; + readonly RGBA: number; + readonly RGBA4: number; + readonly SAMPLER_2D: number; + readonly SAMPLER_CUBE: number; + readonly SAMPLES: number; + readonly SAMPLE_ALPHA_TO_COVERAGE: number; + readonly SAMPLE_BUFFERS: number; + readonly SAMPLE_COVERAGE: number; + readonly SAMPLE_COVERAGE_INVERT: number; + readonly SAMPLE_COVERAGE_VALUE: number; + readonly SCISSOR_BOX: number; + readonly SCISSOR_TEST: number; + readonly SHADER_TYPE: number; + readonly SHADING_LANGUAGE_VERSION: number; + readonly SHORT: number; + readonly SRC_ALPHA: number; + readonly SRC_ALPHA_SATURATE: number; + readonly SRC_COLOR: number; + readonly STATIC_DRAW: number; + readonly STENCIL_ATTACHMENT: number; + readonly STENCIL_BACK_FAIL: number; + readonly STENCIL_BACK_FUNC: number; + readonly STENCIL_BACK_PASS_DEPTH_FAIL: number; + readonly STENCIL_BACK_PASS_DEPTH_PASS: number; + readonly STENCIL_BACK_REF: number; + readonly STENCIL_BACK_VALUE_MASK: number; + readonly STENCIL_BACK_WRITEMASK: number; + readonly STENCIL_BITS: number; + readonly STENCIL_BUFFER_BIT: number; + readonly STENCIL_CLEAR_VALUE: number; + readonly STENCIL_FAIL: number; + readonly STENCIL_FUNC: number; + readonly STENCIL_INDEX: number; + readonly STENCIL_INDEX8: number; + readonly STENCIL_PASS_DEPTH_FAIL: number; + readonly STENCIL_PASS_DEPTH_PASS: number; + readonly STENCIL_REF: number; + readonly STENCIL_TEST: number; + readonly STENCIL_VALUE_MASK: number; + readonly STENCIL_WRITEMASK: number; + readonly STREAM_DRAW: number; + readonly SUBPIXEL_BITS: number; + readonly TEXTURE: number; + readonly TEXTURE0: number; + readonly TEXTURE1: number; + readonly TEXTURE10: number; + readonly TEXTURE11: number; + readonly TEXTURE12: number; + readonly TEXTURE13: number; + readonly TEXTURE14: number; + readonly TEXTURE15: number; + readonly TEXTURE16: number; + readonly TEXTURE17: number; + readonly TEXTURE18: number; + readonly TEXTURE19: number; + readonly TEXTURE2: number; + readonly TEXTURE20: number; + readonly TEXTURE21: number; + readonly TEXTURE22: number; + readonly TEXTURE23: number; + readonly TEXTURE24: number; + readonly TEXTURE25: number; + readonly TEXTURE26: number; + readonly TEXTURE27: number; + readonly TEXTURE28: number; + readonly TEXTURE29: number; + readonly TEXTURE3: number; + readonly TEXTURE30: number; + readonly TEXTURE31: number; + readonly TEXTURE4: number; + readonly TEXTURE5: number; + readonly TEXTURE6: number; + readonly TEXTURE7: number; + readonly TEXTURE8: number; + readonly TEXTURE9: number; + readonly TEXTURE_2D: number; + readonly TEXTURE_BINDING_2D: number; + readonly TEXTURE_BINDING_CUBE_MAP: number; + readonly TEXTURE_CUBE_MAP: number; + readonly TEXTURE_CUBE_MAP_NEGATIVE_X: number; + readonly TEXTURE_CUBE_MAP_NEGATIVE_Y: number; + readonly TEXTURE_CUBE_MAP_NEGATIVE_Z: number; + readonly TEXTURE_CUBE_MAP_POSITIVE_X: number; + readonly TEXTURE_CUBE_MAP_POSITIVE_Y: number; + readonly TEXTURE_CUBE_MAP_POSITIVE_Z: number; + readonly TEXTURE_MAG_FILTER: number; + readonly TEXTURE_MIN_FILTER: number; + readonly TEXTURE_WRAP_S: number; + readonly TEXTURE_WRAP_T: number; + readonly TRIANGLES: number; + readonly TRIANGLE_FAN: number; + readonly TRIANGLE_STRIP: number; + readonly UNPACK_ALIGNMENT: number; + readonly UNPACK_COLORSPACE_CONVERSION_WEBGL: number; + readonly UNPACK_FLIP_Y_WEBGL: number; + readonly UNPACK_PREMULTIPLY_ALPHA_WEBGL: number; + readonly UNSIGNED_BYTE: number; + readonly UNSIGNED_INT: number; + readonly UNSIGNED_SHORT: number; + readonly UNSIGNED_SHORT_4_4_4_4: number; + readonly UNSIGNED_SHORT_5_5_5_1: number; + readonly UNSIGNED_SHORT_5_6_5: number; + readonly VALIDATE_STATUS: number; + readonly VENDOR: number; + readonly VERSION: number; + readonly VERTEX_ATTRIB_ARRAY_BUFFER_BINDING: number; + readonly VERTEX_ATTRIB_ARRAY_ENABLED: number; + readonly VERTEX_ATTRIB_ARRAY_NORMALIZED: number; + readonly VERTEX_ATTRIB_ARRAY_POINTER: number; + readonly VERTEX_ATTRIB_ARRAY_SIZE: number; + readonly VERTEX_ATTRIB_ARRAY_STRIDE: number; + readonly VERTEX_ATTRIB_ARRAY_TYPE: number; + readonly VERTEX_SHADER: number; + readonly VIEWPORT: number; + readonly ZERO: number; } interface WebGLShader extends WebGLObject { @@ -11701,9 +12693,9 @@ declare var WebGLShader: { } interface WebGLShaderPrecisionFormat { - precision: number; - rangeMax: number; - rangeMin: number; + readonly precision: number; + readonly rangeMax: number; + readonly rangeMin: number; } declare var WebGLShaderPrecisionFormat: { @@ -11779,21 +12771,21 @@ declare var WebKitPoint: { interface WebSocket extends EventTarget { binaryType: string; - bufferedAmount: number; - extensions: string; + readonly bufferedAmount: number; + readonly extensions: string; onclose: (ev: CloseEvent) => any; onerror: (ev: Event) => any; onmessage: (ev: MessageEvent) => any; onopen: (ev: Event) => any; - protocol: string; - readyState: number; - url: string; + readonly protocol: string; + readonly readyState: number; + readonly url: string; close(code?: number, reason?: string): void; send(data: any): void; - CLOSED: number; - CLOSING: number; - CONNECTING: number; - OPEN: number; + readonly CLOSED: number; + readonly CLOSING: number; + readonly CONNECTING: number; + readonly OPEN: number; addEventListener(type: "close", listener: (ev: CloseEvent) => any, useCapture?: boolean): void; addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: "message", listener: (ev: MessageEvent) => any, useCapture?: boolean): void; @@ -11804,56 +12796,58 @@ interface WebSocket extends EventTarget { declare var WebSocket: { prototype: WebSocket; new(url: string, protocols?: string | string[]): WebSocket; - CLOSED: number; - CLOSING: number; - CONNECTING: number; - OPEN: number; + readonly CLOSED: number; + readonly CLOSING: number; + readonly CONNECTING: number; + readonly OPEN: number; } interface WheelEvent extends MouseEvent { - deltaMode: number; - deltaX: number; - deltaY: number; - deltaZ: number; + readonly deltaMode: number; + readonly deltaX: number; + readonly deltaY: number; + readonly deltaZ: number; + readonly wheelDelta: number; + readonly wheelDeltaX: number; + readonly wheelDeltaY: number; getCurrentPoint(element: Element): void; 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; - DOM_DELTA_LINE: number; - DOM_DELTA_PAGE: number; - DOM_DELTA_PIXEL: number; + readonly DOM_DELTA_LINE: number; + readonly DOM_DELTA_PAGE: number; + readonly DOM_DELTA_PIXEL: number; } declare var WheelEvent: { prototype: WheelEvent; new(typeArg: string, eventInitDict?: WheelEventInit): WheelEvent; - DOM_DELTA_LINE: number; - DOM_DELTA_PAGE: number; - DOM_DELTA_PIXEL: number; + readonly DOM_DELTA_LINE: number; + readonly DOM_DELTA_PAGE: number; + readonly DOM_DELTA_PIXEL: number; } interface Window extends EventTarget, WindowTimers, WindowSessionStorage, WindowLocalStorage, WindowConsole, GlobalEventHandlers, IDBEnvironment, WindowBase64 { - animationStartTime: number; - applicationCache: ApplicationCache; - clientInformation: Navigator; - closed: boolean; - crypto: Crypto; + readonly applicationCache: ApplicationCache; + readonly clientInformation: Navigator; + readonly closed: boolean; + readonly crypto: Crypto; defaultStatus: string; - devicePixelRatio: number; - doNotTrack: string; - document: Document; + readonly devicePixelRatio: number; + readonly doNotTrack: string; + readonly document: Document; event: Event; - external: External; - frameElement: Element; - frames: Window; - history: History; - innerHeight: number; - innerWidth: number; - length: number; - location: Location; - locationbar: BarProp; - menubar: BarProp; - msAnimationStartTime: number; + readonly external: External; + readonly frameElement: Element; + readonly frames: Window; + readonly history: History; + readonly innerHeight: number; + readonly innerWidth: number; + readonly length: number; + readonly location: Location; + readonly locationbar: BarProp; + readonly menubar: BarProp; + readonly msCredentials: MSCredentials; name: string; - navigator: Navigator; + readonly navigator: Navigator; offscreenBuffering: string | boolean; onabort: (ev: Event) => any; onafterprint: (ev: Event) => any; @@ -11867,6 +12861,7 @@ interface Window extends EventTarget, WindowTimers, WindowSessionStorage, Window oncompassneedscalibration: (ev: Event) => any; oncontextmenu: (ev: PointerEvent) => any; ondblclick: (ev: MouseEvent) => any; + ondevicelight: (ev: DeviceLightEvent) => any; ondevicemotion: (ev: DeviceMotionEvent) => any; ondeviceorientation: (ev: DeviceOrientationEvent) => any; ondrag: (ev: DragEvent) => any; @@ -11878,11 +12873,12 @@ interface Window extends EventTarget, WindowTimers, WindowSessionStorage, Window ondrop: (ev: DragEvent) => any; ondurationchange: (ev: Event) => any; onemptied: (ev: Event) => any; - onended: (ev: Event) => any; + onended: (ev: MediaStreamErrorEvent) => any; onerror: ErrorEventHandler; onfocus: (ev: FocusEvent) => any; onhashchange: (ev: HashChangeEvent) => any; oninput: (ev: Event) => any; + oninvalid: (ev: Event) => any; onkeydown: (ev: KeyboardEvent) => any; onkeypress: (ev: KeyboardEvent) => any; onkeyup: (ev: KeyboardEvent) => any; @@ -11898,7 +12894,7 @@ interface Window extends EventTarget, WindowTimers, WindowSessionStorage, Window onmouseout: (ev: MouseEvent) => any; onmouseover: (ev: MouseEvent) => any; onmouseup: (ev: MouseEvent) => any; - onmousewheel: (ev: MouseWheelEvent) => any; + onmousewheel: (ev: WheelEvent) => any; onmsgesturechange: (ev: MSGestureEvent) => any; onmsgesturedoubletap: (ev: MSGestureEvent) => any; onmsgestureend: (ev: MSGestureEvent) => any; @@ -11937,38 +12933,38 @@ interface Window extends EventTarget, WindowTimers, WindowSessionStorage, Window onsubmit: (ev: Event) => any; onsuspend: (ev: Event) => any; ontimeupdate: (ev: Event) => any; - ontouchcancel: any; - ontouchend: any; - ontouchmove: any; - ontouchstart: any; + ontouchcancel: (ev: TouchEvent) => any; + ontouchend: (ev: TouchEvent) => any; + ontouchmove: (ev: TouchEvent) => any; + ontouchstart: (ev: TouchEvent) => any; onunload: (ev: Event) => any; onvolumechange: (ev: Event) => any; onwaiting: (ev: Event) => any; - opener: Window; + readonly opener: Window; orientation: string | number; - outerHeight: number; - outerWidth: number; - pageXOffset: number; - pageYOffset: number; - parent: Window; - performance: Performance; - personalbar: BarProp; - screen: Screen; - screenLeft: number; - screenTop: number; - screenX: number; - screenY: number; - scrollX: number; - scrollY: number; - scrollbars: BarProp; - self: Window; + readonly outerHeight: number; + readonly outerWidth: number; + readonly pageXOffset: number; + readonly pageYOffset: number; + readonly parent: Window; + readonly performance: Performance; + readonly personalbar: BarProp; + readonly screen: Screen; + readonly screenLeft: number; + readonly screenTop: number; + readonly screenX: number; + readonly screenY: number; + readonly scrollX: number; + readonly scrollY: number; + readonly scrollbars: BarProp; + readonly self: Window; status: string; - statusbar: BarProp; - styleMedia: StyleMedia; - toolbar: BarProp; - top: Window; - window: Window; - URL: URL; + readonly statusbar: BarProp; + readonly styleMedia: StyleMedia; + readonly toolbar: BarProp; + readonly top: Window; + readonly window: Window; + URL: typeof URL; alert(message?: any): void; blur(): void; cancelAnimationFrame(handle: number): void; @@ -11982,12 +12978,9 @@ interface Window extends EventTarget, WindowTimers, WindowSessionStorage, Window matchMedia(mediaQuery: string): MediaQueryList; moveBy(x?: number, y?: number): void; moveTo(x?: number, y?: number): void; - msCancelRequestAnimationFrame(handle: number): void; - msMatchMedia(mediaQuery: string): MediaQueryList; - msRequestAnimationFrame(callback: FrameRequestCallback): number; msWriteProfilerMark(profilerMarkName: string): void; open(url?: string, target?: string, features?: string, replace?: boolean): Window; - postMessage(message: any, targetOrigin: string, ports?: any): void; + postMessage(message: any, targetOrigin: string, transfer?: any[]): void; print(): void; prompt(message?: string, _default?: string): string; releaseEvents(): void; @@ -11997,8 +12990,10 @@ interface Window extends EventTarget, WindowTimers, WindowSessionStorage, Window scroll(x?: number, y?: number): void; scrollBy(x?: number, y?: number): void; scrollTo(x?: number, y?: number): void; + webkitCancelAnimationFrame(handle: number): void; webkitConvertPointFromNodeToPage(node: Node, pt: WebKitPoint): WebKitPoint; webkitConvertPointFromPageToNode(node: Node, pt: WebKitPoint): WebKitPoint; + webkitRequestAnimationFrame(callback: FrameRequestCallback): number; addEventListener(type: "MSGestureChange", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void; addEventListener(type: "MSGestureDoubleTap", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void; addEventListener(type: "MSGestureEnd", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void; @@ -12026,6 +13021,7 @@ interface Window extends EventTarget, WindowTimers, WindowSessionStorage, Window addEventListener(type: "compassneedscalibration", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "contextmenu", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; addEventListener(type: "dblclick", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; + addEventListener(type: "devicelight", listener: (ev: DeviceLightEvent) => any, useCapture?: boolean): void; addEventListener(type: "devicemotion", listener: (ev: DeviceMotionEvent) => any, useCapture?: boolean): void; addEventListener(type: "deviceorientation", listener: (ev: DeviceOrientationEvent) => any, useCapture?: boolean): void; addEventListener(type: "drag", listener: (ev: DragEvent) => any, useCapture?: boolean): void; @@ -12037,10 +13033,11 @@ interface Window extends EventTarget, WindowTimers, WindowSessionStorage, Window addEventListener(type: "drop", listener: (ev: DragEvent) => any, useCapture?: boolean): void; addEventListener(type: "durationchange", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "emptied", listener: (ev: Event) => any, useCapture?: boolean): void; - addEventListener(type: "ended", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "ended", listener: (ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: "focus", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; addEventListener(type: "hashchange", listener: (ev: HashChangeEvent) => any, useCapture?: boolean): void; addEventListener(type: "input", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "invalid", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "keydown", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "keypress", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; addEventListener(type: "keyup", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; @@ -12056,7 +13053,7 @@ interface Window extends EventTarget, WindowTimers, WindowSessionStorage, Window addEventListener(type: "mouseout", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "mouseover", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; addEventListener(type: "mouseup", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; - addEventListener(type: "mousewheel", listener: (ev: MouseWheelEvent) => any, useCapture?: boolean): void; + addEventListener(type: "mousewheel", listener: (ev: WheelEvent) => any, useCapture?: boolean): void; addEventListener(type: "offline", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "online", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "orientationchange", listener: (ev: Event) => any, useCapture?: boolean): void; @@ -12126,16 +13123,15 @@ declare var XMLDocument: { interface XMLHttpRequest extends EventTarget, XMLHttpRequestEventTarget { msCaching: string; onreadystatechange: (ev: ProgressEvent) => any; - readyState: number; - response: any; - responseBody: any; - responseText: string; + readonly readyState: number; + readonly response: any; + readonly responseText: string; responseType: string; - responseXML: any; - status: number; - statusText: string; + readonly responseXML: any; + readonly status: number; + readonly statusText: string; timeout: number; - upload: XMLHttpRequestUpload; + readonly upload: XMLHttpRequestUpload; withCredentials: boolean; abort(): void; getAllResponseHeaders(): string; @@ -12147,11 +13143,11 @@ interface XMLHttpRequest extends EventTarget, XMLHttpRequestEventTarget { send(data?: string): void; send(data?: any): void; setRequestHeader(header: string, value: string): void; - DONE: number; - HEADERS_RECEIVED: number; - LOADING: number; - OPENED: number; - UNSENT: number; + readonly DONE: number; + readonly HEADERS_RECEIVED: number; + readonly LOADING: number; + readonly OPENED: number; + readonly UNSENT: number; addEventListener(type: "abort", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: "load", listener: (ev: Event) => any, useCapture?: boolean): void; @@ -12166,11 +13162,11 @@ interface XMLHttpRequest extends EventTarget, XMLHttpRequestEventTarget { declare var XMLHttpRequest: { prototype: XMLHttpRequest; new(): XMLHttpRequest; - DONE: number; - HEADERS_RECEIVED: number; - LOADING: number; - OPENED: number; - UNSENT: number; + readonly DONE: number; + readonly HEADERS_RECEIVED: number; + readonly LOADING: number; + readonly OPENED: number; + readonly UNSENT: number; create(): XMLHttpRequest; } @@ -12222,40 +13218,40 @@ declare var XPathNSResolver: { } interface XPathResult { - booleanValue: boolean; - invalidIteratorState: boolean; - numberValue: number; - resultType: number; - singleNodeValue: Node; - snapshotLength: number; - stringValue: string; + readonly booleanValue: boolean; + readonly invalidIteratorState: boolean; + readonly numberValue: number; + readonly resultType: number; + readonly singleNodeValue: Node; + readonly snapshotLength: number; + readonly stringValue: string; iterateNext(): Node; snapshotItem(index: number): Node; - ANY_TYPE: number; - ANY_UNORDERED_NODE_TYPE: number; - BOOLEAN_TYPE: number; - FIRST_ORDERED_NODE_TYPE: number; - NUMBER_TYPE: number; - ORDERED_NODE_ITERATOR_TYPE: number; - ORDERED_NODE_SNAPSHOT_TYPE: number; - STRING_TYPE: number; - UNORDERED_NODE_ITERATOR_TYPE: number; - UNORDERED_NODE_SNAPSHOT_TYPE: number; + readonly ANY_TYPE: number; + readonly ANY_UNORDERED_NODE_TYPE: number; + readonly BOOLEAN_TYPE: number; + readonly FIRST_ORDERED_NODE_TYPE: number; + readonly NUMBER_TYPE: number; + readonly ORDERED_NODE_ITERATOR_TYPE: number; + readonly ORDERED_NODE_SNAPSHOT_TYPE: number; + readonly STRING_TYPE: number; + readonly UNORDERED_NODE_ITERATOR_TYPE: number; + readonly UNORDERED_NODE_SNAPSHOT_TYPE: number; } declare var XPathResult: { prototype: XPathResult; new(): XPathResult; - ANY_TYPE: number; - ANY_UNORDERED_NODE_TYPE: number; - BOOLEAN_TYPE: number; - FIRST_ORDERED_NODE_TYPE: number; - NUMBER_TYPE: number; - ORDERED_NODE_ITERATOR_TYPE: number; - ORDERED_NODE_SNAPSHOT_TYPE: number; - STRING_TYPE: number; - UNORDERED_NODE_ITERATOR_TYPE: number; - UNORDERED_NODE_SNAPSHOT_TYPE: number; + readonly ANY_TYPE: number; + readonly ANY_UNORDERED_NODE_TYPE: number; + readonly BOOLEAN_TYPE: number; + readonly FIRST_ORDERED_NODE_TYPE: number; + readonly NUMBER_TYPE: number; + readonly ORDERED_NODE_ITERATOR_TYPE: number; + readonly ORDERED_NODE_SNAPSHOT_TYPE: number; + readonly STRING_TYPE: number; + readonly UNORDERED_NODE_ITERATOR_TYPE: number; + readonly UNORDERED_NODE_SNAPSHOT_TYPE: number; } interface XSLTProcessor { @@ -12280,6 +13276,18 @@ interface AbstractWorker { addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } +interface CanvasPathMethods { + arc(x: number, y: number, radius: number, startAngle: number, endAngle: number, anticlockwise?: boolean): void; + arcTo(x1: number, y1: number, x2: number, y2: number, radius: number): void; + bezierCurveTo(cp1x: number, cp1y: number, cp2x: number, cp2y: number, x: number, y: number): void; + closePath(): void; + ellipse(x: number, y: number, radiusX: number, radiusY: number, rotation: number, startAngle: number, endAngle: number, anticlockwise?: boolean): void; + lineTo(x: number, y: number): void; + moveTo(x: number, y: number): void; + quadraticCurveTo(cpx: number, cpy: number, x: number, y: number): void; + rect(x: number, y: number, w: number, h: number): void; +} + interface ChildNode { remove(): void; } @@ -12302,6 +13310,7 @@ interface DocumentEvent { createEvent(eventInterface:"CommandEvent"): CommandEvent; createEvent(eventInterface:"CompositionEvent"): CompositionEvent; createEvent(eventInterface:"CustomEvent"): CustomEvent; + createEvent(eventInterface:"DeviceLightEvent"): DeviceLightEvent; createEvent(eventInterface:"DeviceMotionEvent"): DeviceMotionEvent; createEvent(eventInterface:"DeviceOrientationEvent"): DeviceOrientationEvent; createEvent(eventInterface:"DragEvent"): DragEvent; @@ -12313,6 +13322,7 @@ interface DocumentEvent { createEvent(eventInterface:"HashChangeEvent"): HashChangeEvent; createEvent(eventInterface:"IDBVersionChangeEvent"): IDBVersionChangeEvent; createEvent(eventInterface:"KeyboardEvent"): KeyboardEvent; + createEvent(eventInterface:"ListeningStateChangedEvent"): ListeningStateChangedEvent; createEvent(eventInterface:"LongRunningScriptDetectedEvent"): LongRunningScriptDetectedEvent; createEvent(eventInterface:"MSGestureEvent"): MSGestureEvent; createEvent(eventInterface:"MSManipulationEvent"): MSManipulationEvent; @@ -12320,21 +13330,31 @@ interface DocumentEvent { createEvent(eventInterface:"MSMediaKeyNeededEvent"): MSMediaKeyNeededEvent; createEvent(eventInterface:"MSPointerEvent"): MSPointerEvent; createEvent(eventInterface:"MSSiteModeEvent"): MSSiteModeEvent; + createEvent(eventInterface:"MediaEncryptedEvent"): MediaEncryptedEvent; + createEvent(eventInterface:"MediaKeyMessageEvent"): MediaKeyMessageEvent; + createEvent(eventInterface:"MediaStreamErrorEvent"): MediaStreamErrorEvent; + createEvent(eventInterface:"MediaStreamTrackEvent"): MediaStreamTrackEvent; createEvent(eventInterface:"MessageEvent"): MessageEvent; createEvent(eventInterface:"MouseEvent"): MouseEvent; createEvent(eventInterface:"MouseEvents"): MouseEvent; - createEvent(eventInterface:"MouseWheelEvent"): MouseWheelEvent; createEvent(eventInterface:"MutationEvent"): MutationEvent; createEvent(eventInterface:"MutationEvents"): MutationEvent; createEvent(eventInterface:"NavigationCompletedEvent"): NavigationCompletedEvent; createEvent(eventInterface:"NavigationEvent"): NavigationEvent; createEvent(eventInterface:"NavigationEventWithReferrer"): NavigationEventWithReferrer; createEvent(eventInterface:"OfflineAudioCompletionEvent"): OfflineAudioCompletionEvent; + createEvent(eventInterface:"OverflowEvent"): OverflowEvent; createEvent(eventInterface:"PageTransitionEvent"): PageTransitionEvent; createEvent(eventInterface:"PermissionRequestedEvent"): PermissionRequestedEvent; createEvent(eventInterface:"PointerEvent"): PointerEvent; createEvent(eventInterface:"PopStateEvent"): PopStateEvent; createEvent(eventInterface:"ProgressEvent"): ProgressEvent; + createEvent(eventInterface:"RTCDTMFToneChangeEvent"): RTCDTMFToneChangeEvent; + createEvent(eventInterface:"RTCDtlsTransportStateChangedEvent"): RTCDtlsTransportStateChangedEvent; + createEvent(eventInterface:"RTCIceCandidatePairChangedEvent"): RTCIceCandidatePairChangedEvent; + createEvent(eventInterface:"RTCIceGathererEvent"): RTCIceGathererEvent; + createEvent(eventInterface:"RTCIceTransportStateChangedEvent"): RTCIceTransportStateChangedEvent; + createEvent(eventInterface:"RTCSsrcConflictEvent"): RTCSsrcConflictEvent; createEvent(eventInterface:"SVGZoomEvent"): SVGZoomEvent; createEvent(eventInterface:"SVGZoomEvents"): SVGZoomEvent; createEvent(eventInterface:"ScriptNotifyEvent"): ScriptNotifyEvent; @@ -12352,11 +13372,11 @@ interface DocumentEvent { } interface ElementTraversal { - childElementCount: number; - firstElementChild: Element; - lastElementChild: Element; - nextElementSibling: Element; - previousElementSibling: Element; + readonly childElementCount: number; + readonly firstElementChild: Element; + readonly lastElementChild: Element; + readonly nextElementSibling: Element; + readonly previousElementSibling: Element; } interface GetSVGDocument { @@ -12401,12 +13421,11 @@ interface HTMLTableAlignment { } interface IDBEnvironment { - indexedDB: IDBFactory; - msIndexedDB: IDBFactory; + readonly indexedDB: IDBFactory; } interface LinkStyle { - sheet: StyleSheet; + readonly sheet: StyleSheet; } interface MSBaseReader { @@ -12416,12 +13435,12 @@ interface MSBaseReader { onloadend: (ev: ProgressEvent) => any; onloadstart: (ev: Event) => any; onprogress: (ev: ProgressEvent) => any; - readyState: number; - result: any; + readonly readyState: number; + readonly result: any; abort(): void; - DONE: number; - EMPTY: number; - LOADING: number; + readonly DONE: number; + readonly EMPTY: number; + readonly LOADING: number; addEventListener(type: "abort", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: "load", listener: (ev: Event) => any, useCapture?: boolean): void; @@ -12449,27 +13468,32 @@ interface NavigatorContentUtils { } interface NavigatorGeolocation { - geolocation: Geolocation; + readonly geolocation: Geolocation; } interface NavigatorID { - appName: string; - appVersion: string; - platform: string; - product: string; - productSub: string; - userAgent: string; - vendor: string; - vendorSub: string; + readonly appName: string; + readonly appVersion: string; + readonly platform: string; + readonly product: string; + readonly productSub: string; + readonly userAgent: string; + readonly vendor: string; + readonly vendorSub: string; } interface NavigatorOnLine { - onLine: boolean; + readonly onLine: boolean; } interface NavigatorStorageUtils { } +interface NavigatorUserMedia { + readonly mediaDevices: MediaDevices; + getUserMedia(constraints: MediaStreamConstraints, successCallback: NavigatorUserMediaSuccessCallback, errorCallback: NavigatorUserMediaErrorCallback): void; +} + interface NodeSelector { querySelector(selectors: string): Element; querySelectorAll(selectors: string): NodeListOf; @@ -12480,29 +13504,29 @@ interface RandomSource { } interface SVGAnimatedPathData { - pathSegList: SVGPathSegList; + readonly pathSegList: SVGPathSegList; } interface SVGAnimatedPoints { - animatedPoints: SVGPointList; - points: SVGPointList; + readonly animatedPoints: SVGPointList; + readonly points: SVGPointList; } interface SVGExternalResourcesRequired { - externalResourcesRequired: SVGAnimatedBoolean; + readonly externalResourcesRequired: SVGAnimatedBoolean; } interface SVGFilterPrimitiveStandardAttributes extends SVGStylable { - height: SVGAnimatedLength; - result: SVGAnimatedString; - width: SVGAnimatedLength; - x: SVGAnimatedLength; - y: SVGAnimatedLength; + readonly height: SVGAnimatedLength; + readonly result: SVGAnimatedString; + readonly width: SVGAnimatedLength; + readonly x: SVGAnimatedLength; + readonly y: SVGAnimatedLength; } interface SVGFitToViewBox { - preserveAspectRatio: SVGAnimatedPreserveAspectRatio; - viewBox: SVGAnimatedRect; + readonly preserveAspectRatio: SVGAnimatedPreserveAspectRatio; + readonly viewBox: SVGAnimatedRect; } interface SVGLangSpace { @@ -12511,8 +13535,8 @@ interface SVGLangSpace { } interface SVGLocatable { - farthestViewportElement: SVGElement; - nearestViewportElement: SVGElement; + readonly farthestViewportElement: SVGElement; + readonly nearestViewportElement: SVGElement; getBBox(): SVGRect; getCTM(): SVGMatrix; getScreenCTM(): SVGMatrix; @@ -12521,22 +13545,22 @@ interface SVGLocatable { interface SVGStylable { className: any; - style: CSSStyleDeclaration; + readonly style: CSSStyleDeclaration; } interface SVGTests { - requiredExtensions: SVGStringList; - requiredFeatures: SVGStringList; - systemLanguage: SVGStringList; + readonly requiredExtensions: SVGStringList; + readonly requiredFeatures: SVGStringList; + readonly systemLanguage: SVGStringList; hasExtension(extension: string): boolean; } interface SVGTransformable extends SVGLocatable { - transform: SVGAnimatedTransformList; + readonly transform: SVGAnimatedTransformList; } interface SVGURIReference { - href: SVGAnimatedString; + readonly href: SVGAnimatedString; } interface WindowBase64 { @@ -12545,15 +13569,15 @@ interface WindowBase64 { } interface WindowConsole { - console: Console; + readonly console: Console; } interface WindowLocalStorage { - localStorage: Storage; + readonly localStorage: Storage; } interface WindowSessionStorage { - sessionStorage: Storage; + readonly sessionStorage: Storage; } interface WindowTimers extends Object, WindowTimersExtension { @@ -12565,8 +13589,6 @@ interface WindowTimers extends Object, WindowTimersExtension { interface WindowTimersExtension { clearImmediate(handle: number): void; - msClearImmediate(handle: number): void; - msSetImmediate(expression: any, ...args: any[]): number; setImmediate(expression: any, ...args: any[]): number; } @@ -12596,22 +13618,18 @@ interface StorageEventInit extends EventInit { storageArea?: Storage; } -interface IDBObjectStoreParameters { - keyPath?: string | string[]; - autoIncrement?: boolean; -} - -interface IDBIndexParameters { - unique?: boolean; - multiEntry?: boolean; -} - interface NodeListOf extends NodeList { length: number; item(index: number): TNode; [index: number]: TNode; } +interface HTMLCollectionOf extends HTMLCollection { + item(index: number): T; + namedItem(name: string): T; + [index: number]: T; +} + interface BlobPropertyBag { type?: string; endings?: string; @@ -12641,15 +13659,6 @@ interface ProgressEventInit extends EventInit { total?: number; } -interface HTMLTemplateElement extends HTMLElement { - content: DocumentFragment; -} - -declare var HTMLTemplateElement: { - prototype: HTMLTemplateElement; - new(): HTMLTemplateElement; -} - interface HTMLPictureElement extends HTMLElement { } @@ -12658,6 +13667,14 @@ declare var HTMLPictureElement: { new(): HTMLPictureElement; } +interface ClipboardEventInit extends EventInit { + data?: string; + dataType?: string; +} + +interface IDBArrayKey extends Array { +} + declare type EventListenerOrEventListenerObject = EventListener | EventListenerObject; interface ErrorEventHandler { @@ -12696,10 +13713,18 @@ interface DecodeErrorCallback { interface FunctionStringCallback { (data: string): void; } +interface NavigatorUserMediaSuccessCallback { + (stream: MediaStream): void; +} +interface NavigatorUserMediaErrorCallback { + (error: MediaStreamError): void; +} +interface ForEachCallback { + (keyId: any, status: string): void; +} declare var Audio: {new(src?: string): HTMLAudioElement; }; declare var Image: {new(width?: number, height?: number): HTMLImageElement; }; declare var Option: {new(text?: string, value?: string, defaultSelected?: boolean, selected?: boolean): HTMLOptionElement; }; -declare var animationStartTime: number; declare var applicationCache: ApplicationCache; declare var clientInformation: Navigator; declare var closed: boolean; @@ -12719,7 +13744,7 @@ declare var length: number; declare var location: Location; declare var locationbar: BarProp; declare var menubar: BarProp; -declare var msAnimationStartTime: number; +declare var msCredentials: MSCredentials; declare var name: string; declare var navigator: Navigator; declare var offscreenBuffering: string | boolean; @@ -12735,6 +13760,7 @@ declare var onclick: (ev: MouseEvent) => any; declare var oncompassneedscalibration: (ev: Event) => any; declare var oncontextmenu: (ev: PointerEvent) => any; declare var ondblclick: (ev: MouseEvent) => any; +declare var ondevicelight: (ev: DeviceLightEvent) => any; declare var ondevicemotion: (ev: DeviceMotionEvent) => any; declare var ondeviceorientation: (ev: DeviceOrientationEvent) => any; declare var ondrag: (ev: DragEvent) => any; @@ -12746,11 +13772,12 @@ declare var ondragstart: (ev: DragEvent) => any; declare var ondrop: (ev: DragEvent) => any; declare var ondurationchange: (ev: Event) => any; declare var onemptied: (ev: Event) => any; -declare var onended: (ev: Event) => any; +declare var onended: (ev: MediaStreamErrorEvent) => any; declare var onerror: ErrorEventHandler; declare var onfocus: (ev: FocusEvent) => any; declare var onhashchange: (ev: HashChangeEvent) => any; declare var oninput: (ev: Event) => any; +declare var oninvalid: (ev: Event) => any; declare var onkeydown: (ev: KeyboardEvent) => any; declare var onkeypress: (ev: KeyboardEvent) => any; declare var onkeyup: (ev: KeyboardEvent) => any; @@ -12766,7 +13793,7 @@ declare var onmousemove: (ev: MouseEvent) => any; declare var onmouseout: (ev: MouseEvent) => any; declare var onmouseover: (ev: MouseEvent) => any; declare var onmouseup: (ev: MouseEvent) => any; -declare var onmousewheel: (ev: MouseWheelEvent) => any; +declare var onmousewheel: (ev: WheelEvent) => any; declare var onmsgesturechange: (ev: MSGestureEvent) => any; declare var onmsgesturedoubletap: (ev: MSGestureEvent) => any; declare var onmsgestureend: (ev: MSGestureEvent) => any; @@ -12805,10 +13832,10 @@ declare var onstorage: (ev: StorageEvent) => any; declare var onsubmit: (ev: Event) => any; declare var onsuspend: (ev: Event) => any; declare var ontimeupdate: (ev: Event) => any; -declare var ontouchcancel: any; -declare var ontouchend: any; -declare var ontouchmove: any; -declare var ontouchstart: any; +declare var ontouchcancel: (ev: TouchEvent) => any; +declare var ontouchend: (ev: TouchEvent) => any; +declare var ontouchmove: (ev: TouchEvent) => any; +declare var ontouchstart: (ev: TouchEvent) => any; declare var onunload: (ev: Event) => any; declare var onvolumechange: (ev: Event) => any; declare var onwaiting: (ev: Event) => any; @@ -12836,7 +13863,6 @@ declare var styleMedia: StyleMedia; declare var toolbar: BarProp; declare var top: Window; declare var window: Window; -declare var URL: URL; declare function alert(message?: any): void; declare function blur(): void; declare function cancelAnimationFrame(handle: number): void; @@ -12850,12 +13876,9 @@ declare function getSelection(): Selection; declare function matchMedia(mediaQuery: string): MediaQueryList; declare function moveBy(x?: number, y?: number): void; declare function moveTo(x?: number, y?: number): void; -declare function msCancelRequestAnimationFrame(handle: number): void; -declare function msMatchMedia(mediaQuery: string): MediaQueryList; -declare function msRequestAnimationFrame(callback: FrameRequestCallback): number; declare function msWriteProfilerMark(profilerMarkName: string): void; declare function open(url?: string, target?: string, features?: string, replace?: boolean): Window; -declare function postMessage(message: any, targetOrigin: string, ports?: any): void; +declare function postMessage(message: any, targetOrigin: string, transfer?: any[]): void; declare function print(): void; declare function prompt(message?: string, _default?: string): string; declare function releaseEvents(): void; @@ -12865,19 +13888,19 @@ declare function resizeTo(x?: number, y?: number): void; declare function scroll(x?: number, y?: number): void; declare function scrollBy(x?: number, y?: number): void; declare function scrollTo(x?: number, y?: number): void; +declare function webkitCancelAnimationFrame(handle: number): void; declare function webkitConvertPointFromNodeToPage(node: Node, pt: WebKitPoint): WebKitPoint; declare function webkitConvertPointFromPageToNode(node: Node, pt: WebKitPoint): WebKitPoint; +declare function webkitRequestAnimationFrame(callback: FrameRequestCallback): number; declare function toString(): string; -declare function addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +declare function addEventListener(type: string, listener?: EventListenerOrEventListenerObject, useCapture?: boolean): void; declare function dispatchEvent(evt: Event): boolean; -declare function removeEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +declare function removeEventListener(type: string, listener?: EventListenerOrEventListenerObject, useCapture?: boolean): void; declare function clearInterval(handle: number): void; declare function clearTimeout(handle: number): void; declare function setInterval(handler: any, timeout?: any, ...args: any[]): number; declare function setTimeout(handler: any, timeout?: any, ...args: any[]): number; declare function clearImmediate(handle: number): void; -declare function msClearImmediate(handle: number): void; -declare function msSetImmediate(expression: any, ...args: any[]): number; declare function setImmediate(expression: any, ...args: any[]): number; declare var sessionStorage: Storage; declare var localStorage: Storage; @@ -12892,7 +13915,6 @@ declare var onpointerover: (ev: PointerEvent) => any; declare var onpointerup: (ev: PointerEvent) => any; declare var onwheel: (ev: WheelEvent) => any; declare var indexedDB: IDBFactory; -declare var msIndexedDB: IDBFactory; declare function atob(encodedString: string): string; declare function btoa(rawString: string): string; declare function addEventListener(type: "MSGestureChange", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void; @@ -12922,6 +13944,7 @@ declare function addEventListener(type: "click", listener: (ev: MouseEvent) => a declare function addEventListener(type: "compassneedscalibration", listener: (ev: Event) => any, useCapture?: boolean): void; declare function addEventListener(type: "contextmenu", listener: (ev: PointerEvent) => any, useCapture?: boolean): void; declare function addEventListener(type: "dblclick", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "devicelight", listener: (ev: DeviceLightEvent) => any, useCapture?: boolean): void; declare function addEventListener(type: "devicemotion", listener: (ev: DeviceMotionEvent) => any, useCapture?: boolean): void; declare function addEventListener(type: "deviceorientation", listener: (ev: DeviceOrientationEvent) => any, useCapture?: boolean): void; declare function addEventListener(type: "drag", listener: (ev: DragEvent) => any, useCapture?: boolean): void; @@ -12933,10 +13956,11 @@ declare function addEventListener(type: "dragstart", listener: (ev: DragEvent) = declare function addEventListener(type: "drop", listener: (ev: DragEvent) => any, useCapture?: boolean): void; declare function addEventListener(type: "durationchange", listener: (ev: Event) => any, useCapture?: boolean): void; declare function addEventListener(type: "emptied", listener: (ev: Event) => any, useCapture?: boolean): void; -declare function addEventListener(type: "ended", listener: (ev: Event) => any, useCapture?: boolean): void; +declare function addEventListener(type: "ended", listener: (ev: MediaStreamErrorEvent) => any, useCapture?: boolean): void; declare function addEventListener(type: "focus", listener: (ev: FocusEvent) => any, useCapture?: boolean): void; declare function addEventListener(type: "hashchange", listener: (ev: HashChangeEvent) => any, useCapture?: boolean): void; declare function addEventListener(type: "input", listener: (ev: Event) => any, useCapture?: boolean): void; +declare function addEventListener(type: "invalid", listener: (ev: Event) => any, useCapture?: boolean): void; declare function addEventListener(type: "keydown", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; declare function addEventListener(type: "keypress", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; declare function addEventListener(type: "keyup", listener: (ev: KeyboardEvent) => any, useCapture?: boolean): void; @@ -12952,7 +13976,7 @@ declare function addEventListener(type: "mousemove", listener: (ev: MouseEvent) declare function addEventListener(type: "mouseout", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; declare function addEventListener(type: "mouseover", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; declare function addEventListener(type: "mouseup", listener: (ev: MouseEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: "mousewheel", listener: (ev: MouseWheelEvent) => any, useCapture?: boolean): void; +declare function addEventListener(type: "mousewheel", listener: (ev: WheelEvent) => any, useCapture?: boolean): void; declare function addEventListener(type: "offline", listener: (ev: Event) => any, useCapture?: boolean): void; declare function addEventListener(type: "online", listener: (ev: Event) => any, useCapture?: boolean): void; declare function addEventListener(type: "orientationchange", listener: (ev: Event) => any, useCapture?: boolean): void; @@ -12988,4 +14012,36 @@ declare function addEventListener(type: "unload", listener: (ev: Event) => any, declare function addEventListener(type: "volumechange", listener: (ev: Event) => any, useCapture?: boolean): void; declare function addEventListener(type: "waiting", listener: (ev: Event) => any, useCapture?: boolean): void; declare function addEventListener(type: "wheel", listener: (ev: WheelEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; \ No newline at end of file +declare function addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +type AAGUID = string; +type AlgorithmIdentifier = string | Algorithm; +type ConstrainBoolean = boolean | ConstrainBooleanParameters; +type ConstrainDOMString = string | string[] | ConstrainDOMStringParameters; +type ConstrainDouble = number | ConstrainDoubleRange; +type ConstrainLong = number | ConstrainLongRange; +type CryptoOperationData = ArrayBufferView; +type GLbitfield = number; +type GLboolean = boolean; +type GLbyte = number; +type GLclampf = number; +type GLenum = number; +type GLfloat = number; +type GLint = number; +type GLintptr = number; +type GLshort = number; +type GLsizei = number; +type GLsizeiptr = number; +type GLubyte = number; +type GLuint = number; +type GLushort = number; +type IDBKeyPath = string; +type KeyFormat = string; +type KeyType = string; +type KeyUsage = string; +type MSInboundPayload = MSVideoRecvPayload | MSAudioRecvPayload; +type MSLocalClientEvent = MSLocalClientEventBase | MSAudioLocalClientEvent; +type MSOutboundPayload = MSVideoSendPayload | MSAudioSendPayload; +type RTCIceGatherCandidate = RTCIceCandidate | RTCIceCandidateComplete; +type RTCTransport = RTCDtlsTransport | RTCSrtpSdesTransport; +type payloadtype = number; +type IDBValidKey = number | string | Date | IDBArrayKey; \ No newline at end of file diff --git a/src/lib/dom.es6.d.ts b/src/lib/dom.iterable.d.ts similarity index 79% rename from src/lib/dom.es6.d.ts rename to src/lib/dom.iterable.d.ts index e83b8531011..4f6378f038e 100644 --- a/src/lib/dom.es6.d.ts +++ b/src/lib/dom.iterable.d.ts @@ -1,3 +1,5 @@ +/// + interface DOMTokenList { [Symbol.iterator](): IterableIterator; } diff --git a/src/lib/es2015.collection.d.ts b/src/lib/es2015.collection.d.ts new file mode 100644 index 00000000000..717c9bb9c04 --- /dev/null +++ b/src/lib/es2015.collection.d.ts @@ -0,0 +1,70 @@ +interface Map { + clear(): void; + delete(key: K): boolean; + forEach(callbackfn: (value: V, index: K, map: Map) => void, thisArg?: any): void; + get(key: K): V | undefined; + has(key: K): boolean; + set(key: K, value?: V): Map; + readonly size: number; +} + +interface MapConstructor { + new (): Map; + new (): Map; + readonly prototype: Map; +} +declare var Map: MapConstructor; + +interface WeakMap { + clear(): void; + delete(key: K): boolean; + get(key: K): V | undefined; + has(key: K): boolean; + set(key: K, value?: V): WeakMap; + +} + +interface WeakMapConstructor { + new (): WeakMap; + new (): WeakMap; + readonly prototype: WeakMap; +} +declare var WeakMap: WeakMapConstructor; + +interface Set { + add(value: T): Set; + clear(): void; + delete(value: T): boolean; + entries(): IterableIterator<[T, T]>; + forEach(callbackfn: (value: T, index: T, set: Set) => void, thisArg?: any): void; + has(value: T): boolean; + keys(): IterableIterator; + readonly size: number; + values(): IterableIterator; + [Symbol.iterator]():IterableIterator; + readonly [Symbol.toStringTag]: "Set"; +} + +interface SetConstructor { + new (): Set; + new (): Set; + new (iterable: Iterable): Set; + readonly prototype: Set; +} +declare var Set: SetConstructor; + +interface WeakSet { + add(value: T): WeakSet; + clear(): void; + delete(value: T): boolean; + has(value: T): boolean; + readonly [Symbol.toStringTag]: "WeakSet"; +} + +interface WeakSetConstructor { + new (): WeakSet; + new (): WeakSet; + new (iterable: Iterable): WeakSet; + readonly prototype: WeakSet; +} +declare var WeakSet: WeakSetConstructor; diff --git a/src/lib/es2015.core.d.ts b/src/lib/es2015.core.d.ts new file mode 100644 index 00000000000..fc93847f8af --- /dev/null +++ b/src/lib/es2015.core.d.ts @@ -0,0 +1,483 @@ +declare type PropertyKey = string | number | symbol; + +interface Array { + /** + * Returns the value of the first element in the array where predicate is true, and undefined + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find + * immediately returns that element value. Otherwise, find returns undefined. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + find(predicate: (value: T, index: number, obj: Array) => boolean, thisArg?: any): T | undefined; + + /** + * Returns the index of the first element in the array where predicate is true, and undefined + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find + * immediately returns that element value. Otherwise, find returns undefined. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + findIndex(predicate: (value: T) => boolean, thisArg?: any): number | undefined; + + /** + * Returns the this object after filling the section identified by start and end with value + * @param value value to fill array section with + * @param start index to start filling the array at. If start is negative, it is treated as + * length+start where length is the length of the array. + * @param end index to stop filling the array at. If end is negative, it is treated as + * length+end. + */ + fill(value: T, start?: number, end?: number): T[]; + + /** + * Returns the this object after copying a section of the array identified by start and end + * to the same array starting at position target + * @param target If target is negative, it is treated as length+target where length is the + * length of the array. + * @param start If start is negative, it is treated as length+start. If end is negative, it + * is treated as length+end. + * @param end If not specified, length of the this object is used as its default value. + */ + copyWithin(target: number, start: number, end?: number): T[]; +} + +interface ArrayConstructor { + /** + * Creates an array from an array-like object. + * @param arrayLike An array-like object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: ArrayLike, mapfn: (v: T, k: number) => U, thisArg?: any): Array; + + + /** + * Creates an array from an array-like object. + * @param arrayLike An array-like object to convert to an array. + */ + from(arrayLike: ArrayLike): Array; + + /** + * Returns a new array from a set of elements. + * @param items A set of elements to include in the new array object. + */ + of(...items: T[]): Array; +} + +interface Function { + /** + * Returns the name of the function. Function names are read-only and can not be changed. + */ + readonly name: string; +} + +interface Math { + /** + * Returns the number of leading zero bits in the 32-bit binary representation of a number. + * @param x A numeric expression. + */ + clz32(x: number): number; + + /** + * Returns the result of 32-bit multiplication of two numbers. + * @param x First number + * @param y Second number + */ + imul(x: number, y: number): number; + + /** + * Returns the sign of the x, indicating whether x is positive, negative or zero. + * @param x The numeric expression to test + */ + sign(x: number): number; + + /** + * Returns the base 10 logarithm of a number. + * @param x A numeric expression. + */ + log10(x: number): number; + + /** + * Returns the base 2 logarithm of a number. + * @param x A numeric expression. + */ + log2(x: number): number; + + /** + * Returns the natural logarithm of 1 + x. + * @param x A numeric expression. + */ + log1p(x: number): number; + + /** + * Returns the result of (e^x - 1) of x (e raised to the power of x, where e is the base of + * the natural logarithms). + * @param x A numeric expression. + */ + expm1(x: number): number; + + /** + * Returns the hyperbolic cosine of a number. + * @param x A numeric expression that contains an angle measured in radians. + */ + cosh(x: number): number; + + /** + * Returns the hyperbolic sine of a number. + * @param x A numeric expression that contains an angle measured in radians. + */ + sinh(x: number): number; + + /** + * Returns the hyperbolic tangent of a number. + * @param x A numeric expression that contains an angle measured in radians. + */ + tanh(x: number): number; + + /** + * Returns the inverse hyperbolic cosine of a number. + * @param x A numeric expression that contains an angle measured in radians. + */ + acosh(x: number): number; + + /** + * Returns the inverse hyperbolic sine of a number. + * @param x A numeric expression that contains an angle measured in radians. + */ + asinh(x: number): number; + + /** + * Returns the inverse hyperbolic tangent of a number. + * @param x A numeric expression that contains an angle measured in radians. + */ + atanh(x: number): number; + + /** + * Returns the square root of the sum of squares of its arguments. + * @param values Values to compute the square root for. + * If no arguments are passed, the result is +0. + * If there is only one argument, the result is the absolute value. + * If any argument is +Infinity or -Infinity, the result is +Infinity. + * If any argument is NaN, the result is NaN. + * If all arguments are either +0 or −0, the result is +0. + */ + hypot(...values: number[] ): number; + + /** + * Returns the integral part of the a numeric expression, x, removing any fractional digits. + * If x is already an integer, the result is x. + * @param x A numeric expression. + */ + trunc(x: number): number; + + /** + * Returns the nearest single precision float representation of a number. + * @param x A numeric expression. + */ + fround(x: number): number; + + /** + * Returns an implementation-dependent approximation to the cube root of number. + * @param x A numeric expression. + */ + cbrt(x: number): number; +} + +interface NumberConstructor { + /** + * The value of Number.EPSILON is the difference between 1 and the smallest value greater than 1 + * that is representable as a Number value, which is approximately: + * 2.2204460492503130808472633361816 x 10‍−‍16. + */ + readonly EPSILON: number; + + /** + * Returns true if passed value is finite. + * Unlike the global isFininte, Number.isFinite doesn't forcibly convert the parameter to a + * number. Only finite values of the type number, result in true. + * @param number A numeric value. + */ + isFinite(number: number): boolean; + + /** + * Returns true if the value passed is an integer, false otherwise. + * @param number A numeric value. + */ + isInteger(number: number): boolean; + + /** + * Returns a Boolean value that indicates whether a value is the reserved value NaN (not a + * number). Unlike the global isNaN(), Number.isNaN() doesn't forcefully convert the parameter + * to a number. Only values of the type number, that are also NaN, result in true. + * @param number A numeric value. + */ + isNaN(number: number): boolean; + + /** + * Returns true if the value passed is a safe integer. + * @param number A numeric value. + */ + isSafeInteger(number: number): boolean; + + /** + * The value of the largest integer n such that n and n + 1 are both exactly representable as + * a Number value. + * The value of Number.MIN_SAFE_INTEGER is 9007199254740991 2^53 − 1. + */ + readonly MAX_SAFE_INTEGER: number; + + /** + * The value of the smallest integer n such that n and n − 1 are both exactly representable as + * a Number value. + * The value of Number.MIN_SAFE_INTEGER is −9007199254740991 (−(2^53 − 1)). + */ + readonly MIN_SAFE_INTEGER: number; + + /** + * Converts a string to a floating-point number. + * @param string A string that contains a floating-point number. + */ + parseFloat(string: string): number; + + /** + * Converts A string to an integer. + * @param s A string to convert into a number. + * @param radix A value between 2 and 36 that specifies the base of the number in numString. + * If this argument is not supplied, strings with a prefix of '0x' are considered hexadecimal. + * All other strings are considered decimal. + */ + parseInt(string: string, radix?: number): number; +} + +interface Object { + /** + * Determines whether an object has a property with the specified name. + * @param v A property name. + */ + hasOwnProperty(v: PropertyKey): boolean + + /** + * Determines whether a specified property is enumerable. + * @param v A property name. + */ + propertyIsEnumerable(v: PropertyKey): boolean; +} + +interface ObjectConstructor { + /** + * Copy the values of all of the enumerable own properties from one or more source objects to a + * target object. Returns the target object. + * @param target The target object to copy to. + * @param source The source object from which to copy properties. + */ + assign(target: T, source: U): T & U; + + /** + * Copy the values of all of the enumerable own properties from one or more source objects to a + * target object. Returns the target object. + * @param target The target object to copy to. + * @param source1 The first source object from which to copy properties. + * @param source2 The second source object from which to copy properties. + */ + assign(target: T, source1: U, source2: V): T & U & V; + + /** + * Copy the values of all of the enumerable own properties from one or more source objects to a + * target object. Returns the target object. + * @param target The target object to copy to. + * @param source1 The first source object from which to copy properties. + * @param source2 The second source object from which to copy properties. + * @param source3 The third source object from which to copy properties. + */ + assign(target: T, source1: U, source2: V, source3: W): T & U & V & W; + + /** + * Copy the values of all of the enumerable own properties from one or more source objects to a + * target object. Returns the target object. + * @param target The target object to copy to. + * @param sources One or more source objects from which to copy properties + */ + assign(target: any, ...sources: any[]): any; + + /** + * Returns an array of all symbol properties found directly on object o. + * @param o Object to retrieve the symbols from. + */ + getOwnPropertySymbols(o: any): symbol[]; + + /** + * Returns true if the values are the same value, false otherwise. + * @param value1 The first value. + * @param value2 The second value. + */ + is(value1: any, value2: any): boolean; + + /** + * Sets the prototype of a specified object o to object proto or null. Returns the object o. + * @param o The object to change its prototype. + * @param proto The value of the new prototype or null. + */ + setPrototypeOf(o: any, proto: any): any; + + /** + * Gets the own property descriptor of the specified object. + * An own property descriptor is one that is defined directly on the object and is not + * inherited from the object's prototype. + * @param o Object that contains the property. + * @param p Name of the property. + */ + getOwnPropertyDescriptor(o: any, propertyKey: PropertyKey): PropertyDescriptor; + + /** + * Adds a property to an object, or modifies attributes of an existing property. + * @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. + * @param p The property name. + * @param attributes Descriptor for the property. It can be for a data property or an accessor + * property. + */ + defineProperty(o: any, propertyKey: PropertyKey, attributes: PropertyDescriptor): any; +} + +interface RegExp { + /** + * Returns a string indicating the flags of the regular expression in question. This field is read-only. + * The characters in this string are sequenced and concatenated in the following order: + * + * - "g" for global + * - "i" for ignoreCase + * - "m" for multiline + * - "u" for unicode + * - "y" for sticky + * + * If no flags are set, the value is the empty string. + */ + readonly flags: string; + + /** + * Returns a Boolean value indicating the state of the sticky flag (y) used with a regular + * expression. Default is false. Read-only. + */ + readonly sticky: boolean; + + /** + * Returns a Boolean value indicating the state of the Unicode flag (u) used with a regular + * expression. Default is false. Read-only. + */ + readonly unicode: boolean; +} + +interface String { + /** + * Returns a nonnegative integer Number less than 1114112 (0x110000) that is the code point + * value of the UTF-16 encoded code point starting at the string element at position pos in + * the String resulting from converting this object to a String. + * If there is no element at that position, the result is undefined. + * If a valid UTF-16 surrogate pair does not begin at pos, the result is the code unit at pos. + */ + codePointAt(pos: number): number | undefined; + + /** + * Returns true if searchString appears as a substring of the result of converting this + * object to a String, at one or more positions that are + * greater than or equal to position; otherwise, returns false. + * @param searchString search string + * @param position If position is undefined, 0 is assumed, so as to search all of the String. + */ + includes(searchString: string, position?: number): boolean; + + /** + * Returns true if the sequence of elements of searchString converted to a String is the + * same as the corresponding elements of this object (converted to a String) starting at + * endPosition – length(this). Otherwise returns false. + */ + endsWith(searchString: string, endPosition?: number): boolean; + + /** + * Returns the String value result of normalizing the string into the normalization form + * named by form as specified in Unicode Standard Annex #15, Unicode Normalization Forms. + * @param form Applicable values: "NFC", "NFD", "NFKC", or "NFKD", If not specified default + * is "NFC" + */ + normalize(form?: string): string; + + /** + * Returns a String value that is made from count copies appended together. If count is 0, + * T is the empty String is returned. + * @param count number of copies to append + */ + repeat(count: number): string; + + /** + * Returns true if the sequence of elements of searchString converted to a String is the + * same as the corresponding elements of this object (converted to a String) starting at + * position. Otherwise returns false. + */ + startsWith(searchString: string, position?: number): boolean; + + /** + * Returns an HTML anchor element and sets the name attribute to the text value + * @param name + */ + anchor(name: string): string; + + /** Returns a HTML element */ + big(): string; + + /** Returns a HTML element */ + blink(): string; + + /** Returns a HTML element */ + bold(): string; + + /** Returns a HTML element */ + fixed(): string + + /** Returns a HTML element and sets the color attribute value */ + fontcolor(color: string): string + + /** Returns a HTML element and sets the size attribute value */ + fontsize(size: number): string; + + /** Returns a HTML element and sets the size attribute value */ + fontsize(size: string): string; + + /** Returns an HTML element */ + italics(): string; + + /** Returns an HTML element and sets the href attribute value */ + link(url: string): string; + + /** Returns a HTML element */ + small(): string; + + /** Returns a HTML element */ + strike(): string; + + /** Returns a HTML element */ + sub(): string; + + /** Returns a HTML element */ + sup(): string; +} + +interface StringConstructor { + /** + * Return the String value whose elements are, in order, the elements in the List elements. + * If length is 0, the empty string is returned. + */ + fromCodePoint(...codePoints: number[]): string; + + /** + * String.raw is intended for use as a tag function of a Tagged Template String. When called + * as such the first argument will be a well formed template call site object and the rest + * parameter will contain the substitution values. + * @param template A well-formed template string call site representation. + * @param substitutions A set of substitution values. + */ + raw(template: TemplateStringsArray, ...substitutions: any[]): string; +} \ No newline at end of file diff --git a/src/lib/es2015.d.ts b/src/lib/es2015.d.ts new file mode 100644 index 00000000000..ba30ea74669 --- /dev/null +++ b/src/lib/es2015.d.ts @@ -0,0 +1,10 @@ +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// \ No newline at end of file diff --git a/src/lib/es2015.generator.d.ts b/src/lib/es2015.generator.d.ts new file mode 100644 index 00000000000..2f522ad8770 --- /dev/null +++ b/src/lib/es2015.generator.d.ts @@ -0,0 +1,12 @@ +interface GeneratorFunction extends Function { } + +interface GeneratorFunctionConstructor { + /** + * Creates a new Generator function. + * @param args A list of arguments the function accepts. + */ + new (...args: string[]): GeneratorFunction; + (...args: string[]): GeneratorFunction; + readonly prototype: GeneratorFunction; +} +declare var GeneratorFunction: GeneratorFunctionConstructor; diff --git a/src/lib/es2015.iterable.d.ts b/src/lib/es2015.iterable.d.ts new file mode 100644 index 00000000000..85c95a73bb0 --- /dev/null +++ b/src/lib/es2015.iterable.d.ts @@ -0,0 +1,373 @@ +/// + +interface IteratorResult { + done: boolean; + value?: T; +} + +interface Iterator { + next(value?: any): IteratorResult; + return?(value?: any): IteratorResult; + throw?(e?: any): IteratorResult; +} + +interface Iterable { } + +interface IterableIterator extends Iterator { } + +interface Array { + /** + * Returns an array of key, value pairs for every entry in the array + */ + entries(): IterableIterator<[number, T]>; + + /** + * Returns an list of keys in the array + */ + keys(): IterableIterator; + + /** + * Returns an list of values in the array + */ + values(): IterableIterator; +} + +interface ArrayConstructor { + /** + * Creates an array from an iterable object. + * @param iterable An iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(iterable: Iterable, mapfn: (v: T, k: number) => U, thisArg?: any): Array; + + /** + * Creates an array from an iterable object. + * @param iterable An iterable object to convert to an array. + */ + from(iterable: Iterable): Array; +} + +interface Map { + entries(): IterableIterator<[K, V]>; + keys(): IterableIterator; + values(): IterableIterator; +} + +interface MapConstructor { + new (iterable: Iterable<[K, V]>): Map; +} + +interface WeakMap { } + +interface WeakMapConstructor { + new (iterable: Iterable<[K, V]>): WeakMap; +} + +interface Promise { } + +interface PromiseConstructor { + /** + * Creates a Promise that is resolved with an array of results when all of the provided Promises + * resolve, or rejected when any Promise is rejected. + * @param values An array of Promises. + * @returns A new Promise. + */ + all(values: Iterable>): Promise; + + /** + * Creates a Promise that is resolved or rejected when any of the provided Promises are resolved + * or rejected. + * @param values An array of Promises. + * @returns A new Promise. + */ + race(values: Iterable>): Promise; +} + +declare namespace Reflect { + function enumerate(target: any): IterableIterator; +} + +/** + * A typed array of 8-bit integer values. The contents are initialized to 0. If the requested + * number of bytes could not be allocated an exception is raised. + */ +interface Int8Array { + /** + * Returns an array of key, value pairs for every entry in the array + */ + entries(): IterableIterator<[number, number]>; + /** + * Returns an list of keys in the array + */ + keys(): IterableIterator; + /** + * Returns an list of values in the array + */ + values(): IterableIterator; +} + +interface Int8ArrayConstructor { + new (elements: Iterable): Int8Array; + + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Int8Array; +} + +/** + * A typed array of 8-bit unsigned integer values. The contents are initialized to 0. If the + * requested number of bytes could not be allocated an exception is raised. + */ +interface Uint8Array { + /** + * Returns an array of key, value pairs for every entry in the array + */ + entries(): IterableIterator<[number, number]>; + /** + * Returns an list of keys in the array + */ + keys(): IterableIterator; + /** + * Returns an list of values in the array + */ + values(): IterableIterator; +} + +interface Uint8ArrayConstructor { + new (elements: Iterable): Uint8Array; + + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint8Array; +} + +/** + * A typed array of 8-bit unsigned integer (clamped) values. The contents are initialized to 0. + * If the requested number of bytes could not be allocated an exception is raised. + */ +interface Uint8ClampedArray { + /** + * Returns an array of key, value pairs for every entry in the array + */ + entries(): IterableIterator<[number, number]>; + + /** + * Returns an list of keys in the array + */ + keys(): IterableIterator; + + /** + * Returns an list of values in the array + */ + values(): IterableIterator; +} + +interface Uint8ClampedArrayConstructor { + new (elements: Iterable): Uint8ClampedArray; + + + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint8ClampedArray; +} + +/** + * A typed array of 16-bit signed integer values. The contents are initialized to 0. If the + * requested number of bytes could not be allocated an exception is raised. + */ +interface Int16Array { + /** + * Returns an array of key, value pairs for every entry in the array + */ + entries(): IterableIterator<[number, number]>; + + /** + * Returns an list of keys in the array + */ + keys(): IterableIterator; + + /** + * Returns an list of values in the array + */ + values(): IterableIterator; +} + +interface Int16ArrayConstructor { + new (elements: Iterable): Int16Array; + + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Int16Array; +} + +/** + * A typed array of 16-bit unsigned integer values. The contents are initialized to 0. If the + * requested number of bytes could not be allocated an exception is raised. + */ +interface Uint16Array { + /** + * Returns an array of key, value pairs for every entry in the array + */ + entries(): IterableIterator<[number, number]>; + /** + * Returns an list of keys in the array + */ + keys(): IterableIterator; + /** + * Returns an list of values in the array + */ + values(): IterableIterator; +} + +interface Uint16ArrayConstructor { + new (elements: Iterable): Uint16Array; + + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint16Array; +} + +/** + * A typed array of 32-bit signed integer values. The contents are initialized to 0. If the + * requested number of bytes could not be allocated an exception is raised. + */ +interface Int32Array { + /** + * Returns an array of key, value pairs for every entry in the array + */ + entries(): IterableIterator<[number, number]>; + /** + * Returns an list of keys in the array + */ + keys(): IterableIterator; + /** + * Returns an list of values in the array + */ + values(): IterableIterator; +} + +interface Int32ArrayConstructor { + new (elements: Iterable): Int32Array; + + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Int32Array; +} + +/** + * A typed array of 32-bit unsigned integer values. The contents are initialized to 0. If the + * requested number of bytes could not be allocated an exception is raised. + */ +interface Uint32Array { + /** + * Returns an array of key, value pairs for every entry in the array + */ + entries(): IterableIterator<[number, number]>; + /** + * Returns an list of keys in the array + */ + keys(): IterableIterator; + /** + * Returns an list of values in the array + */ + values(): IterableIterator; +} + +interface Uint32ArrayConstructor { + new (elements: Iterable): Uint32Array; + + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint32Array; +} + +/** + * A typed array of 32-bit float values. The contents are initialized to 0. If the requested number + * of bytes could not be allocated an exception is raised. + */ +interface Float32Array { + /** + * Returns an array of key, value pairs for every entry in the array + */ + entries(): IterableIterator<[number, number]>; + /** + * Returns an list of keys in the array + */ + keys(): IterableIterator; + /** + * Returns an list of values in the array + */ + values(): IterableIterator; +} + +interface Float32ArrayConstructor { + new (elements: Iterable): Float32Array; + + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Float32Array; +} + +/** + * A typed array of 64-bit float values. The contents are initialized to 0. If the requested + * number of bytes could not be allocated an exception is raised. + */ +interface Float64Array { + /** + * Returns an array of key, value pairs for every entry in the array + */ + entries(): IterableIterator<[number, number]>; + /** + * Returns an list of keys in the array + */ + keys(): IterableIterator; + /** + * Returns an list of values in the array + */ + values(): IterableIterator; +} + +interface Float64ArrayConstructor { + new (elements: Iterable): Float64Array; + + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Float64Array; +} \ No newline at end of file diff --git a/src/lib/es2015.promise.d.ts b/src/lib/es2015.promise.d.ts new file mode 100644 index 00000000000..6ade205dc42 --- /dev/null +++ b/src/lib/es2015.promise.d.ts @@ -0,0 +1,81 @@ +/** + * Represents the completion of an asynchronous operation + */ +interface Promise { + /** + * Attaches callbacks for the resolution and/or rejection of the Promise. + * @param onfulfilled The callback to execute when the Promise is resolved. + * @param onrejected The callback to execute when the Promise is rejected. + * @returns A Promise for the completion of which ever callback is executed. + */ + then(onfulfilled?: (value: T) => TResult | PromiseLike, onrejected?: (reason: any) => TResult | PromiseLike): Promise; + then(onfulfilled?: (value: T) => TResult | PromiseLike, onrejected?: (reason: any) => void): Promise; + + /** + * Attaches a callback for only the rejection of the Promise. + * @param onrejected The callback to execute when the Promise is rejected. + * @returns A Promise for the completion of the callback. + */ + catch(onrejected?: (reason: any) => T | PromiseLike): Promise; + catch(onrejected?: (reason: any) => void): Promise; +} + +interface PromiseConstructor { + /** + * A reference to the prototype. + */ + readonly prototype: Promise; + + /** + * Creates a new Promise. + * @param executor A callback used to initialize the promise. This callback is passed two arguments: + * a resolve callback used resolve the promise with a value or the result of another promise, + * and a reject callback used to reject the promise with a provided reason or error. + */ + new (executor: (resolve: (value?: T | PromiseLike) => void, reject: (reason?: any) => void) => void): Promise; + + /** + * Creates a Promise that is resolved with an array of results when all of the provided Promises + * resolve, or rejected when any Promise is rejected. + * @param values An array of Promises. + * @returns A new Promise. + */ + 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]>; + 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]>; + 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]>; + all(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike , T5 | PromiseLike, T6 | PromiseLike, T7 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6, T7]>; + all(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike , T5 | PromiseLike, T6 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6]>; + all(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike , T5 | PromiseLike]): Promise<[T1, T2, T3, T4, T5]>; + all(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike ]): Promise<[T1, T2, T3, T4]>; + all(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike]): Promise<[T1, T2, T3]>; + all(values: [T1 | PromiseLike, T2 | PromiseLike]): Promise<[T1, T2]>; + + /** + * Creates a new rejected promise for the provided reason. + * @param reason The reason the promise was rejected. + * @returns A new rejected Promise. + */ + reject(reason: any): Promise; + + /** + * Creates a new rejected promise for the provided reason. + * @param reason The reason the promise was rejected. + * @returns A new rejected Promise. + */ + reject(reason: any): Promise; + + /** + * Creates a new resolved promise for the provided value. + * @param value A promise. + * @returns A promise whose internal state matches the provided promise. + */ + resolve(value: T | PromiseLike): Promise; + + /** + * Creates a new resolved promise . + * @returns A resolved promise. + */ + resolve(): Promise; +} + +declare var Promise: PromiseConstructor; \ No newline at end of file diff --git a/src/lib/es2015.proxy.d.ts b/src/lib/es2015.proxy.d.ts new file mode 100644 index 00000000000..c37e8fb0f59 --- /dev/null +++ b/src/lib/es2015.proxy.d.ts @@ -0,0 +1,22 @@ +interface ProxyHandler { + getPrototypeOf? (target: T): any; + setPrototypeOf? (target: T, v: any): boolean; + isExtensible? (target: T): boolean; + preventExtensions? (target: T): boolean; + getOwnPropertyDescriptor? (target: T, p: PropertyKey): PropertyDescriptor; + has? (target: T, p: PropertyKey): boolean; + get? (target: T, p: PropertyKey, receiver: any): any; + set? (target: T, p: PropertyKey, value: any, receiver: any): boolean; + deleteProperty? (target: T, p: PropertyKey): boolean; + defineProperty? (target: T, p: PropertyKey, attributes: PropertyDescriptor): boolean; + enumerate? (target: T): PropertyKey[]; + ownKeys? (target: T): PropertyKey[]; + apply? (target: T, thisArg: any, argArray?: any): any; + construct? (target: T, thisArg: any, argArray?: any): any; +} + +interface ProxyConstructor { + revocable(target: T, handler: ProxyHandler): { proxy: T; revoke: () => void; }; + new (target: T, handler: ProxyHandler): T +} +declare var Proxy: ProxyConstructor; \ No newline at end of file diff --git a/src/lib/es2015.reflect.d.ts b/src/lib/es2015.reflect.d.ts new file mode 100644 index 00000000000..eda8d352263 --- /dev/null +++ b/src/lib/es2015.reflect.d.ts @@ -0,0 +1,16 @@ +declare namespace Reflect { + function apply(target: Function, thisArgument: any, argumentsList: ArrayLike): any; + function construct(target: Function, argumentsList: ArrayLike, newTarget?: any): any; + function defineProperty(target: any, propertyKey: PropertyKey, attributes: PropertyDescriptor): boolean; + function deleteProperty(target: any, propertyKey: PropertyKey): boolean; + function get(target: any, propertyKey: PropertyKey, receiver?: any): any; + function getOwnPropertyDescriptor(target: any, propertyKey: PropertyKey): PropertyDescriptor; + function getPrototypeOf(target: any): any; + function has(target: any, propertyKey: string): boolean; + function has(target: any, propertyKey: symbol): boolean; + function isExtensible(target: any): boolean; + function ownKeys(target: any): Array; + function preventExtensions(target: any): boolean; + function set(target: any, propertyKey: PropertyKey, value: any, receiver?: any): boolean; + function setPrototypeOf(target: any, proto: any): boolean; +} \ No newline at end of file diff --git a/src/lib/es2015.symbol.d.ts b/src/lib/es2015.symbol.d.ts new file mode 100644 index 00000000000..cd7e45595f0 --- /dev/null +++ b/src/lib/es2015.symbol.d.ts @@ -0,0 +1,36 @@ +interface Symbol { + /** Returns a string representation of an object. */ + toString(): string; + + /** Returns the primitive value of the specified object. */ + valueOf(): Object; +} + +interface SymbolConstructor { + /** + * A reference to the prototype. + */ + readonly prototype: Symbol; + + /** + * Returns a new unique Symbol value. + * @param description Description of the new Symbol object. + */ + (description?: string|number): symbol; + + /** + * Returns a Symbol object from the global symbol registry matching the given key if found. + * Otherwise, returns a new symbol with this key. + * @param key key to search for. + */ + for(key: string): symbol; + + /** + * Returns a key from the global symbol registry matching the given Symbol if found. + * Otherwise, returns a undefined. + * @param sym Symbol to find the key for. + */ + keyFor(sym: symbol): string | undefined; +} + +declare var Symbol: SymbolConstructor; \ No newline at end of file diff --git a/src/lib/es2015.symbol.wellknown.d.ts b/src/lib/es2015.symbol.wellknown.d.ts new file mode 100644 index 00000000000..110657e78b1 --- /dev/null +++ b/src/lib/es2015.symbol.wellknown.d.ts @@ -0,0 +1,356 @@ +/// + +interface SymbolConstructor { + /** + * A method that determines if a constructor object recognizes an object as one of the + * constructor’s instances. Called by the semantics of the instanceof operator. + */ + readonly hasInstance: symbol; + + /** + * A Boolean value that if true indicates that an object should flatten to its array elements + * by Array.prototype.concat. + */ + readonly isConcatSpreadable: symbol; + + /** + * A method that returns the default iterator for an object. Called by the semantics of the + * for-of statement. + */ + readonly iterator: symbol; + + /** + * A regular expression method that matches the regular expression against a string. Called + * by the String.prototype.match method. + */ + readonly match: symbol; + + /** + * A regular expression method that replaces matched substrings of a string. Called by the + * String.prototype.replace method. + */ + readonly replace: symbol; + + /** + * A regular expression method that returns the index within a string that matches the + * regular expression. Called by the String.prototype.search method. + */ + readonly search: symbol; + + /** + * A function valued property that is the constructor function that is used to create + * derived objects. + */ + readonly species: symbol; + + /** + * A regular expression method that splits a string at the indices that match the regular + * expression. Called by the String.prototype.split method. + */ + readonly split: symbol; + + /** + * A method that converts an object to a corresponding primitive value. + * Called by the ToPrimitive abstract operation. + */ + readonly toPrimitive: symbol; + + /** + * A String value that is used in the creation of the default string description of an object. + * Called by the built-in method Object.prototype.toString. + */ + readonly toStringTag: symbol; + + /** + * An Object whose own property names are property names that are excluded from the 'with' + * environment bindings of the associated objects. + */ + readonly unscopables: symbol; +} + +interface Symbol { + readonly [Symbol.toStringTag]: "Symbol"; +} + +interface Array { + /** Iterator */ + [Symbol.iterator](): IterableIterator; + + /** + * Returns an object whose properties have the value 'true' + * when they will be absent when used in a 'with' statement. + */ + [Symbol.unscopables](): { + copyWithin: boolean; + entries: boolean; + fill: boolean; + find: boolean; + findIndex: boolean; + keys: boolean; + values: boolean; + }; +} + +interface Date { + /** + * Converts a Date object to a string. + */ + [Symbol.toPrimitive](hint: "default"): string; + /** + * Converts a Date object to a string. + */ + [Symbol.toPrimitive](hint: "string"): string; + /** + * Converts a Date object to a number. + */ + [Symbol.toPrimitive](hint: "number"): number; + /** + * Converts a Date object to a string or number. + * + * @param hint The strings "number", "string", or "default" to specify what primitive to return. + * + * @throws {TypeError} If 'hint' was given something other than "number", "string", or "default". + * @returns A number if 'hint' was "number", a string if 'hint' was "string" or "default". + */ + [Symbol.toPrimitive](hint: string): string | number; +} + +interface Map { + [Symbol.iterator]():IterableIterator<[K,V]>; + readonly [Symbol.toStringTag]: "Map"; +} + +interface WeakMap{ + readonly [Symbol.toStringTag]: "WeakMap"; +} + +interface JSON { + readonly [Symbol.toStringTag]: "JSON"; +} + +interface Function { + /** + * Determines whether the given value inherits from this function if this function was used + * as a constructor function. + * + * A constructor function can control which objects are recognized as its instances by + * 'instanceof' by overriding this method. + */ + [Symbol.hasInstance](value: any): boolean; +} + +interface GeneratorFunction extends Function { + readonly [Symbol.toStringTag]: "GeneratorFunction"; +} + +interface IArguments { + /** Iterator */ + [Symbol.iterator](): IterableIterator; +} + +interface Iterator { } + +interface Iterable { + [Symbol.iterator](): Iterator; +} + +interface IterableIterator extends Iterator { + [Symbol.iterator](): IterableIterator; +} + +interface Math { + readonly [Symbol.toStringTag]: "Math"; +} + +interface Promise { + readonly [Symbol.toStringTag]: "Promise"; +} + +interface PromiseConstructor { + readonly [Symbol.species]: Function; +} + +interface RegExp { + /** + * Matches a string with this regular expression, and returns an array containing the results of + * that search. + * @param string A string to search within. + */ + [Symbol.match](string: string): RegExpMatchArray | null; + + /** + * Replaces text in a string, using this regular expression. + * @param string A String object or string literal whose contents matching against + * this regular expression will be replaced + * @param replaceValue A String object or string literal containing the text to replace for every + * successful match of this regular expression. + */ + [Symbol.replace](string: string, replaceValue: string): string; + + /** + * Replaces text in a string, using this regular expression. + * @param string A String object or string literal whose contents matching against + * this regular expression will be replaced + * @param replacer A function that returns the replacement text. + */ + [Symbol.replace](string: string, replacer: (substring: string, ...args: any[]) => string): string; + + /** + * Finds the position beginning first substring match in a regular expression search + * using this regular expression. + * + * @param string The string to search within. + */ + [Symbol.search](string: string): number; + + /** + * Returns an array of substrings that were delimited by strings in the original input that + * match against this regular expression. + * + * If the regular expression contains capturing parentheses, then each time this + * regular expression matches, the results (including any undefined results) of the + * capturing parentheses are spliced. + * + * @param string string value to split + * @param limit if not undefined, the output array is truncated so that it contains no more + * than 'limit' elements. + */ + [Symbol.split](string: string, limit?: number): string[]; +} + +interface RegExpConstructor { + [Symbol.species](): RegExpConstructor; +} + +interface String { + /** Iterator */ + [Symbol.iterator](): IterableIterator; + + /** + * Matches a string an object that supports being matched against, and returns an array containing the results of that search. + * @param matcher An object that supports being matched against. + */ + match(matcher: { [Symbol.match](string: string): RegExpMatchArray | null; }): RegExpMatchArray | null; + + /** + * Replaces text in a string, using an object that supports replacement within a string. + * @param searchValue A object can search for and replace matches within a string. + * @param replaceValue A string containing the text to replace for every successful match of searchValue in this string. + */ + replace(searchValue: { [Symbol.replace](string: string, replaceValue: string): string; }, replaceValue: string): string; + + /** + * Replaces text in a string, using an object that supports replacement within a string. + * @param searchValue A object can search for and replace matches within a string. + * @param replacer A function that returns the replacement text. + */ + replace(searchValue: { [Symbol.replace](string: string, replacer: (substring: string, ...args: any[]) => string): string; }, replacer: (substring: string, ...args: any[]) => string): string; + + /** + * Finds the first substring match in a regular expression search. + * @param searcher An object which supports searching within a string. + */ + search(searcher: { [Symbol.search](string: string): number; }): number; + + /** + * Split a string into substrings using the specified separator and return them as an array. + * @param splitter An object that can split a string. + * @param limit A value used to limit the number of elements returned in the array. + */ + split(splitter: { [Symbol.split](string: string, limit?: number): string[]; }, limit?: number): string[]; +} + +/** + * Represents a raw buffer of binary data, which is used to store data for the + * different typed arrays. ArrayBuffers cannot be read from or written to directly, + * but can be passed to a typed array or DataView Object to interpret the raw + * buffer as needed. + */ +interface ArrayBuffer { + readonly [Symbol.toStringTag]: "ArrayBuffer"; +} + +interface DataView { + readonly [Symbol.toStringTag]: "DataView"; +} + +/** + * A typed array of 8-bit integer values. The contents are initialized to 0. If the requested + * number of bytes could not be allocated an exception is raised. + */ +interface Int8Array { + [Symbol.iterator](): IterableIterator; + readonly [Symbol.toStringTag]: "Int8Array"; +} + +/** + * A typed array of 8-bit unsigned integer values. The contents are initialized to 0. If the + * requested number of bytes could not be allocated an exception is raised. + */ +interface Uint8Array { + [Symbol.iterator](): IterableIterator; + readonly [Symbol.toStringTag]: "UInt8Array"; +} + +/** + * A typed array of 8-bit unsigned integer (clamped) values. The contents are initialized to 0. + * If the requested number of bytes could not be allocated an exception is raised. + */ +interface Uint8ClampedArray { + [Symbol.iterator](): IterableIterator; + readonly [Symbol.toStringTag]: "Uint8ClampedArray"; +} + +/** + * A typed array of 16-bit signed integer values. The contents are initialized to 0. If the + * requested number of bytes could not be allocated an exception is raised. + */ +interface Int16Array { + [Symbol.iterator](): IterableIterator; + readonly [Symbol.toStringTag]: "Int16Array"; +} + +/** + * A typed array of 16-bit unsigned integer values. The contents are initialized to 0. If the + * requested number of bytes could not be allocated an exception is raised. + */ +interface Uint16Array { + [Symbol.iterator](): IterableIterator; + readonly [Symbol.toStringTag]: "Uint16Array"; +} + +/** + * A typed array of 32-bit signed integer values. The contents are initialized to 0. If the + * requested number of bytes could not be allocated an exception is raised. + */ +interface Int32Array { + [Symbol.iterator](): IterableIterator; + readonly [Symbol.toStringTag]: "Int32Array"; +} + +/** + * A typed array of 32-bit unsigned integer values. The contents are initialized to 0. If the + * requested number of bytes could not be allocated an exception is raised. + */ +interface Uint32Array { + [Symbol.iterator](): IterableIterator; + readonly [Symbol.toStringTag]: "Uint32Array"; +} + +/** + * A typed array of 32-bit float values. The contents are initialized to 0. If the requested number + * of bytes could not be allocated an exception is raised. + */ +interface Float32Array { + [Symbol.iterator](): IterableIterator; + readonly [Symbol.toStringTag]: "Float32Array"; +} + +/** + * A typed array of 64-bit float values. The contents are initialized to 0. If the requested + * number of bytes could not be allocated an exception is raised. + */ +interface Float64Array { + [Symbol.iterator](): IterableIterator; + readonly [Symbol.toStringTag]: "Float64Array"; +} \ No newline at end of file diff --git a/src/lib/es7.d.ts b/src/lib/es2016.array.include.d.ts similarity index 100% rename from src/lib/es7.d.ts rename to src/lib/es2016.array.include.d.ts diff --git a/src/lib/es2016.d.ts b/src/lib/es2016.d.ts new file mode 100644 index 00000000000..34f833d621b --- /dev/null +++ b/src/lib/es2016.d.ts @@ -0,0 +1,2 @@ +/// +/// \ No newline at end of file diff --git a/src/lib/core.d.ts b/src/lib/es5.d.ts similarity index 92% rename from src/lib/core.d.ts rename to src/lib/es5.d.ts index e3f5928794f..1bcf528640b 100644 --- a/src/lib/core.d.ts +++ b/src/lib/es5.d.ts @@ -215,14 +215,16 @@ interface Function { * @param thisArg The object to be used as the this object. * @param argArray A set of arguments to be passed to the function. */ - apply(thisArg: any, argArray?: any): any; + apply(this: (this: T, ...argArray: any[]) => U, thisArg: T, argArray?: any): U; + apply(this: Function, thisArg: any, argArray?: any): any; /** * Calls a method of an object, substituting another object for the current object. * @param thisArg The object to be used as the current object. * @param argArray A list of arguments to be passed to the method. */ - call(thisArg: any, ...argArray: any[]): any; + call(this: (this: T, ...argArray: any[]) => U, thisArg: T, ...argArray: any[]): U; + call(this: Function, thisArg: any, ...argArray: any[]): any; /** * For a given function, creates a bound function that has the same body as the original function. @@ -230,7 +232,8 @@ interface Function { * @param thisArg An object to which the this keyword can refer inside the new function. * @param argArray A list of arguments to be passed to the new function. */ - bind(thisArg: any, ...argArray: any[]): any; + bind(this: (this: T, ...argArray: any[]) => U, thisArg: T, ...argArray: any[]): (this: void, ...argArray: any[]) => U; + bind(this: Function, thisArg: any, ...argArray: any[]): any; prototype: any; readonly length: number; @@ -3904,3 +3907,204 @@ interface Float64ArrayConstructor { from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Float64Array; } declare const Float64Array: Float64ArrayConstructor; + +///////////////////////////// +/// ECMAScript Internationalization API +///////////////////////////// + +declare module Intl { + interface CollatorOptions { + usage?: string; + localeMatcher?: string; + numeric?: boolean; + caseFirst?: string; + sensitivity?: string; + ignorePunctuation?: boolean; + } + + interface ResolvedCollatorOptions { + locale: string; + usage: string; + sensitivity: string; + ignorePunctuation: boolean; + collation: string; + caseFirst: string; + numeric: boolean; + } + + interface Collator { + compare(x: string, y: string): number; + resolvedOptions(): ResolvedCollatorOptions; + } + var Collator: { + new (locales?: string[], options?: CollatorOptions): Collator; + new (locale?: string, options?: CollatorOptions): Collator; + (locales?: string[], options?: CollatorOptions): Collator; + (locale?: string, options?: CollatorOptions): Collator; + supportedLocalesOf(locales: string[], options?: CollatorOptions): string[]; + supportedLocalesOf(locale: string, options?: CollatorOptions): string[]; + } + + interface NumberFormatOptions { + localeMatcher?: string; + style?: string; + currency?: string; + currencyDisplay?: string; + useGrouping?: boolean; + minimumIntegerDigits?: number; + minimumFractionDigits?: number; + maximumFractionDigits?: number; + minimumSignificantDigits?: number; + maximumSignificantDigits?: number; + } + + interface ResolvedNumberFormatOptions { + locale: string; + numberingSystem: string; + style: string; + currency?: string; + currencyDisplay?: string; + minimumIntegerDigits: number; + minimumFractionDigits: number; + maximumFractionDigits: number; + minimumSignificantDigits?: number; + maximumSignificantDigits?: number; + useGrouping: boolean; + } + + interface NumberFormat { + format(value: number): string; + resolvedOptions(): ResolvedNumberFormatOptions; + } + var NumberFormat: { + new (locales?: string[], options?: NumberFormatOptions): NumberFormat; + new (locale?: string, options?: NumberFormatOptions): NumberFormat; + (locales?: string[], options?: NumberFormatOptions): NumberFormat; + (locale?: string, options?: NumberFormatOptions): NumberFormat; + supportedLocalesOf(locales: string[], options?: NumberFormatOptions): string[]; + supportedLocalesOf(locale: string, options?: NumberFormatOptions): string[]; + } + + interface DateTimeFormatOptions { + localeMatcher?: string; + weekday?: string; + era?: string; + year?: string; + month?: string; + day?: string; + hour?: string; + minute?: string; + second?: string; + timeZoneName?: string; + formatMatcher?: string; + hour12?: boolean; + timeZone?: string; + } + + interface ResolvedDateTimeFormatOptions { + locale: string; + calendar: string; + numberingSystem: string; + timeZone: string; + hour12?: boolean; + weekday?: string; + era?: string; + year?: string; + month?: string; + day?: string; + hour?: string; + minute?: string; + second?: string; + timeZoneName?: string; + } + + interface DateTimeFormat { + format(date?: Date | number): string; + resolvedOptions(): ResolvedDateTimeFormatOptions; + } + var DateTimeFormat: { + new (locales?: string[], options?: DateTimeFormatOptions): DateTimeFormat; + new (locale?: string, options?: DateTimeFormatOptions): DateTimeFormat; + (locales?: string[], options?: DateTimeFormatOptions): DateTimeFormat; + (locale?: string, options?: DateTimeFormatOptions): DateTimeFormat; + supportedLocalesOf(locales: string[], options?: DateTimeFormatOptions): string[]; + supportedLocalesOf(locale: string, options?: DateTimeFormatOptions): string[]; + } +} + +interface String { + /** + * Determines whether two strings are equivalent in the current locale. + * @param that String to compare to target string + * @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. + * @param options An object that contains one or more properties that specify comparison options. see the Intl.Collator object for details. + */ + localeCompare(that: string, locales: string[], options?: Intl.CollatorOptions): number; + + /** + * Determines whether two strings are equivalent in the current locale. + * @param that String to compare to target string + * @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. + * @param options An object that contains one or more properties that specify comparison options. see the Intl.Collator object for details. + */ + localeCompare(that: string, locale: string, options?: Intl.CollatorOptions): number; +} + +interface Number { + /** + * Converts a number to a string by using the current or specified locale. + * @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. + * @param options An object that contains one or more properties that specify comparison options. + */ + toLocaleString(locales?: string[], options?: Intl.NumberFormatOptions): string; + + /** + * Converts a number to a string by using the current or specified locale. + * @param locale Locale tag. If you omit this parameter, the default locale of the JavaScript runtime is used. + * @param options An object that contains one or more properties that specify comparison options. + */ + toLocaleString(locale?: string, options?: Intl.NumberFormatOptions): string; +} + +interface Date { + /** + * Converts a date and time to a string by using the current or specified locale. + * @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. + * @param options An object that contains one or more properties that specify comparison options. + */ + toLocaleString(locales?: string[], options?: Intl.DateTimeFormatOptions): string; + /** + * Converts a date to a string by using the current or specified locale. + * @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. + * @param options An object that contains one or more properties that specify comparison options. + */ + toLocaleDateString(locales?: string[], options?: Intl.DateTimeFormatOptions): string; + + /** + * Converts a time to a string by using the current or specified locale. + * @param locale Locale tag. If you omit this parameter, the default locale of the JavaScript runtime is used. + * @param options An object that contains one or more properties that specify comparison options. + */ + toLocaleTimeString(locale?: string[], options?: Intl.DateTimeFormatOptions): string; + + /** + * Converts a date and time to a string by using the current or specified locale. + * @param locale Locale tag. If you omit this parameter, the default locale of the JavaScript runtime is used. + * @param options An object that contains one or more properties that specify comparison options. + */ + toLocaleString(locale?: string, options?: Intl.DateTimeFormatOptions): string; + + /** + * Converts a date to a string by using the current or specified locale. + * @param locale Locale tag. If you omit this parameter, the default locale of the JavaScript runtime is used. + * @param options An object that contains one or more properties that specify comparison options. + */ + toLocaleDateString(locale?: string, options?: Intl.DateTimeFormatOptions): string; + + /** + * Converts a time to a string by using the current or specified locale. + * @param locale Locale tag. If you omit this parameter, the default locale of the JavaScript runtime is used. + * @param options An object that contains one or more properties that specify comparison options. + */ + toLocaleTimeString(locale?: string, options?: Intl.DateTimeFormatOptions): string; +} diff --git a/src/lib/es6.d.ts b/src/lib/es6.d.ts deleted file mode 100644 index 40984ab1512..00000000000 --- a/src/lib/es6.d.ts +++ /dev/null @@ -1,1333 +0,0 @@ -declare type PropertyKey = string | number | symbol; - -interface Symbol { - /** Returns a string representation of an object. */ - toString(): string; - - /** Returns the primitive value of the specified object. */ - valueOf(): Object; - - readonly [Symbol.toStringTag]: "Symbol"; -} - -interface SymbolConstructor { - /** - * A reference to the prototype. - */ - readonly prototype: Symbol; - - /** - * Returns a new unique Symbol value. - * @param description Description of the new Symbol object. - */ - (description?: string|number): symbol; - - /** - * Returns a Symbol object from the global symbol registry matching the given key if found. - * Otherwise, returns a new symbol with this key. - * @param key key to search for. - */ - for(key: string): symbol; - - /** - * Returns a key from the global symbol registry matching the given Symbol if found. - * Otherwise, returns a undefined. - * @param sym Symbol to find the key for. - */ - keyFor(sym: symbol): string | undefined; - - // Well-known Symbols - - /** - * A method that determines if a constructor object recognizes an object as one of the - * constructor’s instances. Called by the semantics of the instanceof operator. - */ - readonly hasInstance: symbol; - - /** - * A Boolean value that if true indicates that an object should flatten to its array elements - * by Array.prototype.concat. - */ - readonly isConcatSpreadable: symbol; - - /** - * A method that returns the default iterator for an object. Called by the semantics of the - * for-of statement. - */ - readonly iterator: symbol; - - /** - * A regular expression method that matches the regular expression against a string. Called - * by the String.prototype.match method. - */ - readonly match: symbol; - - /** - * A regular expression method that replaces matched substrings of a string. Called by the - * String.prototype.replace method. - */ - readonly replace: symbol; - - /** - * A regular expression method that returns the index within a string that matches the - * regular expression. Called by the String.prototype.search method. - */ - readonly search: symbol; - - /** - * A function valued property that is the constructor function that is used to create - * derived objects. - */ - readonly species: symbol; - - /** - * A regular expression method that splits a string at the indices that match the regular - * expression. Called by the String.prototype.split method. - */ - readonly split: symbol; - - /** - * A method that converts an object to a corresponding primitive value. - * Called by the ToPrimitive abstract operation. - */ - readonly toPrimitive: symbol; - - /** - * A String value that is used in the creation of the default string description of an object. - * Called by the built-in method Object.prototype.toString. - */ - readonly toStringTag: symbol; - - /** - * An Object whose own property names are property names that are excluded from the 'with' - * environment bindings of the associated objects. - */ - readonly unscopables: symbol; -} -declare var Symbol: SymbolConstructor; - -interface Object { - /** - * Determines whether an object has a property with the specified name. - * @param v A property name. - */ - hasOwnProperty(v: PropertyKey): boolean; - - /** - * Determines whether a specified property is enumerable. - * @param v A property name. - */ - propertyIsEnumerable(v: PropertyKey): boolean; -} - -interface ObjectConstructor { - /** - * Copy the values of all of the enumerable own properties from one or more source objects to a - * target object. Returns the target object. - * @param target The target object to copy to. - * @param source The source object from which to copy properties. - */ - assign(target: T, source: U): T & U; - - /** - * Copy the values of all of the enumerable own properties from one or more source objects to a - * target object. Returns the target object. - * @param target The target object to copy to. - * @param source1 The first source object from which to copy properties. - * @param source2 The second source object from which to copy properties. - */ - assign(target: T, source1: U, source2: V): T & U & V; - - /** - * Copy the values of all of the enumerable own properties from one or more source objects to a - * target object. Returns the target object. - * @param target The target object to copy to. - * @param source1 The first source object from which to copy properties. - * @param source2 The second source object from which to copy properties. - * @param source3 The third source object from which to copy properties. - */ - assign(target: T, source1: U, source2: V, source3: W): T & U & V & W; - - /** - * Copy the values of all of the enumerable own properties from one or more source objects to a - * target object. Returns the target object. - * @param target The target object to copy to. - * @param sources One or more source objects from which to copy properties - */ - assign(target: any, ...sources: any[]): any; - - /** - * Returns an array of all symbol properties found directly on object o. - * @param o Object to retrieve the symbols from. - */ - getOwnPropertySymbols(o: any): symbol[]; - - /** - * Returns true if the values are the same value, false otherwise. - * @param value1 The first value. - * @param value2 The second value. - */ - is(value1: any, value2: any): boolean; - - /** - * Sets the prototype of a specified object o to object proto or null. Returns the object o. - * @param o The object to change its prototype. - * @param proto The value of the new prototype or null. - */ - setPrototypeOf(o: any, proto: any): any; - - /** - * Gets the own property descriptor of the specified object. - * An own property descriptor is one that is defined directly on the object and is not - * inherited from the object's prototype. - * @param o Object that contains the property. - * @param p Name of the property. - */ - getOwnPropertyDescriptor(o: any, propertyKey: PropertyKey): PropertyDescriptor; - - /** - * Adds a property to an object, or modifies attributes of an existing property. - * @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. - * @param p The property name. - * @param attributes Descriptor for the property. It can be for a data property or an accessor - * property. - */ - defineProperty(o: any, propertyKey: PropertyKey, attributes: PropertyDescriptor): any; -} - -interface Function { - /** - * Returns the name of the function. Function names are read-only and can not be changed. - */ - readonly name: string; - - /** - * Determines whether the given value inherits from this function if this function was used - * as a constructor function. - * - * A constructor function can control which objects are recognized as its instances by - * 'instanceof' by overriding this method. - */ - [Symbol.hasInstance](value: any): boolean; -} - -interface NumberConstructor { - /** - * The value of Number.EPSILON is the difference between 1 and the smallest value greater than 1 - * that is representable as a Number value, which is approximately: - * 2.2204460492503130808472633361816 x 10‍−‍16. - */ - readonly EPSILON: number; - - /** - * Returns true if passed value is finite. - * Unlike the global isFinite, Number.isFinite doesn't forcibly convert the parameter to a - * number. Only finite values of the type number, result in true. - * @param number A numeric value. - */ - isFinite(number: number): boolean; - - /** - * Returns true if the value passed is an integer, false otherwise. - * @param number A numeric value. - */ - isInteger(number: number): boolean; - - /** - * Returns a Boolean value that indicates whether a value is the reserved value NaN (not a - * number). Unlike the global isNaN(), Number.isNaN() doesn't forcefully convert the parameter - * to a number. Only values of the type number, that are also NaN, result in true. - * @param number A numeric value. - */ - isNaN(number: number): boolean; - - /** - * Returns true if the value passed is a safe integer. - * @param number A numeric value. - */ - isSafeInteger(number: number): boolean; - - /** - * The value of the largest integer n such that n and n + 1 are both exactly representable as - * a Number value. - * The value of Number.MIN_SAFE_INTEGER is 9007199254740991 2^53 − 1. - */ - readonly MAX_SAFE_INTEGER: number; - - /** - * The value of the smallest integer n such that n and n − 1 are both exactly representable as - * a Number value. - * The value of Number.MIN_SAFE_INTEGER is −9007199254740991 (−(2^53 − 1)). - */ - readonly MIN_SAFE_INTEGER: number; - - /** - * Converts a string to a floating-point number. - * @param string A string that contains a floating-point number. - */ - parseFloat(string: string): number; - - /** - * Converts A string to an integer. - * @param s A string to convert into a number. - * @param radix A value between 2 and 36 that specifies the base of the number in numString. - * If this argument is not supplied, strings with a prefix of '0x' are considered hexadecimal. - * All other strings are considered decimal. - */ - parseInt(string: string, radix?: number): number; -} - -interface Array { - /** Iterator */ - [Symbol.iterator](): IterableIterator; - - /** - * Returns an object whose properties have the value 'true' - * when they will be absent when used in a 'with' statement. - */ - [Symbol.unscopables](): { - copyWithin: boolean; - entries: boolean; - fill: boolean; - find: boolean; - findIndex: boolean; - keys: boolean; - values: boolean; - }; - - /** - * Returns an array of key, value pairs for every entry in the array - */ - entries(): IterableIterator<[number, T]>; - - /** - * Returns an list of keys in the array - */ - keys(): IterableIterator; - - /** - * Returns an list of values in the array - */ - values(): IterableIterator; - - /** - * Returns the value of the first element in the array where predicate is true, and undefined - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - find(predicate: (value: T, index: number, obj: Array) => boolean, thisArg?: any): T | undefined; - - /** - * Returns the index of the first element in the array where predicate is true, and undefined - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - findIndex(predicate: (value: T) => boolean, thisArg?: any): number | undefined; - - /** - * Returns the this object after filling the section identified by start and end with value - * @param value value to fill array section with - * @param start index to start filling the array at. If start is negative, it is treated as - * length+start where length is the length of the array. - * @param end index to stop filling the array at. If end is negative, it is treated as - * length+end. - */ - fill(value: T, start?: number, end?: number): T[]; - - /** - * Returns the this object after copying a section of the array identified by start and end - * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it - * is treated as length+end. - * @param end If not specified, length of the this object is used as its default value. - */ - copyWithin(target: number, start: number, end?: number): T[]; -} - -interface IArguments { - /** Iterator */ - [Symbol.iterator](): IterableIterator; -} - -interface ArrayConstructor { - /** - * Creates an array from an array-like object. - * @param arrayLike An array-like object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(arrayLike: ArrayLike, mapfn: (v: T, k: number) => U, thisArg?: any): Array; - - /** - * Creates an array from an iterable object. - * @param iterable An iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(iterable: Iterable, mapfn: (v: T, k: number) => U, thisArg?: any): Array; - - /** - * Creates an array from an array-like object. - * @param arrayLike An array-like object to convert to an array. - */ - from(arrayLike: ArrayLike): Array; - - /** - * Creates an array from an iterable object. - * @param iterable An iterable object to convert to an array. - */ - from(iterable: Iterable): Array; - - /** - * Returns a new array from a set of elements. - * @param items A set of elements to include in the new array object. - */ - of(...items: T[]): Array; -} - -interface String { - /** Iterator */ - [Symbol.iterator](): IterableIterator; - - /** - * Returns a nonnegative integer Number less than 1114112 (0x110000) that is the code point - * value of the UTF-16 encoded code point starting at the string element at position pos in - * the String resulting from converting this object to a String. - * If there is no element at that position, the result is undefined. - * If a valid UTF-16 surrogate pair does not begin at pos, the result is the code unit at pos. - */ - codePointAt(pos: number): number | undefined; - - /** - * Returns true if searchString appears as a substring of the result of converting this - * object to a String, at one or more positions that are - * greater than or equal to position; otherwise, returns false. - * @param searchString search string - * @param position If position is undefined, 0 is assumed, so as to search all of the String. - */ - includes(searchString: string, position?: number): boolean; - - /** - * Returns true if the sequence of elements of searchString converted to a String is the - * same as the corresponding elements of this object (converted to a String) starting at - * endPosition – length(this). Otherwise returns false. - */ - endsWith(searchString: string, endPosition?: number): boolean; - - /** - * Returns the String value result of normalizing the string into the normalization form - * named by form as specified in Unicode Standard Annex #15, Unicode Normalization Forms. - * @param form Applicable values: "NFC", "NFD", "NFKC", or "NFKD", If not specified default - * is "NFC" - */ - normalize(form?: string): string; - - /** - * Returns a String value that is made from count copies appended together. If count is 0, - * T is the empty String is returned. - * @param count number of copies to append - */ - repeat(count: number): string; - - /** - * Returns true if the sequence of elements of searchString converted to a String is the - * same as the corresponding elements of this object (converted to a String) starting at - * position. Otherwise returns false. - */ - startsWith(searchString: string, position?: number): boolean; - - // Overloads for objects with methods of well-known symbols. - - /** - * Matches a string an object that supports being matched against, and returns an array containing the results of that search. - * @param matcher An object that supports being matched against. - */ - match(matcher: { [Symbol.match](string: string): RegExpMatchArray | null; }): RegExpMatchArray | null; - - /** - * Replaces text in a string, using an object that supports replacement within a string. - * @param searchValue A object can search for and replace matches within a string. - * @param replaceValue A string containing the text to replace for every successful match of searchValue in this string. - */ - replace(searchValue: { [Symbol.replace](string: string, replaceValue: string): string; }, replaceValue: string): string; - - /** - * Replaces text in a string, using an object that supports replacement within a string. - * @param searchValue A object can search for and replace matches within a string. - * @param replacer A function that returns the replacement text. - */ - replace(searchValue: { [Symbol.replace](string: string, replacer: (substring: string, ...args: any[]) => string): string; }, replacer: (substring: string, ...args: any[]) => string): string; - - /** - * Finds the first substring match in a regular expression search. - * @param searcher An object which supports searching within a string. - */ - search(searcher: { [Symbol.search](string: string): number; }): number; - - /** - * Split a string into substrings using the specified separator and return them as an array. - * @param splitter An object that can split a string. - * @param limit A value used to limit the number of elements returned in the array. - */ - split(splitter: { [Symbol.split](string: string, limit?: number): string[]; }, limit?: number): string[]; - - /** - * Returns an HTML anchor element and sets the name attribute to the text value - * @param name - */ - anchor(name: string): string; - - /** Returns a HTML element */ - big(): string; - - /** Returns a HTML element */ - blink(): string; - - /** Returns a HTML element */ - bold(): string; - - /** Returns a HTML element */ - fixed(): string - - /** Returns a HTML element and sets the color attribute value */ - fontcolor(color: string): string - - /** Returns a HTML element and sets the size attribute value */ - fontsize(size: number): string; - - /** Returns a HTML element and sets the size attribute value */ - fontsize(size: string): string; - - /** Returns an HTML element */ - italics(): string; - - /** Returns an HTML element and sets the href attribute value */ - link(url: string): string; - - /** Returns a HTML element */ - small(): string; - - /** Returns a HTML element */ - strike(): string; - - /** Returns a HTML element */ - sub(): string; - - /** Returns a HTML element */ - sup(): string; -} - -interface StringConstructor { - /** - * Return the String value whose elements are, in order, the elements in the List elements. - * If length is 0, the empty string is returned. - */ - fromCodePoint(...codePoints: number[]): string; - - /** - * String.raw is intended for use as a tag function of a Tagged Template String. When called - * as such the first argument will be a well formed template call site object and the rest - * parameter will contain the substitution values. - * @param template A well-formed template string call site representation. - * @param substitutions A set of substitution values. - */ - raw(template: TemplateStringsArray, ...substitutions: any[]): string; -} - -interface IteratorResult { - done: boolean; - value?: T; -} - -interface Iterator { - next(value?: any): IteratorResult; - return?(value?: any): IteratorResult; - throw?(e?: any): IteratorResult; -} - -interface Iterable { - [Symbol.iterator](): Iterator; -} - -interface IterableIterator extends Iterator { - [Symbol.iterator](): IterableIterator; -} - -interface GeneratorFunction extends Function { - readonly [Symbol.toStringTag]: "GeneratorFunction"; -} - -interface GeneratorFunctionConstructor { - /** - * Creates a new Generator function. - * @param args A list of arguments the function accepts. - */ - new (...args: string[]): GeneratorFunction; - (...args: string[]): GeneratorFunction; - readonly prototype: GeneratorFunction; -} -declare var GeneratorFunction: GeneratorFunctionConstructor; - -interface Math { - /** - * Returns the number of leading zero bits in the 32-bit binary representation of a number. - * @param x A numeric expression. - */ - clz32(x: number): number; - - /** - * Returns the result of 32-bit multiplication of two numbers. - * @param x First number - * @param y Second number - */ - imul(x: number, y: number): number; - - /** - * Returns the sign of the x, indicating whether x is positive, negative or zero. - * @param x The numeric expression to test - */ - sign(x: number): number; - - /** - * Returns the base 10 logarithm of a number. - * @param x A numeric expression. - */ - log10(x: number): number; - - /** - * Returns the base 2 logarithm of a number. - * @param x A numeric expression. - */ - log2(x: number): number; - - /** - * Returns the natural logarithm of 1 + x. - * @param x A numeric expression. - */ - log1p(x: number): number; - - /** - * Returns the result of (e^x - 1) of x (e raised to the power of x, where e is the base of - * the natural logarithms). - * @param x A numeric expression. - */ - expm1(x: number): number; - - /** - * Returns the hyperbolic cosine of a number. - * @param x A numeric expression that contains an angle measured in radians. - */ - cosh(x: number): number; - - /** - * Returns the hyperbolic sine of a number. - * @param x A numeric expression that contains an angle measured in radians. - */ - sinh(x: number): number; - - /** - * Returns the hyperbolic tangent of a number. - * @param x A numeric expression that contains an angle measured in radians. - */ - tanh(x: number): number; - - /** - * Returns the inverse hyperbolic cosine of a number. - * @param x A numeric expression that contains an angle measured in radians. - */ - acosh(x: number): number; - - /** - * Returns the inverse hyperbolic sine of a number. - * @param x A numeric expression that contains an angle measured in radians. - */ - asinh(x: number): number; - - /** - * Returns the inverse hyperbolic tangent of a number. - * @param x A numeric expression that contains an angle measured in radians. - */ - atanh(x: number): number; - - /** - * Returns the square root of the sum of squares of its arguments. - * @param values Values to compute the square root for. - * If no arguments are passed, the result is +0. - * If there is only one argument, the result is the absolute value. - * If any argument is +Infinity or -Infinity, the result is +Infinity. - * If any argument is NaN, the result is NaN. - * If all arguments are either +0 or −0, the result is +0. - */ - hypot(...values: number[] ): number; - - /** - * Returns the integral part of the a numeric expression, x, removing any fractional digits. - * If x is already an integer, the result is x. - * @param x A numeric expression. - */ - trunc(x: number): number; - - /** - * Returns the nearest single precision float representation of a number. - * @param x A numeric expression. - */ - fround(x: number): number; - - /** - * Returns an implementation-dependent approximation to the cube root of number. - * @param x A numeric expression. - */ - cbrt(x: number): number; - - readonly [Symbol.toStringTag]: "Math"; -} - -interface Date { - /** - * Converts a Date object to a string. - */ - [Symbol.toPrimitive](hint: "default"): string; - /** - * Converts a Date object to a string. - */ - [Symbol.toPrimitive](hint: "string"): string; - /** - * Converts a Date object to a number. - */ - [Symbol.toPrimitive](hint: "number"): number; - /** - * Converts a Date object to a string or number. - * - * @param hint The strings "number", "string", or "default" to specify what primitive to return. - * - * @throws {TypeError} If 'hint' was given something other than "number", "string", or "default". - * @returns A number if 'hint' was "number", a string if 'hint' was "string" or "default". - */ - [Symbol.toPrimitive](hint: string): string | number; -} - -interface RegExp { - /** - * Matches a string with this regular expression, and returns an array containing the results of - * that search. - * @param string A string to search within. - */ - [Symbol.match](string: string): RegExpMatchArray | null; - - /** - * Replaces text in a string, using this regular expression. - * @param string A String object or string literal whose contents matching against - * this regular expression will be replaced - * @param replaceValue A String object or string literal containing the text to replace for every - * successful match of this regular expression. - */ - [Symbol.replace](string: string, replaceValue: string): string; - - /** - * Replaces text in a string, using this regular expression. - * @param string A String object or string literal whose contents matching against - * this regular expression will be replaced - * @param replacer A function that returns the replacement text. - */ - [Symbol.replace](string: string, replacer: (substring: string, ...args: any[]) => string): string; - - /** - * Finds the position beginning first substring match in a regular expression search - * using this regular expression. - * - * @param string The string to search within. - */ - [Symbol.search](string: string): number; - - /** - * Returns an array of substrings that were delimited by strings in the original input that - * match against this regular expression. - * - * If the regular expression contains capturing parentheses, then each time this - * regular expression matches, the results (including any undefined results) of the - * capturing parentheses are spliced. - * - * @param string string value to split - * @param limit if not undefined, the output array is truncated so that it contains no more - * than 'limit' elements. - */ - [Symbol.split](string: string, limit?: number): string[]; - - /** - * Returns a string indicating the flags of the regular expression in question. This field is read-only. - * The characters in this string are sequenced and concatenated in the following order: - * - * - "g" for global - * - "i" for ignoreCase - * - "m" for multiline - * - "u" for unicode - * - "y" for sticky - * - * If no flags are set, the value is the empty string. - */ - readonly flags: string; - - /** - * Returns a Boolean value indicating the state of the sticky flag (y) used with a regular - * expression. Default is false. Read-only. - */ - readonly sticky: boolean; - - /** - * Returns a Boolean value indicating the state of the Unicode flag (u) used with a regular - * expression. Default is false. Read-only. - */ - readonly unicode: boolean; -} - -interface RegExpConstructor { - [Symbol.species](): RegExpConstructor; -} - -interface Map { - clear(): void; - delete(key: K): boolean; - entries(): IterableIterator<[K, V]>; - forEach(callbackfn: (value: V, index: K, map: Map) => void, thisArg?: any): void; - get(key: K): V | undefined; - has(key: K): boolean; - keys(): IterableIterator; - set(key: K, value?: V): Map; - readonly size: number; - values(): IterableIterator; - [Symbol.iterator]():IterableIterator<[K,V]>; - readonly [Symbol.toStringTag]: "Map"; -} - -interface MapConstructor { - new (): Map; - new (): Map; - new (iterable: Iterable<[K, V]>): Map; - readonly prototype: Map; -} -declare var Map: MapConstructor; - -interface WeakMap { - clear(): void; - delete(key: K): boolean; - get(key: K): V | undefined; - has(key: K): boolean; - set(key: K, value?: V): WeakMap; - readonly [Symbol.toStringTag]: "WeakMap"; -} - -interface WeakMapConstructor { - new (): WeakMap; - new (): WeakMap; - new (iterable: Iterable<[K, V]>): WeakMap; - readonly prototype: WeakMap; -} -declare var WeakMap: WeakMapConstructor; - -interface Set { - add(value: T): Set; - clear(): void; - delete(value: T): boolean; - entries(): IterableIterator<[T, T]>; - forEach(callbackfn: (value: T, index: T, set: Set) => void, thisArg?: any): void; - has(value: T): boolean; - keys(): IterableIterator; - readonly size: number; - values(): IterableIterator; - [Symbol.iterator]():IterableIterator; - readonly [Symbol.toStringTag]: "Set"; -} - -interface SetConstructor { - new (): Set; - new (): Set; - new (iterable: Iterable): Set; - readonly prototype: Set; -} -declare var Set: SetConstructor; - -interface WeakSet { - add(value: T): WeakSet; - clear(): void; - delete(value: T): boolean; - has(value: T): boolean; - readonly [Symbol.toStringTag]: "WeakSet"; -} - -interface WeakSetConstructor { - new (): WeakSet; - new (): WeakSet; - new (iterable: Iterable): WeakSet; - readonly prototype: WeakSet; -} -declare var WeakSet: WeakSetConstructor; - -interface JSON { - readonly [Symbol.toStringTag]: "JSON"; -} - -/** - * Represents a raw buffer of binary data, which is used to store data for the - * different typed arrays. ArrayBuffers cannot be read from or written to directly, - * but can be passed to a typed array or DataView Object to interpret the raw - * buffer as needed. - */ -interface ArrayBuffer { - readonly [Symbol.toStringTag]: "ArrayBuffer"; -} - -interface DataView { - readonly [Symbol.toStringTag]: "DataView"; -} - -/** - * A typed array of 8-bit integer values. The contents are initialized to 0. If the requested - * number of bytes could not be allocated an exception is raised. - */ -interface Int8Array { - /** - * Returns an array of key, value pairs for every entry in the array - */ - entries(): IterableIterator<[number, number]>; - /** - * Returns an list of keys in the array - */ - keys(): IterableIterator; - /** - * Returns an list of values in the array - */ - values(): IterableIterator; - [Symbol.iterator](): IterableIterator; - readonly [Symbol.toStringTag]: "Int8Array"; -} - -interface Int8ArrayConstructor { - new (elements: Iterable): Int8Array; - - /** - * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Int8Array; -} - -/** - * A typed array of 8-bit unsigned integer values. The contents are initialized to 0. If the - * requested number of bytes could not be allocated an exception is raised. - */ -interface Uint8Array { - /** - * Returns an array of key, value pairs for every entry in the array - */ - entries(): IterableIterator<[number, number]>; - /** - * Returns an list of keys in the array - */ - keys(): IterableIterator; - /** - * Returns an list of values in the array - */ - values(): IterableIterator; - [Symbol.iterator](): IterableIterator; - readonly [Symbol.toStringTag]: "UInt8Array"; -} - -interface Uint8ArrayConstructor { - new (elements: Iterable): Uint8Array; - - /** - * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint8Array; -} - -/** - * A typed array of 8-bit unsigned integer (clamped) values. The contents are initialized to 0. - * If the requested number of bytes could not be allocated an exception is raised. - */ -interface Uint8ClampedArray { - /** - * Returns an array of key, value pairs for every entry in the array - */ - entries(): IterableIterator<[number, number]>; - - /** - * Returns an list of keys in the array - */ - keys(): IterableIterator; - - /** - * Returns an list of values in the array - */ - values(): IterableIterator; - - [Symbol.iterator](): IterableIterator; - readonly [Symbol.toStringTag]: "Uint8ClampedArray"; -} - -interface Uint8ClampedArrayConstructor { - new (elements: Iterable): Uint8ClampedArray; - - - /** - * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint8ClampedArray; -} - -/** - * A typed array of 16-bit signed integer values. The contents are initialized to 0. If the - * requested number of bytes could not be allocated an exception is raised. - */ -interface Int16Array { - /** - * Returns an array of key, value pairs for every entry in the array - */ - entries(): IterableIterator<[number, number]>; - - /** - * Returns an list of keys in the array - */ - keys(): IterableIterator; - - /** - * Returns an list of values in the array - */ - values(): IterableIterator; - - - [Symbol.iterator](): IterableIterator; - readonly [Symbol.toStringTag]: "Int16Array"; -} - -interface Int16ArrayConstructor { - new (elements: Iterable): Int16Array; - - /** - * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Int16Array; -} - -/** - * A typed array of 16-bit unsigned integer values. The contents are initialized to 0. If the - * requested number of bytes could not be allocated an exception is raised. - */ -interface Uint16Array { - /** - * Returns an array of key, value pairs for every entry in the array - */ - entries(): IterableIterator<[number, number]>; - /** - * Returns an list of keys in the array - */ - keys(): IterableIterator; - /** - * Returns an list of values in the array - */ - values(): IterableIterator; - [Symbol.iterator](): IterableIterator; - readonly [Symbol.toStringTag]: "Uint16Array"; -} - -interface Uint16ArrayConstructor { - new (elements: Iterable): Uint16Array; - - /** - * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint16Array; -} - -/** - * A typed array of 32-bit signed integer values. The contents are initialized to 0. If the - * requested number of bytes could not be allocated an exception is raised. - */ -interface Int32Array { - /** - * Returns an array of key, value pairs for every entry in the array - */ - entries(): IterableIterator<[number, number]>; - /** - * Returns an list of keys in the array - */ - keys(): IterableIterator; - /** - * Returns an list of values in the array - */ - values(): IterableIterator; - [Symbol.iterator](): IterableIterator; - readonly [Symbol.toStringTag]: "Int32Array"; -} - -interface Int32ArrayConstructor { - new (elements: Iterable): Int32Array; - - /** - * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Int32Array; -} - -/** - * A typed array of 32-bit unsigned integer values. The contents are initialized to 0. If the - * requested number of bytes could not be allocated an exception is raised. - */ -interface Uint32Array { - /** - * Returns an array of key, value pairs for every entry in the array - */ - entries(): IterableIterator<[number, number]>; - /** - * Returns an list of keys in the array - */ - keys(): IterableIterator; - /** - * Returns an list of values in the array - */ - values(): IterableIterator; - [Symbol.iterator](): IterableIterator; - readonly [Symbol.toStringTag]: "Uint32Array"; -} - -interface Uint32ArrayConstructor { - new (elements: Iterable): Uint32Array; - - /** - * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint32Array; -} - -/** - * A typed array of 32-bit float values. The contents are initialized to 0. If the requested number - * of bytes could not be allocated an exception is raised. - */ -interface Float32Array { - /** - * Returns an array of key, value pairs for every entry in the array - */ - entries(): IterableIterator<[number, number]>; - /** - * Returns an list of keys in the array - */ - keys(): IterableIterator; - /** - * Returns an list of values in the array - */ - values(): IterableIterator; - [Symbol.iterator](): IterableIterator; - readonly [Symbol.toStringTag]: "Float32Array"; -} - -interface Float32ArrayConstructor { - new (elements: Iterable): Float32Array; - - /** - * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Float32Array; -} - -/** - * A typed array of 64-bit float values. The contents are initialized to 0. If the requested - * number of bytes could not be allocated an exception is raised. - */ -interface Float64Array { - /** - * Returns an array of key, value pairs for every entry in the array - */ - entries(): IterableIterator<[number, number]>; - /** - * Returns an list of keys in the array - */ - keys(): IterableIterator; - /** - * Returns an list of values in the array - */ - values(): IterableIterator; - [Symbol.iterator](): IterableIterator; - readonly [Symbol.toStringTag]: "Float64Array"; -} - -interface Float64ArrayConstructor { - new (elements: Iterable): Float64Array; - - /** - * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Float64Array; -} - -interface ProxyHandler { - getPrototypeOf? (target: T): any; - setPrototypeOf? (target: T, v: any): boolean; - isExtensible? (target: T): boolean; - preventExtensions? (target: T): boolean; - getOwnPropertyDescriptor? (target: T, p: PropertyKey): PropertyDescriptor; - has? (target: T, p: PropertyKey): boolean; - get? (target: T, p: PropertyKey, receiver: any): any; - set? (target: T, p: PropertyKey, value: any, receiver: any): boolean; - deleteProperty? (target: T, p: PropertyKey): boolean; - defineProperty? (target: T, p: PropertyKey, attributes: PropertyDescriptor): boolean; - enumerate? (target: T): PropertyKey[]; - ownKeys? (target: T): PropertyKey[]; - apply? (target: T, thisArg: any, argArray?: any): any; - construct? (target: T, thisArg: any, argArray?: any): any; -} - -interface ProxyConstructor { - revocable(target: T, handler: ProxyHandler): { proxy: T; revoke: () => void; }; - new (target: T, handler: ProxyHandler): T -} -declare var Proxy: ProxyConstructor; - -declare namespace Reflect { - function apply(target: Function, thisArgument: any, argumentsList: ArrayLike): any; - function construct(target: Function, argumentsList: ArrayLike, newTarget?: any): any; - function defineProperty(target: any, propertyKey: PropertyKey, attributes: PropertyDescriptor): boolean; - function deleteProperty(target: any, propertyKey: PropertyKey): boolean; - function enumerate(target: any): IterableIterator; - function get(target: any, propertyKey: PropertyKey, receiver?: any): any; - function getOwnPropertyDescriptor(target: any, propertyKey: PropertyKey): PropertyDescriptor; - function getPrototypeOf(target: any): any; - function has(target: any, propertyKey: string): boolean; - function has(target: any, propertyKey: symbol): boolean; - function isExtensible(target: any): boolean; - function ownKeys(target: any): Array; - function preventExtensions(target: any): boolean; - function set(target: any, propertyKey: PropertyKey, value: any, receiver?: any): boolean; - function setPrototypeOf(target: any, proto: any): boolean; -} - -/** - * Represents the completion of an asynchronous operation - */ -interface Promise { - /** - * Attaches callbacks for the resolution and/or rejection of the Promise. - * @param onfulfilled The callback to execute when the Promise is resolved. - * @param onrejected The callback to execute when the Promise is rejected. - * @returns A Promise for the completion of which ever callback is executed. - */ - then(onfulfilled?: (value: T) => TResult | PromiseLike, onrejected?: (reason: any) => TResult | PromiseLike): Promise; - then(onfulfilled?: (value: T) => TResult | PromiseLike, onrejected?: (reason: any) => void): Promise; - - /** - * Attaches a callback for only the rejection of the Promise. - * @param onrejected The callback to execute when the Promise is rejected. - * @returns A Promise for the completion of the callback. - */ - catch(onrejected?: (reason: any) => T | PromiseLike): Promise; - catch(onrejected?: (reason: any) => void): Promise; - - readonly [Symbol.toStringTag]: "Promise"; -} - -interface PromiseConstructor { - /** - * A reference to the prototype. - */ - readonly prototype: Promise; - - /** - * Creates a new Promise. - * @param executor A callback used to initialize the promise. This callback is passed two arguments: - * a resolve callback used resolve the promise with a value or the result of another promise, - * and a reject callback used to reject the promise with a provided reason or error. - */ - new (executor: (resolve: (value?: T | PromiseLike) => void, reject: (reason?: any) => void) => void): Promise; - - /** - * Creates a Promise that is resolved with an array of results when all of the provided Promises - * resolve, or rejected when any Promise is rejected. - * @param values An array of Promises. - * @returns A new Promise. - */ - 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]>; - 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]>; - 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]>; - all(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike , T5 | PromiseLike, T6 | PromiseLike, T7 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6, T7]>; - all(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike , T5 | PromiseLike, T6 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6]>; - all(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike , T5 | PromiseLike]): Promise<[T1, T2, T3, T4, T5]>; - all(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike ]): Promise<[T1, T2, T3, T4]>; - all(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike]): Promise<[T1, T2, T3]>; - all(values: [T1 | PromiseLike, T2 | PromiseLike]): Promise<[T1, T2]>; - all(values: Iterable>): Promise; - - /** - * Creates a Promise that is resolved or rejected when any of the provided Promises are resolved - * or rejected. - * @param values An array of Promises. - * @returns A new Promise. - */ - race(values: Iterable>): Promise; - - /** - * Creates a new rejected promise for the provided reason. - * @param reason The reason the promise was rejected. - * @returns A new rejected Promise. - */ - reject(reason: any): Promise; - - /** - * Creates a new rejected promise for the provided reason. - * @param reason The reason the promise was rejected. - * @returns A new rejected Promise. - */ - reject(reason: any): Promise; - - /** - * Creates a new resolved promise for the provided value. - * @param value A promise. - * @returns A promise whose internal state matches the provided promise. - */ - resolve(value: T | PromiseLike): Promise; - - /** - * Creates a new resolved promise . - * @returns A resolved promise. - */ - resolve(): Promise; - - readonly [Symbol.species]: Function; -} - -declare var Promise: PromiseConstructor; diff --git a/src/lib/importcore.d.ts b/src/lib/importcore.d.ts deleted file mode 100644 index 94e599fb842..00000000000 --- a/src/lib/importcore.d.ts +++ /dev/null @@ -1 +0,0 @@ -/// diff --git a/src/lib/importes5.d.ts b/src/lib/importes5.d.ts new file mode 100644 index 00000000000..872bf0a1bed --- /dev/null +++ b/src/lib/importes5.d.ts @@ -0,0 +1 @@ +/// diff --git a/src/lib/intl.d.ts b/src/lib/intl.d.ts deleted file mode 100644 index 53894587259..00000000000 --- a/src/lib/intl.d.ts +++ /dev/null @@ -1,201 +0,0 @@ -///////////////////////////// -/// ECMAScript Internationalization API -///////////////////////////// - -declare module Intl { - interface CollatorOptions { - usage?: string; - localeMatcher?: string; - numeric?: boolean; - caseFirst?: string; - sensitivity?: string; - ignorePunctuation?: boolean; - } - - interface ResolvedCollatorOptions { - locale: string; - usage: string; - sensitivity: string; - ignorePunctuation: boolean; - collation: string; - caseFirst: string; - numeric: boolean; - } - - interface Collator { - compare(x: string, y: string): number; - resolvedOptions(): ResolvedCollatorOptions; - } - var Collator: { - new (locales?: string[], options?: CollatorOptions): Collator; - new (locale?: string, options?: CollatorOptions): Collator; - (locales?: string[], options?: CollatorOptions): Collator; - (locale?: string, options?: CollatorOptions): Collator; - supportedLocalesOf(locales: string[], options?: CollatorOptions): string[]; - supportedLocalesOf(locale: string, options?: CollatorOptions): string[]; - } - - interface NumberFormatOptions { - localeMatcher?: string; - style?: string; - currency?: string; - currencyDisplay?: string; - useGrouping?: boolean; - minimumIntegerDigits?: number; - minimumFractionDigits?: number; - maximumFractionDigits?: number; - minimumSignificantDigits?: number; - maximumSignificantDigits?: number; - } - - interface ResolvedNumberFormatOptions { - locale: string; - numberingSystem: string; - style: string; - currency?: string; - currencyDisplay?: string; - minimumIntegerDigits: number; - minimumFractionDigits: number; - maximumFractionDigits: number; - minimumSignificantDigits?: number; - maximumSignificantDigits?: number; - useGrouping: boolean; - } - - interface NumberFormat { - format(value: number): string; - resolvedOptions(): ResolvedNumberFormatOptions; - } - var NumberFormat: { - new (locales?: string[], options?: NumberFormatOptions): NumberFormat; - new (locale?: string, options?: NumberFormatOptions): NumberFormat; - (locales?: string[], options?: NumberFormatOptions): NumberFormat; - (locale?: string, options?: NumberFormatOptions): NumberFormat; - supportedLocalesOf(locales: string[], options?: NumberFormatOptions): string[]; - supportedLocalesOf(locale: string, options?: NumberFormatOptions): string[]; - } - - interface DateTimeFormatOptions { - localeMatcher?: string; - weekday?: string; - era?: string; - year?: string; - month?: string; - day?: string; - hour?: string; - minute?: string; - second?: string; - timeZoneName?: string; - formatMatcher?: string; - hour12?: boolean; - timeZone?: string; - } - - interface ResolvedDateTimeFormatOptions { - locale: string; - calendar: string; - numberingSystem: string; - timeZone: string; - hour12?: boolean; - weekday?: string; - era?: string; - year?: string; - month?: string; - day?: string; - hour?: string; - minute?: string; - second?: string; - timeZoneName?: string; - } - - interface DateTimeFormat { - format(date?: Date | number): string; - resolvedOptions(): ResolvedDateTimeFormatOptions; - } - var DateTimeFormat: { - new (locales?: string[], options?: DateTimeFormatOptions): DateTimeFormat; - new (locale?: string, options?: DateTimeFormatOptions): DateTimeFormat; - (locales?: string[], options?: DateTimeFormatOptions): DateTimeFormat; - (locale?: string, options?: DateTimeFormatOptions): DateTimeFormat; - supportedLocalesOf(locales: string[], options?: DateTimeFormatOptions): string[]; - supportedLocalesOf(locale: string, options?: DateTimeFormatOptions): string[]; - } -} - -interface String { - /** - * Determines whether two strings are equivalent in the current locale. - * @param that String to compare to target string - * @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. - * @param options An object that contains one or more properties that specify comparison options. see the Intl.Collator object for details. - */ - localeCompare(that: string, locales: string[], options?: Intl.CollatorOptions): number; - - /** - * Determines whether two strings are equivalent in the current locale. - * @param that String to compare to target string - * @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. - * @param options An object that contains one or more properties that specify comparison options. see the Intl.Collator object for details. - */ - localeCompare(that: string, locale: string, options?: Intl.CollatorOptions): number; -} - -interface Number { - /** - * Converts a number to a string by using the current or specified locale. - * @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. - * @param options An object that contains one or more properties that specify comparison options. - */ - toLocaleString(locales?: string[], options?: Intl.NumberFormatOptions): string; - - /** - * Converts a number to a string by using the current or specified locale. - * @param locale Locale tag. If you omit this parameter, the default locale of the JavaScript runtime is used. - * @param options An object that contains one or more properties that specify comparison options. - */ - toLocaleString(locale?: string, options?: Intl.NumberFormatOptions): string; -} - -interface Date { - /** - * Converts a date and time to a string by using the current or specified locale. - * @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. - * @param options An object that contains one or more properties that specify comparison options. - */ - toLocaleString(locales?: string[], options?: Intl.DateTimeFormatOptions): string; - /** - * Converts a date to a string by using the current or specified locale. - * @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. - * @param options An object that contains one or more properties that specify comparison options. - */ - toLocaleDateString(locales?: string[], options?: Intl.DateTimeFormatOptions): string; - - /** - * Converts a time to a string by using the current or specified locale. - * @param locale Locale tag. If you omit this parameter, the default locale of the JavaScript runtime is used. - * @param options An object that contains one or more properties that specify comparison options. - */ - toLocaleTimeString(locale?: string[], options?: Intl.DateTimeFormatOptions): string; - - /** - * Converts a date and time to a string by using the current or specified locale. - * @param locale Locale tag. If you omit this parameter, the default locale of the JavaScript runtime is used. - * @param options An object that contains one or more properties that specify comparison options. - */ - toLocaleString(locale?: string, options?: Intl.DateTimeFormatOptions): string; - - /** - * Converts a date to a string by using the current or specified locale. - * @param locale Locale tag. If you omit this parameter, the default locale of the JavaScript runtime is used. - * @param options An object that contains one or more properties that specify comparison options. - */ - toLocaleDateString(locale?: string, options?: Intl.DateTimeFormatOptions): string; - - /** - * Converts a time to a string by using the current or specified locale. - * @param locale Locale tag. If you omit this parameter, the default locale of the JavaScript runtime is used. - * @param options An object that contains one or more properties that specify comparison options. - */ - toLocaleTimeString(locale?: string, options?: Intl.DateTimeFormatOptions): string; -} - diff --git a/src/lib/scriptHost.d.ts b/src/lib/scripthost.d.ts similarity index 100% rename from src/lib/scriptHost.d.ts rename to src/lib/scripthost.d.ts diff --git a/src/lib/webworker.generated.d.ts b/src/lib/webworker.generated.d.ts index cd49a565f12..2b302dea6a2 100644 --- a/src/lib/webworker.generated.d.ts +++ b/src/lib/webworker.generated.d.ts @@ -13,10 +13,12 @@ interface EventListener { } interface AudioBuffer { - duration: number; - length: number; - numberOfChannels: number; - sampleRate: number; + readonly duration: number; + readonly length: number; + readonly numberOfChannels: number; + readonly sampleRate: number; + copyFromChannel(destination: Float32Array, channelNumber: number, startInChannel?: number): void; + copyToChannel(source: Float32Array, channelNumber: number, startInChannel?: number): void; getChannelData(channel: number): Float32Array; } @@ -26,8 +28,8 @@ declare var AudioBuffer: { } interface Blob { - size: number; - type: string; + readonly size: number; + readonly type: string; msClose(): void; msDetachStream(): any; slice(start?: number, end?: number, contentType?: string): Blob; @@ -39,9 +41,9 @@ declare var Blob: { } interface CloseEvent extends Event { - code: number; - reason: string; - wasClean: boolean; + readonly code: number; + readonly reason: string; + readonly wasClean: boolean; initCloseEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, wasCleanArg: boolean, codeArg: number, reasonArg: string): void; } @@ -58,6 +60,7 @@ interface Console { dir(value?: any, ...optionalParams: any[]): void; dirxml(value: any): void; error(message?: any, ...optionalParams: any[]): void; + exception(message?: string, ...optionalParams: any[]): void; group(groupTitle?: string): void; groupCollapsed(groupTitle?: string): void; groupEnd(): void; @@ -67,6 +70,7 @@ interface Console { profile(reportName?: string): void; profileEnd(): void; select(element: any): void; + table(...data: any[]): void; time(timerName?: string): void; timeEnd(timerName?: string): void; trace(message?: any, ...optionalParams: any[]): void; @@ -79,13 +83,13 @@ declare var Console: { } interface Coordinates { - accuracy: number; - altitude: number; - altitudeAccuracy: number; - heading: number; - latitude: number; - longitude: number; - speed: number; + readonly accuracy: number; + readonly altitude: number; + readonly altitudeAccuracy: number; + readonly heading: number; + readonly latitude: number; + readonly longitude: number; + readonly speed: number; } declare var Coordinates: { @@ -94,7 +98,7 @@ declare var Coordinates: { } interface DOMError { - name: string; + readonly name: string; toString(): string; } @@ -104,73 +108,73 @@ declare var DOMError: { } interface DOMException { - code: number; - message: string; - name: string; + readonly code: number; + readonly message: string; + readonly name: string; toString(): string; - ABORT_ERR: number; - DATA_CLONE_ERR: number; - DOMSTRING_SIZE_ERR: number; - HIERARCHY_REQUEST_ERR: number; - INDEX_SIZE_ERR: number; - INUSE_ATTRIBUTE_ERR: number; - INVALID_ACCESS_ERR: number; - INVALID_CHARACTER_ERR: number; - INVALID_MODIFICATION_ERR: number; - INVALID_NODE_TYPE_ERR: number; - INVALID_STATE_ERR: number; - NAMESPACE_ERR: number; - NETWORK_ERR: number; - NOT_FOUND_ERR: number; - NOT_SUPPORTED_ERR: number; - NO_DATA_ALLOWED_ERR: number; - NO_MODIFICATION_ALLOWED_ERR: number; - PARSE_ERR: number; - QUOTA_EXCEEDED_ERR: number; - SECURITY_ERR: number; - SERIALIZE_ERR: number; - SYNTAX_ERR: number; - TIMEOUT_ERR: number; - TYPE_MISMATCH_ERR: number; - URL_MISMATCH_ERR: number; - VALIDATION_ERR: number; - WRONG_DOCUMENT_ERR: number; + readonly ABORT_ERR: number; + readonly DATA_CLONE_ERR: number; + readonly DOMSTRING_SIZE_ERR: number; + readonly HIERARCHY_REQUEST_ERR: number; + readonly INDEX_SIZE_ERR: number; + readonly INUSE_ATTRIBUTE_ERR: number; + readonly INVALID_ACCESS_ERR: number; + readonly INVALID_CHARACTER_ERR: number; + readonly INVALID_MODIFICATION_ERR: number; + readonly INVALID_NODE_TYPE_ERR: number; + readonly INVALID_STATE_ERR: number; + readonly NAMESPACE_ERR: number; + readonly NETWORK_ERR: number; + readonly NOT_FOUND_ERR: number; + readonly NOT_SUPPORTED_ERR: number; + readonly NO_DATA_ALLOWED_ERR: number; + readonly NO_MODIFICATION_ALLOWED_ERR: number; + readonly PARSE_ERR: number; + readonly QUOTA_EXCEEDED_ERR: number; + readonly SECURITY_ERR: number; + readonly SERIALIZE_ERR: number; + readonly SYNTAX_ERR: number; + readonly TIMEOUT_ERR: number; + readonly TYPE_MISMATCH_ERR: number; + readonly URL_MISMATCH_ERR: number; + readonly VALIDATION_ERR: number; + readonly WRONG_DOCUMENT_ERR: number; } declare var DOMException: { prototype: DOMException; new(): DOMException; - ABORT_ERR: number; - DATA_CLONE_ERR: number; - DOMSTRING_SIZE_ERR: number; - HIERARCHY_REQUEST_ERR: number; - INDEX_SIZE_ERR: number; - INUSE_ATTRIBUTE_ERR: number; - INVALID_ACCESS_ERR: number; - INVALID_CHARACTER_ERR: number; - INVALID_MODIFICATION_ERR: number; - INVALID_NODE_TYPE_ERR: number; - INVALID_STATE_ERR: number; - NAMESPACE_ERR: number; - NETWORK_ERR: number; - NOT_FOUND_ERR: number; - NOT_SUPPORTED_ERR: number; - NO_DATA_ALLOWED_ERR: number; - NO_MODIFICATION_ALLOWED_ERR: number; - PARSE_ERR: number; - QUOTA_EXCEEDED_ERR: number; - SECURITY_ERR: number; - SERIALIZE_ERR: number; - SYNTAX_ERR: number; - TIMEOUT_ERR: number; - TYPE_MISMATCH_ERR: number; - URL_MISMATCH_ERR: number; - VALIDATION_ERR: number; - WRONG_DOCUMENT_ERR: number; + readonly ABORT_ERR: number; + readonly DATA_CLONE_ERR: number; + readonly DOMSTRING_SIZE_ERR: number; + readonly HIERARCHY_REQUEST_ERR: number; + readonly INDEX_SIZE_ERR: number; + readonly INUSE_ATTRIBUTE_ERR: number; + readonly INVALID_ACCESS_ERR: number; + readonly INVALID_CHARACTER_ERR: number; + readonly INVALID_MODIFICATION_ERR: number; + readonly INVALID_NODE_TYPE_ERR: number; + readonly INVALID_STATE_ERR: number; + readonly NAMESPACE_ERR: number; + readonly NETWORK_ERR: number; + readonly NOT_FOUND_ERR: number; + readonly NOT_SUPPORTED_ERR: number; + readonly NO_DATA_ALLOWED_ERR: number; + readonly NO_MODIFICATION_ALLOWED_ERR: number; + readonly PARSE_ERR: number; + readonly QUOTA_EXCEEDED_ERR: number; + readonly SECURITY_ERR: number; + readonly SERIALIZE_ERR: number; + readonly SYNTAX_ERR: number; + readonly TIMEOUT_ERR: number; + readonly TYPE_MISMATCH_ERR: number; + readonly URL_MISMATCH_ERR: number; + readonly VALIDATION_ERR: number; + readonly WRONG_DOCUMENT_ERR: number; } interface DOMStringList { - length: number; + readonly length: number; contains(str: string): boolean; item(index: number): string; [index: number]: string; @@ -182,11 +186,11 @@ declare var DOMStringList: { } interface ErrorEvent extends Event { - colno: number; - error: any; - filename: string; - lineno: number; - message: string; + readonly colno: number; + readonly error: any; + readonly filename: string; + readonly lineno: number; + readonly message: string; initErrorEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, messageArg: string, filenameArg: string, linenoArg: number): void; } @@ -196,39 +200,39 @@ declare var ErrorEvent: { } interface Event { - bubbles: boolean; + readonly bubbles: boolean; cancelBubble: boolean; - cancelable: boolean; - currentTarget: EventTarget; - defaultPrevented: boolean; - eventPhase: number; - isTrusted: boolean; + readonly cancelable: boolean; + readonly currentTarget: EventTarget; + readonly defaultPrevented: boolean; + readonly eventPhase: number; + readonly isTrusted: boolean; returnValue: boolean; - srcElement: any; - target: EventTarget; - timeStamp: number; - type: string; + readonly srcElement: any; + readonly target: EventTarget; + readonly timeStamp: number; + readonly type: string; initEvent(eventTypeArg: string, canBubbleArg: boolean, cancelableArg: boolean): void; preventDefault(): void; stopImmediatePropagation(): void; stopPropagation(): void; - AT_TARGET: number; - BUBBLING_PHASE: number; - CAPTURING_PHASE: number; + readonly AT_TARGET: number; + readonly BUBBLING_PHASE: number; + readonly CAPTURING_PHASE: number; } declare var Event: { prototype: Event; new(type: string, eventInitDict?: EventInit): Event; - AT_TARGET: number; - BUBBLING_PHASE: number; - CAPTURING_PHASE: number; + readonly AT_TARGET: number; + readonly BUBBLING_PHASE: number; + readonly CAPTURING_PHASE: number; } interface EventTarget { - addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; + addEventListener(type: string, listener?: EventListenerOrEventListenerObject, useCapture?: boolean): void; dispatchEvent(evt: Event): boolean; - removeEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; + removeEventListener(type: string, listener?: EventListenerOrEventListenerObject, useCapture?: boolean): void; } declare var EventTarget: { @@ -237,8 +241,9 @@ declare var EventTarget: { } interface File extends Blob { - lastModifiedDate: any; - name: string; + readonly lastModifiedDate: any; + readonly name: string; + readonly webkitRelativePath: string; } declare var File: { @@ -247,7 +252,7 @@ declare var File: { } interface FileList { - length: number; + readonly length: number; item(index: number): File; [index: number]: File; } @@ -258,7 +263,7 @@ declare var FileList: { } interface FileReader extends EventTarget, MSBaseReader { - error: DOMError; + readonly error: DOMError; readAsArrayBuffer(blob: Blob): void; readAsBinaryString(blob: Blob): void; readAsDataURL(blob: Blob): void; @@ -272,31 +277,31 @@ declare var FileReader: { } interface IDBCursor { - direction: string; - key: any; - primaryKey: any; + readonly direction: string; + key: IDBKeyRange | IDBValidKey; + readonly primaryKey: any; source: IDBObjectStore | IDBIndex; advance(count: number): void; - continue(key?: any): void; + continue(key?: IDBKeyRange | IDBValidKey): void; delete(): IDBRequest; update(value: any): IDBRequest; - NEXT: string; - NEXT_NO_DUPLICATE: string; - PREV: string; - PREV_NO_DUPLICATE: string; + readonly NEXT: string; + readonly NEXT_NO_DUPLICATE: string; + readonly PREV: string; + readonly PREV_NO_DUPLICATE: string; } declare var IDBCursor: { prototype: IDBCursor; new(): IDBCursor; - NEXT: string; - NEXT_NO_DUPLICATE: string; - PREV: string; - PREV_NO_DUPLICATE: string; + readonly NEXT: string; + readonly NEXT_NO_DUPLICATE: string; + readonly PREV: string; + readonly PREV_NO_DUPLICATE: string; } interface IDBCursorWithValue extends IDBCursor { - value: any; + readonly value: any; } declare var IDBCursorWithValue: { @@ -305,15 +310,17 @@ declare var IDBCursorWithValue: { } interface IDBDatabase extends EventTarget { - name: string; - objectStoreNames: DOMStringList; + readonly name: string; + readonly objectStoreNames: DOMStringList; onabort: (ev: Event) => any; onerror: (ev: Event) => any; version: number; + onversionchange: (ev: IDBVersionChangeEvent) => any; close(): void; createObjectStore(name: string, optionalParameters?: IDBObjectStoreParameters): IDBObjectStore; deleteObjectStore(name: string): void; transaction(storeNames: string | string[], mode?: string): IDBTransaction; + addEventListener(type: "versionchange", listener: (ev: IDBVersionChangeEvent) => any, useCapture?: boolean): void; addEventListener(type: "abort", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; @@ -337,15 +344,15 @@ declare var IDBFactory: { interface IDBIndex { keyPath: string | string[]; - name: string; - objectStore: IDBObjectStore; - unique: boolean; + readonly name: string; + readonly objectStore: IDBObjectStore; + readonly unique: boolean; multiEntry: boolean; - count(key?: any): IDBRequest; - get(key: any): IDBRequest; - getKey(key: any): IDBRequest; - openCursor(range?: IDBKeyRange, direction?: string): IDBRequest; - openKeyCursor(range?: IDBKeyRange, direction?: string): IDBRequest; + count(key?: IDBKeyRange | IDBValidKey): IDBRequest; + get(key: IDBKeyRange | IDBValidKey): IDBRequest; + getKey(key: IDBKeyRange | IDBValidKey): IDBRequest; + openCursor(range?: IDBKeyRange | IDBValidKey, direction?: string): IDBRequest; + openKeyCursor(range?: IDBKeyRange | IDBValidKey, direction?: string): IDBRequest; } declare var IDBIndex: { @@ -354,37 +361,37 @@ declare var IDBIndex: { } interface IDBKeyRange { - lower: any; - lowerOpen: boolean; - upper: any; - upperOpen: boolean; + readonly lower: any; + readonly lowerOpen: boolean; + readonly upper: any; + readonly upperOpen: boolean; } declare var IDBKeyRange: { prototype: IDBKeyRange; new(): IDBKeyRange; bound(lower: any, upper: any, lowerOpen?: boolean, upperOpen?: boolean): IDBKeyRange; - lowerBound(bound: any, open?: boolean): IDBKeyRange; + lowerBound(lower: any, open?: boolean): IDBKeyRange; only(value: any): IDBKeyRange; - upperBound(bound: any, open?: boolean): IDBKeyRange; + upperBound(upper: any, open?: boolean): IDBKeyRange; } interface IDBObjectStore { - indexNames: DOMStringList; + readonly indexNames: DOMStringList; keyPath: string | string[]; - name: string; - transaction: IDBTransaction; + readonly name: string; + readonly transaction: IDBTransaction; autoIncrement: boolean; - add(value: any, key?: any): IDBRequest; + add(value: any, key?: IDBKeyRange | IDBValidKey): IDBRequest; clear(): IDBRequest; - count(key?: any): IDBRequest; + count(key?: IDBKeyRange | IDBValidKey): IDBRequest; createIndex(name: string, keyPath: string | string[], optionalParameters?: IDBIndexParameters): IDBIndex; - delete(key: any): IDBRequest; + delete(key: IDBKeyRange | IDBValidKey): IDBRequest; deleteIndex(indexName: string): void; get(key: any): IDBRequest; index(name: string): IDBIndex; - openCursor(range?: any, direction?: string): IDBRequest; - put(value: any, key?: any): IDBRequest; + openCursor(range?: IDBKeyRange | IDBValidKey, direction?: string): IDBRequest; + put(value: any, key?: IDBKeyRange | IDBValidKey): IDBRequest; } declare var IDBObjectStore: { @@ -408,13 +415,13 @@ declare var IDBOpenDBRequest: { } interface IDBRequest extends EventTarget { - error: DOMError; + readonly error: DOMError; onerror: (ev: Event) => any; onsuccess: (ev: Event) => any; - readyState: string; - result: any; + readonly readyState: string; + readonly result: any; source: IDBObjectStore | IDBIndex | IDBCursor; - transaction: IDBTransaction; + readonly transaction: IDBTransaction; addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: "success", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; @@ -426,17 +433,17 @@ declare var IDBRequest: { } interface IDBTransaction extends EventTarget { - db: IDBDatabase; - error: DOMError; - mode: string; + readonly db: IDBDatabase; + readonly error: DOMError; + readonly mode: string; onabort: (ev: Event) => any; oncomplete: (ev: Event) => any; onerror: (ev: Event) => any; abort(): void; objectStore(name: string): IDBObjectStore; - READ_ONLY: string; - READ_WRITE: string; - VERSION_CHANGE: string; + readonly READ_ONLY: string; + readonly READ_WRITE: string; + readonly VERSION_CHANGE: string; addEventListener(type: "abort", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "complete", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; @@ -446,14 +453,14 @@ interface IDBTransaction extends EventTarget { declare var IDBTransaction: { prototype: IDBTransaction; new(): IDBTransaction; - READ_ONLY: string; - READ_WRITE: string; - VERSION_CHANGE: string; + readonly READ_ONLY: string; + readonly READ_WRITE: string; + readonly VERSION_CHANGE: string; } interface IDBVersionChangeEvent extends Event { - newVersion: number; - oldVersion: number; + readonly newVersion: number; + readonly oldVersion: number; } declare var IDBVersionChangeEvent: { @@ -463,8 +470,8 @@ declare var IDBVersionChangeEvent: { interface ImageData { data: Uint8ClampedArray; - height: number; - width: number; + readonly height: number; + readonly width: number; } declare var ImageData: { @@ -483,29 +490,29 @@ interface MSApp { execAsyncAtPriority(asynchronousCallback: MSExecAtPriorityFunctionCallback, priority: string, ...args: any[]): void; execAtPriority(synchronousCallback: MSExecAtPriorityFunctionCallback, priority: string, ...args: any[]): any; getCurrentPriority(): string; - getHtmlPrintDocumentSourceAsync(htmlDoc: any): any; + getHtmlPrintDocumentSourceAsync(htmlDoc: any): PromiseLike; getViewId(view: any): any; isTaskScheduledAtPriorityOrHigher(priority: string): boolean; pageHandlesAllApplicationActivations(enabled: boolean): void; suppressSubdownloadCredentialPrompts(suppress: boolean): void; terminateApp(exceptionObject: any): void; - CURRENT: string; - HIGH: string; - IDLE: string; - NORMAL: string; + readonly CURRENT: string; + readonly HIGH: string; + readonly IDLE: string; + readonly NORMAL: string; } declare var MSApp: MSApp; interface MSAppAsyncOperation extends EventTarget { - error: DOMError; + readonly error: DOMError; oncomplete: (ev: Event) => any; onerror: (ev: Event) => any; - readyState: number; - result: any; + readonly readyState: number; + readonly result: any; start(): void; - COMPLETED: number; - ERROR: number; - STARTED: number; + readonly COMPLETED: number; + readonly ERROR: number; + readonly STARTED: number; addEventListener(type: "complete", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; @@ -514,9 +521,9 @@ interface MSAppAsyncOperation extends EventTarget { declare var MSAppAsyncOperation: { prototype: MSAppAsyncOperation; new(): MSAppAsyncOperation; - COMPLETED: number; - ERROR: number; - STARTED: number; + readonly COMPLETED: number; + readonly ERROR: number; + readonly STARTED: number; } interface MSBlobBuilder { @@ -530,7 +537,7 @@ declare var MSBlobBuilder: { } interface MSStream { - type: string; + readonly type: string; msClose(): void; msDetachStream(): any; } @@ -541,7 +548,7 @@ declare var MSStream: { } interface MSStreamReader extends EventTarget, MSBaseReader { - error: DOMError; + readonly error: DOMError; readAsArrayBuffer(stream: MSStream, size?: number): void; readAsBinaryString(stream: MSStream, size?: number): void; readAsBlob(stream: MSStream, size?: number): void; @@ -556,8 +563,8 @@ declare var MSStreamReader: { } interface MediaQueryList { - matches: boolean; - media: string; + readonly matches: boolean; + readonly media: string; addListener(listener: MediaQueryListListener): void; removeListener(listener: MediaQueryListListener): void; } @@ -568,8 +575,8 @@ declare var MediaQueryList: { } interface MessageChannel { - port1: MessagePort; - port2: MessagePort; + readonly port1: MessagePort; + readonly port2: MessagePort; } declare var MessageChannel: { @@ -578,10 +585,10 @@ declare var MessageChannel: { } interface MessageEvent extends Event { - data: any; - origin: string; - ports: any; - source: any; + readonly data: any; + readonly origin: string; + readonly ports: any; + readonly source: any; initMessageEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, dataArg: any, originArg: string, lastEventIdArg: string, sourceArg: any): void; } @@ -605,8 +612,8 @@ declare var MessagePort: { } interface Position { - coords: Coordinates; - timestamp: number; + readonly coords: Coordinates; + readonly timestamp: number; } declare var Position: { @@ -615,26 +622,26 @@ declare var Position: { } interface PositionError { - code: number; - message: string; + readonly code: number; + readonly message: string; toString(): string; - PERMISSION_DENIED: number; - POSITION_UNAVAILABLE: number; - TIMEOUT: number; + readonly PERMISSION_DENIED: number; + readonly POSITION_UNAVAILABLE: number; + readonly TIMEOUT: number; } declare var PositionError: { prototype: PositionError; new(): PositionError; - PERMISSION_DENIED: number; - POSITION_UNAVAILABLE: number; - TIMEOUT: number; + readonly PERMISSION_DENIED: number; + readonly POSITION_UNAVAILABLE: number; + readonly TIMEOUT: number; } interface ProgressEvent extends Event { - lengthComputable: boolean; - loaded: number; - total: number; + readonly lengthComputable: boolean; + readonly loaded: number; + readonly total: number; initProgressEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, lengthComputableArg: boolean, loadedArg: number, totalArg: number): void; } @@ -645,21 +652,21 @@ declare var ProgressEvent: { interface WebSocket extends EventTarget { binaryType: string; - bufferedAmount: number; - extensions: string; + readonly bufferedAmount: number; + readonly extensions: string; onclose: (ev: CloseEvent) => any; onerror: (ev: Event) => any; onmessage: (ev: MessageEvent) => any; onopen: (ev: Event) => any; - protocol: string; - readyState: number; - url: string; + readonly protocol: string; + readonly readyState: number; + readonly url: string; close(code?: number, reason?: string): void; send(data: any): void; - CLOSED: number; - CLOSING: number; - CONNECTING: number; - OPEN: number; + readonly CLOSED: number; + readonly CLOSING: number; + readonly CONNECTING: number; + readonly OPEN: number; addEventListener(type: "close", listener: (ev: CloseEvent) => any, useCapture?: boolean): void; addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: "message", listener: (ev: MessageEvent) => any, useCapture?: boolean): void; @@ -670,10 +677,10 @@ interface WebSocket extends EventTarget { declare var WebSocket: { prototype: WebSocket; new(url: string, protocols?: string | string[]): WebSocket; - CLOSED: number; - CLOSING: number; - CONNECTING: number; - OPEN: number; + readonly CLOSED: number; + readonly CLOSING: number; + readonly CONNECTING: number; + readonly OPEN: number; } interface Worker extends EventTarget, AbstractWorker { @@ -693,16 +700,15 @@ declare var Worker: { interface XMLHttpRequest extends EventTarget, XMLHttpRequestEventTarget { msCaching: string; onreadystatechange: (ev: ProgressEvent) => any; - readyState: number; - response: any; - responseBody: any; - responseText: string; + readonly readyState: number; + readonly response: any; + readonly responseText: string; responseType: string; - responseXML: any; - status: number; - statusText: string; + readonly responseXML: any; + readonly status: number; + readonly statusText: string; timeout: number; - upload: XMLHttpRequestUpload; + readonly upload: XMLHttpRequestUpload; withCredentials: boolean; abort(): void; getAllResponseHeaders(): string; @@ -713,11 +719,11 @@ interface XMLHttpRequest extends EventTarget, XMLHttpRequestEventTarget { send(data?: string): void; send(data?: any): void; setRequestHeader(header: string, value: string): void; - DONE: number; - HEADERS_RECEIVED: number; - LOADING: number; - OPENED: number; - UNSENT: number; + readonly DONE: number; + readonly HEADERS_RECEIVED: number; + readonly LOADING: number; + readonly OPENED: number; + readonly UNSENT: number; addEventListener(type: "abort", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: "load", listener: (ev: Event) => any, useCapture?: boolean): void; @@ -732,11 +738,11 @@ interface XMLHttpRequest extends EventTarget, XMLHttpRequestEventTarget { declare var XMLHttpRequest: { prototype: XMLHttpRequest; new(): XMLHttpRequest; - DONE: number; - HEADERS_RECEIVED: number; - LOADING: number; - OPENED: number; - UNSENT: number; + readonly DONE: number; + readonly HEADERS_RECEIVED: number; + readonly LOADING: number; + readonly OPENED: number; + readonly UNSENT: number; create(): XMLHttpRequest; } @@ -762,12 +768,12 @@ interface MSBaseReader { onloadend: (ev: ProgressEvent) => any; onloadstart: (ev: Event) => any; onprogress: (ev: ProgressEvent) => any; - readyState: number; - result: any; + readonly readyState: number; + readonly result: any; abort(): void; - DONE: number; - EMPTY: number; - LOADING: number; + readonly DONE: number; + readonly EMPTY: number; + readonly LOADING: number; addEventListener(type: "abort", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: "load", listener: (ev: Event) => any, useCapture?: boolean): void; @@ -778,18 +784,18 @@ interface MSBaseReader { } interface NavigatorID { - appName: string; - appVersion: string; - platform: string; - product: string; - productSub: string; - userAgent: string; - vendor: string; - vendorSub: string; + readonly appName: string; + readonly appVersion: string; + readonly platform: string; + readonly product: string; + readonly productSub: string; + readonly userAgent: string; + readonly vendor: string; + readonly vendorSub: string; } interface NavigatorOnLine { - onLine: boolean; + readonly onLine: boolean; } interface WindowBase64 { @@ -798,7 +804,7 @@ interface WindowBase64 { } interface WindowConsole { - console: Console; + readonly console: Console; } interface XMLHttpRequestEventTarget { @@ -832,9 +838,9 @@ declare var FileReaderSync: { } interface WorkerGlobalScope extends EventTarget, WorkerUtils, DedicatedWorkerGlobalScope, WindowConsole { - location: WorkerLocation; + readonly location: WorkerLocation; onerror: (ev: Event) => any; - self: WorkerGlobalScope; + readonly self: WorkerGlobalScope; close(): void; msWriteProfilerMark(profilerMarkName: string): void; toString(): string; @@ -849,14 +855,14 @@ declare var WorkerGlobalScope: { } interface WorkerLocation { - hash: string; - host: string; - hostname: string; - href: string; - pathname: string; - port: string; - protocol: string; - search: string; + readonly hash: string; + readonly host: string; + readonly hostname: string; + readonly href: string; + readonly pathname: string; + readonly port: string; + readonly protocol: string; + readonly search: string; toString(): string; } @@ -882,9 +888,9 @@ interface DedicatedWorkerGlobalScope { } interface WorkerUtils extends Object, WindowBase64 { - indexedDB: IDBFactory; - msIndexedDB: IDBFactory; - navigator: WorkerNavigator; + readonly indexedDB: IDBFactory; + readonly msIndexedDB: IDBFactory; + readonly navigator: WorkerNavigator; clearImmediate(handle: number): void; clearInterval(handle: number): void; clearTimeout(handle: number): void; @@ -894,16 +900,6 @@ interface WorkerUtils extends Object, WindowBase64 { setTimeout(handler: any, timeout?: any, ...args: any[]): number; } -interface IDBObjectStoreParameters { - keyPath?: string | string[]; - autoIncrement?: boolean; -} - -interface IDBIndexParameters { - unique?: boolean; - multiEntry?: boolean; -} - interface BlobPropertyBag { type?: string; endings?: string; @@ -933,6 +929,9 @@ interface ProgressEventInit extends EventInit { total?: number; } +interface IDBArrayKey extends Array { +} + declare type EventListenerOrEventListenerObject = EventListener | EventListenerObject; interface ErrorEventHandler { @@ -971,9 +970,9 @@ declare var self: WorkerGlobalScope; declare function close(): void; declare function msWriteProfilerMark(profilerMarkName: string): void; declare function toString(): string; -declare function addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +declare function addEventListener(type: string, listener?: EventListenerOrEventListenerObject, useCapture?: boolean): void; declare function dispatchEvent(evt: Event): boolean; -declare function removeEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +declare function removeEventListener(type: string, listener?: EventListenerOrEventListenerObject, useCapture?: boolean): void; declare var indexedDB: IDBFactory; declare var msIndexedDB: IDBFactory; declare var navigator: WorkerNavigator; @@ -991,4 +990,5 @@ declare function postMessage(data: any): void; declare var console: Console; declare function addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; declare function addEventListener(type: "message", listener: (ev: MessageEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; \ No newline at end of file +declare function addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +type IDBValidKey = number | string | Date | IDBArrayKey; \ No newline at end of file diff --git a/src/server/editorServices.ts b/src/server/editorServices.ts index 4b9f17798c8..4c054664a18 100644 --- a/src/server/editorServices.ts +++ b/src/server/editorServices.ts @@ -81,8 +81,14 @@ namespace ts.server { } } - interface TimestampedResolvedModule extends ResolvedModuleWithFailedLookupLocations { - lastCheckTime: number; + interface Timestamped { + lastCheckTime?: number; + } + + interface TimestampedResolvedModule extends ResolvedModuleWithFailedLookupLocations, Timestamped { + } + + interface TimestampedResolvedTypeReferenceDirective extends ResolvedTypeReferenceDirectiveWithFailedLookupLocations, Timestamped { } export class LSHost implements ts.LanguageServiceHost { @@ -90,13 +96,16 @@ namespace ts.server { compilationSettings: ts.CompilerOptions; filenameToScript: ts.FileMap; roots: ScriptInfo[] = []; + private resolvedModuleNames: ts.FileMap>; + private resolvedTypeReferenceDirectives: ts.FileMap>; private moduleResolutionHost: ts.ModuleResolutionHost; private getCanonicalFileName: (fileName: string) => string; constructor(public host: ServerHost, public project: Project) { this.getCanonicalFileName = createGetCanonicalFileName(host.useCaseSensitiveFileNames); this.resolvedModuleNames = createFileMap>(); + this.resolvedTypeReferenceDirectives = createFileMap>(); this.filenameToScript = createFileMap(); this.moduleResolutionHost = { fileExists: fileName => this.fileExists(fileName), @@ -105,46 +114,51 @@ namespace ts.server { }; } - resolveModuleNames(moduleNames: string[], containingFile: string): ResolvedModule[] { + private resolveNamesWithLocalCache( + names: string[], + containingFile: string, + cache: ts.FileMap>, + loader: (name: string, containingFile: string, options: CompilerOptions, host: ModuleResolutionHost) => T, + getResult: (s: T) => R): R[] { + const path = toPath(containingFile, this.host.getCurrentDirectory(), this.getCanonicalFileName); - const currentResolutionsInFile = this.resolvedModuleNames.get(path); - - const newResolutions: Map = {}; - const resolvedModules: ResolvedModule[] = []; + const currentResolutionsInFile = cache.get(path); + const newResolutions: Map = {}; + const resolvedModules: R[] = []; const compilerOptions = this.getCompilationSettings(); - for (const moduleName of moduleNames) { + for (const name of names) { // check if this is a duplicate entry in the list - let resolution = lookUp(newResolutions, moduleName); + let resolution = lookUp(newResolutions, name); if (!resolution) { - const existingResolution = currentResolutionsInFile && ts.lookUp(currentResolutionsInFile, moduleName); + const existingResolution = currentResolutionsInFile && ts.lookUp(currentResolutionsInFile, name); if (moduleResolutionIsValid(existingResolution)) { - // ok, it is safe to use existing module resolution results + // ok, it is safe to use existing name resolution results resolution = existingResolution; } else { - resolution = resolveModuleName(moduleName, containingFile, compilerOptions, this.moduleResolutionHost); + resolution = loader(name, containingFile, compilerOptions, this.moduleResolutionHost); resolution.lastCheckTime = Date.now(); - newResolutions[moduleName] = resolution; + newResolutions[name] = resolution; } } ts.Debug.assert(resolution !== undefined); - resolvedModules.push(resolution.resolvedModule); + resolvedModules.push(getResult(resolution)); } // replace old results with a new one - this.resolvedModuleNames.set(path, newResolutions); + cache.set(path, newResolutions); return resolvedModules; - function moduleResolutionIsValid(resolution: TimestampedResolvedModule): boolean { + function moduleResolutionIsValid(resolution: T): boolean { if (!resolution) { return false; } - if (resolution.resolvedModule) { + if (getResult(resolution)) { // TODO: consider checking failedLookupLocations // TODO: use lastCheckTime to track expiration for module name resolution return true; @@ -156,6 +170,14 @@ namespace ts.server { } } + resolveTypeReferenceDirectives(typeDirectiveNames: string[], containingFile: string): ResolvedTypeReferenceDirective[] { + return this.resolveNamesWithLocalCache(typeDirectiveNames, containingFile, this.resolvedTypeReferenceDirectives, resolveTypeReferenceDirective, m => m.resolvedTypeReferenceDirective); + } + + resolveModuleNames(moduleNames: string[], containingFile: string): ResolvedModule[] { + return this.resolveNamesWithLocalCache(moduleNames, containingFile, this.resolvedModuleNames, resolveModuleName, m => m.resolvedModule); + } + getDefaultLibFileName() { const nodeModuleBinDir = ts.getDirectoryPath(ts.normalizePath(this.host.getExecutingFilePath())); return ts.combinePaths(nodeModuleBinDir, ts.getDefaultLibFileName(this.compilationSettings)); @@ -172,6 +194,7 @@ namespace ts.server { this.compilationSettings = opt; // conservatively assume that changing compiler options might affect module resolution strategy this.resolvedModuleNames.clear(); + this.resolvedTypeReferenceDirectives.clear(); } lineAffectsRefs(filename: string, line: number) { @@ -212,6 +235,7 @@ namespace ts.server { if (!info.isOpen) { this.filenameToScript.remove(info.path); this.resolvedModuleNames.remove(info.path); + this.resolvedTypeReferenceDirectives.remove(info.path); } } @@ -239,6 +263,7 @@ namespace ts.server { this.filenameToScript.remove(info.path); this.roots = copyListRemovingItem(info, this.roots); this.resolvedModuleNames.remove(info.path); + this.resolvedTypeReferenceDirectives.remove(info.path); } } diff --git a/src/server/server.ts b/src/server/server.ts index d9f078ac0eb..3ffd64fe07d 100644 --- a/src/server/server.ts +++ b/src/server/server.ts @@ -1,7 +1,7 @@ /// /// // used in fs.writeSync -/* tslint:disable:no-null */ +/* tslint:disable:no-null-keyword */ namespace ts.server { const readline: NodeJS.ReadLine = require("readline"); diff --git a/src/services/services.ts b/src/services/services.ts index d85d478fcbe..f2906aaa8b4 100644 --- a/src/services/services.ts +++ b/src/services/services.ts @@ -125,6 +125,7 @@ namespace ts { } export interface PreProcessedFileInfo { referencedFiles: FileReference[]; + typeReferenceDirectives: FileReference[]; importedFiles: FileReference[]; ambientExternalModules: string[]; isLibFile: boolean; @@ -762,6 +763,7 @@ namespace ts { declaration: SignatureDeclaration; typeParameters: TypeParameter[]; parameters: Symbol[]; + thisType: Type; resolvedReturnType: Type; minArgumentCount: number; hasRestParameter: boolean; @@ -813,6 +815,7 @@ namespace ts { public amdDependencies: { name: string; path: string }[]; public moduleName: string; public referencedFiles: FileReference[]; + public typeReferenceDirectives: FileReference[]; public syntacticDiagnostics: Diagnostic[]; public referenceDiagnostics: Diagnostic[]; @@ -834,6 +837,7 @@ namespace ts { public identifiers: Map; public nameTable: Map; public resolvedModules: Map; + public resolvedTypeReferenceDirectiveNames: Map; public imports: LiteralExpression[]; public moduleAugmentations: LiteralExpression[]; private namedDeclarations: Map; @@ -1060,6 +1064,7 @@ namespace ts { * host specific questions using 'getScriptSnapshot'. */ resolveModuleNames?(moduleNames: string[], containingFile: string): ResolvedModule[]; + resolveTypeReferenceDirectives?(typeDirectiveNames: string[], containingFile: string): ResolvedTypeReferenceDirective[]; directoryExists?(directoryName: string): boolean; } @@ -2167,6 +2172,7 @@ namespace ts { export function preProcessFile(sourceText: string, readImportFiles = true, detectJavaScriptImports = false): PreProcessedFileInfo { const referencedFiles: FileReference[] = []; + const typeReferenceDirectives: FileReference[] = []; const importedFiles: FileReference[] = []; let ambientExternalModules: { ref: FileReference, depth: number }[]; let isNoDefaultLib = false; @@ -2195,7 +2201,11 @@ namespace ts { isNoDefaultLib = referencePathMatchResult.isNoDefaultLib; const fileReference = referencePathMatchResult.fileReference; if (fileReference) { - referencedFiles.push(fileReference); + const collection = referencePathMatchResult.isTypeReferenceDirective + ? typeReferenceDirectives + : referencedFiles; + + collection.push(fileReference); } } }); @@ -2496,7 +2506,7 @@ namespace ts { importedFiles.push(decl.ref); } } - return { referencedFiles, importedFiles, isLibFile: isNoDefaultLib, ambientExternalModules: undefined }; + return { referencedFiles, typeReferenceDirectives, importedFiles, isLibFile: isNoDefaultLib, ambientExternalModules: undefined }; } else { // for global scripts ambient modules still can have augmentations - look for ambient modules with depth > 0 @@ -2514,7 +2524,7 @@ namespace ts { } } } - return { referencedFiles, importedFiles, isLibFile: isNoDefaultLib, ambientExternalModules: ambientModuleNames }; + return { referencedFiles, typeReferenceDirectives, importedFiles, isLibFile: isNoDefaultLib, ambientExternalModules: ambientModuleNames }; } } @@ -2851,7 +2861,7 @@ namespace ts { getCurrentDirectory: () => currentDirectory, fileExists: (fileName): boolean => { // stub missing host functionality - Debug.assert(!host.resolveModuleNames); + Debug.assert(!host.resolveModuleNames || !host.resolveTypeReferenceDirectives); return hostCache.getOrCreateEntry(fileName) !== undefined; }, readFile: (fileName): string => { @@ -2860,7 +2870,7 @@ namespace ts { return entry && entry.scriptSnapshot.getText(0, entry.scriptSnapshot.getLength()); }, directoryExists: directoryName => { - Debug.assert(!host.resolveModuleNames); + Debug.assert(!host.resolveModuleNames || !host.resolveTypeReferenceDirectives); return directoryProbablyExists(directoryName, host); } }; @@ -2871,6 +2881,11 @@ namespace ts { if (host.resolveModuleNames) { compilerHost.resolveModuleNames = (moduleNames, containingFile) => host.resolveModuleNames(moduleNames, containingFile); } + if (host.resolveTypeReferenceDirectives) { + compilerHost.resolveTypeReferenceDirectives = (typeReferenceDirectiveNames, containingFile) => { + return host.resolveTypeReferenceDirectives(typeReferenceDirectiveNames, containingFile); + }; + } const newProgram = createProgram(hostCache.getRootFileNames(), newSettings, compilerHost, program); @@ -3840,10 +3855,10 @@ namespace ts { } if (isEmpty(existingImportsOrExports)) { - return exportsOfModule; + return filter(exportsOfModule, e => e.name !== "default"); } - return filter(exportsOfModule, e => !lookUp(existingImportsOrExports, e.name)); + return filter(exportsOfModule, e => e.name !== "default" && !lookUp(existingImportsOrExports, e.name)); } /** @@ -4130,6 +4145,9 @@ namespace ts { if (typeChecker.isArgumentsSymbol(symbol)) { return ScriptElementKind.localVariableElement; } + if (location.kind === SyntaxKind.ThisKeyword && isExpression(location)) { + return ScriptElementKind.parameterElement; + } if (flags & SymbolFlags.Variable) { if (isFirstDeclarationOfSymbolParameter(symbol)) { return ScriptElementKind.parameterElement; @@ -4192,6 +4210,7 @@ namespace ts { const symbolFlags = symbol.flags; let symbolKind = getSymbolKindOfConstructorPropertyMethodAccessorFunctionOrVar(symbol, symbolFlags, location); let hasAddedSymbolInfo: boolean; + const isThisExpression: boolean = location.kind === SyntaxKind.ThisKeyword && isExpression(location); let type: Type; // Class at constructor site need to be shown as constructor apart from property,method, vars @@ -4202,7 +4221,7 @@ namespace ts { } let signature: Signature; - type = typeChecker.getTypeOfSymbolAtLocation(symbol, location); + type = isThisExpression ? typeChecker.getTypeAtLocation(location) : typeChecker.getTypeOfSymbolAtLocation(symbol, location); if (type) { if (location.parent && location.parent.kind === SyntaxKind.PropertyAccessExpression) { const right = (location.parent).name; @@ -4313,7 +4332,7 @@ namespace ts { } } } - if (symbolFlags & SymbolFlags.Class && !hasAddedSymbolInfo) { + if (symbolFlags & SymbolFlags.Class && !hasAddedSymbolInfo && !isThisExpression) { if (getDeclarationOfKind(symbol, SyntaxKind.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) @@ -4455,11 +4474,19 @@ namespace ts { if (!hasAddedSymbolInfo) { if (symbolKind !== ScriptElementKind.unknown) { if (type) { - addPrefixForAnyFunctionOrVar(symbol, symbolKind); + if (isThisExpression) { + addNewLineIfDisplayPartsExist(); + displayParts.push(keywordPart(SyntaxKind.ThisKeyword)); + } + else { + addPrefixForAnyFunctionOrVar(symbol, symbolKind); + } + // For properties, variables and local vars: show the type if (symbolKind === ScriptElementKind.memberVariableElement || symbolFlags & SymbolFlags.Variable || - symbolKind === ScriptElementKind.localVariableElement) { + symbolKind === ScriptElementKind.localVariableElement || + isThisExpression) { displayParts.push(punctuationPart(SyntaxKind.ColonToken)); displayParts.push(spacePart()); // If the type is type parameter, format it specially @@ -4691,6 +4718,26 @@ namespace ts { } } + function findReferenceInPosition(refs: FileReference[], pos: number): FileReference { + for (const ref of refs) { + if (ref.pos <= pos && pos < ref.end) { + return ref; + } + } + return undefined; + } + + function getDefinitionInfoForFileReference(name: string, targetFileName: string): DefinitionInfo { + return { + fileName: targetFileName, + textSpan: createTextSpanFromBounds(0, 0), + kind: ScriptElementKind.scriptElement, + name: name, + containerName: undefined, + containerKind: undefined + }; + } + /// Goto definition function getDefinitionAtPosition(fileName: string, position: number): DefinitionInfo[] { synchronizeHostData(); @@ -4710,18 +4757,20 @@ namespace ts { } /// Triple slash reference comments - const comment = forEach(sourceFile.referencedFiles, r => (r.pos <= position && position < r.end) ? r : undefined); + const comment = findReferenceInPosition(sourceFile.referencedFiles, position); if (comment) { const referenceFile = tryResolveScriptReference(program, sourceFile, comment); if (referenceFile) { - return [{ - fileName: referenceFile.fileName, - textSpan: createTextSpanFromBounds(0, 0), - kind: ScriptElementKind.scriptElement, - name: comment.fileName, - containerName: undefined, - containerKind: undefined - }]; + return [getDefinitionInfoForFileReference(comment.fileName, referenceFile.fileName)]; + } + return undefined; + } + // Type reference directives + const typeReferenceDirective = findReferenceInPosition(sourceFile.typeReferenceDirectives, position); + if (typeReferenceDirective) { + const referenceFile = lookUp(program.getResolvedTypeReferenceDirectives(), typeReferenceDirective.fileName); + if (referenceFile && referenceFile.resolvedFileName) { + return [getDefinitionInfoForFileReference(typeReferenceDirective.fileName, referenceFile.resolvedFileName)]; } return undefined; } @@ -5632,8 +5681,51 @@ namespace ts { }; } - function isImportSpecifierSymbol(symbol: Symbol) { - return (symbol.flags & SymbolFlags.Alias) && !!getDeclarationOfKind(symbol, SyntaxKind.ImportSpecifier); + function getAliasSymbolForPropertyNameSymbol(symbol: Symbol, location: Node): Symbol { + if (symbol.flags & SymbolFlags.Alias) { + // Default import get alias + const defaultImport = getDeclarationOfKind(symbol, SyntaxKind.ImportClause); + if (defaultImport) { + return typeChecker.getAliasedSymbol(symbol); + } + + const importOrExportSpecifier = forEach(symbol.declarations, + declaration => (declaration.kind === SyntaxKind.ImportSpecifier || + declaration.kind === SyntaxKind.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 === SyntaxKind.ImportSpecifier ? + typeChecker.getAliasedSymbol(symbol) : + typeChecker.getExportSpecifierLocalTargetSymbol(importOrExportSpecifier); + } + } + return undefined; + } + + function getPropertySymbolOfDestructuringAssignment(location: Node) { + return isArrayLiteralOrObjectLiteralDestructuringPattern(location.parent.parent) && + typeChecker.getPropertySymbolOfDestructuringAssignment(location); + } + + function isObjectBindingPatternElementWithoutPropertyName(symbol: Symbol) { + const bindingElement = getDeclarationOfKind(symbol, SyntaxKind.BindingElement); + return bindingElement && + bindingElement.parent.kind === SyntaxKind.ObjectBindingPattern && + !bindingElement.propertyName; + } + + function getPropertySymbolOfObjectBindingPatternWithoutPropertyName(symbol: Symbol) { + if (isObjectBindingPatternElementWithoutPropertyName(symbol)) { + const bindingElement = getDeclarationOfKind(symbol, SyntaxKind.BindingElement); + const typeOfPattern = typeChecker.getTypeAtLocation(bindingElement.parent); + return typeOfPattern && typeChecker.getPropertyOfType(typeOfPattern, (bindingElement.name).text); + } + return undefined; } function getInternedName(symbol: Symbol, location: Node, declarations: Declaration[]): string { @@ -5681,6 +5773,12 @@ namespace ts { 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 & SymbolFlags.SyntheticProperty)) { @@ -6077,18 +6175,30 @@ namespace ts { // The search set contains at least the current symbol let result = [symbol]; - // If the symbol is an alias, add what it aliases to the list - if (isImportSpecifierSymbol(symbol)) { - result.push(typeChecker.getAliasedSymbol(symbol)); + // If the location is name of property symbol from object literal destructuring pattern + // Search the property symbol + // for ( { property: p2 } of elems) { } + if (isNameOfPropertyAssignment(location) && location.parent.kind !== SyntaxKind.ShorthandPropertyAssignment) { + const propertySymbol = getPropertySymbolOfDestructuringAssignment(location); + if (propertySymbol) { + result.push(propertySymbol); + } } - // For export specifiers, the exported name can be referring to a local symbol, e.g.: + // If the symbol is an alias, add what it aliases to the list // 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) - if (location.parent.kind === SyntaxKind.ExportSpecifier) { - result.push(typeChecker.getExportSpecifierLocalTargetSymbol(location.parent)); + // 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) + const 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 @@ -6125,6 +6235,13 @@ namespace ts { 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 + const 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 forEach(typeChecker.getRootSymbols(symbol), rootSymbol => { @@ -6206,32 +6323,40 @@ namespace ts { } // If the reference symbol is an alias, check if what it is aliasing is one of the search - // symbols. - if (isImportSpecifierSymbol(referenceSymbol)) { - const aliasedSymbol = typeChecker.getAliasedSymbol(referenceSymbol); - if (searchSymbols.indexOf(aliasedSymbol) >= 0) { - return aliasedSymbol; - } - } - - // For export specifiers, it can be a local symbol, e.g. - // import {a} from "mod"; - // export {a as somethingElse} - // We want the local target of the export (i.e. the import symbol) and not the final target (i.e. "mod".a) - if (referenceLocation.parent.kind === SyntaxKind.ExportSpecifier) { - const aliasedSymbol = typeChecker.getExportSpecifierLocalTargetSymbol(referenceLocation.parent); - if (searchSymbols.indexOf(aliasedSymbol) >= 0) { - return aliasedSymbol; - } + // symbols but by looking up for related symbol of this alias so it can handle multiple level of indirectness. + const 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 if (isNameOfPropertyAssignment(referenceLocation)) { - return forEach(getPropertySymbolsFromContextualType(referenceLocation), contextualSymbol => { + const contextualSymbol = forEach(getPropertySymbolsFromContextualType(referenceLocation), contextualSymbol => { return forEach(typeChecker.getRootSymbols(contextualSymbol), s => 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) { } + const 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 }; + const 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) diff --git a/src/services/shims.ts b/src/services/shims.ts index ecfcd6f84da..77a9611ead1 100644 --- a/src/services/shims.ts +++ b/src/services/shims.ts @@ -19,7 +19,7 @@ let debugObjectHost = (this); // We need to use 'null' to interface with the managed side. -/* tslint:disable:no-null */ +/* tslint:disable:no-null-keyword */ /* tslint:disable:no-in-operator */ /* @internal */ @@ -67,6 +67,7 @@ namespace ts { useCaseSensitiveFileNames?(): boolean; getModuleResolutionsForFile?(fileName: string): string; + getTypeReferenceDirectiveResolutionsForFile?(fileName: string): string; directoryExists(directoryName: string): boolean; } @@ -281,6 +282,7 @@ namespace ts { private tracingEnabled = false; public resolveModuleNames: (moduleName: string[], containingFile: string) => ResolvedModule[]; + public resolveTypeReferenceDirectives: (typeDirectiveNames: string[], containingFile: string) => ResolvedTypeReferenceDirective[]; public directoryExists: (directoryName: string) => boolean; constructor(private shimHost: LanguageServiceShimHost) { @@ -298,6 +300,12 @@ namespace ts { if ("directoryExists" in this.shimHost) { this.directoryExists = directoryName => this.shimHost.directoryExists(directoryName); } + if ("getTypeReferenceDirectiveResolutionsForFile" in this.shimHost) { + this.resolveTypeReferenceDirectives = (typeDirectiveNames: string[], containingFile: string) => { + const typeDirectivesForFile = >JSON.parse(this.shimHost.getTypeReferenceDirectiveResolutionsForFile(containingFile)); + return map(typeDirectiveNames, name => lookUp(typeDirectivesForFile, name)); + }; + } } public log(s: string): void { @@ -919,38 +927,49 @@ namespace ts { }); } + public resolveTypeReferenceDirective(fileName: string, typeReferenceDirective: string, compilerOptionsJson: string): string { + return this.forwardJSONCall(`resolveTypeReferenceDirective(${fileName})`, () => { + const compilerOptions = JSON.parse(compilerOptionsJson); + const result = resolveTypeReferenceDirective(typeReferenceDirective, normalizeSlashes(fileName), compilerOptions, this.host); + return { + resolvedFileName: result.resolvedTypeReferenceDirective ? result.resolvedTypeReferenceDirective.resolvedFileName : undefined, + primary: result.resolvedTypeReferenceDirective ? result.resolvedTypeReferenceDirective.primary : true, + failedLookupLocations: result.failedLookupLocations + }; + }); + } + public getPreProcessedFileInfo(fileName: string, sourceTextSnapshot: IScriptSnapshot): string { return this.forwardJSONCall( "getPreProcessedFileInfo('" + fileName + "')", () => { // for now treat files as JavaScript const result = preProcessFile(sourceTextSnapshot.getText(0, sourceTextSnapshot.getLength()), /* readImportFiles */ true, /* detectJavaScriptImports */ true); - const convertResult = { - referencedFiles: [], - importedFiles: [], + return { + referencedFiles: this.convertFileReferences(result.referencedFiles), + importedFiles: this.convertFileReferences(result.importedFiles), ambientExternalModules: result.ambientExternalModules, - isLibFile: result.isLibFile + isLibFile: result.isLibFile, + typeReferenceDirectives: this.convertFileReferences(result.typeReferenceDirectives) }; - - forEach(result.referencedFiles, refFile => { - convertResult.referencedFiles.push({ - path: normalizePath(refFile.fileName), - position: refFile.pos, - length: refFile.end - refFile.pos - }); - }); - - forEach(result.importedFiles, importedFile => { - convertResult.importedFiles.push({ - path: normalizeSlashes(importedFile.fileName), - position: importedFile.pos, - length: importedFile.end - importedFile.pos - }); - }); - return convertResult; }); } + private convertFileReferences(refs: FileReference[]): IFileReference[] { + if (!refs) { + return undefined; + } + const result: IFileReference[] = []; + for (const ref of refs) { + result.push({ + path: normalizeSlashes(ref.fileName), + position: ref.pos, + length: ref.end - ref.pos + }); + } + return result; + } + public getTSConfigFileInfo(fileName: string, sourceTextSnapshot: IScriptSnapshot): string { return this.forwardJSONCall( `getTSConfigFileInfo('${fileName}')`, diff --git a/src/services/signatureHelp.ts b/src/services/signatureHelp.ts index e1e493b2634..9e8a2f14ed8 100644 --- a/src/services/signatureHelp.ts +++ b/src/services/signatureHelp.ts @@ -559,7 +559,7 @@ namespace ts.SignatureHelp { signatureHelpParameters = typeParameters && typeParameters.length > 0 ? map(typeParameters, createSignatureHelpParameterForTypeParameter) : emptyArray; suffixDisplayParts.push(punctuationPart(SyntaxKind.GreaterThanToken)); let parameterParts = mapToDisplayParts(writer => - typeChecker.getSymbolDisplayBuilder().buildDisplayForParametersAndDelimiters(candidateSignature.parameters, writer, invocation)); + typeChecker.getSymbolDisplayBuilder().buildDisplayForParametersAndDelimiters(candidateSignature.thisType, candidateSignature.parameters, writer, invocation)); addRange(suffixDisplayParts, parameterParts); } else { diff --git a/src/services/utilities.ts b/src/services/utilities.ts index 5ea011f2226..73ac43911b5 100644 --- a/src/services/utilities.ts +++ b/src/services/utilities.ts @@ -6,32 +6,6 @@ namespace ts { list: Node; } - export function getEndLinePosition(line: number, sourceFile: SourceFile): number { - Debug.assert(line >= 0); - let lineStarts = sourceFile.getLineStarts(); - - let lineIndex = line; - if (lineIndex + 1 === lineStarts.length) { - // last line - return EOF - return sourceFile.text.length - 1; - } - else { - // current line start - let start = lineStarts[lineIndex]; - // take the start position of the next line -1 = it should be some line break - let pos = lineStarts[lineIndex + 1] - 1; - Debug.assert(isLineBreak(sourceFile.text.charCodeAt(pos))); - // walk backwards skipping line breaks, stop the the beginning of current line. - // i.e: - // - // $ <- end of line for this position should match the start position - while (start <= pos && isLineBreak(sourceFile.text.charCodeAt(pos))) { - pos--; - } - return pos; - } - } - export function getLineStartPositionForPosition(position: number, sourceFile: SourceFile): number { let lineStarts = sourceFile.getLineStarts(); let line = sourceFile.getLineAndCharacterOfPosition(position).line; diff --git a/tests/baselines/reference/anyAssignabilityInInheritance.symbols b/tests/baselines/reference/anyAssignabilityInInheritance.symbols index 351c7faf78f..d1043256962 100644 --- a/tests/baselines/reference/anyAssignabilityInInheritance.symbols +++ b/tests/baselines/reference/anyAssignabilityInInheritance.symbols @@ -56,8 +56,8 @@ var r3 = foo3(a); // any declare function foo5(x: Date): Date; >foo5 : Symbol(foo5, Decl(anyAssignabilityInInheritance.ts, 19, 17), Decl(anyAssignabilityInInheritance.ts, 21, 37)) >x : Symbol(x, Decl(anyAssignabilityInInheritance.ts, 21, 22)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) declare function foo5(x: any): any; >foo5 : Symbol(foo5, Decl(anyAssignabilityInInheritance.ts, 19, 17), Decl(anyAssignabilityInInheritance.ts, 21, 37)) diff --git a/tests/baselines/reference/anyAssignableToEveryType.symbols b/tests/baselines/reference/anyAssignableToEveryType.symbols index a7a2843dc3d..4995a24a5c2 100644 --- a/tests/baselines/reference/anyAssignableToEveryType.symbols +++ b/tests/baselines/reference/anyAssignableToEveryType.symbols @@ -44,7 +44,7 @@ var d: boolean = a; var e: Date = a; >e : Symbol(e, Decl(anyAssignableToEveryType.ts, 17, 3)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >a : Symbol(a, Decl(anyAssignableToEveryType.ts, 0, 3)) var f: any = a; @@ -109,12 +109,12 @@ var o: (x: T) => T = a; var p: Number = a; >p : Symbol(p, Decl(anyAssignableToEveryType.ts, 31, 3)) ->Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >a : Symbol(a, Decl(anyAssignableToEveryType.ts, 0, 3)) var q: String = a; >q : Symbol(q, Decl(anyAssignableToEveryType.ts, 32, 3)) ->String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >a : Symbol(a, Decl(anyAssignableToEveryType.ts, 0, 3)) function foo(x: T, y: U, z: V) { @@ -122,7 +122,7 @@ function foo(x: T, y: U, z: V) { >T : Symbol(T, Decl(anyAssignableToEveryType.ts, 34, 13)) >U : Symbol(U, Decl(anyAssignableToEveryType.ts, 34, 15)) >V : Symbol(V, Decl(anyAssignableToEveryType.ts, 34, 32)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >x : Symbol(x, Decl(anyAssignableToEveryType.ts, 34, 49)) >T : Symbol(T, Decl(anyAssignableToEveryType.ts, 34, 13)) >y : Symbol(y, Decl(anyAssignableToEveryType.ts, 34, 54)) diff --git a/tests/baselines/reference/anyAssignableToEveryType2.symbols b/tests/baselines/reference/anyAssignableToEveryType2.symbols index 46d74d90bd9..12d380aa368 100644 --- a/tests/baselines/reference/anyAssignableToEveryType2.symbols +++ b/tests/baselines/reference/anyAssignableToEveryType2.symbols @@ -50,7 +50,7 @@ interface I5 { [x: string]: Date; >x : Symbol(x, Decl(anyAssignableToEveryType2.ts, 27, 5)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) foo: any; >foo : Symbol(I5.foo, Decl(anyAssignableToEveryType2.ts, 27, 22)) diff --git a/tests/baselines/reference/argumentsObjectIterator01_ES6.symbols b/tests/baselines/reference/argumentsObjectIterator01_ES6.symbols index d2d05cf3132..384b4458b2f 100644 --- a/tests/baselines/reference/argumentsObjectIterator01_ES6.symbols +++ b/tests/baselines/reference/argumentsObjectIterator01_ES6.symbols @@ -14,9 +14,9 @@ function doubleAndReturnAsArray(x: number, y: number, z: number): [number, numbe >arguments : Symbol(arguments) result.push(arg + arg); ->result.push : Symbol(Array.push, Decl(lib.d.ts, --, --)) +>result.push : Symbol(Array.push, Decl(lib.es5.d.ts, --, --)) >result : Symbol(result, Decl(argumentsObjectIterator01_ES6.ts, 2, 7)) ->push : Symbol(Array.push, Decl(lib.d.ts, --, --)) +>push : Symbol(Array.push, Decl(lib.es5.d.ts, --, --)) >arg : Symbol(arg, Decl(argumentsObjectIterator01_ES6.ts, 3, 12)) >arg : Symbol(arg, Decl(argumentsObjectIterator01_ES6.ts, 3, 12)) } diff --git a/tests/baselines/reference/argumentsObjectIterator02_ES6.symbols b/tests/baselines/reference/argumentsObjectIterator02_ES6.symbols index 7a4e75de66b..1f4fa33067a 100644 --- a/tests/baselines/reference/argumentsObjectIterator02_ES6.symbols +++ b/tests/baselines/reference/argumentsObjectIterator02_ES6.symbols @@ -9,9 +9,9 @@ function doubleAndReturnAsArray(x: number, y: number, z: number): [number, numbe let blah = arguments[Symbol.iterator]; >blah : Symbol(blah, Decl(argumentsObjectIterator02_ES6.ts, 2, 7)) >arguments : Symbol(arguments) ->Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) +>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) let result = []; >result : Symbol(result, Decl(argumentsObjectIterator02_ES6.ts, 4, 7)) @@ -21,9 +21,9 @@ function doubleAndReturnAsArray(x: number, y: number, z: number): [number, numbe >blah : Symbol(blah, Decl(argumentsObjectIterator02_ES6.ts, 2, 7)) result.push(arg + arg); ->result.push : Symbol(Array.push, Decl(lib.d.ts, --, --)) +>result.push : Symbol(Array.push, Decl(lib.es5.d.ts, --, --)) >result : Symbol(result, Decl(argumentsObjectIterator02_ES6.ts, 4, 7)) ->push : Symbol(Array.push, Decl(lib.d.ts, --, --)) +>push : Symbol(Array.push, Decl(lib.es5.d.ts, --, --)) >arg : Symbol(arg, Decl(argumentsObjectIterator02_ES6.ts, 5, 12)) >arg : Symbol(arg, Decl(argumentsObjectIterator02_ES6.ts, 5, 12)) } diff --git a/tests/baselines/reference/arrayCast.errors.txt b/tests/baselines/reference/arrayCast.errors.txt index 815813ea727..61463e5557b 100644 --- a/tests/baselines/reference/arrayCast.errors.txt +++ b/tests/baselines/reference/arrayCast.errors.txt @@ -1,5 +1,5 @@ -tests/cases/compiler/arrayCast.ts(3,23): error TS2352: Neither type '{ foo: string; }[]' nor type '{ id: number; }[]' is assignable to the other. - Type '{ foo: string; }' is not assignable to type '{ id: number; }'. +tests/cases/compiler/arrayCast.ts(3,23): error TS2352: Type '{ foo: string; }[]' cannot be converted to type '{ id: number; }[]'. + Type '{ foo: string; }' is not comparable to type '{ id: number; }'. Object literal may only specify known properties, and 'foo' does not exist in type '{ id: number; }'. @@ -8,8 +8,8 @@ tests/cases/compiler/arrayCast.ts(3,23): error TS2352: Neither type '{ foo: stri // has type { foo: string }[], which is not assignable to { id: number }[]. <{ id: number; }[]>[{ foo: "s" }]; ~~~~~~~~ -!!! error TS2352: Neither type '{ foo: string; }[]' nor type '{ id: number; }[]' is assignable to the other. -!!! error TS2352: Type '{ foo: string; }' is not assignable to type '{ id: number; }'. +!!! error TS2352: Type '{ foo: string; }[]' cannot be converted to type '{ id: number; }[]'. +!!! error TS2352: Type '{ foo: string; }' is not comparable to type '{ id: number; }'. !!! error TS2352: Object literal may only specify known properties, and 'foo' does not exist in type '{ id: number; }'. // Should succeed, as the {} element causes the type of the array to be {}[] diff --git a/tests/baselines/reference/arrayLiterals2ES5.symbols b/tests/baselines/reference/arrayLiterals2ES5.symbols index 4db8372a601..eea3c78bfc0 100644 --- a/tests/baselines/reference/arrayLiterals2ES5.symbols +++ b/tests/baselines/reference/arrayLiterals2ES5.symbols @@ -81,13 +81,13 @@ var temp4 = []; interface myArray extends Array { } >myArray : Symbol(myArray, Decl(arrayLiterals2ES5.ts, 42, 15)) >Array : Symbol(Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) interface myArray2 extends Array { } >myArray2 : Symbol(myArray2, Decl(arrayLiterals2ES5.ts, 44, 43)) >Array : Symbol(Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) var d0 = [1, true, ...temp,]; // has type (string|number|boolean)[] >d0 : Symbol(d0, Decl(arrayLiterals2ES5.ts, 46, 3)) diff --git a/tests/baselines/reference/arrayLiterals2ES6.symbols b/tests/baselines/reference/arrayLiterals2ES6.symbols index 0c7dc1495df..407471f76be 100644 --- a/tests/baselines/reference/arrayLiterals2ES6.symbols +++ b/tests/baselines/reference/arrayLiterals2ES6.symbols @@ -72,14 +72,14 @@ var temp2: [number[], string[]] = [[1, 2, 3], ["hello", "string"]]; interface myArray extends Array { } >myArray : Symbol(myArray, Decl(arrayLiterals2ES6.ts, 40, 67)) ->Array : Symbol(Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Array : Symbol(Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --)) +>Number : Symbol(Number, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) interface myArray2 extends Array { } >myArray2 : Symbol(myArray2, Decl(arrayLiterals2ES6.ts, 42, 43)) ->Array : Symbol(Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Array : Symbol(Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --)) +>Number : Symbol(Number, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>String : Symbol(String, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --)) var d0 = [1, true, ...temp, ]; // has type (string|number|boolean)[] >d0 : Symbol(d0, Decl(arrayLiterals2ES6.ts, 44, 3)) diff --git a/tests/baselines/reference/arrowFunctionErrorSpan.errors.txt b/tests/baselines/reference/arrowFunctionErrorSpan.errors.txt new file mode 100644 index 00000000000..e258f56d5ed --- /dev/null +++ b/tests/baselines/reference/arrowFunctionErrorSpan.errors.txt @@ -0,0 +1,111 @@ +tests/cases/compiler/arrowFunctionErrorSpan.ts(4,3): error TS2345: Argument of type '() => void' is not assignable to parameter of type '() => number'. + Type 'void' is not assignable to type 'number'. +tests/cases/compiler/arrowFunctionErrorSpan.ts(7,3): error TS2345: Argument of type '() => void' is not assignable to parameter of type '() => number'. + Type 'void' is not assignable to type 'number'. +tests/cases/compiler/arrowFunctionErrorSpan.ts(12,3): error TS2345: Argument of type '() => void' is not assignable to parameter of type '() => number'. + Type 'void' is not assignable to type 'number'. +tests/cases/compiler/arrowFunctionErrorSpan.ts(17,3): error TS2345: Argument of type '() => void' is not assignable to parameter of type '() => number'. + Type 'void' is not assignable to type 'number'. +tests/cases/compiler/arrowFunctionErrorSpan.ts(18,5): error TS1200: Line terminator not permitted before arrow. +tests/cases/compiler/arrowFunctionErrorSpan.ts(21,3): error TS2345: Argument of type '(a: any, b: any, c: any, d: any) => void' is not assignable to parameter of type '() => number'. +tests/cases/compiler/arrowFunctionErrorSpan.ts(28,7): error TS2345: Argument of type '() => void' is not assignable to parameter of type '() => number'. + Type 'void' is not assignable to type 'number'. +tests/cases/compiler/arrowFunctionErrorSpan.ts(32,7): error TS2345: Argument of type '() => void' is not assignable to parameter of type '() => number'. + Type 'void' is not assignable to type 'number'. +tests/cases/compiler/arrowFunctionErrorSpan.ts(36,7): error TS2345: Argument of type '() => void' is not assignable to parameter of type '() => number'. + Type 'void' is not assignable to type 'number'. +tests/cases/compiler/arrowFunctionErrorSpan.ts(43,5): error TS2345: Argument of type '() => void' is not assignable to parameter of type '() => number'. + Type 'void' is not assignable to type 'number'. +tests/cases/compiler/arrowFunctionErrorSpan.ts(52,3): error TS2345: Argument of type '(_: any) => number' is not assignable to parameter of type '() => number'. + + +==== tests/cases/compiler/arrowFunctionErrorSpan.ts (11 errors) ==== + function f(a: () => number) { } + + // oneliner + f(() => { }); + ~~~~~~~~~ +!!! error TS2345: Argument of type '() => void' is not assignable to parameter of type '() => number'. +!!! error TS2345: Type 'void' is not assignable to type 'number'. + + // multiline, body + f(() => { + ~~~~~~~ +!!! error TS2345: Argument of type '() => void' is not assignable to parameter of type '() => number'. +!!! error TS2345: Type 'void' is not assignable to type 'number'. + + }); + + // multiline 2, body + f(() => { + ~~~~~~~ +!!! error TS2345: Argument of type '() => void' is not assignable to parameter of type '() => number'. +!!! error TS2345: Type 'void' is not assignable to type 'number'. + + }); + + // multiline 3, arrow on a new line + f(() + ~~ + => { }); + ~~~~~~~~~~ +!!! error TS2345: Argument of type '() => void' is not assignable to parameter of type '() => number'. +!!! error TS2345: Type 'void' is not assignable to type 'number'. + ~~ +!!! error TS1200: Line terminator not permitted before arrow. + + // multiline 4, arguments + f((a, + ~~~ + b, + ~~~~~~ + c, + ~~~~~~ + d) => { }); + ~~~~~~~~~~~~~ +!!! error TS2345: Argument of type '(a: any, b: any, c: any, d: any) => void' is not assignable to parameter of type '() => number'. + + // single line with a comment + f(/* + */() => { }); + ~~~~~~~~~ +!!! error TS2345: Argument of type '() => void' is not assignable to parameter of type '() => number'. +!!! error TS2345: Type 'void' is not assignable to type 'number'. + + // multi line with a comment + f(/* + */() => { }); + ~~~~~~~~~ +!!! error TS2345: Argument of type '() => void' is not assignable to parameter of type '() => number'. +!!! error TS2345: Type 'void' is not assignable to type 'number'. + + // multi line with a comment 2 + f(/* + */() => { + ~~~~~~~~ +!!! error TS2345: Argument of type '() => void' is not assignable to parameter of type '() => number'. +!!! error TS2345: Type 'void' is not assignable to type 'number'. + + }); + + // multi line with a comment 3 + f( // comment 1 + // comment 2 + () => + ~~~~~ +!!! error TS2345: Argument of type '() => void' is not assignable to parameter of type '() => number'. +!!! error TS2345: Type 'void' is not assignable to type 'number'. + // comment 3 + { + // comment 4 + } + // comment 5 + ); + + // body is not a block + f(_ => 1 + + ~~~~~~~~ + 2); + ~~~~~ +!!! error TS2345: Argument of type '(_: any) => number' is not assignable to parameter of type '() => number'. + \ No newline at end of file diff --git a/tests/baselines/reference/arrowFunctionErrorSpan.js b/tests/baselines/reference/arrowFunctionErrorSpan.js new file mode 100644 index 00000000000..2557113e89b --- /dev/null +++ b/tests/baselines/reference/arrowFunctionErrorSpan.js @@ -0,0 +1,89 @@ +//// [arrowFunctionErrorSpan.ts] +function f(a: () => number) { } + +// oneliner +f(() => { }); + +// multiline, body +f(() => { + +}); + +// multiline 2, body +f(() => { + +}); + +// multiline 3, arrow on a new line +f(() + => { }); + +// multiline 4, arguments +f((a, + b, + c, + d) => { }); + +// single line with a comment +f(/* + */() => { }); + +// multi line with a comment +f(/* + */() => { }); + +// multi line with a comment 2 +f(/* + */() => { + + }); + +// multi line with a comment 3 +f( // comment 1 + // comment 2 + () => + // comment 3 + { + // comment 4 + } + // comment 5 +); + +// body is not a block +f(_ => 1 + + 2); + + +//// [arrowFunctionErrorSpan.js] +function f(a) { } +// oneliner +f(function () { }); +// multiline, body +f(function () { +}); +// multiline 2, body +f(function () { +}); +// multiline 3, arrow on a new line +f(function () { }); +// multiline 4, arguments +f(function (a, b, c, d) { }); +// single line with a comment +f(/* + */ function () { }); +// multi line with a comment +f(/* + */ function () { }); +// multi line with a comment 2 +f(/* + */ function () { +}); +// multi line with a comment 3 +f(// comment 1 +// comment 2 +function () { + // comment 4 +}); +// body is not a block +f(function (_) { return 1 + + 2; }); diff --git a/tests/baselines/reference/arrowFunctionWithObjectLiteralBody6.symbols b/tests/baselines/reference/arrowFunctionWithObjectLiteralBody6.symbols index 141b0d49880..534f9cc1ea0 100644 --- a/tests/baselines/reference/arrowFunctionWithObjectLiteralBody6.symbols +++ b/tests/baselines/reference/arrowFunctionWithObjectLiteralBody6.symbols @@ -1,13 +1,13 @@ === tests/cases/compiler/arrowFunctionWithObjectLiteralBody6.ts === var a = () => { name: "foo", message: "bar" }; >a : Symbol(a, Decl(arrowFunctionWithObjectLiteralBody6.ts, 0, 3)) ->Error : Symbol(Error, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Error : Symbol(Error, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) >name : Symbol(name, Decl(arrowFunctionWithObjectLiteralBody6.ts, 0, 22)) >message : Symbol(message, Decl(arrowFunctionWithObjectLiteralBody6.ts, 0, 35)) var b = () => ({ name: "foo", message: "bar" }); >b : Symbol(b, Decl(arrowFunctionWithObjectLiteralBody6.ts, 2, 3)) ->Error : Symbol(Error, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Error : Symbol(Error, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) >name : Symbol(name, Decl(arrowFunctionWithObjectLiteralBody6.ts, 2, 23)) >message : Symbol(message, Decl(arrowFunctionWithObjectLiteralBody6.ts, 2, 36)) @@ -18,7 +18,7 @@ var c = () => ({ name: "foo", message: "bar" }); var d = () => ((({ name: "foo", message: "bar" }))); >d : Symbol(d, Decl(arrowFunctionWithObjectLiteralBody6.ts, 6, 3)) ->Error : Symbol(Error, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Error : Symbol(Error, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) >name : Symbol(name, Decl(arrowFunctionWithObjectLiteralBody6.ts, 6, 25)) >message : Symbol(message, Decl(arrowFunctionWithObjectLiteralBody6.ts, 6, 38)) diff --git a/tests/baselines/reference/asOperator1.symbols b/tests/baselines/reference/asOperator1.symbols index 343d3422b5c..83813d26981 100644 --- a/tests/baselines/reference/asOperator1.symbols +++ b/tests/baselines/reference/asOperator1.symbols @@ -13,7 +13,7 @@ var y = (null as string).length; var z = Date as any as string; >z : Symbol(z, Decl(asOperator1.ts, 3, 3)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) // Should parse as a union type, not a bitwise 'or' of (32 as number) and 'string' var j = 32 as number|string; diff --git a/tests/baselines/reference/asOperator2.errors.txt b/tests/baselines/reference/asOperator2.errors.txt index 3b074038c26..92603c25cb0 100644 --- a/tests/baselines/reference/asOperator2.errors.txt +++ b/tests/baselines/reference/asOperator2.errors.txt @@ -1,8 +1,8 @@ -tests/cases/conformance/expressions/asOperator/asOperator2.ts(1,9): error TS2352: Neither type 'number' nor type 'string' is assignable to the other. +tests/cases/conformance/expressions/asOperator/asOperator2.ts(1,9): error TS2352: Type 'number' cannot be converted to type 'string'. ==== tests/cases/conformance/expressions/asOperator/asOperator2.ts (1 errors) ==== var x = 23 as string; ~~~~~~~~~~~~ -!!! error TS2352: Neither type 'number' nor type 'string' is assignable to the other. +!!! error TS2352: Type 'number' cannot be converted to type 'string'. \ No newline at end of file diff --git a/tests/baselines/reference/asOperatorContextualType.errors.txt b/tests/baselines/reference/asOperatorContextualType.errors.txt index c53b407b5cf..9431d6123e2 100644 --- a/tests/baselines/reference/asOperatorContextualType.errors.txt +++ b/tests/baselines/reference/asOperatorContextualType.errors.txt @@ -1,10 +1,10 @@ -tests/cases/conformance/expressions/asOperator/asOperatorContextualType.ts(2,9): error TS2352: Neither type '(v: number) => number' nor type '(x: number) => string' is assignable to the other. - Type 'number' is not assignable to type 'string'. +tests/cases/conformance/expressions/asOperator/asOperatorContextualType.ts(2,9): error TS2352: Type '(v: number) => number' cannot be converted to type '(x: number) => string'. + Type 'number' is not comparable to type 'string'. ==== tests/cases/conformance/expressions/asOperator/asOperatorContextualType.ts (1 errors) ==== // should error var x = (v => v) as (x: number) => string; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2352: Neither type '(v: number) => number' nor type '(x: number) => string' is assignable to the other. -!!! error TS2352: Type 'number' is not assignable to type 'string'. \ No newline at end of file +!!! error TS2352: Type '(v: number) => number' cannot be converted to type '(x: number) => string'. +!!! error TS2352: Type 'number' is not comparable to type 'string'. \ No newline at end of file diff --git a/tests/baselines/reference/asOperatorNames.errors.txt b/tests/baselines/reference/asOperatorNames.errors.txt index e3dfaab9884..4f957791a24 100644 --- a/tests/baselines/reference/asOperatorNames.errors.txt +++ b/tests/baselines/reference/asOperatorNames.errors.txt @@ -1,11 +1,11 @@ -tests/cases/conformance/expressions/asOperator/asOperatorNames.ts(2,9): error TS2352: Neither type 'number' nor type 'string' is assignable to the other. +tests/cases/conformance/expressions/asOperator/asOperatorNames.ts(2,9): error TS2352: Type 'number' cannot be converted to type 'string'. ==== tests/cases/conformance/expressions/asOperator/asOperatorNames.ts (1 errors) ==== var a = 20; var b = a as string; ~~~~~~~~~~~ -!!! error TS2352: Neither type 'number' nor type 'string' is assignable to the other. +!!! error TS2352: Type 'number' cannot be converted to type 'string'. var as = "hello"; var as1 = as as string; \ No newline at end of file diff --git a/tests/baselines/reference/assignmentCompatWithCallSignatures3.symbols b/tests/baselines/reference/assignmentCompatWithCallSignatures3.symbols index 288444a5a10..de0a5dc7b28 100644 --- a/tests/baselines/reference/assignmentCompatWithCallSignatures3.symbols +++ b/tests/baselines/reference/assignmentCompatWithCallSignatures3.symbols @@ -189,8 +189,8 @@ var a18: { (a: Date): Date; >a : Symbol(a, Decl(assignmentCompatWithCallSignatures3.ts, 40, 9)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) }): any[]; } diff --git a/tests/baselines/reference/assignmentCompatWithConstructSignatures3.symbols b/tests/baselines/reference/assignmentCompatWithConstructSignatures3.symbols index d05984ca39f..0e3b0b38332 100644 --- a/tests/baselines/reference/assignmentCompatWithConstructSignatures3.symbols +++ b/tests/baselines/reference/assignmentCompatWithConstructSignatures3.symbols @@ -189,8 +189,8 @@ var a18: { new (a: Date): Date; >a : Symbol(a, Decl(assignmentCompatWithConstructSignatures3.ts, 40, 13)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) }): any[]; } diff --git a/tests/baselines/reference/assignmentToObjectAndFunction.errors.txt b/tests/baselines/reference/assignmentToObjectAndFunction.errors.txt index 2e85ee101f5..454ac41b5b8 100644 --- a/tests/baselines/reference/assignmentToObjectAndFunction.errors.txt +++ b/tests/baselines/reference/assignmentToObjectAndFunction.errors.txt @@ -5,7 +5,7 @@ tests/cases/compiler/assignmentToObjectAndFunction.ts(8,5): error TS2322: Type ' Property 'apply' is missing in type '{}'. tests/cases/compiler/assignmentToObjectAndFunction.ts(29,5): error TS2322: Type 'typeof bad' is not assignable to type 'Function'. Types of property 'apply' are incompatible. - Type 'number' is not assignable to type '(thisArg: any, argArray?: any) => any'. + Type 'number' is not assignable to type '{ (this: (this: T, ...argArray: any[]) => U, thisArg: T, argArray?: any): U; (this: Function, thisArg: any, argArray?: any): any; }'. ==== tests/cases/compiler/assignmentToObjectAndFunction.ts (3 errors) ==== @@ -48,4 +48,4 @@ tests/cases/compiler/assignmentToObjectAndFunction.ts(29,5): error TS2322: Type ~~~~~~~~~~ !!! error TS2322: Type 'typeof bad' is not assignable to type 'Function'. !!! error TS2322: Types of property 'apply' are incompatible. -!!! error TS2322: Type 'number' is not assignable to type '(thisArg: any, argArray?: any) => any'. \ No newline at end of file +!!! error TS2322: Type 'number' is not assignable to type '{ (this: (this: T, ...argArray: any[]) => U, thisArg: T, argArray?: any): U; (this: Function, thisArg: any, argArray?: any): any; }'. \ No newline at end of file diff --git a/tests/baselines/reference/asyncAliasReturnType_es6.symbols b/tests/baselines/reference/asyncAliasReturnType_es6.symbols index 4d6db6a1ef4..61de47e4092 100644 --- a/tests/baselines/reference/asyncAliasReturnType_es6.symbols +++ b/tests/baselines/reference/asyncAliasReturnType_es6.symbols @@ -2,7 +2,7 @@ type PromiseAlias = Promise; >PromiseAlias : Symbol(PromiseAlias, Decl(asyncAliasReturnType_es6.ts, 0, 0)) >T : Symbol(T, Decl(asyncAliasReturnType_es6.ts, 0, 18)) ->Promise : Symbol(Promise, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) >T : Symbol(T, Decl(asyncAliasReturnType_es6.ts, 0, 18)) async function f(): PromiseAlias { diff --git a/tests/baselines/reference/asyncArrowFunction1_es6.symbols b/tests/baselines/reference/asyncArrowFunction1_es6.symbols index a8a5aef325a..a2f62f82990 100644 --- a/tests/baselines/reference/asyncArrowFunction1_es6.symbols +++ b/tests/baselines/reference/asyncArrowFunction1_es6.symbols @@ -2,6 +2,6 @@ var foo = async (): Promise => { >foo : Symbol(foo, Decl(asyncArrowFunction1_es6.ts, 1, 3)) ->Promise : Symbol(Promise, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) }; diff --git a/tests/baselines/reference/asyncArrowFunctionCapturesArguments_es6.symbols b/tests/baselines/reference/asyncArrowFunctionCapturesArguments_es6.symbols index f2f71492ccf..06999513192 100644 --- a/tests/baselines/reference/asyncArrowFunctionCapturesArguments_es6.symbols +++ b/tests/baselines/reference/asyncArrowFunctionCapturesArguments_es6.symbols @@ -10,9 +10,9 @@ class C { var fn = async () => await other.apply(this, arguments); >fn : Symbol(fn, Decl(asyncArrowFunctionCapturesArguments_es6.ts, 3, 9)) ->other.apply : Symbol(Function.apply, Decl(lib.d.ts, --, --)) +>other.apply : Symbol(Function.apply, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) >other : Symbol(other, Decl(asyncArrowFunctionCapturesArguments_es6.ts, 1, 13)) ->apply : Symbol(Function.apply, Decl(lib.d.ts, --, --)) +>apply : Symbol(Function.apply, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) >this : Symbol(C, Decl(asyncArrowFunctionCapturesArguments_es6.ts, 0, 0)) >arguments : Symbol(arguments) } diff --git a/tests/baselines/reference/asyncArrowFunctionCapturesArguments_es6.types b/tests/baselines/reference/asyncArrowFunctionCapturesArguments_es6.types index 76853858c5c..18a08ffface 100644 --- a/tests/baselines/reference/asyncArrowFunctionCapturesArguments_es6.types +++ b/tests/baselines/reference/asyncArrowFunctionCapturesArguments_es6.types @@ -9,13 +9,13 @@ class C { >other : () => void var fn = async () => await other.apply(this, arguments); ->fn : () => Promise ->async () => await other.apply(this, arguments) : () => Promise ->await other.apply(this, arguments) : any ->other.apply(this, arguments) : any ->other.apply : (thisArg: any, argArray?: any) => any +>fn : () => Promise +>async () => await other.apply(this, arguments) : () => Promise +>await other.apply(this, arguments) : void +>other.apply(this, arguments) : void +>other.apply : { (this: (this: T, ...argArray: any[]) => U, thisArg: T, argArray?: any): U; (this: Function, thisArg: any, argArray?: any): any; } >other : () => void ->apply : (thisArg: any, argArray?: any) => any +>apply : { (this: (this: T, ...argArray: any[]) => U, thisArg: T, argArray?: any): U; (this: Function, thisArg: any, argArray?: any): any; } >this : this >arguments : IArguments } diff --git a/tests/baselines/reference/asyncAwait_es6.symbols b/tests/baselines/reference/asyncAwait_es6.symbols index aa70c0a712e..26295e72f78 100644 --- a/tests/baselines/reference/asyncAwait_es6.symbols +++ b/tests/baselines/reference/asyncAwait_es6.symbols @@ -2,16 +2,16 @@ type MyPromise = Promise; >MyPromise : Symbol(MyPromise, Decl(asyncAwait_es6.ts, 0, 0), Decl(asyncAwait_es6.ts, 1, 11)) >T : Symbol(T, Decl(asyncAwait_es6.ts, 0, 15)) ->Promise : Symbol(Promise, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) >T : Symbol(T, Decl(asyncAwait_es6.ts, 0, 15)) declare var MyPromise: typeof Promise; >MyPromise : Symbol(MyPromise, Decl(asyncAwait_es6.ts, 0, 0), Decl(asyncAwait_es6.ts, 1, 11)) ->Promise : Symbol(Promise, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) declare var p: Promise; >p : Symbol(p, Decl(asyncAwait_es6.ts, 2, 11)) ->Promise : Symbol(Promise, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) declare var mp: MyPromise; >mp : Symbol(mp, Decl(asyncAwait_es6.ts, 3, 11)) @@ -22,7 +22,7 @@ async function f0() { } async function f1(): Promise { } >f1 : Symbol(f1, Decl(asyncAwait_es6.ts, 5, 23)) ->Promise : Symbol(Promise, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) async function f3(): MyPromise { } >f3 : Symbol(f3, Decl(asyncAwait_es6.ts, 6, 38)) @@ -33,7 +33,7 @@ let f4 = async function() { } let f5 = async function(): Promise { } >f5 : Symbol(f5, Decl(asyncAwait_es6.ts, 10, 3)) ->Promise : Symbol(Promise, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) let f6 = async function(): MyPromise { } >f6 : Symbol(f6, Decl(asyncAwait_es6.ts, 11, 3)) @@ -44,7 +44,7 @@ let f7 = async () => { }; let f8 = async (): Promise => { }; >f8 : Symbol(f8, Decl(asyncAwait_es6.ts, 14, 3)) ->Promise : Symbol(Promise, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) let f9 = async (): MyPromise => { }; >f9 : Symbol(f9, Decl(asyncAwait_es6.ts, 15, 3)) @@ -60,7 +60,7 @@ let f11 = async () => mp; let f12 = async (): Promise => mp; >f12 : Symbol(f12, Decl(asyncAwait_es6.ts, 18, 3)) ->Promise : Symbol(Promise, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) >mp : Symbol(mp, Decl(asyncAwait_es6.ts, 3, 11)) let f13 = async (): MyPromise => p; @@ -76,7 +76,7 @@ let o = { async m2(): Promise { }, >m2 : Symbol(m2, Decl(asyncAwait_es6.ts, 22, 16)) ->Promise : Symbol(Promise, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) async m3(): MyPromise { } >m3 : Symbol(m3, Decl(asyncAwait_es6.ts, 23, 31)) @@ -92,7 +92,7 @@ class C { async m2(): Promise { } >m2 : Symbol(C.m2, Decl(asyncAwait_es6.ts, 28, 15)) ->Promise : Symbol(Promise, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) async m3(): MyPromise { } >m3 : Symbol(C.m3, Decl(asyncAwait_es6.ts, 29, 30)) @@ -103,7 +103,7 @@ class C { static async m5(): Promise { } >m5 : Symbol(C.m5, Decl(asyncAwait_es6.ts, 31, 22)) ->Promise : Symbol(Promise, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) static async m6(): MyPromise { } >m6 : Symbol(C.m6, Decl(asyncAwait_es6.ts, 32, 37)) diff --git a/tests/baselines/reference/asyncFunctionDeclaration11_es6.symbols b/tests/baselines/reference/asyncFunctionDeclaration11_es6.symbols index f1946aa712f..c9288f42763 100644 --- a/tests/baselines/reference/asyncFunctionDeclaration11_es6.symbols +++ b/tests/baselines/reference/asyncFunctionDeclaration11_es6.symbols @@ -1,5 +1,5 @@ === tests/cases/conformance/async/es6/functionDeclarations/asyncFunctionDeclaration11_es6.ts === async function await(): Promise { >await : Symbol(await, Decl(asyncFunctionDeclaration11_es6.ts, 0, 0)) ->Promise : Symbol(Promise, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) } diff --git a/tests/baselines/reference/asyncFunctionDeclaration14_es6.symbols b/tests/baselines/reference/asyncFunctionDeclaration14_es6.symbols index 34623ded262..d036632ff86 100644 --- a/tests/baselines/reference/asyncFunctionDeclaration14_es6.symbols +++ b/tests/baselines/reference/asyncFunctionDeclaration14_es6.symbols @@ -1,7 +1,7 @@ === tests/cases/conformance/async/es6/functionDeclarations/asyncFunctionDeclaration14_es6.ts === async function foo(): Promise { >foo : Symbol(foo, Decl(asyncFunctionDeclaration14_es6.ts, 0, 0)) ->Promise : Symbol(Promise, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) return; } diff --git a/tests/baselines/reference/asyncFunctionDeclaration1_es6.symbols b/tests/baselines/reference/asyncFunctionDeclaration1_es6.symbols index b1721789f5c..019d2db4f07 100644 --- a/tests/baselines/reference/asyncFunctionDeclaration1_es6.symbols +++ b/tests/baselines/reference/asyncFunctionDeclaration1_es6.symbols @@ -1,5 +1,5 @@ === tests/cases/conformance/async/es6/functionDeclarations/asyncFunctionDeclaration1_es6.ts === async function foo(): Promise { >foo : Symbol(foo, Decl(asyncFunctionDeclaration1_es6.ts, 0, 0)) ->Promise : Symbol(Promise, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) } diff --git a/tests/baselines/reference/awaitBinaryExpression1_es6.symbols b/tests/baselines/reference/awaitBinaryExpression1_es6.symbols index fd532aeca74..aee3dbefe96 100644 --- a/tests/baselines/reference/awaitBinaryExpression1_es6.symbols +++ b/tests/baselines/reference/awaitBinaryExpression1_es6.symbols @@ -4,11 +4,11 @@ declare var a: boolean; declare var p: Promise; >p : Symbol(p, Decl(awaitBinaryExpression1_es6.ts, 1, 11)) ->Promise : Symbol(Promise, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) async function func(): Promise { >func : Symbol(func, Decl(awaitBinaryExpression1_es6.ts, 1, 32)) ->Promise : Symbol(Promise, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) "before"; var b = await p || a; diff --git a/tests/baselines/reference/awaitBinaryExpression2_es6.symbols b/tests/baselines/reference/awaitBinaryExpression2_es6.symbols index 3117f62da17..a4ed0ec14bd 100644 --- a/tests/baselines/reference/awaitBinaryExpression2_es6.symbols +++ b/tests/baselines/reference/awaitBinaryExpression2_es6.symbols @@ -4,11 +4,11 @@ declare var a: boolean; declare var p: Promise; >p : Symbol(p, Decl(awaitBinaryExpression2_es6.ts, 1, 11)) ->Promise : Symbol(Promise, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) async function func(): Promise { >func : Symbol(func, Decl(awaitBinaryExpression2_es6.ts, 1, 32)) ->Promise : Symbol(Promise, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) "before"; var b = await p && a; diff --git a/tests/baselines/reference/awaitBinaryExpression3_es6.symbols b/tests/baselines/reference/awaitBinaryExpression3_es6.symbols index e50f194bbee..4b3beb9d9a5 100644 --- a/tests/baselines/reference/awaitBinaryExpression3_es6.symbols +++ b/tests/baselines/reference/awaitBinaryExpression3_es6.symbols @@ -4,11 +4,11 @@ declare var a: number; declare var p: Promise; >p : Symbol(p, Decl(awaitBinaryExpression3_es6.ts, 1, 11)) ->Promise : Symbol(Promise, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) async function func(): Promise { >func : Symbol(func, Decl(awaitBinaryExpression3_es6.ts, 1, 31)) ->Promise : Symbol(Promise, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) "before"; var b = await p + a; diff --git a/tests/baselines/reference/awaitBinaryExpression4_es6.symbols b/tests/baselines/reference/awaitBinaryExpression4_es6.symbols index 02e05faeab0..1c52cbb48ef 100644 --- a/tests/baselines/reference/awaitBinaryExpression4_es6.symbols +++ b/tests/baselines/reference/awaitBinaryExpression4_es6.symbols @@ -4,11 +4,11 @@ declare var a: boolean; declare var p: Promise; >p : Symbol(p, Decl(awaitBinaryExpression4_es6.ts, 1, 11)) ->Promise : Symbol(Promise, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) async function func(): Promise { >func : Symbol(func, Decl(awaitBinaryExpression4_es6.ts, 1, 32)) ->Promise : Symbol(Promise, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) "before"; var b = await p, a; diff --git a/tests/baselines/reference/awaitBinaryExpression5_es6.symbols b/tests/baselines/reference/awaitBinaryExpression5_es6.symbols index 061364240f8..28f96aa55f5 100644 --- a/tests/baselines/reference/awaitBinaryExpression5_es6.symbols +++ b/tests/baselines/reference/awaitBinaryExpression5_es6.symbols @@ -4,11 +4,11 @@ declare var a: boolean; declare var p: Promise; >p : Symbol(p, Decl(awaitBinaryExpression5_es6.ts, 1, 11)) ->Promise : Symbol(Promise, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) async function func(): Promise { >func : Symbol(func, Decl(awaitBinaryExpression5_es6.ts, 1, 32)) ->Promise : Symbol(Promise, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) "before"; var o: { a: boolean; }; diff --git a/tests/baselines/reference/awaitCallExpression1_es6.symbols b/tests/baselines/reference/awaitCallExpression1_es6.symbols index debe9180bcc..c4a91817a46 100644 --- a/tests/baselines/reference/awaitCallExpression1_es6.symbols +++ b/tests/baselines/reference/awaitCallExpression1_es6.symbols @@ -4,7 +4,7 @@ declare var a: boolean; declare var p: Promise; >p : Symbol(p, Decl(awaitCallExpression1_es6.ts, 1, 11)) ->Promise : Symbol(Promise, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) declare function fn(arg0: boolean, arg1: boolean, arg2: boolean): void; >fn : Symbol(fn, Decl(awaitCallExpression1_es6.ts, 1, 32)) @@ -21,14 +21,14 @@ declare var o: { fn(arg0: boolean, arg1: boolean, arg2: boolean): void; }; declare var pfn: Promise<{ (arg0: boolean, arg1: boolean, arg2: boolean): void; }>; >pfn : Symbol(pfn, Decl(awaitCallExpression1_es6.ts, 4, 11)) ->Promise : Symbol(Promise, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) >arg0 : Symbol(arg0, Decl(awaitCallExpression1_es6.ts, 4, 28)) >arg1 : Symbol(arg1, Decl(awaitCallExpression1_es6.ts, 4, 42)) >arg2 : Symbol(arg2, Decl(awaitCallExpression1_es6.ts, 4, 57)) declare var po: Promise<{ fn(arg0: boolean, arg1: boolean, arg2: boolean): void; }>; >po : Symbol(po, Decl(awaitCallExpression1_es6.ts, 5, 11)) ->Promise : Symbol(Promise, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) >fn : Symbol(fn, Decl(awaitCallExpression1_es6.ts, 5, 25)) >arg0 : Symbol(arg0, Decl(awaitCallExpression1_es6.ts, 5, 29)) >arg1 : Symbol(arg1, Decl(awaitCallExpression1_es6.ts, 5, 43)) @@ -36,7 +36,7 @@ declare var po: Promise<{ fn(arg0: boolean, arg1: boolean, arg2: boolean): void; async function func(): Promise { >func : Symbol(func, Decl(awaitCallExpression1_es6.ts, 5, 84)) ->Promise : Symbol(Promise, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) "before"; var b = fn(a, a, a); diff --git a/tests/baselines/reference/awaitCallExpression2_es6.symbols b/tests/baselines/reference/awaitCallExpression2_es6.symbols index be9a11410c2..3931e28045d 100644 --- a/tests/baselines/reference/awaitCallExpression2_es6.symbols +++ b/tests/baselines/reference/awaitCallExpression2_es6.symbols @@ -4,7 +4,7 @@ declare var a: boolean; declare var p: Promise; >p : Symbol(p, Decl(awaitCallExpression2_es6.ts, 1, 11)) ->Promise : Symbol(Promise, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) declare function fn(arg0: boolean, arg1: boolean, arg2: boolean): void; >fn : Symbol(fn, Decl(awaitCallExpression2_es6.ts, 1, 32)) @@ -21,14 +21,14 @@ declare var o: { fn(arg0: boolean, arg1: boolean, arg2: boolean): void; }; declare var pfn: Promise<{ (arg0: boolean, arg1: boolean, arg2: boolean): void; }>; >pfn : Symbol(pfn, Decl(awaitCallExpression2_es6.ts, 4, 11)) ->Promise : Symbol(Promise, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) >arg0 : Symbol(arg0, Decl(awaitCallExpression2_es6.ts, 4, 28)) >arg1 : Symbol(arg1, Decl(awaitCallExpression2_es6.ts, 4, 42)) >arg2 : Symbol(arg2, Decl(awaitCallExpression2_es6.ts, 4, 57)) declare var po: Promise<{ fn(arg0: boolean, arg1: boolean, arg2: boolean): void; }>; >po : Symbol(po, Decl(awaitCallExpression2_es6.ts, 5, 11)) ->Promise : Symbol(Promise, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) >fn : Symbol(fn, Decl(awaitCallExpression2_es6.ts, 5, 25)) >arg0 : Symbol(arg0, Decl(awaitCallExpression2_es6.ts, 5, 29)) >arg1 : Symbol(arg1, Decl(awaitCallExpression2_es6.ts, 5, 43)) @@ -36,7 +36,7 @@ declare var po: Promise<{ fn(arg0: boolean, arg1: boolean, arg2: boolean): void; async function func(): Promise { >func : Symbol(func, Decl(awaitCallExpression2_es6.ts, 5, 84)) ->Promise : Symbol(Promise, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) "before"; var b = fn(await p, a, a); diff --git a/tests/baselines/reference/awaitCallExpression3_es6.symbols b/tests/baselines/reference/awaitCallExpression3_es6.symbols index 612e33c456c..2002748c9ba 100644 --- a/tests/baselines/reference/awaitCallExpression3_es6.symbols +++ b/tests/baselines/reference/awaitCallExpression3_es6.symbols @@ -4,7 +4,7 @@ declare var a: boolean; declare var p: Promise; >p : Symbol(p, Decl(awaitCallExpression3_es6.ts, 1, 11)) ->Promise : Symbol(Promise, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) declare function fn(arg0: boolean, arg1: boolean, arg2: boolean): void; >fn : Symbol(fn, Decl(awaitCallExpression3_es6.ts, 1, 32)) @@ -21,14 +21,14 @@ declare var o: { fn(arg0: boolean, arg1: boolean, arg2: boolean): void; }; declare var pfn: Promise<{ (arg0: boolean, arg1: boolean, arg2: boolean): void; }>; >pfn : Symbol(pfn, Decl(awaitCallExpression3_es6.ts, 4, 11)) ->Promise : Symbol(Promise, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) >arg0 : Symbol(arg0, Decl(awaitCallExpression3_es6.ts, 4, 28)) >arg1 : Symbol(arg1, Decl(awaitCallExpression3_es6.ts, 4, 42)) >arg2 : Symbol(arg2, Decl(awaitCallExpression3_es6.ts, 4, 57)) declare var po: Promise<{ fn(arg0: boolean, arg1: boolean, arg2: boolean): void; }>; >po : Symbol(po, Decl(awaitCallExpression3_es6.ts, 5, 11)) ->Promise : Symbol(Promise, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) >fn : Symbol(fn, Decl(awaitCallExpression3_es6.ts, 5, 25)) >arg0 : Symbol(arg0, Decl(awaitCallExpression3_es6.ts, 5, 29)) >arg1 : Symbol(arg1, Decl(awaitCallExpression3_es6.ts, 5, 43)) @@ -36,7 +36,7 @@ declare var po: Promise<{ fn(arg0: boolean, arg1: boolean, arg2: boolean): void; async function func(): Promise { >func : Symbol(func, Decl(awaitCallExpression3_es6.ts, 5, 84)) ->Promise : Symbol(Promise, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) "before"; var b = fn(a, await p, a); diff --git a/tests/baselines/reference/awaitCallExpression4_es6.symbols b/tests/baselines/reference/awaitCallExpression4_es6.symbols index 6925e5a44ea..d31cf100ad4 100644 --- a/tests/baselines/reference/awaitCallExpression4_es6.symbols +++ b/tests/baselines/reference/awaitCallExpression4_es6.symbols @@ -4,7 +4,7 @@ declare var a: boolean; declare var p: Promise; >p : Symbol(p, Decl(awaitCallExpression4_es6.ts, 1, 11)) ->Promise : Symbol(Promise, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) declare function fn(arg0: boolean, arg1: boolean, arg2: boolean): void; >fn : Symbol(fn, Decl(awaitCallExpression4_es6.ts, 1, 32)) @@ -21,14 +21,14 @@ declare var o: { fn(arg0: boolean, arg1: boolean, arg2: boolean): void; }; declare var pfn: Promise<{ (arg0: boolean, arg1: boolean, arg2: boolean): void; }>; >pfn : Symbol(pfn, Decl(awaitCallExpression4_es6.ts, 4, 11)) ->Promise : Symbol(Promise, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) >arg0 : Symbol(arg0, Decl(awaitCallExpression4_es6.ts, 4, 28)) >arg1 : Symbol(arg1, Decl(awaitCallExpression4_es6.ts, 4, 42)) >arg2 : Symbol(arg2, Decl(awaitCallExpression4_es6.ts, 4, 57)) declare var po: Promise<{ fn(arg0: boolean, arg1: boolean, arg2: boolean): void; }>; >po : Symbol(po, Decl(awaitCallExpression4_es6.ts, 5, 11)) ->Promise : Symbol(Promise, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) >fn : Symbol(fn, Decl(awaitCallExpression4_es6.ts, 5, 25)) >arg0 : Symbol(arg0, Decl(awaitCallExpression4_es6.ts, 5, 29)) >arg1 : Symbol(arg1, Decl(awaitCallExpression4_es6.ts, 5, 43)) @@ -36,7 +36,7 @@ declare var po: Promise<{ fn(arg0: boolean, arg1: boolean, arg2: boolean): void; async function func(): Promise { >func : Symbol(func, Decl(awaitCallExpression4_es6.ts, 5, 84)) ->Promise : Symbol(Promise, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) "before"; var b = (await pfn)(a, a, a); diff --git a/tests/baselines/reference/awaitCallExpression5_es6.symbols b/tests/baselines/reference/awaitCallExpression5_es6.symbols index 8bdce5cd12c..d14a966b0b1 100644 --- a/tests/baselines/reference/awaitCallExpression5_es6.symbols +++ b/tests/baselines/reference/awaitCallExpression5_es6.symbols @@ -4,7 +4,7 @@ declare var a: boolean; declare var p: Promise; >p : Symbol(p, Decl(awaitCallExpression5_es6.ts, 1, 11)) ->Promise : Symbol(Promise, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) declare function fn(arg0: boolean, arg1: boolean, arg2: boolean): void; >fn : Symbol(fn, Decl(awaitCallExpression5_es6.ts, 1, 32)) @@ -21,14 +21,14 @@ declare var o: { fn(arg0: boolean, arg1: boolean, arg2: boolean): void; }; declare var pfn: Promise<{ (arg0: boolean, arg1: boolean, arg2: boolean): void; }>; >pfn : Symbol(pfn, Decl(awaitCallExpression5_es6.ts, 4, 11)) ->Promise : Symbol(Promise, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) >arg0 : Symbol(arg0, Decl(awaitCallExpression5_es6.ts, 4, 28)) >arg1 : Symbol(arg1, Decl(awaitCallExpression5_es6.ts, 4, 42)) >arg2 : Symbol(arg2, Decl(awaitCallExpression5_es6.ts, 4, 57)) declare var po: Promise<{ fn(arg0: boolean, arg1: boolean, arg2: boolean): void; }>; >po : Symbol(po, Decl(awaitCallExpression5_es6.ts, 5, 11)) ->Promise : Symbol(Promise, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) >fn : Symbol(fn, Decl(awaitCallExpression5_es6.ts, 5, 25)) >arg0 : Symbol(arg0, Decl(awaitCallExpression5_es6.ts, 5, 29)) >arg1 : Symbol(arg1, Decl(awaitCallExpression5_es6.ts, 5, 43)) @@ -36,7 +36,7 @@ declare var po: Promise<{ fn(arg0: boolean, arg1: boolean, arg2: boolean): void; async function func(): Promise { >func : Symbol(func, Decl(awaitCallExpression5_es6.ts, 5, 84)) ->Promise : Symbol(Promise, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) "before"; var b = o.fn(a, a, a); diff --git a/tests/baselines/reference/awaitCallExpression6_es6.symbols b/tests/baselines/reference/awaitCallExpression6_es6.symbols index ad79f75ab49..afd07fd0185 100644 --- a/tests/baselines/reference/awaitCallExpression6_es6.symbols +++ b/tests/baselines/reference/awaitCallExpression6_es6.symbols @@ -4,7 +4,7 @@ declare var a: boolean; declare var p: Promise; >p : Symbol(p, Decl(awaitCallExpression6_es6.ts, 1, 11)) ->Promise : Symbol(Promise, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) declare function fn(arg0: boolean, arg1: boolean, arg2: boolean): void; >fn : Symbol(fn, Decl(awaitCallExpression6_es6.ts, 1, 32)) @@ -21,14 +21,14 @@ declare var o: { fn(arg0: boolean, arg1: boolean, arg2: boolean): void; }; declare var pfn: Promise<{ (arg0: boolean, arg1: boolean, arg2: boolean): void; }>; >pfn : Symbol(pfn, Decl(awaitCallExpression6_es6.ts, 4, 11)) ->Promise : Symbol(Promise, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) >arg0 : Symbol(arg0, Decl(awaitCallExpression6_es6.ts, 4, 28)) >arg1 : Symbol(arg1, Decl(awaitCallExpression6_es6.ts, 4, 42)) >arg2 : Symbol(arg2, Decl(awaitCallExpression6_es6.ts, 4, 57)) declare var po: Promise<{ fn(arg0: boolean, arg1: boolean, arg2: boolean): void; }>; >po : Symbol(po, Decl(awaitCallExpression6_es6.ts, 5, 11)) ->Promise : Symbol(Promise, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) >fn : Symbol(fn, Decl(awaitCallExpression6_es6.ts, 5, 25)) >arg0 : Symbol(arg0, Decl(awaitCallExpression6_es6.ts, 5, 29)) >arg1 : Symbol(arg1, Decl(awaitCallExpression6_es6.ts, 5, 43)) @@ -36,7 +36,7 @@ declare var po: Promise<{ fn(arg0: boolean, arg1: boolean, arg2: boolean): void; async function func(): Promise { >func : Symbol(func, Decl(awaitCallExpression6_es6.ts, 5, 84)) ->Promise : Symbol(Promise, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) "before"; var b = o.fn(await p, a, a); diff --git a/tests/baselines/reference/awaitCallExpression7_es6.symbols b/tests/baselines/reference/awaitCallExpression7_es6.symbols index 0da1dd16016..bb503d4b3a1 100644 --- a/tests/baselines/reference/awaitCallExpression7_es6.symbols +++ b/tests/baselines/reference/awaitCallExpression7_es6.symbols @@ -4,7 +4,7 @@ declare var a: boolean; declare var p: Promise; >p : Symbol(p, Decl(awaitCallExpression7_es6.ts, 1, 11)) ->Promise : Symbol(Promise, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) declare function fn(arg0: boolean, arg1: boolean, arg2: boolean): void; >fn : Symbol(fn, Decl(awaitCallExpression7_es6.ts, 1, 32)) @@ -21,14 +21,14 @@ declare var o: { fn(arg0: boolean, arg1: boolean, arg2: boolean): void; }; declare var pfn: Promise<{ (arg0: boolean, arg1: boolean, arg2: boolean): void; }>; >pfn : Symbol(pfn, Decl(awaitCallExpression7_es6.ts, 4, 11)) ->Promise : Symbol(Promise, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) >arg0 : Symbol(arg0, Decl(awaitCallExpression7_es6.ts, 4, 28)) >arg1 : Symbol(arg1, Decl(awaitCallExpression7_es6.ts, 4, 42)) >arg2 : Symbol(arg2, Decl(awaitCallExpression7_es6.ts, 4, 57)) declare var po: Promise<{ fn(arg0: boolean, arg1: boolean, arg2: boolean): void; }>; >po : Symbol(po, Decl(awaitCallExpression7_es6.ts, 5, 11)) ->Promise : Symbol(Promise, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) >fn : Symbol(fn, Decl(awaitCallExpression7_es6.ts, 5, 25)) >arg0 : Symbol(arg0, Decl(awaitCallExpression7_es6.ts, 5, 29)) >arg1 : Symbol(arg1, Decl(awaitCallExpression7_es6.ts, 5, 43)) @@ -36,7 +36,7 @@ declare var po: Promise<{ fn(arg0: boolean, arg1: boolean, arg2: boolean): void; async function func(): Promise { >func : Symbol(func, Decl(awaitCallExpression7_es6.ts, 5, 84)) ->Promise : Symbol(Promise, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) "before"; var b = o.fn(a, await p, a); diff --git a/tests/baselines/reference/awaitCallExpression8_es6.symbols b/tests/baselines/reference/awaitCallExpression8_es6.symbols index d2d4fa2264d..9f4df1046f4 100644 --- a/tests/baselines/reference/awaitCallExpression8_es6.symbols +++ b/tests/baselines/reference/awaitCallExpression8_es6.symbols @@ -4,7 +4,7 @@ declare var a: boolean; declare var p: Promise; >p : Symbol(p, Decl(awaitCallExpression8_es6.ts, 1, 11)) ->Promise : Symbol(Promise, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) declare function fn(arg0: boolean, arg1: boolean, arg2: boolean): void; >fn : Symbol(fn, Decl(awaitCallExpression8_es6.ts, 1, 32)) @@ -21,14 +21,14 @@ declare var o: { fn(arg0: boolean, arg1: boolean, arg2: boolean): void; }; declare var pfn: Promise<{ (arg0: boolean, arg1: boolean, arg2: boolean): void; }>; >pfn : Symbol(pfn, Decl(awaitCallExpression8_es6.ts, 4, 11)) ->Promise : Symbol(Promise, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) >arg0 : Symbol(arg0, Decl(awaitCallExpression8_es6.ts, 4, 28)) >arg1 : Symbol(arg1, Decl(awaitCallExpression8_es6.ts, 4, 42)) >arg2 : Symbol(arg2, Decl(awaitCallExpression8_es6.ts, 4, 57)) declare var po: Promise<{ fn(arg0: boolean, arg1: boolean, arg2: boolean): void; }>; >po : Symbol(po, Decl(awaitCallExpression8_es6.ts, 5, 11)) ->Promise : Symbol(Promise, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) >fn : Symbol(fn, Decl(awaitCallExpression8_es6.ts, 5, 25)) >arg0 : Symbol(arg0, Decl(awaitCallExpression8_es6.ts, 5, 29)) >arg1 : Symbol(arg1, Decl(awaitCallExpression8_es6.ts, 5, 43)) @@ -36,7 +36,7 @@ declare var po: Promise<{ fn(arg0: boolean, arg1: boolean, arg2: boolean): void; async function func(): Promise { >func : Symbol(func, Decl(awaitCallExpression8_es6.ts, 5, 84)) ->Promise : Symbol(Promise, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) "before"; var b = (await po).fn(a, a, a); diff --git a/tests/baselines/reference/awaitUnion_es6.symbols b/tests/baselines/reference/awaitUnion_es6.symbols index 48524c4526d..98a229c4148 100644 --- a/tests/baselines/reference/awaitUnion_es6.symbols +++ b/tests/baselines/reference/awaitUnion_es6.symbols @@ -4,20 +4,20 @@ declare let a: number | string; declare let b: PromiseLike | PromiseLike; >b : Symbol(b, Decl(awaitUnion_es6.ts, 1, 11)) ->PromiseLike : Symbol(PromiseLike, Decl(lib.d.ts, --, --)) ->PromiseLike : Symbol(PromiseLike, Decl(lib.d.ts, --, --)) +>PromiseLike : Symbol(PromiseLike, Decl(lib.es5.d.ts, --, --)) +>PromiseLike : Symbol(PromiseLike, Decl(lib.es5.d.ts, --, --)) declare let c: PromiseLike; >c : Symbol(c, Decl(awaitUnion_es6.ts, 2, 11)) ->PromiseLike : Symbol(PromiseLike, Decl(lib.d.ts, --, --)) +>PromiseLike : Symbol(PromiseLike, Decl(lib.es5.d.ts, --, --)) declare let d: number | PromiseLike; >d : Symbol(d, Decl(awaitUnion_es6.ts, 3, 11)) ->PromiseLike : Symbol(PromiseLike, Decl(lib.d.ts, --, --)) +>PromiseLike : Symbol(PromiseLike, Decl(lib.es5.d.ts, --, --)) declare let e: number | PromiseLike; >e : Symbol(e, Decl(awaitUnion_es6.ts, 4, 11)) ->PromiseLike : Symbol(PromiseLike, Decl(lib.d.ts, --, --)) +>PromiseLike : Symbol(PromiseLike, Decl(lib.es5.d.ts, --, --)) async function f() { >f : Symbol(f, Decl(awaitUnion_es6.ts, 4, 53)) diff --git a/tests/baselines/reference/blockScopedFunctionDeclarationES5.js b/tests/baselines/reference/blockScopedFunctionDeclarationES5.js new file mode 100644 index 00000000000..066dd07351c --- /dev/null +++ b/tests/baselines/reference/blockScopedFunctionDeclarationES5.js @@ -0,0 +1,13 @@ +//// [blockScopedFunctionDeclarationES5.ts] +if (true) { + function foo() { } + foo(); +} +foo(); + +//// [blockScopedFunctionDeclarationES5.js] +if (true) { + function foo() { } + foo(); +} +foo(); diff --git a/tests/baselines/reference/blockScopedFunctionDeclarationES5.symbols b/tests/baselines/reference/blockScopedFunctionDeclarationES5.symbols new file mode 100644 index 00000000000..5c8f82cf0ff --- /dev/null +++ b/tests/baselines/reference/blockScopedFunctionDeclarationES5.symbols @@ -0,0 +1,11 @@ +=== tests/cases/compiler/blockScopedFunctionDeclarationES5.ts === +if (true) { + function foo() { } +>foo : Symbol(foo, Decl(blockScopedFunctionDeclarationES5.ts, 0, 11)) + + foo(); +>foo : Symbol(foo, Decl(blockScopedFunctionDeclarationES5.ts, 0, 11)) +} +foo(); +>foo : Symbol(foo, Decl(blockScopedFunctionDeclarationES5.ts, 0, 11)) + diff --git a/tests/baselines/reference/blockScopedFunctionDeclarationES5.types b/tests/baselines/reference/blockScopedFunctionDeclarationES5.types new file mode 100644 index 00000000000..b3c4d9b7d73 --- /dev/null +++ b/tests/baselines/reference/blockScopedFunctionDeclarationES5.types @@ -0,0 +1,15 @@ +=== tests/cases/compiler/blockScopedFunctionDeclarationES5.ts === +if (true) { +>true : boolean + + function foo() { } +>foo : () => void + + foo(); +>foo() : void +>foo : () => void +} +foo(); +>foo() : void +>foo : () => void + diff --git a/tests/baselines/reference/blockScopedFunctionDeclarationES6.js b/tests/baselines/reference/blockScopedFunctionDeclarationES6.js new file mode 100644 index 00000000000..32450cd66f1 --- /dev/null +++ b/tests/baselines/reference/blockScopedFunctionDeclarationES6.js @@ -0,0 +1,13 @@ +//// [blockScopedFunctionDeclarationES6.ts] +if (true) { + function foo() { } + foo(); +} +foo(); + +//// [blockScopedFunctionDeclarationES6.js] +if (true) { + function foo() { } + foo(); +} +foo(); diff --git a/tests/baselines/reference/blockScopedFunctionDeclarationES6.symbols b/tests/baselines/reference/blockScopedFunctionDeclarationES6.symbols new file mode 100644 index 00000000000..65fb133b446 --- /dev/null +++ b/tests/baselines/reference/blockScopedFunctionDeclarationES6.symbols @@ -0,0 +1,11 @@ +=== tests/cases/compiler/blockScopedFunctionDeclarationES6.ts === +if (true) { + function foo() { } +>foo : Symbol(foo, Decl(blockScopedFunctionDeclarationES6.ts, 0, 11)) + + foo(); +>foo : Symbol(foo, Decl(blockScopedFunctionDeclarationES6.ts, 0, 11)) +} +foo(); +>foo : Symbol(foo, Decl(blockScopedFunctionDeclarationES6.ts, 0, 11)) + diff --git a/tests/baselines/reference/blockScopedFunctionDeclarationES6.types b/tests/baselines/reference/blockScopedFunctionDeclarationES6.types new file mode 100644 index 00000000000..7ab74feb0ed --- /dev/null +++ b/tests/baselines/reference/blockScopedFunctionDeclarationES6.types @@ -0,0 +1,15 @@ +=== tests/cases/compiler/blockScopedFunctionDeclarationES6.ts === +if (true) { +>true : boolean + + function foo() { } +>foo : () => void + + foo(); +>foo() : void +>foo : () => void +} +foo(); +>foo() : void +>foo : () => void + diff --git a/tests/baselines/reference/blockScopedFunctionDeclarationInStrictClass.errors.txt b/tests/baselines/reference/blockScopedFunctionDeclarationInStrictClass.errors.txt new file mode 100644 index 00000000000..efedfd097a6 --- /dev/null +++ b/tests/baselines/reference/blockScopedFunctionDeclarationInStrictClass.errors.txt @@ -0,0 +1,18 @@ +tests/cases/compiler/blockScopedFunctionDeclarationInStrictClass.ts(4,22): error TS1251: Function declarations are not allowed inside blocks in strict mode when targeting 'ES3' or 'ES5'. Class definitions are automatically in strict mode. +tests/cases/compiler/blockScopedFunctionDeclarationInStrictClass.ts(7,9): error TS2304: Cannot find name 'foo'. + + +==== tests/cases/compiler/blockScopedFunctionDeclarationInStrictClass.ts (2 errors) ==== + class c { + method() { + if (true) { + function foo() { } + ~~~ +!!! error TS1251: Function declarations are not allowed inside blocks in strict mode when targeting 'ES3' or 'ES5'. Class definitions are automatically in strict mode. + foo(); // ok + } + foo(); // not ok + ~~~ +!!! error TS2304: Cannot find name 'foo'. + } + } \ No newline at end of file diff --git a/tests/baselines/reference/blockScopedFunctionDeclarationInStrictClass.js b/tests/baselines/reference/blockScopedFunctionDeclarationInStrictClass.js new file mode 100644 index 00000000000..70a00a95a41 --- /dev/null +++ b/tests/baselines/reference/blockScopedFunctionDeclarationInStrictClass.js @@ -0,0 +1,24 @@ +//// [blockScopedFunctionDeclarationInStrictClass.ts] +class c { + method() { + if (true) { + function foo() { } + foo(); // ok + } + foo(); // not ok + } +} + +//// [blockScopedFunctionDeclarationInStrictClass.js] +var c = (function () { + function c() { + } + c.prototype.method = function () { + if (true) { + function foo() { } + foo(); // ok + } + foo(); // not ok + }; + return c; +}()); diff --git a/tests/baselines/reference/blockScopedFunctionDeclarationInStrictModule.errors.txt b/tests/baselines/reference/blockScopedFunctionDeclarationInStrictModule.errors.txt new file mode 100644 index 00000000000..3f53ef24b58 --- /dev/null +++ b/tests/baselines/reference/blockScopedFunctionDeclarationInStrictModule.errors.txt @@ -0,0 +1,15 @@ +tests/cases/compiler/blockScopedFunctionDeclarationInStrictModule.ts(2,14): error TS1252: Function declarations are not allowed inside blocks in strict mode when targeting 'ES3' or 'ES5'. Modules are automatically in strict mode. +tests/cases/compiler/blockScopedFunctionDeclarationInStrictModule.ts(6,10): error TS2304: Cannot find name 'foo'. + + +==== tests/cases/compiler/blockScopedFunctionDeclarationInStrictModule.ts (2 errors) ==== + if (true) { + function foo() { } + ~~~ +!!! error TS1252: Function declarations are not allowed inside blocks in strict mode when targeting 'ES3' or 'ES5'. Modules are automatically in strict mode. + foo(); // ok + } + + export = foo; // not ok + ~~~ +!!! error TS2304: Cannot find name 'foo'. \ No newline at end of file diff --git a/tests/baselines/reference/blockScopedFunctionDeclarationInStrictModule.js b/tests/baselines/reference/blockScopedFunctionDeclarationInStrictModule.js new file mode 100644 index 00000000000..cd118733e3c --- /dev/null +++ b/tests/baselines/reference/blockScopedFunctionDeclarationInStrictModule.js @@ -0,0 +1,16 @@ +//// [blockScopedFunctionDeclarationInStrictModule.ts] +if (true) { + function foo() { } + foo(); // ok +} + +export = foo; // not ok + +//// [blockScopedFunctionDeclarationInStrictModule.js] +define(["require", "exports"], function (require, exports) { + "use strict"; + if (true) { + function foo() { } + foo(); // ok + } +}); diff --git a/tests/baselines/reference/blockScopedFunctionDeclarationStrictES5.errors.txt b/tests/baselines/reference/blockScopedFunctionDeclarationStrictES5.errors.txt new file mode 100644 index 00000000000..f945d0eacbf --- /dev/null +++ b/tests/baselines/reference/blockScopedFunctionDeclarationStrictES5.errors.txt @@ -0,0 +1,15 @@ +tests/cases/compiler/blockScopedFunctionDeclarationStrictES5.ts(3,14): error TS1250: Function declarations are not allowed inside blocks in strict mode when targeting 'ES3' or 'ES5'. +tests/cases/compiler/blockScopedFunctionDeclarationStrictES5.ts(6,1): error TS2304: Cannot find name 'foo'. + + +==== tests/cases/compiler/blockScopedFunctionDeclarationStrictES5.ts (2 errors) ==== + "use strict"; + if (true) { + function foo() { } // Error to declare function in block scope + ~~~ +!!! error TS1250: Function declarations are not allowed inside blocks in strict mode when targeting 'ES3' or 'ES5'. + foo(); // This call should be ok + } + foo(); // Error to find name foo + ~~~ +!!! error TS2304: Cannot find name 'foo'. \ No newline at end of file diff --git a/tests/baselines/reference/blockScopedFunctionDeclarationStrictES5.js b/tests/baselines/reference/blockScopedFunctionDeclarationStrictES5.js new file mode 100644 index 00000000000..f0926cadf39 --- /dev/null +++ b/tests/baselines/reference/blockScopedFunctionDeclarationStrictES5.js @@ -0,0 +1,15 @@ +//// [blockScopedFunctionDeclarationStrictES5.ts] +"use strict"; +if (true) { + function foo() { } // Error to declare function in block scope + foo(); // This call should be ok +} +foo(); // Error to find name foo + +//// [blockScopedFunctionDeclarationStrictES5.js] +"use strict"; +if (true) { + function foo() { } // Error to declare function in block scope + foo(); // This call should be ok +} +foo(); // Error to find name foo diff --git a/tests/baselines/reference/blockScopedFunctionDeclarationStrictES6.errors.txt b/tests/baselines/reference/blockScopedFunctionDeclarationStrictES6.errors.txt new file mode 100644 index 00000000000..6772a29926b --- /dev/null +++ b/tests/baselines/reference/blockScopedFunctionDeclarationStrictES6.errors.txt @@ -0,0 +1,12 @@ +tests/cases/compiler/blockScopedFunctionDeclarationStrictES6.ts(6,1): error TS2304: Cannot find name 'foo'. + + +==== tests/cases/compiler/blockScopedFunctionDeclarationStrictES6.ts (1 errors) ==== + "use strict"; + if (true) { + function foo() { } // Allowed to declare block scope function + foo(); // This call should be ok + } + foo(); // Cannot find name since foo is block scoped + ~~~ +!!! error TS2304: Cannot find name 'foo'. \ No newline at end of file diff --git a/tests/baselines/reference/blockScopedFunctionDeclarationStrictES6.js b/tests/baselines/reference/blockScopedFunctionDeclarationStrictES6.js new file mode 100644 index 00000000000..0a1b263875b --- /dev/null +++ b/tests/baselines/reference/blockScopedFunctionDeclarationStrictES6.js @@ -0,0 +1,15 @@ +//// [blockScopedFunctionDeclarationStrictES6.ts] +"use strict"; +if (true) { + function foo() { } // Allowed to declare block scope function + foo(); // This call should be ok +} +foo(); // Cannot find name since foo is block scoped + +//// [blockScopedFunctionDeclarationStrictES6.js] +"use strict"; +if (true) { + function foo() { } // Allowed to declare block scope function + foo(); // This call should be ok +} +foo(); // Cannot find name since foo is block scoped diff --git a/tests/baselines/reference/blockScopedSameNameFunctionDeclarationES5.errors.txt b/tests/baselines/reference/blockScopedSameNameFunctionDeclarationES5.errors.txt new file mode 100644 index 00000000000..3efa85d1cc7 --- /dev/null +++ b/tests/baselines/reference/blockScopedSameNameFunctionDeclarationES5.errors.txt @@ -0,0 +1,37 @@ +tests/cases/compiler/blockScopedSameNameFunctionDeclarationES5.ts(3,18): error TS2393: Duplicate function implementation. +tests/cases/compiler/blockScopedSameNameFunctionDeclarationES5.ts(5,9): error TS2346: Supplied parameters do not match any signature of call target. +tests/cases/compiler/blockScopedSameNameFunctionDeclarationES5.ts(8,18): error TS2393: Duplicate function implementation. +tests/cases/compiler/blockScopedSameNameFunctionDeclarationES5.ts(10,9): error TS2346: Supplied parameters do not match any signature of call target. +tests/cases/compiler/blockScopedSameNameFunctionDeclarationES5.ts(12,5): error TS2346: Supplied parameters do not match any signature of call target. +tests/cases/compiler/blockScopedSameNameFunctionDeclarationES5.ts(16,1): error TS2346: Supplied parameters do not match any signature of call target. + + +==== tests/cases/compiler/blockScopedSameNameFunctionDeclarationES5.ts (6 errors) ==== + function foo(a: number) { + if (a === 1) { + function foo() { } // duplicate function + ~~~ +!!! error TS2393: Duplicate function implementation. + foo(); + foo(10); // not ok + ~~~~~~~ +!!! error TS2346: Supplied parameters do not match any signature of call target. + } + else { + function foo() { } // duplicate function + ~~~ +!!! error TS2393: Duplicate function implementation. + foo(); + foo(10); // not ok + ~~~~~~~ +!!! error TS2346: Supplied parameters do not match any signature of call target. + } + foo(10); // not ok + ~~~~~~~ +!!! error TS2346: Supplied parameters do not match any signature of call target. + foo(); + } + foo(10); + foo(); // not ok - needs number + ~~~~~ +!!! error TS2346: Supplied parameters do not match any signature of call target. \ No newline at end of file diff --git a/tests/baselines/reference/blockScopedSameNameFunctionDeclarationES5.js b/tests/baselines/reference/blockScopedSameNameFunctionDeclarationES5.js new file mode 100644 index 00000000000..4c7721f9b43 --- /dev/null +++ b/tests/baselines/reference/blockScopedSameNameFunctionDeclarationES5.js @@ -0,0 +1,35 @@ +//// [blockScopedSameNameFunctionDeclarationES5.ts] +function foo(a: number) { + if (a === 1) { + function foo() { } // duplicate function + foo(); + foo(10); // not ok + } + else { + function foo() { } // duplicate function + foo(); + foo(10); // not ok + } + foo(10); // not ok + foo(); +} +foo(10); +foo(); // not ok - needs number + +//// [blockScopedSameNameFunctionDeclarationES5.js] +function foo(a) { + if (a === 1) { + function foo() { } // duplicate function + foo(); + foo(10); // not ok + } + else { + function foo() { } // duplicate function + foo(); + foo(10); // not ok + } + foo(10); // not ok + foo(); +} +foo(10); +foo(); // not ok - needs number diff --git a/tests/baselines/reference/blockScopedSameNameFunctionDeclarationES6.errors.txt b/tests/baselines/reference/blockScopedSameNameFunctionDeclarationES6.errors.txt new file mode 100644 index 00000000000..5d15278f098 --- /dev/null +++ b/tests/baselines/reference/blockScopedSameNameFunctionDeclarationES6.errors.txt @@ -0,0 +1,37 @@ +tests/cases/compiler/blockScopedSameNameFunctionDeclarationES6.ts(3,18): error TS2393: Duplicate function implementation. +tests/cases/compiler/blockScopedSameNameFunctionDeclarationES6.ts(5,9): error TS2346: Supplied parameters do not match any signature of call target. +tests/cases/compiler/blockScopedSameNameFunctionDeclarationES6.ts(8,18): error TS2393: Duplicate function implementation. +tests/cases/compiler/blockScopedSameNameFunctionDeclarationES6.ts(10,9): error TS2346: Supplied parameters do not match any signature of call target. +tests/cases/compiler/blockScopedSameNameFunctionDeclarationES6.ts(12,5): error TS2346: Supplied parameters do not match any signature of call target. +tests/cases/compiler/blockScopedSameNameFunctionDeclarationES6.ts(16,1): error TS2346: Supplied parameters do not match any signature of call target. + + +==== tests/cases/compiler/blockScopedSameNameFunctionDeclarationES6.ts (6 errors) ==== + function foo(a: number) { + if (a === 10) { + function foo() { } // duplicate + ~~~ +!!! error TS2393: Duplicate function implementation. + foo(); + foo(10); // not ok + ~~~~~~~ +!!! error TS2346: Supplied parameters do not match any signature of call target. + } + else { + function foo() { } // duplicate + ~~~ +!!! error TS2393: Duplicate function implementation. + foo(); + foo(10);// not ok + ~~~~~~~ +!!! error TS2346: Supplied parameters do not match any signature of call target. + } + foo(10); // not ok + ~~~~~~~ +!!! error TS2346: Supplied parameters do not match any signature of call target. + foo(); + } + foo(10); + foo(); // not ok - needs number + ~~~~~ +!!! error TS2346: Supplied parameters do not match any signature of call target. \ No newline at end of file diff --git a/tests/baselines/reference/blockScopedSameNameFunctionDeclarationES6.js b/tests/baselines/reference/blockScopedSameNameFunctionDeclarationES6.js new file mode 100644 index 00000000000..c793b74c60a --- /dev/null +++ b/tests/baselines/reference/blockScopedSameNameFunctionDeclarationES6.js @@ -0,0 +1,35 @@ +//// [blockScopedSameNameFunctionDeclarationES6.ts] +function foo(a: number) { + if (a === 10) { + function foo() { } // duplicate + foo(); + foo(10); // not ok + } + else { + function foo() { } // duplicate + foo(); + foo(10);// not ok + } + foo(10); // not ok + foo(); +} +foo(10); +foo(); // not ok - needs number + +//// [blockScopedSameNameFunctionDeclarationES6.js] +function foo(a) { + if (a === 10) { + function foo() { } // duplicate + foo(); + foo(10); // not ok + } + else { + function foo() { } // duplicate + foo(); + foo(10); // not ok + } + foo(10); // not ok + foo(); +} +foo(10); +foo(); // not ok - needs number diff --git a/tests/baselines/reference/blockScopedSameNameFunctionDeclarationStrictES5.errors.txt b/tests/baselines/reference/blockScopedSameNameFunctionDeclarationStrictES5.errors.txt new file mode 100644 index 00000000000..36ce2d8c488 --- /dev/null +++ b/tests/baselines/reference/blockScopedSameNameFunctionDeclarationStrictES5.errors.txt @@ -0,0 +1,38 @@ +tests/cases/compiler/blockScopedSameNameFunctionDeclarationStrictES5.ts(4,18): error TS1250: Function declarations are not allowed inside blocks in strict mode when targeting 'ES3' or 'ES5'. +tests/cases/compiler/blockScopedSameNameFunctionDeclarationStrictES5.ts(6,9): error TS2346: Supplied parameters do not match any signature of call target. +tests/cases/compiler/blockScopedSameNameFunctionDeclarationStrictES5.ts(9,18): error TS1250: Function declarations are not allowed inside blocks in strict mode when targeting 'ES3' or 'ES5'. +tests/cases/compiler/blockScopedSameNameFunctionDeclarationStrictES5.ts(11,9): error TS2346: Supplied parameters do not match any signature of call target. +tests/cases/compiler/blockScopedSameNameFunctionDeclarationStrictES5.ts(14,5): error TS2346: Supplied parameters do not match any signature of call target. +tests/cases/compiler/blockScopedSameNameFunctionDeclarationStrictES5.ts(17,1): error TS2346: Supplied parameters do not match any signature of call target. + + +==== tests/cases/compiler/blockScopedSameNameFunctionDeclarationStrictES5.ts (6 errors) ==== + "use strict"; + function foo(a: number) { + if (a === 1) { + function foo() { } // Error to declare function in block scope + ~~~ +!!! error TS1250: Function declarations are not allowed inside blocks in strict mode when targeting 'ES3' or 'ES5'. + foo(); + foo(10); // not ok + ~~~~~~~ +!!! error TS2346: Supplied parameters do not match any signature of call target. + } + else { + function foo() { } // Error to declare function in block scope + ~~~ +!!! error TS1250: Function declarations are not allowed inside blocks in strict mode when targeting 'ES3' or 'ES5'. + foo(); + foo(10); // not ok + ~~~~~~~ +!!! error TS2346: Supplied parameters do not match any signature of call target. + } + foo(10); + foo(); // not ok - needs number + ~~~~~ +!!! error TS2346: Supplied parameters do not match any signature of call target. + } + foo(10); + foo(); // not ok - needs number + ~~~~~ +!!! error TS2346: Supplied parameters do not match any signature of call target. \ No newline at end of file diff --git a/tests/baselines/reference/blockScopedSameNameFunctionDeclarationStrictES5.js b/tests/baselines/reference/blockScopedSameNameFunctionDeclarationStrictES5.js new file mode 100644 index 00000000000..b51be0493cd --- /dev/null +++ b/tests/baselines/reference/blockScopedSameNameFunctionDeclarationStrictES5.js @@ -0,0 +1,37 @@ +//// [blockScopedSameNameFunctionDeclarationStrictES5.ts] +"use strict"; +function foo(a: number) { + if (a === 1) { + function foo() { } // Error to declare function in block scope + foo(); + foo(10); // not ok + } + else { + function foo() { } // Error to declare function in block scope + foo(); + foo(10); // not ok + } + foo(10); + foo(); // not ok - needs number +} +foo(10); +foo(); // not ok - needs number + +//// [blockScopedSameNameFunctionDeclarationStrictES5.js] +"use strict"; +function foo(a) { + if (a === 1) { + function foo() { } // Error to declare function in block scope + foo(); + foo(10); // not ok + } + else { + function foo() { } // Error to declare function in block scope + foo(); + foo(10); // not ok + } + foo(10); + foo(); // not ok - needs number +} +foo(10); +foo(); // not ok - needs number diff --git a/tests/baselines/reference/blockScopedSameNameFunctionDeclarationStrictES6.errors.txt b/tests/baselines/reference/blockScopedSameNameFunctionDeclarationStrictES6.errors.txt new file mode 100644 index 00000000000..7b8834c5594 --- /dev/null +++ b/tests/baselines/reference/blockScopedSameNameFunctionDeclarationStrictES6.errors.txt @@ -0,0 +1,32 @@ +tests/cases/compiler/blockScopedSameNameFunctionDeclarationStrictES6.ts(6,9): error TS2346: Supplied parameters do not match any signature of call target. +tests/cases/compiler/blockScopedSameNameFunctionDeclarationStrictES6.ts(11,9): error TS2346: Supplied parameters do not match any signature of call target. +tests/cases/compiler/blockScopedSameNameFunctionDeclarationStrictES6.ts(14,5): error TS2346: Supplied parameters do not match any signature of call target. +tests/cases/compiler/blockScopedSameNameFunctionDeclarationStrictES6.ts(17,1): error TS2346: Supplied parameters do not match any signature of call target. + + +==== tests/cases/compiler/blockScopedSameNameFunctionDeclarationStrictES6.ts (4 errors) ==== + "use strict"; + function foo(a: number) { + if (a === 10) { + function foo() { } + foo(); + foo(10); // not ok + ~~~~~~~ +!!! error TS2346: Supplied parameters do not match any signature of call target. + } + else { + function foo() { } + foo(); + foo(10); // not ok + ~~~~~~~ +!!! error TS2346: Supplied parameters do not match any signature of call target. + } + foo(10); + foo(); // not ok + ~~~~~ +!!! error TS2346: Supplied parameters do not match any signature of call target. + } + foo(10); + foo(); // not ok - needs number + ~~~~~ +!!! error TS2346: Supplied parameters do not match any signature of call target. \ No newline at end of file diff --git a/tests/baselines/reference/blockScopedSameNameFunctionDeclarationStrictES6.js b/tests/baselines/reference/blockScopedSameNameFunctionDeclarationStrictES6.js new file mode 100644 index 00000000000..863df86c031 --- /dev/null +++ b/tests/baselines/reference/blockScopedSameNameFunctionDeclarationStrictES6.js @@ -0,0 +1,37 @@ +//// [blockScopedSameNameFunctionDeclarationStrictES6.ts] +"use strict"; +function foo(a: number) { + if (a === 10) { + function foo() { } + foo(); + foo(10); // not ok + } + else { + function foo() { } + foo(); + foo(10); // not ok + } + foo(10); + foo(); // not ok +} +foo(10); +foo(); // not ok - needs number + +//// [blockScopedSameNameFunctionDeclarationStrictES6.js] +"use strict"; +function foo(a) { + if (a === 10) { + function foo() { } + foo(); + foo(10); // not ok + } + else { + function foo() { } + foo(); + foo(10); // not ok + } + foo(10); + foo(); // not ok +} +foo(10); +foo(); // not ok - needs number diff --git a/tests/baselines/reference/callSignatureAssignabilityInInheritance2.symbols b/tests/baselines/reference/callSignatureAssignabilityInInheritance2.symbols index f0fbcce4bf1..f1fa53d7b6c 100644 --- a/tests/baselines/reference/callSignatureAssignabilityInInheritance2.symbols +++ b/tests/baselines/reference/callSignatureAssignabilityInInheritance2.symbols @@ -195,8 +195,8 @@ interface A { // T (a: Date): Date; >a : Symbol(a, Decl(callSignatureAssignabilityInInheritance2.ts, 42, 13)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) }): any[]; }; diff --git a/tests/baselines/reference/callWithSpreadES6.symbols b/tests/baselines/reference/callWithSpreadES6.symbols index 7b6216764ce..518b04162b2 100644 --- a/tests/baselines/reference/callWithSpreadES6.symbols +++ b/tests/baselines/reference/callWithSpreadES6.symbols @@ -94,7 +94,7 @@ xa[1].foo(1, 2, ...a, "abc"); >a : Symbol(a, Decl(callWithSpreadES6.ts, 8, 3)) (xa[1].foo)(...[1, 2, "abc"]); ->Function : Symbol(Function, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Function : Symbol(Function, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --)) >xa[1].foo : Symbol(X.foo, Decl(callWithSpreadES6.ts, 1, 13)) >xa : Symbol(xa, Decl(callWithSpreadES6.ts, 11, 3)) >foo : Symbol(X.foo, Decl(callWithSpreadES6.ts, 1, 13)) diff --git a/tests/baselines/reference/capturedLetConstInLoop2_ES6.symbols b/tests/baselines/reference/capturedLetConstInLoop2_ES6.symbols index 32812c89370..0dd74bc4b25 100644 --- a/tests/baselines/reference/capturedLetConstInLoop2_ES6.symbols +++ b/tests/baselines/reference/capturedLetConstInLoop2_ES6.symbols @@ -10,9 +10,9 @@ function foo0(x) { let a = arguments.length; >a : Symbol(a, Decl(capturedLetConstInLoop2_ES6.ts, 4, 11)) ->arguments.length : Symbol(IArguments.length, Decl(lib.d.ts, --, --)) +>arguments.length : Symbol(IArguments.length, Decl(lib.es5.d.ts, --, --)) >arguments : Symbol(arguments) ->length : Symbol(IArguments.length, Decl(lib.d.ts, --, --)) +>length : Symbol(IArguments.length, Decl(lib.es5.d.ts, --, --)) (function() { return x + a }); >x : Symbol(x, Decl(capturedLetConstInLoop2_ES6.ts, 3, 12)) @@ -33,9 +33,9 @@ function foo0_1(x) { let a = arguments.length; >a : Symbol(a, Decl(capturedLetConstInLoop2_ES6.ts, 12, 11)) ->arguments.length : Symbol(IArguments.length, Decl(lib.d.ts, --, --)) +>arguments.length : Symbol(IArguments.length, Decl(lib.es5.d.ts, --, --)) >arguments : Symbol(arguments) ->length : Symbol(IArguments.length, Decl(lib.d.ts, --, --)) +>length : Symbol(IArguments.length, Decl(lib.es5.d.ts, --, --)) (function() { return x + a }); >x : Symbol(x, Decl(capturedLetConstInLoop2_ES6.ts, 11, 12)) @@ -58,9 +58,9 @@ function foo1(x) { let a = arguments.length; >a : Symbol(a, Decl(capturedLetConstInLoop2_ES6.ts, 20, 11)) ->arguments.length : Symbol(IArguments.length, Decl(lib.d.ts, --, --)) +>arguments.length : Symbol(IArguments.length, Decl(lib.es5.d.ts, --, --)) >arguments : Symbol(arguments) ->length : Symbol(IArguments.length, Decl(lib.d.ts, --, --)) +>length : Symbol(IArguments.length, Decl(lib.es5.d.ts, --, --)) (function() { return x + a }); >x : Symbol(x, Decl(capturedLetConstInLoop2_ES6.ts, 19, 12)) @@ -79,9 +79,9 @@ function foo2(x) { while (1 === 1) { let a = arguments.length; >a : Symbol(a, Decl(capturedLetConstInLoop2_ES6.ts, 28, 11)) ->arguments.length : Symbol(IArguments.length, Decl(lib.d.ts, --, --)) +>arguments.length : Symbol(IArguments.length, Decl(lib.es5.d.ts, --, --)) >arguments : Symbol(arguments) ->length : Symbol(IArguments.length, Decl(lib.d.ts, --, --)) +>length : Symbol(IArguments.length, Decl(lib.es5.d.ts, --, --)) (function() { return x + a }); >x : Symbol(x, Decl(capturedLetConstInLoop2_ES6.ts, 26, 14)) @@ -103,9 +103,9 @@ function foo3(x) { let a = arguments.length; >a : Symbol(a, Decl(capturedLetConstInLoop2_ES6.ts, 37, 11)) ->arguments.length : Symbol(IArguments.length, Decl(lib.d.ts, --, --)) +>arguments.length : Symbol(IArguments.length, Decl(lib.es5.d.ts, --, --)) >arguments : Symbol(arguments) ->length : Symbol(IArguments.length, Decl(lib.d.ts, --, --)) +>length : Symbol(IArguments.length, Decl(lib.es5.d.ts, --, --)) (function() { return x + a }); >x : Symbol(x, Decl(capturedLetConstInLoop2_ES6.ts, 36, 11)) @@ -129,9 +129,9 @@ function foo4(x) { let a = arguments.length; >a : Symbol(a, Decl(capturedLetConstInLoop2_ES6.ts, 45, 11)) ->arguments.length : Symbol(IArguments.length, Decl(lib.d.ts, --, --)) +>arguments.length : Symbol(IArguments.length, Decl(lib.es5.d.ts, --, --)) >arguments : Symbol(arguments) ->length : Symbol(IArguments.length, Decl(lib.d.ts, --, --)) +>length : Symbol(IArguments.length, Decl(lib.es5.d.ts, --, --)) let x = 1; >x : Symbol(x, Decl(capturedLetConstInLoop2_ES6.ts, 46, 11)) @@ -158,9 +158,9 @@ function foo5(x) { let a = arguments.length; >a : Symbol(a, Decl(capturedLetConstInLoop2_ES6.ts, 54, 11)) ->arguments.length : Symbol(IArguments.length, Decl(lib.d.ts, --, --)) +>arguments.length : Symbol(IArguments.length, Decl(lib.es5.d.ts, --, --)) >arguments : Symbol(arguments) ->length : Symbol(IArguments.length, Decl(lib.d.ts, --, --)) +>length : Symbol(IArguments.length, Decl(lib.es5.d.ts, --, --)) (function() { return x + y + a }); >x : Symbol(x, Decl(capturedLetConstInLoop2_ES6.ts, 53, 12)) @@ -186,9 +186,9 @@ function foo6(x) { let a = arguments.length; >a : Symbol(a, Decl(capturedLetConstInLoop2_ES6.ts, 64, 11)) ->arguments.length : Symbol(IArguments.length, Decl(lib.d.ts, --, --)) +>arguments.length : Symbol(IArguments.length, Decl(lib.es5.d.ts, --, --)) >arguments : Symbol(arguments) ->length : Symbol(IArguments.length, Decl(lib.d.ts, --, --)) +>length : Symbol(IArguments.length, Decl(lib.es5.d.ts, --, --)) (function() { return x + y + a }); >x : Symbol(x, Decl(capturedLetConstInLoop2_ES6.ts, 63, 11)) @@ -213,9 +213,9 @@ function foo7(x) { let a = arguments.length; >a : Symbol(a, Decl(capturedLetConstInLoop2_ES6.ts, 73, 11)) ->arguments.length : Symbol(IArguments.length, Decl(lib.d.ts, --, --)) +>arguments.length : Symbol(IArguments.length, Decl(lib.es5.d.ts, --, --)) >arguments : Symbol(arguments) ->length : Symbol(IArguments.length, Decl(lib.d.ts, --, --)) +>length : Symbol(IArguments.length, Decl(lib.es5.d.ts, --, --)) (function() { return x + y + a }); >x : Symbol(x, Decl(capturedLetConstInLoop2_ES6.ts, 72, 11)) @@ -245,9 +245,9 @@ function foo8(x) { let a = arguments.length; >a : Symbol(a, Decl(capturedLetConstInLoop2_ES6.ts, 83, 11)) ->arguments.length : Symbol(IArguments.length, Decl(lib.d.ts, --, --)) +>arguments.length : Symbol(IArguments.length, Decl(lib.es5.d.ts, --, --)) >arguments : Symbol(arguments) ->length : Symbol(IArguments.length, Decl(lib.d.ts, --, --)) +>length : Symbol(IArguments.length, Decl(lib.es5.d.ts, --, --)) (function() { return x + y + a }); >x : Symbol(x, Decl(capturedLetConstInLoop2_ES6.ts, 82, 11)) @@ -270,9 +270,9 @@ function foo0_c(x) { const a = arguments.length; >a : Symbol(a, Decl(capturedLetConstInLoop2_ES6.ts, 91, 13)) ->arguments.length : Symbol(IArguments.length, Decl(lib.d.ts, --, --)) +>arguments.length : Symbol(IArguments.length, Decl(lib.es5.d.ts, --, --)) >arguments : Symbol(arguments) ->length : Symbol(IArguments.length, Decl(lib.d.ts, --, --)) +>length : Symbol(IArguments.length, Decl(lib.es5.d.ts, --, --)) (function() { return x + a }); >x : Symbol(x, Decl(capturedLetConstInLoop2_ES6.ts, 90, 14)) @@ -293,9 +293,9 @@ function foo0_1_c(x) { const a = arguments.length; >a : Symbol(a, Decl(capturedLetConstInLoop2_ES6.ts, 99, 13)) ->arguments.length : Symbol(IArguments.length, Decl(lib.d.ts, --, --)) +>arguments.length : Symbol(IArguments.length, Decl(lib.es5.d.ts, --, --)) >arguments : Symbol(arguments) ->length : Symbol(IArguments.length, Decl(lib.d.ts, --, --)) +>length : Symbol(IArguments.length, Decl(lib.es5.d.ts, --, --)) (function() { return x + a }); >x : Symbol(x, Decl(capturedLetConstInLoop2_ES6.ts, 98, 14)) @@ -317,9 +317,9 @@ function foo1_c(x) { const a = arguments.length; >a : Symbol(a, Decl(capturedLetConstInLoop2_ES6.ts, 107, 13)) ->arguments.length : Symbol(IArguments.length, Decl(lib.d.ts, --, --)) +>arguments.length : Symbol(IArguments.length, Decl(lib.es5.d.ts, --, --)) >arguments : Symbol(arguments) ->length : Symbol(IArguments.length, Decl(lib.d.ts, --, --)) +>length : Symbol(IArguments.length, Decl(lib.es5.d.ts, --, --)) (function() { return x + a }); >x : Symbol(x, Decl(capturedLetConstInLoop2_ES6.ts, 106, 14)) @@ -338,9 +338,9 @@ function foo2_c(x) { while (1 === 1) { const a = arguments.length; >a : Symbol(a, Decl(capturedLetConstInLoop2_ES6.ts, 115, 13)) ->arguments.length : Symbol(IArguments.length, Decl(lib.d.ts, --, --)) +>arguments.length : Symbol(IArguments.length, Decl(lib.es5.d.ts, --, --)) >arguments : Symbol(arguments) ->length : Symbol(IArguments.length, Decl(lib.d.ts, --, --)) +>length : Symbol(IArguments.length, Decl(lib.es5.d.ts, --, --)) (function() { return x + a }); >x : Symbol(x, Decl(capturedLetConstInLoop2_ES6.ts, 113, 16)) @@ -362,9 +362,9 @@ function foo3_c(x) { const a = arguments.length; >a : Symbol(a, Decl(capturedLetConstInLoop2_ES6.ts, 124, 13)) ->arguments.length : Symbol(IArguments.length, Decl(lib.d.ts, --, --)) +>arguments.length : Symbol(IArguments.length, Decl(lib.es5.d.ts, --, --)) >arguments : Symbol(arguments) ->length : Symbol(IArguments.length, Decl(lib.d.ts, --, --)) +>length : Symbol(IArguments.length, Decl(lib.es5.d.ts, --, --)) (function() { return x + a }); >x : Symbol(x, Decl(capturedLetConstInLoop2_ES6.ts, 123, 13)) @@ -387,9 +387,9 @@ function foo4_c(x) { const a = arguments.length; >a : Symbol(a, Decl(capturedLetConstInLoop2_ES6.ts, 132, 13)) ->arguments.length : Symbol(IArguments.length, Decl(lib.d.ts, --, --)) +>arguments.length : Symbol(IArguments.length, Decl(lib.es5.d.ts, --, --)) >arguments : Symbol(arguments) ->length : Symbol(IArguments.length, Decl(lib.d.ts, --, --)) +>length : Symbol(IArguments.length, Decl(lib.es5.d.ts, --, --)) const x = 1; >x : Symbol(x, Decl(capturedLetConstInLoop2_ES6.ts, 133, 13)) @@ -415,9 +415,9 @@ function foo5_c(x) { const a = arguments.length; >a : Symbol(a, Decl(capturedLetConstInLoop2_ES6.ts, 141, 13)) ->arguments.length : Symbol(IArguments.length, Decl(lib.d.ts, --, --)) +>arguments.length : Symbol(IArguments.length, Decl(lib.es5.d.ts, --, --)) >arguments : Symbol(arguments) ->length : Symbol(IArguments.length, Decl(lib.d.ts, --, --)) +>length : Symbol(IArguments.length, Decl(lib.es5.d.ts, --, --)) (function() { return x + y + a }); >x : Symbol(x, Decl(capturedLetConstInLoop2_ES6.ts, 140, 14)) @@ -443,9 +443,9 @@ function foo6_c(x) { const a = arguments.length; >a : Symbol(a, Decl(capturedLetConstInLoop2_ES6.ts, 151, 13)) ->arguments.length : Symbol(IArguments.length, Decl(lib.d.ts, --, --)) +>arguments.length : Symbol(IArguments.length, Decl(lib.es5.d.ts, --, --)) >arguments : Symbol(arguments) ->length : Symbol(IArguments.length, Decl(lib.d.ts, --, --)) +>length : Symbol(IArguments.length, Decl(lib.es5.d.ts, --, --)) (function() { return x + y + a }); >x : Symbol(x, Decl(capturedLetConstInLoop2_ES6.ts, 150, 13)) @@ -470,9 +470,9 @@ function foo7_c(x) { const a = arguments.length; >a : Symbol(a, Decl(capturedLetConstInLoop2_ES6.ts, 160, 13)) ->arguments.length : Symbol(IArguments.length, Decl(lib.d.ts, --, --)) +>arguments.length : Symbol(IArguments.length, Decl(lib.es5.d.ts, --, --)) >arguments : Symbol(arguments) ->length : Symbol(IArguments.length, Decl(lib.d.ts, --, --)) +>length : Symbol(IArguments.length, Decl(lib.es5.d.ts, --, --)) (function() { return x + y + a }); >x : Symbol(x, Decl(capturedLetConstInLoop2_ES6.ts, 159, 13)) @@ -501,9 +501,9 @@ function foo8_c(x) { const a = arguments.length; >a : Symbol(a, Decl(capturedLetConstInLoop2_ES6.ts, 170, 13)) ->arguments.length : Symbol(IArguments.length, Decl(lib.d.ts, --, --)) +>arguments.length : Symbol(IArguments.length, Decl(lib.es5.d.ts, --, --)) >arguments : Symbol(arguments) ->length : Symbol(IArguments.length, Decl(lib.d.ts, --, --)) +>length : Symbol(IArguments.length, Decl(lib.es5.d.ts, --, --)) (function() { return x + y + a }); >x : Symbol(x, Decl(capturedLetConstInLoop2_ES6.ts, 169, 13)) diff --git a/tests/baselines/reference/capturedLetConstInLoop9_ES6.symbols b/tests/baselines/reference/capturedLetConstInLoop9_ES6.symbols index 2cab346a81e..c9b8fdb392c 100644 --- a/tests/baselines/reference/capturedLetConstInLoop9_ES6.symbols +++ b/tests/baselines/reference/capturedLetConstInLoop9_ES6.symbols @@ -127,9 +127,9 @@ function foo() { >z1 : Symbol(z1, Decl(capturedLetConstInLoop9_ES6.ts, 68, 21)) >x1 : Symbol(x1, Decl(capturedLetConstInLoop9_ES6.ts, 68, 33)) >y : Symbol(y, Decl(capturedLetConstInLoop9_ES6.ts, 68, 38)) ->arguments.length : Symbol(IArguments.length, Decl(lib.d.ts, --, --)) +>arguments.length : Symbol(IArguments.length, Decl(lib.es5.d.ts, --, --)) >arguments : Symbol(arguments) ->length : Symbol(IArguments.length, Decl(lib.d.ts, --, --)) +>length : Symbol(IArguments.length, Decl(lib.es5.d.ts, --, --)) if (b === 1) { >b : Symbol(b, Decl(capturedLetConstInLoop9_ES6.ts, 67, 16)) @@ -247,24 +247,24 @@ function foo3 () { let x = arguments.length; >x : Symbol(x, Decl(capturedLetConstInLoop9_ES6.ts, 132, 7)) ->arguments.length : Symbol(IArguments.length, Decl(lib.d.ts, --, --)) +>arguments.length : Symbol(IArguments.length, Decl(lib.es5.d.ts, --, --)) >arguments : Symbol(arguments) ->length : Symbol(IArguments.length, Decl(lib.d.ts, --, --)) +>length : Symbol(IArguments.length, Decl(lib.es5.d.ts, --, --)) for (let y of []) { >y : Symbol(y, Decl(capturedLetConstInLoop9_ES6.ts, 133, 12)) let z = arguments.length; >z : Symbol(z, Decl(capturedLetConstInLoop9_ES6.ts, 134, 11)) ->arguments.length : Symbol(IArguments.length, Decl(lib.d.ts, --, --)) +>arguments.length : Symbol(IArguments.length, Decl(lib.es5.d.ts, --, --)) >arguments : Symbol(arguments) ->length : Symbol(IArguments.length, Decl(lib.d.ts, --, --)) +>length : Symbol(IArguments.length, Decl(lib.es5.d.ts, --, --)) (function() { return y + z + arguments.length; }); >y : Symbol(y, Decl(capturedLetConstInLoop9_ES6.ts, 133, 12)) >z : Symbol(z, Decl(capturedLetConstInLoop9_ES6.ts, 134, 11)) ->arguments.length : Symbol(IArguments.length, Decl(lib.d.ts, --, --)) +>arguments.length : Symbol(IArguments.length, Decl(lib.es5.d.ts, --, --)) >arguments : Symbol(arguments) ->length : Symbol(IArguments.length, Decl(lib.d.ts, --, --)) +>length : Symbol(IArguments.length, Decl(lib.es5.d.ts, --, --)) } } diff --git a/tests/baselines/reference/castingTuple.errors.txt b/tests/baselines/reference/castingTuple.errors.txt index 128ee5b5bb4..6d5549c6bf2 100644 --- a/tests/baselines/reference/castingTuple.errors.txt +++ b/tests/baselines/reference/castingTuple.errors.txt @@ -1,9 +1,9 @@ -tests/cases/conformance/types/tuple/castingTuple.ts(28,10): error TS2352: Neither type '[number, string]' nor type '[number, number]' is assignable to the other. +tests/cases/conformance/types/tuple/castingTuple.ts(28,10): error TS2352: Type '[number, string]' cannot be converted to type '[number, number]'. Types of property '1' are incompatible. - Type 'string' is not assignable to type 'number'. -tests/cases/conformance/types/tuple/castingTuple.ts(29,10): error TS2352: Neither type '[C, D]' nor type '[A, I]' is assignable to the other. + Type 'string' is not comparable to type 'number'. +tests/cases/conformance/types/tuple/castingTuple.ts(29,10): error TS2352: Type '[C, D]' cannot be converted to type '[A, I]'. Types of property '0' are incompatible. - Type 'C' is not assignable to type 'A'. + Type 'C' is not comparable to type 'A'. Property 'a' is missing in type 'C'. tests/cases/conformance/types/tuple/castingTuple.ts(30,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'array1' must be of type '{}[]', but here has type 'number[]'. tests/cases/conformance/types/tuple/castingTuple.ts(31,1): error TS2304: Cannot find name 't4'. @@ -39,14 +39,14 @@ tests/cases/conformance/types/tuple/castingTuple.ts(31,1): error TS2304: Cannot // error var t3 = <[number, number]>numStrTuple; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2352: Neither type '[number, string]' nor type '[number, number]' is assignable to the other. +!!! error TS2352: Type '[number, string]' cannot be converted to type '[number, number]'. !!! error TS2352: Types of property '1' are incompatible. -!!! error TS2352: Type 'string' is not assignable to type 'number'. +!!! error TS2352: Type 'string' is not comparable to type 'number'. var t9 = <[A, I]>classCDTuple; ~~~~~~~~~~~~~~~~~~~~ -!!! error TS2352: Neither type '[C, D]' nor type '[A, I]' is assignable to the other. +!!! error TS2352: Type '[C, D]' cannot be converted to type '[A, I]'. !!! error TS2352: Types of property '0' are incompatible. -!!! error TS2352: Type 'C' is not assignable to type 'A'. +!!! error TS2352: Type 'C' is not comparable to type 'A'. !!! error TS2352: Property 'a' is missing in type 'C'. var array1 = numStrTuple; ~~~~~~ diff --git a/tests/baselines/reference/chainedAssignment2.symbols b/tests/baselines/reference/chainedAssignment2.symbols index 3335c3cbb43..0f37d41c3be 100644 --- a/tests/baselines/reference/chainedAssignment2.symbols +++ b/tests/baselines/reference/chainedAssignment2.symbols @@ -10,7 +10,7 @@ var c: boolean; var d: Date; >d : Symbol(d, Decl(chainedAssignment2.ts, 3, 3)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) var e: RegExp; >e : Symbol(e, Decl(chainedAssignment2.ts, 4, 3)) diff --git a/tests/baselines/reference/classExtendingBuiltinType.symbols b/tests/baselines/reference/classExtendingBuiltinType.symbols index 78f2195c8db..fb0814cc0f2 100644 --- a/tests/baselines/reference/classExtendingBuiltinType.symbols +++ b/tests/baselines/reference/classExtendingBuiltinType.symbols @@ -9,7 +9,7 @@ class C2 extends Function { } class C3 extends String { } >C3 : Symbol(C3, Decl(classExtendingBuiltinType.ts, 1, 29)) ->String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) class C4 extends Boolean { } >C4 : Symbol(C4, Decl(classExtendingBuiltinType.ts, 2, 27)) @@ -17,11 +17,11 @@ class C4 extends Boolean { } class C5 extends Number { } >C5 : Symbol(C5, Decl(classExtendingBuiltinType.ts, 3, 28)) ->Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) class C6 extends Date { } >C6 : Symbol(C6, Decl(classExtendingBuiltinType.ts, 4, 27)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) class C7 extends RegExp { } >C7 : Symbol(C7, Decl(classExtendingBuiltinType.ts, 5, 25)) diff --git a/tests/baselines/reference/commaOperatorWithSecondOperandObjectType.symbols b/tests/baselines/reference/commaOperatorWithSecondOperandObjectType.symbols index 19f69513354..6df26708078 100644 --- a/tests/baselines/reference/commaOperatorWithSecondOperandObjectType.symbols +++ b/tests/baselines/reference/commaOperatorWithSecondOperandObjectType.symbols @@ -82,7 +82,7 @@ true, {} >BOOLEAN : Symbol(BOOLEAN, Decl(commaOperatorWithSecondOperandObjectType.ts, 1, 3)) "string", new Date() ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) STRING.toLowerCase(), new CLASS() >STRING.toLowerCase : Symbol(String.toLowerCase, Decl(lib.d.ts, --, --)) @@ -110,7 +110,7 @@ var resultIsObject9 = (!BOOLEAN, { a: 1, b: "s" }); var resultIsObject10 = ("string", new Date()); >resultIsObject10 : Symbol(resultIsObject10, Decl(commaOperatorWithSecondOperandObjectType.ts, 36, 3)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) var resultIsObject11 = (STRING.toLowerCase(), new CLASS()); >resultIsObject11 : Symbol(resultIsObject11, Decl(commaOperatorWithSecondOperandObjectType.ts, 37, 3)) diff --git a/tests/baselines/reference/commaOperatorWithSecondOperandStringType.symbols b/tests/baselines/reference/commaOperatorWithSecondOperandStringType.symbols index 3c674237a21..2d9fc665a81 100644 --- a/tests/baselines/reference/commaOperatorWithSecondOperandStringType.symbols +++ b/tests/baselines/reference/commaOperatorWithSecondOperandStringType.symbols @@ -71,7 +71,7 @@ null, STRING; ANY = new Date(), STRING; >ANY : Symbol(ANY, Decl(commaOperatorWithSecondOperandStringType.ts, 0, 3)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >STRING : Symbol(STRING, Decl(commaOperatorWithSecondOperandStringType.ts, 3, 3)) true, ""; @@ -96,7 +96,7 @@ var resultIsString6 = (null, STRING); var resultIsString7 = (ANY = new Date(), STRING); >resultIsString7 : Symbol(resultIsString7, Decl(commaOperatorWithSecondOperandStringType.ts, 31, 3)) >ANY : Symbol(ANY, Decl(commaOperatorWithSecondOperandStringType.ts, 0, 3)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >STRING : Symbol(STRING, Decl(commaOperatorWithSecondOperandStringType.ts, 3, 3)) var resultIsString8 = (true, ""); diff --git a/tests/baselines/reference/commentsAfterFunctionExpression1.js b/tests/baselines/reference/commentsAfterFunctionExpression1.js new file mode 100644 index 00000000000..7a591391052 --- /dev/null +++ b/tests/baselines/reference/commentsAfterFunctionExpression1.js @@ -0,0 +1,14 @@ +//// [commentsAfterFunctionExpression1.ts] +var v = { + f: a => 0 /*t1*/, + g: (a => 0) /*t2*/, + h: (a => 0 /*t3*/) +} + + +//// [commentsAfterFunctionExpression1.js] +var v = { + f: function (a) { return 0; } /*t1*/, + g: (function (a) { return 0; }) /*t2*/, + h: (function (a) { return 0; } /*t3*/) +}; diff --git a/tests/baselines/reference/commentsAfterFunctionExpression1.symbols b/tests/baselines/reference/commentsAfterFunctionExpression1.symbols new file mode 100644 index 00000000000..450bb990c89 --- /dev/null +++ b/tests/baselines/reference/commentsAfterFunctionExpression1.symbols @@ -0,0 +1,17 @@ +=== tests/cases/compiler/commentsAfterFunctionExpression1.ts === +var v = { +>v : Symbol(v, Decl(commentsAfterFunctionExpression1.ts, 0, 3)) + + f: a => 0 /*t1*/, +>f : Symbol(f, Decl(commentsAfterFunctionExpression1.ts, 0, 9)) +>a : Symbol(a, Decl(commentsAfterFunctionExpression1.ts, 1, 6)) + + g: (a => 0) /*t2*/, +>g : Symbol(g, Decl(commentsAfterFunctionExpression1.ts, 1, 21)) +>a : Symbol(a, Decl(commentsAfterFunctionExpression1.ts, 2, 8)) + + h: (a => 0 /*t3*/) +>h : Symbol(h, Decl(commentsAfterFunctionExpression1.ts, 2, 23)) +>a : Symbol(a, Decl(commentsAfterFunctionExpression1.ts, 3, 8)) +} + diff --git a/tests/baselines/reference/commentsAfterFunctionExpression1.types b/tests/baselines/reference/commentsAfterFunctionExpression1.types new file mode 100644 index 00000000000..4a6b12bc210 --- /dev/null +++ b/tests/baselines/reference/commentsAfterFunctionExpression1.types @@ -0,0 +1,26 @@ +=== tests/cases/compiler/commentsAfterFunctionExpression1.ts === +var v = { +>v : { f: (a: any) => number; g: (a: any) => number; h: (a: any) => number; } +>{ f: a => 0 /*t1*/, g: (a => 0) /*t2*/, h: (a => 0 /*t3*/)} : { f: (a: any) => number; g: (a: any) => number; h: (a: any) => number; } + + f: a => 0 /*t1*/, +>f : (a: any) => number +>a => 0 : (a: any) => number +>a : any +>0 : number + + g: (a => 0) /*t2*/, +>g : (a: any) => number +>(a => 0) : (a: any) => number +>a => 0 : (a: any) => number +>a : any +>0 : number + + h: (a => 0 /*t3*/) +>h : (a: any) => number +>(a => 0 /*t3*/) : (a: any) => number +>a => 0 : (a: any) => number +>a : any +>0 : number +} + diff --git a/tests/baselines/reference/commentsOnObjectLiteral3.symbols b/tests/baselines/reference/commentsOnObjectLiteral3.symbols index 3d58fe2d6d7..81fa15b6a11 100644 --- a/tests/baselines/reference/commentsOnObjectLiteral3.symbols +++ b/tests/baselines/reference/commentsOnObjectLiteral3.symbols @@ -21,6 +21,10 @@ var v = { >a : Symbol(a, Decl(commentsOnObjectLiteral3.ts, 8, 13), Decl(commentsOnObjectLiteral3.ts, 12, 18)) return this.prop; +>this.prop : Symbol(prop, Decl(commentsOnObjectLiteral3.ts, 1, 9)) +>this : Symbol(, Decl(commentsOnObjectLiteral3.ts, 1, 7)) +>prop : Symbol(prop, Decl(commentsOnObjectLiteral3.ts, 1, 9)) + } /*trailing 1*/, //setter set a(value) { @@ -28,6 +32,9 @@ var v = { >value : Symbol(value, Decl(commentsOnObjectLiteral3.ts, 14, 7)) this.prop = value; +>this.prop : Symbol(prop, Decl(commentsOnObjectLiteral3.ts, 1, 9)) +>this : Symbol(, Decl(commentsOnObjectLiteral3.ts, 1, 7)) +>prop : Symbol(prop, Decl(commentsOnObjectLiteral3.ts, 1, 9)) >value : Symbol(value, Decl(commentsOnObjectLiteral3.ts, 14, 7)) } // trailing 2 diff --git a/tests/baselines/reference/commentsOnObjectLiteral3.types b/tests/baselines/reference/commentsOnObjectLiteral3.types index a63920fce0f..26a1e2e4250 100644 --- a/tests/baselines/reference/commentsOnObjectLiteral3.types +++ b/tests/baselines/reference/commentsOnObjectLiteral3.types @@ -24,9 +24,9 @@ var v = { >a : any return this.prop; ->this.prop : any ->this : any ->prop : any +>this.prop : number +>this : { prop: number; func: () => void; func1(): void; a: any; } +>prop : number } /*trailing 1*/, //setter @@ -36,9 +36,9 @@ var v = { this.prop = value; >this.prop = value : any ->this.prop : any ->this : any ->prop : any +>this.prop : number +>this : { prop: number; func: () => void; func1(): void; a: any; } +>prop : number >value : any } // trailing 2 diff --git a/tests/baselines/reference/commentsOnObjectLiteral4.js b/tests/baselines/reference/commentsOnObjectLiteral4.js index 3b7efefdff4..23e238b8307 100644 --- a/tests/baselines/reference/commentsOnObjectLiteral4.js +++ b/tests/baselines/reference/commentsOnObjectLiteral4.js @@ -5,9 +5,10 @@ var v = { * @type {number} */ get bar(): number { - return this._bar; + return 12; } -} +} + //// [commentsOnObjectLiteral4.js] var v = { @@ -15,6 +16,6 @@ var v = { * @type {number} */ get bar() { - return this._bar; + return 12; } }; diff --git a/tests/baselines/reference/commentsOnObjectLiteral4.symbols b/tests/baselines/reference/commentsOnObjectLiteral4.symbols index c1762cb75c8..568d6332126 100644 --- a/tests/baselines/reference/commentsOnObjectLiteral4.symbols +++ b/tests/baselines/reference/commentsOnObjectLiteral4.symbols @@ -9,6 +9,7 @@ var v = { get bar(): number { >bar : Symbol(bar, Decl(commentsOnObjectLiteral4.ts, 1, 9)) - return this._bar; + return 12; } } + diff --git a/tests/baselines/reference/commentsOnObjectLiteral4.types b/tests/baselines/reference/commentsOnObjectLiteral4.types index f458d73ae36..5d20d4f79cc 100644 --- a/tests/baselines/reference/commentsOnObjectLiteral4.types +++ b/tests/baselines/reference/commentsOnObjectLiteral4.types @@ -2,7 +2,7 @@ var v = { >v : { readonly bar: number; } ->{ /** * @type {number} */ get bar(): number { return this._bar; }} : { readonly bar: number; } +>{ /** * @type {number} */ get bar(): number { return 12; }} : { readonly bar: number; } /** * @type {number} @@ -10,9 +10,8 @@ var v = { get bar(): number { >bar : number - return this._bar; ->this._bar : any ->this : any ->_bar : any + return 12; +>12 : number } } + diff --git a/tests/baselines/reference/computedPropertyNamesContextualType1_ES6.symbols b/tests/baselines/reference/computedPropertyNamesContextualType1_ES6.symbols index 56da1f91a5e..ef5d519c3a0 100644 --- a/tests/baselines/reference/computedPropertyNamesContextualType1_ES6.symbols +++ b/tests/baselines/reference/computedPropertyNamesContextualType1_ES6.symbols @@ -17,13 +17,13 @@ var o: I = { ["" + 0](y) { return y.length; }, >y : Symbol(y, Decl(computedPropertyNamesContextualType1_ES6.ts, 6, 13)) ->y.length : Symbol(String.length, Decl(lib.d.ts, --, --)) +>y.length : Symbol(String.length, Decl(lib.es5.d.ts, --, --)) >y : Symbol(y, Decl(computedPropertyNamesContextualType1_ES6.ts, 6, 13)) ->length : Symbol(String.length, Decl(lib.d.ts, --, --)) +>length : Symbol(String.length, Decl(lib.es5.d.ts, --, --)) ["" + 1]: y => y.length >y : Symbol(y, Decl(computedPropertyNamesContextualType1_ES6.ts, 7, 13)) ->y.length : Symbol(String.length, Decl(lib.d.ts, --, --)) +>y.length : Symbol(String.length, Decl(lib.es5.d.ts, --, --)) >y : Symbol(y, Decl(computedPropertyNamesContextualType1_ES6.ts, 7, 13)) ->length : Symbol(String.length, Decl(lib.d.ts, --, --)) +>length : Symbol(String.length, Decl(lib.es5.d.ts, --, --)) } diff --git a/tests/baselines/reference/computedPropertyNamesContextualType2_ES6.symbols b/tests/baselines/reference/computedPropertyNamesContextualType2_ES6.symbols index 9412a9c8c34..d8cab4c4a52 100644 --- a/tests/baselines/reference/computedPropertyNamesContextualType2_ES6.symbols +++ b/tests/baselines/reference/computedPropertyNamesContextualType2_ES6.symbols @@ -17,13 +17,13 @@ var o: I = { [+"foo"](y) { return y.length; }, >y : Symbol(y, Decl(computedPropertyNamesContextualType2_ES6.ts, 6, 13)) ->y.length : Symbol(String.length, Decl(lib.d.ts, --, --)) +>y.length : Symbol(String.length, Decl(lib.es5.d.ts, --, --)) >y : Symbol(y, Decl(computedPropertyNamesContextualType2_ES6.ts, 6, 13)) ->length : Symbol(String.length, Decl(lib.d.ts, --, --)) +>length : Symbol(String.length, Decl(lib.es5.d.ts, --, --)) [+"bar"]: y => y.length >y : Symbol(y, Decl(computedPropertyNamesContextualType2_ES6.ts, 7, 13)) ->y.length : Symbol(String.length, Decl(lib.d.ts, --, --)) +>y.length : Symbol(String.length, Decl(lib.es5.d.ts, --, --)) >y : Symbol(y, Decl(computedPropertyNamesContextualType2_ES6.ts, 7, 13)) ->length : Symbol(String.length, Decl(lib.d.ts, --, --)) +>length : Symbol(String.length, Decl(lib.es5.d.ts, --, --)) } diff --git a/tests/baselines/reference/computedPropertyNamesContextualType3_ES6.symbols b/tests/baselines/reference/computedPropertyNamesContextualType3_ES6.symbols index 0b53cf3bfe4..deea9bff3df 100644 --- a/tests/baselines/reference/computedPropertyNamesContextualType3_ES6.symbols +++ b/tests/baselines/reference/computedPropertyNamesContextualType3_ES6.symbols @@ -13,13 +13,13 @@ var o: I = { [+"foo"](y) { return y.length; }, >y : Symbol(y, Decl(computedPropertyNamesContextualType3_ES6.ts, 5, 13)) ->y.length : Symbol(String.length, Decl(lib.d.ts, --, --)) +>y.length : Symbol(String.length, Decl(lib.es5.d.ts, --, --)) >y : Symbol(y, Decl(computedPropertyNamesContextualType3_ES6.ts, 5, 13)) ->length : Symbol(String.length, Decl(lib.d.ts, --, --)) +>length : Symbol(String.length, Decl(lib.es5.d.ts, --, --)) [+"bar"]: y => y.length >y : Symbol(y, Decl(computedPropertyNamesContextualType3_ES6.ts, 6, 13)) ->y.length : Symbol(String.length, Decl(lib.d.ts, --, --)) +>y.length : Symbol(String.length, Decl(lib.es5.d.ts, --, --)) >y : Symbol(y, Decl(computedPropertyNamesContextualType3_ES6.ts, 6, 13)) ->length : Symbol(String.length, Decl(lib.d.ts, --, --)) +>length : Symbol(String.length, Decl(lib.es5.d.ts, --, --)) } diff --git a/tests/baselines/reference/conditionalOperatorConditionIsObjectType.symbols b/tests/baselines/reference/conditionalOperatorConditionIsObjectType.symbols index 0867a708770..2c000f17bf6 100644 --- a/tests/baselines/reference/conditionalOperatorConditionIsObjectType.symbols +++ b/tests/baselines/reference/conditionalOperatorConditionIsObjectType.symbols @@ -120,7 +120,7 @@ foo() ? exprAny1 : exprAny2; >exprAny2 : Symbol(exprAny2, Decl(conditionalOperatorConditionIsObjectType.ts, 9, 3)) new Date() ? exprBoolean1 : exprBoolean2; ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >exprBoolean1 : Symbol(exprBoolean1, Decl(conditionalOperatorConditionIsObjectType.ts, 4, 3)) >exprBoolean2 : Symbol(exprBoolean2, Decl(conditionalOperatorConditionIsObjectType.ts, 10, 3)) @@ -144,7 +144,7 @@ condObject.valueOf() ? exprIsObject1 : exprIsObject2; >exprIsObject2 : Symbol(exprIsObject2, Decl(conditionalOperatorConditionIsObjectType.ts, 13, 3)) new Date() ? exprString1 : exprBoolean1; // union ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >exprString1 : Symbol(exprString1, Decl(conditionalOperatorConditionIsObjectType.ts, 6, 3)) >exprBoolean1 : Symbol(exprBoolean1, Decl(conditionalOperatorConditionIsObjectType.ts, 4, 3)) @@ -237,7 +237,7 @@ var resultIsAny3 = foo() ? exprAny1 : exprAny2; var resultIsBoolean3 = new Date() ? exprBoolean1 : exprBoolean2; >resultIsBoolean3 : Symbol(resultIsBoolean3, Decl(conditionalOperatorConditionIsObjectType.ts, 58, 3)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >exprBoolean1 : Symbol(exprBoolean1, Decl(conditionalOperatorConditionIsObjectType.ts, 4, 3)) >exprBoolean2 : Symbol(exprBoolean2, Decl(conditionalOperatorConditionIsObjectType.ts, 10, 3)) diff --git a/tests/baselines/reference/constraintSatisfactionWithAny.symbols b/tests/baselines/reference/constraintSatisfactionWithAny.symbols index 6461e50d860..824035a185c 100644 --- a/tests/baselines/reference/constraintSatisfactionWithAny.symbols +++ b/tests/baselines/reference/constraintSatisfactionWithAny.symbols @@ -4,7 +4,7 @@ function foo(x: T): T { return null; } >foo : Symbol(foo, Decl(constraintSatisfactionWithAny.ts, 0, 0)) >T : Symbol(T, Decl(constraintSatisfactionWithAny.ts, 2, 13)) ->String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >x : Symbol(x, Decl(constraintSatisfactionWithAny.ts, 2, 31)) >T : Symbol(T, Decl(constraintSatisfactionWithAny.ts, 2, 13)) >T : Symbol(T, Decl(constraintSatisfactionWithAny.ts, 2, 13)) @@ -67,7 +67,7 @@ foo4(b); class C { >C : Symbol(C, Decl(constraintSatisfactionWithAny.ts, 16, 13)) >T : Symbol(T, Decl(constraintSatisfactionWithAny.ts, 22, 8)) ->String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) constructor(public x: T) { } >x : Symbol(C.x, Decl(constraintSatisfactionWithAny.ts, 23, 16)) diff --git a/tests/baselines/reference/constructSignatureAssignabilityInInheritance2.symbols b/tests/baselines/reference/constructSignatureAssignabilityInInheritance2.symbols index 956e4ea5b62..4d63a7f2db4 100644 --- a/tests/baselines/reference/constructSignatureAssignabilityInInheritance2.symbols +++ b/tests/baselines/reference/constructSignatureAssignabilityInInheritance2.symbols @@ -195,8 +195,8 @@ interface A { // T new (a: Date): Date; >a : Symbol(a, Decl(constructSignatureAssignabilityInInheritance2.ts, 42, 17)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) }): any[]; }; diff --git a/tests/baselines/reference/constructorImplementationWithDefaultValues.symbols b/tests/baselines/reference/constructorImplementationWithDefaultValues.symbols index a96e053132e..7403c126f45 100644 --- a/tests/baselines/reference/constructorImplementationWithDefaultValues.symbols +++ b/tests/baselines/reference/constructorImplementationWithDefaultValues.symbols @@ -34,7 +34,7 @@ class D { class E { >E : Symbol(E, Decl(constructorImplementationWithDefaultValues.ts, 12, 1)) >T : Symbol(T, Decl(constructorImplementationWithDefaultValues.ts, 14, 8)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) constructor(x); >x : Symbol(x, Decl(constructorImplementationWithDefaultValues.ts, 15, 16)) diff --git a/tests/baselines/reference/contextualTyping24.errors.txt b/tests/baselines/reference/contextualTyping24.errors.txt index f4205f24359..ea973050625 100644 --- a/tests/baselines/reference/contextualTyping24.errors.txt +++ b/tests/baselines/reference/contextualTyping24.errors.txt @@ -1,11 +1,11 @@ -tests/cases/compiler/contextualTyping24.ts(1,55): error TS2322: Type '(a: string) => number' is not assignable to type '(a: { (): number; (i: number): number; }) => number'. +tests/cases/compiler/contextualTyping24.ts(1,55): error TS2322: Type '(this: void, a: string) => number' is not assignable to type '(a: { (): number; (i: number): number; }) => number'. Types of parameters 'a' and 'a' are incompatible. Type '{ (): number; (i: number): number; }' is not assignable to type 'string'. ==== tests/cases/compiler/contextualTyping24.ts (1 errors) ==== - var foo:(a:{():number; (i:number):number; })=>number; foo = function(a:string){return 5}; + var foo:(a:{():number; (i:number):number; })=>number; foo = function(this: void, a:string){return 5}; ~~~ -!!! error TS2322: Type '(a: string) => number' is not assignable to type '(a: { (): number; (i: number): number; }) => number'. +!!! error TS2322: Type '(this: void, a: string) => number' is not assignable to type '(a: { (): number; (i: number): number; }) => number'. !!! error TS2322: Types of parameters 'a' and 'a' are incompatible. !!! error TS2322: Type '{ (): number; (i: number): number; }' is not assignable to type 'string'. \ No newline at end of file diff --git a/tests/baselines/reference/contextualTyping24.js b/tests/baselines/reference/contextualTyping24.js index 04c4ecba21b..14c1feeb031 100644 --- a/tests/baselines/reference/contextualTyping24.js +++ b/tests/baselines/reference/contextualTyping24.js @@ -1,5 +1,5 @@ //// [contextualTyping24.ts] -var foo:(a:{():number; (i:number):number; })=>number; foo = function(a:string){return 5}; +var foo:(a:{():number; (i:number):number; })=>number; foo = function(this: void, a:string){return 5}; //// [contextualTyping24.js] var foo; diff --git a/tests/baselines/reference/contextualTyping39.errors.txt b/tests/baselines/reference/contextualTyping39.errors.txt index e43624fbead..9081480f4ba 100644 --- a/tests/baselines/reference/contextualTyping39.errors.txt +++ b/tests/baselines/reference/contextualTyping39.errors.txt @@ -1,9 +1,9 @@ -tests/cases/compiler/contextualTyping39.ts(1,11): error TS2352: Neither type '() => string' nor type '() => number' is assignable to the other. - Type 'string' is not assignable to type 'number'. +tests/cases/compiler/contextualTyping39.ts(1,11): error TS2352: Type '() => string' cannot be converted to type '() => number'. + Type 'string' is not comparable to type 'number'. ==== tests/cases/compiler/contextualTyping39.ts (1 errors) ==== var foo = <{ (): number; }> function() { return "err"; }; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2352: Neither type '() => string' nor type '() => number' is assignable to the other. -!!! error TS2352: Type 'string' is not assignable to type 'number'. \ No newline at end of file +!!! error TS2352: Type '() => string' cannot be converted to type '() => number'. +!!! error TS2352: Type 'string' is not comparable to type 'number'. \ No newline at end of file diff --git a/tests/baselines/reference/contextualTyping41.errors.txt b/tests/baselines/reference/contextualTyping41.errors.txt index 1ed6da1b782..418d435e7fe 100644 --- a/tests/baselines/reference/contextualTyping41.errors.txt +++ b/tests/baselines/reference/contextualTyping41.errors.txt @@ -1,9 +1,9 @@ -tests/cases/compiler/contextualTyping41.ts(1,11): error TS2352: Neither type '() => string' nor type '{ (): number; (i: number): number; }' is assignable to the other. - Type 'string' is not assignable to type 'number'. +tests/cases/compiler/contextualTyping41.ts(1,11): error TS2352: Type '() => string' cannot be converted to type '{ (): number; (i: number): number; }'. + Type 'string' is not comparable to type 'number'. ==== tests/cases/compiler/contextualTyping41.ts (1 errors) ==== var foo = <{():number; (i:number):number; }> (function(){return "err";}); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2352: Neither type '() => string' nor type '{ (): number; (i: number): number; }' is assignable to the other. -!!! error TS2352: Type 'string' is not assignable to type 'number'. \ No newline at end of file +!!! error TS2352: Type '() => string' cannot be converted to type '{ (): number; (i: number): number; }'. +!!! error TS2352: Type 'string' is not comparable to type 'number'. \ No newline at end of file diff --git a/tests/baselines/reference/declFileObjectLiteralWithAccessors.symbols b/tests/baselines/reference/declFileObjectLiteralWithAccessors.symbols index 862b0b3781e..9b3599da674 100644 --- a/tests/baselines/reference/declFileObjectLiteralWithAccessors.symbols +++ b/tests/baselines/reference/declFileObjectLiteralWithAccessors.symbols @@ -15,6 +15,9 @@ function /*1*/makePoint(x: number) { set x(a: number) { this.b = a; } >x : Symbol(x, Decl(declFileObjectLiteralWithAccessors.ts, 3, 14), Decl(declFileObjectLiteralWithAccessors.ts, 4, 30)) >a : Symbol(a, Decl(declFileObjectLiteralWithAccessors.ts, 5, 14)) +>this.b : Symbol(b, Decl(declFileObjectLiteralWithAccessors.ts, 2, 12)) +>this : Symbol(, Decl(declFileObjectLiteralWithAccessors.ts, 2, 10)) +>b : Symbol(b, Decl(declFileObjectLiteralWithAccessors.ts, 2, 12)) >a : Symbol(a, Decl(declFileObjectLiteralWithAccessors.ts, 5, 14)) }; diff --git a/tests/baselines/reference/declFileObjectLiteralWithAccessors.types b/tests/baselines/reference/declFileObjectLiteralWithAccessors.types index f7bb57b0e1e..1bf012605c1 100644 --- a/tests/baselines/reference/declFileObjectLiteralWithAccessors.types +++ b/tests/baselines/reference/declFileObjectLiteralWithAccessors.types @@ -19,9 +19,9 @@ function /*1*/makePoint(x: number) { >x : number >a : number >this.b = a : number ->this.b : any ->this : any ->b : any +>this.b : number +>this : { b: number; x: number; } +>b : number >a : number }; diff --git a/tests/baselines/reference/declFileObjectLiteralWithOnlySetter.symbols b/tests/baselines/reference/declFileObjectLiteralWithOnlySetter.symbols index f7474466140..89b7b9dd747 100644 --- a/tests/baselines/reference/declFileObjectLiteralWithOnlySetter.symbols +++ b/tests/baselines/reference/declFileObjectLiteralWithOnlySetter.symbols @@ -11,6 +11,9 @@ function /*1*/makePoint(x: number) { set x(a: number) { this.b = a; } >x : Symbol(x, Decl(declFileObjectLiteralWithOnlySetter.ts, 3, 14)) >a : Symbol(a, Decl(declFileObjectLiteralWithOnlySetter.ts, 4, 14)) +>this.b : Symbol(b, Decl(declFileObjectLiteralWithOnlySetter.ts, 2, 12)) +>this : Symbol(, Decl(declFileObjectLiteralWithOnlySetter.ts, 2, 10)) +>b : Symbol(b, Decl(declFileObjectLiteralWithOnlySetter.ts, 2, 12)) >a : Symbol(a, Decl(declFileObjectLiteralWithOnlySetter.ts, 4, 14)) }; diff --git a/tests/baselines/reference/declFileObjectLiteralWithOnlySetter.types b/tests/baselines/reference/declFileObjectLiteralWithOnlySetter.types index 2b9b98a8963..1bce86915ad 100644 --- a/tests/baselines/reference/declFileObjectLiteralWithOnlySetter.types +++ b/tests/baselines/reference/declFileObjectLiteralWithOnlySetter.types @@ -15,9 +15,9 @@ function /*1*/makePoint(x: number) { >x : number >a : number >this.b = a : number ->this.b : any ->this : any ->b : any +>this.b : number +>this : { b: number; x: number; } +>b : number >a : number }; diff --git a/tests/baselines/reference/declarationEmitDefaultExportWithTempVarName.js b/tests/baselines/reference/declarationEmitDefaultExportWithTempVarName.js new file mode 100644 index 00000000000..a0c8ab59b97 --- /dev/null +++ b/tests/baselines/reference/declarationEmitDefaultExportWithTempVarName.js @@ -0,0 +1,19 @@ +//// [pi.ts] +export default 3.14159; + +//// [pi.js] +System.register([], function(exports_1, context_1) { + "use strict"; + var __moduleName = context_1 && context_1.id; + return { + setters:[], + execute: function() { + exports_1("default",3.14159); + } + } +}); + + +//// [pi.d.ts] +declare var _default: number; +export default _default; diff --git a/tests/baselines/reference/declarationEmitDefaultExportWithTempVarName.symbols b/tests/baselines/reference/declarationEmitDefaultExportWithTempVarName.symbols new file mode 100644 index 00000000000..a45ecb2e47e --- /dev/null +++ b/tests/baselines/reference/declarationEmitDefaultExportWithTempVarName.symbols @@ -0,0 +1,3 @@ +=== tests/cases/compiler/pi.ts === +export default 3.14159; +No type information for this code. \ No newline at end of file diff --git a/tests/baselines/reference/declarationEmitDefaultExportWithTempVarName.types b/tests/baselines/reference/declarationEmitDefaultExportWithTempVarName.types new file mode 100644 index 00000000000..a45ecb2e47e --- /dev/null +++ b/tests/baselines/reference/declarationEmitDefaultExportWithTempVarName.types @@ -0,0 +1,3 @@ +=== tests/cases/compiler/pi.ts === +export default 3.14159; +No type information for this code. \ No newline at end of file diff --git a/tests/baselines/reference/declarationEmitDefaultExportWithTempVarNameWithBundling.js b/tests/baselines/reference/declarationEmitDefaultExportWithTempVarNameWithBundling.js new file mode 100644 index 00000000000..adb081dc2a3 --- /dev/null +++ b/tests/baselines/reference/declarationEmitDefaultExportWithTempVarNameWithBundling.js @@ -0,0 +1,22 @@ +//// [pi.ts] + +export default 3.14159; + +//// [app.js] +System.register("pi", [], function(exports_1, context_1) { + "use strict"; + var __moduleName = context_1 && context_1.id; + return { + setters:[], + execute: function() { + exports_1("default",3.14159); + } + } +}); + + +//// [app.d.ts] +declare module "pi" { + var _default: number; + export default _default; +} diff --git a/tests/baselines/reference/declarationEmitDefaultExportWithTempVarNameWithBundling.symbols b/tests/baselines/reference/declarationEmitDefaultExportWithTempVarNameWithBundling.symbols new file mode 100644 index 00000000000..82f52e818e3 --- /dev/null +++ b/tests/baselines/reference/declarationEmitDefaultExportWithTempVarNameWithBundling.symbols @@ -0,0 +1,4 @@ +=== tests/cases/compiler/pi.ts === + +No type information for this code.export default 3.14159; +No type information for this code. \ No newline at end of file diff --git a/tests/baselines/reference/declarationEmitDefaultExportWithTempVarNameWithBundling.types b/tests/baselines/reference/declarationEmitDefaultExportWithTempVarNameWithBundling.types new file mode 100644 index 00000000000..82f52e818e3 --- /dev/null +++ b/tests/baselines/reference/declarationEmitDefaultExportWithTempVarNameWithBundling.types @@ -0,0 +1,4 @@ +=== tests/cases/compiler/pi.ts === + +No type information for this code.export default 3.14159; +No type information for this code. \ No newline at end of file diff --git a/tests/baselines/reference/declarationEmitThisPredicates02.errors.txt b/tests/baselines/reference/declarationEmitThisPredicates02.errors.txt index 4d95cf01136..d3597ad2507 100644 --- a/tests/baselines/reference/declarationEmitThisPredicates02.errors.txt +++ b/tests/baselines/reference/declarationEmitThisPredicates02.errors.txt @@ -1,7 +1,9 @@ tests/cases/conformance/declarationEmit/typePredicates/declarationEmitThisPredicates02.ts(9,10): error TS2526: A 'this' type is available only in a non-static member of a class or interface. +tests/cases/conformance/declarationEmit/typePredicates/declarationEmitThisPredicates02.ts(10,19): error TS2352: Type '{ m(): this is Foo; }' cannot be converted to type 'Foo'. + Property 'a' is missing in type '{ m(): this is Foo; }'. -==== tests/cases/conformance/declarationEmit/typePredicates/declarationEmitThisPredicates02.ts (1 errors) ==== +==== tests/cases/conformance/declarationEmit/typePredicates/declarationEmitThisPredicates02.ts (2 errors) ==== export interface Foo { a: string; @@ -14,6 +16,9 @@ tests/cases/conformance/declarationEmit/typePredicates/declarationEmitThisPredic ~~~~ !!! error TS2526: A 'this' type is available only in a non-static member of a class or interface. let dis = this as Foo; + ~~~~~~~~~~~ +!!! error TS2352: Type '{ m(): this is Foo; }' cannot be converted to type 'Foo'. +!!! error TS2352: Property 'a' is missing in type '{ m(): this is Foo; }'. return dis.a != null && dis.b != null && dis.c != null; } } \ No newline at end of file diff --git a/tests/baselines/reference/declarationEmitThisPredicatesWithPrivateName02.errors.txt b/tests/baselines/reference/declarationEmitThisPredicatesWithPrivateName02.errors.txt index 86c0f478133..7a4716a92e0 100644 --- a/tests/baselines/reference/declarationEmitThisPredicatesWithPrivateName02.errors.txt +++ b/tests/baselines/reference/declarationEmitThisPredicatesWithPrivateName02.errors.txt @@ -1,8 +1,10 @@ tests/cases/conformance/declarationEmit/typePredicates/declarationEmitThisPredicatesWithPrivateName02.ts(8,14): error TS4025: Exported variable 'obj' has or is using private name 'Foo'. tests/cases/conformance/declarationEmit/typePredicates/declarationEmitThisPredicatesWithPrivateName02.ts(9,10): error TS2526: A 'this' type is available only in a non-static member of a class or interface. +tests/cases/conformance/declarationEmit/typePredicates/declarationEmitThisPredicatesWithPrivateName02.ts(10,19): error TS2352: Type '{ m(): this is Foo; }' cannot be converted to type 'Foo'. + Property 'a' is missing in type '{ m(): this is Foo; }'. -==== tests/cases/conformance/declarationEmit/typePredicates/declarationEmitThisPredicatesWithPrivateName02.ts (2 errors) ==== +==== tests/cases/conformance/declarationEmit/typePredicates/declarationEmitThisPredicatesWithPrivateName02.ts (3 errors) ==== interface Foo { a: string; @@ -17,6 +19,9 @@ tests/cases/conformance/declarationEmit/typePredicates/declarationEmitThisPredic ~~~~ !!! error TS2526: A 'this' type is available only in a non-static member of a class or interface. let dis = this as Foo; + ~~~~~~~~~~~ +!!! error TS2352: Type '{ m(): this is Foo; }' cannot be converted to type 'Foo'. +!!! error TS2352: Property 'a' is missing in type '{ m(): this is Foo; }'. return dis.a != null && dis.b != null && dis.c != null; } } \ No newline at end of file diff --git a/tests/baselines/reference/decoratedDefaultExportsGetExportedAmd.symbols b/tests/baselines/reference/decoratedDefaultExportsGetExportedAmd.symbols index 4414fd9ef87..3e7ec568927 100644 --- a/tests/baselines/reference/decoratedDefaultExportsGetExportedAmd.symbols +++ b/tests/baselines/reference/decoratedDefaultExportsGetExportedAmd.symbols @@ -1,7 +1,7 @@ === tests/cases/conformance/es6/moduleExportsAmd/a.ts === var decorator: ClassDecorator; >decorator : Symbol(decorator, Decl(a.ts, 0, 3)) ->ClassDecorator : Symbol(ClassDecorator, Decl(lib.d.ts, --, --)) +>ClassDecorator : Symbol(ClassDecorator, Decl(lib.es5.d.ts, --, --)) @decorator >decorator : Symbol(decorator, Decl(a.ts, 0, 3)) @@ -12,7 +12,7 @@ export default class Foo {} === tests/cases/conformance/es6/moduleExportsAmd/b.ts === var decorator: ClassDecorator; >decorator : Symbol(decorator, Decl(b.ts, 0, 3)) ->ClassDecorator : Symbol(ClassDecorator, Decl(lib.d.ts, --, --)) +>ClassDecorator : Symbol(ClassDecorator, Decl(lib.es5.d.ts, --, --)) @decorator >decorator : Symbol(decorator, Decl(b.ts, 0, 3)) diff --git a/tests/baselines/reference/decoratedDefaultExportsGetExportedCommonjs.symbols b/tests/baselines/reference/decoratedDefaultExportsGetExportedCommonjs.symbols index 4eafc337573..383d7d2c0d2 100644 --- a/tests/baselines/reference/decoratedDefaultExportsGetExportedCommonjs.symbols +++ b/tests/baselines/reference/decoratedDefaultExportsGetExportedCommonjs.symbols @@ -1,7 +1,7 @@ === tests/cases/conformance/es6/moduleExportsCommonjs/a.ts === var decorator: ClassDecorator; >decorator : Symbol(decorator, Decl(a.ts, 0, 3)) ->ClassDecorator : Symbol(ClassDecorator, Decl(lib.d.ts, --, --)) +>ClassDecorator : Symbol(ClassDecorator, Decl(lib.es5.d.ts, --, --)) @decorator >decorator : Symbol(decorator, Decl(a.ts, 0, 3)) @@ -12,7 +12,7 @@ export default class Foo {} === tests/cases/conformance/es6/moduleExportsCommonjs/b.ts === var decorator: ClassDecorator; >decorator : Symbol(decorator, Decl(b.ts, 0, 3)) ->ClassDecorator : Symbol(ClassDecorator, Decl(lib.d.ts, --, --)) +>ClassDecorator : Symbol(ClassDecorator, Decl(lib.es5.d.ts, --, --)) @decorator >decorator : Symbol(decorator, Decl(b.ts, 0, 3)) diff --git a/tests/baselines/reference/decoratedDefaultExportsGetExportedSystem.symbols b/tests/baselines/reference/decoratedDefaultExportsGetExportedSystem.symbols index 3751c992fa5..73898da76c4 100644 --- a/tests/baselines/reference/decoratedDefaultExportsGetExportedSystem.symbols +++ b/tests/baselines/reference/decoratedDefaultExportsGetExportedSystem.symbols @@ -1,7 +1,7 @@ === tests/cases/conformance/es6/moduleExportsSystem/a.ts === var decorator: ClassDecorator; >decorator : Symbol(decorator, Decl(a.ts, 0, 3)) ->ClassDecorator : Symbol(ClassDecorator, Decl(lib.d.ts, --, --)) +>ClassDecorator : Symbol(ClassDecorator, Decl(lib.es5.d.ts, --, --)) @decorator >decorator : Symbol(decorator, Decl(a.ts, 0, 3)) @@ -12,7 +12,7 @@ export default class Foo {} === tests/cases/conformance/es6/moduleExportsSystem/b.ts === var decorator: ClassDecorator; >decorator : Symbol(decorator, Decl(b.ts, 0, 3)) ->ClassDecorator : Symbol(ClassDecorator, Decl(lib.d.ts, --, --)) +>ClassDecorator : Symbol(ClassDecorator, Decl(lib.es5.d.ts, --, --)) @decorator >decorator : Symbol(decorator, Decl(b.ts, 0, 3)) diff --git a/tests/baselines/reference/decoratedDefaultExportsGetExportedUmd.symbols b/tests/baselines/reference/decoratedDefaultExportsGetExportedUmd.symbols index 5ea35d450d0..f93e5411306 100644 --- a/tests/baselines/reference/decoratedDefaultExportsGetExportedUmd.symbols +++ b/tests/baselines/reference/decoratedDefaultExportsGetExportedUmd.symbols @@ -1,7 +1,7 @@ === tests/cases/conformance/es6/moduleExportsUmd/a.ts === var decorator: ClassDecorator; >decorator : Symbol(decorator, Decl(a.ts, 0, 3)) ->ClassDecorator : Symbol(ClassDecorator, Decl(lib.d.ts, --, --)) +>ClassDecorator : Symbol(ClassDecorator, Decl(lib.es5.d.ts, --, --)) @decorator >decorator : Symbol(decorator, Decl(a.ts, 0, 3)) @@ -12,7 +12,7 @@ export default class Foo {} === tests/cases/conformance/es6/moduleExportsUmd/b.ts === var decorator: ClassDecorator; >decorator : Symbol(decorator, Decl(b.ts, 0, 3)) ->ClassDecorator : Symbol(ClassDecorator, Decl(lib.d.ts, --, --)) +>ClassDecorator : Symbol(ClassDecorator, Decl(lib.es5.d.ts, --, --)) @decorator >decorator : Symbol(decorator, Decl(b.ts, 0, 3)) diff --git a/tests/baselines/reference/decoratorOnClassMethod13.symbols b/tests/baselines/reference/decoratorOnClassMethod13.symbols index 6dfcd15d040..389b45e5679 100644 --- a/tests/baselines/reference/decoratorOnClassMethod13.symbols +++ b/tests/baselines/reference/decoratorOnClassMethod13.symbols @@ -5,9 +5,9 @@ declare function dec(target: any, propertyKey: string, descriptor: TypedPrope >target : Symbol(target, Decl(decoratorOnClassMethod13.ts, 0, 24)) >propertyKey : Symbol(propertyKey, Decl(decoratorOnClassMethod13.ts, 0, 36)) >descriptor : Symbol(descriptor, Decl(decoratorOnClassMethod13.ts, 0, 57)) ->TypedPropertyDescriptor : Symbol(TypedPropertyDescriptor, Decl(lib.d.ts, --, --)) +>TypedPropertyDescriptor : Symbol(TypedPropertyDescriptor, Decl(lib.es5.d.ts, --, --)) >T : Symbol(T, Decl(decoratorOnClassMethod13.ts, 0, 21)) ->TypedPropertyDescriptor : Symbol(TypedPropertyDescriptor, Decl(lib.d.ts, --, --)) +>TypedPropertyDescriptor : Symbol(TypedPropertyDescriptor, Decl(lib.es5.d.ts, --, --)) >T : Symbol(T, Decl(decoratorOnClassMethod13.ts, 0, 21)) class C { diff --git a/tests/baselines/reference/decoratorOnClassMethod4.symbols b/tests/baselines/reference/decoratorOnClassMethod4.symbols index 745fb8c4ce7..909fcd7f424 100644 --- a/tests/baselines/reference/decoratorOnClassMethod4.symbols +++ b/tests/baselines/reference/decoratorOnClassMethod4.symbols @@ -5,9 +5,9 @@ declare function dec(target: any, propertyKey: string, descriptor: TypedPrope >target : Symbol(target, Decl(decoratorOnClassMethod4.ts, 0, 24)) >propertyKey : Symbol(propertyKey, Decl(decoratorOnClassMethod4.ts, 0, 36)) >descriptor : Symbol(descriptor, Decl(decoratorOnClassMethod4.ts, 0, 57)) ->TypedPropertyDescriptor : Symbol(TypedPropertyDescriptor, Decl(lib.d.ts, --, --)) +>TypedPropertyDescriptor : Symbol(TypedPropertyDescriptor, Decl(lib.es5.d.ts, --, --)) >T : Symbol(T, Decl(decoratorOnClassMethod4.ts, 0, 21)) ->TypedPropertyDescriptor : Symbol(TypedPropertyDescriptor, Decl(lib.d.ts, --, --)) +>TypedPropertyDescriptor : Symbol(TypedPropertyDescriptor, Decl(lib.es5.d.ts, --, --)) >T : Symbol(T, Decl(decoratorOnClassMethod4.ts, 0, 21)) class C { diff --git a/tests/baselines/reference/decoratorOnClassMethod5.symbols b/tests/baselines/reference/decoratorOnClassMethod5.symbols index 124ace783fe..a9780c1efa4 100644 --- a/tests/baselines/reference/decoratorOnClassMethod5.symbols +++ b/tests/baselines/reference/decoratorOnClassMethod5.symbols @@ -5,9 +5,9 @@ declare function dec(): (target: any, propertyKey: string, descriptor: TypedP >target : Symbol(target, Decl(decoratorOnClassMethod5.ts, 0, 28)) >propertyKey : Symbol(propertyKey, Decl(decoratorOnClassMethod5.ts, 0, 40)) >descriptor : Symbol(descriptor, Decl(decoratorOnClassMethod5.ts, 0, 61)) ->TypedPropertyDescriptor : Symbol(TypedPropertyDescriptor, Decl(lib.d.ts, --, --)) +>TypedPropertyDescriptor : Symbol(TypedPropertyDescriptor, Decl(lib.es5.d.ts, --, --)) >T : Symbol(T, Decl(decoratorOnClassMethod5.ts, 0, 25)) ->TypedPropertyDescriptor : Symbol(TypedPropertyDescriptor, Decl(lib.d.ts, --, --)) +>TypedPropertyDescriptor : Symbol(TypedPropertyDescriptor, Decl(lib.es5.d.ts, --, --)) >T : Symbol(T, Decl(decoratorOnClassMethod5.ts, 0, 25)) class C { diff --git a/tests/baselines/reference/decoratorOnClassMethod7.symbols b/tests/baselines/reference/decoratorOnClassMethod7.symbols index e870a798559..3837816f79b 100644 --- a/tests/baselines/reference/decoratorOnClassMethod7.symbols +++ b/tests/baselines/reference/decoratorOnClassMethod7.symbols @@ -5,9 +5,9 @@ declare function dec(target: any, propertyKey: string, descriptor: TypedPrope >target : Symbol(target, Decl(decoratorOnClassMethod7.ts, 0, 24)) >propertyKey : Symbol(propertyKey, Decl(decoratorOnClassMethod7.ts, 0, 36)) >descriptor : Symbol(descriptor, Decl(decoratorOnClassMethod7.ts, 0, 57)) ->TypedPropertyDescriptor : Symbol(TypedPropertyDescriptor, Decl(lib.d.ts, --, --)) +>TypedPropertyDescriptor : Symbol(TypedPropertyDescriptor, Decl(lib.es5.d.ts, --, --)) >T : Symbol(T, Decl(decoratorOnClassMethod7.ts, 0, 21)) ->TypedPropertyDescriptor : Symbol(TypedPropertyDescriptor, Decl(lib.d.ts, --, --)) +>TypedPropertyDescriptor : Symbol(TypedPropertyDescriptor, Decl(lib.es5.d.ts, --, --)) >T : Symbol(T, Decl(decoratorOnClassMethod7.ts, 0, 21)) class C { diff --git a/tests/baselines/reference/defaultArgsInFunctionExpressions.errors.txt b/tests/baselines/reference/defaultArgsInFunctionExpressions.errors.txt index 156fdcc4c7a..60a9e92bc95 100644 --- a/tests/baselines/reference/defaultArgsInFunctionExpressions.errors.txt +++ b/tests/baselines/reference/defaultArgsInFunctionExpressions.errors.txt @@ -2,9 +2,9 @@ tests/cases/compiler/defaultArgsInFunctionExpressions.ts(4,19): error TS2345: Ar tests/cases/compiler/defaultArgsInFunctionExpressions.ts(5,1): error TS2322: Type 'number' is not assignable to type 'string'. tests/cases/compiler/defaultArgsInFunctionExpressions.ts(8,20): error TS2322: Type 'number' is not assignable to type 'string'. tests/cases/compiler/defaultArgsInFunctionExpressions.ts(11,1): error TS2322: Type 'string' is not assignable to type 'number'. -tests/cases/compiler/defaultArgsInFunctionExpressions.ts(14,51): error TS2352: Neither type 'string' nor type 'number' is assignable to the other. +tests/cases/compiler/defaultArgsInFunctionExpressions.ts(14,51): error TS2352: Type 'string' cannot be converted to type 'number'. tests/cases/compiler/defaultArgsInFunctionExpressions.ts(17,41): error TS2322: Type 'string' is not assignable to type 'number'. -tests/cases/compiler/defaultArgsInFunctionExpressions.ts(20,62): error TS2352: Neither type 'string' nor type 'number' is assignable to the other. +tests/cases/compiler/defaultArgsInFunctionExpressions.ts(20,62): error TS2352: Type 'string' cannot be converted to type 'number'. tests/cases/compiler/defaultArgsInFunctionExpressions.ts(28,15): error TS2304: Cannot find name 'T'. @@ -32,7 +32,7 @@ tests/cases/compiler/defaultArgsInFunctionExpressions.ts(28,15): error TS2304: C // Contextually type the default arg with the type annotation var f3 = function (a: (s: string) => any = (s) => s) { }; ~~~~~~~~~ -!!! error TS2352: Neither type 'string' nor type 'number' is assignable to the other. +!!! error TS2352: Type 'string' cannot be converted to type 'number'. // Type check using the function's contextual type var f4: (a: number) => void = function (a = "") { }; @@ -42,7 +42,7 @@ tests/cases/compiler/defaultArgsInFunctionExpressions.ts(28,15): error TS2304: C // Contextually type the default arg using the function's contextual type var f5: (a: (s: string) => any) => void = function (a = s => s) { }; ~~~~~~~~~ -!!! error TS2352: Neither type 'string' nor type 'number' is assignable to the other. +!!! error TS2352: Type 'string' cannot be converted to type 'number'. // Instantiated module module T { } diff --git a/tests/baselines/reference/destructuringParameterDeclaration3ES5.symbols b/tests/baselines/reference/destructuringParameterDeclaration3ES5.symbols index c4dc8fd0f79..d08dc0a89fa 100644 --- a/tests/baselines/reference/destructuringParameterDeclaration3ES5.symbols +++ b/tests/baselines/reference/destructuringParameterDeclaration3ES5.symbols @@ -8,19 +8,19 @@ type arrayString = Array >arrayString : Symbol(arrayString, Decl(destructuringParameterDeclaration3ES5.ts, 0, 0)) ->Array : Symbol(Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Array : Symbol(Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --)) +>String : Symbol(String, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --)) type someArray = Array | number[]; >someArray : Symbol(someArray, Decl(destructuringParameterDeclaration3ES5.ts, 7, 32)) ->Array : Symbol(Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Array : Symbol(Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --)) +>String : Symbol(String, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --)) type stringOrNumArray = Array; >stringOrNumArray : Symbol(stringOrNumArray, Decl(destructuringParameterDeclaration3ES5.ts, 8, 42)) ->Array : Symbol(Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Array : Symbol(Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --)) +>String : Symbol(String, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --)) +>Number : Symbol(Number, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) function a1(...x: (number|string)[]) { } >a1 : Symbol(a1, Decl(destructuringParameterDeclaration3ES5.ts, 9, 45)) @@ -33,8 +33,8 @@ function a2(...a) { } function a3(...a: Array) { } >a3 : Symbol(a3, Decl(destructuringParameterDeclaration3ES5.ts, 12, 21)) >a : Symbol(a, Decl(destructuringParameterDeclaration3ES5.ts, 13, 12)) ->Array : Symbol(Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Array : Symbol(Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --)) +>String : Symbol(String, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --)) function a4(...a: arrayString) { } >a4 : Symbol(a4, Decl(destructuringParameterDeclaration3ES5.ts, 13, 36)) @@ -122,7 +122,7 @@ const enum E1 { a, b } function foo1(...a: T[]) { } >foo1 : Symbol(foo1, Decl(destructuringParameterDeclaration3ES5.ts, 39, 22)) >T : Symbol(T, Decl(destructuringParameterDeclaration3ES5.ts, 40, 14)) ->Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Number : Symbol(Number, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) >a : Symbol(a, Decl(destructuringParameterDeclaration3ES5.ts, 40, 32)) >T : Symbol(T, Decl(destructuringParameterDeclaration3ES5.ts, 40, 14)) diff --git a/tests/baselines/reference/destructuringParameterDeclaration3ES6.symbols b/tests/baselines/reference/destructuringParameterDeclaration3ES6.symbols index 46682802e2a..dd07a528ec8 100644 --- a/tests/baselines/reference/destructuringParameterDeclaration3ES6.symbols +++ b/tests/baselines/reference/destructuringParameterDeclaration3ES6.symbols @@ -8,19 +8,19 @@ type arrayString = Array >arrayString : Symbol(arrayString, Decl(destructuringParameterDeclaration3ES6.ts, 0, 0)) ->Array : Symbol(Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Array : Symbol(Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --)) +>String : Symbol(String, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --)) type someArray = Array | number[]; >someArray : Symbol(someArray, Decl(destructuringParameterDeclaration3ES6.ts, 7, 32)) ->Array : Symbol(Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Array : Symbol(Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --)) +>String : Symbol(String, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --)) type stringOrNumArray = Array; >stringOrNumArray : Symbol(stringOrNumArray, Decl(destructuringParameterDeclaration3ES6.ts, 8, 42)) ->Array : Symbol(Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Array : Symbol(Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --)) +>String : Symbol(String, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --)) +>Number : Symbol(Number, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) function a1(...x: (number|string)[]) { } >a1 : Symbol(a1, Decl(destructuringParameterDeclaration3ES6.ts, 9, 45)) @@ -33,8 +33,8 @@ function a2(...a) { } function a3(...a: Array) { } >a3 : Symbol(a3, Decl(destructuringParameterDeclaration3ES6.ts, 12, 21)) >a : Symbol(a, Decl(destructuringParameterDeclaration3ES6.ts, 13, 12)) ->Array : Symbol(Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Array : Symbol(Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --)) +>String : Symbol(String, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --)) function a4(...a: arrayString) { } >a4 : Symbol(a4, Decl(destructuringParameterDeclaration3ES6.ts, 13, 36)) @@ -122,7 +122,7 @@ const enum E1 { a, b } function foo1(...a: T[]) { } >foo1 : Symbol(foo1, Decl(destructuringParameterDeclaration3ES6.ts, 39, 22)) >T : Symbol(T, Decl(destructuringParameterDeclaration3ES6.ts, 40, 14)) ->Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Number : Symbol(Number, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) >a : Symbol(a, Decl(destructuringParameterDeclaration3ES6.ts, 40, 32)) >T : Symbol(T, Decl(destructuringParameterDeclaration3ES6.ts, 40, 14)) diff --git a/tests/baselines/reference/downlevelLetConst18.errors.txt b/tests/baselines/reference/downlevelLetConst18.errors.txt new file mode 100644 index 00000000000..5b91498f173 --- /dev/null +++ b/tests/baselines/reference/downlevelLetConst18.errors.txt @@ -0,0 +1,40 @@ +tests/cases/compiler/downlevelLetConst18.ts(5,14): error TS1250: Function declarations are not allowed inside blocks in strict mode when targeting 'ES3' or 'ES5'. +tests/cases/compiler/downlevelLetConst18.ts(9,14): error TS1250: Function declarations are not allowed inside blocks in strict mode when targeting 'ES3' or 'ES5'. + + +==== tests/cases/compiler/downlevelLetConst18.ts (2 errors) ==== + + 'use strict' + + for (let x; ;) { + function foo() { x }; + ~~~ +!!! error TS1250: Function declarations are not allowed inside blocks in strict mode when targeting 'ES3' or 'ES5'. + } + + for (let x; ;) { + function foo1() { x }; + ~~~~ +!!! error TS1250: Function declarations are not allowed inside blocks in strict mode when targeting 'ES3' or 'ES5'. + } + + for (let x; ;) { + (() => { x })(); + } + + for (const x = 1; ;) { + (() => { x })(); + } + + for (let x; ;) { + ({ foo() { x }}) + } + + for (let x; ;) { + ({ get foo() { return x } }) + } + + for (let x; ;) { + ({ set foo(v) { x } }) + } + \ No newline at end of file diff --git a/tests/baselines/reference/downlevelLetConst18.symbols b/tests/baselines/reference/downlevelLetConst18.symbols deleted file mode 100644 index a1df0dc6ae9..00000000000 --- a/tests/baselines/reference/downlevelLetConst18.symbols +++ /dev/null @@ -1,59 +0,0 @@ -=== tests/cases/compiler/downlevelLetConst18.ts === - -'use strict' - -for (let x; ;) { ->x : Symbol(x, Decl(downlevelLetConst18.ts, 3, 8)) - - function foo() { x }; ->foo : Symbol(foo, Decl(downlevelLetConst18.ts, 3, 16)) ->x : Symbol(x, Decl(downlevelLetConst18.ts, 3, 8)) -} - -for (let x; ;) { ->x : Symbol(x, Decl(downlevelLetConst18.ts, 7, 8)) - - function foo1() { x }; ->foo1 : Symbol(foo1, Decl(downlevelLetConst18.ts, 7, 16)) ->x : Symbol(x, Decl(downlevelLetConst18.ts, 7, 8)) -} - -for (let x; ;) { ->x : Symbol(x, Decl(downlevelLetConst18.ts, 11, 8)) - - (() => { x })(); ->x : Symbol(x, Decl(downlevelLetConst18.ts, 11, 8)) -} - -for (const x = 1; ;) { ->x : Symbol(x, Decl(downlevelLetConst18.ts, 15, 10)) - - (() => { x })(); ->x : Symbol(x, Decl(downlevelLetConst18.ts, 15, 10)) -} - -for (let x; ;) { ->x : Symbol(x, Decl(downlevelLetConst18.ts, 19, 8)) - - ({ foo() { x }}) ->foo : Symbol(foo, Decl(downlevelLetConst18.ts, 20, 6)) ->x : Symbol(x, Decl(downlevelLetConst18.ts, 19, 8)) -} - -for (let x; ;) { ->x : Symbol(x, Decl(downlevelLetConst18.ts, 23, 8)) - - ({ get foo() { return x } }) ->foo : Symbol(foo, Decl(downlevelLetConst18.ts, 24, 6)) ->x : Symbol(x, Decl(downlevelLetConst18.ts, 23, 8)) -} - -for (let x; ;) { ->x : Symbol(x, Decl(downlevelLetConst18.ts, 27, 8)) - - ({ set foo(v) { x } }) ->foo : Symbol(foo, Decl(downlevelLetConst18.ts, 28, 6)) ->v : Symbol(v, Decl(downlevelLetConst18.ts, 28, 15)) ->x : Symbol(x, Decl(downlevelLetConst18.ts, 27, 8)) -} - diff --git a/tests/baselines/reference/downlevelLetConst18.types b/tests/baselines/reference/downlevelLetConst18.types deleted file mode 100644 index 1f7be616124..00000000000 --- a/tests/baselines/reference/downlevelLetConst18.types +++ /dev/null @@ -1,73 +0,0 @@ -=== tests/cases/compiler/downlevelLetConst18.ts === - -'use strict' ->'use strict' : string - -for (let x; ;) { ->x : any - - function foo() { x }; ->foo : () => void ->x : any -} - -for (let x; ;) { ->x : any - - function foo1() { x }; ->foo1 : () => void ->x : any -} - -for (let x; ;) { ->x : any - - (() => { x })(); ->(() => { x })() : void ->(() => { x }) : () => void ->() => { x } : () => void ->x : any -} - -for (const x = 1; ;) { ->x : number ->1 : number - - (() => { x })(); ->(() => { x })() : void ->(() => { x }) : () => void ->() => { x } : () => void ->x : number -} - -for (let x; ;) { ->x : any - - ({ foo() { x }}) ->({ foo() { x }}) : { foo(): void; } ->{ foo() { x }} : { foo(): void; } ->foo : () => void ->x : any -} - -for (let x; ;) { ->x : any - - ({ get foo() { return x } }) ->({ get foo() { return x } }) : { readonly foo: any; } ->{ get foo() { return x } } : { readonly foo: any; } ->foo : any ->x : any -} - -for (let x; ;) { ->x : any - - ({ set foo(v) { x } }) ->({ set foo(v) { x } }) : { foo: any; } ->{ set foo(v) { x } } : { foo: any; } ->foo : any ->v : any ->x : any -} - diff --git a/tests/baselines/reference/downlevelLetConst19.errors.txt b/tests/baselines/reference/downlevelLetConst19.errors.txt new file mode 100644 index 00000000000..ef8583347bd --- /dev/null +++ b/tests/baselines/reference/downlevelLetConst19.errors.txt @@ -0,0 +1,25 @@ +tests/cases/compiler/downlevelLetConst19.ts(9,14): error TS1250: Function declarations are not allowed inside blocks in strict mode when targeting 'ES3' or 'ES5'. + + +==== tests/cases/compiler/downlevelLetConst19.ts (1 errors) ==== + 'use strict' + declare function use(a: any); + var x; + function a() { + { + let x; + use(x); + + function b() { + ~ +!!! error TS1250: Function declarations are not allowed inside blocks in strict mode when targeting 'ES3' or 'ES5'. + { + let x; + use(x); + } + use(x); + } + } + use(x) + } + use(x) \ No newline at end of file diff --git a/tests/baselines/reference/downlevelLetConst19.symbols b/tests/baselines/reference/downlevelLetConst19.symbols deleted file mode 100644 index 9ed23e43447..00000000000 --- a/tests/baselines/reference/downlevelLetConst19.symbols +++ /dev/null @@ -1,42 +0,0 @@ -=== tests/cases/compiler/downlevelLetConst19.ts === -'use strict' -declare function use(a: any); ->use : Symbol(use, Decl(downlevelLetConst19.ts, 0, 12)) ->a : Symbol(a, Decl(downlevelLetConst19.ts, 1, 21)) - -var x; ->x : Symbol(x, Decl(downlevelLetConst19.ts, 2, 3)) - -function a() { ->a : Symbol(a, Decl(downlevelLetConst19.ts, 2, 6)) - { - let x; ->x : Symbol(x, Decl(downlevelLetConst19.ts, 5, 7)) - - use(x); ->use : Symbol(use, Decl(downlevelLetConst19.ts, 0, 12)) ->x : Symbol(x, Decl(downlevelLetConst19.ts, 5, 7)) - - function b() { ->b : Symbol(b, Decl(downlevelLetConst19.ts, 6, 11)) - { - let x; ->x : Symbol(x, Decl(downlevelLetConst19.ts, 10, 15)) - - use(x); ->use : Symbol(use, Decl(downlevelLetConst19.ts, 0, 12)) ->x : Symbol(x, Decl(downlevelLetConst19.ts, 10, 15)) - } - use(x); ->use : Symbol(use, Decl(downlevelLetConst19.ts, 0, 12)) ->x : Symbol(x, Decl(downlevelLetConst19.ts, 5, 7)) - } - } - use(x) ->use : Symbol(use, Decl(downlevelLetConst19.ts, 0, 12)) ->x : Symbol(x, Decl(downlevelLetConst19.ts, 2, 3)) -} -use(x) ->use : Symbol(use, Decl(downlevelLetConst19.ts, 0, 12)) ->x : Symbol(x, Decl(downlevelLetConst19.ts, 2, 3)) - diff --git a/tests/baselines/reference/downlevelLetConst19.types b/tests/baselines/reference/downlevelLetConst19.types deleted file mode 100644 index 687033c195a..00000000000 --- a/tests/baselines/reference/downlevelLetConst19.types +++ /dev/null @@ -1,49 +0,0 @@ -=== tests/cases/compiler/downlevelLetConst19.ts === -'use strict' ->'use strict' : string - -declare function use(a: any); ->use : (a: any) => any ->a : any - -var x; ->x : any - -function a() { ->a : () => void - { - let x; ->x : any - - use(x); ->use(x) : any ->use : (a: any) => any ->x : any - - function b() { ->b : () => void - { - let x; ->x : any - - use(x); ->use(x) : any ->use : (a: any) => any ->x : any - } - use(x); ->use(x) : any ->use : (a: any) => any ->x : any - } - } - use(x) ->use(x) : any ->use : (a: any) => any ->x : any -} -use(x) ->use(x) : any ->use : (a: any) => any ->x : any - diff --git a/tests/baselines/reference/emitArrowFunctionWhenUsingArguments14_ES6.symbols b/tests/baselines/reference/emitArrowFunctionWhenUsingArguments14_ES6.symbols index f5846be3738..fe6788b31f5 100644 --- a/tests/baselines/reference/emitArrowFunctionWhenUsingArguments14_ES6.symbols +++ b/tests/baselines/reference/emitArrowFunctionWhenUsingArguments14_ES6.symbols @@ -4,9 +4,9 @@ function f() { >f : Symbol(f, Decl(emitArrowFunctionWhenUsingArguments14_ES6.ts, 0, 0)) if (Math.random()) { ->Math.random : Symbol(Math.random, Decl(lib.d.ts, --, --)) ->Math : Symbol(Math, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->random : Symbol(Math.random, Decl(lib.d.ts, --, --)) +>Math.random : Symbol(Math.random, Decl(lib.es5.d.ts, --, --)) +>Math : Symbol(Math, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --)) +>random : Symbol(Math.random, Decl(lib.es5.d.ts, --, --)) let arguments = 100; >arguments : Symbol(arguments, Decl(emitArrowFunctionWhenUsingArguments14_ES6.ts, 3, 11)) diff --git a/tests/baselines/reference/emitArrowFunctionWhenUsingArguments15_ES6.symbols b/tests/baselines/reference/emitArrowFunctionWhenUsingArguments15_ES6.symbols index 648f04b0814..63ee68f0aa7 100644 --- a/tests/baselines/reference/emitArrowFunctionWhenUsingArguments15_ES6.symbols +++ b/tests/baselines/reference/emitArrowFunctionWhenUsingArguments15_ES6.symbols @@ -7,9 +7,9 @@ function f() { >arguments : Symbol(arguments, Decl(emitArrowFunctionWhenUsingArguments15_ES6.ts, 2, 7)) if (Math.random()) { ->Math.random : Symbol(Math.random, Decl(lib.d.ts, --, --)) ->Math : Symbol(Math, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->random : Symbol(Math.random, Decl(lib.d.ts, --, --)) +>Math.random : Symbol(Math.random, Decl(lib.es5.d.ts, --, --)) +>Math : Symbol(Math, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --)) +>random : Symbol(Math.random, Decl(lib.es5.d.ts, --, --)) const arguments = 100; >arguments : Symbol(arguments, Decl(emitArrowFunctionWhenUsingArguments15_ES6.ts, 4, 13)) diff --git a/tests/baselines/reference/emitArrowFunctionWhenUsingArguments16_ES6.symbols b/tests/baselines/reference/emitArrowFunctionWhenUsingArguments16_ES6.symbols index bc9fcbfa159..6ea3019f1e6 100644 --- a/tests/baselines/reference/emitArrowFunctionWhenUsingArguments16_ES6.symbols +++ b/tests/baselines/reference/emitArrowFunctionWhenUsingArguments16_ES6.symbols @@ -7,9 +7,9 @@ function f() { >arguments : Symbol(arguments, Decl(emitArrowFunctionWhenUsingArguments16_ES6.ts, 2, 7), Decl(emitArrowFunctionWhenUsingArguments16_ES6.ts, 6, 7)) if (Math.random()) { ->Math.random : Symbol(Math.random, Decl(lib.d.ts, --, --)) ->Math : Symbol(Math, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->random : Symbol(Math.random, Decl(lib.d.ts, --, --)) +>Math.random : Symbol(Math.random, Decl(lib.es5.d.ts, --, --)) +>Math : Symbol(Math, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --)) +>random : Symbol(Math.random, Decl(lib.es5.d.ts, --, --)) return () => arguments[0]; >arguments : Symbol(arguments) diff --git a/tests/baselines/reference/emitArrowFunctionWhenUsingArguments17_ES6.symbols b/tests/baselines/reference/emitArrowFunctionWhenUsingArguments17_ES6.symbols index 65f4e121d10..a7d5e457056 100644 --- a/tests/baselines/reference/emitArrowFunctionWhenUsingArguments17_ES6.symbols +++ b/tests/baselines/reference/emitArrowFunctionWhenUsingArguments17_ES6.symbols @@ -8,9 +8,9 @@ function f() { >arguments : Symbol(arguments, Decl(emitArrowFunctionWhenUsingArguments17_ES6.ts, 2, 25)) if (Math.random()) { ->Math.random : Symbol(Math.random, Decl(lib.d.ts, --, --)) ->Math : Symbol(Math, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->random : Symbol(Math.random, Decl(lib.d.ts, --, --)) +>Math.random : Symbol(Math.random, Decl(lib.es5.d.ts, --, --)) +>Math : Symbol(Math, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --)) +>random : Symbol(Math.random, Decl(lib.es5.d.ts, --, --)) return () => arguments[0]; >arguments : Symbol(arguments) diff --git a/tests/baselines/reference/emitArrowFunctionWhenUsingArguments18_ES6.symbols b/tests/baselines/reference/emitArrowFunctionWhenUsingArguments18_ES6.symbols index a15a10c29d8..e59ed6b8537 100644 --- a/tests/baselines/reference/emitArrowFunctionWhenUsingArguments18_ES6.symbols +++ b/tests/baselines/reference/emitArrowFunctionWhenUsingArguments18_ES6.symbols @@ -9,9 +9,9 @@ function f() { >arguments : Symbol(arguments, Decl(emitArrowFunctionWhenUsingArguments18_ES6.ts, 2, 31)) if (Math.random()) { ->Math.random : Symbol(Math.random, Decl(lib.d.ts, --, --)) ->Math : Symbol(Math, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->random : Symbol(Math.random, Decl(lib.d.ts, --, --)) +>Math.random : Symbol(Math.random, Decl(lib.es5.d.ts, --, --)) +>Math : Symbol(Math, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --)) +>random : Symbol(Math.random, Decl(lib.es5.d.ts, --, --)) return () => arguments; >arguments : Symbol(arguments) diff --git a/tests/baselines/reference/emitCompoundExponentiationAssignmentWithIndexingOnLHS3.symbols b/tests/baselines/reference/emitCompoundExponentiationAssignmentWithIndexingOnLHS3.symbols index dbd5aa150dc..4da659c4a1a 100644 --- a/tests/baselines/reference/emitCompoundExponentiationAssignmentWithIndexingOnLHS3.symbols +++ b/tests/baselines/reference/emitCompoundExponentiationAssignmentWithIndexingOnLHS3.symbols @@ -8,11 +8,18 @@ var object = { get 0() { return this._0; +>this._0 : Symbol(_0, Decl(emitCompoundExponentiationAssignmentWithIndexingOnLHS3.ts, 1, 14)) +>this : Symbol(, Decl(emitCompoundExponentiationAssignmentWithIndexingOnLHS3.ts, 1, 12)) +>_0 : Symbol(_0, Decl(emitCompoundExponentiationAssignmentWithIndexingOnLHS3.ts, 1, 14)) + }, set 0(x: number) { >x : Symbol(x, Decl(emitCompoundExponentiationAssignmentWithIndexingOnLHS3.ts, 6, 10)) this._0 = x; +>this._0 : Symbol(_0, Decl(emitCompoundExponentiationAssignmentWithIndexingOnLHS3.ts, 1, 14)) +>this : Symbol(, Decl(emitCompoundExponentiationAssignmentWithIndexingOnLHS3.ts, 1, 12)) +>_0 : Symbol(_0, Decl(emitCompoundExponentiationAssignmentWithIndexingOnLHS3.ts, 1, 14)) >x : Symbol(x, Decl(emitCompoundExponentiationAssignmentWithIndexingOnLHS3.ts, 6, 10)) }, diff --git a/tests/baselines/reference/emitCompoundExponentiationAssignmentWithIndexingOnLHS3.types b/tests/baselines/reference/emitCompoundExponentiationAssignmentWithIndexingOnLHS3.types index 1877f391207..b47c88f3de3 100644 --- a/tests/baselines/reference/emitCompoundExponentiationAssignmentWithIndexingOnLHS3.types +++ b/tests/baselines/reference/emitCompoundExponentiationAssignmentWithIndexingOnLHS3.types @@ -10,9 +10,9 @@ var object = { get 0() { return this._0; ->this._0 : any ->this : any ->_0 : any +>this._0 : number +>this : { 0: number; _0: number; } +>_0 : number }, set 0(x: number) { @@ -20,9 +20,9 @@ var object = { this._0 = x; >this._0 = x : number ->this._0 : any ->this : any ->_0 : any +>this._0 : number +>this : { 0: number; _0: number; } +>_0 : number >x : number }, diff --git a/tests/baselines/reference/equalityWithIntersectionTypes01.errors.txt b/tests/baselines/reference/equalityWithIntersectionTypes01.errors.txt new file mode 100644 index 00000000000..8bffff2218b --- /dev/null +++ b/tests/baselines/reference/equalityWithIntersectionTypes01.errors.txt @@ -0,0 +1,51 @@ +tests/cases/conformance/types/typeRelationships/comparable/equalityWithIntersectionTypes01.ts(17,5): error TS2365: Operator '===' cannot be applied to types 'I1 & I3' and 'I2'. +tests/cases/conformance/types/typeRelationships/comparable/equalityWithIntersectionTypes01.ts(17,16): error TS2365: Operator '===' cannot be applied to types 'I2' and 'I1 & I3'. +tests/cases/conformance/types/typeRelationships/comparable/equalityWithIntersectionTypes01.ts(19,10): error TS2365: Operator '!==' cannot be applied to types 'I1 & I3' and 'I2'. +tests/cases/conformance/types/typeRelationships/comparable/equalityWithIntersectionTypes01.ts(19,21): error TS2365: Operator '!==' cannot be applied to types 'I2' and 'I1 & I3'. +tests/cases/conformance/types/typeRelationships/comparable/equalityWithIntersectionTypes01.ts(21,10): error TS2365: Operator '==' cannot be applied to types 'I1 & I3' and 'I2'. +tests/cases/conformance/types/typeRelationships/comparable/equalityWithIntersectionTypes01.ts(21,20): error TS2365: Operator '==' cannot be applied to types 'I2' and 'I1 & I3'. +tests/cases/conformance/types/typeRelationships/comparable/equalityWithIntersectionTypes01.ts(23,10): error TS2365: Operator '!=' cannot be applied to types 'I1 & I3' and 'I2'. +tests/cases/conformance/types/typeRelationships/comparable/equalityWithIntersectionTypes01.ts(23,20): error TS2365: Operator '!=' cannot be applied to types 'I2' and 'I1 & I3'. + + +==== tests/cases/conformance/types/typeRelationships/comparable/equalityWithIntersectionTypes01.ts (8 errors) ==== + interface I1 { + p1: number + } + + interface I2 extends I1 { + p2: number; + } + + interface I3 { + p3: number; + } + + var x = { p1: 10, p2: 20, p3: 30 }; + var y: I1 & I3 = x; + var z: I2 = x; + + if (y === z || z === y) { + ~~~~~~~ +!!! error TS2365: Operator '===' cannot be applied to types 'I1 & I3' and 'I2'. + ~~~~~~~ +!!! error TS2365: Operator '===' cannot be applied to types 'I2' and 'I1 & I3'. + } + else if (y !== z || z !== y) { + ~~~~~~~ +!!! error TS2365: Operator '!==' cannot be applied to types 'I1 & I3' and 'I2'. + ~~~~~~~ +!!! error TS2365: Operator '!==' cannot be applied to types 'I2' and 'I1 & I3'. + } + else if (y == z || z == y) { + ~~~~~~ +!!! error TS2365: Operator '==' cannot be applied to types 'I1 & I3' and 'I2'. + ~~~~~~ +!!! error TS2365: Operator '==' cannot be applied to types 'I2' and 'I1 & I3'. + } + else if (y != z || z != y) { + ~~~~~~ +!!! error TS2365: Operator '!=' cannot be applied to types 'I1 & I3' and 'I2'. + ~~~~~~ +!!! error TS2365: Operator '!=' cannot be applied to types 'I2' and 'I1 & I3'. + } \ No newline at end of file diff --git a/tests/baselines/reference/equalityWithIntersectionTypes01.js b/tests/baselines/reference/equalityWithIntersectionTypes01.js new file mode 100644 index 00000000000..151809bb6f8 --- /dev/null +++ b/tests/baselines/reference/equalityWithIntersectionTypes01.js @@ -0,0 +1,38 @@ +//// [equalityWithIntersectionTypes01.ts] +interface I1 { + p1: number +} + +interface I2 extends I1 { + p2: number; +} + +interface I3 { + p3: number; +} + +var x = { p1: 10, p2: 20, p3: 30 }; +var y: I1 & I3 = x; +var z: I2 = x; + +if (y === z || z === y) { +} +else if (y !== z || z !== y) { +} +else if (y == z || z == y) { +} +else if (y != z || z != y) { +} + +//// [equalityWithIntersectionTypes01.js] +var x = { p1: 10, p2: 20, p3: 30 }; +var y = x; +var z = x; +if (y === z || z === y) { +} +else if (y !== z || z !== y) { +} +else if (y == z || z == y) { +} +else if (y != z || z != y) { +} diff --git a/tests/baselines/reference/equalityWithUnionTypes01.js b/tests/baselines/reference/equalityWithUnionTypes01.js new file mode 100644 index 00000000000..05e9f25cd69 --- /dev/null +++ b/tests/baselines/reference/equalityWithUnionTypes01.js @@ -0,0 +1,34 @@ +//// [equalityWithUnionTypes01.ts] +interface I1 { + p1: number +} + +interface I2 extends I1 { + p2: number; +} + +var x = { p1: 10, p2: 20 }; +var y: number | I2 = x; +var z: I1 = x; + +if (y === z || z === y) { +} +else if (y !== z || z !== y) { +} +else if (y == z || z == y) { +} +else if (y != z || z != y) { +} + +//// [equalityWithUnionTypes01.js] +var x = { p1: 10, p2: 20 }; +var y = x; +var z = x; +if (y === z || z === y) { +} +else if (y !== z || z !== y) { +} +else if (y == z || z == y) { +} +else if (y != z || z != y) { +} diff --git a/tests/baselines/reference/equalityWithUnionTypes01.symbols b/tests/baselines/reference/equalityWithUnionTypes01.symbols new file mode 100644 index 00000000000..0b1a6892517 --- /dev/null +++ b/tests/baselines/reference/equalityWithUnionTypes01.symbols @@ -0,0 +1,55 @@ +=== tests/cases/conformance/types/typeRelationships/comparable/equalityWithUnionTypes01.ts === +interface I1 { +>I1 : Symbol(I1, Decl(equalityWithUnionTypes01.ts, 0, 0)) + + p1: number +>p1 : Symbol(I1.p1, Decl(equalityWithUnionTypes01.ts, 0, 14)) +} + +interface I2 extends I1 { +>I2 : Symbol(I2, Decl(equalityWithUnionTypes01.ts, 2, 1)) +>I1 : Symbol(I1, Decl(equalityWithUnionTypes01.ts, 0, 0)) + + p2: number; +>p2 : Symbol(I2.p2, Decl(equalityWithUnionTypes01.ts, 4, 25)) +} + +var x = { p1: 10, p2: 20 }; +>x : Symbol(x, Decl(equalityWithUnionTypes01.ts, 8, 3)) +>p1 : Symbol(p1, Decl(equalityWithUnionTypes01.ts, 8, 9)) +>p2 : Symbol(p2, Decl(equalityWithUnionTypes01.ts, 8, 17)) + +var y: number | I2 = x; +>y : Symbol(y, Decl(equalityWithUnionTypes01.ts, 9, 3)) +>I2 : Symbol(I2, Decl(equalityWithUnionTypes01.ts, 2, 1)) +>x : Symbol(x, Decl(equalityWithUnionTypes01.ts, 8, 3)) + +var z: I1 = x; +>z : Symbol(z, Decl(equalityWithUnionTypes01.ts, 10, 3)) +>I1 : Symbol(I1, Decl(equalityWithUnionTypes01.ts, 0, 0)) +>x : Symbol(x, Decl(equalityWithUnionTypes01.ts, 8, 3)) + +if (y === z || z === y) { +>y : Symbol(y, Decl(equalityWithUnionTypes01.ts, 9, 3)) +>z : Symbol(z, Decl(equalityWithUnionTypes01.ts, 10, 3)) +>z : Symbol(z, Decl(equalityWithUnionTypes01.ts, 10, 3)) +>y : Symbol(y, Decl(equalityWithUnionTypes01.ts, 9, 3)) +} +else if (y !== z || z !== y) { +>y : Symbol(y, Decl(equalityWithUnionTypes01.ts, 9, 3)) +>z : Symbol(z, Decl(equalityWithUnionTypes01.ts, 10, 3)) +>z : Symbol(z, Decl(equalityWithUnionTypes01.ts, 10, 3)) +>y : Symbol(y, Decl(equalityWithUnionTypes01.ts, 9, 3)) +} +else if (y == z || z == y) { +>y : Symbol(y, Decl(equalityWithUnionTypes01.ts, 9, 3)) +>z : Symbol(z, Decl(equalityWithUnionTypes01.ts, 10, 3)) +>z : Symbol(z, Decl(equalityWithUnionTypes01.ts, 10, 3)) +>y : Symbol(y, Decl(equalityWithUnionTypes01.ts, 9, 3)) +} +else if (y != z || z != y) { +>y : Symbol(y, Decl(equalityWithUnionTypes01.ts, 9, 3)) +>z : Symbol(z, Decl(equalityWithUnionTypes01.ts, 10, 3)) +>z : Symbol(z, Decl(equalityWithUnionTypes01.ts, 10, 3)) +>y : Symbol(y, Decl(equalityWithUnionTypes01.ts, 9, 3)) +} diff --git a/tests/baselines/reference/equalityWithUnionTypes01.types b/tests/baselines/reference/equalityWithUnionTypes01.types new file mode 100644 index 00000000000..27bf01c048b --- /dev/null +++ b/tests/baselines/reference/equalityWithUnionTypes01.types @@ -0,0 +1,70 @@ +=== tests/cases/conformance/types/typeRelationships/comparable/equalityWithUnionTypes01.ts === +interface I1 { +>I1 : I1 + + p1: number +>p1 : number +} + +interface I2 extends I1 { +>I2 : I2 +>I1 : I1 + + p2: number; +>p2 : number +} + +var x = { p1: 10, p2: 20 }; +>x : { p1: number; p2: number; } +>{ p1: 10, p2: 20 } : { p1: number; p2: number; } +>p1 : number +>10 : number +>p2 : number +>20 : number + +var y: number | I2 = x; +>y : number | I2 +>I2 : I2 +>x : { p1: number; p2: number; } + +var z: I1 = x; +>z : I1 +>I1 : I1 +>x : { p1: number; p2: number; } + +if (y === z || z === y) { +>y === z || z === y : boolean +>y === z : boolean +>y : number | I2 +>z : I1 +>z === y : boolean +>z : I1 +>y : number | I2 +} +else if (y !== z || z !== y) { +>y !== z || z !== y : boolean +>y !== z : boolean +>y : number | I2 +>z : I1 +>z !== y : boolean +>z : I1 +>y : number | I2 +} +else if (y == z || z == y) { +>y == z || z == y : boolean +>y == z : boolean +>y : number | I2 +>z : I1 +>z == y : boolean +>z : I1 +>y : number | I2 +} +else if (y != z || z != y) { +>y != z || z != y : boolean +>y != z : boolean +>y : number | I2 +>z : I1 +>z != y : boolean +>z : I1 +>y : number | I2 +} diff --git a/tests/baselines/reference/everyTypeAssignableToAny.symbols b/tests/baselines/reference/everyTypeAssignableToAny.symbols index de62f8d3734..caf8c5e47d6 100644 --- a/tests/baselines/reference/everyTypeAssignableToAny.symbols +++ b/tests/baselines/reference/everyTypeAssignableToAny.symbols @@ -41,7 +41,7 @@ var d: boolean; var e: Date; >e : Symbol(e, Decl(everyTypeAssignableToAny.ts, 17, 3)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) var f: any; >f : Symbol(f, Decl(everyTypeAssignableToAny.ts, 18, 3)) @@ -83,11 +83,11 @@ var o: (x: T) => T; var p: Number; >p : Symbol(p, Decl(everyTypeAssignableToAny.ts, 28, 3)) ->Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) var q: String; >q : Symbol(q, Decl(everyTypeAssignableToAny.ts, 29, 3)) ->String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) a = b; >a : Symbol(a, Decl(everyTypeAssignableToAny.ts, 0, 3)) @@ -166,7 +166,7 @@ function foo(x: T, y: U, z: V) { >T : Symbol(T, Decl(everyTypeAssignableToAny.ts, 50, 13)) >U : Symbol(U, Decl(everyTypeAssignableToAny.ts, 50, 15)) >V : Symbol(V, Decl(everyTypeAssignableToAny.ts, 50, 32)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >x : Symbol(x, Decl(everyTypeAssignableToAny.ts, 50, 49)) >T : Symbol(T, Decl(everyTypeAssignableToAny.ts, 50, 13)) >y : Symbol(y, Decl(everyTypeAssignableToAny.ts, 50, 54)) diff --git a/tests/baselines/reference/everyTypeWithAnnotationAndInitializer.symbols b/tests/baselines/reference/everyTypeWithAnnotationAndInitializer.symbols index b97f34bfcc8..8667507fb51 100644 --- a/tests/baselines/reference/everyTypeWithAnnotationAndInitializer.symbols +++ b/tests/baselines/reference/everyTypeWithAnnotationAndInitializer.symbols @@ -64,8 +64,8 @@ var aString: string = 'this is a string'; var aDate: Date = new Date(12); >aDate : Symbol(aDate, Decl(everyTypeWithAnnotationAndInitializer.ts, 26, 3)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) var anObject: Object = new Object(); >anObject : Symbol(anObject, Decl(everyTypeWithAnnotationAndInitializer.ts, 27, 3)) diff --git a/tests/baselines/reference/everyTypeWithInitializer.symbols b/tests/baselines/reference/everyTypeWithInitializer.symbols index 25a342ed18e..ba269fbc536 100644 --- a/tests/baselines/reference/everyTypeWithInitializer.symbols +++ b/tests/baselines/reference/everyTypeWithInitializer.symbols @@ -64,7 +64,7 @@ var aString = 'this is a string'; var aDate = new Date(12); >aDate : Symbol(aDate, Decl(everyTypeWithInitializer.ts, 26, 3)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) var anObject = new Object(); >anObject : Symbol(anObject, Decl(everyTypeWithInitializer.ts, 27, 3)) diff --git a/tests/baselines/reference/exportAssignValueAndType.symbols b/tests/baselines/reference/exportAssignValueAndType.symbols index e7049557619..3d5495b4874 100644 --- a/tests/baselines/reference/exportAssignValueAndType.symbols +++ b/tests/baselines/reference/exportAssignValueAndType.symbols @@ -16,7 +16,7 @@ interface server { startTime: Date; >startTime : Symbol(server.startTime, Decl(exportAssignValueAndType.ts, 5, 20)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) } var x = 5; @@ -24,7 +24,7 @@ var x = 5; var server = new Date(); >server : Symbol(server, Decl(exportAssignValueAndType.ts, 2, 1), Decl(exportAssignValueAndType.ts, 10, 3)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) export = server; >server : Symbol(server, Decl(exportAssignValueAndType.ts, 2, 1), Decl(exportAssignValueAndType.ts, 10, 3)) diff --git a/tests/baselines/reference/exportAssignedTypeAsTypeAnnotation.symbols b/tests/baselines/reference/exportAssignedTypeAsTypeAnnotation.symbols index d06bac73e4f..79392369c3f 100644 --- a/tests/baselines/reference/exportAssignedTypeAsTypeAnnotation.symbols +++ b/tests/baselines/reference/exportAssignedTypeAsTypeAnnotation.symbols @@ -13,7 +13,7 @@ interface x { >x : Symbol(x, Decl(exportAssignedTypeAsTypeAnnotation_0.ts, 0, 0)) (): Date; ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) foo: string; >foo : Symbol(x.foo, Decl(exportAssignedTypeAsTypeAnnotation_0.ts, 2, 13)) diff --git a/tests/baselines/reference/exportEqualNamespaces.symbols b/tests/baselines/reference/exportEqualNamespaces.symbols index c8e6565c929..0c2890b028a 100644 --- a/tests/baselines/reference/exportEqualNamespaces.symbols +++ b/tests/baselines/reference/exportEqualNamespaces.symbols @@ -16,7 +16,7 @@ interface server { startTime: Date; >startTime : Symbol(server.startTime, Decl(exportEqualNamespaces.ts, 5, 22)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) } var x = 5; @@ -24,7 +24,7 @@ var x = 5; var server = new Date(); >server : Symbol(server, Decl(exportEqualNamespaces.ts, 0, 0), Decl(exportEqualNamespaces.ts, 2, 1), Decl(exportEqualNamespaces.ts, 10, 3)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) export = server; >server : Symbol(server, Decl(exportEqualNamespaces.ts, 0, 0), Decl(exportEqualNamespaces.ts, 2, 1), Decl(exportEqualNamespaces.ts, 10, 3)) diff --git a/tests/baselines/reference/extendNumberInterface.symbols b/tests/baselines/reference/extendNumberInterface.symbols index 2eb64c13c88..febe4993e2a 100644 --- a/tests/baselines/reference/extendNumberInterface.symbols +++ b/tests/baselines/reference/extendNumberInterface.symbols @@ -1,6 +1,6 @@ === tests/cases/conformance/types/primitives/number/extendNumberInterface.ts === interface Number { ->Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(extendNumberInterface.ts, 0, 0)) +>Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(extendNumberInterface.ts, 0, 0)) doStuff(): string; >doStuff : Symbol(Number.doStuff, Decl(extendNumberInterface.ts, 0, 18)) diff --git a/tests/baselines/reference/extendStringInterface.symbols b/tests/baselines/reference/extendStringInterface.symbols index a4d3c31d97c..67773fa30bd 100644 --- a/tests/baselines/reference/extendStringInterface.symbols +++ b/tests/baselines/reference/extendStringInterface.symbols @@ -1,6 +1,6 @@ === tests/cases/conformance/types/primitives/string/extendStringInterface.ts === interface String { ->String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(extendStringInterface.ts, 0, 0)) +>String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(extendStringInterface.ts, 0, 0)) doStuff(): string; >doStuff : Symbol(String.doStuff, Decl(extendStringInterface.ts, 0, 18)) diff --git a/tests/baselines/reference/fatarrowfunctionsInFunctionParameterDefaults.symbols b/tests/baselines/reference/fatarrowfunctionsInFunctionParameterDefaults.symbols index ea0ed9a605c..b836bc88573 100644 --- a/tests/baselines/reference/fatarrowfunctionsInFunctionParameterDefaults.symbols +++ b/tests/baselines/reference/fatarrowfunctionsInFunctionParameterDefaults.symbols @@ -12,7 +12,7 @@ function fn(x = () => this, y = x()) { } fn.call(4); // Should be 4 ->fn.call : Symbol(Function.call, Decl(lib.d.ts, --, --)) +>fn.call : Symbol(Function.call, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >fn : Symbol(fn, Decl(fatarrowfunctionsInFunctionParameterDefaults.ts, 0, 0)) ->call : Symbol(Function.call, Decl(lib.d.ts, --, --)) +>call : Symbol(Function.call, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) diff --git a/tests/baselines/reference/fatarrowfunctionsInFunctionParameterDefaults.types b/tests/baselines/reference/fatarrowfunctionsInFunctionParameterDefaults.types index 55d72e854d3..58c576bf24e 100644 --- a/tests/baselines/reference/fatarrowfunctionsInFunctionParameterDefaults.types +++ b/tests/baselines/reference/fatarrowfunctionsInFunctionParameterDefaults.types @@ -16,8 +16,8 @@ function fn(x = () => this, y = x()) { fn.call(4); // Should be 4 >fn.call(4) : any ->fn.call : (thisArg: any, ...argArray: any[]) => any +>fn.call : { (this: (this: T, ...argArray: any[]) => U, thisArg: T, ...argArray: any[]): U; (this: Function, thisArg: any, ...argArray: any[]): any; } >fn : (x?: () => any, y?: any) => any ->call : (thisArg: any, ...argArray: any[]) => any +>call : { (this: (this: T, ...argArray: any[]) => U, thisArg: T, ...argArray: any[]): U; (this: Function, thisArg: any, ...argArray: any[]): any; } >4 : number diff --git a/tests/baselines/reference/for-inStatementsArray.symbols b/tests/baselines/reference/for-inStatementsArray.symbols index 5b6ea9385cd..0d594c193cb 100644 --- a/tests/baselines/reference/for-inStatementsArray.symbols +++ b/tests/baselines/reference/for-inStatementsArray.symbols @@ -1,7 +1,7 @@ === tests/cases/conformance/statements/for-inStatements/for-inStatementsArray.ts === let a: Date[]; >a : Symbol(a, Decl(for-inStatementsArray.ts, 0, 3)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) let b: boolean[]; >b : Symbol(b, Decl(for-inStatementsArray.ts, 1, 3)) diff --git a/tests/baselines/reference/for-of13.symbols b/tests/baselines/reference/for-of13.symbols index bcfc3f981bd..d257ed5290a 100644 --- a/tests/baselines/reference/for-of13.symbols +++ b/tests/baselines/reference/for-of13.symbols @@ -4,6 +4,6 @@ var v: string; for (v of [""].values()) { } >v : Symbol(v, Decl(for-of13.ts, 0, 3)) ->[""].values : Symbol(Array.values, Decl(lib.d.ts, --, --)) ->values : Symbol(Array.values, Decl(lib.d.ts, --, --)) +>[""].values : Symbol(Array.values, Decl(lib.es2015.iterable.d.ts, --, --)) +>values : Symbol(Array.values, Decl(lib.es2015.iterable.d.ts, --, --)) diff --git a/tests/baselines/reference/for-of18.symbols b/tests/baselines/reference/for-of18.symbols index 24bbd8f7119..191b33e858e 100644 --- a/tests/baselines/reference/for-of18.symbols +++ b/tests/baselines/reference/for-of18.symbols @@ -22,9 +22,9 @@ class StringIterator { }; } [Symbol.iterator]() { ->Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) +>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) return this; >this : Symbol(StringIterator, Decl(for-of18.ts, 1, 33)) diff --git a/tests/baselines/reference/for-of19.symbols b/tests/baselines/reference/for-of19.symbols index 202ac2b0725..a11ee1da53b 100644 --- a/tests/baselines/reference/for-of19.symbols +++ b/tests/baselines/reference/for-of19.symbols @@ -27,9 +27,9 @@ class FooIterator { }; } [Symbol.iterator]() { ->Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) +>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) return this; >this : Symbol(FooIterator, Decl(for-of19.ts, 4, 13)) diff --git a/tests/baselines/reference/for-of20.symbols b/tests/baselines/reference/for-of20.symbols index 75d5b54e221..9ec6d4edea1 100644 --- a/tests/baselines/reference/for-of20.symbols +++ b/tests/baselines/reference/for-of20.symbols @@ -27,9 +27,9 @@ class FooIterator { }; } [Symbol.iterator]() { ->Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) +>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) return this; >this : Symbol(FooIterator, Decl(for-of20.ts, 4, 13)) diff --git a/tests/baselines/reference/for-of21.symbols b/tests/baselines/reference/for-of21.symbols index 7bfaf450bef..3e9d50ac041 100644 --- a/tests/baselines/reference/for-of21.symbols +++ b/tests/baselines/reference/for-of21.symbols @@ -27,9 +27,9 @@ class FooIterator { }; } [Symbol.iterator]() { ->Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) +>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) return this; >this : Symbol(FooIterator, Decl(for-of21.ts, 4, 13)) diff --git a/tests/baselines/reference/for-of22.symbols b/tests/baselines/reference/for-of22.symbols index 9ab9bf378f5..6ce5fe1181a 100644 --- a/tests/baselines/reference/for-of22.symbols +++ b/tests/baselines/reference/for-of22.symbols @@ -28,9 +28,9 @@ class FooIterator { }; } [Symbol.iterator]() { ->Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) +>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) return this; >this : Symbol(FooIterator, Decl(for-of22.ts, 5, 13)) diff --git a/tests/baselines/reference/for-of23.symbols b/tests/baselines/reference/for-of23.symbols index 6223c93de37..ce20bb81b79 100644 --- a/tests/baselines/reference/for-of23.symbols +++ b/tests/baselines/reference/for-of23.symbols @@ -27,9 +27,9 @@ class FooIterator { }; } [Symbol.iterator]() { ->Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) +>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) return this; >this : Symbol(FooIterator, Decl(for-of23.ts, 4, 13)) diff --git a/tests/baselines/reference/for-of25.symbols b/tests/baselines/reference/for-of25.symbols index dfa358da0bd..6c80a560efa 100644 --- a/tests/baselines/reference/for-of25.symbols +++ b/tests/baselines/reference/for-of25.symbols @@ -10,9 +10,9 @@ class StringIterator { >StringIterator : Symbol(StringIterator, Decl(for-of25.ts, 1, 37)) [Symbol.iterator]() { ->Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) +>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) return x; >x : Symbol(x, Decl(for-of25.ts, 0, 3)) diff --git a/tests/baselines/reference/for-of26.symbols b/tests/baselines/reference/for-of26.symbols index 60555a08044..9970dea754b 100644 --- a/tests/baselines/reference/for-of26.symbols +++ b/tests/baselines/reference/for-of26.symbols @@ -16,9 +16,9 @@ class StringIterator { >x : Symbol(x, Decl(for-of26.ts, 0, 3)) } [Symbol.iterator]() { ->Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) +>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) return this; >this : Symbol(StringIterator, Decl(for-of26.ts, 1, 37)) diff --git a/tests/baselines/reference/for-of27.symbols b/tests/baselines/reference/for-of27.symbols index 57148c53f13..12452b2ee77 100644 --- a/tests/baselines/reference/for-of27.symbols +++ b/tests/baselines/reference/for-of27.symbols @@ -7,7 +7,7 @@ class StringIterator { >StringIterator : Symbol(StringIterator, Decl(for-of27.ts, 0, 37)) [Symbol.iterator]: any; ->Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) +>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) } diff --git a/tests/baselines/reference/for-of28.symbols b/tests/baselines/reference/for-of28.symbols index c019a4285cd..94c8a1041d1 100644 --- a/tests/baselines/reference/for-of28.symbols +++ b/tests/baselines/reference/for-of28.symbols @@ -10,9 +10,9 @@ class StringIterator { >next : Symbol(StringIterator.next, Decl(for-of28.ts, 2, 22)) [Symbol.iterator]() { ->Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) +>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) return this; >this : Symbol(StringIterator, Decl(for-of28.ts, 0, 37)) diff --git a/tests/baselines/reference/for-of37.symbols b/tests/baselines/reference/for-of37.symbols index b8ce9da9ce2..c9c5c627b8a 100644 --- a/tests/baselines/reference/for-of37.symbols +++ b/tests/baselines/reference/for-of37.symbols @@ -1,7 +1,7 @@ === tests/cases/conformance/es6/for-ofStatements/for-of37.ts === var map = new Map([["", true]]); >map : Symbol(map, Decl(for-of37.ts, 0, 3)) ->Map : Symbol(Map, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Map : Symbol(Map, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.collection.d.ts, --, --), Decl(lib.es2015.collection.d.ts, --, --)) for (var v of map) { >v : Symbol(v, Decl(for-of37.ts, 1, 8)) diff --git a/tests/baselines/reference/for-of38.symbols b/tests/baselines/reference/for-of38.symbols index 18d2dda6db8..d1df1afea3b 100644 --- a/tests/baselines/reference/for-of38.symbols +++ b/tests/baselines/reference/for-of38.symbols @@ -1,7 +1,7 @@ === tests/cases/conformance/es6/for-ofStatements/for-of38.ts === var map = new Map([["", true]]); >map : Symbol(map, Decl(for-of38.ts, 0, 3)) ->Map : Symbol(Map, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Map : Symbol(Map, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.collection.d.ts, --, --), Decl(lib.es2015.collection.d.ts, --, --)) for (var [k, v] of map) { >k : Symbol(k, Decl(for-of38.ts, 1, 10)) diff --git a/tests/baselines/reference/for-of40.symbols b/tests/baselines/reference/for-of40.symbols index a9177d12435..37fff144559 100644 --- a/tests/baselines/reference/for-of40.symbols +++ b/tests/baselines/reference/for-of40.symbols @@ -1,7 +1,7 @@ === tests/cases/conformance/es6/for-ofStatements/for-of40.ts === var map = new Map([["", true]]); >map : Symbol(map, Decl(for-of40.ts, 0, 3)) ->Map : Symbol(Map, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Map : Symbol(Map, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.collection.d.ts, --, --), Decl(lib.es2015.collection.d.ts, --, --)) for (var [k = "", v = false] of map) { >k : Symbol(k, Decl(for-of40.ts, 1, 10)) diff --git a/tests/baselines/reference/for-of44.symbols b/tests/baselines/reference/for-of44.symbols index d7057da0ee2..fb951a6ef8a 100644 --- a/tests/baselines/reference/for-of44.symbols +++ b/tests/baselines/reference/for-of44.symbols @@ -1,7 +1,7 @@ === tests/cases/conformance/es6/for-ofStatements/for-of44.ts === var array: [number, string | boolean | symbol][] = [[0, ""], [0, true], [1, Symbol()]] >array : Symbol(array, Decl(for-of44.ts, 0, 3)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) for (var [num, strBoolSym] of array) { >num : Symbol(num, Decl(for-of44.ts, 1, 10)) diff --git a/tests/baselines/reference/for-of45.symbols b/tests/baselines/reference/for-of45.symbols index 7d8ffd4ba86..3a0968069c8 100644 --- a/tests/baselines/reference/for-of45.symbols +++ b/tests/baselines/reference/for-of45.symbols @@ -5,7 +5,7 @@ var k: string, v: boolean; var map = new Map([["", true]]); >map : Symbol(map, Decl(for-of45.ts, 1, 3)) ->Map : Symbol(Map, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Map : Symbol(Map, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.collection.d.ts, --, --), Decl(lib.es2015.collection.d.ts, --, --)) for ([k = "", v = false] of map) { >k : Symbol(k, Decl(for-of45.ts, 0, 3)) diff --git a/tests/baselines/reference/for-of50.symbols b/tests/baselines/reference/for-of50.symbols index 435390f2a6e..ad9b06d48a9 100644 --- a/tests/baselines/reference/for-of50.symbols +++ b/tests/baselines/reference/for-of50.symbols @@ -1,7 +1,7 @@ === tests/cases/conformance/es6/for-ofStatements/for-of50.ts === var map = new Map([["", true]]); >map : Symbol(map, Decl(for-of50.ts, 0, 3)) ->Map : Symbol(Map, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Map : Symbol(Map, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.collection.d.ts, --, --), Decl(lib.es2015.collection.d.ts, --, --)) for (const [k, v] of map) { >k : Symbol(k, Decl(for-of50.ts, 1, 12)) diff --git a/tests/baselines/reference/for-of57.symbols b/tests/baselines/reference/for-of57.symbols index 191377bdd47..e510b4f9afa 100644 --- a/tests/baselines/reference/for-of57.symbols +++ b/tests/baselines/reference/for-of57.symbols @@ -1,7 +1,7 @@ === tests/cases/conformance/es6/for-ofStatements/for-of57.ts === var iter: Iterable; >iter : Symbol(iter, Decl(for-of57.ts, 0, 3)) ->Iterable : Symbol(Iterable, Decl(lib.d.ts, --, --)) +>Iterable : Symbol(Iterable, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) for (let num of iter) { } >num : Symbol(num, Decl(for-of57.ts, 1, 8)) diff --git a/tests/baselines/reference/forStatements.symbols b/tests/baselines/reference/forStatements.symbols index 4a256ff51dc..84cd7dc70d1 100644 --- a/tests/baselines/reference/forStatements.symbols +++ b/tests/baselines/reference/forStatements.symbols @@ -65,8 +65,8 @@ for(var aString: string = 'this is a string';;){} for(var aDate: Date = new Date(12);;){} >aDate : Symbol(aDate, Decl(forStatements.ts, 27, 7)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) for(var anObject: Object = new Object();;){} >anObject : Symbol(anObject, Decl(forStatements.ts, 28, 7)) diff --git a/tests/baselines/reference/functionConstraintSatisfaction.symbols b/tests/baselines/reference/functionConstraintSatisfaction.symbols index 5955f0059a9..6c7ca5f7713 100644 --- a/tests/baselines/reference/functionConstraintSatisfaction.symbols +++ b/tests/baselines/reference/functionConstraintSatisfaction.symbols @@ -154,7 +154,7 @@ var r11 = foo((x: U) => x); >r11 : Symbol(r11, Decl(functionConstraintSatisfaction.ts, 42, 3)) >foo : Symbol(foo, Decl(functionConstraintSatisfaction.ts, 0, 0)) >U : Symbol(U, Decl(functionConstraintSatisfaction.ts, 42, 15)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >x : Symbol(x, Decl(functionConstraintSatisfaction.ts, 42, 31)) >U : Symbol(U, Decl(functionConstraintSatisfaction.ts, 42, 15)) >x : Symbol(x, Decl(functionConstraintSatisfaction.ts, 42, 31)) diff --git a/tests/baselines/reference/functionExpressionContextualTyping1.symbols b/tests/baselines/reference/functionExpressionContextualTyping1.symbols index a34c9bed4c1..7d4b0ccbb6b 100644 --- a/tests/baselines/reference/functionExpressionContextualTyping1.symbols +++ b/tests/baselines/reference/functionExpressionContextualTyping1.symbols @@ -37,7 +37,7 @@ var a1: (c: Class) => number = (a1) => { >a1 : Symbol(a1, Decl(functionExpressionContextualTyping1.ts, 17, 3)) >c : Symbol(c, Decl(functionExpressionContextualTyping1.ts, 17, 9)) >Class : Symbol(Class, Decl(functionExpressionContextualTyping1.ts, 11, 1)) ->Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >a1 : Symbol(a1, Decl(functionExpressionContextualTyping1.ts, 17, 40)) a1.foo(); diff --git a/tests/baselines/reference/functionImplementationErrors.errors.txt b/tests/baselines/reference/functionImplementationErrors.errors.txt index 86ecb6a6057..dc5ad5a2747 100644 --- a/tests/baselines/reference/functionImplementationErrors.errors.txt +++ b/tests/baselines/reference/functionImplementationErrors.errors.txt @@ -30,13 +30,10 @@ tests/cases/conformance/functions/functionImplementationErrors.ts(70,11): error }; var f3 = () => { ~~~~~~~ - return ''; - ~~~~~~~~~~~~~~ - return 3; - ~~~~~~~~~~~~~ - }; - ~ !!! error TS2354: No best common type exists among return expressions. + return ''; + return 3; + }; // FunctionExpression with no return type annotation with return branch of number[] and other of string[] var f4 = function () { @@ -94,13 +91,10 @@ tests/cases/conformance/functions/functionImplementationErrors.ts(70,11): error }; var f10 = () => { ~~~~~~~ - return new Derived1(); - ~~~~~~~~~~~~~~~~~~~~~~~~~~ - return new Derived2(); - ~~~~~~~~~~~~~~~~~~~~~~~~~~ - }; - ~ !!! error TS2354: No best common type exists among return expressions. + return new Derived1(); + return new Derived2(); + }; function f11() { ~~~ !!! error TS2354: No best common type exists among return expressions. @@ -115,11 +109,8 @@ tests/cases/conformance/functions/functionImplementationErrors.ts(70,11): error }; var f13 = () => { ~~~~~~~ - return new Base(); - ~~~~~~~~~~~~~~~~~~~~~~ - return new AnotherClass(); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - }; - ~ !!! error TS2354: No best common type exists among return expressions. + return new Base(); + return new AnotherClass(); + }; \ No newline at end of file diff --git a/tests/baselines/reference/functionOverloadsOnGenericArity2.symbols b/tests/baselines/reference/functionOverloadsOnGenericArity2.symbols index 9fbe362e33f..750da358d67 100644 --- a/tests/baselines/reference/functionOverloadsOnGenericArity2.symbols +++ b/tests/baselines/reference/functionOverloadsOnGenericArity2.symbols @@ -16,5 +16,5 @@ interface I { >U : Symbol(U, Decl(functionOverloadsOnGenericArity2.ts, 3, 9)) >T : Symbol(T, Decl(functionOverloadsOnGenericArity2.ts, 3, 11)) >p : Symbol(p, Decl(functionOverloadsOnGenericArity2.ts, 3, 15)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) } diff --git a/tests/baselines/reference/functionType.symbols b/tests/baselines/reference/functionType.symbols index 30a5a7cc447..65347d39b5a 100644 --- a/tests/baselines/reference/functionType.symbols +++ b/tests/baselines/reference/functionType.symbols @@ -3,9 +3,9 @@ function salt() {} >salt : Symbol(salt, Decl(functionType.ts, 0, 0)) salt.apply("hello", []); ->salt.apply : Symbol(Function.apply, Decl(lib.d.ts, --, --)) +>salt.apply : Symbol(Function.apply, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >salt : Symbol(salt, Decl(functionType.ts, 0, 0)) ->apply : Symbol(Function.apply, Decl(lib.d.ts, --, --)) +>apply : Symbol(Function.apply, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) (new Function("return 5"))(); >Function : Symbol(Function, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) diff --git a/tests/baselines/reference/functionType.types b/tests/baselines/reference/functionType.types index e7ea7a47edf..9183ec4a13e 100644 --- a/tests/baselines/reference/functionType.types +++ b/tests/baselines/reference/functionType.types @@ -3,10 +3,10 @@ function salt() {} >salt : () => void salt.apply("hello", []); ->salt.apply("hello", []) : any ->salt.apply : (thisArg: any, argArray?: any) => any +>salt.apply("hello", []) : void +>salt.apply : { (this: (this: T, ...argArray: any[]) => U, thisArg: T, argArray?: any): U; (this: Function, thisArg: any, argArray?: any): any; } >salt : () => void ->apply : (thisArg: any, argArray?: any) => any +>apply : { (this: (this: T, ...argArray: any[]) => U, thisArg: T, argArray?: any): U; (this: Function, thisArg: any, argArray?: any): any; } >"hello" : string >[] : undefined[] diff --git a/tests/baselines/reference/fuzzy.errors.txt b/tests/baselines/reference/fuzzy.errors.txt index 0aa8207ff98..344a3865fb2 100644 --- a/tests/baselines/reference/fuzzy.errors.txt +++ b/tests/baselines/reference/fuzzy.errors.txt @@ -5,7 +5,7 @@ tests/cases/compiler/fuzzy.ts(21,20): error TS2322: Type '{ anything: number; on Type 'this' is not assignable to type 'I'. Type 'C' is not assignable to type 'I'. Property 'alsoWorks' is missing in type 'C'. -tests/cases/compiler/fuzzy.ts(25,20): error TS2352: Neither type '{ oneI: this; }' nor type 'R' is assignable to the other. +tests/cases/compiler/fuzzy.ts(25,20): error TS2352: Type '{ oneI: this; }' cannot be converted to type 'R'. Property 'anything' is missing in type '{ oneI: this; }'. @@ -45,7 +45,7 @@ tests/cases/compiler/fuzzy.ts(25,20): error TS2352: Neither type '{ oneI: this; worksToo():R { return ({ oneI: this }); ~~~~~~~~~~~~~~~~~~~ -!!! error TS2352: Neither type '{ oneI: this; }' nor type 'R' is assignable to the other. +!!! error TS2352: Type '{ oneI: this; }' cannot be converted to type 'R'. !!! error TS2352: Property 'anything' is missing in type '{ oneI: this; }'. } } diff --git a/tests/baselines/reference/generatorES6_6.symbols b/tests/baselines/reference/generatorES6_6.symbols index 96b8b861c8b..3ae6ef318e8 100644 --- a/tests/baselines/reference/generatorES6_6.symbols +++ b/tests/baselines/reference/generatorES6_6.symbols @@ -3,9 +3,9 @@ class C { >C : Symbol(C, Decl(generatorES6_6.ts, 0, 0)) *[Symbol.iterator]() { ->Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) +>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) let a = yield 1; >a : Symbol(a, Decl(generatorES6_6.ts, 2, 7)) diff --git a/tests/baselines/reference/generatorOverloads4.symbols b/tests/baselines/reference/generatorOverloads4.symbols index 1384b8d451c..ecc0afe6109 100644 --- a/tests/baselines/reference/generatorOverloads4.symbols +++ b/tests/baselines/reference/generatorOverloads4.symbols @@ -5,15 +5,15 @@ class C { f(s: string): Iterable; >f : Symbol(C.f, Decl(generatorOverloads4.ts, 0, 9), Decl(generatorOverloads4.ts, 1, 32), Decl(generatorOverloads4.ts, 2, 32)) >s : Symbol(s, Decl(generatorOverloads4.ts, 1, 6)) ->Iterable : Symbol(Iterable, Decl(lib.d.ts, --, --)) +>Iterable : Symbol(Iterable, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) f(s: number): Iterable; >f : Symbol(C.f, Decl(generatorOverloads4.ts, 0, 9), Decl(generatorOverloads4.ts, 1, 32), Decl(generatorOverloads4.ts, 2, 32)) >s : Symbol(s, Decl(generatorOverloads4.ts, 2, 6)) ->Iterable : Symbol(Iterable, Decl(lib.d.ts, --, --)) +>Iterable : Symbol(Iterable, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) *f(s: any): Iterable { } >f : Symbol(C.f, Decl(generatorOverloads4.ts, 0, 9), Decl(generatorOverloads4.ts, 1, 32), Decl(generatorOverloads4.ts, 2, 32)) >s : Symbol(s, Decl(generatorOverloads4.ts, 3, 7)) ->Iterable : Symbol(Iterable, Decl(lib.d.ts, --, --)) +>Iterable : Symbol(Iterable, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) } diff --git a/tests/baselines/reference/generatorOverloads5.symbols b/tests/baselines/reference/generatorOverloads5.symbols index 07de0c87f51..a93e9156a6e 100644 --- a/tests/baselines/reference/generatorOverloads5.symbols +++ b/tests/baselines/reference/generatorOverloads5.symbols @@ -5,15 +5,15 @@ module M { function f(s: string): Iterable; >f : Symbol(f, Decl(generatorOverloads5.ts, 0, 10), Decl(generatorOverloads5.ts, 1, 41), Decl(generatorOverloads5.ts, 2, 41)) >s : Symbol(s, Decl(generatorOverloads5.ts, 1, 15)) ->Iterable : Symbol(Iterable, Decl(lib.d.ts, --, --)) +>Iterable : Symbol(Iterable, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) function f(s: number): Iterable; >f : Symbol(f, Decl(generatorOverloads5.ts, 0, 10), Decl(generatorOverloads5.ts, 1, 41), Decl(generatorOverloads5.ts, 2, 41)) >s : Symbol(s, Decl(generatorOverloads5.ts, 2, 15)) ->Iterable : Symbol(Iterable, Decl(lib.d.ts, --, --)) +>Iterable : Symbol(Iterable, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) function* f(s: any): Iterable { } >f : Symbol(f, Decl(generatorOverloads5.ts, 0, 10), Decl(generatorOverloads5.ts, 1, 41), Decl(generatorOverloads5.ts, 2, 41)) >s : Symbol(s, Decl(generatorOverloads5.ts, 3, 16)) ->Iterable : Symbol(Iterable, Decl(lib.d.ts, --, --)) +>Iterable : Symbol(Iterable, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) } diff --git a/tests/baselines/reference/generatorTypeCheck1.symbols b/tests/baselines/reference/generatorTypeCheck1.symbols index b9456ccba48..cc61c5b9803 100644 --- a/tests/baselines/reference/generatorTypeCheck1.symbols +++ b/tests/baselines/reference/generatorTypeCheck1.symbols @@ -1,5 +1,5 @@ === tests/cases/conformance/es6/yieldExpressions/generatorTypeCheck1.ts === function* g1(): Iterator { } >g1 : Symbol(g1, Decl(generatorTypeCheck1.ts, 0, 0)) ->Iterator : Symbol(Iterator, Decl(lib.d.ts, --, --)) +>Iterator : Symbol(Iterator, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) diff --git a/tests/baselines/reference/generatorTypeCheck10.symbols b/tests/baselines/reference/generatorTypeCheck10.symbols index 2112a9b1ebc..582693e7336 100644 --- a/tests/baselines/reference/generatorTypeCheck10.symbols +++ b/tests/baselines/reference/generatorTypeCheck10.symbols @@ -1,7 +1,7 @@ === tests/cases/conformance/es6/yieldExpressions/generatorTypeCheck10.ts === function* g(): IterableIterator { >g : Symbol(g, Decl(generatorTypeCheck10.ts, 0, 0)) ->IterableIterator : Symbol(IterableIterator, Decl(lib.d.ts, --, --)) +>IterableIterator : Symbol(IterableIterator, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) return; } diff --git a/tests/baselines/reference/generatorTypeCheck11.symbols b/tests/baselines/reference/generatorTypeCheck11.symbols index 439b97caa7f..ce8f2f5f065 100644 --- a/tests/baselines/reference/generatorTypeCheck11.symbols +++ b/tests/baselines/reference/generatorTypeCheck11.symbols @@ -1,7 +1,7 @@ === tests/cases/conformance/es6/yieldExpressions/generatorTypeCheck11.ts === function* g(): IterableIterator { >g : Symbol(g, Decl(generatorTypeCheck11.ts, 0, 0)) ->IterableIterator : Symbol(IterableIterator, Decl(lib.d.ts, --, --)) +>IterableIterator : Symbol(IterableIterator, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) return 0; } diff --git a/tests/baselines/reference/generatorTypeCheck12.symbols b/tests/baselines/reference/generatorTypeCheck12.symbols index 1c7661a06cf..052f35a5f5f 100644 --- a/tests/baselines/reference/generatorTypeCheck12.symbols +++ b/tests/baselines/reference/generatorTypeCheck12.symbols @@ -1,7 +1,7 @@ === tests/cases/conformance/es6/yieldExpressions/generatorTypeCheck12.ts === function* g(): IterableIterator { >g : Symbol(g, Decl(generatorTypeCheck12.ts, 0, 0)) ->IterableIterator : Symbol(IterableIterator, Decl(lib.d.ts, --, --)) +>IterableIterator : Symbol(IterableIterator, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) return ""; } diff --git a/tests/baselines/reference/generatorTypeCheck13.symbols b/tests/baselines/reference/generatorTypeCheck13.symbols index 7d9587e5ac9..ceaea53dacf 100644 --- a/tests/baselines/reference/generatorTypeCheck13.symbols +++ b/tests/baselines/reference/generatorTypeCheck13.symbols @@ -1,7 +1,7 @@ === tests/cases/conformance/es6/yieldExpressions/generatorTypeCheck13.ts === function* g(): IterableIterator { >g : Symbol(g, Decl(generatorTypeCheck13.ts, 0, 0)) ->IterableIterator : Symbol(IterableIterator, Decl(lib.d.ts, --, --)) +>IterableIterator : Symbol(IterableIterator, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) yield 0; return ""; diff --git a/tests/baselines/reference/generatorTypeCheck17.symbols b/tests/baselines/reference/generatorTypeCheck17.symbols index acec0544f03..6f082994488 100644 --- a/tests/baselines/reference/generatorTypeCheck17.symbols +++ b/tests/baselines/reference/generatorTypeCheck17.symbols @@ -10,7 +10,7 @@ class Bar extends Foo { y: string } function* g(): IterableIterator { >g : Symbol(g, Decl(generatorTypeCheck17.ts, 1, 35)) ->IterableIterator : Symbol(IterableIterator, Decl(lib.d.ts, --, --)) +>IterableIterator : Symbol(IterableIterator, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) >Foo : Symbol(Foo, Decl(generatorTypeCheck17.ts, 0, 0)) yield; diff --git a/tests/baselines/reference/generatorTypeCheck19.symbols b/tests/baselines/reference/generatorTypeCheck19.symbols index 206cb39e3e1..af506d275cf 100644 --- a/tests/baselines/reference/generatorTypeCheck19.symbols +++ b/tests/baselines/reference/generatorTypeCheck19.symbols @@ -10,7 +10,7 @@ class Bar extends Foo { y: string } function* g(): IterableIterator { >g : Symbol(g, Decl(generatorTypeCheck19.ts, 1, 35)) ->IterableIterator : Symbol(IterableIterator, Decl(lib.d.ts, --, --)) +>IterableIterator : Symbol(IterableIterator, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) >Foo : Symbol(Foo, Decl(generatorTypeCheck19.ts, 0, 0)) yield; diff --git a/tests/baselines/reference/generatorTypeCheck2.symbols b/tests/baselines/reference/generatorTypeCheck2.symbols index 5741e089d1b..63150081c18 100644 --- a/tests/baselines/reference/generatorTypeCheck2.symbols +++ b/tests/baselines/reference/generatorTypeCheck2.symbols @@ -1,5 +1,5 @@ === tests/cases/conformance/es6/yieldExpressions/generatorTypeCheck2.ts === function* g1(): Iterable { } >g1 : Symbol(g1, Decl(generatorTypeCheck2.ts, 0, 0)) ->Iterable : Symbol(Iterable, Decl(lib.d.ts, --, --)) +>Iterable : Symbol(Iterable, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) diff --git a/tests/baselines/reference/generatorTypeCheck26.symbols b/tests/baselines/reference/generatorTypeCheck26.symbols index 2f2c27d2810..0680c0680e1 100644 --- a/tests/baselines/reference/generatorTypeCheck26.symbols +++ b/tests/baselines/reference/generatorTypeCheck26.symbols @@ -1,20 +1,20 @@ === tests/cases/conformance/es6/yieldExpressions/generatorTypeCheck26.ts === function* g(): IterableIterator<(x: string) => number> { >g : Symbol(g, Decl(generatorTypeCheck26.ts, 0, 0)) ->IterableIterator : Symbol(IterableIterator, Decl(lib.d.ts, --, --)) +>IterableIterator : Symbol(IterableIterator, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) >x : Symbol(x, Decl(generatorTypeCheck26.ts, 0, 33)) yield x => x.length; >x : Symbol(x, Decl(generatorTypeCheck26.ts, 1, 9)) ->x.length : Symbol(String.length, Decl(lib.d.ts, --, --)) +>x.length : Symbol(String.length, Decl(lib.es5.d.ts, --, --)) >x : Symbol(x, Decl(generatorTypeCheck26.ts, 1, 9)) ->length : Symbol(String.length, Decl(lib.d.ts, --, --)) +>length : Symbol(String.length, Decl(lib.es5.d.ts, --, --)) yield *[x => x.length]; >x : Symbol(x, Decl(generatorTypeCheck26.ts, 2, 12)) ->x.length : Symbol(String.length, Decl(lib.d.ts, --, --)) +>x.length : Symbol(String.length, Decl(lib.es5.d.ts, --, --)) >x : Symbol(x, Decl(generatorTypeCheck26.ts, 2, 12)) ->length : Symbol(String.length, Decl(lib.d.ts, --, --)) +>length : Symbol(String.length, Decl(lib.es5.d.ts, --, --)) return x => x.length; >x : Symbol(x, Decl(generatorTypeCheck26.ts, 3, 10)) diff --git a/tests/baselines/reference/generatorTypeCheck27.symbols b/tests/baselines/reference/generatorTypeCheck27.symbols index 27c5cbf5db8..e8d630804f8 100644 --- a/tests/baselines/reference/generatorTypeCheck27.symbols +++ b/tests/baselines/reference/generatorTypeCheck27.symbols @@ -1,7 +1,7 @@ === tests/cases/conformance/es6/yieldExpressions/generatorTypeCheck27.ts === function* g(): IterableIterator<(x: string) => number> { >g : Symbol(g, Decl(generatorTypeCheck27.ts, 0, 0)) ->IterableIterator : Symbol(IterableIterator, Decl(lib.d.ts, --, --)) +>IterableIterator : Symbol(IterableIterator, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) >x : Symbol(x, Decl(generatorTypeCheck27.ts, 0, 33)) yield * function* () { diff --git a/tests/baselines/reference/generatorTypeCheck28.symbols b/tests/baselines/reference/generatorTypeCheck28.symbols index a7e799679d7..9031e6413c9 100644 --- a/tests/baselines/reference/generatorTypeCheck28.symbols +++ b/tests/baselines/reference/generatorTypeCheck28.symbols @@ -1,20 +1,20 @@ === tests/cases/conformance/es6/yieldExpressions/generatorTypeCheck28.ts === function* g(): IterableIterator<(x: string) => number> { >g : Symbol(g, Decl(generatorTypeCheck28.ts, 0, 0)) ->IterableIterator : Symbol(IterableIterator, Decl(lib.d.ts, --, --)) +>IterableIterator : Symbol(IterableIterator, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) >x : Symbol(x, Decl(generatorTypeCheck28.ts, 0, 33)) yield * { *[Symbol.iterator]() { ->Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) +>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) yield x => x.length; >x : Symbol(x, Decl(generatorTypeCheck28.ts, 3, 17)) ->x.length : Symbol(String.length, Decl(lib.d.ts, --, --)) +>x.length : Symbol(String.length, Decl(lib.es5.d.ts, --, --)) >x : Symbol(x, Decl(generatorTypeCheck28.ts, 3, 17)) ->length : Symbol(String.length, Decl(lib.d.ts, --, --)) +>length : Symbol(String.length, Decl(lib.es5.d.ts, --, --)) } }; } diff --git a/tests/baselines/reference/generatorTypeCheck29.symbols b/tests/baselines/reference/generatorTypeCheck29.symbols index 4b332f6c86b..105d16377f2 100644 --- a/tests/baselines/reference/generatorTypeCheck29.symbols +++ b/tests/baselines/reference/generatorTypeCheck29.symbols @@ -1,8 +1,8 @@ === tests/cases/conformance/es6/yieldExpressions/generatorTypeCheck29.ts === function* g2(): Iterator number>> { >g2 : Symbol(g2, Decl(generatorTypeCheck29.ts, 0, 0)) ->Iterator : Symbol(Iterator, Decl(lib.d.ts, --, --)) ->Iterable : Symbol(Iterable, Decl(lib.d.ts, --, --)) +>Iterator : Symbol(Iterator, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Iterable : Symbol(Iterable, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) >x : Symbol(x, Decl(generatorTypeCheck29.ts, 0, 35)) yield function* () { diff --git a/tests/baselines/reference/generatorTypeCheck3.symbols b/tests/baselines/reference/generatorTypeCheck3.symbols index 6e97cd6f280..e61980735d8 100644 --- a/tests/baselines/reference/generatorTypeCheck3.symbols +++ b/tests/baselines/reference/generatorTypeCheck3.symbols @@ -1,5 +1,5 @@ === tests/cases/conformance/es6/yieldExpressions/generatorTypeCheck3.ts === function* g1(): IterableIterator { } >g1 : Symbol(g1, Decl(generatorTypeCheck3.ts, 0, 0)) ->IterableIterator : Symbol(IterableIterator, Decl(lib.d.ts, --, --)) +>IterableIterator : Symbol(IterableIterator, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) diff --git a/tests/baselines/reference/generatorTypeCheck30.symbols b/tests/baselines/reference/generatorTypeCheck30.symbols index 3c56fde9039..fd83f551575 100644 --- a/tests/baselines/reference/generatorTypeCheck30.symbols +++ b/tests/baselines/reference/generatorTypeCheck30.symbols @@ -1,8 +1,8 @@ === tests/cases/conformance/es6/yieldExpressions/generatorTypeCheck30.ts === function* g2(): Iterator number>> { >g2 : Symbol(g2, Decl(generatorTypeCheck30.ts, 0, 0)) ->Iterator : Symbol(Iterator, Decl(lib.d.ts, --, --)) ->Iterable : Symbol(Iterable, Decl(lib.d.ts, --, --)) +>Iterator : Symbol(Iterator, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Iterable : Symbol(Iterable, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) >x : Symbol(x, Decl(generatorTypeCheck30.ts, 0, 35)) yield function* () { diff --git a/tests/baselines/reference/generatorTypeCheck45.symbols b/tests/baselines/reference/generatorTypeCheck45.symbols index a637f154dc4..e62c0b54f46 100644 --- a/tests/baselines/reference/generatorTypeCheck45.symbols +++ b/tests/baselines/reference/generatorTypeCheck45.symbols @@ -6,7 +6,7 @@ declare function foo(x: T, fun: () => Iterator<(x: T) => U>, fun2: (y: U) >x : Symbol(x, Decl(generatorTypeCheck45.ts, 0, 27)) >T : Symbol(T, Decl(generatorTypeCheck45.ts, 0, 21)) >fun : Symbol(fun, Decl(generatorTypeCheck45.ts, 0, 32)) ->Iterator : Symbol(Iterator, Decl(lib.d.ts, --, --)) +>Iterator : Symbol(Iterator, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) >x : Symbol(x, Decl(generatorTypeCheck45.ts, 0, 54)) >T : Symbol(T, Decl(generatorTypeCheck45.ts, 0, 21)) >U : Symbol(U, Decl(generatorTypeCheck45.ts, 0, 23)) @@ -19,9 +19,9 @@ declare function foo(x: T, fun: () => Iterator<(x: T) => U>, fun2: (y: U) foo("", function* () { yield x => x.length }, p => undefined); // T is fixed, should be string >foo : Symbol(foo, Decl(generatorTypeCheck45.ts, 0, 0)) >x : Symbol(x, Decl(generatorTypeCheck45.ts, 2, 28)) ->x.length : Symbol(String.length, Decl(lib.d.ts, --, --)) +>x.length : Symbol(String.length, Decl(lib.es5.d.ts, --, --)) >x : Symbol(x, Decl(generatorTypeCheck45.ts, 2, 28)) ->length : Symbol(String.length, Decl(lib.d.ts, --, --)) +>length : Symbol(String.length, Decl(lib.es5.d.ts, --, --)) >p : Symbol(p, Decl(generatorTypeCheck45.ts, 2, 45)) >undefined : Symbol(undefined) diff --git a/tests/baselines/reference/generatorTypeCheck46.symbols b/tests/baselines/reference/generatorTypeCheck46.symbols index abb170b12a7..23f9f77d406 100644 --- a/tests/baselines/reference/generatorTypeCheck46.symbols +++ b/tests/baselines/reference/generatorTypeCheck46.symbols @@ -6,7 +6,7 @@ declare function foo(x: T, fun: () => Iterable<(x: T) => U>, fun2: (y: U) >x : Symbol(x, Decl(generatorTypeCheck46.ts, 0, 27)) >T : Symbol(T, Decl(generatorTypeCheck46.ts, 0, 21)) >fun : Symbol(fun, Decl(generatorTypeCheck46.ts, 0, 32)) ->Iterable : Symbol(Iterable, Decl(lib.d.ts, --, --)) +>Iterable : Symbol(Iterable, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) >x : Symbol(x, Decl(generatorTypeCheck46.ts, 0, 54)) >T : Symbol(T, Decl(generatorTypeCheck46.ts, 0, 21)) >U : Symbol(U, Decl(generatorTypeCheck46.ts, 0, 23)) @@ -21,15 +21,15 @@ foo("", function* () { yield* { *[Symbol.iterator]() { ->Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) +>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) yield x => x.length >x : Symbol(x, Decl(generatorTypeCheck46.ts, 5, 17)) ->x.length : Symbol(String.length, Decl(lib.d.ts, --, --)) +>x.length : Symbol(String.length, Decl(lib.es5.d.ts, --, --)) >x : Symbol(x, Decl(generatorTypeCheck46.ts, 5, 17)) ->length : Symbol(String.length, Decl(lib.d.ts, --, --)) +>length : Symbol(String.length, Decl(lib.es5.d.ts, --, --)) } } }, p => undefined); // T is fixed, should be string diff --git a/tests/baselines/reference/genericCallWithObjectTypeArgsAndIndexers.symbols b/tests/baselines/reference/genericCallWithObjectTypeArgsAndIndexers.symbols index 3824029dfec..4aa4807b637 100644 --- a/tests/baselines/reference/genericCallWithObjectTypeArgsAndIndexers.symbols +++ b/tests/baselines/reference/genericCallWithObjectTypeArgsAndIndexers.symbols @@ -20,7 +20,7 @@ var a: { [x: number]: Date; >x : Symbol(x, Decl(genericCallWithObjectTypeArgsAndIndexers.ts, 8, 5)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) }; var r = foo(a); @@ -31,7 +31,7 @@ var r = foo(a); function other(arg: T) { >other : Symbol(other, Decl(genericCallWithObjectTypeArgsAndIndexers.ts, 10, 15)) >T : Symbol(T, Decl(genericCallWithObjectTypeArgsAndIndexers.ts, 12, 15)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >arg : Symbol(arg, Decl(genericCallWithObjectTypeArgsAndIndexers.ts, 12, 31)) >T : Symbol(T, Decl(genericCallWithObjectTypeArgsAndIndexers.ts, 12, 15)) diff --git a/tests/baselines/reference/genericCallWithObjectTypeArgsAndIndexersErrors.symbols b/tests/baselines/reference/genericCallWithObjectTypeArgsAndIndexersErrors.symbols index 0f3fe58da01..e8371f0cf76 100644 --- a/tests/baselines/reference/genericCallWithObjectTypeArgsAndIndexersErrors.symbols +++ b/tests/baselines/reference/genericCallWithObjectTypeArgsAndIndexersErrors.symbols @@ -40,7 +40,7 @@ function other3(arg: T) { >T : Symbol(T, Decl(genericCallWithObjectTypeArgsAndIndexersErrors.ts, 14, 16)) >U : Symbol(U, Decl(genericCallWithObjectTypeArgsAndIndexersErrors.ts, 14, 28)) >U : Symbol(U, Decl(genericCallWithObjectTypeArgsAndIndexersErrors.ts, 14, 28)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >arg : Symbol(arg, Decl(genericCallWithObjectTypeArgsAndIndexersErrors.ts, 14, 45)) >T : Symbol(T, Decl(genericCallWithObjectTypeArgsAndIndexersErrors.ts, 14, 16)) diff --git a/tests/baselines/reference/genericCallWithObjectTypeArgsAndNumericIndexer.symbols b/tests/baselines/reference/genericCallWithObjectTypeArgsAndNumericIndexer.symbols index 4e7622d3d81..58d9d2a3770 100644 --- a/tests/baselines/reference/genericCallWithObjectTypeArgsAndNumericIndexer.symbols +++ b/tests/baselines/reference/genericCallWithObjectTypeArgsAndNumericIndexer.symbols @@ -14,7 +14,7 @@ function foo(x: T) { var a: { [x: number]: Date }; >a : Symbol(a, Decl(genericCallWithObjectTypeArgsAndNumericIndexer.ts, 6, 3)) >x : Symbol(x, Decl(genericCallWithObjectTypeArgsAndNumericIndexer.ts, 6, 10)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) var r = foo(a); >r : Symbol(r, Decl(genericCallWithObjectTypeArgsAndNumericIndexer.ts, 7, 3)) @@ -41,7 +41,7 @@ function other(arg: T) { function other2(arg: T) { >other2 : Symbol(other2, Decl(genericCallWithObjectTypeArgsAndNumericIndexer.ts, 12, 1)) >T : Symbol(T, Decl(genericCallWithObjectTypeArgsAndNumericIndexer.ts, 14, 16)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >arg : Symbol(arg, Decl(genericCallWithObjectTypeArgsAndNumericIndexer.ts, 14, 32)) >T : Symbol(T, Decl(genericCallWithObjectTypeArgsAndNumericIndexer.ts, 14, 16)) @@ -63,9 +63,9 @@ function other2(arg: T) { function other3(arg: T) { >other3 : Symbol(other3, Decl(genericCallWithObjectTypeArgsAndNumericIndexer.ts, 18, 1)) >T : Symbol(T, Decl(genericCallWithObjectTypeArgsAndNumericIndexer.ts, 20, 16)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >U : Symbol(U, Decl(genericCallWithObjectTypeArgsAndNumericIndexer.ts, 20, 31)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >arg : Symbol(arg, Decl(genericCallWithObjectTypeArgsAndNumericIndexer.ts, 20, 48)) >T : Symbol(T, Decl(genericCallWithObjectTypeArgsAndNumericIndexer.ts, 20, 16)) diff --git a/tests/baselines/reference/genericCallWithObjectTypeArgsAndStringIndexer.symbols b/tests/baselines/reference/genericCallWithObjectTypeArgsAndStringIndexer.symbols index 932cedf148e..56f1015f620 100644 --- a/tests/baselines/reference/genericCallWithObjectTypeArgsAndStringIndexer.symbols +++ b/tests/baselines/reference/genericCallWithObjectTypeArgsAndStringIndexer.symbols @@ -14,7 +14,7 @@ function foo(x: T) { var a: { [x: string]: Date }; >a : Symbol(a, Decl(genericCallWithObjectTypeArgsAndStringIndexer.ts, 6, 3)) >x : Symbol(x, Decl(genericCallWithObjectTypeArgsAndStringIndexer.ts, 6, 10)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) var r = foo(a); >r : Symbol(r, Decl(genericCallWithObjectTypeArgsAndStringIndexer.ts, 7, 3)) @@ -41,7 +41,7 @@ function other(arg: T) { function other2(arg: T) { >other2 : Symbol(other2, Decl(genericCallWithObjectTypeArgsAndStringIndexer.ts, 12, 1)) >T : Symbol(T, Decl(genericCallWithObjectTypeArgsAndStringIndexer.ts, 14, 16)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >arg : Symbol(arg, Decl(genericCallWithObjectTypeArgsAndStringIndexer.ts, 14, 32)) >T : Symbol(T, Decl(genericCallWithObjectTypeArgsAndStringIndexer.ts, 14, 16)) @@ -57,16 +57,16 @@ function other2(arg: T) { var d: Date = r2['hm']; // ok >d : Symbol(d, Decl(genericCallWithObjectTypeArgsAndStringIndexer.ts, 17, 7)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >r2 : Symbol(r2, Decl(genericCallWithObjectTypeArgsAndStringIndexer.ts, 16, 7)) } function other3(arg: T) { >other3 : Symbol(other3, Decl(genericCallWithObjectTypeArgsAndStringIndexer.ts, 18, 1)) >T : Symbol(T, Decl(genericCallWithObjectTypeArgsAndStringIndexer.ts, 20, 16)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >U : Symbol(U, Decl(genericCallWithObjectTypeArgsAndStringIndexer.ts, 20, 31)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >arg : Symbol(arg, Decl(genericCallWithObjectTypeArgsAndStringIndexer.ts, 20, 48)) >T : Symbol(T, Decl(genericCallWithObjectTypeArgsAndStringIndexer.ts, 20, 16)) @@ -82,7 +82,7 @@ function other3(arg: T) { var d: Date = r2['hm']; // ok >d : Symbol(d, Decl(genericCallWithObjectTypeArgsAndStringIndexer.ts, 23, 7)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >r2 : Symbol(r2, Decl(genericCallWithObjectTypeArgsAndStringIndexer.ts, 22, 7)) // BUG 821629 diff --git a/tests/baselines/reference/genericConstraintOnExtendedBuiltinTypes.symbols b/tests/baselines/reference/genericConstraintOnExtendedBuiltinTypes.symbols index 8f8703f3e50..57c0e6d0a21 100644 --- a/tests/baselines/reference/genericConstraintOnExtendedBuiltinTypes.symbols +++ b/tests/baselines/reference/genericConstraintOnExtendedBuiltinTypes.symbols @@ -11,7 +11,7 @@ declare module EndGate { } interface Number extends EndGate.ICloneable { } ->Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(genericConstraintOnExtendedBuiltinTypes.ts, 4, 1)) +>Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(genericConstraintOnExtendedBuiltinTypes.ts, 4, 1)) >EndGate.ICloneable : Symbol(EndGate.ICloneable, Decl(genericConstraintOnExtendedBuiltinTypes.ts, 0, 24)) >EndGate : Symbol(EndGate, Decl(genericConstraintOnExtendedBuiltinTypes.ts, 0, 0), Decl(genericConstraintOnExtendedBuiltinTypes.ts, 6, 47), Decl(genericConstraintOnExtendedBuiltinTypes.ts, 17, 1)) >ICloneable : Symbol(EndGate.ICloneable, Decl(genericConstraintOnExtendedBuiltinTypes.ts, 0, 24)) diff --git a/tests/baselines/reference/genericConstraintOnExtendedBuiltinTypes2.symbols b/tests/baselines/reference/genericConstraintOnExtendedBuiltinTypes2.symbols index c261d0404ec..63251ba000d 100644 --- a/tests/baselines/reference/genericConstraintOnExtendedBuiltinTypes2.symbols +++ b/tests/baselines/reference/genericConstraintOnExtendedBuiltinTypes2.symbols @@ -11,7 +11,7 @@ module EndGate { } interface Number extends EndGate.ICloneable { } ->Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(genericConstraintOnExtendedBuiltinTypes2.ts, 4, 1)) +>Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(genericConstraintOnExtendedBuiltinTypes2.ts, 4, 1)) >EndGate.ICloneable : Symbol(EndGate.ICloneable, Decl(genericConstraintOnExtendedBuiltinTypes2.ts, 0, 16)) >EndGate : Symbol(EndGate, Decl(genericConstraintOnExtendedBuiltinTypes2.ts, 0, 0), Decl(genericConstraintOnExtendedBuiltinTypes2.ts, 6, 47), Decl(genericConstraintOnExtendedBuiltinTypes2.ts, 16, 1)) >ICloneable : Symbol(EndGate.ICloneable, Decl(genericConstraintOnExtendedBuiltinTypes2.ts, 0, 16)) @@ -51,7 +51,7 @@ module EndGate.Tweening { export class NumberTween extends Tween{ >NumberTween : Symbol(NumberTween, Decl(genericConstraintOnExtendedBuiltinTypes2.ts, 18, 25)) >Tween : Symbol(Tween, Decl(genericConstraintOnExtendedBuiltinTypes2.ts, 8, 25)) ->Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(genericConstraintOnExtendedBuiltinTypes2.ts, 4, 1)) +>Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(genericConstraintOnExtendedBuiltinTypes2.ts, 4, 1)) constructor(from: number) { >from : Symbol(from, Decl(genericConstraintOnExtendedBuiltinTypes2.ts, 20, 20)) diff --git a/tests/baselines/reference/genericFunctionSpecializations1.symbols b/tests/baselines/reference/genericFunctionSpecializations1.symbols index aaf607cbd47..717e07455f4 100644 --- a/tests/baselines/reference/genericFunctionSpecializations1.symbols +++ b/tests/baselines/reference/genericFunctionSpecializations1.symbols @@ -18,7 +18,7 @@ function foo4(test: string); // valid function foo4(test: T) { } >foo4 : Symbol(foo4, Decl(genericFunctionSpecializations1.ts, 1, 29), Decl(genericFunctionSpecializations1.ts, 3, 31)) >T : Symbol(T, Decl(genericFunctionSpecializations1.ts, 4, 14)) ->String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >test : Symbol(test, Decl(genericFunctionSpecializations1.ts, 4, 32)) >T : Symbol(T, Decl(genericFunctionSpecializations1.ts, 4, 14)) diff --git a/tests/baselines/reference/genericFunctionsWithOptionalParameters3.symbols b/tests/baselines/reference/genericFunctionsWithOptionalParameters3.symbols index 2bfc54f2c32..398c3a0e71f 100644 --- a/tests/baselines/reference/genericFunctionsWithOptionalParameters3.symbols +++ b/tests/baselines/reference/genericFunctionsWithOptionalParameters3.symbols @@ -63,7 +63,7 @@ var r3 = utils.mapReduce(c, (x) => { return 1 }, (y) => { return new Date() }); >c : Symbol(c, Decl(genericFunctionsWithOptionalParameters3.ts, 8, 3)) >x : Symbol(x, Decl(genericFunctionsWithOptionalParameters3.ts, 9, 29)) >y : Symbol(y, Decl(genericFunctionsWithOptionalParameters3.ts, 9, 50)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) var r4 = utils.mapReduce(c, (x: string) => { return 1 }, (y: number) => { return new Date() }); >r4 : Symbol(r4, Decl(genericFunctionsWithOptionalParameters3.ts, 10, 3)) @@ -73,7 +73,7 @@ var r4 = utils.mapReduce(c, (x: string) => { return 1 }, (y: number) => { return >c : Symbol(c, Decl(genericFunctionsWithOptionalParameters3.ts, 8, 3)) >x : Symbol(x, Decl(genericFunctionsWithOptionalParameters3.ts, 10, 29)) >y : Symbol(y, Decl(genericFunctionsWithOptionalParameters3.ts, 10, 58)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) var f1 = (x: string) => { return 1 }; >f1 : Symbol(f1, Decl(genericFunctionsWithOptionalParameters3.ts, 11, 3)) @@ -82,7 +82,7 @@ var f1 = (x: string) => { return 1 }; var f2 = (y: number) => { return new Date() }; >f2 : Symbol(f2, Decl(genericFunctionsWithOptionalParameters3.ts, 12, 3)) >y : Symbol(y, Decl(genericFunctionsWithOptionalParameters3.ts, 12, 10)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) var r5 = utils.mapReduce(c, f1, f2); >r5 : Symbol(r5, Decl(genericFunctionsWithOptionalParameters3.ts, 13, 3)) diff --git a/tests/baselines/reference/genericSignatureIdentity.symbols b/tests/baselines/reference/genericSignatureIdentity.symbols index afd12ec266a..b5caa87b0a5 100644 --- a/tests/baselines/reference/genericSignatureIdentity.symbols +++ b/tests/baselines/reference/genericSignatureIdentity.symbols @@ -9,7 +9,7 @@ var x: { (x: T): T; >T : Symbol(T, Decl(genericSignatureIdentity.ts, 6, 5)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >x : Symbol(x, Decl(genericSignatureIdentity.ts, 6, 21)) >T : Symbol(T, Decl(genericSignatureIdentity.ts, 6, 5)) >T : Symbol(T, Decl(genericSignatureIdentity.ts, 6, 5)) diff --git a/tests/baselines/reference/genericTypeAssertions1.errors.txt b/tests/baselines/reference/genericTypeAssertions1.errors.txt index 5479c5f948e..aa5f14f5da8 100644 --- a/tests/baselines/reference/genericTypeAssertions1.errors.txt +++ b/tests/baselines/reference/genericTypeAssertions1.errors.txt @@ -2,8 +2,8 @@ tests/cases/compiler/genericTypeAssertions1.ts(3,5): error TS2322: Type 'A>' is not assignable to type 'A'. Type 'A' is not assignable to type 'number'. -tests/cases/compiler/genericTypeAssertions1.ts(4,21): error TS2352: Neither type 'A' nor type 'A>' is assignable to the other. - Type 'number' is not assignable to type 'A'. +tests/cases/compiler/genericTypeAssertions1.ts(4,21): error TS2352: Type 'A' cannot be converted to type 'A>'. + Type 'number' is not comparable to type 'A'. ==== tests/cases/compiler/genericTypeAssertions1.ts (3 errors) ==== @@ -18,5 +18,5 @@ tests/cases/compiler/genericTypeAssertions1.ts(4,21): error TS2352: Neither type !!! error TS2322: Type 'A>' is not assignable to type 'A'. !!! error TS2322: Type 'A' is not assignable to type 'number'. ~~~~~~~~~~~~~~~~~ -!!! error TS2352: Neither type 'A' nor type 'A>' is assignable to the other. -!!! error TS2352: Type 'number' is not assignable to type 'A'. \ No newline at end of file +!!! error TS2352: Type 'A' cannot be converted to type 'A>'. +!!! error TS2352: Type 'number' is not comparable to type 'A'. \ No newline at end of file diff --git a/tests/baselines/reference/genericTypeAssertions2.errors.txt b/tests/baselines/reference/genericTypeAssertions2.errors.txt index e424e6a13b1..756690f1783 100644 --- a/tests/baselines/reference/genericTypeAssertions2.errors.txt +++ b/tests/baselines/reference/genericTypeAssertions2.errors.txt @@ -5,7 +5,7 @@ tests/cases/compiler/genericTypeAssertions2.ts(10,5): error TS2322: Type 'B' is not assignable to type 'B'. Property 'bar' is missing in type 'A'. -tests/cases/compiler/genericTypeAssertions2.ts(13,21): error TS2352: Neither type 'undefined[]' nor type 'A' is assignable to the other. +tests/cases/compiler/genericTypeAssertions2.ts(13,21): error TS2352: Type 'undefined[]' cannot be converted to type 'A'. Property 'foo' is missing in type 'undefined[]'. @@ -33,5 +33,5 @@ tests/cases/compiler/genericTypeAssertions2.ts(13,21): error TS2352: Neither typ var r4: A = >new A(); var r5: A = >[]; // error ~~~~~~~~~~~~~ -!!! error TS2352: Neither type 'undefined[]' nor type 'A' is assignable to the other. +!!! error TS2352: Type 'undefined[]' cannot be converted to type 'A'. !!! error TS2352: Property 'foo' is missing in type 'undefined[]'. \ No newline at end of file diff --git a/tests/baselines/reference/genericTypeAssertions4.errors.txt b/tests/baselines/reference/genericTypeAssertions4.errors.txt index 055de774b39..401834930f3 100644 --- a/tests/baselines/reference/genericTypeAssertions4.errors.txt +++ b/tests/baselines/reference/genericTypeAssertions4.errors.txt @@ -1,8 +1,8 @@ tests/cases/compiler/genericTypeAssertions4.ts(19,5): error TS2322: Type 'A' is not assignable to type 'T'. tests/cases/compiler/genericTypeAssertions4.ts(20,5): error TS2322: Type 'B' is not assignable to type 'T'. tests/cases/compiler/genericTypeAssertions4.ts(21,5): error TS2322: Type 'C' is not assignable to type 'T'. -tests/cases/compiler/genericTypeAssertions4.ts(23,9): error TS2352: Neither type 'B' nor type 'T' is assignable to the other. -tests/cases/compiler/genericTypeAssertions4.ts(24,9): error TS2352: Neither type 'C' nor type 'T' is assignable to the other. +tests/cases/compiler/genericTypeAssertions4.ts(23,9): error TS2352: Type 'B' cannot be converted to type 'T'. +tests/cases/compiler/genericTypeAssertions4.ts(24,9): error TS2352: Type 'C' cannot be converted to type 'T'. ==== tests/cases/compiler/genericTypeAssertions4.ts (5 errors) ==== @@ -36,8 +36,8 @@ tests/cases/compiler/genericTypeAssertions4.ts(24,9): error TS2352: Neither type y = a; y = b; // error: cannot convert B to T ~~~~ -!!! error TS2352: Neither type 'B' nor type 'T' is assignable to the other. +!!! error TS2352: Type 'B' cannot be converted to type 'T'. y = c; // error: cannot convert C to T ~~~~ -!!! error TS2352: Neither type 'C' nor type 'T' is assignable to the other. +!!! error TS2352: Type 'C' cannot be converted to type 'T'. } \ No newline at end of file diff --git a/tests/baselines/reference/genericTypeAssertions5.errors.txt b/tests/baselines/reference/genericTypeAssertions5.errors.txt index e315a7f122a..45f76073363 100644 --- a/tests/baselines/reference/genericTypeAssertions5.errors.txt +++ b/tests/baselines/reference/genericTypeAssertions5.errors.txt @@ -1,8 +1,8 @@ tests/cases/compiler/genericTypeAssertions5.ts(19,5): error TS2322: Type 'A' is not assignable to type 'T'. tests/cases/compiler/genericTypeAssertions5.ts(20,5): error TS2322: Type 'B' is not assignable to type 'T'. tests/cases/compiler/genericTypeAssertions5.ts(21,5): error TS2322: Type 'C' is not assignable to type 'T'. -tests/cases/compiler/genericTypeAssertions5.ts(23,9): error TS2352: Neither type 'B' nor type 'T' is assignable to the other. -tests/cases/compiler/genericTypeAssertions5.ts(24,9): error TS2352: Neither type 'C' nor type 'T' is assignable to the other. +tests/cases/compiler/genericTypeAssertions5.ts(23,9): error TS2352: Type 'B' cannot be converted to type 'T'. +tests/cases/compiler/genericTypeAssertions5.ts(24,9): error TS2352: Type 'C' cannot be converted to type 'T'. ==== tests/cases/compiler/genericTypeAssertions5.ts (5 errors) ==== @@ -36,8 +36,8 @@ tests/cases/compiler/genericTypeAssertions5.ts(24,9): error TS2352: Neither type y = a; y = b; // error: cannot convert B to T ~~~~ -!!! error TS2352: Neither type 'B' nor type 'T' is assignable to the other. +!!! error TS2352: Type 'B' cannot be converted to type 'T'. y = c; // error: cannot convert C to T ~~~~ -!!! error TS2352: Neither type 'C' nor type 'T' is assignable to the other. +!!! error TS2352: Type 'C' cannot be converted to type 'T'. } \ No newline at end of file diff --git a/tests/baselines/reference/genericTypeAssertions6.errors.txt b/tests/baselines/reference/genericTypeAssertions6.errors.txt index 29ca99ecb1a..1bda683b88a 100644 --- a/tests/baselines/reference/genericTypeAssertions6.errors.txt +++ b/tests/baselines/reference/genericTypeAssertions6.errors.txt @@ -1,7 +1,7 @@ -tests/cases/compiler/genericTypeAssertions6.ts(8,13): error TS2352: Neither type 'U' nor type 'T' is assignable to the other. -tests/cases/compiler/genericTypeAssertions6.ts(9,13): error TS2352: Neither type 'T' nor type 'U' is assignable to the other. -tests/cases/compiler/genericTypeAssertions6.ts(19,17): error TS2352: Neither type 'U' nor type 'T' is assignable to the other. - Type 'Date' is not assignable to type 'T'. +tests/cases/compiler/genericTypeAssertions6.ts(8,13): error TS2352: Type 'U' cannot be converted to type 'T'. +tests/cases/compiler/genericTypeAssertions6.ts(9,13): error TS2352: Type 'T' cannot be converted to type 'U'. +tests/cases/compiler/genericTypeAssertions6.ts(19,17): error TS2352: Type 'U' cannot be converted to type 'T'. + Type 'Date' is not comparable to type 'T'. ==== tests/cases/compiler/genericTypeAssertions6.ts (3 errors) ==== @@ -14,10 +14,10 @@ tests/cases/compiler/genericTypeAssertions6.ts(19,17): error TS2352: Neither typ f(x: T, y: U) { x = y; ~~~~ -!!! error TS2352: Neither type 'U' nor type 'T' is assignable to the other. +!!! error TS2352: Type 'U' cannot be converted to type 'T'. y = x; ~~~~ -!!! error TS2352: Neither type 'T' nor type 'U' is assignable to the other. +!!! error TS2352: Type 'T' cannot be converted to type 'U'. } } @@ -29,8 +29,8 @@ tests/cases/compiler/genericTypeAssertions6.ts(19,17): error TS2352: Neither typ var d = new Date(); var e = new Date(); ~~~~~~~~~~~~~~~~ -!!! error TS2352: Neither type 'U' nor type 'T' is assignable to the other. -!!! error TS2352: Type 'Date' is not assignable to type 'T'. +!!! error TS2352: Type 'U' cannot be converted to type 'T'. +!!! error TS2352: Type 'Date' is not comparable to type 'T'. } } diff --git a/tests/baselines/reference/genericTypeParameterEquivalence2.symbols b/tests/baselines/reference/genericTypeParameterEquivalence2.symbols index cd558fdd10a..1aa22b1e994 100644 --- a/tests/baselines/reference/genericTypeParameterEquivalence2.symbols +++ b/tests/baselines/reference/genericTypeParameterEquivalence2.symbols @@ -24,9 +24,9 @@ function compose(f: (b: B) => C, g: (a:A) => B): (a:A) => C { return f(g.apply(null, a)); >f : Symbol(f, Decl(genericTypeParameterEquivalence2.ts, 1, 26)) ->g.apply : Symbol(Function.apply, Decl(lib.d.ts, --, --)) +>g.apply : Symbol(Function.apply, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >g : Symbol(g, Decl(genericTypeParameterEquivalence2.ts, 1, 41)) ->apply : Symbol(Function.apply, Decl(lib.d.ts, --, --)) +>apply : Symbol(Function.apply, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >a : Symbol(a, Decl(genericTypeParameterEquivalence2.ts, 2, 21)) }; diff --git a/tests/baselines/reference/genericTypeParameterEquivalence2.types b/tests/baselines/reference/genericTypeParameterEquivalence2.types index 3b2c533543d..9fdb03b0fbe 100644 --- a/tests/baselines/reference/genericTypeParameterEquivalence2.types +++ b/tests/baselines/reference/genericTypeParameterEquivalence2.types @@ -26,10 +26,10 @@ function compose(f: (b: B) => C, g: (a:A) => B): (a:A) => C { return f(g.apply(null, a)); >f(g.apply(null, a)) : C >f : (b: B) => C ->g.apply(null, a) : any ->g.apply : (thisArg: any, argArray?: any) => any +>g.apply(null, a) : B +>g.apply : { (this: (this: T, ...argArray: any[]) => U, thisArg: T, argArray?: any): U; (this: Function, thisArg: any, argArray?: any): any; } >g : (a: A) => B ->apply : (thisArg: any, argArray?: any) => any +>apply : { (this: (this: T, ...argArray: any[]) => U, thisArg: T, argArray?: any): U; (this: Function, thisArg: any, argArray?: any): any; } >null : null >a : A diff --git a/tests/baselines/reference/indexer3.symbols b/tests/baselines/reference/indexer3.symbols index fa6f905def6..03b055b343f 100644 --- a/tests/baselines/reference/indexer3.symbols +++ b/tests/baselines/reference/indexer3.symbols @@ -2,10 +2,10 @@ var dateMap: { [x: string]: Date; } = {} >dateMap : Symbol(dateMap, Decl(indexer3.ts, 0, 3)) >x : Symbol(x, Decl(indexer3.ts, 0, 16)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) var r: Date = dateMap["hello"] // result type includes indexer using BCT >r : Symbol(r, Decl(indexer3.ts, 1, 3)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >dateMap : Symbol(dateMap, Decl(indexer3.ts, 0, 3)) diff --git a/tests/baselines/reference/indexersInClassType.symbols b/tests/baselines/reference/indexersInClassType.symbols index 149a61d8b4d..27c64845e92 100644 --- a/tests/baselines/reference/indexersInClassType.symbols +++ b/tests/baselines/reference/indexersInClassType.symbols @@ -4,14 +4,14 @@ class C { [x: number]: Date; >x : Symbol(x, Decl(indexersInClassType.ts, 1, 5)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) [x: string]: Object; >x : Symbol(x, Decl(indexersInClassType.ts, 2, 5)) >Object : Symbol(Object, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) 1: Date; ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) 'a': {} diff --git a/tests/baselines/reference/inferenceLimit.symbols b/tests/baselines/reference/inferenceLimit.symbols index 8a338b80307..bedea9ce1f0 100644 --- a/tests/baselines/reference/inferenceLimit.symbols +++ b/tests/baselines/reference/inferenceLimit.symbols @@ -14,8 +14,8 @@ export class BrokenClass { >value : Symbol(value, Decl(file1.ts, 7, 36)) return new Promise>((resolve, reject) => { ->Promise : Symbol(Promise, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->Array : Symbol(Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Array : Symbol(Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --)) >MyModule : Symbol(MyModule, Decl(file1.ts, 1, 6)) >MyModel : Symbol(MyModule.MyModel, Decl(mymodule.ts, 0, 0)) >resolve : Symbol(resolve, Decl(file1.ts, 8, 47)) @@ -23,7 +23,7 @@ export class BrokenClass { let result: Array = []; >result : Symbol(result, Decl(file1.ts, 10, 7)) ->Array : Symbol(Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Array : Symbol(Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --)) >MyModule : Symbol(MyModule, Decl(file1.ts, 1, 6)) >MyModel : Symbol(MyModule.MyModel, Decl(mymodule.ts, 0, 0)) @@ -32,19 +32,19 @@ export class BrokenClass { >order : Symbol(order, Decl(file1.ts, 12, 25)) return new Promise((resolve, reject) => { ->Promise : Symbol(Promise, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) >resolve : Symbol(resolve, Decl(file1.ts, 13, 26)) >reject : Symbol(reject, Decl(file1.ts, 13, 34)) this.doStuff(order.id) ->this.doStuff(order.id) .then : Symbol(Promise.then, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>this.doStuff(order.id) .then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >this.doStuff : Symbol(BrokenClass.doStuff, Decl(file1.ts, 27, 3)) >this : Symbol(BrokenClass, Decl(file1.ts, 1, 39)) >doStuff : Symbol(BrokenClass.doStuff, Decl(file1.ts, 27, 3)) >order : Symbol(order, Decl(file1.ts, 12, 25)) .then((items) => { ->then : Symbol(Promise.then, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >items : Symbol(items, Decl(file1.ts, 15, 17)) order.items = items; @@ -60,19 +60,19 @@ export class BrokenClass { }; return Promise.all(result.map(populateItems)) ->Promise.all(result.map(populateItems)) .then : Symbol(Promise.then, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->Promise.all : Symbol(PromiseConstructor.all, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->Promise : Symbol(Promise, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->all : Symbol(PromiseConstructor.all, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->result.map : Symbol(Array.map, Decl(lib.d.ts, --, --)) +>Promise.all(result.map(populateItems)) .then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>Promise.all : Symbol(PromiseConstructor.all, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>all : Symbol(PromiseConstructor.all, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>result.map : Symbol(Array.map, Decl(lib.es5.d.ts, --, --)) >result : Symbol(result, Decl(file1.ts, 10, 7)) ->map : Symbol(Array.map, Decl(lib.d.ts, --, --)) +>map : Symbol(Array.map, Decl(lib.es5.d.ts, --, --)) >populateItems : Symbol(populateItems, Decl(file1.ts, 12, 7)) .then((orders: Array) => { ->then : Symbol(Promise.then, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >orders : Symbol(orders, Decl(file1.ts, 23, 13)) ->Array : Symbol(Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Array : Symbol(Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --)) >MyModule : Symbol(MyModule, Decl(file1.ts, 1, 6)) >MyModel : Symbol(MyModule.MyModel, Decl(mymodule.ts, 0, 0)) diff --git a/tests/baselines/reference/inheritanceOfGenericConstructorMethod1.symbols b/tests/baselines/reference/inheritanceOfGenericConstructorMethod1.symbols index 108170e8895..dad2ac6f886 100644 --- a/tests/baselines/reference/inheritanceOfGenericConstructorMethod1.symbols +++ b/tests/baselines/reference/inheritanceOfGenericConstructorMethod1.symbols @@ -12,7 +12,7 @@ class B extends A {} var a = new A(); >a : Symbol(a, Decl(inheritanceOfGenericConstructorMethod1.ts, 2, 3)) >A : Symbol(A, Decl(inheritanceOfGenericConstructorMethod1.ts, 0, 0)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) var b1 = new B(); // no error >b1 : Symbol(b1, Decl(inheritanceOfGenericConstructorMethod1.ts, 3, 3)) @@ -21,12 +21,12 @@ var b1 = new B(); // no error var b2: B = new B(); // no error >b2 : Symbol(b2, Decl(inheritanceOfGenericConstructorMethod1.ts, 4, 3)) >B : Symbol(B, Decl(inheritanceOfGenericConstructorMethod1.ts, 0, 14)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >B : Symbol(B, Decl(inheritanceOfGenericConstructorMethod1.ts, 0, 14)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) var b3 = new B(); // error, could not select overload for 'new' expression >b3 : Symbol(b3, Decl(inheritanceOfGenericConstructorMethod1.ts, 5, 3)) >B : Symbol(B, Decl(inheritanceOfGenericConstructorMethod1.ts, 0, 14)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) diff --git a/tests/baselines/reference/inheritedGenericCallSignature.symbols b/tests/baselines/reference/inheritedGenericCallSignature.symbols index 9a482685180..57469f4dad8 100644 --- a/tests/baselines/reference/inheritedGenericCallSignature.symbols +++ b/tests/baselines/reference/inheritedGenericCallSignature.symbols @@ -34,7 +34,7 @@ interface I2 extends I1 { var x: I2; >x : Symbol(x, Decl(inheritedGenericCallSignature.ts, 20, 3)) >I2 : Symbol(I2, Decl(inheritedGenericCallSignature.ts, 8, 19)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) diff --git a/tests/baselines/reference/innerTypeParameterShadowingOuterOne.symbols b/tests/baselines/reference/innerTypeParameterShadowingOuterOne.symbols index 36502a9988d..d3488b4db72 100644 --- a/tests/baselines/reference/innerTypeParameterShadowingOuterOne.symbols +++ b/tests/baselines/reference/innerTypeParameterShadowingOuterOne.symbols @@ -5,12 +5,12 @@ function f() { >f : Symbol(f, Decl(innerTypeParameterShadowingOuterOne.ts, 0, 0)) >T : Symbol(T, Decl(innerTypeParameterShadowingOuterOne.ts, 3, 11)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) function g() { >g : Symbol(g, Decl(innerTypeParameterShadowingOuterOne.ts, 3, 30)) >T : Symbol(T, Decl(innerTypeParameterShadowingOuterOne.ts, 4, 15)) ->Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) var x: T; >x : Symbol(x, Decl(innerTypeParameterShadowingOuterOne.ts, 5, 11)) @@ -34,16 +34,16 @@ function f() { function f2() { >f2 : Symbol(f2, Decl(innerTypeParameterShadowingOuterOne.ts, 10, 1)) >T : Symbol(T, Decl(innerTypeParameterShadowingOuterOne.ts, 12, 12)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >U : Symbol(U, Decl(innerTypeParameterShadowingOuterOne.ts, 12, 27)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) function g() { >g : Symbol(g, Decl(innerTypeParameterShadowingOuterOne.ts, 12, 47)) >T : Symbol(T, Decl(innerTypeParameterShadowingOuterOne.ts, 13, 15)) ->Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >U : Symbol(U, Decl(innerTypeParameterShadowingOuterOne.ts, 13, 32)) ->Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) var x: U; >x : Symbol(x, Decl(innerTypeParameterShadowingOuterOne.ts, 14, 11)) diff --git a/tests/baselines/reference/innerTypeParameterShadowingOuterOne2.symbols b/tests/baselines/reference/innerTypeParameterShadowingOuterOne2.symbols index 56699f1d6db..1a54ab4024a 100644 --- a/tests/baselines/reference/innerTypeParameterShadowingOuterOne2.symbols +++ b/tests/baselines/reference/innerTypeParameterShadowingOuterOne2.symbols @@ -5,12 +5,12 @@ class C { >C : Symbol(C, Decl(innerTypeParameterShadowingOuterOne2.ts, 0, 0)) >T : Symbol(T, Decl(innerTypeParameterShadowingOuterOne2.ts, 3, 8)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) g() { >g : Symbol(C.g, Decl(innerTypeParameterShadowingOuterOne2.ts, 3, 25)) >T : Symbol(T, Decl(innerTypeParameterShadowingOuterOne2.ts, 4, 6)) ->Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) var x: T; >x : Symbol(x, Decl(innerTypeParameterShadowingOuterOne2.ts, 5, 11)) @@ -39,16 +39,16 @@ class C { class C2 { >C2 : Symbol(C2, Decl(innerTypeParameterShadowingOuterOne2.ts, 13, 1)) >T : Symbol(T, Decl(innerTypeParameterShadowingOuterOne2.ts, 15, 9)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >U : Symbol(U, Decl(innerTypeParameterShadowingOuterOne2.ts, 15, 24)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) g() { >g : Symbol(C2.g, Decl(innerTypeParameterShadowingOuterOne2.ts, 15, 42)) >T : Symbol(T, Decl(innerTypeParameterShadowingOuterOne2.ts, 16, 6)) ->Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >U : Symbol(U, Decl(innerTypeParameterShadowingOuterOne2.ts, 16, 23)) ->Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) var x: U; >x : Symbol(x, Decl(innerTypeParameterShadowingOuterOne2.ts, 17, 11)) diff --git a/tests/baselines/reference/intTypeCheck.errors.txt b/tests/baselines/reference/intTypeCheck.errors.txt index a860f5e3604..0d19c6b2b6e 100644 --- a/tests/baselines/reference/intTypeCheck.errors.txt +++ b/tests/baselines/reference/intTypeCheck.errors.txt @@ -70,7 +70,7 @@ tests/cases/compiler/intTypeCheck.ts(182,5): error TS2322: Type '{}' is not assi Type '{}' provides no match for the signature 'new (): any' tests/cases/compiler/intTypeCheck.ts(183,5): error TS2322: Type 'Object' is not assignable to type 'i7'. Type 'Object' provides no match for the signature 'new (): any' -tests/cases/compiler/intTypeCheck.ts(185,17): error TS2352: Neither type 'Base' nor type 'i7' is assignable to the other. +tests/cases/compiler/intTypeCheck.ts(185,17): error TS2352: Type 'Base' cannot be converted to type 'i7'. Type 'Base' provides no match for the signature 'new (): any' tests/cases/compiler/intTypeCheck.ts(187,5): error TS2322: Type '() => void' is not assignable to type 'i7'. Type '() => void' provides no match for the signature 'new (): any' @@ -396,7 +396,7 @@ tests/cases/compiler/intTypeCheck.ts(205,17): error TS2351: Cannot use 'new' wit var obj69: i7 = new obj66; var obj70: i7 = new Base; ~~~~~~~~~~~~ -!!! error TS2352: Neither type 'Base' nor type 'i7' is assignable to the other. +!!! error TS2352: Type 'Base' cannot be converted to type 'i7'. !!! error TS2352: Type 'Base' provides no match for the signature 'new (): any' var obj71: i7 = null; var obj72: i7 = function () { }; diff --git a/tests/baselines/reference/iterableArrayPattern1.symbols b/tests/baselines/reference/iterableArrayPattern1.symbols index 59ea46b8781..a7e8215dda9 100644 --- a/tests/baselines/reference/iterableArrayPattern1.symbols +++ b/tests/baselines/reference/iterableArrayPattern1.symbols @@ -13,7 +13,7 @@ class SymbolIterator { return { value: Symbol(), >value : Symbol(value, Decl(iterableArrayPattern1.ts, 3, 16)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) done: false >done : Symbol(done, Decl(iterableArrayPattern1.ts, 4, 28)) @@ -22,9 +22,9 @@ class SymbolIterator { } [Symbol.iterator]() { ->Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) +>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) return this; >this : Symbol(SymbolIterator, Decl(iterableArrayPattern1.ts, 0, 32)) diff --git a/tests/baselines/reference/iterableArrayPattern11.symbols b/tests/baselines/reference/iterableArrayPattern11.symbols index 32e79de0dc0..9a61280b634 100644 --- a/tests/baselines/reference/iterableArrayPattern11.symbols +++ b/tests/baselines/reference/iterableArrayPattern11.symbols @@ -36,9 +36,9 @@ class FooIterator { } [Symbol.iterator]() { ->Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) +>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) return this; >this : Symbol(FooIterator, Decl(iterableArrayPattern11.ts, 3, 27)) diff --git a/tests/baselines/reference/iterableArrayPattern12.symbols b/tests/baselines/reference/iterableArrayPattern12.symbols index 4b844fc4003..8046b32d120 100644 --- a/tests/baselines/reference/iterableArrayPattern12.symbols +++ b/tests/baselines/reference/iterableArrayPattern12.symbols @@ -36,9 +36,9 @@ class FooIterator { } [Symbol.iterator]() { ->Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) +>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) return this; >this : Symbol(FooIterator, Decl(iterableArrayPattern12.ts, 3, 27)) diff --git a/tests/baselines/reference/iterableArrayPattern13.symbols b/tests/baselines/reference/iterableArrayPattern13.symbols index c346a8a73b1..3ebaac62fcc 100644 --- a/tests/baselines/reference/iterableArrayPattern13.symbols +++ b/tests/baselines/reference/iterableArrayPattern13.symbols @@ -35,9 +35,9 @@ class FooIterator { } [Symbol.iterator]() { ->Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) +>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) return this; >this : Symbol(FooIterator, Decl(iterableArrayPattern13.ts, 3, 27)) diff --git a/tests/baselines/reference/iterableArrayPattern2.symbols b/tests/baselines/reference/iterableArrayPattern2.symbols index dc1eaef8ce1..6ab3040d570 100644 --- a/tests/baselines/reference/iterableArrayPattern2.symbols +++ b/tests/baselines/reference/iterableArrayPattern2.symbols @@ -13,7 +13,7 @@ class SymbolIterator { return { value: Symbol(), >value : Symbol(value, Decl(iterableArrayPattern2.ts, 3, 16)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) done: false >done : Symbol(done, Decl(iterableArrayPattern2.ts, 4, 28)) @@ -22,9 +22,9 @@ class SymbolIterator { } [Symbol.iterator]() { ->Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) +>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) return this; >this : Symbol(SymbolIterator, Decl(iterableArrayPattern2.ts, 0, 35)) diff --git a/tests/baselines/reference/iterableArrayPattern3.symbols b/tests/baselines/reference/iterableArrayPattern3.symbols index 9fb3aa26598..b9fe0a95cdd 100644 --- a/tests/baselines/reference/iterableArrayPattern3.symbols +++ b/tests/baselines/reference/iterableArrayPattern3.symbols @@ -37,9 +37,9 @@ class FooIterator { } [Symbol.iterator]() { ->Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) +>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) return this; >this : Symbol(FooIterator, Decl(iterableArrayPattern3.ts, 3, 27)) diff --git a/tests/baselines/reference/iterableArrayPattern30.symbols b/tests/baselines/reference/iterableArrayPattern30.symbols index 393d9fbca51..b6597922490 100644 --- a/tests/baselines/reference/iterableArrayPattern30.symbols +++ b/tests/baselines/reference/iterableArrayPattern30.symbols @@ -4,5 +4,5 @@ const [[k1, v1], [k2, v2]] = new Map([["", true], ["hello", true]]) >v1 : Symbol(v1, Decl(iterableArrayPattern30.ts, 0, 11)) >k2 : Symbol(k2, Decl(iterableArrayPattern30.ts, 0, 18)) >v2 : Symbol(v2, Decl(iterableArrayPattern30.ts, 0, 21)) ->Map : Symbol(Map, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Map : Symbol(Map, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.collection.d.ts, --, --), Decl(lib.es2015.collection.d.ts, --, --)) diff --git a/tests/baselines/reference/iterableArrayPattern4.symbols b/tests/baselines/reference/iterableArrayPattern4.symbols index 85e2f431ecd..b39834bec2e 100644 --- a/tests/baselines/reference/iterableArrayPattern4.symbols +++ b/tests/baselines/reference/iterableArrayPattern4.symbols @@ -37,9 +37,9 @@ class FooIterator { } [Symbol.iterator]() { ->Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) +>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) return this; >this : Symbol(FooIterator, Decl(iterableArrayPattern4.ts, 3, 27)) diff --git a/tests/baselines/reference/iterableArrayPattern9.symbols b/tests/baselines/reference/iterableArrayPattern9.symbols index e48dd83aafb..f79e2d687b6 100644 --- a/tests/baselines/reference/iterableArrayPattern9.symbols +++ b/tests/baselines/reference/iterableArrayPattern9.symbols @@ -32,9 +32,9 @@ class FooIterator { } [Symbol.iterator]() { ->Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) +>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) return this; >this : Symbol(FooIterator, Decl(iterableArrayPattern9.ts, 2, 27)) diff --git a/tests/baselines/reference/iterableContextualTyping1.symbols b/tests/baselines/reference/iterableContextualTyping1.symbols index 5af4fdbcd78..8d9a47a8f3b 100644 --- a/tests/baselines/reference/iterableContextualTyping1.symbols +++ b/tests/baselines/reference/iterableContextualTyping1.symbols @@ -1,10 +1,10 @@ === tests/cases/conformance/expressions/contextualTyping/iterableContextualTyping1.ts === var iter: Iterable<(x: string) => number> = [s => s.length]; >iter : Symbol(iter, Decl(iterableContextualTyping1.ts, 0, 3)) ->Iterable : Symbol(Iterable, Decl(lib.d.ts, --, --)) +>Iterable : Symbol(Iterable, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) >x : Symbol(x, Decl(iterableContextualTyping1.ts, 0, 20)) >s : Symbol(s, Decl(iterableContextualTyping1.ts, 0, 45)) ->s.length : Symbol(String.length, Decl(lib.d.ts, --, --)) +>s.length : Symbol(String.length, Decl(lib.es5.d.ts, --, --)) >s : Symbol(s, Decl(iterableContextualTyping1.ts, 0, 45)) ->length : Symbol(String.length, Decl(lib.d.ts, --, --)) +>length : Symbol(String.length, Decl(lib.es5.d.ts, --, --)) diff --git a/tests/baselines/reference/iteratorSpreadInArray.symbols b/tests/baselines/reference/iteratorSpreadInArray.symbols index 580cc86cffc..11e1de17444 100644 --- a/tests/baselines/reference/iteratorSpreadInArray.symbols +++ b/tests/baselines/reference/iteratorSpreadInArray.symbols @@ -12,7 +12,7 @@ class SymbolIterator { return { value: Symbol(), >value : Symbol(value, Decl(iteratorSpreadInArray.ts, 4, 16)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) done: false >done : Symbol(done, Decl(iteratorSpreadInArray.ts, 5, 28)) @@ -21,9 +21,9 @@ class SymbolIterator { } [Symbol.iterator]() { ->Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) +>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) return this; >this : Symbol(SymbolIterator, Decl(iteratorSpreadInArray.ts, 0, 36)) diff --git a/tests/baselines/reference/iteratorSpreadInArray11.symbols b/tests/baselines/reference/iteratorSpreadInArray11.symbols index f982bf2deab..b2d8a522377 100644 --- a/tests/baselines/reference/iteratorSpreadInArray11.symbols +++ b/tests/baselines/reference/iteratorSpreadInArray11.symbols @@ -1,7 +1,7 @@ === tests/cases/conformance/es6/spread/iteratorSpreadInArray11.ts === var iter: Iterable; >iter : Symbol(iter, Decl(iteratorSpreadInArray11.ts, 0, 3)) ->Iterable : Symbol(Iterable, Decl(lib.d.ts, --, --)) +>Iterable : Symbol(Iterable, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) var array = [...iter]; >array : Symbol(array, Decl(iteratorSpreadInArray11.ts, 1, 3)) diff --git a/tests/baselines/reference/iteratorSpreadInArray2.symbols b/tests/baselines/reference/iteratorSpreadInArray2.symbols index ec223d508a8..5f9354727e5 100644 --- a/tests/baselines/reference/iteratorSpreadInArray2.symbols +++ b/tests/baselines/reference/iteratorSpreadInArray2.symbols @@ -13,7 +13,7 @@ class SymbolIterator { return { value: Symbol(), >value : Symbol(value, Decl(iteratorSpreadInArray2.ts, 4, 16)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) done: false >done : Symbol(done, Decl(iteratorSpreadInArray2.ts, 5, 28)) @@ -22,9 +22,9 @@ class SymbolIterator { } [Symbol.iterator]() { ->Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) +>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) return this; >this : Symbol(SymbolIterator, Decl(iteratorSpreadInArray2.ts, 0, 59)) @@ -48,9 +48,9 @@ class NumberIterator { } [Symbol.iterator]() { ->Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) +>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) return this; >this : Symbol(NumberIterator, Decl(iteratorSpreadInArray2.ts, 13, 1)) diff --git a/tests/baselines/reference/iteratorSpreadInArray3.symbols b/tests/baselines/reference/iteratorSpreadInArray3.symbols index 2536978d339..40d2c3aab43 100644 --- a/tests/baselines/reference/iteratorSpreadInArray3.symbols +++ b/tests/baselines/reference/iteratorSpreadInArray3.symbols @@ -12,7 +12,7 @@ class SymbolIterator { return { value: Symbol(), >value : Symbol(value, Decl(iteratorSpreadInArray3.ts, 4, 16)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) done: false >done : Symbol(done, Decl(iteratorSpreadInArray3.ts, 5, 28)) @@ -21,9 +21,9 @@ class SymbolIterator { } [Symbol.iterator]() { ->Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) +>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) return this; >this : Symbol(SymbolIterator, Decl(iteratorSpreadInArray3.ts, 0, 47)) diff --git a/tests/baselines/reference/iteratorSpreadInArray4.symbols b/tests/baselines/reference/iteratorSpreadInArray4.symbols index 89daffea26b..65f3bbbea45 100644 --- a/tests/baselines/reference/iteratorSpreadInArray4.symbols +++ b/tests/baselines/reference/iteratorSpreadInArray4.symbols @@ -12,7 +12,7 @@ class SymbolIterator { return { value: Symbol(), >value : Symbol(value, Decl(iteratorSpreadInArray4.ts, 4, 16)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) done: false >done : Symbol(done, Decl(iteratorSpreadInArray4.ts, 5, 28)) @@ -21,9 +21,9 @@ class SymbolIterator { } [Symbol.iterator]() { ->Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) +>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) return this; >this : Symbol(SymbolIterator, Decl(iteratorSpreadInArray4.ts, 0, 42)) diff --git a/tests/baselines/reference/iteratorSpreadInArray7.symbols b/tests/baselines/reference/iteratorSpreadInArray7.symbols index 23761a2d23c..d5830a8146a 100644 --- a/tests/baselines/reference/iteratorSpreadInArray7.symbols +++ b/tests/baselines/reference/iteratorSpreadInArray7.symbols @@ -3,9 +3,9 @@ var array: symbol[]; >array : Symbol(array, Decl(iteratorSpreadInArray7.ts, 0, 3)) array.concat([...new SymbolIterator]); ->array.concat : Symbol(Array.concat, Decl(lib.d.ts, --, --)) +>array.concat : Symbol(Array.concat, Decl(lib.es5.d.ts, --, --)) >array : Symbol(array, Decl(iteratorSpreadInArray7.ts, 0, 3)) ->concat : Symbol(Array.concat, Decl(lib.d.ts, --, --)) +>concat : Symbol(Array.concat, Decl(lib.es5.d.ts, --, --)) >SymbolIterator : Symbol(SymbolIterator, Decl(iteratorSpreadInArray7.ts, 1, 38)) class SymbolIterator { @@ -17,7 +17,7 @@ class SymbolIterator { return { value: Symbol(), >value : Symbol(value, Decl(iteratorSpreadInArray7.ts, 5, 16)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) done: false >done : Symbol(done, Decl(iteratorSpreadInArray7.ts, 6, 28)) @@ -26,9 +26,9 @@ class SymbolIterator { } [Symbol.iterator]() { ->Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) +>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) return this; >this : Symbol(SymbolIterator, Decl(iteratorSpreadInArray7.ts, 1, 38)) diff --git a/tests/baselines/reference/iteratorSpreadInCall11.symbols b/tests/baselines/reference/iteratorSpreadInCall11.symbols index e6f43e6e02c..335487813d9 100644 --- a/tests/baselines/reference/iteratorSpreadInCall11.symbols +++ b/tests/baselines/reference/iteratorSpreadInCall11.symbols @@ -19,7 +19,7 @@ class SymbolIterator { return { value: Symbol(), >value : Symbol(value, Decl(iteratorSpreadInCall11.ts, 6, 16)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) done: false >done : Symbol(done, Decl(iteratorSpreadInCall11.ts, 7, 28)) @@ -28,9 +28,9 @@ class SymbolIterator { } [Symbol.iterator]() { ->Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) +>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) return this; >this : Symbol(SymbolIterator, Decl(iteratorSpreadInCall11.ts, 2, 42)) diff --git a/tests/baselines/reference/iteratorSpreadInCall12.symbols b/tests/baselines/reference/iteratorSpreadInCall12.symbols index b9d33f02d1e..b0d47deaba0 100644 --- a/tests/baselines/reference/iteratorSpreadInCall12.symbols +++ b/tests/baselines/reference/iteratorSpreadInCall12.symbols @@ -22,7 +22,7 @@ class SymbolIterator { return { value: Symbol(), >value : Symbol(value, Decl(iteratorSpreadInCall12.ts, 8, 16)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) done: false >done : Symbol(done, Decl(iteratorSpreadInCall12.ts, 9, 28)) @@ -31,9 +31,9 @@ class SymbolIterator { } [Symbol.iterator]() { ->Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) +>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) return this; >this : Symbol(SymbolIterator, Decl(iteratorSpreadInCall12.ts, 4, 1)) @@ -57,9 +57,9 @@ class StringIterator { } [Symbol.iterator]() { ->Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) +>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) return this; >this : Symbol(StringIterator, Decl(iteratorSpreadInCall12.ts, 17, 1)) diff --git a/tests/baselines/reference/iteratorSpreadInCall3.symbols b/tests/baselines/reference/iteratorSpreadInCall3.symbols index 61c37ee9019..eef50a68d38 100644 --- a/tests/baselines/reference/iteratorSpreadInCall3.symbols +++ b/tests/baselines/reference/iteratorSpreadInCall3.symbols @@ -16,7 +16,7 @@ class SymbolIterator { return { value: Symbol(), >value : Symbol(value, Decl(iteratorSpreadInCall3.ts, 5, 16)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) done: false >done : Symbol(done, Decl(iteratorSpreadInCall3.ts, 6, 28)) @@ -25,9 +25,9 @@ class SymbolIterator { } [Symbol.iterator]() { ->Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) +>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) return this; >this : Symbol(SymbolIterator, Decl(iteratorSpreadInCall3.ts, 2, 32)) diff --git a/tests/baselines/reference/iteratorSpreadInCall5.symbols b/tests/baselines/reference/iteratorSpreadInCall5.symbols index ea4a93c8c2b..02c44ec3bfa 100644 --- a/tests/baselines/reference/iteratorSpreadInCall5.symbols +++ b/tests/baselines/reference/iteratorSpreadInCall5.symbols @@ -17,7 +17,7 @@ class SymbolIterator { return { value: Symbol(), >value : Symbol(value, Decl(iteratorSpreadInCall5.ts, 5, 16)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) done: false >done : Symbol(done, Decl(iteratorSpreadInCall5.ts, 6, 28)) @@ -26,9 +26,9 @@ class SymbolIterator { } [Symbol.iterator]() { ->Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) +>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) return this; >this : Symbol(SymbolIterator, Decl(iteratorSpreadInCall5.ts, 2, 43)) @@ -52,9 +52,9 @@ class StringIterator { } [Symbol.iterator]() { ->Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) +>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) return this; >this : Symbol(StringIterator, Decl(iteratorSpreadInCall5.ts, 14, 1)) diff --git a/tests/baselines/reference/letDeclarations-access.symbols b/tests/baselines/reference/letDeclarations-access.symbols index 060ebc80b80..078ad740d20 100644 --- a/tests/baselines/reference/letDeclarations-access.symbols +++ b/tests/baselines/reference/letDeclarations-access.symbols @@ -81,7 +81,7 @@ x; >x : Symbol(x, Decl(letDeclarations-access.ts, 1, 3)) x.toString(); ->x.toString : Symbol(Number.toString, Decl(lib.d.ts, --, --)) +>x.toString : Symbol(Number.toString, Decl(lib.es5.d.ts, --, --)) >x : Symbol(x, Decl(letDeclarations-access.ts, 1, 3)) ->toString : Symbol(Number.toString, Decl(lib.d.ts, --, --)) +>toString : Symbol(Number.toString, Decl(lib.es5.d.ts, --, --)) diff --git a/tests/baselines/reference/library-reference-1.js b/tests/baselines/reference/library-reference-1.js new file mode 100644 index 00000000000..e709db72dea --- /dev/null +++ b/tests/baselines/reference/library-reference-1.js @@ -0,0 +1,17 @@ +//// [tests/cases/conformance/references/library-reference-1.ts] //// + +//// [index.d.ts] + +// We can find typings in the ./types folder + +declare var $: { foo(): void }; + + +//// [consumer.ts] +/// +$.foo(); + + +//// [consumer.js] +/// +$.foo(); diff --git a/tests/baselines/reference/library-reference-1.symbols b/tests/baselines/reference/library-reference-1.symbols new file mode 100644 index 00000000000..0e848c626c5 --- /dev/null +++ b/tests/baselines/reference/library-reference-1.symbols @@ -0,0 +1,16 @@ +=== /consumer.ts === +/// +$.foo(); +>$.foo : Symbol(foo, Decl(index.d.ts, 3, 16)) +>$ : Symbol($, Decl(index.d.ts, 3, 11)) +>foo : Symbol(foo, Decl(index.d.ts, 3, 16)) + +=== /types/jquery/index.d.ts === + +// We can find typings in the ./types folder + +declare var $: { foo(): void }; +>$ : Symbol($, Decl(index.d.ts, 3, 11)) +>foo : Symbol(foo, Decl(index.d.ts, 3, 16)) + + diff --git a/tests/baselines/reference/library-reference-1.trace.json b/tests/baselines/reference/library-reference-1.trace.json new file mode 100644 index 00000000000..1b8c237dff1 --- /dev/null +++ b/tests/baselines/reference/library-reference-1.trace.json @@ -0,0 +1,7 @@ +[ + "======== Resolving type reference directive 'jquery', containing file '/consumer.ts', root directory '/'. ========", + "Resolving with primary search path '/types/'", + "File '/types/jquery/package.json' does not exist.", + "File '/types/jquery/index.d.ts' exist - use it as a name resolution result.", + "======== Type reference directive 'jquery' was successfully resolved to '/types/jquery/index.d.ts', primary: true. ========" +] \ No newline at end of file diff --git a/tests/baselines/reference/library-reference-1.types b/tests/baselines/reference/library-reference-1.types new file mode 100644 index 00000000000..99133f2f8df --- /dev/null +++ b/tests/baselines/reference/library-reference-1.types @@ -0,0 +1,17 @@ +=== /consumer.ts === +/// +$.foo(); +>$.foo() : void +>$.foo : () => void +>$ : { foo(): void; } +>foo : () => void + +=== /types/jquery/index.d.ts === + +// We can find typings in the ./types folder + +declare var $: { foo(): void }; +>$ : { foo(): void; } +>foo : () => void + + diff --git a/tests/baselines/reference/library-reference-10.js b/tests/baselines/reference/library-reference-10.js new file mode 100644 index 00000000000..a6dbdfce610 --- /dev/null +++ b/tests/baselines/reference/library-reference-10.js @@ -0,0 +1,22 @@ +//// [tests/cases/conformance/references/library-reference-10.ts] //// + +//// [package.json] + +// package.json in a primary reference can refer to another file + +{ + "typings": "jquery.d.ts" +} + +//// [jquery.d.ts] +declare var $: { foo(): void }; + + +//// [consumer.ts] +/// +$.foo(); + + +//// [consumer.js] +/// +$.foo(); diff --git a/tests/baselines/reference/library-reference-10.symbols b/tests/baselines/reference/library-reference-10.symbols new file mode 100644 index 00000000000..9d0f7e4781e --- /dev/null +++ b/tests/baselines/reference/library-reference-10.symbols @@ -0,0 +1,13 @@ +=== /consumer.ts === +/// +$.foo(); +>$.foo : Symbol(foo, Decl(jquery.d.ts, 0, 16)) +>$ : Symbol($, Decl(jquery.d.ts, 0, 11)) +>foo : Symbol(foo, Decl(jquery.d.ts, 0, 16)) + +=== /types/jquery/jquery.d.ts === +declare var $: { foo(): void }; +>$ : Symbol($, Decl(jquery.d.ts, 0, 11)) +>foo : Symbol(foo, Decl(jquery.d.ts, 0, 16)) + + diff --git a/tests/baselines/reference/library-reference-10.trace.json b/tests/baselines/reference/library-reference-10.trace.json new file mode 100644 index 00000000000..e6a1918a446 --- /dev/null +++ b/tests/baselines/reference/library-reference-10.trace.json @@ -0,0 +1,8 @@ +[ + "======== Resolving type reference directive 'jquery', containing file '/consumer.ts', root directory '/'. ========", + "Resolving with primary search path '/types/'", + "Found 'package.json' at '/types/jquery/package.json'.", + "'package.json' has 'typings' field 'jquery.d.ts' that references '/types/jquery/jquery.d.ts'.", + "File '/types/jquery/jquery.d.ts' exist - use it as a name resolution result.", + "======== Type reference directive 'jquery' was successfully resolved to '/types/jquery/jquery.d.ts', primary: true. ========" +] \ No newline at end of file diff --git a/tests/baselines/reference/library-reference-10.types b/tests/baselines/reference/library-reference-10.types new file mode 100644 index 00000000000..42d78f72865 --- /dev/null +++ b/tests/baselines/reference/library-reference-10.types @@ -0,0 +1,14 @@ +=== /consumer.ts === +/// +$.foo(); +>$.foo() : void +>$.foo : () => void +>$ : { foo(): void; } +>foo : () => void + +=== /types/jquery/jquery.d.ts === +declare var $: { foo(): void }; +>$ : { foo(): void; } +>foo : () => void + + diff --git a/tests/baselines/reference/library-reference-11.js b/tests/baselines/reference/library-reference-11.js new file mode 100644 index 00000000000..773fe5a890a --- /dev/null +++ b/tests/baselines/reference/library-reference-11.js @@ -0,0 +1,22 @@ +//// [tests/cases/conformance/references/library-reference-11.ts] //// + +//// [package.json] + +// package.json in a secondary reference can refer to another file + +{ + "typings": "jquery.d.ts" +} + +//// [jquery.d.ts] +declare var $: { foo(): void }; + + +//// [consumer.ts] +/// +$.foo(); + + +//// [consumer.js] +/// +$.foo(); diff --git a/tests/baselines/reference/library-reference-11.symbols b/tests/baselines/reference/library-reference-11.symbols new file mode 100644 index 00000000000..22b8bdf1b44 --- /dev/null +++ b/tests/baselines/reference/library-reference-11.symbols @@ -0,0 +1,13 @@ +=== /a/b/consumer.ts === +/// +$.foo(); +>$.foo : Symbol(foo, Decl(jquery.d.ts, 0, 16)) +>$ : Symbol($, Decl(jquery.d.ts, 0, 11)) +>foo : Symbol(foo, Decl(jquery.d.ts, 0, 16)) + +=== /a/node_modules/jquery/jquery.d.ts === +declare var $: { foo(): void }; +>$ : Symbol($, Decl(jquery.d.ts, 0, 11)) +>foo : Symbol(foo, Decl(jquery.d.ts, 0, 16)) + + diff --git a/tests/baselines/reference/library-reference-11.trace.json b/tests/baselines/reference/library-reference-11.trace.json new file mode 100644 index 00000000000..e0af1e39c5a --- /dev/null +++ b/tests/baselines/reference/library-reference-11.trace.json @@ -0,0 +1,21 @@ +[ + "======== Resolving type reference directive 'jquery', containing file '/a/b/consumer.ts', root directory not set. ========", + "Root directory cannot be determined, skipping primary search paths.", + "Looking up in 'node_modules' folder, initial location '/a/b'", + "File '/a/b/node_modules/jquery.ts' does not exist.", + "File '/a/b/node_modules/jquery.d.ts' does not exist.", + "File '/a/b/node_modules/jquery/package.json' does not exist.", + "File '/a/b/node_modules/jquery/index.ts' does not exist.", + "File '/a/b/node_modules/jquery/index.d.ts' does not exist.", + "File '/a/b/node_modules/@types/jquery.ts' does not exist.", + "File '/a/b/node_modules/@types/jquery.d.ts' does not exist.", + "File '/a/b/node_modules/@types/jquery/package.json' does not exist.", + "File '/a/b/node_modules/@types/jquery/index.ts' does not exist.", + "File '/a/b/node_modules/@types/jquery/index.d.ts' does not exist.", + "File '/a/node_modules/jquery.ts' does not exist.", + "File '/a/node_modules/jquery.d.ts' does not exist.", + "Found 'package.json' at '/a/node_modules/jquery/package.json'.", + "'package.json' has 'typings' field 'jquery.d.ts' that references '/a/node_modules/jquery/jquery.d.ts'.", + "File '/a/node_modules/jquery/jquery.d.ts' exist - use it as a name resolution result.", + "======== Type reference directive 'jquery' was successfully resolved to '/a/node_modules/jquery/jquery.d.ts', primary: false. ========" +] \ No newline at end of file diff --git a/tests/baselines/reference/library-reference-11.types b/tests/baselines/reference/library-reference-11.types new file mode 100644 index 00000000000..267ee08e6d6 --- /dev/null +++ b/tests/baselines/reference/library-reference-11.types @@ -0,0 +1,14 @@ +=== /a/b/consumer.ts === +/// +$.foo(); +>$.foo() : void +>$.foo : () => void +>$ : { foo(): void; } +>foo : () => void + +=== /a/node_modules/jquery/jquery.d.ts === +declare var $: { foo(): void }; +>$ : { foo(): void; } +>foo : () => void + + diff --git a/tests/baselines/reference/library-reference-12.js b/tests/baselines/reference/library-reference-12.js new file mode 100644 index 00000000000..42d0f650b50 --- /dev/null +++ b/tests/baselines/reference/library-reference-12.js @@ -0,0 +1,22 @@ +//// [tests/cases/conformance/references/library-reference-12.ts] //// + +//// [package.json] + +// package.json in a secondary reference can refer to another file + +{ + "types": "dist/jquery.d.ts" +} + +//// [jquery.d.ts] +declare var $: { foo(): void }; + + +//// [consumer.ts] +/// +$.foo(); + + +//// [consumer.js] +/// +$.foo(); diff --git a/tests/baselines/reference/library-reference-12.symbols b/tests/baselines/reference/library-reference-12.symbols new file mode 100644 index 00000000000..2e25588bf77 --- /dev/null +++ b/tests/baselines/reference/library-reference-12.symbols @@ -0,0 +1,13 @@ +=== /a/b/consumer.ts === +/// +$.foo(); +>$.foo : Symbol(foo, Decl(jquery.d.ts, 0, 16)) +>$ : Symbol($, Decl(jquery.d.ts, 0, 11)) +>foo : Symbol(foo, Decl(jquery.d.ts, 0, 16)) + +=== /a/node_modules/jquery/dist/jquery.d.ts === +declare var $: { foo(): void }; +>$ : Symbol($, Decl(jquery.d.ts, 0, 11)) +>foo : Symbol(foo, Decl(jquery.d.ts, 0, 16)) + + diff --git a/tests/baselines/reference/library-reference-12.trace.json b/tests/baselines/reference/library-reference-12.trace.json new file mode 100644 index 00000000000..2cdf1f5f20a --- /dev/null +++ b/tests/baselines/reference/library-reference-12.trace.json @@ -0,0 +1,21 @@ +[ + "======== Resolving type reference directive 'jquery', containing file '/a/b/consumer.ts', root directory not set. ========", + "Root directory cannot be determined, skipping primary search paths.", + "Looking up in 'node_modules' folder, initial location '/a/b'", + "File '/a/b/node_modules/jquery.ts' does not exist.", + "File '/a/b/node_modules/jquery.d.ts' does not exist.", + "File '/a/b/node_modules/jquery/package.json' does not exist.", + "File '/a/b/node_modules/jquery/index.ts' does not exist.", + "File '/a/b/node_modules/jquery/index.d.ts' does not exist.", + "File '/a/b/node_modules/@types/jquery.ts' does not exist.", + "File '/a/b/node_modules/@types/jquery.d.ts' does not exist.", + "File '/a/b/node_modules/@types/jquery/package.json' does not exist.", + "File '/a/b/node_modules/@types/jquery/index.ts' does not exist.", + "File '/a/b/node_modules/@types/jquery/index.d.ts' does not exist.", + "File '/a/node_modules/jquery.ts' does not exist.", + "File '/a/node_modules/jquery.d.ts' does not exist.", + "Found 'package.json' at '/a/node_modules/jquery/package.json'.", + "'package.json' has 'types' field 'dist/jquery.d.ts' that references '/a/node_modules/jquery/dist/jquery.d.ts'.", + "File '/a/node_modules/jquery/dist/jquery.d.ts' exist - use it as a name resolution result.", + "======== Type reference directive 'jquery' was successfully resolved to '/a/node_modules/jquery/dist/jquery.d.ts', primary: false. ========" +] \ No newline at end of file diff --git a/tests/baselines/reference/library-reference-12.types b/tests/baselines/reference/library-reference-12.types new file mode 100644 index 00000000000..2ab9fb8ba95 --- /dev/null +++ b/tests/baselines/reference/library-reference-12.types @@ -0,0 +1,14 @@ +=== /a/b/consumer.ts === +/// +$.foo(); +>$.foo() : void +>$.foo : () => void +>$ : { foo(): void; } +>foo : () => void + +=== /a/node_modules/jquery/dist/jquery.d.ts === +declare var $: { foo(): void }; +>$ : { foo(): void; } +>foo : () => void + + diff --git a/tests/baselines/reference/library-reference-13.js b/tests/baselines/reference/library-reference-13.js new file mode 100644 index 00000000000..be52aba1a39 --- /dev/null +++ b/tests/baselines/reference/library-reference-13.js @@ -0,0 +1,12 @@ +//// [tests/cases/conformance/references/library-reference-13.ts] //// + +//// [index.d.ts] +declare var $: { foo(): void }; + + +//// [consumer.ts] +$.foo(); + + +//// [consumer.js] +$.foo(); diff --git a/tests/baselines/reference/library-reference-13.symbols b/tests/baselines/reference/library-reference-13.symbols new file mode 100644 index 00000000000..04d50373caa --- /dev/null +++ b/tests/baselines/reference/library-reference-13.symbols @@ -0,0 +1,12 @@ +=== /a/b/consumer.ts === +$.foo(); +>$.foo : Symbol(foo, Decl(index.d.ts, 0, 16)) +>$ : Symbol($, Decl(index.d.ts, 0, 11)) +>foo : Symbol(foo, Decl(index.d.ts, 0, 16)) + +=== /a/types/jquery/index.d.ts === +declare var $: { foo(): void }; +>$ : Symbol($, Decl(index.d.ts, 0, 11)) +>foo : Symbol(foo, Decl(index.d.ts, 0, 16)) + + diff --git a/tests/baselines/reference/library-reference-13.trace.json b/tests/baselines/reference/library-reference-13.trace.json new file mode 100644 index 00000000000..2133414f414 --- /dev/null +++ b/tests/baselines/reference/library-reference-13.trace.json @@ -0,0 +1,7 @@ +[ + "======== Resolving type reference directive 'jquery', containing file not set, root directory '/a'. ========", + "Resolving with primary search path '/a/types/'", + "File '/a/types/jquery/package.json' does not exist.", + "File '/a/types/jquery/index.d.ts' exist - use it as a name resolution result.", + "======== Type reference directive 'jquery' was successfully resolved to '/a/types/jquery/index.d.ts', primary: true. ========" +] \ No newline at end of file diff --git a/tests/baselines/reference/library-reference-13.types b/tests/baselines/reference/library-reference-13.types new file mode 100644 index 00000000000..b00d778c5b2 --- /dev/null +++ b/tests/baselines/reference/library-reference-13.types @@ -0,0 +1,13 @@ +=== /a/b/consumer.ts === +$.foo(); +>$.foo() : void +>$.foo : () => void +>$ : { foo(): void; } +>foo : () => void + +=== /a/types/jquery/index.d.ts === +declare var $: { foo(): void }; +>$ : { foo(): void; } +>foo : () => void + + diff --git a/tests/baselines/reference/library-reference-14.js b/tests/baselines/reference/library-reference-14.js new file mode 100644 index 00000000000..0fb5ff04fb9 --- /dev/null +++ b/tests/baselines/reference/library-reference-14.js @@ -0,0 +1,13 @@ +//// [tests/cases/conformance/references/library-reference-14.ts] //// + +//// [index.d.ts] + +declare var $: { foo(): void }; + + +//// [consumer.ts] +$.foo(); + + +//// [consumer.js] +$.foo(); diff --git a/tests/baselines/reference/library-reference-14.symbols b/tests/baselines/reference/library-reference-14.symbols new file mode 100644 index 00000000000..162afc50ca7 --- /dev/null +++ b/tests/baselines/reference/library-reference-14.symbols @@ -0,0 +1,13 @@ +=== /a/b/consumer.ts === +$.foo(); +>$.foo : Symbol(foo, Decl(index.d.ts, 1, 16)) +>$ : Symbol($, Decl(index.d.ts, 1, 11)) +>foo : Symbol(foo, Decl(index.d.ts, 1, 16)) + +=== /a/types/jquery/index.d.ts === + +declare var $: { foo(): void }; +>$ : Symbol($, Decl(index.d.ts, 1, 11)) +>foo : Symbol(foo, Decl(index.d.ts, 1, 16)) + + diff --git a/tests/baselines/reference/library-reference-14.trace.json b/tests/baselines/reference/library-reference-14.trace.json new file mode 100644 index 00000000000..2133414f414 --- /dev/null +++ b/tests/baselines/reference/library-reference-14.trace.json @@ -0,0 +1,7 @@ +[ + "======== Resolving type reference directive 'jquery', containing file not set, root directory '/a'. ========", + "Resolving with primary search path '/a/types/'", + "File '/a/types/jquery/package.json' does not exist.", + "File '/a/types/jquery/index.d.ts' exist - use it as a name resolution result.", + "======== Type reference directive 'jquery' was successfully resolved to '/a/types/jquery/index.d.ts', primary: true. ========" +] \ No newline at end of file diff --git a/tests/baselines/reference/library-reference-14.types b/tests/baselines/reference/library-reference-14.types new file mode 100644 index 00000000000..f4196e10744 --- /dev/null +++ b/tests/baselines/reference/library-reference-14.types @@ -0,0 +1,14 @@ +=== /a/b/consumer.ts === +$.foo(); +>$.foo() : void +>$.foo : () => void +>$ : { foo(): void; } +>foo : () => void + +=== /a/types/jquery/index.d.ts === + +declare var $: { foo(): void }; +>$ : { foo(): void; } +>foo : () => void + + diff --git a/tests/baselines/reference/library-reference-15.errors.txt b/tests/baselines/reference/library-reference-15.errors.txt new file mode 100644 index 00000000000..a311633ca76 --- /dev/null +++ b/tests/baselines/reference/library-reference-15.errors.txt @@ -0,0 +1,15 @@ +error TS2304: Cannot find name 'jquery'. +/a/b/consumer.ts(1,1): error TS2304: Cannot find name '$'. + + +!!! error TS2304: Cannot find name 'jquery'. +==== /a/b/consumer.ts (1 errors) ==== + $.foo(); + ~ +!!! error TS2304: Cannot find name '$'. + +==== /a/types/jquery/index.d.ts (0 errors) ==== + + declare var $: { foo(): void }; + + \ No newline at end of file diff --git a/tests/baselines/reference/library-reference-15.js b/tests/baselines/reference/library-reference-15.js new file mode 100644 index 00000000000..f9aa7038d53 --- /dev/null +++ b/tests/baselines/reference/library-reference-15.js @@ -0,0 +1,13 @@ +//// [tests/cases/conformance/references/library-reference-15.ts] //// + +//// [index.d.ts] + +declare var $: { foo(): void }; + + +//// [consumer.ts] +$.foo(); + + +//// [consumer.js] +$.foo(); diff --git a/tests/baselines/reference/library-reference-15.trace.json b/tests/baselines/reference/library-reference-15.trace.json new file mode 100644 index 00000000000..9a19d75ffac --- /dev/null +++ b/tests/baselines/reference/library-reference-15.trace.json @@ -0,0 +1,5 @@ +[ + "======== Resolving type reference directive 'jquery', containing file not set, root directory not set. ========", + "Root directory cannot be determined, skipping primary search paths.", + "Containing file is not specified and root directory cannot be determined, skipping lookup in 'node_modules' folder." +] \ No newline at end of file diff --git a/tests/baselines/reference/library-reference-2.js b/tests/baselines/reference/library-reference-2.js new file mode 100644 index 00000000000..20729db6c60 --- /dev/null +++ b/tests/baselines/reference/library-reference-2.js @@ -0,0 +1,22 @@ +//// [tests/cases/conformance/references/library-reference-2.ts] //// + +//// [package.json] + +// package.json in a primary reference can refer to another file + +{ + "types": "jquery.d.ts" +} + +//// [jquery.d.ts] +declare var $: { foo(): void }; + + +//// [consumer.ts] +/// +$.foo(); + + +//// [consumer.js] +/// +$.foo(); diff --git a/tests/baselines/reference/library-reference-2.symbols b/tests/baselines/reference/library-reference-2.symbols new file mode 100644 index 00000000000..9d0f7e4781e --- /dev/null +++ b/tests/baselines/reference/library-reference-2.symbols @@ -0,0 +1,13 @@ +=== /consumer.ts === +/// +$.foo(); +>$.foo : Symbol(foo, Decl(jquery.d.ts, 0, 16)) +>$ : Symbol($, Decl(jquery.d.ts, 0, 11)) +>foo : Symbol(foo, Decl(jquery.d.ts, 0, 16)) + +=== /types/jquery/jquery.d.ts === +declare var $: { foo(): void }; +>$ : Symbol($, Decl(jquery.d.ts, 0, 11)) +>foo : Symbol(foo, Decl(jquery.d.ts, 0, 16)) + + diff --git a/tests/baselines/reference/library-reference-2.trace.json b/tests/baselines/reference/library-reference-2.trace.json new file mode 100644 index 00000000000..b5ef5f3e208 --- /dev/null +++ b/tests/baselines/reference/library-reference-2.trace.json @@ -0,0 +1,8 @@ +[ + "======== Resolving type reference directive 'jquery', containing file '/consumer.ts', root directory '/'. ========", + "Resolving with primary search path '/types/'", + "Found 'package.json' at '/types/jquery/package.json'.", + "'package.json' has 'types' field 'jquery.d.ts' that references '/types/jquery/jquery.d.ts'.", + "File '/types/jquery/jquery.d.ts' exist - use it as a name resolution result.", + "======== Type reference directive 'jquery' was successfully resolved to '/types/jquery/jquery.d.ts', primary: true. ========" +] \ No newline at end of file diff --git a/tests/baselines/reference/library-reference-2.types b/tests/baselines/reference/library-reference-2.types new file mode 100644 index 00000000000..42d78f72865 --- /dev/null +++ b/tests/baselines/reference/library-reference-2.types @@ -0,0 +1,14 @@ +=== /consumer.ts === +/// +$.foo(); +>$.foo() : void +>$.foo : () => void +>$ : { foo(): void; } +>foo : () => void + +=== /types/jquery/jquery.d.ts === +declare var $: { foo(): void }; +>$ : { foo(): void; } +>foo : () => void + + diff --git a/tests/baselines/reference/library-reference-3.js b/tests/baselines/reference/library-reference-3.js new file mode 100644 index 00000000000..6f9ad2d43d2 --- /dev/null +++ b/tests/baselines/reference/library-reference-3.js @@ -0,0 +1,16 @@ +//// [tests/cases/conformance/references/library-reference-3.ts] //// + +//// [index.d.ts] + +// Secondary references are possible + +declare var $: { foo(): void }; + +//// [consumer.ts] +/// +$.foo(); + + +//// [consumer.js] +/// +$.foo(); diff --git a/tests/baselines/reference/library-reference-3.symbols b/tests/baselines/reference/library-reference-3.symbols new file mode 100644 index 00000000000..a1785fd77c9 --- /dev/null +++ b/tests/baselines/reference/library-reference-3.symbols @@ -0,0 +1,15 @@ +=== /src/consumer.ts === +/// +$.foo(); +>$.foo : Symbol(foo, Decl(index.d.ts, 3, 16)) +>$ : Symbol($, Decl(index.d.ts, 3, 11)) +>foo : Symbol(foo, Decl(index.d.ts, 3, 16)) + +=== /src/node_modules/jquery/index.d.ts === + +// Secondary references are possible + +declare var $: { foo(): void }; +>$ : Symbol($, Decl(index.d.ts, 3, 11)) +>foo : Symbol(foo, Decl(index.d.ts, 3, 16)) + diff --git a/tests/baselines/reference/library-reference-3.trace.json b/tests/baselines/reference/library-reference-3.trace.json new file mode 100644 index 00000000000..30dbbc3fca4 --- /dev/null +++ b/tests/baselines/reference/library-reference-3.trace.json @@ -0,0 +1,10 @@ +[ + "======== Resolving type reference directive 'jquery', containing file '/src/consumer.ts', root directory '/src'. ========", + "Resolving with primary search path '/src/types/'", + "File '/src/types/jquery/package.json' does not exist.", + "File '/src/types/jquery/index.d.ts' does not exist.", + "Resolving with primary search path '/src/node_modules/'", + "File '/src/node_modules/jquery/package.json' does not exist.", + "File '/src/node_modules/jquery/index.d.ts' exist - use it as a name resolution result.", + "======== Type reference directive 'jquery' was successfully resolved to '/src/node_modules/jquery/index.d.ts', primary: true. ========" +] \ No newline at end of file diff --git a/tests/baselines/reference/library-reference-3.types b/tests/baselines/reference/library-reference-3.types new file mode 100644 index 00000000000..ed7da59525f --- /dev/null +++ b/tests/baselines/reference/library-reference-3.types @@ -0,0 +1,16 @@ +=== /src/consumer.ts === +/// +$.foo(); +>$.foo() : void +>$.foo : () => void +>$ : { foo(): void; } +>foo : () => void + +=== /src/node_modules/jquery/index.d.ts === + +// Secondary references are possible + +declare var $: { foo(): void }; +>$ : { foo(): void; } +>foo : () => void + diff --git a/tests/baselines/reference/library-reference-4.js b/tests/baselines/reference/library-reference-4.js new file mode 100644 index 00000000000..39e4b1d73a5 --- /dev/null +++ b/tests/baselines/reference/library-reference-4.js @@ -0,0 +1,27 @@ +//// [tests/cases/conformance/references/library-reference-4.ts] //// + +//// [index.d.ts] + +// Secondary references may be duplicated if they agree in content + +/// +declare var foo: any; + +//// [index.d.ts] +declare var alpha: any; + +//// [index.d.ts] +/// +declare var bar: any; + +//// [index.d.ts] +declare var alpha: any; + +//// [root.ts] +/// +/// + + +//// [root.js] +/// +/// diff --git a/tests/baselines/reference/library-reference-4.symbols b/tests/baselines/reference/library-reference-4.symbols new file mode 100644 index 00000000000..f7c082a946d --- /dev/null +++ b/tests/baselines/reference/library-reference-4.symbols @@ -0,0 +1,21 @@ +=== /src/root.ts === +/// +No type information for this code./// +No type information for this code. +No type information for this code.=== /node_modules/foo/index.d.ts === + +// Secondary references may be duplicated if they agree in content + +/// +declare var foo: any; +>foo : Symbol(foo, Decl(index.d.ts, 4, 11)) + +=== /node_modules/foo/node_modules/alpha/index.d.ts === +declare var alpha: any; +>alpha : Symbol(alpha, Decl(index.d.ts, 0, 11)) + +=== /node_modules/bar/index.d.ts === +/// +declare var bar: any; +>bar : Symbol(bar, Decl(index.d.ts, 1, 11)) + diff --git a/tests/baselines/reference/library-reference-4.trace.json b/tests/baselines/reference/library-reference-4.trace.json new file mode 100644 index 00000000000..90b6eb7b01d --- /dev/null +++ b/tests/baselines/reference/library-reference-4.trace.json @@ -0,0 +1,90 @@ +[ + "======== Resolving type reference directive 'foo', containing file '/src/root.ts', root directory '/src'. ========", + "Resolving with primary search path '/src/types/'", + "File '/src/types/foo/package.json' does not exist.", + "File '/src/types/foo/index.d.ts' does not exist.", + "Resolving with primary search path '/src/node_modules/'", + "File '/src/node_modules/foo/package.json' does not exist.", + "File '/src/node_modules/foo/index.d.ts' does not exist.", + "Resolving with primary search path '/src/node_modules/@types/'", + "File '/src/node_modules/@types/foo/package.json' does not exist.", + "File '/src/node_modules/@types/foo/index.d.ts' does not exist.", + "Looking up in 'node_modules' folder, initial location '/src'", + "File '/src/node_modules/foo.ts' does not exist.", + "File '/src/node_modules/foo.d.ts' does not exist.", + "File '/src/node_modules/foo/package.json' does not exist.", + "File '/src/node_modules/foo/index.ts' does not exist.", + "File '/src/node_modules/foo/index.d.ts' does not exist.", + "File '/src/node_modules/@types/foo.ts' does not exist.", + "File '/src/node_modules/@types/foo.d.ts' does not exist.", + "File '/src/node_modules/@types/foo/package.json' does not exist.", + "File '/src/node_modules/@types/foo/index.ts' does not exist.", + "File '/src/node_modules/@types/foo/index.d.ts' does not exist.", + "File '/node_modules/foo.ts' does not exist.", + "File '/node_modules/foo.d.ts' does not exist.", + "File '/node_modules/foo/package.json' does not exist.", + "File '/node_modules/foo/index.ts' does not exist.", + "File '/node_modules/foo/index.d.ts' exist - use it as a name resolution result.", + "======== Type reference directive 'foo' was successfully resolved to '/node_modules/foo/index.d.ts', primary: false. ========", + "======== Resolving type reference directive 'bar', containing file '/src/root.ts', root directory '/src'. ========", + "Resolving with primary search path '/src/types/'", + "File '/src/types/bar/package.json' does not exist.", + "File '/src/types/bar/index.d.ts' does not exist.", + "Resolving with primary search path '/src/node_modules/'", + "File '/src/node_modules/bar/package.json' does not exist.", + "File '/src/node_modules/bar/index.d.ts' does not exist.", + "Resolving with primary search path '/src/node_modules/@types/'", + "File '/src/node_modules/@types/bar/package.json' does not exist.", + "File '/src/node_modules/@types/bar/index.d.ts' does not exist.", + "Looking up in 'node_modules' folder, initial location '/src'", + "File '/src/node_modules/bar.ts' does not exist.", + "File '/src/node_modules/bar.d.ts' does not exist.", + "File '/src/node_modules/bar/package.json' does not exist.", + "File '/src/node_modules/bar/index.ts' does not exist.", + "File '/src/node_modules/bar/index.d.ts' does not exist.", + "File '/src/node_modules/@types/bar.ts' does not exist.", + "File '/src/node_modules/@types/bar.d.ts' does not exist.", + "File '/src/node_modules/@types/bar/package.json' does not exist.", + "File '/src/node_modules/@types/bar/index.ts' does not exist.", + "File '/src/node_modules/@types/bar/index.d.ts' does not exist.", + "File '/node_modules/bar.ts' does not exist.", + "File '/node_modules/bar.d.ts' does not exist.", + "File '/node_modules/bar/package.json' does not exist.", + "File '/node_modules/bar/index.ts' does not exist.", + "File '/node_modules/bar/index.d.ts' exist - use it as a name resolution result.", + "======== Type reference directive 'bar' was successfully resolved to '/node_modules/bar/index.d.ts', primary: false. ========", + "======== Resolving type reference directive 'alpha', containing file '/node_modules/foo/index.d.ts', root directory '/src'. ========", + "Resolving with primary search path '/src/types/'", + "File '/src/types/alpha/package.json' does not exist.", + "File '/src/types/alpha/index.d.ts' does not exist.", + "Resolving with primary search path '/src/node_modules/'", + "File '/src/node_modules/alpha/package.json' does not exist.", + "File '/src/node_modules/alpha/index.d.ts' does not exist.", + "Resolving with primary search path '/src/node_modules/@types/'", + "File '/src/node_modules/@types/alpha/package.json' does not exist.", + "File '/src/node_modules/@types/alpha/index.d.ts' does not exist.", + "Looking up in 'node_modules' folder, initial location '/node_modules/foo'", + "File '/node_modules/foo/node_modules/alpha.ts' does not exist.", + "File '/node_modules/foo/node_modules/alpha.d.ts' does not exist.", + "File '/node_modules/foo/node_modules/alpha/package.json' does not exist.", + "File '/node_modules/foo/node_modules/alpha/index.ts' does not exist.", + "File '/node_modules/foo/node_modules/alpha/index.d.ts' exist - use it as a name resolution result.", + "======== Type reference directive 'alpha' was successfully resolved to '/node_modules/foo/node_modules/alpha/index.d.ts', primary: false. ========", + "======== Resolving type reference directive 'alpha', containing file '/node_modules/bar/index.d.ts', root directory '/src'. ========", + "Resolving with primary search path '/src/types/'", + "File '/src/types/alpha/package.json' does not exist.", + "File '/src/types/alpha/index.d.ts' does not exist.", + "Resolving with primary search path '/src/node_modules/'", + "File '/src/node_modules/alpha/package.json' does not exist.", + "File '/src/node_modules/alpha/index.d.ts' does not exist.", + "Resolving with primary search path '/src/node_modules/@types/'", + "File '/src/node_modules/@types/alpha/package.json' does not exist.", + "File '/src/node_modules/@types/alpha/index.d.ts' does not exist.", + "Looking up in 'node_modules' folder, initial location '/node_modules/bar'", + "File '/node_modules/bar/node_modules/alpha.ts' does not exist.", + "File '/node_modules/bar/node_modules/alpha.d.ts' does not exist.", + "File '/node_modules/bar/node_modules/alpha/package.json' does not exist.", + "File '/node_modules/bar/node_modules/alpha/index.ts' does not exist.", + "File '/node_modules/bar/node_modules/alpha/index.d.ts' exist - use it as a name resolution result.", + "======== Type reference directive 'alpha' was successfully resolved to '/node_modules/bar/node_modules/alpha/index.d.ts', primary: false. ========" +] \ No newline at end of file diff --git a/tests/baselines/reference/library-reference-4.types b/tests/baselines/reference/library-reference-4.types new file mode 100644 index 00000000000..a0a7d370b4c --- /dev/null +++ b/tests/baselines/reference/library-reference-4.types @@ -0,0 +1,21 @@ +=== /src/root.ts === +/// +No type information for this code./// +No type information for this code. +No type information for this code.=== /node_modules/foo/index.d.ts === + +// Secondary references may be duplicated if they agree in content + +/// +declare var foo: any; +>foo : any + +=== /node_modules/foo/node_modules/alpha/index.d.ts === +declare var alpha: any; +>alpha : any + +=== /node_modules/bar/index.d.ts === +/// +declare var bar: any; +>bar : any + diff --git a/tests/baselines/reference/library-reference-5.errors.txt b/tests/baselines/reference/library-reference-5.errors.txt new file mode 100644 index 00000000000..ea571cad1a3 --- /dev/null +++ b/tests/baselines/reference/library-reference-5.errors.txt @@ -0,0 +1,26 @@ +/node_modules/bar/index.d.ts(1,1): message TS4090: Conflicting library definitions for 'alpha' found at '/node_modules/bar/node_modules/alpha/index.d.ts' and '/node_modules/foo/node_modules/alpha/index.d.ts'. Copy the correct file to the 'typings' folder to resolve this conflict. + + +==== /src/root.ts (0 errors) ==== + /// + /// + +==== /node_modules/foo/index.d.ts (0 errors) ==== + + // Secondary references may not be duplicated if they disagree in content + + /// + declare var foo: any; + +==== /node_modules/foo/node_modules/alpha/index.d.ts (0 errors) ==== + declare var alpha: any; + +==== /node_modules/bar/index.d.ts (1 errors) ==== + /// + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! message TS4090: Conflicting library definitions for 'alpha' found at 'index.d.ts' and 'index.d.ts'. Copy the correct file to the 'typings' folder to resolve this conflict. + declare var bar: any; + +==== /node_modules/bar/node_modules/alpha/index.d.ts (0 errors) ==== + declare var alpha: {}; + \ No newline at end of file diff --git a/tests/baselines/reference/library-reference-5.js b/tests/baselines/reference/library-reference-5.js new file mode 100644 index 00000000000..40d2131920e --- /dev/null +++ b/tests/baselines/reference/library-reference-5.js @@ -0,0 +1,27 @@ +//// [tests/cases/conformance/references/library-reference-5.ts] //// + +//// [index.d.ts] + +// Secondary references may not be duplicated if they disagree in content + +/// +declare var foo: any; + +//// [index.d.ts] +declare var alpha: any; + +//// [index.d.ts] +/// +declare var bar: any; + +//// [index.d.ts] +declare var alpha: {}; + +//// [root.ts] +/// +/// + + +//// [root.js] +/// +/// diff --git a/tests/baselines/reference/library-reference-5.trace.json b/tests/baselines/reference/library-reference-5.trace.json new file mode 100644 index 00000000000..272009782b5 --- /dev/null +++ b/tests/baselines/reference/library-reference-5.trace.json @@ -0,0 +1,58 @@ +[ + "======== Resolving type reference directive 'foo', containing file '/src/root.ts', root directory not set. ========", + "Root directory cannot be determined, skipping primary search paths.", + "Looking up in 'node_modules' folder, initial location '/src'", + "File '/src/node_modules/foo.ts' does not exist.", + "File '/src/node_modules/foo.d.ts' does not exist.", + "File '/src/node_modules/foo/package.json' does not exist.", + "File '/src/node_modules/foo/index.ts' does not exist.", + "File '/src/node_modules/foo/index.d.ts' does not exist.", + "File '/src/node_modules/@types/foo.ts' does not exist.", + "File '/src/node_modules/@types/foo.d.ts' does not exist.", + "File '/src/node_modules/@types/foo/package.json' does not exist.", + "File '/src/node_modules/@types/foo/index.ts' does not exist.", + "File '/src/node_modules/@types/foo/index.d.ts' does not exist.", + "File '/node_modules/foo.ts' does not exist.", + "File '/node_modules/foo.d.ts' does not exist.", + "File '/node_modules/foo/package.json' does not exist.", + "File '/node_modules/foo/index.ts' does not exist.", + "File '/node_modules/foo/index.d.ts' exist - use it as a name resolution result.", + "======== Type reference directive 'foo' was successfully resolved to '/node_modules/foo/index.d.ts', primary: false. ========", + "======== Resolving type reference directive 'bar', containing file '/src/root.ts', root directory not set. ========", + "Root directory cannot be determined, skipping primary search paths.", + "Looking up in 'node_modules' folder, initial location '/src'", + "File '/src/node_modules/bar.ts' does not exist.", + "File '/src/node_modules/bar.d.ts' does not exist.", + "File '/src/node_modules/bar/package.json' does not exist.", + "File '/src/node_modules/bar/index.ts' does not exist.", + "File '/src/node_modules/bar/index.d.ts' does not exist.", + "File '/src/node_modules/@types/bar.ts' does not exist.", + "File '/src/node_modules/@types/bar.d.ts' does not exist.", + "File '/src/node_modules/@types/bar/package.json' does not exist.", + "File '/src/node_modules/@types/bar/index.ts' does not exist.", + "File '/src/node_modules/@types/bar/index.d.ts' does not exist.", + "File '/node_modules/bar.ts' does not exist.", + "File '/node_modules/bar.d.ts' does not exist.", + "File '/node_modules/bar/package.json' does not exist.", + "File '/node_modules/bar/index.ts' does not exist.", + "File '/node_modules/bar/index.d.ts' exist - use it as a name resolution result.", + "======== Type reference directive 'bar' was successfully resolved to '/node_modules/bar/index.d.ts', primary: false. ========", + "======== Resolving type reference directive 'alpha', containing file '/node_modules/foo/index.d.ts', root directory not set. ========", + "Root directory cannot be determined, skipping primary search paths.", + "Looking up in 'node_modules' folder, initial location '/node_modules/foo'", + "File '/node_modules/foo/node_modules/alpha.ts' does not exist.", + "File '/node_modules/foo/node_modules/alpha.d.ts' does not exist.", + "File '/node_modules/foo/node_modules/alpha/package.json' does not exist.", + "File '/node_modules/foo/node_modules/alpha/index.ts' does not exist.", + "File '/node_modules/foo/node_modules/alpha/index.d.ts' exist - use it as a name resolution result.", + "======== Type reference directive 'alpha' was successfully resolved to '/node_modules/foo/node_modules/alpha/index.d.ts', primary: false. ========", + "======== Resolving type reference directive 'alpha', containing file '/node_modules/bar/index.d.ts', root directory not set. ========", + "Root directory cannot be determined, skipping primary search paths.", + "Looking up in 'node_modules' folder, initial location '/node_modules/bar'", + "File '/node_modules/bar/node_modules/alpha.ts' does not exist.", + "File '/node_modules/bar/node_modules/alpha.d.ts' does not exist.", + "File '/node_modules/bar/node_modules/alpha/package.json' does not exist.", + "File '/node_modules/bar/node_modules/alpha/index.ts' does not exist.", + "File '/node_modules/bar/node_modules/alpha/index.d.ts' exist - use it as a name resolution result.", + "======== Type reference directive 'alpha' was successfully resolved to '/node_modules/bar/node_modules/alpha/index.d.ts', primary: false. ========" +] \ No newline at end of file diff --git a/tests/baselines/reference/library-reference-6.js b/tests/baselines/reference/library-reference-6.js new file mode 100644 index 00000000000..d78a3a131a1 --- /dev/null +++ b/tests/baselines/reference/library-reference-6.js @@ -0,0 +1,16 @@ +//// [tests/cases/conformance/references/library-reference-6.ts] //// + +//// [index.d.ts] + +// The primary lookup folder is relative to tsconfig.json, if present + +declare var alpha: { a: string }; + +//// [foo.ts] +/// +var x: string = alpha.a; + + +//// [foo.js] +/// +var x = alpha.a; diff --git a/tests/baselines/reference/library-reference-6.symbols b/tests/baselines/reference/library-reference-6.symbols new file mode 100644 index 00000000000..328842f804c --- /dev/null +++ b/tests/baselines/reference/library-reference-6.symbols @@ -0,0 +1,16 @@ +=== /src/foo.ts === +/// +var x: string = alpha.a; +>x : Symbol(x, Decl(foo.ts, 1, 3)) +>alpha.a : Symbol(a, Decl(index.d.ts, 3, 20)) +>alpha : Symbol(alpha, Decl(index.d.ts, 3, 11)) +>a : Symbol(a, Decl(index.d.ts, 3, 20)) + +=== /types/alpha/index.d.ts === + +// The primary lookup folder is relative to tsconfig.json, if present + +declare var alpha: { a: string }; +>alpha : Symbol(alpha, Decl(index.d.ts, 3, 11)) +>a : Symbol(a, Decl(index.d.ts, 3, 20)) + diff --git a/tests/baselines/reference/library-reference-6.trace.json b/tests/baselines/reference/library-reference-6.trace.json new file mode 100644 index 00000000000..426214fdcfc --- /dev/null +++ b/tests/baselines/reference/library-reference-6.trace.json @@ -0,0 +1,7 @@ +[ + "======== Resolving type reference directive 'alpha', containing file '/src/foo.ts', root directory '/'. ========", + "Resolving with primary search path '/types/'", + "File '/types/alpha/package.json' does not exist.", + "File '/types/alpha/index.d.ts' exist - use it as a name resolution result.", + "======== Type reference directive 'alpha' was successfully resolved to '/types/alpha/index.d.ts', primary: true. ========" +] \ No newline at end of file diff --git a/tests/baselines/reference/library-reference-6.types b/tests/baselines/reference/library-reference-6.types new file mode 100644 index 00000000000..2f6c1e49b89 --- /dev/null +++ b/tests/baselines/reference/library-reference-6.types @@ -0,0 +1,16 @@ +=== /src/foo.ts === +/// +var x: string = alpha.a; +>x : string +>alpha.a : string +>alpha : { a: string; } +>a : string + +=== /types/alpha/index.d.ts === + +// The primary lookup folder is relative to tsconfig.json, if present + +declare var alpha: { a: string }; +>alpha : { a: string; } +>a : string + diff --git a/tests/baselines/reference/library-reference-7.js b/tests/baselines/reference/library-reference-7.js new file mode 100644 index 00000000000..f1ef6ca4eab --- /dev/null +++ b/tests/baselines/reference/library-reference-7.js @@ -0,0 +1,16 @@ +//// [tests/cases/conformance/references/library-reference-7.ts] //// + +//// [index.d.ts] + +// Secondary references are possible + +declare var $: { foo(): void }; + +//// [consumer.ts] +/// +$.foo(); + + +//// [consumer.js] +/// +$.foo(); diff --git a/tests/baselines/reference/library-reference-7.symbols b/tests/baselines/reference/library-reference-7.symbols new file mode 100644 index 00000000000..a1785fd77c9 --- /dev/null +++ b/tests/baselines/reference/library-reference-7.symbols @@ -0,0 +1,15 @@ +=== /src/consumer.ts === +/// +$.foo(); +>$.foo : Symbol(foo, Decl(index.d.ts, 3, 16)) +>$ : Symbol($, Decl(index.d.ts, 3, 11)) +>foo : Symbol(foo, Decl(index.d.ts, 3, 16)) + +=== /src/node_modules/jquery/index.d.ts === + +// Secondary references are possible + +declare var $: { foo(): void }; +>$ : Symbol($, Decl(index.d.ts, 3, 11)) +>foo : Symbol(foo, Decl(index.d.ts, 3, 16)) + diff --git a/tests/baselines/reference/library-reference-7.trace.json b/tests/baselines/reference/library-reference-7.trace.json new file mode 100644 index 00000000000..419fe6d055d --- /dev/null +++ b/tests/baselines/reference/library-reference-7.trace.json @@ -0,0 +1,11 @@ +[ + "======== Resolving type reference directive 'jquery', containing file '/src/consumer.ts', root directory not set. ========", + "Root directory cannot be determined, skipping primary search paths.", + "Looking up in 'node_modules' folder, initial location '/src'", + "File '/src/node_modules/jquery.ts' does not exist.", + "File '/src/node_modules/jquery.d.ts' does not exist.", + "File '/src/node_modules/jquery/package.json' does not exist.", + "File '/src/node_modules/jquery/index.ts' does not exist.", + "File '/src/node_modules/jquery/index.d.ts' exist - use it as a name resolution result.", + "======== Type reference directive 'jquery' was successfully resolved to '/src/node_modules/jquery/index.d.ts', primary: false. ========" +] \ No newline at end of file diff --git a/tests/baselines/reference/library-reference-7.types b/tests/baselines/reference/library-reference-7.types new file mode 100644 index 00000000000..ed7da59525f --- /dev/null +++ b/tests/baselines/reference/library-reference-7.types @@ -0,0 +1,16 @@ +=== /src/consumer.ts === +/// +$.foo(); +>$.foo() : void +>$.foo : () => void +>$ : { foo(): void; } +>foo : () => void + +=== /src/node_modules/jquery/index.d.ts === + +// Secondary references are possible + +declare var $: { foo(): void }; +>$ : { foo(): void; } +>foo : () => void + diff --git a/tests/baselines/reference/library-reference-8.js b/tests/baselines/reference/library-reference-8.js new file mode 100644 index 00000000000..a48b226cb62 --- /dev/null +++ b/tests/baselines/reference/library-reference-8.js @@ -0,0 +1,24 @@ +//// [tests/cases/conformance/references/library-reference-8.ts] //// + +//// [index.d.ts] + +// Don't crash in circular library reference situations + +/// +declare var alpha: { a: string }; + +//// [index.d.ts] +/// +declare var beta: { b: string }; + +//// [foo.ts] +/// +/// +var x: string = alpha.a + beta.b; + + + +//// [foo.js] +/// +/// +var x = alpha.a + beta.b; diff --git a/tests/baselines/reference/library-reference-8.symbols b/tests/baselines/reference/library-reference-8.symbols new file mode 100644 index 00000000000..299a60f1b1d --- /dev/null +++ b/tests/baselines/reference/library-reference-8.symbols @@ -0,0 +1,28 @@ +=== /foo.ts === +/// +/// +var x: string = alpha.a + beta.b; +>x : Symbol(x, Decl(foo.ts, 2, 3)) +>alpha.a : Symbol(a, Decl(index.d.ts, 4, 20)) +>alpha : Symbol(alpha, Decl(index.d.ts, 4, 11)) +>a : Symbol(a, Decl(index.d.ts, 4, 20)) +>beta.b : Symbol(b, Decl(index.d.ts, 1, 19)) +>beta : Symbol(beta, Decl(index.d.ts, 1, 11)) +>b : Symbol(b, Decl(index.d.ts, 1, 19)) + + +=== /types/alpha/index.d.ts === + +// Don't crash in circular library reference situations + +/// +declare var alpha: { a: string }; +>alpha : Symbol(alpha, Decl(index.d.ts, 4, 11)) +>a : Symbol(a, Decl(index.d.ts, 4, 20)) + +=== /types/beta/index.d.ts === +/// +declare var beta: { b: string }; +>beta : Symbol(beta, Decl(index.d.ts, 1, 11)) +>b : Symbol(b, Decl(index.d.ts, 1, 19)) + diff --git a/tests/baselines/reference/library-reference-8.trace.json b/tests/baselines/reference/library-reference-8.trace.json new file mode 100644 index 00000000000..b1dc6478688 --- /dev/null +++ b/tests/baselines/reference/library-reference-8.trace.json @@ -0,0 +1,22 @@ +[ + "======== Resolving type reference directive 'alpha', containing file '/foo.ts', root directory '/'. ========", + "Resolving with primary search path '/types/'", + "File '/types/alpha/package.json' does not exist.", + "File '/types/alpha/index.d.ts' exist - use it as a name resolution result.", + "======== Type reference directive 'alpha' was successfully resolved to '/types/alpha/index.d.ts', primary: true. ========", + "======== Resolving type reference directive 'beta', containing file '/foo.ts', root directory '/'. ========", + "Resolving with primary search path '/types/'", + "File '/types/beta/package.json' does not exist.", + "File '/types/beta/index.d.ts' exist - use it as a name resolution result.", + "======== Type reference directive 'beta' was successfully resolved to '/types/beta/index.d.ts', primary: true. ========", + "======== Resolving type reference directive 'beta', containing file '/types/alpha/index.d.ts', root directory '/'. ========", + "Resolving with primary search path '/types/'", + "File '/types/beta/package.json' does not exist.", + "File '/types/beta/index.d.ts' exist - use it as a name resolution result.", + "======== Type reference directive 'beta' was successfully resolved to '/types/beta/index.d.ts', primary: true. ========", + "======== Resolving type reference directive 'alpha', containing file '/types/beta/index.d.ts', root directory '/'. ========", + "Resolving with primary search path '/types/'", + "File '/types/alpha/package.json' does not exist.", + "File '/types/alpha/index.d.ts' exist - use it as a name resolution result.", + "======== Type reference directive 'alpha' was successfully resolved to '/types/alpha/index.d.ts', primary: true. ========" +] \ No newline at end of file diff --git a/tests/baselines/reference/library-reference-8.types b/tests/baselines/reference/library-reference-8.types new file mode 100644 index 00000000000..b0780d90f63 --- /dev/null +++ b/tests/baselines/reference/library-reference-8.types @@ -0,0 +1,29 @@ +=== /foo.ts === +/// +/// +var x: string = alpha.a + beta.b; +>x : string +>alpha.a + beta.b : string +>alpha.a : string +>alpha : { a: string; } +>a : string +>beta.b : string +>beta : { b: string; } +>b : string + + +=== /types/alpha/index.d.ts === + +// Don't crash in circular library reference situations + +/// +declare var alpha: { a: string }; +>alpha : { a: string; } +>a : string + +=== /types/beta/index.d.ts === +/// +declare var beta: { b: string }; +>beta : { b: string; } +>b : string + diff --git a/tests/baselines/reference/library-reference-9.js b/tests/baselines/reference/library-reference-9.js new file mode 100644 index 00000000000..ccb3b3213a9 --- /dev/null +++ b/tests/baselines/reference/library-reference-9.js @@ -0,0 +1,16 @@ +//// [tests/cases/conformance/references/library-reference-9.ts] //// + +//// [index.d.ts] + +// Use types search path + +declare var alpha: { a: string }; + +//// [foo.ts] +/// +var x: string = alpha.a; + + +//// [foo.js] +/// +var x = alpha.a; diff --git a/tests/baselines/reference/library-reference-9.symbols b/tests/baselines/reference/library-reference-9.symbols new file mode 100644 index 00000000000..62cde2117df --- /dev/null +++ b/tests/baselines/reference/library-reference-9.symbols @@ -0,0 +1,16 @@ +=== /base/src/foo.ts === +/// +var x: string = alpha.a; +>x : Symbol(x, Decl(foo.ts, 1, 3)) +>alpha.a : Symbol(a, Decl(index.d.ts, 3, 20)) +>alpha : Symbol(alpha, Decl(index.d.ts, 3, 11)) +>a : Symbol(a, Decl(index.d.ts, 3, 20)) + +=== /share/typelib/alpha/index.d.ts === + +// Use types search path + +declare var alpha: { a: string }; +>alpha : Symbol(alpha, Decl(index.d.ts, 3, 11)) +>a : Symbol(a, Decl(index.d.ts, 3, 20)) + diff --git a/tests/baselines/reference/library-reference-9.trace.json b/tests/baselines/reference/library-reference-9.trace.json new file mode 100644 index 00000000000..e2fdfdc0550 --- /dev/null +++ b/tests/baselines/reference/library-reference-9.trace.json @@ -0,0 +1,7 @@ +[ + "======== Resolving type reference directive 'alpha', containing file '/base/src/foo.ts', root directory '/'. ========", + "Resolving with primary search path '/share/typelib'", + "File '/share/typelib/alpha/package.json' does not exist.", + "File '/share/typelib/alpha/index.d.ts' exist - use it as a name resolution result.", + "======== Type reference directive 'alpha' was successfully resolved to '/share/typelib/alpha/index.d.ts', primary: true. ========" +] \ No newline at end of file diff --git a/tests/baselines/reference/library-reference-9.types b/tests/baselines/reference/library-reference-9.types new file mode 100644 index 00000000000..8df2179e249 --- /dev/null +++ b/tests/baselines/reference/library-reference-9.types @@ -0,0 +1,16 @@ +=== /base/src/foo.ts === +/// +var x: string = alpha.a; +>x : string +>alpha.a : string +>alpha : { a: string; } +>a : string + +=== /share/typelib/alpha/index.d.ts === + +// Use types search path + +declare var alpha: { a: string }; +>alpha : { a: string; } +>a : string + diff --git a/tests/baselines/reference/library_DatePrototypeProperties.symbols b/tests/baselines/reference/library_DatePrototypeProperties.symbols index 8aa5f81f2f5..4601adcde18 100644 --- a/tests/baselines/reference/library_DatePrototypeProperties.symbols +++ b/tests/baselines/reference/library_DatePrototypeProperties.symbols @@ -4,308 +4,308 @@ Date.prototype.constructor; >Date.prototype.constructor : Symbol(Object.constructor, Decl(lib.d.ts, --, --)) >Date.prototype : Symbol(DateConstructor.prototype, Decl(lib.d.ts, --, --)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >prototype : Symbol(DateConstructor.prototype, Decl(lib.d.ts, --, --)) >constructor : Symbol(Object.constructor, Decl(lib.d.ts, --, --)) Date.prototype.toString(); >Date.prototype.toString : Symbol(Date.toString, Decl(lib.d.ts, --, --)) >Date.prototype : Symbol(DateConstructor.prototype, Decl(lib.d.ts, --, --)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >prototype : Symbol(DateConstructor.prototype, Decl(lib.d.ts, --, --)) >toString : Symbol(Date.toString, Decl(lib.d.ts, --, --)) Date.prototype.toDateString(); >Date.prototype.toDateString : Symbol(Date.toDateString, Decl(lib.d.ts, --, --)) >Date.prototype : Symbol(DateConstructor.prototype, Decl(lib.d.ts, --, --)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >prototype : Symbol(DateConstructor.prototype, Decl(lib.d.ts, --, --)) >toDateString : Symbol(Date.toDateString, Decl(lib.d.ts, --, --)) Date.prototype.toTimeString(); >Date.prototype.toTimeString : Symbol(Date.toTimeString, Decl(lib.d.ts, --, --)) >Date.prototype : Symbol(DateConstructor.prototype, Decl(lib.d.ts, --, --)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >prototype : Symbol(DateConstructor.prototype, Decl(lib.d.ts, --, --)) >toTimeString : Symbol(Date.toTimeString, Decl(lib.d.ts, --, --)) Date.prototype.toLocaleString(); ->Date.prototype.toLocaleString : Symbol(Date.toLocaleString, Decl(lib.d.ts, --, --)) +>Date.prototype.toLocaleString : Symbol(Date.toLocaleString, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >Date.prototype : Symbol(DateConstructor.prototype, Decl(lib.d.ts, --, --)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >prototype : Symbol(DateConstructor.prototype, Decl(lib.d.ts, --, --)) ->toLocaleString : Symbol(Date.toLocaleString, Decl(lib.d.ts, --, --)) +>toLocaleString : Symbol(Date.toLocaleString, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) Date.prototype.toLocaleDateString(); ->Date.prototype.toLocaleDateString : Symbol(Date.toLocaleDateString, Decl(lib.d.ts, --, --)) +>Date.prototype.toLocaleDateString : Symbol(Date.toLocaleDateString, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >Date.prototype : Symbol(DateConstructor.prototype, Decl(lib.d.ts, --, --)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >prototype : Symbol(DateConstructor.prototype, Decl(lib.d.ts, --, --)) ->toLocaleDateString : Symbol(Date.toLocaleDateString, Decl(lib.d.ts, --, --)) +>toLocaleDateString : Symbol(Date.toLocaleDateString, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) Date.prototype.toLocaleTimeString(); ->Date.prototype.toLocaleTimeString : Symbol(Date.toLocaleTimeString, Decl(lib.d.ts, --, --)) +>Date.prototype.toLocaleTimeString : Symbol(Date.toLocaleTimeString, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >Date.prototype : Symbol(DateConstructor.prototype, Decl(lib.d.ts, --, --)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >prototype : Symbol(DateConstructor.prototype, Decl(lib.d.ts, --, --)) ->toLocaleTimeString : Symbol(Date.toLocaleTimeString, Decl(lib.d.ts, --, --)) +>toLocaleTimeString : Symbol(Date.toLocaleTimeString, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) Date.prototype.valueOf(); >Date.prototype.valueOf : Symbol(Date.valueOf, Decl(lib.d.ts, --, --)) >Date.prototype : Symbol(DateConstructor.prototype, Decl(lib.d.ts, --, --)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >prototype : Symbol(DateConstructor.prototype, Decl(lib.d.ts, --, --)) >valueOf : Symbol(Date.valueOf, Decl(lib.d.ts, --, --)) Date.prototype.getTime(); >Date.prototype.getTime : Symbol(Date.getTime, Decl(lib.d.ts, --, --)) >Date.prototype : Symbol(DateConstructor.prototype, Decl(lib.d.ts, --, --)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >prototype : Symbol(DateConstructor.prototype, Decl(lib.d.ts, --, --)) >getTime : Symbol(Date.getTime, Decl(lib.d.ts, --, --)) Date.prototype.getFullYear(); >Date.prototype.getFullYear : Symbol(Date.getFullYear, Decl(lib.d.ts, --, --)) >Date.prototype : Symbol(DateConstructor.prototype, Decl(lib.d.ts, --, --)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >prototype : Symbol(DateConstructor.prototype, Decl(lib.d.ts, --, --)) >getFullYear : Symbol(Date.getFullYear, Decl(lib.d.ts, --, --)) Date.prototype.getUTCFullYear(); >Date.prototype.getUTCFullYear : Symbol(Date.getUTCFullYear, Decl(lib.d.ts, --, --)) >Date.prototype : Symbol(DateConstructor.prototype, Decl(lib.d.ts, --, --)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >prototype : Symbol(DateConstructor.prototype, Decl(lib.d.ts, --, --)) >getUTCFullYear : Symbol(Date.getUTCFullYear, Decl(lib.d.ts, --, --)) Date.prototype.getMonth(); >Date.prototype.getMonth : Symbol(Date.getMonth, Decl(lib.d.ts, --, --)) >Date.prototype : Symbol(DateConstructor.prototype, Decl(lib.d.ts, --, --)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >prototype : Symbol(DateConstructor.prototype, Decl(lib.d.ts, --, --)) >getMonth : Symbol(Date.getMonth, Decl(lib.d.ts, --, --)) Date.prototype.getUTCMonth(); >Date.prototype.getUTCMonth : Symbol(Date.getUTCMonth, Decl(lib.d.ts, --, --)) >Date.prototype : Symbol(DateConstructor.prototype, Decl(lib.d.ts, --, --)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >prototype : Symbol(DateConstructor.prototype, Decl(lib.d.ts, --, --)) >getUTCMonth : Symbol(Date.getUTCMonth, Decl(lib.d.ts, --, --)) Date.prototype.getDate(); >Date.prototype.getDate : Symbol(Date.getDate, Decl(lib.d.ts, --, --)) >Date.prototype : Symbol(DateConstructor.prototype, Decl(lib.d.ts, --, --)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >prototype : Symbol(DateConstructor.prototype, Decl(lib.d.ts, --, --)) >getDate : Symbol(Date.getDate, Decl(lib.d.ts, --, --)) Date.prototype.getUTCDate(); >Date.prototype.getUTCDate : Symbol(Date.getUTCDate, Decl(lib.d.ts, --, --)) >Date.prototype : Symbol(DateConstructor.prototype, Decl(lib.d.ts, --, --)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >prototype : Symbol(DateConstructor.prototype, Decl(lib.d.ts, --, --)) >getUTCDate : Symbol(Date.getUTCDate, Decl(lib.d.ts, --, --)) Date.prototype.getDay(); >Date.prototype.getDay : Symbol(Date.getDay, Decl(lib.d.ts, --, --)) >Date.prototype : Symbol(DateConstructor.prototype, Decl(lib.d.ts, --, --)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >prototype : Symbol(DateConstructor.prototype, Decl(lib.d.ts, --, --)) >getDay : Symbol(Date.getDay, Decl(lib.d.ts, --, --)) Date.prototype.getUTCDay(); >Date.prototype.getUTCDay : Symbol(Date.getUTCDay, Decl(lib.d.ts, --, --)) >Date.prototype : Symbol(DateConstructor.prototype, Decl(lib.d.ts, --, --)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >prototype : Symbol(DateConstructor.prototype, Decl(lib.d.ts, --, --)) >getUTCDay : Symbol(Date.getUTCDay, Decl(lib.d.ts, --, --)) Date.prototype.getHours(); >Date.prototype.getHours : Symbol(Date.getHours, Decl(lib.d.ts, --, --)) >Date.prototype : Symbol(DateConstructor.prototype, Decl(lib.d.ts, --, --)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >prototype : Symbol(DateConstructor.prototype, Decl(lib.d.ts, --, --)) >getHours : Symbol(Date.getHours, Decl(lib.d.ts, --, --)) Date.prototype.getUTCHours(); >Date.prototype.getUTCHours : Symbol(Date.getUTCHours, Decl(lib.d.ts, --, --)) >Date.prototype : Symbol(DateConstructor.prototype, Decl(lib.d.ts, --, --)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >prototype : Symbol(DateConstructor.prototype, Decl(lib.d.ts, --, --)) >getUTCHours : Symbol(Date.getUTCHours, Decl(lib.d.ts, --, --)) Date.prototype.getMinutes(); >Date.prototype.getMinutes : Symbol(Date.getMinutes, Decl(lib.d.ts, --, --)) >Date.prototype : Symbol(DateConstructor.prototype, Decl(lib.d.ts, --, --)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >prototype : Symbol(DateConstructor.prototype, Decl(lib.d.ts, --, --)) >getMinutes : Symbol(Date.getMinutes, Decl(lib.d.ts, --, --)) Date.prototype.getUTCMinutes(); >Date.prototype.getUTCMinutes : Symbol(Date.getUTCMinutes, Decl(lib.d.ts, --, --)) >Date.prototype : Symbol(DateConstructor.prototype, Decl(lib.d.ts, --, --)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >prototype : Symbol(DateConstructor.prototype, Decl(lib.d.ts, --, --)) >getUTCMinutes : Symbol(Date.getUTCMinutes, Decl(lib.d.ts, --, --)) Date.prototype.getSeconds(); >Date.prototype.getSeconds : Symbol(Date.getSeconds, Decl(lib.d.ts, --, --)) >Date.prototype : Symbol(DateConstructor.prototype, Decl(lib.d.ts, --, --)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >prototype : Symbol(DateConstructor.prototype, Decl(lib.d.ts, --, --)) >getSeconds : Symbol(Date.getSeconds, Decl(lib.d.ts, --, --)) Date.prototype.getUTCSeconds(); >Date.prototype.getUTCSeconds : Symbol(Date.getUTCSeconds, Decl(lib.d.ts, --, --)) >Date.prototype : Symbol(DateConstructor.prototype, Decl(lib.d.ts, --, --)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >prototype : Symbol(DateConstructor.prototype, Decl(lib.d.ts, --, --)) >getUTCSeconds : Symbol(Date.getUTCSeconds, Decl(lib.d.ts, --, --)) Date.prototype.getMilliseconds(); >Date.prototype.getMilliseconds : Symbol(Date.getMilliseconds, Decl(lib.d.ts, --, --)) >Date.prototype : Symbol(DateConstructor.prototype, Decl(lib.d.ts, --, --)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >prototype : Symbol(DateConstructor.prototype, Decl(lib.d.ts, --, --)) >getMilliseconds : Symbol(Date.getMilliseconds, Decl(lib.d.ts, --, --)) Date.prototype.getUTCMilliseconds(); >Date.prototype.getUTCMilliseconds : Symbol(Date.getUTCMilliseconds, Decl(lib.d.ts, --, --)) >Date.prototype : Symbol(DateConstructor.prototype, Decl(lib.d.ts, --, --)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >prototype : Symbol(DateConstructor.prototype, Decl(lib.d.ts, --, --)) >getUTCMilliseconds : Symbol(Date.getUTCMilliseconds, Decl(lib.d.ts, --, --)) Date.prototype.getTimezoneOffset(); >Date.prototype.getTimezoneOffset : Symbol(Date.getTimezoneOffset, Decl(lib.d.ts, --, --)) >Date.prototype : Symbol(DateConstructor.prototype, Decl(lib.d.ts, --, --)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >prototype : Symbol(DateConstructor.prototype, Decl(lib.d.ts, --, --)) >getTimezoneOffset : Symbol(Date.getTimezoneOffset, Decl(lib.d.ts, --, --)) Date.prototype.setTime(0); >Date.prototype.setTime : Symbol(Date.setTime, Decl(lib.d.ts, --, --)) >Date.prototype : Symbol(DateConstructor.prototype, Decl(lib.d.ts, --, --)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >prototype : Symbol(DateConstructor.prototype, Decl(lib.d.ts, --, --)) >setTime : Symbol(Date.setTime, Decl(lib.d.ts, --, --)) Date.prototype.setMilliseconds(0); >Date.prototype.setMilliseconds : Symbol(Date.setMilliseconds, Decl(lib.d.ts, --, --)) >Date.prototype : Symbol(DateConstructor.prototype, Decl(lib.d.ts, --, --)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >prototype : Symbol(DateConstructor.prototype, Decl(lib.d.ts, --, --)) >setMilliseconds : Symbol(Date.setMilliseconds, Decl(lib.d.ts, --, --)) Date.prototype.setUTCMilliseconds(0); >Date.prototype.setUTCMilliseconds : Symbol(Date.setUTCMilliseconds, Decl(lib.d.ts, --, --)) >Date.prototype : Symbol(DateConstructor.prototype, Decl(lib.d.ts, --, --)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >prototype : Symbol(DateConstructor.prototype, Decl(lib.d.ts, --, --)) >setUTCMilliseconds : Symbol(Date.setUTCMilliseconds, Decl(lib.d.ts, --, --)) Date.prototype.setSeconds(0); >Date.prototype.setSeconds : Symbol(Date.setSeconds, Decl(lib.d.ts, --, --)) >Date.prototype : Symbol(DateConstructor.prototype, Decl(lib.d.ts, --, --)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >prototype : Symbol(DateConstructor.prototype, Decl(lib.d.ts, --, --)) >setSeconds : Symbol(Date.setSeconds, Decl(lib.d.ts, --, --)) Date.prototype.setUTCSeconds(0); >Date.prototype.setUTCSeconds : Symbol(Date.setUTCSeconds, Decl(lib.d.ts, --, --)) >Date.prototype : Symbol(DateConstructor.prototype, Decl(lib.d.ts, --, --)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >prototype : Symbol(DateConstructor.prototype, Decl(lib.d.ts, --, --)) >setUTCSeconds : Symbol(Date.setUTCSeconds, Decl(lib.d.ts, --, --)) Date.prototype.setMinutes(0); >Date.prototype.setMinutes : Symbol(Date.setMinutes, Decl(lib.d.ts, --, --)) >Date.prototype : Symbol(DateConstructor.prototype, Decl(lib.d.ts, --, --)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >prototype : Symbol(DateConstructor.prototype, Decl(lib.d.ts, --, --)) >setMinutes : Symbol(Date.setMinutes, Decl(lib.d.ts, --, --)) Date.prototype.setUTCMinutes(0); >Date.prototype.setUTCMinutes : Symbol(Date.setUTCMinutes, Decl(lib.d.ts, --, --)) >Date.prototype : Symbol(DateConstructor.prototype, Decl(lib.d.ts, --, --)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >prototype : Symbol(DateConstructor.prototype, Decl(lib.d.ts, --, --)) >setUTCMinutes : Symbol(Date.setUTCMinutes, Decl(lib.d.ts, --, --)) Date.prototype.setHours(0); >Date.prototype.setHours : Symbol(Date.setHours, Decl(lib.d.ts, --, --)) >Date.prototype : Symbol(DateConstructor.prototype, Decl(lib.d.ts, --, --)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >prototype : Symbol(DateConstructor.prototype, Decl(lib.d.ts, --, --)) >setHours : Symbol(Date.setHours, Decl(lib.d.ts, --, --)) Date.prototype.setUTCHours(0); >Date.prototype.setUTCHours : Symbol(Date.setUTCHours, Decl(lib.d.ts, --, --)) >Date.prototype : Symbol(DateConstructor.prototype, Decl(lib.d.ts, --, --)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >prototype : Symbol(DateConstructor.prototype, Decl(lib.d.ts, --, --)) >setUTCHours : Symbol(Date.setUTCHours, Decl(lib.d.ts, --, --)) Date.prototype.setDate(0); >Date.prototype.setDate : Symbol(Date.setDate, Decl(lib.d.ts, --, --)) >Date.prototype : Symbol(DateConstructor.prototype, Decl(lib.d.ts, --, --)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >prototype : Symbol(DateConstructor.prototype, Decl(lib.d.ts, --, --)) >setDate : Symbol(Date.setDate, Decl(lib.d.ts, --, --)) Date.prototype.setUTCDate(0); >Date.prototype.setUTCDate : Symbol(Date.setUTCDate, Decl(lib.d.ts, --, --)) >Date.prototype : Symbol(DateConstructor.prototype, Decl(lib.d.ts, --, --)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >prototype : Symbol(DateConstructor.prototype, Decl(lib.d.ts, --, --)) >setUTCDate : Symbol(Date.setUTCDate, Decl(lib.d.ts, --, --)) Date.prototype.setMonth(0); >Date.prototype.setMonth : Symbol(Date.setMonth, Decl(lib.d.ts, --, --)) >Date.prototype : Symbol(DateConstructor.prototype, Decl(lib.d.ts, --, --)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >prototype : Symbol(DateConstructor.prototype, Decl(lib.d.ts, --, --)) >setMonth : Symbol(Date.setMonth, Decl(lib.d.ts, --, --)) Date.prototype.setUTCMonth(0); >Date.prototype.setUTCMonth : Symbol(Date.setUTCMonth, Decl(lib.d.ts, --, --)) >Date.prototype : Symbol(DateConstructor.prototype, Decl(lib.d.ts, --, --)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >prototype : Symbol(DateConstructor.prototype, Decl(lib.d.ts, --, --)) >setUTCMonth : Symbol(Date.setUTCMonth, Decl(lib.d.ts, --, --)) Date.prototype.setFullYear(0); >Date.prototype.setFullYear : Symbol(Date.setFullYear, Decl(lib.d.ts, --, --)) >Date.prototype : Symbol(DateConstructor.prototype, Decl(lib.d.ts, --, --)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >prototype : Symbol(DateConstructor.prototype, Decl(lib.d.ts, --, --)) >setFullYear : Symbol(Date.setFullYear, Decl(lib.d.ts, --, --)) Date.prototype.setUTCFullYear(0); >Date.prototype.setUTCFullYear : Symbol(Date.setUTCFullYear, Decl(lib.d.ts, --, --)) >Date.prototype : Symbol(DateConstructor.prototype, Decl(lib.d.ts, --, --)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >prototype : Symbol(DateConstructor.prototype, Decl(lib.d.ts, --, --)) >setUTCFullYear : Symbol(Date.setUTCFullYear, Decl(lib.d.ts, --, --)) Date.prototype.toUTCString(); >Date.prototype.toUTCString : Symbol(Date.toUTCString, Decl(lib.d.ts, --, --)) >Date.prototype : Symbol(DateConstructor.prototype, Decl(lib.d.ts, --, --)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >prototype : Symbol(DateConstructor.prototype, Decl(lib.d.ts, --, --)) >toUTCString : Symbol(Date.toUTCString, Decl(lib.d.ts, --, --)) Date.prototype.toISOString(); >Date.prototype.toISOString : Symbol(Date.toISOString, Decl(lib.d.ts, --, --)) >Date.prototype : Symbol(DateConstructor.prototype, Decl(lib.d.ts, --, --)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >prototype : Symbol(DateConstructor.prototype, Decl(lib.d.ts, --, --)) >toISOString : Symbol(Date.toISOString, Decl(lib.d.ts, --, --)) Date.prototype.toJSON(null); >Date.prototype.toJSON : Symbol(Date.toJSON, Decl(lib.d.ts, --, --)) >Date.prototype : Symbol(DateConstructor.prototype, Decl(lib.d.ts, --, --)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >prototype : Symbol(DateConstructor.prototype, Decl(lib.d.ts, --, --)) >toJSON : Symbol(Date.toJSON, Decl(lib.d.ts, --, --)) diff --git a/tests/baselines/reference/library_DatePrototypeProperties.types b/tests/baselines/reference/library_DatePrototypeProperties.types index 79aad91245b..c048b9833d6 100644 --- a/tests/baselines/reference/library_DatePrototypeProperties.types +++ b/tests/baselines/reference/library_DatePrototypeProperties.types @@ -34,27 +34,27 @@ Date.prototype.toTimeString(); Date.prototype.toLocaleString(); >Date.prototype.toLocaleString() : string ->Date.prototype.toLocaleString : () => string +>Date.prototype.toLocaleString : { (): string; (locales?: string[], options?: Intl.DateTimeFormatOptions): string; (locale?: string, options?: Intl.DateTimeFormatOptions): string; } >Date.prototype : Date >Date : DateConstructor >prototype : Date ->toLocaleString : () => string +>toLocaleString : { (): string; (locales?: string[], options?: Intl.DateTimeFormatOptions): string; (locale?: string, options?: Intl.DateTimeFormatOptions): string; } Date.prototype.toLocaleDateString(); >Date.prototype.toLocaleDateString() : string ->Date.prototype.toLocaleDateString : () => string +>Date.prototype.toLocaleDateString : { (): string; (locales?: string[], options?: Intl.DateTimeFormatOptions): string; (locale?: string, options?: Intl.DateTimeFormatOptions): string; } >Date.prototype : Date >Date : DateConstructor >prototype : Date ->toLocaleDateString : () => string +>toLocaleDateString : { (): string; (locales?: string[], options?: Intl.DateTimeFormatOptions): string; (locale?: string, options?: Intl.DateTimeFormatOptions): string; } Date.prototype.toLocaleTimeString(); >Date.prototype.toLocaleTimeString() : string ->Date.prototype.toLocaleTimeString : () => string +>Date.prototype.toLocaleTimeString : { (): string; (locale?: string[], options?: Intl.DateTimeFormatOptions): string; (locale?: string, options?: Intl.DateTimeFormatOptions): string; } >Date.prototype : Date >Date : DateConstructor >prototype : Date ->toLocaleTimeString : () => string +>toLocaleTimeString : { (): string; (locale?: string[], options?: Intl.DateTimeFormatOptions): string; (locale?: string, options?: Intl.DateTimeFormatOptions): string; } Date.prototype.valueOf(); >Date.prototype.valueOf() : number diff --git a/tests/baselines/reference/library_StringSlice.symbols b/tests/baselines/reference/library_StringSlice.symbols index de79b8755ac..bdf661c5ab2 100644 --- a/tests/baselines/reference/library_StringSlice.symbols +++ b/tests/baselines/reference/library_StringSlice.symbols @@ -3,21 +3,21 @@ String.prototype.slice(); >String.prototype.slice : Symbol(String.slice, Decl(lib.d.ts, --, --)) >String.prototype : Symbol(StringConstructor.prototype, Decl(lib.d.ts, --, --)) ->String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >prototype : Symbol(StringConstructor.prototype, Decl(lib.d.ts, --, --)) >slice : Symbol(String.slice, Decl(lib.d.ts, --, --)) String.prototype.slice(0); >String.prototype.slice : Symbol(String.slice, Decl(lib.d.ts, --, --)) >String.prototype : Symbol(StringConstructor.prototype, Decl(lib.d.ts, --, --)) ->String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >prototype : Symbol(StringConstructor.prototype, Decl(lib.d.ts, --, --)) >slice : Symbol(String.slice, Decl(lib.d.ts, --, --)) String.prototype.slice(0,1); >String.prototype.slice : Symbol(String.slice, Decl(lib.d.ts, --, --)) >String.prototype : Symbol(StringConstructor.prototype, Decl(lib.d.ts, --, --)) ->String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >prototype : Symbol(StringConstructor.prototype, Decl(lib.d.ts, --, --)) >slice : Symbol(String.slice, Decl(lib.d.ts, --, --)) diff --git a/tests/baselines/reference/literals-negative.errors.txt b/tests/baselines/reference/literals-negative.errors.txt index d783e5dfa02..2024066d9f2 100644 --- a/tests/baselines/reference/literals-negative.errors.txt +++ b/tests/baselines/reference/literals-negative.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/literals-negative.ts(5,9): error TS2352: Neither type 'number' nor type 'boolean' is assignable to the other. +tests/cases/compiler/literals-negative.ts(5,9): error TS2352: Type 'number' cannot be converted to type 'boolean'. ==== tests/cases/compiler/literals-negative.ts (1 errors) ==== @@ -8,7 +8,7 @@ tests/cases/compiler/literals-negative.ts(5,9): error TS2352: Neither type 'numb var s = (null); var b = (n); ~~~~~~~~~~~~ -!!! error TS2352: Neither type 'number' nor type 'boolean' is assignable to the other. +!!! error TS2352: Type 'number' cannot be converted to type 'boolean'. function isVoid() : void { } diff --git a/tests/baselines/reference/localClassesInLoop_ES6.symbols b/tests/baselines/reference/localClassesInLoop_ES6.symbols index 17e8102ad05..f70373a4d73 100644 --- a/tests/baselines/reference/localClassesInLoop_ES6.symbols +++ b/tests/baselines/reference/localClassesInLoop_ES6.symbols @@ -17,9 +17,9 @@ for (let x = 0; x < 2; ++x) { >C : Symbol(C, Decl(localClassesInLoop_ES6.ts, 5, 29)) data.push(() => C); ->data.push : Symbol(Array.push, Decl(lib.d.ts, --, --)) +>data.push : Symbol(Array.push, Decl(lib.es5.d.ts, --, --)) >data : Symbol(data, Decl(localClassesInLoop_ES6.ts, 4, 3)) ->push : Symbol(Array.push, Decl(lib.d.ts, --, --)) +>push : Symbol(Array.push, Decl(lib.es5.d.ts, --, --)) >C : Symbol(C, Decl(localClassesInLoop_ES6.ts, 5, 29)) } diff --git a/tests/baselines/reference/localTypes5.symbols b/tests/baselines/reference/localTypes5.symbols index fadbc026c9c..175469e7a72 100644 --- a/tests/baselines/reference/localTypes5.symbols +++ b/tests/baselines/reference/localTypes5.symbols @@ -22,7 +22,7 @@ function foo() { >Y : Symbol(Y, Decl(localTypes5.ts, 3, 36)) })(); ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) } } var x = new X(); diff --git a/tests/baselines/reference/looseThisTypeInFunctions.errors.txt b/tests/baselines/reference/looseThisTypeInFunctions.errors.txt new file mode 100644 index 00000000000..b7a36b99ad4 --- /dev/null +++ b/tests/baselines/reference/looseThisTypeInFunctions.errors.txt @@ -0,0 +1,66 @@ +tests/cases/conformance/types/thisType/looseThisTypeInFunctions.ts(21,1): error TS2322: Type '(this: C, m: number) => number' is not assignable to type '(this: void, m: number) => number'. + The 'this' types of each signature are incompatible. + Type 'void' is not assignable to type 'C'. +tests/cases/conformance/types/thisType/looseThisTypeInFunctions.ts(33,28): error TS2339: Property 'length' does not exist on type 'number'. +tests/cases/conformance/types/thisType/looseThisTypeInFunctions.ts(37,9): error TS2684: The 'this' context of type 'void' is not assignable to method's 'this' of type 'I'. +tests/cases/conformance/types/thisType/looseThisTypeInFunctions.ts(46,20): error TS2339: Property 'length' does not exist on type 'number'. + + +==== tests/cases/conformance/types/thisType/looseThisTypeInFunctions.ts (4 errors) ==== + interface I { + n: number; + explicitThis(this: this, m: number): number; + } + interface Unused { + implicitNoThis(m: number): number; + } + class C implements I { + n: number; + explicitThis(this: this, m: number): number { + return this.n + m; + } + implicitThis(m: number): number { + return this.n + m; + } + explicitVoid(this: void, m: number): number { + return m + 1; + } + } + let c = new C(); + c.explicitVoid = c.explicitThis; // error, 'void' is missing everything + ~~~~~~~~~~~~~~ +!!! error TS2322: Type '(this: C, m: number) => number' is not assignable to type '(this: void, m: number) => number'. +!!! error TS2322: The 'this' types of each signature are incompatible. +!!! error TS2322: Type 'void' is not assignable to type 'C'. + let o = { + n: 101, + explicitThis: function (m: number) { + return m + this.n.length; // ok, this.n: any + }, + implicitThis(m: number): number { return m; } + }; + let i: I = o; + let o2: I = { + n: 1001, + explicitThis: function (m) { + return m + this.n.length; // error, this.n: number, no member 'length' + ~~~~~~ +!!! error TS2339: Property 'length' does not exist on type 'number'. + }, + } + let x = i.explicitThis; + let n = x(12); // callee:void doesn't match this:I + ~~~~~ +!!! error TS2684: The 'this' context of type 'void' is not assignable to method's 'this' of type 'I'. + let u: Unused; + let y = u.implicitNoThis; + n = y(12); // ok, callee:void matches this:any + c.explicitVoid = c.implicitThis // ok, implicitThis(this:any) + o.implicitThis = c.implicitThis; // ok, implicitThis(this:any) + o.implicitThis = c.explicitThis; // ok, implicitThis(this:any) is assignable to explicitThis(this: this) + o.implicitThis = i.explicitThis; + i.explicitThis = function(m) { + return this.n.length; // error, this.n: number + ~~~~~~ +!!! error TS2339: Property 'length' does not exist on type 'number'. + } \ No newline at end of file diff --git a/tests/baselines/reference/looseThisTypeInFunctions.js b/tests/baselines/reference/looseThisTypeInFunctions.js new file mode 100644 index 00000000000..3b172877e0e --- /dev/null +++ b/tests/baselines/reference/looseThisTypeInFunctions.js @@ -0,0 +1,92 @@ +//// [looseThisTypeInFunctions.ts] +interface I { + n: number; + explicitThis(this: this, m: number): number; +} +interface Unused { + implicitNoThis(m: number): number; +} +class C implements I { + n: number; + explicitThis(this: this, m: number): number { + return this.n + m; + } + implicitThis(m: number): number { + return this.n + m; + } + explicitVoid(this: void, m: number): number { + return m + 1; + } +} +let c = new C(); +c.explicitVoid = c.explicitThis; // error, 'void' is missing everything +let o = { + n: 101, + explicitThis: function (m: number) { + return m + this.n.length; // ok, this.n: any + }, + implicitThis(m: number): number { return m; } +}; +let i: I = o; +let o2: I = { + n: 1001, + explicitThis: function (m) { + return m + this.n.length; // error, this.n: number, no member 'length' + }, +} +let x = i.explicitThis; +let n = x(12); // callee:void doesn't match this:I +let u: Unused; +let y = u.implicitNoThis; +n = y(12); // ok, callee:void matches this:any +c.explicitVoid = c.implicitThis // ok, implicitThis(this:any) +o.implicitThis = c.implicitThis; // ok, implicitThis(this:any) +o.implicitThis = c.explicitThis; // ok, implicitThis(this:any) is assignable to explicitThis(this: this) +o.implicitThis = i.explicitThis; +i.explicitThis = function(m) { + return this.n.length; // error, this.n: number +} + +//// [looseThisTypeInFunctions.js] +var C = (function () { + function C() { + } + C.prototype.explicitThis = function (m) { + return this.n + m; + }; + C.prototype.implicitThis = function (m) { + return this.n + m; + }; + C.prototype.explicitVoid = function (m) { + return m + 1; + }; + return C; +}()); +var c = new C(); +c.explicitVoid = c.explicitThis; // error, 'void' is missing everything +var o = { + n: 101, + explicitThis: function (m) { + return m + this.n.length; // ok, this.n: any + }, + implicitThis: function (m) { return m; } +}; +var i = o; +var o2 = { + n: 1001, + explicitThis: function (m) { + return m + this.n.length; // error, this.n: number, no member 'length' + } +}; +var x = i.explicitThis; +var n = x(12); // callee:void doesn't match this:I +var u; +var y = u.implicitNoThis; +n = y(12); // ok, callee:void matches this:any +c.explicitVoid = c.implicitThis; // ok, implicitThis(this:any) +o.implicitThis = c.implicitThis; // ok, implicitThis(this:any) +o.implicitThis = c.explicitThis; // ok, implicitThis(this:any) is assignable to explicitThis(this: this) +o.implicitThis = i.explicitThis; +i.explicitThis = function (m) { + return this.n.length; // error, this.n: number +}; diff --git a/tests/baselines/reference/mergedInterfaceFromMultipleFiles1.symbols b/tests/baselines/reference/mergedInterfaceFromMultipleFiles1.symbols index 12be101789d..4dffd06bcde 100644 --- a/tests/baselines/reference/mergedInterfaceFromMultipleFiles1.symbols +++ b/tests/baselines/reference/mergedInterfaceFromMultipleFiles1.symbols @@ -11,7 +11,7 @@ interface C extends D { b(): Date; >b : Symbol(C.b, Decl(mergedInterfaceFromMultipleFiles1_1.ts, 4, 23)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) } var c:C; @@ -38,7 +38,7 @@ var d: number = c.a(); var e: Date = c.b(); >e : Symbol(e, Decl(mergedInterfaceFromMultipleFiles1_1.ts, 12, 3)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >c.b : Symbol(C.b, Decl(mergedInterfaceFromMultipleFiles1_1.ts, 4, 23)) >c : Symbol(c, Decl(mergedInterfaceFromMultipleFiles1_1.ts, 8, 3)) >b : Symbol(C.b, Decl(mergedInterfaceFromMultipleFiles1_1.ts, 4, 23)) diff --git a/tests/baselines/reference/mergedInterfacesWithMultipleBases3.symbols b/tests/baselines/reference/mergedInterfacesWithMultipleBases3.symbols index 4d24c5494cf..de2bff45743 100644 --- a/tests/baselines/reference/mergedInterfacesWithMultipleBases3.symbols +++ b/tests/baselines/reference/mergedInterfacesWithMultipleBases3.symbols @@ -69,7 +69,7 @@ class D implements A { b: Date; >b : Symbol(D.b, Decl(mergedInterfacesWithMultipleBases3.ts, 28, 14)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) c: string; >c : Symbol(D.c, Decl(mergedInterfacesWithMultipleBases3.ts, 29, 12)) diff --git a/tests/baselines/reference/modularizeLibrary_ErrorFromUsingES6ArrayWithOnlyES6ArrayLib.errors.txt b/tests/baselines/reference/modularizeLibrary_ErrorFromUsingES6ArrayWithOnlyES6ArrayLib.errors.txt new file mode 100644 index 00000000000..f796092fb14 --- /dev/null +++ b/tests/baselines/reference/modularizeLibrary_ErrorFromUsingES6ArrayWithOnlyES6ArrayLib.errors.txt @@ -0,0 +1,20 @@ +error TS2318: Cannot find global type 'Boolean'. +error TS2318: Cannot find global type 'IArguments'. +error TS2318: Cannot find global type 'Number'. +tests/cases/compiler/modularizeLibrary_ErrorFromUsingES6ArrayWithOnlyES6ArrayLib.ts(4,12): error TS2304: Cannot find name 'Array'. + + +!!! error TS2318: Cannot find global type 'Boolean'. +!!! error TS2318: Cannot find global type 'IArguments'. +!!! error TS2318: Cannot find global type 'Number'. +==== tests/cases/compiler/modularizeLibrary_ErrorFromUsingES6ArrayWithOnlyES6ArrayLib.ts (1 errors) ==== + + // Error missing basic JavaScript objects + function f(x: number, y: number, z: number) { + return Array.from(arguments); + ~~~~~ +!!! error TS2304: Cannot find name 'Array'. + } + + f(1, 2, 3); + \ No newline at end of file diff --git a/tests/baselines/reference/modularizeLibrary_ErrorFromUsingES6ArrayWithOnlyES6ArrayLib.js b/tests/baselines/reference/modularizeLibrary_ErrorFromUsingES6ArrayWithOnlyES6ArrayLib.js new file mode 100644 index 00000000000..61591a5f7e1 --- /dev/null +++ b/tests/baselines/reference/modularizeLibrary_ErrorFromUsingES6ArrayWithOnlyES6ArrayLib.js @@ -0,0 +1,16 @@ +//// [modularizeLibrary_ErrorFromUsingES6ArrayWithOnlyES6ArrayLib.ts] + +// Error missing basic JavaScript objects +function f(x: number, y: number, z: number) { + return Array.from(arguments); +} + +f(1, 2, 3); + + +//// [modularizeLibrary_ErrorFromUsingES6ArrayWithOnlyES6ArrayLib.js] +// Error missing basic JavaScript objects +function f(x, y, z) { + return Array.from(arguments); +} +f(1, 2, 3); diff --git a/tests/baselines/reference/modularizeLibrary_ErrorFromUsingES6FeaturesWithOnlyES5Lib.errors.txt b/tests/baselines/reference/modularizeLibrary_ErrorFromUsingES6FeaturesWithOnlyES5Lib.errors.txt new file mode 100644 index 00000000000..c8a69546ee0 --- /dev/null +++ b/tests/baselines/reference/modularizeLibrary_ErrorFromUsingES6FeaturesWithOnlyES5Lib.errors.txt @@ -0,0 +1,94 @@ +tests/cases/compiler/modularizeLibrary_ErrorFromUsingES6FeaturesWithOnlyES5Lib.ts(5,18): error TS2339: Property 'from' does not exist on type 'ArrayConstructor'. +tests/cases/compiler/modularizeLibrary_ErrorFromUsingES6FeaturesWithOnlyES5Lib.ts(11,13): error TS2304: Cannot find name 'Map'. +tests/cases/compiler/modularizeLibrary_ErrorFromUsingES6FeaturesWithOnlyES5Lib.ts(18,5): error TS2339: Property 'name' does not exist on type '() => void'. +tests/cases/compiler/modularizeLibrary_ErrorFromUsingES6FeaturesWithOnlyES5Lib.ts(21,6): error TS2339: Property 'sign' does not exist on type 'Math'. +tests/cases/compiler/modularizeLibrary_ErrorFromUsingES6FeaturesWithOnlyES5Lib.ts(26,6): error TS2304: Cannot find name 'Symbol'. +tests/cases/compiler/modularizeLibrary_ErrorFromUsingES6FeaturesWithOnlyES5Lib.ts(30,18): error TS2304: Cannot find name 'Symbol'. +tests/cases/compiler/modularizeLibrary_ErrorFromUsingES6FeaturesWithOnlyES5Lib.ts(34,13): error TS2304: Cannot find name 'Proxy'. +tests/cases/compiler/modularizeLibrary_ErrorFromUsingES6FeaturesWithOnlyES5Lib.ts(37,1): error TS2304: Cannot find name 'Reflect'. +tests/cases/compiler/modularizeLibrary_ErrorFromUsingES6FeaturesWithOnlyES5Lib.ts(41,5): error TS2339: Property 'flags' does not exist on type 'RegExp'. +tests/cases/compiler/modularizeLibrary_ErrorFromUsingES6FeaturesWithOnlyES5Lib.ts(45,5): error TS2339: Property 'includes' does not exist on type 'string'. +tests/cases/compiler/modularizeLibrary_ErrorFromUsingES6FeaturesWithOnlyES5Lib.ts(48,9): error TS2304: Cannot find name 'Symbol'. +tests/cases/compiler/modularizeLibrary_ErrorFromUsingES6FeaturesWithOnlyES5Lib.ts(52,6): error TS2304: Cannot find name 'Symbol'. + + +==== tests/cases/compiler/modularizeLibrary_ErrorFromUsingES6FeaturesWithOnlyES5Lib.ts (12 errors) ==== + + // All will be error from using ES6 features but only include ES5 library + // Using Es6 array + function f(x: number, y: number, z: number) { + return Array.from(arguments); + ~~~~ +!!! error TS2339: Property 'from' does not exist on type 'ArrayConstructor'. + } + + f(1, 2, 3); // no error + + // Using ES6 collection + var m = new Map(); + ~~~ +!!! error TS2304: Cannot find name 'Map'. + m.clear(); + // Using ES6 iterable + m.keys(); + + // Using ES6 function + function Baz() { } + Baz.name; + ~~~~ +!!! error TS2339: Property 'name' does not exist on type '() => void'. + + // Using ES6 math + Math.sign(1); + ~~~~ +!!! error TS2339: Property 'sign' does not exist on type 'Math'. + + // Using ES6 object + var o = { + a: 2, + [Symbol.hasInstance](value: any) { + ~~~~~~ +!!! error TS2304: Cannot find name 'Symbol'. + return false; + } + }; + o.hasOwnProperty(Symbol.hasInstance); + ~~~~~~ +!!! error TS2304: Cannot find name 'Symbol'. + + // Using Es6 proxy + var t = {} + var p = new Proxy(t, {}); + ~~~~~ +!!! error TS2304: Cannot find name 'Proxy'. + + // Using ES6 reflect + Reflect.isExtensible({}); + ~~~~~~~ +!!! error TS2304: Cannot find name 'Reflect'. + + // Using Es6 regexp + var reg = new RegExp("/s"); + reg.flags; + ~~~~~ +!!! error TS2339: Property 'flags' does not exist on type 'RegExp'. + + // Using ES6 string + var str = "Hello world"; + str.includes("hello", 0); + ~~~~~~~~ +!!! error TS2339: Property 'includes' does not exist on type 'string'. + + // Using ES6 symbol + var s = Symbol(); + ~~~~~~ +!!! error TS2304: Cannot find name 'Symbol'. + + // Using ES6 wellknown-symbol + const o1 = { + [Symbol.hasInstance](value: any) { + ~~~~~~ +!!! error TS2304: Cannot find name 'Symbol'. + return false; + } + } \ No newline at end of file diff --git a/tests/baselines/reference/modularizeLibrary_ErrorFromUsingES6FeaturesWithOnlyES5Lib.js b/tests/baselines/reference/modularizeLibrary_ErrorFromUsingES6FeaturesWithOnlyES5Lib.js new file mode 100644 index 00000000000..257df4278fe --- /dev/null +++ b/tests/baselines/reference/modularizeLibrary_ErrorFromUsingES6FeaturesWithOnlyES5Lib.js @@ -0,0 +1,101 @@ +//// [modularizeLibrary_ErrorFromUsingES6FeaturesWithOnlyES5Lib.ts] + +// All will be error from using ES6 features but only include ES5 library +// Using Es6 array +function f(x: number, y: number, z: number) { + return Array.from(arguments); +} + +f(1, 2, 3); // no error + +// Using ES6 collection +var m = new Map(); +m.clear(); +// Using ES6 iterable +m.keys(); + +// Using ES6 function +function Baz() { } +Baz.name; + +// Using ES6 math +Math.sign(1); + +// Using ES6 object +var o = { + a: 2, + [Symbol.hasInstance](value: any) { + return false; + } +}; +o.hasOwnProperty(Symbol.hasInstance); + +// Using Es6 proxy +var t = {} +var p = new Proxy(t, {}); + +// Using ES6 reflect +Reflect.isExtensible({}); + +// Using Es6 regexp +var reg = new RegExp("/s"); +reg.flags; + +// Using ES6 string +var str = "Hello world"; +str.includes("hello", 0); + +// Using ES6 symbol +var s = Symbol(); + +// Using ES6 wellknown-symbol +const o1 = { + [Symbol.hasInstance](value: any) { + return false; + } +} + +//// [modularizeLibrary_ErrorFromUsingES6FeaturesWithOnlyES5Lib.js] +// All will be error from using ES6 features but only include ES5 library +// Using Es6 array +function f(x, y, z) { + return Array.from(arguments); +} +f(1, 2, 3); // no error +// Using ES6 collection +var m = new Map(); +m.clear(); +// Using ES6 iterable +m.keys(); +// Using ES6 function +function Baz() { } +Baz.name; +// Using ES6 math +Math.sign(1); +// Using ES6 object +var o = { + a: 2, + [Symbol.hasInstance](value) { + return false; + } +}; +o.hasOwnProperty(Symbol.hasInstance); +// Using Es6 proxy +var t = {}; +var p = new Proxy(t, {}); +// Using ES6 reflect +Reflect.isExtensible({}); +// Using Es6 regexp +var reg = new RegExp("/s"); +reg.flags; +// Using ES6 string +var str = "Hello world"; +str.includes("hello", 0); +// Using ES6 symbol +var s = Symbol(); +// Using ES6 wellknown-symbol +const o1 = { + [Symbol.hasInstance](value) { + return false; + } +}; diff --git a/tests/baselines/reference/modularizeLibrary_ErrorFromUsingWellknownSymbolWithOutES6WellknownSymbolLib.errors.txt b/tests/baselines/reference/modularizeLibrary_ErrorFromUsingWellknownSymbolWithOutES6WellknownSymbolLib.errors.txt new file mode 100644 index 00000000000..b5da9f97867 --- /dev/null +++ b/tests/baselines/reference/modularizeLibrary_ErrorFromUsingWellknownSymbolWithOutES6WellknownSymbolLib.errors.txt @@ -0,0 +1,17 @@ +tests/cases/compiler/modularizeLibrary_ErrorFromUsingWellknownSymbolWithOutES6WellknownSymbolLib.ts(8,1): error TS2322: Type 'boolean' is not assignable to type 'string'. +tests/cases/compiler/modularizeLibrary_ErrorFromUsingWellknownSymbolWithOutES6WellknownSymbolLib.ts(8,3): error TS2304: Cannot find name 'Symbol'. + + +==== tests/cases/compiler/modularizeLibrary_ErrorFromUsingWellknownSymbolWithOutES6WellknownSymbolLib.ts (2 errors) ==== + + function f(x: number, y: number, z: number) { + return Array.from(arguments); + } + + f(1, 2, 3); // no error + let a = ['c', 'd']; + a[Symbol.isConcatSpreadable] = false; + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2322: Type 'boolean' is not assignable to type 'string'. + ~~~~~~ +!!! error TS2304: Cannot find name 'Symbol'. \ No newline at end of file diff --git a/tests/baselines/reference/modularizeLibrary_ErrorFromUsingWellknownSymbolWithOutES6WellknownSymbolLib.js b/tests/baselines/reference/modularizeLibrary_ErrorFromUsingWellknownSymbolWithOutES6WellknownSymbolLib.js new file mode 100644 index 00000000000..e150560cc6a --- /dev/null +++ b/tests/baselines/reference/modularizeLibrary_ErrorFromUsingWellknownSymbolWithOutES6WellknownSymbolLib.js @@ -0,0 +1,17 @@ +//// [modularizeLibrary_ErrorFromUsingWellknownSymbolWithOutES6WellknownSymbolLib.ts] + +function f(x: number, y: number, z: number) { + return Array.from(arguments); +} + +f(1, 2, 3); // no error +let a = ['c', 'd']; +a[Symbol.isConcatSpreadable] = false; + +//// [modularizeLibrary_ErrorFromUsingWellknownSymbolWithOutES6WellknownSymbolLib.js] +function f(x, y, z) { + return Array.from(arguments); +} +f(1, 2, 3); // no error +var a = ['c', 'd']; +a[Symbol.isConcatSpreadable] = false; diff --git a/tests/baselines/reference/modularizeLibrary_NoErrorDuplicateLibOptions1.js b/tests/baselines/reference/modularizeLibrary_NoErrorDuplicateLibOptions1.js new file mode 100644 index 00000000000..9a5ed619b2d --- /dev/null +++ b/tests/baselines/reference/modularizeLibrary_NoErrorDuplicateLibOptions1.js @@ -0,0 +1,158 @@ +//// [modularizeLibrary_NoErrorDuplicateLibOptions1.ts] + +// Using Es6 array +function f(x: number, y: number, z: number) { + return Array.from(arguments); +} + +f(1, 2, 3); // no error + +// Using ES6 collection +var m = new Map(); +m.clear(); +// Using ES6 iterable +m.keys(); + +// Using ES6 function +function Baz() { } +Baz.name; + +// Using ES6 generator +function* gen() { + let i = 0; + while (i < 10) { + yield i; + i++; + } +} + +function* gen2() { + let i = 0; + while (i < 10) { + yield i; + i++; + } +} + +// Using ES6 math +Math.sign(1); + +// Using ES6 object +var o = { + a: 2, + [Symbol.hasInstance](value: any) { + return false; + } +}; +o.hasOwnProperty(Symbol.hasInstance); + +// Using ES6 promise +async function out() { + return new Promise(function (resolve, reject) {}); +} + +declare var console: any; +out().then(() => { + console.log("Yea!"); +}); + +// Using Es6 proxy +var t = {} +var p = new Proxy(t, {}); + +// Using ES6 reflect +Reflect.isExtensible({}); + +// Using Es6 regexp +var reg = new RegExp("/s"); +reg.flags; + +// Using ES6 string +var str = "Hello world"; +str.includes("hello", 0); + +// Using ES6 symbol +var s = Symbol(); + +// Using ES6 wellknown-symbol +const o1 = { + [Symbol.hasInstance](value: any) { + return false; + } +} + +//// [modularizeLibrary_NoErrorDuplicateLibOptions1.js] +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator.throw(value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments)).next()); + }); +}; +// Using Es6 array +function f(x, y, z) { + return Array.from(arguments); +} +f(1, 2, 3); // no error +// Using ES6 collection +var m = new Map(); +m.clear(); +// Using ES6 iterable +m.keys(); +// Using ES6 function +function Baz() { } +Baz.name; +// Using ES6 generator +function* gen() { + let i = 0; + while (i < 10) { + yield i; + i++; + } +} +function* gen2() { + let i = 0; + while (i < 10) { + yield i; + i++; + } +} +// Using ES6 math +Math.sign(1); +// Using ES6 object +var o = { + a: 2, + [Symbol.hasInstance](value) { + return false; + } +}; +o.hasOwnProperty(Symbol.hasInstance); +// Using ES6 promise +function out() { + return __awaiter(this, void 0, void 0, function* () { + return new Promise(function (resolve, reject) { }); + }); +} +out().then(() => { + console.log("Yea!"); +}); +// Using Es6 proxy +var t = {}; +var p = new Proxy(t, {}); +// Using ES6 reflect +Reflect.isExtensible({}); +// Using Es6 regexp +var reg = new RegExp("/s"); +reg.flags; +// Using ES6 string +var str = "Hello world"; +str.includes("hello", 0); +// Using ES6 symbol +var s = Symbol(); +// Using ES6 wellknown-symbol +const o1 = { + [Symbol.hasInstance](value) { + return false; + } +}; diff --git a/tests/baselines/reference/modularizeLibrary_NoErrorDuplicateLibOptions1.symbols b/tests/baselines/reference/modularizeLibrary_NoErrorDuplicateLibOptions1.symbols new file mode 100644 index 00000000000..3bbe91bc9fa --- /dev/null +++ b/tests/baselines/reference/modularizeLibrary_NoErrorDuplicateLibOptions1.symbols @@ -0,0 +1,184 @@ +=== tests/cases/compiler/modularizeLibrary_NoErrorDuplicateLibOptions1.ts === + +// Using Es6 array +function f(x: number, y: number, z: number) { +>f : Symbol(f, Decl(modularizeLibrary_NoErrorDuplicateLibOptions1.ts, 0, 0)) +>x : Symbol(x, Decl(modularizeLibrary_NoErrorDuplicateLibOptions1.ts, 2, 11)) +>y : Symbol(y, Decl(modularizeLibrary_NoErrorDuplicateLibOptions1.ts, 2, 21)) +>z : Symbol(z, Decl(modularizeLibrary_NoErrorDuplicateLibOptions1.ts, 2, 32)) + + return Array.from(arguments); +>Array.from : Symbol(ArrayConstructor.from, Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --)) +>Array : Symbol(Array, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>from : Symbol(ArrayConstructor.from, Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --)) +>arguments : Symbol(arguments) +} + +f(1, 2, 3); // no error +>f : Symbol(f, Decl(modularizeLibrary_NoErrorDuplicateLibOptions1.ts, 0, 0)) + +// Using ES6 collection +var m = new Map(); +>m : Symbol(m, Decl(modularizeLibrary_NoErrorDuplicateLibOptions1.ts, 9, 3)) +>Map : Symbol(Map, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.collection.d.ts, --, --), Decl(lib.es2015.collection.d.ts, --, --)) + +m.clear(); +>m.clear : Symbol(Map.clear, Decl(lib.es2015.collection.d.ts, --, --)) +>m : Symbol(m, Decl(modularizeLibrary_NoErrorDuplicateLibOptions1.ts, 9, 3)) +>clear : Symbol(Map.clear, Decl(lib.es2015.collection.d.ts, --, --)) + +// Using ES6 iterable +m.keys(); +>m.keys : Symbol(Map.keys, Decl(lib.es2015.iterable.d.ts, --, --)) +>m : Symbol(m, Decl(modularizeLibrary_NoErrorDuplicateLibOptions1.ts, 9, 3)) +>keys : Symbol(Map.keys, Decl(lib.es2015.iterable.d.ts, --, --)) + +// Using ES6 function +function Baz() { } +>Baz : Symbol(Baz, Decl(modularizeLibrary_NoErrorDuplicateLibOptions1.ts, 12, 9)) + +Baz.name; +>Baz.name : Symbol(Function.name, Decl(lib.es2015.core.d.ts, --, --)) +>Baz : Symbol(Baz, Decl(modularizeLibrary_NoErrorDuplicateLibOptions1.ts, 12, 9)) +>name : Symbol(Function.name, Decl(lib.es2015.core.d.ts, --, --)) + +// Using ES6 generator +function* gen() { +>gen : Symbol(gen, Decl(modularizeLibrary_NoErrorDuplicateLibOptions1.ts, 16, 9)) + + let i = 0; +>i : Symbol(i, Decl(modularizeLibrary_NoErrorDuplicateLibOptions1.ts, 20, 7)) + + while (i < 10) { +>i : Symbol(i, Decl(modularizeLibrary_NoErrorDuplicateLibOptions1.ts, 20, 7)) + + yield i; +>i : Symbol(i, Decl(modularizeLibrary_NoErrorDuplicateLibOptions1.ts, 20, 7)) + + i++; +>i : Symbol(i, Decl(modularizeLibrary_NoErrorDuplicateLibOptions1.ts, 20, 7)) + } +} + +function* gen2() { +>gen2 : Symbol(gen2, Decl(modularizeLibrary_NoErrorDuplicateLibOptions1.ts, 25, 1)) + + let i = 0; +>i : Symbol(i, Decl(modularizeLibrary_NoErrorDuplicateLibOptions1.ts, 28, 7)) + + while (i < 10) { +>i : Symbol(i, Decl(modularizeLibrary_NoErrorDuplicateLibOptions1.ts, 28, 7)) + + yield i; +>i : Symbol(i, Decl(modularizeLibrary_NoErrorDuplicateLibOptions1.ts, 28, 7)) + + i++; +>i : Symbol(i, Decl(modularizeLibrary_NoErrorDuplicateLibOptions1.ts, 28, 7)) + } +} + +// Using ES6 math +Math.sign(1); +>Math.sign : Symbol(Math.sign, Decl(lib.es2015.core.d.ts, --, --)) +>Math : Symbol(Math, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>sign : Symbol(Math.sign, Decl(lib.es2015.core.d.ts, --, --)) + +// Using ES6 object +var o = { +>o : Symbol(o, Decl(modularizeLibrary_NoErrorDuplicateLibOptions1.ts, 39, 3)) + + a: 2, +>a : Symbol(a, Decl(modularizeLibrary_NoErrorDuplicateLibOptions1.ts, 39, 9)) + + [Symbol.hasInstance](value: any) { +>Symbol.hasInstance : Symbol(SymbolConstructor.hasInstance, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>hasInstance : Symbol(SymbolConstructor.hasInstance, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>value : Symbol(value, Decl(modularizeLibrary_NoErrorDuplicateLibOptions1.ts, 41, 25)) + + return false; + } +}; +o.hasOwnProperty(Symbol.hasInstance); +>o.hasOwnProperty : Symbol(Object.hasOwnProperty, Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>o : Symbol(o, Decl(modularizeLibrary_NoErrorDuplicateLibOptions1.ts, 39, 3)) +>hasOwnProperty : Symbol(Object.hasOwnProperty, Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>Symbol.hasInstance : Symbol(SymbolConstructor.hasInstance, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>hasInstance : Symbol(SymbolConstructor.hasInstance, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) + +// Using ES6 promise +async function out() { +>out : Symbol(out, Decl(modularizeLibrary_NoErrorDuplicateLibOptions1.ts, 45, 37)) + + return new Promise(function (resolve, reject) {}); +>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>resolve : Symbol(resolve, Decl(modularizeLibrary_NoErrorDuplicateLibOptions1.ts, 49, 33)) +>reject : Symbol(reject, Decl(modularizeLibrary_NoErrorDuplicateLibOptions1.ts, 49, 41)) +} + +declare var console: any; +>console : Symbol(console, Decl(modularizeLibrary_NoErrorDuplicateLibOptions1.ts, 52, 11)) + +out().then(() => { +>out().then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>out : Symbol(out, Decl(modularizeLibrary_NoErrorDuplicateLibOptions1.ts, 45, 37)) +>then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) + + console.log("Yea!"); +>console : Symbol(console, Decl(modularizeLibrary_NoErrorDuplicateLibOptions1.ts, 52, 11)) + +}); + +// Using Es6 proxy +var t = {} +>t : Symbol(t, Decl(modularizeLibrary_NoErrorDuplicateLibOptions1.ts, 58, 3)) + +var p = new Proxy(t, {}); +>p : Symbol(p, Decl(modularizeLibrary_NoErrorDuplicateLibOptions1.ts, 59, 3)) +>Proxy : Symbol(Proxy, Decl(lib.es2015.proxy.d.ts, --, --)) +>t : Symbol(t, Decl(modularizeLibrary_NoErrorDuplicateLibOptions1.ts, 58, 3)) + +// Using ES6 reflect +Reflect.isExtensible({}); +>Reflect.isExtensible : Symbol(Reflect.isExtensible, Decl(lib.es2015.reflect.d.ts, --, --)) +>Reflect : Symbol(Reflect, Decl(lib.es2015.reflect.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>isExtensible : Symbol(Reflect.isExtensible, Decl(lib.es2015.reflect.d.ts, --, --)) + +// Using Es6 regexp +var reg = new RegExp("/s"); +>reg : Symbol(reg, Decl(modularizeLibrary_NoErrorDuplicateLibOptions1.ts, 65, 3)) +>RegExp : Symbol(RegExp, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) + +reg.flags; +>reg.flags : Symbol(RegExp.flags, Decl(lib.es2015.core.d.ts, --, --)) +>reg : Symbol(reg, Decl(modularizeLibrary_NoErrorDuplicateLibOptions1.ts, 65, 3)) +>flags : Symbol(RegExp.flags, Decl(lib.es2015.core.d.ts, --, --)) + +// Using ES6 string +var str = "Hello world"; +>str : Symbol(str, Decl(modularizeLibrary_NoErrorDuplicateLibOptions1.ts, 69, 3)) + +str.includes("hello", 0); +>str.includes : Symbol(String.includes, Decl(lib.es2015.core.d.ts, --, --)) +>str : Symbol(str, Decl(modularizeLibrary_NoErrorDuplicateLibOptions1.ts, 69, 3)) +>includes : Symbol(String.includes, Decl(lib.es2015.core.d.ts, --, --)) + +// Using ES6 symbol +var s = Symbol(); +>s : Symbol(s, Decl(modularizeLibrary_NoErrorDuplicateLibOptions1.ts, 73, 3)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) + +// Using ES6 wellknown-symbol +const o1 = { +>o1 : Symbol(o1, Decl(modularizeLibrary_NoErrorDuplicateLibOptions1.ts, 76, 5)) + + [Symbol.hasInstance](value: any) { +>Symbol.hasInstance : Symbol(SymbolConstructor.hasInstance, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>hasInstance : Symbol(SymbolConstructor.hasInstance, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>value : Symbol(value, Decl(modularizeLibrary_NoErrorDuplicateLibOptions1.ts, 77, 25)) + + return false; + } +} diff --git a/tests/baselines/reference/modularizeLibrary_NoErrorDuplicateLibOptions1.types b/tests/baselines/reference/modularizeLibrary_NoErrorDuplicateLibOptions1.types new file mode 100644 index 00000000000..16051c14b7c --- /dev/null +++ b/tests/baselines/reference/modularizeLibrary_NoErrorDuplicateLibOptions1.types @@ -0,0 +1,231 @@ +=== tests/cases/compiler/modularizeLibrary_NoErrorDuplicateLibOptions1.ts === + +// Using Es6 array +function f(x: number, y: number, z: number) { +>f : (x: number, y: number, z: number) => any[] +>x : number +>y : number +>z : number + + return Array.from(arguments); +>Array.from(arguments) : any[] +>Array.from : { (iterable: Iterable, mapfn: (v: T, k: number) => U, thisArg?: any): U[]; (iterable: Iterable): T[]; (arrayLike: ArrayLike, mapfn: (v: T, k: number) => U, thisArg?: any): U[]; (arrayLike: ArrayLike): T[]; } +>Array : ArrayConstructor +>from : { (iterable: Iterable, mapfn: (v: T, k: number) => U, thisArg?: any): U[]; (iterable: Iterable): T[]; (arrayLike: ArrayLike, mapfn: (v: T, k: number) => U, thisArg?: any): U[]; (arrayLike: ArrayLike): T[]; } +>arguments : IArguments +} + +f(1, 2, 3); // no error +>f(1, 2, 3) : any[] +>f : (x: number, y: number, z: number) => any[] +>1 : number +>2 : number +>3 : number + +// Using ES6 collection +var m = new Map(); +>m : Map +>new Map() : Map +>Map : MapConstructor + +m.clear(); +>m.clear() : void +>m.clear : () => void +>m : Map +>clear : () => void + +// Using ES6 iterable +m.keys(); +>m.keys() : IterableIterator +>m.keys : () => IterableIterator +>m : Map +>keys : () => IterableIterator + +// Using ES6 function +function Baz() { } +>Baz : () => void + +Baz.name; +>Baz.name : string +>Baz : () => void +>name : string + +// Using ES6 generator +function* gen() { +>gen : () => IterableIterator + + let i = 0; +>i : number +>0 : number + + while (i < 10) { +>i < 10 : boolean +>i : number +>10 : number + + yield i; +>yield i : any +>i : number + + i++; +>i++ : number +>i : number + } +} + +function* gen2() { +>gen2 : () => IterableIterator + + let i = 0; +>i : number +>0 : number + + while (i < 10) { +>i < 10 : boolean +>i : number +>10 : number + + yield i; +>yield i : any +>i : number + + i++; +>i++ : number +>i : number + } +} + +// Using ES6 math +Math.sign(1); +>Math.sign(1) : number +>Math.sign : (x: number) => number +>Math : Math +>sign : (x: number) => number +>1 : number + +// Using ES6 object +var o = { +>o : { a: number; [Symbol.hasInstance](value: any): boolean; } +>{ a: 2, [Symbol.hasInstance](value: any) { return false; }} : { a: number; [Symbol.hasInstance](value: any): boolean; } + + a: 2, +>a : number +>2 : number + + [Symbol.hasInstance](value: any) { +>Symbol.hasInstance : symbol +>Symbol : SymbolConstructor +>hasInstance : symbol +>value : any + + return false; +>false : boolean + } +}; +o.hasOwnProperty(Symbol.hasInstance); +>o.hasOwnProperty(Symbol.hasInstance) : boolean +>o.hasOwnProperty : { (v: string | number | symbol): boolean; (v: string): boolean; } +>o : { a: number; [Symbol.hasInstance](value: any): boolean; } +>hasOwnProperty : { (v: string | number | symbol): boolean; (v: string): boolean; } +>Symbol.hasInstance : symbol +>Symbol : SymbolConstructor +>hasInstance : symbol + +// Using ES6 promise +async function out() { +>out : () => Promise<{}> + + return new Promise(function (resolve, reject) {}); +>new Promise(function (resolve, reject) {}) : Promise<{}> +>Promise : PromiseConstructor +>function (resolve, reject) {} : (resolve: (value?: {} | PromiseLike<{}>) => void, reject: (reason?: any) => void) => void +>resolve : (value?: {} | PromiseLike<{}>) => void +>reject : (reason?: any) => void +} + +declare var console: any; +>console : any + +out().then(() => { +>out().then(() => { console.log("Yea!");}) : Promise +>out().then : { (onfulfilled?: (value: {}) => TResult | PromiseLike, onrejected?: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled?: (value: {}) => TResult | PromiseLike, onrejected?: (reason: any) => void): Promise; } +>out() : Promise<{}> +>out : () => Promise<{}> +>then : { (onfulfilled?: (value: {}) => TResult | PromiseLike, onrejected?: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled?: (value: {}) => TResult | PromiseLike, onrejected?: (reason: any) => void): Promise; } +>() => { console.log("Yea!");} : () => void + + console.log("Yea!"); +>console.log("Yea!") : any +>console.log : any +>console : any +>log : any +>"Yea!" : string + +}); + +// Using Es6 proxy +var t = {} +>t : {} +>{} : {} + +var p = new Proxy(t, {}); +>p : {} +>new Proxy(t, {}) : {} +>Proxy : ProxyConstructor +>t : {} +>{} : {} + +// Using ES6 reflect +Reflect.isExtensible({}); +>Reflect.isExtensible({}) : boolean +>Reflect.isExtensible : (target: any) => boolean +>Reflect : typeof Reflect +>isExtensible : (target: any) => boolean +>{} : {} + +// Using Es6 regexp +var reg = new RegExp("/s"); +>reg : RegExp +>new RegExp("/s") : RegExp +>RegExp : RegExpConstructor +>"/s" : string + +reg.flags; +>reg.flags : string +>reg : RegExp +>flags : string + +// Using ES6 string +var str = "Hello world"; +>str : string +>"Hello world" : string + +str.includes("hello", 0); +>str.includes("hello", 0) : boolean +>str.includes : (searchString: string, position?: number) => boolean +>str : string +>includes : (searchString: string, position?: number) => boolean +>"hello" : string +>0 : number + +// Using ES6 symbol +var s = Symbol(); +>s : symbol +>Symbol() : symbol +>Symbol : SymbolConstructor + +// Using ES6 wellknown-symbol +const o1 = { +>o1 : { [Symbol.hasInstance](value: any): boolean; } +>{ [Symbol.hasInstance](value: any) { return false; }} : { [Symbol.hasInstance](value: any): boolean; } + + [Symbol.hasInstance](value: any) { +>Symbol.hasInstance : symbol +>Symbol : SymbolConstructor +>hasInstance : symbol +>value : any + + return false; +>false : boolean + } +} diff --git a/tests/baselines/reference/modularizeLibrary_NoErrorDuplicateLibOptions2.js b/tests/baselines/reference/modularizeLibrary_NoErrorDuplicateLibOptions2.js new file mode 100644 index 00000000000..c4c2d6853af --- /dev/null +++ b/tests/baselines/reference/modularizeLibrary_NoErrorDuplicateLibOptions2.js @@ -0,0 +1,158 @@ +//// [modularizeLibrary_NoErrorDuplicateLibOptions2.ts] + +// Using Es6 array +function f(x: number, y: number, z: number) { + return Array.from(arguments); +} + +f(1, 2, 3); // no error + +// Using ES6 collection +var m = new Map(); +m.clear(); +// Using ES6 iterable +m.keys(); + +// Using ES6 function +function Baz() { } +Baz.name; + +// Using ES6 generator +function* gen() { + let i = 0; + while (i < 10) { + yield i; + i++; + } +} + +function* gen2() { + let i = 0; + while (i < 10) { + yield i; + i++; + } +} + +// Using ES6 math +Math.sign(1); + +// Using ES6 object +var o = { + a: 2, + [Symbol.hasInstance](value: any) { + return false; + } +}; +o.hasOwnProperty(Symbol.hasInstance); + +// Using ES6 promise +async function out() { + return new Promise(function (resolve, reject) {}); +} + +declare var console: any; +out().then(() => { + console.log("Yea!"); +}); + +// Using Es6 proxy +var t = {} +var p = new Proxy(t, {}); + +// Using ES6 reflect +Reflect.isExtensible({}); + +// Using Es6 regexp +var reg = new RegExp("/s"); +reg.flags; + +// Using ES6 string +var str = "Hello world"; +str.includes("hello", 0); + +// Using ES6 symbol +var s = Symbol(); + +// Using ES6 wellknown-symbol +const o1 = { + [Symbol.hasInstance](value: any) { + return false; + } +} + +//// [modularizeLibrary_NoErrorDuplicateLibOptions2.js] +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator.throw(value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments)).next()); + }); +}; +// Using Es6 array +function f(x, y, z) { + return Array.from(arguments); +} +f(1, 2, 3); // no error +// Using ES6 collection +var m = new Map(); +m.clear(); +// Using ES6 iterable +m.keys(); +// Using ES6 function +function Baz() { } +Baz.name; +// Using ES6 generator +function* gen() { + let i = 0; + while (i < 10) { + yield i; + i++; + } +} +function* gen2() { + let i = 0; + while (i < 10) { + yield i; + i++; + } +} +// Using ES6 math +Math.sign(1); +// Using ES6 object +var o = { + a: 2, + [Symbol.hasInstance](value) { + return false; + } +}; +o.hasOwnProperty(Symbol.hasInstance); +// Using ES6 promise +function out() { + return __awaiter(this, void 0, void 0, function* () { + return new Promise(function (resolve, reject) { }); + }); +} +out().then(() => { + console.log("Yea!"); +}); +// Using Es6 proxy +var t = {}; +var p = new Proxy(t, {}); +// Using ES6 reflect +Reflect.isExtensible({}); +// Using Es6 regexp +var reg = new RegExp("/s"); +reg.flags; +// Using ES6 string +var str = "Hello world"; +str.includes("hello", 0); +// Using ES6 symbol +var s = Symbol(); +// Using ES6 wellknown-symbol +const o1 = { + [Symbol.hasInstance](value) { + return false; + } +}; diff --git a/tests/baselines/reference/modularizeLibrary_NoErrorDuplicateLibOptions2.symbols b/tests/baselines/reference/modularizeLibrary_NoErrorDuplicateLibOptions2.symbols new file mode 100644 index 00000000000..89cb8fe7179 --- /dev/null +++ b/tests/baselines/reference/modularizeLibrary_NoErrorDuplicateLibOptions2.symbols @@ -0,0 +1,184 @@ +=== tests/cases/compiler/modularizeLibrary_NoErrorDuplicateLibOptions2.ts === + +// Using Es6 array +function f(x: number, y: number, z: number) { +>f : Symbol(f, Decl(modularizeLibrary_NoErrorDuplicateLibOptions2.ts, 0, 0)) +>x : Symbol(x, Decl(modularizeLibrary_NoErrorDuplicateLibOptions2.ts, 2, 11)) +>y : Symbol(y, Decl(modularizeLibrary_NoErrorDuplicateLibOptions2.ts, 2, 21)) +>z : Symbol(z, Decl(modularizeLibrary_NoErrorDuplicateLibOptions2.ts, 2, 32)) + + return Array.from(arguments); +>Array.from : Symbol(ArrayConstructor.from, Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --)) +>Array : Symbol(Array, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>from : Symbol(ArrayConstructor.from, Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --)) +>arguments : Symbol(arguments) +} + +f(1, 2, 3); // no error +>f : Symbol(f, Decl(modularizeLibrary_NoErrorDuplicateLibOptions2.ts, 0, 0)) + +// Using ES6 collection +var m = new Map(); +>m : Symbol(m, Decl(modularizeLibrary_NoErrorDuplicateLibOptions2.ts, 9, 3)) +>Map : Symbol(Map, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.collection.d.ts, --, --), Decl(lib.es2015.collection.d.ts, --, --)) + +m.clear(); +>m.clear : Symbol(Map.clear, Decl(lib.es2015.collection.d.ts, --, --)) +>m : Symbol(m, Decl(modularizeLibrary_NoErrorDuplicateLibOptions2.ts, 9, 3)) +>clear : Symbol(Map.clear, Decl(lib.es2015.collection.d.ts, --, --)) + +// Using ES6 iterable +m.keys(); +>m.keys : Symbol(Map.keys, Decl(lib.es2015.iterable.d.ts, --, --)) +>m : Symbol(m, Decl(modularizeLibrary_NoErrorDuplicateLibOptions2.ts, 9, 3)) +>keys : Symbol(Map.keys, Decl(lib.es2015.iterable.d.ts, --, --)) + +// Using ES6 function +function Baz() { } +>Baz : Symbol(Baz, Decl(modularizeLibrary_NoErrorDuplicateLibOptions2.ts, 12, 9)) + +Baz.name; +>Baz.name : Symbol(Function.name, Decl(lib.es2015.core.d.ts, --, --)) +>Baz : Symbol(Baz, Decl(modularizeLibrary_NoErrorDuplicateLibOptions2.ts, 12, 9)) +>name : Symbol(Function.name, Decl(lib.es2015.core.d.ts, --, --)) + +// Using ES6 generator +function* gen() { +>gen : Symbol(gen, Decl(modularizeLibrary_NoErrorDuplicateLibOptions2.ts, 16, 9)) + + let i = 0; +>i : Symbol(i, Decl(modularizeLibrary_NoErrorDuplicateLibOptions2.ts, 20, 7)) + + while (i < 10) { +>i : Symbol(i, Decl(modularizeLibrary_NoErrorDuplicateLibOptions2.ts, 20, 7)) + + yield i; +>i : Symbol(i, Decl(modularizeLibrary_NoErrorDuplicateLibOptions2.ts, 20, 7)) + + i++; +>i : Symbol(i, Decl(modularizeLibrary_NoErrorDuplicateLibOptions2.ts, 20, 7)) + } +} + +function* gen2() { +>gen2 : Symbol(gen2, Decl(modularizeLibrary_NoErrorDuplicateLibOptions2.ts, 25, 1)) + + let i = 0; +>i : Symbol(i, Decl(modularizeLibrary_NoErrorDuplicateLibOptions2.ts, 28, 7)) + + while (i < 10) { +>i : Symbol(i, Decl(modularizeLibrary_NoErrorDuplicateLibOptions2.ts, 28, 7)) + + yield i; +>i : Symbol(i, Decl(modularizeLibrary_NoErrorDuplicateLibOptions2.ts, 28, 7)) + + i++; +>i : Symbol(i, Decl(modularizeLibrary_NoErrorDuplicateLibOptions2.ts, 28, 7)) + } +} + +// Using ES6 math +Math.sign(1); +>Math.sign : Symbol(Math.sign, Decl(lib.es2015.core.d.ts, --, --)) +>Math : Symbol(Math, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>sign : Symbol(Math.sign, Decl(lib.es2015.core.d.ts, --, --)) + +// Using ES6 object +var o = { +>o : Symbol(o, Decl(modularizeLibrary_NoErrorDuplicateLibOptions2.ts, 39, 3)) + + a: 2, +>a : Symbol(a, Decl(modularizeLibrary_NoErrorDuplicateLibOptions2.ts, 39, 9)) + + [Symbol.hasInstance](value: any) { +>Symbol.hasInstance : Symbol(SymbolConstructor.hasInstance, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>hasInstance : Symbol(SymbolConstructor.hasInstance, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>value : Symbol(value, Decl(modularizeLibrary_NoErrorDuplicateLibOptions2.ts, 41, 25)) + + return false; + } +}; +o.hasOwnProperty(Symbol.hasInstance); +>o.hasOwnProperty : Symbol(Object.hasOwnProperty, Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>o : Symbol(o, Decl(modularizeLibrary_NoErrorDuplicateLibOptions2.ts, 39, 3)) +>hasOwnProperty : Symbol(Object.hasOwnProperty, Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>Symbol.hasInstance : Symbol(SymbolConstructor.hasInstance, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>hasInstance : Symbol(SymbolConstructor.hasInstance, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) + +// Using ES6 promise +async function out() { +>out : Symbol(out, Decl(modularizeLibrary_NoErrorDuplicateLibOptions2.ts, 45, 37)) + + return new Promise(function (resolve, reject) {}); +>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>resolve : Symbol(resolve, Decl(modularizeLibrary_NoErrorDuplicateLibOptions2.ts, 49, 33)) +>reject : Symbol(reject, Decl(modularizeLibrary_NoErrorDuplicateLibOptions2.ts, 49, 41)) +} + +declare var console: any; +>console : Symbol(console, Decl(modularizeLibrary_NoErrorDuplicateLibOptions2.ts, 52, 11)) + +out().then(() => { +>out().then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>out : Symbol(out, Decl(modularizeLibrary_NoErrorDuplicateLibOptions2.ts, 45, 37)) +>then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) + + console.log("Yea!"); +>console : Symbol(console, Decl(modularizeLibrary_NoErrorDuplicateLibOptions2.ts, 52, 11)) + +}); + +// Using Es6 proxy +var t = {} +>t : Symbol(t, Decl(modularizeLibrary_NoErrorDuplicateLibOptions2.ts, 58, 3)) + +var p = new Proxy(t, {}); +>p : Symbol(p, Decl(modularizeLibrary_NoErrorDuplicateLibOptions2.ts, 59, 3)) +>Proxy : Symbol(Proxy, Decl(lib.es2015.proxy.d.ts, --, --)) +>t : Symbol(t, Decl(modularizeLibrary_NoErrorDuplicateLibOptions2.ts, 58, 3)) + +// Using ES6 reflect +Reflect.isExtensible({}); +>Reflect.isExtensible : Symbol(Reflect.isExtensible, Decl(lib.es2015.reflect.d.ts, --, --)) +>Reflect : Symbol(Reflect, Decl(lib.es2015.reflect.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>isExtensible : Symbol(Reflect.isExtensible, Decl(lib.es2015.reflect.d.ts, --, --)) + +// Using Es6 regexp +var reg = new RegExp("/s"); +>reg : Symbol(reg, Decl(modularizeLibrary_NoErrorDuplicateLibOptions2.ts, 65, 3)) +>RegExp : Symbol(RegExp, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) + +reg.flags; +>reg.flags : Symbol(RegExp.flags, Decl(lib.es2015.core.d.ts, --, --)) +>reg : Symbol(reg, Decl(modularizeLibrary_NoErrorDuplicateLibOptions2.ts, 65, 3)) +>flags : Symbol(RegExp.flags, Decl(lib.es2015.core.d.ts, --, --)) + +// Using ES6 string +var str = "Hello world"; +>str : Symbol(str, Decl(modularizeLibrary_NoErrorDuplicateLibOptions2.ts, 69, 3)) + +str.includes("hello", 0); +>str.includes : Symbol(String.includes, Decl(lib.es2015.core.d.ts, --, --)) +>str : Symbol(str, Decl(modularizeLibrary_NoErrorDuplicateLibOptions2.ts, 69, 3)) +>includes : Symbol(String.includes, Decl(lib.es2015.core.d.ts, --, --)) + +// Using ES6 symbol +var s = Symbol(); +>s : Symbol(s, Decl(modularizeLibrary_NoErrorDuplicateLibOptions2.ts, 73, 3)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) + +// Using ES6 wellknown-symbol +const o1 = { +>o1 : Symbol(o1, Decl(modularizeLibrary_NoErrorDuplicateLibOptions2.ts, 76, 5)) + + [Symbol.hasInstance](value: any) { +>Symbol.hasInstance : Symbol(SymbolConstructor.hasInstance, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>hasInstance : Symbol(SymbolConstructor.hasInstance, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>value : Symbol(value, Decl(modularizeLibrary_NoErrorDuplicateLibOptions2.ts, 77, 25)) + + return false; + } +} diff --git a/tests/baselines/reference/modularizeLibrary_NoErrorDuplicateLibOptions2.types b/tests/baselines/reference/modularizeLibrary_NoErrorDuplicateLibOptions2.types new file mode 100644 index 00000000000..a7d8e77e28c --- /dev/null +++ b/tests/baselines/reference/modularizeLibrary_NoErrorDuplicateLibOptions2.types @@ -0,0 +1,231 @@ +=== tests/cases/compiler/modularizeLibrary_NoErrorDuplicateLibOptions2.ts === + +// Using Es6 array +function f(x: number, y: number, z: number) { +>f : (x: number, y: number, z: number) => any[] +>x : number +>y : number +>z : number + + return Array.from(arguments); +>Array.from(arguments) : any[] +>Array.from : { (iterable: Iterable, mapfn: (v: T, k: number) => U, thisArg?: any): U[]; (iterable: Iterable): T[]; (arrayLike: ArrayLike, mapfn: (v: T, k: number) => U, thisArg?: any): U[]; (arrayLike: ArrayLike): T[]; } +>Array : ArrayConstructor +>from : { (iterable: Iterable, mapfn: (v: T, k: number) => U, thisArg?: any): U[]; (iterable: Iterable): T[]; (arrayLike: ArrayLike, mapfn: (v: T, k: number) => U, thisArg?: any): U[]; (arrayLike: ArrayLike): T[]; } +>arguments : IArguments +} + +f(1, 2, 3); // no error +>f(1, 2, 3) : any[] +>f : (x: number, y: number, z: number) => any[] +>1 : number +>2 : number +>3 : number + +// Using ES6 collection +var m = new Map(); +>m : Map +>new Map() : Map +>Map : MapConstructor + +m.clear(); +>m.clear() : void +>m.clear : () => void +>m : Map +>clear : () => void + +// Using ES6 iterable +m.keys(); +>m.keys() : IterableIterator +>m.keys : () => IterableIterator +>m : Map +>keys : () => IterableIterator + +// Using ES6 function +function Baz() { } +>Baz : () => void + +Baz.name; +>Baz.name : string +>Baz : () => void +>name : string + +// Using ES6 generator +function* gen() { +>gen : () => IterableIterator + + let i = 0; +>i : number +>0 : number + + while (i < 10) { +>i < 10 : boolean +>i : number +>10 : number + + yield i; +>yield i : any +>i : number + + i++; +>i++ : number +>i : number + } +} + +function* gen2() { +>gen2 : () => IterableIterator + + let i = 0; +>i : number +>0 : number + + while (i < 10) { +>i < 10 : boolean +>i : number +>10 : number + + yield i; +>yield i : any +>i : number + + i++; +>i++ : number +>i : number + } +} + +// Using ES6 math +Math.sign(1); +>Math.sign(1) : number +>Math.sign : (x: number) => number +>Math : Math +>sign : (x: number) => number +>1 : number + +// Using ES6 object +var o = { +>o : { a: number; [Symbol.hasInstance](value: any): boolean; } +>{ a: 2, [Symbol.hasInstance](value: any) { return false; }} : { a: number; [Symbol.hasInstance](value: any): boolean; } + + a: 2, +>a : number +>2 : number + + [Symbol.hasInstance](value: any) { +>Symbol.hasInstance : symbol +>Symbol : SymbolConstructor +>hasInstance : symbol +>value : any + + return false; +>false : boolean + } +}; +o.hasOwnProperty(Symbol.hasInstance); +>o.hasOwnProperty(Symbol.hasInstance) : boolean +>o.hasOwnProperty : { (v: string | number | symbol): boolean; (v: string): boolean; } +>o : { a: number; [Symbol.hasInstance](value: any): boolean; } +>hasOwnProperty : { (v: string | number | symbol): boolean; (v: string): boolean; } +>Symbol.hasInstance : symbol +>Symbol : SymbolConstructor +>hasInstance : symbol + +// Using ES6 promise +async function out() { +>out : () => Promise<{}> + + return new Promise(function (resolve, reject) {}); +>new Promise(function (resolve, reject) {}) : Promise<{}> +>Promise : PromiseConstructor +>function (resolve, reject) {} : (resolve: (value?: {} | PromiseLike<{}>) => void, reject: (reason?: any) => void) => void +>resolve : (value?: {} | PromiseLike<{}>) => void +>reject : (reason?: any) => void +} + +declare var console: any; +>console : any + +out().then(() => { +>out().then(() => { console.log("Yea!");}) : Promise +>out().then : { (onfulfilled?: (value: {}) => TResult | PromiseLike, onrejected?: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled?: (value: {}) => TResult | PromiseLike, onrejected?: (reason: any) => void): Promise; } +>out() : Promise<{}> +>out : () => Promise<{}> +>then : { (onfulfilled?: (value: {}) => TResult | PromiseLike, onrejected?: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled?: (value: {}) => TResult | PromiseLike, onrejected?: (reason: any) => void): Promise; } +>() => { console.log("Yea!");} : () => void + + console.log("Yea!"); +>console.log("Yea!") : any +>console.log : any +>console : any +>log : any +>"Yea!" : string + +}); + +// Using Es6 proxy +var t = {} +>t : {} +>{} : {} + +var p = new Proxy(t, {}); +>p : {} +>new Proxy(t, {}) : {} +>Proxy : ProxyConstructor +>t : {} +>{} : {} + +// Using ES6 reflect +Reflect.isExtensible({}); +>Reflect.isExtensible({}) : boolean +>Reflect.isExtensible : (target: any) => boolean +>Reflect : typeof Reflect +>isExtensible : (target: any) => boolean +>{} : {} + +// Using Es6 regexp +var reg = new RegExp("/s"); +>reg : RegExp +>new RegExp("/s") : RegExp +>RegExp : RegExpConstructor +>"/s" : string + +reg.flags; +>reg.flags : string +>reg : RegExp +>flags : string + +// Using ES6 string +var str = "Hello world"; +>str : string +>"Hello world" : string + +str.includes("hello", 0); +>str.includes("hello", 0) : boolean +>str.includes : (searchString: string, position?: number) => boolean +>str : string +>includes : (searchString: string, position?: number) => boolean +>"hello" : string +>0 : number + +// Using ES6 symbol +var s = Symbol(); +>s : symbol +>Symbol() : symbol +>Symbol : SymbolConstructor + +// Using ES6 wellknown-symbol +const o1 = { +>o1 : { [Symbol.hasInstance](value: any): boolean; } +>{ [Symbol.hasInstance](value: any) { return false; }} : { [Symbol.hasInstance](value: any): boolean; } + + [Symbol.hasInstance](value: any) { +>Symbol.hasInstance : symbol +>Symbol : SymbolConstructor +>hasInstance : symbol +>value : any + + return false; +>false : boolean + } +} diff --git a/tests/baselines/reference/modularizeLibrary_TargetES5UsingES6Lib.js b/tests/baselines/reference/modularizeLibrary_TargetES5UsingES6Lib.js new file mode 100644 index 00000000000..8736c51cd16 --- /dev/null +++ b/tests/baselines/reference/modularizeLibrary_TargetES5UsingES6Lib.js @@ -0,0 +1,158 @@ +//// [modularizeLibrary_TargetES5UsingES6Lib.ts] + +// Using Es6 array +function f(x: number, y: number, z: number) { + return Array.from(arguments); +} + +f(1, 2, 3); // no error + +// Using ES6 collection +var m = new Map(); +m.clear(); +// Using ES6 iterable +m.keys(); + +// Using ES6 function +function Baz() { } +Baz.name; + +// Using ES6 generator +function* gen() { + let i = 0; + while (i < 10) { + yield i; + i++; + } +} + +function* gen2() { + let i = 0; + while (i < 10) { + yield i; + i++; + } +} + +// Using ES6 math +Math.sign(1); + +// Using ES6 object +var o = { + a: 2, + [Symbol.hasInstance](value: any) { + return false; + } +}; +o.hasOwnProperty(Symbol.hasInstance); + +// Using ES6 promise +async function out() { + return new Promise(function (resolve, reject) {}); +} + +declare var console: any; +out().then(() => { + console.log("Yea!"); +}); + +// Using Es6 proxy +var t = {} +var p = new Proxy(t, {}); + +// Using ES6 reflect +Reflect.isExtensible({}); + +// Using Es6 regexp +var reg = new RegExp("/s"); +reg.flags; + +// Using ES6 string +var str = "Hello world"; +str.includes("hello", 0); + +// Using ES6 symbol +var s = Symbol(); + +// Using ES6 wellknown-symbol +const o1 = { + [Symbol.hasInstance](value: any) { + return false; + } +} + +//// [modularizeLibrary_TargetES5UsingES6Lib.js] +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator.throw(value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments)).next()); + }); +}; +// Using Es6 array +function f(x, y, z) { + return Array.from(arguments); +} +f(1, 2, 3); // no error +// Using ES6 collection +var m = new Map(); +m.clear(); +// Using ES6 iterable +m.keys(); +// Using ES6 function +function Baz() { } +Baz.name; +// Using ES6 generator +function* gen() { + let i = 0; + while (i < 10) { + yield i; + i++; + } +} +function* gen2() { + let i = 0; + while (i < 10) { + yield i; + i++; + } +} +// Using ES6 math +Math.sign(1); +// Using ES6 object +var o = { + a: 2, + [Symbol.hasInstance](value) { + return false; + } +}; +o.hasOwnProperty(Symbol.hasInstance); +// Using ES6 promise +function out() { + return __awaiter(this, void 0, void 0, function* () { + return new Promise(function (resolve, reject) { }); + }); +} +out().then(() => { + console.log("Yea!"); +}); +// Using Es6 proxy +var t = {}; +var p = new Proxy(t, {}); +// Using ES6 reflect +Reflect.isExtensible({}); +// Using Es6 regexp +var reg = new RegExp("/s"); +reg.flags; +// Using ES6 string +var str = "Hello world"; +str.includes("hello", 0); +// Using ES6 symbol +var s = Symbol(); +// Using ES6 wellknown-symbol +const o1 = { + [Symbol.hasInstance](value) { + return false; + } +}; diff --git a/tests/baselines/reference/modularizeLibrary_TargetES5UsingES6Lib.symbols b/tests/baselines/reference/modularizeLibrary_TargetES5UsingES6Lib.symbols new file mode 100644 index 00000000000..c8ccdd98653 --- /dev/null +++ b/tests/baselines/reference/modularizeLibrary_TargetES5UsingES6Lib.symbols @@ -0,0 +1,184 @@ +=== tests/cases/compiler/modularizeLibrary_TargetES5UsingES6Lib.ts === + +// Using Es6 array +function f(x: number, y: number, z: number) { +>f : Symbol(f, Decl(modularizeLibrary_TargetES5UsingES6Lib.ts, 0, 0)) +>x : Symbol(x, Decl(modularizeLibrary_TargetES5UsingES6Lib.ts, 2, 11)) +>y : Symbol(y, Decl(modularizeLibrary_TargetES5UsingES6Lib.ts, 2, 21)) +>z : Symbol(z, Decl(modularizeLibrary_TargetES5UsingES6Lib.ts, 2, 32)) + + return Array.from(arguments); +>Array.from : Symbol(ArrayConstructor.from, Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --)) +>Array : Symbol(Array, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>from : Symbol(ArrayConstructor.from, Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --)) +>arguments : Symbol(arguments) +} + +f(1, 2, 3); // no error +>f : Symbol(f, Decl(modularizeLibrary_TargetES5UsingES6Lib.ts, 0, 0)) + +// Using ES6 collection +var m = new Map(); +>m : Symbol(m, Decl(modularizeLibrary_TargetES5UsingES6Lib.ts, 9, 3)) +>Map : Symbol(Map, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.collection.d.ts, --, --), Decl(lib.es2015.collection.d.ts, --, --)) + +m.clear(); +>m.clear : Symbol(Map.clear, Decl(lib.es2015.collection.d.ts, --, --)) +>m : Symbol(m, Decl(modularizeLibrary_TargetES5UsingES6Lib.ts, 9, 3)) +>clear : Symbol(Map.clear, Decl(lib.es2015.collection.d.ts, --, --)) + +// Using ES6 iterable +m.keys(); +>m.keys : Symbol(Map.keys, Decl(lib.es2015.iterable.d.ts, --, --)) +>m : Symbol(m, Decl(modularizeLibrary_TargetES5UsingES6Lib.ts, 9, 3)) +>keys : Symbol(Map.keys, Decl(lib.es2015.iterable.d.ts, --, --)) + +// Using ES6 function +function Baz() { } +>Baz : Symbol(Baz, Decl(modularizeLibrary_TargetES5UsingES6Lib.ts, 12, 9)) + +Baz.name; +>Baz.name : Symbol(Function.name, Decl(lib.es2015.core.d.ts, --, --)) +>Baz : Symbol(Baz, Decl(modularizeLibrary_TargetES5UsingES6Lib.ts, 12, 9)) +>name : Symbol(Function.name, Decl(lib.es2015.core.d.ts, --, --)) + +// Using ES6 generator +function* gen() { +>gen : Symbol(gen, Decl(modularizeLibrary_TargetES5UsingES6Lib.ts, 16, 9)) + + let i = 0; +>i : Symbol(i, Decl(modularizeLibrary_TargetES5UsingES6Lib.ts, 20, 7)) + + while (i < 10) { +>i : Symbol(i, Decl(modularizeLibrary_TargetES5UsingES6Lib.ts, 20, 7)) + + yield i; +>i : Symbol(i, Decl(modularizeLibrary_TargetES5UsingES6Lib.ts, 20, 7)) + + i++; +>i : Symbol(i, Decl(modularizeLibrary_TargetES5UsingES6Lib.ts, 20, 7)) + } +} + +function* gen2() { +>gen2 : Symbol(gen2, Decl(modularizeLibrary_TargetES5UsingES6Lib.ts, 25, 1)) + + let i = 0; +>i : Symbol(i, Decl(modularizeLibrary_TargetES5UsingES6Lib.ts, 28, 7)) + + while (i < 10) { +>i : Symbol(i, Decl(modularizeLibrary_TargetES5UsingES6Lib.ts, 28, 7)) + + yield i; +>i : Symbol(i, Decl(modularizeLibrary_TargetES5UsingES6Lib.ts, 28, 7)) + + i++; +>i : Symbol(i, Decl(modularizeLibrary_TargetES5UsingES6Lib.ts, 28, 7)) + } +} + +// Using ES6 math +Math.sign(1); +>Math.sign : Symbol(Math.sign, Decl(lib.es2015.core.d.ts, --, --)) +>Math : Symbol(Math, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>sign : Symbol(Math.sign, Decl(lib.es2015.core.d.ts, --, --)) + +// Using ES6 object +var o = { +>o : Symbol(o, Decl(modularizeLibrary_TargetES5UsingES6Lib.ts, 39, 3)) + + a: 2, +>a : Symbol(a, Decl(modularizeLibrary_TargetES5UsingES6Lib.ts, 39, 9)) + + [Symbol.hasInstance](value: any) { +>Symbol.hasInstance : Symbol(SymbolConstructor.hasInstance, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>hasInstance : Symbol(SymbolConstructor.hasInstance, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>value : Symbol(value, Decl(modularizeLibrary_TargetES5UsingES6Lib.ts, 41, 25)) + + return false; + } +}; +o.hasOwnProperty(Symbol.hasInstance); +>o.hasOwnProperty : Symbol(Object.hasOwnProperty, Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>o : Symbol(o, Decl(modularizeLibrary_TargetES5UsingES6Lib.ts, 39, 3)) +>hasOwnProperty : Symbol(Object.hasOwnProperty, Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>Symbol.hasInstance : Symbol(SymbolConstructor.hasInstance, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>hasInstance : Symbol(SymbolConstructor.hasInstance, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) + +// Using ES6 promise +async function out() { +>out : Symbol(out, Decl(modularizeLibrary_TargetES5UsingES6Lib.ts, 45, 37)) + + return new Promise(function (resolve, reject) {}); +>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>resolve : Symbol(resolve, Decl(modularizeLibrary_TargetES5UsingES6Lib.ts, 49, 33)) +>reject : Symbol(reject, Decl(modularizeLibrary_TargetES5UsingES6Lib.ts, 49, 41)) +} + +declare var console: any; +>console : Symbol(console, Decl(modularizeLibrary_TargetES5UsingES6Lib.ts, 52, 11)) + +out().then(() => { +>out().then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>out : Symbol(out, Decl(modularizeLibrary_TargetES5UsingES6Lib.ts, 45, 37)) +>then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) + + console.log("Yea!"); +>console : Symbol(console, Decl(modularizeLibrary_TargetES5UsingES6Lib.ts, 52, 11)) + +}); + +// Using Es6 proxy +var t = {} +>t : Symbol(t, Decl(modularizeLibrary_TargetES5UsingES6Lib.ts, 58, 3)) + +var p = new Proxy(t, {}); +>p : Symbol(p, Decl(modularizeLibrary_TargetES5UsingES6Lib.ts, 59, 3)) +>Proxy : Symbol(Proxy, Decl(lib.es2015.proxy.d.ts, --, --)) +>t : Symbol(t, Decl(modularizeLibrary_TargetES5UsingES6Lib.ts, 58, 3)) + +// Using ES6 reflect +Reflect.isExtensible({}); +>Reflect.isExtensible : Symbol(Reflect.isExtensible, Decl(lib.es2015.reflect.d.ts, --, --)) +>Reflect : Symbol(Reflect, Decl(lib.es2015.reflect.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>isExtensible : Symbol(Reflect.isExtensible, Decl(lib.es2015.reflect.d.ts, --, --)) + +// Using Es6 regexp +var reg = new RegExp("/s"); +>reg : Symbol(reg, Decl(modularizeLibrary_TargetES5UsingES6Lib.ts, 65, 3)) +>RegExp : Symbol(RegExp, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) + +reg.flags; +>reg.flags : Symbol(RegExp.flags, Decl(lib.es2015.core.d.ts, --, --)) +>reg : Symbol(reg, Decl(modularizeLibrary_TargetES5UsingES6Lib.ts, 65, 3)) +>flags : Symbol(RegExp.flags, Decl(lib.es2015.core.d.ts, --, --)) + +// Using ES6 string +var str = "Hello world"; +>str : Symbol(str, Decl(modularizeLibrary_TargetES5UsingES6Lib.ts, 69, 3)) + +str.includes("hello", 0); +>str.includes : Symbol(String.includes, Decl(lib.es2015.core.d.ts, --, --)) +>str : Symbol(str, Decl(modularizeLibrary_TargetES5UsingES6Lib.ts, 69, 3)) +>includes : Symbol(String.includes, Decl(lib.es2015.core.d.ts, --, --)) + +// Using ES6 symbol +var s = Symbol(); +>s : Symbol(s, Decl(modularizeLibrary_TargetES5UsingES6Lib.ts, 73, 3)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) + +// Using ES6 wellknown-symbol +const o1 = { +>o1 : Symbol(o1, Decl(modularizeLibrary_TargetES5UsingES6Lib.ts, 76, 5)) + + [Symbol.hasInstance](value: any) { +>Symbol.hasInstance : Symbol(SymbolConstructor.hasInstance, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>hasInstance : Symbol(SymbolConstructor.hasInstance, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>value : Symbol(value, Decl(modularizeLibrary_TargetES5UsingES6Lib.ts, 77, 25)) + + return false; + } +} diff --git a/tests/baselines/reference/modularizeLibrary_TargetES5UsingES6Lib.types b/tests/baselines/reference/modularizeLibrary_TargetES5UsingES6Lib.types new file mode 100644 index 00000000000..8272465da5e --- /dev/null +++ b/tests/baselines/reference/modularizeLibrary_TargetES5UsingES6Lib.types @@ -0,0 +1,231 @@ +=== tests/cases/compiler/modularizeLibrary_TargetES5UsingES6Lib.ts === + +// Using Es6 array +function f(x: number, y: number, z: number) { +>f : (x: number, y: number, z: number) => any[] +>x : number +>y : number +>z : number + + return Array.from(arguments); +>Array.from(arguments) : any[] +>Array.from : { (iterable: Iterable, mapfn: (v: T, k: number) => U, thisArg?: any): U[]; (iterable: Iterable): T[]; (arrayLike: ArrayLike, mapfn: (v: T, k: number) => U, thisArg?: any): U[]; (arrayLike: ArrayLike): T[]; } +>Array : ArrayConstructor +>from : { (iterable: Iterable, mapfn: (v: T, k: number) => U, thisArg?: any): U[]; (iterable: Iterable): T[]; (arrayLike: ArrayLike, mapfn: (v: T, k: number) => U, thisArg?: any): U[]; (arrayLike: ArrayLike): T[]; } +>arguments : IArguments +} + +f(1, 2, 3); // no error +>f(1, 2, 3) : any[] +>f : (x: number, y: number, z: number) => any[] +>1 : number +>2 : number +>3 : number + +// Using ES6 collection +var m = new Map(); +>m : Map +>new Map() : Map +>Map : MapConstructor + +m.clear(); +>m.clear() : void +>m.clear : () => void +>m : Map +>clear : () => void + +// Using ES6 iterable +m.keys(); +>m.keys() : IterableIterator +>m.keys : () => IterableIterator +>m : Map +>keys : () => IterableIterator + +// Using ES6 function +function Baz() { } +>Baz : () => void + +Baz.name; +>Baz.name : string +>Baz : () => void +>name : string + +// Using ES6 generator +function* gen() { +>gen : () => IterableIterator + + let i = 0; +>i : number +>0 : number + + while (i < 10) { +>i < 10 : boolean +>i : number +>10 : number + + yield i; +>yield i : any +>i : number + + i++; +>i++ : number +>i : number + } +} + +function* gen2() { +>gen2 : () => IterableIterator + + let i = 0; +>i : number +>0 : number + + while (i < 10) { +>i < 10 : boolean +>i : number +>10 : number + + yield i; +>yield i : any +>i : number + + i++; +>i++ : number +>i : number + } +} + +// Using ES6 math +Math.sign(1); +>Math.sign(1) : number +>Math.sign : (x: number) => number +>Math : Math +>sign : (x: number) => number +>1 : number + +// Using ES6 object +var o = { +>o : { a: number; [Symbol.hasInstance](value: any): boolean; } +>{ a: 2, [Symbol.hasInstance](value: any) { return false; }} : { a: number; [Symbol.hasInstance](value: any): boolean; } + + a: 2, +>a : number +>2 : number + + [Symbol.hasInstance](value: any) { +>Symbol.hasInstance : symbol +>Symbol : SymbolConstructor +>hasInstance : symbol +>value : any + + return false; +>false : boolean + } +}; +o.hasOwnProperty(Symbol.hasInstance); +>o.hasOwnProperty(Symbol.hasInstance) : boolean +>o.hasOwnProperty : { (v: string | number | symbol): boolean; (v: string): boolean; } +>o : { a: number; [Symbol.hasInstance](value: any): boolean; } +>hasOwnProperty : { (v: string | number | symbol): boolean; (v: string): boolean; } +>Symbol.hasInstance : symbol +>Symbol : SymbolConstructor +>hasInstance : symbol + +// Using ES6 promise +async function out() { +>out : () => Promise<{}> + + return new Promise(function (resolve, reject) {}); +>new Promise(function (resolve, reject) {}) : Promise<{}> +>Promise : PromiseConstructor +>function (resolve, reject) {} : (resolve: (value?: {} | PromiseLike<{}>) => void, reject: (reason?: any) => void) => void +>resolve : (value?: {} | PromiseLike<{}>) => void +>reject : (reason?: any) => void +} + +declare var console: any; +>console : any + +out().then(() => { +>out().then(() => { console.log("Yea!");}) : Promise +>out().then : { (onfulfilled?: (value: {}) => TResult | PromiseLike, onrejected?: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled?: (value: {}) => TResult | PromiseLike, onrejected?: (reason: any) => void): Promise; } +>out() : Promise<{}> +>out : () => Promise<{}> +>then : { (onfulfilled?: (value: {}) => TResult | PromiseLike, onrejected?: (reason: any) => TResult | PromiseLike): Promise; (onfulfilled?: (value: {}) => TResult | PromiseLike, onrejected?: (reason: any) => void): Promise; } +>() => { console.log("Yea!");} : () => void + + console.log("Yea!"); +>console.log("Yea!") : any +>console.log : any +>console : any +>log : any +>"Yea!" : string + +}); + +// Using Es6 proxy +var t = {} +>t : {} +>{} : {} + +var p = new Proxy(t, {}); +>p : {} +>new Proxy(t, {}) : {} +>Proxy : ProxyConstructor +>t : {} +>{} : {} + +// Using ES6 reflect +Reflect.isExtensible({}); +>Reflect.isExtensible({}) : boolean +>Reflect.isExtensible : (target: any) => boolean +>Reflect : typeof Reflect +>isExtensible : (target: any) => boolean +>{} : {} + +// Using Es6 regexp +var reg = new RegExp("/s"); +>reg : RegExp +>new RegExp("/s") : RegExp +>RegExp : RegExpConstructor +>"/s" : string + +reg.flags; +>reg.flags : string +>reg : RegExp +>flags : string + +// Using ES6 string +var str = "Hello world"; +>str : string +>"Hello world" : string + +str.includes("hello", 0); +>str.includes("hello", 0) : boolean +>str.includes : (searchString: string, position?: number) => boolean +>str : string +>includes : (searchString: string, position?: number) => boolean +>"hello" : string +>0 : number + +// Using ES6 symbol +var s = Symbol(); +>s : symbol +>Symbol() : symbol +>Symbol : SymbolConstructor + +// Using ES6 wellknown-symbol +const o1 = { +>o1 : { [Symbol.hasInstance](value: any): boolean; } +>{ [Symbol.hasInstance](value: any) { return false; }} : { [Symbol.hasInstance](value: any): boolean; } + + [Symbol.hasInstance](value: any) { +>Symbol.hasInstance : symbol +>Symbol : SymbolConstructor +>hasInstance : symbol +>value : any + + return false; +>false : boolean + } +} diff --git a/tests/baselines/reference/modularizeLibrary_TargetES6UsingES6Lib.js b/tests/baselines/reference/modularizeLibrary_TargetES6UsingES6Lib.js new file mode 100644 index 00000000000..137bd1063b8 --- /dev/null +++ b/tests/baselines/reference/modularizeLibrary_TargetES6UsingES6Lib.js @@ -0,0 +1,99 @@ +//// [modularizeLibrary_TargetES6UsingES6Lib.ts] + +// Using Es6 array +function f(x: number, y: number, z: number) { + return Array.from(arguments); +} + +f(1, 2, 3); // no error + +// Using ES6 collection +var m = new Map(); +m.clear(); +// Using ES6 iterable +m.keys(); + +// Using ES6 function +function Baz() { } +Baz.name; + +// Using ES6 math +Math.sign(1); + +// Using ES6 object +var o = { + a: 2, + [Symbol.hasInstance](value: any) { + return false; + } +}; +o.hasOwnProperty(Symbol.hasInstance); + +// Using Es6 proxy +var t = {} +var p = new Proxy(t, {}); + +// Using ES6 reflect +Reflect.isExtensible({}); + +// Using Es6 regexp +var reg = new RegExp("/s"); +reg.flags; + +// Using ES6 string +var str = "Hello world"; +str.includes("hello", 0); + +// Using ES6 symbol +var s = Symbol(); + +// Using ES6 wellknown-symbol +const o1 = { + [Symbol.hasInstance](value: any) { + return false; + } +} + +//// [modularizeLibrary_TargetES6UsingES6Lib.js] +// Using Es6 array +function f(x, y, z) { + return Array.from(arguments); +} +f(1, 2, 3); // no error +// Using ES6 collection +var m = new Map(); +m.clear(); +// Using ES6 iterable +m.keys(); +// Using ES6 function +function Baz() { } +Baz.name; +// Using ES6 math +Math.sign(1); +// Using ES6 object +var o = { + a: 2, + [Symbol.hasInstance](value) { + return false; + } +}; +o.hasOwnProperty(Symbol.hasInstance); +// Using Es6 proxy +var t = {}; +var p = new Proxy(t, {}); +// Using ES6 reflect +Reflect.isExtensible({}); +// Using Es6 regexp +var reg = new RegExp("/s"); +reg.flags; +// Using ES6 string +var str = "Hello world"; +str.includes("hello", 0); +// Using ES6 symbol +var s = Symbol(); +// Using ES6 wellknown-symbol +const o1 = { + [Symbol.hasInstance](value) { + return false; + } +}; diff --git a/tests/baselines/reference/modularizeLibrary_TargetES6UsingES6Lib.symbols b/tests/baselines/reference/modularizeLibrary_TargetES6UsingES6Lib.symbols new file mode 100644 index 00000000000..d3d3e3d1ed6 --- /dev/null +++ b/tests/baselines/reference/modularizeLibrary_TargetES6UsingES6Lib.symbols @@ -0,0 +1,126 @@ +=== tests/cases/compiler/modularizeLibrary_TargetES6UsingES6Lib.ts === + +// Using Es6 array +function f(x: number, y: number, z: number) { +>f : Symbol(f, Decl(modularizeLibrary_TargetES6UsingES6Lib.ts, 0, 0)) +>x : Symbol(x, Decl(modularizeLibrary_TargetES6UsingES6Lib.ts, 2, 11)) +>y : Symbol(y, Decl(modularizeLibrary_TargetES6UsingES6Lib.ts, 2, 21)) +>z : Symbol(z, Decl(modularizeLibrary_TargetES6UsingES6Lib.ts, 2, 32)) + + return Array.from(arguments); +>Array.from : Symbol(ArrayConstructor.from, Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --)) +>Array : Symbol(Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --)) +>from : Symbol(ArrayConstructor.from, Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --)) +>arguments : Symbol(arguments) +} + +f(1, 2, 3); // no error +>f : Symbol(f, Decl(modularizeLibrary_TargetES6UsingES6Lib.ts, 0, 0)) + +// Using ES6 collection +var m = new Map(); +>m : Symbol(m, Decl(modularizeLibrary_TargetES6UsingES6Lib.ts, 9, 3)) +>Map : Symbol(Map, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.collection.d.ts, --, --), Decl(lib.es2015.collection.d.ts, --, --)) + +m.clear(); +>m.clear : Symbol(Map.clear, Decl(lib.es2015.collection.d.ts, --, --)) +>m : Symbol(m, Decl(modularizeLibrary_TargetES6UsingES6Lib.ts, 9, 3)) +>clear : Symbol(Map.clear, Decl(lib.es2015.collection.d.ts, --, --)) + +// Using ES6 iterable +m.keys(); +>m.keys : Symbol(Map.keys, Decl(lib.es2015.iterable.d.ts, --, --)) +>m : Symbol(m, Decl(modularizeLibrary_TargetES6UsingES6Lib.ts, 9, 3)) +>keys : Symbol(Map.keys, Decl(lib.es2015.iterable.d.ts, --, --)) + +// Using ES6 function +function Baz() { } +>Baz : Symbol(Baz, Decl(modularizeLibrary_TargetES6UsingES6Lib.ts, 12, 9)) + +Baz.name; +>Baz.name : Symbol(Function.name, Decl(lib.es2015.core.d.ts, --, --)) +>Baz : Symbol(Baz, Decl(modularizeLibrary_TargetES6UsingES6Lib.ts, 12, 9)) +>name : Symbol(Function.name, Decl(lib.es2015.core.d.ts, --, --)) + +// Using ES6 math +Math.sign(1); +>Math.sign : Symbol(Math.sign, Decl(lib.es2015.core.d.ts, --, --)) +>Math : Symbol(Math, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --)) +>sign : Symbol(Math.sign, Decl(lib.es2015.core.d.ts, --, --)) + +// Using ES6 object +var o = { +>o : Symbol(o, Decl(modularizeLibrary_TargetES6UsingES6Lib.ts, 22, 3)) + + a: 2, +>a : Symbol(a, Decl(modularizeLibrary_TargetES6UsingES6Lib.ts, 22, 9)) + + [Symbol.hasInstance](value: any) { +>Symbol.hasInstance : Symbol(SymbolConstructor.hasInstance, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>hasInstance : Symbol(SymbolConstructor.hasInstance, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>value : Symbol(value, Decl(modularizeLibrary_TargetES6UsingES6Lib.ts, 24, 25)) + + return false; + } +}; +o.hasOwnProperty(Symbol.hasInstance); +>o.hasOwnProperty : Symbol(Object.hasOwnProperty, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --)) +>o : Symbol(o, Decl(modularizeLibrary_TargetES6UsingES6Lib.ts, 22, 3)) +>hasOwnProperty : Symbol(Object.hasOwnProperty, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --)) +>Symbol.hasInstance : Symbol(SymbolConstructor.hasInstance, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>hasInstance : Symbol(SymbolConstructor.hasInstance, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) + +// Using Es6 proxy +var t = {} +>t : Symbol(t, Decl(modularizeLibrary_TargetES6UsingES6Lib.ts, 31, 3)) + +var p = new Proxy(t, {}); +>p : Symbol(p, Decl(modularizeLibrary_TargetES6UsingES6Lib.ts, 32, 3)) +>Proxy : Symbol(Proxy, Decl(lib.es2015.proxy.d.ts, --, --)) +>t : Symbol(t, Decl(modularizeLibrary_TargetES6UsingES6Lib.ts, 31, 3)) + +// Using ES6 reflect +Reflect.isExtensible({}); +>Reflect.isExtensible : Symbol(Reflect.isExtensible, Decl(lib.es2015.reflect.d.ts, --, --)) +>Reflect : Symbol(Reflect, Decl(lib.es2015.reflect.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>isExtensible : Symbol(Reflect.isExtensible, Decl(lib.es2015.reflect.d.ts, --, --)) + +// Using Es6 regexp +var reg = new RegExp("/s"); +>reg : Symbol(reg, Decl(modularizeLibrary_TargetES6UsingES6Lib.ts, 38, 3)) +>RegExp : Symbol(RegExp, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --)) + +reg.flags; +>reg.flags : Symbol(RegExp.flags, Decl(lib.es2015.core.d.ts, --, --)) +>reg : Symbol(reg, Decl(modularizeLibrary_TargetES6UsingES6Lib.ts, 38, 3)) +>flags : Symbol(RegExp.flags, Decl(lib.es2015.core.d.ts, --, --)) + +// Using ES6 string +var str = "Hello world"; +>str : Symbol(str, Decl(modularizeLibrary_TargetES6UsingES6Lib.ts, 42, 3)) + +str.includes("hello", 0); +>str.includes : Symbol(String.includes, Decl(lib.es2015.core.d.ts, --, --)) +>str : Symbol(str, Decl(modularizeLibrary_TargetES6UsingES6Lib.ts, 42, 3)) +>includes : Symbol(String.includes, Decl(lib.es2015.core.d.ts, --, --)) + +// Using ES6 symbol +var s = Symbol(); +>s : Symbol(s, Decl(modularizeLibrary_TargetES6UsingES6Lib.ts, 46, 3)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) + +// Using ES6 wellknown-symbol +const o1 = { +>o1 : Symbol(o1, Decl(modularizeLibrary_TargetES6UsingES6Lib.ts, 49, 5)) + + [Symbol.hasInstance](value: any) { +>Symbol.hasInstance : Symbol(SymbolConstructor.hasInstance, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>hasInstance : Symbol(SymbolConstructor.hasInstance, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>value : Symbol(value, Decl(modularizeLibrary_TargetES6UsingES6Lib.ts, 50, 25)) + + return false; + } +} diff --git a/tests/baselines/reference/modularizeLibrary_TargetES6UsingES6Lib.types b/tests/baselines/reference/modularizeLibrary_TargetES6UsingES6Lib.types new file mode 100644 index 00000000000..7af40d3684c --- /dev/null +++ b/tests/baselines/reference/modularizeLibrary_TargetES6UsingES6Lib.types @@ -0,0 +1,154 @@ +=== tests/cases/compiler/modularizeLibrary_TargetES6UsingES6Lib.ts === + +// Using Es6 array +function f(x: number, y: number, z: number) { +>f : (x: number, y: number, z: number) => any[] +>x : number +>y : number +>z : number + + return Array.from(arguments); +>Array.from(arguments) : any[] +>Array.from : { (iterable: Iterable, mapfn: (v: T, k: number) => U, thisArg?: any): U[]; (iterable: Iterable): T[]; (arrayLike: ArrayLike, mapfn: (v: T, k: number) => U, thisArg?: any): U[]; (arrayLike: ArrayLike): T[]; } +>Array : ArrayConstructor +>from : { (iterable: Iterable, mapfn: (v: T, k: number) => U, thisArg?: any): U[]; (iterable: Iterable): T[]; (arrayLike: ArrayLike, mapfn: (v: T, k: number) => U, thisArg?: any): U[]; (arrayLike: ArrayLike): T[]; } +>arguments : IArguments +} + +f(1, 2, 3); // no error +>f(1, 2, 3) : any[] +>f : (x: number, y: number, z: number) => any[] +>1 : number +>2 : number +>3 : number + +// Using ES6 collection +var m = new Map(); +>m : Map +>new Map() : Map +>Map : MapConstructor + +m.clear(); +>m.clear() : void +>m.clear : () => void +>m : Map +>clear : () => void + +// Using ES6 iterable +m.keys(); +>m.keys() : IterableIterator +>m.keys : () => IterableIterator +>m : Map +>keys : () => IterableIterator + +// Using ES6 function +function Baz() { } +>Baz : () => void + +Baz.name; +>Baz.name : string +>Baz : () => void +>name : string + +// Using ES6 math +Math.sign(1); +>Math.sign(1) : number +>Math.sign : (x: number) => number +>Math : Math +>sign : (x: number) => number +>1 : number + +// Using ES6 object +var o = { +>o : { a: number; [Symbol.hasInstance](value: any): boolean; } +>{ a: 2, [Symbol.hasInstance](value: any) { return false; }} : { a: number; [Symbol.hasInstance](value: any): boolean; } + + a: 2, +>a : number +>2 : number + + [Symbol.hasInstance](value: any) { +>Symbol.hasInstance : symbol +>Symbol : SymbolConstructor +>hasInstance : symbol +>value : any + + return false; +>false : boolean + } +}; +o.hasOwnProperty(Symbol.hasInstance); +>o.hasOwnProperty(Symbol.hasInstance) : boolean +>o.hasOwnProperty : { (v: string): boolean; (v: string | number | symbol): boolean; } +>o : { a: number; [Symbol.hasInstance](value: any): boolean; } +>hasOwnProperty : { (v: string): boolean; (v: string | number | symbol): boolean; } +>Symbol.hasInstance : symbol +>Symbol : SymbolConstructor +>hasInstance : symbol + +// Using Es6 proxy +var t = {} +>t : {} +>{} : {} + +var p = new Proxy(t, {}); +>p : {} +>new Proxy(t, {}) : {} +>Proxy : ProxyConstructor +>t : {} +>{} : {} + +// Using ES6 reflect +Reflect.isExtensible({}); +>Reflect.isExtensible({}) : boolean +>Reflect.isExtensible : (target: any) => boolean +>Reflect : typeof Reflect +>isExtensible : (target: any) => boolean +>{} : {} + +// Using Es6 regexp +var reg = new RegExp("/s"); +>reg : RegExp +>new RegExp("/s") : RegExp +>RegExp : RegExpConstructor +>"/s" : string + +reg.flags; +>reg.flags : string +>reg : RegExp +>flags : string + +// Using ES6 string +var str = "Hello world"; +>str : string +>"Hello world" : string + +str.includes("hello", 0); +>str.includes("hello", 0) : boolean +>str.includes : (searchString: string, position?: number) => boolean +>str : string +>includes : (searchString: string, position?: number) => boolean +>"hello" : string +>0 : number + +// Using ES6 symbol +var s = Symbol(); +>s : symbol +>Symbol() : symbol +>Symbol : SymbolConstructor + +// Using ES6 wellknown-symbol +const o1 = { +>o1 : { [Symbol.hasInstance](value: any): boolean; } +>{ [Symbol.hasInstance](value: any) { return false; }} : { [Symbol.hasInstance](value: any): boolean; } + + [Symbol.hasInstance](value: any) { +>Symbol.hasInstance : symbol +>Symbol : SymbolConstructor +>hasInstance : symbol +>value : any + + return false; +>false : boolean + } +} diff --git a/tests/baselines/reference/modularizeLibrary_UsingES5LibAndES6ArrayLib.js b/tests/baselines/reference/modularizeLibrary_UsingES5LibAndES6ArrayLib.js new file mode 100644 index 00000000000..29e0afc711c --- /dev/null +++ b/tests/baselines/reference/modularizeLibrary_UsingES5LibAndES6ArrayLib.js @@ -0,0 +1,15 @@ +//// [modularizeLibrary_UsingES5LibAndES6ArrayLib.ts] + +// No error +function f(x: number, y: number, z: number) { + return Array.from(arguments); +} + +f(1, 2, 3); + +//// [modularizeLibrary_UsingES5LibAndES6ArrayLib.js] +// No error +function f(x, y, z) { + return Array.from(arguments); +} +f(1, 2, 3); diff --git a/tests/baselines/reference/modularizeLibrary_UsingES5LibAndES6ArrayLib.symbols b/tests/baselines/reference/modularizeLibrary_UsingES5LibAndES6ArrayLib.symbols new file mode 100644 index 00000000000..ce03d4cfc59 --- /dev/null +++ b/tests/baselines/reference/modularizeLibrary_UsingES5LibAndES6ArrayLib.symbols @@ -0,0 +1,19 @@ +=== tests/cases/compiler/modularizeLibrary_UsingES5LibAndES6ArrayLib.ts === + +// No error +function f(x: number, y: number, z: number) { +>f : Symbol(f, Decl(modularizeLibrary_UsingES5LibAndES6ArrayLib.ts, 0, 0)) +>x : Symbol(x, Decl(modularizeLibrary_UsingES5LibAndES6ArrayLib.ts, 2, 11)) +>y : Symbol(y, Decl(modularizeLibrary_UsingES5LibAndES6ArrayLib.ts, 2, 21)) +>z : Symbol(z, Decl(modularizeLibrary_UsingES5LibAndES6ArrayLib.ts, 2, 32)) + + return Array.from(arguments); +>Array.from : Symbol(ArrayConstructor.from, Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --)) +>Array : Symbol(Array, Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>from : Symbol(ArrayConstructor.from, Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --)) +>arguments : Symbol(arguments) +} + +f(1, 2, 3); +>f : Symbol(f, Decl(modularizeLibrary_UsingES5LibAndES6ArrayLib.ts, 0, 0)) + diff --git a/tests/baselines/reference/modularizeLibrary_UsingES5LibAndES6ArrayLib.types b/tests/baselines/reference/modularizeLibrary_UsingES5LibAndES6ArrayLib.types new file mode 100644 index 00000000000..d17a6fcbcbb --- /dev/null +++ b/tests/baselines/reference/modularizeLibrary_UsingES5LibAndES6ArrayLib.types @@ -0,0 +1,24 @@ +=== tests/cases/compiler/modularizeLibrary_UsingES5LibAndES6ArrayLib.ts === + +// No error +function f(x: number, y: number, z: number) { +>f : (x: number, y: number, z: number) => any[] +>x : number +>y : number +>z : number + + return Array.from(arguments); +>Array.from(arguments) : any[] +>Array.from : { (arrayLike: ArrayLike, mapfn: (v: T, k: number) => U, thisArg?: any): U[]; (arrayLike: ArrayLike): T[]; } +>Array : ArrayConstructor +>from : { (arrayLike: ArrayLike, mapfn: (v: T, k: number) => U, thisArg?: any): U[]; (arrayLike: ArrayLike): T[]; } +>arguments : IArguments +} + +f(1, 2, 3); +>f(1, 2, 3) : any[] +>f : (x: number, y: number, z: number) => any[] +>1 : number +>2 : number +>3 : number + diff --git a/tests/baselines/reference/modularizeLibrary_UsingES5LibAndES6FeatureLibs.js b/tests/baselines/reference/modularizeLibrary_UsingES5LibAndES6FeatureLibs.js new file mode 100644 index 00000000000..892bc688524 --- /dev/null +++ b/tests/baselines/reference/modularizeLibrary_UsingES5LibAndES6FeatureLibs.js @@ -0,0 +1,27 @@ +//// [modularizeLibrary_UsingES5LibAndES6FeatureLibs.ts] + +var s = Symbol(); +var t = {}; +var p = new Proxy(t, {}); + +Reflect.ownKeys({}); + +function* idGen() { + let i = 10; + while (i < 20) { + yield i + 2; + } +} + + +//// [modularizeLibrary_UsingES5LibAndES6FeatureLibs.js] +var s = Symbol(); +var t = {}; +var p = new Proxy(t, {}); +Reflect.ownKeys({}); +function* idGen() { + let i = 10; + while (i < 20) { + yield i + 2; + } +} diff --git a/tests/baselines/reference/modularizeLibrary_UsingES5LibAndES6FeatureLibs.symbols b/tests/baselines/reference/modularizeLibrary_UsingES5LibAndES6FeatureLibs.symbols new file mode 100644 index 00000000000..e6f7584c471 --- /dev/null +++ b/tests/baselines/reference/modularizeLibrary_UsingES5LibAndES6FeatureLibs.symbols @@ -0,0 +1,33 @@ +=== tests/cases/compiler/modularizeLibrary_UsingES5LibAndES6FeatureLibs.ts === + +var s = Symbol(); +>s : Symbol(s, Decl(modularizeLibrary_UsingES5LibAndES6FeatureLibs.ts, 1, 3)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) + +var t = {}; +>t : Symbol(t, Decl(modularizeLibrary_UsingES5LibAndES6FeatureLibs.ts, 2, 3)) + +var p = new Proxy(t, {}); +>p : Symbol(p, Decl(modularizeLibrary_UsingES5LibAndES6FeatureLibs.ts, 3, 3)) +>Proxy : Symbol(Proxy, Decl(lib.es2015.proxy.d.ts, --, --)) +>t : Symbol(t, Decl(modularizeLibrary_UsingES5LibAndES6FeatureLibs.ts, 2, 3)) + +Reflect.ownKeys({}); +>Reflect.ownKeys : Symbol(Reflect.ownKeys, Decl(lib.es2015.reflect.d.ts, --, --)) +>Reflect : Symbol(Reflect, Decl(lib.es2015.reflect.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>ownKeys : Symbol(Reflect.ownKeys, Decl(lib.es2015.reflect.d.ts, --, --)) + +function* idGen() { +>idGen : Symbol(idGen, Decl(modularizeLibrary_UsingES5LibAndES6FeatureLibs.ts, 5, 20)) + + let i = 10; +>i : Symbol(i, Decl(modularizeLibrary_UsingES5LibAndES6FeatureLibs.ts, 8, 7)) + + while (i < 20) { +>i : Symbol(i, Decl(modularizeLibrary_UsingES5LibAndES6FeatureLibs.ts, 8, 7)) + + yield i + 2; +>i : Symbol(i, Decl(modularizeLibrary_UsingES5LibAndES6FeatureLibs.ts, 8, 7)) + } +} + diff --git a/tests/baselines/reference/modularizeLibrary_UsingES5LibAndES6FeatureLibs.types b/tests/baselines/reference/modularizeLibrary_UsingES5LibAndES6FeatureLibs.types new file mode 100644 index 00000000000..820c2f6dc8a --- /dev/null +++ b/tests/baselines/reference/modularizeLibrary_UsingES5LibAndES6FeatureLibs.types @@ -0,0 +1,45 @@ +=== tests/cases/compiler/modularizeLibrary_UsingES5LibAndES6FeatureLibs.ts === + +var s = Symbol(); +>s : symbol +>Symbol() : symbol +>Symbol : SymbolConstructor + +var t = {}; +>t : {} +>{} : {} + +var p = new Proxy(t, {}); +>p : {} +>new Proxy(t, {}) : {} +>Proxy : ProxyConstructor +>t : {} +>{} : {} + +Reflect.ownKeys({}); +>Reflect.ownKeys({}) : (string | number | symbol)[] +>Reflect.ownKeys : (target: any) => (string | number | symbol)[] +>Reflect : typeof Reflect +>ownKeys : (target: any) => (string | number | symbol)[] +>{} : {} + +function* idGen() { +>idGen : () => IterableIterator + + let i = 10; +>i : number +>10 : number + + while (i < 20) { +>i < 20 : boolean +>i : number +>20 : number + + yield i + 2; +>yield i + 2 : any +>i + 2 : number +>i : number +>2 : number + } +} + diff --git a/tests/baselines/reference/modularizeLibrary_UsingES5LibES6ArrayLibES6WellknownSymbolLib.js b/tests/baselines/reference/modularizeLibrary_UsingES5LibES6ArrayLibES6WellknownSymbolLib.js new file mode 100644 index 00000000000..7755fc72ce8 --- /dev/null +++ b/tests/baselines/reference/modularizeLibrary_UsingES5LibES6ArrayLibES6WellknownSymbolLib.js @@ -0,0 +1,17 @@ +//// [modularizeLibrary_UsingES5LibES6ArrayLibES6WellknownSymbolLib.ts] + +function f(x: number, y: number, z: number) { + return Array.from(arguments); +} + +f(1, 2, 3); // no error +let a = ['c', 'd']; +a[Symbol.isConcatSpreadable] = false; + +//// [modularizeLibrary_UsingES5LibES6ArrayLibES6WellknownSymbolLib.js] +function f(x, y, z) { + return Array.from(arguments); +} +f(1, 2, 3); // no error +var a = ['c', 'd']; +a[Symbol.isConcatSpreadable] = false; diff --git a/tests/baselines/reference/modularizeLibrary_UsingES5LibES6ArrayLibES6WellknownSymbolLib.symbols b/tests/baselines/reference/modularizeLibrary_UsingES5LibES6ArrayLibES6WellknownSymbolLib.symbols new file mode 100644 index 00000000000..0ed5ec38513 --- /dev/null +++ b/tests/baselines/reference/modularizeLibrary_UsingES5LibES6ArrayLibES6WellknownSymbolLib.symbols @@ -0,0 +1,27 @@ +=== tests/cases/compiler/modularizeLibrary_UsingES5LibES6ArrayLibES6WellknownSymbolLib.ts === + +function f(x: number, y: number, z: number) { +>f : Symbol(f, Decl(modularizeLibrary_UsingES5LibES6ArrayLibES6WellknownSymbolLib.ts, 0, 0)) +>x : Symbol(x, Decl(modularizeLibrary_UsingES5LibES6ArrayLibES6WellknownSymbolLib.ts, 1, 11)) +>y : Symbol(y, Decl(modularizeLibrary_UsingES5LibES6ArrayLibES6WellknownSymbolLib.ts, 1, 21)) +>z : Symbol(z, Decl(modularizeLibrary_UsingES5LibES6ArrayLibES6WellknownSymbolLib.ts, 1, 32)) + + return Array.from(arguments); +>Array.from : Symbol(ArrayConstructor.from, Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --)) +>Array : Symbol(Array, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>from : Symbol(ArrayConstructor.from, Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --)) +>arguments : Symbol(arguments) +} + +f(1, 2, 3); // no error +>f : Symbol(f, Decl(modularizeLibrary_UsingES5LibES6ArrayLibES6WellknownSymbolLib.ts, 0, 0)) + +let a = ['c', 'd']; +>a : Symbol(a, Decl(modularizeLibrary_UsingES5LibES6ArrayLibES6WellknownSymbolLib.ts, 6, 3)) + +a[Symbol.isConcatSpreadable] = false; +>a : Symbol(a, Decl(modularizeLibrary_UsingES5LibES6ArrayLibES6WellknownSymbolLib.ts, 6, 3)) +>Symbol.isConcatSpreadable : Symbol(SymbolConstructor.isConcatSpreadable, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>isConcatSpreadable : Symbol(SymbolConstructor.isConcatSpreadable, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) + diff --git a/tests/baselines/reference/modularizeLibrary_UsingES5LibES6ArrayLibES6WellknownSymbolLib.types b/tests/baselines/reference/modularizeLibrary_UsingES5LibES6ArrayLibES6WellknownSymbolLib.types new file mode 100644 index 00000000000..3ae08c79fd4 --- /dev/null +++ b/tests/baselines/reference/modularizeLibrary_UsingES5LibES6ArrayLibES6WellknownSymbolLib.types @@ -0,0 +1,38 @@ +=== tests/cases/compiler/modularizeLibrary_UsingES5LibES6ArrayLibES6WellknownSymbolLib.ts === + +function f(x: number, y: number, z: number) { +>f : (x: number, y: number, z: number) => any[] +>x : number +>y : number +>z : number + + return Array.from(arguments); +>Array.from(arguments) : any[] +>Array.from : { (arrayLike: ArrayLike, mapfn: (v: T, k: number) => U, thisArg?: any): U[]; (arrayLike: ArrayLike): T[]; } +>Array : ArrayConstructor +>from : { (arrayLike: ArrayLike, mapfn: (v: T, k: number) => U, thisArg?: any): U[]; (arrayLike: ArrayLike): T[]; } +>arguments : IArguments +} + +f(1, 2, 3); // no error +>f(1, 2, 3) : any[] +>f : (x: number, y: number, z: number) => any[] +>1 : number +>2 : number +>3 : number + +let a = ['c', 'd']; +>a : string[] +>['c', 'd'] : string[] +>'c' : string +>'d' : string + +a[Symbol.isConcatSpreadable] = false; +>a[Symbol.isConcatSpreadable] = false : boolean +>a[Symbol.isConcatSpreadable] : any +>a : string[] +>Symbol.isConcatSpreadable : symbol +>Symbol : SymbolConstructor +>isConcatSpreadable : symbol +>false : boolean + diff --git a/tests/baselines/reference/noImplicitAnyDestructuringInPrivateMethod.js b/tests/baselines/reference/noImplicitAnyDestructuringInPrivateMethod.js new file mode 100644 index 00000000000..2d7d930703c --- /dev/null +++ b/tests/baselines/reference/noImplicitAnyDestructuringInPrivateMethod.js @@ -0,0 +1,34 @@ +//// [noImplicitAnyDestructuringInPrivateMethod.ts] +type Arg = { + a: number; +}; +export class Bar { + private bar({ a, }: Arg): number { + return a; + } +} +export declare class Bar2 { + private bar({ a, }); +} + +//// [noImplicitAnyDestructuringInPrivateMethod.js] +"use strict"; +var Bar = (function () { + function Bar() { + } + Bar.prototype.bar = function (_a) { + var a = _a.a; + return a; + }; + return Bar; +}()); +exports.Bar = Bar; + + +//// [noImplicitAnyDestructuringInPrivateMethod.d.ts] +export declare class Bar { + private bar({a}); +} +export declare class Bar2 { + private bar({a}); +} diff --git a/tests/baselines/reference/noImplicitAnyDestructuringInPrivateMethod.symbols b/tests/baselines/reference/noImplicitAnyDestructuringInPrivateMethod.symbols new file mode 100644 index 00000000000..0b1ce5cfe48 --- /dev/null +++ b/tests/baselines/reference/noImplicitAnyDestructuringInPrivateMethod.symbols @@ -0,0 +1,27 @@ +=== tests/cases/compiler/noImplicitAnyDestructuringInPrivateMethod.ts === +type Arg = { +>Arg : Symbol(Arg, Decl(noImplicitAnyDestructuringInPrivateMethod.ts, 0, 0)) + + a: number; +>a : Symbol(a, Decl(noImplicitAnyDestructuringInPrivateMethod.ts, 0, 12)) + +}; +export class Bar { +>Bar : Symbol(Bar, Decl(noImplicitAnyDestructuringInPrivateMethod.ts, 2, 2)) + + private bar({ a, }: Arg): number { +>bar : Symbol(Bar.bar, Decl(noImplicitAnyDestructuringInPrivateMethod.ts, 3, 18)) +>a : Symbol(a, Decl(noImplicitAnyDestructuringInPrivateMethod.ts, 4, 17)) +>Arg : Symbol(Arg, Decl(noImplicitAnyDestructuringInPrivateMethod.ts, 0, 0)) + + return a; +>a : Symbol(a, Decl(noImplicitAnyDestructuringInPrivateMethod.ts, 4, 17)) + } +} +export declare class Bar2 { +>Bar2 : Symbol(Bar2, Decl(noImplicitAnyDestructuringInPrivateMethod.ts, 7, 1)) + + private bar({ a, }); +>bar : Symbol(Bar2.bar, Decl(noImplicitAnyDestructuringInPrivateMethod.ts, 8, 27)) +>a : Symbol(a, Decl(noImplicitAnyDestructuringInPrivateMethod.ts, 9, 17)) +} diff --git a/tests/baselines/reference/noImplicitAnyDestructuringInPrivateMethod.types b/tests/baselines/reference/noImplicitAnyDestructuringInPrivateMethod.types new file mode 100644 index 00000000000..a399e59e3c3 --- /dev/null +++ b/tests/baselines/reference/noImplicitAnyDestructuringInPrivateMethod.types @@ -0,0 +1,27 @@ +=== tests/cases/compiler/noImplicitAnyDestructuringInPrivateMethod.ts === +type Arg = { +>Arg : { a: number; } + + a: number; +>a : number + +}; +export class Bar { +>Bar : Bar + + private bar({ a, }: Arg): number { +>bar : ({a}: { a: number; }) => number +>a : number +>Arg : { a: number; } + + return a; +>a : number + } +} +export declare class Bar2 { +>Bar2 : Bar2 + + private bar({ a, }); +>bar : ({a}: { a: any; }) => any +>a : any +} diff --git a/tests/baselines/reference/noImplicitAnyDestructuringParameterDeclaration.errors.txt b/tests/baselines/reference/noImplicitAnyDestructuringParameterDeclaration.errors.txt new file mode 100644 index 00000000000..a15f9c07cd3 --- /dev/null +++ b/tests/baselines/reference/noImplicitAnyDestructuringParameterDeclaration.errors.txt @@ -0,0 +1,55 @@ +tests/cases/compiler/noImplicitAnyDestructuringParameterDeclaration.ts(1,14): error TS7031: Binding element 'a' implicitly has an 'any' type. +tests/cases/compiler/noImplicitAnyDestructuringParameterDeclaration.ts(1,19): error TS7031: Binding element 'b' implicitly has an 'any' type. +tests/cases/compiler/noImplicitAnyDestructuringParameterDeclaration.ts(1,23): error TS7006: Parameter 'c' implicitly has an 'any' type. +tests/cases/compiler/noImplicitAnyDestructuringParameterDeclaration.ts(1,26): error TS7006: Parameter 'd' implicitly has an 'any' type. +tests/cases/compiler/noImplicitAnyDestructuringParameterDeclaration.ts(3,14): error TS7031: Binding element 'a' implicitly has an 'any' type. +tests/cases/compiler/noImplicitAnyDestructuringParameterDeclaration.ts(3,31): error TS7031: Binding element 'b' implicitly has an 'any' type. +tests/cases/compiler/noImplicitAnyDestructuringParameterDeclaration.ts(3,42): error TS7006: Parameter 'c' implicitly has an 'any' type. +tests/cases/compiler/noImplicitAnyDestructuringParameterDeclaration.ts(3,57): error TS7006: Parameter 'd' implicitly has an 'any' type. +tests/cases/compiler/noImplicitAnyDestructuringParameterDeclaration.ts(7,20): error TS7008: Member 'b' implicitly has an 'any' type. +tests/cases/compiler/noImplicitAnyDestructuringParameterDeclaration.ts(7,30): error TS7008: Member 'b' implicitly has an 'any' type. +tests/cases/compiler/noImplicitAnyDestructuringParameterDeclaration.ts(9,14): error TS7031: Binding element 'a1' implicitly has an 'any' type. +tests/cases/compiler/noImplicitAnyDestructuringParameterDeclaration.ts(9,34): error TS7031: Binding element 'b1' implicitly has an 'any' type. +tests/cases/compiler/noImplicitAnyDestructuringParameterDeclaration.ts(9,54): error TS7006: Parameter 'c1' implicitly has an 'any' type. +tests/cases/compiler/noImplicitAnyDestructuringParameterDeclaration.ts(9,70): error TS7006: Parameter 'd1' implicitly has an 'any' type. + + +==== tests/cases/compiler/noImplicitAnyDestructuringParameterDeclaration.ts (14 errors) ==== + function f1([a], {b}, c, d) { // error + ~ +!!! error TS7031: Binding element 'a' implicitly has an 'any' type. + ~ +!!! error TS7031: Binding element 'b' implicitly has an 'any' type. + ~ +!!! error TS7006: Parameter 'c' implicitly has an 'any' type. + ~ +!!! error TS7006: Parameter 'd' implicitly has an 'any' type. + } + function f2([a = undefined], {b = null}, c = undefined, d = null) { // error + ~ +!!! error TS7031: Binding element 'a' implicitly has an 'any' type. + ~ +!!! error TS7031: Binding element 'b' implicitly has an 'any' type. + ~~~~~~~~~~~~~ +!!! error TS7006: Parameter 'c' implicitly has an 'any' type. + ~~~~~~~~ +!!! error TS7006: Parameter 'd' implicitly has an 'any' type. + } + function f3([a]: [any], {b}: { b: any }, c: any, d: any) { + } + function f4({b}: { b }, x: { b }) { // error in type instead + ~ +!!! error TS7008: Member 'b' implicitly has an 'any' type. + ~ +!!! error TS7008: Member 'b' implicitly has an 'any' type. + } + function f5([a1] = [undefined], {b1} = { b1: null }, c1 = undefined, d1 = null) { // error + ~~ +!!! error TS7031: Binding element 'a1' implicitly has an 'any' type. + ~~ +!!! error TS7031: Binding element 'b1' implicitly has an 'any' type. + ~~~~~~~~~~~~~~ +!!! error TS7006: Parameter 'c1' implicitly has an 'any' type. + ~~~~~~~~~ +!!! error TS7006: Parameter 'd1' implicitly has an 'any' type. + } \ No newline at end of file diff --git a/tests/baselines/reference/noImplicitAnyDestructuringParameterDeclaration.js b/tests/baselines/reference/noImplicitAnyDestructuringParameterDeclaration.js new file mode 100644 index 00000000000..d587f8789a9 --- /dev/null +++ b/tests/baselines/reference/noImplicitAnyDestructuringParameterDeclaration.js @@ -0,0 +1,36 @@ +//// [noImplicitAnyDestructuringParameterDeclaration.ts] +function f1([a], {b}, c, d) { // error +} +function f2([a = undefined], {b = null}, c = undefined, d = null) { // error +} +function f3([a]: [any], {b}: { b: any }, c: any, d: any) { +} +function f4({b}: { b }, x: { b }) { // error in type instead +} +function f5([a1] = [undefined], {b1} = { b1: null }, c1 = undefined, d1 = null) { // error +} + +//// [noImplicitAnyDestructuringParameterDeclaration.js] +function f1(_a, _b, c, d) { + var a = _a[0]; + var b = _b.b; +} +function f2(_a, _b, c, d) { + var _c = _a[0], a = _c === void 0 ? undefined : _c; + var _d = _b.b, b = _d === void 0 ? null : _d; + if (c === void 0) { c = undefined; } + if (d === void 0) { d = null; } +} +function f3(_a, _b, c, d) { + var a = _a[0]; + var b = _b.b; +} +function f4(_a, x) { + var b = _a.b; +} +function f5(_a, _b, c1, d1) { + var a1 = (_a === void 0 ? [undefined] : _a)[0]; + var b1 = (_b === void 0 ? { b1: null } : _b).b1; + if (c1 === void 0) { c1 = undefined; } + if (d1 === void 0) { d1 = null; } +} diff --git a/tests/baselines/reference/noImplicitAnyDestructuringVarDeclaration.errors.txt b/tests/baselines/reference/noImplicitAnyDestructuringVarDeclaration.errors.txt new file mode 100644 index 00000000000..10d6b05c622 --- /dev/null +++ b/tests/baselines/reference/noImplicitAnyDestructuringVarDeclaration.errors.txt @@ -0,0 +1,69 @@ +tests/cases/compiler/noImplicitAnyDestructuringVarDeclaration.ts(1,5): error TS1182: A destructuring declaration must have an initializer. +tests/cases/compiler/noImplicitAnyDestructuringVarDeclaration.ts(1,6): error TS7031: Binding element 'a' implicitly has an 'any' type. +tests/cases/compiler/noImplicitAnyDestructuringVarDeclaration.ts(1,10): error TS1182: A destructuring declaration must have an initializer. +tests/cases/compiler/noImplicitAnyDestructuringVarDeclaration.ts(1,11): error TS7031: Binding element 'b' implicitly has an 'any' type. +tests/cases/compiler/noImplicitAnyDestructuringVarDeclaration.ts(1,15): error TS7005: Variable 'c' implicitly has an 'any' type. +tests/cases/compiler/noImplicitAnyDestructuringVarDeclaration.ts(1,18): error TS7005: Variable 'd' implicitly has an 'any' type. +tests/cases/compiler/noImplicitAnyDestructuringVarDeclaration.ts(3,5): error TS1182: A destructuring declaration must have an initializer. +tests/cases/compiler/noImplicitAnyDestructuringVarDeclaration.ts(3,6): error TS7031: Binding element 'a1' implicitly has an 'any' type. +tests/cases/compiler/noImplicitAnyDestructuringVarDeclaration.ts(3,23): error TS1182: A destructuring declaration must have an initializer. +tests/cases/compiler/noImplicitAnyDestructuringVarDeclaration.ts(3,24): error TS7031: Binding element 'b1' implicitly has an 'any' type. +tests/cases/compiler/noImplicitAnyDestructuringVarDeclaration.ts(3,36): error TS7005: Variable 'c1' implicitly has an 'any' type. +tests/cases/compiler/noImplicitAnyDestructuringVarDeclaration.ts(3,52): error TS7005: Variable 'd1' implicitly has an 'any' type. +tests/cases/compiler/noImplicitAnyDestructuringVarDeclaration.ts(5,5): error TS1182: A destructuring declaration must have an initializer. +tests/cases/compiler/noImplicitAnyDestructuringVarDeclaration.ts(5,18): error TS1182: A destructuring declaration must have an initializer. +tests/cases/compiler/noImplicitAnyDestructuringVarDeclaration.ts(7,5): error TS1182: A destructuring declaration must have an initializer. +tests/cases/compiler/noImplicitAnyDestructuringVarDeclaration.ts(7,13): error TS7008: Member 'b3' implicitly has an 'any' type. +tests/cases/compiler/noImplicitAnyDestructuringVarDeclaration.ts(7,25): error TS7008: Member 'b3' implicitly has an 'any' type. +tests/cases/compiler/noImplicitAnyDestructuringVarDeclaration.ts(9,6): error TS7031: Binding element 'a1' implicitly has an 'any' type. +tests/cases/compiler/noImplicitAnyDestructuringVarDeclaration.ts(9,26): error TS7031: Binding element 'b1' implicitly has an 'any' type. + + +==== tests/cases/compiler/noImplicitAnyDestructuringVarDeclaration.ts (19 errors) ==== + var [a], {b}, c, d; // error + ~~~ +!!! error TS1182: A destructuring declaration must have an initializer. + ~ +!!! error TS7031: Binding element 'a' implicitly has an 'any' type. + ~~~ +!!! error TS1182: A destructuring declaration must have an initializer. + ~ +!!! error TS7031: Binding element 'b' implicitly has an 'any' type. + ~ +!!! error TS7005: Variable 'c' implicitly has an 'any' type. + ~ +!!! error TS7005: Variable 'd' implicitly has an 'any' type. + + var [a1 = undefined], {b1 = null}, c1 = undefined, d1 = null; // error + ~~~~~~~~~~~~~~~~ +!!! error TS1182: A destructuring declaration must have an initializer. + ~~ +!!! error TS7031: Binding element 'a1' implicitly has an 'any' type. + ~~~~~~~~~~~ +!!! error TS1182: A destructuring declaration must have an initializer. + ~~ +!!! error TS7031: Binding element 'b1' implicitly has an 'any' type. + ~~ +!!! error TS7005: Variable 'c1' implicitly has an 'any' type. + ~~ +!!! error TS7005: Variable 'd1' implicitly has an 'any' type. + + var [a2]: [any], {b2}: { b2: any }, c2: any, d2: any; + ~~~~ +!!! error TS1182: A destructuring declaration must have an initializer. + ~~~~ +!!! error TS1182: A destructuring declaration must have an initializer. + + var {b3}: { b3 }, c3: { b3 }; // error in type instead + ~~~~ +!!! error TS1182: A destructuring declaration must have an initializer. + ~~ +!!! error TS7008: Member 'b3' implicitly has an 'any' type. + ~~ +!!! error TS7008: Member 'b3' implicitly has an 'any' type. + + var [a1] = [undefined], {b1} = { b1: null }, c1 = undefined, d1 = null; // error + ~~ +!!! error TS7031: Binding element 'a1' implicitly has an 'any' type. + ~~ +!!! error TS7031: Binding element 'b1' implicitly has an 'any' type. \ No newline at end of file diff --git a/tests/baselines/reference/noImplicitAnyDestructuringVarDeclaration.js b/tests/baselines/reference/noImplicitAnyDestructuringVarDeclaration.js new file mode 100644 index 00000000000..cbc15c01e9e --- /dev/null +++ b/tests/baselines/reference/noImplicitAnyDestructuringVarDeclaration.js @@ -0,0 +1,17 @@ +//// [noImplicitAnyDestructuringVarDeclaration.ts] +var [a], {b}, c, d; // error + +var [a1 = undefined], {b1 = null}, c1 = undefined, d1 = null; // error + +var [a2]: [any], {b2}: { b2: any }, c2: any, d2: any; + +var {b3}: { b3 }, c3: { b3 }; // error in type instead + +var [a1] = [undefined], {b1} = { b1: null }, c1 = undefined, d1 = null; // error + +//// [noImplicitAnyDestructuringVarDeclaration.js] +var a = (void 0)[0], b = (void 0).b, c, d; // error +var _a = (void 0)[0], a1 = _a === void 0 ? undefined : _a, _b = (void 0).b1, b1 = _b === void 0 ? null : _b, c1 = undefined, d1 = null; // error +var a2 = (void 0)[0], b2 = (void 0).b2, c2, d2; +var b3 = (void 0).b3, c3; // error in type instead +var a1 = [undefined][0], b1 = { b1: null }.b1, c1 = undefined, d1 = null; // error diff --git a/tests/baselines/reference/noImplicitAnyInCastExpression.errors.txt b/tests/baselines/reference/noImplicitAnyInCastExpression.errors.txt index 66a7773ab49..8243a9c68ce 100644 --- a/tests/baselines/reference/noImplicitAnyInCastExpression.errors.txt +++ b/tests/baselines/reference/noImplicitAnyInCastExpression.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/noImplicitAnyInCastExpression.ts(16,2): error TS2352: Neither type '{ c: null; }' nor type 'IFoo' is assignable to the other. +tests/cases/compiler/noImplicitAnyInCastExpression.ts(16,2): error TS2352: Type '{ c: null; }' cannot be converted to type 'IFoo'. Property 'a' is missing in type '{ c: null; }'. @@ -20,5 +20,5 @@ tests/cases/compiler/noImplicitAnyInCastExpression.ts(16,2): error TS2352: Neith // Neither types is assignable to each other ({ c: null }); ~~~~~~~~~~~~~~~~~ -!!! error TS2352: Neither type '{ c: null; }' nor type 'IFoo' is assignable to the other. +!!! error TS2352: Type '{ c: null; }' cannot be converted to type 'IFoo'. !!! error TS2352: Property 'a' is missing in type '{ c: null; }'. \ No newline at end of file diff --git a/tests/baselines/reference/noImplicitReturnsInAsync1.symbols b/tests/baselines/reference/noImplicitReturnsInAsync1.symbols index b44f17e5fdd..7bf70fbf04e 100644 --- a/tests/baselines/reference/noImplicitReturnsInAsync1.symbols +++ b/tests/baselines/reference/noImplicitReturnsInAsync1.symbols @@ -11,7 +11,7 @@ async function test(isError: boolean = false) { } let x = await Promise.resolve("The test is passed without an error."); >x : Symbol(x, Decl(noImplicitReturnsInAsync1.ts, 5, 7)) ->Promise.resolve : Symbol(PromiseConstructor.resolve, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->Promise : Symbol(Promise, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->resolve : Symbol(PromiseConstructor.resolve, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Promise.resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) } diff --git a/tests/baselines/reference/noImplicitThisFunctions.errors.txt b/tests/baselines/reference/noImplicitThisFunctions.errors.txt new file mode 100644 index 00000000000..5f66ac3553f --- /dev/null +++ b/tests/baselines/reference/noImplicitThisFunctions.errors.txt @@ -0,0 +1,28 @@ +tests/cases/compiler/noImplicitThisFunctions.ts(14,12): error TS2683: 'this' implicitly has type 'any' because it does not have a type annotation. +tests/cases/compiler/noImplicitThisFunctions.ts(18,38): error TS2683: 'this' implicitly has type 'any' because it does not have a type annotation. + + +==== tests/cases/compiler/noImplicitThisFunctions.ts (2 errors) ==== + + function f1(x) { + // implicit any is still allowed + return x + 1; + } + + function f2(y: number) { + // ok: no reference to this + return y + 1; + } + + function f3(z: number): number { + // error: this is implicitly any + return this.a + z; + ~~~~ +!!! error TS2683: 'this' implicitly has type 'any' because it does not have a type annotation. + } + + // error: `this` is `window`, but is still of type `any` + let f4: (b: number) => number = b => this.c + b; + ~~~~ +!!! error TS2683: 'this' implicitly has type 'any' because it does not have a type annotation. + \ No newline at end of file diff --git a/tests/baselines/reference/noImplicitThisFunctions.js b/tests/baselines/reference/noImplicitThisFunctions.js new file mode 100644 index 00000000000..80ceccbe751 --- /dev/null +++ b/tests/baselines/reference/noImplicitThisFunctions.js @@ -0,0 +1,37 @@ +//// [noImplicitThisFunctions.ts] + +function f1(x) { + // implicit any is still allowed + return x + 1; +} + +function f2(y: number) { + // ok: no reference to this + return y + 1; +} + +function f3(z: number): number { + // error: this is implicitly any + return this.a + z; +} + +// error: `this` is `window`, but is still of type `any` +let f4: (b: number) => number = b => this.c + b; + + +//// [noImplicitThisFunctions.js] +var _this = this; +function f1(x) { + // implicit any is still allowed + return x + 1; +} +function f2(y) { + // ok: no reference to this + return y + 1; +} +function f3(z) { + // error: this is implicitly any + return this.a + z; +} +// error: `this` is `window`, but is still of type `any` +var f4 = function (b) { return _this.c + b; }; diff --git a/tests/baselines/reference/nullAssignableToEveryType.symbols b/tests/baselines/reference/nullAssignableToEveryType.symbols index 1ef7c8373f3..969686563a3 100644 --- a/tests/baselines/reference/nullAssignableToEveryType.symbols +++ b/tests/baselines/reference/nullAssignableToEveryType.symbols @@ -38,7 +38,7 @@ var d: boolean = null; var e: Date = null; >e : Symbol(e, Decl(nullAssignableToEveryType.ts, 15, 3)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) var f: any = null; >f : Symbol(f, Decl(nullAssignableToEveryType.ts, 16, 3)) @@ -89,18 +89,18 @@ var o: (x: T) => T = null; var p: Number = null; >p : Symbol(p, Decl(nullAssignableToEveryType.ts, 29, 3)) ->Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) var q: String = null; >q : Symbol(q, Decl(nullAssignableToEveryType.ts, 30, 3)) ->String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) function foo(x: T, y: U, z: V) { >foo : Symbol(foo, Decl(nullAssignableToEveryType.ts, 30, 21)) >T : Symbol(T, Decl(nullAssignableToEveryType.ts, 32, 13)) >U : Symbol(U, Decl(nullAssignableToEveryType.ts, 32, 15)) >V : Symbol(V, Decl(nullAssignableToEveryType.ts, 32, 18)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >x : Symbol(x, Decl(nullAssignableToEveryType.ts, 32, 35)) >T : Symbol(T, Decl(nullAssignableToEveryType.ts, 32, 13)) >y : Symbol(y, Decl(nullAssignableToEveryType.ts, 32, 40)) diff --git a/tests/baselines/reference/nullIsSubtypeOfEverythingButUndefined.symbols b/tests/baselines/reference/nullIsSubtypeOfEverythingButUndefined.symbols index 9b10e1e447b..3d4fb84145e 100644 --- a/tests/baselines/reference/nullIsSubtypeOfEverythingButUndefined.symbols +++ b/tests/baselines/reference/nullIsSubtypeOfEverythingButUndefined.symbols @@ -39,11 +39,11 @@ var r3 = true ? null : true; var r4 = true ? new Date() : null; >r4 : Symbol(r4, Decl(nullIsSubtypeOfEverythingButUndefined.ts, 18, 3), Decl(nullIsSubtypeOfEverythingButUndefined.ts, 19, 3)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) var r4 = true ? null : new Date(); >r4 : Symbol(r4, Decl(nullIsSubtypeOfEverythingButUndefined.ts, 18, 3), Decl(nullIsSubtypeOfEverythingButUndefined.ts, 19, 3)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) var r5 = true ? /1/ : null; >r5 : Symbol(r5, Decl(nullIsSubtypeOfEverythingButUndefined.ts, 21, 3), Decl(nullIsSubtypeOfEverythingButUndefined.ts, 22, 3)) diff --git a/tests/baselines/reference/objectTypeWithCallSignatureAppearsToBeFunctionType.symbols b/tests/baselines/reference/objectTypeWithCallSignatureAppearsToBeFunctionType.symbols index 60b7b08397a..08d3d75e9dc 100644 --- a/tests/baselines/reference/objectTypeWithCallSignatureAppearsToBeFunctionType.symbols +++ b/tests/baselines/reference/objectTypeWithCallSignatureAppearsToBeFunctionType.symbols @@ -20,9 +20,9 @@ var r2b: (x: any, y?: any) => any = i.apply; >r2b : Symbol(r2b, Decl(objectTypeWithCallSignatureAppearsToBeFunctionType.ts, 9, 3)) >x : Symbol(x, Decl(objectTypeWithCallSignatureAppearsToBeFunctionType.ts, 9, 10)) >y : Symbol(y, Decl(objectTypeWithCallSignatureAppearsToBeFunctionType.ts, 9, 17)) ->i.apply : Symbol(Function.apply, Decl(lib.d.ts, --, --)) +>i.apply : Symbol(Function.apply, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >i : Symbol(i, Decl(objectTypeWithCallSignatureAppearsToBeFunctionType.ts, 7, 3)) ->apply : Symbol(Function.apply, Decl(lib.d.ts, --, --)) +>apply : Symbol(Function.apply, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) var b: { >b : Symbol(b, Decl(objectTypeWithCallSignatureAppearsToBeFunctionType.ts, 11, 3)) @@ -38,7 +38,7 @@ var rb4: (x: any, y?: any) => any = b.apply; >rb4 : Symbol(rb4, Decl(objectTypeWithCallSignatureAppearsToBeFunctionType.ts, 16, 3)) >x : Symbol(x, Decl(objectTypeWithCallSignatureAppearsToBeFunctionType.ts, 16, 10)) >y : Symbol(y, Decl(objectTypeWithCallSignatureAppearsToBeFunctionType.ts, 16, 17)) ->b.apply : Symbol(Function.apply, Decl(lib.d.ts, --, --)) +>b.apply : Symbol(Function.apply, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >b : Symbol(b, Decl(objectTypeWithCallSignatureAppearsToBeFunctionType.ts, 11, 3)) ->apply : Symbol(Function.apply, Decl(lib.d.ts, --, --)) +>apply : Symbol(Function.apply, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) diff --git a/tests/baselines/reference/objectTypeWithCallSignatureAppearsToBeFunctionType.types b/tests/baselines/reference/objectTypeWithCallSignatureAppearsToBeFunctionType.types index 74d8ef57d67..496734c9183 100644 --- a/tests/baselines/reference/objectTypeWithCallSignatureAppearsToBeFunctionType.types +++ b/tests/baselines/reference/objectTypeWithCallSignatureAppearsToBeFunctionType.types @@ -21,9 +21,9 @@ var r2b: (x: any, y?: any) => any = i.apply; >r2b : (x: any, y?: any) => any >x : any >y : any ->i.apply : (thisArg: any, argArray?: any) => any +>i.apply : { (this: (this: T, ...argArray: any[]) => U, thisArg: T, argArray?: any): U; (this: Function, thisArg: any, argArray?: any): any; } >i : I ->apply : (thisArg: any, argArray?: any) => any +>apply : { (this: (this: T, ...argArray: any[]) => U, thisArg: T, argArray?: any): U; (this: Function, thisArg: any, argArray?: any): any; } var b: { >b : () => void @@ -40,7 +40,7 @@ var rb4: (x: any, y?: any) => any = b.apply; >rb4 : (x: any, y?: any) => any >x : any >y : any ->b.apply : (thisArg: any, argArray?: any) => any +>b.apply : { (this: (this: T, ...argArray: any[]) => U, thisArg: T, argArray?: any): U; (this: Function, thisArg: any, argArray?: any): any; } >b : () => void ->apply : (thisArg: any, argArray?: any) => any +>apply : { (this: (this: T, ...argArray: any[]) => U, thisArg: T, argArray?: any): U; (this: Function, thisArg: any, argArray?: any): any; } diff --git a/tests/baselines/reference/objectTypeWithStringNamedNumericProperty.symbols b/tests/baselines/reference/objectTypeWithStringNamedNumericProperty.symbols index d3c463d9a15..a3f316b1bbf 100644 --- a/tests/baselines/reference/objectTypeWithStringNamedNumericProperty.symbols +++ b/tests/baselines/reference/objectTypeWithStringNamedNumericProperty.symbols @@ -15,13 +15,13 @@ class C { "1.": string; "1..": boolean; "1.0": Date; ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) "-1.0": RegExp; >RegExp : Symbol(RegExp, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) "-1": Date; ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) } var c: C; @@ -121,13 +121,13 @@ interface I { "1.": string; "1..": boolean; "1.0": Date; ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) "-1.0": RegExp; >RegExp : Symbol(RegExp, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) "-1": Date; ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) } var i: I; @@ -227,13 +227,13 @@ var a: { "1.": string; "1..": boolean; "1.0": Date; ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) "-1.0": RegExp; >RegExp : Symbol(RegExp, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) "-1": Date; ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) } var r1 = a['0.1']; @@ -329,11 +329,11 @@ var b = { "1.": "", "1..": true, "1.0": new Date(), ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) "-1.0": /123/, "-1": Date ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) }; diff --git a/tests/baselines/reference/objectTypesIdentity2.symbols b/tests/baselines/reference/objectTypesIdentity2.symbols index 626841b08dc..eb04eaf03c7 100644 --- a/tests/baselines/reference/objectTypesIdentity2.symbols +++ b/tests/baselines/reference/objectTypesIdentity2.symbols @@ -29,7 +29,7 @@ interface I { foo: Date; >foo : Symbol(I.foo, Decl(objectTypesIdentity2.ts, 14, 13)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) } var a: { foo: RegExp; } diff --git a/tests/baselines/reference/objectTypesIdentityWithCallSignatures2.symbols b/tests/baselines/reference/objectTypesIdentityWithCallSignatures2.symbols index 2ffa1b23e2b..fb01ef775c4 100644 --- a/tests/baselines/reference/objectTypesIdentityWithCallSignatures2.symbols +++ b/tests/baselines/reference/objectTypesIdentityWithCallSignatures2.symbols @@ -51,7 +51,7 @@ var a: { foo(x: Date): string } >a : Symbol(a, Decl(objectTypesIdentityWithCallSignatures2.ts, 22, 3)) >foo : Symbol(foo, Decl(objectTypesIdentityWithCallSignatures2.ts, 22, 8)) >x : Symbol(x, Decl(objectTypesIdentityWithCallSignatures2.ts, 22, 13)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) var b = { foo(x: RegExp) { return ''; } }; >b : Symbol(b, Decl(objectTypesIdentityWithCallSignatures2.ts, 23, 3)) diff --git a/tests/baselines/reference/objectTypesIdentityWithConstructSignatures2.symbols b/tests/baselines/reference/objectTypesIdentityWithConstructSignatures2.symbols index 90ec832873c..64677b63c5f 100644 --- a/tests/baselines/reference/objectTypesIdentityWithConstructSignatures2.symbols +++ b/tests/baselines/reference/objectTypesIdentityWithConstructSignatures2.symbols @@ -37,7 +37,7 @@ interface I2 { var a: { new(x: Date): string } >a : Symbol(a, Decl(objectTypesIdentityWithConstructSignatures2.ts, 18, 3)) >x : Symbol(x, Decl(objectTypesIdentityWithConstructSignatures2.ts, 18, 13)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) var b = { new(x: RegExp) { return ''; } }; // not a construct signature, function called new >b : Symbol(b, Decl(objectTypesIdentityWithConstructSignatures2.ts, 19, 3)) diff --git a/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.symbols b/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.symbols index 8b59c622ec6..7d017936a04 100644 --- a/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.symbols +++ b/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.symbols @@ -9,7 +9,7 @@ class A { foo(x: T): string { return null; } >foo : Symbol(A.foo, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts, 4, 9)) >T : Symbol(T, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts, 5, 8)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts, 5, 24)) >T : Symbol(T, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts, 5, 8)) } @@ -28,7 +28,7 @@ class B> { class C { >C : Symbol(C, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts, 10, 1)) >T : Symbol(T, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts, 12, 8)) ->String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) foo(x: T): string { return null; } >foo : Symbol(C.foo, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts, 12, 27)) @@ -39,7 +39,7 @@ class C { interface I { >I : Symbol(I, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts, 14, 1)) >T : Symbol(T, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts, 16, 12)) ->Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) foo(x: T): string; >foo : Symbol(I.foo, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts, 16, 31)) @@ -108,13 +108,13 @@ function foo1c(x: C); >foo1c : Symbol(foo1c, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts, 33, 26), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts, 35, 29), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts, 36, 29)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts, 35, 15)) >C : Symbol(C, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts, 10, 1)) ->String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) function foo1c(x: C); // error >foo1c : Symbol(foo1c, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts, 33, 26), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts, 35, 29), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts, 36, 29)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts, 36, 15)) >C : Symbol(C, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts, 10, 1)) ->String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) function foo1c(x: any) { } >foo1c : Symbol(foo1c, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts, 33, 26), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts, 35, 29), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts, 36, 29)) @@ -124,13 +124,13 @@ function foo2(x: I); >foo2 : Symbol(foo2, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts, 37, 26), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts, 39, 28), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts, 40, 28)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts, 39, 14)) >I : Symbol(I, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts, 14, 1)) ->Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) function foo2(x: I); // error >foo2 : Symbol(foo2, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts, 37, 26), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts, 39, 28), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts, 40, 28)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts, 40, 14)) >I : Symbol(I, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts, 14, 1)) ->Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) function foo2(x: any) { } >foo2 : Symbol(foo2, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts, 37, 26), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts, 39, 28), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts, 40, 28)) @@ -188,7 +188,7 @@ function foo5b(x: C); // ok >foo5b : Symbol(foo5b, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts, 53, 25), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts, 55, 21), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts, 56, 29)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts, 56, 15)) >C : Symbol(C, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts, 10, 1)) ->String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) function foo5b(x: any) { } >foo5b : Symbol(foo5b, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts, 53, 25), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts, 55, 21), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts, 56, 29)) @@ -203,7 +203,7 @@ function foo6(x: I); // ok >foo6 : Symbol(foo6, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts, 57, 26), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts, 59, 20), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts, 60, 28)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts, 60, 14)) >I : Symbol(I, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts, 14, 1)) ->Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) function foo6(x: any) { } >foo6 : Symbol(foo6, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts, 57, 26), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts, 59, 20), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts, 60, 28)) @@ -233,7 +233,7 @@ function foo8(x: I); // ok >foo8 : Symbol(foo8, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts, 65, 25), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts, 67, 35), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts, 68, 28)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts, 68, 14)) >I : Symbol(I, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts, 14, 1)) ->Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) function foo8(x: any) { } >foo8 : Symbol(foo8, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts, 65, 25), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts, 67, 35), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts, 68, 28)) @@ -249,7 +249,7 @@ function foo9(x: C); // ok >foo9 : Symbol(foo9, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts, 69, 25), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts, 71, 35), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts, 72, 28)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts, 72, 14)) >C : Symbol(C, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts, 10, 1)) ->String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) function foo9(x: any) { } >foo9 : Symbol(foo9, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts, 69, 25), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts, 71, 35), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts, 72, 28)) @@ -289,13 +289,13 @@ function foo12(x: I); >foo12 : Symbol(foo12, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts, 81, 26), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts, 83, 29), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts, 84, 29)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts, 83, 15)) >I : Symbol(I, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts, 14, 1)) ->Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) function foo12(x: C); // ok >foo12 : Symbol(foo12, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts, 81, 26), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts, 83, 29), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts, 84, 29)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts, 84, 15)) >C : Symbol(C, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts, 10, 1)) ->String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) function foo12(x: any) { } >foo12 : Symbol(foo12, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts, 81, 26), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts, 83, 29), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts, 84, 29)) @@ -310,7 +310,7 @@ function foo12b(x: C); // ok >foo12b : Symbol(foo12b, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts, 85, 26), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts, 87, 23), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts, 88, 30)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts, 88, 16)) >C : Symbol(C, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts, 10, 1)) ->String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) function foo12b(x: any) { } >foo12b : Symbol(foo12b, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts, 85, 26), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts, 87, 23), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts, 88, 30)) @@ -320,7 +320,7 @@ function foo13(x: I); >foo13 : Symbol(foo13, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts, 89, 27), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts, 91, 29), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts, 92, 28)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts, 91, 15)) >I : Symbol(I, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts, 14, 1)) ->Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) function foo13(x: typeof a); // ok >foo13 : Symbol(foo13, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts, 89, 27), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts, 91, 29), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts, 92, 28)) @@ -335,7 +335,7 @@ function foo14(x: I); >foo14 : Symbol(foo14, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts, 93, 26), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts, 95, 29), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts, 96, 28)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts, 95, 15)) >I : Symbol(I, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts, 14, 1)) ->Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) function foo14(x: typeof b); // ok >foo14 : Symbol(foo14, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts, 93, 26), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts, 95, 29), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts, 96, 28)) @@ -355,7 +355,7 @@ function foo15(x: C); // ok >foo15 : Symbol(foo15, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts, 97, 26), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts, 99, 22), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts, 100, 29)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts, 100, 15)) >C : Symbol(C, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts, 10, 1)) ->String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) function foo15(x: any) { } >foo15 : Symbol(foo15, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts, 97, 26), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts, 99, 22), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.ts, 100, 29)) diff --git a/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.symbols b/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.symbols index 1cade70f1a5..e37b606be59 100644 --- a/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.symbols +++ b/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.symbols @@ -11,7 +11,7 @@ class A { >T : Symbol(T, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 5, 8)) >U : Symbol(U, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 5, 20)) >U : Symbol(U, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 5, 20)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 5, 37)) >T : Symbol(T, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 5, 8)) >y : Symbol(y, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 5, 42)) @@ -38,7 +38,7 @@ class C { >T : Symbol(T, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 12, 8)) >U : Symbol(U, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 12, 20)) >U : Symbol(U, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 12, 20)) ->String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) foo(x: T, y: U): string { return null; } >foo : Symbol(C.foo, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 12, 40)) @@ -53,7 +53,7 @@ class D { >T : Symbol(T, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 16, 8)) >U : Symbol(U, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 16, 20)) >U : Symbol(U, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 16, 20)) ->Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) foo(x: T, y: U): string { return null; } >foo : Symbol(D.foo, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 16, 40)) @@ -68,7 +68,7 @@ interface I { >T : Symbol(T, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 20, 12)) >U : Symbol(U, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 20, 24)) >U : Symbol(U, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 20, 24)) ->Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) foo(x: T, y: U): string; >foo : Symbol(I.foo, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 20, 44)) @@ -153,15 +153,15 @@ function foo1c(x: C); >foo1c : Symbol(foo1c, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 37, 26), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 39, 37), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 40, 37)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 39, 15)) >C : Symbol(C, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 10, 1)) ->String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) function foo1c(x: C); // error >foo1c : Symbol(foo1c, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 37, 26), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 39, 37), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 40, 37)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 40, 15)) >C : Symbol(C, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 10, 1)) ->String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) function foo1c(x: any) { } >foo1c : Symbol(foo1c, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 37, 26), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 39, 37), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 40, 37)) @@ -171,15 +171,15 @@ function foo2(x: I); >foo2 : Symbol(foo2, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 41, 26), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 43, 36), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 44, 36)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 43, 14)) >I : Symbol(I, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 18, 1)) ->Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) function foo2(x: I); // error >foo2 : Symbol(foo2, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 41, 26), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 43, 36), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 44, 36)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 44, 14)) >I : Symbol(I, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 18, 1)) ->Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) function foo2(x: any) { } >foo2 : Symbol(foo2, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 41, 26), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 43, 36), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 44, 36)) @@ -238,8 +238,8 @@ function foo5b(x: C); // ok >foo5b : Symbol(foo5b, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 57, 25), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 59, 21), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 60, 37)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 60, 15)) >C : Symbol(C, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 10, 1)) ->String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) function foo5b(x: any) { } >foo5b : Symbol(foo5b, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 57, 25), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 59, 21), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 60, 37)) @@ -249,15 +249,15 @@ function foo5c(x: C); >foo5c : Symbol(foo5c, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 61, 26), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 63, 37), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 64, 37)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 63, 15)) >C : Symbol(C, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 10, 1)) ->String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) function foo5c(x: D); // ok >foo5c : Symbol(foo5c, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 61, 26), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 63, 37), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 64, 37)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 64, 15)) >D : Symbol(D, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 14, 1)) ->Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) function foo5c(x: any) { } >foo5c : Symbol(foo5c, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 61, 26), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 63, 37), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 64, 37)) @@ -267,14 +267,14 @@ function foo6c(x: C); >foo6c : Symbol(foo6c, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 65, 26), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 67, 37), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 68, 34)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 67, 15)) >C : Symbol(C, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 10, 1)) ->String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) function foo6c(x: D); // error, "any" does not satisfy the constraint >foo6c : Symbol(foo6c, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 65, 26), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 67, 37), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 68, 34)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 68, 15)) >D : Symbol(D, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 14, 1)) ->Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) function foo6c(x: any) { } >foo6c : Symbol(foo6c, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 65, 26), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 67, 37), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 68, 34)) @@ -289,8 +289,8 @@ function foo6(x: I); // ok >foo6 : Symbol(foo6, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 69, 26), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 71, 20), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 72, 36)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 72, 14)) >I : Symbol(I, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 18, 1)) ->Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) function foo6(x: any) { } >foo6 : Symbol(foo6, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 69, 26), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 71, 20), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 72, 36)) @@ -321,8 +321,8 @@ function foo8(x: I); // ok >foo8 : Symbol(foo8, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 77, 25), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 79, 50), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 80, 36)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 80, 14)) >I : Symbol(I, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 18, 1)) ->Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) function foo8(x: any) { } >foo8 : Symbol(foo8, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 77, 25), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 79, 50), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 80, 36)) @@ -339,8 +339,8 @@ function foo9(x: C); // ok >foo9 : Symbol(foo9, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 81, 25), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 83, 50), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 84, 36)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 84, 14)) >C : Symbol(C, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 10, 1)) ->String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) function foo9(x: any) { } >foo9 : Symbol(foo9, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 81, 25), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 83, 50), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 84, 36)) @@ -382,15 +382,15 @@ function foo12(x: I); >foo12 : Symbol(foo12, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 93, 26), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 95, 37), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 96, 37)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 95, 15)) >I : Symbol(I, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 18, 1)) ->Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) function foo12(x: C); // ok >foo12 : Symbol(foo12, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 93, 26), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 95, 37), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 96, 37)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 96, 15)) >C : Symbol(C, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 10, 1)) ->String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) function foo12(x: any) { } >foo12 : Symbol(foo12, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 93, 26), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 95, 37), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 96, 37)) @@ -405,8 +405,8 @@ function foo12b(x: C); // ok >foo12b : Symbol(foo12b, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 97, 26), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 99, 23), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 100, 38)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 100, 16)) >C : Symbol(C, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 10, 1)) ->String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) function foo12b(x: any) { } >foo12b : Symbol(foo12b, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 97, 26), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 99, 23), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 100, 38)) @@ -416,8 +416,8 @@ function foo13(x: I); >foo13 : Symbol(foo13, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 101, 27), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 103, 37), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 104, 28)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 103, 15)) >I : Symbol(I, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 18, 1)) ->Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) function foo13(x: typeof a); // ok >foo13 : Symbol(foo13, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 101, 27), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 103, 37), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 104, 28)) @@ -432,8 +432,8 @@ function foo14(x: I); >foo14 : Symbol(foo14, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 105, 26), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 107, 37), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 108, 28)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 107, 15)) >I : Symbol(I, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 18, 1)) ->Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) function foo14(x: typeof b); // ok >foo14 : Symbol(foo14, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 105, 26), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 107, 37), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 108, 28)) @@ -453,8 +453,8 @@ function foo15(x: C); // ok >foo15 : Symbol(foo15, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 109, 26), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 111, 22), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 112, 37)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 112, 15)) >C : Symbol(C, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 10, 1)) ->String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) function foo15(x: any) { } >foo15 : Symbol(foo15, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 109, 26), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 111, 22), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.ts, 112, 37)) diff --git a/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType.symbols b/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType.symbols index dc6f1fbf856..a3f4f8038a0 100644 --- a/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType.symbols +++ b/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType.symbols @@ -41,7 +41,7 @@ interface I { >foo : Symbol(I.foo, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType.ts, 16, 16)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType.ts, 17, 8)) >T : Symbol(T, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType.ts, 16, 12)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) } interface I2 { diff --git a/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.symbols b/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.symbols index 588ecabd832..d90a4b1d545 100644 --- a/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.symbols +++ b/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.symbols @@ -9,7 +9,7 @@ class A { foo(x: T): string { return null; } >foo : Symbol(A.foo, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 4, 9)) >T : Symbol(T, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 5, 8)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 5, 24)) >T : Symbol(T, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 5, 8)) } @@ -17,7 +17,7 @@ class A { class B { >B : Symbol(B, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 6, 1)) >T : Symbol(T, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 8, 8)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) foo(x: T): number { return null; } >foo : Symbol(B.foo, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 8, 25)) @@ -28,7 +28,7 @@ class B { class C { >C : Symbol(C, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 10, 1)) >T : Symbol(T, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 12, 8)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) foo(x: T): boolean { return null; } >foo : Symbol(C.foo, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 12, 25)) @@ -39,13 +39,13 @@ class C { interface I { >I : Symbol(I, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 14, 1)) >T : Symbol(T, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 16, 12)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) foo(x: T): Date; >foo : Symbol(I.foo, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 16, 29)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 17, 8)) >T : Symbol(T, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 16, 12)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) } interface I2 { @@ -54,7 +54,7 @@ interface I2 { foo(x: T): RegExp; >foo : Symbol(I2.foo, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 20, 14)) >T : Symbol(T, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 21, 8)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 21, 24)) >T : Symbol(T, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 21, 8)) >RegExp : Symbol(RegExp, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) @@ -64,7 +64,7 @@ var a: { foo(x: T): T } >a : Symbol(a, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 24, 3)) >foo : Symbol(foo, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 24, 8)) >T : Symbol(T, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 24, 13)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 24, 29)) >T : Symbol(T, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 24, 13)) >T : Symbol(T, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 24, 13)) @@ -73,7 +73,7 @@ var b = { foo(x: T) { return null; } }; >b : Symbol(b, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 25, 3)) >foo : Symbol(foo, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 25, 9)) >T : Symbol(T, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 25, 14)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 25, 30)) >T : Symbol(T, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 25, 14)) @@ -95,13 +95,13 @@ function foo1b(x: B); >foo1b : Symbol(foo1b, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 29, 25), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 31, 27), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 32, 27)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 31, 15)) >B : Symbol(B, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 6, 1)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) function foo1b(x: B); // error >foo1b : Symbol(foo1b, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 29, 25), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 31, 27), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 32, 27)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 32, 15)) >B : Symbol(B, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 6, 1)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) function foo1b(x: any) { } >foo1b : Symbol(foo1b, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 29, 25), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 31, 27), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 32, 27)) @@ -111,13 +111,13 @@ function foo1c(x: C); >foo1c : Symbol(foo1c, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 33, 26), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 35, 27), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 36, 27)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 35, 15)) >C : Symbol(C, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 10, 1)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) function foo1c(x: C); // error >foo1c : Symbol(foo1c, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 33, 26), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 35, 27), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 36, 27)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 36, 15)) >C : Symbol(C, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 10, 1)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) function foo1c(x: any) { } >foo1c : Symbol(foo1c, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 33, 26), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 35, 27), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 36, 27)) @@ -127,13 +127,13 @@ function foo2(x: I); >foo2 : Symbol(foo2, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 37, 26), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 39, 26), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 40, 26)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 39, 14)) >I : Symbol(I, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 14, 1)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) function foo2(x: I); // error >foo2 : Symbol(foo2, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 37, 26), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 39, 26), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 40, 26)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 40, 14)) >I : Symbol(I, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 14, 1)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) function foo2(x: any) { } >foo2 : Symbol(foo2, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 37, 26), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 39, 26), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 40, 26)) @@ -176,7 +176,7 @@ function foo5(x: B); // ok >foo5 : Symbol(foo5, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 49, 25), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 51, 20), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 52, 26)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 52, 14)) >B : Symbol(B, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 6, 1)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) function foo5(x: any) { } >foo5 : Symbol(foo5, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 49, 25), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 51, 20), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 52, 26)) @@ -191,7 +191,7 @@ function foo5b(x: C); // ok >foo5b : Symbol(foo5b, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 53, 25), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 55, 21), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 56, 27)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 56, 15)) >C : Symbol(C, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 10, 1)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) function foo5b(x: any) { } >foo5b : Symbol(foo5b, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 53, 25), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 55, 21), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 56, 27)) @@ -206,7 +206,7 @@ function foo6(x: I); // ok >foo6 : Symbol(foo6, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 57, 26), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 59, 20), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 60, 26)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 60, 14)) >I : Symbol(I, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 14, 1)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) function foo6(x: any) { } >foo6 : Symbol(foo6, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 57, 26), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 59, 20), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 60, 26)) @@ -230,13 +230,13 @@ function foo8(x: B); >foo8 : Symbol(foo8, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 65, 25), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 67, 26), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 68, 26)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 67, 14)) >B : Symbol(B, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 6, 1)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) function foo8(x: I); // ok >foo8 : Symbol(foo8, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 65, 25), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 67, 26), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 68, 26)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 68, 14)) >I : Symbol(I, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 14, 1)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) function foo8(x: any) { } >foo8 : Symbol(foo8, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 65, 25), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 67, 26), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 68, 26)) @@ -246,13 +246,13 @@ function foo9(x: B); >foo9 : Symbol(foo9, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 69, 25), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 71, 26), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 72, 26)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 71, 14)) >B : Symbol(B, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 6, 1)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) function foo9(x: C); // ok >foo9 : Symbol(foo9, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 69, 25), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 71, 26), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 72, 26)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 72, 14)) >C : Symbol(C, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 10, 1)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) function foo9(x: any) { } >foo9 : Symbol(foo9, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 69, 25), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 71, 26), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 72, 26)) @@ -262,7 +262,7 @@ function foo10(x: B); >foo10 : Symbol(foo10, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 73, 25), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 75, 27), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 76, 28)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 75, 15)) >B : Symbol(B, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 6, 1)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) function foo10(x: typeof a); // ok >foo10 : Symbol(foo10, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 73, 25), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 75, 27), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 76, 28)) @@ -277,7 +277,7 @@ function foo11(x: B); >foo11 : Symbol(foo11, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 77, 26), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 79, 27), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 80, 28)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 79, 15)) >B : Symbol(B, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 6, 1)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) function foo11(x: typeof b); // ok >foo11 : Symbol(foo11, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 77, 26), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 79, 27), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 80, 28)) @@ -292,13 +292,13 @@ function foo12(x: I); >foo12 : Symbol(foo12, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 81, 26), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 83, 27), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 84, 27)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 83, 15)) >I : Symbol(I, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 14, 1)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) function foo12(x: C); // ok >foo12 : Symbol(foo12, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 81, 26), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 83, 27), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 84, 27)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 84, 15)) >C : Symbol(C, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 10, 1)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) function foo12(x: any) { } >foo12 : Symbol(foo12, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 81, 26), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 83, 27), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 84, 27)) @@ -313,7 +313,7 @@ function foo12b(x: C); // ok >foo12b : Symbol(foo12b, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 85, 26), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 87, 23), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 88, 28)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 88, 16)) >C : Symbol(C, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 10, 1)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) function foo12b(x: any) { } >foo12b : Symbol(foo12b, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 85, 26), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 87, 23), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 88, 28)) @@ -323,7 +323,7 @@ function foo13(x: I); >foo13 : Symbol(foo13, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 89, 27), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 91, 27), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 92, 28)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 91, 15)) >I : Symbol(I, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 14, 1)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) function foo13(x: typeof a); // ok >foo13 : Symbol(foo13, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 89, 27), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 91, 27), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 92, 28)) @@ -338,7 +338,7 @@ function foo14(x: I); >foo14 : Symbol(foo14, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 93, 26), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 95, 27), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 96, 28)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 95, 15)) >I : Symbol(I, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 14, 1)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) function foo14(x: typeof b); // ok >foo14 : Symbol(foo14, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 93, 26), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 95, 27), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 96, 28)) @@ -358,7 +358,7 @@ function foo15(x: C); // ok >foo15 : Symbol(foo15, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 97, 26), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 99, 22), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 100, 27)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 100, 15)) >C : Symbol(C, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 10, 1)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) function foo15(x: any) { } >foo15 : Symbol(foo15, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 97, 26), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 99, 22), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.ts, 100, 27)) diff --git a/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterCounts.symbols b/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterCounts.symbols index 89c60608faa..748c945d8d0 100644 --- a/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterCounts.symbols +++ b/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterCounts.symbols @@ -211,7 +211,7 @@ function foo6(x: I); // ok >foo6 : Symbol(foo6, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterCounts.ts, 55, 26), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterCounts.ts, 57, 20), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterCounts.ts, 58, 51)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterCounts.ts, 58, 14)) >I : Symbol(I, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterCounts.ts, 12, 1)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) function foo6(x: any) { } >foo6 : Symbol(foo6, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterCounts.ts, 55, 26), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterCounts.ts, 57, 20), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterCounts.ts, 58, 51)) @@ -240,7 +240,7 @@ function foo8(x: I); // error >foo8 : Symbol(foo8, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterCounts.ts, 63, 25), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterCounts.ts, 65, 36), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterCounts.ts, 66, 51)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterCounts.ts, 66, 14)) >I : Symbol(I, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterCounts.ts, 12, 1)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) function foo8(x: any) { } >foo8 : Symbol(foo8, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterCounts.ts, 63, 25), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterCounts.ts, 65, 36), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterCounts.ts, 66, 51)) @@ -294,14 +294,14 @@ function foo12(x: I, number, Date, string>); >x : Symbol(x, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterCounts.ts, 81, 15)) >I : Symbol(I, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterCounts.ts, 12, 1)) >B : Symbol(B, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterCounts.ts, 4, 1)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) function foo12(x: C, number, Date>); // error >foo12 : Symbol(foo12, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterCounts.ts, 79, 26), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterCounts.ts, 81, 62), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterCounts.ts, 82, 54)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterCounts.ts, 82, 15)) >C : Symbol(C, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterCounts.ts, 8, 1)) >B : Symbol(B, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterCounts.ts, 4, 1)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) function foo12(x: any) { } >foo12 : Symbol(foo12, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterCounts.ts, 79, 26), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterCounts.ts, 81, 62), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterCounts.ts, 82, 54)) @@ -325,9 +325,9 @@ function foo13(x: I); >foo13 : Symbol(foo13, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterCounts.ts, 87, 27), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterCounts.ts, 89, 49), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterCounts.ts, 90, 28)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterCounts.ts, 89, 15)) >I : Symbol(I, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterCounts.ts, 12, 1)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >RegExp : Symbol(RegExp, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) function foo13(x: typeof a); // ok >foo13 : Symbol(foo13, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterCounts.ts, 87, 27), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterCounts.ts, 89, 49), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterCounts.ts, 90, 28)) @@ -342,7 +342,7 @@ function foo14(x: I); >foo14 : Symbol(foo14, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterCounts.ts, 91, 26), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterCounts.ts, 93, 52), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterCounts.ts, 94, 28)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterCounts.ts, 93, 15)) >I : Symbol(I, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterCounts.ts, 12, 1)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >RegExp : Symbol(RegExp, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) function foo14(x: typeof b); // ok diff --git a/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterCounts2.symbols b/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterCounts2.symbols index d1f87946de5..a69ddbe5647 100644 --- a/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterCounts2.symbols +++ b/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterCounts2.symbols @@ -85,7 +85,7 @@ function foo13(x: I); >foo13 : Symbol(foo13, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterCounts2.ts, 23, 25), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterCounts2.ts, 25, 52), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterCounts2.ts, 26, 28)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterCounts2.ts, 25, 15)) >I : Symbol(I, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterCounts2.ts, 0, 0)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) function foo13(x: typeof a); // ok >foo13 : Symbol(foo13, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterCounts2.ts, 23, 25), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterCounts2.ts, 25, 52), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterCounts2.ts, 26, 28)) @@ -100,7 +100,7 @@ function foo14(x: I); >foo14 : Symbol(foo14, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterCounts2.ts, 27, 26), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterCounts2.ts, 29, 52), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterCounts2.ts, 30, 22)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterCounts2.ts, 29, 15)) >I : Symbol(I, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterCounts2.ts, 0, 0)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) function foo14(x: I2); // error >foo14 : Symbol(foo14, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterCounts2.ts, 27, 26), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterCounts2.ts, 29, 52), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterCounts2.ts, 30, 22)) @@ -129,7 +129,7 @@ function foo15(x: I); >foo15 : Symbol(foo15, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterCounts2.ts, 35, 27), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterCounts2.ts, 37, 52), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterCounts2.ts, 38, 22)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterCounts2.ts, 37, 15)) >I : Symbol(I, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterCounts2.ts, 0, 0)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) function foo15(x: I2); // ok >foo15 : Symbol(foo15, Decl(objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterCounts2.ts, 35, 27), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterCounts2.ts, 37, 52), Decl(objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterCounts2.ts, 38, 22)) diff --git a/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints.symbols b/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints.symbols index fb3fba82cb2..c95d5234ac5 100644 --- a/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints.symbols +++ b/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints.symbols @@ -16,7 +16,7 @@ class B> { class C { >C : Symbol(C, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints.ts, 6, 1)) >T : Symbol(T, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints.ts, 8, 8)) ->String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) constructor(x: T) { return null; } >x : Symbol(x, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints.ts, 9, 16)) @@ -26,7 +26,7 @@ class C { interface I { >I : Symbol(I, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints.ts, 10, 1)) >T : Symbol(T, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints.ts, 12, 12)) ->Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) new(x: T): string; >x : Symbol(x, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints.ts, 13, 8)) @@ -78,13 +78,13 @@ function foo1c(x: C); >foo1c : Symbol(foo1c, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints.ts, 25, 26), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints.ts, 27, 29), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints.ts, 28, 29)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints.ts, 27, 15)) >C : Symbol(C, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints.ts, 6, 1)) ->String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) function foo1c(x: C); // error >foo1c : Symbol(foo1c, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints.ts, 25, 26), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints.ts, 27, 29), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints.ts, 28, 29)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints.ts, 28, 15)) >C : Symbol(C, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints.ts, 6, 1)) ->String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) function foo1c(x: any) { } >foo1c : Symbol(foo1c, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints.ts, 25, 26), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints.ts, 27, 29), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints.ts, 28, 29)) @@ -94,13 +94,13 @@ function foo2(x: I); >foo2 : Symbol(foo2, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints.ts, 29, 26), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints.ts, 31, 28), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints.ts, 32, 28)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints.ts, 31, 14)) >I : Symbol(I, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints.ts, 10, 1)) ->Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) function foo2(x: I); // error >foo2 : Symbol(foo2, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints.ts, 29, 26), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints.ts, 31, 28), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints.ts, 32, 28)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints.ts, 32, 14)) >I : Symbol(I, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints.ts, 10, 1)) ->Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) function foo2(x: any) { } >foo2 : Symbol(foo2, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints.ts, 29, 26), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints.ts, 31, 28), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints.ts, 32, 28)) @@ -144,7 +144,7 @@ function foo8(x: I); // ok >foo8 : Symbol(foo8, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints.ts, 41, 25), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints.ts, 43, 35), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints.ts, 44, 28)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints.ts, 44, 14)) >I : Symbol(I, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints.ts, 10, 1)) ->Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) function foo8(x: any) { } >foo8 : Symbol(foo8, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints.ts, 41, 25), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints.ts, 43, 35), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints.ts, 44, 28)) @@ -160,7 +160,7 @@ function foo9(x: C); // error, types are structurally equal >foo9 : Symbol(foo9, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints.ts, 45, 25), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints.ts, 47, 35), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints.ts, 48, 28)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints.ts, 48, 14)) >C : Symbol(C, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints.ts, 6, 1)) ->String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) function foo9(x: any) { } >foo9 : Symbol(foo9, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints.ts, 45, 25), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints.ts, 47, 35), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints.ts, 48, 28)) @@ -200,13 +200,13 @@ function foo12(x: I); >foo12 : Symbol(foo12, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints.ts, 57, 26), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints.ts, 59, 29), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints.ts, 60, 29)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints.ts, 59, 15)) >I : Symbol(I, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints.ts, 10, 1)) ->Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) function foo12(x: C); // ok >foo12 : Symbol(foo12, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints.ts, 57, 26), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints.ts, 59, 29), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints.ts, 60, 29)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints.ts, 60, 15)) >C : Symbol(C, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints.ts, 6, 1)) ->String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) function foo12(x: any) { } >foo12 : Symbol(foo12, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints.ts, 57, 26), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints.ts, 59, 29), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints.ts, 60, 29)) @@ -221,7 +221,7 @@ function foo12b(x: C); // ok >foo12b : Symbol(foo12b, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints.ts, 61, 26), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints.ts, 63, 23), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints.ts, 64, 30)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints.ts, 64, 16)) >C : Symbol(C, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints.ts, 6, 1)) ->String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) function foo12b(x: any) { } >foo12b : Symbol(foo12b, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints.ts, 61, 26), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints.ts, 63, 23), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints.ts, 64, 30)) @@ -231,7 +231,7 @@ function foo13(x: I); >foo13 : Symbol(foo13, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints.ts, 65, 27), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints.ts, 67, 29), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints.ts, 68, 28)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints.ts, 67, 15)) >I : Symbol(I, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints.ts, 10, 1)) ->Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) function foo13(x: typeof a); // ok >foo13 : Symbol(foo13, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints.ts, 65, 27), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints.ts, 67, 29), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints.ts, 68, 28)) @@ -246,7 +246,7 @@ function foo14(x: I); >foo14 : Symbol(foo14, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints.ts, 69, 26), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints.ts, 71, 29), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints.ts, 72, 28)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints.ts, 71, 15)) >I : Symbol(I, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints.ts, 10, 1)) ->Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) function foo14(x: typeof b); // ok >foo14 : Symbol(foo14, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints.ts, 69, 26), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints.ts, 71, 29), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints.ts, 72, 28)) diff --git a/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.symbols b/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.symbols index ce55a114621..8d82f4ea140 100644 --- a/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.symbols +++ b/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.symbols @@ -22,7 +22,7 @@ class C { >T : Symbol(T, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts, 8, 8)) >U : Symbol(U, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts, 8, 20)) >U : Symbol(U, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts, 8, 20)) ->String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) constructor(x: T, y: U) { return null; } >x : Symbol(x, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts, 9, 16)) @@ -36,7 +36,7 @@ class D { >T : Symbol(T, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts, 12, 8)) >U : Symbol(U, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts, 12, 20)) >U : Symbol(U, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts, 12, 20)) ->Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) constructor(x: T, y: U) { return null; } >x : Symbol(x, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts, 13, 16)) @@ -50,7 +50,7 @@ interface I { >T : Symbol(T, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts, 16, 12)) >U : Symbol(U, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts, 16, 24)) >U : Symbol(U, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts, 16, 24)) ->Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) new(x: T, y: U): string; >x : Symbol(x, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts, 17, 8)) @@ -118,15 +118,15 @@ function foo1c(x: C); >foo1c : Symbol(foo1c, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts, 29, 26), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts, 31, 37), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts, 32, 37)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts, 31, 15)) >C : Symbol(C, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts, 6, 1)) ->String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) function foo1c(x: C); // error >foo1c : Symbol(foo1c, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts, 29, 26), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts, 31, 37), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts, 32, 37)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts, 32, 15)) >C : Symbol(C, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts, 6, 1)) ->String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) function foo1c(x: any) { } >foo1c : Symbol(foo1c, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts, 29, 26), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts, 31, 37), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts, 32, 37)) @@ -136,15 +136,15 @@ function foo2(x: I); >foo2 : Symbol(foo2, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts, 33, 26), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts, 35, 36), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts, 36, 36)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts, 35, 14)) >I : Symbol(I, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts, 14, 1)) ->Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) function foo2(x: I); // error >foo2 : Symbol(foo2, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts, 33, 26), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts, 35, 36), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts, 36, 36)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts, 36, 14)) >I : Symbol(I, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts, 14, 1)) ->Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) function foo2(x: any) { } >foo2 : Symbol(foo2, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts, 33, 26), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts, 35, 36), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts, 36, 36)) @@ -182,15 +182,15 @@ function foo5c(x: C); >foo5c : Symbol(foo5c, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts, 45, 25), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts, 47, 37), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts, 48, 37)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts, 47, 15)) >C : Symbol(C, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts, 6, 1)) ->String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) function foo5c(x: D); // ok >foo5c : Symbol(foo5c, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts, 45, 25), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts, 47, 37), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts, 48, 37)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts, 48, 15)) >D : Symbol(D, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts, 10, 1)) ->Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) function foo5c(x: any) { } >foo5c : Symbol(foo5c, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts, 45, 25), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts, 47, 37), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts, 48, 37)) @@ -200,14 +200,14 @@ function foo6c(x: C); >foo6c : Symbol(foo6c, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts, 49, 26), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts, 51, 37), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts, 52, 34)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts, 51, 15)) >C : Symbol(C, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts, 6, 1)) ->String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) function foo6c(x: D); // ok >foo6c : Symbol(foo6c, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts, 49, 26), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts, 51, 37), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts, 52, 34)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts, 52, 15)) >D : Symbol(D, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts, 10, 1)) ->Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) function foo6c(x: any) { } >foo6c : Symbol(foo6c, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts, 49, 26), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts, 51, 37), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts, 52, 34)) @@ -224,8 +224,8 @@ function foo8(x: I); // ok >foo8 : Symbol(foo8, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts, 53, 26), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts, 55, 50), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts, 56, 36)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts, 56, 14)) >I : Symbol(I, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts, 14, 1)) ->Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) function foo8(x: any) { } >foo8 : Symbol(foo8, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts, 53, 26), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts, 55, 50), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts, 56, 36)) @@ -242,8 +242,8 @@ function foo9(x: C); // error, types are structurally equal >foo9 : Symbol(foo9, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts, 57, 25), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts, 59, 50), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts, 60, 36)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts, 60, 14)) >C : Symbol(C, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts, 6, 1)) ->String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) function foo9(x: any) { } >foo9 : Symbol(foo9, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts, 57, 25), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts, 59, 50), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts, 60, 36)) @@ -285,15 +285,15 @@ function foo12(x: I); >foo12 : Symbol(foo12, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts, 69, 26), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts, 71, 37), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts, 72, 37)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts, 71, 15)) >I : Symbol(I, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts, 14, 1)) ->Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) function foo12(x: C); // ok >foo12 : Symbol(foo12, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts, 69, 26), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts, 71, 37), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts, 72, 37)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts, 72, 15)) >C : Symbol(C, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts, 6, 1)) ->String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) function foo12(x: any) { } >foo12 : Symbol(foo12, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts, 69, 26), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts, 71, 37), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts, 72, 37)) @@ -308,8 +308,8 @@ function foo12b(x: C); // ok >foo12b : Symbol(foo12b, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts, 73, 26), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts, 75, 23), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts, 76, 38)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts, 76, 16)) >C : Symbol(C, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts, 6, 1)) ->String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) function foo12b(x: any) { } >foo12b : Symbol(foo12b, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts, 73, 26), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts, 75, 23), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts, 76, 38)) @@ -319,8 +319,8 @@ function foo13(x: I); >foo13 : Symbol(foo13, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts, 77, 27), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts, 79, 37), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts, 80, 28)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts, 79, 15)) >I : Symbol(I, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts, 14, 1)) ->Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) function foo13(x: typeof a); // ok >foo13 : Symbol(foo13, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts, 77, 27), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts, 79, 37), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts, 80, 28)) @@ -335,8 +335,8 @@ function foo14(x: I); >foo14 : Symbol(foo14, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts, 81, 26), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts, 83, 37), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts, 84, 28)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts, 83, 15)) >I : Symbol(I, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts, 14, 1)) ->Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) function foo14(x: typeof b); // ok >foo14 : Symbol(foo14, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts, 81, 26), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts, 83, 37), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.ts, 84, 28)) diff --git a/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType.symbols b/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType.symbols index 422b5820a8b..418ed27a99d 100644 --- a/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType.symbols +++ b/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType.symbols @@ -28,7 +28,7 @@ interface I { new(x: T): Date; >x : Symbol(x, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType.ts, 13, 8)) >T : Symbol(T, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType.ts, 12, 12)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) } interface I2 { diff --git a/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.symbols b/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.symbols index e44493e933b..23702ebab68 100644 --- a/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.symbols +++ b/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.symbols @@ -6,7 +6,7 @@ class B { >B : Symbol(B, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 0, 0)) >T : Symbol(T, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 4, 8)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) constructor(x: T) { return null; } >x : Symbol(x, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 5, 16)) @@ -16,7 +16,7 @@ class B { class C { >C : Symbol(C, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 6, 1)) >T : Symbol(T, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 8, 8)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) constructor(x: T) { return null; } >x : Symbol(x, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 9, 16)) @@ -26,12 +26,12 @@ class C { interface I { >I : Symbol(I, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 10, 1)) >T : Symbol(T, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 12, 12)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) new(x: T): Date; >x : Symbol(x, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 13, 8)) >T : Symbol(T, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 12, 12)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) } interface I2 { @@ -39,7 +39,7 @@ interface I2 { new(x: T): RegExp; >T : Symbol(T, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 17, 8)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 17, 24)) >T : Symbol(T, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 17, 8)) >RegExp : Symbol(RegExp, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) @@ -48,7 +48,7 @@ interface I2 { var a: { new(x: T): T } >a : Symbol(a, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 20, 3)) >T : Symbol(T, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 20, 13)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 20, 29)) >T : Symbol(T, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 20, 13)) >T : Symbol(T, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 20, 13)) @@ -57,7 +57,7 @@ var b = { new(x: T) { return null; } }; // not a construct signa >b : Symbol(b, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 21, 3)) >new : Symbol(new, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 21, 9)) >T : Symbol(T, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 21, 14)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 21, 30)) >T : Symbol(T, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 21, 14)) @@ -65,13 +65,13 @@ function foo1b(x: B); >foo1b : Symbol(foo1b, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 21, 55), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 23, 27), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 24, 27)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 23, 15)) >B : Symbol(B, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 0, 0)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) function foo1b(x: B); // error >foo1b : Symbol(foo1b, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 21, 55), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 23, 27), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 24, 27)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 24, 15)) >B : Symbol(B, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 0, 0)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) function foo1b(x: any) { } >foo1b : Symbol(foo1b, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 21, 55), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 23, 27), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 24, 27)) @@ -81,13 +81,13 @@ function foo1c(x: C); >foo1c : Symbol(foo1c, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 25, 26), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 27, 27), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 28, 27)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 27, 15)) >C : Symbol(C, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 6, 1)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) function foo1c(x: C); // error >foo1c : Symbol(foo1c, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 25, 26), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 27, 27), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 28, 27)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 28, 15)) >C : Symbol(C, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 6, 1)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) function foo1c(x: any) { } >foo1c : Symbol(foo1c, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 25, 26), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 27, 27), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 28, 27)) @@ -97,13 +97,13 @@ function foo2(x: I); >foo2 : Symbol(foo2, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 29, 26), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 31, 26), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 32, 26)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 31, 14)) >I : Symbol(I, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 10, 1)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) function foo2(x: I); // error >foo2 : Symbol(foo2, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 29, 26), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 31, 26), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 32, 26)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 32, 14)) >I : Symbol(I, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 10, 1)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) function foo2(x: any) { } >foo2 : Symbol(foo2, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 29, 26), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 31, 26), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 32, 26)) @@ -141,13 +141,13 @@ function foo8(x: B); >foo8 : Symbol(foo8, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 41, 25), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 43, 26), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 44, 26)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 43, 14)) >B : Symbol(B, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 0, 0)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) function foo8(x: I); // ok >foo8 : Symbol(foo8, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 41, 25), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 43, 26), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 44, 26)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 44, 14)) >I : Symbol(I, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 10, 1)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) function foo8(x: any) { } >foo8 : Symbol(foo8, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 41, 25), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 43, 26), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 44, 26)) @@ -157,13 +157,13 @@ function foo9(x: B); >foo9 : Symbol(foo9, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 45, 25), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 47, 26), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 48, 26)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 47, 14)) >B : Symbol(B, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 0, 0)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) function foo9(x: C); // error since types are structurally equal >foo9 : Symbol(foo9, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 45, 25), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 47, 26), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 48, 26)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 48, 14)) >C : Symbol(C, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 6, 1)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) function foo9(x: any) { } >foo9 : Symbol(foo9, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 45, 25), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 47, 26), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 48, 26)) @@ -173,7 +173,7 @@ function foo10(x: B); >foo10 : Symbol(foo10, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 49, 25), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 51, 27), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 52, 28)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 51, 15)) >B : Symbol(B, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 0, 0)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) function foo10(x: typeof a); // ok >foo10 : Symbol(foo10, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 49, 25), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 51, 27), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 52, 28)) @@ -188,7 +188,7 @@ function foo11(x: B); >foo11 : Symbol(foo11, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 53, 26), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 55, 27), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 56, 28)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 55, 15)) >B : Symbol(B, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 0, 0)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) function foo11(x: typeof b); // ok >foo11 : Symbol(foo11, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 53, 26), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 55, 27), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 56, 28)) @@ -203,13 +203,13 @@ function foo12(x: I); >foo12 : Symbol(foo12, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 57, 26), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 59, 27), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 60, 27)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 59, 15)) >I : Symbol(I, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 10, 1)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) function foo12(x: C); // ok >foo12 : Symbol(foo12, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 57, 26), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 59, 27), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 60, 27)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 60, 15)) >C : Symbol(C, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 6, 1)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) function foo12(x: any) { } >foo12 : Symbol(foo12, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 57, 26), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 59, 27), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 60, 27)) @@ -224,7 +224,7 @@ function foo12b(x: C); // ok >foo12b : Symbol(foo12b, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 61, 26), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 63, 23), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 64, 28)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 64, 16)) >C : Symbol(C, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 6, 1)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) function foo12b(x: any) { } >foo12b : Symbol(foo12b, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 61, 26), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 63, 23), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 64, 28)) @@ -234,7 +234,7 @@ function foo13(x: I); >foo13 : Symbol(foo13, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 65, 27), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 67, 27), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 68, 28)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 67, 15)) >I : Symbol(I, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 10, 1)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) function foo13(x: typeof a); // ok >foo13 : Symbol(foo13, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 65, 27), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 67, 27), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 68, 28)) @@ -249,7 +249,7 @@ function foo14(x: I); >foo14 : Symbol(foo14, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 69, 26), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 71, 27), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 72, 28)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 71, 15)) >I : Symbol(I, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 10, 1)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) function foo14(x: typeof b); // ok >foo14 : Symbol(foo14, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 69, 26), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 71, 27), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 72, 28)) @@ -269,7 +269,7 @@ function foo15(x: C); // ok >foo15 : Symbol(foo15, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 73, 26), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 75, 22), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 76, 27)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 76, 15)) >C : Symbol(C, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 6, 1)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) function foo15(x: any) { } >foo15 : Symbol(foo15, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 73, 26), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 75, 22), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.ts, 76, 27)) diff --git a/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesDifferingTypeParameterCounts.symbols b/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesDifferingTypeParameterCounts.symbols index 48f28e40b8a..e03c24b2ce5 100644 --- a/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesDifferingTypeParameterCounts.symbols +++ b/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesDifferingTypeParameterCounts.symbols @@ -159,7 +159,7 @@ function foo8(x: I); // BUG 832086 >foo8 : Symbol(foo8, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingTypeParameterCounts.ts, 39, 25), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingTypeParameterCounts.ts, 41, 36), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingTypeParameterCounts.ts, 42, 51)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingTypeParameterCounts.ts, 42, 14)) >I : Symbol(I, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingTypeParameterCounts.ts, 8, 1)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) function foo8(x: any) { } >foo8 : Symbol(foo8, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingTypeParameterCounts.ts, 39, 25), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingTypeParameterCounts.ts, 41, 36), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingTypeParameterCounts.ts, 42, 51)) @@ -213,14 +213,14 @@ function foo12(x: I, number, Date, string>); >x : Symbol(x, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingTypeParameterCounts.ts, 57, 15)) >I : Symbol(I, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingTypeParameterCounts.ts, 8, 1)) >B : Symbol(B, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingTypeParameterCounts.ts, 0, 0)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) function foo12(x: C, number, Date>); // ok >foo12 : Symbol(foo12, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingTypeParameterCounts.ts, 55, 26), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingTypeParameterCounts.ts, 57, 62), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingTypeParameterCounts.ts, 58, 54)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingTypeParameterCounts.ts, 58, 15)) >C : Symbol(C, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingTypeParameterCounts.ts, 4, 1)) >B : Symbol(B, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingTypeParameterCounts.ts, 0, 0)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) function foo12(x: any) { } >foo12 : Symbol(foo12, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingTypeParameterCounts.ts, 55, 26), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingTypeParameterCounts.ts, 57, 62), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingTypeParameterCounts.ts, 58, 54)) @@ -244,9 +244,9 @@ function foo13(x: I); >foo13 : Symbol(foo13, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingTypeParameterCounts.ts, 63, 27), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingTypeParameterCounts.ts, 65, 49), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingTypeParameterCounts.ts, 66, 28)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingTypeParameterCounts.ts, 65, 15)) >I : Symbol(I, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingTypeParameterCounts.ts, 8, 1)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >RegExp : Symbol(RegExp, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) function foo13(x: typeof a); // ok >foo13 : Symbol(foo13, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingTypeParameterCounts.ts, 63, 27), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingTypeParameterCounts.ts, 65, 49), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingTypeParameterCounts.ts, 66, 28)) @@ -261,7 +261,7 @@ function foo14(x: I); >foo14 : Symbol(foo14, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingTypeParameterCounts.ts, 67, 26), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingTypeParameterCounts.ts, 69, 52), Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingTypeParameterCounts.ts, 70, 28)) >x : Symbol(x, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingTypeParameterCounts.ts, 69, 15)) >I : Symbol(I, Decl(objectTypesIdentityWithGenericConstructSignaturesDifferingTypeParameterCounts.ts, 8, 1)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >RegExp : Symbol(RegExp, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) function foo14(x: typeof b); // ok diff --git a/tests/baselines/reference/objectTypesIdentityWithPrivates3.errors.txt b/tests/baselines/reference/objectTypesIdentityWithPrivates3.errors.txt index 9cbaa730022..2342065605b 100644 --- a/tests/baselines/reference/objectTypesIdentityWithPrivates3.errors.txt +++ b/tests/baselines/reference/objectTypesIdentityWithPrivates3.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithPrivates3.ts(25,1): error TS2352: Neither type 'C3' nor type 'C4' is assignable to the other. +tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithPrivates3.ts(25,1): error TS2352: Type 'C3' cannot be converted to type 'C4'. Property 'y' is missing in type 'C3'. @@ -29,5 +29,5 @@ tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectType var c3: C3; c3; // Should fail (private x originates in the same declaration, but different types) ~~~~~~ -!!! error TS2352: Neither type 'C3' nor type 'C4' is assignable to the other. +!!! error TS2352: Type 'C3' cannot be converted to type 'C4'. !!! error TS2352: Property 'y' is missing in type 'C3'. \ No newline at end of file diff --git a/tests/baselines/reference/overloadOnGenericArity.symbols b/tests/baselines/reference/overloadOnGenericArity.symbols index e585d3a38a0..a50a788b4e8 100644 --- a/tests/baselines/reference/overloadOnGenericArity.symbols +++ b/tests/baselines/reference/overloadOnGenericArity.symbols @@ -10,7 +10,7 @@ interface Test { then(p: string): Date; // Error: Overloads cannot differ only by return type >then : Symbol(Test.then, Decl(overloadOnGenericArity.ts, 0, 16), Decl(overloadOnGenericArity.ts, 1, 31)) >p : Symbol(p, Decl(overloadOnGenericArity.ts, 2, 9)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) } diff --git a/tests/baselines/reference/overloadresolutionWithConstraintCheckingDeferred.errors.txt b/tests/baselines/reference/overloadresolutionWithConstraintCheckingDeferred.errors.txt index 5ca1e78de58..3c06fd43275 100644 --- a/tests/baselines/reference/overloadresolutionWithConstraintCheckingDeferred.errors.txt +++ b/tests/baselines/reference/overloadresolutionWithConstraintCheckingDeferred.errors.txt @@ -39,16 +39,13 @@ tests/cases/compiler/overloadresolutionWithConstraintCheckingDeferred.ts(19,14): var result3: string = foo(x => { // x has type D ~~~~~~~~~~~~~~~~~~~~~~ - var y: G; // error that D does not satisfy constraint, y is of type G, entire call to foo is an error - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - ~~~~~~~~ -!!! error TS2344: Type 'D' does not satisfy the constraint 'A'. - return y; - ~~~~~~~~~~~~~ - }); - ~ !!! error TS2345: Argument of type '(x: D) => G' is not assignable to parameter of type '(x: B) => any'. !!! error TS2345: Types of parameters 'x' and 'x' are incompatible. !!! error TS2345: Type 'B' is not assignable to type 'D'. !!! error TS2345: Property 'q' is missing in type 'B'. + var y: G; // error that D does not satisfy constraint, y is of type G, entire call to foo is an error + ~~~~~~~~ +!!! error TS2344: Type 'D' does not satisfy the constraint 'A'. + return y; + }); \ No newline at end of file diff --git a/tests/baselines/reference/overloadsWithConstraints.symbols b/tests/baselines/reference/overloadsWithConstraints.symbols index 4b33826e6b8..d3a3574da6a 100644 --- a/tests/baselines/reference/overloadsWithConstraints.symbols +++ b/tests/baselines/reference/overloadsWithConstraints.symbols @@ -2,7 +2,7 @@ declare function f(x: T): T; >f : Symbol(f, Decl(overloadsWithConstraints.ts, 0, 0), Decl(overloadsWithConstraints.ts, 0, 46)) >T : Symbol(T, Decl(overloadsWithConstraints.ts, 0, 19)) ->Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >x : Symbol(x, Decl(overloadsWithConstraints.ts, 0, 37)) >T : Symbol(T, Decl(overloadsWithConstraints.ts, 0, 19)) >T : Symbol(T, Decl(overloadsWithConstraints.ts, 0, 19)) @@ -10,7 +10,7 @@ declare function f(x: T): T; declare function f(x: T): T >f : Symbol(f, Decl(overloadsWithConstraints.ts, 0, 0), Decl(overloadsWithConstraints.ts, 0, 46)) >T : Symbol(T, Decl(overloadsWithConstraints.ts, 1, 19)) ->String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >x : Symbol(x, Decl(overloadsWithConstraints.ts, 1, 37)) >T : Symbol(T, Decl(overloadsWithConstraints.ts, 1, 19)) >T : Symbol(T, Decl(overloadsWithConstraints.ts, 1, 19)) diff --git a/tests/baselines/reference/parenthesizedContexualTyping3.symbols b/tests/baselines/reference/parenthesizedContexualTyping3.symbols index 4db888efd61..1d4bce3f230 100644 --- a/tests/baselines/reference/parenthesizedContexualTyping3.symbols +++ b/tests/baselines/reference/parenthesizedContexualTyping3.symbols @@ -9,7 +9,7 @@ function tempFun(tempStrs: TemplateStringsArray, g: (x: T) => T, x: T): T; >tempFun : Symbol(tempFun, Decl(parenthesizedContexualTyping3.ts, 0, 0), Decl(parenthesizedContexualTyping3.ts, 6, 77), Decl(parenthesizedContexualTyping3.ts, 7, 93)) >T : Symbol(T, Decl(parenthesizedContexualTyping3.ts, 6, 17)) >tempStrs : Symbol(tempStrs, Decl(parenthesizedContexualTyping3.ts, 6, 20)) ->TemplateStringsArray : Symbol(TemplateStringsArray, Decl(lib.d.ts, --, --)) +>TemplateStringsArray : Symbol(TemplateStringsArray, Decl(lib.es5.d.ts, --, --)) >g : Symbol(g, Decl(parenthesizedContexualTyping3.ts, 6, 51)) >x : Symbol(x, Decl(parenthesizedContexualTyping3.ts, 6, 56)) >T : Symbol(T, Decl(parenthesizedContexualTyping3.ts, 6, 17)) @@ -22,7 +22,7 @@ function tempFun(tempStrs: TemplateStringsArray, g: (x: T) => T, h: (y: T) => >tempFun : Symbol(tempFun, Decl(parenthesizedContexualTyping3.ts, 0, 0), Decl(parenthesizedContexualTyping3.ts, 6, 77), Decl(parenthesizedContexualTyping3.ts, 7, 93)) >T : Symbol(T, Decl(parenthesizedContexualTyping3.ts, 7, 17)) >tempStrs : Symbol(tempStrs, Decl(parenthesizedContexualTyping3.ts, 7, 20)) ->TemplateStringsArray : Symbol(TemplateStringsArray, Decl(lib.d.ts, --, --)) +>TemplateStringsArray : Symbol(TemplateStringsArray, Decl(lib.es5.d.ts, --, --)) >g : Symbol(g, Decl(parenthesizedContexualTyping3.ts, 7, 51)) >x : Symbol(x, Decl(parenthesizedContexualTyping3.ts, 7, 56)) >T : Symbol(T, Decl(parenthesizedContexualTyping3.ts, 7, 17)) @@ -39,7 +39,7 @@ function tempFun(tempStrs: TemplateStringsArray, g: (x: T) => T, x: T): T { >tempFun : Symbol(tempFun, Decl(parenthesizedContexualTyping3.ts, 0, 0), Decl(parenthesizedContexualTyping3.ts, 6, 77), Decl(parenthesizedContexualTyping3.ts, 7, 93)) >T : Symbol(T, Decl(parenthesizedContexualTyping3.ts, 8, 17)) >tempStrs : Symbol(tempStrs, Decl(parenthesizedContexualTyping3.ts, 8, 20)) ->TemplateStringsArray : Symbol(TemplateStringsArray, Decl(lib.d.ts, --, --)) +>TemplateStringsArray : Symbol(TemplateStringsArray, Decl(lib.es5.d.ts, --, --)) >g : Symbol(g, Decl(parenthesizedContexualTyping3.ts, 8, 51)) >x : Symbol(x, Decl(parenthesizedContexualTyping3.ts, 8, 56)) >T : Symbol(T, Decl(parenthesizedContexualTyping3.ts, 8, 17)) diff --git a/tests/baselines/reference/parserSymbolProperty1.symbols b/tests/baselines/reference/parserSymbolProperty1.symbols index b337b6ae30b..f9e377e054e 100644 --- a/tests/baselines/reference/parserSymbolProperty1.symbols +++ b/tests/baselines/reference/parserSymbolProperty1.symbols @@ -3,7 +3,7 @@ interface I { >I : Symbol(I, Decl(parserSymbolProperty1.ts, 0, 0)) [Symbol.iterator]: string; ->Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) +>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) } diff --git a/tests/baselines/reference/parserSymbolProperty2.symbols b/tests/baselines/reference/parserSymbolProperty2.symbols index d4bfa388fa8..f5bb7fa0f53 100644 --- a/tests/baselines/reference/parserSymbolProperty2.symbols +++ b/tests/baselines/reference/parserSymbolProperty2.symbols @@ -3,7 +3,7 @@ interface I { >I : Symbol(I, Decl(parserSymbolProperty2.ts, 0, 0)) [Symbol.unscopables](): string; ->Symbol.unscopables : Symbol(SymbolConstructor.unscopables, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->unscopables : Symbol(SymbolConstructor.unscopables, Decl(lib.d.ts, --, --)) +>Symbol.unscopables : Symbol(SymbolConstructor.unscopables, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>unscopables : Symbol(SymbolConstructor.unscopables, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) } diff --git a/tests/baselines/reference/parserSymbolProperty3.symbols b/tests/baselines/reference/parserSymbolProperty3.symbols index b740d5be4ad..9d2266ad4b7 100644 --- a/tests/baselines/reference/parserSymbolProperty3.symbols +++ b/tests/baselines/reference/parserSymbolProperty3.symbols @@ -3,7 +3,7 @@ declare class C { >C : Symbol(C, Decl(parserSymbolProperty3.ts, 0, 0)) [Symbol.unscopables](): string; ->Symbol.unscopables : Symbol(SymbolConstructor.unscopables, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->unscopables : Symbol(SymbolConstructor.unscopables, Decl(lib.d.ts, --, --)) +>Symbol.unscopables : Symbol(SymbolConstructor.unscopables, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>unscopables : Symbol(SymbolConstructor.unscopables, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) } diff --git a/tests/baselines/reference/parserSymbolProperty4.symbols b/tests/baselines/reference/parserSymbolProperty4.symbols index 65250e977b7..e37cb6bc011 100644 --- a/tests/baselines/reference/parserSymbolProperty4.symbols +++ b/tests/baselines/reference/parserSymbolProperty4.symbols @@ -3,7 +3,7 @@ declare class C { >C : Symbol(C, Decl(parserSymbolProperty4.ts, 0, 0)) [Symbol.toPrimitive]: string; ->Symbol.toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, --, --)) +>Symbol.toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) } diff --git a/tests/baselines/reference/parserSymbolProperty5.symbols b/tests/baselines/reference/parserSymbolProperty5.symbols index c883c0aa12f..f8fb7d93417 100644 --- a/tests/baselines/reference/parserSymbolProperty5.symbols +++ b/tests/baselines/reference/parserSymbolProperty5.symbols @@ -3,7 +3,7 @@ class C { >C : Symbol(C, Decl(parserSymbolProperty5.ts, 0, 0)) [Symbol.toPrimitive]: string; ->Symbol.toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, --, --)) +>Symbol.toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) } diff --git a/tests/baselines/reference/parserSymbolProperty6.symbols b/tests/baselines/reference/parserSymbolProperty6.symbols index d8a2b9bf1cc..7fb83ea9ffa 100644 --- a/tests/baselines/reference/parserSymbolProperty6.symbols +++ b/tests/baselines/reference/parserSymbolProperty6.symbols @@ -3,7 +3,7 @@ class C { >C : Symbol(C, Decl(parserSymbolProperty6.ts, 0, 0)) [Symbol.toStringTag]: string = ""; ->Symbol.toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.d.ts, --, --)) +>Symbol.toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) } diff --git a/tests/baselines/reference/parserSymbolProperty7.symbols b/tests/baselines/reference/parserSymbolProperty7.symbols index 9319dfe87bb..8d71cbb1a0d 100644 --- a/tests/baselines/reference/parserSymbolProperty7.symbols +++ b/tests/baselines/reference/parserSymbolProperty7.symbols @@ -3,7 +3,7 @@ class C { >C : Symbol(C, Decl(parserSymbolProperty7.ts, 0, 0)) [Symbol.toStringTag](): void { } ->Symbol.toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.d.ts, --, --)) +>Symbol.toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) } diff --git a/tests/baselines/reference/parserSymbolProperty8.symbols b/tests/baselines/reference/parserSymbolProperty8.symbols index 2a58473973e..e20dd2dbba4 100644 --- a/tests/baselines/reference/parserSymbolProperty8.symbols +++ b/tests/baselines/reference/parserSymbolProperty8.symbols @@ -3,7 +3,7 @@ var x: { >x : Symbol(x, Decl(parserSymbolProperty8.ts, 0, 3)) [Symbol.toPrimitive](): string ->Symbol.toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, --, --)) +>Symbol.toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) } diff --git a/tests/baselines/reference/parserSymbolProperty9.symbols b/tests/baselines/reference/parserSymbolProperty9.symbols index 85c66b21d5e..c70643c254a 100644 --- a/tests/baselines/reference/parserSymbolProperty9.symbols +++ b/tests/baselines/reference/parserSymbolProperty9.symbols @@ -3,7 +3,7 @@ var x: { >x : Symbol(x, Decl(parserSymbolProperty9.ts, 0, 3)) [Symbol.toPrimitive]: string ->Symbol.toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, --, --)) +>Symbol.toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) } diff --git a/tests/baselines/reference/pathMappingBasedModuleResolution3_classic.trace.json b/tests/baselines/reference/pathMappingBasedModuleResolution3_classic.trace.json index 513198c50b0..8b003e05e8f 100644 --- a/tests/baselines/reference/pathMappingBasedModuleResolution3_classic.trace.json +++ b/tests/baselines/reference/pathMappingBasedModuleResolution3_classic.trace.json @@ -3,11 +3,11 @@ "Explicitly specified module resolution kind: 'Classic'.", "'baseUrl' option is set to 'c:/root', using this value to resolve non-relative module name 'folder2/file2'", "Resolving module name 'folder2/file2' relative to base url 'c:/root' - 'c:/root/folder2/file2'.", - "File 'c:/root/folder2/file2.ts' exist - use it as a module resolution result.", + "File 'c:/root/folder2/file2.ts' exist - use it as a name resolution result.", "======== Module name 'folder2/file2' was successfully resolved to 'c:/root/folder2/file2.ts'. ========", "======== Resolving module './file3' from 'c:/root/folder2/file2.ts'. ========", "Explicitly specified module resolution kind: 'Classic'.", - "File 'c:/root/folder2/file3.ts' exist - use it as a module resolution result.", + "File 'c:/root/folder2/file3.ts' exist - use it as a name resolution result.", "======== Module name './file3' was successfully resolved to 'c:/root/folder2/file3.ts'. ========", "======== Resolving module 'file4' from 'c:/root/folder2/file2.ts'. ========", "Explicitly specified module resolution kind: 'Classic'.", @@ -19,6 +19,6 @@ "File 'c:/root/folder2/file4.d.ts' does not exist.", "File 'c:/root/file4.ts' does not exist.", "File 'c:/root/file4.d.ts' does not exist.", - "File 'c:/file4.ts' exist - use it as a module resolution result.", + "File 'c:/file4.ts' exist - use it as a name resolution result.", "======== Module name 'file4' was successfully resolved to 'c:/file4.ts'. ========" ] \ No newline at end of file diff --git a/tests/baselines/reference/pathMappingBasedModuleResolution3_node.trace.json b/tests/baselines/reference/pathMappingBasedModuleResolution3_node.trace.json index 6d0de807bc0..af5e20a3cc3 100644 --- a/tests/baselines/reference/pathMappingBasedModuleResolution3_node.trace.json +++ b/tests/baselines/reference/pathMappingBasedModuleResolution3_node.trace.json @@ -4,12 +4,12 @@ "'baseUrl' option is set to 'c:/root', using this value to resolve non-relative module name 'folder2/file2'", "Resolving module name 'folder2/file2' relative to base url 'c:/root' - 'c:/root/folder2/file2'.", "Loading module as file / folder, candidate module location 'c:/root/folder2/file2'.", - "File 'c:/root/folder2/file2.ts' exist - use it as a module resolution result.", + "File 'c:/root/folder2/file2.ts' exist - use it as a name resolution result.", "======== Module name 'folder2/file2' was successfully resolved to 'c:/root/folder2/file2.ts'. ========", "======== Resolving module './file3' from 'c:/root/folder2/file2.ts'. ========", "Explicitly specified module resolution kind: 'NodeJs'.", "Loading module as file / folder, candidate module location 'c:/root/folder2/file3'.", - "File 'c:/root/folder2/file3.ts' exist - use it as a module resolution result.", + "File 'c:/root/folder2/file3.ts' exist - use it as a name resolution result.", "======== Module name './file3' was successfully resolved to 'c:/root/folder2/file3.ts'. ========", "======== Resolving module 'file4' from 'c:/root/folder2/file2.ts'. ========", "Explicitly specified module resolution kind: 'NodeJs'.", @@ -31,6 +31,13 @@ "File 'c:/root/folder2/node_modules/file4/index.ts' does not exist.", "File 'c:/root/folder2/node_modules/file4/index.tsx' does not exist.", "File 'c:/root/folder2/node_modules/file4/index.d.ts' does not exist.", + "File 'c:/root/folder2/node_modules/@types/file4.ts' does not exist.", + "File 'c:/root/folder2/node_modules/@types/file4.tsx' does not exist.", + "File 'c:/root/folder2/node_modules/@types/file4.d.ts' does not exist.", + "File 'c:/root/folder2/node_modules/@types/file4/package.json' does not exist.", + "File 'c:/root/folder2/node_modules/@types/file4/index.ts' does not exist.", + "File 'c:/root/folder2/node_modules/@types/file4/index.tsx' does not exist.", + "File 'c:/root/folder2/node_modules/@types/file4/index.d.ts' does not exist.", "File 'c:/root/node_modules/file4.ts' does not exist.", "File 'c:/root/node_modules/file4.tsx' does not exist.", "File 'c:/root/node_modules/file4.d.ts' does not exist.", @@ -38,12 +45,19 @@ "File 'c:/root/node_modules/file4/index.ts' does not exist.", "File 'c:/root/node_modules/file4/index.tsx' does not exist.", "File 'c:/root/node_modules/file4/index.d.ts' does not exist.", + "File 'c:/root/node_modules/@types/file4.ts' does not exist.", + "File 'c:/root/node_modules/@types/file4.tsx' does not exist.", + "File 'c:/root/node_modules/@types/file4.d.ts' does not exist.", + "File 'c:/root/node_modules/@types/file4/package.json' does not exist.", + "File 'c:/root/node_modules/@types/file4/index.ts' does not exist.", + "File 'c:/root/node_modules/@types/file4/index.tsx' does not exist.", + "File 'c:/root/node_modules/@types/file4/index.d.ts' does not exist.", "File 'c:/node_modules/file4.ts' does not exist.", "File 'c:/node_modules/file4.tsx' does not exist.", "File 'c:/node_modules/file4.d.ts' does not exist.", "File 'c:/node_modules/file4/package.json' does not exist.", "File 'c:/node_modules/file4/index.ts' does not exist.", "File 'c:/node_modules/file4/index.tsx' does not exist.", - "File 'c:/node_modules/file4/index.d.ts' exist - use it as a module resolution result.", + "File 'c:/node_modules/file4/index.d.ts' exist - use it as a name resolution result.", "======== Module name 'file4' was successfully resolved to 'c:/node_modules/file4/index.d.ts'. ========" ] \ No newline at end of file diff --git a/tests/baselines/reference/pathMappingBasedModuleResolution4_classic.trace.json b/tests/baselines/reference/pathMappingBasedModuleResolution4_classic.trace.json index 513198c50b0..8b003e05e8f 100644 --- a/tests/baselines/reference/pathMappingBasedModuleResolution4_classic.trace.json +++ b/tests/baselines/reference/pathMappingBasedModuleResolution4_classic.trace.json @@ -3,11 +3,11 @@ "Explicitly specified module resolution kind: 'Classic'.", "'baseUrl' option is set to 'c:/root', using this value to resolve non-relative module name 'folder2/file2'", "Resolving module name 'folder2/file2' relative to base url 'c:/root' - 'c:/root/folder2/file2'.", - "File 'c:/root/folder2/file2.ts' exist - use it as a module resolution result.", + "File 'c:/root/folder2/file2.ts' exist - use it as a name resolution result.", "======== Module name 'folder2/file2' was successfully resolved to 'c:/root/folder2/file2.ts'. ========", "======== Resolving module './file3' from 'c:/root/folder2/file2.ts'. ========", "Explicitly specified module resolution kind: 'Classic'.", - "File 'c:/root/folder2/file3.ts' exist - use it as a module resolution result.", + "File 'c:/root/folder2/file3.ts' exist - use it as a name resolution result.", "======== Module name './file3' was successfully resolved to 'c:/root/folder2/file3.ts'. ========", "======== Resolving module 'file4' from 'c:/root/folder2/file2.ts'. ========", "Explicitly specified module resolution kind: 'Classic'.", @@ -19,6 +19,6 @@ "File 'c:/root/folder2/file4.d.ts' does not exist.", "File 'c:/root/file4.ts' does not exist.", "File 'c:/root/file4.d.ts' does not exist.", - "File 'c:/file4.ts' exist - use it as a module resolution result.", + "File 'c:/file4.ts' exist - use it as a name resolution result.", "======== Module name 'file4' was successfully resolved to 'c:/file4.ts'. ========" ] \ No newline at end of file diff --git a/tests/baselines/reference/pathMappingBasedModuleResolution4_node.trace.json b/tests/baselines/reference/pathMappingBasedModuleResolution4_node.trace.json index 6d0de807bc0..af5e20a3cc3 100644 --- a/tests/baselines/reference/pathMappingBasedModuleResolution4_node.trace.json +++ b/tests/baselines/reference/pathMappingBasedModuleResolution4_node.trace.json @@ -4,12 +4,12 @@ "'baseUrl' option is set to 'c:/root', using this value to resolve non-relative module name 'folder2/file2'", "Resolving module name 'folder2/file2' relative to base url 'c:/root' - 'c:/root/folder2/file2'.", "Loading module as file / folder, candidate module location 'c:/root/folder2/file2'.", - "File 'c:/root/folder2/file2.ts' exist - use it as a module resolution result.", + "File 'c:/root/folder2/file2.ts' exist - use it as a name resolution result.", "======== Module name 'folder2/file2' was successfully resolved to 'c:/root/folder2/file2.ts'. ========", "======== Resolving module './file3' from 'c:/root/folder2/file2.ts'. ========", "Explicitly specified module resolution kind: 'NodeJs'.", "Loading module as file / folder, candidate module location 'c:/root/folder2/file3'.", - "File 'c:/root/folder2/file3.ts' exist - use it as a module resolution result.", + "File 'c:/root/folder2/file3.ts' exist - use it as a name resolution result.", "======== Module name './file3' was successfully resolved to 'c:/root/folder2/file3.ts'. ========", "======== Resolving module 'file4' from 'c:/root/folder2/file2.ts'. ========", "Explicitly specified module resolution kind: 'NodeJs'.", @@ -31,6 +31,13 @@ "File 'c:/root/folder2/node_modules/file4/index.ts' does not exist.", "File 'c:/root/folder2/node_modules/file4/index.tsx' does not exist.", "File 'c:/root/folder2/node_modules/file4/index.d.ts' does not exist.", + "File 'c:/root/folder2/node_modules/@types/file4.ts' does not exist.", + "File 'c:/root/folder2/node_modules/@types/file4.tsx' does not exist.", + "File 'c:/root/folder2/node_modules/@types/file4.d.ts' does not exist.", + "File 'c:/root/folder2/node_modules/@types/file4/package.json' does not exist.", + "File 'c:/root/folder2/node_modules/@types/file4/index.ts' does not exist.", + "File 'c:/root/folder2/node_modules/@types/file4/index.tsx' does not exist.", + "File 'c:/root/folder2/node_modules/@types/file4/index.d.ts' does not exist.", "File 'c:/root/node_modules/file4.ts' does not exist.", "File 'c:/root/node_modules/file4.tsx' does not exist.", "File 'c:/root/node_modules/file4.d.ts' does not exist.", @@ -38,12 +45,19 @@ "File 'c:/root/node_modules/file4/index.ts' does not exist.", "File 'c:/root/node_modules/file4/index.tsx' does not exist.", "File 'c:/root/node_modules/file4/index.d.ts' does not exist.", + "File 'c:/root/node_modules/@types/file4.ts' does not exist.", + "File 'c:/root/node_modules/@types/file4.tsx' does not exist.", + "File 'c:/root/node_modules/@types/file4.d.ts' does not exist.", + "File 'c:/root/node_modules/@types/file4/package.json' does not exist.", + "File 'c:/root/node_modules/@types/file4/index.ts' does not exist.", + "File 'c:/root/node_modules/@types/file4/index.tsx' does not exist.", + "File 'c:/root/node_modules/@types/file4/index.d.ts' does not exist.", "File 'c:/node_modules/file4.ts' does not exist.", "File 'c:/node_modules/file4.tsx' does not exist.", "File 'c:/node_modules/file4.d.ts' does not exist.", "File 'c:/node_modules/file4/package.json' does not exist.", "File 'c:/node_modules/file4/index.ts' does not exist.", "File 'c:/node_modules/file4/index.tsx' does not exist.", - "File 'c:/node_modules/file4/index.d.ts' exist - use it as a module resolution result.", + "File 'c:/node_modules/file4/index.d.ts' exist - use it as a name resolution result.", "======== Module name 'file4' was successfully resolved to 'c:/node_modules/file4/index.d.ts'. ========" ] \ No newline at end of file diff --git a/tests/baselines/reference/pathMappingBasedModuleResolution5_classic.trace.json b/tests/baselines/reference/pathMappingBasedModuleResolution5_classic.trace.json index 099acae2aca..d1709c82dc6 100644 --- a/tests/baselines/reference/pathMappingBasedModuleResolution5_classic.trace.json +++ b/tests/baselines/reference/pathMappingBasedModuleResolution5_classic.trace.json @@ -5,7 +5,7 @@ "'paths' option is specified, looking for a pattern to match module name 'folder2/file1'.", "Module name 'folder2/file1', matched pattern '*'.", "Trying substitution '*', candidate module location: 'folder2/file1'.", - "File 'c:/root/folder2/file1.ts' exist - use it as a module resolution result.", + "File 'c:/root/folder2/file1.ts' exist - use it as a name resolution result.", "======== Module name 'folder2/file1' was successfully resolved to 'c:/root/folder2/file1.ts'. ========", "======== Resolving module 'folder3/file2' from 'c:/root/folder1/file1.ts'. ========", "Module resolution kind is not specified, using 'Classic'.", @@ -16,7 +16,7 @@ "File 'c:/root/folder3/file2.ts' does not exist.", "File 'c:/root/folder3/file2.d.ts' does not exist.", "Trying substitution 'generated/*', candidate module location: 'generated/folder3/file2'.", - "File 'c:/root/generated/folder3/file2.ts' exist - use it as a module resolution result.", + "File 'c:/root/generated/folder3/file2.ts' exist - use it as a name resolution result.", "======== Module name 'folder3/file2' was successfully resolved to 'c:/root/generated/folder3/file2.ts'. ========", "======== Resolving module 'components/file3' from 'c:/root/folder1/file1.ts'. ========", "Module resolution kind is not specified, using 'Classic'.", @@ -24,7 +24,7 @@ "'paths' option is specified, looking for a pattern to match module name 'components/file3'.", "Module name 'components/file3', matched pattern 'components/*'.", "Trying substitution 'shared/components/*', candidate module location: 'shared/components/file3'.", - "File 'c:/root/shared/components/file3.ts' exist - use it as a module resolution result.", + "File 'c:/root/shared/components/file3.ts' exist - use it as a name resolution result.", "======== Module name 'components/file3' was successfully resolved to 'c:/root/shared/components/file3.ts'. ========", "======== Resolving module 'file4' from 'c:/root/folder1/file1.ts'. ========", "Module resolution kind is not specified, using 'Classic'.", @@ -41,6 +41,6 @@ "File 'c:/root/folder1/file4.d.ts' does not exist.", "File 'c:/root/file4.ts' does not exist.", "File 'c:/root/file4.d.ts' does not exist.", - "File 'c:/file4.ts' exist - use it as a module resolution result.", + "File 'c:/file4.ts' exist - use it as a name resolution result.", "======== Module name 'file4' was successfully resolved to 'c:/file4.ts'. ========" ] \ No newline at end of file diff --git a/tests/baselines/reference/pathMappingBasedModuleResolution5_node.trace.json b/tests/baselines/reference/pathMappingBasedModuleResolution5_node.trace.json index 398d15839de..cebd59f01b4 100644 --- a/tests/baselines/reference/pathMappingBasedModuleResolution5_node.trace.json +++ b/tests/baselines/reference/pathMappingBasedModuleResolution5_node.trace.json @@ -6,7 +6,7 @@ "Module name 'folder2/file1', matched pattern '*'.", "Trying substitution '*', candidate module location: 'folder2/file1'.", "Loading module as file / folder, candidate module location 'c:/root/folder2/file1'.", - "File 'c:/root/folder2/file1.ts' exist - use it as a module resolution result.", + "File 'c:/root/folder2/file1.ts' exist - use it as a name resolution result.", "======== Module name 'folder2/file1' was successfully resolved to 'c:/root/folder2/file1.ts'. ========", "======== Resolving module 'folder3/file2' from 'c:/root/folder1/file1.ts'. ========", "Module resolution kind is not specified, using 'NodeJs'.", @@ -24,7 +24,7 @@ "File 'c:/root/folder3/file2/index.d.ts' does not exist.", "Trying substitution 'generated/*', candidate module location: 'generated/folder3/file2'.", "Loading module as file / folder, candidate module location 'c:/root/generated/folder3/file2'.", - "File 'c:/root/generated/folder3/file2.ts' exist - use it as a module resolution result.", + "File 'c:/root/generated/folder3/file2.ts' exist - use it as a name resolution result.", "======== Module name 'folder3/file2' was successfully resolved to 'c:/root/generated/folder3/file2.ts'. ========", "======== Resolving module 'components/file3' from 'c:/root/folder1/file1.ts'. ========", "Module resolution kind is not specified, using 'NodeJs'.", @@ -39,7 +39,7 @@ "File 'c:/root/shared/components/file3/package.json' does not exist.", "File 'c:/root/shared/components/file3/index.ts' does not exist.", "File 'c:/root/shared/components/file3/index.tsx' does not exist.", - "File 'c:/root/shared/components/file3/index.d.ts' exist - use it as a module resolution result.", + "File 'c:/root/shared/components/file3/index.d.ts' exist - use it as a name resolution result.", "======== Module name 'components/file3' was successfully resolved to 'c:/root/shared/components/file3/index.d.ts'. ========", "======== Resolving module 'file4' from 'c:/root/folder1/file1.ts'. ========", "Module resolution kind is not specified, using 'NodeJs'.", @@ -72,6 +72,13 @@ "File 'c:/root/folder1/node_modules/file4/index.ts' does not exist.", "File 'c:/root/folder1/node_modules/file4/index.tsx' does not exist.", "File 'c:/root/folder1/node_modules/file4/index.d.ts' does not exist.", + "File 'c:/root/folder1/node_modules/@types/file4.ts' does not exist.", + "File 'c:/root/folder1/node_modules/@types/file4.tsx' does not exist.", + "File 'c:/root/folder1/node_modules/@types/file4.d.ts' does not exist.", + "File 'c:/root/folder1/node_modules/@types/file4/package.json' does not exist.", + "File 'c:/root/folder1/node_modules/@types/file4/index.ts' does not exist.", + "File 'c:/root/folder1/node_modules/@types/file4/index.tsx' does not exist.", + "File 'c:/root/folder1/node_modules/@types/file4/index.d.ts' does not exist.", "File 'c:/root/node_modules/file4.ts' does not exist.", "File 'c:/root/node_modules/file4.tsx' does not exist.", "File 'c:/root/node_modules/file4.d.ts' does not exist.", @@ -79,6 +86,13 @@ "File 'c:/root/node_modules/file4/index.ts' does not exist.", "File 'c:/root/node_modules/file4/index.tsx' does not exist.", "File 'c:/root/node_modules/file4/index.d.ts' does not exist.", - "File 'c:/node_modules/file4.ts' exist - use it as a module resolution result.", + "File 'c:/root/node_modules/@types/file4.ts' does not exist.", + "File 'c:/root/node_modules/@types/file4.tsx' does not exist.", + "File 'c:/root/node_modules/@types/file4.d.ts' does not exist.", + "File 'c:/root/node_modules/@types/file4/package.json' does not exist.", + "File 'c:/root/node_modules/@types/file4/index.ts' does not exist.", + "File 'c:/root/node_modules/@types/file4/index.tsx' does not exist.", + "File 'c:/root/node_modules/@types/file4/index.d.ts' does not exist.", + "File 'c:/node_modules/file4.ts' exist - use it as a name resolution result.", "======== Module name 'file4' was successfully resolved to 'c:/node_modules/file4.ts'. ========" ] \ No newline at end of file diff --git a/tests/baselines/reference/pathMappingBasedModuleResolution6_classic.trace.json b/tests/baselines/reference/pathMappingBasedModuleResolution6_classic.trace.json index 0493e9c216b..20fc416ccd4 100644 --- a/tests/baselines/reference/pathMappingBasedModuleResolution6_classic.trace.json +++ b/tests/baselines/reference/pathMappingBasedModuleResolution6_classic.trace.json @@ -10,7 +10,7 @@ "File 'c:/root/src/project/file3.d.ts' does not exist.", "Trying other entries in 'rootDirs'", "Loading 'project/file3' from the root dir 'c:/root/generated/src', candidate location 'c:/root/generated/src/project/file3'", - "File 'c:/root/generated/src/project/file3.ts' exist - use it as a module resolution result.", + "File 'c:/root/generated/src/project/file3.ts' exist - use it as a name resolution result.", "======== Module name './project/file3' was successfully resolved to 'c:/root/generated/src/project/file3.ts'. ========", "======== Resolving module '../file2' from 'c:/root/generated/src/project/file3.ts'. ========", "Module resolution kind is not specified, using 'Classic'.", @@ -24,6 +24,6 @@ "Trying other entries in 'rootDirs'", "Loading 'file2' from the root dir 'c:/root/src', candidate location 'c:/root/src/file2'", "File 'c:/root/src/file2.ts' does not exist.", - "File 'c:/root/src/file2.d.ts' exist - use it as a module resolution result.", + "File 'c:/root/src/file2.d.ts' exist - use it as a name resolution result.", "======== Module name '../file2' was successfully resolved to 'c:/root/src/file2.d.ts'. ========" ] \ No newline at end of file diff --git a/tests/baselines/reference/pathMappingBasedModuleResolution6_node.trace.json b/tests/baselines/reference/pathMappingBasedModuleResolution6_node.trace.json index 4ea2f12a63c..7c5e76a2847 100644 --- a/tests/baselines/reference/pathMappingBasedModuleResolution6_node.trace.json +++ b/tests/baselines/reference/pathMappingBasedModuleResolution6_node.trace.json @@ -17,7 +17,7 @@ "Trying other entries in 'rootDirs'", "Loading 'project/file3' from the root dir 'c:/root/generated/src', candidate location 'c:/root/generated/src/project/file3'", "Loading module as file / folder, candidate module location 'c:/root/generated/src/project/file3'.", - "File 'c:/root/generated/src/project/file3.ts' exist - use it as a module resolution result.", + "File 'c:/root/generated/src/project/file3.ts' exist - use it as a name resolution result.", "======== Module name './project/file3' was successfully resolved to 'c:/root/generated/src/project/file3.ts'. ========", "======== Resolving module '../file2' from 'c:/root/generated/src/project/file3.ts'. ========", "Module resolution kind is not specified, using 'NodeJs'.", @@ -43,6 +43,6 @@ "File 'c:/root/src/file2/package.json' does not exist.", "File 'c:/root/src/file2/index.ts' does not exist.", "File 'c:/root/src/file2/index.tsx' does not exist.", - "File 'c:/root/src/file2/index.d.ts' exist - use it as a module resolution result.", + "File 'c:/root/src/file2/index.d.ts' exist - use it as a name resolution result.", "======== Module name '../file2' was successfully resolved to 'c:/root/src/file2/index.d.ts'. ========" ] \ No newline at end of file diff --git a/tests/baselines/reference/pathMappingBasedModuleResolution7_classic.trace.json b/tests/baselines/reference/pathMappingBasedModuleResolution7_classic.trace.json index b45cd4754c7..2d72108210e 100644 --- a/tests/baselines/reference/pathMappingBasedModuleResolution7_classic.trace.json +++ b/tests/baselines/reference/pathMappingBasedModuleResolution7_classic.trace.json @@ -10,7 +10,7 @@ "File 'c:/root/src/project/file2.d.ts' does not exist.", "Trying other entries in 'rootDirs'", "Loading 'project/file2' from the root dir 'c:/root/generated/src', candidate location 'c:/root/generated/src/project/file2'", - "File 'c:/root/generated/src/project/file2.ts' exist - use it as a module resolution result.", + "File 'c:/root/generated/src/project/file2.ts' exist - use it as a name resolution result.", "======== Module name './project/file2' was successfully resolved to 'c:/root/generated/src/project/file2.ts'. ========", "======== Resolving module 'module3' from 'c:/root/src/file1.ts'. ========", "Module resolution kind is not specified, using 'Classic'.", @@ -28,7 +28,7 @@ "File 'c:/root/module3.ts' does not exist.", "File 'c:/root/module3.d.ts' does not exist.", "File 'c:/module3.ts' does not exist.", - "File 'c:/module3.d.ts' exist - use it as a module resolution result.", + "File 'c:/module3.d.ts' exist - use it as a name resolution result.", "======== Module name 'module3' was successfully resolved to 'c:/module3.d.ts'. ========", "======== Resolving module 'module1' from 'c:/root/generated/src/project/file2.ts'. ========", "Module resolution kind is not specified, using 'Classic'.", @@ -40,7 +40,7 @@ "File 'c:/root/module1.d.ts' does not exist.", "Trying substitution 'c:/shared/*', candidate module location: 'c:/shared/module1'.", "File 'c:/shared/module1.ts' does not exist.", - "File 'c:/shared/module1.d.ts' exist - use it as a module resolution result.", + "File 'c:/shared/module1.d.ts' exist - use it as a name resolution result.", "======== Module name 'module1' was successfully resolved to 'c:/shared/module1.d.ts'. ========", "======== Resolving module 'templates/module2' from 'c:/root/generated/src/project/file2.ts'. ========", "Module resolution kind is not specified, using 'Classic'.", @@ -48,7 +48,7 @@ "'paths' option is specified, looking for a pattern to match module name 'templates/module2'.", "Module name 'templates/module2', matched pattern 'templates/*'.", "Trying substitution 'generated/src/templates/*', candidate module location: 'generated/src/templates/module2'.", - "File 'c:/root/generated/src/templates/module2.ts' exist - use it as a module resolution result.", + "File 'c:/root/generated/src/templates/module2.ts' exist - use it as a name resolution result.", "======== Module name 'templates/module2' was successfully resolved to 'c:/root/generated/src/templates/module2.ts'. ========", "======== Resolving module '../file3' from 'c:/root/generated/src/project/file2.ts'. ========", "Module resolution kind is not specified, using 'Classic'.", @@ -62,6 +62,6 @@ "Trying other entries in 'rootDirs'", "Loading 'file3' from the root dir 'c:/root/src', candidate location 'c:/root/src/file3'", "File 'c:/root/src/file3.ts' does not exist.", - "File 'c:/root/src/file3.d.ts' exist - use it as a module resolution result.", + "File 'c:/root/src/file3.d.ts' exist - use it as a name resolution result.", "======== Module name '../file3' was successfully resolved to 'c:/root/src/file3.d.ts'. ========" ] \ No newline at end of file diff --git a/tests/baselines/reference/pathMappingBasedModuleResolution7_node.trace.json b/tests/baselines/reference/pathMappingBasedModuleResolution7_node.trace.json index 39d5c25c92a..99d4bf244db 100644 --- a/tests/baselines/reference/pathMappingBasedModuleResolution7_node.trace.json +++ b/tests/baselines/reference/pathMappingBasedModuleResolution7_node.trace.json @@ -17,7 +17,7 @@ "Trying other entries in 'rootDirs'", "Loading 'project/file2' from the root dir 'c:/root/generated/src', candidate location 'c:/root/generated/src/project/file2'", "Loading module as file / folder, candidate module location 'c:/root/generated/src/project/file2'.", - "File 'c:/root/generated/src/project/file2.ts' exist - use it as a module resolution result.", + "File 'c:/root/generated/src/project/file2.ts' exist - use it as a name resolution result.", "======== Module name './project/file2' was successfully resolved to 'c:/root/generated/src/project/file2.ts'. ========", "======== Resolving module 'module3' from 'c:/root/src/file1.ts'. ========", "Module resolution kind is not specified, using 'NodeJs'.", @@ -50,6 +50,13 @@ "File 'c:/root/src/node_modules/module3/index.ts' does not exist.", "File 'c:/root/src/node_modules/module3/index.tsx' does not exist.", "File 'c:/root/src/node_modules/module3/index.d.ts' does not exist.", + "File 'c:/root/src/node_modules/@types/module3.ts' does not exist.", + "File 'c:/root/src/node_modules/@types/module3.tsx' does not exist.", + "File 'c:/root/src/node_modules/@types/module3.d.ts' does not exist.", + "File 'c:/root/src/node_modules/@types/module3/package.json' does not exist.", + "File 'c:/root/src/node_modules/@types/module3/index.ts' does not exist.", + "File 'c:/root/src/node_modules/@types/module3/index.tsx' does not exist.", + "File 'c:/root/src/node_modules/@types/module3/index.d.ts' does not exist.", "File 'c:/root/node_modules/module3.ts' does not exist.", "File 'c:/root/node_modules/module3.tsx' does not exist.", "File 'c:/root/node_modules/module3.d.ts' does not exist.", @@ -57,9 +64,16 @@ "File 'c:/root/node_modules/module3/index.ts' does not exist.", "File 'c:/root/node_modules/module3/index.tsx' does not exist.", "File 'c:/root/node_modules/module3/index.d.ts' does not exist.", + "File 'c:/root/node_modules/@types/module3.ts' does not exist.", + "File 'c:/root/node_modules/@types/module3.tsx' does not exist.", + "File 'c:/root/node_modules/@types/module3.d.ts' does not exist.", + "File 'c:/root/node_modules/@types/module3/package.json' does not exist.", + "File 'c:/root/node_modules/@types/module3/index.ts' does not exist.", + "File 'c:/root/node_modules/@types/module3/index.tsx' does not exist.", + "File 'c:/root/node_modules/@types/module3/index.d.ts' does not exist.", "File 'c:/node_modules/module3.ts' does not exist.", "File 'c:/node_modules/module3.tsx' does not exist.", - "File 'c:/node_modules/module3.d.ts' exist - use it as a module resolution result.", + "File 'c:/node_modules/module3.d.ts' exist - use it as a name resolution result.", "======== Module name 'module3' was successfully resolved to 'c:/node_modules/module3.d.ts'. ========", "======== Resolving module 'module1' from 'c:/root/generated/src/project/file2.ts'. ========", "Module resolution kind is not specified, using 'NodeJs'.", @@ -83,7 +97,7 @@ "File 'c:/shared/module1/package.json' does not exist.", "File 'c:/shared/module1/index.ts' does not exist.", "File 'c:/shared/module1/index.tsx' does not exist.", - "File 'c:/shared/module1/index.d.ts' exist - use it as a module resolution result.", + "File 'c:/shared/module1/index.d.ts' exist - use it as a name resolution result.", "======== Module name 'module1' was successfully resolved to 'c:/shared/module1/index.d.ts'. ========", "======== Resolving module 'templates/module2' from 'c:/root/generated/src/project/file2.ts'. ========", "Module resolution kind is not specified, using 'NodeJs'.", @@ -92,7 +106,7 @@ "Module name 'templates/module2', matched pattern 'templates/*'.", "Trying substitution 'generated/src/templates/*', candidate module location: 'generated/src/templates/module2'.", "Loading module as file / folder, candidate module location 'c:/root/generated/src/templates/module2'.", - "File 'c:/root/generated/src/templates/module2.ts' exist - use it as a module resolution result.", + "File 'c:/root/generated/src/templates/module2.ts' exist - use it as a name resolution result.", "======== Module name 'templates/module2' was successfully resolved to 'c:/root/generated/src/templates/module2.ts'. ========", "======== Resolving module '../file3' from 'c:/root/generated/src/project/file2.ts'. ========", "Module resolution kind is not specified, using 'NodeJs'.", @@ -118,6 +132,6 @@ "File 'c:/root/src/file3/package.json' does not exist.", "File 'c:/root/src/file3/index.ts' does not exist.", "File 'c:/root/src/file3/index.tsx' does not exist.", - "File 'c:/root/src/file3/index.d.ts' exist - use it as a module resolution result.", + "File 'c:/root/src/file3/index.d.ts' exist - use it as a name resolution result.", "======== Module name '../file3' was successfully resolved to 'c:/root/src/file3/index.d.ts'. ========" ] \ No newline at end of file diff --git a/tests/baselines/reference/promiseVoidErrorCallback.symbols b/tests/baselines/reference/promiseVoidErrorCallback.symbols index 500f8e14b79..b2959f139ea 100644 --- a/tests/baselines/reference/promiseVoidErrorCallback.symbols +++ b/tests/baselines/reference/promiseVoidErrorCallback.symbols @@ -22,13 +22,13 @@ interface T3 { function f1(): Promise { >f1 : Symbol(f1, Decl(promiseVoidErrorCallback.ts, 10, 1)) ->Promise : Symbol(Promise, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) >T1 : Symbol(T1, Decl(promiseVoidErrorCallback.ts, 0, 0)) return Promise.resolve({ __t1: "foo_t1" }); ->Promise.resolve : Symbol(PromiseConstructor.resolve, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->Promise : Symbol(Promise, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->resolve : Symbol(PromiseConstructor.resolve, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Promise.resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >__t1 : Symbol(__t1, Decl(promiseVoidErrorCallback.ts, 13, 28)) } @@ -47,22 +47,22 @@ function f2(x: T1): T2 { var x3 = f1() >x3 : Symbol(x3, Decl(promiseVoidErrorCallback.ts, 20, 3)) ->f1() .then(f2, (e: Error) => { throw e;}) .then : Symbol(Promise.then, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->f1() .then : Symbol(Promise.then, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>f1() .then(f2, (e: Error) => { throw e;}) .then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>f1() .then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >f1 : Symbol(f1, Decl(promiseVoidErrorCallback.ts, 10, 1)) .then(f2, (e: Error) => { ->then : Symbol(Promise.then, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >f2 : Symbol(f2, Decl(promiseVoidErrorCallback.ts, 14, 1)) >e : Symbol(e, Decl(promiseVoidErrorCallback.ts, 21, 15)) ->Error : Symbol(Error, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Error : Symbol(Error, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) throw e; >e : Symbol(e, Decl(promiseVoidErrorCallback.ts, 21, 15)) }) .then((x: T2) => { ->then : Symbol(Promise.then, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>then : Symbol(Promise.then, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >x : Symbol(x, Decl(promiseVoidErrorCallback.ts, 24, 11)) >T2 : Symbol(T2, Decl(promiseVoidErrorCallback.ts, 2, 1)) diff --git a/tests/baselines/reference/propertyAccessOnTypeParameterWithConstraints.symbols b/tests/baselines/reference/propertyAccessOnTypeParameterWithConstraints.symbols index b9287f343f7..6fbb89f00de 100644 --- a/tests/baselines/reference/propertyAccessOnTypeParameterWithConstraints.symbols +++ b/tests/baselines/reference/propertyAccessOnTypeParameterWithConstraints.symbols @@ -5,7 +5,7 @@ class C { >C : Symbol(C, Decl(propertyAccessOnTypeParameterWithConstraints.ts, 0, 0)) >T : Symbol(T, Decl(propertyAccessOnTypeParameterWithConstraints.ts, 3, 8)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) f() { >f : Symbol(C.f, Decl(propertyAccessOnTypeParameterWithConstraints.ts, 3, 25)) @@ -31,13 +31,13 @@ var r = (new C()).f(); >r : Symbol(r, Decl(propertyAccessOnTypeParameterWithConstraints.ts, 11, 3)) >(new C()).f : Symbol(C.f, Decl(propertyAccessOnTypeParameterWithConstraints.ts, 3, 25)) >C : Symbol(C, Decl(propertyAccessOnTypeParameterWithConstraints.ts, 0, 0)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >f : Symbol(C.f, Decl(propertyAccessOnTypeParameterWithConstraints.ts, 3, 25)) interface I { >I : Symbol(I, Decl(propertyAccessOnTypeParameterWithConstraints.ts, 11, 28)) >T : Symbol(T, Decl(propertyAccessOnTypeParameterWithConstraints.ts, 13, 12)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) foo: T; >foo : Symbol(I.foo, Decl(propertyAccessOnTypeParameterWithConstraints.ts, 13, 29)) @@ -46,7 +46,7 @@ interface I { var i: I; >i : Symbol(i, Decl(propertyAccessOnTypeParameterWithConstraints.ts, 16, 3)) >I : Symbol(I, Decl(propertyAccessOnTypeParameterWithConstraints.ts, 11, 28)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) var r2 = i.foo.getDate(); >r2 : Symbol(r2, Decl(propertyAccessOnTypeParameterWithConstraints.ts, 17, 3)) @@ -68,14 +68,14 @@ var a: { (): T; >T : Symbol(T, Decl(propertyAccessOnTypeParameterWithConstraints.ts, 21, 5)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >T : Symbol(T, Decl(propertyAccessOnTypeParameterWithConstraints.ts, 21, 5)) } var r3 = a().getDate(); >r3 : Symbol(r3, Decl(propertyAccessOnTypeParameterWithConstraints.ts, 23, 3)) >a().getDate : Symbol(Date.getDate, Decl(lib.d.ts, --, --)) >a : Symbol(a, Decl(propertyAccessOnTypeParameterWithConstraints.ts, 20, 3)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >getDate : Symbol(Date.getDate, Decl(lib.d.ts, --, --)) var r3b = a()['getDate'](); @@ -89,7 +89,7 @@ var b = { foo: (x: T) => { >foo : Symbol(foo, Decl(propertyAccessOnTypeParameterWithConstraints.ts, 26, 9)) >T : Symbol(T, Decl(propertyAccessOnTypeParameterWithConstraints.ts, 27, 10)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >x : Symbol(x, Decl(propertyAccessOnTypeParameterWithConstraints.ts, 27, 26)) >T : Symbol(T, Decl(propertyAccessOnTypeParameterWithConstraints.ts, 27, 10)) @@ -111,5 +111,5 @@ var r4 = b.foo(new Date()); >b.foo : Symbol(foo, Decl(propertyAccessOnTypeParameterWithConstraints.ts, 26, 9)) >b : Symbol(b, Decl(propertyAccessOnTypeParameterWithConstraints.ts, 26, 3)) >foo : Symbol(foo, Decl(propertyAccessOnTypeParameterWithConstraints.ts, 26, 9)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) diff --git a/tests/baselines/reference/reactNamespaceJSXEmit.js b/tests/baselines/reference/reactNamespaceJSXEmit.js index 26967d56b7b..ced18ebc031 100644 --- a/tests/baselines/reference/reactNamespaceJSXEmit.js +++ b/tests/baselines/reference/reactNamespaceJSXEmit.js @@ -13,8 +13,16 @@ declare var x: any; //// [reactNamespaceJSXEmit.js] +var __assign = (this && this.__assign) || Object.assign || function(t) { + for (var s, i = 1, n = arguments.length; i < n; i++) { + s = arguments[i]; + for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) + t[p] = s[p]; + } + return t; +}; myReactLib.createElement("foo", {data: true}); myReactLib.createElement(Bar, {x: x}); myReactLib.createElement("x-component", null); -myReactLib.createElement(Bar, myReactLib.__spread({}, x)); -myReactLib.createElement(Bar, myReactLib.__spread({}, x, {y: 2})); +myReactLib.createElement(Bar, __assign({}, x)); +myReactLib.createElement(Bar, __assign({}, x, {y: 2})); diff --git a/tests/baselines/reference/returnStatements.symbols b/tests/baselines/reference/returnStatements.symbols index a833da8fe11..af8aa2af7df 100644 --- a/tests/baselines/reference/returnStatements.symbols +++ b/tests/baselines/reference/returnStatements.symbols @@ -18,8 +18,8 @@ function fn5(): boolean { return true; } function fn6(): Date { return new Date(12); } >fn6 : Symbol(fn6, Decl(returnStatements.ts, 5, 40)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) function fn7(): any { return null; } >fn7 : Symbol(fn7, Decl(returnStatements.ts, 6, 45)) diff --git a/tests/baselines/reference/returnTypeParameterWithModules.symbols b/tests/baselines/reference/returnTypeParameterWithModules.symbols index 7f8fab382a3..e3b7c50948f 100644 --- a/tests/baselines/reference/returnTypeParameterWithModules.symbols +++ b/tests/baselines/reference/returnTypeParameterWithModules.symbols @@ -12,13 +12,13 @@ module M1 { >A : Symbol(A, Decl(returnTypeParameterWithModules.ts, 1, 27)) return Array.prototype.reduce.apply(ar, e ? [f, e] : [f]); ->Array.prototype.reduce.apply : Symbol(Function.apply, Decl(lib.d.ts, --, --)) +>Array.prototype.reduce.apply : Symbol(Function.apply, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >Array.prototype.reduce : Symbol(Array.reduce, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >Array.prototype : Symbol(ArrayConstructor.prototype, Decl(lib.d.ts, --, --)) >Array : Symbol(Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >prototype : Symbol(ArrayConstructor.prototype, Decl(lib.d.ts, --, --)) >reduce : Symbol(Array.reduce, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->apply : Symbol(Function.apply, Decl(lib.d.ts, --, --)) +>apply : Symbol(Function.apply, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >ar : Symbol(ar, Decl(returnTypeParameterWithModules.ts, 1, 30)) >e : Symbol(e, Decl(returnTypeParameterWithModules.ts, 1, 36)) >f : Symbol(f, Decl(returnTypeParameterWithModules.ts, 1, 33)) diff --git a/tests/baselines/reference/returnTypeParameterWithModules.types b/tests/baselines/reference/returnTypeParameterWithModules.types index be09b8f46b0..ffb058daa08 100644 --- a/tests/baselines/reference/returnTypeParameterWithModules.types +++ b/tests/baselines/reference/returnTypeParameterWithModules.types @@ -13,13 +13,13 @@ module M1 { return Array.prototype.reduce.apply(ar, e ? [f, e] : [f]); >Array.prototype.reduce.apply(ar, e ? [f, e] : [f]) : any ->Array.prototype.reduce.apply : (thisArg: any, argArray?: any) => any +>Array.prototype.reduce.apply : { (this: (this: T, ...argArray: any[]) => U, thisArg: T, argArray?: any): U; (this: Function, thisArg: any, argArray?: any): any; } >Array.prototype.reduce : { (callbackfn: (previousValue: any, currentValue: any, currentIndex: number, array: any[]) => any, initialValue?: any): any; (callbackfn: (previousValue: U, currentValue: any, currentIndex: number, array: any[]) => U, initialValue: U): U; } >Array.prototype : any[] >Array : ArrayConstructor >prototype : any[] >reduce : { (callbackfn: (previousValue: any, currentValue: any, currentIndex: number, array: any[]) => any, initialValue?: any): any; (callbackfn: (previousValue: U, currentValue: any, currentIndex: number, array: any[]) => U, initialValue: U): U; } ->apply : (thisArg: any, argArray?: any) => any +>apply : { (this: (this: T, ...argArray: any[]) => U, thisArg: T, argArray?: any): U; (this: Function, thisArg: any, argArray?: any): any; } >ar : any >e ? [f, e] : [f] : any[] >e : any diff --git a/tests/baselines/reference/scopeResolutionIdentifiers.symbols b/tests/baselines/reference/scopeResolutionIdentifiers.symbols index 1dc027548ea..ecabe30534e 100644 --- a/tests/baselines/reference/scopeResolutionIdentifiers.symbols +++ b/tests/baselines/reference/scopeResolutionIdentifiers.symbols @@ -51,7 +51,7 @@ class C { s: Date; >s : Symbol(C.s, Decl(scopeResolutionIdentifiers.ts, 21, 9)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) n = this.s; >n : Symbol(C.n, Decl(scopeResolutionIdentifiers.ts, 22, 12)) @@ -70,7 +70,7 @@ class C { var p: Date; >p : Symbol(p, Decl(scopeResolutionIdentifiers.ts, 25, 11), Decl(scopeResolutionIdentifiers.ts, 26, 11)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) } } diff --git a/tests/baselines/reference/specializedSignatureIsSubtypeOfNonSpecializedSignature.symbols b/tests/baselines/reference/specializedSignatureIsSubtypeOfNonSpecializedSignature.symbols index f1e0a615367..164361c14ac 100644 --- a/tests/baselines/reference/specializedSignatureIsSubtypeOfNonSpecializedSignature.symbols +++ b/tests/baselines/reference/specializedSignatureIsSubtypeOfNonSpecializedSignature.symbols @@ -55,7 +55,7 @@ class C2 { class C3 { >C3 : Symbol(C3, Decl(specializedSignatureIsSubtypeOfNonSpecializedSignature.ts, 18, 1)) >T : Symbol(T, Decl(specializedSignatureIsSubtypeOfNonSpecializedSignature.ts, 20, 9)) ->String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) foo(x: 'a'); >foo : Symbol(C3.foo, Decl(specializedSignatureIsSubtypeOfNonSpecializedSignature.ts, 20, 28), Decl(specializedSignatureIsSubtypeOfNonSpecializedSignature.ts, 21, 16), Decl(specializedSignatureIsSubtypeOfNonSpecializedSignature.ts, 22, 19), Decl(specializedSignatureIsSubtypeOfNonSpecializedSignature.ts, 23, 14)) @@ -131,7 +131,7 @@ interface I2 { interface I3 { >I3 : Symbol(I3, Decl(specializedSignatureIsSubtypeOfNonSpecializedSignature.ts, 43, 1)) >T : Symbol(T, Decl(specializedSignatureIsSubtypeOfNonSpecializedSignature.ts, 45, 13)) ->String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) (x: 'a'); >x : Symbol(x, Decl(specializedSignatureIsSubtypeOfNonSpecializedSignature.ts, 46, 5)) @@ -236,7 +236,7 @@ var a3: { foo(x: T); >foo : Symbol(foo, Decl(specializedSignatureIsSubtypeOfNonSpecializedSignature.ts, 75, 16), Decl(specializedSignatureIsSubtypeOfNonSpecializedSignature.ts, 76, 19), Decl(specializedSignatureIsSubtypeOfNonSpecializedSignature.ts, 77, 16)) >T : Symbol(T, Decl(specializedSignatureIsSubtypeOfNonSpecializedSignature.ts, 78, 8)) ->String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >x : Symbol(x, Decl(specializedSignatureIsSubtypeOfNonSpecializedSignature.ts, 78, 26)) >T : Symbol(T, Decl(specializedSignatureIsSubtypeOfNonSpecializedSignature.ts, 78, 8)) } diff --git a/tests/baselines/reference/stringIncludes.symbols b/tests/baselines/reference/stringIncludes.symbols index 1f1b2e55ccf..5b2bf4b7afa 100644 --- a/tests/baselines/reference/stringIncludes.symbols +++ b/tests/baselines/reference/stringIncludes.symbols @@ -5,11 +5,11 @@ var includes: boolean; includes = "abcde".includes("cd"); >includes : Symbol(includes, Decl(stringIncludes.ts, 1, 3)) ->"abcde".includes : Symbol(String.includes, Decl(lib.d.ts, --, --)) ->includes : Symbol(String.includes, Decl(lib.d.ts, --, --)) +>"abcde".includes : Symbol(String.includes, Decl(lib.es2015.core.d.ts, --, --)) +>includes : Symbol(String.includes, Decl(lib.es2015.core.d.ts, --, --)) includes = "abcde".includes("cd", 2); >includes : Symbol(includes, Decl(stringIncludes.ts, 1, 3)) ->"abcde".includes : Symbol(String.includes, Decl(lib.d.ts, --, --)) ->includes : Symbol(String.includes, Decl(lib.d.ts, --, --)) +>"abcde".includes : Symbol(String.includes, Decl(lib.es2015.core.d.ts, --, --)) +>includes : Symbol(String.includes, Decl(lib.es2015.core.d.ts, --, --)) diff --git a/tests/baselines/reference/stringLiteralTypeIsSubtypeOfString.symbols b/tests/baselines/reference/stringLiteralTypeIsSubtypeOfString.symbols index 2df032770c6..e97b2a59118 100644 --- a/tests/baselines/reference/stringLiteralTypeIsSubtypeOfString.symbols +++ b/tests/baselines/reference/stringLiteralTypeIsSubtypeOfString.symbols @@ -84,7 +84,7 @@ function f7(x: 'a'); function f7(x: Date); >f7 : Symbol(f7, Decl(stringLiteralTypeIsSubtypeOfString.ts, 27, 23), Decl(stringLiteralTypeIsSubtypeOfString.ts, 29, 20), Decl(stringLiteralTypeIsSubtypeOfString.ts, 30, 21)) >x : Symbol(x, Decl(stringLiteralTypeIsSubtypeOfString.ts, 30, 12)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) function f7(x: any) { } >f7 : Symbol(f7, Decl(stringLiteralTypeIsSubtypeOfString.ts, 27, 23), Decl(stringLiteralTypeIsSubtypeOfString.ts, 29, 20), Decl(stringLiteralTypeIsSubtypeOfString.ts, 30, 21)) @@ -117,7 +117,7 @@ function f9(x: any) { } class C implements String { >C : Symbol(C, Decl(stringLiteralTypeIsSubtypeOfString.ts, 39, 23)) ->String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) toString(): string { return null; } >toString : Symbol(C.toString, Decl(stringLiteralTypeIsSubtypeOfString.ts, 41, 27)) @@ -222,7 +222,7 @@ function f10(x: any) { } interface I extends String { >I : Symbol(I, Decl(stringLiteralTypeIsSubtypeOfString.ts, 69, 24)) ->String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) foo: string; >foo : Symbol(I.foo, Decl(stringLiteralTypeIsSubtypeOfString.ts, 71, 28)) @@ -261,20 +261,20 @@ function f12(x: any) { } function f13(x: 'a'); >f13 : Symbol(f13, Decl(stringLiteralTypeIsSubtypeOfString.ts, 82, 27), Decl(stringLiteralTypeIsSubtypeOfString.ts, 84, 39), Decl(stringLiteralTypeIsSubtypeOfString.ts, 85, 37)) >T : Symbol(T, Decl(stringLiteralTypeIsSubtypeOfString.ts, 84, 13)) ->String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >x : Symbol(x, Decl(stringLiteralTypeIsSubtypeOfString.ts, 84, 31)) function f13(x: T); >f13 : Symbol(f13, Decl(stringLiteralTypeIsSubtypeOfString.ts, 82, 27), Decl(stringLiteralTypeIsSubtypeOfString.ts, 84, 39), Decl(stringLiteralTypeIsSubtypeOfString.ts, 85, 37)) >T : Symbol(T, Decl(stringLiteralTypeIsSubtypeOfString.ts, 85, 13)) ->String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >x : Symbol(x, Decl(stringLiteralTypeIsSubtypeOfString.ts, 85, 31)) >T : Symbol(T, Decl(stringLiteralTypeIsSubtypeOfString.ts, 85, 13)) function f13(x: any) { } >f13 : Symbol(f13, Decl(stringLiteralTypeIsSubtypeOfString.ts, 82, 27), Decl(stringLiteralTypeIsSubtypeOfString.ts, 84, 39), Decl(stringLiteralTypeIsSubtypeOfString.ts, 85, 37)) >T : Symbol(T, Decl(stringLiteralTypeIsSubtypeOfString.ts, 86, 13)) ->String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >x : Symbol(x, Decl(stringLiteralTypeIsSubtypeOfString.ts, 86, 31)) enum E { A } @@ -319,7 +319,7 @@ function f15(x: any) { } function f16(x: 'a'); >f16 : Symbol(f16, Decl(stringLiteralTypeIsSubtypeOfString.ts, 95, 40), Decl(stringLiteralTypeIsSubtypeOfString.ts, 97, 52), Decl(stringLiteralTypeIsSubtypeOfString.ts, 98, 50)) >T : Symbol(T, Decl(stringLiteralTypeIsSubtypeOfString.ts, 97, 13)) ->String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >U : Symbol(U, Decl(stringLiteralTypeIsSubtypeOfString.ts, 97, 30)) >T : Symbol(T, Decl(stringLiteralTypeIsSubtypeOfString.ts, 97, 13)) >x : Symbol(x, Decl(stringLiteralTypeIsSubtypeOfString.ts, 97, 44)) @@ -327,7 +327,7 @@ function f16(x: 'a'); function f16(x: U); >f16 : Symbol(f16, Decl(stringLiteralTypeIsSubtypeOfString.ts, 95, 40), Decl(stringLiteralTypeIsSubtypeOfString.ts, 97, 52), Decl(stringLiteralTypeIsSubtypeOfString.ts, 98, 50)) >T : Symbol(T, Decl(stringLiteralTypeIsSubtypeOfString.ts, 98, 13)) ->String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >U : Symbol(U, Decl(stringLiteralTypeIsSubtypeOfString.ts, 98, 30)) >T : Symbol(T, Decl(stringLiteralTypeIsSubtypeOfString.ts, 98, 13)) >x : Symbol(x, Decl(stringLiteralTypeIsSubtypeOfString.ts, 98, 44)) @@ -336,7 +336,7 @@ function f16(x: U); function f16(x: any) { } >f16 : Symbol(f16, Decl(stringLiteralTypeIsSubtypeOfString.ts, 95, 40), Decl(stringLiteralTypeIsSubtypeOfString.ts, 97, 52), Decl(stringLiteralTypeIsSubtypeOfString.ts, 98, 50)) >T : Symbol(T, Decl(stringLiteralTypeIsSubtypeOfString.ts, 99, 13)) ->String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >U : Symbol(U, Decl(stringLiteralTypeIsSubtypeOfString.ts, 99, 30)) >T : Symbol(T, Decl(stringLiteralTypeIsSubtypeOfString.ts, 99, 13)) >x : Symbol(x, Decl(stringLiteralTypeIsSubtypeOfString.ts, 99, 44)) diff --git a/tests/baselines/reference/subtypesOfAny.symbols b/tests/baselines/reference/subtypesOfAny.symbols index 7d360530959..5e5353e8c9d 100644 --- a/tests/baselines/reference/subtypesOfAny.symbols +++ b/tests/baselines/reference/subtypesOfAny.symbols @@ -53,7 +53,7 @@ interface I5 { foo: Date; >foo : Symbol(I5.foo, Decl(subtypesOfAny.ts, 27, 21)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) } diff --git a/tests/baselines/reference/subtypesOfTypeParameterWithConstraints2.symbols b/tests/baselines/reference/subtypesOfTypeParameterWithConstraints2.symbols index 07c4641dd2c..b33b9d212f2 100644 --- a/tests/baselines/reference/subtypesOfTypeParameterWithConstraints2.symbols +++ b/tests/baselines/reference/subtypesOfTypeParameterWithConstraints2.symbols @@ -76,7 +76,7 @@ function f3(x: T, y: U) { >T : Symbol(T, Decl(subtypesOfTypeParameterWithConstraints2.ts, 22, 12)) >U : Symbol(U, Decl(subtypesOfTypeParameterWithConstraints2.ts, 22, 24)) >U : Symbol(U, Decl(subtypesOfTypeParameterWithConstraints2.ts, 22, 24)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >x : Symbol(x, Decl(subtypesOfTypeParameterWithConstraints2.ts, 22, 41)) >T : Symbol(T, Decl(subtypesOfTypeParameterWithConstraints2.ts, 22, 12)) >y : Symbol(y, Decl(subtypesOfTypeParameterWithConstraints2.ts, 22, 46)) @@ -96,22 +96,22 @@ function f3(x: T, y: U) { var r2 = true ? x : new Date(); >r2 : Symbol(r2, Decl(subtypesOfTypeParameterWithConstraints2.ts, 27, 7), Decl(subtypesOfTypeParameterWithConstraints2.ts, 28, 7)) >x : Symbol(x, Decl(subtypesOfTypeParameterWithConstraints2.ts, 22, 41)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) var r2 = true ? new Date() : x; >r2 : Symbol(r2, Decl(subtypesOfTypeParameterWithConstraints2.ts, 27, 7), Decl(subtypesOfTypeParameterWithConstraints2.ts, 28, 7)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >x : Symbol(x, Decl(subtypesOfTypeParameterWithConstraints2.ts, 22, 41)) // ok var r3 = true ? y : new Date(); >r3 : Symbol(r3, Decl(subtypesOfTypeParameterWithConstraints2.ts, 31, 7), Decl(subtypesOfTypeParameterWithConstraints2.ts, 32, 7)) >y : Symbol(y, Decl(subtypesOfTypeParameterWithConstraints2.ts, 22, 46)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) var r3 = true ? new Date() : y; >r3 : Symbol(r3, Decl(subtypesOfTypeParameterWithConstraints2.ts, 31, 7), Decl(subtypesOfTypeParameterWithConstraints2.ts, 32, 7)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >y : Symbol(y, Decl(subtypesOfTypeParameterWithConstraints2.ts, 22, 46)) } @@ -157,7 +157,7 @@ module c { function f4(x: T) { >f4 : Symbol(f4, Decl(subtypesOfTypeParameterWithConstraints2.ts, 47, 1)) >T : Symbol(T, Decl(subtypesOfTypeParameterWithConstraints2.ts, 49, 12)) ->Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >x : Symbol(x, Decl(subtypesOfTypeParameterWithConstraints2.ts, 49, 30)) >T : Symbol(T, Decl(subtypesOfTypeParameterWithConstraints2.ts, 49, 12)) @@ -187,7 +187,7 @@ function f4(x: T) { function f5(x: T) { >f5 : Symbol(f5, Decl(subtypesOfTypeParameterWithConstraints2.ts, 56, 1)) >T : Symbol(T, Decl(subtypesOfTypeParameterWithConstraints2.ts, 58, 12)) ->Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >x : Symbol(x, Decl(subtypesOfTypeParameterWithConstraints2.ts, 58, 30)) >T : Symbol(T, Decl(subtypesOfTypeParameterWithConstraints2.ts, 58, 12)) @@ -203,7 +203,7 @@ function f5(x: T) { function f6(x: T) { >f6 : Symbol(f6, Decl(subtypesOfTypeParameterWithConstraints2.ts, 61, 1)) >T : Symbol(T, Decl(subtypesOfTypeParameterWithConstraints2.ts, 63, 12)) ->String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >x : Symbol(x, Decl(subtypesOfTypeParameterWithConstraints2.ts, 63, 30)) >T : Symbol(T, Decl(subtypesOfTypeParameterWithConstraints2.ts, 63, 12)) @@ -235,19 +235,19 @@ function f7(x: T) { function f8(x: T) { >f8 : Symbol(f8, Decl(subtypesOfTypeParameterWithConstraints2.ts, 71, 1)) >T : Symbol(T, Decl(subtypesOfTypeParameterWithConstraints2.ts, 73, 12)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >x : Symbol(x, Decl(subtypesOfTypeParameterWithConstraints2.ts, 73, 28)) >T : Symbol(T, Decl(subtypesOfTypeParameterWithConstraints2.ts, 73, 12)) var r4 = true ? new Date() : x; // ok >r4 : Symbol(r4, Decl(subtypesOfTypeParameterWithConstraints2.ts, 74, 7), Decl(subtypesOfTypeParameterWithConstraints2.ts, 75, 7)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >x : Symbol(x, Decl(subtypesOfTypeParameterWithConstraints2.ts, 73, 28)) var r4 = true ? x : new Date(); // ok >r4 : Symbol(r4, Decl(subtypesOfTypeParameterWithConstraints2.ts, 74, 7), Decl(subtypesOfTypeParameterWithConstraints2.ts, 75, 7)) >x : Symbol(x, Decl(subtypesOfTypeParameterWithConstraints2.ts, 73, 28)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) } function f9(x: T) { @@ -516,7 +516,7 @@ function f19(x: T) { function f20(x: T) { >f20 : Symbol(f20, Decl(subtypesOfTypeParameterWithConstraints2.ts, 146, 1)) >T : Symbol(T, Decl(subtypesOfTypeParameterWithConstraints2.ts, 148, 13)) ->Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >x : Symbol(x, Decl(subtypesOfTypeParameterWithConstraints2.ts, 148, 31)) >T : Symbol(T, Decl(subtypesOfTypeParameterWithConstraints2.ts, 148, 13)) @@ -534,7 +534,7 @@ function f20(x: T) { function f21(x: T) { >f21 : Symbol(f21, Decl(subtypesOfTypeParameterWithConstraints2.ts, 151, 1)) >T : Symbol(T, Decl(subtypesOfTypeParameterWithConstraints2.ts, 153, 13)) ->Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >x : Symbol(x, Decl(subtypesOfTypeParameterWithConstraints2.ts, 153, 31)) >T : Symbol(T, Decl(subtypesOfTypeParameterWithConstraints2.ts, 153, 13)) diff --git a/tests/baselines/reference/subtypingWithCallSignatures2.symbols b/tests/baselines/reference/subtypingWithCallSignatures2.symbols index 2b974d215cc..95158bb25d9 100644 --- a/tests/baselines/reference/subtypingWithCallSignatures2.symbols +++ b/tests/baselines/reference/subtypingWithCallSignatures2.symbols @@ -297,8 +297,8 @@ declare function foo18(a: { (a: Date): Date; >a : Symbol(a, Decl(subtypingWithCallSignatures2.ts, 74, 9)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) }): any[]; }): typeof a; diff --git a/tests/baselines/reference/subtypingWithConstructSignatures2.symbols b/tests/baselines/reference/subtypingWithConstructSignatures2.symbols index 45e8409f145..cbb72b9f396 100644 --- a/tests/baselines/reference/subtypingWithConstructSignatures2.symbols +++ b/tests/baselines/reference/subtypingWithConstructSignatures2.symbols @@ -297,8 +297,8 @@ declare function foo18(a: { new (a: Date): Date; >a : Symbol(a, Decl(subtypingWithConstructSignatures2.ts, 74, 13)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) }): any[]; }): typeof a; diff --git a/tests/baselines/reference/superCallParameterContextualTyping1.symbols b/tests/baselines/reference/superCallParameterContextualTyping1.symbols index e46e88aff54..91eff4b3c8b 100644 --- a/tests/baselines/reference/superCallParameterContextualTyping1.symbols +++ b/tests/baselines/reference/superCallParameterContextualTyping1.symbols @@ -22,7 +22,7 @@ class B extends A { constructor() { super(value => String(value.toExponential())); } >super : Symbol(A, Decl(superCallParameterContextualTyping1.ts, 0, 0)) >value : Symbol(value, Decl(superCallParameterContextualTyping1.ts, 9, 26)) ->String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >value.toExponential : Symbol(Number.toExponential, Decl(lib.d.ts, --, --)) >value : Symbol(value, Decl(superCallParameterContextualTyping1.ts, 9, 26)) >toExponential : Symbol(Number.toExponential, Decl(lib.d.ts, --, --)) diff --git a/tests/baselines/reference/superSymbolIndexedAccess1.symbols b/tests/baselines/reference/superSymbolIndexedAccess1.symbols index 47131f231cb..9141771f0c9 100644 --- a/tests/baselines/reference/superSymbolIndexedAccess1.symbols +++ b/tests/baselines/reference/superSymbolIndexedAccess1.symbols @@ -1,9 +1,9 @@ === tests/cases/conformance/expressions/superPropertyAccess/superSymbolIndexedAccess1.ts === var symbol = Symbol.for('myThing'); >symbol : Symbol(symbol, Decl(superSymbolIndexedAccess1.ts, 0, 3)) ->Symbol.for : Symbol(SymbolConstructor.for, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->for : Symbol(SymbolConstructor.for, Decl(lib.d.ts, --, --)) +>Symbol.for : Symbol(SymbolConstructor.for, Decl(lib.es2015.symbol.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>for : Symbol(SymbolConstructor.for, Decl(lib.es2015.symbol.d.ts, --, --)) class Foo { >Foo : Symbol(Foo, Decl(superSymbolIndexedAccess1.ts, 0, 35)) diff --git a/tests/baselines/reference/superSymbolIndexedAccess2.symbols b/tests/baselines/reference/superSymbolIndexedAccess2.symbols index 9b65ce358bb..68b503778e7 100644 --- a/tests/baselines/reference/superSymbolIndexedAccess2.symbols +++ b/tests/baselines/reference/superSymbolIndexedAccess2.symbols @@ -4,9 +4,9 @@ class Foo { >Foo : Symbol(Foo, Decl(superSymbolIndexedAccess2.ts, 0, 0)) [Symbol.isConcatSpreadable]() { ->Symbol.isConcatSpreadable : Symbol(SymbolConstructor.isConcatSpreadable, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->isConcatSpreadable : Symbol(SymbolConstructor.isConcatSpreadable, Decl(lib.d.ts, --, --)) +>Symbol.isConcatSpreadable : Symbol(SymbolConstructor.isConcatSpreadable, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>isConcatSpreadable : Symbol(SymbolConstructor.isConcatSpreadable, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) return 0; } @@ -17,14 +17,14 @@ class Bar extends Foo { >Foo : Symbol(Foo, Decl(superSymbolIndexedAccess2.ts, 0, 0)) [Symbol.isConcatSpreadable]() { ->Symbol.isConcatSpreadable : Symbol(SymbolConstructor.isConcatSpreadable, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->isConcatSpreadable : Symbol(SymbolConstructor.isConcatSpreadable, Decl(lib.d.ts, --, --)) +>Symbol.isConcatSpreadable : Symbol(SymbolConstructor.isConcatSpreadable, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>isConcatSpreadable : Symbol(SymbolConstructor.isConcatSpreadable, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) return super[Symbol.isConcatSpreadable](); >super : Symbol(Foo, Decl(superSymbolIndexedAccess2.ts, 0, 0)) ->Symbol.isConcatSpreadable : Symbol(SymbolConstructor.isConcatSpreadable, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->isConcatSpreadable : Symbol(SymbolConstructor.isConcatSpreadable, Decl(lib.d.ts, --, --)) +>Symbol.isConcatSpreadable : Symbol(SymbolConstructor.isConcatSpreadable, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>isConcatSpreadable : Symbol(SymbolConstructor.isConcatSpreadable, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) } } diff --git a/tests/baselines/reference/switchAssignmentCompat.errors.txt b/tests/baselines/reference/switchAssignmentCompat.errors.txt index 6a2755365ab..747a1035b68 100644 --- a/tests/baselines/reference/switchAssignmentCompat.errors.txt +++ b/tests/baselines/reference/switchAssignmentCompat.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/switchAssignmentCompat.ts(4,10): error TS2322: Type 'typeof Foo' is not assignable to type 'number'. +tests/cases/compiler/switchAssignmentCompat.ts(4,10): error TS2678: Type 'typeof Foo' is not comparable to type 'number'. ==== tests/cases/compiler/switchAssignmentCompat.ts (1 errors) ==== @@ -7,6 +7,6 @@ tests/cases/compiler/switchAssignmentCompat.ts(4,10): error TS2322: Type 'typeof switch (0) { case Foo: break; // Error expected ~~~ -!!! error TS2322: Type 'typeof Foo' is not assignable to type 'number'. +!!! error TS2678: Type 'typeof Foo' is not comparable to type 'number'. } \ No newline at end of file diff --git a/tests/baselines/reference/switchCaseWithIntersectionTypes01.errors.txt b/tests/baselines/reference/switchCaseWithIntersectionTypes01.errors.txt new file mode 100644 index 00000000000..d42f407a784 --- /dev/null +++ b/tests/baselines/reference/switchCaseWithIntersectionTypes01.errors.txt @@ -0,0 +1,38 @@ +tests/cases/conformance/types/typeRelationships/comparable/switchCaseWithIntersectionTypes01.ts(19,10): error TS2678: Type 'number & boolean' is not comparable to type 'string & number'. + Type 'number & boolean' is not comparable to type 'string'. +tests/cases/conformance/types/typeRelationships/comparable/switchCaseWithIntersectionTypes01.ts(23,10): error TS2678: Type 'boolean' is not comparable to type 'string & number'. + Type 'boolean' is not comparable to type 'string'. + + +==== tests/cases/conformance/types/typeRelationships/comparable/switchCaseWithIntersectionTypes01.ts (2 errors) ==== + + var strAndNum: string & number; + var numAndBool: number & boolean; + var str: string; + var num: number; + var bool: boolean; + + switch (strAndNum) { + // Identical + case strAndNum: + break; + + // Constituents + case str: + case num: + break; + + // Overlap in constituents + case numAndBool: + ~~~~~~~~~~ +!!! error TS2678: Type 'number & boolean' is not comparable to type 'string & number'. +!!! error TS2678: Type 'number & boolean' is not comparable to type 'string'. + break; + + // No relation + case bool: + ~~~~ +!!! error TS2678: Type 'boolean' is not comparable to type 'string & number'. +!!! error TS2678: Type 'boolean' is not comparable to type 'string'. + break; + } \ No newline at end of file diff --git a/tests/baselines/reference/switchCaseWithIntersectionTypes01.js b/tests/baselines/reference/switchCaseWithIntersectionTypes01.js new file mode 100644 index 00000000000..4e0ddf7ea76 --- /dev/null +++ b/tests/baselines/reference/switchCaseWithIntersectionTypes01.js @@ -0,0 +1,48 @@ +//// [switchCaseWithIntersectionTypes01.ts] + +var strAndNum: string & number; +var numAndBool: number & boolean; +var str: string; +var num: number; +var bool: boolean; + +switch (strAndNum) { + // Identical + case strAndNum: + break; + + // Constituents + case str: + case num: + break; + + // Overlap in constituents + case numAndBool: + break; + + // No relation + case bool: + break; +} + +//// [switchCaseWithIntersectionTypes01.js] +var strAndNum; +var numAndBool; +var str; +var num; +var bool; +switch (strAndNum) { + // Identical + case strAndNum: + break; + // Constituents + case str: + case num: + break; + // Overlap in constituents + case numAndBool: + break; + // No relation + case bool: + break; +} diff --git a/tests/baselines/reference/switchCaseWithUnionTypes01.errors.txt b/tests/baselines/reference/switchCaseWithUnionTypes01.errors.txt new file mode 100644 index 00000000000..5f164f57343 --- /dev/null +++ b/tests/baselines/reference/switchCaseWithUnionTypes01.errors.txt @@ -0,0 +1,31 @@ +tests/cases/conformance/types/typeRelationships/comparable/switchCaseWithUnionTypes01.ts(23,10): error TS2678: Type 'boolean' is not comparable to type 'string | number'. + + +==== tests/cases/conformance/types/typeRelationships/comparable/switchCaseWithUnionTypes01.ts (1 errors) ==== + + var strOrNum: string | number; + var numOrBool: number | boolean; + var str: string; + var num: number; + var bool: boolean; + + switch (strOrNum) { + // Identical + case strOrNum: + break; + + // Constituents + case str: + case num: + break; + + // Overlap in constituents + case numOrBool: + break; + + // No relation + case bool: + ~~~~ +!!! error TS2678: Type 'boolean' is not comparable to type 'string | number'. + break; + } \ No newline at end of file diff --git a/tests/baselines/reference/switchCaseWithUnionTypes01.js b/tests/baselines/reference/switchCaseWithUnionTypes01.js new file mode 100644 index 00000000000..5c34ea674dc --- /dev/null +++ b/tests/baselines/reference/switchCaseWithUnionTypes01.js @@ -0,0 +1,48 @@ +//// [switchCaseWithUnionTypes01.ts] + +var strOrNum: string | number; +var numOrBool: number | boolean; +var str: string; +var num: number; +var bool: boolean; + +switch (strOrNum) { + // Identical + case strOrNum: + break; + + // Constituents + case str: + case num: + break; + + // Overlap in constituents + case numOrBool: + break; + + // No relation + case bool: + break; +} + +//// [switchCaseWithUnionTypes01.js] +var strOrNum; +var numOrBool; +var str; +var num; +var bool; +switch (strOrNum) { + // Identical + case strOrNum: + break; + // Constituents + case str: + case num: + break; + // Overlap in constituents + case numOrBool: + break; + // No relation + case bool: + break; +} diff --git a/tests/baselines/reference/switchCasesExpressionTypeMismatch.errors.txt b/tests/baselines/reference/switchCasesExpressionTypeMismatch.errors.txt index de739af007d..26d39efef48 100644 --- a/tests/baselines/reference/switchCasesExpressionTypeMismatch.errors.txt +++ b/tests/baselines/reference/switchCasesExpressionTypeMismatch.errors.txt @@ -1,6 +1,6 @@ -tests/cases/compiler/switchCasesExpressionTypeMismatch.ts(4,10): error TS2322: Type 'typeof Foo' is not assignable to type 'number'. -tests/cases/compiler/switchCasesExpressionTypeMismatch.ts(5,10): error TS2322: Type 'string' is not assignable to type 'number'. -tests/cases/compiler/switchCasesExpressionTypeMismatch.ts(7,10): error TS2322: Type 'boolean' is not assignable to type 'number'. +tests/cases/compiler/switchCasesExpressionTypeMismatch.ts(4,10): error TS2678: Type 'typeof Foo' is not comparable to type 'number'. +tests/cases/compiler/switchCasesExpressionTypeMismatch.ts(5,10): error TS2678: Type 'string' is not comparable to type 'number'. +tests/cases/compiler/switchCasesExpressionTypeMismatch.ts(7,10): error TS2678: Type 'boolean' is not comparable to type 'number'. ==== tests/cases/compiler/switchCasesExpressionTypeMismatch.ts (3 errors) ==== @@ -9,14 +9,14 @@ tests/cases/compiler/switchCasesExpressionTypeMismatch.ts(7,10): error TS2322: T switch (0) { case Foo: break; // Error ~~~ -!!! error TS2322: Type 'typeof Foo' is not assignable to type 'number'. +!!! error TS2678: Type 'typeof Foo' is not comparable to type 'number'. case "sss": break; // Error ~~~~~ -!!! error TS2322: Type 'string' is not assignable to type 'number'. +!!! error TS2678: Type 'string' is not comparable to type 'number'. case 123: break; // No Error case true: break; // Error ~~~~ -!!! error TS2322: Type 'boolean' is not assignable to type 'number'. +!!! error TS2678: Type 'boolean' is not comparable to type 'number'. } var s: any = 0; diff --git a/tests/baselines/reference/switchStatements.errors.txt b/tests/baselines/reference/switchStatements.errors.txt index c99b0eba909..81e24aa69a8 100644 --- a/tests/baselines/reference/switchStatements.errors.txt +++ b/tests/baselines/reference/switchStatements.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/statements/switchStatements/switchStatements.ts(35,20): error TS2322: Type '{ id: number; name: string; }' is not assignable to type 'C'. +tests/cases/conformance/statements/switchStatements/switchStatements.ts(35,20): error TS2678: Type '{ id: number; name: string; }' is not comparable to type 'C'. Object literal may only specify known properties, and 'name' does not exist in type 'C'. @@ -39,8 +39,8 @@ tests/cases/conformance/statements/switchStatements/switchStatements.ts(35,20): case new D(): case { id: 12, name: '' }: ~~~~~~~~ -!!! error TS2322: Type '{ id: number; name: string; }' is not assignable to type 'C'. -!!! error TS2322: Object literal may only specify known properties, and 'name' does not exist in type 'C'. +!!! error TS2678: Type '{ id: number; name: string; }' is not comparable to type 'C'. +!!! error TS2678: Object literal may only specify known properties, and 'name' does not exist in type 'C'. case new C(): } diff --git a/tests/baselines/reference/symbolDeclarationEmit1.symbols b/tests/baselines/reference/symbolDeclarationEmit1.symbols index 0b1999cf606..86f57e7de92 100644 --- a/tests/baselines/reference/symbolDeclarationEmit1.symbols +++ b/tests/baselines/reference/symbolDeclarationEmit1.symbols @@ -3,7 +3,7 @@ class C { >C : Symbol(C, Decl(symbolDeclarationEmit1.ts, 0, 0)) [Symbol.toPrimitive]: number; ->Symbol.toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, --, --)) +>Symbol.toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) } diff --git a/tests/baselines/reference/symbolDeclarationEmit10.symbols b/tests/baselines/reference/symbolDeclarationEmit10.symbols index 7d7cbf257df..bcc562e478e 100644 --- a/tests/baselines/reference/symbolDeclarationEmit10.symbols +++ b/tests/baselines/reference/symbolDeclarationEmit10.symbols @@ -3,13 +3,13 @@ var obj = { >obj : Symbol(obj, Decl(symbolDeclarationEmit10.ts, 0, 3)) get [Symbol.isConcatSpreadable]() { return '' }, ->Symbol.isConcatSpreadable : Symbol(SymbolConstructor.isConcatSpreadable, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->isConcatSpreadable : Symbol(SymbolConstructor.isConcatSpreadable, Decl(lib.d.ts, --, --)) +>Symbol.isConcatSpreadable : Symbol(SymbolConstructor.isConcatSpreadable, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>isConcatSpreadable : Symbol(SymbolConstructor.isConcatSpreadable, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) set [Symbol.isConcatSpreadable](x) { } ->Symbol.isConcatSpreadable : Symbol(SymbolConstructor.isConcatSpreadable, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->isConcatSpreadable : Symbol(SymbolConstructor.isConcatSpreadable, Decl(lib.d.ts, --, --)) +>Symbol.isConcatSpreadable : Symbol(SymbolConstructor.isConcatSpreadable, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>isConcatSpreadable : Symbol(SymbolConstructor.isConcatSpreadable, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) >x : Symbol(x, Decl(symbolDeclarationEmit10.ts, 2, 36)) } diff --git a/tests/baselines/reference/symbolDeclarationEmit11.symbols b/tests/baselines/reference/symbolDeclarationEmit11.symbols index a8b9ab0757d..485bb58fb2a 100644 --- a/tests/baselines/reference/symbolDeclarationEmit11.symbols +++ b/tests/baselines/reference/symbolDeclarationEmit11.symbols @@ -3,23 +3,23 @@ class C { >C : Symbol(C, Decl(symbolDeclarationEmit11.ts, 0, 0)) static [Symbol.iterator] = 0; ->Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) +>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) static [Symbol.isConcatSpreadable]() { } ->Symbol.isConcatSpreadable : Symbol(SymbolConstructor.isConcatSpreadable, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->isConcatSpreadable : Symbol(SymbolConstructor.isConcatSpreadable, Decl(lib.d.ts, --, --)) +>Symbol.isConcatSpreadable : Symbol(SymbolConstructor.isConcatSpreadable, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>isConcatSpreadable : Symbol(SymbolConstructor.isConcatSpreadable, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) static get [Symbol.toPrimitive]() { return ""; } ->Symbol.toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, --, --)) +>Symbol.toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) static set [Symbol.toPrimitive](x) { } ->Symbol.toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, --, --)) +>Symbol.toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) >x : Symbol(x, Decl(symbolDeclarationEmit11.ts, 4, 36)) } diff --git a/tests/baselines/reference/symbolDeclarationEmit13.symbols b/tests/baselines/reference/symbolDeclarationEmit13.symbols index 9ac140cbcc4..b0884c44cb8 100644 --- a/tests/baselines/reference/symbolDeclarationEmit13.symbols +++ b/tests/baselines/reference/symbolDeclarationEmit13.symbols @@ -3,13 +3,13 @@ class C { >C : Symbol(C, Decl(symbolDeclarationEmit13.ts, 0, 0)) get [Symbol.toPrimitive]() { return ""; } ->Symbol.toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, --, --)) +>Symbol.toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) set [Symbol.toStringTag](x) { } ->Symbol.toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.d.ts, --, --)) +>Symbol.toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) >x : Symbol(x, Decl(symbolDeclarationEmit13.ts, 2, 29)) } diff --git a/tests/baselines/reference/symbolDeclarationEmit14.symbols b/tests/baselines/reference/symbolDeclarationEmit14.symbols index 4ee1d1d2ebd..e20e3348309 100644 --- a/tests/baselines/reference/symbolDeclarationEmit14.symbols +++ b/tests/baselines/reference/symbolDeclarationEmit14.symbols @@ -3,12 +3,12 @@ class C { >C : Symbol(C, Decl(symbolDeclarationEmit14.ts, 0, 0)) get [Symbol.toPrimitive]() { return ""; } ->Symbol.toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, --, --)) +>Symbol.toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) get [Symbol.toStringTag]() { return ""; } ->Symbol.toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.d.ts, --, --)) +>Symbol.toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) } diff --git a/tests/baselines/reference/symbolDeclarationEmit2.symbols b/tests/baselines/reference/symbolDeclarationEmit2.symbols index f3d7253f1af..348760f0d7d 100644 --- a/tests/baselines/reference/symbolDeclarationEmit2.symbols +++ b/tests/baselines/reference/symbolDeclarationEmit2.symbols @@ -3,7 +3,7 @@ class C { >C : Symbol(C, Decl(symbolDeclarationEmit2.ts, 0, 0)) [Symbol.toPrimitive] = ""; ->Symbol.toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, --, --)) +>Symbol.toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) } diff --git a/tests/baselines/reference/symbolDeclarationEmit3.symbols b/tests/baselines/reference/symbolDeclarationEmit3.symbols index 4a75ecac742..5bb8d67984e 100644 --- a/tests/baselines/reference/symbolDeclarationEmit3.symbols +++ b/tests/baselines/reference/symbolDeclarationEmit3.symbols @@ -3,20 +3,20 @@ class C { >C : Symbol(C, Decl(symbolDeclarationEmit3.ts, 0, 0)) [Symbol.toPrimitive](x: number); ->Symbol.toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, --, --)) +>Symbol.toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) >x : Symbol(x, Decl(symbolDeclarationEmit3.ts, 1, 25)) [Symbol.toPrimitive](x: string); ->Symbol.toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, --, --)) +>Symbol.toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) >x : Symbol(x, Decl(symbolDeclarationEmit3.ts, 2, 25)) [Symbol.toPrimitive](x: any) { } ->Symbol.toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, --, --)) +>Symbol.toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) >x : Symbol(x, Decl(symbolDeclarationEmit3.ts, 3, 25)) } diff --git a/tests/baselines/reference/symbolDeclarationEmit4.symbols b/tests/baselines/reference/symbolDeclarationEmit4.symbols index eec0912d6ee..89a4714f941 100644 --- a/tests/baselines/reference/symbolDeclarationEmit4.symbols +++ b/tests/baselines/reference/symbolDeclarationEmit4.symbols @@ -3,13 +3,13 @@ class C { >C : Symbol(C, Decl(symbolDeclarationEmit4.ts, 0, 0)) get [Symbol.toPrimitive]() { return ""; } ->Symbol.toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, --, --)) +>Symbol.toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) set [Symbol.toPrimitive](x) { } ->Symbol.toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, --, --)) +>Symbol.toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) >x : Symbol(x, Decl(symbolDeclarationEmit4.ts, 2, 29)) } diff --git a/tests/baselines/reference/symbolDeclarationEmit5.symbols b/tests/baselines/reference/symbolDeclarationEmit5.symbols index e9ee78e4a7d..bd1049b4e00 100644 --- a/tests/baselines/reference/symbolDeclarationEmit5.symbols +++ b/tests/baselines/reference/symbolDeclarationEmit5.symbols @@ -3,7 +3,7 @@ interface I { >I : Symbol(I, Decl(symbolDeclarationEmit5.ts, 0, 0)) [Symbol.isConcatSpreadable](): string; ->Symbol.isConcatSpreadable : Symbol(SymbolConstructor.isConcatSpreadable, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->isConcatSpreadable : Symbol(SymbolConstructor.isConcatSpreadable, Decl(lib.d.ts, --, --)) +>Symbol.isConcatSpreadable : Symbol(SymbolConstructor.isConcatSpreadable, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>isConcatSpreadable : Symbol(SymbolConstructor.isConcatSpreadable, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) } diff --git a/tests/baselines/reference/symbolDeclarationEmit6.symbols b/tests/baselines/reference/symbolDeclarationEmit6.symbols index 64da887014c..19b86ff2b66 100644 --- a/tests/baselines/reference/symbolDeclarationEmit6.symbols +++ b/tests/baselines/reference/symbolDeclarationEmit6.symbols @@ -3,7 +3,7 @@ interface I { >I : Symbol(I, Decl(symbolDeclarationEmit6.ts, 0, 0)) [Symbol.isConcatSpreadable]: string; ->Symbol.isConcatSpreadable : Symbol(SymbolConstructor.isConcatSpreadable, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->isConcatSpreadable : Symbol(SymbolConstructor.isConcatSpreadable, Decl(lib.d.ts, --, --)) +>Symbol.isConcatSpreadable : Symbol(SymbolConstructor.isConcatSpreadable, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>isConcatSpreadable : Symbol(SymbolConstructor.isConcatSpreadable, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) } diff --git a/tests/baselines/reference/symbolDeclarationEmit7.symbols b/tests/baselines/reference/symbolDeclarationEmit7.symbols index 3bfaee5316c..2cf42a5c5cc 100644 --- a/tests/baselines/reference/symbolDeclarationEmit7.symbols +++ b/tests/baselines/reference/symbolDeclarationEmit7.symbols @@ -3,7 +3,7 @@ var obj: { >obj : Symbol(obj, Decl(symbolDeclarationEmit7.ts, 0, 3)) [Symbol.isConcatSpreadable]: string; ->Symbol.isConcatSpreadable : Symbol(SymbolConstructor.isConcatSpreadable, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->isConcatSpreadable : Symbol(SymbolConstructor.isConcatSpreadable, Decl(lib.d.ts, --, --)) +>Symbol.isConcatSpreadable : Symbol(SymbolConstructor.isConcatSpreadable, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>isConcatSpreadable : Symbol(SymbolConstructor.isConcatSpreadable, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) } diff --git a/tests/baselines/reference/symbolDeclarationEmit8.symbols b/tests/baselines/reference/symbolDeclarationEmit8.symbols index 9eead633343..bb6c4728a08 100644 --- a/tests/baselines/reference/symbolDeclarationEmit8.symbols +++ b/tests/baselines/reference/symbolDeclarationEmit8.symbols @@ -3,7 +3,7 @@ var obj = { >obj : Symbol(obj, Decl(symbolDeclarationEmit8.ts, 0, 3)) [Symbol.isConcatSpreadable]: 0 ->Symbol.isConcatSpreadable : Symbol(SymbolConstructor.isConcatSpreadable, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->isConcatSpreadable : Symbol(SymbolConstructor.isConcatSpreadable, Decl(lib.d.ts, --, --)) +>Symbol.isConcatSpreadable : Symbol(SymbolConstructor.isConcatSpreadable, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>isConcatSpreadable : Symbol(SymbolConstructor.isConcatSpreadable, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) } diff --git a/tests/baselines/reference/symbolDeclarationEmit9.symbols b/tests/baselines/reference/symbolDeclarationEmit9.symbols index ec49c196d02..60fdbf63c95 100644 --- a/tests/baselines/reference/symbolDeclarationEmit9.symbols +++ b/tests/baselines/reference/symbolDeclarationEmit9.symbols @@ -3,7 +3,7 @@ var obj = { >obj : Symbol(obj, Decl(symbolDeclarationEmit9.ts, 0, 3)) [Symbol.isConcatSpreadable]() { } ->Symbol.isConcatSpreadable : Symbol(SymbolConstructor.isConcatSpreadable, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->isConcatSpreadable : Symbol(SymbolConstructor.isConcatSpreadable, Decl(lib.d.ts, --, --)) +>Symbol.isConcatSpreadable : Symbol(SymbolConstructor.isConcatSpreadable, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>isConcatSpreadable : Symbol(SymbolConstructor.isConcatSpreadable, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) } diff --git a/tests/baselines/reference/symbolProperty11.symbols b/tests/baselines/reference/symbolProperty11.symbols index b064d11b9de..2b9c912bc14 100644 --- a/tests/baselines/reference/symbolProperty11.symbols +++ b/tests/baselines/reference/symbolProperty11.symbols @@ -6,9 +6,9 @@ interface I { >I : Symbol(I, Decl(symbolProperty11.ts, 0, 11)) [Symbol.iterator]?: { x }; ->Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) +>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) >x : Symbol(x, Decl(symbolProperty11.ts, 2, 25)) } diff --git a/tests/baselines/reference/symbolProperty13.symbols b/tests/baselines/reference/symbolProperty13.symbols index a48f02fdacf..9b9b17baf51 100644 --- a/tests/baselines/reference/symbolProperty13.symbols +++ b/tests/baselines/reference/symbolProperty13.symbols @@ -3,9 +3,9 @@ class C { >C : Symbol(C, Decl(symbolProperty13.ts, 0, 0)) [Symbol.iterator]: { x; y }; ->Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) +>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) >x : Symbol(x, Decl(symbolProperty13.ts, 1, 24)) >y : Symbol(y, Decl(symbolProperty13.ts, 1, 27)) } @@ -13,9 +13,9 @@ interface I { >I : Symbol(I, Decl(symbolProperty13.ts, 2, 1)) [Symbol.iterator]: { x }; ->Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) +>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) >x : Symbol(x, Decl(symbolProperty13.ts, 4, 24)) } diff --git a/tests/baselines/reference/symbolProperty14.symbols b/tests/baselines/reference/symbolProperty14.symbols index 459b2699e42..4a995d3311d 100644 --- a/tests/baselines/reference/symbolProperty14.symbols +++ b/tests/baselines/reference/symbolProperty14.symbols @@ -3,9 +3,9 @@ class C { >C : Symbol(C, Decl(symbolProperty14.ts, 0, 0)) [Symbol.iterator]: { x; y }; ->Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) +>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) >x : Symbol(x, Decl(symbolProperty14.ts, 1, 24)) >y : Symbol(y, Decl(symbolProperty14.ts, 1, 27)) } @@ -13,9 +13,9 @@ interface I { >I : Symbol(I, Decl(symbolProperty14.ts, 2, 1)) [Symbol.iterator]?: { x }; ->Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) +>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) >x : Symbol(x, Decl(symbolProperty14.ts, 4, 25)) } diff --git a/tests/baselines/reference/symbolProperty15.symbols b/tests/baselines/reference/symbolProperty15.symbols index 83a3f4630fe..3685a2971f8 100644 --- a/tests/baselines/reference/symbolProperty15.symbols +++ b/tests/baselines/reference/symbolProperty15.symbols @@ -6,9 +6,9 @@ interface I { >I : Symbol(I, Decl(symbolProperty15.ts, 0, 11)) [Symbol.iterator]?: { x }; ->Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) +>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) >x : Symbol(x, Decl(symbolProperty15.ts, 2, 25)) } diff --git a/tests/baselines/reference/symbolProperty16.symbols b/tests/baselines/reference/symbolProperty16.symbols index d54002167a1..4147b23d4ff 100644 --- a/tests/baselines/reference/symbolProperty16.symbols +++ b/tests/baselines/reference/symbolProperty16.symbols @@ -3,18 +3,18 @@ class C { >C : Symbol(C, Decl(symbolProperty16.ts, 0, 0)) private [Symbol.iterator]: { x }; ->Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) +>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) >x : Symbol(x, Decl(symbolProperty16.ts, 1, 32)) } interface I { >I : Symbol(I, Decl(symbolProperty16.ts, 2, 1)) [Symbol.iterator]: { x }; ->Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) +>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) >x : Symbol(x, Decl(symbolProperty16.ts, 4, 24)) } diff --git a/tests/baselines/reference/symbolProperty18.symbols b/tests/baselines/reference/symbolProperty18.symbols index 8f863572639..5e79c460fc8 100644 --- a/tests/baselines/reference/symbolProperty18.symbols +++ b/tests/baselines/reference/symbolProperty18.symbols @@ -3,39 +3,39 @@ var i = { >i : Symbol(i, Decl(symbolProperty18.ts, 0, 3)) [Symbol.iterator]: 0, ->Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) +>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) [Symbol.toStringTag]() { return "" }, ->Symbol.toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.d.ts, --, --)) +>Symbol.toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) set [Symbol.toPrimitive](p: boolean) { } ->Symbol.toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, --, --)) +>Symbol.toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) >p : Symbol(p, Decl(symbolProperty18.ts, 3, 29)) } var it = i[Symbol.iterator]; >it : Symbol(it, Decl(symbolProperty18.ts, 6, 3)) >i : Symbol(i, Decl(symbolProperty18.ts, 0, 3)) ->Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) +>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) var str = i[Symbol.toStringTag](); >str : Symbol(str, Decl(symbolProperty18.ts, 7, 3)) >i : Symbol(i, Decl(symbolProperty18.ts, 0, 3)) ->Symbol.toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.d.ts, --, --)) +>Symbol.toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) i[Symbol.toPrimitive] = false; >i : Symbol(i, Decl(symbolProperty18.ts, 0, 3)) ->Symbol.toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, --, --)) +>Symbol.toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) diff --git a/tests/baselines/reference/symbolProperty19.symbols b/tests/baselines/reference/symbolProperty19.symbols index a2c7dd7dcfd..1e50924524d 100644 --- a/tests/baselines/reference/symbolProperty19.symbols +++ b/tests/baselines/reference/symbolProperty19.symbols @@ -3,15 +3,15 @@ var i = { >i : Symbol(i, Decl(symbolProperty19.ts, 0, 3)) [Symbol.iterator]: { p: null }, ->Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) +>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) >p : Symbol(p, Decl(symbolProperty19.ts, 1, 24)) [Symbol.toStringTag]() { return { p: undefined }; } ->Symbol.toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.d.ts, --, --)) +>Symbol.toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) >p : Symbol(p, Decl(symbolProperty19.ts, 2, 37)) >undefined : Symbol(undefined) } @@ -19,14 +19,14 @@ var i = { var it = i[Symbol.iterator]; >it : Symbol(it, Decl(symbolProperty19.ts, 5, 3)) >i : Symbol(i, Decl(symbolProperty19.ts, 0, 3)) ->Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) +>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) var str = i[Symbol.toStringTag](); >str : Symbol(str, Decl(symbolProperty19.ts, 6, 3)) >i : Symbol(i, Decl(symbolProperty19.ts, 0, 3)) ->Symbol.toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.d.ts, --, --)) +>Symbol.toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) diff --git a/tests/baselines/reference/symbolProperty2.symbols b/tests/baselines/reference/symbolProperty2.symbols index a9bc4a440e0..90cb47c0011 100644 --- a/tests/baselines/reference/symbolProperty2.symbols +++ b/tests/baselines/reference/symbolProperty2.symbols @@ -1,7 +1,7 @@ === tests/cases/conformance/es6/Symbols/symbolProperty2.ts === var s = Symbol(); >s : Symbol(s, Decl(symbolProperty2.ts, 0, 3)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) var x = { >x : Symbol(x, Decl(symbolProperty2.ts, 1, 3)) diff --git a/tests/baselines/reference/symbolProperty20.symbols b/tests/baselines/reference/symbolProperty20.symbols index 97bb4164c2f..e40abe03277 100644 --- a/tests/baselines/reference/symbolProperty20.symbols +++ b/tests/baselines/reference/symbolProperty20.symbols @@ -3,15 +3,15 @@ interface I { >I : Symbol(I, Decl(symbolProperty20.ts, 0, 0)) [Symbol.iterator]: (s: string) => string; ->Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) +>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) >s : Symbol(s, Decl(symbolProperty20.ts, 1, 24)) [Symbol.toStringTag](s: number): number; ->Symbol.toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.d.ts, --, --)) +>Symbol.toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) >s : Symbol(s, Decl(symbolProperty20.ts, 2, 25)) } @@ -20,16 +20,16 @@ var i: I = { >I : Symbol(I, Decl(symbolProperty20.ts, 0, 0)) [Symbol.iterator]: s => s, ->Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) +>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) >s : Symbol(s, Decl(symbolProperty20.ts, 6, 22)) >s : Symbol(s, Decl(symbolProperty20.ts, 6, 22)) [Symbol.toStringTag](n) { return n; } ->Symbol.toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.d.ts, --, --)) +>Symbol.toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) >n : Symbol(n, Decl(symbolProperty20.ts, 7, 25)) >n : Symbol(n, Decl(symbolProperty20.ts, 7, 25)) } diff --git a/tests/baselines/reference/symbolProperty22.symbols b/tests/baselines/reference/symbolProperty22.symbols index 1d7f46fa897..e4e68d81970 100644 --- a/tests/baselines/reference/symbolProperty22.symbols +++ b/tests/baselines/reference/symbolProperty22.symbols @@ -5,9 +5,9 @@ interface I { >U : Symbol(U, Decl(symbolProperty22.ts, 0, 14)) [Symbol.unscopables](x: T): U; ->Symbol.unscopables : Symbol(SymbolConstructor.unscopables, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->unscopables : Symbol(SymbolConstructor.unscopables, Decl(lib.d.ts, --, --)) +>Symbol.unscopables : Symbol(SymbolConstructor.unscopables, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>unscopables : Symbol(SymbolConstructor.unscopables, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) >x : Symbol(x, Decl(symbolProperty22.ts, 1, 25)) >T : Symbol(T, Decl(symbolProperty22.ts, 0, 12)) >U : Symbol(U, Decl(symbolProperty22.ts, 0, 14)) @@ -27,11 +27,11 @@ declare function foo(p1: T, p2: I): U; foo("", { [Symbol.unscopables]: s => s.length }); >foo : Symbol(foo, Decl(symbolProperty22.ts, 2, 1)) ->Symbol.unscopables : Symbol(SymbolConstructor.unscopables, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->unscopables : Symbol(SymbolConstructor.unscopables, Decl(lib.d.ts, --, --)) +>Symbol.unscopables : Symbol(SymbolConstructor.unscopables, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>unscopables : Symbol(SymbolConstructor.unscopables, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) >s : Symbol(s, Decl(symbolProperty22.ts, 6, 31)) ->s.length : Symbol(String.length, Decl(lib.d.ts, --, --)) +>s.length : Symbol(String.length, Decl(lib.es5.d.ts, --, --)) >s : Symbol(s, Decl(symbolProperty22.ts, 6, 31)) ->length : Symbol(String.length, Decl(lib.d.ts, --, --)) +>length : Symbol(String.length, Decl(lib.es5.d.ts, --, --)) diff --git a/tests/baselines/reference/symbolProperty23.symbols b/tests/baselines/reference/symbolProperty23.symbols index 06fce65875c..714b76fa85b 100644 --- a/tests/baselines/reference/symbolProperty23.symbols +++ b/tests/baselines/reference/symbolProperty23.symbols @@ -3,9 +3,9 @@ interface I { >I : Symbol(I, Decl(symbolProperty23.ts, 0, 0)) [Symbol.toPrimitive]: () => boolean; ->Symbol.toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, --, --)) +>Symbol.toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) } class C implements I { @@ -13,9 +13,9 @@ class C implements I { >I : Symbol(I, Decl(symbolProperty23.ts, 0, 0)) [Symbol.toPrimitive]() { ->Symbol.toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, --, --)) +>Symbol.toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) return true; } diff --git a/tests/baselines/reference/symbolProperty26.symbols b/tests/baselines/reference/symbolProperty26.symbols index ae8f95d5859..785a2e395cb 100644 --- a/tests/baselines/reference/symbolProperty26.symbols +++ b/tests/baselines/reference/symbolProperty26.symbols @@ -3,9 +3,9 @@ class C1 { >C1 : Symbol(C1, Decl(symbolProperty26.ts, 0, 0)) [Symbol.toStringTag]() { ->Symbol.toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.d.ts, --, --)) +>Symbol.toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) return ""; } @@ -16,9 +16,9 @@ class C2 extends C1 { >C1 : Symbol(C1, Decl(symbolProperty26.ts, 0, 0)) [Symbol.toStringTag]() { ->Symbol.toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.d.ts, --, --)) +>Symbol.toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) return ""; } diff --git a/tests/baselines/reference/symbolProperty27.symbols b/tests/baselines/reference/symbolProperty27.symbols index d5fcf7ec224..1b050b617c2 100644 --- a/tests/baselines/reference/symbolProperty27.symbols +++ b/tests/baselines/reference/symbolProperty27.symbols @@ -3,9 +3,9 @@ class C1 { >C1 : Symbol(C1, Decl(symbolProperty27.ts, 0, 0)) [Symbol.toStringTag]() { ->Symbol.toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.d.ts, --, --)) +>Symbol.toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) return {}; } @@ -16,9 +16,9 @@ class C2 extends C1 { >C1 : Symbol(C1, Decl(symbolProperty27.ts, 0, 0)) [Symbol.toStringTag]() { ->Symbol.toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.d.ts, --, --)) +>Symbol.toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) return ""; } diff --git a/tests/baselines/reference/symbolProperty28.symbols b/tests/baselines/reference/symbolProperty28.symbols index d8c9daba0d9..c72de5fefb5 100644 --- a/tests/baselines/reference/symbolProperty28.symbols +++ b/tests/baselines/reference/symbolProperty28.symbols @@ -3,9 +3,9 @@ class C1 { >C1 : Symbol(C1, Decl(symbolProperty28.ts, 0, 0)) [Symbol.toStringTag]() { ->Symbol.toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.d.ts, --, --)) +>Symbol.toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) return { x: "" }; >x : Symbol(x, Decl(symbolProperty28.ts, 2, 16)) @@ -24,8 +24,8 @@ var obj = c[Symbol.toStringTag]().x; >obj : Symbol(obj, Decl(symbolProperty28.ts, 9, 3)) >c[Symbol.toStringTag]().x : Symbol(x, Decl(symbolProperty28.ts, 2, 16)) >c : Symbol(c, Decl(symbolProperty28.ts, 8, 3)) ->Symbol.toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.d.ts, --, --)) +>Symbol.toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) >x : Symbol(x, Decl(symbolProperty28.ts, 2, 16)) diff --git a/tests/baselines/reference/symbolProperty4.symbols b/tests/baselines/reference/symbolProperty4.symbols index 7817a7c6fd0..c1f7c82de7d 100644 --- a/tests/baselines/reference/symbolProperty4.symbols +++ b/tests/baselines/reference/symbolProperty4.symbols @@ -3,13 +3,13 @@ var x = { >x : Symbol(x, Decl(symbolProperty4.ts, 0, 3)) [Symbol()]: 0, ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) [Symbol()]() { }, ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) get [Symbol()]() { ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) return 0; } diff --git a/tests/baselines/reference/symbolProperty40.symbols b/tests/baselines/reference/symbolProperty40.symbols index 26a5dc36ed5..a572c380d13 100644 --- a/tests/baselines/reference/symbolProperty40.symbols +++ b/tests/baselines/reference/symbolProperty40.symbols @@ -3,21 +3,21 @@ class C { >C : Symbol(C, Decl(symbolProperty40.ts, 0, 0)) [Symbol.iterator](x: string): string; ->Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) +>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) >x : Symbol(x, Decl(symbolProperty40.ts, 1, 22)) [Symbol.iterator](x: number): number; ->Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) +>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) >x : Symbol(x, Decl(symbolProperty40.ts, 2, 22)) [Symbol.iterator](x: any) { ->Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) +>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) >x : Symbol(x, Decl(symbolProperty40.ts, 3, 22)) return undefined; @@ -31,13 +31,13 @@ var c = new C; c[Symbol.iterator](""); >c : Symbol(c, Decl(symbolProperty40.ts, 8, 3)) ->Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) +>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) c[Symbol.iterator](0); >c : Symbol(c, Decl(symbolProperty40.ts, 8, 3)) ->Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) +>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) diff --git a/tests/baselines/reference/symbolProperty41.symbols b/tests/baselines/reference/symbolProperty41.symbols index 7db66e5862e..82174ce2e0e 100644 --- a/tests/baselines/reference/symbolProperty41.symbols +++ b/tests/baselines/reference/symbolProperty41.symbols @@ -3,24 +3,24 @@ class C { >C : Symbol(C, Decl(symbolProperty41.ts, 0, 0)) [Symbol.iterator](x: string): { x: string }; ->Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) +>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) >x : Symbol(x, Decl(symbolProperty41.ts, 1, 22)) >x : Symbol(x, Decl(symbolProperty41.ts, 1, 35)) [Symbol.iterator](x: "hello"): { x: string; hello: string }; ->Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) +>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) >x : Symbol(x, Decl(symbolProperty41.ts, 2, 22)) >x : Symbol(x, Decl(symbolProperty41.ts, 2, 36)) >hello : Symbol(hello, Decl(symbolProperty41.ts, 2, 47)) [Symbol.iterator](x: any) { ->Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) +>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) >x : Symbol(x, Decl(symbolProperty41.ts, 3, 22)) return undefined; @@ -34,13 +34,13 @@ var c = new C; c[Symbol.iterator](""); >c : Symbol(c, Decl(symbolProperty41.ts, 8, 3)) ->Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) +>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) c[Symbol.iterator]("hello"); >c : Symbol(c, Decl(symbolProperty41.ts, 8, 3)) ->Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) +>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) diff --git a/tests/baselines/reference/symbolProperty45.symbols b/tests/baselines/reference/symbolProperty45.symbols index 46ecb0a6414..0f42e37c5cf 100644 --- a/tests/baselines/reference/symbolProperty45.symbols +++ b/tests/baselines/reference/symbolProperty45.symbols @@ -3,16 +3,16 @@ class C { >C : Symbol(C, Decl(symbolProperty45.ts, 0, 0)) get [Symbol.hasInstance]() { ->Symbol.hasInstance : Symbol(SymbolConstructor.hasInstance, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->hasInstance : Symbol(SymbolConstructor.hasInstance, Decl(lib.d.ts, --, --)) +>Symbol.hasInstance : Symbol(SymbolConstructor.hasInstance, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>hasInstance : Symbol(SymbolConstructor.hasInstance, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) return ""; } get [Symbol.toPrimitive]() { ->Symbol.toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, --, --)) +>Symbol.toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) return ""; } diff --git a/tests/baselines/reference/symbolProperty5.symbols b/tests/baselines/reference/symbolProperty5.symbols index 00e47c461ee..d8ae4d18940 100644 --- a/tests/baselines/reference/symbolProperty5.symbols +++ b/tests/baselines/reference/symbolProperty5.symbols @@ -3,19 +3,19 @@ var x = { >x : Symbol(x, Decl(symbolProperty5.ts, 0, 3)) [Symbol.iterator]: 0, ->Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) +>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) [Symbol.toPrimitive]() { }, ->Symbol.toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, --, --)) +>Symbol.toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) get [Symbol.toStringTag]() { ->Symbol.toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.d.ts, --, --)) +>Symbol.toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) return 0; } diff --git a/tests/baselines/reference/symbolProperty50.symbols b/tests/baselines/reference/symbolProperty50.symbols index f5197627846..2e51286ffa4 100644 --- a/tests/baselines/reference/symbolProperty50.symbols +++ b/tests/baselines/reference/symbolProperty50.symbols @@ -9,8 +9,8 @@ module M { >C : Symbol(C, Decl(symbolProperty50.ts, 1, 24)) [Symbol.iterator]() { } ->Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) +>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) } } diff --git a/tests/baselines/reference/symbolProperty51.symbols b/tests/baselines/reference/symbolProperty51.symbols index 4be31dd0a56..7cd4870ea32 100644 --- a/tests/baselines/reference/symbolProperty51.symbols +++ b/tests/baselines/reference/symbolProperty51.symbols @@ -9,8 +9,8 @@ module M { >C : Symbol(C, Decl(symbolProperty51.ts, 1, 21)) [Symbol.iterator]() { } ->Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) +>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) } } diff --git a/tests/baselines/reference/symbolProperty55.symbols b/tests/baselines/reference/symbolProperty55.symbols index e6a9c304abe..f7371428e76 100644 --- a/tests/baselines/reference/symbolProperty55.symbols +++ b/tests/baselines/reference/symbolProperty55.symbols @@ -3,9 +3,9 @@ var obj = { >obj : Symbol(obj, Decl(symbolProperty55.ts, 0, 3)) [Symbol.iterator]: 0 ->Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) +>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) }; @@ -14,13 +14,13 @@ module M { var Symbol: SymbolConstructor; >Symbol : Symbol(Symbol, Decl(symbolProperty55.ts, 5, 7)) ->SymbolConstructor : Symbol(SymbolConstructor, Decl(lib.d.ts, --, --)) +>SymbolConstructor : Symbol(SymbolConstructor, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) // The following should be of type 'any'. This is because even though obj has a property keyed by Symbol.iterator, // the key passed in here is the *wrong* Symbol.iterator. It is not the iterator property of the global Symbol. obj[Symbol.iterator]; >obj : Symbol(obj, Decl(symbolProperty55.ts, 0, 3)) ->Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) +>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) >Symbol : Symbol(Symbol, Decl(symbolProperty55.ts, 5, 7)) ->iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) +>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) } diff --git a/tests/baselines/reference/symbolProperty56.symbols b/tests/baselines/reference/symbolProperty56.symbols index 6ff465daa98..00ca21138fc 100644 --- a/tests/baselines/reference/symbolProperty56.symbols +++ b/tests/baselines/reference/symbolProperty56.symbols @@ -3,9 +3,9 @@ var obj = { >obj : Symbol(obj, Decl(symbolProperty56.ts, 0, 3)) [Symbol.iterator]: 0 ->Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) +>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) }; diff --git a/tests/baselines/reference/symbolProperty57.symbols b/tests/baselines/reference/symbolProperty57.symbols index b256ba651c4..bb4ac0ceef2 100644 --- a/tests/baselines/reference/symbolProperty57.symbols +++ b/tests/baselines/reference/symbolProperty57.symbols @@ -3,14 +3,14 @@ var obj = { >obj : Symbol(obj, Decl(symbolProperty57.ts, 0, 3)) [Symbol.iterator]: 0 ->Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) +>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) }; // Should give type 'any'. obj[Symbol["nonsense"]]; >obj : Symbol(obj, Decl(symbolProperty57.ts, 0, 3)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) diff --git a/tests/baselines/reference/symbolProperty6.symbols b/tests/baselines/reference/symbolProperty6.symbols index d0eedccf4fa..73c55715a5d 100644 --- a/tests/baselines/reference/symbolProperty6.symbols +++ b/tests/baselines/reference/symbolProperty6.symbols @@ -3,24 +3,24 @@ class C { >C : Symbol(C, Decl(symbolProperty6.ts, 0, 0)) [Symbol.iterator] = 0; ->Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, --, --)) +>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) [Symbol.unscopables]: number; ->Symbol.unscopables : Symbol(SymbolConstructor.unscopables, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->unscopables : Symbol(SymbolConstructor.unscopables, Decl(lib.d.ts, --, --)) +>Symbol.unscopables : Symbol(SymbolConstructor.unscopables, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>unscopables : Symbol(SymbolConstructor.unscopables, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) [Symbol.toPrimitive]() { } ->Symbol.toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, --, --)) +>Symbol.toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) get [Symbol.toStringTag]() { ->Symbol.toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.d.ts, --, --)) +>Symbol.toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) return 0; } diff --git a/tests/baselines/reference/symbolProperty8.symbols b/tests/baselines/reference/symbolProperty8.symbols index 8d26d193ef5..e46c35b47be 100644 --- a/tests/baselines/reference/symbolProperty8.symbols +++ b/tests/baselines/reference/symbolProperty8.symbols @@ -3,12 +3,12 @@ interface I { >I : Symbol(I, Decl(symbolProperty8.ts, 0, 0)) [Symbol.unscopables]: number; ->Symbol.unscopables : Symbol(SymbolConstructor.unscopables, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->unscopables : Symbol(SymbolConstructor.unscopables, Decl(lib.d.ts, --, --)) +>Symbol.unscopables : Symbol(SymbolConstructor.unscopables, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>unscopables : Symbol(SymbolConstructor.unscopables, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) [Symbol.toPrimitive](); ->Symbol.toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, --, --)) +>Symbol.toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) } diff --git a/tests/baselines/reference/symbolType11.symbols b/tests/baselines/reference/symbolType11.symbols index d5c19af7844..3c5fc1b61cc 100644 --- a/tests/baselines/reference/symbolType11.symbols +++ b/tests/baselines/reference/symbolType11.symbols @@ -1,9 +1,9 @@ === tests/cases/conformance/es6/Symbols/symbolType11.ts === var s = Symbol.for("logical"); >s : Symbol(s, Decl(symbolType11.ts, 0, 3)) ->Symbol.for : Symbol(SymbolConstructor.for, Decl(lib.d.ts, --, --)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->for : Symbol(SymbolConstructor.for, Decl(lib.d.ts, --, --)) +>Symbol.for : Symbol(SymbolConstructor.for, Decl(lib.es2015.symbol.d.ts, --, --)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --)) +>for : Symbol(SymbolConstructor.for, Decl(lib.es2015.symbol.d.ts, --, --)) s && s; >s : Symbol(s, Decl(symbolType11.ts, 0, 3)) diff --git a/tests/baselines/reference/symbolType16.symbols b/tests/baselines/reference/symbolType16.symbols index 843bf3f68e6..3e5fb6e2157 100644 --- a/tests/baselines/reference/symbolType16.symbols +++ b/tests/baselines/reference/symbolType16.symbols @@ -1,6 +1,6 @@ === tests/cases/conformance/es6/Symbols/symbolType16.ts === interface Symbol { ->Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(symbolType16.ts, 0, 0)) +>Symbol : Symbol(Symbol, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(symbolType16.ts, 0, 0)) newSymbolProp: number; >newSymbolProp : Symbol(Symbol.newSymbolProp, Decl(symbolType16.ts, 0, 18)) diff --git a/tests/baselines/reference/taggedTemplateContextualTyping1.symbols b/tests/baselines/reference/taggedTemplateContextualTyping1.symbols index 2de45d16379..3c50a6f92e4 100644 --- a/tests/baselines/reference/taggedTemplateContextualTyping1.symbols +++ b/tests/baselines/reference/taggedTemplateContextualTyping1.symbols @@ -13,7 +13,7 @@ function tempTag1(templateStrs: TemplateStringsArray, f: FuncType, x: T): T; >tempTag1 : Symbol(tempTag1, Decl(taggedTemplateContextualTyping1.ts, 1, 48), Decl(taggedTemplateContextualTyping1.ts, 3, 79), Decl(taggedTemplateContextualTyping1.ts, 4, 92)) >T : Symbol(T, Decl(taggedTemplateContextualTyping1.ts, 3, 18)) >templateStrs : Symbol(templateStrs, Decl(taggedTemplateContextualTyping1.ts, 3, 21)) ->TemplateStringsArray : Symbol(TemplateStringsArray, Decl(lib.d.ts, --, --)) +>TemplateStringsArray : Symbol(TemplateStringsArray, Decl(lib.es5.d.ts, --, --)) >f : Symbol(f, Decl(taggedTemplateContextualTyping1.ts, 3, 56)) >FuncType : Symbol(FuncType, Decl(taggedTemplateContextualTyping1.ts, 0, 0)) >x : Symbol(x, Decl(taggedTemplateContextualTyping1.ts, 3, 69)) @@ -24,7 +24,7 @@ function tempTag1(templateStrs: TemplateStringsArray, f: FuncType, h: FuncTyp >tempTag1 : Symbol(tempTag1, Decl(taggedTemplateContextualTyping1.ts, 1, 48), Decl(taggedTemplateContextualTyping1.ts, 3, 79), Decl(taggedTemplateContextualTyping1.ts, 4, 92)) >T : Symbol(T, Decl(taggedTemplateContextualTyping1.ts, 4, 18)) >templateStrs : Symbol(templateStrs, Decl(taggedTemplateContextualTyping1.ts, 4, 21)) ->TemplateStringsArray : Symbol(TemplateStringsArray, Decl(lib.d.ts, --, --)) +>TemplateStringsArray : Symbol(TemplateStringsArray, Decl(lib.es5.d.ts, --, --)) >f : Symbol(f, Decl(taggedTemplateContextualTyping1.ts, 4, 56)) >FuncType : Symbol(FuncType, Decl(taggedTemplateContextualTyping1.ts, 0, 0)) >h : Symbol(h, Decl(taggedTemplateContextualTyping1.ts, 4, 69)) diff --git a/tests/baselines/reference/taggedTemplateContextualTyping2.symbols b/tests/baselines/reference/taggedTemplateContextualTyping2.symbols index 240cc344de7..a1ee63ef8b0 100644 --- a/tests/baselines/reference/taggedTemplateContextualTyping2.symbols +++ b/tests/baselines/reference/taggedTemplateContextualTyping2.symbols @@ -22,7 +22,7 @@ type FuncType2 = (x: (p: T) => T) => typeof x; function tempTag2(templateStrs: TemplateStringsArray, f: FuncType1, x: number): number; >tempTag2 : Symbol(tempTag2, Decl(taggedTemplateContextualTyping2.ts, 2, 52), Decl(taggedTemplateContextualTyping2.ts, 4, 87), Decl(taggedTemplateContextualTyping2.ts, 5, 101)) >templateStrs : Symbol(templateStrs, Decl(taggedTemplateContextualTyping2.ts, 4, 18)) ->TemplateStringsArray : Symbol(TemplateStringsArray, Decl(lib.d.ts, --, --)) +>TemplateStringsArray : Symbol(TemplateStringsArray, Decl(lib.es5.d.ts, --, --)) >f : Symbol(f, Decl(taggedTemplateContextualTyping2.ts, 4, 53)) >FuncType1 : Symbol(FuncType1, Decl(taggedTemplateContextualTyping2.ts, 0, 0)) >x : Symbol(x, Decl(taggedTemplateContextualTyping2.ts, 4, 67)) @@ -30,7 +30,7 @@ function tempTag2(templateStrs: TemplateStringsArray, f: FuncType1, x: number): function tempTag2(templateStrs: TemplateStringsArray, f: FuncType2, h: FuncType2, x: string): string; >tempTag2 : Symbol(tempTag2, Decl(taggedTemplateContextualTyping2.ts, 2, 52), Decl(taggedTemplateContextualTyping2.ts, 4, 87), Decl(taggedTemplateContextualTyping2.ts, 5, 101)) >templateStrs : Symbol(templateStrs, Decl(taggedTemplateContextualTyping2.ts, 5, 18)) ->TemplateStringsArray : Symbol(TemplateStringsArray, Decl(lib.d.ts, --, --)) +>TemplateStringsArray : Symbol(TemplateStringsArray, Decl(lib.es5.d.ts, --, --)) >f : Symbol(f, Decl(taggedTemplateContextualTyping2.ts, 5, 53)) >FuncType2 : Symbol(FuncType2, Decl(taggedTemplateContextualTyping2.ts, 1, 49)) >h : Symbol(h, Decl(taggedTemplateContextualTyping2.ts, 5, 67)) diff --git a/tests/baselines/reference/taggedTemplateStringsWithOverloadResolution2_ES6.symbols b/tests/baselines/reference/taggedTemplateStringsWithOverloadResolution2_ES6.symbols index e96912ec3bb..cadfa135202 100644 --- a/tests/baselines/reference/taggedTemplateStringsWithOverloadResolution2_ES6.symbols +++ b/tests/baselines/reference/taggedTemplateStringsWithOverloadResolution2_ES6.symbols @@ -2,7 +2,7 @@ function foo1(strs: TemplateStringsArray, x: number): string; >foo1 : Symbol(foo1, Decl(taggedTemplateStringsWithOverloadResolution2_ES6.ts, 0, 0), Decl(taggedTemplateStringsWithOverloadResolution2_ES6.ts, 0, 61), Decl(taggedTemplateStringsWithOverloadResolution2_ES6.ts, 1, 49)) >strs : Symbol(strs, Decl(taggedTemplateStringsWithOverloadResolution2_ES6.ts, 0, 14)) ->TemplateStringsArray : Symbol(TemplateStringsArray, Decl(lib.d.ts, --, --)) +>TemplateStringsArray : Symbol(TemplateStringsArray, Decl(lib.es5.d.ts, --, --)) >x : Symbol(x, Decl(taggedTemplateStringsWithOverloadResolution2_ES6.ts, 0, 41)) function foo1(strs: string[], x: number): number; @@ -34,7 +34,7 @@ function foo2(strs: string[], x: number): number; function foo2(strs: TemplateStringsArray, x: number): string; >foo2 : Symbol(foo2, Decl(taggedTemplateStringsWithOverloadResolution2_ES6.ts, 7, 20), Decl(taggedTemplateStringsWithOverloadResolution2_ES6.ts, 9, 49), Decl(taggedTemplateStringsWithOverloadResolution2_ES6.ts, 10, 61)) >strs : Symbol(strs, Decl(taggedTemplateStringsWithOverloadResolution2_ES6.ts, 10, 14)) ->TemplateStringsArray : Symbol(TemplateStringsArray, Decl(lib.d.ts, --, --)) +>TemplateStringsArray : Symbol(TemplateStringsArray, Decl(lib.es5.d.ts, --, --)) >x : Symbol(x, Decl(taggedTemplateStringsWithOverloadResolution2_ES6.ts, 10, 41)) function foo2(...stuff: any[]): any { diff --git a/tests/baselines/reference/templateStringWithEmbeddedNewOperator.symbols b/tests/baselines/reference/templateStringWithEmbeddedNewOperator.symbols index ed7ef9dbc63..120bd330502 100644 --- a/tests/baselines/reference/templateStringWithEmbeddedNewOperator.symbols +++ b/tests/baselines/reference/templateStringWithEmbeddedNewOperator.symbols @@ -1,5 +1,5 @@ === tests/cases/conformance/es6/templates/templateStringWithEmbeddedNewOperator.ts === var x = `abc${ new String("Hi") }def`; >x : Symbol(x, Decl(templateStringWithEmbeddedNewOperator.ts, 0, 3)) ->String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) diff --git a/tests/baselines/reference/templateStringWithEmbeddedNewOperatorES6.symbols b/tests/baselines/reference/templateStringWithEmbeddedNewOperatorES6.symbols index a7240d4fd22..8b499b52e6b 100644 --- a/tests/baselines/reference/templateStringWithEmbeddedNewOperatorES6.symbols +++ b/tests/baselines/reference/templateStringWithEmbeddedNewOperatorES6.symbols @@ -1,5 +1,5 @@ === tests/cases/conformance/es6/templates/templateStringWithEmbeddedNewOperatorES6.ts === var x = `abc${ new String("Hi") }def`; >x : Symbol(x, Decl(templateStringWithEmbeddedNewOperatorES6.ts, 0, 3)) ->String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>String : Symbol(String, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --)) diff --git a/tests/baselines/reference/templateStringWithEmbeddedUnaryPlusES6.symbols b/tests/baselines/reference/templateStringWithEmbeddedUnaryPlusES6.symbols index 5d27cedede1..df10fbfca6d 100644 --- a/tests/baselines/reference/templateStringWithEmbeddedUnaryPlusES6.symbols +++ b/tests/baselines/reference/templateStringWithEmbeddedUnaryPlusES6.symbols @@ -1,5 +1,5 @@ === tests/cases/conformance/es6/templates/templateStringWithEmbeddedUnaryPlusES6.ts === var x = `abc${ +Infinity }def`; >x : Symbol(x, Decl(templateStringWithEmbeddedUnaryPlusES6.ts, 0, 3)) ->Infinity : Symbol(Infinity, Decl(lib.d.ts, --, --)) +>Infinity : Symbol(Infinity, Decl(lib.es5.d.ts, --, --)) diff --git a/tests/baselines/reference/templateStringWithPropertyAccessES6.symbols b/tests/baselines/reference/templateStringWithPropertyAccessES6.symbols index 9259aff2a31..803705609a1 100644 --- a/tests/baselines/reference/templateStringWithPropertyAccessES6.symbols +++ b/tests/baselines/reference/templateStringWithPropertyAccessES6.symbols @@ -1,5 +1,5 @@ === tests/cases/conformance/es6/templates/templateStringWithPropertyAccessES6.ts === `abc${0}abc`.indexOf(`abc`); ->`abc${0}abc`.indexOf : Symbol(String.indexOf, Decl(lib.d.ts, --, --)) ->indexOf : Symbol(String.indexOf, Decl(lib.d.ts, --, --)) +>`abc${0}abc`.indexOf : Symbol(String.indexOf, Decl(lib.es5.d.ts, --, --)) +>indexOf : Symbol(String.indexOf, Decl(lib.es5.d.ts, --, --)) diff --git a/tests/baselines/reference/thisInObjectLiterals.errors.txt b/tests/baselines/reference/thisInObjectLiterals.errors.txt index 73300d86d74..b0b1c63a34a 100644 --- a/tests/baselines/reference/thisInObjectLiterals.errors.txt +++ b/tests/baselines/reference/thisInObjectLiterals.errors.txt @@ -1,7 +1,8 @@ tests/cases/conformance/expressions/thisKeyword/thisInObjectLiterals.ts(7,13): error TS2403: Subsequent variable declarations must have the same type. Variable 't' must be of type '{ x: this; y: number; }', but here has type '{ x: MyClass; y: number; }'. +tests/cases/conformance/expressions/thisKeyword/thisInObjectLiterals.ts(14,21): error TS2339: Property 'spaaace' does not exist on type '{ f(): any; }'. -==== tests/cases/conformance/expressions/thisKeyword/thisInObjectLiterals.ts (1 errors) ==== +==== tests/cases/conformance/expressions/thisKeyword/thisInObjectLiterals.ts (2 errors) ==== class MyClass { t: number; @@ -14,10 +15,12 @@ tests/cases/conformance/expressions/thisKeyword/thisInObjectLiterals.ts(7,13): e } } - //type of 'this' in an object literal property of a function type is Any + //type of 'this' in an object literal method is the type of the object literal var obj = { f() { return this.spaaace; + ~~~~~~~ +!!! error TS2339: Property 'spaaace' does not exist on type '{ f(): any; }'. } }; var obj: { f: () => any; }; diff --git a/tests/baselines/reference/thisInObjectLiterals.js b/tests/baselines/reference/thisInObjectLiterals.js index 4e71347a366..6c8380060a7 100644 --- a/tests/baselines/reference/thisInObjectLiterals.js +++ b/tests/baselines/reference/thisInObjectLiterals.js @@ -9,7 +9,7 @@ class MyClass { } } -//type of 'this' in an object literal property of a function type is Any +//type of 'this' in an object literal method is the type of the object literal var obj = { f() { return this.spaaace; @@ -29,7 +29,7 @@ var MyClass = (function () { }; return MyClass; }()); -//type of 'this' in an object literal property of a function type is Any +//type of 'this' in an object literal method is the type of the object literal var obj = { f: function () { return this.spaaace; diff --git a/tests/baselines/reference/thisTypeInClasses.symbols b/tests/baselines/reference/thisTypeInClasses.symbols index e10379dc785..0f98f013b01 100644 --- a/tests/baselines/reference/thisTypeInClasses.symbols +++ b/tests/baselines/reference/thisTypeInClasses.symbols @@ -41,11 +41,11 @@ class C3 { c: this | Date; >c : Symbol(C3.c, Decl(thisTypeInClasses.ts, 16, 20)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) d: this & Date; >d : Symbol(C3.d, Decl(thisTypeInClasses.ts, 17, 19)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) e: (((this))); >e : Symbol(C3.e, Decl(thisTypeInClasses.ts, 18, 19)) diff --git a/tests/baselines/reference/thisTypeInFunctions.js b/tests/baselines/reference/thisTypeInFunctions.js new file mode 100644 index 00000000000..cfe1706ae99 --- /dev/null +++ b/tests/baselines/reference/thisTypeInFunctions.js @@ -0,0 +1,382 @@ +//// [thisTypeInFunctions.ts] +// body checking +class B { + n: number; +} +class C { + n: number; + explicitThis(this: this, m: number): number { + return this.n + m; + } + explicitC(this: C, m: number): number { + return this.n + m; + } + explicitProperty(this: {n: number}, m: number): number { + return this.n + m; + } + explicitVoid(this: void, m: number): number { + return m + 1; + } +} +class D extends C { } +interface I { + a: number; + explicitVoid1(this: void): number; + explicitVoid2(this: void): number; + explicitStructural(this: {a: number}): number; + explicitInterface(this: I): number; + explicitThis(this: this): number; +} +function explicitStructural(this: { y: number }, x: number): number { + return x + this.y; +} +function justThis(this: { y: number }): number { + return this.y; +} +function implicitThis(n: number): number { + return this.m + n + 12; +} +let impl: I = { + a: 12, + explicitVoid2: () => this.a, // ok, this: any because it refers to some outer object (window?) + explicitVoid1() { return 12; }, + explicitStructural() { + return this.a; + }, + explicitInterface() { + return this.a; + }, + explicitThis() { + return this.a; + }, +} +impl.explicitVoid1 = function () { return 12; }; +impl.explicitVoid2 = () => 12; +impl.explicitStructural = function() { return this.a; }; +impl.explicitInterface = function() { return this.a; }; +impl.explicitStructural = () => 12; +impl.explicitInterface = () => 12; +impl.explicitThis = function () { return this.a; }; +// parameter checking +let ok: {y: number, f: (this: { y: number }, x: number) => number} = { y: 12, f: explicitStructural }; +let implicitAnyOk: {notSpecified: number, f: (x: number) => number} = { notSpecified: 12, f: implicitThis }; +ok.f(13); +implicitThis(12); +implicitAnyOk.f(12); + +let c = new C(); +let d = new D(); +let ripped = c.explicitC; +c.explicitC(12); +c.explicitProperty(12); +c.explicitThis(12); +d.explicitC(12); +d.explicitProperty(12); +d.explicitThis(12); +let reconstructed: { + n: number, + explicitThis(this: C, m: number): number, // note: this: this is not allowed in an object literal type. + explicitC(this: C, m: number): number, + explicitProperty: (this: {n : number}, m: number) => number, + explicitVoid(this: void, m: number): number, +} = { + n: 12, + explicitThis: c.explicitThis, + explicitC: c.explicitC, + explicitProperty: c.explicitProperty, + explicitVoid: c.explicitVoid +}; +reconstructed.explicitThis(10); +reconstructed.explicitProperty(11); +let explicitVoid = reconstructed.explicitVoid; +explicitVoid(12); +// assignment checking +let unboundToSpecified: (this: { y: number }, x: number) => number = x => x + this.y; // ok, this:any +let specifiedToSpecified: (this: {y: number}, x: number) => number = explicitStructural; +let anyToSpecified: (this: { y: number }, x: number) => number = function(x: number): number { return x + 12; }; + +let unspecifiedLambda: (x: number) => number = x => x + 12; +let specifiedLambda: (this: void, x: number) => number = x => x + 12; +let unspecifiedLambdaToSpecified: (this: {y: number}, x: number) => number = unspecifiedLambda; +let specifiedLambdaToSpecified: (this: {y: number}, x: number) => number = specifiedLambda; + + +let explicitCFunction: (this: C, m: number) => number; +let explicitPropertyFunction: (this: {n: number}, m: number) => number; +c.explicitC = explicitCFunction; +c.explicitC = function(this: C, m: number) { return this.n + m }; +c.explicitProperty = explicitPropertyFunction; +c.explicitProperty = function(this: {n: number}, m: number) { return this.n + m }; +c.explicitProperty = reconstructed.explicitProperty; + +// lambdas are assignable to anything +c.explicitC = m => m; +c.explicitThis = m => m; +c.explicitProperty = m => m; + +// this inside lambdas refer to outer scope +// the outer-scoped lambda at top-level is still just `any` +c.explicitC = m => m + this.n; +c.explicitThis = m => m + this.n; +c.explicitProperty = m => m + this.n; + +//NOTE: this=C here, I guess? +c.explicitThis = explicitCFunction; +c.explicitThis = function(this: C, m: number) { return this.n + m }; + +// this:any compatibility +c.explicitC = function(m) { return this.n + m }; +c.explicitProperty = function(m) { return this.n + m }; +c.explicitThis = function(m) { return this.n + m }; + +// this: contextual typing +c.explicitThis = function(this, m) { return this.n + m }; + +// this: superclass compatibility +c.explicitC = function(this: B, m: number) { return this.n + m }; + +// this:void compatibility +c.explicitVoid = n => n; + +// class-based assignability +class Base1 { + x: number; + public polymorphic(this: this): number { return this.x; } + explicit(this: Base1): number { return this.x; } + static explicitStatic(this: typeof Base1): number { return this.y; } + static y: number; +} +class Derived1 extends Base1 { + y: number +} +class Base2 { + y: number + polymorphic(this: this): number { return this.y; } + explicit(this: Base1): number { return this.x; } +} +class Derived2 extends Base2 { + x: number +} +let b1 = new Base1(); +let b2 = new Base2(); +let d1 = new Derived1(); +let d2 = new Derived2(); +d2.polymorphic = d1.polymorphic // ok, 'x' and 'y' in { x, y } +d1.polymorphic = d2.polymorphic // ok, 'x' and 'y' in { x, y } + +// bivariance-allowed cases +d1.polymorphic = b2.polymorphic // ok, 'y' in D: { x, y } +d2.polymorphic = d1.explicit // ok, 'y' in { x, y } +b1.polymorphic = d2.polymorphic // ok, 'x' and 'y' not in Base1: { x } +b1.explicit = d2.polymorphic // ok, 'x' and 'y' not in Base1: { x } + +////// use this-type for construction with new //// +function InterfaceThis(this: I) { + this.a = 12; +} +function LiteralTypeThis(this: {x: string}) { + this.x = "ok"; +} +function AnyThis(this: any) { + this.x = "ok"; +} +let interfaceThis = new InterfaceThis(); +let literalTypeThis = new LiteralTypeThis(); +let anyThis = new AnyThis(); + +//// type parameter inference //// +declare var f: { + (this: void, x: number): number, + call(this: (...argArray: any[]) => U, ...argArray: any[]): U; +}; +let n: number = f.call(12); + +function missingTypeIsImplicitAny(this, a: number) { return this.anything + a; } + + +//// [thisTypeInFunctions.js] +var __extends = (this && this.__extends) || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); +}; +var _this = this; +// body checking +var B = (function () { + function B() { + } + return B; +}()); +var C = (function () { + function C() { + } + C.prototype.explicitThis = function (m) { + return this.n + m; + }; + C.prototype.explicitC = function (m) { + return this.n + m; + }; + C.prototype.explicitProperty = function (m) { + return this.n + m; + }; + C.prototype.explicitVoid = function (m) { + return m + 1; + }; + return C; +}()); +var D = (function (_super) { + __extends(D, _super); + function D() { + _super.apply(this, arguments); + } + return D; +}(C)); +function explicitStructural(x) { + return x + this.y; +} +function justThis() { + return this.y; +} +function implicitThis(n) { + return this.m + n + 12; +} +var impl = { + a: 12, + explicitVoid2: function () { return _this.a; }, + explicitVoid1: function () { return 12; }, + explicitStructural: function () { + return this.a; + }, + explicitInterface: function () { + return this.a; + }, + explicitThis: function () { + return this.a; + } +}; +impl.explicitVoid1 = function () { return 12; }; +impl.explicitVoid2 = function () { return 12; }; +impl.explicitStructural = function () { return this.a; }; +impl.explicitInterface = function () { return this.a; }; +impl.explicitStructural = function () { return 12; }; +impl.explicitInterface = function () { return 12; }; +impl.explicitThis = function () { return this.a; }; +// parameter checking +var ok = { y: 12, f: explicitStructural }; +var implicitAnyOk = { notSpecified: 12, f: implicitThis }; +ok.f(13); +implicitThis(12); +implicitAnyOk.f(12); +var c = new C(); +var d = new D(); +var ripped = c.explicitC; +c.explicitC(12); +c.explicitProperty(12); +c.explicitThis(12); +d.explicitC(12); +d.explicitProperty(12); +d.explicitThis(12); +var reconstructed = { + n: 12, + explicitThis: c.explicitThis, + explicitC: c.explicitC, + explicitProperty: c.explicitProperty, + explicitVoid: c.explicitVoid +}; +reconstructed.explicitThis(10); +reconstructed.explicitProperty(11); +var explicitVoid = reconstructed.explicitVoid; +explicitVoid(12); +// assignment checking +var unboundToSpecified = function (x) { return x + _this.y; }; // ok, this:any +var specifiedToSpecified = explicitStructural; +var anyToSpecified = function (x) { return x + 12; }; +var unspecifiedLambda = function (x) { return x + 12; }; +var specifiedLambda = function (x) { return x + 12; }; +var unspecifiedLambdaToSpecified = unspecifiedLambda; +var specifiedLambdaToSpecified = specifiedLambda; +var explicitCFunction; +var explicitPropertyFunction; +c.explicitC = explicitCFunction; +c.explicitC = function (m) { return this.n + m; }; +c.explicitProperty = explicitPropertyFunction; +c.explicitProperty = function (m) { return this.n + m; }; +c.explicitProperty = reconstructed.explicitProperty; +// lambdas are assignable to anything +c.explicitC = function (m) { return m; }; +c.explicitThis = function (m) { return m; }; +c.explicitProperty = function (m) { return m; }; +// this inside lambdas refer to outer scope +// the outer-scoped lambda at top-level is still just `any` +c.explicitC = function (m) { return m + _this.n; }; +c.explicitThis = function (m) { return m + _this.n; }; +c.explicitProperty = function (m) { return m + _this.n; }; +//NOTE: this=C here, I guess? +c.explicitThis = explicitCFunction; +c.explicitThis = function (m) { return this.n + m; }; +// this:any compatibility +c.explicitC = function (m) { return this.n + m; }; +c.explicitProperty = function (m) { return this.n + m; }; +c.explicitThis = function (m) { return this.n + m; }; +// this: contextual typing +c.explicitThis = function (m) { return this.n + m; }; +// this: superclass compatibility +c.explicitC = function (m) { return this.n + m; }; +// this:void compatibility +c.explicitVoid = function (n) { return n; }; +// class-based assignability +var Base1 = (function () { + function Base1() { + } + Base1.prototype.polymorphic = function () { return this.x; }; + Base1.prototype.explicit = function () { return this.x; }; + Base1.explicitStatic = function () { return this.y; }; + return Base1; +}()); +var Derived1 = (function (_super) { + __extends(Derived1, _super); + function Derived1() { + _super.apply(this, arguments); + } + return Derived1; +}(Base1)); +var Base2 = (function () { + function Base2() { + } + Base2.prototype.polymorphic = function () { return this.y; }; + Base2.prototype.explicit = function () { return this.x; }; + return Base2; +}()); +var Derived2 = (function (_super) { + __extends(Derived2, _super); + function Derived2() { + _super.apply(this, arguments); + } + return Derived2; +}(Base2)); +var b1 = new Base1(); +var b2 = new Base2(); +var d1 = new Derived1(); +var d2 = new Derived2(); +d2.polymorphic = d1.polymorphic; // ok, 'x' and 'y' in { x, y } +d1.polymorphic = d2.polymorphic; // ok, 'x' and 'y' in { x, y } +// bivariance-allowed cases +d1.polymorphic = b2.polymorphic; // ok, 'y' in D: { x, y } +d2.polymorphic = d1.explicit; // ok, 'y' in { x, y } +b1.polymorphic = d2.polymorphic; // ok, 'x' and 'y' not in Base1: { x } +b1.explicit = d2.polymorphic; // ok, 'x' and 'y' not in Base1: { x } +////// use this-type for construction with new //// +function InterfaceThis() { + this.a = 12; +} +function LiteralTypeThis() { + this.x = "ok"; +} +function AnyThis() { + this.x = "ok"; +} +var interfaceThis = new InterfaceThis(); +var literalTypeThis = new LiteralTypeThis(); +var anyThis = new AnyThis(); +var n = f.call(12); +function missingTypeIsImplicitAny(a) { return this.anything + a; } diff --git a/tests/baselines/reference/thisTypeInFunctions.symbols b/tests/baselines/reference/thisTypeInFunctions.symbols new file mode 100644 index 00000000000..3d4c3f6ecc7 --- /dev/null +++ b/tests/baselines/reference/thisTypeInFunctions.symbols @@ -0,0 +1,797 @@ +=== tests/cases/conformance/types/thisType/thisTypeInFunctions.ts === +// body checking +class B { +>B : Symbol(B, Decl(thisTypeInFunctions.ts, 0, 0)) + + n: number; +>n : Symbol(B.n, Decl(thisTypeInFunctions.ts, 1, 9)) +} +class C { +>C : Symbol(C, Decl(thisTypeInFunctions.ts, 3, 1)) + + n: number; +>n : Symbol(C.n, Decl(thisTypeInFunctions.ts, 4, 9)) + + explicitThis(this: this, m: number): number { +>explicitThis : Symbol(C.explicitThis, Decl(thisTypeInFunctions.ts, 5, 14)) +>this : Symbol(this, Decl(thisTypeInFunctions.ts, 6, 17)) +>m : Symbol(m, Decl(thisTypeInFunctions.ts, 6, 28)) + + return this.n + m; +>this.n : Symbol(C.n, Decl(thisTypeInFunctions.ts, 4, 9)) +>this : Symbol(C, Decl(thisTypeInFunctions.ts, 3, 1)) +>n : Symbol(C.n, Decl(thisTypeInFunctions.ts, 4, 9)) +>m : Symbol(m, Decl(thisTypeInFunctions.ts, 6, 28)) + } + explicitC(this: C, m: number): number { +>explicitC : Symbol(C.explicitC, Decl(thisTypeInFunctions.ts, 8, 5)) +>this : Symbol(this, Decl(thisTypeInFunctions.ts, 9, 14)) +>C : Symbol(C, Decl(thisTypeInFunctions.ts, 3, 1)) +>m : Symbol(m, Decl(thisTypeInFunctions.ts, 9, 22)) + + return this.n + m; +>this.n : Symbol(C.n, Decl(thisTypeInFunctions.ts, 4, 9)) +>this : Symbol(C, Decl(thisTypeInFunctions.ts, 3, 1)) +>n : Symbol(C.n, Decl(thisTypeInFunctions.ts, 4, 9)) +>m : Symbol(m, Decl(thisTypeInFunctions.ts, 9, 22)) + } + explicitProperty(this: {n: number}, m: number): number { +>explicitProperty : Symbol(C.explicitProperty, Decl(thisTypeInFunctions.ts, 11, 5)) +>this : Symbol(this, Decl(thisTypeInFunctions.ts, 12, 21)) +>n : Symbol(n, Decl(thisTypeInFunctions.ts, 12, 28)) +>m : Symbol(m, Decl(thisTypeInFunctions.ts, 12, 39)) + + return this.n + m; +>this.n : Symbol(n, Decl(thisTypeInFunctions.ts, 12, 28)) +>this : Symbol(, Decl(thisTypeInFunctions.ts, 12, 26)) +>n : Symbol(n, Decl(thisTypeInFunctions.ts, 12, 28)) +>m : Symbol(m, Decl(thisTypeInFunctions.ts, 12, 39)) + } + explicitVoid(this: void, m: number): number { +>explicitVoid : Symbol(C.explicitVoid, Decl(thisTypeInFunctions.ts, 14, 5)) +>this : Symbol(this, Decl(thisTypeInFunctions.ts, 15, 17)) +>m : Symbol(m, Decl(thisTypeInFunctions.ts, 15, 28)) + + return m + 1; +>m : Symbol(m, Decl(thisTypeInFunctions.ts, 15, 28)) + } +} +class D extends C { } +>D : Symbol(D, Decl(thisTypeInFunctions.ts, 18, 1)) +>C : Symbol(C, Decl(thisTypeInFunctions.ts, 3, 1)) + +interface I { +>I : Symbol(I, Decl(thisTypeInFunctions.ts, 19, 21)) + + a: number; +>a : Symbol(I.a, Decl(thisTypeInFunctions.ts, 20, 13)) + + explicitVoid1(this: void): number; +>explicitVoid1 : Symbol(I.explicitVoid1, Decl(thisTypeInFunctions.ts, 21, 14)) +>this : Symbol(this, Decl(thisTypeInFunctions.ts, 22, 18)) + + explicitVoid2(this: void): number; +>explicitVoid2 : Symbol(I.explicitVoid2, Decl(thisTypeInFunctions.ts, 22, 38)) +>this : Symbol(this, Decl(thisTypeInFunctions.ts, 23, 18)) + + explicitStructural(this: {a: number}): number; +>explicitStructural : Symbol(I.explicitStructural, Decl(thisTypeInFunctions.ts, 23, 38)) +>this : Symbol(this, Decl(thisTypeInFunctions.ts, 24, 23)) +>a : Symbol(a, Decl(thisTypeInFunctions.ts, 24, 30)) + + explicitInterface(this: I): number; +>explicitInterface : Symbol(I.explicitInterface, Decl(thisTypeInFunctions.ts, 24, 50)) +>this : Symbol(this, Decl(thisTypeInFunctions.ts, 25, 22)) +>I : Symbol(I, Decl(thisTypeInFunctions.ts, 19, 21)) + + explicitThis(this: this): number; +>explicitThis : Symbol(I.explicitThis, Decl(thisTypeInFunctions.ts, 25, 39)) +>this : Symbol(this, Decl(thisTypeInFunctions.ts, 26, 17)) +} +function explicitStructural(this: { y: number }, x: number): number { +>explicitStructural : Symbol(explicitStructural, Decl(thisTypeInFunctions.ts, 27, 1)) +>this : Symbol(this, Decl(thisTypeInFunctions.ts, 28, 28)) +>y : Symbol(y, Decl(thisTypeInFunctions.ts, 28, 35)) +>x : Symbol(x, Decl(thisTypeInFunctions.ts, 28, 48)) + + return x + this.y; +>x : Symbol(x, Decl(thisTypeInFunctions.ts, 28, 48)) +>this.y : Symbol(y, Decl(thisTypeInFunctions.ts, 28, 35)) +>this : Symbol(, Decl(thisTypeInFunctions.ts, 28, 33)) +>y : Symbol(y, Decl(thisTypeInFunctions.ts, 28, 35)) +} +function justThis(this: { y: number }): number { +>justThis : Symbol(justThis, Decl(thisTypeInFunctions.ts, 30, 1)) +>this : Symbol(this, Decl(thisTypeInFunctions.ts, 31, 18)) +>y : Symbol(y, Decl(thisTypeInFunctions.ts, 31, 25)) + + return this.y; +>this.y : Symbol(y, Decl(thisTypeInFunctions.ts, 31, 25)) +>this : Symbol(, Decl(thisTypeInFunctions.ts, 31, 23)) +>y : Symbol(y, Decl(thisTypeInFunctions.ts, 31, 25)) +} +function implicitThis(n: number): number { +>implicitThis : Symbol(implicitThis, Decl(thisTypeInFunctions.ts, 33, 1)) +>n : Symbol(n, Decl(thisTypeInFunctions.ts, 34, 22)) + + return this.m + n + 12; +>n : Symbol(n, Decl(thisTypeInFunctions.ts, 34, 22)) +} +let impl: I = { +>impl : Symbol(impl, Decl(thisTypeInFunctions.ts, 37, 3)) +>I : Symbol(I, Decl(thisTypeInFunctions.ts, 19, 21)) + + a: 12, +>a : Symbol(a, Decl(thisTypeInFunctions.ts, 37, 15)) + + explicitVoid2: () => this.a, // ok, this: any because it refers to some outer object (window?) +>explicitVoid2 : Symbol(explicitVoid2, Decl(thisTypeInFunctions.ts, 38, 10)) + + explicitVoid1() { return 12; }, +>explicitVoid1 : Symbol(explicitVoid1, Decl(thisTypeInFunctions.ts, 39, 32)) + + explicitStructural() { +>explicitStructural : Symbol(explicitStructural, Decl(thisTypeInFunctions.ts, 40, 35)) + + return this.a; +>this.a : Symbol(a, Decl(thisTypeInFunctions.ts, 24, 30)) +>this : Symbol(, Decl(thisTypeInFunctions.ts, 24, 28)) +>a : Symbol(a, Decl(thisTypeInFunctions.ts, 24, 30)) + + }, + explicitInterface() { +>explicitInterface : Symbol(explicitInterface, Decl(thisTypeInFunctions.ts, 43, 6)) + + return this.a; +>this.a : Symbol(I.a, Decl(thisTypeInFunctions.ts, 20, 13)) +>this : Symbol(I, Decl(thisTypeInFunctions.ts, 19, 21)) +>a : Symbol(I.a, Decl(thisTypeInFunctions.ts, 20, 13)) + + }, + explicitThis() { +>explicitThis : Symbol(explicitThis, Decl(thisTypeInFunctions.ts, 46, 6)) + + return this.a; +>this.a : Symbol(I.a, Decl(thisTypeInFunctions.ts, 20, 13)) +>this : Symbol(I, Decl(thisTypeInFunctions.ts, 19, 21)) +>a : Symbol(I.a, Decl(thisTypeInFunctions.ts, 20, 13)) + + }, +} +impl.explicitVoid1 = function () { return 12; }; +>impl.explicitVoid1 : Symbol(I.explicitVoid1, Decl(thisTypeInFunctions.ts, 21, 14)) +>impl : Symbol(impl, Decl(thisTypeInFunctions.ts, 37, 3)) +>explicitVoid1 : Symbol(I.explicitVoid1, Decl(thisTypeInFunctions.ts, 21, 14)) + +impl.explicitVoid2 = () => 12; +>impl.explicitVoid2 : Symbol(I.explicitVoid2, Decl(thisTypeInFunctions.ts, 22, 38)) +>impl : Symbol(impl, Decl(thisTypeInFunctions.ts, 37, 3)) +>explicitVoid2 : Symbol(I.explicitVoid2, Decl(thisTypeInFunctions.ts, 22, 38)) + +impl.explicitStructural = function() { return this.a; }; +>impl.explicitStructural : Symbol(I.explicitStructural, Decl(thisTypeInFunctions.ts, 23, 38)) +>impl : Symbol(impl, Decl(thisTypeInFunctions.ts, 37, 3)) +>explicitStructural : Symbol(I.explicitStructural, Decl(thisTypeInFunctions.ts, 23, 38)) +>this.a : Symbol(a, Decl(thisTypeInFunctions.ts, 24, 30)) +>this : Symbol(, Decl(thisTypeInFunctions.ts, 24, 28)) +>a : Symbol(a, Decl(thisTypeInFunctions.ts, 24, 30)) + +impl.explicitInterface = function() { return this.a; }; +>impl.explicitInterface : Symbol(I.explicitInterface, Decl(thisTypeInFunctions.ts, 24, 50)) +>impl : Symbol(impl, Decl(thisTypeInFunctions.ts, 37, 3)) +>explicitInterface : Symbol(I.explicitInterface, Decl(thisTypeInFunctions.ts, 24, 50)) +>this.a : Symbol(I.a, Decl(thisTypeInFunctions.ts, 20, 13)) +>this : Symbol(I, Decl(thisTypeInFunctions.ts, 19, 21)) +>a : Symbol(I.a, Decl(thisTypeInFunctions.ts, 20, 13)) + +impl.explicitStructural = () => 12; +>impl.explicitStructural : Symbol(I.explicitStructural, Decl(thisTypeInFunctions.ts, 23, 38)) +>impl : Symbol(impl, Decl(thisTypeInFunctions.ts, 37, 3)) +>explicitStructural : Symbol(I.explicitStructural, Decl(thisTypeInFunctions.ts, 23, 38)) + +impl.explicitInterface = () => 12; +>impl.explicitInterface : Symbol(I.explicitInterface, Decl(thisTypeInFunctions.ts, 24, 50)) +>impl : Symbol(impl, Decl(thisTypeInFunctions.ts, 37, 3)) +>explicitInterface : Symbol(I.explicitInterface, Decl(thisTypeInFunctions.ts, 24, 50)) + +impl.explicitThis = function () { return this.a; }; +>impl.explicitThis : Symbol(I.explicitThis, Decl(thisTypeInFunctions.ts, 25, 39)) +>impl : Symbol(impl, Decl(thisTypeInFunctions.ts, 37, 3)) +>explicitThis : Symbol(I.explicitThis, Decl(thisTypeInFunctions.ts, 25, 39)) +>this.a : Symbol(I.a, Decl(thisTypeInFunctions.ts, 20, 13)) +>this : Symbol(I, Decl(thisTypeInFunctions.ts, 19, 21)) +>a : Symbol(I.a, Decl(thisTypeInFunctions.ts, 20, 13)) + +// parameter checking +let ok: {y: number, f: (this: { y: number }, x: number) => number} = { y: 12, f: explicitStructural }; +>ok : Symbol(ok, Decl(thisTypeInFunctions.ts, 59, 3)) +>y : Symbol(y, Decl(thisTypeInFunctions.ts, 59, 9)) +>f : Symbol(f, Decl(thisTypeInFunctions.ts, 59, 19)) +>this : Symbol(this, Decl(thisTypeInFunctions.ts, 59, 24)) +>y : Symbol(y, Decl(thisTypeInFunctions.ts, 59, 31)) +>x : Symbol(x, Decl(thisTypeInFunctions.ts, 59, 44)) +>y : Symbol(y, Decl(thisTypeInFunctions.ts, 59, 70)) +>f : Symbol(f, Decl(thisTypeInFunctions.ts, 59, 77)) +>explicitStructural : Symbol(explicitStructural, Decl(thisTypeInFunctions.ts, 27, 1)) + +let implicitAnyOk: {notSpecified: number, f: (x: number) => number} = { notSpecified: 12, f: implicitThis }; +>implicitAnyOk : Symbol(implicitAnyOk, Decl(thisTypeInFunctions.ts, 60, 3)) +>notSpecified : Symbol(notSpecified, Decl(thisTypeInFunctions.ts, 60, 20)) +>f : Symbol(f, Decl(thisTypeInFunctions.ts, 60, 41)) +>x : Symbol(x, Decl(thisTypeInFunctions.ts, 60, 46)) +>notSpecified : Symbol(notSpecified, Decl(thisTypeInFunctions.ts, 60, 71)) +>f : Symbol(f, Decl(thisTypeInFunctions.ts, 60, 89)) +>implicitThis : Symbol(implicitThis, Decl(thisTypeInFunctions.ts, 33, 1)) + +ok.f(13); +>ok.f : Symbol(f, Decl(thisTypeInFunctions.ts, 59, 19)) +>ok : Symbol(ok, Decl(thisTypeInFunctions.ts, 59, 3)) +>f : Symbol(f, Decl(thisTypeInFunctions.ts, 59, 19)) + +implicitThis(12); +>implicitThis : Symbol(implicitThis, Decl(thisTypeInFunctions.ts, 33, 1)) + +implicitAnyOk.f(12); +>implicitAnyOk.f : Symbol(f, Decl(thisTypeInFunctions.ts, 60, 41)) +>implicitAnyOk : Symbol(implicitAnyOk, Decl(thisTypeInFunctions.ts, 60, 3)) +>f : Symbol(f, Decl(thisTypeInFunctions.ts, 60, 41)) + +let c = new C(); +>c : Symbol(c, Decl(thisTypeInFunctions.ts, 65, 3)) +>C : Symbol(C, Decl(thisTypeInFunctions.ts, 3, 1)) + +let d = new D(); +>d : Symbol(d, Decl(thisTypeInFunctions.ts, 66, 3)) +>D : Symbol(D, Decl(thisTypeInFunctions.ts, 18, 1)) + +let ripped = c.explicitC; +>ripped : Symbol(ripped, Decl(thisTypeInFunctions.ts, 67, 3)) +>c.explicitC : Symbol(C.explicitC, Decl(thisTypeInFunctions.ts, 8, 5)) +>c : Symbol(c, Decl(thisTypeInFunctions.ts, 65, 3)) +>explicitC : Symbol(C.explicitC, Decl(thisTypeInFunctions.ts, 8, 5)) + +c.explicitC(12); +>c.explicitC : Symbol(C.explicitC, Decl(thisTypeInFunctions.ts, 8, 5)) +>c : Symbol(c, Decl(thisTypeInFunctions.ts, 65, 3)) +>explicitC : Symbol(C.explicitC, Decl(thisTypeInFunctions.ts, 8, 5)) + +c.explicitProperty(12); +>c.explicitProperty : Symbol(C.explicitProperty, Decl(thisTypeInFunctions.ts, 11, 5)) +>c : Symbol(c, Decl(thisTypeInFunctions.ts, 65, 3)) +>explicitProperty : Symbol(C.explicitProperty, Decl(thisTypeInFunctions.ts, 11, 5)) + +c.explicitThis(12); +>c.explicitThis : Symbol(C.explicitThis, Decl(thisTypeInFunctions.ts, 5, 14)) +>c : Symbol(c, Decl(thisTypeInFunctions.ts, 65, 3)) +>explicitThis : Symbol(C.explicitThis, Decl(thisTypeInFunctions.ts, 5, 14)) + +d.explicitC(12); +>d.explicitC : Symbol(C.explicitC, Decl(thisTypeInFunctions.ts, 8, 5)) +>d : Symbol(d, Decl(thisTypeInFunctions.ts, 66, 3)) +>explicitC : Symbol(C.explicitC, Decl(thisTypeInFunctions.ts, 8, 5)) + +d.explicitProperty(12); +>d.explicitProperty : Symbol(C.explicitProperty, Decl(thisTypeInFunctions.ts, 11, 5)) +>d : Symbol(d, Decl(thisTypeInFunctions.ts, 66, 3)) +>explicitProperty : Symbol(C.explicitProperty, Decl(thisTypeInFunctions.ts, 11, 5)) + +d.explicitThis(12); +>d.explicitThis : Symbol(C.explicitThis, Decl(thisTypeInFunctions.ts, 5, 14)) +>d : Symbol(d, Decl(thisTypeInFunctions.ts, 66, 3)) +>explicitThis : Symbol(C.explicitThis, Decl(thisTypeInFunctions.ts, 5, 14)) + +let reconstructed: { +>reconstructed : Symbol(reconstructed, Decl(thisTypeInFunctions.ts, 74, 3)) + + n: number, +>n : Symbol(n, Decl(thisTypeInFunctions.ts, 74, 20)) + + explicitThis(this: C, m: number): number, // note: this: this is not allowed in an object literal type. +>explicitThis : Symbol(explicitThis, Decl(thisTypeInFunctions.ts, 75, 14)) +>this : Symbol(this, Decl(thisTypeInFunctions.ts, 76, 17)) +>C : Symbol(C, Decl(thisTypeInFunctions.ts, 3, 1)) +>m : Symbol(m, Decl(thisTypeInFunctions.ts, 76, 25)) + + explicitC(this: C, m: number): number, +>explicitC : Symbol(explicitC, Decl(thisTypeInFunctions.ts, 76, 45)) +>this : Symbol(this, Decl(thisTypeInFunctions.ts, 77, 14)) +>C : Symbol(C, Decl(thisTypeInFunctions.ts, 3, 1)) +>m : Symbol(m, Decl(thisTypeInFunctions.ts, 77, 22)) + + explicitProperty: (this: {n : number}, m: number) => number, +>explicitProperty : Symbol(explicitProperty, Decl(thisTypeInFunctions.ts, 77, 42)) +>this : Symbol(this, Decl(thisTypeInFunctions.ts, 78, 23)) +>n : Symbol(n, Decl(thisTypeInFunctions.ts, 78, 30)) +>m : Symbol(m, Decl(thisTypeInFunctions.ts, 78, 42)) + + explicitVoid(this: void, m: number): number, +>explicitVoid : Symbol(explicitVoid, Decl(thisTypeInFunctions.ts, 78, 64)) +>this : Symbol(this, Decl(thisTypeInFunctions.ts, 79, 17)) +>m : Symbol(m, Decl(thisTypeInFunctions.ts, 79, 28)) + +} = { + n: 12, +>n : Symbol(n, Decl(thisTypeInFunctions.ts, 80, 5)) + + explicitThis: c.explicitThis, +>explicitThis : Symbol(explicitThis, Decl(thisTypeInFunctions.ts, 81, 10)) +>c.explicitThis : Symbol(C.explicitThis, Decl(thisTypeInFunctions.ts, 5, 14)) +>c : Symbol(c, Decl(thisTypeInFunctions.ts, 65, 3)) +>explicitThis : Symbol(C.explicitThis, Decl(thisTypeInFunctions.ts, 5, 14)) + + explicitC: c.explicitC, +>explicitC : Symbol(explicitC, Decl(thisTypeInFunctions.ts, 82, 33)) +>c.explicitC : Symbol(C.explicitC, Decl(thisTypeInFunctions.ts, 8, 5)) +>c : Symbol(c, Decl(thisTypeInFunctions.ts, 65, 3)) +>explicitC : Symbol(C.explicitC, Decl(thisTypeInFunctions.ts, 8, 5)) + + explicitProperty: c.explicitProperty, +>explicitProperty : Symbol(explicitProperty, Decl(thisTypeInFunctions.ts, 83, 27)) +>c.explicitProperty : Symbol(C.explicitProperty, Decl(thisTypeInFunctions.ts, 11, 5)) +>c : Symbol(c, Decl(thisTypeInFunctions.ts, 65, 3)) +>explicitProperty : Symbol(C.explicitProperty, Decl(thisTypeInFunctions.ts, 11, 5)) + + explicitVoid: c.explicitVoid +>explicitVoid : Symbol(explicitVoid, Decl(thisTypeInFunctions.ts, 84, 41)) +>c.explicitVoid : Symbol(C.explicitVoid, Decl(thisTypeInFunctions.ts, 14, 5)) +>c : Symbol(c, Decl(thisTypeInFunctions.ts, 65, 3)) +>explicitVoid : Symbol(C.explicitVoid, Decl(thisTypeInFunctions.ts, 14, 5)) + +}; +reconstructed.explicitThis(10); +>reconstructed.explicitThis : Symbol(explicitThis, Decl(thisTypeInFunctions.ts, 75, 14)) +>reconstructed : Symbol(reconstructed, Decl(thisTypeInFunctions.ts, 74, 3)) +>explicitThis : Symbol(explicitThis, Decl(thisTypeInFunctions.ts, 75, 14)) + +reconstructed.explicitProperty(11); +>reconstructed.explicitProperty : Symbol(explicitProperty, Decl(thisTypeInFunctions.ts, 77, 42)) +>reconstructed : Symbol(reconstructed, Decl(thisTypeInFunctions.ts, 74, 3)) +>explicitProperty : Symbol(explicitProperty, Decl(thisTypeInFunctions.ts, 77, 42)) + +let explicitVoid = reconstructed.explicitVoid; +>explicitVoid : Symbol(explicitVoid, Decl(thisTypeInFunctions.ts, 89, 3)) +>reconstructed.explicitVoid : Symbol(explicitVoid, Decl(thisTypeInFunctions.ts, 78, 64)) +>reconstructed : Symbol(reconstructed, Decl(thisTypeInFunctions.ts, 74, 3)) +>explicitVoid : Symbol(explicitVoid, Decl(thisTypeInFunctions.ts, 78, 64)) + +explicitVoid(12); +>explicitVoid : Symbol(explicitVoid, Decl(thisTypeInFunctions.ts, 89, 3)) + +// assignment checking +let unboundToSpecified: (this: { y: number }, x: number) => number = x => x + this.y; // ok, this:any +>unboundToSpecified : Symbol(unboundToSpecified, Decl(thisTypeInFunctions.ts, 92, 3)) +>this : Symbol(this, Decl(thisTypeInFunctions.ts, 92, 25)) +>y : Symbol(y, Decl(thisTypeInFunctions.ts, 92, 32)) +>x : Symbol(x, Decl(thisTypeInFunctions.ts, 92, 45)) +>x : Symbol(x, Decl(thisTypeInFunctions.ts, 92, 68)) +>x : Symbol(x, Decl(thisTypeInFunctions.ts, 92, 68)) + +let specifiedToSpecified: (this: {y: number}, x: number) => number = explicitStructural; +>specifiedToSpecified : Symbol(specifiedToSpecified, Decl(thisTypeInFunctions.ts, 93, 3)) +>this : Symbol(this, Decl(thisTypeInFunctions.ts, 93, 27)) +>y : Symbol(y, Decl(thisTypeInFunctions.ts, 93, 34)) +>x : Symbol(x, Decl(thisTypeInFunctions.ts, 93, 45)) +>explicitStructural : Symbol(explicitStructural, Decl(thisTypeInFunctions.ts, 27, 1)) + +let anyToSpecified: (this: { y: number }, x: number) => number = function(x: number): number { return x + 12; }; +>anyToSpecified : Symbol(anyToSpecified, Decl(thisTypeInFunctions.ts, 94, 3)) +>this : Symbol(this, Decl(thisTypeInFunctions.ts, 94, 21)) +>y : Symbol(y, Decl(thisTypeInFunctions.ts, 94, 28)) +>x : Symbol(x, Decl(thisTypeInFunctions.ts, 94, 41)) +>x : Symbol(x, Decl(thisTypeInFunctions.ts, 94, 74)) +>x : Symbol(x, Decl(thisTypeInFunctions.ts, 94, 74)) + +let unspecifiedLambda: (x: number) => number = x => x + 12; +>unspecifiedLambda : Symbol(unspecifiedLambda, Decl(thisTypeInFunctions.ts, 96, 3)) +>x : Symbol(x, Decl(thisTypeInFunctions.ts, 96, 24)) +>x : Symbol(x, Decl(thisTypeInFunctions.ts, 96, 46)) +>x : Symbol(x, Decl(thisTypeInFunctions.ts, 96, 46)) + +let specifiedLambda: (this: void, x: number) => number = x => x + 12; +>specifiedLambda : Symbol(specifiedLambda, Decl(thisTypeInFunctions.ts, 97, 3)) +>this : Symbol(this, Decl(thisTypeInFunctions.ts, 97, 22)) +>x : Symbol(x, Decl(thisTypeInFunctions.ts, 97, 33)) +>x : Symbol(x, Decl(thisTypeInFunctions.ts, 97, 56)) +>x : Symbol(x, Decl(thisTypeInFunctions.ts, 97, 56)) + +let unspecifiedLambdaToSpecified: (this: {y: number}, x: number) => number = unspecifiedLambda; +>unspecifiedLambdaToSpecified : Symbol(unspecifiedLambdaToSpecified, Decl(thisTypeInFunctions.ts, 98, 3)) +>this : Symbol(this, Decl(thisTypeInFunctions.ts, 98, 35)) +>y : Symbol(y, Decl(thisTypeInFunctions.ts, 98, 42)) +>x : Symbol(x, Decl(thisTypeInFunctions.ts, 98, 53)) +>unspecifiedLambda : Symbol(unspecifiedLambda, Decl(thisTypeInFunctions.ts, 96, 3)) + +let specifiedLambdaToSpecified: (this: {y: number}, x: number) => number = specifiedLambda; +>specifiedLambdaToSpecified : Symbol(specifiedLambdaToSpecified, Decl(thisTypeInFunctions.ts, 99, 3)) +>this : Symbol(this, Decl(thisTypeInFunctions.ts, 99, 33)) +>y : Symbol(y, Decl(thisTypeInFunctions.ts, 99, 40)) +>x : Symbol(x, Decl(thisTypeInFunctions.ts, 99, 51)) +>specifiedLambda : Symbol(specifiedLambda, Decl(thisTypeInFunctions.ts, 97, 3)) + + +let explicitCFunction: (this: C, m: number) => number; +>explicitCFunction : Symbol(explicitCFunction, Decl(thisTypeInFunctions.ts, 102, 3)) +>this : Symbol(this, Decl(thisTypeInFunctions.ts, 102, 24)) +>C : Symbol(C, Decl(thisTypeInFunctions.ts, 3, 1)) +>m : Symbol(m, Decl(thisTypeInFunctions.ts, 102, 32)) + +let explicitPropertyFunction: (this: {n: number}, m: number) => number; +>explicitPropertyFunction : Symbol(explicitPropertyFunction, Decl(thisTypeInFunctions.ts, 103, 3)) +>this : Symbol(this, Decl(thisTypeInFunctions.ts, 103, 31)) +>n : Symbol(n, Decl(thisTypeInFunctions.ts, 103, 38)) +>m : Symbol(m, Decl(thisTypeInFunctions.ts, 103, 49)) + +c.explicitC = explicitCFunction; +>c.explicitC : Symbol(C.explicitC, Decl(thisTypeInFunctions.ts, 8, 5)) +>c : Symbol(c, Decl(thisTypeInFunctions.ts, 65, 3)) +>explicitC : Symbol(C.explicitC, Decl(thisTypeInFunctions.ts, 8, 5)) +>explicitCFunction : Symbol(explicitCFunction, Decl(thisTypeInFunctions.ts, 102, 3)) + +c.explicitC = function(this: C, m: number) { return this.n + m }; +>c.explicitC : Symbol(C.explicitC, Decl(thisTypeInFunctions.ts, 8, 5)) +>c : Symbol(c, Decl(thisTypeInFunctions.ts, 65, 3)) +>explicitC : Symbol(C.explicitC, Decl(thisTypeInFunctions.ts, 8, 5)) +>this : Symbol(this, Decl(thisTypeInFunctions.ts, 105, 23)) +>C : Symbol(C, Decl(thisTypeInFunctions.ts, 3, 1)) +>m : Symbol(m, Decl(thisTypeInFunctions.ts, 105, 31)) +>this.n : Symbol(C.n, Decl(thisTypeInFunctions.ts, 4, 9)) +>this : Symbol(C, Decl(thisTypeInFunctions.ts, 3, 1)) +>n : Symbol(C.n, Decl(thisTypeInFunctions.ts, 4, 9)) +>m : Symbol(m, Decl(thisTypeInFunctions.ts, 105, 31)) + +c.explicitProperty = explicitPropertyFunction; +>c.explicitProperty : Symbol(C.explicitProperty, Decl(thisTypeInFunctions.ts, 11, 5)) +>c : Symbol(c, Decl(thisTypeInFunctions.ts, 65, 3)) +>explicitProperty : Symbol(C.explicitProperty, Decl(thisTypeInFunctions.ts, 11, 5)) +>explicitPropertyFunction : Symbol(explicitPropertyFunction, Decl(thisTypeInFunctions.ts, 103, 3)) + +c.explicitProperty = function(this: {n: number}, m: number) { return this.n + m }; +>c.explicitProperty : Symbol(C.explicitProperty, Decl(thisTypeInFunctions.ts, 11, 5)) +>c : Symbol(c, Decl(thisTypeInFunctions.ts, 65, 3)) +>explicitProperty : Symbol(C.explicitProperty, Decl(thisTypeInFunctions.ts, 11, 5)) +>this : Symbol(this, Decl(thisTypeInFunctions.ts, 107, 30)) +>n : Symbol(n, Decl(thisTypeInFunctions.ts, 107, 37)) +>m : Symbol(m, Decl(thisTypeInFunctions.ts, 107, 48)) +>this.n : Symbol(n, Decl(thisTypeInFunctions.ts, 107, 37)) +>this : Symbol(, Decl(thisTypeInFunctions.ts, 107, 35)) +>n : Symbol(n, Decl(thisTypeInFunctions.ts, 107, 37)) +>m : Symbol(m, Decl(thisTypeInFunctions.ts, 107, 48)) + +c.explicitProperty = reconstructed.explicitProperty; +>c.explicitProperty : Symbol(C.explicitProperty, Decl(thisTypeInFunctions.ts, 11, 5)) +>c : Symbol(c, Decl(thisTypeInFunctions.ts, 65, 3)) +>explicitProperty : Symbol(C.explicitProperty, Decl(thisTypeInFunctions.ts, 11, 5)) +>reconstructed.explicitProperty : Symbol(explicitProperty, Decl(thisTypeInFunctions.ts, 77, 42)) +>reconstructed : Symbol(reconstructed, Decl(thisTypeInFunctions.ts, 74, 3)) +>explicitProperty : Symbol(explicitProperty, Decl(thisTypeInFunctions.ts, 77, 42)) + +// lambdas are assignable to anything +c.explicitC = m => m; +>c.explicitC : Symbol(C.explicitC, Decl(thisTypeInFunctions.ts, 8, 5)) +>c : Symbol(c, Decl(thisTypeInFunctions.ts, 65, 3)) +>explicitC : Symbol(C.explicitC, Decl(thisTypeInFunctions.ts, 8, 5)) +>m : Symbol(m, Decl(thisTypeInFunctions.ts, 111, 13)) +>m : Symbol(m, Decl(thisTypeInFunctions.ts, 111, 13)) + +c.explicitThis = m => m; +>c.explicitThis : Symbol(C.explicitThis, Decl(thisTypeInFunctions.ts, 5, 14)) +>c : Symbol(c, Decl(thisTypeInFunctions.ts, 65, 3)) +>explicitThis : Symbol(C.explicitThis, Decl(thisTypeInFunctions.ts, 5, 14)) +>m : Symbol(m, Decl(thisTypeInFunctions.ts, 112, 16)) +>m : Symbol(m, Decl(thisTypeInFunctions.ts, 112, 16)) + +c.explicitProperty = m => m; +>c.explicitProperty : Symbol(C.explicitProperty, Decl(thisTypeInFunctions.ts, 11, 5)) +>c : Symbol(c, Decl(thisTypeInFunctions.ts, 65, 3)) +>explicitProperty : Symbol(C.explicitProperty, Decl(thisTypeInFunctions.ts, 11, 5)) +>m : Symbol(m, Decl(thisTypeInFunctions.ts, 113, 20)) +>m : Symbol(m, Decl(thisTypeInFunctions.ts, 113, 20)) + +// this inside lambdas refer to outer scope +// the outer-scoped lambda at top-level is still just `any` +c.explicitC = m => m + this.n; +>c.explicitC : Symbol(C.explicitC, Decl(thisTypeInFunctions.ts, 8, 5)) +>c : Symbol(c, Decl(thisTypeInFunctions.ts, 65, 3)) +>explicitC : Symbol(C.explicitC, Decl(thisTypeInFunctions.ts, 8, 5)) +>m : Symbol(m, Decl(thisTypeInFunctions.ts, 117, 13)) +>m : Symbol(m, Decl(thisTypeInFunctions.ts, 117, 13)) + +c.explicitThis = m => m + this.n; +>c.explicitThis : Symbol(C.explicitThis, Decl(thisTypeInFunctions.ts, 5, 14)) +>c : Symbol(c, Decl(thisTypeInFunctions.ts, 65, 3)) +>explicitThis : Symbol(C.explicitThis, Decl(thisTypeInFunctions.ts, 5, 14)) +>m : Symbol(m, Decl(thisTypeInFunctions.ts, 118, 16)) +>m : Symbol(m, Decl(thisTypeInFunctions.ts, 118, 16)) + +c.explicitProperty = m => m + this.n; +>c.explicitProperty : Symbol(C.explicitProperty, Decl(thisTypeInFunctions.ts, 11, 5)) +>c : Symbol(c, Decl(thisTypeInFunctions.ts, 65, 3)) +>explicitProperty : Symbol(C.explicitProperty, Decl(thisTypeInFunctions.ts, 11, 5)) +>m : Symbol(m, Decl(thisTypeInFunctions.ts, 119, 20)) +>m : Symbol(m, Decl(thisTypeInFunctions.ts, 119, 20)) + +//NOTE: this=C here, I guess? +c.explicitThis = explicitCFunction; +>c.explicitThis : Symbol(C.explicitThis, Decl(thisTypeInFunctions.ts, 5, 14)) +>c : Symbol(c, Decl(thisTypeInFunctions.ts, 65, 3)) +>explicitThis : Symbol(C.explicitThis, Decl(thisTypeInFunctions.ts, 5, 14)) +>explicitCFunction : Symbol(explicitCFunction, Decl(thisTypeInFunctions.ts, 102, 3)) + +c.explicitThis = function(this: C, m: number) { return this.n + m }; +>c.explicitThis : Symbol(C.explicitThis, Decl(thisTypeInFunctions.ts, 5, 14)) +>c : Symbol(c, Decl(thisTypeInFunctions.ts, 65, 3)) +>explicitThis : Symbol(C.explicitThis, Decl(thisTypeInFunctions.ts, 5, 14)) +>this : Symbol(this, Decl(thisTypeInFunctions.ts, 123, 26)) +>C : Symbol(C, Decl(thisTypeInFunctions.ts, 3, 1)) +>m : Symbol(m, Decl(thisTypeInFunctions.ts, 123, 34)) +>this.n : Symbol(C.n, Decl(thisTypeInFunctions.ts, 4, 9)) +>this : Symbol(C, Decl(thisTypeInFunctions.ts, 3, 1)) +>n : Symbol(C.n, Decl(thisTypeInFunctions.ts, 4, 9)) +>m : Symbol(m, Decl(thisTypeInFunctions.ts, 123, 34)) + +// this:any compatibility +c.explicitC = function(m) { return this.n + m }; +>c.explicitC : Symbol(C.explicitC, Decl(thisTypeInFunctions.ts, 8, 5)) +>c : Symbol(c, Decl(thisTypeInFunctions.ts, 65, 3)) +>explicitC : Symbol(C.explicitC, Decl(thisTypeInFunctions.ts, 8, 5)) +>m : Symbol(m, Decl(thisTypeInFunctions.ts, 126, 23)) +>this.n : Symbol(C.n, Decl(thisTypeInFunctions.ts, 4, 9)) +>this : Symbol(C, Decl(thisTypeInFunctions.ts, 3, 1)) +>n : Symbol(C.n, Decl(thisTypeInFunctions.ts, 4, 9)) +>m : Symbol(m, Decl(thisTypeInFunctions.ts, 126, 23)) + +c.explicitProperty = function(m) { return this.n + m }; +>c.explicitProperty : Symbol(C.explicitProperty, Decl(thisTypeInFunctions.ts, 11, 5)) +>c : Symbol(c, Decl(thisTypeInFunctions.ts, 65, 3)) +>explicitProperty : Symbol(C.explicitProperty, Decl(thisTypeInFunctions.ts, 11, 5)) +>m : Symbol(m, Decl(thisTypeInFunctions.ts, 127, 30)) +>this.n : Symbol(n, Decl(thisTypeInFunctions.ts, 12, 28)) +>this : Symbol(, Decl(thisTypeInFunctions.ts, 12, 26)) +>n : Symbol(n, Decl(thisTypeInFunctions.ts, 12, 28)) +>m : Symbol(m, Decl(thisTypeInFunctions.ts, 127, 30)) + +c.explicitThis = function(m) { return this.n + m }; +>c.explicitThis : Symbol(C.explicitThis, Decl(thisTypeInFunctions.ts, 5, 14)) +>c : Symbol(c, Decl(thisTypeInFunctions.ts, 65, 3)) +>explicitThis : Symbol(C.explicitThis, Decl(thisTypeInFunctions.ts, 5, 14)) +>m : Symbol(m, Decl(thisTypeInFunctions.ts, 128, 26)) +>this.n : Symbol(C.n, Decl(thisTypeInFunctions.ts, 4, 9)) +>this : Symbol(C, Decl(thisTypeInFunctions.ts, 3, 1)) +>n : Symbol(C.n, Decl(thisTypeInFunctions.ts, 4, 9)) +>m : Symbol(m, Decl(thisTypeInFunctions.ts, 128, 26)) + +// this: contextual typing +c.explicitThis = function(this, m) { return this.n + m }; +>c.explicitThis : Symbol(C.explicitThis, Decl(thisTypeInFunctions.ts, 5, 14)) +>c : Symbol(c, Decl(thisTypeInFunctions.ts, 65, 3)) +>explicitThis : Symbol(C.explicitThis, Decl(thisTypeInFunctions.ts, 5, 14)) +>this : Symbol(this, Decl(thisTypeInFunctions.ts, 131, 26)) +>m : Symbol(m, Decl(thisTypeInFunctions.ts, 131, 31)) +>this.n : Symbol(C.n, Decl(thisTypeInFunctions.ts, 4, 9)) +>this : Symbol(C, Decl(thisTypeInFunctions.ts, 3, 1)) +>n : Symbol(C.n, Decl(thisTypeInFunctions.ts, 4, 9)) +>m : Symbol(m, Decl(thisTypeInFunctions.ts, 131, 31)) + +// this: superclass compatibility +c.explicitC = function(this: B, m: number) { return this.n + m }; +>c.explicitC : Symbol(C.explicitC, Decl(thisTypeInFunctions.ts, 8, 5)) +>c : Symbol(c, Decl(thisTypeInFunctions.ts, 65, 3)) +>explicitC : Symbol(C.explicitC, Decl(thisTypeInFunctions.ts, 8, 5)) +>this : Symbol(this, Decl(thisTypeInFunctions.ts, 134, 23)) +>B : Symbol(B, Decl(thisTypeInFunctions.ts, 0, 0)) +>m : Symbol(m, Decl(thisTypeInFunctions.ts, 134, 31)) +>this.n : Symbol(B.n, Decl(thisTypeInFunctions.ts, 1, 9)) +>this : Symbol(B, Decl(thisTypeInFunctions.ts, 0, 0)) +>n : Symbol(B.n, Decl(thisTypeInFunctions.ts, 1, 9)) +>m : Symbol(m, Decl(thisTypeInFunctions.ts, 134, 31)) + +// this:void compatibility +c.explicitVoid = n => n; +>c.explicitVoid : Symbol(C.explicitVoid, Decl(thisTypeInFunctions.ts, 14, 5)) +>c : Symbol(c, Decl(thisTypeInFunctions.ts, 65, 3)) +>explicitVoid : Symbol(C.explicitVoid, Decl(thisTypeInFunctions.ts, 14, 5)) +>n : Symbol(n, Decl(thisTypeInFunctions.ts, 137, 16)) +>n : Symbol(n, Decl(thisTypeInFunctions.ts, 137, 16)) + +// class-based assignability +class Base1 { +>Base1 : Symbol(Base1, Decl(thisTypeInFunctions.ts, 137, 24)) + + x: number; +>x : Symbol(Base1.x, Decl(thisTypeInFunctions.ts, 140, 13)) + + public polymorphic(this: this): number { return this.x; } +>polymorphic : Symbol(Base1.polymorphic, Decl(thisTypeInFunctions.ts, 141, 14)) +>this : Symbol(this, Decl(thisTypeInFunctions.ts, 142, 23)) +>this.x : Symbol(Base1.x, Decl(thisTypeInFunctions.ts, 140, 13)) +>this : Symbol(Base1, Decl(thisTypeInFunctions.ts, 137, 24)) +>x : Symbol(Base1.x, Decl(thisTypeInFunctions.ts, 140, 13)) + + explicit(this: Base1): number { return this.x; } +>explicit : Symbol(Base1.explicit, Decl(thisTypeInFunctions.ts, 142, 61)) +>this : Symbol(this, Decl(thisTypeInFunctions.ts, 143, 13)) +>Base1 : Symbol(Base1, Decl(thisTypeInFunctions.ts, 137, 24)) +>this.x : Symbol(Base1.x, Decl(thisTypeInFunctions.ts, 140, 13)) +>this : Symbol(Base1, Decl(thisTypeInFunctions.ts, 137, 24)) +>x : Symbol(Base1.x, Decl(thisTypeInFunctions.ts, 140, 13)) + + static explicitStatic(this: typeof Base1): number { return this.y; } +>explicitStatic : Symbol(Base1.explicitStatic, Decl(thisTypeInFunctions.ts, 143, 52)) +>this : Symbol(this, Decl(thisTypeInFunctions.ts, 144, 26)) +>Base1 : Symbol(Base1, Decl(thisTypeInFunctions.ts, 137, 24)) +>this.y : Symbol(Base1.y, Decl(thisTypeInFunctions.ts, 144, 72)) +>this : Symbol(Base1, Decl(thisTypeInFunctions.ts, 137, 24)) +>y : Symbol(Base1.y, Decl(thisTypeInFunctions.ts, 144, 72)) + + static y: number; +>y : Symbol(Base1.y, Decl(thisTypeInFunctions.ts, 144, 72)) +} +class Derived1 extends Base1 { +>Derived1 : Symbol(Derived1, Decl(thisTypeInFunctions.ts, 146, 1)) +>Base1 : Symbol(Base1, Decl(thisTypeInFunctions.ts, 137, 24)) + + y: number +>y : Symbol(Derived1.y, Decl(thisTypeInFunctions.ts, 147, 30)) +} +class Base2 { +>Base2 : Symbol(Base2, Decl(thisTypeInFunctions.ts, 149, 1)) + + y: number +>y : Symbol(Base2.y, Decl(thisTypeInFunctions.ts, 150, 13)) + + polymorphic(this: this): number { return this.y; } +>polymorphic : Symbol(Base2.polymorphic, Decl(thisTypeInFunctions.ts, 151, 13)) +>this : Symbol(this, Decl(thisTypeInFunctions.ts, 152, 16)) +>this.y : Symbol(Base2.y, Decl(thisTypeInFunctions.ts, 150, 13)) +>this : Symbol(Base2, Decl(thisTypeInFunctions.ts, 149, 1)) +>y : Symbol(Base2.y, Decl(thisTypeInFunctions.ts, 150, 13)) + + explicit(this: Base1): number { return this.x; } +>explicit : Symbol(Base2.explicit, Decl(thisTypeInFunctions.ts, 152, 54)) +>this : Symbol(this, Decl(thisTypeInFunctions.ts, 153, 13)) +>Base1 : Symbol(Base1, Decl(thisTypeInFunctions.ts, 137, 24)) +>this.x : Symbol(Base1.x, Decl(thisTypeInFunctions.ts, 140, 13)) +>this : Symbol(Base1, Decl(thisTypeInFunctions.ts, 137, 24)) +>x : Symbol(Base1.x, Decl(thisTypeInFunctions.ts, 140, 13)) +} +class Derived2 extends Base2 { +>Derived2 : Symbol(Derived2, Decl(thisTypeInFunctions.ts, 154, 1)) +>Base2 : Symbol(Base2, Decl(thisTypeInFunctions.ts, 149, 1)) + + x: number +>x : Symbol(Derived2.x, Decl(thisTypeInFunctions.ts, 155, 30)) +} +let b1 = new Base1(); +>b1 : Symbol(b1, Decl(thisTypeInFunctions.ts, 158, 3)) +>Base1 : Symbol(Base1, Decl(thisTypeInFunctions.ts, 137, 24)) + +let b2 = new Base2(); +>b2 : Symbol(b2, Decl(thisTypeInFunctions.ts, 159, 3)) +>Base2 : Symbol(Base2, Decl(thisTypeInFunctions.ts, 149, 1)) + +let d1 = new Derived1(); +>d1 : Symbol(d1, Decl(thisTypeInFunctions.ts, 160, 3)) +>Derived1 : Symbol(Derived1, Decl(thisTypeInFunctions.ts, 146, 1)) + +let d2 = new Derived2(); +>d2 : Symbol(d2, Decl(thisTypeInFunctions.ts, 161, 3)) +>Derived2 : Symbol(Derived2, Decl(thisTypeInFunctions.ts, 154, 1)) + +d2.polymorphic = d1.polymorphic // ok, 'x' and 'y' in { x, y } +>d2.polymorphic : Symbol(Base2.polymorphic, Decl(thisTypeInFunctions.ts, 151, 13)) +>d2 : Symbol(d2, Decl(thisTypeInFunctions.ts, 161, 3)) +>polymorphic : Symbol(Base2.polymorphic, Decl(thisTypeInFunctions.ts, 151, 13)) +>d1.polymorphic : Symbol(Base1.polymorphic, Decl(thisTypeInFunctions.ts, 141, 14)) +>d1 : Symbol(d1, Decl(thisTypeInFunctions.ts, 160, 3)) +>polymorphic : Symbol(Base1.polymorphic, Decl(thisTypeInFunctions.ts, 141, 14)) + +d1.polymorphic = d2.polymorphic // ok, 'x' and 'y' in { x, y } +>d1.polymorphic : Symbol(Base1.polymorphic, Decl(thisTypeInFunctions.ts, 141, 14)) +>d1 : Symbol(d1, Decl(thisTypeInFunctions.ts, 160, 3)) +>polymorphic : Symbol(Base1.polymorphic, Decl(thisTypeInFunctions.ts, 141, 14)) +>d2.polymorphic : Symbol(Base2.polymorphic, Decl(thisTypeInFunctions.ts, 151, 13)) +>d2 : Symbol(d2, Decl(thisTypeInFunctions.ts, 161, 3)) +>polymorphic : Symbol(Base2.polymorphic, Decl(thisTypeInFunctions.ts, 151, 13)) + +// bivariance-allowed cases +d1.polymorphic = b2.polymorphic // ok, 'y' in D: { x, y } +>d1.polymorphic : Symbol(Base1.polymorphic, Decl(thisTypeInFunctions.ts, 141, 14)) +>d1 : Symbol(d1, Decl(thisTypeInFunctions.ts, 160, 3)) +>polymorphic : Symbol(Base1.polymorphic, Decl(thisTypeInFunctions.ts, 141, 14)) +>b2.polymorphic : Symbol(Base2.polymorphic, Decl(thisTypeInFunctions.ts, 151, 13)) +>b2 : Symbol(b2, Decl(thisTypeInFunctions.ts, 159, 3)) +>polymorphic : Symbol(Base2.polymorphic, Decl(thisTypeInFunctions.ts, 151, 13)) + +d2.polymorphic = d1.explicit // ok, 'y' in { x, y } +>d2.polymorphic : Symbol(Base2.polymorphic, Decl(thisTypeInFunctions.ts, 151, 13)) +>d2 : Symbol(d2, Decl(thisTypeInFunctions.ts, 161, 3)) +>polymorphic : Symbol(Base2.polymorphic, Decl(thisTypeInFunctions.ts, 151, 13)) +>d1.explicit : Symbol(Base1.explicit, Decl(thisTypeInFunctions.ts, 142, 61)) +>d1 : Symbol(d1, Decl(thisTypeInFunctions.ts, 160, 3)) +>explicit : Symbol(Base1.explicit, Decl(thisTypeInFunctions.ts, 142, 61)) + +b1.polymorphic = d2.polymorphic // ok, 'x' and 'y' not in Base1: { x } +>b1.polymorphic : Symbol(Base1.polymorphic, Decl(thisTypeInFunctions.ts, 141, 14)) +>b1 : Symbol(b1, Decl(thisTypeInFunctions.ts, 158, 3)) +>polymorphic : Symbol(Base1.polymorphic, Decl(thisTypeInFunctions.ts, 141, 14)) +>d2.polymorphic : Symbol(Base2.polymorphic, Decl(thisTypeInFunctions.ts, 151, 13)) +>d2 : Symbol(d2, Decl(thisTypeInFunctions.ts, 161, 3)) +>polymorphic : Symbol(Base2.polymorphic, Decl(thisTypeInFunctions.ts, 151, 13)) + +b1.explicit = d2.polymorphic // ok, 'x' and 'y' not in Base1: { x } +>b1.explicit : Symbol(Base1.explicit, Decl(thisTypeInFunctions.ts, 142, 61)) +>b1 : Symbol(b1, Decl(thisTypeInFunctions.ts, 158, 3)) +>explicit : Symbol(Base1.explicit, Decl(thisTypeInFunctions.ts, 142, 61)) +>d2.polymorphic : Symbol(Base2.polymorphic, Decl(thisTypeInFunctions.ts, 151, 13)) +>d2 : Symbol(d2, Decl(thisTypeInFunctions.ts, 161, 3)) +>polymorphic : Symbol(Base2.polymorphic, Decl(thisTypeInFunctions.ts, 151, 13)) + +////// use this-type for construction with new //// +function InterfaceThis(this: I) { +>InterfaceThis : Symbol(InterfaceThis, Decl(thisTypeInFunctions.ts, 169, 28)) +>this : Symbol(this, Decl(thisTypeInFunctions.ts, 172, 23)) +>I : Symbol(I, Decl(thisTypeInFunctions.ts, 19, 21)) + + this.a = 12; +>this.a : Symbol(I.a, Decl(thisTypeInFunctions.ts, 20, 13)) +>this : Symbol(I, Decl(thisTypeInFunctions.ts, 19, 21)) +>a : Symbol(I.a, Decl(thisTypeInFunctions.ts, 20, 13)) +} +function LiteralTypeThis(this: {x: string}) { +>LiteralTypeThis : Symbol(LiteralTypeThis, Decl(thisTypeInFunctions.ts, 174, 1)) +>this : Symbol(this, Decl(thisTypeInFunctions.ts, 175, 25)) +>x : Symbol(x, Decl(thisTypeInFunctions.ts, 175, 32)) + + this.x = "ok"; +>this.x : Symbol(x, Decl(thisTypeInFunctions.ts, 175, 32)) +>this : Symbol(, Decl(thisTypeInFunctions.ts, 175, 30)) +>x : Symbol(x, Decl(thisTypeInFunctions.ts, 175, 32)) +} +function AnyThis(this: any) { +>AnyThis : Symbol(AnyThis, Decl(thisTypeInFunctions.ts, 177, 1)) +>this : Symbol(this, Decl(thisTypeInFunctions.ts, 178, 17)) + + this.x = "ok"; +} +let interfaceThis = new InterfaceThis(); +>interfaceThis : Symbol(interfaceThis, Decl(thisTypeInFunctions.ts, 181, 3)) +>InterfaceThis : Symbol(InterfaceThis, Decl(thisTypeInFunctions.ts, 169, 28)) + +let literalTypeThis = new LiteralTypeThis(); +>literalTypeThis : Symbol(literalTypeThis, Decl(thisTypeInFunctions.ts, 182, 3)) +>LiteralTypeThis : Symbol(LiteralTypeThis, Decl(thisTypeInFunctions.ts, 174, 1)) + +let anyThis = new AnyThis(); +>anyThis : Symbol(anyThis, Decl(thisTypeInFunctions.ts, 183, 3)) +>AnyThis : Symbol(AnyThis, Decl(thisTypeInFunctions.ts, 177, 1)) + +//// type parameter inference //// +declare var f: { +>f : Symbol(f, Decl(thisTypeInFunctions.ts, 186, 11)) + + (this: void, x: number): number, +>this : Symbol(this, Decl(thisTypeInFunctions.ts, 187, 5)) +>x : Symbol(x, Decl(thisTypeInFunctions.ts, 187, 16)) + + call(this: (...argArray: any[]) => U, ...argArray: any[]): U; +>call : Symbol(call, Decl(thisTypeInFunctions.ts, 187, 36)) +>U : Symbol(U, Decl(thisTypeInFunctions.ts, 188, 9)) +>this : Symbol(this, Decl(thisTypeInFunctions.ts, 188, 12)) +>argArray : Symbol(argArray, Decl(thisTypeInFunctions.ts, 188, 19)) +>U : Symbol(U, Decl(thisTypeInFunctions.ts, 188, 9)) +>argArray : Symbol(argArray, Decl(thisTypeInFunctions.ts, 188, 44)) +>U : Symbol(U, Decl(thisTypeInFunctions.ts, 188, 9)) + +}; +let n: number = f.call(12); +>n : Symbol(n, Decl(thisTypeInFunctions.ts, 190, 3)) +>f.call : Symbol(call, Decl(thisTypeInFunctions.ts, 187, 36)) +>f : Symbol(f, Decl(thisTypeInFunctions.ts, 186, 11)) +>call : Symbol(call, Decl(thisTypeInFunctions.ts, 187, 36)) + +function missingTypeIsImplicitAny(this, a: number) { return this.anything + a; } +>missingTypeIsImplicitAny : Symbol(missingTypeIsImplicitAny, Decl(thisTypeInFunctions.ts, 190, 27)) +>this : Symbol(this, Decl(thisTypeInFunctions.ts, 192, 34)) +>a : Symbol(a, Decl(thisTypeInFunctions.ts, 192, 39)) +>a : Symbol(a, Decl(thisTypeInFunctions.ts, 192, 39)) + diff --git a/tests/baselines/reference/thisTypeInFunctions.types b/tests/baselines/reference/thisTypeInFunctions.types new file mode 100644 index 00000000000..ddef8544a54 --- /dev/null +++ b/tests/baselines/reference/thisTypeInFunctions.types @@ -0,0 +1,963 @@ +=== tests/cases/conformance/types/thisType/thisTypeInFunctions.ts === +// body checking +class B { +>B : B + + n: number; +>n : number +} +class C { +>C : C + + n: number; +>n : number + + explicitThis(this: this, m: number): number { +>explicitThis : (this: this, m: number) => number +>this : this +>m : number + + return this.n + m; +>this.n + m : number +>this.n : number +>this : this +>n : number +>m : number + } + explicitC(this: C, m: number): number { +>explicitC : (this: C, m: number) => number +>this : C +>C : C +>m : number + + return this.n + m; +>this.n + m : number +>this.n : number +>this : C +>n : number +>m : number + } + explicitProperty(this: {n: number}, m: number): number { +>explicitProperty : (this: { n: number; }, m: number) => number +>this : { n: number; } +>n : number +>m : number + + return this.n + m; +>this.n + m : number +>this.n : number +>this : { n: number; } +>n : number +>m : number + } + explicitVoid(this: void, m: number): number { +>explicitVoid : (this: void, m: number) => number +>this : void +>m : number + + return m + 1; +>m + 1 : number +>m : number +>1 : number + } +} +class D extends C { } +>D : D +>C : C + +interface I { +>I : I + + a: number; +>a : number + + explicitVoid1(this: void): number; +>explicitVoid1 : (this: void) => number +>this : void + + explicitVoid2(this: void): number; +>explicitVoid2 : (this: void) => number +>this : void + + explicitStructural(this: {a: number}): number; +>explicitStructural : (this: { a: number; }) => number +>this : { a: number; } +>a : number + + explicitInterface(this: I): number; +>explicitInterface : (this: I) => number +>this : I +>I : I + + explicitThis(this: this): number; +>explicitThis : (this: this) => number +>this : this +} +function explicitStructural(this: { y: number }, x: number): number { +>explicitStructural : (this: { y: number; }, x: number) => number +>this : { y: number; } +>y : number +>x : number + + return x + this.y; +>x + this.y : number +>x : number +>this.y : number +>this : { y: number; } +>y : number +} +function justThis(this: { y: number }): number { +>justThis : (this: { y: number; }) => number +>this : { y: number; } +>y : number + + return this.y; +>this.y : number +>this : { y: number; } +>y : number +} +function implicitThis(n: number): number { +>implicitThis : (n: number) => number +>n : number + + return this.m + n + 12; +>this.m + n + 12 : any +>this.m + n : any +>this.m : any +>this : any +>m : any +>n : number +>12 : number +} +let impl: I = { +>impl : I +>I : I +>{ a: 12, explicitVoid2: () => this.a, // ok, this: any because it refers to some outer object (window?) explicitVoid1() { return 12; }, explicitStructural() { return this.a; }, explicitInterface() { return this.a; }, explicitThis() { return this.a; },} : { a: number; explicitVoid2: () => any; explicitVoid1(): number; explicitStructural(): number; explicitInterface(): number; explicitThis(): number; } + + a: 12, +>a : number +>12 : number + + explicitVoid2: () => this.a, // ok, this: any because it refers to some outer object (window?) +>explicitVoid2 : () => any +>() => this.a : () => any +>this.a : any +>this : any +>a : any + + explicitVoid1() { return 12; }, +>explicitVoid1 : () => number +>12 : number + + explicitStructural() { +>explicitStructural : () => number + + return this.a; +>this.a : number +>this : { a: number; } +>a : number + + }, + explicitInterface() { +>explicitInterface : () => number + + return this.a; +>this.a : number +>this : I +>a : number + + }, + explicitThis() { +>explicitThis : () => number + + return this.a; +>this.a : number +>this : I +>a : number + + }, +} +impl.explicitVoid1 = function () { return 12; }; +>impl.explicitVoid1 = function () { return 12; } : () => number +>impl.explicitVoid1 : (this: void) => number +>impl : I +>explicitVoid1 : (this: void) => number +>function () { return 12; } : () => number +>12 : number + +impl.explicitVoid2 = () => 12; +>impl.explicitVoid2 = () => 12 : () => number +>impl.explicitVoid2 : (this: void) => number +>impl : I +>explicitVoid2 : (this: void) => number +>() => 12 : () => number +>12 : number + +impl.explicitStructural = function() { return this.a; }; +>impl.explicitStructural = function() { return this.a; } : () => number +>impl.explicitStructural : (this: { a: number; }) => number +>impl : I +>explicitStructural : (this: { a: number; }) => number +>function() { return this.a; } : () => number +>this.a : number +>this : { a: number; } +>a : number + +impl.explicitInterface = function() { return this.a; }; +>impl.explicitInterface = function() { return this.a; } : () => number +>impl.explicitInterface : (this: I) => number +>impl : I +>explicitInterface : (this: I) => number +>function() { return this.a; } : () => number +>this.a : number +>this : I +>a : number + +impl.explicitStructural = () => 12; +>impl.explicitStructural = () => 12 : () => number +>impl.explicitStructural : (this: { a: number; }) => number +>impl : I +>explicitStructural : (this: { a: number; }) => number +>() => 12 : () => number +>12 : number + +impl.explicitInterface = () => 12; +>impl.explicitInterface = () => 12 : () => number +>impl.explicitInterface : (this: I) => number +>impl : I +>explicitInterface : (this: I) => number +>() => 12 : () => number +>12 : number + +impl.explicitThis = function () { return this.a; }; +>impl.explicitThis = function () { return this.a; } : () => number +>impl.explicitThis : (this: I) => number +>impl : I +>explicitThis : (this: I) => number +>function () { return this.a; } : () => number +>this.a : number +>this : I +>a : number + +// parameter checking +let ok: {y: number, f: (this: { y: number }, x: number) => number} = { y: 12, f: explicitStructural }; +>ok : { y: number; f: (this: { y: number; }, x: number) => number; } +>y : number +>f : (this: { y: number; }, x: number) => number +>this : { y: number; } +>y : number +>x : number +>{ y: 12, f: explicitStructural } : { y: number; f: (this: { y: number; }, x: number) => number; } +>y : number +>12 : number +>f : (this: { y: number; }, x: number) => number +>explicitStructural : (this: { y: number; }, x: number) => number + +let implicitAnyOk: {notSpecified: number, f: (x: number) => number} = { notSpecified: 12, f: implicitThis }; +>implicitAnyOk : { notSpecified: number; f: (x: number) => number; } +>notSpecified : number +>f : (x: number) => number +>x : number +>{ notSpecified: 12, f: implicitThis } : { notSpecified: number; f: (n: number) => number; } +>notSpecified : number +>12 : number +>f : (n: number) => number +>implicitThis : (n: number) => number + +ok.f(13); +>ok.f(13) : number +>ok.f : (this: { y: number; }, x: number) => number +>ok : { y: number; f: (this: { y: number; }, x: number) => number; } +>f : (this: { y: number; }, x: number) => number +>13 : number + +implicitThis(12); +>implicitThis(12) : number +>implicitThis : (n: number) => number +>12 : number + +implicitAnyOk.f(12); +>implicitAnyOk.f(12) : number +>implicitAnyOk.f : (x: number) => number +>implicitAnyOk : { notSpecified: number; f: (x: number) => number; } +>f : (x: number) => number +>12 : number + +let c = new C(); +>c : C +>new C() : C +>C : typeof C + +let d = new D(); +>d : D +>new D() : D +>D : typeof D + +let ripped = c.explicitC; +>ripped : (this: C, m: number) => number +>c.explicitC : (this: C, m: number) => number +>c : C +>explicitC : (this: C, m: number) => number + +c.explicitC(12); +>c.explicitC(12) : number +>c.explicitC : (this: C, m: number) => number +>c : C +>explicitC : (this: C, m: number) => number +>12 : number + +c.explicitProperty(12); +>c.explicitProperty(12) : number +>c.explicitProperty : (this: { n: number; }, m: number) => number +>c : C +>explicitProperty : (this: { n: number; }, m: number) => number +>12 : number + +c.explicitThis(12); +>c.explicitThis(12) : number +>c.explicitThis : (this: C, m: number) => number +>c : C +>explicitThis : (this: C, m: number) => number +>12 : number + +d.explicitC(12); +>d.explicitC(12) : number +>d.explicitC : (this: C, m: number) => number +>d : D +>explicitC : (this: C, m: number) => number +>12 : number + +d.explicitProperty(12); +>d.explicitProperty(12) : number +>d.explicitProperty : (this: { n: number; }, m: number) => number +>d : D +>explicitProperty : (this: { n: number; }, m: number) => number +>12 : number + +d.explicitThis(12); +>d.explicitThis(12) : number +>d.explicitThis : (this: D, m: number) => number +>d : D +>explicitThis : (this: D, m: number) => number +>12 : number + +let reconstructed: { +>reconstructed : { n: number; explicitThis(this: C, m: number): number; explicitC(this: C, m: number): number; explicitProperty: (this: { n: number; }, m: number) => number; explicitVoid(this: void, m: number): number; } + + n: number, +>n : number + + explicitThis(this: C, m: number): number, // note: this: this is not allowed in an object literal type. +>explicitThis : (this: C, m: number) => number +>this : C +>C : C +>m : number + + explicitC(this: C, m: number): number, +>explicitC : (this: C, m: number) => number +>this : C +>C : C +>m : number + + explicitProperty: (this: {n : number}, m: number) => number, +>explicitProperty : (this: { n: number; }, m: number) => number +>this : { n: number; } +>n : number +>m : number + + explicitVoid(this: void, m: number): number, +>explicitVoid : (this: void, m: number) => number +>this : void +>m : number + +} = { +>{ n: 12, explicitThis: c.explicitThis, explicitC: c.explicitC, explicitProperty: c.explicitProperty, explicitVoid: c.explicitVoid} : { n: number; explicitThis: (this: C, m: number) => number; explicitC: (this: C, m: number) => number; explicitProperty: (this: { n: number; }, m: number) => number; explicitVoid: (this: void, m: number) => number; } + + n: 12, +>n : number +>12 : number + + explicitThis: c.explicitThis, +>explicitThis : (this: C, m: number) => number +>c.explicitThis : (this: C, m: number) => number +>c : C +>explicitThis : (this: C, m: number) => number + + explicitC: c.explicitC, +>explicitC : (this: C, m: number) => number +>c.explicitC : (this: C, m: number) => number +>c : C +>explicitC : (this: C, m: number) => number + + explicitProperty: c.explicitProperty, +>explicitProperty : (this: { n: number; }, m: number) => number +>c.explicitProperty : (this: { n: number; }, m: number) => number +>c : C +>explicitProperty : (this: { n: number; }, m: number) => number + + explicitVoid: c.explicitVoid +>explicitVoid : (this: void, m: number) => number +>c.explicitVoid : (this: void, m: number) => number +>c : C +>explicitVoid : (this: void, m: number) => number + +}; +reconstructed.explicitThis(10); +>reconstructed.explicitThis(10) : number +>reconstructed.explicitThis : (this: C, m: number) => number +>reconstructed : { n: number; explicitThis(this: C, m: number): number; explicitC(this: C, m: number): number; explicitProperty: (this: { n: number; }, m: number) => number; explicitVoid(this: void, m: number): number; } +>explicitThis : (this: C, m: number) => number +>10 : number + +reconstructed.explicitProperty(11); +>reconstructed.explicitProperty(11) : number +>reconstructed.explicitProperty : (this: { n: number; }, m: number) => number +>reconstructed : { n: number; explicitThis(this: C, m: number): number; explicitC(this: C, m: number): number; explicitProperty: (this: { n: number; }, m: number) => number; explicitVoid(this: void, m: number): number; } +>explicitProperty : (this: { n: number; }, m: number) => number +>11 : number + +let explicitVoid = reconstructed.explicitVoid; +>explicitVoid : (this: void, m: number) => number +>reconstructed.explicitVoid : (this: void, m: number) => number +>reconstructed : { n: number; explicitThis(this: C, m: number): number; explicitC(this: C, m: number): number; explicitProperty: (this: { n: number; }, m: number) => number; explicitVoid(this: void, m: number): number; } +>explicitVoid : (this: void, m: number) => number + +explicitVoid(12); +>explicitVoid(12) : number +>explicitVoid : (this: void, m: number) => number +>12 : number + +// assignment checking +let unboundToSpecified: (this: { y: number }, x: number) => number = x => x + this.y; // ok, this:any +>unboundToSpecified : (this: { y: number; }, x: number) => number +>this : { y: number; } +>y : number +>x : number +>x => x + this.y : (x: number) => any +>x : number +>x + this.y : any +>x : number +>this.y : any +>this : any +>y : any + +let specifiedToSpecified: (this: {y: number}, x: number) => number = explicitStructural; +>specifiedToSpecified : (this: { y: number; }, x: number) => number +>this : { y: number; } +>y : number +>x : number +>explicitStructural : (this: { y: number; }, x: number) => number + +let anyToSpecified: (this: { y: number }, x: number) => number = function(x: number): number { return x + 12; }; +>anyToSpecified : (this: { y: number; }, x: number) => number +>this : { y: number; } +>y : number +>x : number +>function(x: number): number { return x + 12; } : (x: number) => number +>x : number +>x + 12 : number +>x : number +>12 : number + +let unspecifiedLambda: (x: number) => number = x => x + 12; +>unspecifiedLambda : (x: number) => number +>x : number +>x => x + 12 : (x: number) => number +>x : number +>x + 12 : number +>x : number +>12 : number + +let specifiedLambda: (this: void, x: number) => number = x => x + 12; +>specifiedLambda : (this: void, x: number) => number +>this : void +>x : number +>x => x + 12 : (x: number) => number +>x : number +>x + 12 : number +>x : number +>12 : number + +let unspecifiedLambdaToSpecified: (this: {y: number}, x: number) => number = unspecifiedLambda; +>unspecifiedLambdaToSpecified : (this: { y: number; }, x: number) => number +>this : { y: number; } +>y : number +>x : number +>unspecifiedLambda : (x: number) => number + +let specifiedLambdaToSpecified: (this: {y: number}, x: number) => number = specifiedLambda; +>specifiedLambdaToSpecified : (this: { y: number; }, x: number) => number +>this : { y: number; } +>y : number +>x : number +>specifiedLambda : (this: void, x: number) => number + + +let explicitCFunction: (this: C, m: number) => number; +>explicitCFunction : (this: C, m: number) => number +>this : C +>C : C +>m : number + +let explicitPropertyFunction: (this: {n: number}, m: number) => number; +>explicitPropertyFunction : (this: { n: number; }, m: number) => number +>this : { n: number; } +>n : number +>m : number + +c.explicitC = explicitCFunction; +>c.explicitC = explicitCFunction : (this: C, m: number) => number +>c.explicitC : (this: C, m: number) => number +>c : C +>explicitC : (this: C, m: number) => number +>explicitCFunction : (this: C, m: number) => number + +c.explicitC = function(this: C, m: number) { return this.n + m }; +>c.explicitC = function(this: C, m: number) { return this.n + m } : (this: C, m: number) => number +>c.explicitC : (this: C, m: number) => number +>c : C +>explicitC : (this: C, m: number) => number +>function(this: C, m: number) { return this.n + m } : (this: C, m: number) => number +>this : C +>C : C +>m : number +>this.n + m : number +>this.n : number +>this : C +>n : number +>m : number + +c.explicitProperty = explicitPropertyFunction; +>c.explicitProperty = explicitPropertyFunction : (this: { n: number; }, m: number) => number +>c.explicitProperty : (this: { n: number; }, m: number) => number +>c : C +>explicitProperty : (this: { n: number; }, m: number) => number +>explicitPropertyFunction : (this: { n: number; }, m: number) => number + +c.explicitProperty = function(this: {n: number}, m: number) { return this.n + m }; +>c.explicitProperty = function(this: {n: number}, m: number) { return this.n + m } : (this: { n: number; }, m: number) => number +>c.explicitProperty : (this: { n: number; }, m: number) => number +>c : C +>explicitProperty : (this: { n: number; }, m: number) => number +>function(this: {n: number}, m: number) { return this.n + m } : (this: { n: number; }, m: number) => number +>this : { n: number; } +>n : number +>m : number +>this.n + m : number +>this.n : number +>this : { n: number; } +>n : number +>m : number + +c.explicitProperty = reconstructed.explicitProperty; +>c.explicitProperty = reconstructed.explicitProperty : (this: { n: number; }, m: number) => number +>c.explicitProperty : (this: { n: number; }, m: number) => number +>c : C +>explicitProperty : (this: { n: number; }, m: number) => number +>reconstructed.explicitProperty : (this: { n: number; }, m: number) => number +>reconstructed : { n: number; explicitThis(this: C, m: number): number; explicitC(this: C, m: number): number; explicitProperty: (this: { n: number; }, m: number) => number; explicitVoid(this: void, m: number): number; } +>explicitProperty : (this: { n: number; }, m: number) => number + +// lambdas are assignable to anything +c.explicitC = m => m; +>c.explicitC = m => m : (m: number) => number +>c.explicitC : (this: C, m: number) => number +>c : C +>explicitC : (this: C, m: number) => number +>m => m : (m: number) => number +>m : number +>m : number + +c.explicitThis = m => m; +>c.explicitThis = m => m : (m: number) => number +>c.explicitThis : (this: C, m: number) => number +>c : C +>explicitThis : (this: C, m: number) => number +>m => m : (m: number) => number +>m : number +>m : number + +c.explicitProperty = m => m; +>c.explicitProperty = m => m : (m: number) => number +>c.explicitProperty : (this: { n: number; }, m: number) => number +>c : C +>explicitProperty : (this: { n: number; }, m: number) => number +>m => m : (m: number) => number +>m : number +>m : number + +// this inside lambdas refer to outer scope +// the outer-scoped lambda at top-level is still just `any` +c.explicitC = m => m + this.n; +>c.explicitC = m => m + this.n : (m: number) => any +>c.explicitC : (this: C, m: number) => number +>c : C +>explicitC : (this: C, m: number) => number +>m => m + this.n : (m: number) => any +>m : number +>m + this.n : any +>m : number +>this.n : any +>this : any +>n : any + +c.explicitThis = m => m + this.n; +>c.explicitThis = m => m + this.n : (m: number) => any +>c.explicitThis : (this: C, m: number) => number +>c : C +>explicitThis : (this: C, m: number) => number +>m => m + this.n : (m: number) => any +>m : number +>m + this.n : any +>m : number +>this.n : any +>this : any +>n : any + +c.explicitProperty = m => m + this.n; +>c.explicitProperty = m => m + this.n : (m: number) => any +>c.explicitProperty : (this: { n: number; }, m: number) => number +>c : C +>explicitProperty : (this: { n: number; }, m: number) => number +>m => m + this.n : (m: number) => any +>m : number +>m + this.n : any +>m : number +>this.n : any +>this : any +>n : any + +//NOTE: this=C here, I guess? +c.explicitThis = explicitCFunction; +>c.explicitThis = explicitCFunction : (this: C, m: number) => number +>c.explicitThis : (this: C, m: number) => number +>c : C +>explicitThis : (this: C, m: number) => number +>explicitCFunction : (this: C, m: number) => number + +c.explicitThis = function(this: C, m: number) { return this.n + m }; +>c.explicitThis = function(this: C, m: number) { return this.n + m } : (this: C, m: number) => number +>c.explicitThis : (this: C, m: number) => number +>c : C +>explicitThis : (this: C, m: number) => number +>function(this: C, m: number) { return this.n + m } : (this: C, m: number) => number +>this : C +>C : C +>m : number +>this.n + m : number +>this.n : number +>this : C +>n : number +>m : number + +// this:any compatibility +c.explicitC = function(m) { return this.n + m }; +>c.explicitC = function(m) { return this.n + m } : (m: number) => number +>c.explicitC : (this: C, m: number) => number +>c : C +>explicitC : (this: C, m: number) => number +>function(m) { return this.n + m } : (m: number) => number +>m : number +>this.n + m : number +>this.n : number +>this : C +>n : number +>m : number + +c.explicitProperty = function(m) { return this.n + m }; +>c.explicitProperty = function(m) { return this.n + m } : (m: number) => number +>c.explicitProperty : (this: { n: number; }, m: number) => number +>c : C +>explicitProperty : (this: { n: number; }, m: number) => number +>function(m) { return this.n + m } : (m: number) => number +>m : number +>this.n + m : number +>this.n : number +>this : { n: number; } +>n : number +>m : number + +c.explicitThis = function(m) { return this.n + m }; +>c.explicitThis = function(m) { return this.n + m } : (m: number) => number +>c.explicitThis : (this: C, m: number) => number +>c : C +>explicitThis : (this: C, m: number) => number +>function(m) { return this.n + m } : (m: number) => number +>m : number +>this.n + m : number +>this.n : number +>this : C +>n : number +>m : number + +// this: contextual typing +c.explicitThis = function(this, m) { return this.n + m }; +>c.explicitThis = function(this, m) { return this.n + m } : (this: any, m: number) => number +>c.explicitThis : (this: C, m: number) => number +>c : C +>explicitThis : (this: C, m: number) => number +>function(this, m) { return this.n + m } : (this: any, m: number) => number +>this : C +>m : number +>this.n + m : number +>this.n : number +>this : C +>n : number +>m : number + +// this: superclass compatibility +c.explicitC = function(this: B, m: number) { return this.n + m }; +>c.explicitC = function(this: B, m: number) { return this.n + m } : (this: B, m: number) => number +>c.explicitC : (this: C, m: number) => number +>c : C +>explicitC : (this: C, m: number) => number +>function(this: B, m: number) { return this.n + m } : (this: B, m: number) => number +>this : B +>B : B +>m : number +>this.n + m : number +>this.n : number +>this : B +>n : number +>m : number + +// this:void compatibility +c.explicitVoid = n => n; +>c.explicitVoid = n => n : (n: number) => number +>c.explicitVoid : (this: void, m: number) => number +>c : C +>explicitVoid : (this: void, m: number) => number +>n => n : (n: number) => number +>n : number +>n : number + +// class-based assignability +class Base1 { +>Base1 : Base1 + + x: number; +>x : number + + public polymorphic(this: this): number { return this.x; } +>polymorphic : (this: this) => number +>this : this +>this.x : number +>this : this +>x : number + + explicit(this: Base1): number { return this.x; } +>explicit : (this: Base1) => number +>this : Base1 +>Base1 : Base1 +>this.x : number +>this : Base1 +>x : number + + static explicitStatic(this: typeof Base1): number { return this.y; } +>explicitStatic : (this: typeof Base1) => number +>this : typeof Base1 +>Base1 : typeof Base1 +>this.y : number +>this : typeof Base1 +>y : number + + static y: number; +>y : number +} +class Derived1 extends Base1 { +>Derived1 : Derived1 +>Base1 : Base1 + + y: number +>y : number +} +class Base2 { +>Base2 : Base2 + + y: number +>y : number + + polymorphic(this: this): number { return this.y; } +>polymorphic : (this: this) => number +>this : this +>this.y : number +>this : this +>y : number + + explicit(this: Base1): number { return this.x; } +>explicit : (this: Base1) => number +>this : Base1 +>Base1 : Base1 +>this.x : number +>this : Base1 +>x : number +} +class Derived2 extends Base2 { +>Derived2 : Derived2 +>Base2 : Base2 + + x: number +>x : number +} +let b1 = new Base1(); +>b1 : Base1 +>new Base1() : Base1 +>Base1 : typeof Base1 + +let b2 = new Base2(); +>b2 : Base2 +>new Base2() : Base2 +>Base2 : typeof Base2 + +let d1 = new Derived1(); +>d1 : Derived1 +>new Derived1() : Derived1 +>Derived1 : typeof Derived1 + +let d2 = new Derived2(); +>d2 : Derived2 +>new Derived2() : Derived2 +>Derived2 : typeof Derived2 + +d2.polymorphic = d1.polymorphic // ok, 'x' and 'y' in { x, y } +>d2.polymorphic = d1.polymorphic : (this: Derived1) => number +>d2.polymorphic : (this: Derived2) => number +>d2 : Derived2 +>polymorphic : (this: Derived2) => number +>d1.polymorphic : (this: Derived1) => number +>d1 : Derived1 +>polymorphic : (this: Derived1) => number + +d1.polymorphic = d2.polymorphic // ok, 'x' and 'y' in { x, y } +>d1.polymorphic = d2.polymorphic : (this: Derived2) => number +>d1.polymorphic : (this: Derived1) => number +>d1 : Derived1 +>polymorphic : (this: Derived1) => number +>d2.polymorphic : (this: Derived2) => number +>d2 : Derived2 +>polymorphic : (this: Derived2) => number + +// bivariance-allowed cases +d1.polymorphic = b2.polymorphic // ok, 'y' in D: { x, y } +>d1.polymorphic = b2.polymorphic : (this: Base2) => number +>d1.polymorphic : (this: Derived1) => number +>d1 : Derived1 +>polymorphic : (this: Derived1) => number +>b2.polymorphic : (this: Base2) => number +>b2 : Base2 +>polymorphic : (this: Base2) => number + +d2.polymorphic = d1.explicit // ok, 'y' in { x, y } +>d2.polymorphic = d1.explicit : (this: Base1) => number +>d2.polymorphic : (this: Derived2) => number +>d2 : Derived2 +>polymorphic : (this: Derived2) => number +>d1.explicit : (this: Base1) => number +>d1 : Derived1 +>explicit : (this: Base1) => number + +b1.polymorphic = d2.polymorphic // ok, 'x' and 'y' not in Base1: { x } +>b1.polymorphic = d2.polymorphic : (this: Derived2) => number +>b1.polymorphic : (this: Base1) => number +>b1 : Base1 +>polymorphic : (this: Base1) => number +>d2.polymorphic : (this: Derived2) => number +>d2 : Derived2 +>polymorphic : (this: Derived2) => number + +b1.explicit = d2.polymorphic // ok, 'x' and 'y' not in Base1: { x } +>b1.explicit = d2.polymorphic : (this: Derived2) => number +>b1.explicit : (this: Base1) => number +>b1 : Base1 +>explicit : (this: Base1) => number +>d2.polymorphic : (this: Derived2) => number +>d2 : Derived2 +>polymorphic : (this: Derived2) => number + +////// use this-type for construction with new //// +function InterfaceThis(this: I) { +>InterfaceThis : (this: I) => void +>this : I +>I : I + + this.a = 12; +>this.a = 12 : number +>this.a : number +>this : I +>a : number +>12 : number +} +function LiteralTypeThis(this: {x: string}) { +>LiteralTypeThis : (this: { x: string; }) => void +>this : { x: string; } +>x : string + + this.x = "ok"; +>this.x = "ok" : string +>this.x : string +>this : { x: string; } +>x : string +>"ok" : string +} +function AnyThis(this: any) { +>AnyThis : (this: any) => void +>this : any + + this.x = "ok"; +>this.x = "ok" : string +>this.x : any +>this : any +>x : any +>"ok" : string +} +let interfaceThis = new InterfaceThis(); +>interfaceThis : any +>new InterfaceThis() : any +>InterfaceThis : (this: I) => void + +let literalTypeThis = new LiteralTypeThis(); +>literalTypeThis : any +>new LiteralTypeThis() : any +>LiteralTypeThis : (this: { x: string; }) => void + +let anyThis = new AnyThis(); +>anyThis : any +>new AnyThis() : any +>AnyThis : (this: any) => void + +//// type parameter inference //// +declare var f: { +>f : { (this: void, x: number): number; call(this: (...argArray: any[]) => U, ...argArray: any[]): U; } + + (this: void, x: number): number, +>this : void +>x : number + + call(this: (...argArray: any[]) => U, ...argArray: any[]): U; +>call : (this: (...argArray: any[]) => U, ...argArray: any[]) => U +>U : U +>this : (...argArray: any[]) => U +>argArray : any[] +>U : U +>argArray : any[] +>U : U + +}; +let n: number = f.call(12); +>n : number +>f.call(12) : number +>f.call : (this: (...argArray: any[]) => U, ...argArray: any[]) => U +>f : { (this: void, x: number): number; call(this: (...argArray: any[]) => U, ...argArray: any[]): U; } +>call : (this: (...argArray: any[]) => U, ...argArray: any[]) => U +>12 : number + +function missingTypeIsImplicitAny(this, a: number) { return this.anything + a; } +>missingTypeIsImplicitAny : (this: any, a: number) => any +>this : any +>a : number +>this.anything + a : any +>this.anything : any +>this : any +>anything : any +>a : number + diff --git a/tests/baselines/reference/thisTypeInFunctionsNegative.errors.txt b/tests/baselines/reference/thisTypeInFunctionsNegative.errors.txt new file mode 100644 index 00000000000..017550dcecd --- /dev/null +++ b/tests/baselines/reference/thisTypeInFunctionsNegative.errors.txt @@ -0,0 +1,447 @@ +tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(16,15): error TS2339: Property 'n' does not exist on type 'void'. +tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(39,21): error TS2339: Property 'a' does not exist on type 'void'. +tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(49,1): error TS2684: The 'this' context of type 'void' is not assignable to method's 'this' of type '{ a: number; }'. +tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(51,1): error TS2684: The 'this' context of type 'void' is not assignable to method's 'this' of type 'I'. +tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(56,21): error TS2339: Property 'notFound' does not exist on type '{ y: number; }'. +tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(59,21): error TS2339: Property 'notSpecified' does not exist on type 'void'. +tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(61,79): error TS2322: Type '{ y: number; explicitStructural: (this: { y: number; }, x: number) => number; }' is not assignable to type '{ y: number; f: (this: { y: number; }, x: number) => number; }'. + Object literal may only specify known properties, and 'explicitStructural' does not exist in type '{ y: number; f: (this: { y: number; }, x: number) => number; }'. +tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(62,97): error TS2322: Type '{ y: string; explicitStructural: (this: { y: number; }, x: number) => number; }' is not assignable to type '{ y: string; f: (this: { y: number; }, x: number) => number; }'. + Object literal may only specify known properties, and 'explicitStructural' does not exist in type '{ y: string; f: (this: { y: number; }, x: number) => number; }'. +tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(63,110): error TS2322: Type '{ wrongName: number; explicitStructural: (this: { y: number; }, x: number) => number; }' is not assignable to type '{ wrongName: number; f: (this: { y: number; }, x: number) => number; }'. + Object literal may only specify known properties, and 'explicitStructural' does not exist in type '{ wrongName: number; f: (this: { y: number; }, x: number) => number; }'. +tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(65,1): error TS2346: Supplied parameters do not match any signature of call target. +tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(66,6): error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. +tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(67,1): error TS2346: Supplied parameters do not match any signature of call target. +tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(68,1): error TS2684: The 'this' context of type '{ y: string; f: (this: { y: number; }, x: number) => number; }' is not assignable to method's 'this' of type '{ y: number; }'. + Types of property 'y' are incompatible. + Type 'string' is not assignable to type 'number'. +tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(69,1): error TS2684: The 'this' context of type '{ wrongName: number; f: (this: { y: number; }, x: number) => number; }' is not assignable to method's 'this' of type '{ y: number; }'. + Property 'y' is missing in type '{ wrongName: number; f: (this: { y: number; }, x: number) => number; }'. +tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(72,1): error TS2346: Supplied parameters do not match any signature of call target. +tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(73,13): error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. +tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(74,1): error TS2346: Supplied parameters do not match any signature of call target. +tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(75,1): error TS2346: Supplied parameters do not match any signature of call target. +tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(76,16): error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. +tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(77,1): error TS2346: Supplied parameters do not match any signature of call target. +tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(78,1): error TS2346: Supplied parameters do not match any signature of call target. +tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(79,16): error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. +tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(80,1): error TS2346: Supplied parameters do not match any signature of call target. +tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(81,1): error TS2346: Supplied parameters do not match any signature of call target. +tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(82,20): error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. +tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(83,1): error TS2346: Supplied parameters do not match any signature of call target. +tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(86,5): error TS2322: Type '(this: { y: number; }, x: number) => number' is not assignable to type '(this: void, x: number) => number'. + The 'this' types of each signature are incompatible. + Type 'void' is not assignable to type '{ y: number; }'. +tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(107,1): error TS2322: Type '(this: D, m: number) => number' is not assignable to type '(this: C, m: number) => number'. + The 'this' types of each signature are incompatible. + Type 'C' is not assignable to type 'D'. + Property 'x' is missing in type 'C'. +tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(108,1): error TS2322: Type '(this: { x: number; }, m: number) => number' is not assignable to type '(this: { n: number; }, m: number) => number'. + The 'this' types of each signature are incompatible. + Type '{ n: number; }' is not assignable to type '{ x: number; }'. + Property 'x' is missing in type '{ n: number; }'. +tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(110,1): error TS2322: Type '(this: D, m: number) => number' is not assignable to type '(this: C, m: number) => number'. + The 'this' types of each signature are incompatible. + Type 'C' is not assignable to type 'D'. +tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(111,1): error TS2322: Type '(this: D, m: number) => number' is not assignable to type '(this: C, m: number) => number'. + The 'this' types of each signature are incompatible. + Type 'C' is not assignable to type 'D'. +tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(112,1): error TS2322: Type '(this: D, m: number) => number' is not assignable to type '(this: C, m: number) => number'. + The 'this' types of each signature are incompatible. + Type 'C' is not assignable to type 'D'. +tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(113,1): error TS2322: Type '(this: D, m: number) => number' is not assignable to type '(this: C, m: number) => number'. + The 'this' types of each signature are incompatible. + Type 'C' is not assignable to type 'D'. +tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(114,1): error TS2322: Type '(this: D, m: number) => number' is not assignable to type '(this: { n: number; }, m: number) => number'. + The 'this' types of each signature are incompatible. + Type '{ n: number; }' is not assignable to type 'D'. + Property 'x' is missing in type '{ n: number; }'. +tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(115,1): error TS2322: Type '(this: D, m: number) => number' is not assignable to type '(this: C, m: number) => number'. +tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(116,1): error TS2322: Type '(this: D, m: number) => number' is not assignable to type '(this: void, m: number) => number'. + The 'this' types of each signature are incompatible. + Type 'void' is not assignable to type 'D'. +tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(117,1): error TS2322: Type '(this: D, m: number) => number' is not assignable to type '(this: void, m: number) => number'. + The 'this' types of each signature are incompatible. + Type 'void' is not assignable to type 'D'. +tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(125,69): error TS2339: Property 'x' does not exist on type 'typeof Base1'. +tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(145,1): error TS2322: Type '(this: Base2) => number' is not assignable to type '(this: Base1) => number'. + The 'this' types of each signature are incompatible. + Type 'Base1' is not assignable to type 'Base2'. + Property 'y' is missing in type 'Base1'. +tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(146,1): error TS2322: Type '(this: Base2) => number' is not assignable to type '(this: Base1) => number'. + The 'this' types of each signature are incompatible. + Type 'Base1' is not assignable to type 'Base2'. +tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(148,1): error TS2322: Type '(this: Base2) => number' is not assignable to type '(this: Base1) => number'. +tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(154,16): error TS2679: A function that is called with the 'new' keyword cannot have a 'this' type that is 'void'. +tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(158,17): error TS2681: A constructor cannot have a 'this' parameter. +tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(160,11): error TS2682: A setter cannot have a 'this' parameter. +tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(164,9): error TS2681: A constructor cannot have a 'this' parameter. +tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(166,31): error TS2681: A constructor cannot have a 'this' parameter. +tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(167,30): error TS2680: A 'this' parameter must be the first parameter. +tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(170,26): error TS1003: Identifier expected. +tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(170,30): error TS1005: ',' expected. +tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(171,20): error TS2370: A rest parameter must be of an array type. +tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(171,23): error TS1003: Identifier expected. +tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(171,27): error TS1005: ',' expected. +tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(172,23): error TS1005: ',' expected. +tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(172,24): error TS1138: Parameter declaration expected. +tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(173,28): error TS1003: Identifier expected. +tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(173,32): error TS1005: ',' expected. +tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(174,30): error TS1005: ',' expected. +tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(174,32): error TS1138: Parameter declaration expected. +tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(174,39): error TS1005: ';' expected. +tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(174,40): error TS1128: Declaration or statement expected. +tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(174,42): error TS2304: Cannot find name 'number'. +tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(174,49): error TS1005: ';' expected. +tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(177,1): error TS7027: Unreachable code detected. +tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(177,29): error TS2304: Cannot find name 'm'. +tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(177,32): error TS1005: ';' expected. +tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(177,35): error TS2304: Cannot find name 'm'. + + +==== tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts (66 errors) ==== + class C { + n: number; + explicitThis(this: this, m: number): number { + return this.n + m; + } + implicitThis(m: number): number { + return this.n + m; + } + explicitC(this: C, m: number): number { + return this.n + m; + } + explicitProperty(this: {n: number}, m: number): number { + return this.n + m; + } + explicitVoid(this: void, m: number): number { + return this.n + m; // 'n' doesn't exist on type 'void'. + ~ +!!! error TS2339: Property 'n' does not exist on type 'void'. + } + } + class D { + x: number; + explicitThis(this: this, m: number): number { + return this.x + m; + } + explicitD(this: D, m: number): number { + return this.x + m; + } + } + interface I { + a: number; + explicitVoid1(this: void): number; + explicitVoid2(this: void): number; + explicitStructural(this: {a: number}): number; + explicitInterface(this: I): number; + explicitThis(this: this): number; // TODO: Allow `this` types for interfaces + } + let impl: I = { + a: 12, + explicitVoid1() { + return this.a; // error, no 'a' in 'void' + ~ +!!! error TS2339: Property 'a' does not exist on type 'void'. + }, + explicitVoid2: () => this.a, // ok, `this:any` because it refers to an outer object + explicitStructural: () => 12, + explicitInterface: () => 12, + explicitThis() { + return this.a; + }, + } + let implExplicitStructural = impl.explicitStructural; + implExplicitStructural(); // error, no 'a' in 'void' + ~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2684: The 'this' context of type 'void' is not assignable to method's 'this' of type '{ a: number; }'. + let implExplicitInterface = impl.explicitInterface; + implExplicitInterface(); // error, no 'a' in 'void' + ~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2684: The 'this' context of type 'void' is not assignable to method's 'this' of type 'I'. + function explicitStructural(this: { y: number }, x: number): number { + return x + this.y; + } + function propertyName(this: { y: number }, x: number): number { + return x + this.notFound; + ~~~~~~~~ +!!! error TS2339: Property 'notFound' does not exist on type '{ y: number; }'. + } + function voidThisSpecified(this: void, x: number): number { + return x + this.notSpecified; + ~~~~~~~~~~~~ +!!! error TS2339: Property 'notSpecified' does not exist on type 'void'. + } + let ok: {y: number, f: (this: { y: number }, x: number) => number} = { y: 12, explicitStructural }; + ~~~~~~~~~~~~~~~~~~ +!!! error TS2322: Type '{ y: number; explicitStructural: (this: { y: number; }, x: number) => number; }' is not assignable to type '{ y: number; f: (this: { y: number; }, x: number) => number; }'. +!!! error TS2322: Object literal may only specify known properties, and 'explicitStructural' does not exist in type '{ y: number; f: (this: { y: number; }, x: number) => number; }'. + let wrongPropertyType: {y: string, f: (this: { y: number }, x: number) => number} = { y: 'foo', explicitStructural }; + ~~~~~~~~~~~~~~~~~~ +!!! error TS2322: Type '{ y: string; explicitStructural: (this: { y: number; }, x: number) => number; }' is not assignable to type '{ y: string; f: (this: { y: number; }, x: number) => number; }'. +!!! error TS2322: Object literal may only specify known properties, and 'explicitStructural' does not exist in type '{ y: string; f: (this: { y: number; }, x: number) => number; }'. + let wrongPropertyName: {wrongName: number, f: (this: { y: number }, x: number) => number} = { wrongName: 12, explicitStructural }; + ~~~~~~~~~~~~~~~~~~ +!!! error TS2322: Type '{ wrongName: number; explicitStructural: (this: { y: number; }, x: number) => number; }' is not assignable to type '{ wrongName: number; f: (this: { y: number; }, x: number) => number; }'. +!!! error TS2322: Object literal may only specify known properties, and 'explicitStructural' does not exist in type '{ wrongName: number; f: (this: { y: number; }, x: number) => number; }'. + + ok.f(); // not enough arguments + ~~~~~~ +!!! error TS2346: Supplied parameters do not match any signature of call target. + ok.f('wrong type'); + ~~~~~~~~~~~~ +!!! error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. + ok.f(13, 'too many arguments'); + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2346: Supplied parameters do not match any signature of call target. + wrongPropertyType.f(13); + ~~~~~~~~~~~~~~~~~ +!!! error TS2684: The 'this' context of type '{ y: string; f: (this: { y: number; }, x: number) => number; }' is not assignable to method's 'this' of type '{ y: number; }'. +!!! error TS2684: Types of property 'y' are incompatible. +!!! error TS2684: Type 'string' is not assignable to type 'number'. + wrongPropertyName.f(13); + ~~~~~~~~~~~~~~~~~ +!!! error TS2684: The 'this' context of type '{ wrongName: number; f: (this: { y: number; }, x: number) => number; }' is not assignable to method's 'this' of type '{ y: number; }'. +!!! error TS2684: Property 'y' is missing in type '{ wrongName: number; f: (this: { y: number; }, x: number) => number; }'. + + let c = new C(); + c.explicitC(); // not enough arguments + ~~~~~~~~~~~~~ +!!! error TS2346: Supplied parameters do not match any signature of call target. + c.explicitC('wrong type'); + ~~~~~~~~~~~~ +!!! error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. + c.explicitC(13, 'too many arguments'); + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2346: Supplied parameters do not match any signature of call target. + c.explicitThis(); // not enough arguments + ~~~~~~~~~~~~~~~~ +!!! error TS2346: Supplied parameters do not match any signature of call target. + c.explicitThis('wrong type 2'); + ~~~~~~~~~~~~~~ +!!! error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. + c.explicitThis(14, 'too many arguments 2'); + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2346: Supplied parameters do not match any signature of call target. + c.implicitThis(); // not enough arguments + ~~~~~~~~~~~~~~~~ +!!! error TS2346: Supplied parameters do not match any signature of call target. + c.implicitThis('wrong type 2'); + ~~~~~~~~~~~~~~ +!!! error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. + c.implicitThis(14, 'too many arguments 2'); + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2346: Supplied parameters do not match any signature of call target. + c.explicitProperty(); // not enough arguments + ~~~~~~~~~~~~~~~~~~~~ +!!! error TS2346: Supplied parameters do not match any signature of call target. + c.explicitProperty('wrong type 3'); + ~~~~~~~~~~~~~~ +!!! error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. + c.explicitProperty(15, 'too many arguments 3'); + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2346: Supplied parameters do not match any signature of call target. + + // oops, this triggers contextual typing, which needs to be updated to understand that =>'s `this` is void. + let specifiedToVoid: (this: void, x: number) => number = explicitStructural; + ~~~~~~~~~~~~~~~ +!!! error TS2322: Type '(this: { y: number; }, x: number) => number' is not assignable to type '(this: void, x: number) => number'. +!!! error TS2322: The 'this' types of each signature are incompatible. +!!! error TS2322: Type 'void' is not assignable to type '{ y: number; }'. + + let reconstructed: { + n: number, + explicitThis(this: C, m: number): number, // note: this: this is not allowed in an object literal type. + explicitC(this: C, m: number): number, + explicitProperty: (this: {n : number}, m: number) => number, + explicitVoid(this: void, m: number): number, + } = { + n: 12, + explicitThis: c.explicitThis, + explicitC: c.explicitC, + explicitProperty: c.explicitProperty, + explicitVoid: c.explicitVoid + };; + + // lambdas have this: void for assignability purposes (and this unbound (free) for body checking) + let d = new D(); + let explicitXProperty: (this: { x: number }, m: number) => number; + + // from differing object types + c.explicitC = function(this: D, m: number) { return this.x + m }; + ~~~~~~~~~~~ +!!! error TS2322: Type '(this: D, m: number) => number' is not assignable to type '(this: C, m: number) => number'. +!!! error TS2322: The 'this' types of each signature are incompatible. +!!! error TS2322: Type 'C' is not assignable to type 'D'. +!!! error TS2322: Property 'x' is missing in type 'C'. + c.explicitProperty = explicitXProperty; + ~~~~~~~~~~~~~~~~~~ +!!! error TS2322: Type '(this: { x: number; }, m: number) => number' is not assignable to type '(this: { n: number; }, m: number) => number'. +!!! error TS2322: The 'this' types of each signature are incompatible. +!!! error TS2322: Type '{ n: number; }' is not assignable to type '{ x: number; }'. +!!! error TS2322: Property 'x' is missing in type '{ n: number; }'. + + c.explicitC = d.explicitD; + ~~~~~~~~~~~ +!!! error TS2322: Type '(this: D, m: number) => number' is not assignable to type '(this: C, m: number) => number'. +!!! error TS2322: The 'this' types of each signature are incompatible. +!!! error TS2322: Type 'C' is not assignable to type 'D'. + c.explicitC = d.explicitThis; + ~~~~~~~~~~~ +!!! error TS2322: Type '(this: D, m: number) => number' is not assignable to type '(this: C, m: number) => number'. +!!! error TS2322: The 'this' types of each signature are incompatible. +!!! error TS2322: Type 'C' is not assignable to type 'D'. + c.explicitThis = d.explicitD; + ~~~~~~~~~~~~~~ +!!! error TS2322: Type '(this: D, m: number) => number' is not assignable to type '(this: C, m: number) => number'. +!!! error TS2322: The 'this' types of each signature are incompatible. +!!! error TS2322: Type 'C' is not assignable to type 'D'. + c.explicitThis = d.explicitThis; + ~~~~~~~~~~~~~~ +!!! error TS2322: Type '(this: D, m: number) => number' is not assignable to type '(this: C, m: number) => number'. +!!! error TS2322: The 'this' types of each signature are incompatible. +!!! error TS2322: Type 'C' is not assignable to type 'D'. + c.explicitProperty = d.explicitD; + ~~~~~~~~~~~~~~~~~~ +!!! error TS2322: Type '(this: D, m: number) => number' is not assignable to type '(this: { n: number; }, m: number) => number'. +!!! error TS2322: The 'this' types of each signature are incompatible. +!!! error TS2322: Type '{ n: number; }' is not assignable to type 'D'. +!!! error TS2322: Property 'x' is missing in type '{ n: number; }'. + c.explicitThis = d.explicitThis; + ~~~~~~~~~~~~~~ +!!! error TS2322: Type '(this: D, m: number) => number' is not assignable to type '(this: C, m: number) => number'. + c.explicitVoid = d.explicitD; + ~~~~~~~~~~~~~~ +!!! error TS2322: Type '(this: D, m: number) => number' is not assignable to type '(this: void, m: number) => number'. +!!! error TS2322: The 'this' types of each signature are incompatible. +!!! error TS2322: Type 'void' is not assignable to type 'D'. + c.explicitVoid = d.explicitThis; + ~~~~~~~~~~~~~~ +!!! error TS2322: Type '(this: D, m: number) => number' is not assignable to type '(this: void, m: number) => number'. +!!! error TS2322: The 'this' types of each signature are incompatible. +!!! error TS2322: Type 'void' is not assignable to type 'D'. + + /// class-based polymorphic assignability (with inheritance!) /// + + class Base1 { + x: number + public polymorphic(this: this): number { return this.x; } + explicit(this: Base1): number { return this.x; } + static explicitStatic(this: typeof Base1): number { return this.x; } + ~ +!!! error TS2339: Property 'x' does not exist on type 'typeof Base1'. + } + class Derived1 extends Base1 { + y: number + } + class Base2 { + y: number + polymorphic(this: this): number { return this.y; } + explicit(this: Base1): number { return this.x; } + } + class Derived2 extends Base2 { + x: number + } + + + let b1 = new Base1(); + let d1 = new Derived1(); + let b2 = new Base2(); + let d2 = new Derived2(); + + b1.polymorphic = b2.polymorphic // error, 'this.y' not in Base1: { x } + ~~~~~~~~~~~~~~ +!!! error TS2322: Type '(this: Base2) => number' is not assignable to type '(this: Base1) => number'. +!!! error TS2322: The 'this' types of each signature are incompatible. +!!! error TS2322: Type 'Base1' is not assignable to type 'Base2'. +!!! error TS2322: Property 'y' is missing in type 'Base1'. + b1.explicit = b2.polymorphic // error, 'y' not in Base1: { x } + ~~~~~~~~~~~ +!!! error TS2322: Type '(this: Base2) => number' is not assignable to type '(this: Base1) => number'. +!!! error TS2322: The 'this' types of each signature are incompatible. +!!! error TS2322: Type 'Base1' is not assignable to type 'Base2'. + + d1.explicit = b2.polymorphic // error, 'y' not in Base1: { x } + ~~~~~~~~~~~ +!!! error TS2322: Type '(this: Base2) => number' is not assignable to type '(this: Base1) => number'. + + ////// use this-type for construction with new //// + function VoidThis(this: void) { + + } + let voidThis = new VoidThis(); + ~~~~~~~~~~~~~~ +!!! error TS2679: A function that is called with the 'new' keyword cannot have a 'this' type that is 'void'. + + ///// syntax-ish errors ///// + class ThisConstructor { + constructor(this: ThisConstructor, private n: number) { + ~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2681: A constructor cannot have a 'this' parameter. + } + set p(this: void) { + ~~~~~~~~~~ +!!! error TS2682: A setter cannot have a 'this' parameter. + } + } + interface ThisConstructorInterface { + new(this: ThisConstructor, n: number); + ~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2681: A constructor cannot have a 'this' parameter. + } + var thisConstructorType: new (this: number) => number; + ~~~~~~~~~~~~ +!!! error TS2681: A constructor cannot have a 'this' parameter. + function notFirst(a: number, this: C): number { return this.n; } + ~~~~~~~ +!!! error TS2680: A 'this' parameter must be the first parameter. + + ///// parse errors ///// + function modifiers(async this: C): number { return this.n; } + ~~~~ +!!! error TS1003: Identifier expected. + ~ +!!! error TS1005: ',' expected. + function restParam(...this: C): number { return this.n; } + ~~~~~~~ +!!! error TS2370: A rest parameter must be of an array type. + ~~~~ +!!! error TS1003: Identifier expected. + ~ +!!! error TS1005: ',' expected. + function optional(this?: C): number { return this.n; } + ~ +!!! error TS1005: ',' expected. + ~ +!!! error TS1138: Parameter declaration expected. + function decorated(@deco() this: C): number { return this.n; } + ~~~~ +!!! error TS1003: Identifier expected. + ~ +!!! error TS1005: ',' expected. + function initializer(this: C = new C()): number { return this.n; } + ~ +!!! error TS1005: ',' expected. + ~~~ +!!! error TS1138: Parameter declaration expected. + ~ +!!! error TS1005: ';' expected. + ~ +!!! error TS1128: Declaration or statement expected. + ~~~~~~ +!!! error TS2304: Cannot find name 'number'. + ~ +!!! error TS1005: ';' expected. + + // can't name parameters 'this' in a lambda. + c.explicitProperty = (this, m) => m + this.n; + ~ +!!! error TS7027: Unreachable code detected. + ~ +!!! error TS2304: Cannot find name 'm'. + ~~ +!!! error TS1005: ';' expected. + ~ +!!! error TS2304: Cannot find name 'm'. + \ No newline at end of file diff --git a/tests/baselines/reference/thisTypeInFunctionsNegative.js b/tests/baselines/reference/thisTypeInFunctionsNegative.js new file mode 100644 index 00000000000..124a7c88013 --- /dev/null +++ b/tests/baselines/reference/thisTypeInFunctionsNegative.js @@ -0,0 +1,363 @@ +//// [thisTypeInFunctionsNegative.ts] +class C { + n: number; + explicitThis(this: this, m: number): number { + return this.n + m; + } + implicitThis(m: number): number { + return this.n + m; + } + explicitC(this: C, m: number): number { + return this.n + m; + } + explicitProperty(this: {n: number}, m: number): number { + return this.n + m; + } + explicitVoid(this: void, m: number): number { + return this.n + m; // 'n' doesn't exist on type 'void'. + } +} +class D { + x: number; + explicitThis(this: this, m: number): number { + return this.x + m; + } + explicitD(this: D, m: number): number { + return this.x + m; + } +} +interface I { + a: number; + explicitVoid1(this: void): number; + explicitVoid2(this: void): number; + explicitStructural(this: {a: number}): number; + explicitInterface(this: I): number; + explicitThis(this: this): number; // TODO: Allow `this` types for interfaces +} +let impl: I = { + a: 12, + explicitVoid1() { + return this.a; // error, no 'a' in 'void' + }, + explicitVoid2: () => this.a, // ok, `this:any` because it refers to an outer object + explicitStructural: () => 12, + explicitInterface: () => 12, + explicitThis() { + return this.a; + }, +} +let implExplicitStructural = impl.explicitStructural; +implExplicitStructural(); // error, no 'a' in 'void' +let implExplicitInterface = impl.explicitInterface; +implExplicitInterface(); // error, no 'a' in 'void' +function explicitStructural(this: { y: number }, x: number): number { + return x + this.y; +} +function propertyName(this: { y: number }, x: number): number { + return x + this.notFound; +} +function voidThisSpecified(this: void, x: number): number { + return x + this.notSpecified; +} +let ok: {y: number, f: (this: { y: number }, x: number) => number} = { y: 12, explicitStructural }; +let wrongPropertyType: {y: string, f: (this: { y: number }, x: number) => number} = { y: 'foo', explicitStructural }; +let wrongPropertyName: {wrongName: number, f: (this: { y: number }, x: number) => number} = { wrongName: 12, explicitStructural }; + +ok.f(); // not enough arguments +ok.f('wrong type'); +ok.f(13, 'too many arguments'); +wrongPropertyType.f(13); +wrongPropertyName.f(13); + +let c = new C(); +c.explicitC(); // not enough arguments +c.explicitC('wrong type'); +c.explicitC(13, 'too many arguments'); +c.explicitThis(); // not enough arguments +c.explicitThis('wrong type 2'); +c.explicitThis(14, 'too many arguments 2'); +c.implicitThis(); // not enough arguments +c.implicitThis('wrong type 2'); +c.implicitThis(14, 'too many arguments 2'); +c.explicitProperty(); // not enough arguments +c.explicitProperty('wrong type 3'); +c.explicitProperty(15, 'too many arguments 3'); + +// oops, this triggers contextual typing, which needs to be updated to understand that =>'s `this` is void. +let specifiedToVoid: (this: void, x: number) => number = explicitStructural; + +let reconstructed: { + n: number, + explicitThis(this: C, m: number): number, // note: this: this is not allowed in an object literal type. + explicitC(this: C, m: number): number, + explicitProperty: (this: {n : number}, m: number) => number, + explicitVoid(this: void, m: number): number, +} = { + n: 12, + explicitThis: c.explicitThis, + explicitC: c.explicitC, + explicitProperty: c.explicitProperty, + explicitVoid: c.explicitVoid +};; + +// lambdas have this: void for assignability purposes (and this unbound (free) for body checking) +let d = new D(); +let explicitXProperty: (this: { x: number }, m: number) => number; + +// from differing object types +c.explicitC = function(this: D, m: number) { return this.x + m }; +c.explicitProperty = explicitXProperty; + +c.explicitC = d.explicitD; +c.explicitC = d.explicitThis; +c.explicitThis = d.explicitD; +c.explicitThis = d.explicitThis; +c.explicitProperty = d.explicitD; +c.explicitThis = d.explicitThis; +c.explicitVoid = d.explicitD; +c.explicitVoid = d.explicitThis; + +/// class-based polymorphic assignability (with inheritance!) /// + +class Base1 { + x: number + public polymorphic(this: this): number { return this.x; } + explicit(this: Base1): number { return this.x; } + static explicitStatic(this: typeof Base1): number { return this.x; } +} +class Derived1 extends Base1 { + y: number +} +class Base2 { + y: number + polymorphic(this: this): number { return this.y; } + explicit(this: Base1): number { return this.x; } +} +class Derived2 extends Base2 { + x: number +} + + +let b1 = new Base1(); +let d1 = new Derived1(); +let b2 = new Base2(); +let d2 = new Derived2(); + +b1.polymorphic = b2.polymorphic // error, 'this.y' not in Base1: { x } +b1.explicit = b2.polymorphic // error, 'y' not in Base1: { x } + +d1.explicit = b2.polymorphic // error, 'y' not in Base1: { x } + +////// use this-type for construction with new //// +function VoidThis(this: void) { + +} +let voidThis = new VoidThis(); + +///// syntax-ish errors ///// +class ThisConstructor { + constructor(this: ThisConstructor, private n: number) { + } + set p(this: void) { + } +} +interface ThisConstructorInterface { + new(this: ThisConstructor, n: number); +} +var thisConstructorType: new (this: number) => number; +function notFirst(a: number, this: C): number { return this.n; } + +///// parse errors ///// +function modifiers(async this: C): number { return this.n; } +function restParam(...this: C): number { return this.n; } +function optional(this?: C): number { return this.n; } +function decorated(@deco() this: C): number { return this.n; } +function initializer(this: C = new C()): number { return this.n; } + +// can't name parameters 'this' in a lambda. +c.explicitProperty = (this, m) => m + this.n; + + +//// [thisTypeInFunctionsNegative.js] +var __extends = (this && this.__extends) || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); +}; +var _this = this; +var C = (function () { + function C() { + } + C.prototype.explicitThis = function (m) { + return this.n + m; + }; + C.prototype.implicitThis = function (m) { + return this.n + m; + }; + C.prototype.explicitC = function (m) { + return this.n + m; + }; + C.prototype.explicitProperty = function (m) { + return this.n + m; + }; + C.prototype.explicitVoid = function (m) { + return this.n + m; // 'n' doesn't exist on type 'void'. + }; + return C; +}()); +var D = (function () { + function D() { + } + D.prototype.explicitThis = function (m) { + return this.x + m; + }; + D.prototype.explicitD = function (m) { + return this.x + m; + }; + return D; +}()); +var impl = { + a: 12, + explicitVoid1: function () { + return this.a; // error, no 'a' in 'void' + }, + explicitVoid2: function () { return _this.a; }, + explicitStructural: function () { return 12; }, + explicitInterface: function () { return 12; }, + explicitThis: function () { + return this.a; + } +}; +var implExplicitStructural = impl.explicitStructural; +implExplicitStructural(); // error, no 'a' in 'void' +var implExplicitInterface = impl.explicitInterface; +implExplicitInterface(); // error, no 'a' in 'void' +function explicitStructural(x) { + return x + this.y; +} +function propertyName(x) { + return x + this.notFound; +} +function voidThisSpecified(x) { + return x + this.notSpecified; +} +var ok = { y: 12, explicitStructural: explicitStructural }; +var wrongPropertyType = { y: 'foo', explicitStructural: explicitStructural }; +var wrongPropertyName = { wrongName: 12, explicitStructural: explicitStructural }; +ok.f(); // not enough arguments +ok.f('wrong type'); +ok.f(13, 'too many arguments'); +wrongPropertyType.f(13); +wrongPropertyName.f(13); +var c = new C(); +c.explicitC(); // not enough arguments +c.explicitC('wrong type'); +c.explicitC(13, 'too many arguments'); +c.explicitThis(); // not enough arguments +c.explicitThis('wrong type 2'); +c.explicitThis(14, 'too many arguments 2'); +c.implicitThis(); // not enough arguments +c.implicitThis('wrong type 2'); +c.implicitThis(14, 'too many arguments 2'); +c.explicitProperty(); // not enough arguments +c.explicitProperty('wrong type 3'); +c.explicitProperty(15, 'too many arguments 3'); +// oops, this triggers contextual typing, which needs to be updated to understand that =>'s `this` is void. +var specifiedToVoid = explicitStructural; +var reconstructed = { + n: 12, + explicitThis: c.explicitThis, + explicitC: c.explicitC, + explicitProperty: c.explicitProperty, + explicitVoid: c.explicitVoid +}; +; +// lambdas have this: void for assignability purposes (and this unbound (free) for body checking) +var d = new D(); +var explicitXProperty; +// from differing object types +c.explicitC = function (m) { return this.x + m; }; +c.explicitProperty = explicitXProperty; +c.explicitC = d.explicitD; +c.explicitC = d.explicitThis; +c.explicitThis = d.explicitD; +c.explicitThis = d.explicitThis; +c.explicitProperty = d.explicitD; +c.explicitThis = d.explicitThis; +c.explicitVoid = d.explicitD; +c.explicitVoid = d.explicitThis; +/// class-based polymorphic assignability (with inheritance!) /// +var Base1 = (function () { + function Base1() { + } + Base1.prototype.polymorphic = function () { return this.x; }; + Base1.prototype.explicit = function () { return this.x; }; + Base1.explicitStatic = function () { return this.x; }; + return Base1; +}()); +var Derived1 = (function (_super) { + __extends(Derived1, _super); + function Derived1() { + _super.apply(this, arguments); + } + return Derived1; +}(Base1)); +var Base2 = (function () { + function Base2() { + } + Base2.prototype.polymorphic = function () { return this.y; }; + Base2.prototype.explicit = function () { return this.x; }; + return Base2; +}()); +var Derived2 = (function (_super) { + __extends(Derived2, _super); + function Derived2() { + _super.apply(this, arguments); + } + return Derived2; +}(Base2)); +var b1 = new Base1(); +var d1 = new Derived1(); +var b2 = new Base2(); +var d2 = new Derived2(); +b1.polymorphic = b2.polymorphic; // error, 'this.y' not in Base1: { x } +b1.explicit = b2.polymorphic; // error, 'y' not in Base1: { x } +d1.explicit = b2.polymorphic; // error, 'y' not in Base1: { x } +////// use this-type for construction with new //// +function VoidThis() { +} +var voidThis = new VoidThis(); +///// syntax-ish errors ///// +var ThisConstructor = (function () { + function ThisConstructor(n) { + this.n = n; + } + Object.defineProperty(ThisConstructor.prototype, "p", { + set: function () { + }, + enumerable: true, + configurable: true + }); + return ThisConstructor; +}()); +var thisConstructorType; +function notFirst(a, this) { return this.n; } +///// parse errors ///// +function modifiers(, C) { + if ( === void 0) { = this; } + return this.n; +} +function restParam(, C) { return this.n; } +function optional(C) { return this.n; } +function decorated(, C) { + if ( === void 0) { = this; } + return this.n; +} +new C(); +number; +{ + return this.n; +} +// can't name parameters 'this' in a lambda. +c.explicitProperty = (this, m); +m + this.n; diff --git a/tests/baselines/reference/thisTypeInInterfaces.symbols b/tests/baselines/reference/thisTypeInInterfaces.symbols index b5aba20e1f0..286447a7083 100644 --- a/tests/baselines/reference/thisTypeInInterfaces.symbols +++ b/tests/baselines/reference/thisTypeInInterfaces.symbols @@ -46,11 +46,11 @@ interface I3 { c: this | Date; >c : Symbol(I3.c, Decl(thisTypeInInterfaces.ts, 18, 20)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) d: this & Date; >d : Symbol(I3.d, Decl(thisTypeInInterfaces.ts, 19, 19)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) e: (((this))); >e : Symbol(I3.e, Decl(thisTypeInInterfaces.ts, 20, 19)) diff --git a/tests/baselines/reference/thisTypeInObjectLiterals.js b/tests/baselines/reference/thisTypeInObjectLiterals.js new file mode 100644 index 00000000000..5af13a41af8 --- /dev/null +++ b/tests/baselines/reference/thisTypeInObjectLiterals.js @@ -0,0 +1,56 @@ +//// [thisTypeInObjectLiterals.ts] +let o = { + d: "bar", + m() { + return this.d.length; + } +} +let mutuallyRecursive = { + a: 100, + start() { + return this.passthrough(this.a); + }, + passthrough(n: number) { + return this.sub1(n); + }, + sub1(n: number): number { + if (n > 0) { + return this.passthrough(n - 1); + } + return n; + } +} +var i: number = mutuallyRecursive.start(); +interface I { + a: number; + start(): number; + passthrough(n: number): number; + sub1(n: number): number; +} +var impl: I = mutuallyRecursive; + + +//// [thisTypeInObjectLiterals.js] +var o = { + d: "bar", + m: function () { + return this.d.length; + } +}; +var mutuallyRecursive = { + a: 100, + start: function () { + return this.passthrough(this.a); + }, + passthrough: function (n) { + return this.sub1(n); + }, + sub1: function (n) { + if (n > 0) { + return this.passthrough(n - 1); + } + return n; + } +}; +var i = mutuallyRecursive.start(); +var impl = mutuallyRecursive; diff --git a/tests/baselines/reference/thisTypeInObjectLiterals.symbols b/tests/baselines/reference/thisTypeInObjectLiterals.symbols new file mode 100644 index 00000000000..9ae4a990d5b --- /dev/null +++ b/tests/baselines/reference/thisTypeInObjectLiterals.symbols @@ -0,0 +1,92 @@ +=== tests/cases/conformance/types/thisType/thisTypeInObjectLiterals.ts === +let o = { +>o : Symbol(o, Decl(thisTypeInObjectLiterals.ts, 0, 3)) + + d: "bar", +>d : Symbol(d, Decl(thisTypeInObjectLiterals.ts, 0, 9)) + + m() { +>m : Symbol(m, Decl(thisTypeInObjectLiterals.ts, 1, 13)) + + return this.d.length; +>this.d.length : Symbol(String.length, Decl(lib.d.ts, --, --)) +>this.d : Symbol(d, Decl(thisTypeInObjectLiterals.ts, 0, 9)) +>this : Symbol(, Decl(thisTypeInObjectLiterals.ts, 0, 7)) +>d : Symbol(d, Decl(thisTypeInObjectLiterals.ts, 0, 9)) +>length : Symbol(String.length, Decl(lib.d.ts, --, --)) + } +} +let mutuallyRecursive = { +>mutuallyRecursive : Symbol(mutuallyRecursive, Decl(thisTypeInObjectLiterals.ts, 6, 3)) + + a: 100, +>a : Symbol(a, Decl(thisTypeInObjectLiterals.ts, 6, 25)) + + start() { +>start : Symbol(start, Decl(thisTypeInObjectLiterals.ts, 7, 11)) + + return this.passthrough(this.a); +>this.passthrough : Symbol(passthrough, Decl(thisTypeInObjectLiterals.ts, 10, 6)) +>this : Symbol(, Decl(thisTypeInObjectLiterals.ts, 6, 23)) +>passthrough : Symbol(passthrough, Decl(thisTypeInObjectLiterals.ts, 10, 6)) +>this.a : Symbol(a, Decl(thisTypeInObjectLiterals.ts, 6, 25)) +>this : Symbol(, Decl(thisTypeInObjectLiterals.ts, 6, 23)) +>a : Symbol(a, Decl(thisTypeInObjectLiterals.ts, 6, 25)) + + }, + passthrough(n: number) { +>passthrough : Symbol(passthrough, Decl(thisTypeInObjectLiterals.ts, 10, 6)) +>n : Symbol(n, Decl(thisTypeInObjectLiterals.ts, 11, 16)) + + return this.sub1(n); +>this.sub1 : Symbol(sub1, Decl(thisTypeInObjectLiterals.ts, 13, 6)) +>this : Symbol(, Decl(thisTypeInObjectLiterals.ts, 6, 23)) +>sub1 : Symbol(sub1, Decl(thisTypeInObjectLiterals.ts, 13, 6)) +>n : Symbol(n, Decl(thisTypeInObjectLiterals.ts, 11, 16)) + + }, + sub1(n: number): number { +>sub1 : Symbol(sub1, Decl(thisTypeInObjectLiterals.ts, 13, 6)) +>n : Symbol(n, Decl(thisTypeInObjectLiterals.ts, 14, 9)) + + if (n > 0) { +>n : Symbol(n, Decl(thisTypeInObjectLiterals.ts, 14, 9)) + + return this.passthrough(n - 1); +>this.passthrough : Symbol(passthrough, Decl(thisTypeInObjectLiterals.ts, 10, 6)) +>this : Symbol(, Decl(thisTypeInObjectLiterals.ts, 6, 23)) +>passthrough : Symbol(passthrough, Decl(thisTypeInObjectLiterals.ts, 10, 6)) +>n : Symbol(n, Decl(thisTypeInObjectLiterals.ts, 14, 9)) + } + return n; +>n : Symbol(n, Decl(thisTypeInObjectLiterals.ts, 14, 9)) + } +} +var i: number = mutuallyRecursive.start(); +>i : Symbol(i, Decl(thisTypeInObjectLiterals.ts, 21, 3)) +>mutuallyRecursive.start : Symbol(start, Decl(thisTypeInObjectLiterals.ts, 7, 11)) +>mutuallyRecursive : Symbol(mutuallyRecursive, Decl(thisTypeInObjectLiterals.ts, 6, 3)) +>start : Symbol(start, Decl(thisTypeInObjectLiterals.ts, 7, 11)) + +interface I { +>I : Symbol(I, Decl(thisTypeInObjectLiterals.ts, 21, 42)) + + a: number; +>a : Symbol(I.a, Decl(thisTypeInObjectLiterals.ts, 22, 13)) + + start(): number; +>start : Symbol(I.start, Decl(thisTypeInObjectLiterals.ts, 23, 14)) + + passthrough(n: number): number; +>passthrough : Symbol(I.passthrough, Decl(thisTypeInObjectLiterals.ts, 24, 20)) +>n : Symbol(n, Decl(thisTypeInObjectLiterals.ts, 25, 16)) + + sub1(n: number): number; +>sub1 : Symbol(I.sub1, Decl(thisTypeInObjectLiterals.ts, 25, 35)) +>n : Symbol(n, Decl(thisTypeInObjectLiterals.ts, 26, 9)) +} +var impl: I = mutuallyRecursive; +>impl : Symbol(impl, Decl(thisTypeInObjectLiterals.ts, 28, 3)) +>I : Symbol(I, Decl(thisTypeInObjectLiterals.ts, 21, 42)) +>mutuallyRecursive : Symbol(mutuallyRecursive, Decl(thisTypeInObjectLiterals.ts, 6, 3)) + diff --git a/tests/baselines/reference/thisTypeInObjectLiterals.types b/tests/baselines/reference/thisTypeInObjectLiterals.types new file mode 100644 index 00000000000..0b164209219 --- /dev/null +++ b/tests/baselines/reference/thisTypeInObjectLiterals.types @@ -0,0 +1,104 @@ +=== tests/cases/conformance/types/thisType/thisTypeInObjectLiterals.ts === +let o = { +>o : { d: string; m(): number; } +>{ d: "bar", m() { return this.d.length; }} : { d: string; m(): number; } + + d: "bar", +>d : string +>"bar" : string + + m() { +>m : () => number + + return this.d.length; +>this.d.length : number +>this.d : string +>this : { d: string; m(): number; } +>d : string +>length : number + } +} +let mutuallyRecursive = { +>mutuallyRecursive : { a: number; start(): number; passthrough(n: number): number; sub1(n: number): number; } +>{ a: 100, start() { return this.passthrough(this.a); }, passthrough(n: number) { return this.sub1(n); }, sub1(n: number): number { if (n > 0) { return this.passthrough(n - 1); } return n; }} : { a: number; start(): number; passthrough(n: number): number; sub1(n: number): number; } + + a: 100, +>a : number +>100 : number + + start() { +>start : () => number + + return this.passthrough(this.a); +>this.passthrough(this.a) : number +>this.passthrough : (n: number) => number +>this : { a: number; start(): number; passthrough(n: number): number; sub1(n: number): number; } +>passthrough : (n: number) => number +>this.a : number +>this : { a: number; start(): number; passthrough(n: number): number; sub1(n: number): number; } +>a : number + + }, + passthrough(n: number) { +>passthrough : (n: number) => number +>n : number + + return this.sub1(n); +>this.sub1(n) : number +>this.sub1 : (n: number) => number +>this : { a: number; start(): number; passthrough(n: number): number; sub1(n: number): number; } +>sub1 : (n: number) => number +>n : number + + }, + sub1(n: number): number { +>sub1 : (n: number) => number +>n : number + + if (n > 0) { +>n > 0 : boolean +>n : number +>0 : number + + return this.passthrough(n - 1); +>this.passthrough(n - 1) : number +>this.passthrough : (n: number) => number +>this : { a: number; start(): number; passthrough(n: number): number; sub1(n: number): number; } +>passthrough : (n: number) => number +>n - 1 : number +>n : number +>1 : number + } + return n; +>n : number + } +} +var i: number = mutuallyRecursive.start(); +>i : number +>mutuallyRecursive.start() : number +>mutuallyRecursive.start : () => number +>mutuallyRecursive : { a: number; start(): number; passthrough(n: number): number; sub1(n: number): number; } +>start : () => number + +interface I { +>I : I + + a: number; +>a : number + + start(): number; +>start : () => number + + passthrough(n: number): number; +>passthrough : (n: number) => number +>n : number + + sub1(n: number): number; +>sub1 : (n: number) => number +>n : number +} +var impl: I = mutuallyRecursive; +>impl : I +>I : I +>mutuallyRecursive : { a: number; start(): number; passthrough(n: number): number; sub1(n: number): number; } + diff --git a/tests/baselines/reference/throwInEnclosingStatements.symbols b/tests/baselines/reference/throwInEnclosingStatements.symbols index 63ed9dde578..858b6484e53 100644 --- a/tests/baselines/reference/throwInEnclosingStatements.symbols +++ b/tests/baselines/reference/throwInEnclosingStatements.symbols @@ -89,6 +89,7 @@ var aa = { >biz : Symbol(biz, Decl(throwInEnclosingStatements.ts, 41, 10)) throw this; +>this : Symbol(, Decl(throwInEnclosingStatements.ts, 40, 8)) } } diff --git a/tests/baselines/reference/throwInEnclosingStatements.types b/tests/baselines/reference/throwInEnclosingStatements.types index 32f0fb093bc..8add6e8b1a8 100644 --- a/tests/baselines/reference/throwInEnclosingStatements.types +++ b/tests/baselines/reference/throwInEnclosingStatements.types @@ -104,7 +104,7 @@ var aa = { >biz : () => void throw this; ->this : any +>this : { id: number; biz(): void; } } } diff --git a/tests/baselines/reference/throwStatements.symbols b/tests/baselines/reference/throwStatements.symbols index ddda19ef3dc..854fbcbe90b 100644 --- a/tests/baselines/reference/throwStatements.symbols +++ b/tests/baselines/reference/throwStatements.symbols @@ -73,7 +73,7 @@ throw aString; var aDate = new Date(12); >aDate : Symbol(aDate, Decl(throwStatements.ts, 31, 3)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) throw aDate; >aDate : Symbol(aDate, Decl(throwStatements.ts, 31, 3)) @@ -203,7 +203,7 @@ throw []; throw ['a', ['b']]; throw /[a-z]/; throw new Date(); ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) throw new C(); >C : Symbol(C, Decl(throwStatements.ts, 5, 1)) diff --git a/tests/baselines/reference/tsxExternalModuleEmit2.js b/tests/baselines/reference/tsxExternalModuleEmit2.js index 2233c5181cb..25e186e140f 100644 --- a/tests/baselines/reference/tsxExternalModuleEmit2.js +++ b/tests/baselines/reference/tsxExternalModuleEmit2.js @@ -19,8 +19,16 @@ declare var Foo, React; //// [app.js] "use strict"; +var __assign = (this && this.__assign) || Object.assign || function(t) { + for (var s, i = 1, n = arguments.length; i < n; i++) { + s = arguments[i]; + for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) + t[p] = s[p]; + } + return t; +}; var mod_1 = require('mod'); // Should see mod_1['default'] in emit here React.createElement(Foo, {handler: mod_1["default"]}); // Should see mod_1['default'] in emit here -React.createElement(Foo, React.__spread({}, mod_1["default"])); +React.createElement(Foo, __assign({}, mod_1["default"])); diff --git a/tests/baselines/reference/tsxReactEmit2.js b/tests/baselines/reference/tsxReactEmit2.js index fd7fff16976..051c7380171 100644 --- a/tests/baselines/reference/tsxReactEmit2.js +++ b/tests/baselines/reference/tsxReactEmit2.js @@ -16,9 +16,17 @@ var spreads5 =
{p2}
; //// [file.js] +var __assign = (this && this.__assign) || Object.assign || function(t) { + for (var s, i = 1, n = arguments.length; i < n; i++) { + s = arguments[i]; + for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) + t[p] = s[p]; + } + return t; +}; var p1, p2, p3; -var spreads1 = React.createElement("div", React.__spread({}, p1), p2); -var spreads2 = React.createElement("div", React.__spread({}, p1), p2); -var spreads3 = React.createElement("div", React.__spread({x: p3}, p1), p2); -var spreads4 = React.createElement("div", React.__spread({}, p1, {x: p3}), p2); -var spreads5 = React.createElement("div", React.__spread({x: p2}, p1, {y: p3}), p2); +var spreads1 = React.createElement("div", __assign({}, p1), p2); +var spreads2 = React.createElement("div", __assign({}, p1), p2); +var spreads3 = React.createElement("div", __assign({x: p3}, p1), p2); +var spreads4 = React.createElement("div", __assign({}, p1, {x: p3}), p2); +var spreads5 = React.createElement("div", __assign({x: p2}, p1, {y: p3}), p2); diff --git a/tests/baselines/reference/tsxReactEmit4.js b/tests/baselines/reference/tsxReactEmit4.js index d61cea24d2c..3b554f17cb7 100644 --- a/tests/baselines/reference/tsxReactEmit4.js +++ b/tests/baselines/reference/tsxReactEmit4.js @@ -18,7 +18,15 @@ var openClosed1 =
var spread1 =
; //// [file.js] +var __assign = (this && this.__assign) || Object.assign || function(t) { + for (var s, i = 1, n = arguments.length; i < n; i++) { + s = arguments[i]; + for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) + t[p] = s[p]; + } + return t; +}; var p; var openClosed1 = React.createElement("div", null, blah); // Should emit React.__spread({}, p, {x: 0}) -var spread1 = React.createElement("div", React.__spread({}, p, {x: 0})); +var spread1 = React.createElement("div", __assign({}, p, {x: 0})); diff --git a/tests/baselines/reference/tsxReactEmit5.js b/tests/baselines/reference/tsxReactEmit5.js index 06b05f67d63..a6dde25edc3 100644 --- a/tests/baselines/reference/tsxReactEmit5.js +++ b/tests/baselines/reference/tsxReactEmit5.js @@ -23,8 +23,16 @@ var spread1 =
; //// [file.js] //// [react-consumer.js] "use strict"; +var __assign = (this && this.__assign) || Object.assign || function(t) { + for (var s, i = 1, n = arguments.length; i < n; i++) { + s = arguments[i]; + for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) + t[p] = s[p]; + } + return t; +}; var test_1 = require("./test"); // Should emit test_1.React.createElement // and React.__spread var foo; -var spread1 = test_1.React.createElement("div", test_1.React.__spread({x: ''}, foo, {y: ''})); +var spread1 = test_1.React.createElement("div", __assign({x: ''}, foo, {y: ''})); diff --git a/tests/baselines/reference/tsxReactEmit6.js b/tests/baselines/reference/tsxReactEmit6.js index 4f583929004..cb41bf4d1eb 100644 --- a/tests/baselines/reference/tsxReactEmit6.js +++ b/tests/baselines/reference/tsxReactEmit6.js @@ -28,6 +28,14 @@ namespace M { //// [file.js] //// [react-consumer.js] +var __assign = (this && this.__assign) || Object.assign || function(t) { + for (var s, i = 1, n = arguments.length; i < n; i++) { + s = arguments[i]; + for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) + t[p] = s[p]; + } + return t; +}; var M; (function (M) { })(M || (M = {})); @@ -36,7 +44,7 @@ var M; // Should emit M.React.createElement // and M.React.__spread var foo; - var spread1 = M.React.createElement("div", M.React.__spread({x: ''}, foo, {y: ''})); + var spread1 = M.React.createElement("div", __assign({x: ''}, foo, {y: ''})); // Quotes var x = M.React.createElement("div", null, "This \"quote\" thing"); })(M || (M = {})); diff --git a/tests/baselines/reference/twoMergedInterfacesWithDifferingOverloads.symbols b/tests/baselines/reference/twoMergedInterfacesWithDifferingOverloads.symbols index 36b7775d585..b93de8e55ce 100644 --- a/tests/baselines/reference/twoMergedInterfacesWithDifferingOverloads.symbols +++ b/tests/baselines/reference/twoMergedInterfacesWithDifferingOverloads.symbols @@ -19,8 +19,8 @@ interface A { foo(x: Date): Date; >foo : Symbol(A.foo, Decl(twoMergedInterfacesWithDifferingOverloads.ts, 2, 13), Decl(twoMergedInterfacesWithDifferingOverloads.ts, 3, 27), Decl(twoMergedInterfacesWithDifferingOverloads.ts, 7, 13)) >x : Symbol(x, Decl(twoMergedInterfacesWithDifferingOverloads.ts, 8, 8)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) } interface B { @@ -45,12 +45,12 @@ interface B { >foo : Symbol(B.foo, Decl(twoMergedInterfacesWithDifferingOverloads.ts, 11, 16), Decl(twoMergedInterfacesWithDifferingOverloads.ts, 12, 22), Decl(twoMergedInterfacesWithDifferingOverloads.ts, 16, 16), Decl(twoMergedInterfacesWithDifferingOverloads.ts, 17, 20)) >x : Symbol(x, Decl(twoMergedInterfacesWithDifferingOverloads.ts, 17, 8)) >T : Symbol(T, Decl(twoMergedInterfacesWithDifferingOverloads.ts, 11, 12), Decl(twoMergedInterfacesWithDifferingOverloads.ts, 16, 12)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) foo(x: Date): string; >foo : Symbol(B.foo, Decl(twoMergedInterfacesWithDifferingOverloads.ts, 11, 16), Decl(twoMergedInterfacesWithDifferingOverloads.ts, 12, 22), Decl(twoMergedInterfacesWithDifferingOverloads.ts, 16, 16), Decl(twoMergedInterfacesWithDifferingOverloads.ts, 17, 20)) >x : Symbol(x, Decl(twoMergedInterfacesWithDifferingOverloads.ts, 18, 8)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) } var b: B; @@ -100,7 +100,7 @@ interface C { var c: C; >c : Symbol(c, Decl(twoMergedInterfacesWithDifferingOverloads.ts, 34, 3)) >C : Symbol(C, Decl(twoMergedInterfacesWithDifferingOverloads.ts, 22, 20), Decl(twoMergedInterfacesWithDifferingOverloads.ts, 28, 1)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) var r2 = c.foo(1, 2); // number >r2 : Symbol(r2, Decl(twoMergedInterfacesWithDifferingOverloads.ts, 35, 3)) @@ -150,7 +150,7 @@ interface D { var d: D; >d : Symbol(d, Decl(twoMergedInterfacesWithDifferingOverloads.ts, 48, 3)) >D : Symbol(D, Decl(twoMergedInterfacesWithDifferingOverloads.ts, 35, 21), Decl(twoMergedInterfacesWithDifferingOverloads.ts, 42, 1)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) var r3 = d.foo(1, 1); // boolean, last definition wins >r3 : Symbol(r3, Decl(twoMergedInterfacesWithDifferingOverloads.ts, 49, 3)) diff --git a/tests/baselines/reference/typeArgumentInferenceApparentType1.symbols b/tests/baselines/reference/typeArgumentInferenceApparentType1.symbols index 00de7ec64c9..4b57715d3fb 100644 --- a/tests/baselines/reference/typeArgumentInferenceApparentType1.symbols +++ b/tests/baselines/reference/typeArgumentInferenceApparentType1.symbols @@ -3,7 +3,7 @@ function method(iterable: Iterable): T { >method : Symbol(method, Decl(typeArgumentInferenceApparentType1.ts, 0, 0)) >T : Symbol(T, Decl(typeArgumentInferenceApparentType1.ts, 0, 16)) >iterable : Symbol(iterable, Decl(typeArgumentInferenceApparentType1.ts, 0, 19)) ->Iterable : Symbol(Iterable, Decl(lib.d.ts, --, --)) +>Iterable : Symbol(Iterable, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) >T : Symbol(T, Decl(typeArgumentInferenceApparentType1.ts, 0, 16)) >T : Symbol(T, Decl(typeArgumentInferenceApparentType1.ts, 0, 16)) diff --git a/tests/baselines/reference/typeArgumentInferenceApparentType2.symbols b/tests/baselines/reference/typeArgumentInferenceApparentType2.symbols index 4626aabb605..f5985b6ff48 100644 --- a/tests/baselines/reference/typeArgumentInferenceApparentType2.symbols +++ b/tests/baselines/reference/typeArgumentInferenceApparentType2.symbols @@ -3,14 +3,14 @@ function method(iterable: Iterable): T { >method : Symbol(method, Decl(typeArgumentInferenceApparentType2.ts, 0, 0)) >T : Symbol(T, Decl(typeArgumentInferenceApparentType2.ts, 0, 16)) >iterable : Symbol(iterable, Decl(typeArgumentInferenceApparentType2.ts, 0, 19)) ->Iterable : Symbol(Iterable, Decl(lib.d.ts, --, --)) +>Iterable : Symbol(Iterable, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) >T : Symbol(T, Decl(typeArgumentInferenceApparentType2.ts, 0, 16)) >T : Symbol(T, Decl(typeArgumentInferenceApparentType2.ts, 0, 16)) function inner>() { >inner : Symbol(inner, Decl(typeArgumentInferenceApparentType2.ts, 0, 46)) >U : Symbol(U, Decl(typeArgumentInferenceApparentType2.ts, 1, 19)) ->Iterable : Symbol(Iterable, Decl(lib.d.ts, --, --)) +>Iterable : Symbol(Iterable, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) >T : Symbol(T, Decl(typeArgumentInferenceApparentType2.ts, 0, 16)) var u: U; diff --git a/tests/baselines/reference/typeArgumentInferenceTransitiveConstraints.symbols b/tests/baselines/reference/typeArgumentInferenceTransitiveConstraints.symbols index 2d6270bbf5c..bc554ce9f86 100644 --- a/tests/baselines/reference/typeArgumentInferenceTransitiveConstraints.symbols +++ b/tests/baselines/reference/typeArgumentInferenceTransitiveConstraints.symbols @@ -3,7 +3,7 @@ function fn(a: A, b: B, c: C) { >fn : Symbol(fn, Decl(typeArgumentInferenceTransitiveConstraints.ts, 0, 0)) >A : Symbol(A, Decl(typeArgumentInferenceTransitiveConstraints.ts, 1, 12)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >B : Symbol(B, Decl(typeArgumentInferenceTransitiveConstraints.ts, 1, 27)) >A : Symbol(A, Decl(typeArgumentInferenceTransitiveConstraints.ts, 1, 12)) >C : Symbol(C, Decl(typeArgumentInferenceTransitiveConstraints.ts, 1, 40)) @@ -24,11 +24,11 @@ function fn(a: A, b: B, c: C) { var d = fn(new Date(), new Date(), new Date()); >d : Symbol(d, Decl(typeArgumentInferenceTransitiveConstraints.ts, 5, 3), Decl(typeArgumentInferenceTransitiveConstraints.ts, 6, 3)) >fn : Symbol(fn, Decl(typeArgumentInferenceTransitiveConstraints.ts, 0, 0)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) var d: Date[]; // Should be OK (d should be Date[]) >d : Symbol(d, Decl(typeArgumentInferenceTransitiveConstraints.ts, 5, 3), Decl(typeArgumentInferenceTransitiveConstraints.ts, 6, 3)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) diff --git a/tests/baselines/reference/typeAssertions.errors.txt b/tests/baselines/reference/typeAssertions.errors.txt index c7401e4fcf9..e330c23d737 100644 --- a/tests/baselines/reference/typeAssertions.errors.txt +++ b/tests/baselines/reference/typeAssertions.errors.txt @@ -1,11 +1,11 @@ tests/cases/conformance/expressions/typeAssertions/typeAssertions.ts(5,5): error TS2346: Supplied parameters do not match any signature of call target. -tests/cases/conformance/expressions/typeAssertions/typeAssertions.ts(31,12): error TS2352: Neither type 'SomeOther' nor type 'SomeBase' is assignable to the other. +tests/cases/conformance/expressions/typeAssertions/typeAssertions.ts(31,12): error TS2352: Type 'SomeOther' cannot be converted to type 'SomeBase'. Property 'p' is missing in type 'SomeOther'. -tests/cases/conformance/expressions/typeAssertions/typeAssertions.ts(35,15): error TS2352: Neither type 'SomeOther' nor type 'SomeDerived' is assignable to the other. +tests/cases/conformance/expressions/typeAssertions/typeAssertions.ts(35,15): error TS2352: Type 'SomeOther' cannot be converted to type 'SomeDerived'. Property 'x' is missing in type 'SomeOther'. -tests/cases/conformance/expressions/typeAssertions/typeAssertions.ts(37,13): error TS2352: Neither type 'SomeDerived' nor type 'SomeOther' is assignable to the other. +tests/cases/conformance/expressions/typeAssertions/typeAssertions.ts(37,13): error TS2352: Type 'SomeDerived' cannot be converted to type 'SomeOther'. Property 'q' is missing in type 'SomeDerived'. -tests/cases/conformance/expressions/typeAssertions/typeAssertions.ts(38,13): error TS2352: Neither type 'SomeBase' nor type 'SomeOther' is assignable to the other. +tests/cases/conformance/expressions/typeAssertions/typeAssertions.ts(38,13): error TS2352: Type 'SomeBase' cannot be converted to type 'SomeOther'. Property 'q' is missing in type 'SomeBase'. tests/cases/conformance/expressions/typeAssertions/typeAssertions.ts(44,5): error TS2304: Cannot find name 'numOrStr'. tests/cases/conformance/expressions/typeAssertions/typeAssertions.ts(44,14): error TS1005: '>' expected. @@ -58,23 +58,23 @@ tests/cases/conformance/expressions/typeAssertions/typeAssertions.ts(48,50): err someBase = someBase; someBase = someOther; // Error ~~~~~~~~~~~~~~~~~~~ -!!! error TS2352: Neither type 'SomeOther' nor type 'SomeBase' is assignable to the other. +!!! error TS2352: Type 'SomeOther' cannot be converted to type 'SomeBase'. !!! error TS2352: Property 'p' is missing in type 'SomeOther'. someDerived = someDerived; someDerived = someBase; someDerived = someOther; // Error ~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2352: Neither type 'SomeOther' nor type 'SomeDerived' is assignable to the other. +!!! error TS2352: Type 'SomeOther' cannot be converted to type 'SomeDerived'. !!! error TS2352: Property 'x' is missing in type 'SomeOther'. someOther = someDerived; // Error ~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2352: Neither type 'SomeDerived' nor type 'SomeOther' is assignable to the other. +!!! error TS2352: Type 'SomeDerived' cannot be converted to type 'SomeOther'. !!! error TS2352: Property 'q' is missing in type 'SomeDerived'. someOther = someBase; // Error ~~~~~~~~~~~~~~~~~~~ -!!! error TS2352: Neither type 'SomeBase' nor type 'SomeOther' is assignable to the other. +!!! error TS2352: Type 'SomeBase' cannot be converted to type 'SomeOther'. !!! error TS2352: Property 'q' is missing in type 'SomeBase'. someOther = someOther; diff --git a/tests/baselines/reference/typeAssertionsWithIntersectionTypes01.errors.txt b/tests/baselines/reference/typeAssertionsWithIntersectionTypes01.errors.txt new file mode 100644 index 00000000000..42ed640e8fc --- /dev/null +++ b/tests/baselines/reference/typeAssertionsWithIntersectionTypes01.errors.txt @@ -0,0 +1,34 @@ +tests/cases/conformance/types/typeRelationships/comparable/typeAssertionsWithIntersectionTypes01.ts(17,9): error TS2352: Type 'I2' cannot be converted to type 'I1 & I3'. + Type 'I2' is not comparable to type 'I3'. + Property 'p3' is missing in type 'I2'. +tests/cases/conformance/types/typeRelationships/comparable/typeAssertionsWithIntersectionTypes01.ts(18,9): error TS2352: Type 'I2' cannot be converted to type 'I3'. + + +==== tests/cases/conformance/types/typeRelationships/comparable/typeAssertionsWithIntersectionTypes01.ts (2 errors) ==== + interface I1 { + p1: number + } + + interface I2 extends I1 { + p2: number; + } + + interface I3 { + p3: number; + } + + var x = { p1: 10, p2: 20, p3: 30 }; + var y: I1 & I3 = x; + var z: I2 = x; + + var a = z; + ~~~~~~~~~~ +!!! error TS2352: Type 'I2' cannot be converted to type 'I1 & I3'. +!!! error TS2352: Type 'I2' is not comparable to type 'I3'. +!!! error TS2352: Property 'p3' is missing in type 'I2'. + var b = z; + ~~~~~ +!!! error TS2352: Type 'I2' cannot be converted to type 'I3'. + var c = z; + var d = y; + \ No newline at end of file diff --git a/tests/baselines/reference/typeAssertionsWithIntersectionTypes01.js b/tests/baselines/reference/typeAssertionsWithIntersectionTypes01.js new file mode 100644 index 00000000000..31fc831f95f --- /dev/null +++ b/tests/baselines/reference/typeAssertionsWithIntersectionTypes01.js @@ -0,0 +1,31 @@ +//// [typeAssertionsWithIntersectionTypes01.ts] +interface I1 { + p1: number +} + +interface I2 extends I1 { + p2: number; +} + +interface I3 { + p3: number; +} + +var x = { p1: 10, p2: 20, p3: 30 }; +var y: I1 & I3 = x; +var z: I2 = x; + +var a = z; +var b = z; +var c = z; +var d = y; + + +//// [typeAssertionsWithIntersectionTypes01.js] +var x = { p1: 10, p2: 20, p3: 30 }; +var y = x; +var z = x; +var a = z; +var b = z; +var c = z; +var d = y; diff --git a/tests/baselines/reference/typeAssertionsWithUnionTypes01.errors.txt b/tests/baselines/reference/typeAssertionsWithUnionTypes01.errors.txt new file mode 100644 index 00000000000..7bc2a9df9b3 --- /dev/null +++ b/tests/baselines/reference/typeAssertionsWithUnionTypes01.errors.txt @@ -0,0 +1,23 @@ +tests/cases/conformance/types/typeRelationships/comparable/typeAssertionsWithUnionTypes01.ts(14,9): error TS2352: Type 'I1' cannot be converted to type 'number'. + + +==== tests/cases/conformance/types/typeRelationships/comparable/typeAssertionsWithUnionTypes01.ts (1 errors) ==== + interface I1 { + p1: number + } + + interface I2 extends I1 { + p2: number; + } + + var x = { p1: 10, p2: 20 }; + var y: number | I2 = x; + var z: I1 = x; + + var a = z; + var b = z; + ~~~~~~~~~ +!!! error TS2352: Type 'I1' cannot be converted to type 'number'. + var c = z; + var d = y; + \ No newline at end of file diff --git a/tests/baselines/reference/typeAssertionsWithUnionTypes01.js b/tests/baselines/reference/typeAssertionsWithUnionTypes01.js new file mode 100644 index 00000000000..9cc448f6217 --- /dev/null +++ b/tests/baselines/reference/typeAssertionsWithUnionTypes01.js @@ -0,0 +1,27 @@ +//// [typeAssertionsWithUnionTypes01.ts] +interface I1 { + p1: number +} + +interface I2 extends I1 { + p2: number; +} + +var x = { p1: 10, p2: 20 }; +var y: number | I2 = x; +var z: I1 = x; + +var a = z; +var b = z; +var c = z; +var d = y; + + +//// [typeAssertionsWithUnionTypes01.js] +var x = { p1: 10, p2: 20 }; +var y = x; +var z = x; +var a = z; +var b = z; +var c = z; +var d = y; diff --git a/tests/baselines/reference/typeOfThisInMemberFunctions.symbols b/tests/baselines/reference/typeOfThisInMemberFunctions.symbols index 3641add1bd9..a98234023c5 100644 --- a/tests/baselines/reference/typeOfThisInMemberFunctions.symbols +++ b/tests/baselines/reference/typeOfThisInMemberFunctions.symbols @@ -47,7 +47,7 @@ class D { class E { >E : Symbol(E, Decl(typeOfThisInMemberFunctions.ts, 19, 1)) >T : Symbol(T, Decl(typeOfThisInMemberFunctions.ts, 21, 8)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) x: T; >x : Symbol(E.x, Decl(typeOfThisInMemberFunctions.ts, 21, 25)) diff --git a/tests/baselines/reference/typeParameterAndArgumentOfSameName1.symbols b/tests/baselines/reference/typeParameterAndArgumentOfSameName1.symbols index e38953fe8a2..cacd7f91dfe 100644 --- a/tests/baselines/reference/typeParameterAndArgumentOfSameName1.symbols +++ b/tests/baselines/reference/typeParameterAndArgumentOfSameName1.symbols @@ -2,7 +2,7 @@ function f(A: A): A { >f : Symbol(f, Decl(typeParameterAndArgumentOfSameName1.ts, 0, 0)) >A : Symbol(A, Decl(typeParameterAndArgumentOfSameName1.ts, 0, 11), Decl(typeParameterAndArgumentOfSameName1.ts, 0, 29)) ->Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >A : Symbol(A, Decl(typeParameterAndArgumentOfSameName1.ts, 0, 11), Decl(typeParameterAndArgumentOfSameName1.ts, 0, 29)) >A : Symbol(A, Decl(typeParameterAndArgumentOfSameName1.ts, 0, 11), Decl(typeParameterAndArgumentOfSameName1.ts, 0, 29)) >A : Symbol(A, Decl(typeParameterAndArgumentOfSameName1.ts, 0, 11), Decl(typeParameterAndArgumentOfSameName1.ts, 0, 29)) diff --git a/tests/baselines/reference/typeParameterUsedAsConstraint.symbols b/tests/baselines/reference/typeParameterUsedAsConstraint.symbols index 0b031742e75..2ab34915a65 100644 --- a/tests/baselines/reference/typeParameterUsedAsConstraint.symbols +++ b/tests/baselines/reference/typeParameterUsedAsConstraint.symbols @@ -14,7 +14,7 @@ class C2 { } class C3 { } >C3 : Symbol(C3, Decl(typeParameterUsedAsConstraint.ts, 1, 28)) >T : Symbol(T, Decl(typeParameterUsedAsConstraint.ts, 2, 9)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >U : Symbol(U, Decl(typeParameterUsedAsConstraint.ts, 2, 24)) >T : Symbol(T, Decl(typeParameterUsedAsConstraint.ts, 2, 9)) @@ -23,7 +23,7 @@ class C4 { } >T : Symbol(T, Decl(typeParameterUsedAsConstraint.ts, 3, 9)) >U : Symbol(U, Decl(typeParameterUsedAsConstraint.ts, 3, 21)) >U : Symbol(U, Decl(typeParameterUsedAsConstraint.ts, 3, 21)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) class C5 { } >C5 : Symbol(C5, Decl(typeParameterUsedAsConstraint.ts, 3, 41)) @@ -56,7 +56,7 @@ interface I2 { } interface I3 { } >I3 : Symbol(I3, Decl(typeParameterUsedAsConstraint.ts, 8, 32)) >T : Symbol(T, Decl(typeParameterUsedAsConstraint.ts, 9, 13)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >U : Symbol(U, Decl(typeParameterUsedAsConstraint.ts, 9, 28)) >T : Symbol(T, Decl(typeParameterUsedAsConstraint.ts, 9, 13)) @@ -65,7 +65,7 @@ interface I4 { } >T : Symbol(T, Decl(typeParameterUsedAsConstraint.ts, 10, 13)) >U : Symbol(U, Decl(typeParameterUsedAsConstraint.ts, 10, 25)) >U : Symbol(U, Decl(typeParameterUsedAsConstraint.ts, 10, 25)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) interface I5 { } >I5 : Symbol(I5, Decl(typeParameterUsedAsConstraint.ts, 10, 45)) @@ -98,7 +98,7 @@ function f2() { } function f3() { } >f3 : Symbol(f3, Decl(typeParameterUsedAsConstraint.ts, 15, 33)) >T : Symbol(T, Decl(typeParameterUsedAsConstraint.ts, 16, 12)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >U : Symbol(U, Decl(typeParameterUsedAsConstraint.ts, 16, 27)) >T : Symbol(T, Decl(typeParameterUsedAsConstraint.ts, 16, 12)) @@ -107,7 +107,7 @@ function f4() { } >T : Symbol(T, Decl(typeParameterUsedAsConstraint.ts, 17, 12)) >U : Symbol(U, Decl(typeParameterUsedAsConstraint.ts, 17, 24)) >U : Symbol(U, Decl(typeParameterUsedAsConstraint.ts, 17, 24)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) function f5() { } >f5 : Symbol(f5, Decl(typeParameterUsedAsConstraint.ts, 17, 46)) @@ -140,7 +140,7 @@ var e2 = () => { } var e3 = () => { } >e3 : Symbol(e3, Decl(typeParameterUsedAsConstraint.ts, 23, 3)) >T : Symbol(T, Decl(typeParameterUsedAsConstraint.ts, 23, 10)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >U : Symbol(U, Decl(typeParameterUsedAsConstraint.ts, 23, 25)) >T : Symbol(T, Decl(typeParameterUsedAsConstraint.ts, 23, 10)) @@ -149,7 +149,7 @@ var e4 = () => { } >T : Symbol(T, Decl(typeParameterUsedAsConstraint.ts, 24, 10)) >U : Symbol(U, Decl(typeParameterUsedAsConstraint.ts, 24, 22)) >U : Symbol(U, Decl(typeParameterUsedAsConstraint.ts, 24, 22)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) var e5 = () => { } >e5 : Symbol(e5, Decl(typeParameterUsedAsConstraint.ts, 25, 3)) @@ -182,7 +182,7 @@ var a2: { (): void } var a3: { (): void } >a3 : Symbol(a3, Decl(typeParameterUsedAsConstraint.ts, 30, 3)) >T : Symbol(T, Decl(typeParameterUsedAsConstraint.ts, 30, 11)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >U : Symbol(U, Decl(typeParameterUsedAsConstraint.ts, 30, 26)) >T : Symbol(T, Decl(typeParameterUsedAsConstraint.ts, 30, 11)) @@ -191,7 +191,7 @@ var a4: { (): void } >T : Symbol(T, Decl(typeParameterUsedAsConstraint.ts, 31, 11)) >U : Symbol(U, Decl(typeParameterUsedAsConstraint.ts, 31, 23)) >U : Symbol(U, Decl(typeParameterUsedAsConstraint.ts, 31, 23)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) var a5: { (): void } >a5 : Symbol(a5, Decl(typeParameterUsedAsConstraint.ts, 32, 3)) diff --git a/tests/baselines/reference/typeParametersAreIdenticalToThemselves.symbols b/tests/baselines/reference/typeParametersAreIdenticalToThemselves.symbols index edbfab9c8e9..39479bdba90 100644 --- a/tests/baselines/reference/typeParametersAreIdenticalToThemselves.symbols +++ b/tests/baselines/reference/typeParametersAreIdenticalToThemselves.symbols @@ -144,21 +144,21 @@ class C { foo4(x: T); >foo4 : Symbol(C.foo4, Decl(typeParametersAreIdenticalToThemselves.ts, 31, 21), Decl(typeParametersAreIdenticalToThemselves.ts, 33, 31), Decl(typeParametersAreIdenticalToThemselves.ts, 34, 31)) >T : Symbol(T, Decl(typeParametersAreIdenticalToThemselves.ts, 33, 9)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >x : Symbol(x, Decl(typeParametersAreIdenticalToThemselves.ts, 33, 25)) >T : Symbol(T, Decl(typeParametersAreIdenticalToThemselves.ts, 33, 9)) foo4(x: T); // no error, different declaration for each T >foo4 : Symbol(C.foo4, Decl(typeParametersAreIdenticalToThemselves.ts, 31, 21), Decl(typeParametersAreIdenticalToThemselves.ts, 33, 31), Decl(typeParametersAreIdenticalToThemselves.ts, 34, 31)) >T : Symbol(T, Decl(typeParametersAreIdenticalToThemselves.ts, 34, 9)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >x : Symbol(x, Decl(typeParametersAreIdenticalToThemselves.ts, 34, 25)) >T : Symbol(T, Decl(typeParametersAreIdenticalToThemselves.ts, 34, 9)) foo4(x: T) { } >foo4 : Symbol(C.foo4, Decl(typeParametersAreIdenticalToThemselves.ts, 31, 21), Decl(typeParametersAreIdenticalToThemselves.ts, 33, 31), Decl(typeParametersAreIdenticalToThemselves.ts, 34, 31)) >T : Symbol(T, Decl(typeParametersAreIdenticalToThemselves.ts, 35, 9)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >x : Symbol(x, Decl(typeParametersAreIdenticalToThemselves.ts, 35, 25)) >T : Symbol(T, Decl(typeParametersAreIdenticalToThemselves.ts, 35, 9)) } @@ -166,7 +166,7 @@ class C { class C2 { >C2 : Symbol(C2, Decl(typeParametersAreIdenticalToThemselves.ts, 36, 1)) >T : Symbol(T, Decl(typeParametersAreIdenticalToThemselves.ts, 38, 9)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) foo1(x: T); >foo1 : Symbol(C2.foo1, Decl(typeParametersAreIdenticalToThemselves.ts, 38, 26), Decl(typeParametersAreIdenticalToThemselves.ts, 39, 15), Decl(typeParametersAreIdenticalToThemselves.ts, 40, 15)) @@ -271,14 +271,14 @@ interface I { foo4(x: T); >foo4 : Symbol(I.foo4, Decl(typeParametersAreIdenticalToThemselves.ts, 60, 18), Decl(typeParametersAreIdenticalToThemselves.ts, 62, 31)) >T : Symbol(T, Decl(typeParametersAreIdenticalToThemselves.ts, 62, 9)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >x : Symbol(x, Decl(typeParametersAreIdenticalToThemselves.ts, 62, 25)) >T : Symbol(T, Decl(typeParametersAreIdenticalToThemselves.ts, 62, 9)) foo4(x: T); // no error, different declaration for each T >foo4 : Symbol(I.foo4, Decl(typeParametersAreIdenticalToThemselves.ts, 60, 18), Decl(typeParametersAreIdenticalToThemselves.ts, 62, 31)) >T : Symbol(T, Decl(typeParametersAreIdenticalToThemselves.ts, 63, 9)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >x : Symbol(x, Decl(typeParametersAreIdenticalToThemselves.ts, 63, 25)) >T : Symbol(T, Decl(typeParametersAreIdenticalToThemselves.ts, 63, 9)) } @@ -286,7 +286,7 @@ interface I { interface I2 { >I2 : Symbol(I2, Decl(typeParametersAreIdenticalToThemselves.ts, 64, 1)) >T : Symbol(T, Decl(typeParametersAreIdenticalToThemselves.ts, 66, 13)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) foo1(x: T); >foo1 : Symbol(I2.foo1, Decl(typeParametersAreIdenticalToThemselves.ts, 66, 30), Decl(typeParametersAreIdenticalToThemselves.ts, 67, 15)) diff --git a/tests/baselines/reference/typeReferenceDirectives1.js b/tests/baselines/reference/typeReferenceDirectives1.js new file mode 100644 index 00000000000..775af9c5283 --- /dev/null +++ b/tests/baselines/reference/typeReferenceDirectives1.js @@ -0,0 +1,21 @@ +//// [tests/cases/compiler/typeReferenceDirectives1.ts] //// + +//// [index.d.ts] + + +interface $ { x } + +//// [app.ts] +/// +interface A { + x: $ +} + +//// [app.js] + + +//// [app.d.ts] +/// +interface A { + x: $; +} diff --git a/tests/baselines/reference/typeReferenceDirectives1.symbols b/tests/baselines/reference/typeReferenceDirectives1.symbols new file mode 100644 index 00000000000..55c17b219ec --- /dev/null +++ b/tests/baselines/reference/typeReferenceDirectives1.symbols @@ -0,0 +1,16 @@ +=== /app.ts === +/// +interface A { +>A : Symbol(A, Decl(app.ts, 0, 0)) + + x: $ +>x : Symbol(A.x, Decl(app.ts, 1, 13)) +>$ : Symbol($, Decl(index.d.ts, 0, 0)) +} +=== /types/lib/index.d.ts === + + +interface $ { x } +>$ : Symbol($, Decl(index.d.ts, 0, 0)) +>x : Symbol($.x, Decl(index.d.ts, 2, 13)) + diff --git a/tests/baselines/reference/typeReferenceDirectives1.trace.json b/tests/baselines/reference/typeReferenceDirectives1.trace.json new file mode 100644 index 00000000000..c936a84dcc0 --- /dev/null +++ b/tests/baselines/reference/typeReferenceDirectives1.trace.json @@ -0,0 +1,7 @@ +[ + "======== Resolving type reference directive 'lib', containing file '/app.ts', root directory '/'. ========", + "Resolving with primary search path '/types/'", + "File '/types/lib/package.json' does not exist.", + "File '/types/lib/index.d.ts' exist - use it as a name resolution result.", + "======== Type reference directive 'lib' was successfully resolved to '/types/lib/index.d.ts', primary: true. ========" +] \ No newline at end of file diff --git a/tests/baselines/reference/typeReferenceDirectives1.types b/tests/baselines/reference/typeReferenceDirectives1.types new file mode 100644 index 00000000000..05080e05651 --- /dev/null +++ b/tests/baselines/reference/typeReferenceDirectives1.types @@ -0,0 +1,16 @@ +=== /app.ts === +/// +interface A { +>A : A + + x: $ +>x : $ +>$ : $ +} +=== /types/lib/index.d.ts === + + +interface $ { x } +>$ : $ +>x : any + diff --git a/tests/baselines/reference/typeReferenceDirectives10.js b/tests/baselines/reference/typeReferenceDirectives10.js new file mode 100644 index 00000000000..e4253bb3a58 --- /dev/null +++ b/tests/baselines/reference/typeReferenceDirectives10.js @@ -0,0 +1,26 @@ +//// [tests/cases/compiler/typeReferenceDirectives10.ts] //// + +//// [ref.d.ts] + +export interface $ { x } + +//// [index.d.ts] +declare let $: { x: number } + +//// [app.ts] +/// +import {$} from "./ref"; +export interface A { + x: $ +} + + +//// [app.js] +"use strict"; + + +//// [app.d.ts] +import { $ } from "./ref"; +export interface A { + x: $; +} diff --git a/tests/baselines/reference/typeReferenceDirectives10.symbols b/tests/baselines/reference/typeReferenceDirectives10.symbols new file mode 100644 index 00000000000..910f9ac6643 --- /dev/null +++ b/tests/baselines/reference/typeReferenceDirectives10.symbols @@ -0,0 +1,24 @@ +=== /app.ts === +/// +import {$} from "./ref"; +>$ : Symbol($, Decl(app.ts, 1, 8)) + +export interface A { +>A : Symbol(A, Decl(app.ts, 1, 24)) + + x: $ +>x : Symbol(A.x, Decl(app.ts, 2, 20)) +>$ : Symbol($, Decl(app.ts, 1, 8)) +} + +=== /ref.d.ts === + +export interface $ { x } +>$ : Symbol($, Decl(ref.d.ts, 0, 0)) +>x : Symbol($.x, Decl(ref.d.ts, 1, 20)) + +=== /types/lib/index.d.ts === +declare let $: { x: number } +>$ : Symbol($, Decl(index.d.ts, 0, 11)) +>x : Symbol(x, Decl(index.d.ts, 0, 16)) + diff --git a/tests/baselines/reference/typeReferenceDirectives10.trace.json b/tests/baselines/reference/typeReferenceDirectives10.trace.json new file mode 100644 index 00000000000..b6adaf1f513 --- /dev/null +++ b/tests/baselines/reference/typeReferenceDirectives10.trace.json @@ -0,0 +1,14 @@ +[ + "======== Resolving type reference directive 'lib', containing file '/app.ts', root directory '/'. ========", + "Resolving with primary search path '/types/'", + "File '/types/lib/package.json' does not exist.", + "File '/types/lib/index.d.ts' exist - use it as a name resolution result.", + "======== Type reference directive 'lib' was successfully resolved to '/types/lib/index.d.ts', primary: true. ========", + "======== Resolving module './ref' from '/app.ts'. ========", + "Module resolution kind is not specified, using 'NodeJs'.", + "Loading module as file / folder, candidate module location '/ref'.", + "File '/ref.ts' does not exist.", + "File '/ref.tsx' does not exist.", + "File '/ref.d.ts' exist - use it as a name resolution result.", + "======== Module name './ref' was successfully resolved to '/ref.d.ts'. ========" +] \ No newline at end of file diff --git a/tests/baselines/reference/typeReferenceDirectives10.types b/tests/baselines/reference/typeReferenceDirectives10.types new file mode 100644 index 00000000000..c33e2e64a88 --- /dev/null +++ b/tests/baselines/reference/typeReferenceDirectives10.types @@ -0,0 +1,24 @@ +=== /app.ts === +/// +import {$} from "./ref"; +>$ : any + +export interface A { +>A : A + + x: $ +>x : $ +>$ : $ +} + +=== /ref.d.ts === + +export interface $ { x } +>$ : $ +>x : any + +=== /types/lib/index.d.ts === +declare let $: { x: number } +>$ : { x: number; } +>x : number + diff --git a/tests/baselines/reference/typeReferenceDirectives11.js b/tests/baselines/reference/typeReferenceDirectives11.js new file mode 100644 index 00000000000..cb41c843adc --- /dev/null +++ b/tests/baselines/reference/typeReferenceDirectives11.js @@ -0,0 +1,27 @@ +//// [tests/cases/compiler/typeReferenceDirectives11.ts] //// + +//// [index.d.ts] + + +interface Lib { x } + +//// [mod1.ts] + +export function foo(): Lib { return {x: 1} } + +//// [mod2.ts] + +import {foo} from "./mod1"; +export const bar = foo(); + +//// [output.js] + + +//// [output.d.ts] +/// +declare module "mod1" { + export function foo(): Lib; +} +declare module "mod2" { + export const bar: Lib; +} diff --git a/tests/baselines/reference/typeReferenceDirectives11.symbols b/tests/baselines/reference/typeReferenceDirectives11.symbols new file mode 100644 index 00000000000..875bb2a0900 --- /dev/null +++ b/tests/baselines/reference/typeReferenceDirectives11.symbols @@ -0,0 +1,23 @@ +=== /mod2.ts === + +import {foo} from "./mod1"; +>foo : Symbol(foo, Decl(mod2.ts, 1, 8)) + +export const bar = foo(); +>bar : Symbol(bar, Decl(mod2.ts, 2, 12)) +>foo : Symbol(foo, Decl(mod2.ts, 1, 8)) + +=== /types/lib/index.d.ts === + + +interface Lib { x } +>Lib : Symbol(Lib, Decl(index.d.ts, 0, 0)) +>x : Symbol(Lib.x, Decl(index.d.ts, 2, 15)) + +=== /mod1.ts === + +export function foo(): Lib { return {x: 1} } +>foo : Symbol(foo, Decl(mod1.ts, 0, 0)) +>Lib : Symbol(Lib, Decl(index.d.ts, 0, 0)) +>x : Symbol(x, Decl(mod1.ts, 1, 37)) + diff --git a/tests/baselines/reference/typeReferenceDirectives11.trace.json b/tests/baselines/reference/typeReferenceDirectives11.trace.json new file mode 100644 index 00000000000..be060569d83 --- /dev/null +++ b/tests/baselines/reference/typeReferenceDirectives11.trace.json @@ -0,0 +1,12 @@ +[ + "======== Resolving type reference directive 'lib', containing file not set, root directory '/'. ========", + "Resolving with primary search path '/types/'", + "File '/types/lib/package.json' does not exist.", + "File '/types/lib/index.d.ts' exist - use it as a name resolution result.", + "======== Type reference directive 'lib' was successfully resolved to '/types/lib/index.d.ts', primary: true. ========", + "======== Resolving module './mod1' from '/mod2.ts'. ========", + "Module resolution kind is not specified, using 'NodeJs'.", + "Loading module as file / folder, candidate module location '/mod1'.", + "File '/mod1.ts' exist - use it as a name resolution result.", + "======== Module name './mod1' was successfully resolved to '/mod1.ts'. ========" +] \ No newline at end of file diff --git a/tests/baselines/reference/typeReferenceDirectives11.types b/tests/baselines/reference/typeReferenceDirectives11.types new file mode 100644 index 00000000000..93d80b7988a --- /dev/null +++ b/tests/baselines/reference/typeReferenceDirectives11.types @@ -0,0 +1,26 @@ +=== /mod2.ts === + +import {foo} from "./mod1"; +>foo : () => Lib + +export const bar = foo(); +>bar : Lib +>foo() : Lib +>foo : () => Lib + +=== /types/lib/index.d.ts === + + +interface Lib { x } +>Lib : Lib +>x : any + +=== /mod1.ts === + +export function foo(): Lib { return {x: 1} } +>foo : () => Lib +>Lib : Lib +>{x: 1} : { x: number; } +>x : number +>1 : number + diff --git a/tests/baselines/reference/typeReferenceDirectives12.js b/tests/baselines/reference/typeReferenceDirectives12.js new file mode 100644 index 00000000000..c9c4a912da1 --- /dev/null +++ b/tests/baselines/reference/typeReferenceDirectives12.js @@ -0,0 +1,63 @@ +//// [tests/cases/compiler/typeReferenceDirectives12.ts] //// + +//// [index.d.ts] + + +interface Lib { x } + +//// [main.ts] +export class Cls { + x +} + +//// [mod1.ts] +/// + +import {Cls} from "./main"; +Cls.prototype.foo = function() { return undefined; } + +declare module "./main" { + interface Cls { + foo(): Lib; + } + namespace Cls { + function bar(): Lib; + } +} + +//// [mod2.ts] +import { Cls } from "./main"; +import "./mod1"; + +export const cls = Cls; +export const foo = new Cls().foo(); +export const bar = Cls.bar(); + +//// [output.js] +/// + + +//// [output.d.ts] +/// +declare module "main" { + export class Cls { + x: any; + } +} +declare module "mod1" { + module "main" { + interface Cls { + foo(): Lib; + } + namespace Cls { + function bar(): Lib; + } + } +} +declare module "mod2" { + import { Cls } from "main"; + import "mod1"; + export const cls: typeof Cls; + export const foo: Lib; + export const bar: Lib; +} diff --git a/tests/baselines/reference/typeReferenceDirectives12.symbols b/tests/baselines/reference/typeReferenceDirectives12.symbols new file mode 100644 index 00000000000..30b24c39284 --- /dev/null +++ b/tests/baselines/reference/typeReferenceDirectives12.symbols @@ -0,0 +1,68 @@ +=== /mod2.ts === +import { Cls } from "./main"; +>Cls : Symbol(Cls, Decl(mod2.ts, 0, 8)) + +import "./mod1"; + +export const cls = Cls; +>cls : Symbol(cls, Decl(mod2.ts, 3, 12)) +>Cls : Symbol(Cls, Decl(mod2.ts, 0, 8)) + +export const foo = new Cls().foo(); +>foo : Symbol(foo, Decl(mod2.ts, 4, 12)) +>new Cls().foo : Symbol(Cls.foo, Decl(mod1.ts, 6, 19)) +>Cls : Symbol(Cls, Decl(mod2.ts, 0, 8)) +>foo : Symbol(Cls.foo, Decl(mod1.ts, 6, 19)) + +export const bar = Cls.bar(); +>bar : Symbol(bar, Decl(mod2.ts, 5, 12)) +>Cls.bar : Symbol(Cls.bar, Decl(mod1.ts, 9, 19)) +>Cls : Symbol(Cls, Decl(mod2.ts, 0, 8)) +>bar : Symbol(Cls.bar, Decl(mod1.ts, 9, 19)) + +=== /types/lib/index.d.ts === + + +interface Lib { x } +>Lib : Symbol(Lib, Decl(index.d.ts, 0, 0)) +>x : Symbol(Lib.x, Decl(index.d.ts, 2, 15)) + +=== /main.ts === +export class Cls { +>Cls : Symbol(Cls, Decl(main.ts, 0, 0), Decl(mod1.ts, 5, 25), Decl(mod1.ts, 8, 5)) + + x +>x : Symbol(Cls.x, Decl(main.ts, 0, 18)) +} + +=== /mod1.ts === +/// + +import {Cls} from "./main"; +>Cls : Symbol(Cls, Decl(mod1.ts, 2, 8)) + +Cls.prototype.foo = function() { return undefined; } +>Cls.prototype.foo : Symbol(Cls.foo, Decl(mod1.ts, 6, 19)) +>Cls.prototype : Symbol(Cls.prototype) +>Cls : Symbol(Cls, Decl(mod1.ts, 2, 8)) +>prototype : Symbol(Cls.prototype) +>foo : Symbol(Cls.foo, Decl(mod1.ts, 6, 19)) +>undefined : Symbol(undefined) + +declare module "./main" { + interface Cls { +>Cls : Symbol(Cls, Decl(main.ts, 0, 0), Decl(mod1.ts, 5, 25), Decl(mod1.ts, 8, 5)) + + foo(): Lib; +>foo : Symbol(Cls.foo, Decl(mod1.ts, 6, 19)) +>Lib : Symbol(Lib, Decl(index.d.ts, 0, 0)) + } + namespace Cls { +>Cls : Symbol(Cls, Decl(main.ts, 0, 0), Decl(mod1.ts, 5, 25), Decl(mod1.ts, 8, 5)) + + function bar(): Lib; +>bar : Symbol(bar, Decl(mod1.ts, 9, 19)) +>Lib : Symbol(Lib, Decl(index.d.ts, 0, 0)) + } +} + diff --git a/tests/baselines/reference/typeReferenceDirectives12.trace.json b/tests/baselines/reference/typeReferenceDirectives12.trace.json new file mode 100644 index 00000000000..f4fc0937325 --- /dev/null +++ b/tests/baselines/reference/typeReferenceDirectives12.trace.json @@ -0,0 +1,22 @@ +[ + "======== Resolving module './main' from '/mod2.ts'. ========", + "Module resolution kind is not specified, using 'NodeJs'.", + "Loading module as file / folder, candidate module location '/main'.", + "File '/main.ts' exist - use it as a name resolution result.", + "======== Module name './main' was successfully resolved to '/main.ts'. ========", + "======== Resolving module './mod1' from '/mod2.ts'. ========", + "Module resolution kind is not specified, using 'NodeJs'.", + "Loading module as file / folder, candidate module location '/mod1'.", + "File '/mod1.ts' exist - use it as a name resolution result.", + "======== Module name './mod1' was successfully resolved to '/mod1.ts'. ========", + "======== Resolving type reference directive 'lib', containing file '/mod1.ts', root directory '/'. ========", + "Resolving with primary search path '/types/'", + "File '/types/lib/package.json' does not exist.", + "File '/types/lib/index.d.ts' exist - use it as a name resolution result.", + "======== Type reference directive 'lib' was successfully resolved to '/types/lib/index.d.ts', primary: true. ========", + "======== Resolving module './main' from '/mod1.ts'. ========", + "Module resolution kind is not specified, using 'NodeJs'.", + "Loading module as file / folder, candidate module location '/main'.", + "File '/main.ts' exist - use it as a name resolution result.", + "======== Module name './main' was successfully resolved to '/main.ts'. ========" +] \ No newline at end of file diff --git a/tests/baselines/reference/typeReferenceDirectives12.types b/tests/baselines/reference/typeReferenceDirectives12.types new file mode 100644 index 00000000000..bd429b91f1c --- /dev/null +++ b/tests/baselines/reference/typeReferenceDirectives12.types @@ -0,0 +1,73 @@ +=== /mod2.ts === +import { Cls } from "./main"; +>Cls : typeof Cls + +import "./mod1"; + +export const cls = Cls; +>cls : typeof Cls +>Cls : typeof Cls + +export const foo = new Cls().foo(); +>foo : Lib +>new Cls().foo() : Lib +>new Cls().foo : () => Lib +>new Cls() : Cls +>Cls : typeof Cls +>foo : () => Lib + +export const bar = Cls.bar(); +>bar : Lib +>Cls.bar() : Lib +>Cls.bar : () => Lib +>Cls : typeof Cls +>bar : () => Lib + +=== /types/lib/index.d.ts === + + +interface Lib { x } +>Lib : Lib +>x : any + +=== /main.ts === +export class Cls { +>Cls : Cls + + x +>x : any +} + +=== /mod1.ts === +/// + +import {Cls} from "./main"; +>Cls : typeof Cls + +Cls.prototype.foo = function() { return undefined; } +>Cls.prototype.foo = function() { return undefined; } : () => any +>Cls.prototype.foo : () => Lib +>Cls.prototype : Cls +>Cls : typeof Cls +>prototype : Cls +>foo : () => Lib +>function() { return undefined; } : () => any +>undefined : undefined + +declare module "./main" { + interface Cls { +>Cls : Cls + + foo(): Lib; +>foo : () => Lib +>Lib : Lib + } + namespace Cls { +>Cls : typeof Cls + + function bar(): Lib; +>bar : () => Lib +>Lib : Lib + } +} + diff --git a/tests/baselines/reference/typeReferenceDirectives13.js b/tests/baselines/reference/typeReferenceDirectives13.js new file mode 100644 index 00000000000..9fecdd47f77 --- /dev/null +++ b/tests/baselines/reference/typeReferenceDirectives13.js @@ -0,0 +1,26 @@ +//// [tests/cases/compiler/typeReferenceDirectives13.ts] //// + +//// [ref.d.ts] + +export interface $ { x } + +//// [index.d.ts] +declare let $: { x: number } + +//// [app.ts] +/// +import {$} from "./ref"; +export interface A { + x: () => typeof $ +} + + +//// [app.js] +"use strict"; + + +//// [app.d.ts] +/// +export interface A { + x: () => typeof $; +} diff --git a/tests/baselines/reference/typeReferenceDirectives13.symbols b/tests/baselines/reference/typeReferenceDirectives13.symbols new file mode 100644 index 00000000000..90a32b16341 --- /dev/null +++ b/tests/baselines/reference/typeReferenceDirectives13.symbols @@ -0,0 +1,24 @@ +=== /app.ts === +/// +import {$} from "./ref"; +>$ : Symbol($, Decl(app.ts, 1, 8)) + +export interface A { +>A : Symbol(A, Decl(app.ts, 1, 24)) + + x: () => typeof $ +>x : Symbol(A.x, Decl(app.ts, 2, 20)) +>$ : Symbol($, Decl(app.ts, 1, 8)) +} + +=== /ref.d.ts === + +export interface $ { x } +>$ : Symbol($, Decl(ref.d.ts, 0, 0)) +>x : Symbol($.x, Decl(ref.d.ts, 1, 20)) + +=== /types/lib/index.d.ts === +declare let $: { x: number } +>$ : Symbol($, Decl(index.d.ts, 0, 11)) +>x : Symbol(x, Decl(index.d.ts, 0, 16)) + diff --git a/tests/baselines/reference/typeReferenceDirectives13.trace.json b/tests/baselines/reference/typeReferenceDirectives13.trace.json new file mode 100644 index 00000000000..b6adaf1f513 --- /dev/null +++ b/tests/baselines/reference/typeReferenceDirectives13.trace.json @@ -0,0 +1,14 @@ +[ + "======== Resolving type reference directive 'lib', containing file '/app.ts', root directory '/'. ========", + "Resolving with primary search path '/types/'", + "File '/types/lib/package.json' does not exist.", + "File '/types/lib/index.d.ts' exist - use it as a name resolution result.", + "======== Type reference directive 'lib' was successfully resolved to '/types/lib/index.d.ts', primary: true. ========", + "======== Resolving module './ref' from '/app.ts'. ========", + "Module resolution kind is not specified, using 'NodeJs'.", + "Loading module as file / folder, candidate module location '/ref'.", + "File '/ref.ts' does not exist.", + "File '/ref.tsx' does not exist.", + "File '/ref.d.ts' exist - use it as a name resolution result.", + "======== Module name './ref' was successfully resolved to '/ref.d.ts'. ========" +] \ No newline at end of file diff --git a/tests/baselines/reference/typeReferenceDirectives13.types b/tests/baselines/reference/typeReferenceDirectives13.types new file mode 100644 index 00000000000..240661883bb --- /dev/null +++ b/tests/baselines/reference/typeReferenceDirectives13.types @@ -0,0 +1,24 @@ +=== /app.ts === +/// +import {$} from "./ref"; +>$ : any + +export interface A { +>A : A + + x: () => typeof $ +>x : () => { x: number; } +>$ : { x: number; } +} + +=== /ref.d.ts === + +export interface $ { x } +>$ : $ +>x : any + +=== /types/lib/index.d.ts === +declare let $: { x: number } +>$ : { x: number; } +>x : number + diff --git a/tests/baselines/reference/typeReferenceDirectives2.js b/tests/baselines/reference/typeReferenceDirectives2.js new file mode 100644 index 00000000000..3d441ac04fc --- /dev/null +++ b/tests/baselines/reference/typeReferenceDirectives2.js @@ -0,0 +1,19 @@ +//// [tests/cases/compiler/typeReferenceDirectives2.ts] //// + +//// [index.d.ts] + +interface $ { x } + +//// [app.ts] +interface A { + x: $ +} + +//// [app.js] + + +//// [app.d.ts] +/// +interface A { + x: $; +} diff --git a/tests/baselines/reference/typeReferenceDirectives2.symbols b/tests/baselines/reference/typeReferenceDirectives2.symbols new file mode 100644 index 00000000000..100296c11cf --- /dev/null +++ b/tests/baselines/reference/typeReferenceDirectives2.symbols @@ -0,0 +1,14 @@ +=== /app.ts === +interface A { +>A : Symbol(A, Decl(app.ts, 0, 0)) + + x: $ +>x : Symbol(A.x, Decl(app.ts, 0, 13)) +>$ : Symbol($, Decl(index.d.ts, 0, 0)) +} +=== /types/lib/index.d.ts === + +interface $ { x } +>$ : Symbol($, Decl(index.d.ts, 0, 0)) +>x : Symbol($.x, Decl(index.d.ts, 1, 13)) + diff --git a/tests/baselines/reference/typeReferenceDirectives2.trace.json b/tests/baselines/reference/typeReferenceDirectives2.trace.json new file mode 100644 index 00000000000..826abe5d51a --- /dev/null +++ b/tests/baselines/reference/typeReferenceDirectives2.trace.json @@ -0,0 +1,7 @@ +[ + "======== Resolving type reference directive 'lib', containing file not set, root directory '/'. ========", + "Resolving with primary search path '/types/'", + "File '/types/lib/package.json' does not exist.", + "File '/types/lib/index.d.ts' exist - use it as a name resolution result.", + "======== Type reference directive 'lib' was successfully resolved to '/types/lib/index.d.ts', primary: true. ========" +] \ No newline at end of file diff --git a/tests/baselines/reference/typeReferenceDirectives2.types b/tests/baselines/reference/typeReferenceDirectives2.types new file mode 100644 index 00000000000..284e2ef1f44 --- /dev/null +++ b/tests/baselines/reference/typeReferenceDirectives2.types @@ -0,0 +1,14 @@ +=== /app.ts === +interface A { +>A : A + + x: $ +>x : $ +>$ : $ +} +=== /types/lib/index.d.ts === + +interface $ { x } +>$ : $ +>x : any + diff --git a/tests/baselines/reference/typeReferenceDirectives3.js b/tests/baselines/reference/typeReferenceDirectives3.js new file mode 100644 index 00000000000..9a41c69e30a --- /dev/null +++ b/tests/baselines/reference/typeReferenceDirectives3.js @@ -0,0 +1,27 @@ +//// [tests/cases/compiler/typeReferenceDirectives3.ts] //// + +//// [ref.d.ts] + +// $ comes from d.ts file - no need to add type reference directive + +interface $ { x } + +//// [index.d.ts] +declare let $: { x: number } + +//// [app.ts] +/// +/// +interface A { + x: () => $ +} + +//// [app.js] +/// + + +//// [app.d.ts] +/// +interface A { + x: () => $; +} diff --git a/tests/baselines/reference/typeReferenceDirectives3.symbols b/tests/baselines/reference/typeReferenceDirectives3.symbols new file mode 100644 index 00000000000..6ab3cd7d1ee --- /dev/null +++ b/tests/baselines/reference/typeReferenceDirectives3.symbols @@ -0,0 +1,23 @@ +=== /app.ts === +/// +/// +interface A { +>A : Symbol(A, Decl(app.ts, 0, 0)) + + x: () => $ +>x : Symbol(A.x, Decl(app.ts, 2, 13)) +>$ : Symbol($, Decl(ref.d.ts, 0, 0), Decl(index.d.ts, 0, 11)) +} +=== /ref.d.ts === + +// $ comes from d.ts file - no need to add type reference directive + +interface $ { x } +>$ : Symbol($, Decl(ref.d.ts, 0, 0), Decl(index.d.ts, 0, 11)) +>x : Symbol($.x, Decl(ref.d.ts, 3, 13)) + +=== /types/lib/index.d.ts === +declare let $: { x: number } +>$ : Symbol($, Decl(ref.d.ts, 0, 0), Decl(index.d.ts, 0, 11)) +>x : Symbol(x, Decl(index.d.ts, 0, 16)) + diff --git a/tests/baselines/reference/typeReferenceDirectives3.trace.json b/tests/baselines/reference/typeReferenceDirectives3.trace.json new file mode 100644 index 00000000000..c936a84dcc0 --- /dev/null +++ b/tests/baselines/reference/typeReferenceDirectives3.trace.json @@ -0,0 +1,7 @@ +[ + "======== Resolving type reference directive 'lib', containing file '/app.ts', root directory '/'. ========", + "Resolving with primary search path '/types/'", + "File '/types/lib/package.json' does not exist.", + "File '/types/lib/index.d.ts' exist - use it as a name resolution result.", + "======== Type reference directive 'lib' was successfully resolved to '/types/lib/index.d.ts', primary: true. ========" +] \ No newline at end of file diff --git a/tests/baselines/reference/typeReferenceDirectives3.types b/tests/baselines/reference/typeReferenceDirectives3.types new file mode 100644 index 00000000000..3f82a9c666b --- /dev/null +++ b/tests/baselines/reference/typeReferenceDirectives3.types @@ -0,0 +1,23 @@ +=== /app.ts === +/// +/// +interface A { +>A : A + + x: () => $ +>x : () => $ +>$ : $ +} +=== /ref.d.ts === + +// $ comes from d.ts file - no need to add type reference directive + +interface $ { x } +>$ : $ +>x : any + +=== /types/lib/index.d.ts === +declare let $: { x: number } +>$ : { x: number; } +>x : number + diff --git a/tests/baselines/reference/typeReferenceDirectives4.js b/tests/baselines/reference/typeReferenceDirectives4.js new file mode 100644 index 00000000000..ebe66d7b4dc --- /dev/null +++ b/tests/baselines/reference/typeReferenceDirectives4.js @@ -0,0 +1,30 @@ +//// [tests/cases/compiler/typeReferenceDirectives4.ts] //// + +//// [ref.d.ts] + +// $ comes from d.ts file - no need to add type reference directive + +interface $ { x } + +//// [index.d.ts] +declare let $: { x: number } + + +//// [app.ts] +/// +/// + +let x: $; +let y = () => x + +//// [app.js] +/// +/// +var x; +var y = function () { return x; }; + + +//// [app.d.ts] +/// +declare let x: $; +declare let y: () => $; diff --git a/tests/baselines/reference/typeReferenceDirectives4.symbols b/tests/baselines/reference/typeReferenceDirectives4.symbols new file mode 100644 index 00000000000..2877064934a --- /dev/null +++ b/tests/baselines/reference/typeReferenceDirectives4.symbols @@ -0,0 +1,26 @@ +=== /app.ts === +/// +/// + +let x: $; +>x : Symbol(x, Decl(app.ts, 3, 3)) +>$ : Symbol($, Decl(ref.d.ts, 0, 0), Decl(index.d.ts, 0, 11)) + +let y = () => x +>y : Symbol(y, Decl(app.ts, 4, 3)) +>x : Symbol(x, Decl(app.ts, 3, 3)) + +=== /ref.d.ts === + +// $ comes from d.ts file - no need to add type reference directive + +interface $ { x } +>$ : Symbol($, Decl(ref.d.ts, 0, 0), Decl(index.d.ts, 0, 11)) +>x : Symbol($.x, Decl(ref.d.ts, 3, 13)) + +=== /types/lib/index.d.ts === +declare let $: { x: number } +>$ : Symbol($, Decl(ref.d.ts, 0, 0), Decl(index.d.ts, 0, 11)) +>x : Symbol(x, Decl(index.d.ts, 0, 16)) + + diff --git a/tests/baselines/reference/typeReferenceDirectives4.trace.json b/tests/baselines/reference/typeReferenceDirectives4.trace.json new file mode 100644 index 00000000000..c936a84dcc0 --- /dev/null +++ b/tests/baselines/reference/typeReferenceDirectives4.trace.json @@ -0,0 +1,7 @@ +[ + "======== Resolving type reference directive 'lib', containing file '/app.ts', root directory '/'. ========", + "Resolving with primary search path '/types/'", + "File '/types/lib/package.json' does not exist.", + "File '/types/lib/index.d.ts' exist - use it as a name resolution result.", + "======== Type reference directive 'lib' was successfully resolved to '/types/lib/index.d.ts', primary: true. ========" +] \ No newline at end of file diff --git a/tests/baselines/reference/typeReferenceDirectives4.types b/tests/baselines/reference/typeReferenceDirectives4.types new file mode 100644 index 00000000000..39d40a1ee78 --- /dev/null +++ b/tests/baselines/reference/typeReferenceDirectives4.types @@ -0,0 +1,27 @@ +=== /app.ts === +/// +/// + +let x: $; +>x : $ +>$ : $ + +let y = () => x +>y : () => $ +>() => x : () => $ +>x : $ + +=== /ref.d.ts === + +// $ comes from d.ts file - no need to add type reference directive + +interface $ { x } +>$ : $ +>x : any + +=== /types/lib/index.d.ts === +declare let $: { x: number } +>$ : { x: number; } +>x : number + + diff --git a/tests/baselines/reference/typeReferenceDirectives5.js b/tests/baselines/reference/typeReferenceDirectives5.js new file mode 100644 index 00000000000..41448cbeab2 --- /dev/null +++ b/tests/baselines/reference/typeReferenceDirectives5.js @@ -0,0 +1,25 @@ +//// [tests/cases/compiler/typeReferenceDirectives5.ts] //// + +//// [ref.d.ts] + +export interface $ { x } + +//// [index.d.ts] +declare let $: { x: number } + +//// [app.ts] +/// +import {$} from "./ref"; +export interface A { + x: typeof $; +} + +//// [app.js] +"use strict"; + + +//// [app.d.ts] +/// +export interface A { + x: typeof $; +} diff --git a/tests/baselines/reference/typeReferenceDirectives5.symbols b/tests/baselines/reference/typeReferenceDirectives5.symbols new file mode 100644 index 00000000000..fbbb06d6834 --- /dev/null +++ b/tests/baselines/reference/typeReferenceDirectives5.symbols @@ -0,0 +1,23 @@ +=== /app.ts === +/// +import {$} from "./ref"; +>$ : Symbol($, Decl(app.ts, 1, 8)) + +export interface A { +>A : Symbol(A, Decl(app.ts, 1, 24)) + + x: typeof $; +>x : Symbol(A.x, Decl(app.ts, 2, 20)) +>$ : Symbol($, Decl(app.ts, 1, 8)) +} +=== /ref.d.ts === + +export interface $ { x } +>$ : Symbol($, Decl(ref.d.ts, 0, 0)) +>x : Symbol($.x, Decl(ref.d.ts, 1, 20)) + +=== /types/lib/index.d.ts === +declare let $: { x: number } +>$ : Symbol($, Decl(index.d.ts, 0, 11)) +>x : Symbol(x, Decl(index.d.ts, 0, 16)) + diff --git a/tests/baselines/reference/typeReferenceDirectives5.trace.json b/tests/baselines/reference/typeReferenceDirectives5.trace.json new file mode 100644 index 00000000000..b6adaf1f513 --- /dev/null +++ b/tests/baselines/reference/typeReferenceDirectives5.trace.json @@ -0,0 +1,14 @@ +[ + "======== Resolving type reference directive 'lib', containing file '/app.ts', root directory '/'. ========", + "Resolving with primary search path '/types/'", + "File '/types/lib/package.json' does not exist.", + "File '/types/lib/index.d.ts' exist - use it as a name resolution result.", + "======== Type reference directive 'lib' was successfully resolved to '/types/lib/index.d.ts', primary: true. ========", + "======== Resolving module './ref' from '/app.ts'. ========", + "Module resolution kind is not specified, using 'NodeJs'.", + "Loading module as file / folder, candidate module location '/ref'.", + "File '/ref.ts' does not exist.", + "File '/ref.tsx' does not exist.", + "File '/ref.d.ts' exist - use it as a name resolution result.", + "======== Module name './ref' was successfully resolved to '/ref.d.ts'. ========" +] \ No newline at end of file diff --git a/tests/baselines/reference/typeReferenceDirectives5.types b/tests/baselines/reference/typeReferenceDirectives5.types new file mode 100644 index 00000000000..9b7cd93f6cc --- /dev/null +++ b/tests/baselines/reference/typeReferenceDirectives5.types @@ -0,0 +1,23 @@ +=== /app.ts === +/// +import {$} from "./ref"; +>$ : any + +export interface A { +>A : A + + x: typeof $; +>x : { x: number; } +>$ : { x: number; } +} +=== /ref.d.ts === + +export interface $ { x } +>$ : $ +>x : any + +=== /types/lib/index.d.ts === +declare let $: { x: number } +>$ : { x: number; } +>x : number + diff --git a/tests/baselines/reference/typeReferenceDirectives6.js b/tests/baselines/reference/typeReferenceDirectives6.js new file mode 100644 index 00000000000..3d1ea0e41c9 --- /dev/null +++ b/tests/baselines/reference/typeReferenceDirectives6.js @@ -0,0 +1,33 @@ +//// [tests/cases/compiler/typeReferenceDirectives6.ts] //// + +//// [ref.d.ts] + +// $ comes from type declaration file - type reference directive should be added + +declare let $: { x: number } + +//// [index.d.ts] +interface $ { x } + + +//// [app.ts] +/// +/// + +let x: $; +let y = () => x + + + +//// [app.js] +/// +/// +var x; +var y = function () { return x; }; + + +//// [app.d.ts] +/// +/// +declare let x: $; +declare let y: () => $; diff --git a/tests/baselines/reference/typeReferenceDirectives6.symbols b/tests/baselines/reference/typeReferenceDirectives6.symbols new file mode 100644 index 00000000000..f8a5245a0a5 --- /dev/null +++ b/tests/baselines/reference/typeReferenceDirectives6.symbols @@ -0,0 +1,27 @@ +=== /app.ts === +/// +/// + +let x: $; +>x : Symbol(x, Decl(app.ts, 3, 3)) +>$ : Symbol($, Decl(ref.d.ts, 3, 11), Decl(index.d.ts, 0, 0)) + +let y = () => x +>y : Symbol(y, Decl(app.ts, 4, 3)) +>x : Symbol(x, Decl(app.ts, 3, 3)) + + +=== /ref.d.ts === + +// $ comes from type declaration file - type reference directive should be added + +declare let $: { x: number } +>$ : Symbol($, Decl(ref.d.ts, 3, 11), Decl(index.d.ts, 0, 0)) +>x : Symbol(x, Decl(ref.d.ts, 3, 16)) + +=== /types/lib/index.d.ts === +interface $ { x } +>$ : Symbol($, Decl(ref.d.ts, 3, 11), Decl(index.d.ts, 0, 0)) +>x : Symbol($.x, Decl(index.d.ts, 0, 13)) + + diff --git a/tests/baselines/reference/typeReferenceDirectives6.trace.json b/tests/baselines/reference/typeReferenceDirectives6.trace.json new file mode 100644 index 00000000000..c936a84dcc0 --- /dev/null +++ b/tests/baselines/reference/typeReferenceDirectives6.trace.json @@ -0,0 +1,7 @@ +[ + "======== Resolving type reference directive 'lib', containing file '/app.ts', root directory '/'. ========", + "Resolving with primary search path '/types/'", + "File '/types/lib/package.json' does not exist.", + "File '/types/lib/index.d.ts' exist - use it as a name resolution result.", + "======== Type reference directive 'lib' was successfully resolved to '/types/lib/index.d.ts', primary: true. ========" +] \ No newline at end of file diff --git a/tests/baselines/reference/typeReferenceDirectives6.types b/tests/baselines/reference/typeReferenceDirectives6.types new file mode 100644 index 00000000000..db4d3514bde --- /dev/null +++ b/tests/baselines/reference/typeReferenceDirectives6.types @@ -0,0 +1,28 @@ +=== /app.ts === +/// +/// + +let x: $; +>x : $ +>$ : $ + +let y = () => x +>y : () => $ +>() => x : () => $ +>x : $ + + +=== /ref.d.ts === + +// $ comes from type declaration file - type reference directive should be added + +declare let $: { x: number } +>$ : { x: number; } +>x : number + +=== /types/lib/index.d.ts === +interface $ { x } +>$ : $ +>x : any + + diff --git a/tests/baselines/reference/typeReferenceDirectives7.js b/tests/baselines/reference/typeReferenceDirectives7.js new file mode 100644 index 00000000000..6a15180d3e7 --- /dev/null +++ b/tests/baselines/reference/typeReferenceDirectives7.js @@ -0,0 +1,28 @@ +//// [tests/cases/compiler/typeReferenceDirectives7.ts] //// + +//// [index.d.ts] + +// local value shadows global - no need to add type reference directive + +declare let $: { x: number } + + +//// [app.ts] +/// + +export let $ = 1; + +export let x: typeof $; +export let y = () => x + +//// [app.js] +/// +"use strict"; +exports.$ = 1; +exports.y = function () { return exports.x; }; + + +//// [app.d.ts] +export declare let $: number; +export declare let x: typeof $; +export declare let y: () => number; diff --git a/tests/baselines/reference/typeReferenceDirectives7.symbols b/tests/baselines/reference/typeReferenceDirectives7.symbols new file mode 100644 index 00000000000..27637dfaa0e --- /dev/null +++ b/tests/baselines/reference/typeReferenceDirectives7.symbols @@ -0,0 +1,23 @@ +=== /app.ts === +/// + +export let $ = 1; +>$ : Symbol($, Decl(app.ts, 2, 10)) + +export let x: typeof $; +>x : Symbol(x, Decl(app.ts, 4, 10)) +>$ : Symbol($, Decl(app.ts, 2, 10)) + +export let y = () => x +>y : Symbol(y, Decl(app.ts, 5, 10)) +>x : Symbol(x, Decl(app.ts, 4, 10)) + +=== /types/lib/index.d.ts === + +// local value shadows global - no need to add type reference directive + +declare let $: { x: number } +>$ : Symbol($, Decl(index.d.ts, 3, 11)) +>x : Symbol(x, Decl(index.d.ts, 3, 16)) + + diff --git a/tests/baselines/reference/typeReferenceDirectives7.trace.json b/tests/baselines/reference/typeReferenceDirectives7.trace.json new file mode 100644 index 00000000000..c936a84dcc0 --- /dev/null +++ b/tests/baselines/reference/typeReferenceDirectives7.trace.json @@ -0,0 +1,7 @@ +[ + "======== Resolving type reference directive 'lib', containing file '/app.ts', root directory '/'. ========", + "Resolving with primary search path '/types/'", + "File '/types/lib/package.json' does not exist.", + "File '/types/lib/index.d.ts' exist - use it as a name resolution result.", + "======== Type reference directive 'lib' was successfully resolved to '/types/lib/index.d.ts', primary: true. ========" +] \ No newline at end of file diff --git a/tests/baselines/reference/typeReferenceDirectives7.types b/tests/baselines/reference/typeReferenceDirectives7.types new file mode 100644 index 00000000000..dab53a49899 --- /dev/null +++ b/tests/baselines/reference/typeReferenceDirectives7.types @@ -0,0 +1,25 @@ +=== /app.ts === +/// + +export let $ = 1; +>$ : number +>1 : number + +export let x: typeof $; +>x : number +>$ : number + +export let y = () => x +>y : () => number +>() => x : () => number +>x : number + +=== /types/lib/index.d.ts === + +// local value shadows global - no need to add type reference directive + +declare let $: { x: number } +>$ : { x: number; } +>x : number + + diff --git a/tests/baselines/reference/typeReferenceDirectives8.js b/tests/baselines/reference/typeReferenceDirectives8.js new file mode 100644 index 00000000000..cfa22c4228c --- /dev/null +++ b/tests/baselines/reference/typeReferenceDirectives8.js @@ -0,0 +1,32 @@ +//// [tests/cases/compiler/typeReferenceDirectives8.ts] //// + +//// [index.d.ts] + + +interface Lib { x } + +//// [mod1.ts] + +export function foo(): Lib { return {x: 1} } + +//// [mod2.ts] + +import {foo} from "./mod1"; +export const bar = foo(); + +//// [mod1.js] +"use strict"; +function foo() { return { x: 1 }; } +exports.foo = foo; +//// [mod2.js] +"use strict"; +var mod1_1 = require("./mod1"); +exports.bar = mod1_1.foo(); + + +//// [mod1.d.ts] +/// +export declare function foo(): Lib; +//// [mod2.d.ts] +/// +export declare const bar: Lib; diff --git a/tests/baselines/reference/typeReferenceDirectives8.symbols b/tests/baselines/reference/typeReferenceDirectives8.symbols new file mode 100644 index 00000000000..875bb2a0900 --- /dev/null +++ b/tests/baselines/reference/typeReferenceDirectives8.symbols @@ -0,0 +1,23 @@ +=== /mod2.ts === + +import {foo} from "./mod1"; +>foo : Symbol(foo, Decl(mod2.ts, 1, 8)) + +export const bar = foo(); +>bar : Symbol(bar, Decl(mod2.ts, 2, 12)) +>foo : Symbol(foo, Decl(mod2.ts, 1, 8)) + +=== /types/lib/index.d.ts === + + +interface Lib { x } +>Lib : Symbol(Lib, Decl(index.d.ts, 0, 0)) +>x : Symbol(Lib.x, Decl(index.d.ts, 2, 15)) + +=== /mod1.ts === + +export function foo(): Lib { return {x: 1} } +>foo : Symbol(foo, Decl(mod1.ts, 0, 0)) +>Lib : Symbol(Lib, Decl(index.d.ts, 0, 0)) +>x : Symbol(x, Decl(mod1.ts, 1, 37)) + diff --git a/tests/baselines/reference/typeReferenceDirectives8.trace.json b/tests/baselines/reference/typeReferenceDirectives8.trace.json new file mode 100644 index 00000000000..be060569d83 --- /dev/null +++ b/tests/baselines/reference/typeReferenceDirectives8.trace.json @@ -0,0 +1,12 @@ +[ + "======== Resolving type reference directive 'lib', containing file not set, root directory '/'. ========", + "Resolving with primary search path '/types/'", + "File '/types/lib/package.json' does not exist.", + "File '/types/lib/index.d.ts' exist - use it as a name resolution result.", + "======== Type reference directive 'lib' was successfully resolved to '/types/lib/index.d.ts', primary: true. ========", + "======== Resolving module './mod1' from '/mod2.ts'. ========", + "Module resolution kind is not specified, using 'NodeJs'.", + "Loading module as file / folder, candidate module location '/mod1'.", + "File '/mod1.ts' exist - use it as a name resolution result.", + "======== Module name './mod1' was successfully resolved to '/mod1.ts'. ========" +] \ No newline at end of file diff --git a/tests/baselines/reference/typeReferenceDirectives8.types b/tests/baselines/reference/typeReferenceDirectives8.types new file mode 100644 index 00000000000..93d80b7988a --- /dev/null +++ b/tests/baselines/reference/typeReferenceDirectives8.types @@ -0,0 +1,26 @@ +=== /mod2.ts === + +import {foo} from "./mod1"; +>foo : () => Lib + +export const bar = foo(); +>bar : Lib +>foo() : Lib +>foo : () => Lib + +=== /types/lib/index.d.ts === + + +interface Lib { x } +>Lib : Lib +>x : any + +=== /mod1.ts === + +export function foo(): Lib { return {x: 1} } +>foo : () => Lib +>Lib : Lib +>{x: 1} : { x: number; } +>x : number +>1 : number + diff --git a/tests/baselines/reference/typeReferenceDirectives9.js b/tests/baselines/reference/typeReferenceDirectives9.js new file mode 100644 index 00000000000..5fd17ea16d3 --- /dev/null +++ b/tests/baselines/reference/typeReferenceDirectives9.js @@ -0,0 +1,79 @@ +//// [tests/cases/compiler/typeReferenceDirectives9.ts] //// + +//// [index.d.ts] + + +interface Lib { x } + +//// [main.ts] +export class Cls { + x +} + +//// [mod1.ts] +/// + +import {Cls} from "./main"; +Cls.prototype.foo = function() { return undefined; } + +declare module "./main" { + interface Cls { + foo(): Lib; + } + namespace Cls { + function bar(): Lib; + } +} + +//// [mod2.ts] +import { Cls } from "./main"; +import "./mod1"; + +export const cls = Cls; +export const foo = new Cls().foo(); +export const bar = Cls.bar(); + +//// [main.js] +"use strict"; +var Cls = (function () { + function Cls() { + } + return Cls; +}()); +exports.Cls = Cls; +//// [mod1.js] +/// +"use strict"; +var main_1 = require("./main"); +main_1.Cls.prototype.foo = function () { return undefined; }; +//// [mod2.js] +"use strict"; +var main_1 = require("./main"); +require("./mod1"); +exports.cls = main_1.Cls; +exports.foo = new main_1.Cls().foo(); +exports.bar = main_1.Cls.bar(); + + +//// [main.d.ts] +export declare class Cls { + x: any; +} +//// [mod1.d.ts] +/// +declare module "./main" { + interface Cls { + foo(): Lib; + } + namespace Cls { + function bar(): Lib; + } +} +export {}; +//// [mod2.d.ts] +/// +import { Cls } from "./main"; +import "./mod1"; +export declare const cls: typeof Cls; +export declare const foo: Lib; +export declare const bar: Lib; diff --git a/tests/baselines/reference/typeReferenceDirectives9.symbols b/tests/baselines/reference/typeReferenceDirectives9.symbols new file mode 100644 index 00000000000..30b24c39284 --- /dev/null +++ b/tests/baselines/reference/typeReferenceDirectives9.symbols @@ -0,0 +1,68 @@ +=== /mod2.ts === +import { Cls } from "./main"; +>Cls : Symbol(Cls, Decl(mod2.ts, 0, 8)) + +import "./mod1"; + +export const cls = Cls; +>cls : Symbol(cls, Decl(mod2.ts, 3, 12)) +>Cls : Symbol(Cls, Decl(mod2.ts, 0, 8)) + +export const foo = new Cls().foo(); +>foo : Symbol(foo, Decl(mod2.ts, 4, 12)) +>new Cls().foo : Symbol(Cls.foo, Decl(mod1.ts, 6, 19)) +>Cls : Symbol(Cls, Decl(mod2.ts, 0, 8)) +>foo : Symbol(Cls.foo, Decl(mod1.ts, 6, 19)) + +export const bar = Cls.bar(); +>bar : Symbol(bar, Decl(mod2.ts, 5, 12)) +>Cls.bar : Symbol(Cls.bar, Decl(mod1.ts, 9, 19)) +>Cls : Symbol(Cls, Decl(mod2.ts, 0, 8)) +>bar : Symbol(Cls.bar, Decl(mod1.ts, 9, 19)) + +=== /types/lib/index.d.ts === + + +interface Lib { x } +>Lib : Symbol(Lib, Decl(index.d.ts, 0, 0)) +>x : Symbol(Lib.x, Decl(index.d.ts, 2, 15)) + +=== /main.ts === +export class Cls { +>Cls : Symbol(Cls, Decl(main.ts, 0, 0), Decl(mod1.ts, 5, 25), Decl(mod1.ts, 8, 5)) + + x +>x : Symbol(Cls.x, Decl(main.ts, 0, 18)) +} + +=== /mod1.ts === +/// + +import {Cls} from "./main"; +>Cls : Symbol(Cls, Decl(mod1.ts, 2, 8)) + +Cls.prototype.foo = function() { return undefined; } +>Cls.prototype.foo : Symbol(Cls.foo, Decl(mod1.ts, 6, 19)) +>Cls.prototype : Symbol(Cls.prototype) +>Cls : Symbol(Cls, Decl(mod1.ts, 2, 8)) +>prototype : Symbol(Cls.prototype) +>foo : Symbol(Cls.foo, Decl(mod1.ts, 6, 19)) +>undefined : Symbol(undefined) + +declare module "./main" { + interface Cls { +>Cls : Symbol(Cls, Decl(main.ts, 0, 0), Decl(mod1.ts, 5, 25), Decl(mod1.ts, 8, 5)) + + foo(): Lib; +>foo : Symbol(Cls.foo, Decl(mod1.ts, 6, 19)) +>Lib : Symbol(Lib, Decl(index.d.ts, 0, 0)) + } + namespace Cls { +>Cls : Symbol(Cls, Decl(main.ts, 0, 0), Decl(mod1.ts, 5, 25), Decl(mod1.ts, 8, 5)) + + function bar(): Lib; +>bar : Symbol(bar, Decl(mod1.ts, 9, 19)) +>Lib : Symbol(Lib, Decl(index.d.ts, 0, 0)) + } +} + diff --git a/tests/baselines/reference/typeReferenceDirectives9.trace.json b/tests/baselines/reference/typeReferenceDirectives9.trace.json new file mode 100644 index 00000000000..f4fc0937325 --- /dev/null +++ b/tests/baselines/reference/typeReferenceDirectives9.trace.json @@ -0,0 +1,22 @@ +[ + "======== Resolving module './main' from '/mod2.ts'. ========", + "Module resolution kind is not specified, using 'NodeJs'.", + "Loading module as file / folder, candidate module location '/main'.", + "File '/main.ts' exist - use it as a name resolution result.", + "======== Module name './main' was successfully resolved to '/main.ts'. ========", + "======== Resolving module './mod1' from '/mod2.ts'. ========", + "Module resolution kind is not specified, using 'NodeJs'.", + "Loading module as file / folder, candidate module location '/mod1'.", + "File '/mod1.ts' exist - use it as a name resolution result.", + "======== Module name './mod1' was successfully resolved to '/mod1.ts'. ========", + "======== Resolving type reference directive 'lib', containing file '/mod1.ts', root directory '/'. ========", + "Resolving with primary search path '/types/'", + "File '/types/lib/package.json' does not exist.", + "File '/types/lib/index.d.ts' exist - use it as a name resolution result.", + "======== Type reference directive 'lib' was successfully resolved to '/types/lib/index.d.ts', primary: true. ========", + "======== Resolving module './main' from '/mod1.ts'. ========", + "Module resolution kind is not specified, using 'NodeJs'.", + "Loading module as file / folder, candidate module location '/main'.", + "File '/main.ts' exist - use it as a name resolution result.", + "======== Module name './main' was successfully resolved to '/main.ts'. ========" +] \ No newline at end of file diff --git a/tests/baselines/reference/typeReferenceDirectives9.types b/tests/baselines/reference/typeReferenceDirectives9.types new file mode 100644 index 00000000000..bd429b91f1c --- /dev/null +++ b/tests/baselines/reference/typeReferenceDirectives9.types @@ -0,0 +1,73 @@ +=== /mod2.ts === +import { Cls } from "./main"; +>Cls : typeof Cls + +import "./mod1"; + +export const cls = Cls; +>cls : typeof Cls +>Cls : typeof Cls + +export const foo = new Cls().foo(); +>foo : Lib +>new Cls().foo() : Lib +>new Cls().foo : () => Lib +>new Cls() : Cls +>Cls : typeof Cls +>foo : () => Lib + +export const bar = Cls.bar(); +>bar : Lib +>Cls.bar() : Lib +>Cls.bar : () => Lib +>Cls : typeof Cls +>bar : () => Lib + +=== /types/lib/index.d.ts === + + +interface Lib { x } +>Lib : Lib +>x : any + +=== /main.ts === +export class Cls { +>Cls : Cls + + x +>x : any +} + +=== /mod1.ts === +/// + +import {Cls} from "./main"; +>Cls : typeof Cls + +Cls.prototype.foo = function() { return undefined; } +>Cls.prototype.foo = function() { return undefined; } : () => any +>Cls.prototype.foo : () => Lib +>Cls.prototype : Cls +>Cls : typeof Cls +>prototype : Cls +>foo : () => Lib +>function() { return undefined; } : () => any +>undefined : undefined + +declare module "./main" { + interface Cls { +>Cls : Cls + + foo(): Lib; +>foo : () => Lib +>Lib : Lib + } + namespace Cls { +>Cls : typeof Cls + + function bar(): Lib; +>bar : () => Lib +>Lib : Lib + } +} + diff --git a/tests/baselines/reference/typedArrays.symbols b/tests/baselines/reference/typedArrays.symbols index 7282e8b8879..2d45fb7e5c1 100644 --- a/tests/baselines/reference/typedArrays.symbols +++ b/tests/baselines/reference/typedArrays.symbols @@ -8,39 +8,39 @@ function CreateTypedArrayTypes() { typedArrays[0] = Int8Array; >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 2, 7)) ->Int8Array : Symbol(Int8Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Int8Array : Symbol(Int8Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) typedArrays[1] = Uint8Array; >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 2, 7)) ->Uint8Array : Symbol(Uint8Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Uint8Array : Symbol(Uint8Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) typedArrays[2] = Int16Array; >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 2, 7)) ->Int16Array : Symbol(Int16Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Int16Array : Symbol(Int16Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) typedArrays[3] = Uint16Array; >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 2, 7)) ->Uint16Array : Symbol(Uint16Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Uint16Array : Symbol(Uint16Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) typedArrays[4] = Int32Array; >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 2, 7)) ->Int32Array : Symbol(Int32Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Int32Array : Symbol(Int32Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) typedArrays[5] = Uint32Array; >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 2, 7)) ->Uint32Array : Symbol(Uint32Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Uint32Array : Symbol(Uint32Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) typedArrays[6] = Float32Array; >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 2, 7)) ->Float32Array : Symbol(Float32Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Float32Array : Symbol(Float32Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) typedArrays[7] = Float64Array; >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 2, 7)) ->Float64Array : Symbol(Float64Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Float64Array : Symbol(Float64Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) typedArrays[8] = Uint8ClampedArray; >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 2, 7)) ->Uint8ClampedArray : Symbol(Uint8ClampedArray, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Uint8ClampedArray : Symbol(Uint8ClampedArray, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) return typedArrays; >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 2, 7)) @@ -55,47 +55,47 @@ function CreateTypedArrayInstancesFromLength(obj: number) { typedArrays[0] = new Int8Array(obj); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 17, 7)) ->Int8Array : Symbol(Int8Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Int8Array : Symbol(Int8Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) >obj : Symbol(obj, Decl(typedArrays.ts, 16, 45)) typedArrays[1] = new Uint8Array(obj); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 17, 7)) ->Uint8Array : Symbol(Uint8Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Uint8Array : Symbol(Uint8Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) >obj : Symbol(obj, Decl(typedArrays.ts, 16, 45)) typedArrays[2] = new Int16Array(obj); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 17, 7)) ->Int16Array : Symbol(Int16Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Int16Array : Symbol(Int16Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) >obj : Symbol(obj, Decl(typedArrays.ts, 16, 45)) typedArrays[3] = new Uint16Array(obj); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 17, 7)) ->Uint16Array : Symbol(Uint16Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Uint16Array : Symbol(Uint16Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) >obj : Symbol(obj, Decl(typedArrays.ts, 16, 45)) typedArrays[4] = new Int32Array(obj); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 17, 7)) ->Int32Array : Symbol(Int32Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Int32Array : Symbol(Int32Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) >obj : Symbol(obj, Decl(typedArrays.ts, 16, 45)) typedArrays[5] = new Uint32Array(obj); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 17, 7)) ->Uint32Array : Symbol(Uint32Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Uint32Array : Symbol(Uint32Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) >obj : Symbol(obj, Decl(typedArrays.ts, 16, 45)) typedArrays[6] = new Float32Array(obj); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 17, 7)) ->Float32Array : Symbol(Float32Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Float32Array : Symbol(Float32Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) >obj : Symbol(obj, Decl(typedArrays.ts, 16, 45)) typedArrays[7] = new Float64Array(obj); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 17, 7)) ->Float64Array : Symbol(Float64Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Float64Array : Symbol(Float64Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) >obj : Symbol(obj, Decl(typedArrays.ts, 16, 45)) typedArrays[8] = new Uint8ClampedArray(obj); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 17, 7)) ->Uint8ClampedArray : Symbol(Uint8ClampedArray, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Uint8ClampedArray : Symbol(Uint8ClampedArray, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) >obj : Symbol(obj, Decl(typedArrays.ts, 16, 45)) return typedArrays; @@ -111,47 +111,47 @@ function CreateTypedArrayInstancesFromArray(obj: number[]) { typedArrays[0] = new Int8Array(obj); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 32, 7)) ->Int8Array : Symbol(Int8Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Int8Array : Symbol(Int8Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) >obj : Symbol(obj, Decl(typedArrays.ts, 31, 44)) typedArrays[1] = new Uint8Array(obj); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 32, 7)) ->Uint8Array : Symbol(Uint8Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Uint8Array : Symbol(Uint8Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) >obj : Symbol(obj, Decl(typedArrays.ts, 31, 44)) typedArrays[2] = new Int16Array(obj); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 32, 7)) ->Int16Array : Symbol(Int16Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Int16Array : Symbol(Int16Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) >obj : Symbol(obj, Decl(typedArrays.ts, 31, 44)) typedArrays[3] = new Uint16Array(obj); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 32, 7)) ->Uint16Array : Symbol(Uint16Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Uint16Array : Symbol(Uint16Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) >obj : Symbol(obj, Decl(typedArrays.ts, 31, 44)) typedArrays[4] = new Int32Array(obj); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 32, 7)) ->Int32Array : Symbol(Int32Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Int32Array : Symbol(Int32Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) >obj : Symbol(obj, Decl(typedArrays.ts, 31, 44)) typedArrays[5] = new Uint32Array(obj); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 32, 7)) ->Uint32Array : Symbol(Uint32Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Uint32Array : Symbol(Uint32Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) >obj : Symbol(obj, Decl(typedArrays.ts, 31, 44)) typedArrays[6] = new Float32Array(obj); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 32, 7)) ->Float32Array : Symbol(Float32Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Float32Array : Symbol(Float32Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) >obj : Symbol(obj, Decl(typedArrays.ts, 31, 44)) typedArrays[7] = new Float64Array(obj); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 32, 7)) ->Float64Array : Symbol(Float64Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Float64Array : Symbol(Float64Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) >obj : Symbol(obj, Decl(typedArrays.ts, 31, 44)) typedArrays[8] = new Uint8ClampedArray(obj); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 32, 7)) ->Uint8ClampedArray : Symbol(Uint8ClampedArray, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Uint8ClampedArray : Symbol(Uint8ClampedArray, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) >obj : Symbol(obj, Decl(typedArrays.ts, 31, 44)) return typedArrays; @@ -167,65 +167,65 @@ function CreateIntegerTypedArraysFromArray2(obj:number[]) { typedArrays[0] = Int8Array.from(obj); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 47, 7)) ->Int8Array.from : Symbol(Int8ArrayConstructor.from, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->Int8Array : Symbol(Int8Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->from : Symbol(Int8ArrayConstructor.from, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Int8Array.from : Symbol(Int8ArrayConstructor.from, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Int8Array : Symbol(Int8Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>from : Symbol(Int8ArrayConstructor.from, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) >obj : Symbol(obj, Decl(typedArrays.ts, 46, 44)) typedArrays[1] = Uint8Array.from(obj); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 47, 7)) ->Uint8Array.from : Symbol(Uint8ArrayConstructor.from, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->Uint8Array : Symbol(Uint8Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->from : Symbol(Uint8ArrayConstructor.from, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Uint8Array.from : Symbol(Uint8ArrayConstructor.from, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Uint8Array : Symbol(Uint8Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>from : Symbol(Uint8ArrayConstructor.from, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) >obj : Symbol(obj, Decl(typedArrays.ts, 46, 44)) typedArrays[2] = Int16Array.from(obj); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 47, 7)) ->Int16Array.from : Symbol(Int16ArrayConstructor.from, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->Int16Array : Symbol(Int16Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->from : Symbol(Int16ArrayConstructor.from, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Int16Array.from : Symbol(Int16ArrayConstructor.from, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Int16Array : Symbol(Int16Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>from : Symbol(Int16ArrayConstructor.from, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) >obj : Symbol(obj, Decl(typedArrays.ts, 46, 44)) typedArrays[3] = Uint16Array.from(obj); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 47, 7)) ->Uint16Array.from : Symbol(Uint16ArrayConstructor.from, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->Uint16Array : Symbol(Uint16Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->from : Symbol(Uint16ArrayConstructor.from, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Uint16Array.from : Symbol(Uint16ArrayConstructor.from, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Uint16Array : Symbol(Uint16Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>from : Symbol(Uint16ArrayConstructor.from, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) >obj : Symbol(obj, Decl(typedArrays.ts, 46, 44)) typedArrays[4] = Int32Array.from(obj); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 47, 7)) ->Int32Array.from : Symbol(Int32ArrayConstructor.from, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->Int32Array : Symbol(Int32Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->from : Symbol(Int32ArrayConstructor.from, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Int32Array.from : Symbol(Int32ArrayConstructor.from, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Int32Array : Symbol(Int32Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>from : Symbol(Int32ArrayConstructor.from, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) >obj : Symbol(obj, Decl(typedArrays.ts, 46, 44)) typedArrays[5] = Uint32Array.from(obj); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 47, 7)) ->Uint32Array.from : Symbol(Uint32ArrayConstructor.from, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->Uint32Array : Symbol(Uint32Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->from : Symbol(Uint32ArrayConstructor.from, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Uint32Array.from : Symbol(Uint32ArrayConstructor.from, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Uint32Array : Symbol(Uint32Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>from : Symbol(Uint32ArrayConstructor.from, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) >obj : Symbol(obj, Decl(typedArrays.ts, 46, 44)) typedArrays[6] = Float32Array.from(obj); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 47, 7)) ->Float32Array.from : Symbol(Float32ArrayConstructor.from, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->Float32Array : Symbol(Float32Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->from : Symbol(Float32ArrayConstructor.from, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Float32Array.from : Symbol(Float32ArrayConstructor.from, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Float32Array : Symbol(Float32Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>from : Symbol(Float32ArrayConstructor.from, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) >obj : Symbol(obj, Decl(typedArrays.ts, 46, 44)) typedArrays[7] = Float64Array.from(obj); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 47, 7)) ->Float64Array.from : Symbol(Float64ArrayConstructor.from, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->Float64Array : Symbol(Float64Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->from : Symbol(Float64ArrayConstructor.from, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Float64Array.from : Symbol(Float64ArrayConstructor.from, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Float64Array : Symbol(Float64Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>from : Symbol(Float64ArrayConstructor.from, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) >obj : Symbol(obj, Decl(typedArrays.ts, 46, 44)) typedArrays[8] = Uint8ClampedArray.from(obj); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 47, 7)) ->Uint8ClampedArray.from : Symbol(Uint8ClampedArrayConstructor.from, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->Uint8ClampedArray : Symbol(Uint8ClampedArray, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->from : Symbol(Uint8ClampedArrayConstructor.from, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Uint8ClampedArray.from : Symbol(Uint8ClampedArrayConstructor.from, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Uint8ClampedArray : Symbol(Uint8ClampedArray, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>from : Symbol(Uint8ClampedArrayConstructor.from, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) >obj : Symbol(obj, Decl(typedArrays.ts, 46, 44)) return typedArrays; @@ -235,72 +235,72 @@ function CreateIntegerTypedArraysFromArray2(obj:number[]) { function CreateIntegerTypedArraysFromArrayLike(obj:ArrayLike) { >CreateIntegerTypedArraysFromArrayLike : Symbol(CreateIntegerTypedArraysFromArrayLike, Decl(typedArrays.ts, 59, 1)) >obj : Symbol(obj, Decl(typedArrays.ts, 61, 47)) ->ArrayLike : Symbol(ArrayLike, Decl(lib.d.ts, --, --)) +>ArrayLike : Symbol(ArrayLike, Decl(lib.es5.d.ts, --, --)) var typedArrays = []; >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 62, 7)) typedArrays[0] = Int8Array.from(obj); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 62, 7)) ->Int8Array.from : Symbol(Int8ArrayConstructor.from, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->Int8Array : Symbol(Int8Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->from : Symbol(Int8ArrayConstructor.from, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Int8Array.from : Symbol(Int8ArrayConstructor.from, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Int8Array : Symbol(Int8Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>from : Symbol(Int8ArrayConstructor.from, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) >obj : Symbol(obj, Decl(typedArrays.ts, 61, 47)) typedArrays[1] = Uint8Array.from(obj); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 62, 7)) ->Uint8Array.from : Symbol(Uint8ArrayConstructor.from, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->Uint8Array : Symbol(Uint8Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->from : Symbol(Uint8ArrayConstructor.from, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Uint8Array.from : Symbol(Uint8ArrayConstructor.from, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Uint8Array : Symbol(Uint8Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>from : Symbol(Uint8ArrayConstructor.from, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) >obj : Symbol(obj, Decl(typedArrays.ts, 61, 47)) typedArrays[2] = Int16Array.from(obj); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 62, 7)) ->Int16Array.from : Symbol(Int16ArrayConstructor.from, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->Int16Array : Symbol(Int16Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->from : Symbol(Int16ArrayConstructor.from, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Int16Array.from : Symbol(Int16ArrayConstructor.from, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Int16Array : Symbol(Int16Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>from : Symbol(Int16ArrayConstructor.from, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) >obj : Symbol(obj, Decl(typedArrays.ts, 61, 47)) typedArrays[3] = Uint16Array.from(obj); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 62, 7)) ->Uint16Array.from : Symbol(Uint16ArrayConstructor.from, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->Uint16Array : Symbol(Uint16Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->from : Symbol(Uint16ArrayConstructor.from, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Uint16Array.from : Symbol(Uint16ArrayConstructor.from, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Uint16Array : Symbol(Uint16Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>from : Symbol(Uint16ArrayConstructor.from, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) >obj : Symbol(obj, Decl(typedArrays.ts, 61, 47)) typedArrays[4] = Int32Array.from(obj); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 62, 7)) ->Int32Array.from : Symbol(Int32ArrayConstructor.from, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->Int32Array : Symbol(Int32Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->from : Symbol(Int32ArrayConstructor.from, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Int32Array.from : Symbol(Int32ArrayConstructor.from, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Int32Array : Symbol(Int32Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>from : Symbol(Int32ArrayConstructor.from, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) >obj : Symbol(obj, Decl(typedArrays.ts, 61, 47)) typedArrays[5] = Uint32Array.from(obj); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 62, 7)) ->Uint32Array.from : Symbol(Uint32ArrayConstructor.from, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->Uint32Array : Symbol(Uint32Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->from : Symbol(Uint32ArrayConstructor.from, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Uint32Array.from : Symbol(Uint32ArrayConstructor.from, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Uint32Array : Symbol(Uint32Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>from : Symbol(Uint32ArrayConstructor.from, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) >obj : Symbol(obj, Decl(typedArrays.ts, 61, 47)) typedArrays[6] = Float32Array.from(obj); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 62, 7)) ->Float32Array.from : Symbol(Float32ArrayConstructor.from, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->Float32Array : Symbol(Float32Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->from : Symbol(Float32ArrayConstructor.from, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Float32Array.from : Symbol(Float32ArrayConstructor.from, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Float32Array : Symbol(Float32Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>from : Symbol(Float32ArrayConstructor.from, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) >obj : Symbol(obj, Decl(typedArrays.ts, 61, 47)) typedArrays[7] = Float64Array.from(obj); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 62, 7)) ->Float64Array.from : Symbol(Float64ArrayConstructor.from, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->Float64Array : Symbol(Float64Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->from : Symbol(Float64ArrayConstructor.from, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Float64Array.from : Symbol(Float64ArrayConstructor.from, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Float64Array : Symbol(Float64Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>from : Symbol(Float64ArrayConstructor.from, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) >obj : Symbol(obj, Decl(typedArrays.ts, 61, 47)) typedArrays[8] = Uint8ClampedArray.from(obj); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 62, 7)) ->Uint8ClampedArray.from : Symbol(Uint8ClampedArrayConstructor.from, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->Uint8ClampedArray : Symbol(Uint8ClampedArray, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->from : Symbol(Uint8ClampedArrayConstructor.from, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Uint8ClampedArray.from : Symbol(Uint8ClampedArrayConstructor.from, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Uint8ClampedArray : Symbol(Uint8ClampedArray, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>from : Symbol(Uint8ClampedArrayConstructor.from, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) >obj : Symbol(obj, Decl(typedArrays.ts, 61, 47)) return typedArrays; @@ -316,65 +316,65 @@ function CreateTypedArraysOf(obj) { typedArrays[0] = Int8Array.of(...obj); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 77, 7)) ->Int8Array.of : Symbol(Int8ArrayConstructor.of, Decl(lib.d.ts, --, --)) ->Int8Array : Symbol(Int8Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->of : Symbol(Int8ArrayConstructor.of, Decl(lib.d.ts, --, --)) +>Int8Array.of : Symbol(Int8ArrayConstructor.of, Decl(lib.es5.d.ts, --, --)) +>Int8Array : Symbol(Int8Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>of : Symbol(Int8ArrayConstructor.of, Decl(lib.es5.d.ts, --, --)) >obj : Symbol(obj, Decl(typedArrays.ts, 76, 29)) typedArrays[1] = Uint8Array.of(...obj); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 77, 7)) ->Uint8Array.of : Symbol(Uint8ArrayConstructor.of, Decl(lib.d.ts, --, --)) ->Uint8Array : Symbol(Uint8Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->of : Symbol(Uint8ArrayConstructor.of, Decl(lib.d.ts, --, --)) +>Uint8Array.of : Symbol(Uint8ArrayConstructor.of, Decl(lib.es5.d.ts, --, --)) +>Uint8Array : Symbol(Uint8Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>of : Symbol(Uint8ArrayConstructor.of, Decl(lib.es5.d.ts, --, --)) >obj : Symbol(obj, Decl(typedArrays.ts, 76, 29)) typedArrays[2] = Int16Array.of(...obj); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 77, 7)) ->Int16Array.of : Symbol(Int16ArrayConstructor.of, Decl(lib.d.ts, --, --)) ->Int16Array : Symbol(Int16Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->of : Symbol(Int16ArrayConstructor.of, Decl(lib.d.ts, --, --)) +>Int16Array.of : Symbol(Int16ArrayConstructor.of, Decl(lib.es5.d.ts, --, --)) +>Int16Array : Symbol(Int16Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>of : Symbol(Int16ArrayConstructor.of, Decl(lib.es5.d.ts, --, --)) >obj : Symbol(obj, Decl(typedArrays.ts, 76, 29)) typedArrays[3] = Uint16Array.of(...obj); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 77, 7)) ->Uint16Array.of : Symbol(Uint16ArrayConstructor.of, Decl(lib.d.ts, --, --)) ->Uint16Array : Symbol(Uint16Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->of : Symbol(Uint16ArrayConstructor.of, Decl(lib.d.ts, --, --)) +>Uint16Array.of : Symbol(Uint16ArrayConstructor.of, Decl(lib.es5.d.ts, --, --)) +>Uint16Array : Symbol(Uint16Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>of : Symbol(Uint16ArrayConstructor.of, Decl(lib.es5.d.ts, --, --)) >obj : Symbol(obj, Decl(typedArrays.ts, 76, 29)) typedArrays[4] = Int32Array.of(...obj); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 77, 7)) ->Int32Array.of : Symbol(Int32ArrayConstructor.of, Decl(lib.d.ts, --, --)) ->Int32Array : Symbol(Int32Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->of : Symbol(Int32ArrayConstructor.of, Decl(lib.d.ts, --, --)) +>Int32Array.of : Symbol(Int32ArrayConstructor.of, Decl(lib.es5.d.ts, --, --)) +>Int32Array : Symbol(Int32Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>of : Symbol(Int32ArrayConstructor.of, Decl(lib.es5.d.ts, --, --)) >obj : Symbol(obj, Decl(typedArrays.ts, 76, 29)) typedArrays[5] = Uint32Array.of(...obj); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 77, 7)) ->Uint32Array.of : Symbol(Uint32ArrayConstructor.of, Decl(lib.d.ts, --, --)) ->Uint32Array : Symbol(Uint32Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->of : Symbol(Uint32ArrayConstructor.of, Decl(lib.d.ts, --, --)) +>Uint32Array.of : Symbol(Uint32ArrayConstructor.of, Decl(lib.es5.d.ts, --, --)) +>Uint32Array : Symbol(Uint32Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>of : Symbol(Uint32ArrayConstructor.of, Decl(lib.es5.d.ts, --, --)) >obj : Symbol(obj, Decl(typedArrays.ts, 76, 29)) typedArrays[6] = Float32Array.of(...obj); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 77, 7)) ->Float32Array.of : Symbol(Float32ArrayConstructor.of, Decl(lib.d.ts, --, --)) ->Float32Array : Symbol(Float32Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->of : Symbol(Float32ArrayConstructor.of, Decl(lib.d.ts, --, --)) +>Float32Array.of : Symbol(Float32ArrayConstructor.of, Decl(lib.es5.d.ts, --, --)) +>Float32Array : Symbol(Float32Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>of : Symbol(Float32ArrayConstructor.of, Decl(lib.es5.d.ts, --, --)) >obj : Symbol(obj, Decl(typedArrays.ts, 76, 29)) typedArrays[7] = Float64Array.of(...obj); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 77, 7)) ->Float64Array.of : Symbol(Float64ArrayConstructor.of, Decl(lib.d.ts, --, --)) ->Float64Array : Symbol(Float64Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->of : Symbol(Float64ArrayConstructor.of, Decl(lib.d.ts, --, --)) +>Float64Array.of : Symbol(Float64ArrayConstructor.of, Decl(lib.es5.d.ts, --, --)) +>Float64Array : Symbol(Float64Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>of : Symbol(Float64ArrayConstructor.of, Decl(lib.es5.d.ts, --, --)) >obj : Symbol(obj, Decl(typedArrays.ts, 76, 29)) typedArrays[8] = Uint8ClampedArray.of(...obj); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 77, 7)) ->Uint8ClampedArray.of : Symbol(Uint8ClampedArrayConstructor.of, Decl(lib.d.ts, --, --)) ->Uint8ClampedArray : Symbol(Uint8ClampedArray, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->of : Symbol(Uint8ClampedArrayConstructor.of, Decl(lib.d.ts, --, --)) +>Uint8ClampedArray.of : Symbol(Uint8ClampedArrayConstructor.of, Decl(lib.es5.d.ts, --, --)) +>Uint8ClampedArray : Symbol(Uint8ClampedArray, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>of : Symbol(Uint8ClampedArrayConstructor.of, Decl(lib.es5.d.ts, --, --)) >obj : Symbol(obj, Decl(typedArrays.ts, 76, 29)) return typedArrays; @@ -389,57 +389,57 @@ function CreateTypedArraysOf2() { typedArrays[0] = Int8Array.of(1,2,3,4); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 92, 7)) ->Int8Array.of : Symbol(Int8ArrayConstructor.of, Decl(lib.d.ts, --, --)) ->Int8Array : Symbol(Int8Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->of : Symbol(Int8ArrayConstructor.of, Decl(lib.d.ts, --, --)) +>Int8Array.of : Symbol(Int8ArrayConstructor.of, Decl(lib.es5.d.ts, --, --)) +>Int8Array : Symbol(Int8Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>of : Symbol(Int8ArrayConstructor.of, Decl(lib.es5.d.ts, --, --)) typedArrays[1] = Uint8Array.of(1,2,3,4); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 92, 7)) ->Uint8Array.of : Symbol(Uint8ArrayConstructor.of, Decl(lib.d.ts, --, --)) ->Uint8Array : Symbol(Uint8Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->of : Symbol(Uint8ArrayConstructor.of, Decl(lib.d.ts, --, --)) +>Uint8Array.of : Symbol(Uint8ArrayConstructor.of, Decl(lib.es5.d.ts, --, --)) +>Uint8Array : Symbol(Uint8Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>of : Symbol(Uint8ArrayConstructor.of, Decl(lib.es5.d.ts, --, --)) typedArrays[2] = Int16Array.of(1,2,3,4); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 92, 7)) ->Int16Array.of : Symbol(Int16ArrayConstructor.of, Decl(lib.d.ts, --, --)) ->Int16Array : Symbol(Int16Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->of : Symbol(Int16ArrayConstructor.of, Decl(lib.d.ts, --, --)) +>Int16Array.of : Symbol(Int16ArrayConstructor.of, Decl(lib.es5.d.ts, --, --)) +>Int16Array : Symbol(Int16Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>of : Symbol(Int16ArrayConstructor.of, Decl(lib.es5.d.ts, --, --)) typedArrays[3] = Uint16Array.of(1,2,3,4); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 92, 7)) ->Uint16Array.of : Symbol(Uint16ArrayConstructor.of, Decl(lib.d.ts, --, --)) ->Uint16Array : Symbol(Uint16Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->of : Symbol(Uint16ArrayConstructor.of, Decl(lib.d.ts, --, --)) +>Uint16Array.of : Symbol(Uint16ArrayConstructor.of, Decl(lib.es5.d.ts, --, --)) +>Uint16Array : Symbol(Uint16Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>of : Symbol(Uint16ArrayConstructor.of, Decl(lib.es5.d.ts, --, --)) typedArrays[4] = Int32Array.of(1,2,3,4); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 92, 7)) ->Int32Array.of : Symbol(Int32ArrayConstructor.of, Decl(lib.d.ts, --, --)) ->Int32Array : Symbol(Int32Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->of : Symbol(Int32ArrayConstructor.of, Decl(lib.d.ts, --, --)) +>Int32Array.of : Symbol(Int32ArrayConstructor.of, Decl(lib.es5.d.ts, --, --)) +>Int32Array : Symbol(Int32Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>of : Symbol(Int32ArrayConstructor.of, Decl(lib.es5.d.ts, --, --)) typedArrays[5] = Uint32Array.of(1,2,3,4); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 92, 7)) ->Uint32Array.of : Symbol(Uint32ArrayConstructor.of, Decl(lib.d.ts, --, --)) ->Uint32Array : Symbol(Uint32Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->of : Symbol(Uint32ArrayConstructor.of, Decl(lib.d.ts, --, --)) +>Uint32Array.of : Symbol(Uint32ArrayConstructor.of, Decl(lib.es5.d.ts, --, --)) +>Uint32Array : Symbol(Uint32Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>of : Symbol(Uint32ArrayConstructor.of, Decl(lib.es5.d.ts, --, --)) typedArrays[6] = Float32Array.of(1,2,3,4); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 92, 7)) ->Float32Array.of : Symbol(Float32ArrayConstructor.of, Decl(lib.d.ts, --, --)) ->Float32Array : Symbol(Float32Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->of : Symbol(Float32ArrayConstructor.of, Decl(lib.d.ts, --, --)) +>Float32Array.of : Symbol(Float32ArrayConstructor.of, Decl(lib.es5.d.ts, --, --)) +>Float32Array : Symbol(Float32Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>of : Symbol(Float32ArrayConstructor.of, Decl(lib.es5.d.ts, --, --)) typedArrays[7] = Float64Array.of(1,2,3,4); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 92, 7)) ->Float64Array.of : Symbol(Float64ArrayConstructor.of, Decl(lib.d.ts, --, --)) ->Float64Array : Symbol(Float64Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->of : Symbol(Float64ArrayConstructor.of, Decl(lib.d.ts, --, --)) +>Float64Array.of : Symbol(Float64ArrayConstructor.of, Decl(lib.es5.d.ts, --, --)) +>Float64Array : Symbol(Float64Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>of : Symbol(Float64ArrayConstructor.of, Decl(lib.es5.d.ts, --, --)) typedArrays[8] = Uint8ClampedArray.of(1,2,3,4); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 92, 7)) ->Uint8ClampedArray.of : Symbol(Uint8ClampedArrayConstructor.of, Decl(lib.d.ts, --, --)) ->Uint8ClampedArray : Symbol(Uint8ClampedArray, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->of : Symbol(Uint8ClampedArrayConstructor.of, Decl(lib.d.ts, --, --)) +>Uint8ClampedArray.of : Symbol(Uint8ClampedArrayConstructor.of, Decl(lib.es5.d.ts, --, --)) +>Uint8ClampedArray : Symbol(Uint8ClampedArray, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>of : Symbol(Uint8ClampedArrayConstructor.of, Decl(lib.es5.d.ts, --, --)) return typedArrays; >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 92, 7)) @@ -448,7 +448,7 @@ function CreateTypedArraysOf2() { function CreateTypedArraysFromMapFn(obj:ArrayLike, mapFn: (n:number, v:number)=> number) { >CreateTypedArraysFromMapFn : Symbol(CreateTypedArraysFromMapFn, Decl(typedArrays.ts, 104, 1)) >obj : Symbol(obj, Decl(typedArrays.ts, 106, 36)) ->ArrayLike : Symbol(ArrayLike, Decl(lib.d.ts, --, --)) +>ArrayLike : Symbol(ArrayLike, Decl(lib.es5.d.ts, --, --)) >mapFn : Symbol(mapFn, Decl(typedArrays.ts, 106, 58)) >n : Symbol(n, Decl(typedArrays.ts, 106, 67)) >v : Symbol(v, Decl(typedArrays.ts, 106, 76)) @@ -458,73 +458,73 @@ function CreateTypedArraysFromMapFn(obj:ArrayLike, mapFn: (n:number, v:n typedArrays[0] = Int8Array.from(obj, mapFn); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 107, 7)) ->Int8Array.from : Symbol(Int8ArrayConstructor.from, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->Int8Array : Symbol(Int8Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->from : Symbol(Int8ArrayConstructor.from, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Int8Array.from : Symbol(Int8ArrayConstructor.from, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Int8Array : Symbol(Int8Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>from : Symbol(Int8ArrayConstructor.from, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) >obj : Symbol(obj, Decl(typedArrays.ts, 106, 36)) >mapFn : Symbol(mapFn, Decl(typedArrays.ts, 106, 58)) typedArrays[1] = Uint8Array.from(obj, mapFn); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 107, 7)) ->Uint8Array.from : Symbol(Uint8ArrayConstructor.from, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->Uint8Array : Symbol(Uint8Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->from : Symbol(Uint8ArrayConstructor.from, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Uint8Array.from : Symbol(Uint8ArrayConstructor.from, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Uint8Array : Symbol(Uint8Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>from : Symbol(Uint8ArrayConstructor.from, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) >obj : Symbol(obj, Decl(typedArrays.ts, 106, 36)) >mapFn : Symbol(mapFn, Decl(typedArrays.ts, 106, 58)) typedArrays[2] = Int16Array.from(obj, mapFn); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 107, 7)) ->Int16Array.from : Symbol(Int16ArrayConstructor.from, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->Int16Array : Symbol(Int16Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->from : Symbol(Int16ArrayConstructor.from, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Int16Array.from : Symbol(Int16ArrayConstructor.from, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Int16Array : Symbol(Int16Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>from : Symbol(Int16ArrayConstructor.from, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) >obj : Symbol(obj, Decl(typedArrays.ts, 106, 36)) >mapFn : Symbol(mapFn, Decl(typedArrays.ts, 106, 58)) typedArrays[3] = Uint16Array.from(obj, mapFn); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 107, 7)) ->Uint16Array.from : Symbol(Uint16ArrayConstructor.from, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->Uint16Array : Symbol(Uint16Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->from : Symbol(Uint16ArrayConstructor.from, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Uint16Array.from : Symbol(Uint16ArrayConstructor.from, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Uint16Array : Symbol(Uint16Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>from : Symbol(Uint16ArrayConstructor.from, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) >obj : Symbol(obj, Decl(typedArrays.ts, 106, 36)) >mapFn : Symbol(mapFn, Decl(typedArrays.ts, 106, 58)) typedArrays[4] = Int32Array.from(obj, mapFn); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 107, 7)) ->Int32Array.from : Symbol(Int32ArrayConstructor.from, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->Int32Array : Symbol(Int32Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->from : Symbol(Int32ArrayConstructor.from, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Int32Array.from : Symbol(Int32ArrayConstructor.from, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Int32Array : Symbol(Int32Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>from : Symbol(Int32ArrayConstructor.from, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) >obj : Symbol(obj, Decl(typedArrays.ts, 106, 36)) >mapFn : Symbol(mapFn, Decl(typedArrays.ts, 106, 58)) typedArrays[5] = Uint32Array.from(obj, mapFn); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 107, 7)) ->Uint32Array.from : Symbol(Uint32ArrayConstructor.from, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->Uint32Array : Symbol(Uint32Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->from : Symbol(Uint32ArrayConstructor.from, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Uint32Array.from : Symbol(Uint32ArrayConstructor.from, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Uint32Array : Symbol(Uint32Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>from : Symbol(Uint32ArrayConstructor.from, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) >obj : Symbol(obj, Decl(typedArrays.ts, 106, 36)) >mapFn : Symbol(mapFn, Decl(typedArrays.ts, 106, 58)) typedArrays[6] = Float32Array.from(obj, mapFn); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 107, 7)) ->Float32Array.from : Symbol(Float32ArrayConstructor.from, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->Float32Array : Symbol(Float32Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->from : Symbol(Float32ArrayConstructor.from, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Float32Array.from : Symbol(Float32ArrayConstructor.from, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Float32Array : Symbol(Float32Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>from : Symbol(Float32ArrayConstructor.from, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) >obj : Symbol(obj, Decl(typedArrays.ts, 106, 36)) >mapFn : Symbol(mapFn, Decl(typedArrays.ts, 106, 58)) typedArrays[7] = Float64Array.from(obj, mapFn); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 107, 7)) ->Float64Array.from : Symbol(Float64ArrayConstructor.from, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->Float64Array : Symbol(Float64Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->from : Symbol(Float64ArrayConstructor.from, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Float64Array.from : Symbol(Float64ArrayConstructor.from, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Float64Array : Symbol(Float64Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>from : Symbol(Float64ArrayConstructor.from, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) >obj : Symbol(obj, Decl(typedArrays.ts, 106, 36)) >mapFn : Symbol(mapFn, Decl(typedArrays.ts, 106, 58)) typedArrays[8] = Uint8ClampedArray.from(obj, mapFn); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 107, 7)) ->Uint8ClampedArray.from : Symbol(Uint8ClampedArrayConstructor.from, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->Uint8ClampedArray : Symbol(Uint8ClampedArray, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->from : Symbol(Uint8ClampedArrayConstructor.from, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Uint8ClampedArray.from : Symbol(Uint8ClampedArrayConstructor.from, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Uint8ClampedArray : Symbol(Uint8ClampedArray, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>from : Symbol(Uint8ClampedArrayConstructor.from, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) >obj : Symbol(obj, Decl(typedArrays.ts, 106, 36)) >mapFn : Symbol(mapFn, Decl(typedArrays.ts, 106, 58)) @@ -535,7 +535,7 @@ function CreateTypedArraysFromMapFn(obj:ArrayLike, mapFn: (n:number, v:n function CreateTypedArraysFromThisObj(obj:ArrayLike, mapFn: (n:number, v:number)=> number, thisArg: {}) { >CreateTypedArraysFromThisObj : Symbol(CreateTypedArraysFromThisObj, Decl(typedArrays.ts, 119, 1)) >obj : Symbol(obj, Decl(typedArrays.ts, 121, 38)) ->ArrayLike : Symbol(ArrayLike, Decl(lib.d.ts, --, --)) +>ArrayLike : Symbol(ArrayLike, Decl(lib.es5.d.ts, --, --)) >mapFn : Symbol(mapFn, Decl(typedArrays.ts, 121, 60)) >n : Symbol(n, Decl(typedArrays.ts, 121, 69)) >v : Symbol(v, Decl(typedArrays.ts, 121, 78)) @@ -546,81 +546,81 @@ function CreateTypedArraysFromThisObj(obj:ArrayLike, mapFn: (n:number, v typedArrays[0] = Int8Array.from(obj, mapFn, thisArg); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 122, 7)) ->Int8Array.from : Symbol(Int8ArrayConstructor.from, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->Int8Array : Symbol(Int8Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->from : Symbol(Int8ArrayConstructor.from, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Int8Array.from : Symbol(Int8ArrayConstructor.from, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Int8Array : Symbol(Int8Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>from : Symbol(Int8ArrayConstructor.from, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) >obj : Symbol(obj, Decl(typedArrays.ts, 121, 38)) >mapFn : Symbol(mapFn, Decl(typedArrays.ts, 121, 60)) >thisArg : Symbol(thisArg, Decl(typedArrays.ts, 121, 98)) typedArrays[1] = Uint8Array.from(obj, mapFn, thisArg); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 122, 7)) ->Uint8Array.from : Symbol(Uint8ArrayConstructor.from, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->Uint8Array : Symbol(Uint8Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->from : Symbol(Uint8ArrayConstructor.from, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Uint8Array.from : Symbol(Uint8ArrayConstructor.from, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Uint8Array : Symbol(Uint8Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>from : Symbol(Uint8ArrayConstructor.from, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) >obj : Symbol(obj, Decl(typedArrays.ts, 121, 38)) >mapFn : Symbol(mapFn, Decl(typedArrays.ts, 121, 60)) >thisArg : Symbol(thisArg, Decl(typedArrays.ts, 121, 98)) typedArrays[2] = Int16Array.from(obj, mapFn, thisArg); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 122, 7)) ->Int16Array.from : Symbol(Int16ArrayConstructor.from, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->Int16Array : Symbol(Int16Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->from : Symbol(Int16ArrayConstructor.from, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Int16Array.from : Symbol(Int16ArrayConstructor.from, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Int16Array : Symbol(Int16Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>from : Symbol(Int16ArrayConstructor.from, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) >obj : Symbol(obj, Decl(typedArrays.ts, 121, 38)) >mapFn : Symbol(mapFn, Decl(typedArrays.ts, 121, 60)) >thisArg : Symbol(thisArg, Decl(typedArrays.ts, 121, 98)) typedArrays[3] = Uint16Array.from(obj, mapFn, thisArg); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 122, 7)) ->Uint16Array.from : Symbol(Uint16ArrayConstructor.from, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->Uint16Array : Symbol(Uint16Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->from : Symbol(Uint16ArrayConstructor.from, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Uint16Array.from : Symbol(Uint16ArrayConstructor.from, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Uint16Array : Symbol(Uint16Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>from : Symbol(Uint16ArrayConstructor.from, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) >obj : Symbol(obj, Decl(typedArrays.ts, 121, 38)) >mapFn : Symbol(mapFn, Decl(typedArrays.ts, 121, 60)) >thisArg : Symbol(thisArg, Decl(typedArrays.ts, 121, 98)) typedArrays[4] = Int32Array.from(obj, mapFn, thisArg); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 122, 7)) ->Int32Array.from : Symbol(Int32ArrayConstructor.from, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->Int32Array : Symbol(Int32Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->from : Symbol(Int32ArrayConstructor.from, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Int32Array.from : Symbol(Int32ArrayConstructor.from, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Int32Array : Symbol(Int32Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>from : Symbol(Int32ArrayConstructor.from, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) >obj : Symbol(obj, Decl(typedArrays.ts, 121, 38)) >mapFn : Symbol(mapFn, Decl(typedArrays.ts, 121, 60)) >thisArg : Symbol(thisArg, Decl(typedArrays.ts, 121, 98)) typedArrays[5] = Uint32Array.from(obj, mapFn, thisArg); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 122, 7)) ->Uint32Array.from : Symbol(Uint32ArrayConstructor.from, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->Uint32Array : Symbol(Uint32Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->from : Symbol(Uint32ArrayConstructor.from, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Uint32Array.from : Symbol(Uint32ArrayConstructor.from, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Uint32Array : Symbol(Uint32Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>from : Symbol(Uint32ArrayConstructor.from, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) >obj : Symbol(obj, Decl(typedArrays.ts, 121, 38)) >mapFn : Symbol(mapFn, Decl(typedArrays.ts, 121, 60)) >thisArg : Symbol(thisArg, Decl(typedArrays.ts, 121, 98)) typedArrays[6] = Float32Array.from(obj, mapFn, thisArg); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 122, 7)) ->Float32Array.from : Symbol(Float32ArrayConstructor.from, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->Float32Array : Symbol(Float32Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->from : Symbol(Float32ArrayConstructor.from, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Float32Array.from : Symbol(Float32ArrayConstructor.from, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Float32Array : Symbol(Float32Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>from : Symbol(Float32ArrayConstructor.from, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) >obj : Symbol(obj, Decl(typedArrays.ts, 121, 38)) >mapFn : Symbol(mapFn, Decl(typedArrays.ts, 121, 60)) >thisArg : Symbol(thisArg, Decl(typedArrays.ts, 121, 98)) typedArrays[7] = Float64Array.from(obj, mapFn, thisArg); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 122, 7)) ->Float64Array.from : Symbol(Float64ArrayConstructor.from, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->Float64Array : Symbol(Float64Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->from : Symbol(Float64ArrayConstructor.from, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Float64Array.from : Symbol(Float64ArrayConstructor.from, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Float64Array : Symbol(Float64Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>from : Symbol(Float64ArrayConstructor.from, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) >obj : Symbol(obj, Decl(typedArrays.ts, 121, 38)) >mapFn : Symbol(mapFn, Decl(typedArrays.ts, 121, 60)) >thisArg : Symbol(thisArg, Decl(typedArrays.ts, 121, 98)) typedArrays[8] = Uint8ClampedArray.from(obj, mapFn, thisArg); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 122, 7)) ->Uint8ClampedArray.from : Symbol(Uint8ClampedArrayConstructor.from, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->Uint8ClampedArray : Symbol(Uint8ClampedArray, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->from : Symbol(Uint8ClampedArrayConstructor.from, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Uint8ClampedArray.from : Symbol(Uint8ClampedArrayConstructor.from, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>Uint8ClampedArray : Symbol(Uint8ClampedArray, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) +>from : Symbol(Uint8ClampedArrayConstructor.from, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --)) >obj : Symbol(obj, Decl(typedArrays.ts, 121, 38)) >mapFn : Symbol(mapFn, Decl(typedArrays.ts, 121, 60)) >thisArg : Symbol(thisArg, Decl(typedArrays.ts, 121, 98)) diff --git a/tests/baselines/reference/undeclaredModuleError.errors.txt b/tests/baselines/reference/undeclaredModuleError.errors.txt index 74e36318595..4a8248bfd6c 100644 --- a/tests/baselines/reference/undeclaredModuleError.errors.txt +++ b/tests/baselines/reference/undeclaredModuleError.errors.txt @@ -16,10 +16,9 @@ tests/cases/compiler/undeclaredModuleError.ts(11,41): error TS2304: Cannot find fs.readFile(originalFilePath, () => { readdir(covFileDir, () => { ~~~~~~~ - } , (error: Error, files: {}[]) => { - ~~~~~~~~~ !!! error TS2345: Argument of type '() => void' is not assignable to parameter of type '(stat: any, name: string) => boolean'. !!! error TS2345: Type 'void' is not assignable to type 'boolean'. + } , (error: Error, files: {}[]) => { files.forEach((file) => { var fullPath = join(IDoNotExist); ~~~~~~~~~~~ diff --git a/tests/baselines/reference/undefinedAssignableToEveryType.symbols b/tests/baselines/reference/undefinedAssignableToEveryType.symbols index 81a7d906cdf..c48839ea50f 100644 --- a/tests/baselines/reference/undefinedAssignableToEveryType.symbols +++ b/tests/baselines/reference/undefinedAssignableToEveryType.symbols @@ -41,7 +41,7 @@ var d: boolean = undefined; var e: Date = undefined; >e : Symbol(e, Decl(undefinedAssignableToEveryType.ts, 15, 3)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >undefined : Symbol(undefined) var f: any = undefined; @@ -106,12 +106,12 @@ var o: (x: T) => T = undefined; var p: Number = undefined; >p : Symbol(p, Decl(undefinedAssignableToEveryType.ts, 29, 3)) ->Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >undefined : Symbol(undefined) var q: String = undefined; >q : Symbol(q, Decl(undefinedAssignableToEveryType.ts, 30, 3)) ->String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >undefined : Symbol(undefined) function foo(x: T, y: U, z: V) { @@ -119,7 +119,7 @@ function foo(x: T, y: U, z: V) { >T : Symbol(T, Decl(undefinedAssignableToEveryType.ts, 32, 13)) >U : Symbol(U, Decl(undefinedAssignableToEveryType.ts, 32, 15)) >V : Symbol(V, Decl(undefinedAssignableToEveryType.ts, 32, 18)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >x : Symbol(x, Decl(undefinedAssignableToEveryType.ts, 32, 35)) >T : Symbol(T, Decl(undefinedAssignableToEveryType.ts, 32, 13)) >y : Symbol(y, Decl(undefinedAssignableToEveryType.ts, 32, 40)) diff --git a/tests/baselines/reference/undefinedIsSubtypeOfEverything.symbols b/tests/baselines/reference/undefinedIsSubtypeOfEverything.symbols index b9e17147d51..f2776039d3a 100644 --- a/tests/baselines/reference/undefinedIsSubtypeOfEverything.symbols +++ b/tests/baselines/reference/undefinedIsSubtypeOfEverything.symbols @@ -40,7 +40,7 @@ class D1A extends Base { foo: String; >foo : Symbol(D1A.foo, Decl(undefinedIsSubtypeOfEverything.ts, 18, 24)) ->String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) } @@ -58,7 +58,7 @@ class D2A extends Base { foo: Number; >foo : Symbol(D2A.foo, Decl(undefinedIsSubtypeOfEverything.ts, 27, 24)) ->Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) } @@ -95,7 +95,7 @@ class D5 extends Base { foo: Date; >foo : Symbol(D5.foo, Decl(undefinedIsSubtypeOfEverything.ts, 45, 23)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) } diff --git a/tests/baselines/reference/underscoreTest1.symbols b/tests/baselines/reference/underscoreTest1.symbols index 0184e5dc577..3506f23510e 100644 --- a/tests/baselines/reference/underscoreTest1.symbols +++ b/tests/baselines/reference/underscoreTest1.symbols @@ -437,7 +437,7 @@ var log = _.bind((message?: string, ...rest: string[]) => { }, Date); >bind : Symbol(Underscore.Static.bind, Decl(underscoreTest1_underscore.ts, 548, 68), Decl(underscoreTest1_underscore.ts, 550, 58)) >message : Symbol(message, Decl(underscoreTest1_underscoreTests.ts, 108, 18)) >rest : Symbol(rest, Decl(underscoreTest1_underscoreTests.ts, 108, 35)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) _.delay(log, 1000, 'logged later'); >_.delay : Symbol(Underscore.Static.delay, Decl(underscoreTest1_underscore.ts, 557, 73)) @@ -782,7 +782,7 @@ _.isDate(new Date()); >_.isDate : Symbol(Underscore.Static.isDate, Decl(underscoreTest1_underscore.ts, 611, 40)) >_ : Symbol(_, Decl(underscoreTest1_underscore.ts, 645, 11)) >isDate : Symbol(Underscore.Static.isDate, Decl(underscoreTest1_underscore.ts, 611, 40)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) _.isRegExp(/moe/); >_.isRegExp : Symbol(Underscore.Static.isRegExp, Decl(underscoreTest1_underscore.ts, 612, 37)) diff --git a/tests/baselines/reference/unionThisTypeInFunctions.js b/tests/baselines/reference/unionThisTypeInFunctions.js new file mode 100644 index 00000000000..0d4b535ff8b --- /dev/null +++ b/tests/baselines/reference/unionThisTypeInFunctions.js @@ -0,0 +1,18 @@ +//// [unionThisTypeInFunctions.ts] +interface Real { + method(this: this, n: number): void; + data: string; +} +interface Fake { + method(this: this, n: number): void; + data: number; +} +function test(r: Real | Fake) { + r.method(12); +} + + +//// [unionThisTypeInFunctions.js] +function test(r) { + r.method(12); +} diff --git a/tests/baselines/reference/unionThisTypeInFunctions.symbols b/tests/baselines/reference/unionThisTypeInFunctions.symbols new file mode 100644 index 00000000000..eada1231750 --- /dev/null +++ b/tests/baselines/reference/unionThisTypeInFunctions.symbols @@ -0,0 +1,35 @@ +=== tests/cases/conformance/types/thisType/unionThisTypeInFunctions.ts === +interface Real { +>Real : Symbol(Real, Decl(unionThisTypeInFunctions.ts, 0, 0)) + + method(this: this, n: number): void; +>method : Symbol(Real.method, Decl(unionThisTypeInFunctions.ts, 0, 16)) +>this : Symbol(this, Decl(unionThisTypeInFunctions.ts, 1, 11)) +>n : Symbol(n, Decl(unionThisTypeInFunctions.ts, 1, 22)) + + data: string; +>data : Symbol(Real.data, Decl(unionThisTypeInFunctions.ts, 1, 40)) +} +interface Fake { +>Fake : Symbol(Fake, Decl(unionThisTypeInFunctions.ts, 3, 1)) + + method(this: this, n: number): void; +>method : Symbol(Fake.method, Decl(unionThisTypeInFunctions.ts, 4, 16)) +>this : Symbol(this, Decl(unionThisTypeInFunctions.ts, 5, 11)) +>n : Symbol(n, Decl(unionThisTypeInFunctions.ts, 5, 22)) + + data: number; +>data : Symbol(Fake.data, Decl(unionThisTypeInFunctions.ts, 5, 40)) +} +function test(r: Real | Fake) { +>test : Symbol(test, Decl(unionThisTypeInFunctions.ts, 7, 1)) +>r : Symbol(r, Decl(unionThisTypeInFunctions.ts, 8, 14)) +>Real : Symbol(Real, Decl(unionThisTypeInFunctions.ts, 0, 0)) +>Fake : Symbol(Fake, Decl(unionThisTypeInFunctions.ts, 3, 1)) + + r.method(12); +>r.method : Symbol(method, Decl(unionThisTypeInFunctions.ts, 0, 16), Decl(unionThisTypeInFunctions.ts, 4, 16)) +>r : Symbol(r, Decl(unionThisTypeInFunctions.ts, 8, 14)) +>method : Symbol(method, Decl(unionThisTypeInFunctions.ts, 0, 16), Decl(unionThisTypeInFunctions.ts, 4, 16)) +} + diff --git a/tests/baselines/reference/unionThisTypeInFunctions.types b/tests/baselines/reference/unionThisTypeInFunctions.types new file mode 100644 index 00000000000..3c5181166b6 --- /dev/null +++ b/tests/baselines/reference/unionThisTypeInFunctions.types @@ -0,0 +1,37 @@ +=== tests/cases/conformance/types/thisType/unionThisTypeInFunctions.ts === +interface Real { +>Real : Real + + method(this: this, n: number): void; +>method : (this: this, n: number) => void +>this : this +>n : number + + data: string; +>data : string +} +interface Fake { +>Fake : Fake + + method(this: this, n: number): void; +>method : (this: this, n: number) => void +>this : this +>n : number + + data: number; +>data : number +} +function test(r: Real | Fake) { +>test : (r: Real | Fake) => void +>r : Real | Fake +>Real : Real +>Fake : Fake + + r.method(12); +>r.method(12) : void +>r.method : ((this: Real, n: number) => void) | ((this: Fake, n: number) => void) +>r : Real | Fake +>method : ((this: Real, n: number) => void) | ((this: Fake, n: number) => void) +>12 : number +} + diff --git a/tests/baselines/reference/unionTypeCallSignatures2.symbols b/tests/baselines/reference/unionTypeCallSignatures2.symbols index 32ce4c352b8..19279346cde 100644 --- a/tests/baselines/reference/unionTypeCallSignatures2.symbols +++ b/tests/baselines/reference/unionTypeCallSignatures2.symbols @@ -11,7 +11,7 @@ interface A { (x: Date): void; >x : Symbol(x, Decl(unionTypeCallSignatures2.ts, 3, 5)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) (x: T[]): T[]; >T : Symbol(T, Decl(unionTypeCallSignatures2.ts, 4, 5)) @@ -31,7 +31,7 @@ interface B { (x: Date): void; >x : Symbol(x, Decl(unionTypeCallSignatures2.ts, 10, 5)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) (x: T[]): T[]; >T : Symbol(T, Decl(unionTypeCallSignatures2.ts, 11, 5)) diff --git a/tests/baselines/reference/unionTypeIndexSignature.symbols b/tests/baselines/reference/unionTypeIndexSignature.symbols index 7295b860f3f..dc3923f2f24 100644 --- a/tests/baselines/reference/unionTypeIndexSignature.symbols +++ b/tests/baselines/reference/unionTypeIndexSignature.symbols @@ -1,7 +1,7 @@ === tests/cases/conformance/types/union/unionTypeIndexSignature.ts === var numOrDate: number | Date; >numOrDate : Symbol(numOrDate, Decl(unionTypeIndexSignature.ts, 0, 3)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) var anyVar: number; >anyVar : Symbol(anyVar, Decl(unionTypeIndexSignature.ts, 1, 3)) @@ -13,7 +13,7 @@ var unionOfDifferentReturnType: { [a: string]: number; } | { [a: string]: Date; >unionOfDifferentReturnType : Symbol(unionOfDifferentReturnType, Decl(unionTypeIndexSignature.ts, 6, 3)) >a : Symbol(a, Decl(unionTypeIndexSignature.ts, 6, 35)) >a : Symbol(a, Decl(unionTypeIndexSignature.ts, 6, 62)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) numOrDate = unionOfDifferentReturnType["hello"]; // number | Date >numOrDate : Symbol(numOrDate, Decl(unionTypeIndexSignature.ts, 0, 3)) @@ -41,7 +41,7 @@ var unionOfDifferentReturnType1: { [a: number]: number; } | { [a: number]: Date; >unionOfDifferentReturnType1 : Symbol(unionOfDifferentReturnType1, Decl(unionTypeIndexSignature.ts, 16, 3)) >a : Symbol(a, Decl(unionTypeIndexSignature.ts, 16, 36)) >a : Symbol(a, Decl(unionTypeIndexSignature.ts, 16, 63)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) numOrDate = unionOfDifferentReturnType1["hello"]; // any >numOrDate : Symbol(numOrDate, Decl(unionTypeIndexSignature.ts, 0, 3)) diff --git a/tests/baselines/reference/useStrictLikePrologueString01.js b/tests/baselines/reference/useStrictLikePrologueString01.js new file mode 100644 index 00000000000..56df03abfe5 --- /dev/null +++ b/tests/baselines/reference/useStrictLikePrologueString01.js @@ -0,0 +1,14 @@ +//// [useStrictLikePrologueString01.ts] + +"hey!" +" use strict " +export function f() { +} + +//// [useStrictLikePrologueString01.js] +"hey!"; +" use strict "; +"use strict"; +function f() { +} +exports.f = f; diff --git a/tests/baselines/reference/useStrictLikePrologueString01.symbols b/tests/baselines/reference/useStrictLikePrologueString01.symbols new file mode 100644 index 00000000000..e96d48d9933 --- /dev/null +++ b/tests/baselines/reference/useStrictLikePrologueString01.symbols @@ -0,0 +1,7 @@ +=== tests/cases/compiler/useStrictLikePrologueString01.ts === + +"hey!" +" use strict " +export function f() { +>f : Symbol(f, Decl(useStrictLikePrologueString01.ts, 2, 14)) +} diff --git a/tests/baselines/reference/useStrictLikePrologueString01.types b/tests/baselines/reference/useStrictLikePrologueString01.types new file mode 100644 index 00000000000..a12dfe3abd3 --- /dev/null +++ b/tests/baselines/reference/useStrictLikePrologueString01.types @@ -0,0 +1,11 @@ +=== tests/cases/compiler/useStrictLikePrologueString01.ts === + +"hey!" +>"hey!" : string + +" use strict " +>" use strict " : string + +export function f() { +>f : () => void +} diff --git a/tests/baselines/reference/validStringAssignments.symbols b/tests/baselines/reference/validStringAssignments.symbols index bb24a6c1574..cb949fd076e 100644 --- a/tests/baselines/reference/validStringAssignments.symbols +++ b/tests/baselines/reference/validStringAssignments.symbols @@ -17,6 +17,6 @@ var c: string = x; var d: String = x; >d : Symbol(d, Decl(validStringAssignments.ts, 5, 3)) ->String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) >x : Symbol(x, Decl(validStringAssignments.ts, 0, 3)) diff --git a/tests/baselines/reference/wideningTuples5.errors.txt b/tests/baselines/reference/wideningTuples5.errors.txt index bfd72079f55..cd6bf6161c9 100644 --- a/tests/baselines/reference/wideningTuples5.errors.txt +++ b/tests/baselines/reference/wideningTuples5.errors.txt @@ -1,10 +1,10 @@ -tests/cases/conformance/types/tuple/wideningTuples5.ts(1,6): error TS7005: Variable 'a' implicitly has an 'any' type. -tests/cases/conformance/types/tuple/wideningTuples5.ts(1,9): error TS7005: Variable 'b' implicitly has an 'any' type. +tests/cases/conformance/types/tuple/wideningTuples5.ts(1,6): error TS7031: Binding element 'a' implicitly has an 'any' type. +tests/cases/conformance/types/tuple/wideningTuples5.ts(1,9): error TS7031: Binding element 'b' implicitly has an 'any' type. ==== tests/cases/conformance/types/tuple/wideningTuples5.ts (2 errors) ==== var [a, b] = [undefined, null]; ~ -!!! error TS7005: Variable 'a' implicitly has an 'any' type. +!!! error TS7031: Binding element 'a' implicitly has an 'any' type. ~ -!!! error TS7005: Variable 'b' implicitly has an 'any' type. \ No newline at end of file +!!! error TS7031: Binding element 'b' implicitly has an 'any' type. \ No newline at end of file diff --git a/tests/baselines/reference/wrappedAndRecursiveConstraints.symbols b/tests/baselines/reference/wrappedAndRecursiveConstraints.symbols index c374f1c02f3..4f56145951d 100644 --- a/tests/baselines/reference/wrappedAndRecursiveConstraints.symbols +++ b/tests/baselines/reference/wrappedAndRecursiveConstraints.symbols @@ -4,7 +4,7 @@ class C { >C : Symbol(C, Decl(wrappedAndRecursiveConstraints.ts, 0, 0)) >T : Symbol(T, Decl(wrappedAndRecursiveConstraints.ts, 2, 8)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) constructor(public data: T) { } >data : Symbol(C.data, Decl(wrappedAndRecursiveConstraints.ts, 3, 16)) @@ -24,7 +24,7 @@ class C { interface Foo extends Date { >Foo : Symbol(Foo, Decl(wrappedAndRecursiveConstraints.ts, 7, 1)) ->Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) +>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) foo: string; >foo : Symbol(Foo.foo, Decl(wrappedAndRecursiveConstraints.ts, 9, 28)) diff --git a/tests/cases/compiler/arrowFunctionErrorSpan.ts b/tests/cases/compiler/arrowFunctionErrorSpan.ts new file mode 100644 index 00000000000..4c7fff88a93 --- /dev/null +++ b/tests/cases/compiler/arrowFunctionErrorSpan.ts @@ -0,0 +1,53 @@ +function f(a: () => number) { } + +// oneliner +f(() => { }); + +// multiline, body +f(() => { + +}); + +// multiline 2, body +f(() => { + +}); + +// multiline 3, arrow on a new line +f(() + => { }); + +// multiline 4, arguments +f((a, + b, + c, + d) => { }); + +// single line with a comment +f(/* + */() => { }); + +// multi line with a comment +f(/* + */() => { }); + +// multi line with a comment 2 +f(/* + */() => { + + }); + +// multi line with a comment 3 +f( // comment 1 + // comment 2 + () => + // comment 3 + { + // comment 4 + } + // comment 5 +); + +// body is not a block +f(_ => 1 + + 2); diff --git a/tests/cases/compiler/blockScopedFunctionDeclarationES5.ts b/tests/cases/compiler/blockScopedFunctionDeclarationES5.ts new file mode 100644 index 00000000000..dbb725361a0 --- /dev/null +++ b/tests/cases/compiler/blockScopedFunctionDeclarationES5.ts @@ -0,0 +1,6 @@ +// @target: ES5 +if (true) { + function foo() { } + foo(); +} +foo(); \ No newline at end of file diff --git a/tests/cases/compiler/blockScopedFunctionDeclarationES6.ts b/tests/cases/compiler/blockScopedFunctionDeclarationES6.ts new file mode 100644 index 00000000000..fd0e678b806 --- /dev/null +++ b/tests/cases/compiler/blockScopedFunctionDeclarationES6.ts @@ -0,0 +1,6 @@ +// @target: ES6 +if (true) { + function foo() { } + foo(); +} +foo(); \ No newline at end of file diff --git a/tests/cases/compiler/blockScopedFunctionDeclarationInStrictClass.ts b/tests/cases/compiler/blockScopedFunctionDeclarationInStrictClass.ts new file mode 100644 index 00000000000..48d83e6ad87 --- /dev/null +++ b/tests/cases/compiler/blockScopedFunctionDeclarationInStrictClass.ts @@ -0,0 +1,10 @@ +// @target: ES5 +class c { + method() { + if (true) { + function foo() { } + foo(); // ok + } + foo(); // not ok + } +} \ No newline at end of file diff --git a/tests/cases/compiler/blockScopedFunctionDeclarationInStrictModule.ts b/tests/cases/compiler/blockScopedFunctionDeclarationInStrictModule.ts new file mode 100644 index 00000000000..48c68770620 --- /dev/null +++ b/tests/cases/compiler/blockScopedFunctionDeclarationInStrictModule.ts @@ -0,0 +1,8 @@ +// @target: ES5 +// @module: amd +if (true) { + function foo() { } + foo(); // ok +} + +export = foo; // not ok \ No newline at end of file diff --git a/tests/cases/compiler/blockScopedFunctionDeclarationStrictES5.ts b/tests/cases/compiler/blockScopedFunctionDeclarationStrictES5.ts new file mode 100644 index 00000000000..c5035e1130c --- /dev/null +++ b/tests/cases/compiler/blockScopedFunctionDeclarationStrictES5.ts @@ -0,0 +1,7 @@ +// @target: ES5 +"use strict"; +if (true) { + function foo() { } // Error to declare function in block scope + foo(); // This call should be ok +} +foo(); // Error to find name foo \ No newline at end of file diff --git a/tests/cases/compiler/blockScopedFunctionDeclarationStrictES6.ts b/tests/cases/compiler/blockScopedFunctionDeclarationStrictES6.ts new file mode 100644 index 00000000000..043890add06 --- /dev/null +++ b/tests/cases/compiler/blockScopedFunctionDeclarationStrictES6.ts @@ -0,0 +1,7 @@ +// @target: ES6 +"use strict"; +if (true) { + function foo() { } // Allowed to declare block scope function + foo(); // This call should be ok +} +foo(); // Cannot find name since foo is block scoped \ No newline at end of file diff --git a/tests/cases/compiler/blockScopedSameNameFunctionDeclarationES5.ts b/tests/cases/compiler/blockScopedSameNameFunctionDeclarationES5.ts new file mode 100644 index 00000000000..a5e10d19af2 --- /dev/null +++ b/tests/cases/compiler/blockScopedSameNameFunctionDeclarationES5.ts @@ -0,0 +1,17 @@ +// @target: ES5 +function foo(a: number) { + if (a === 1) { + function foo() { } // duplicate function + foo(); + foo(10); // not ok + } + else { + function foo() { } // duplicate function + foo(); + foo(10); // not ok + } + foo(10); // not ok + foo(); +} +foo(10); +foo(); // not ok - needs number \ No newline at end of file diff --git a/tests/cases/compiler/blockScopedSameNameFunctionDeclarationES6.ts b/tests/cases/compiler/blockScopedSameNameFunctionDeclarationES6.ts new file mode 100644 index 00000000000..c97e50964e7 --- /dev/null +++ b/tests/cases/compiler/blockScopedSameNameFunctionDeclarationES6.ts @@ -0,0 +1,17 @@ +// @target: ES6 +function foo(a: number) { + if (a === 10) { + function foo() { } // duplicate + foo(); + foo(10); // not ok + } + else { + function foo() { } // duplicate + foo(); + foo(10);// not ok + } + foo(10); // not ok + foo(); +} +foo(10); +foo(); // not ok - needs number \ No newline at end of file diff --git a/tests/cases/compiler/blockScopedSameNameFunctionDeclarationStrictES5.ts b/tests/cases/compiler/blockScopedSameNameFunctionDeclarationStrictES5.ts new file mode 100644 index 00000000000..a0073c75d43 --- /dev/null +++ b/tests/cases/compiler/blockScopedSameNameFunctionDeclarationStrictES5.ts @@ -0,0 +1,18 @@ +// @target: ES5 +"use strict"; +function foo(a: number) { + if (a === 1) { + function foo() { } // Error to declare function in block scope + foo(); + foo(10); // not ok + } + else { + function foo() { } // Error to declare function in block scope + foo(); + foo(10); // not ok + } + foo(10); + foo(); // not ok - needs number +} +foo(10); +foo(); // not ok - needs number \ No newline at end of file diff --git a/tests/cases/compiler/blockScopedSameNameFunctionDeclarationStrictES6.ts b/tests/cases/compiler/blockScopedSameNameFunctionDeclarationStrictES6.ts new file mode 100644 index 00000000000..34d73a05201 --- /dev/null +++ b/tests/cases/compiler/blockScopedSameNameFunctionDeclarationStrictES6.ts @@ -0,0 +1,18 @@ +// @target: ES6 +"use strict"; +function foo(a: number) { + if (a === 10) { + function foo() { } + foo(); + foo(10); // not ok + } + else { + function foo() { } + foo(); + foo(10); // not ok + } + foo(10); + foo(); // not ok +} +foo(10); +foo(); // not ok - needs number \ No newline at end of file diff --git a/tests/cases/compiler/commentsAfterFunctionExpression1.ts b/tests/cases/compiler/commentsAfterFunctionExpression1.ts new file mode 100644 index 00000000000..04fb0aec3b1 --- /dev/null +++ b/tests/cases/compiler/commentsAfterFunctionExpression1.ts @@ -0,0 +1,6 @@ +// @removeComments: false +var v = { + f: a => 0 /*t1*/, + g: (a => 0) /*t2*/, + h: (a => 0 /*t3*/) +} diff --git a/tests/cases/compiler/commentsOnObjectLiteral4.ts b/tests/cases/compiler/commentsOnObjectLiteral4.ts index d685304f31e..dfb9e42b3cb 100644 --- a/tests/cases/compiler/commentsOnObjectLiteral4.ts +++ b/tests/cases/compiler/commentsOnObjectLiteral4.ts @@ -6,6 +6,6 @@ var v = { * @type {number} */ get bar(): number { - return this._bar; + return 12; } -} \ No newline at end of file +} diff --git a/tests/cases/compiler/contextualTyping24.ts b/tests/cases/compiler/contextualTyping24.ts index be28ff3b04c..fad23fa313c 100644 --- a/tests/cases/compiler/contextualTyping24.ts +++ b/tests/cases/compiler/contextualTyping24.ts @@ -1 +1 @@ -var foo:(a:{():number; (i:number):number; })=>number; foo = function(a:string){return 5}; \ No newline at end of file +var foo:(a:{():number; (i:number):number; })=>number; foo = function(this: void, a:string){return 5}; \ No newline at end of file diff --git a/tests/cases/compiler/declarationEmitDefaultExportWithTempVarName.ts b/tests/cases/compiler/declarationEmitDefaultExportWithTempVarName.ts new file mode 100644 index 00000000000..13c967c4fe5 --- /dev/null +++ b/tests/cases/compiler/declarationEmitDefaultExportWithTempVarName.ts @@ -0,0 +1,4 @@ +// @declaration: true +// @module: system +// @Filename: pi.ts +export default 3.14159; \ No newline at end of file diff --git a/tests/cases/compiler/declarationEmitDefaultExportWithTempVarNameWithBundling.ts b/tests/cases/compiler/declarationEmitDefaultExportWithTempVarNameWithBundling.ts new file mode 100644 index 00000000000..6bd5320f3fe --- /dev/null +++ b/tests/cases/compiler/declarationEmitDefaultExportWithTempVarNameWithBundling.ts @@ -0,0 +1,6 @@ +// @declaration: true +// @module: system +// @outFile: app.js + +// @Filename: pi.ts +export default 3.14159; \ No newline at end of file diff --git a/tests/cases/compiler/modularizeLibrary_ErrorFromUsingES6ArrayWithOnlyES6ArrayLib.ts b/tests/cases/compiler/modularizeLibrary_ErrorFromUsingES6ArrayWithOnlyES6ArrayLib.ts new file mode 100644 index 00000000000..3f6b9a5e35a --- /dev/null +++ b/tests/cases/compiler/modularizeLibrary_ErrorFromUsingES6ArrayWithOnlyES6ArrayLib.ts @@ -0,0 +1,9 @@ +// @lib: es2015.core +// @target: es5 + +// Error missing basic JavaScript objects +function f(x: number, y: number, z: number) { + return Array.from(arguments); +} + +f(1, 2, 3); diff --git a/tests/cases/compiler/modularizeLibrary_ErrorFromUsingES6FeaturesWithOnlyES5Lib.ts b/tests/cases/compiler/modularizeLibrary_ErrorFromUsingES6FeaturesWithOnlyES5Lib.ts new file mode 100644 index 00000000000..290cf0e4211 --- /dev/null +++ b/tests/cases/compiler/modularizeLibrary_ErrorFromUsingES6FeaturesWithOnlyES5Lib.ts @@ -0,0 +1,57 @@ +// @lib: es5 +// @target: es6 + +// All will be error from using ES6 features but only include ES5 library +// Using Es6 array +function f(x: number, y: number, z: number) { + return Array.from(arguments); +} + +f(1, 2, 3); // no error + +// Using ES6 collection +var m = new Map(); +m.clear(); +// Using ES6 iterable +m.keys(); + +// Using ES6 function +function Baz() { } +Baz.name; + +// Using ES6 math +Math.sign(1); + +// Using ES6 object +var o = { + a: 2, + [Symbol.hasInstance](value: any) { + return false; + } +}; +o.hasOwnProperty(Symbol.hasInstance); + +// Using Es6 proxy +var t = {} +var p = new Proxy(t, {}); + +// Using ES6 reflect +Reflect.isExtensible({}); + +// Using Es6 regexp +var reg = new RegExp("/s"); +reg.flags; + +// Using ES6 string +var str = "Hello world"; +str.includes("hello", 0); + +// Using ES6 symbol +var s = Symbol(); + +// Using ES6 wellknown-symbol +const o1 = { + [Symbol.hasInstance](value: any) { + return false; + } +} \ No newline at end of file diff --git a/tests/cases/compiler/modularizeLibrary_ErrorFromUsingWellknownSymbolWithOutES6WellknownSymbolLib.ts b/tests/cases/compiler/modularizeLibrary_ErrorFromUsingWellknownSymbolWithOutES6WellknownSymbolLib.ts new file mode 100644 index 00000000000..c3e1d616ea5 --- /dev/null +++ b/tests/cases/compiler/modularizeLibrary_ErrorFromUsingWellknownSymbolWithOutES6WellknownSymbolLib.ts @@ -0,0 +1,9 @@ +// @lib: es5,es2015.core + +function f(x: number, y: number, z: number) { + return Array.from(arguments); +} + +f(1, 2, 3); // no error +let a = ['c', 'd']; +a[Symbol.isConcatSpreadable] = false; \ No newline at end of file diff --git a/tests/cases/compiler/modularizeLibrary_NoErrorDuplicateLibOptions1.ts b/tests/cases/compiler/modularizeLibrary_NoErrorDuplicateLibOptions1.ts new file mode 100644 index 00000000000..4b2a88c1320 --- /dev/null +++ b/tests/cases/compiler/modularizeLibrary_NoErrorDuplicateLibOptions1.ts @@ -0,0 +1,83 @@ +// @lib: es5,es6,es6 +// @target: es6 + +// Using Es6 array +function f(x: number, y: number, z: number) { + return Array.from(arguments); +} + +f(1, 2, 3); // no error + +// Using ES6 collection +var m = new Map(); +m.clear(); +// Using ES6 iterable +m.keys(); + +// Using ES6 function +function Baz() { } +Baz.name; + +// Using ES6 generator +function* gen() { + let i = 0; + while (i < 10) { + yield i; + i++; + } +} + +function* gen2() { + let i = 0; + while (i < 10) { + yield i; + i++; + } +} + +// Using ES6 math +Math.sign(1); + +// Using ES6 object +var o = { + a: 2, + [Symbol.hasInstance](value: any) { + return false; + } +}; +o.hasOwnProperty(Symbol.hasInstance); + +// Using ES6 promise +async function out() { + return new Promise(function (resolve, reject) {}); +} + +declare var console: any; +out().then(() => { + console.log("Yea!"); +}); + +// Using Es6 proxy +var t = {} +var p = new Proxy(t, {}); + +// Using ES6 reflect +Reflect.isExtensible({}); + +// Using Es6 regexp +var reg = new RegExp("/s"); +reg.flags; + +// Using ES6 string +var str = "Hello world"; +str.includes("hello", 0); + +// Using ES6 symbol +var s = Symbol(); + +// Using ES6 wellknown-symbol +const o1 = { + [Symbol.hasInstance](value: any) { + return false; + } +} \ No newline at end of file diff --git a/tests/cases/compiler/modularizeLibrary_NoErrorDuplicateLibOptions2.ts b/tests/cases/compiler/modularizeLibrary_NoErrorDuplicateLibOptions2.ts new file mode 100644 index 00000000000..9ddfac81223 --- /dev/null +++ b/tests/cases/compiler/modularizeLibrary_NoErrorDuplicateLibOptions2.ts @@ -0,0 +1,83 @@ +// @lib: es5,es2015,es2015.core,es2015.symbol.wellknown +// @target: es6 + +// Using Es6 array +function f(x: number, y: number, z: number) { + return Array.from(arguments); +} + +f(1, 2, 3); // no error + +// Using ES6 collection +var m = new Map(); +m.clear(); +// Using ES6 iterable +m.keys(); + +// Using ES6 function +function Baz() { } +Baz.name; + +// Using ES6 generator +function* gen() { + let i = 0; + while (i < 10) { + yield i; + i++; + } +} + +function* gen2() { + let i = 0; + while (i < 10) { + yield i; + i++; + } +} + +// Using ES6 math +Math.sign(1); + +// Using ES6 object +var o = { + a: 2, + [Symbol.hasInstance](value: any) { + return false; + } +}; +o.hasOwnProperty(Symbol.hasInstance); + +// Using ES6 promise +async function out() { + return new Promise(function (resolve, reject) {}); +} + +declare var console: any; +out().then(() => { + console.log("Yea!"); +}); + +// Using Es6 proxy +var t = {} +var p = new Proxy(t, {}); + +// Using ES6 reflect +Reflect.isExtensible({}); + +// Using Es6 regexp +var reg = new RegExp("/s"); +reg.flags; + +// Using ES6 string +var str = "Hello world"; +str.includes("hello", 0); + +// Using ES6 symbol +var s = Symbol(); + +// Using ES6 wellknown-symbol +const o1 = { + [Symbol.hasInstance](value: any) { + return false; + } +} \ No newline at end of file diff --git a/tests/cases/compiler/modularizeLibrary_TargetES5UsingES6Lib.ts b/tests/cases/compiler/modularizeLibrary_TargetES5UsingES6Lib.ts new file mode 100644 index 00000000000..e308912757b --- /dev/null +++ b/tests/cases/compiler/modularizeLibrary_TargetES5UsingES6Lib.ts @@ -0,0 +1,83 @@ +// @lib: es5,es6 +// @target: es6 + +// Using Es6 array +function f(x: number, y: number, z: number) { + return Array.from(arguments); +} + +f(1, 2, 3); // no error + +// Using ES6 collection +var m = new Map(); +m.clear(); +// Using ES6 iterable +m.keys(); + +// Using ES6 function +function Baz() { } +Baz.name; + +// Using ES6 generator +function* gen() { + let i = 0; + while (i < 10) { + yield i; + i++; + } +} + +function* gen2() { + let i = 0; + while (i < 10) { + yield i; + i++; + } +} + +// Using ES6 math +Math.sign(1); + +// Using ES6 object +var o = { + a: 2, + [Symbol.hasInstance](value: any) { + return false; + } +}; +o.hasOwnProperty(Symbol.hasInstance); + +// Using ES6 promise +async function out() { + return new Promise(function (resolve, reject) {}); +} + +declare var console: any; +out().then(() => { + console.log("Yea!"); +}); + +// Using Es6 proxy +var t = {} +var p = new Proxy(t, {}); + +// Using ES6 reflect +Reflect.isExtensible({}); + +// Using Es6 regexp +var reg = new RegExp("/s"); +reg.flags; + +// Using ES6 string +var str = "Hello world"; +str.includes("hello", 0); + +// Using ES6 symbol +var s = Symbol(); + +// Using ES6 wellknown-symbol +const o1 = { + [Symbol.hasInstance](value: any) { + return false; + } +} \ No newline at end of file diff --git a/tests/cases/compiler/modularizeLibrary_TargetES6UsingES6Lib.ts b/tests/cases/compiler/modularizeLibrary_TargetES6UsingES6Lib.ts new file mode 100644 index 00000000000..3a938fe1a69 --- /dev/null +++ b/tests/cases/compiler/modularizeLibrary_TargetES6UsingES6Lib.ts @@ -0,0 +1,56 @@ +// @lib: es6 +// @target: es6 + +// Using Es6 array +function f(x: number, y: number, z: number) { + return Array.from(arguments); +} + +f(1, 2, 3); // no error + +// Using ES6 collection +var m = new Map(); +m.clear(); +// Using ES6 iterable +m.keys(); + +// Using ES6 function +function Baz() { } +Baz.name; + +// Using ES6 math +Math.sign(1); + +// Using ES6 object +var o = { + a: 2, + [Symbol.hasInstance](value: any) { + return false; + } +}; +o.hasOwnProperty(Symbol.hasInstance); + +// Using Es6 proxy +var t = {} +var p = new Proxy(t, {}); + +// Using ES6 reflect +Reflect.isExtensible({}); + +// Using Es6 regexp +var reg = new RegExp("/s"); +reg.flags; + +// Using ES6 string +var str = "Hello world"; +str.includes("hello", 0); + +// Using ES6 symbol +var s = Symbol(); + +// Using ES6 wellknown-symbol +const o1 = { + [Symbol.hasInstance](value: any) { + return false; + } +} \ No newline at end of file diff --git a/tests/cases/compiler/modularizeLibrary_UsingES5LibAndES6ArrayLib.ts b/tests/cases/compiler/modularizeLibrary_UsingES5LibAndES6ArrayLib.ts new file mode 100644 index 00000000000..b7697af1f7f --- /dev/null +++ b/tests/cases/compiler/modularizeLibrary_UsingES5LibAndES6ArrayLib.ts @@ -0,0 +1,9 @@ +// @lib: es5,es2015.core +// @target: es5 + +// No error +function f(x: number, y: number, z: number) { + return Array.from(arguments); +} + +f(1, 2, 3); \ No newline at end of file diff --git a/tests/cases/compiler/modularizeLibrary_UsingES5LibAndES6FeatureLibs.ts b/tests/cases/compiler/modularizeLibrary_UsingES5LibAndES6FeatureLibs.ts new file mode 100644 index 00000000000..327df2e679f --- /dev/null +++ b/tests/cases/compiler/modularizeLibrary_UsingES5LibAndES6FeatureLibs.ts @@ -0,0 +1,15 @@ +// @lib: es5,es2015.core,es2015.symbol,es2015.proxy,es2015.generator,es2015.iterable,es2015.reflect +// @target: es6 + +var s = Symbol(); +var t = {}; +var p = new Proxy(t, {}); + +Reflect.ownKeys({}); + +function* idGen() { + let i = 10; + while (i < 20) { + yield i + 2; + } +} diff --git a/tests/cases/compiler/modularizeLibrary_UsingES5LibES6ArrayLibES6WellknownSymbolLib.ts b/tests/cases/compiler/modularizeLibrary_UsingES5LibES6ArrayLibES6WellknownSymbolLib.ts new file mode 100644 index 00000000000..51a0ee5d1f5 --- /dev/null +++ b/tests/cases/compiler/modularizeLibrary_UsingES5LibES6ArrayLibES6WellknownSymbolLib.ts @@ -0,0 +1,9 @@ +// @lib: es5,es2015.core,es2015.symbol.wellknown + +function f(x: number, y: number, z: number) { + return Array.from(arguments); +} + +f(1, 2, 3); // no error +let a = ['c', 'd']; +a[Symbol.isConcatSpreadable] = false; \ No newline at end of file diff --git a/tests/cases/compiler/noImplicitAnyDestructuringInPrivateMethod.ts b/tests/cases/compiler/noImplicitAnyDestructuringInPrivateMethod.ts new file mode 100644 index 00000000000..b6ff1fa6969 --- /dev/null +++ b/tests/cases/compiler/noImplicitAnyDestructuringInPrivateMethod.ts @@ -0,0 +1,13 @@ +// @noimplicitany: true +// @declaration: true +type Arg = { + a: number; +}; +export class Bar { + private bar({ a, }: Arg): number { + return a; + } +} +export declare class Bar2 { + private bar({ a, }); +} \ No newline at end of file diff --git a/tests/cases/compiler/noImplicitAnyDestructuringParameterDeclaration.ts b/tests/cases/compiler/noImplicitAnyDestructuringParameterDeclaration.ts new file mode 100644 index 00000000000..9f4e579dcff --- /dev/null +++ b/tests/cases/compiler/noImplicitAnyDestructuringParameterDeclaration.ts @@ -0,0 +1,11 @@ +// @noimplicitany: true +function f1([a], {b}, c, d) { // error +} +function f2([a = undefined], {b = null}, c = undefined, d = null) { // error +} +function f3([a]: [any], {b}: { b: any }, c: any, d: any) { +} +function f4({b}: { b }, x: { b }) { // error in type instead +} +function f5([a1] = [undefined], {b1} = { b1: null }, c1 = undefined, d1 = null) { // error +} \ No newline at end of file diff --git a/tests/cases/compiler/noImplicitAnyDestructuringVarDeclaration.ts b/tests/cases/compiler/noImplicitAnyDestructuringVarDeclaration.ts new file mode 100644 index 00000000000..6988416d4de --- /dev/null +++ b/tests/cases/compiler/noImplicitAnyDestructuringVarDeclaration.ts @@ -0,0 +1,10 @@ +// @noimplicitany: true +var [a], {b}, c, d; // error + +var [a1 = undefined], {b1 = null}, c1 = undefined, d1 = null; // error + +var [a2]: [any], {b2}: { b2: any }, c2: any, d2: any; + +var {b3}: { b3 }, c3: { b3 }; // error in type instead + +var [a1] = [undefined], {b1} = { b1: null }, c1 = undefined, d1 = null; // error \ No newline at end of file diff --git a/tests/cases/compiler/noImplicitThisFunctions.ts b/tests/cases/compiler/noImplicitThisFunctions.ts new file mode 100644 index 00000000000..45f0e5a1eb9 --- /dev/null +++ b/tests/cases/compiler/noImplicitThisFunctions.ts @@ -0,0 +1,19 @@ +// @noImplicitThis: true + +function f1(x) { + // implicit any is still allowed + return x + 1; +} + +function f2(y: number) { + // ok: no reference to this + return y + 1; +} + +function f3(z: number): number { + // error: this is implicitly any + return this.a + z; +} + +// error: `this` is `window`, but is still of type `any` +let f4: (b: number) => number = b => this.c + b; diff --git a/tests/cases/compiler/pathMappingBasedModuleResolution1_classic.ts b/tests/cases/compiler/pathMappingBasedModuleResolution1_classic.ts index 20845a49372..054d6ed8a0b 100644 --- a/tests/cases/compiler/pathMappingBasedModuleResolution1_classic.ts +++ b/tests/cases/compiler/pathMappingBasedModuleResolution1_classic.ts @@ -1,5 +1,5 @@ // @module: amd -// @traceModuleResolution: true +// @traceResolution: true // paths should error in the absence of baseurl diff --git a/tests/cases/compiler/pathMappingBasedModuleResolution1_node.ts b/tests/cases/compiler/pathMappingBasedModuleResolution1_node.ts index 392e85bd7c3..a0ce95f2c1a 100644 --- a/tests/cases/compiler/pathMappingBasedModuleResolution1_node.ts +++ b/tests/cases/compiler/pathMappingBasedModuleResolution1_node.ts @@ -1,5 +1,5 @@ // @module: commonjs -// @traceModuleResolution: true +// @traceResolution: true // paths should error in the absence of baseurl // @filename: c:/root/tsconfig.json diff --git a/tests/cases/compiler/pathMappingBasedModuleResolution2_classic.ts b/tests/cases/compiler/pathMappingBasedModuleResolution2_classic.ts index 6c84a197eeb..f24e857fa41 100644 --- a/tests/cases/compiler/pathMappingBasedModuleResolution2_classic.ts +++ b/tests/cases/compiler/pathMappingBasedModuleResolution2_classic.ts @@ -1,5 +1,5 @@ // @module: amd -// @traceModuleResolution: true +// @traceResolution: true // baseurl is defined in tsconfig.json // paths has errors diff --git a/tests/cases/compiler/pathMappingBasedModuleResolution2_node.ts b/tests/cases/compiler/pathMappingBasedModuleResolution2_node.ts index 78ef7215e73..ac4d51bacf5 100644 --- a/tests/cases/compiler/pathMappingBasedModuleResolution2_node.ts +++ b/tests/cases/compiler/pathMappingBasedModuleResolution2_node.ts @@ -1,5 +1,5 @@ // @module: commonjs -// @traceModuleResolution: true +// @traceResolution: true // baseurl is defined in tsconfig.json // paths has errors diff --git a/tests/cases/compiler/pathMappingBasedModuleResolution3_classic.ts b/tests/cases/compiler/pathMappingBasedModuleResolution3_classic.ts index d46308d089f..350346adebc 100644 --- a/tests/cases/compiler/pathMappingBasedModuleResolution3_classic.ts +++ b/tests/cases/compiler/pathMappingBasedModuleResolution3_classic.ts @@ -1,7 +1,7 @@ // @moduleResolution: classic // @module: amd // @baseUrl: c:/root -// @traceModuleResolution: true +// @traceResolution: true // baseUrl set via command line diff --git a/tests/cases/compiler/pathMappingBasedModuleResolution3_node.ts b/tests/cases/compiler/pathMappingBasedModuleResolution3_node.ts index 30e95c9303e..6cab1df06b0 100644 --- a/tests/cases/compiler/pathMappingBasedModuleResolution3_node.ts +++ b/tests/cases/compiler/pathMappingBasedModuleResolution3_node.ts @@ -1,7 +1,7 @@ // @moduleResolution: node // @module: commonjs // @baseUrl: c:/root -// @traceModuleResolution: true +// @traceResolution: true // baseUrl set via command line diff --git a/tests/cases/compiler/pathMappingBasedModuleResolution4_classic.ts b/tests/cases/compiler/pathMappingBasedModuleResolution4_classic.ts index 723de05b70c..fbf11e61716 100644 --- a/tests/cases/compiler/pathMappingBasedModuleResolution4_classic.ts +++ b/tests/cases/compiler/pathMappingBasedModuleResolution4_classic.ts @@ -1,6 +1,6 @@ // @moduleResolution: classic // @module: amd -// @traceModuleResolution: true +// @traceResolution: true // baseUrl set via command line diff --git a/tests/cases/compiler/pathMappingBasedModuleResolution4_node.ts b/tests/cases/compiler/pathMappingBasedModuleResolution4_node.ts index e68635e205e..cfb90ca1cc5 100644 --- a/tests/cases/compiler/pathMappingBasedModuleResolution4_node.ts +++ b/tests/cases/compiler/pathMappingBasedModuleResolution4_node.ts @@ -1,6 +1,6 @@ // @moduleResolution: node // @module: commonjs -// @traceModuleResolution: true +// @traceResolution: true // baseUrl set via command line diff --git a/tests/cases/compiler/pathMappingBasedModuleResolution5_classic.ts b/tests/cases/compiler/pathMappingBasedModuleResolution5_classic.ts index a7662688e37..9779f0ca644 100644 --- a/tests/cases/compiler/pathMappingBasedModuleResolution5_classic.ts +++ b/tests/cases/compiler/pathMappingBasedModuleResolution5_classic.ts @@ -1,5 +1,5 @@ // @module: amd -// @traceModuleResolution: true +// @traceResolution: true // paths is defined in tsconfig.json // @filename: c:/root/tsconfig.json diff --git a/tests/cases/compiler/pathMappingBasedModuleResolution5_node.ts b/tests/cases/compiler/pathMappingBasedModuleResolution5_node.ts index ef5ef0afd6a..3606ab08cd1 100644 --- a/tests/cases/compiler/pathMappingBasedModuleResolution5_node.ts +++ b/tests/cases/compiler/pathMappingBasedModuleResolution5_node.ts @@ -1,5 +1,5 @@ // @module: commonjs -// @traceModuleResolution: true +// @traceResolution: true // paths is defined in tsconfig.json // @filename: c:/root/tsconfig.json diff --git a/tests/cases/compiler/pathMappingBasedModuleResolution6_classic.ts b/tests/cases/compiler/pathMappingBasedModuleResolution6_classic.ts index adaba8478c9..5ce4bd2a18f 100644 --- a/tests/cases/compiler/pathMappingBasedModuleResolution6_classic.ts +++ b/tests/cases/compiler/pathMappingBasedModuleResolution6_classic.ts @@ -1,5 +1,5 @@ // @module: amd -// @traceModuleResolution: true +// @traceResolution: true // @filename: c:/root/src/tsconfig.json { diff --git a/tests/cases/compiler/pathMappingBasedModuleResolution6_node.ts b/tests/cases/compiler/pathMappingBasedModuleResolution6_node.ts index a3d0feadf7c..29a82e5412d 100644 --- a/tests/cases/compiler/pathMappingBasedModuleResolution6_node.ts +++ b/tests/cases/compiler/pathMappingBasedModuleResolution6_node.ts @@ -1,5 +1,5 @@ // @module: commonjs -// @traceModuleResolution: true +// @traceResolution: true // @filename: c:/root/src/tsconfig.json { diff --git a/tests/cases/compiler/pathMappingBasedModuleResolution7_classic.ts b/tests/cases/compiler/pathMappingBasedModuleResolution7_classic.ts index af092df5ce9..81c2328df67 100644 --- a/tests/cases/compiler/pathMappingBasedModuleResolution7_classic.ts +++ b/tests/cases/compiler/pathMappingBasedModuleResolution7_classic.ts @@ -1,5 +1,5 @@ // @module: amd -// @traceModuleResolution: true +// @traceResolution: true // @filename: c:/root/src/tsconfig.json { diff --git a/tests/cases/compiler/pathMappingBasedModuleResolution7_node.ts b/tests/cases/compiler/pathMappingBasedModuleResolution7_node.ts index faecbe4adb9..1ba9630e0cf 100644 --- a/tests/cases/compiler/pathMappingBasedModuleResolution7_node.ts +++ b/tests/cases/compiler/pathMappingBasedModuleResolution7_node.ts @@ -1,5 +1,5 @@ // @module: commonjs -// @traceModuleResolution: true +// @traceResolution: true // @filename: c:/root/src/tsconfig.json { diff --git a/tests/cases/compiler/typeReferenceDirectives1.ts b/tests/cases/compiler/typeReferenceDirectives1.ts new file mode 100644 index 00000000000..2127bd13f7b --- /dev/null +++ b/tests/cases/compiler/typeReferenceDirectives1.ts @@ -0,0 +1,14 @@ +// @noImplicitReferences: true +// @traceResolution: true +// @declaration: true +// @typesRoot: / + + +// @filename: /types/lib/index.d.ts +interface $ { x } + +// @filename: /app.ts +/// +interface A { + x: $ +} \ No newline at end of file diff --git a/tests/cases/compiler/typeReferenceDirectives10.ts b/tests/cases/compiler/typeReferenceDirectives10.ts new file mode 100644 index 00000000000..bf0768993c9 --- /dev/null +++ b/tests/cases/compiler/typeReferenceDirectives10.ts @@ -0,0 +1,17 @@ +// @noImplicitReferences: true +// @declaration: true +// @typesRoot: / +// @traceResolution: true + +// @filename: /ref.d.ts +export interface $ { x } + +// @filename: /types/lib/index.d.ts +declare let $: { x: number } + +// @filename: /app.ts +/// +import {$} from "./ref"; +export interface A { + x: $ +} diff --git a/tests/cases/compiler/typeReferenceDirectives11.ts b/tests/cases/compiler/typeReferenceDirectives11.ts new file mode 100644 index 00000000000..c955a5daffc --- /dev/null +++ b/tests/cases/compiler/typeReferenceDirectives11.ts @@ -0,0 +1,19 @@ +// @noImplicitReferences: true +// @declaration: true +// @typesRoot: / +// @traceResolution: true +// @types: lib +// @out: output.js + +// @filename: /types/lib/index.d.ts + +interface Lib { x } + +// @filename: /mod1.ts + +export function foo(): Lib { return {x: 1} } + +// @filename: /mod2.ts + +import {foo} from "./mod1"; +export const bar = foo(); \ No newline at end of file diff --git a/tests/cases/compiler/typeReferenceDirectives12.ts b/tests/cases/compiler/typeReferenceDirectives12.ts new file mode 100644 index 00000000000..ef3c8d9755f --- /dev/null +++ b/tests/cases/compiler/typeReferenceDirectives12.ts @@ -0,0 +1,37 @@ +// @noImplicitReferences: true +// @declaration: true +// @typesRoot: / +// @traceResolution: true +// @out: output.js + +// @filename: /types/lib/index.d.ts + +interface Lib { x } + +// @filename: /main.ts +export class Cls { + x +} + +// @filename: /mod1.ts +/// + +import {Cls} from "./main"; +Cls.prototype.foo = function() { return undefined; } + +declare module "./main" { + interface Cls { + foo(): Lib; + } + namespace Cls { + function bar(): Lib; + } +} + +// @filename: /mod2.ts +import { Cls } from "./main"; +import "./mod1"; + +export const cls = Cls; +export const foo = new Cls().foo(); +export const bar = Cls.bar(); \ No newline at end of file diff --git a/tests/cases/compiler/typeReferenceDirectives13.ts b/tests/cases/compiler/typeReferenceDirectives13.ts new file mode 100644 index 00000000000..816d419e9d5 --- /dev/null +++ b/tests/cases/compiler/typeReferenceDirectives13.ts @@ -0,0 +1,17 @@ +// @noImplicitReferences: true +// @declaration: true +// @typesRoot: / +// @traceResolution: true + +// @filename: /ref.d.ts +export interface $ { x } + +// @filename: /types/lib/index.d.ts +declare let $: { x: number } + +// @filename: /app.ts +/// +import {$} from "./ref"; +export interface A { + x: () => typeof $ +} diff --git a/tests/cases/compiler/typeReferenceDirectives2.ts b/tests/cases/compiler/typeReferenceDirectives2.ts new file mode 100644 index 00000000000..eb651728cea --- /dev/null +++ b/tests/cases/compiler/typeReferenceDirectives2.ts @@ -0,0 +1,13 @@ +// @noImplicitReferences: true +// @traceResolution: true +// @declaration: true +// @typesRoot: / +// @types: lib + +// @filename: /types/lib/index.d.ts +interface $ { x } + +// @filename: /app.ts +interface A { + x: $ +} \ No newline at end of file diff --git a/tests/cases/compiler/typeReferenceDirectives3.ts b/tests/cases/compiler/typeReferenceDirectives3.ts new file mode 100644 index 00000000000..bf81268d141 --- /dev/null +++ b/tests/cases/compiler/typeReferenceDirectives3.ts @@ -0,0 +1,19 @@ +// @noImplicitReferences: true +// @declaration: true +// @typesRoot: / +// @traceResolution: true + +// $ comes from d.ts file - no need to add type reference directive + +// @filename: /ref.d.ts +interface $ { x } + +// @filename: /types/lib/index.d.ts +declare let $: { x: number } + +// @filename: /app.ts +/// +/// +interface A { + x: () => $ +} \ No newline at end of file diff --git a/tests/cases/compiler/typeReferenceDirectives4.ts b/tests/cases/compiler/typeReferenceDirectives4.ts new file mode 100644 index 00000000000..48eb8a5324a --- /dev/null +++ b/tests/cases/compiler/typeReferenceDirectives4.ts @@ -0,0 +1,20 @@ +// @noImplicitReferences: true +// @traceResolution: true +// @declaration: true +// @typesRoot: / + +// $ comes from d.ts file - no need to add type reference directive + +// @filename: /ref.d.ts +interface $ { x } + +// @filename: /types/lib/index.d.ts +declare let $: { x: number } + + +// @filename: /app.ts +/// +/// + +let x: $; +let y = () => x \ No newline at end of file diff --git a/tests/cases/compiler/typeReferenceDirectives5.ts b/tests/cases/compiler/typeReferenceDirectives5.ts new file mode 100644 index 00000000000..675f932da68 --- /dev/null +++ b/tests/cases/compiler/typeReferenceDirectives5.ts @@ -0,0 +1,17 @@ +// @noImplicitReferences: true +// @traceResolution: true +// @declaration: true +// @typesRoot: / + +// @filename: /ref.d.ts +export interface $ { x } + +// @filename: /types/lib/index.d.ts +declare let $: { x: number } + +// @filename: /app.ts +/// +import {$} from "./ref"; +export interface A { + x: typeof $; +} \ No newline at end of file diff --git a/tests/cases/compiler/typeReferenceDirectives6.ts b/tests/cases/compiler/typeReferenceDirectives6.ts new file mode 100644 index 00000000000..120a743009c --- /dev/null +++ b/tests/cases/compiler/typeReferenceDirectives6.ts @@ -0,0 +1,21 @@ +// @noImplicitReferences: true +// @traceResolution: true +// @declaration: true +// @typesRoot: / + +// $ comes from type declaration file - type reference directive should be added + +// @filename: /ref.d.ts +declare let $: { x: number } + +// @filename: /types/lib/index.d.ts +interface $ { x } + + +// @filename: /app.ts +/// +/// + +let x: $; +let y = () => x + diff --git a/tests/cases/compiler/typeReferenceDirectives7.ts b/tests/cases/compiler/typeReferenceDirectives7.ts new file mode 100644 index 00000000000..f18fed37741 --- /dev/null +++ b/tests/cases/compiler/typeReferenceDirectives7.ts @@ -0,0 +1,18 @@ +// @noImplicitReferences: true +// @traceResolution: true +// @declaration: true +// @typesRoot: / + +// local value shadows global - no need to add type reference directive + +// @filename: /types/lib/index.d.ts +declare let $: { x: number } + + +// @filename: /app.ts +/// + +export let $ = 1; + +export let x: typeof $; +export let y = () => x \ No newline at end of file diff --git a/tests/cases/compiler/typeReferenceDirectives8.ts b/tests/cases/compiler/typeReferenceDirectives8.ts new file mode 100644 index 00000000000..2465d2afb10 --- /dev/null +++ b/tests/cases/compiler/typeReferenceDirectives8.ts @@ -0,0 +1,18 @@ +// @noImplicitReferences: true +// @declaration: true +// @typesRoot: / +// @traceResolution: true +// @types: lib + +// @filename: /types/lib/index.d.ts + +interface Lib { x } + +// @filename: /mod1.ts + +export function foo(): Lib { return {x: 1} } + +// @filename: /mod2.ts + +import {foo} from "./mod1"; +export const bar = foo(); \ No newline at end of file diff --git a/tests/cases/compiler/typeReferenceDirectives9.ts b/tests/cases/compiler/typeReferenceDirectives9.ts new file mode 100644 index 00000000000..eb8d6abaef1 --- /dev/null +++ b/tests/cases/compiler/typeReferenceDirectives9.ts @@ -0,0 +1,36 @@ +// @noImplicitReferences: true +// @declaration: true +// @typesRoot: / +// @traceResolution: true + +// @filename: /types/lib/index.d.ts + +interface Lib { x } + +// @filename: /main.ts +export class Cls { + x +} + +// @filename: /mod1.ts +/// + +import {Cls} from "./main"; +Cls.prototype.foo = function() { return undefined; } + +declare module "./main" { + interface Cls { + foo(): Lib; + } + namespace Cls { + function bar(): Lib; + } +} + +// @filename: /mod2.ts +import { Cls } from "./main"; +import "./mod1"; + +export const cls = Cls; +export const foo = new Cls().foo(); +export const bar = Cls.bar(); \ No newline at end of file diff --git a/tests/cases/compiler/useStrictLikePrologueString01.ts b/tests/cases/compiler/useStrictLikePrologueString01.ts new file mode 100644 index 00000000000..b76e38ebb06 --- /dev/null +++ b/tests/cases/compiler/useStrictLikePrologueString01.ts @@ -0,0 +1,7 @@ +//@target: commonjs +//@target: es5 + +"hey!" +" use strict " +export function f() { +} \ No newline at end of file diff --git a/tests/cases/conformance/expressions/thisKeyword/thisInObjectLiterals.ts b/tests/cases/conformance/expressions/thisKeyword/thisInObjectLiterals.ts index da38484bc07..ddfbb790980 100644 --- a/tests/cases/conformance/expressions/thisKeyword/thisInObjectLiterals.ts +++ b/tests/cases/conformance/expressions/thisKeyword/thisInObjectLiterals.ts @@ -8,7 +8,7 @@ class MyClass { } } -//type of 'this' in an object literal property of a function type is Any +//type of 'this' in an object literal method is the type of the object literal var obj = { f() { return this.spaaace; diff --git a/tests/cases/conformance/references/library-reference-1.ts b/tests/cases/conformance/references/library-reference-1.ts new file mode 100644 index 00000000000..ca25441521f --- /dev/null +++ b/tests/cases/conformance/references/library-reference-1.ts @@ -0,0 +1,13 @@ +// @noImplicitReferences: true +// @traceResolution: true +// @typesRoot: / + +// We can find typings in the ./types folder + +// @filename: /types/jquery/index.d.ts +declare var $: { foo(): void }; + + +// @filename: /consumer.ts +/// +$.foo(); diff --git a/tests/cases/conformance/references/library-reference-10.ts b/tests/cases/conformance/references/library-reference-10.ts new file mode 100644 index 00000000000..11e065b0a7d --- /dev/null +++ b/tests/cases/conformance/references/library-reference-10.ts @@ -0,0 +1,18 @@ +// @noImplicitReferences: true +// @traceResolution: true +// @typesRoot: / + +// package.json in a primary reference can refer to another file + +// @filename: /types/jquery/package.json +{ + "typings": "jquery.d.ts" +} + +// @filename: /types/jquery/jquery.d.ts +declare var $: { foo(): void }; + + +// @filename: /consumer.ts +/// +$.foo(); diff --git a/tests/cases/conformance/references/library-reference-11.ts b/tests/cases/conformance/references/library-reference-11.ts new file mode 100644 index 00000000000..39c8af56543 --- /dev/null +++ b/tests/cases/conformance/references/library-reference-11.ts @@ -0,0 +1,17 @@ +// @noImplicitReferences: true +// @traceResolution: true + +// package.json in a secondary reference can refer to another file + +// @filename: /a/node_modules/jquery/package.json +{ + "typings": "jquery.d.ts" +} + +// @filename: /a/node_modules/jquery/jquery.d.ts +declare var $: { foo(): void }; + + +// @filename: /a/b/consumer.ts +/// +$.foo(); diff --git a/tests/cases/conformance/references/library-reference-12.ts b/tests/cases/conformance/references/library-reference-12.ts new file mode 100644 index 00000000000..c61d6d916ff --- /dev/null +++ b/tests/cases/conformance/references/library-reference-12.ts @@ -0,0 +1,17 @@ +// @noImplicitReferences: true +// @traceResolution: true + +// package.json in a secondary reference can refer to another file + +// @filename: /a/node_modules/jquery/package.json +{ + "types": "dist/jquery.d.ts" +} + +// @filename: /a/node_modules/jquery/dist/jquery.d.ts +declare var $: { foo(): void }; + + +// @filename: /a/b/consumer.ts +/// +$.foo(); diff --git a/tests/cases/conformance/references/library-reference-13.ts b/tests/cases/conformance/references/library-reference-13.ts new file mode 100644 index 00000000000..a96437f9b2c --- /dev/null +++ b/tests/cases/conformance/references/library-reference-13.ts @@ -0,0 +1,18 @@ +// @noImplicitReferences: true +// @traceResolution: true + +// load type declarations from types section of tsconfig + +// @filename: /a/tsconfig.json +{ + "compilerOptions": { + "types": [ "jquery" ] + } +} + +// @filename: /a/types/jquery/index.d.ts +declare var $: { foo(): void }; + + +// @filename: /a/b/consumer.ts +$.foo(); diff --git a/tests/cases/conformance/references/library-reference-14.ts b/tests/cases/conformance/references/library-reference-14.ts new file mode 100644 index 00000000000..53bca2ab40d --- /dev/null +++ b/tests/cases/conformance/references/library-reference-14.ts @@ -0,0 +1,11 @@ +// @noImplicitReferences: true +// @traceResolution: true +// @types: jquery +// @typesRoot: /a + +// @filename: /a/types/jquery/index.d.ts +declare var $: { foo(): void }; + + +// @filename: /a/b/consumer.ts +$.foo(); diff --git a/tests/cases/conformance/references/library-reference-15.ts b/tests/cases/conformance/references/library-reference-15.ts new file mode 100644 index 00000000000..92c96e74c97 --- /dev/null +++ b/tests/cases/conformance/references/library-reference-15.ts @@ -0,0 +1,10 @@ +// @noImplicitReferences: true +// @traceResolution: true +// @types: jquery + +// @filename: /a/types/jquery/index.d.ts +declare var $: { foo(): void }; + + +// @filename: /a/b/consumer.ts +$.foo(); diff --git a/tests/cases/conformance/references/library-reference-2.ts b/tests/cases/conformance/references/library-reference-2.ts new file mode 100644 index 00000000000..d8975664428 --- /dev/null +++ b/tests/cases/conformance/references/library-reference-2.ts @@ -0,0 +1,18 @@ +// @noImplicitReferences: true +// @traceResolution: true +// @typesRoot: / + +// package.json in a primary reference can refer to another file + +// @filename: /types/jquery/package.json +{ + "types": "jquery.d.ts" +} + +// @filename: /types/jquery/jquery.d.ts +declare var $: { foo(): void }; + + +// @filename: /consumer.ts +/// +$.foo(); diff --git a/tests/cases/conformance/references/library-reference-3.ts b/tests/cases/conformance/references/library-reference-3.ts new file mode 100644 index 00000000000..1af6df89d19 --- /dev/null +++ b/tests/cases/conformance/references/library-reference-3.ts @@ -0,0 +1,12 @@ +// @noImplicitReferences: true +// @traceResolution: true +// @typesRoot: /src + +// Secondary references are possible + +// @filename: /src/node_modules/jquery/index.d.ts +declare var $: { foo(): void }; + +// @filename: /src/consumer.ts +/// +$.foo(); diff --git a/tests/cases/conformance/references/library-reference-4.ts b/tests/cases/conformance/references/library-reference-4.ts new file mode 100644 index 00000000000..92f1b4008be --- /dev/null +++ b/tests/cases/conformance/references/library-reference-4.ts @@ -0,0 +1,23 @@ +// @noImplicitReferences: true +// @traceResolution: true +// @typesRoot: /src + +// Secondary references may be duplicated if they agree in content + +// @filename: /node_modules/foo/index.d.ts +/// +declare var foo: any; + +// @filename: /node_modules/foo/node_modules/alpha/index.d.ts +declare var alpha: any; + +// @filename: /node_modules/bar/index.d.ts +/// +declare var bar: any; + +// @filename: /node_modules/bar/node_modules/alpha/index.d.ts +declare var alpha: any; + +// @filename: /src/root.ts +/// +/// diff --git a/tests/cases/conformance/references/library-reference-5.ts b/tests/cases/conformance/references/library-reference-5.ts new file mode 100644 index 00000000000..4660da00a2a --- /dev/null +++ b/tests/cases/conformance/references/library-reference-5.ts @@ -0,0 +1,22 @@ +// @noImplicitReferences: true +// @traceResolution: true + +// Secondary references may not be duplicated if they disagree in content + +// @filename: /node_modules/foo/index.d.ts +/// +declare var foo: any; + +// @filename: /node_modules/foo/node_modules/alpha/index.d.ts +declare var alpha: any; + +// @filename: /node_modules/bar/index.d.ts +/// +declare var bar: any; + +// @filename: /node_modules/bar/node_modules/alpha/index.d.ts +declare var alpha: {}; + +// @filename: /src/root.ts +/// +/// diff --git a/tests/cases/conformance/references/library-reference-6.ts b/tests/cases/conformance/references/library-reference-6.ts new file mode 100644 index 00000000000..a746262dd73 --- /dev/null +++ b/tests/cases/conformance/references/library-reference-6.ts @@ -0,0 +1,15 @@ +// @noImplicitReferences: true +// @traceResolution: true + +// The primary lookup folder is relative to tsconfig.json, if present + +// @filename: /types/alpha/index.d.ts +declare var alpha: { a: string }; + +// @filename: /src/foo.ts +/// +var x: string = alpha.a; + +// @filename: /tsconfig.json +{ +} diff --git a/tests/cases/conformance/references/library-reference-7.ts b/tests/cases/conformance/references/library-reference-7.ts new file mode 100644 index 00000000000..e938aef7d3a --- /dev/null +++ b/tests/cases/conformance/references/library-reference-7.ts @@ -0,0 +1,11 @@ +// @noImplicitReferences: true +// @traceResolution: true + +// Secondary references are possible + +// @filename: /src/node_modules/jquery/index.d.ts +declare var $: { foo(): void }; + +// @filename: /src/consumer.ts +/// +$.foo(); diff --git a/tests/cases/conformance/references/library-reference-8.ts b/tests/cases/conformance/references/library-reference-8.ts new file mode 100644 index 00000000000..9de93776989 --- /dev/null +++ b/tests/cases/conformance/references/library-reference-8.ts @@ -0,0 +1,19 @@ +// @noImplicitReferences: true +// @traceResolution: true +// @typesRoot: / + +// Don't crash in circular library reference situations + +// @filename: /types/alpha/index.d.ts +/// +declare var alpha: { a: string }; + +// @filename: /types/beta/index.d.ts +/// +declare var beta: { b: string }; + +// @filename: /foo.ts +/// +/// +var x: string = alpha.a + beta.b; + diff --git a/tests/cases/conformance/references/library-reference-9.ts b/tests/cases/conformance/references/library-reference-9.ts new file mode 100644 index 00000000000..a187d3c23b9 --- /dev/null +++ b/tests/cases/conformance/references/library-reference-9.ts @@ -0,0 +1,20 @@ +// @noImplicitReferences: true +// @traceResolution: true + +// Use types search path + +// @filename: /share/typelib/alpha/index.d.ts +declare var alpha: { a: string }; + +// @filename: /base/src/foo.ts +/// +var x: string = alpha.a; + +// @filename: /tsconfig.json +{ + "compilerOptions": { + "typesSearchPaths": [ + "./share/typelib" + ] + } +} diff --git a/tests/cases/conformance/types/thisType/looseThisTypeInFunctions.ts b/tests/cases/conformance/types/thisType/looseThisTypeInFunctions.ts new file mode 100644 index 00000000000..b151961e324 --- /dev/null +++ b/tests/cases/conformance/types/thisType/looseThisTypeInFunctions.ts @@ -0,0 +1,47 @@ +interface I { + n: number; + explicitThis(this: this, m: number): number; +} +interface Unused { + implicitNoThis(m: number): number; +} +class C implements I { + n: number; + explicitThis(this: this, m: number): number { + return this.n + m; + } + implicitThis(m: number): number { + return this.n + m; + } + explicitVoid(this: void, m: number): number { + return m + 1; + } +} +let c = new C(); +c.explicitVoid = c.explicitThis; // error, 'void' is missing everything +let o = { + n: 101, + explicitThis: function (m: number) { + return m + this.n.length; // ok, this.n: any + }, + implicitThis(m: number): number { return m; } +}; +let i: I = o; +let o2: I = { + n: 1001, + explicitThis: function (m) { + return m + this.n.length; // error, this.n: number, no member 'length' + }, +} +let x = i.explicitThis; +let n = x(12); // callee:void doesn't match this:I +let u: Unused; +let y = u.implicitNoThis; +n = y(12); // ok, callee:void matches this:any +c.explicitVoid = c.implicitThis // ok, implicitThis(this:any) +o.implicitThis = c.implicitThis; // ok, implicitThis(this:any) +o.implicitThis = c.explicitThis; // ok, implicitThis(this:any) is assignable to explicitThis(this: this) +o.implicitThis = i.explicitThis; +i.explicitThis = function(m) { + return this.n.length; // error, this.n: number +} \ No newline at end of file diff --git a/tests/cases/conformance/types/thisType/thisTypeInFunctions.ts b/tests/cases/conformance/types/thisType/thisTypeInFunctions.ts new file mode 100644 index 00000000000..481e1630092 --- /dev/null +++ b/tests/cases/conformance/types/thisType/thisTypeInFunctions.ts @@ -0,0 +1,193 @@ +// body checking +class B { + n: number; +} +class C { + n: number; + explicitThis(this: this, m: number): number { + return this.n + m; + } + explicitC(this: C, m: number): number { + return this.n + m; + } + explicitProperty(this: {n: number}, m: number): number { + return this.n + m; + } + explicitVoid(this: void, m: number): number { + return m + 1; + } +} +class D extends C { } +interface I { + a: number; + explicitVoid1(this: void): number; + explicitVoid2(this: void): number; + explicitStructural(this: {a: number}): number; + explicitInterface(this: I): number; + explicitThis(this: this): number; +} +function explicitStructural(this: { y: number }, x: number): number { + return x + this.y; +} +function justThis(this: { y: number }): number { + return this.y; +} +function implicitThis(n: number): number { + return this.m + n + 12; +} +let impl: I = { + a: 12, + explicitVoid2: () => this.a, // ok, this: any because it refers to some outer object (window?) + explicitVoid1() { return 12; }, + explicitStructural() { + return this.a; + }, + explicitInterface() { + return this.a; + }, + explicitThis() { + return this.a; + }, +} +impl.explicitVoid1 = function () { return 12; }; +impl.explicitVoid2 = () => 12; +impl.explicitStructural = function() { return this.a; }; +impl.explicitInterface = function() { return this.a; }; +impl.explicitStructural = () => 12; +impl.explicitInterface = () => 12; +impl.explicitThis = function () { return this.a; }; +// parameter checking +let ok: {y: number, f: (this: { y: number }, x: number) => number} = { y: 12, f: explicitStructural }; +let implicitAnyOk: {notSpecified: number, f: (x: number) => number} = { notSpecified: 12, f: implicitThis }; +ok.f(13); +implicitThis(12); +implicitAnyOk.f(12); + +let c = new C(); +let d = new D(); +let ripped = c.explicitC; +c.explicitC(12); +c.explicitProperty(12); +c.explicitThis(12); +d.explicitC(12); +d.explicitProperty(12); +d.explicitThis(12); +let reconstructed: { + n: number, + explicitThis(this: C, m: number): number, // note: this: this is not allowed in an object literal type. + explicitC(this: C, m: number): number, + explicitProperty: (this: {n : number}, m: number) => number, + explicitVoid(this: void, m: number): number, +} = { + n: 12, + explicitThis: c.explicitThis, + explicitC: c.explicitC, + explicitProperty: c.explicitProperty, + explicitVoid: c.explicitVoid +}; +reconstructed.explicitThis(10); +reconstructed.explicitProperty(11); +let explicitVoid = reconstructed.explicitVoid; +explicitVoid(12); +// assignment checking +let unboundToSpecified: (this: { y: number }, x: number) => number = x => x + this.y; // ok, this:any +let specifiedToSpecified: (this: {y: number}, x: number) => number = explicitStructural; +let anyToSpecified: (this: { y: number }, x: number) => number = function(x: number): number { return x + 12; }; + +let unspecifiedLambda: (x: number) => number = x => x + 12; +let specifiedLambda: (this: void, x: number) => number = x => x + 12; +let unspecifiedLambdaToSpecified: (this: {y: number}, x: number) => number = unspecifiedLambda; +let specifiedLambdaToSpecified: (this: {y: number}, x: number) => number = specifiedLambda; + + +let explicitCFunction: (this: C, m: number) => number; +let explicitPropertyFunction: (this: {n: number}, m: number) => number; +c.explicitC = explicitCFunction; +c.explicitC = function(this: C, m: number) { return this.n + m }; +c.explicitProperty = explicitPropertyFunction; +c.explicitProperty = function(this: {n: number}, m: number) { return this.n + m }; +c.explicitProperty = reconstructed.explicitProperty; + +// lambdas are assignable to anything +c.explicitC = m => m; +c.explicitThis = m => m; +c.explicitProperty = m => m; + +// this inside lambdas refer to outer scope +// the outer-scoped lambda at top-level is still just `any` +c.explicitC = m => m + this.n; +c.explicitThis = m => m + this.n; +c.explicitProperty = m => m + this.n; + +//NOTE: this=C here, I guess? +c.explicitThis = explicitCFunction; +c.explicitThis = function(this: C, m: number) { return this.n + m }; + +// this:any compatibility +c.explicitC = function(m) { return this.n + m }; +c.explicitProperty = function(m) { return this.n + m }; +c.explicitThis = function(m) { return this.n + m }; + +// this: contextual typing +c.explicitThis = function(this, m) { return this.n + m }; + +// this: superclass compatibility +c.explicitC = function(this: B, m: number) { return this.n + m }; + +// this:void compatibility +c.explicitVoid = n => n; + +// class-based assignability +class Base1 { + x: number; + public polymorphic(this: this): number { return this.x; } + explicit(this: Base1): number { return this.x; } + static explicitStatic(this: typeof Base1): number { return this.y; } + static y: number; +} +class Derived1 extends Base1 { + y: number +} +class Base2 { + y: number + polymorphic(this: this): number { return this.y; } + explicit(this: Base1): number { return this.x; } +} +class Derived2 extends Base2 { + x: number +} +let b1 = new Base1(); +let b2 = new Base2(); +let d1 = new Derived1(); +let d2 = new Derived2(); +d2.polymorphic = d1.polymorphic // ok, 'x' and 'y' in { x, y } +d1.polymorphic = d2.polymorphic // ok, 'x' and 'y' in { x, y } + +// bivariance-allowed cases +d1.polymorphic = b2.polymorphic // ok, 'y' in D: { x, y } +d2.polymorphic = d1.explicit // ok, 'y' in { x, y } +b1.polymorphic = d2.polymorphic // ok, 'x' and 'y' not in Base1: { x } +b1.explicit = d2.polymorphic // ok, 'x' and 'y' not in Base1: { x } + +////// use this-type for construction with new //// +function InterfaceThis(this: I) { + this.a = 12; +} +function LiteralTypeThis(this: {x: string}) { + this.x = "ok"; +} +function AnyThis(this: any) { + this.x = "ok"; +} +let interfaceThis = new InterfaceThis(); +let literalTypeThis = new LiteralTypeThis(); +let anyThis = new AnyThis(); + +//// type parameter inference //// +declare var f: { + (this: void, x: number): number, + call(this: (...argArray: any[]) => U, ...argArray: any[]): U; +}; +let n: number = f.call(12); + +function missingTypeIsImplicitAny(this, a: number) { return this.anything + a; } diff --git a/tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts b/tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts new file mode 100644 index 00000000000..597fe5a836e --- /dev/null +++ b/tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts @@ -0,0 +1,177 @@ +class C { + n: number; + explicitThis(this: this, m: number): number { + return this.n + m; + } + implicitThis(m: number): number { + return this.n + m; + } + explicitC(this: C, m: number): number { + return this.n + m; + } + explicitProperty(this: {n: number}, m: number): number { + return this.n + m; + } + explicitVoid(this: void, m: number): number { + return this.n + m; // 'n' doesn't exist on type 'void'. + } +} +class D { + x: number; + explicitThis(this: this, m: number): number { + return this.x + m; + } + explicitD(this: D, m: number): number { + return this.x + m; + } +} +interface I { + a: number; + explicitVoid1(this: void): number; + explicitVoid2(this: void): number; + explicitStructural(this: {a: number}): number; + explicitInterface(this: I): number; + explicitThis(this: this): number; // TODO: Allow `this` types for interfaces +} +let impl: I = { + a: 12, + explicitVoid1() { + return this.a; // error, no 'a' in 'void' + }, + explicitVoid2: () => this.a, // ok, `this:any` because it refers to an outer object + explicitStructural: () => 12, + explicitInterface: () => 12, + explicitThis() { + return this.a; + }, +} +let implExplicitStructural = impl.explicitStructural; +implExplicitStructural(); // error, no 'a' in 'void' +let implExplicitInterface = impl.explicitInterface; +implExplicitInterface(); // error, no 'a' in 'void' +function explicitStructural(this: { y: number }, x: number): number { + return x + this.y; +} +function propertyName(this: { y: number }, x: number): number { + return x + this.notFound; +} +function voidThisSpecified(this: void, x: number): number { + return x + this.notSpecified; +} +let ok: {y: number, f: (this: { y: number }, x: number) => number} = { y: 12, explicitStructural }; +let wrongPropertyType: {y: string, f: (this: { y: number }, x: number) => number} = { y: 'foo', explicitStructural }; +let wrongPropertyName: {wrongName: number, f: (this: { y: number }, x: number) => number} = { wrongName: 12, explicitStructural }; + +ok.f(); // not enough arguments +ok.f('wrong type'); +ok.f(13, 'too many arguments'); +wrongPropertyType.f(13); +wrongPropertyName.f(13); + +let c = new C(); +c.explicitC(); // not enough arguments +c.explicitC('wrong type'); +c.explicitC(13, 'too many arguments'); +c.explicitThis(); // not enough arguments +c.explicitThis('wrong type 2'); +c.explicitThis(14, 'too many arguments 2'); +c.implicitThis(); // not enough arguments +c.implicitThis('wrong type 2'); +c.implicitThis(14, 'too many arguments 2'); +c.explicitProperty(); // not enough arguments +c.explicitProperty('wrong type 3'); +c.explicitProperty(15, 'too many arguments 3'); + +// oops, this triggers contextual typing, which needs to be updated to understand that =>'s `this` is void. +let specifiedToVoid: (this: void, x: number) => number = explicitStructural; + +let reconstructed: { + n: number, + explicitThis(this: C, m: number): number, // note: this: this is not allowed in an object literal type. + explicitC(this: C, m: number): number, + explicitProperty: (this: {n : number}, m: number) => number, + explicitVoid(this: void, m: number): number, +} = { + n: 12, + explicitThis: c.explicitThis, + explicitC: c.explicitC, + explicitProperty: c.explicitProperty, + explicitVoid: c.explicitVoid +};; + +// lambdas have this: void for assignability purposes (and this unbound (free) for body checking) +let d = new D(); +let explicitXProperty: (this: { x: number }, m: number) => number; + +// from differing object types +c.explicitC = function(this: D, m: number) { return this.x + m }; +c.explicitProperty = explicitXProperty; + +c.explicitC = d.explicitD; +c.explicitC = d.explicitThis; +c.explicitThis = d.explicitD; +c.explicitThis = d.explicitThis; +c.explicitProperty = d.explicitD; +c.explicitThis = d.explicitThis; +c.explicitVoid = d.explicitD; +c.explicitVoid = d.explicitThis; + +/// class-based polymorphic assignability (with inheritance!) /// + +class Base1 { + x: number + public polymorphic(this: this): number { return this.x; } + explicit(this: Base1): number { return this.x; } + static explicitStatic(this: typeof Base1): number { return this.x; } +} +class Derived1 extends Base1 { + y: number +} +class Base2 { + y: number + polymorphic(this: this): number { return this.y; } + explicit(this: Base1): number { return this.x; } +} +class Derived2 extends Base2 { + x: number +} + + +let b1 = new Base1(); +let d1 = new Derived1(); +let b2 = new Base2(); +let d2 = new Derived2(); + +b1.polymorphic = b2.polymorphic // error, 'this.y' not in Base1: { x } +b1.explicit = b2.polymorphic // error, 'y' not in Base1: { x } + +d1.explicit = b2.polymorphic // error, 'y' not in Base1: { x } + +////// use this-type for construction with new //// +function VoidThis(this: void) { + +} +let voidThis = new VoidThis(); + +///// syntax-ish errors ///// +class ThisConstructor { + constructor(this: ThisConstructor, private n: number) { + } + set p(this: void) { + } +} +interface ThisConstructorInterface { + new(this: ThisConstructor, n: number); +} +var thisConstructorType: new (this: number) => number; +function notFirst(a: number, this: C): number { return this.n; } + +///// parse errors ///// +function modifiers(async this: C): number { return this.n; } +function restParam(...this: C): number { return this.n; } +function optional(this?: C): number { return this.n; } +function decorated(@deco() this: C): number { return this.n; } +function initializer(this: C = new C()): number { return this.n; } + +// can't name parameters 'this' in a lambda. +c.explicitProperty = (this, m) => m + this.n; diff --git a/tests/cases/conformance/types/thisType/thisTypeInObjectLiterals.ts b/tests/cases/conformance/types/thisType/thisTypeInObjectLiterals.ts new file mode 100644 index 00000000000..cfdb0883fed --- /dev/null +++ b/tests/cases/conformance/types/thisType/thisTypeInObjectLiterals.ts @@ -0,0 +1,29 @@ +let o = { + d: "bar", + m() { + return this.d.length; + } +} +let mutuallyRecursive = { + a: 100, + start() { + return this.passthrough(this.a); + }, + passthrough(n: number) { + return this.sub1(n); + }, + sub1(n: number): number { + if (n > 0) { + return this.passthrough(n - 1); + } + return n; + } +} +var i: number = mutuallyRecursive.start(); +interface I { + a: number; + start(): number; + passthrough(n: number): number; + sub1(n: number): number; +} +var impl: I = mutuallyRecursive; diff --git a/tests/cases/conformance/types/thisType/unionThisTypeInFunctions.ts b/tests/cases/conformance/types/thisType/unionThisTypeInFunctions.ts new file mode 100644 index 00000000000..4f74058cc48 --- /dev/null +++ b/tests/cases/conformance/types/thisType/unionThisTypeInFunctions.ts @@ -0,0 +1,11 @@ +interface Real { + method(this: this, n: number): void; + data: string; +} +interface Fake { + method(this: this, n: number): void; + data: number; +} +function test(r: Real | Fake) { + r.method(12); +} diff --git a/tests/cases/conformance/types/typeRelationships/comparable/equalityWithIntersectionTypes01.ts b/tests/cases/conformance/types/typeRelationships/comparable/equalityWithIntersectionTypes01.ts new file mode 100644 index 00000000000..74c0ebb7412 --- /dev/null +++ b/tests/cases/conformance/types/typeRelationships/comparable/equalityWithIntersectionTypes01.ts @@ -0,0 +1,24 @@ +interface I1 { + p1: number +} + +interface I2 extends I1 { + p2: number; +} + +interface I3 { + p3: number; +} + +var x = { p1: 10, p2: 20, p3: 30 }; +var y: I1 & I3 = x; +var z: I2 = x; + +if (y === z || z === y) { +} +else if (y !== z || z !== y) { +} +else if (y == z || z == y) { +} +else if (y != z || z != y) { +} \ No newline at end of file diff --git a/tests/cases/conformance/types/typeRelationships/comparable/equalityWithUnionTypes01.ts b/tests/cases/conformance/types/typeRelationships/comparable/equalityWithUnionTypes01.ts new file mode 100644 index 00000000000..d83277b975a --- /dev/null +++ b/tests/cases/conformance/types/typeRelationships/comparable/equalityWithUnionTypes01.ts @@ -0,0 +1,20 @@ +interface I1 { + p1: number +} + +interface I2 extends I1 { + p2: number; +} + +var x = { p1: 10, p2: 20 }; +var y: number | I2 = x; +var z: I1 = x; + +if (y === z || z === y) { +} +else if (y !== z || z !== y) { +} +else if (y == z || z == y) { +} +else if (y != z || z != y) { +} \ No newline at end of file diff --git a/tests/cases/conformance/types/typeRelationships/comparable/switchCaseWithIntersectionTypes01.ts b/tests/cases/conformance/types/typeRelationships/comparable/switchCaseWithIntersectionTypes01.ts new file mode 100644 index 00000000000..fd629306b10 --- /dev/null +++ b/tests/cases/conformance/types/typeRelationships/comparable/switchCaseWithIntersectionTypes01.ts @@ -0,0 +1,25 @@ + +var strAndNum: string & number; +var numAndBool: number & boolean; +var str: string; +var num: number; +var bool: boolean; + +switch (strAndNum) { + // Identical + case strAndNum: + break; + + // Constituents + case str: + case num: + break; + + // Overlap in constituents + case numAndBool: + break; + + // No relation + case bool: + break; +} \ No newline at end of file diff --git a/tests/cases/conformance/types/typeRelationships/comparable/switchCaseWithUnionTypes01.ts b/tests/cases/conformance/types/typeRelationships/comparable/switchCaseWithUnionTypes01.ts new file mode 100644 index 00000000000..bdbfaf2df47 --- /dev/null +++ b/tests/cases/conformance/types/typeRelationships/comparable/switchCaseWithUnionTypes01.ts @@ -0,0 +1,25 @@ + +var strOrNum: string | number; +var numOrBool: number | boolean; +var str: string; +var num: number; +var bool: boolean; + +switch (strOrNum) { + // Identical + case strOrNum: + break; + + // Constituents + case str: + case num: + break; + + // Overlap in constituents + case numOrBool: + break; + + // No relation + case bool: + break; +} \ No newline at end of file diff --git a/tests/cases/conformance/types/typeRelationships/comparable/typeAssertionsWithIntersectionTypes01.ts b/tests/cases/conformance/types/typeRelationships/comparable/typeAssertionsWithIntersectionTypes01.ts new file mode 100644 index 00000000000..1afc760ef85 --- /dev/null +++ b/tests/cases/conformance/types/typeRelationships/comparable/typeAssertionsWithIntersectionTypes01.ts @@ -0,0 +1,20 @@ +interface I1 { + p1: number +} + +interface I2 extends I1 { + p2: number; +} + +interface I3 { + p3: number; +} + +var x = { p1: 10, p2: 20, p3: 30 }; +var y: I1 & I3 = x; +var z: I2 = x; + +var a = z; +var b = z; +var c = z; +var d = y; diff --git a/tests/cases/conformance/types/typeRelationships/comparable/typeAssertionsWithUnionTypes01.ts b/tests/cases/conformance/types/typeRelationships/comparable/typeAssertionsWithUnionTypes01.ts new file mode 100644 index 00000000000..3010c5f159a --- /dev/null +++ b/tests/cases/conformance/types/typeRelationships/comparable/typeAssertionsWithUnionTypes01.ts @@ -0,0 +1,16 @@ +interface I1 { + p1: number +} + +interface I2 extends I1 { + p2: number; +} + +var x = { p1: 10, p2: 20 }; +var y: number | I2 = x; +var z: I1 = x; + +var a = z; +var b = z; +var c = z; +var d = y; diff --git a/tests/cases/fourslash/commentsClassMembers.ts b/tests/cases/fourslash/commentsClassMembers.ts index 54b4f0253d4..d719253a57b 100644 --- a/tests/cases/fourslash/commentsClassMembers.ts +++ b/tests/cases/fourslash/commentsClassMembers.ts @@ -694,7 +694,7 @@ verify.completionListContains("a", "(parameter) a: number", "this is first param verify.quickInfoIs("(parameter) a: number", "this is first parameter a\nmore info about a"); goTo.marker('116'); -verify.quickInfoIs("class cWithConstructorProperty", ""); +verify.quickInfoIs("this: this", ""); goTo.marker('117'); verify.quickInfoIs("(local var) bbbb: number", ""); diff --git a/tests/cases/fourslash/completionInNamedImportLocation.ts b/tests/cases/fourslash/completionInNamedImportLocation.ts new file mode 100644 index 00000000000..596de652cc3 --- /dev/null +++ b/tests/cases/fourslash/completionInNamedImportLocation.ts @@ -0,0 +1,23 @@ +/// + +// @Filename: file.ts +////export var x = 10; +////export var y = 10; +////export default class C { +////} + + +// @Filename: a.ts +////import { /*1*/ } from "./file"; +////import { x, /*2*/ } from "./file"; + +goTo.file("a.ts"); +goTo.marker('1'); +verify.completionListContains("x", "var x: number"); +verify.completionListContains("y", "var y: number"); +verify.not.completionListContains("C"); + +goTo.marker('2'); +verify.not.completionListContains("x", "var x: number"); +verify.completionListContains("y", "var y: number"); +verify.not.completionListContains("C"); \ No newline at end of file diff --git a/tests/cases/fourslash/completionListEnumMembers.ts b/tests/cases/fourslash/completionListEnumMembers.ts index 9c24f6228b0..4f81af5a845 100644 --- a/tests/cases/fourslash/completionListEnumMembers.ts +++ b/tests/cases/fourslash/completionListEnumMembers.ts @@ -21,4 +21,4 @@ verify.memberListCount(0); goTo.marker('enumValueReference'); verify.memberListContains("toString"); verify.memberListContains("toFixed"); -verify.memberListCount(5); +verify.memberListCount(6); diff --git a/tests/cases/fourslash/findAllRefsObjectBindingElementPropertyName03.ts b/tests/cases/fourslash/findAllRefsObjectBindingElementPropertyName03.ts index 304fa9e42e9..8dc2b1e7bb8 100644 --- a/tests/cases/fourslash/findAllRefsObjectBindingElementPropertyName03.ts +++ b/tests/cases/fourslash/findAllRefsObjectBindingElementPropertyName03.ts @@ -6,7 +6,7 @@ ////} //// ////var foo: I; -////var [{ [|property1|]: prop1 }, { property1, property2 } ] = [foo, foo]; +////var [{ [|property1|]: prop1 }, { [|property1|], property2 } ] = [foo, foo]; let ranges = test.ranges(); for (let range of ranges) { diff --git a/tests/cases/fourslash/findAllRefsObjectBindingElementPropertyName04.ts b/tests/cases/fourslash/findAllRefsObjectBindingElementPropertyName04.ts index bdb37525f71..dfa0997774e 100644 --- a/tests/cases/fourslash/findAllRefsObjectBindingElementPropertyName04.ts +++ b/tests/cases/fourslash/findAllRefsObjectBindingElementPropertyName04.ts @@ -6,14 +6,12 @@ ////} //// ////function f({ /**/[|property1|]: p1 }: I, -//// { /*SHOULD_BE_A_REFERENCE*/property1 }: I, +//// { [|property1|] }: I, //// { property1: p2 }) { //// -//// return property1 + 1; +//// return [|property1|] + 1; ////} -// NOTE: In the future, the identifier at -// SHOULD_BE_A_REFERENCE should be in the set of ranges. goTo.marker(); let ranges = test.ranges(); diff --git a/tests/cases/fourslash/findAllRefsObjectBindingElementPropertyName06.ts b/tests/cases/fourslash/findAllRefsObjectBindingElementPropertyName06.ts index 67c7029861e..379d1d4d5f5 100644 --- a/tests/cases/fourslash/findAllRefsObjectBindingElementPropertyName06.ts +++ b/tests/cases/fourslash/findAllRefsObjectBindingElementPropertyName06.ts @@ -8,12 +8,12 @@ ////var elems: I[]; ////for (let { [|property1|]: p } of elems) { ////} -////for (let { property1 } of elems) { +////for (let { [|property1|] } of elems) { ////} ////for (var { [|property1|]: p1 } of elems) { ////} ////var p2; -////for ({ property1 : p2 } of elems) { +////for ({ [|property1|] : p2 } of elems) { ////} // Note: if this test ever changes, consider updating diff --git a/tests/cases/fourslash/findAllRefsObjectBindingElementPropertyName09.ts b/tests/cases/fourslash/findAllRefsObjectBindingElementPropertyName09.ts index e45359bcf1c..0b82c73e31d 100644 --- a/tests/cases/fourslash/findAllRefsObjectBindingElementPropertyName09.ts +++ b/tests/cases/fourslash/findAllRefsObjectBindingElementPropertyName09.ts @@ -1,19 +1,17 @@ /// ////interface I { -//// /*SHOULD_BE_A_REFERENCE1*/property1: number; +//// [|property1|]: number; //// property2: string; ////} //// -////function f({ /*SHOULD_BE_A_REFERENCE2*/property1: p1 }: I, +////function f({ [|property1|]: p1 }: I, //// { /**/[|property1|] }: I, //// { property1: p2 }) { //// //// return [|property1|] + 1; ////} -// NOTE: In the future, the identifiers at -// SHOULD_BE_A_REFERENCE[1/2] should be in the set of ranges. goTo.marker(); let ranges = test.ranges(); diff --git a/tests/cases/fourslash/goToDefinitionTypeReferenceDirective.ts b/tests/cases/fourslash/goToDefinitionTypeReferenceDirective.ts new file mode 100644 index 00000000000..3aaa3ab980f --- /dev/null +++ b/tests/cases/fourslash/goToDefinitionTypeReferenceDirective.ts @@ -0,0 +1,13 @@ +/// + +// @typesRoot: src +// @Filename: src/types/lib/index.d.ts +/////*0*/declare let $: {x: number}; + +// @Filename: src/app.ts +//// /// +//// $.x; + +goTo.marker("1"); +goTo.definition(); +verify.caretAtMarker("0"); \ No newline at end of file diff --git a/tests/cases/fourslash/instanceTypesForGenericType1.ts b/tests/cases/fourslash/instanceTypesForGenericType1.ts index 96ee175383e..a3d119785bf 100644 --- a/tests/cases/fourslash/instanceTypesForGenericType1.ts +++ b/tests/cases/fourslash/instanceTypesForGenericType1.ts @@ -11,4 +11,4 @@ goTo.marker('1'); verify.quickInfoIs('(property) G.self: G'); goTo.marker('2'); -verify.quickInfoIs('class G'); \ No newline at end of file +verify.quickInfoIs('this: this'); \ No newline at end of file diff --git a/tests/cases/fourslash/memberListOnExplicitThis.ts b/tests/cases/fourslash/memberListOnExplicitThis.ts new file mode 100644 index 00000000000..b776a7c0641 --- /dev/null +++ b/tests/cases/fourslash/memberListOnExplicitThis.ts @@ -0,0 +1,29 @@ +/// + +////interface Restricted { +//// n: number; +////} +////class C1 implements Restricted { +//// n: number; +//// m: number; +//// f(this: this) {this./*1*/} // test on 'this.' +//// g(this: Restricted) {this./*2*/} +////} +////function f(this: void) {this./*3*/} +////function g(this: Restricted) {this./*4*/} + +goTo.marker('1'); +verify.memberListContains('f', '(method) C1.f(this: this): void'); +verify.memberListContains('g', '(method) C1.g(this: Restricted): void'); +verify.memberListContains('n', '(property) C1.n: number'); +verify.memberListContains('m', '(property) C1.m: number'); + +goTo.marker('2'); +verify.memberListContains('n', '(property) Restricted.n: number'); + +goTo.marker('3'); +verify.memberListIsEmpty(); + +goTo.marker('4'); +verify.memberListContains('n', '(property) Restricted.n: number'); + diff --git a/tests/cases/fourslash/quickInfoOnThis.ts b/tests/cases/fourslash/quickInfoOnThis.ts index c4eecfca5d5..91083d41e6b 100644 --- a/tests/cases/fourslash/quickInfoOnThis.ts +++ b/tests/cases/fourslash/quickInfoOnThis.ts @@ -1,15 +1,95 @@ /// - -////function someFn1(someFn: { (): void; }) { } +////interface Restricted { +//// n: number; +////} +////function wrapper(wrapped: { (): void; }) { } ////class Foo { -//// public bar() { -//// someFn1( -//// function doSomething() { -//// console.log(th/**/is); +//// n: number; +//// public explicitThis(this: this) { +//// wrapper( +//// function explicitVoid(this: void) { +//// console.log(th/*1*/is); //// } //// ) +//// console.log(th/*2*/is); +//// } +//// public explicitInterface(th/*3*/is: Restricted) { +//// console.log(th/*4*/is); +//// } +//// public explicitClass(th/*5*/is: Foo) { +//// console.log(th/*6*/is); //// } ////} +////class Bar { +//// public explicitThis(this: this) { +//// console.log(th/*7*/is); +//// } +//// public explicitClass(this: Bar) { +//// console.log(thi/*8*/s); +//// } +////} +//// +////function implicitAny(x: number): void { +//// return th/*9*/is; +////} +////function explicitVoid(th/*10*/is: void, x: number): void { +//// return th/*11*/is; +////} +////function explicitInterface(th/*12*/is: Restricted): void { +//// console.log(thi/*13*/s); +////} +////function explicitLiteral(th/*14*/is: { n: number }): void { +//// console.log(th/*15*/is); +////} +//// +////interface ContextualInterface { +//// m: number; +//// method(this: this, n: number); +////} +////let o: ContextualInterface = { +//// m: 12, +//// method(n) { +//// let x = this/*16*/.m; +//// } +////} +////interface ContextualInterface2 { +//// (this: void, n: number): void; +////} +////let contextualInterface2: ContextualInterface2 = function (th/*17*/is, n) { } -goTo.marker(); +goTo.marker('1'); +verify.quickInfoIs('void'); +goTo.marker('2'); +verify.quickInfoIs('this: this'); +goTo.marker('3'); +verify.quickInfoIs('(parameter) this: Restricted'); +goTo.marker('4'); +verify.quickInfoIs('this: Restricted'); +goTo.marker('5'); +verify.quickInfoIs('(parameter) this: Foo'); +goTo.marker('6'); +verify.quickInfoIs('this: Foo'); +goTo.marker('7'); +verify.quickInfoIs('this: this'); +goTo.marker('8'); +verify.quickInfoIs('this: Bar'); +goTo.marker('9'); verify.quickInfoIs('any'); +goTo.marker('10'); +verify.quickInfoIs('(parameter) this: void'); +goTo.marker('11'); +verify.quickInfoIs('void'); +goTo.marker('12'); +verify.quickInfoIs('(parameter) this: Restricted'); +goTo.marker('13'); +verify.quickInfoIs('this: Restricted'); +goTo.marker('14'); + +verify.quickInfoIs('(parameter) this: {\n n: number;\n}'); +goTo.marker('15'); +verify.quickInfoIs('this: {\n n: number;\n}'); + +goTo.marker('16'); +verify.quickInfoIs('this: ContextualInterface'); +goTo.marker('17'); +verify.quickInfoIs('(parameter) this: void'); diff --git a/tests/cases/fourslash/renameDefaultImport.ts b/tests/cases/fourslash/renameDefaultImport.ts new file mode 100644 index 00000000000..fd9534e65f7 --- /dev/null +++ b/tests/cases/fourslash/renameDefaultImport.ts @@ -0,0 +1,19 @@ +/// + +// @Filename: B.ts +////export default class [|B|] { +//// test() { +//// } +////} + +// @Filename: A.ts +////import [|B|] from "./B"; +////let b = new [|B|](); +////b.test(); + +let ranges = test.ranges() +for (let range of ranges) { + goTo.file(range.fileName); + goTo.position(range.start); + verify.renameLocations(/*findInStrings*/ false, /*findInComments*/ false); +} diff --git a/tests/cases/fourslash/renameDefaultImportDifferentName.ts b/tests/cases/fourslash/renameDefaultImportDifferentName.ts new file mode 100644 index 00000000000..5965f1a63e9 --- /dev/null +++ b/tests/cases/fourslash/renameDefaultImportDifferentName.ts @@ -0,0 +1,23 @@ +/// + +// @Filename: B.ts +////export default class /*1*/C { +//// test() { +//// } +////} + +// @Filename: A.ts +////import [|B|] from "./B"; +////let b = new [|B|](); +////b.test(); + +goTo.file("B.ts"); +goTo.marker("1"); +verify.occurrencesAtPositionCount(1); + +goTo.file("A.ts"); +let ranges = test.ranges() +for (let range of ranges) { + goTo.position(range.start); + verify.renameLocations(/*findInStrings*/ false, /*findInComments*/ false); +} diff --git a/tests/cases/fourslash/renameDestructuringAssignment.ts b/tests/cases/fourslash/renameDestructuringAssignment.ts new file mode 100644 index 00000000000..b7b18f661d2 --- /dev/null +++ b/tests/cases/fourslash/renameDestructuringAssignment.ts @@ -0,0 +1,14 @@ +/// + +////interface I { +//// [|x|]: number; +////} +////var a: I; +////var x; +////({ [|x|]: x } = a); + +let ranges = test.ranges() +for (let range of ranges) { + goTo.position(range.start); + verify.renameLocations(/*findInStrings*/ false, /*findInComments*/ false); +} diff --git a/tests/cases/fourslash/renameDestructuringAssignmentInFor.ts b/tests/cases/fourslash/renameDestructuringAssignmentInFor.ts new file mode 100644 index 00000000000..6be57b81fa2 --- /dev/null +++ b/tests/cases/fourslash/renameDestructuringAssignmentInFor.ts @@ -0,0 +1,20 @@ +/// + +////interface I { +//// /*1*/[|property1|]: number; +//// property2: string; +////} +////var elems: I[]; +//// +////var p2: number, property1: number; +////for ({ [|property1|] } = elems[0]; p2 < 100; p2++) { +//// p2 = property1++; +////} +////for ({ /*2*/[|property1|]: p2 } = elems[0]; p2 < 100; p2++) { +////} + +goTo.marker("1"); +verify.renameLocations(/*findInStrings*/ false, /*findInComments*/ false); + +goTo.marker("2"); +verify.renameLocations(/*findInStrings*/ false, /*findInComments*/ false); diff --git a/tests/cases/fourslash/renameDestructuringAssignmentInFor2.ts b/tests/cases/fourslash/renameDestructuringAssignmentInFor2.ts new file mode 100644 index 00000000000..ca75e42394b --- /dev/null +++ b/tests/cases/fourslash/renameDestructuringAssignmentInFor2.ts @@ -0,0 +1,20 @@ +/// + +////interface I { +//// property1: number; +//// property2: string; +////} +////var elems: I[]; +//// +////var p2: number, [|property1|]: number; +////for ({ [|property1|] } = elems[0]; p2 < 100; p2++) { +//// p2 = [|property1|]++; +////} +////for ({ property1: p2 } = elems[0]; p2 < 100; p2++) { +////} + +let ranges = test.ranges() +for (let range of ranges) { + goTo.position(range.start); + verify.renameLocations(/*findInStrings*/ false, /*findInComments*/ false); +} diff --git a/tests/cases/fourslash/renameDestructuringAssignmentInForOf.ts b/tests/cases/fourslash/renameDestructuringAssignmentInForOf.ts new file mode 100644 index 00000000000..d965875d259 --- /dev/null +++ b/tests/cases/fourslash/renameDestructuringAssignmentInForOf.ts @@ -0,0 +1,20 @@ +/// + +////interface I { +//// /*1*/[|property1|]: number; +//// property2: string; +////} +////var elems: I[]; +//// +////var property1: number, p2: number; +////for ({ [|property1|] } of elems) { +//// property1++; +////} +////for ({ /*2*/[|property1|]: p2 } of elems) { +////} + +goTo.marker("1"); +verify.renameLocations(/*findInStrings*/ false, /*findInComments*/ false); + +goTo.marker("2"); +verify.renameLocations(/*findInStrings*/ false, /*findInComments*/ false); \ No newline at end of file diff --git a/tests/cases/fourslash/renameDestructuringAssignmentInForOf2.ts b/tests/cases/fourslash/renameDestructuringAssignmentInForOf2.ts new file mode 100644 index 00000000000..401b6776d2e --- /dev/null +++ b/tests/cases/fourslash/renameDestructuringAssignmentInForOf2.ts @@ -0,0 +1,20 @@ +/// + +////interface I { +//// property1: number; +//// property2: string; +////} +////var elems: I[]; +//// +////var [|property1|]: number, p2: number; +////for ({ [|property1|] } of elems) { +//// [|property1|]++; +////} +////for ({ property1: p2 } of elems) { +////} + +let ranges = test.ranges() +for (let range of ranges) { + goTo.position(range.start); + verify.renameLocations(/*findInStrings*/ false, /*findInComments*/ false); +} diff --git a/tests/cases/fourslash/renameDestructuringAssignmentNestedInArrayLiteral.ts b/tests/cases/fourslash/renameDestructuringAssignmentNestedInArrayLiteral.ts new file mode 100644 index 00000000000..9d5d2a041e5 --- /dev/null +++ b/tests/cases/fourslash/renameDestructuringAssignmentNestedInArrayLiteral.ts @@ -0,0 +1,15 @@ +/// + +////interface I { +//// /*1*/[|property1|]: number; +//// property2: string; +////} +////var elems: I[], p1: number, property1: number; +////[{ /*2*/[|property1|]: p1 }] = elems; +////[{ [|property1|] }] = elems; + +goTo.marker("1"); +verify.renameLocations(/*findInStrings*/ false, /*findInComments*/ false); + +goTo.marker("2"); +verify.renameLocations(/*findInStrings*/ false, /*findInComments*/ false); diff --git a/tests/cases/fourslash/renameDestructuringAssignmentNestedInArrayLiteral2.ts b/tests/cases/fourslash/renameDestructuringAssignmentNestedInArrayLiteral2.ts new file mode 100644 index 00000000000..c4db2de512f --- /dev/null +++ b/tests/cases/fourslash/renameDestructuringAssignmentNestedInArrayLiteral2.ts @@ -0,0 +1,15 @@ +/// + +////interface I { +//// property1: number; +//// property2: string; +////} +////var elems: I[], p1: number, [|property1|]: number; +////[{ property1: p1 }] = elems; +////[{ [|property1|] }] = elems; + +let ranges = test.ranges() +for (let range of ranges) { + goTo.position(range.start); + verify.renameLocations(/*findInStrings*/ false, /*findInComments*/ false); +} diff --git a/tests/cases/fourslash/renameDestructuringAssignmentNestedInFor.ts b/tests/cases/fourslash/renameDestructuringAssignmentNestedInFor.ts new file mode 100644 index 00000000000..e603c82dbd7 --- /dev/null +++ b/tests/cases/fourslash/renameDestructuringAssignmentNestedInFor.ts @@ -0,0 +1,22 @@ +/// + +////interface MultiRobot { +//// name: string; +//// skills: { +//// /*1*/[|primary|]: string; +//// secondary: string; +//// }; +////} +////let multiRobot: MultiRobot; +////for ({ skills: { /*2*/[|primary|]: primaryA, secondary: secondaryA } } = multiRobot, i = 0; i < 1; i++) { +//// console.log(primaryA); +////} +////for ({ skills: { [|primary|], secondary } } = multiRobot, i = 0; i < 1; i++) { +//// console.log(primary); +////} + +goTo.marker("1"); +verify.renameLocations(/*findInStrings*/ false, /*findInComments*/ false); + +goTo.marker("2"); +verify.renameLocations(/*findInStrings*/ false, /*findInComments*/ false); diff --git a/tests/cases/fourslash/renameDestructuringAssignmentNestedInFor2.ts b/tests/cases/fourslash/renameDestructuringAssignmentNestedInFor2.ts new file mode 100644 index 00000000000..89dc899c5bf --- /dev/null +++ b/tests/cases/fourslash/renameDestructuringAssignmentNestedInFor2.ts @@ -0,0 +1,23 @@ +/// + +////interface MultiRobot { +//// name: string; +//// skills: { +//// primary: string; +//// secondary: string; +//// }; +////} +////let multiRobot: MultiRobot, [|primary|]: string; +////for ({ skills: { primary: primaryA, secondary: secondaryA } } = multiRobot, i = 0; i < 1; i++) { +//// console.log(primaryA); +////} +////for ({ skills: { [|primary|], secondary } } = multiRobot, i = 0; i < 1; i++) { +//// console.log([|primary|]); +////} + +let ranges = test.ranges() +for (let range of ranges) { + goTo.position(range.start); + verify.renameLocations(/*findInStrings*/ false, /*findInComments*/ false); +} + diff --git a/tests/cases/fourslash/renameDestructuringAssignmentNestedInForOf.ts b/tests/cases/fourslash/renameDestructuringAssignmentNestedInForOf.ts new file mode 100644 index 00000000000..bef88d201d4 --- /dev/null +++ b/tests/cases/fourslash/renameDestructuringAssignmentNestedInForOf.ts @@ -0,0 +1,22 @@ +/// + +////interface MultiRobot { +//// name: string; +//// skills: { +//// /*1*/[|primary|]: string; +//// secondary: string; +//// }; +////} +////let multiRobots: MultiRobot[]; +////for ({ skills: { /*2*/[|primary|]: primaryA, secondary: secondaryA } } of multiRobots) { +//// console.log(primaryA); +////} +////for ({ skills: { [|primary|], secondary } } of multiRobots) { +//// console.log(primary); +////} + +goTo.marker("1"); +verify.renameLocations(/*findInStrings*/ false, /*findInComments*/ false); + +goTo.marker("2"); +verify.renameLocations(/*findInStrings*/ false, /*findInComments*/ false); diff --git a/tests/cases/fourslash/renameDestructuringAssignmentNestedInForOf2.ts b/tests/cases/fourslash/renameDestructuringAssignmentNestedInForOf2.ts new file mode 100644 index 00000000000..b684e6b6a81 --- /dev/null +++ b/tests/cases/fourslash/renameDestructuringAssignmentNestedInForOf2.ts @@ -0,0 +1,23 @@ +/// + +////interface MultiRobot { +//// name: string; +//// skills: { +//// primary: string; +//// secondary: string; +//// }; +////} +////let multiRobots: MultiRobot[], [|primary|]: string; +////for ({ skills: { primary: primaryA, secondary: secondaryA } } of multiRobots) { +//// console.log(primaryA); +////} +////for ({ skills: { [|primary|], secondary } } of multiRobots) { +//// console.log([|primary|]); +////} + + +let ranges = test.ranges() +for (let range of ranges) { + goTo.position(range.start); + verify.renameLocations(/*findInStrings*/ false, /*findInComments*/ false); +} diff --git a/tests/cases/fourslash/renameDestructuringClassProperty.ts b/tests/cases/fourslash/renameDestructuringClassProperty.ts new file mode 100644 index 00000000000..acc58f999c4 --- /dev/null +++ b/tests/cases/fourslash/renameDestructuringClassProperty.ts @@ -0,0 +1,23 @@ +/// + +////class A { +//// [|foo|]: string; +////} +////class B { +//// syntax1(a: A): void { +//// let { [|foo|] } = a; +//// } +//// syntax2(a: A): void { +//// let { [|foo|]: foo } = a; +//// } +//// syntax11(a: A): void { +//// let { [|foo|] } = a; +//// [|foo|] = "newString"; +//// } +////} + +let ranges = test.ranges() +for (let range of ranges) { + goTo.position(range.start); + verify.renameLocations(/*findInStrings*/ false, /*findInComments*/ false); +} diff --git a/tests/cases/fourslash/renameDestructuringDeclarationInFor.ts b/tests/cases/fourslash/renameDestructuringDeclarationInFor.ts new file mode 100644 index 00000000000..0edf9085092 --- /dev/null +++ b/tests/cases/fourslash/renameDestructuringDeclarationInFor.ts @@ -0,0 +1,20 @@ +/// + +////interface I { +//// [|property1|]: number; +//// property2: string; +////} +////var elems: I[]; +//// +////var p2: number, property1: number; +////for (let { [|property1|]: p2 } = elems[0]; p2 < 100; p2++) { +////} +////for (let { [|property1|] } = elems[0]; p2 < 100; p2++) { +//// [|property1|] = p2; +////} + +let ranges = test.ranges() +for (let range of ranges) { + goTo.position(range.start); + verify.renameLocations(/*findInStrings*/ false, /*findInComments*/ false); +} diff --git a/tests/cases/fourslash/renameDestructuringDeclarationInForOf.ts b/tests/cases/fourslash/renameDestructuringDeclarationInForOf.ts new file mode 100644 index 00000000000..1c2b04b7ab5 --- /dev/null +++ b/tests/cases/fourslash/renameDestructuringDeclarationInForOf.ts @@ -0,0 +1,19 @@ +/// + +////interface I { +//// [|property1|]: number; +//// property2: string; +////} +////var elems: I[]; +//// +////for (let { [|property1|] } of elems) { +//// [|property1|]++; +////} +////for (let { [|property1|]: p2 } of elems) { +////} + +let ranges = test.ranges() +for (let range of ranges) { + goTo.position(range.start); + verify.renameLocations(/*findInStrings*/ false, /*findInComments*/ false); +} diff --git a/tests/cases/fourslash/renameDestructuringFunctionParameter.ts b/tests/cases/fourslash/renameDestructuringFunctionParameter.ts new file mode 100644 index 00000000000..d1df0f58275 --- /dev/null +++ b/tests/cases/fourslash/renameDestructuringFunctionParameter.ts @@ -0,0 +1,10 @@ +/// + +////function f({[|a|]}: {[|a|]}) { +//// f({[|a|]}); +////} +let ranges = test.ranges(); +for (let range of ranges) { + goTo.position(range.start); + verify.renameLocations(/*findInStrings*/ false, /*findInComments*/ false); +} diff --git a/tests/cases/fourslash/renameDestructuringNestedBindingElement.ts b/tests/cases/fourslash/renameDestructuringNestedBindingElement.ts new file mode 100644 index 00000000000..1c4254b14ae --- /dev/null +++ b/tests/cases/fourslash/renameDestructuringNestedBindingElement.ts @@ -0,0 +1,22 @@ +/// + +////interface MultiRobot { +//// name: string; +//// skills: { +//// [|primary|]: string; +//// secondary: string; +//// }; +////} +////let multiRobots: MultiRobot[]; +////for (let { skills: {[|primary|]: primaryA, secondary: secondaryA } } of multiRobots) { +//// console.log(primaryA); +////} +////for (let { skills: {[|primary|], secondary } } of multiRobots) { +//// console.log([|primary|]); +////} + +let ranges = test.ranges() +for (let range of ranges) { + goTo.position(range.start); + verify.renameLocations(/*findInStrings*/ false, /*findInComments*/ false); +} diff --git a/tests/cases/fourslash/renameImportAndExportInDiffFiles.ts b/tests/cases/fourslash/renameImportAndExportInDiffFiles.ts new file mode 100644 index 00000000000..7b098721196 --- /dev/null +++ b/tests/cases/fourslash/renameImportAndExportInDiffFiles.ts @@ -0,0 +1,18 @@ +/// + +// @Filename: a.ts +////export var /*1*/a; + +// @Filename: b.ts +////import { /*2*/a } from './a'; +////export { /*3*/a }; + +goTo.file("a.ts"); +goTo.marker("1"); + +goTo.file("b.ts"); +goTo.marker("2"); +verify.referencesCountIs(3); + +goTo.marker("3"); +verify.referencesCountIs(3); \ No newline at end of file diff --git a/tests/cases/fourslash/shims-pp/goToDefinitionTypeReferenceDirective.ts b/tests/cases/fourslash/shims-pp/goToDefinitionTypeReferenceDirective.ts new file mode 100644 index 00000000000..3aaa3ab980f --- /dev/null +++ b/tests/cases/fourslash/shims-pp/goToDefinitionTypeReferenceDirective.ts @@ -0,0 +1,13 @@ +/// + +// @typesRoot: src +// @Filename: src/types/lib/index.d.ts +/////*0*/declare let $: {x: number}; + +// @Filename: src/app.ts +//// /// +//// $.x; + +goTo.marker("1"); +goTo.definition(); +verify.caretAtMarker("0"); \ No newline at end of file diff --git a/tests/cases/fourslash/shims/goToDefinitionTypeReferenceDirective.ts b/tests/cases/fourslash/shims/goToDefinitionTypeReferenceDirective.ts new file mode 100644 index 00000000000..3aaa3ab980f --- /dev/null +++ b/tests/cases/fourslash/shims/goToDefinitionTypeReferenceDirective.ts @@ -0,0 +1,13 @@ +/// + +// @typesRoot: src +// @Filename: src/types/lib/index.d.ts +/////*0*/declare let $: {x: number}; + +// @Filename: src/app.ts +//// /// +//// $.x; + +goTo.marker("1"); +goTo.definition(); +verify.caretAtMarker("0"); \ No newline at end of file diff --git a/tests/cases/fourslash/signatureHelpThis.ts b/tests/cases/fourslash/signatureHelpThis.ts new file mode 100644 index 00000000000..2ac19c823c0 --- /dev/null +++ b/tests/cases/fourslash/signatureHelpThis.ts @@ -0,0 +1,43 @@ +/// +////class Foo { +//// public implicitAny(n: number) { +//// } +//// public explicitThis(this: this, n: number) { +//// console.log(this); +//// } +//// public explicitClass(this: Foo, n: number) { +//// console.log(this); +//// } +////} +//// +////function implicitAny(x: number): void { +//// return this; +////} +////function explicitVoid(this: void, x: number): void { +//// return this; +////} +////function explicitLiteral(this: { n: number }, x: number): void { +//// console.log(this); +////} +////let foo = new Foo(); +////foo.implicitAny(/*1*/); +////foo.explicitThis(/*2*/); +////foo.explicitClass(/*3*/); +////implicitAny(/*4*/12); +////explicitVoid(/*5*/13); +////let o = { n: 14, m: explicitLiteral }; +////o.m(/*6*/); + + +goTo.marker('1'); +verify.currentParameterHelpArgumentNameIs("n"); +goTo.marker('2'); +verify.currentParameterHelpArgumentNameIs("n"); +goTo.marker('3'); +verify.currentParameterHelpArgumentNameIs("n"); +goTo.marker('4'); +verify.currentParameterHelpArgumentNameIs("x"); +goTo.marker('5'); +verify.currentParameterHelpArgumentNameIs("x"); +goTo.marker('6'); +verify.currentParameterHelpArgumentNameIs("x"); diff --git a/tests/cases/fourslash/thisBindingInLambda.ts b/tests/cases/fourslash/thisBindingInLambda.ts index f6dfdbdec08..d9c43796bd8 100644 --- a/tests/cases/fourslash/thisBindingInLambda.ts +++ b/tests/cases/fourslash/thisBindingInLambda.ts @@ -9,4 +9,4 @@ ////} goTo.marker(); -verify.quickInfoIs('class Greeter'); +verify.quickInfoIs('this: this'); diff --git a/tests/cases/fourslash/tsxCompletionOnOpeningTagWithoutJSX1.ts b/tests/cases/fourslash/tsxCompletionOnOpeningTagWithoutJSX1.ts index 1b745f6e418..d0ef579f401 100644 --- a/tests/cases/fourslash/tsxCompletionOnOpeningTagWithoutJSX1.ts +++ b/tests/cases/fourslash/tsxCompletionOnOpeningTagWithoutJSX1.ts @@ -4,4 +4,4 @@ //// var x = { + // --lib es6 0.ts + assertParseResult(["--lib", "es6", "0.ts"], + { + errors: [], + fileNames: ["0.ts"], + options: { + lib: ["lib.es2015.d.ts"] + } + }); + }); + + it("Parse multiple options of library flags ", () => { + // --lib es5,es2015.symbol.wellknown 0.ts + assertParseResult(["--lib", "es5,es2015.symbol.wellknown", "0.ts"], + { + errors: [], + fileNames: ["0.ts"], + options: { + lib: ["lib.es5.d.ts", "lib.es2015.symbol.wellknown.d.ts"] + } + }); + }); + + it("Parse invalid option of library flags ", () => { + // --lib es5,invalidOption 0.ts + assertParseResult(["--lib", "es5,invalidOption", "0.ts"], + { + errors: [{ + messageText: "Argument for '--lib' option must be: 'es5', 'es6', 'es2015', 'es7', 'es2016', 'dom', 'webworker', 'scripthost', 'es2015.core', 'es2015.collection', 'es2015.generator', 'es2015.iterable', 'es2015.promise', 'es2015.proxy', 'es2015.reflect', 'es2015.symbol', 'es2015.symbol.wellknown', 'es2016.array.include'", + category: ts.Diagnostics.Argument_for_0_option_must_be_Colon_1.category, + code: ts.Diagnostics.Argument_for_0_option_must_be_Colon_1.code, + + file: undefined, + start: undefined, + length: undefined, + }], + fileNames: ["0.ts"], + options: { + lib: ["lib.es5.d.ts"] + } + }); + }); it("Parse empty options of --jsx ", () => { // 0.ts --jsx assertParseResult(["0.ts", "--jsx"], @@ -161,29 +204,111 @@ namespace ts { }); }); + it("Parse empty options of --lib ", () => { + // 0.ts --lib + assertParseResult(["0.ts", "--lib"], + { + errors: [{ + messageText: "Compiler option 'lib' expects an argument.", + category: ts.Diagnostics.Compiler_option_0_expects_an_argument.category, + code: ts.Diagnostics.Compiler_option_0_expects_an_argument.code, + + file: undefined, + start: undefined, + length: undefined, + }, { + messageText: "Argument for '--lib' option must be: 'es5', 'es6', 'es2015', 'es7', 'es2016', 'dom', 'webworker', 'scripthost', 'es2015.core', 'es2015.collection', 'es2015.generator', 'es2015.iterable', 'es2015.promise', 'es2015.proxy', 'es2015.reflect', 'es2015.symbol', 'es2015.symbol.wellknown', 'es2016.array.include'", + category: ts.Diagnostics.Argument_for_0_option_must_be_Colon_1.category, + code: ts.Diagnostics.Argument_for_0_option_must_be_Colon_1.code, + + file: undefined, + start: undefined, + length: undefined, + }], + fileNames: ["0.ts"], + options: { + lib: [] + } + }); + }); + + it("Parse --lib option with extra comma ", () => { + // --lib es5, es7 0.ts + assertParseResult(["--lib", "es5,", "es7", "0.ts"], + { + errors: [{ + messageText: "Argument for '--lib' option must be: 'es5', 'es6', 'es2015', 'es7', 'es2016', 'dom', 'webworker', 'scripthost', 'es2015.core', 'es2015.collection', 'es2015.generator', 'es2015.iterable', 'es2015.promise', 'es2015.proxy', 'es2015.reflect', 'es2015.symbol', 'es2015.symbol.wellknown', 'es2016.array.include'", + category: ts.Diagnostics.Argument_for_0_option_must_be_Colon_1.category, + code: ts.Diagnostics.Argument_for_0_option_must_be_Colon_1.code, + + file: undefined, + start: undefined, + length: undefined, + }], + fileNames: ["es7", "0.ts"], + options: { + lib: ["lib.es5.d.ts"] + } + }); + }); + + it("Parse --lib option with trailing white-space ", () => { + // --lib es5, es7 0.ts + assertParseResult(["--lib", "es5, ", "es7", "0.ts"], + { + errors: [{ + messageText: "Argument for '--lib' option must be: 'es5', 'es6', 'es2015', 'es7', 'es2016', 'dom', 'webworker', 'scripthost', 'es2015.core', 'es2015.collection', 'es2015.generator', 'es2015.iterable', 'es2015.promise', 'es2015.proxy', 'es2015.reflect', 'es2015.symbol', 'es2015.symbol.wellknown', 'es2016.array.include'", + category: ts.Diagnostics.Argument_for_0_option_must_be_Colon_1.category, + code: ts.Diagnostics.Argument_for_0_option_must_be_Colon_1.code, + + file: undefined, + start: undefined, + length: undefined, + }], + fileNames: ["es7", "0.ts"], + options: { + lib: ["lib.es5.d.ts"] + } + }); + }); + it("Parse multiple compiler flags with input files at the end", () => { - // --module commonjs --target es5 0.ts - assertParseResult(["--module", "commonjs", "--target", "es5", "0.ts"], + // --lib es5,es2015.symbol.wellknown --target es5 0.ts + assertParseResult(["--lib", "es5,es2015.symbol.wellknown", "--target", "es5", "0.ts"], { errors: [], fileNames: ["0.ts"], options: { - module: ts.ModuleKind.CommonJS, + lib: ["lib.es5.d.ts", "lib.es2015.symbol.wellknown.d.ts"], target: ts.ScriptTarget.ES5, } }); }); it("Parse multiple compiler flags with input files in the middle", () => { - // --module commonjs --target es5 0.ts --noImplicitAny - assertParseResult(["--module", "commonjs", "--target", "es5", "0.ts", "--noImplicitAny"], + // --module commonjs --target es5 0.ts --lib es5,es2015.symbol.wellknown + assertParseResult(["--module", "commonjs", "--target", "es5", "0.ts", "--lib", "es5,es2015.symbol.wellknown"], { errors: [], fileNames: ["0.ts"], options: { module: ts.ModuleKind.CommonJS, target: ts.ScriptTarget.ES5, - noImplicitAny: true, + lib: ["lib.es5.d.ts", "lib.es2015.symbol.wellknown.d.ts"], + } + }); + }); + + it("Parse multiple library compiler flags ", () => { + // --module commonjs --target es5 --lib es5 0.ts --library es2015.array,es2015.symbol.wellknown + assertParseResult(["--module", "commonjs", "--target", "es5", "--lib", "es5", "0.ts", "--lib", "es2015.core, es2015.symbol.wellknown "], + { + errors: [], + fileNames: ["0.ts"], + options: { + module: ts.ModuleKind.CommonJS, + target: ts.ScriptTarget.ES5, + lib: ["lib.es2015.core.d.ts", "lib.es2015.symbol.wellknown.d.ts"], } }); }); diff --git a/tests/cases/unittests/convertCompilerOptionsFromJson.ts b/tests/cases/unittests/convertCompilerOptionsFromJson.ts index 7ac80be7892..ed1d96a0fb7 100644 --- a/tests/cases/unittests/convertCompilerOptionsFromJson.ts +++ b/tests/cases/unittests/convertCompilerOptionsFromJson.ts @@ -30,6 +30,7 @@ namespace ts { "target": "es5", "noImplicitAny": false, "sourceMap": false, + "lib": ["es5", "es2015.core", "es2015.symbol"] } }, "tsconfig.json", { @@ -38,6 +39,7 @@ namespace ts { target: ScriptTarget.ES5, noImplicitAny: false, sourceMap: false, + lib: ["lib.es5.d.ts", "lib.es2015.core.d.ts", "lib.es2015.symbol.d.ts"] }, errors: [] } @@ -53,6 +55,7 @@ namespace ts { "noImplicitAny": false, "sourceMap": false, "allowJs": false, + "lib": ["es5", "es2015.core", "es2015.symbol"] } }, "tsconfig.json", { @@ -62,13 +65,14 @@ namespace ts { noImplicitAny: false, sourceMap: false, allowJs: false, + lib: ["lib.es5.d.ts", "lib.es2015.core.d.ts", "lib.es2015.symbol.d.ts"] }, errors: [] } ); }); - it("Convert incorrectly option of jsx to compiler-options ", () => { + it("Convert incorrect option of jsx to compiler-options ", () => { assertCompilerOptions( { "compilerOptions": { @@ -98,7 +102,7 @@ namespace ts { ); }); - it("Convert incorrectly option of module to compiler-options ", () => { + it("Convert incorrect option of module to compiler-options ", () => { assertCompilerOptions( { "compilerOptions": { @@ -126,7 +130,7 @@ namespace ts { ); }); - it("Convert incorrectly option of newLine to compiler-options ", () => { + it("Convert incorrect option of newLine to compiler-options ", () => { assertCompilerOptions( { "compilerOptions": { @@ -154,7 +158,7 @@ namespace ts { ); }); - it("Convert incorrectly option of target to compiler-options ", () => { + it("Convert incorrect option of target to compiler-options ", () => { assertCompilerOptions( { "compilerOptions": { @@ -180,7 +184,7 @@ namespace ts { ); }); - it("Convert incorrectly option of module-resolution to compiler-options ", () => { + it("Convert incorrect option of module-resolution to compiler-options ", () => { assertCompilerOptions( { "compilerOptions": { @@ -206,6 +210,154 @@ namespace ts { ); }); + it("Convert incorrect option of libs to compiler-options ", () => { + assertCompilerOptions( + { + "compilerOptions": { + "module": "commonjs", + "target": "es5", + "noImplicitAny": false, + "sourceMap": false, + "lib": ["es5", "es2015.core", "incorrectLib"] + } + }, "tsconfig.json", + { + compilerOptions: { + module: ModuleKind.CommonJS, + target: ScriptTarget.ES5, + noImplicitAny: false, + sourceMap: false, + lib: ["lib.es5.d.ts", "lib.es2015.core.d.ts"] + }, + errors: [{ + file: undefined, + start: 0, + length: 0, + messageText: "Argument for '--lib' option must be: 'es5', 'es6', 'es2015', 'es7', 'es2016', 'dom', 'webworker', 'scripthost', 'es2015.core', 'es2015.collection', 'es2015.generator', 'es2015.iterable', 'es2015.promise', 'es2015.proxy', 'es2015.reflect', 'es2015.symbol', 'es2015.symbol.wellknown', 'es2016.array.include'", + code: Diagnostics.Argument_for_0_option_must_be_Colon_1.code, + category: Diagnostics.Argument_for_0_option_must_be_Colon_1.category + }] + } + ); + }); + + it("Convert empty string option of libs to compiler-options ", () => { + assertCompilerOptions( + { + "compilerOptions": { + "module": "commonjs", + "target": "es5", + "noImplicitAny": false, + "sourceMap": false, + "lib": ["es5", ""] + } + }, "tsconfig.json", + { + compilerOptions: { + module: ModuleKind.CommonJS, + target: ScriptTarget.ES5, + noImplicitAny: false, + sourceMap: false, + lib: ["lib.es5.d.ts"] + }, + errors: [{ + file: undefined, + start: 0, + length: 0, + messageText: "Argument for '--lib' option must be: 'es5', 'es6', 'es2015', 'es7', 'es2016', 'dom', 'webworker', 'scripthost', 'es2015.core', 'es2015.collection', 'es2015.generator', 'es2015.iterable', 'es2015.promise', 'es2015.proxy', 'es2015.reflect', 'es2015.symbol', 'es2015.symbol.wellknown', 'es2016.array.include'", + code: Diagnostics.Argument_for_0_option_must_be_Colon_1.code, + category: Diagnostics.Argument_for_0_option_must_be_Colon_1.category + }] + } + ); + }); + + it("Convert empty string option of libs to compiler-options ", () => { + assertCompilerOptions( + { + "compilerOptions": { + "module": "commonjs", + "target": "es5", + "noImplicitAny": false, + "sourceMap": false, + "lib": [""] + } + }, "tsconfig.json", + { + compilerOptions: { + module: ModuleKind.CommonJS, + target: ScriptTarget.ES5, + noImplicitAny: false, + sourceMap: false, + lib: [] + }, + errors: [{ + file: undefined, + start: 0, + length: 0, + messageText: "Argument for '--lib' option must be: 'es5', 'es6', 'es2015', 'es7', 'es2016', 'dom', 'webworker', 'scripthost', 'es2015.core', 'es2015.collection', 'es2015.generator', 'es2015.iterable', 'es2015.promise', 'es2015.proxy', 'es2015.reflect', 'es2015.symbol', 'es2015.symbol.wellknown', 'es2016.array.include'", + code: Diagnostics.Argument_for_0_option_must_be_Colon_1.code, + category: Diagnostics.Argument_for_0_option_must_be_Colon_1.category + }] + } + ); + }); + + it("Convert trailing-whitespace string option of libs to compiler-options ", () => { + assertCompilerOptions( + { + "compilerOptions": { + "module": "commonjs", + "target": "es5", + "noImplicitAny": false, + "sourceMap": false, + "lib": [" "] + } + }, "tsconfig.json", + { + compilerOptions: { + module: ModuleKind.CommonJS, + target: ScriptTarget.ES5, + noImplicitAny: false, + sourceMap: false, + lib: [] + }, + errors: [{ + file: undefined, + start: 0, + length: 0, + messageText: "Argument for '--lib' option must be: 'es5', 'es6', 'es2015', 'es7', 'es2016', 'dom', 'webworker', 'scripthost', 'es2015.core', 'es2015.collection', 'es2015.generator', 'es2015.iterable', 'es2015.promise', 'es2015.proxy', 'es2015.reflect', 'es2015.symbol', 'es2015.symbol.wellknown', 'es2016.array.include'", + code: Diagnostics.Argument_for_0_option_must_be_Colon_1.code, + category: Diagnostics.Argument_for_0_option_must_be_Colon_1.category + }] + } + ); + }); + + it("Convert empty option of libs to compiler-options ", () => { + assertCompilerOptions( + { + "compilerOptions": { + "module": "commonjs", + "target": "es5", + "noImplicitAny": false, + "sourceMap": false, + "lib": [] + } + }, "tsconfig.json", + { + compilerOptions: { + module: ModuleKind.CommonJS, + target: ScriptTarget.ES5, + noImplicitAny: false, + sourceMap: false, + lib: [] + }, + errors: [] + } + ); + }); + it("Convert incorrectly format tsconfig.json to compiler-options ", () => { assertCompilerOptions( { @@ -245,6 +397,7 @@ namespace ts { "target": "es5", "noImplicitAny": false, "sourceMap": false, + "lib": ["es5", "es2015.core", "es2015.symbol"] } }, "jsconfig.json", { @@ -254,6 +407,7 @@ namespace ts { target: ScriptTarget.ES5, noImplicitAny: false, sourceMap: false, + lib: ["lib.es5.d.ts", "lib.es2015.core.d.ts", "lib.es2015.symbol.d.ts"] }, errors: [] } @@ -269,6 +423,7 @@ namespace ts { "noImplicitAny": false, "sourceMap": false, "allowJs": false, + "lib": ["es5", "es2015.core", "es2015.symbol"] } }, "jsconfig.json", { @@ -278,6 +433,7 @@ namespace ts { target: ScriptTarget.ES5, noImplicitAny: false, sourceMap: false, + lib: ["lib.es5.d.ts", "lib.es2015.core.d.ts", "lib.es2015.symbol.d.ts"] }, errors: [] } diff --git a/tests/cases/unittests/convertToBase64.ts b/tests/cases/unittests/convertToBase64.ts index 76f56f77477..c73d7531c40 100644 --- a/tests/cases/unittests/convertToBase64.ts +++ b/tests/cases/unittests/convertToBase64.ts @@ -8,26 +8,28 @@ module ts { assert.equal(actual, expected, "Encoded string using convertToBase64 does not match buffer.toString('base64')"); } - it("Converts ASCII charaters correctly", () => { - runTest(" !\"#$ %&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~"); - }); + if (Buffer) { + it("Converts ASCII charaters correctly", () => { + runTest(" !\"#$ %&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~"); + }); - it("Converts escape sequences correctly", () => { - runTest("\t\n\r\\\"\'\u0062"); - }); + it("Converts escape sequences correctly", () => { + runTest("\t\n\r\\\"\'\u0062"); + }); - it("Converts simple unicode characters correctly", () => { - runTest("ΠΣ ٵپ औठ ⺐⺠"); - }); + it("Converts simple unicode characters correctly", () => { + runTest("ΠΣ ٵپ औठ ⺐⺠"); + }); - it("Converts simple code snippet correctly", () => { - runTest(`/// + it("Converts simple code snippet correctly", () => { + runTest(`/// var x: string = "string"; console.log(x);`); - }); + }); - it("Converts simple code snippet with unicode characters correctly", () => { - runTest(`var Π = 3.1415; console.log(Π);`); - }); + it("Converts simple code snippet with unicode characters correctly", () => { + runTest(`var Π = 3.1415; console.log(Π);`); + }); + } }); } diff --git a/tests/cases/unittests/moduleResolution.ts b/tests/cases/unittests/moduleResolution.ts index 9a52d9896e4..29fde331892 100644 --- a/tests/cases/unittests/moduleResolution.ts +++ b/tests/cases/unittests/moduleResolution.ts @@ -204,6 +204,13 @@ module ts { "/a/b/c/d/node_modules/foo/index.ts", "/a/b/c/d/node_modules/foo/index.tsx", "/a/b/c/d/node_modules/foo/index.d.ts", + "/a/b/c/d/node_modules/@types/foo.ts", + "/a/b/c/d/node_modules/@types/foo.tsx", + "/a/b/c/d/node_modules/@types/foo.d.ts", + "/a/b/c/d/node_modules/@types/foo/package.json", + "/a/b/c/d/node_modules/@types/foo/index.ts", + "/a/b/c/d/node_modules/@types/foo/index.tsx", + "/a/b/c/d/node_modules/@types/foo/index.d.ts", "/a/b/c/node_modules/foo.ts", "/a/b/c/node_modules/foo.tsx", "/a/b/c/node_modules/foo.d.ts", @@ -211,6 +218,13 @@ module ts { "/a/b/c/node_modules/foo/index.ts", "/a/b/c/node_modules/foo/index.tsx", "/a/b/c/node_modules/foo/index.d.ts", + "/a/b/c/node_modules/@types/foo.ts", + "/a/b/c/node_modules/@types/foo.tsx", + "/a/b/c/node_modules/@types/foo.d.ts", + "/a/b/c/node_modules/@types/foo/package.json", + "/a/b/c/node_modules/@types/foo/index.ts", + "/a/b/c/node_modules/@types/foo/index.tsx", + "/a/b/c/node_modules/@types/foo/index.d.ts", ]) } }); @@ -246,6 +260,13 @@ module ts { "/a/node_modules/b/c/node_modules/d/node_modules/foo/index.ts", "/a/node_modules/b/c/node_modules/d/node_modules/foo/index.tsx", "/a/node_modules/b/c/node_modules/d/node_modules/foo/index.d.ts", + "/a/node_modules/b/c/node_modules/d/node_modules/@types/foo.ts", + "/a/node_modules/b/c/node_modules/d/node_modules/@types/foo.tsx", + "/a/node_modules/b/c/node_modules/d/node_modules/@types/foo.d.ts", + "/a/node_modules/b/c/node_modules/d/node_modules/@types/foo/package.json", + "/a/node_modules/b/c/node_modules/d/node_modules/@types/foo/index.ts", + "/a/node_modules/b/c/node_modules/d/node_modules/@types/foo/index.tsx", + "/a/node_modules/b/c/node_modules/d/node_modules/@types/foo/index.d.ts", "/a/node_modules/b/c/node_modules/foo.ts", "/a/node_modules/b/c/node_modules/foo.tsx", "/a/node_modules/b/c/node_modules/foo.d.ts", @@ -253,6 +274,13 @@ module ts { "/a/node_modules/b/c/node_modules/foo/index.ts", "/a/node_modules/b/c/node_modules/foo/index.tsx", "/a/node_modules/b/c/node_modules/foo/index.d.ts", + "/a/node_modules/b/c/node_modules/@types/foo.ts", + "/a/node_modules/b/c/node_modules/@types/foo.tsx", + "/a/node_modules/b/c/node_modules/@types/foo.d.ts", + "/a/node_modules/b/c/node_modules/@types/foo/package.json", + "/a/node_modules/b/c/node_modules/@types/foo/index.ts", + "/a/node_modules/b/c/node_modules/@types/foo/index.tsx", + "/a/node_modules/b/c/node_modules/@types/foo/index.d.ts", "/a/node_modules/b/node_modules/foo.ts", "/a/node_modules/b/node_modules/foo.tsx", "/a/node_modules/b/node_modules/foo.d.ts", @@ -260,6 +288,13 @@ module ts { "/a/node_modules/b/node_modules/foo/index.ts", "/a/node_modules/b/node_modules/foo/index.tsx", "/a/node_modules/b/node_modules/foo/index.d.ts", + "/a/node_modules/b/node_modules/@types/foo.ts", + "/a/node_modules/b/node_modules/@types/foo.tsx", + "/a/node_modules/b/node_modules/@types/foo.d.ts", + "/a/node_modules/b/node_modules/@types/foo/package.json", + "/a/node_modules/b/node_modules/@types/foo/index.ts", + "/a/node_modules/b/node_modules/@types/foo/index.tsx", + "/a/node_modules/b/node_modules/@types/foo/index.d.ts", "/a/node_modules/foo.ts", "/a/node_modules/foo.tsx", "/a/node_modules/foo.d.ts", @@ -267,7 +302,6 @@ module ts { "/a/node_modules/foo/index.ts", "/a/node_modules/foo/index.tsx" ]); - } }); }); @@ -664,6 +698,13 @@ import b = require("./moduleB.ts"); "/root/folder1/node_modules/file6/index.ts", "/root/folder1/node_modules/file6/index.tsx", "/root/folder1/node_modules/file6/index.d.ts", + "/root/folder1/node_modules/@types/file6.ts", + "/root/folder1/node_modules/@types/file6.tsx", + "/root/folder1/node_modules/@types/file6.d.ts", + "/root/folder1/node_modules/@types/file6/package.json", + "/root/folder1/node_modules/@types/file6/index.ts", + "/root/folder1/node_modules/@types/file6/index.tsx", + "/root/folder1/node_modules/@types/file6/index.d.ts" // success on /root/node_modules/file6.ts ]); @@ -913,4 +954,119 @@ import b = require("./moduleB.ts"); assert(!result.resolvedModule); }); }); + + describe("Type reference directive resolution: ", () => { + function test(typesRoot: string, typeDirective: string, primary: boolean, initialFile: File, targetFile: File, ...otherFiles: File[]) { + const host = createModuleResolutionHost(false, ...[initialFile, targetFile].concat(...otherFiles)); + const result = resolveTypeReferenceDirective(typeDirective, initialFile.name, {typesRoot}, host); + assert(result.resolvedTypeReferenceDirective.resolvedFileName !== undefined, "expected type directive to be resolved"); + assert.equal(result.resolvedTypeReferenceDirective.resolvedFileName, targetFile.name, "unexpected result of type reference resolution"); + assert.equal(result.resolvedTypeReferenceDirective.primary, primary, "unexpected 'primary' value"); + } + + it("Can be resolved from primary location", () => { + { + const f1 = { name: "/root/src/app.ts" } + const f2 = { name: "/root/src/types/lib/index.d.ts" }; + test(/*typesRoot*/"/root/src", /* typeDirective */"lib", /*primary*/ true, f1, f2); + } + { + const f1 = { name: "/root/src/app.ts" } + const f2 = { name: "/root/src/types/lib/typings/lib.d.ts" }; + const package = { name: "/root/src/types/lib/package.json", content: JSON.stringify({types: "typings/lib.d.ts"}) }; + test(/*typesRoot*/"/root/src", /* typeDirective */"lib", /*primary*/ true, f1, f2, package); + } + { + const f1 = { name: "/root/src/app.ts" } + const f2 = { name: "/root/src/node_modules/lib/index.d.ts" }; + test(/*typesRoot*/"/root/src", /* typeDirective */"lib", /*primary*/ true, f1, f2); + } + { + const f1 = { name: "/root/src/app.ts" } + const f2 = { name: "/root/src/node_modules/lib/typings/lib.d.ts" }; + const package = { name: "/root/src/node_modules/lib/package.json", content: JSON.stringify({types: "typings/lib.d.ts"}) }; + test(/*typesRoot*/"/root/src", /* typeDirective */"lib", /*primary*/ true, f1, f2, package); + } + { + const f1 = { name: "/root/src/app.ts" } + const f2 = { name: "/root/src/node_modules/@types/lib/index.d.ts" }; + test(/*typesRoot*/"/root/src", /* typeDirective */"lib", /*primary*/ true, f1, f2); + } + { + const f1 = { name: "/root/src/app.ts" } + const f2 = { name: "/root/src/node_modules/@types/lib/typings/lib.d.ts" }; + const package = { name: "/root/src/node_modules/@types/lib/package.json", content: JSON.stringify({types: "typings/lib.d.ts"}) }; + test(/*typesRoot*/"/root/src", /* typeDirective */"lib", /*primary*/ true, f1, f2, package); + } + }); + it("Can be resolved from secondary location", () => { + { + const f1 = { name: "/root/src/app.ts" } + const f2 = { name: "/root/node_modules/lib.d.ts" }; + test(/*typesRoot*/"/root/src", /* typeDirective */"lib", /*primary*/ false, f1, f2); + } + { + const f1 = { name: "/root/src/app.ts" } + const f2 = { name: "/root/node_modules/lib/index.d.ts" }; + test(/*typesRoot*/"/root/src", /* typeDirective */"lib", /*primary*/ false, f1, f2); + } + { + const f1 = { name: "/root/src/app.ts" } + const f2 = { name: "/root/node_modules/lib/typings/lib.d.ts" }; + const package = { name: "/root/node_modules/lib/package.json", content: JSON.stringify({typings: "typings/lib.d.ts"}) }; + test(/*typesRoot*/"/root/src", /* typeDirective */"lib", /*primary*/ false, f1, f2, package); + } + { + const f1 = { name: "/root/src/app.ts" } + const f2 = { name: "/root/node_modules/@types/lib/index.d.ts" }; + test(/*typesRoot*/"/root/src", /* typeDirective */"lib", /*primary*/ false, f1, f2); + } + { + const f1 = { name: "/root/src/app.ts" } + const f2 = { name: "/root/node_modules/@types/lib/typings/lib.d.ts" }; + const package = { name: "/root/node_modules/@types/lib/package.json", content: JSON.stringify({typings: "typings/lib.d.ts"}) }; + test(/*typesRoot*/"/root/src", /* typeDirective */"lib", /*primary*/ false, f1, f2, package); + } + }); + it("Primary resolution overrides secondary resolutions", () => { + { + const f1 = { name: "/root/src/a/b/c/app.ts" }; + const f2 = { name: "/root/src/types/lib/index.d.ts" }; + const f3 = { name: "/root/src/a/b/node_modules/lib.d.ts" } + test(/*typesRoot*/"/root/src", /* typeDirective */"lib", /*primary*/ true, f1, f2, f3); + } + }) + it("Reused program keeps errors", () => { + const f1 = { name: "/root/src/a/b/c/d/e/app.ts", content: `/// ` }; + const f2 = { name: "/root/src/a/b/c/d/node_modules/lib/index.d.ts", content: `declare var x: number;` }; + const f3 = { name: "/root/src/a/b/c/d/f/g/app.ts", content: `/// ` }; + const f4 = { name: "/root/src/a/b/c/d/f/node_modules/lib/index.d.ts", content: `declare var x: number;` }; + const files = [f1, f2, f3, f4]; + + const names = map(files, f => f.name); + const sourceFiles = arrayToMap(map(files, f => createSourceFile(f.name, f.content, ScriptTarget.ES6)), f => f.fileName); + const compilerHost: CompilerHost = { + fileExists : fileName => hasProperty(sourceFiles, fileName), + getSourceFile: fileName => sourceFiles[fileName], + getDefaultLibFileName: () => "lib.d.ts", + writeFile(file, text) { + throw new Error("NYI"); + }, + getCurrentDirectory: () => "/", + getCanonicalFileName: f => f.toLowerCase(), + getNewLine: () => "\r\n", + useCaseSensitiveFileNames: () => false, + readFile: fileName => hasProperty(sourceFiles, fileName) ? sourceFiles[fileName].text : undefined + }; + const program1 = createProgram(names, {}, compilerHost); + const diagnostics1 = program1.getFileProcessingDiagnostics().getDiagnostics(); + assert.equal(diagnostics1.length, 1, "expected one diagnostic"); + + const program2 = createProgram(names, {}, compilerHost, program1); + assert.isTrue(program1.structureIsReused); + const diagnostics2 = program1.getFileProcessingDiagnostics().getDiagnostics(); + assert.equal(diagnostics2.length, 1, "expected one diagnostic"); + assert.equal(diagnostics1[0].messageText, diagnostics2[0].messageText, "expected one diagnostic"); + }) + }); } \ No newline at end of file diff --git a/tests/cases/unittests/reuseProgramStructure.ts b/tests/cases/unittests/reuseProgramStructure.ts index 5f313eeae2b..61d5d56ca2c 100644 --- a/tests/cases/unittests/reuseProgramStructure.ts +++ b/tests/cases/unittests/reuseProgramStructure.ts @@ -118,13 +118,13 @@ module ts { return ""; }, getCanonicalFileName(fileName): string { - return sys.useCaseSensitiveFileNames ? fileName : fileName.toLowerCase(); + return sys && sys.useCaseSensitiveFileNames ? fileName : fileName.toLowerCase(); }, useCaseSensitiveFileNames(): boolean { - return sys.useCaseSensitiveFileNames; + return sys && sys.useCaseSensitiveFileNames; }, getNewLine(): string { - return sys.newLine; + return sys ? sys.newLine : newLine; }, fileExists: fileName => hasProperty(files, fileName), readFile: fileName => { @@ -160,36 +160,55 @@ module ts { return size; } - function checkResolvedModulesCache(program: Program, fileName: string, expectedContent: Map): void { + function checkResolvedModule(expected: ResolvedModule, actual: ResolvedModule): void { + assert.isTrue(actual !== undefined); + assert.isTrue(expected.resolvedFileName === actual.resolvedFileName, `'resolvedFileName': expected '${expected.resolvedFileName}' to be equal to '${actual.resolvedFileName}'`); + assert.isTrue(expected.isExternalLibraryImport === actual.isExternalLibraryImport, `'isExternalLibraryImport': expected '${expected.isExternalLibraryImport}' to be equal to '${actual.isExternalLibraryImport}'`); + } + + function checkResolvedTypeDirective(expected: ResolvedTypeReferenceDirective, actual: ResolvedTypeReferenceDirective): void { + assert.isTrue(actual !== undefined); + assert.isTrue(expected.resolvedFileName === actual.resolvedFileName, `'resolvedFileName': expected '${expected.resolvedFileName}' to be equal to '${actual.resolvedFileName}'`); + assert.isTrue(expected.primary === actual.primary, `'primary': expected '${expected.primary}' to be equal to '${actual.primary}'`); + } + + function checkCache(caption: string, program: Program, fileName: string, expectedContent: Map, getCache: (f: SourceFile) => Map, entryChecker: (expected: T, original:T) => void): void { let file = program.getSourceFile(fileName); assert.isTrue(file !== undefined, `cannot find file ${fileName}`); + const cache = getCache(file) if (expectedContent === undefined) { - assert.isTrue(file.resolvedModules === undefined, "expected resolvedModules to be undefined"); + assert.isTrue(cache === undefined, `expected ${caption} to be undefined`); } else { - assert.isTrue(file.resolvedModules !== undefined, "expected resolvedModuled to be set"); - let actualCacheSize = getSizeOfMap(file.resolvedModules); + assert.isTrue(cache !== undefined, `expected ${caption} to be set`); + let actualCacheSize = getSizeOfMap(cache); let expectedSize = getSizeOfMap(expectedContent); assert.isTrue(actualCacheSize === expectedSize, `expected actual size: ${actualCacheSize} to be equal to ${expectedSize}`); for (let id in expectedContent) { if (hasProperty(expectedContent, id)) { - assert.isTrue(hasProperty(file.resolvedModules, id), `expected ${id} to be found in resolved modules`); + if (expectedContent[id]) { const expected = expectedContent[id]; - const actual = file.resolvedModules[id]; - assert.isTrue(actual !== undefined); - assert.isTrue(expected.resolvedFileName === actual.resolvedFileName, `'resolvedFileName': expected '${expected.resolvedFileName}' to be equal to '${actual.resolvedFileName}'`); - assert.isTrue(expected.isExternalLibraryImport === actual.isExternalLibraryImport, `'shouldBeProperExternalModule': expected '${expected.isExternalLibraryImport}' to be equal to '${actual.isExternalLibraryImport}'`); - } - else { - assert.isTrue(file.resolvedModules[id] === undefined); + const actual = cache[id]; + entryChecker(expected, actual); } } + else { + assert.isTrue(cache[id] === undefined); + } } } } + function checkResolvedModulesCache(program: Program, fileName: string, expectedContent: Map): void { + checkCache("resolved modules", program, fileName, expectedContent, f => f.resolvedModules, checkResolvedModule); + } + + function checkResolvedTypeDirectivesCache(program: Program, fileName: string, expectedContent: Map): void { + checkCache("resolved type directives", program, fileName, expectedContent, f => f.resolvedTypeReferenceDirectiveNames, checkResolvedTypeDirective); + } + describe("Reuse program structure", () => { let target = ScriptTarget.Latest; let files = [ @@ -197,9 +216,11 @@ module ts { ` /// /// +/// `, "",`var x = 1`) }, { name: "b.ts", text: SourceText.New(`/// `, "", `var y = 2`) }, { name: "c.ts", text: SourceText.New("", "", `var z = 1;`) }, + { name: "types/typerefs/index.d.ts", text: SourceText.New("", "", `declare let z: number;`) }, ] it("successful if change does not affect imports", () => { @@ -213,6 +234,17 @@ module ts { assert.equal(program1Diagnostics.length, program2Diagnostics.length); }); + it("successful if change does not affect type reference directives", () => { + var program_1 = newProgram(files, ["a.ts"], { target }); + var program_2 = updateProgram(program_1, ["a.ts"], { target }, files => { + files[0].text = files[0].text.updateProgram("var x = 100"); + }); + assert.isTrue(program_1.structureIsReused); + let program1Diagnostics = program_1.getSemanticDiagnostics(program_1.getSourceFile("a.ts")) + let program2Diagnostics = program_2.getSemanticDiagnostics(program_1.getSourceFile("a.ts")) + assert.equal(program1Diagnostics.length, program2Diagnostics.length); + }); + it("fails if change affects tripleslash references", () => { var program_1 = newProgram(files, ["a.ts"], { target }); var program_2 = updateProgram(program_1, ["a.ts"], { target }, files => { @@ -232,11 +264,35 @@ module ts { assert.isTrue(!program_1.structureIsReused); }); + it("fails if change affects type directives", () => { + var program_1 = newProgram(files, ["a.ts"], { target }); + var program_2 = updateProgram(program_1, ["a.ts"], { target }, files => { + let newReferences = ` +/// +/// +/// `; + files[0].text = files[0].text.updateReferences(newReferences); + }); + assert.isTrue(!program_1.structureIsReused); + }); + it("fails if module kind changes", () => { var program_1 = newProgram(files, ["a.ts"], { target, module: ModuleKind.CommonJS }); var program_2 = updateProgram(program_1, ["a.ts"], { target, module: ModuleKind.AMD }, files => void 0); assert.isTrue(!program_1.structureIsReused); }); + + it("fails if rootdir changes", () => { + var program_1 = newProgram(files, ["a.ts"], { target, module: ModuleKind.CommonJS, rootDir: "/a/b" }); + var program_2 = updateProgram(program_1, ["a.ts"], { target, module: ModuleKind.CommonJS, rootDir: "/a/c" }, files => void 0); + assert.isTrue(!program_1.structureIsReused); + }); + + it("fails if config path changes", () => { + var program_1 = newProgram(files, ["a.ts"], { target, module: ModuleKind.CommonJS, configFilePath: "/a/b/tsconfig.json" }); + var program_2 = updateProgram(program_1, ["a.ts"], { target, module: ModuleKind.CommonJS, configFilePath: "/a/c/tsconfig.json" }, files => void 0); + assert.isTrue(!program_1.structureIsReused); + }); it("resolution cache follows imports", () => { let files = [ @@ -274,5 +330,49 @@ module ts { assert.isTrue(!program_3.structureIsReused); checkResolvedModulesCache(program_4, "a.ts", { "b": { resolvedFileName: "b.ts" }, "c": undefined }); }); - }) + + it("resolved type directives cache follows type directives", () => { + let files = [ + { name: "/a.ts", text: SourceText.New("/// ", "", "var x = $") }, + { name: "/types/typedefs/index.d.ts", text: SourceText.New("", "", "declare var $: number") }, + ]; + var options: CompilerOptions = { target, typesRoot: "/" }; + + var program_1 = newProgram(files, ["/a.ts"], options); + checkResolvedTypeDirectivesCache(program_1, "/a.ts", { "typedefs": { resolvedFileName: "/types/typedefs/index.d.ts", primary: true } }); + checkResolvedTypeDirectivesCache(program_1, "/types/typedefs/index.d.ts", undefined); + + var program_2 = updateProgram(program_1, ["/a.ts"], options, files => { + files[0].text = files[0].text.updateProgram("var x = 2"); + }); + assert.isTrue(program_1.structureIsReused); + + // content of resolution cache should not change + checkResolvedTypeDirectivesCache(program_1, "/a.ts", { "typedefs": { resolvedFileName: "/types/typedefs/index.d.ts", primary: true } }); + checkResolvedTypeDirectivesCache(program_1, "/types/typedefs/index.d.ts", undefined); + + // type reference directives has changed - program is not reused + var program_3 = updateProgram(program_2, ["/a.ts"], options, files => { + files[0].text = files[0].text.updateReferences(""); + }); + + assert.isTrue(!program_2.structureIsReused); + checkResolvedTypeDirectivesCache(program_3, "/a.ts", undefined); + + var program_4 = updateProgram(program_3, ["/a.ts"], options, files => { + let newReferences = `/// + /// + `; + files[0].text = files[0].text.updateReferences(newReferences); + }); + assert.isTrue(!program_3.structureIsReused); + checkResolvedTypeDirectivesCache(program_1, "/a.ts", { "typedefs": { resolvedFileName: "/types/typedefs/index.d.ts", primary: true } }); + }); + }); + + describe("host is optional", () => { + it("should work if host is not provided", () => { + createProgram([], {}); + }) + }); } \ No newline at end of file diff --git a/tests/cases/unittests/services/preProcessFile.ts b/tests/cases/unittests/services/preProcessFile.ts index a648a3c4b26..7fa25b440c5 100644 --- a/tests/cases/unittests/services/preProcessFile.ts +++ b/tests/cases/unittests/services/preProcessFile.ts @@ -9,18 +9,11 @@ describe('PreProcessFile:', function () { function test(sourceText: string, readImportFile: boolean, detectJavaScriptImports: boolean, expectedPreProcess: ts.PreProcessedFileInfo): void { var resultPreProcess = ts.preProcessFile(sourceText, readImportFile, detectJavaScriptImports); - var resultIsLibFile = resultPreProcess.isLibFile; - var resultImportedFiles = resultPreProcess.importedFiles; - var resultReferencedFiles = resultPreProcess.referencedFiles; + assert.equal(resultPreProcess.isLibFile, expectedPreProcess.isLibFile, "Pre-processed file has different value for isLibFile. Expected: " + expectedPreProcess.isLibFile + ". Actual: " + resultPreProcess.isLibFile); - var expectedIsLibFile = expectedPreProcess.isLibFile; - var expectedImportedFiles = expectedPreProcess.importedFiles; - var expectedReferencedFiles = expectedPreProcess.referencedFiles; - - assert.equal(resultIsLibFile, expectedIsLibFile, "Pre-processed file has different value for isLibFile. Expected: " + expectedPreProcess + ". Actual: " + resultIsLibFile); - - checkFileReferenceList("Imported files", expectedImportedFiles, resultImportedFiles); - checkFileReferenceList("Referenced files", expectedReferencedFiles, resultReferencedFiles); + checkFileReferenceList("Imported files", expectedPreProcess.importedFiles, resultPreProcess.importedFiles); + checkFileReferenceList("Referenced files", expectedPreProcess.referencedFiles, resultPreProcess.referencedFiles); + checkFileReferenceList("Type reference directives", expectedPreProcess.typeReferenceDirectives, resultPreProcess.typeReferenceDirectives); assert.deepEqual(resultPreProcess.ambientExternalModules, expectedPreProcess.ambientExternalModules); } @@ -52,6 +45,7 @@ describe('PreProcessFile:', function () { referencedFiles: [{ fileName: "refFile1.ts", pos: 0, end: 37 }, { fileName: "refFile2.ts", pos: 38, end: 73 }, { fileName: "refFile3.ts", pos: 74, end: 109 }, { fileName: "..\\refFile4d.ts", pos: 110, end: 150 }], importedFiles: [], + typeReferenceDirectives: [], ambientExternalModules: undefined, isLibFile: false }); @@ -64,6 +58,7 @@ describe('PreProcessFile:', function () { { referencedFiles: [], importedFiles: [], + typeReferenceDirectives: [], ambientExternalModules: undefined, isLibFile: false }); @@ -75,6 +70,7 @@ describe('PreProcessFile:', function () { /* detectJavaScriptImports */ false, { referencedFiles: [], + typeReferenceDirectives: [], importedFiles: [{ fileName: "r1.ts", pos: 20, end: 25 }, { fileName: "r2.ts", pos: 49, end: 54 }, { fileName: "r3.ts", pos: 78, end: 83 }, { fileName: "r4.ts", pos: 106, end: 111 }, { fileName: "r5.ts", pos: 138, end: 143 }], ambientExternalModules: undefined, @@ -88,6 +84,7 @@ describe('PreProcessFile:', function () { /* detectJavaScriptImports */ false, { referencedFiles: [], + typeReferenceDirectives: [], importedFiles: [], ambientExternalModules: undefined, isLibFile: false @@ -100,6 +97,7 @@ describe('PreProcessFile:', function () { /* detectJavaScriptImports */ false, { referencedFiles: [], + typeReferenceDirectives: [], importedFiles: [{ fileName: "r3.ts", pos: 73, end: 78 }], ambientExternalModules: undefined, isLibFile: false @@ -112,6 +110,7 @@ describe('PreProcessFile:', function () { /* detectJavaScriptImports */ false, { referencedFiles: [{ fileName: "refFile1.ts", pos: 0, end: 35 }, { fileName: "refFile2.ts", pos: 36, end: 71 }], + typeReferenceDirectives: [], importedFiles: [{ fileName: "r1.ts", pos: 92, end: 97 }, { fileName: "r2.ts", pos: 121, end: 126 }], ambientExternalModules: undefined, isLibFile: false @@ -124,6 +123,7 @@ describe('PreProcessFile:', function () { /* detectJavaScriptImports */ false, { referencedFiles: [{ fileName: "refFile1.ts", pos: 0, end: 35 }], + typeReferenceDirectives: [], importedFiles: [{ fileName: "r1.ts", pos: 91, end: 96 }, { fileName: "r3.ts", pos: 148, end: 153 }], ambientExternalModules: undefined, isLibFile: false @@ -142,6 +142,7 @@ describe('PreProcessFile:', function () { /* detectJavaScriptImports */ false, { referencedFiles: [], + typeReferenceDirectives: [], importedFiles: [ { fileName: "m1", pos: 20, end: 22 }, { fileName: "m2", pos: 51, end: 53 }, @@ -165,6 +166,7 @@ describe('PreProcessFile:', function () { /* detectJavaScriptImports */ false, { referencedFiles: [], + typeReferenceDirectives: [], importedFiles: [ { fileName: "m1", pos: 14, end: 16 }, { fileName: "m2", pos: 36, end: 38 }, @@ -188,6 +190,7 @@ describe('PreProcessFile:', function () { { referencedFiles: [], + typeReferenceDirectives: [], importedFiles: [], ambientExternalModules: ["B"], isLibFile: false @@ -200,6 +203,7 @@ describe('PreProcessFile:', function () { /* detectJavaScriptImports */ false, { referencedFiles: [], + typeReferenceDirectives: [], importedFiles: [ { fileName: "m1", pos: 26, end: 28 } ], @@ -218,6 +222,7 @@ describe('PreProcessFile:', function () { /* detectJavaScriptImports */ true, { referencedFiles: [], + typeReferenceDirectives: [], importedFiles: [ { fileName: "m1", pos: 39, end: 41 }, { fileName: "m2", pos: 74, end: 76 }, @@ -237,6 +242,7 @@ describe('PreProcessFile:', function () { /* detectJavaScriptImports */ true, { referencedFiles: [], + typeReferenceDirectives: [], importedFiles: [ { fileName: "mod1", pos: 21, end: 25 }, { fileName: "mod2", pos: 29, end: 33 }, @@ -254,6 +260,7 @@ describe('PreProcessFile:', function () { /* detectJavaScriptImports */ true, { referencedFiles: [], + typeReferenceDirectives: [], importedFiles: [ { fileName: "mod1", pos: 28, end: 32 }, { fileName: "mod2", pos: 36, end: 40 }, @@ -274,6 +281,7 @@ describe('PreProcessFile:', function () { /*detectJavaScriptImports*/ false, { referencedFiles: [], + typeReferenceDirectives: [], importedFiles: [ { "fileName": "../Observable", "pos": 28, "end": 41 } ], @@ -293,6 +301,7 @@ describe('PreProcessFile:', function () { /*detectJavaScriptImports*/ false, { referencedFiles: [], + typeReferenceDirectives: [], importedFiles: [ { "fileName": "m", "pos": 135, "end": 136 }, { "fileName": "../Observable", "pos": 28, "end": 41 } @@ -313,6 +322,7 @@ describe('PreProcessFile:', function () { /*detectJavaScriptImports*/ false, { referencedFiles: [], + typeReferenceDirectives: [], importedFiles: [ { "fileName": "m", "pos": 135, "end": 136 }, { "fileName": "../Observable", "pos": 28, "end": 41 } @@ -333,6 +343,7 @@ describe('PreProcessFile:', function () { /*detectJavaScriptImports*/ false, { referencedFiles: [], + typeReferenceDirectives: [], importedFiles: [ { "fileName": "../Observable", "pos": 28, "end": 41 } ], @@ -352,6 +363,7 @@ describe('PreProcessFile:', function () { /*detectJavaScriptImports*/ false, { referencedFiles: [], + typeReferenceDirectives: [], importedFiles: [ { "fileName": "../Observable", "pos": 28, "end": 41 } ], @@ -370,6 +382,7 @@ describe('PreProcessFile:', function () { /*detectJavaScriptImports*/ false, { referencedFiles: [], + typeReferenceDirectives: [], importedFiles: [ { "fileName": "../Observable", "pos": 28, "end": 41 } ], @@ -390,6 +403,7 @@ describe('PreProcessFile:', function () { /*detectJavaScriptImports*/ false, { referencedFiles: [], + typeReferenceDirectives: [], importedFiles: [ { "fileName": "m2", "pos": 65, "end": 67 }, { "fileName": "augmentation", "pos": 102, "end": 114 } @@ -413,6 +427,7 @@ describe('PreProcessFile:', function () { /*detectJavaScriptImports*/ false, { referencedFiles: [], + typeReferenceDirectives: [], importedFiles: [ { "fileName": "m2", "pos": 127, "end": 129 }, { "fileName": "augmentation", "pos": 164, "end": 176 } @@ -420,7 +435,30 @@ describe('PreProcessFile:', function () { ambientExternalModules: ["m1"], isLibFile: false }); - }); + }); + it ("correctly recognizes type reference directives", () => { + test(` + /// + /// + /// + /// + `, + /*readImportFile*/ true, + /*detectJavaScriptImports*/ false, + { + referencedFiles: [ + { "pos": 13, "end": 38, "fileName": "a" }, + { "pos": 91, "end": 117, "fileName": "a2" } + ], + typeReferenceDirectives: [ + { "pos": 51, "end": 78, "fileName": "a1" }, + { "pos": 130, "end": 157, "fileName": "a3" } + ], + importedFiles: [], + ambientExternalModules: undefined, + isLibFile: false + }); + }) }); }); diff --git a/tests/cases/unittests/session.ts b/tests/cases/unittests/session.ts index 41f4bc599f6..ee9742482cd 100644 --- a/tests/cases/unittests/session.ts +++ b/tests/cases/unittests/session.ts @@ -36,7 +36,7 @@ namespace ts.server { let lastSent: protocol.Message; beforeEach(() => { - session = new Session(mockHost, Buffer.byteLength, process.hrtime, mockLogger); + session = new Session(mockHost, Utils.byteLength, process.hrtime, mockLogger); session.send = (msg: protocol.Message) => { lastSent = msg; }; @@ -161,7 +161,7 @@ namespace ts.server { it("is an overrideable handle which sends protocol messages over the wire", () => { const msg = {seq: 0, type: "none"}; const strmsg = JSON.stringify(msg); - const len = 1 + Buffer.byteLength(strmsg, "utf8"); + const len = 1 + Utils.byteLength(strmsg, "utf8"); const resultMsg = `Content-Length: ${len}\r\n\r\n${strmsg}\n`; session.send = Session.prototype.send; @@ -253,7 +253,7 @@ namespace ts.server { lastSent: protocol.Message; customHandler = "testhandler"; constructor() { - super(mockHost, Buffer.byteLength, process.hrtime, mockLogger); + super(mockHost, Utils.byteLength, process.hrtime, mockLogger); this.addProtocolHandler(this.customHandler, () => { return {response: undefined, responseRequired: true}; }); @@ -311,7 +311,7 @@ namespace ts.server { class InProcSession extends Session { private queue: protocol.Request[] = []; constructor(private client: InProcClient) { - super(mockHost, Buffer.byteLength, process.hrtime, mockLogger); + super(mockHost, Utils.byteLength, process.hrtime, mockLogger); this.addProtocolHandler("echo", (req: protocol.Request) => ({ response: req.arguments, responseRequired: true diff --git a/tests/cases/unittests/tsconfigParsing.ts b/tests/cases/unittests/tsconfigParsing.ts index 622c3abfff2..29283acfe3c 100644 --- a/tests/cases/unittests/tsconfigParsing.ts +++ b/tests/cases/unittests/tsconfigParsing.ts @@ -13,6 +13,12 @@ namespace ts { assert.isTrue(undefined === parsed.config); assert.isTrue(undefined !== parsed.error); } + + function assertParseErrorWithExcludesKeyword(jsonText: string) { + let parsed = ts.parseConfigFileTextToJson("/apath/tsconfig.json", jsonText); + let parsedCommand = ts.parseJsonConfigFileContent(parsed, ts.sys, "tests/cases/unittests"); + assert.isTrue(undefined !== parsedCommand.errors); + } it("returns empty config for file with only whitespaces", () => { assertParseResult("", { config : {} }); @@ -102,5 +108,17 @@ namespace ts { config: { compilerOptions: { lib: "es5,es6" } } }); }); + + it("returns error when tsconfig have excludes", () => { + assertParseErrorWithExcludesKeyword( + `{ + "compilerOptions": { + "lib": "es5" + }, + "excludes": [ + "foge.ts" + ] + }`); + }); }); } diff --git a/tslint.json b/tslint.json index ad056efaa74..f789af46cea 100644 --- a/tslint.json +++ b/tslint.json @@ -38,7 +38,7 @@ "no-internal-module": true, "no-trailing-whitespace": true, "no-inferrable-types": true, - "no-null": true, + "no-null-keyword": true, "no-unused-variable": true, "boolean-trivia": true, "type-operator-spacing": true,